{"version":3,"file":"weather-DR9cttN_.js","sources":["../../src/scripts/modules/weather.ts"],"sourcesContent":["import { Component } from '@verndale/core';\nimport { ConditionalDisplay } from '../helpers/global';\n\nclass Weather extends Component {\n setupDefaults() {\n this.dom = {\n weatherBar: this.el.querySelectorAll('.v-section-weather__bar')\n };\n if (ConditionalDisplay(this.el.id)) {\n this.el.style.display = 'none';\n }\n this.updateBarValues();\n }\n\n updateBarValues() {\n (this.dom.weatherBar as NodeListOf).forEach(bar => {\n const value = bar.dataset.value?.replace(/[^0-9.-]+/g, '');\n const barFill = bar.querySelectorAll('.v-section-weather__progress-bar');\n\n if (barFill && value) {\n let valueFloat = parseFloat(value);\n const barToFills = Math.ceil(valueFloat / 10);\n\n for (let i = 0; i < barToFills; i++) {\n if (i > 9) return;\n if (valueFloat > 10) {\n (barFill[i] as HTMLElement).style.setProperty('inset-inline-end', '0%');\n valueFloat -= 10;\n } else {\n (barFill[i] as HTMLElement).style.setProperty(\n 'inset-inline-end',\n `calc(100% - ${valueFloat * 10}%`\n );\n }\n }\n }\n });\n }\n}\n\nexport default Weather;\n"],"names":["Weather","Component","ConditionalDisplay","bar","value","_a","barFill","valueFloat","barToFills","i"],"mappings":"8EAGA,MAAMA,UAAgBC,CAAU,CAC9B,eAAgB,CACd,KAAK,IAAM,CACT,WAAY,KAAK,GAAG,iBAAiB,yBAAyB,CAAA,EAE5DC,EAAmB,KAAK,GAAG,EAAE,IAC1B,KAAA,GAAG,MAAM,QAAU,QAE1B,KAAK,gBAAgB,CACvB,CAEA,iBAAkB,CACf,KAAK,IAAI,WAAuC,QAAeC,GAAA,OAC9D,MAAMC,GAAQC,EAAAF,EAAI,QAAQ,QAAZ,YAAAE,EAAmB,QAAQ,aAAc,IACjDC,EAAUH,EAAI,iBAAiB,kCAAkC,EAEvE,GAAIG,GAAWF,EAAO,CAChB,IAAAG,EAAa,WAAWH,CAAK,EACjC,MAAMI,EAAa,KAAK,KAAKD,EAAa,EAAE,EAE5C,QAASE,EAAI,EAAGA,EAAID,EAAYC,IAAK,CACnC,GAAIA,EAAI,EAAG,OACPF,EAAa,IACdD,EAAQG,CAAC,EAAkB,MAAM,YAAY,mBAAoB,IAAI,EACxDF,GAAA,IAEbD,EAAQG,CAAC,EAAkB,MAAM,YAChC,mBACA,eAAeF,EAAa,EAAE,GAAA,CAGpC,CACF,CAAA,CACD,CACH,CACF"}