UNPKG

flyonui

Version:

The easiest, free and open-source Tailwind CSS component library with semantic classes.

49 lines 268 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(self,()=>(()=>{"use strict";var e={12:function(e,t,i){ /* * HSCopyMarkup * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(806),o=s(i(287));class l extends o.default{constructor(e,t){super(e,t),this.count=0;const i=e.getAttribute("data-copy-markup"),s=i?JSON.parse(i):{},n=Object.assign(Object.assign({},s),t);this.targetSelector=(null==n?void 0:n.targetSelector)||null,this.wrapperSelector=(null==n?void 0:n.wrapperSelector)||null,this.limit=(null==n?void 0:n.limit)||null,this.items=[],this.targetSelector&&this.init()}elementClick(){this.copy()}deleteItemButtonClick(e){this.delete(e)}init(){this.createCollection(window.$hsCopyMarkupCollection,this),this.onElementClickListener=()=>this.elementClick(),this.setTarget(),this.setWrapper(),this.addPredefinedItems(),this.el.addEventListener("click",this.onElementClickListener)}copy(){if(this.limit&&this.items.length>=this.limit)return!1;this.el.hasAttribute("disabled")&&this.el.setAttribute("disabled","");const e=this.target.cloneNode(!0),t=`${this.target.id}-${this.count++}`;e.setAttribute("id",t),this.addToItems(e),this.limit&&this.items.length>=this.limit&&this.el.setAttribute("disabled","disabled"),this.fireEvent("copy",e),(0,n.dispatch)("copy.copyMarkup",e,e)}addPredefinedItems(){Array.from(this.wrapper.children).filter(e=>!e.classList.contains("[--ignore-for-count]")).forEach(e=>{this.addToItems(e)}),this.limit&&this.items.length>=this.limit&&this.el.setAttribute("disabled","disabled")}setTarget(){const e="string"==typeof this.targetSelector?document.querySelector(this.targetSelector).cloneNode(!0):this.targetSelector.cloneNode(!0);this.target=e}setWrapper(){this.wrapper="string"==typeof this.wrapperSelector?document.querySelector(this.wrapperSelector):this.wrapperSelector}addToItems(e){const t=e.querySelector("[data-copy-markup-delete-item]");this.wrapper?this.wrapper.append(e):this.el.before(e),t&&(this.onDeleteItemButtonClickListener=()=>this.deleteItemButtonClick(e),t.addEventListener("click",this.onDeleteItemButtonClickListener)),this.items.push(e)}delete(e){if(e){const t=this.items.indexOf(e);-1!==t&&this.items.splice(t,1),e.remove(),this.fireEvent("delete",e),(0,n.dispatch)("delete.copyMarkup",e,e),this.limit&&this.items.length<this.limit&&this.el.removeAttribute("disabled")}}destroy(){const e=this.wrapper.querySelectorAll("[data-copy-markup-delete-item]");this.el.removeEventListener("click",this.onElementClickListener),e.length&&e.forEach(e=>e.removeEventListener("click",this.onDeleteItemButtonClickListener)),this.el.removeAttribute("disabled"),this.target=null,this.wrapper=null,this.items=null,window.$hsCopyMarkupCollection=window.$hsCopyMarkupCollection.filter(({element:e})=>e.el!==this.el)}static getInstance(e,t){const i=window.$hsCopyMarkupCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e));return i?t?i:i.element:null}static autoInit(){window.$hsCopyMarkupCollection||(window.$hsCopyMarkupCollection=[]),window.$hsCopyMarkupCollection&&(window.$hsCopyMarkupCollection=window.$hsCopyMarkupCollection.filter(({element:e})=>document.contains(e.el))),document.querySelectorAll("[data-copy-markup]:not(.--prevent-on-load-init)").forEach(e=>{if(!window.$hsCopyMarkupCollection.find(t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e})){const t=e.getAttribute("data-copy-markup"),i=t?JSON.parse(t):{};new l(e,i)}})}}window.addEventListener("load",()=>{l.autoInit()}),"undefined"!=typeof window&&(window.HSCopyMarkup=l),t.default=l},75:function(e,t,i){ /* * HSComboBox * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))(function(n,o){function l(e){try{a(s.next(e))}catch(e){o(e)}}function r(e){try{a(s.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(l,r)}a((s=s.apply(e,t||[])).next())})},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(806),l=n(i(287)),r=n(i(294));class a extends l.default{constructor(e,t,i){var s,n,o,l,r,a,h,d,c,u,p,m,g,v,f,w,y,b,C,S,L,I,E,T,x,k,A,O,P,$,B;super(e,t,i),this.isSearchLengthExceeded=!1;const M=e.getAttribute("data-combo-box"),D=M?JSON.parse(M):{},N=Object.assign(Object.assign({},D),t);this.gap=6,this.viewport=null!==(s="string"==typeof(null==N?void 0:N.viewport)?document.querySelector(null==N?void 0:N.viewport):null==N?void 0:N.viewport)&&void 0!==s?s:null,this.preventVisibility=null!==(n=null==N?void 0:N.preventVisibility)&&void 0!==n&&n,this.minSearchLength=null!==(o=null==N?void 0:N.minSearchLength)&&void 0!==o?o:0,this.apiUrl=null!==(l=null==N?void 0:N.apiUrl)&&void 0!==l?l:null,this.apiDataPart=null!==(r=null==N?void 0:N.apiDataPart)&&void 0!==r?r:null,this.apiQuery=null!==(a=null==N?void 0:N.apiQuery)&&void 0!==a?a:null,this.apiSearchQuery=null!==(h=null==N?void 0:N.apiSearchQuery)&&void 0!==h?h:null,this.apiSearchPath=null!==(d=null==N?void 0:N.apiSearchPath)&&void 0!==d?d:null,this.apiSearchDefaultPath=null!==(c=null==N?void 0:N.apiSearchDefaultPath)&&void 0!==c?c:null,this.apiHeaders=null!==(u=null==N?void 0:N.apiHeaders)&&void 0!==u?u:{},this.apiGroupField=null!==(p=null==N?void 0:N.apiGroupField)&&void 0!==p?p:null,this.outputItemTemplate=null!==(m=null==N?void 0:N.outputItemTemplate)&&void 0!==m?m:'<div class="dropdown-item combo-box-selected:dropdown-active" data-combo-box-output-item>\n\t\t\t\t<div class="flex justify-between items-center w-full">\n\t\t\t\t\t<span data-combo-box-search-text></span>\n\t\t\t\t\t<span class="hidden combo-box-selected:block">\n <svg class="shrink-0 size-4 text-primary" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m5 12l5 5L20 7"/></svg>\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</div>',this.outputEmptyTemplate=null!==(g=null==N?void 0:N.outputEmptyTemplate)&&void 0!==g?g:'<div class="dropdown-item">Nothing found...</div>',this.outputLoaderTemplate=null!==(v=null==N?void 0:N.outputLoaderTemplate)&&void 0!==v?v:'<span class="loading loading-spinner text-primary"></span>',this.groupingType=null!==(f=null==N?void 0:N.groupingType)&&void 0!==f?f:null,this.groupingTitleTemplate=null!==(w=null==N?void 0:N.groupingTitleTemplate)&&void 0!==w?w:"default"===this.groupingType?'<div class="block mb-1 text-xs font-semibold uppercase text-primary"></div>':'<button type="button" class="btn btn-soft btn-primary"></button>',this.tabsWrapperTemplate=null!==(y=null==N?void 0:N.tabsWrapperTemplate)&&void 0!==y?y:'<div class="overflow-x-auto p-4"></div>',this.preventSelection=null!==(b=null==N?void 0:N.preventSelection)&&void 0!==b&&b,this.preventAutoPosition=null!==(C=null==N?void 0:N.preventAutoPosition)&&void 0!==C&&C,this.preventClientFiltering=null!==(S=null==t?void 0:t.preventClientFiltering)&&void 0!==S?S:!!(null==N?void 0:N.apiSearchQuery)||!!(null==N?void 0:N.apiSearchPath),this.isOpenOnFocus=null!==(L=null==N?void 0:N.isOpenOnFocus)&&void 0!==L&&L,this.keepOriginalOrder=null!==(I=null==N?void 0:N.keepOriginalOrder)&&void 0!==I&&I,this.preserveSelectionOnEmpty=null===(E=null==N?void 0:N.preserveSelectionOnEmpty)||void 0===E||E,this.input=null!==(T=this.el.querySelector("[data-combo-box-input]"))&&void 0!==T?T:null,this.output=null!==(x=this.el.querySelector("[data-combo-box-output]"))&&void 0!==x?x:null,this.itemsWrapper=null!==(k=this.el.querySelector("[data-combo-box-output-items-wrapper]"))&&void 0!==k?k:null,this.items=null!==(A=Array.from(this.el.querySelectorAll("[data-combo-box-output-item]")))&&void 0!==A?A:[],this.tabs=[],this.toggle=null!==(O=this.el.querySelector("[data-combo-box-toggle]"))&&void 0!==O?O:null,this.toggleClose=null!==(P=this.el.querySelector("[data-combo-box-close]"))&&void 0!==P?P:null,this.toggleOpen=null!==($=this.el.querySelector("[data-combo-box-open]"))&&void 0!==$?$:null,this.outputPlaceholder=null,this.selected=this.value=null!==(B=this.el.querySelector("[data-combo-box-input]").value)&&void 0!==B?B:"",this.currentData=null,this.isOpened=!1,this.isCurrent=!1,this.animationInProcess=!1,this.selectedGroup="all",this.init()}inputFocus(){this.isOpened||(this.setResultAndRender(),this.open())}inputInput(e){const t=e.target.value.trim();t.length<=this.minSearchLength?this.setResultAndRender(""):this.setResultAndRender(t),this.preserveSelectionOnEmpty||""!==t||(this.selected="",this.value="",this.currentData=null),""!==this.input.value?this.el.classList.add("has-value"):this.el.classList.remove("has-value"),this.isOpened||this.open()}toggleClick(){this.isOpened?this.close():this.open(this.toggle.getAttribute("data-combo-box-toggle"))}toggleCloseClick(){this.close()}toggleOpenClick(){this.open()}init(){this.createCollection(window.$hsComboBoxCollection,this),this.build(),"undefined"!=typeof window&&(window.HSAccessibilityObserver||(window.HSAccessibilityObserver=new r.default),this.setupAccessibility())}build(){this.buildInput(),this.groupingType&&this.setGroups(),this.buildItems(),this.preventVisibility&&(this.preventAutoPosition||this.recalculateDirection()),this.toggle&&this.buildToggle(),this.toggleClose&&this.buildToggleClose(),this.toggleOpen&&this.buildToggleOpen()}getNestedProperty(e,t){return t.split(".").reduce((e,t)=>e&&e[t],e)}setValue(e,t=null){this.selected=e,this.value=e,this.input.value=e,t&&(this.currentData=t),this.fireEvent("select",this.currentData),(0,o.dispatch)("select.combobox",this.el,this.currentData)}setValueAndOpen(e){this.value=e,this.items.length&&this.setItemsVisibility()}setValueAndClear(e,t=null){e?this.setValue(e,t):this.setValue(this.selected,t),this.outputPlaceholder&&this.destroyOutputPlaceholder()}setSelectedByValue(e){this.items.forEach(t=>{const i=t.querySelector("[data-combo-box-value]");i&&e.includes(i.textContent)?t.classList.add("selected"):t.classList.remove("selected")})}setResultAndRender(e=""){let t=this.preventVisibility?this.input.value:e;this.setResults(t),(this.apiSearchQuery||this.apiSearchPath||this.apiSearchDefaultPath)&&this.itemsFromJson(),this.isSearchLengthExceeded=""===t,this.updatePlaceholderVisibility()}setResults(e){this.value=e,this.resultItems(),this.updatePlaceholderVisibility()}updatePlaceholderVisibility(){this.hasVisibleItems()?this.destroyOutputPlaceholder():this.buildOutputPlaceholder()}setGroups(){const e=[];this.items.forEach(t=>{const{group:i}=JSON.parse(t.getAttribute("data-combo-box-output-item"));e.some(e=>(null==e?void 0:e.name)===i.name)||e.push(i)}),this.groups=e}setApiGroups(e){const t=[];e.forEach(e=>{const i=e[this.apiGroupField];t.some(e=>e.name===i)||t.push({name:i,title:i})}),this.groups=t}setItemsVisibility(){if(this.preventClientFiltering)return this.items.forEach(e=>{e.style.display=""}),!1;"tabs"===this.groupingType&&"all"!==this.selectedGroup&&this.items.forEach(e=>{e.style.display="none"});const e="tabs"===this.groupingType?"all"===this.selectedGroup?this.items:this.items.filter(e=>{const{group:t}=JSON.parse(e.getAttribute("data-combo-box-output-item"));return t.name===this.selectedGroup}):this.items;"tabs"===this.groupingType&&"all"!==this.selectedGroup&&e.forEach(e=>{e.style.display="block"}),e.forEach(e=>{this.isTextExistsAny(e,this.value)?e.style.display="block":e.style.display="none"}),"default"===this.groupingType&&this.output.querySelectorAll("[data-combo-box-group-title]").forEach(e=>{const t=e.getAttribute("data-combo-box-group-title");this.items.filter(e=>{const{group:i}=JSON.parse(e.getAttribute("data-combo-box-output-item"));return i.name===t&&"block"===e.style.display}).length?e.style.display="block":e.style.display="none"})}isTextExistsAny(e,t){return Array.from(e.querySelectorAll("[data-combo-box-search-text]")).some(e=>e.getAttribute("data-combo-box-search-text").toLowerCase().includes(t.toLowerCase()))}hasVisibleItems(){return!!this.items.length&&this.items.some(e=>{const t=window.getComputedStyle(e);return"none"!==t.display&&"hidden"!==t.visibility})}valuesBySelector(e){return Array.from(e.querySelectorAll("[data-combo-box-search-text]")).reduce((e,t)=>[...e,t.getAttribute("data-combo-box-search-text")],[])}sortItems(){if(this.keepOriginalOrder)return this.items;return this.items.sort((e,t)=>{const i=e.querySelector("[data-combo-box-value]").textContent,s=t.querySelector("[data-combo-box-value]").textContent;return i<s?-1:i>s?1:0})}buildInput(){this.isOpenOnFocus&&(this.onInputFocusListener=()=>this.inputFocus(),this.input.addEventListener("focus",this.onInputFocusListener)),this.onInputInputListener=(0,o.debounce)(e=>this.inputInput(e)),this.input.addEventListener("input",this.onInputInputListener)}buildItems(){return s(this,void 0,void 0,function*(){this.output.role="listbox",this.output.tabIndex=-1,this.output.ariaOrientation="vertical",this.apiUrl?yield this.itemsFromJson():(this.itemsWrapper?this.itemsWrapper.innerHTML="":this.output.innerHTML="",this.itemsFromHtml()),(null==this?void 0:this.items.length)&&this.items[0].classList.contains("selected")&&(this.currentData=JSON.parse(this.items[0].getAttribute("data-combo-box-item-stored-data")))})}buildOutputLoader(){if(this.outputLoader)return!1;this.outputLoader=(0,o.htmlToElement)(this.outputLoaderTemplate),this.items.length||this.outputPlaceholder?(this.outputLoader.style.position="absolute",this.outputLoader.style.top="0",this.outputLoader.style.bottom="0",this.outputLoader.style.left="0",this.outputLoader.style.right="0",this.outputLoader.style.zIndex="2"):(this.outputLoader.style.position="",this.outputLoader.style.top="",this.outputLoader.style.bottom="",this.outputLoader.style.left="",this.outputLoader.style.right="",this.outputLoader.style.zIndex="",this.outputLoader.style.height="30px"),this.output.append(this.outputLoader)}buildToggle(){var e,t,i,s;this.isOpened?((null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.toggle.ariaExpanded="true"),(null===(t=null==this?void 0:this.input)||void 0===t?void 0:t.ariaExpanded)&&(this.input.ariaExpanded="true")):((null===(i=null==this?void 0:this.toggle)||void 0===i?void 0:i.ariaExpanded)&&(this.toggle.ariaExpanded="false"),(null===(s=null==this?void 0:this.input)||void 0===s?void 0:s.ariaExpanded)&&(this.input.ariaExpanded="false")),this.onToggleClickListener=()=>this.toggleClick(),this.toggle.addEventListener("click",this.onToggleClickListener)}buildToggleClose(){this.onToggleCloseClickListener=()=>this.toggleCloseClick(),this.toggleClose.addEventListener("click",this.onToggleCloseClickListener)}buildToggleOpen(){this.onToggleOpenClickListener=()=>this.toggleOpenClick(),this.toggleOpen.addEventListener("click",this.onToggleOpenClickListener)}buildOutputPlaceholder(){this.outputPlaceholder||(this.outputPlaceholder=(0,o.htmlToElement)(this.outputEmptyTemplate)),this.appendItemsToWrapper(this.outputPlaceholder)}destroyOutputLoader(){this.outputLoader&&this.outputLoader.remove(),this.outputLoader=null}itemRender(e){var t;const i=e.querySelector("[data-combo-box-value]").textContent,s=null!==(t=JSON.parse(e.getAttribute("data-combo-box-item-stored-data")))&&void 0!==t?t:null;this.itemsWrapper?this.itemsWrapper.append(e):this.output.append(e),this.preventSelection||e.addEventListener("click",()=>{this.close(i,s),this.setSelectedByValue(this.valuesBySelector(e))})}plainRender(e){e.forEach(e=>{this.itemRender(e)})}jsonItemsRender(e){e.forEach((e,t)=>{const i=(0,o.htmlToElement)(this.outputItemTemplate);i.setAttribute("data-combo-box-item-stored-data",JSON.stringify(e)),i.querySelectorAll("[data-combo-box-output-item-field]").forEach(t=>{const i=t.getAttribute("data-combo-box-output-item-field");let s="";try{const t=JSON.parse(i);s=Array.isArray(t)?t.map(t=>this.getNestedProperty(e,t)).filter(Boolean).join(" "):this.getNestedProperty(e,i)}catch(t){s=this.getNestedProperty(e,i)}t.textContent=null!=s?s:"",!s&&t.hasAttribute("data-combo-box-output-item-hide-if-empty")&&(t.style.display="none")}),i.querySelectorAll("[data-combo-box-search-text]").forEach(t=>{const i=t.getAttribute("data-combo-box-output-item-field");let s="";try{const t=JSON.parse(i);s=Array.isArray(t)?t.map(t=>this.getNestedProperty(e,t)).filter(Boolean).join(" "):this.getNestedProperty(e,i)}catch(t){s=this.getNestedProperty(e,i)}t.setAttribute("data-combo-box-search-text",null!=s?s:"")}),i.querySelectorAll("[data-combo-box-output-item-attr]").forEach(t=>{JSON.parse(t.getAttribute("data-combo-box-output-item-attr")).forEach(i=>{let s=e[i.valueFrom];"class"===i.attr&&t.className?t.className=`${t.className} ${s}`.trim():t.setAttribute(i.attr,s)})}),i.setAttribute("tabIndex",`${t}`),"tabs"!==this.groupingType&&"default"!==this.groupingType||i.setAttribute("data-combo-box-output-item",`{"group": {"name": "${e[this.apiGroupField]}", "title": "${e[this.apiGroupField]}"}}`),this.items=[...this.items,i],this.preventSelection||i.addEventListener("click",()=>{this.close(i.querySelector("[data-combo-box-value]").textContent,JSON.parse(i.getAttribute("data-combo-box-item-stored-data"))),this.setSelectedByValue(this.valuesBySelector(i))}),this.appendItemsToWrapper(i)})}groupDefaultRender(){this.groups.forEach(e=>{const t=(0,o.htmlToElement)(this.groupingTitleTemplate);t.setAttribute("data-combo-box-group-title",e.name),t.classList.add("--exclude-accessibility"),t.innerText=e.title,this.itemsWrapper?this.itemsWrapper.append(t):this.output.append(t);const i=this.sortItems().filter(t=>{const{group:i}=JSON.parse(t.getAttribute("data-combo-box-output-item"));return i.name===e.name});this.plainRender(i)})}groupTabsRender(){const e=(0,o.htmlToElement)(this.tabsWrapperTemplate),t=(0,o.htmlToElement)('<div class="flex flex-nowrap gap-x-2"></div>');e.append(t),this.output.insertBefore(e,this.output.firstChild);const i=(0,o.htmlToElement)(this.groupingTitleTemplate);i.setAttribute("data-combo-box-group-title","all"),i.classList.add("--exclude-accessibility","active"),i.innerText="All",this.tabs=[...this.tabs,i],t.append(i),i.addEventListener("click",()=>{this.selectedGroup="all";const e=this.tabs.find(e=>e.getAttribute("data-combo-box-group-title")===this.selectedGroup);this.tabs.forEach(e=>e.classList.remove("active")),e.classList.add("active"),this.setItemsVisibility()}),this.groups.forEach(e=>{const i=(0,o.htmlToElement)(this.groupingTitleTemplate);i.setAttribute("data-combo-box-group-title",e.name),i.classList.add("--exclude-accessibility"),i.innerText=e.title,this.tabs=[...this.tabs,i],t.append(i),i.addEventListener("click",()=>{this.selectedGroup=e.name;const t=this.tabs.find(e=>e.getAttribute("data-combo-box-group-title")===this.selectedGroup);this.tabs.forEach(e=>e.classList.remove("active")),t.classList.add("active"),this.setItemsVisibility()})})}itemsFromHtml(){if("default"===this.groupingType)this.groupDefaultRender();else if("tabs"===this.groupingType){const e=this.sortItems();this.groupTabsRender(),this.plainRender(e)}else{const e=this.sortItems();this.plainRender(e)}this.setResults(this.input.value)}itemsFromJson(){return s(this,void 0,void 0,function*(){if(this.isSearchLengthExceeded)return this.buildOutputPlaceholder(),!1;this.buildOutputLoader();try{const e=`${this.apiQuery}`;let t,i,s=this.apiUrl;!this.apiSearchQuery&&this.apiSearchPath?(i=this.apiSearchDefaultPath&&""===this.value?`/${this.apiSearchDefaultPath}`:`/${this.apiSearchPath}/${this.value.toLowerCase()}`,(this.apiSearchPath||this.apiSearchDefaultPath)&&(s+=i)):(t=`${this.apiSearchQuery}=${this.value.toLowerCase()}`,this.apiQuery&&this.apiSearchQuery?s+=`?${t}&${e}`:this.apiQuery?s+=`?${e}`:this.apiSearchQuery&&(s+=`?${t}`));const n=yield fetch(s,this.apiHeaders);if(!n.ok)return this.items=[],this.itemsWrapper?this.itemsWrapper.innerHTML="":this.output.innerHTML="",void this.setResults(this.input.value);let l=yield n.json();this.apiDataPart&&(l=l[this.apiDataPart]),Array.isArray(l)||(l=[]),(this.apiSearchQuery||this.apiSearchPath)&&(this.items=[]),this.itemsWrapper?this.itemsWrapper.innerHTML="":this.output.innerHTML="","tabs"===this.groupingType?(this.setApiGroups(l),this.groupTabsRender(),this.jsonItemsRender(l)):"default"===this.groupingType?(this.setApiGroups(l),this.groups.forEach(e=>{const t=(0,o.htmlToElement)(this.groupingTitleTemplate);t.setAttribute("data-combo-box-group-title",e.name),t.classList.add("--exclude-accessibility"),t.innerText=e.title;const i=l.filter(t=>t[this.apiGroupField]===e.name);this.itemsWrapper?this.itemsWrapper.append(t):this.output.append(t),this.jsonItemsRender(i)})):this.jsonItemsRender(l),this.setResults(this.input.value.length<=this.minSearchLength?"":this.input.value),this.updatePlaceholderVisibility()}catch(e){console.error("Error fetching items:",e),this.items=[],this.itemsWrapper?this.itemsWrapper.innerHTML="":this.output.innerHTML="",this.setResults(this.input.value)}finally{this.destroyOutputLoader()}})}appendItemsToWrapper(e){this.itemsWrapper?this.itemsWrapper.append(e):this.output.append(e)}resultItems(){if(!this.items.length)return!1;this.setItemsVisibility(),this.setSelectedByValue([this.selected])}destroyOutputPlaceholder(){this.outputPlaceholder&&this.outputPlaceholder.remove(),this.outputPlaceholder=null}getPreparedItems(e=!1,t){if(!t)return null;return(e?Array.from(t.querySelectorAll(":scope > *:not(.--exclude-accessibility)")).filter(e=>"none"!==e.style.display).reverse():Array.from(t.querySelectorAll(":scope > *:not(.--exclude-accessibility)")).filter(e=>"none"!==e.style.display)).filter(e=>!e.classList.contains("disabled"))}setHighlighted(e,t,i){t.focus(),i.value=t.querySelector("[data-combo-box-value]").getAttribute("data-combo-box-search-text"),e&&e.classList.remove("combo-box-output-item-highlighted"),t.classList.add("combo-box-output-item-highlighted")}setupAccessibility(){var e;const t=null!==(e=this.itemsWrapper)&&void 0!==e?e:this.output;this.accessibilityComponent=window.HSAccessibilityObserver.registerComponent(this.el,{onEnter:()=>this.onEnter(),onSpace:()=>this.onEnter(),onEsc:()=>{this.isOpened&&(this.close(),this.input&&this.input.focus())},onArrow:e=>{if(this.isOpened||"ArrowDown"!==e.key){if(this.isOpened)switch(e.key){case"ArrowDown":this.focusMenuItem("next");break;case"ArrowUp":this.focusMenuItem("prev");break;case"Home":this.onStartEnd(!0);break;case"End":this.onStartEnd(!1)}}else this.open()}},this.isOpened,"ComboBox","[data-combo-box]",t)}onEnter(){var e,t,i;if(this.isOpened){const s=this.output.querySelector(".combo-box-output-item-highlighted");s&&(this.close(null!==(t=null===(e=s.querySelector("[data-combo-box-value]"))||void 0===e?void 0:e.getAttribute("data-combo-box-search-text"))&&void 0!==t?t:null,null!==(i=JSON.parse(s.getAttribute("data-combo-box-item-stored-data")))&&void 0!==i?i:null),this.input&&this.input.focus())}else this.open()}focusMenuItem(e){var t;const i=null!==(t=this.itemsWrapper)&&void 0!==t?t:this.output;if(!i)return!1;const s=Array.from(i.querySelectorAll(":scope > *:not(.--exclude-accessibility)")).filter(e=>"none"!==e.style.display);if(!s.length)return!1;const n=i.querySelector(".combo-box-output-item-highlighted"),o=n?s.indexOf(n):-1,l="next"===e?(o+1)%s.length:(o-1+s.length)%s.length;n&&n.classList.remove("combo-box-output-item-highlighted"),s[l].classList.add("combo-box-output-item-highlighted"),s[l].focus(),this.input.value=s[l].querySelector("[data-combo-box-value]").getAttribute("data-combo-box-search-text")}onStartEnd(e=!0){var t;const i=null!==(t=this.itemsWrapper)&&void 0!==t?t:this.output;if(!i)return!1;const s=Array.from(i.querySelectorAll(":scope > *:not(.--exclude-accessibility)")).filter(e=>"none"!==e.style.display);if(!s.length)return!1;const n=i.querySelector(".combo-box-output-item-highlighted");this.setHighlighted(n,s[0],this.input)}getCurrentData(){return this.currentData}setCurrent(){window.$hsComboBoxCollection.length&&(window.$hsComboBoxCollection.map(e=>e.element.isCurrent=!1),this.isCurrent=!0)}open(e){return!this.animationInProcess&&(void 0!==e&&this.setValueAndOpen(e),!this.preventVisibility&&(this.animationInProcess=!0,this.output.style.display="block",this.preventAutoPosition||this.recalculateDirection(),setTimeout(()=>{var e,t;(null===(e=null==this?void 0:this.input)||void 0===e?void 0:e.ariaExpanded)&&(this.input.ariaExpanded="true"),(null===(t=null==this?void 0:this.toggle)||void 0===t?void 0:t.ariaExpanded)&&(this.toggle.ariaExpanded="true"),this.el.classList.add("active"),this.animationInProcess=!1}),this.isOpened=!0,void(window.HSAccessibilityObserver&&this.accessibilityComponent&&window.HSAccessibilityObserver.updateComponentState(this.accessibilityComponent,!0))))}close(e,t=null){var i,s;return!this.animationInProcess&&(this.preventVisibility?(this.setValueAndClear(e,t),""!==this.input.value?this.el.classList.add("has-value"):this.el.classList.remove("has-value"),!1):(this.preserveSelectionOnEmpty||""!==this.input.value.trim()||(this.selected="",this.value=""),this.animationInProcess=!0,(null===(i=null==this?void 0:this.input)||void 0===i?void 0:i.ariaExpanded)&&(this.input.ariaExpanded="false"),(null===(s=null==this?void 0:this.toggle)||void 0===s?void 0:s.ariaExpanded)&&(this.toggle.ariaExpanded="false"),this.el.classList.remove("active"),this.preventAutoPosition||(this.output.classList.remove("bottom-full","top-full"),this.output.style.marginTop="",this.output.style.marginBottom=""),(0,o.afterTransition)(this.output,()=>{this.output.style.display="none",this.setValueAndClear(e,t||null),this.animationInProcess=!1}),""!==this.input.value?this.el.classList.add("has-value"):this.el.classList.remove("has-value"),this.isOpened=!1,void(window.HSAccessibilityObserver&&this.accessibilityComponent&&window.HSAccessibilityObserver.updateComponentState(this.accessibilityComponent,!1))))}recalculateDirection(){(0,o.isEnoughSpace)(this.output,this.input,"bottom",this.gap,this.viewport)?(this.output.classList.remove("bottom-full"),this.output.style.marginBottom="",this.output.classList.add("top-full"),this.output.style.marginTop=`${this.gap}px`):(this.output.classList.remove("top-full"),this.output.style.marginTop="",this.output.classList.add("bottom-full"),this.output.style.marginBottom=`${this.gap}px`)}destroy(){this.input.removeEventListener("focus",this.onInputFocusListener),this.input.removeEventListener("input",this.onInputInputListener),this.toggle.removeEventListener("click",this.onToggleClickListener),this.toggleClose&&this.toggleClose.removeEventListener("click",this.onToggleCloseClickListener),this.toggleOpen&&this.toggleOpen.removeEventListener("click",this.onToggleOpenClickListener),this.el.classList.remove("has-value","active"),this.items.length&&this.items.forEach(e=>{e.classList.remove("selected"),e.style.display=""}),this.output.removeAttribute("role"),this.output.removeAttribute("tabindex"),this.output.removeAttribute("aria-orientation"),this.outputLoader&&(this.outputLoader.remove(),this.outputLoader=null),this.outputPlaceholder&&(this.outputPlaceholder.remove(),this.outputPlaceholder=null),this.apiUrl&&(this.output.innerHTML=""),this.items=[],"undefined"!=typeof window&&window.HSAccessibilityObserver&&window.HSAccessibilityObserver.unregisterComponent(this.accessibilityComponent),window.$hsComboBoxCollection=window.$hsComboBoxCollection.filter(({element:e})=>e.el!==this.el)}static getInstance(e,t){const i=window.$hsComboBoxCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e));return i?t?i:i.element:null}static autoInit(){window.$hsComboBoxCollection||(window.$hsComboBoxCollection=[],window.addEventListener("click",e=>{const t=e.target;a.closeCurrentlyOpened(t)})),window.$hsComboBoxCollection&&(window.$hsComboBoxCollection=window.$hsComboBoxCollection.filter(({element:e})=>document.contains(e.el))),document.querySelectorAll("[data-combo-box]:not(.--prevent-on-load-init)").forEach(e=>{if(!window.$hsComboBoxCollection.find(t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e})){const t=e.getAttribute("data-combo-box"),i=t?JSON.parse(t):{};new a(e,i)}})}static close(e){const t=window.$hsComboBoxCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e));t&&t.element.isOpened&&t.element.close()}static closeCurrentlyOpened(e=null){if(!e.closest("[data-combo-box].active")){const e=window.$hsComboBoxCollection.filter(e=>e.element.isOpened)||null;e&&e.forEach(e=>{e.element.close()})}}}window.addEventListener("load",()=>{a.autoInit()}),document.addEventListener("scroll",()=>{if(!window.$hsComboBoxCollection)return!1;const e=window.$hsComboBoxCollection.find(e=>e.element.isOpened);e&&!e.element.preventAutoPosition&&e.element.recalculateDirection()}),"undefined"!=typeof window&&(window.HSComboBox=a),t.default=a},86:function(e,t,i){ /* * HSInputNumber * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(806),o=s(i(287));class l extends o.default{constructor(e,t){super(e,t),this.input=this.el.querySelector("[data-input-number-input]")||null,this.increment=this.el.querySelector("[data-input-number-increment]")||null,this.decrement=this.el.querySelector("[data-input-number-decrement]")||null,this.input&&this.checkIsNumberAndConvert();const i=this.el.dataset.inputNumber,s=i?JSON.parse(i):{step:1},n=Object.assign(Object.assign({},s),t);this.minInputValue="min"in n?n.min:0,this.maxInputValue="max"in n?n.max:null,this.step="step"in n&&n.step>0?n.step:1,this.init()}inputInput(){this.changeValue()}incrementClick(){this.changeValue("increment")}decrementClick(){this.changeValue("decrement")}init(){this.createCollection(window.$hsInputNumberCollection,this),this.input&&this.increment&&this.build()}checkIsNumberAndConvert(){const e=this.input.value.trim(),t=this.cleanAndExtractNumber(e);null!==t?(this.inputValue=t,this.input.value=t.toString()):(this.inputValue=0,this.input.value="0")}cleanAndExtractNumber(e){const t=[];let i=!1;e.split("").forEach(e=>{e>="0"&&e<="9"?t.push(e):"."!==e||i||(t.push(e),i=!0)});const s=t.join(""),n=parseFloat(s);return isNaN(n)?null:n}build(){this.input&&this.buildInput(),this.increment&&this.buildIncrement(),this.decrement&&this.buildDecrement(),this.inputValue<=this.minInputValue&&(this.inputValue=this.minInputValue,this.input.value=`${this.minInputValue}`),this.inputValue<=this.minInputValue&&this.changeValue(),this.input.hasAttribute("disabled")&&this.disableButtons()}buildInput(){this.onInputInputListener=()=>this.inputInput(),this.input.addEventListener("input",this.onInputInputListener)}buildIncrement(){this.onIncrementClickListener=()=>this.incrementClick(),this.increment.addEventListener("click",this.onIncrementClickListener)}buildDecrement(){this.onDecrementClickListener=()=>this.decrementClick(),this.decrement.addEventListener("click",this.onDecrementClickListener)}changeValue(e="none"){var t,i;const s={inputValue:this.inputValue},o=null!==(t=this.minInputValue)&&void 0!==t?t:Number.MIN_SAFE_INTEGER,l=null!==(i=this.maxInputValue)&&void 0!==i?i:Number.MAX_SAFE_INTEGER;switch(this.inputValue=isNaN(this.inputValue)?0:this.inputValue,e){case"increment":const e=this.inputValue+this.step;this.inputValue=e>=o&&e<=l?e:l,this.input.value=this.inputValue.toString();break;case"decrement":const t=this.inputValue-this.step;this.inputValue=t>=o&&t<=l?t:o,this.input.value=this.inputValue.toString();break;default:const i=isNaN(parseInt(this.input.value))?0:parseInt(this.input.value);this.inputValue=i>=l?l:i<=o?o:i,this.inputValue<=o&&(this.input.value=this.inputValue.toString())}s.inputValue=this.inputValue,this.inputValue===o?(this.el.classList.add("disabled"),this.decrement&&this.disableButtons("decrement")):(this.el.classList.remove("disabled"),this.decrement&&this.enableButtons("decrement")),this.inputValue===l?(this.el.classList.add("disabled"),this.increment&&this.disableButtons("increment")):(this.el.classList.remove("disabled"),this.increment&&this.enableButtons("increment")),this.fireEvent("change",s),(0,n.dispatch)("change.inputNumber",this.el,s)}disableButtons(e="all"){"all"===e?("BUTTON"!==this.increment.tagName&&"INPUT"!==this.increment.tagName||this.increment.setAttribute("disabled","disabled"),"BUTTON"!==this.decrement.tagName&&"INPUT"!==this.decrement.tagName||this.decrement.setAttribute("disabled","disabled")):"increment"===e?"BUTTON"!==this.increment.tagName&&"INPUT"!==this.increment.tagName||this.increment.setAttribute("disabled","disabled"):"decrement"===e&&("BUTTON"!==this.decrement.tagName&&"INPUT"!==this.decrement.tagName||this.decrement.setAttribute("disabled","disabled"))}enableButtons(e="all"){"all"===e?("BUTTON"!==this.increment.tagName&&"INPUT"!==this.increment.tagName||this.increment.removeAttribute("disabled"),"BUTTON"!==this.decrement.tagName&&"INPUT"!==this.decrement.tagName||this.decrement.removeAttribute("disabled")):"increment"===e?"BUTTON"!==this.increment.tagName&&"INPUT"!==this.increment.tagName||this.increment.removeAttribute("disabled"):"decrement"===e&&("BUTTON"!==this.decrement.tagName&&"INPUT"!==this.decrement.tagName||this.decrement.removeAttribute("disabled"))}destroy(){this.el.classList.remove("disabled"),this.increment.removeAttribute("disabled"),this.decrement.removeAttribute("disabled"),this.input.removeEventListener("input",this.onInputInputListener),this.increment.removeEventListener("click",this.onIncrementClickListener),this.decrement.removeEventListener("click",this.onDecrementClickListener),window.$hsInputNumberCollection=window.$hsInputNumberCollection.filter(({element:e})=>e.el!==this.el)}static getInstance(e,t){const i=window.$hsInputNumberCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e));return i?t?i:i.element:null}static autoInit(){window.$hsInputNumberCollection||(window.$hsInputNumberCollection=[]),window.$hsInputNumberCollection&&(window.$hsInputNumberCollection=window.$hsInputNumberCollection.filter(({element:e})=>document.contains(e.el))),document.querySelectorAll("[data-input-number]:not(.--prevent-on-load-init)").forEach(e=>{window.$hsInputNumberCollection.find(t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e})||new l(e)})}}window.addEventListener("load",()=>{l.autoInit()}),"undefined"!=typeof window&&(window.HSInputNumber=l),t.default=l},113:function(e,t,i){ /* * HSRemoveElement * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(806),o=s(i(287));class l extends o.default{constructor(e,t){super(e,t);const i=e.getAttribute("data-remove-element-options"),s=i?JSON.parse(i):{},n=Object.assign(Object.assign({},s),t);this.removeTargetId=this.el.getAttribute("data-remove-element"),this.removeTarget=document.querySelector(this.removeTargetId),this.removeTargetAnimationClass=(null==n?void 0:n.removeTargetAnimationClass)||"removing",this.removeTarget&&this.init()}elementClick(){this.remove()}init(){this.createCollection(window.$hsRemoveElementCollection,this),this.onElementClickListener=()=>this.elementClick(),this.el.addEventListener("click",this.onElementClickListener)}remove(){if(!this.removeTarget)return!1;this.removeTarget.classList.add(this.removeTargetAnimationClass),(0,n.afterTransition)(this.removeTarget,()=>setTimeout(()=>this.removeTarget.remove()))}destroy(){this.removeTarget.classList.remove(this.removeTargetAnimationClass),this.el.removeEventListener("click",this.onElementClickListener),window.$hsRemoveElementCollection=window.$hsRemoveElementCollection.filter(({element:e})=>e.el!==this.el)}static getInstance(e,t){const i=window.$hsRemoveElementCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e)||t.element.el===("string"==typeof e?document.querySelector(e):e));return i?t?i:i.element.el:null}static autoInit(){window.$hsRemoveElementCollection||(window.$hsRemoveElementCollection=[]),window.$hsRemoveElementCollection&&(window.$hsRemoveElementCollection=window.$hsRemoveElementCollection.filter(({element:e})=>document.contains(e.el))),document.querySelectorAll("[data-remove-element]:not(.--prevent-on-load-init)").forEach(e=>{window.$hsRemoveElementCollection.find(t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e})||new l(e)})}}window.addEventListener("load",()=>{l.autoInit()}),"undefined"!=typeof window&&(window.HSRemoveElement=l),t.default=l},126:function(e,t,i){ /* * HSToggleCount * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(i(287));class o extends n.default{constructor(e,t){super(e,t);const i=e.getAttribute("data-toggle-count"),s=i?JSON.parse(i):{},n=Object.assign(Object.assign({},s),t);this.target=(null==n?void 0:n.target)?"string"==typeof(null==n?void 0:n.target)?document.querySelector(n.target):n.target:null,this.min=(null==n?void 0:n.min)||0,this.max=(null==n?void 0:n.max)||0,this.duration=(null==n?void 0:n.duration)||700,this.isChecked=this.target.checked||!1,this.target&&this.init()}toggleChange(){this.isChecked=!this.isChecked,this.toggle()}init(){this.createCollection(window.$hsToggleCountCollection,this),this.isChecked&&(this.el.innerText=String(this.max)),this.onToggleChangeListener=()=>this.toggleChange(),this.target.addEventListener("change",this.onToggleChangeListener)}toggle(){this.isChecked?this.countUp():this.countDown()}animate(e,t){let i=0;const s=n=>{i||(i=n);const o=Math.min((n-i)/this.duration,1);this.el.innerText=String(Math.floor(o*(t-e)+e)),o<1&&window.requestAnimationFrame(s)};window.requestAnimationFrame(s)}countUp(){this.animate(this.min,this.max)}countDown(){this.animate(this.max,this.min)}destroy(){this.target.removeEventListener("change",this.onToggleChangeListener),window.$hsToggleCountCollection=window.$hsToggleCountCollection.filter(({element:e})=>e.el!==this.el)}static getInstance(e,t){const i=window.$hsToggleCountCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e));return i?t?i:i.element:null}static autoInit(){window.$hsToggleCountCollection||(window.$hsToggleCountCollection=[]),window.$hsToggleCountCollection&&(window.$hsToggleCountCollection=window.$hsToggleCountCollection.filter(({element:e})=>document.contains(e.el))),document.querySelectorAll("[data-toggle-count]:not(.--prevent-on-load-init)").forEach(e=>{window.$hsToggleCountCollection.find(t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e})||new o(e)})}}window.addEventListener("load",()=>{o.autoInit()}),"undefined"!=typeof window&&(window.HSToggleCount=o),t.default=o},164:function(e,t,i){ /* * HSOverlay * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(806),o=i(917),l=s(i(287)),r=s(i(294));class a extends l.default{constructor(e,t,i){var s,l,r,a,h,d;super(e,t,i),this.lastFocusedToggle=null,this.initialZIndex=0,this.toggleButtons=Array.from(document.querySelectorAll(`[data-overlay="#${this.el.id}"]`));const c=this.collectToggleParameters(this.toggleButtons);this.toggleMinifierButtons=Array.from(document.querySelectorAll(`[data-overlay-minifier="#${this.el.id}"]`));const u=e.getAttribute("data-overlay-options"),p=u?JSON.parse(u):{},m=Object.assign(Object.assign(Object.assign({},p),c),t);this.hiddenClass=(null==m?void 0:m.hiddenClass)||"hidden",this.emulateScrollbarSpace=(null==m?void 0:m.emulateScrollbarSpace)||!1,this.isClosePrev=null===(s=null==m?void 0:m.isClosePrev)||void 0===s||s,this.backdropClasses=null!==(l=null==m?void 0:m.backdropClasses)&&void 0!==l?l:"overlay-backdrop transition duration-300 fixed inset-0 bg-base-300/60 overflow-y-auto",this.backdropParent="string"==typeof m.backdropParent?document.querySelector(m.backdropParent):document.body,this.backdropExtraClasses=null!==(r=null==m?void 0:m.backdropExtraClasses)&&void 0!==r?r:"",this.moveOverlayToBody=(null==m?void 0:m.moveOverlayToBody)||null,this.openNextOverlay=!1,this.autoHide=null,this.initContainer=(null===(a=this.el)||void 0===a?void 0:a.parentElement)||null,this.isCloseWhenClickInside=(0,n.stringToBoolean)((0,n.getClassProperty)(this.el,"--close-when-click-inside","false")||"false"),this.isTabAccessibilityLimited=(0,n.stringToBoolean)((0,n.getClassProperty)(this.el,"--tab-accessibility-limited","true")||"true"),this.isLayoutAffect=(0,n.stringToBoolean)((0,n.getClassProperty)(this.el,"--is-layout-affect","false")||"false"),this.hasAutofocus=(0,n.stringToBoolean)((0,n.getClassProperty)(this.el,"--has-autofocus","true")||"true"),this.hasDynamicZIndex=(0,n.stringToBoolean)((0,n.getClassProperty)(this.el,"--has-dynamic-z-index","false")||"false"),this.hasAbilityToCloseOnBackdropClick=(0,n.stringToBoolean)(this.el.getAttribute("data-overlay-keyboard")||"true");const g=(0,n.getClassProperty)(this.el,"--auto-close"),v=(0,n.getClassProperty)(this.el,"--auto-close-equality-type"),f=(0,n.getClassProperty)(this.el,"--opened");this.autoClose=!isNaN(+g)&&isFinite(+g)?+g:o.BREAKPOINTS[g]||null,this.autoCloseEqualityType=null!==(h=v)&&void 0!==h?h:null,this.openedBreakpoint=(!isNaN(+f)&&isFinite(+f)?+f:o.BREAKPOINTS[f])||null,this.animationTarget=(null===(d=null==this?void 0:this.el)||void 0===d?void 0:d.querySelector(".overlay-animation-target"))||this.el,this.initialZIndex=parseInt(getComputedStyle(this.el).zIndex,10),this.onElementClickListener=[],this.onElementMinifierClickListener=[],this.initiallyOpened=document.body.classList.contains("overlay-body-open"),this.init()}elementClick(){const e=()=>{const e={el:this.el,isOpened:!!this.el.classList.contains("open")};this.fireEvent("toggleClicked",e),(0,n.dispatch)("toggleClicked.overlay",this.el,e)};this.el.classList.contains("opened")?this.close(!1,e):this.open(e)}elementMinifierClick(){const e=()=>{const e={el:this.el,isMinified:!!this.el.classList.contains("minified")};this.fireEvent("toggleMinifierClicked",e),(0,n.dispatch)("toggleMinifierClicked.overlay",this.el,e)};this.el.classList.contains("minified")?this.minify(!1,e):this.minify(!0,e)}minify(e,t=null){e?(this.el.classList.add("minified"),document.body.classList.add("overlay-minified"),t&&t()):(this.el.classList.remove("minified"),document.body.classList.remove("overlay-minified"),t&&t())}overlayClick(e){e.target.id&&`#${e.target.id}`===this.el.id&&this.isCloseWhenClickInside&&this.hasAbilityToCloseOnBackdropClick&&this.close()}backdropClick(){this.close()}init(){if(this.createCollection(window.$hsOverlayCollection,this),this.isLayoutAffect&&this.openedBreakpoint){const e=a.getInstance(this.el,!0);a.setOpened(this.openedBreakpoint,e)}this.onOverlayClickListener=e=>this.overlayClick(e),this.el.addEventListener("click",this.onOverlayClickListener),this.toggleButtons.length&&this.buildToggleButtons(this.toggleButtons),this.toggleMinifierButtons.length&&this.buildToggleMinifierButtons(),"undefined"!=typeof window&&(window.HSAccessibilityObserver||(window.HSAccessibilityObserver=new r.default),this.setupAccessibility())}buildToggleButtons(e){e.forEach(e=>{this.el.classList.contains("opened")?e.ariaExpanded="true":e.ariaExpanded="false",this.onElementClickListener.push({el:e,fn:()=>this.elementClick()}),e.addEventListener("click",this.onElementClickListener.find(t=>t.el===e).fn)})}buildToggleMinifierButtons(){this.toggleMinifierButtons.forEach(e=>{this.el.classList.contains("minified")?e.ariaExpanded="true":e.ariaExpanded="false",this.onElementMinifierClickListener.push({el:e,fn:()=>this.elementMinifierClick()}),e.addEventListener("click",this.onElementMinifierClickListener.find(t=>t.el===e).fn)})}hideAuto(){const e=parseInt((0,n.getClassProperty)(this.el,"--auto-hide","0"));e&&(this.autoHide=setTimeout(()=>{this.close()},e))}checkTimer(){this.autoHide&&(clearTimeout(this.autoHide),this.autoHide=null)}buildBackdrop(){const e=this.el.classList.value.split(" "),t=parseInt(window.getComputedStyle(this.el).getPropertyValue("z-index")),i=this.el.getAttribute("data-overlay-backdrop-container")||!1;this.backdrop=document.createElement("div");let s=`${this.backdropClasses} ${this.backdropExtraClasses}`;const o="static"!==(0,n.getClassProperty)(this.el,"--overlay-backdrop","true"),l="false"===(0,n.getClassProperty)(this.el,"--overlay-backdrop","true");this.backdrop.id=`${this.el.id}-backdrop`,"style"in this.backdrop&&(this.backdrop.style.zIndex=""+(t-1));for(const t of e)(t.startsWith("overlay-backdrop-open:")||t.includes(":overlay-backdrop-open:"))&&(s+=` ${t}`);l||(i&&(this.backdrop=document.querySelector(i).cloneNode(!0),this.backdrop.classList.remove("hidden"),s=`${this.backdrop.classList.toString()}`,this.backdrop.classList.value=""),o&&(this.onBackdropClickListener=()=>this.backdropClick(),this.backdrop.addEventListener("click",this.onBackdropClickListener,!0)),this.backdrop.setAttribute("data-overlay-backdrop-template",""),this.backdropParent.appendChild(this.backdrop),setTimeout(()=>{this.backdrop.classList.value=s}))}destroyBackdrop(){const e=document.querySelector(`#${this.el.id}-backdrop`);e&&(this.openNextOverlay&&(e.style.transitionDuration=1.8*parseFloat(window.getComputedStyle(e).transitionDuration.replace(/[^\d.-]/g,""))+"s"),e.classList.add("opacity-0"),(0,n.afterTransition)(e,()=>{e.remove()}))}focusElement(){const e=this.el.querySelector("[autofocus]");if(!e)return!1;e.focus()}getScrollbarSize(){let e=document.createElement("div");e.style.overflow="scroll",e.style.width="100px",e.style.height="100px",document.body.appendChild(e);let t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}collectToggleParameters(e){let t={};return e.forEach(e=>{const i=e.getAttribute("data-overlay-options"),s=i?JSON.parse(i):{};t=Object.assign(Object.assign({},t),s)}),t}isElementVisible(){const e=window.getComputedStyle(this.el);if("none"===e.display||"hidden"===e.visibility||"0"===e.opacity)return!1;const t=this.el.getBoundingClientRect();if(0===t.width||0===t.height)return!1;let i=this.el.parentElement;for(;i;){const e=window.getComputedStyle(i);if("none"===e.display||"hidden"===e.visibility||"0"===e.opacity)return!1;i=i.parentElement}return!0}isOpened(){return this.el.classList.contains("open")&&!this.el.classList.contains(this.hiddenClass)}open(e=null){this.el.classList.contains("minified")&&this.minify(!1),this.hasDynamicZIndex&&(a.currentZIndex<this.initialZIndex&&(a.currentZIndex=this.initialZIndex),a.currentZIndex++,this.el.style.zIndex=`${a.currentZIndex}`);const t=document.querySelectorAll(".overlay.open"),i=window.$hsOverlayCollection.find(e=>Array.from(t).includes(e.element.el)&&!e.element.isLayoutAffect),s=document.querySelectorAll(`[data-overlay="#${this.el.id}"]`),o="true"!==(0,n.getClassProperty)(this.el,"--body-scroll","false");if(this.lastFocusedToggle=document.activeElement,this.isClosePrev&&i)return this.openNextOverlay=!0,i.element.close().then(()=>{this.open(),this.openNextOverlay=!1});o&&(document.body.style.overflow="hidden",this.emulateScrollbarSpace&&(document.body.style.paddingRight=`${this.getScrollbarSize()}px`)),this.buildBackdrop(),this.checkTimer(),this.hideAuto(),s.forEach(e=>{e.ariaExpanded&&(e.ariaExpanded="true")}),this.el.classList.remove(this.hiddenClass),this.el.setAttribute("aria-overlay","true"),this.el.setAttribute("tabindex","-1"),setTimeout(()=>{if(this.el.classList.contains("opened"))return!1;this.el.classList.add("open","opened"),this.isLayoutAffect&&document.body.classList.add("overlay-body-open"),this.initiallyOpened||(this.el.focus(),this.el.style.outline="none"),this.initiallyOpened=!1,this.fireEvent("open",this.el),(0,n.dispatch)("open.overlay",this.el,this.el),window.HSAccessibilityObserver&&this.accessibilityComponent&&window.HSAccessibilityObserver.updateComponentState(this.accessibilityComponent,!0),this.hasAutofocus&&this.focusElement(),"function"==typeof e&&e(),this.isElementVisible()&&a.openedItemsQty++},50)}close(e=!1,t=null){this.isElementVisible()&&(a.openedItemsQty=a.openedItemsQty<=0?0:a.openedItemsQty-1),0===a.openedItemsQty&&this.isLayoutAffect&&document.body.classList.remove("overlay-body-open");const i=e=>{if(this.el.classList.contains("open"))return!1;document.querySelectorAll(`[data-overlay="#${this.el.id}"]`).forEach(e=>{e.ariaExpanded&&(e.ariaExpanded="false")}),this.el.classList.add(this.hiddenClass),this.hasDynamicZIndex&&(this.el.style.zIndex=""),this.destroyBackdrop(),this.fireEvent("close",this.el),(0,n.dispatch)("close.overlay",this.el,this.el),window.HSAccessibilityObserver&&this.accessibilityComponent&&window.HSAccessibilityObserver.updateComponentState(this.accessibilityComponent,!1),document.querySelector(".overlay.opened")||(do