window.customElements.define("joomla-field-fancy-select",class extends HTMLElement{get allowCustom(){return this.hasAttribute("allow-custom")}get remoteSearch(){return this.hasAttribute("remote-search")}get url(){return this.getAttribute("url")}get termKey(){return this.getAttribute("term-key")||"term"}get minTermLength(){return parseInt(this.getAttribute("min-term-length"),10)||1}get newItemPrefix(){return this.getAttribute("new-item-prefix")||""}get placeholder(){return this.getAttribute("placeholder")}get searchPlaceholder(){return this.getAttribute("search-placeholder")}get value(){return this.choicesInstance.getValue(!0)}set value(e){this.choicesInstance.setChoiceByValue(e)}constructor(){if(super(),this.keyCode={ENTER:13},!Joomla)throw new Error("Joomla API is not properly initiated");if(!window.Choices)throw new Error("JoomlaFieldFancySelect requires Choices.js to work");this.choicesCache={},this.activeXHR=null,this.choicesInstance=null,this.isDisconnected=!1}connectedCallback(){if(window.Choices||"complete"===document.readyState)this.doConnect();else{const e=()=>{this.doConnect(),window.removeEventListener("load",e)};window.addEventListener("load",e)}}doConnect(){if(this.select=this.querySelector("select"),!this.select)throw new Error("JoomlaFieldFancySelect requires