{"version":3,"file":"select_controller-D68J6dVR.js","sources":["../../../app/frontend/entrypoints/controllers/select_controller.js"],"sourcesContent":["import { Controller } from '@hotwired/stimulus';\nimport TomSelect from 'tom-select';\n\nexport default class extends Controller {\n connect() {\n this.initializeTomSelect();\n document.addEventListener('turbo:load', this.initializeTomSelect);\n }\n\n disconnect() {\n document.removeEventListener('turbo:load', this.initializeTomSelect);\n }\n\n initializeTomSelect = () => {\n console.log('Initializing Tom Select...');\n // Make sure to guard against initializing Tom Select multiple times\n if (!this.hasInitialized) {\n const selectElements = document.querySelectorAll('.tom-select-initialized');\n selectElements.forEach((element) => {\n if (!element._tomSelect) {\n new TomSelect(element, {\n // options\n });\n }\n });\n this.hasInitialized = true; // Prevent multiple initializations\n }\n };\n}\n"],"names":["SelectController","Controller","__publicField","element","TomSelect"],"mappings":"6QAGe,MAAKA,UAASC,CAAW,CAAzB,kCAUbC,EAAA,2BAAsB,IAAM,CAC1B,QAAQ,IAAI,4BAA4B,EAEnC,KAAK,iBACe,SAAS,iBAAiB,yBAAyB,EAC3D,QAASC,GAAY,CAC7BA,EAAQ,YACX,IAAIC,EAAUD,EAAS,CAEjC,CAAW,CAEX,CAAO,EACD,KAAK,eAAiB,GAEzB,GAvBD,SAAU,CACR,KAAK,oBAAqB,EAC1B,SAAS,iBAAiB,aAAc,KAAK,mBAAmB,CACpE,CAEE,YAAa,CACX,SAAS,oBAAoB,aAAc,KAAK,mBAAmB,CACvE,CAiBA"}