{ "version": 3, "sources": ["toggler_controller-169bf112.js"], "sourcesContent": ["import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [ \"checkbox\", \"toggler\", \"trueOption\", \"falseOption\" ]\n static classes = [ \"hidden\", \"active\", \"true\", \"false\" ]\n\n checkboxTargetConnected() {\n this.updateVisualState()\n this.swapInitialVisibility()\n\n const self = this\n this.checkboxTarget.addEventListener(\"change\", () => self.updateVisualState())\n }\n\n swapInitialVisibility() {\n this.checkboxTarget.classList.add(this.hiddenClass)\n this.togglerTarget.classList.remove(this.hiddenClass)\n }\n\n addVisualActivation(target) {\n target.classList.add(this.activeClass)\n\n const valueClass = target === this.trueOptionTarget ? this.trueClass : this.falseClass\n target.classList.add(valueClass)\n }\n\n removeVisualActivation(target) {\n target.classList.remove(this.activeClass)\n\n const valueClass = target === this.trueOptionTarget ? this.trueClass : this.falseClass\n target.classList.remove(valueClass)\n }\n\n setTrue() {\n if (!this.checkboxTarget.checked) {\n this.checkboxTarget.click()\n }\n }\n\n setFalse() {\n if (this.checkboxTarget.checked) {\n this.checkboxTarget.click()\n }\n }\n\n updateVisualState() {\n if (this.checkboxTarget.checked) {\n this.removeVisualActivation(this.falseOptionTarget)\n this.addVisualActivation(this.trueOptionTarget)\n } else {\n this.removeVisualActivation(this.trueOptionTarget)\n this.addVisualActivation(this.falseOptionTarget)\n }\n }\n}"], "mappings": "wKAAA,gDAEA,qBAAO,SAAsB,EAAW,CAItC,yBAA0B,CACxB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAE3B,KAAM,GAAO,KACb,KAAK,eAAe,iBAAiB,SAAU,IAAM,EAAK,kBAAkB,CAAC,CAC/E,CAEA,uBAAwB,CACtB,KAAK,eAAe,UAAU,IAAI,KAAK,WAAW,EAClD,KAAK,cAAc,UAAU,OAAO,KAAK,WAAW,CACtD,CAEA,oBAAoB,EAAQ,CAC1B,EAAO,UAAU,IAAI,KAAK,WAAW,EAErC,KAAM,GAAa,IAAW,KAAK,iBAAmB,KAAK,UAAY,KAAK,WAC5E,EAAO,UAAU,IAAI,CAAU,CACjC,CAEA,uBAAuB,EAAQ,CAC7B,EAAO,UAAU,OAAO,KAAK,WAAW,EAExC,KAAM,GAAa,IAAW,KAAK,iBAAmB,KAAK,UAAY,KAAK,WAC5E,EAAO,UAAU,OAAO,CAAU,CACpC,CAEA,SAAU,CACR,AAAK,KAAK,eAAe,SACvB,KAAK,eAAe,MAAM,CAE9B,CAEA,UAAW,CACT,AAAI,KAAK,eAAe,SACtB,KAAK,eAAe,MAAM,CAE9B,CAEA,mBAAoB,CAClB,AAAI,KAAK,eAAe,QACtB,MAAK,uBAAuB,KAAK,iBAAiB,EAClD,KAAK,oBAAoB,KAAK,gBAAgB,GAE9C,MAAK,uBAAuB,KAAK,gBAAgB,EACjD,KAAK,oBAAoB,KAAK,iBAAiB,EAEnD,CACF,CAnDS,EADT,EACS,UAAU,CAAE,WAAY,UAAW,aAAc,aAAc,GAC/D,EAFT,EAES,UAAU,CAAE,SAAU,SAAU,OAAQ,OAAQ", "names": [] }