1import{C as r}from"./app-BXezEdO3.js";class a extends r{visitSelect=null;choiceSelections=null;refreshEndpoint="";fetchChoicesController=null;async run(){this.bind(),this.setListeners()}bind(){this.visitSelect=this.element.querySelector('select[name="book_workshop_form[visit]"]'),this.choiceSelections=this.element.querySelectorAll("select[data-dynamic-choice]"),this.refreshEndpoint=this.element.dataset?.refreshEndpoint}setListeners(){this.visitSelect?.addEventListener("change",()=>{this.updateChoices(this.visitSelect.value)})}async updateChoices(o){if(o&&this.choiceSelections.length>0){this.fetchChoicesController?.abort(),this.fetchChoicesController=new AbortController;const i=this.refreshEndpoint.replace("_VISIT_TIMEFRAME_",o),s=await(await fetch(i,{signal:this.fetchChoicesController.signal})).json();if(s.records){const n=Object.entries(s.records).map(([e,t])=>({value:e,label:t}));Array.from(this.choiceSelections).forEach(e=>{const t=e.value?Number(e.value):0;e.app["custom-select"]?.updateItems(n),t in s.records&&(e.value=t.toString())})}}}}export{a as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.