{"version":3,"file":"homepage-CYR_ZTRU.js","sources":["../../../app/frontend/homepage/controllers/calculator_controller.js","../../../app/frontend/homepage/controllers/easter_controller.js","../../../app/frontend/homepage/controllers/slider_controller.js","../../../app/frontend/homepage/controllers/tabs_controller.js","../../../app/frontend/homepage/controllers/index.js"],"sourcesContent":["import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['clubs', 'income', 'result']\n static values = {\n club: {\n type: Number,\n default: 50\n },\n income: {\n type: Number,\n default: 2500\n },\n operatingMargin: {\n type: Number,\n default: 15\n },\n total: {\n Number,\n default: 18750\n }\n }\n\n connect () {\n this.setInitialValues()\n }\n\n setInitialValues () {\n this.resultTarget.textContent = this.formatter(this.totalValue)\n }\n\n calculate (event) {\n const { type, value } = event.detail\n\n if (type === 'club') {\n this.clubValue = value\n } else if (type === 'income') {\n this.incomeValue = value\n }\n\n this.totalValue = this.clubValue * this.incomeValue * this.operatingMarginValue / 100\n this.resultTarget.textContent = this.formatter(this.totalValue)\n\n if (this.totalValue >= (this.clubsTarget.max * this.incomeTarget.max * this.operatingMarginValue / 100)) {\n this.dispatchEasterEvent()\n }\n }\n\n formatter (value) {\n return new Intl.NumberFormat('fr-FR',\n {\n style: 'currency',\n currency: 'EUR',\n minimumFractionDigits: 0\n }).format(\n value\n )\n }\n\n dispatchEasterEvent () {\n const event = new window.CustomEvent('easter')\n window.dispatchEvent(event)\n }\n}\n","import { Controller } from '@hotwired/stimulus'\nimport confetti from 'https://esm.run/canvas-confetti@1'\n\nexport default class extends Controller {\n burst () {\n confetti({\n angle: this.randomInRange(55, 125),\n spread: this.randomInRange(50, 70),\n particleCount: this.randomInRange(50, 100),\n origin: { y: 0.6 },\n colors: ['#CE4A49']\n })\n }\n\n randomInRange (min, max) {\n return Math.random() * (max - min) + min\n }\n}\n","import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['glow', 'result', 'slider']\n static values = {\n base: {\n type: Number\n },\n default: Number,\n type: String\n }\n\n connect () {\n this.setInitialValues()\n this.updateResult()\n this.updateBackground()\n }\n\n update () {\n this.updateResult()\n this.updateBaseValue()\n this.updateBackground()\n this.dispatchSliderEvent()\n }\n\n setInitialValues () {\n this.sliderTarget.value = this.defaultValue || this.sliderTarget.value\n this.updateBaseValue()\n }\n\n updateResult () {\n this.resultTarget.textContent = this.typeValue === 'income' ? this.formatter(this.sliderTarget.value) : this.sliderTarget.value\n }\n\n updateBaseValue () {\n this.baseValue = (this.sliderTarget.value - this.sliderTarget.min) / (this.sliderTarget.max - this.sliderTarget.min) * 100\n }\n\n updateBackground () {\n this.sliderTarget.style.background = `linear-gradient(to right, #CE4A49 0%, #CE4A49 ${this.baseValue}%, #F2F4F5 ${this.baseValue}%, #F2F4F5 100%)`\n this.glowTarget.style.width = this.baseValue > 50 ? `calc(${this.baseValue}% - 1%)` : `${this.baseValue}%`\n }\n\n dispatchSliderEvent () {\n const event = new window.CustomEvent('slider', {\n detail: {\n type: this.typeValue,\n value: this.sliderTarget.value\n }\n })\n window.dispatchEvent(event)\n }\n\n formatter (value) {\n return new Intl.NumberFormat('fr-FR',\n {\n style: 'currency',\n currency: 'EUR',\n minimumFractionDigits: 0\n }).format(\n value\n )\n }\n}\n","import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['panel', 'tab']\n static values = {\n activeTab: { type: String, default: '0' }\n }\n\n connect () {\n this.setTabActive()\n this.setPanelVisibility()\n }\n\n showTab (event) {\n const tab = event.currentTarget\n this.activeTabValue = tab.getAttribute('index')\n this.setTabActive()\n this.setPanelVisibility()\n }\n\n setTabActive () {\n this.tabTargets.forEach(tab => {\n const isActive = tab.getAttribute('index') === this.activeTabValue\n tab.setAttribute('aria-selected', isActive)\n tab.classList.toggle('active', isActive)\n })\n }\n\n setPanelVisibility () {\n this.panelTargets.forEach(panel => {\n const isActive = panel.getAttribute('index') === this.activeTabValue\n panel.setAttribute('aria-hidden', !isActive)\n panel.classList.toggle('hidden', !isActive)\n })\n }\n}\n","import { Application } from '@hotwired/stimulus'\nimport { registerControllers } from 'stimulus-vite-helpers'\n\nconst app = Application.start()\n\nconst controllers = import.meta.glob([\n './**/*_controller.js',\n '../../common/controllers/**/*_controller.js'\n], { eager: true })\n\nregisterControllers(app, controllers)\n"],"names":["calculator_controller","Controller","event","type","value","__publicField","easter_controller","confetti","min","max","slider_controller","tabs_controller","tab","isActive","panel","app","Application","controllers","__vite_glob_0_0","__vite_glob_0_1","__vite_glob_0_2","__vite_glob_0_3","__vite_glob_0_4","__vite_glob_0_5","__vite_glob_0_6","__vite_glob_0_7","__vite_glob_0_8","__vite_glob_0_9","__vite_glob_0_10","__vite_glob_0_11","__vite_glob_0_12","__vite_glob_0_13","registerControllers"],"mappings":"kZAEe,MAAKA,UAASC,CAAW,CAqBtC,SAAW,CACT,KAAK,iBAAgB,CACzB,CAEE,kBAAoB,CAClB,KAAK,aAAa,YAAc,KAAK,UAAU,KAAK,UAAU,CAClE,CAEE,UAAWC,EAAO,CAChB,KAAM,CAAE,KAAAC,EAAM,MAAAC,CAAO,EAAGF,EAAM,OAE1BC,IAAS,OACX,KAAK,UAAYC,EACRD,IAAS,WAClB,KAAK,YAAcC,GAGrB,KAAK,WAAa,KAAK,UAAY,KAAK,YAAc,KAAK,qBAAuB,IAClF,KAAK,aAAa,YAAc,KAAK,UAAU,KAAK,UAAU,EAE1D,KAAK,YAAe,KAAK,YAAY,IAAM,KAAK,aAAa,IAAM,KAAK,qBAAuB,KACjG,KAAK,oBAAmB,CAE9B,CAEE,UAAWA,EAAO,CAChB,OAAO,IAAI,KAAK,aAAa,QAC3B,CACE,MAAO,WACP,SAAU,MACV,sBAAuB,CACxB,CAAA,EAAE,OACHA,CACN,CACA,CAEE,qBAAuB,CACrB,MAAMF,EAAQ,IAAI,OAAO,YAAY,QAAQ,EAC7C,OAAO,cAAcA,CAAK,CAC9B,CACA,CA5DEG,EADkBL,EACX,UAAU,CAAC,QAAS,SAAU,QAAQ,GAC7CK,EAFkBL,E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