{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/components/statsBlock.ts","webpack://@verndale/toolkit/./src/js/helpers/index.ts"],"names":["StatsBlock","Component","el","randomColor","getRandomColor","debounce","callback","wait","timerId","args","darkColorPalette","lightColorPalette","background"],"mappings":"wLAGA,MAAMA,UAAmBC,WAAU,CACjC,YAAYC,EAAiB,CAC3B,MAAMA,CAAE,EAER,KAAK,oBAAoB,CAC3B,CAEA,qBAAsB,CACpB,MAAMC,G,EAAcC,MAAe,MAAM,EACzC,KAAK,GAAG,UAAU,IAAI,gBAAgBD,EAAY,MAAM,CAC1D,CACF,CAEA,QAAeH,C,sDCZR,MAAMK,EAAW,CAACC,EAAmCC,IAAiB,CAC3E,IAAIC,EAEJ,MAAO,IAAIC,IAAoB,CAC7B,aAAaD,CAAO,EACpBA,EAAU,WAAW,IAAM,CACzBF,EAAS,GAAGG,CAAI,CAClB,EAAGF,CAAI,CACT,CACF,EAOaG,EAAyC,CACpD,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,QAAS,KAAM,SAAU,EACjC,CAAE,KAAM,aAAc,KAAM,SAAU,CACxC,EAEaC,EAA0C,CACrD,CAAE,KAAM,MAAO,KAAM,SAAU,EAC/B,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,OAAQ,KAAM,SAAU,EAChC,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,QAAS,KAAM,SAAU,EACjC,CAAE,KAAM,aAAc,KAAM,SAAU,CACxC,EAEaP,EAAiB,CAC5BQ,EAA+B,UAE3BA,IAAe,QAEfD,EAAkB,KAAK,MAAM,KAAK,OAAO,EAAIA,EAAkB,MAAM,GAKvED,EAAiB,KAAK,MAAM,KAAK,OAAO,EAAIA,EAAiB,MAAM,E","file":"scripts/3005.d9b6549d8bafe7515321.js","sourcesContent":["import { Component } from '@verndale/core';\nimport { getRandomColor } from '../helpers';\n\nclass StatsBlock extends Component {\n constructor(el: HTMLElement) {\n super(el);\n\n this.generateRandomColor();\n }\n\n generateRandomColor() {\n const randomColor = getRandomColor('dark');\n this.el.classList.add(`stats-block--${randomColor.name}`);\n }\n}\n\nexport default StatsBlock;\n","// /**\n// * debounce function\n// * Delays the processing of the event\n// */\nexport const debounce = (callback: (args: unknown) => void, wait: number) => {\n let timerId: ReturnType;\n\n return (...args: [unknown]) => {\n clearTimeout(timerId);\n timerId = setTimeout(() => {\n callback(...args);\n }, wait);\n };\n};\n\ninterface IColorPalette {\n name: string;\n code: string;\n}\n\nexport const darkColorPalette: Array = [\n { name: 'orange', code: '#f47920' },\n { name: 'yellow', code: '#f4b450' },\n { name: 'green', code: '#0f9d58' },\n { name: 'light-blue', code: '#009cde' }\n];\n\nexport const lightColorPalette: Array = [\n { name: 'red', code: '#da291c' },\n { name: 'purple', code: '#492d8c' },\n { name: 'blue', code: '#2e67b2' },\n { name: 'orange', code: '#f47920' },\n { name: 'yellow', code: '#f4b450' },\n { name: 'green', code: '#0f9d58' },\n { name: 'light-blue', code: '#009cde' }\n];\n\nexport const getRandomColor = (\n background: 'light' | 'dark' = 'light'\n): IColorPalette => {\n if (background === 'light') {\n const lightRandomColor =\n lightColorPalette[Math.floor(Math.random() * lightColorPalette.length)];\n return lightRandomColor;\n }\n\n const darkRandomColor =\n darkColorPalette[Math.floor(Math.random() * darkColorPalette.length)];\n return darkRandomColor;\n};\n"],"sourceRoot":""}