@contributte/datagrid 0.0.0-20250703-ec6c039 → 0.0.0-20250703-b34b484

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
- const t=t=>{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()};class e extends EventTarget{constructor(t){super(),this.naja=t,this.selector=".ajax",this.allowedOrigins=[window.location.origin],this.handler=this.handleUI.bind(this),t.addEventListener("init",this.initialize.bind(this))}initialize(){t(()=>this.bindUI(window.document.body)),this.naja.snippetHandler.addEventListener("afterUpdate",t=>{const{snippet:e}=t.detail;this.bindUI(e)})}bindUI(t){const e=`a${this.selector}`,i=t=>{t.removeEventListener("click",this.handler),t.addEventListener("click",this.handler)};if(t.matches(e))return i(t);t.querySelectorAll(e).forEach(t=>i(t));const n=t=>{t.removeEventListener("submit",this.handler),t.addEventListener("submit",this.handler)};if(t instanceof HTMLFormElement)return n(t);t.querySelectorAll("form").forEach(t=>n(t))}handleUI(t){const e=t.currentTarget,i=this.naja.prepareOptions(),n=()=>{};if(t instanceof MouseEvent){if(t.altKey||t.ctrlKey||t.shiftKey||t.metaKey||t.button)return;return void this.clickElement(e,i,t).catch(n)}const{submitter:r}=t;(""===this.selector||e.matches(this.selector)||r?.matches(this.selector))&&this.submitForm(r??e,i,t).catch(n)}async clickElement(t,e={},i){if(t instanceof HTMLAnchorElement)return this.processInteraction(t,"GET",t.href,null,e,i);if((t instanceof HTMLInputElement||t instanceof HTMLButtonElement)&&t.form)return this.submitForm(t,e,i);throw new Error("Unsupported element in clickElement(): element must be an anchor or a submitter element attached to a form.")}async submitForm(t,e={},i){let n,r=null;if((t instanceof HTMLInputElement||t instanceof HTMLButtonElement)&&t.form)n=t.form,r=t;else{if(!(t instanceof HTMLFormElement))throw new Error("Unsupported element in submitForm(): formOrSubmitter must be either a form or a submitter element attached to a form.");n=t,r=i instanceof SubmitEvent?i.submitter:null}const s=(r?.getAttribute("formmethod")??n.getAttribute("method")??"GET").toUpperCase(),o=r?.getAttribute("formaction")??n.getAttribute("action")??window.location.pathname+window.location.search,a=new FormData(n,r);return this.processInteraction(r??n,s,o,a,e,i)}async processInteraction(t,e,i,n=null,r={},s){if(!this.dispatchEvent(new CustomEvent("interaction",{cancelable:!0,detail:{element:t,originalEvent:s,options:r}})))return s?.preventDefault(),{};if(!this.isUrlAllowed(`${i}`))throw new Error(`Cannot dispatch async request, URL is not allowed: ${i}`);return s?.preventDefault(),this.naja.makeRequest(e,i,n,r)}isUrlAllowed(t){const e=new URL(t,location.href);return"null"!==e.origin&&this.allowedOrigins.includes(e.origin)}}class i{constructor(t){this.naja=t,t.addEventListener("init",this.initialize.bind(this)),t.uiHandler.addEventListener("interaction",this.processForm.bind(this))}initialize(){t(()=>this.initForms(window.document.body)),this.naja.snippetHandler.addEventListener("afterUpdate",t=>{const{snippet:e}=t.detail;this.initForms(e)})}initForms(t){const e=this.netteForms||window.Nette;if(!e)return;if(t instanceof HTMLFormElement)return void e.initForm(t);t.querySelectorAll("form").forEach(t=>e.initForm(t))}processForm(t){const{element:e,originalEvent:i}=t.detail,n=e instanceof HTMLFormElement,r=(e instanceof HTMLInputElement||e instanceof HTMLButtonElement)&&e.form;r&&(e.form["nette-submittedBy"]=e);const s=this.netteForms||window.Nette;(n||r)&&s&&!s.validateForm(e)&&(i?.stopImmediatePropagation(),i?.preventDefault(),t.preventDefault())}}class n extends EventTarget{constructor(t){super(),this.naja=t,t.uiHandler.addEventListener("interaction",t=>{const{element:e,options:i}=t.detail;if(e.hasAttribute("data-naja-force-redirect")||e.form?.hasAttribute("data-naja-force-redirect")){const t=e.getAttribute("data-naja-force-redirect")??e.form?.getAttribute("data-naja-force-redirect");i.forceRedirect="off"!==t}}),t.addEventListener("success",t=>{const{payload:e,options:i}=t.detail;e.redirect&&(this.makeRedirect(e.redirect,i.forceRedirect??!1,i),t.stopImmediatePropagation())}),this.locationAdapter={assign:t=>window.location.assign(t)}}makeRedirect(t,e,i={}){t instanceof URL&&(t=t.href);let n=e||!this.naja.uiHandler.isUrlAllowed(t);this.dispatchEvent(new CustomEvent("redirect",{cancelable:!0,detail:{url:t,setUrl(e){t=e},isHardRedirect:n,setHardRedirect(t){n=!!t},options:i}}))&&(n?this.locationAdapter.assign(t):this.naja.makeRequest("GET",t,null,i))}}class r extends EventTarget{constructor(t){super(),this.op={replace:{updateElement(t,e){t.innerHTML=e},updateIndex:(t,e)=>e},prepend:{updateElement(t,e){t.insertAdjacentHTML("afterbegin",e)},updateIndex:(t,e)=>e+t},append:{updateElement(t,e){t.insertAdjacentHTML("beforeend",e)},updateIndex:(t,e)=>t+e}},t.addEventListener("success",t=>{const{options:e,payload:i}=t.detail;i.snippets&&this.updateSnippets(i.snippets,!1,e)})}static findSnippets(t,e=window.document){const i={};return e.querySelectorAll('[id^="snippet-"]').forEach(e=>{(t?.(e)??1)&&(i[e.id]=e.innerHTML)}),i}async updateSnippets(t,e=!1,i={}){await Promise.all(Object.keys(t).map(async n=>{const r=document.getElementById(n);r&&await this.updateSnippet(r,t[n],e,i)}))}async updateSnippet(t,e,i,n){let r=this.op.replace;!t.hasAttribute("data-naja-snippet-prepend")&&!t.hasAttribute("data-ajax-prepend")||i?!t.hasAttribute("data-naja-snippet-append")&&!t.hasAttribute("data-ajax-append")||i||(r=this.op.append):r=this.op.prepend;if(!this.dispatchEvent(new CustomEvent("beforeUpdate",{cancelable:!0,detail:{snippet:t,content:e,fromCache:i,operation:r,changeOperation(t){r=t},options:n}})))return;this.dispatchEvent(new CustomEvent("pendingUpdate",{detail:{snippet:t,content:e,fromCache:i,operation:r,options:n}}));const s="function"==typeof r?r:r.updateElement;await s(t,e),this.dispatchEvent(new CustomEvent("afterUpdate",{detail:{snippet:t,content:e,fromCache:i,operation:r,options:n}}))}}const s=Symbol();class o extends EventTarget{constructor(t){super(),this.naja=t,this.initialized=!1,this.cursor=0,this.popStateHandler=this.handlePopState.bind(this),t.addEventListener("init",this.initialize.bind(this)),t.addEventListener("before",this.saveUrl.bind(this)),t.addEventListener("before",this.saveOriginalTitle.bind(this)),t.addEventListener("before",this.replaceInitialState.bind(this)),t.addEventListener("success",this.pushNewState.bind(this)),t.redirectHandler.addEventListener("redirect",this.saveRedirectedUrl.bind(this)),t.uiHandler.addEventListener("interaction",this.configureMode.bind(this)),this.historyAdapter={replaceState:(t,e,i)=>window.history.replaceState(t,e,i),pushState:(t,e,i)=>window.history.pushState(t,e,i)}}set uiCache(t){console.warn("Naja: HistoryHandler.uiCache is deprecated, use options.snippetCache instead."),this.naja.defaultOptions.snippetCache=t}handlePopState(t){const{state:e}=t;if("naja"!==e?.source)return;const i=e.cursor-this.cursor;this.cursor=e.cursor;const n=this.naja.prepareOptions();this.dispatchEvent(new CustomEvent("restoreState",{detail:{state:e,direction:i,options:n}}))}initialize(){window.addEventListener("popstate",this.popStateHandler)}saveOriginalTitle(t){const{options:e}=t.detail;e[s]=window.document.title}saveUrl(t){const{url:e,options:i}=t.detail;i.href??=e}saveRedirectedUrl(t){const{url:e,options:i}=t.detail;i.href=e}replaceInitialState(e){const{options:i}=e.detail;!1===o.normalizeMode(i.history)||this.initialized||(t(()=>this.historyAdapter.replaceState(this.buildState(window.location.href,"replace",this.cursor,i),window.document.title,window.location.href)),this.initialized=!0)}configureMode(t){const{element:e,options:i}=t.detail;if(e.hasAttribute("data-naja-history")||e.form?.hasAttribute("data-naja-history")){const t=e.getAttribute("data-naja-history")??e.form?.getAttribute("data-naja-history");i.history=o.normalizeMode(t)}}static normalizeMode(t){return"off"!==t&&!1!==t&&("replace"!==t||"replace")}pushNewState(t){const{payload:e,options:i}=t.detail,n=o.normalizeMode(i.history);if(!1===n)return;e.postGet&&e.url&&(i.href=e.url);const r="replace"===n?"replaceState":"pushState",a="replace"===n?this.cursor:++this.cursor,l=this.buildState(i.href,n,a,i),c=window.document.title;window.document.title=i[s],this.historyAdapter[r](l,c,i.href),window.document.title=c}buildState(t,e,i,n){const r={source:"naja",cursor:i,href:t};return this.dispatchEvent(new CustomEvent("buildState",{detail:{state:r,operation:"replace"===e?"replaceState":"pushState",options:n}})),r}}class a extends EventTarget{constructor(t){super(),this.naja=t,this.currentSnippets=new Map,this.storages={off:new l(t),history:new c,session:new d},t.addEventListener("init",this.initializeIndex.bind(this)),t.snippetHandler.addEventListener("pendingUpdate",this.updateIndex.bind(this)),t.uiHandler.addEventListener("interaction",this.configureCache.bind(this)),t.historyHandler.addEventListener("buildState",this.buildHistoryState.bind(this)),t.historyHandler.addEventListener("restoreState",this.restoreHistoryState.bind(this))}resolveStorage(t){let e;return e=!0===t||void 0===t?"history":!1===t?"off":t,this.storages[e]}static shouldCacheSnippet(t){return!(t.hasAttribute("data-naja-history-nocache")||t.hasAttribute("data-history-nocache")||t.hasAttribute("data-naja-snippet-cache")&&"off"===t.getAttribute("data-naja-snippet-cache"))}initializeIndex(){t(()=>{const t=r.findSnippets(a.shouldCacheSnippet);this.currentSnippets=new Map(Object.entries(t))})}updateIndex(t){const{snippet:e,content:i,operation:n}=t.detail;if(!a.shouldCacheSnippet(e))return;const s=this.currentSnippets.get(e.id)??"",o="object"==typeof n?n.updateIndex:()=>i;this.currentSnippets.set(e.id,o(s,i));const l=a.parser.parseFromString(i,"text/html"),c=r.findSnippets(a.shouldCacheSnippet,l);for(const[t,e]of Object.entries(c))this.currentSnippets.set(t,e)}configureCache(t){const{element:e,options:i}=t.detail;if(e&&(e.hasAttribute("data-naja-snippet-cache")||e.form?.hasAttribute("data-naja-snippet-cache")||e.hasAttribute("data-naja-history-cache")||e.form?.hasAttribute("data-naja-history-cache"))){const t=e.getAttribute("data-naja-snippet-cache")??e.form?.getAttribute("data-naja-snippet-cache")??e.getAttribute("data-naja-history-cache")??e.form?.getAttribute("data-naja-history-cache");i.snippetCache=t}}buildHistoryState(t){const{state:e,options:i}=t.detail;"historyUiCache"in i&&(console.warn("Naja: options.historyUiCache is deprecated, use options.snippetCache instead."),i.snippetCache=i.historyUiCache);const n=Object.keys(r.findSnippets(a.shouldCacheSnippet)),s=Object.fromEntries(Array.from(this.currentSnippets).filter(([t])=>n.includes(t)));if(!this.dispatchEvent(new CustomEvent("store",{cancelable:!0,detail:{snippets:s,state:e,options:i}})))return;const o=this.resolveStorage(i.snippetCache);e.snippets={storage:o.type,key:o.store(s)}}restoreHistoryState(t){const{state:e,options:i}=t.detail;if(void 0===e.snippets)return;if(i.snippetCache=e.snippets.storage,!this.dispatchEvent(new CustomEvent("fetch",{cancelable:!0,detail:{state:e,options:i}})))return;const n=this.resolveStorage(i.snippetCache).fetch(e.snippets.key,e,i);null!==n&&this.dispatchEvent(new CustomEvent("restore",{cancelable:!0,detail:{snippets:n,state:e,options:i}}))&&this.naja.snippetHandler.updateSnippets(n,!0,i)}}a.parser=new DOMParser;class l{constructor(t){this.naja=t,this.type="off"}store(){return null}fetch(t,e,i){return this.naja.makeRequest("GET",e.href,null,{...i,history:!1,snippetCache:!1}),null}}class c{constructor(){this.type="history"}store(t){return t}fetch(t){return t}}class d{constructor(){this.type="session"}store(t){const e=Math.random().toString(36).substring(2,8);return window.sessionStorage.setItem(e,JSON.stringify(t)),e}fetch(t){const e=window.sessionStorage.getItem(t);return null===e?null:JSON.parse(e)}}class u{constructor(t){this.naja=t,this.loadedScripts=new Set,t.addEventListener("init",this.initialize.bind(this))}initialize(){t(()=>{document.querySelectorAll("script[data-naja-script-id]").forEach(t=>{const e=t.getAttribute("data-naja-script-id");null!==e&&""!==e&&this.loadedScripts.add(e)})}),this.naja.snippetHandler.addEventListener("afterUpdate",t=>{const{content:e}=t.detail;this.loadScripts(e)})}loadScripts(t){"string"!=typeof t?Object.keys(t).forEach(e=>{const i=t[e];this.loadScriptsInSnippet(i)}):this.loadScriptsInSnippet(t)}loadScriptsInSnippet(t){if(!/<script/i.test(t))return;u.parser.parseFromString(t,"text/html").querySelectorAll("script").forEach(t=>{const e=t.getAttribute("data-naja-script-id");if(null!==e&&""!==e&&this.loadedScripts.has(e))return;const i=window.document.createElement("script");if(i.innerHTML=t.innerHTML,t.hasAttributes())for(const e of t.attributes)i.setAttribute(e.name,e.value);window.document.head.appendChild(i).parentNode.removeChild(i),null!==e&&""!==e&&this.loadedScripts.add(e)})}}u.parser=new DOMParser;class h extends EventTarget{constructor(t,s,l,c,d,h,p){super(),this.VERSION=3,this.initialized=!1,this.extensions=[],this.defaultOptions={},this.uiHandler=new(t??e)(this),this.redirectHandler=new(s??n)(this),this.snippetHandler=new(l??r)(this),this.formsHandler=new(c??i)(this),this.historyHandler=new(d??o)(this),this.snippetCache=new(h??a)(this),this.scriptLoader=new(p??u)(this)}registerExtension(t){this.initialized&&t.initialize(this),this.extensions.push(t)}initialize(t={}){if(this.initialized)throw new Error("Cannot initialize Naja, it is already initialized.");this.defaultOptions=this.prepareOptions(t),this.extensions.forEach(t=>t.initialize(this)),this.dispatchEvent(new CustomEvent("init",{detail:{defaultOptions:this.defaultOptions}})),this.initialized=!0}prepareOptions(t){return{...this.defaultOptions,...t,fetch:{...this.defaultOptions.fetch,...t?.fetch}}}async makeRequest(t,e,i=null,n={}){"string"==typeof e&&(e=new URL(e,location.href)),n=this.prepareOptions(n);const r=new Headers(n.fetch.headers||{}),s=this.transformData(e,t,i),o=new AbortController,a=new Request(e.toString(),{credentials:"same-origin",...n.fetch,method:t,headers:r,body:s,signal:o.signal});if(a.headers.set("X-Requested-With","XMLHttpRequest"),a.headers.set("Accept","application/json"),!this.dispatchEvent(new CustomEvent("before",{cancelable:!0,detail:{request:a,method:t,url:e.toString(),data:i,options:n}})))return{};const l=window.fetch(a);let c,d;this.dispatchEvent(new CustomEvent("start",{detail:{request:a,promise:l,abortController:o,options:n}}));try{if(c=await l,!c.ok)throw new p(c);d=await c.json()}catch(t){if("AbortError"===t.name)return this.dispatchEvent(new CustomEvent("abort",{detail:{request:a,error:t,options:n}})),this.dispatchEvent(new CustomEvent("complete",{detail:{request:a,response:c,payload:void 0,error:t,options:n}})),{};throw this.dispatchEvent(new CustomEvent("error",{detail:{request:a,response:c,error:t,options:n}})),this.dispatchEvent(new CustomEvent("complete",{detail:{request:a,response:c,payload:void 0,error:t,options:n}})),t}return this.dispatchEvent(new CustomEvent("payload",{detail:{request:a,response:c,payload:d,options:n}})),this.dispatchEvent(new CustomEvent("success",{detail:{request:a,response:c,payload:d,options:n}})),this.dispatchEvent(new CustomEvent("complete",{detail:{request:a,response:c,payload:d,error:void 0,options:n}})),d}appendToQueryString(t,e,i){if(null!=i)if(Array.isArray(i)||Object.getPrototypeOf(i)===Object.prototype)for(const[n,r]of Object.entries(i))this.appendToQueryString(t,`${e}[${n}]`,r);else t.append(e,String(i))}transformData(t,e,i){const n=["GET","HEAD"].includes(e.toUpperCase());if(n&&i instanceof FormData){for(const[e,n]of i)null!=n&&t.searchParams.append(e,String(n));return null}if(null!==i&&Object.getPrototypeOf(i)===Object.prototype||Array.isArray(i)){const e=n?t.searchParams:new URLSearchParams;for(const[t,n]of Object.entries(i))this.appendToQueryString(e,t,n);return n?null:e}return i}}class p extends Error{constructor(t){const e=`HTTP ${t.status}: ${t.statusText}`;super(e),this.name=this.constructor.name,this.stack=new Error(e).stack,this.response=t}}const f=new h;function g(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}f.registerExtension(new class{constructor(){this.abortControllers=new Set}initialize(t){t.uiHandler.addEventListener("interaction",this.checkAbortable.bind(this)),t.addEventListener("init",this.onInitialize.bind(this)),t.addEventListener("start",this.saveAbortController.bind(this)),t.addEventListener("complete",this.removeAbortController.bind(this))}onInitialize(){document.addEventListener("keydown",t=>{if("Escape"===t.key&&!(t.ctrlKey||t.shiftKey||t.altKey||t.metaKey)){for(const t of this.abortControllers)t.abort();this.abortControllers.clear()}})}checkAbortable(t){const{element:e,options:i}=t.detail;(e.hasAttribute("data-naja-abort")||e.form?.hasAttribute("data-naja-abort"))&&(i.abort="off"!==(e.getAttribute("data-naja-abort")??e.form?.getAttribute("data-naja-abort")))}saveAbortController(t){const{abortController:e,options:i}=t.detail;!1!==i.abort&&(this.abortControllers.add(e),i.clearAbortExtension=()=>this.abortControllers.delete(e))}removeAbortController(t){const{options:e}=t.detail;!1!==e.abort&&e.clearAbortExtension&&e.clearAbortExtension()}}),f.registerExtension(new class{constructor(){this.abortControllers=new Map}initialize(t){t.uiHandler.addEventListener("interaction",this.checkUniqueness.bind(this)),t.addEventListener("start",this.abortPreviousRequest.bind(this)),t.addEventListener("complete",this.clearRequest.bind(this))}checkUniqueness(t){const{element:e,options:i}=t.detail;if(e.hasAttribute("data-naja-unique")??e.form?.hasAttribute("data-naja-unique")){const t=e.getAttribute("data-naja-unique")??e.form?.getAttribute("data-naja-unique");i.unique="off"!==t&&(t??"default")}}abortPreviousRequest(t){const{abortController:e,options:i}=t.detail;!1!==i.unique&&(this.abortControllers.get(i.unique??"default")?.abort(),this.abortControllers.set(i.unique??"default",e))}clearRequest(t){const{request:e,options:i}=t.detail;e.signal.aborted||!1===i.unique||this.abortControllers.delete(i.unique??"default")}});var m,v={exports:{}};
1
+ const e=e=>{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()};class t extends EventTarget{constructor(e){super(),this.naja=e,this.selector=".ajax",this.allowedOrigins=[window.location.origin],this.handler=this.handleUI.bind(this),e.addEventListener("init",this.initialize.bind(this))}initialize(){e(()=>this.bindUI(window.document.body)),this.naja.snippetHandler.addEventListener("afterUpdate",e=>{const{snippet:t}=e.detail;this.bindUI(t)})}bindUI(e){const t=`a${this.selector}`,i=e=>{e.removeEventListener("click",this.handler),e.addEventListener("click",this.handler)};if(e.matches(t))return i(e);e.querySelectorAll(t).forEach(e=>i(e));const n=e=>{e.removeEventListener("submit",this.handler),e.addEventListener("submit",this.handler)};if(e instanceof HTMLFormElement)return n(e);e.querySelectorAll("form").forEach(e=>n(e))}handleUI(e){const t=e.currentTarget,i=this.naja.prepareOptions(),n=()=>{};if(e instanceof MouseEvent){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey||e.button)return;return void this.clickElement(t,i,e).catch(n)}const{submitter:r}=e;(""===this.selector||t.matches(this.selector)||r?.matches(this.selector))&&this.submitForm(r??t,i,e).catch(n)}async clickElement(e,t={},i){if(e instanceof HTMLAnchorElement)return this.processInteraction(e,"GET",e.href,null,t,i);if((e instanceof HTMLInputElement||e instanceof HTMLButtonElement)&&e.form)return this.submitForm(e,t,i);throw new Error("Unsupported element in clickElement(): element must be an anchor or a submitter element attached to a form.")}async submitForm(e,t={},i){let n,r=null;if((e instanceof HTMLInputElement||e instanceof HTMLButtonElement)&&e.form)n=e.form,r=e;else{if(!(e instanceof HTMLFormElement))throw new Error("Unsupported element in submitForm(): formOrSubmitter must be either a form or a submitter element attached to a form.");n=e,r=i instanceof SubmitEvent?i.submitter:null}const s=(r?.getAttribute("formmethod")??n.getAttribute("method")??"GET").toUpperCase(),o=r?.getAttribute("formaction")??n.getAttribute("action")??window.location.pathname+window.location.search,a=new FormData(n,r);return this.processInteraction(r??n,s,o,a,t,i)}async processInteraction(e,t,i,n=null,r={},s){if(!this.dispatchEvent(new CustomEvent("interaction",{cancelable:!0,detail:{element:e,originalEvent:s,options:r}})))return s?.preventDefault(),{};if(!this.isUrlAllowed(`${i}`))throw new Error(`Cannot dispatch async request, URL is not allowed: ${i}`);return s?.preventDefault(),this.naja.makeRequest(t,i,n,r)}isUrlAllowed(e){const t=new URL(e,location.href);return"null"!==t.origin&&this.allowedOrigins.includes(t.origin)}}class i{constructor(e){this.naja=e,e.addEventListener("init",this.initialize.bind(this)),e.uiHandler.addEventListener("interaction",this.processForm.bind(this))}initialize(){e(()=>this.initForms(window.document.body)),this.naja.snippetHandler.addEventListener("afterUpdate",e=>{const{snippet:t}=e.detail;this.initForms(t)})}initForms(e){const t=this.netteForms||window.Nette;if(!t)return;if(e instanceof HTMLFormElement)return void t.initForm(e);e.querySelectorAll("form").forEach(e=>t.initForm(e))}processForm(e){const{element:t,originalEvent:i}=e.detail,n=t instanceof HTMLFormElement,r=(t instanceof HTMLInputElement||t instanceof HTMLButtonElement)&&t.form;r&&(t.form["nette-submittedBy"]=t);const s=this.netteForms||window.Nette;(n||r)&&s&&!s.validateForm(t)&&(i?.stopImmediatePropagation(),i?.preventDefault(),e.preventDefault())}}class n extends EventTarget{constructor(e){super(),this.naja=e,e.uiHandler.addEventListener("interaction",e=>{const{element:t,options:i}=e.detail;if(t.hasAttribute("data-naja-force-redirect")||t.form?.hasAttribute("data-naja-force-redirect")){const e=t.getAttribute("data-naja-force-redirect")??t.form?.getAttribute("data-naja-force-redirect");i.forceRedirect="off"!==e}}),e.addEventListener("success",e=>{const{payload:t,options:i}=e.detail;t.redirect&&(this.makeRedirect(t.redirect,i.forceRedirect??!1,i),e.stopImmediatePropagation())}),this.locationAdapter={assign:e=>window.location.assign(e)}}makeRedirect(e,t,i={}){e instanceof URL&&(e=e.href);let n=t||!this.naja.uiHandler.isUrlAllowed(e);this.dispatchEvent(new CustomEvent("redirect",{cancelable:!0,detail:{url:e,setUrl(t){e=t},isHardRedirect:n,setHardRedirect(e){n=!!e},options:i}}))&&(n?this.locationAdapter.assign(e):this.naja.makeRequest("GET",e,null,i))}}class r extends EventTarget{constructor(e){super(),this.op={replace:{updateElement(e,t){e.innerHTML=t},updateIndex:(e,t)=>t},prepend:{updateElement(e,t){e.insertAdjacentHTML("afterbegin",t)},updateIndex:(e,t)=>t+e},append:{updateElement(e,t){e.insertAdjacentHTML("beforeend",t)},updateIndex:(e,t)=>e+t}},e.addEventListener("success",e=>{const{options:t,payload:i}=e.detail;i.snippets&&this.updateSnippets(i.snippets,!1,t)})}static findSnippets(e,t=window.document){const i={};return t.querySelectorAll('[id^="snippet-"]').forEach(t=>{(e?.(t)??1)&&(i[t.id]=t.innerHTML)}),i}async updateSnippets(e,t=!1,i={}){await Promise.all(Object.keys(e).map(async n=>{const r=document.getElementById(n);r&&await this.updateSnippet(r,e[n],t,i)}))}async updateSnippet(e,t,i,n){let r=this.op.replace;!e.hasAttribute("data-naja-snippet-prepend")&&!e.hasAttribute("data-ajax-prepend")||i?!e.hasAttribute("data-naja-snippet-append")&&!e.hasAttribute("data-ajax-append")||i||(r=this.op.append):r=this.op.prepend;if(!this.dispatchEvent(new CustomEvent("beforeUpdate",{cancelable:!0,detail:{snippet:e,content:t,fromCache:i,operation:r,changeOperation(e){r=e},options:n}})))return;this.dispatchEvent(new CustomEvent("pendingUpdate",{detail:{snippet:e,content:t,fromCache:i,operation:r,options:n}}));const s="function"==typeof r?r:r.updateElement;await s(e,t),this.dispatchEvent(new CustomEvent("afterUpdate",{detail:{snippet:e,content:t,fromCache:i,operation:r,options:n}}))}}const s=Symbol();class o extends EventTarget{constructor(e){super(),this.naja=e,this.initialized=!1,this.cursor=0,this.popStateHandler=this.handlePopState.bind(this),e.addEventListener("init",this.initialize.bind(this)),e.addEventListener("before",this.saveUrl.bind(this)),e.addEventListener("before",this.saveOriginalTitle.bind(this)),e.addEventListener("before",this.replaceInitialState.bind(this)),e.addEventListener("success",this.pushNewState.bind(this)),e.redirectHandler.addEventListener("redirect",this.saveRedirectedUrl.bind(this)),e.uiHandler.addEventListener("interaction",this.configureMode.bind(this)),this.historyAdapter={replaceState:(e,t,i)=>window.history.replaceState(e,t,i),pushState:(e,t,i)=>window.history.pushState(e,t,i)}}set uiCache(e){console.warn("Naja: HistoryHandler.uiCache is deprecated, use options.snippetCache instead."),this.naja.defaultOptions.snippetCache=e}handlePopState(e){const{state:t}=e;if("naja"!==t?.source)return;const i=t.cursor-this.cursor;this.cursor=t.cursor;const n=this.naja.prepareOptions();this.dispatchEvent(new CustomEvent("restoreState",{detail:{state:t,direction:i,options:n}}))}initialize(){window.addEventListener("popstate",this.popStateHandler)}saveOriginalTitle(e){const{options:t}=e.detail;t[s]=window.document.title}saveUrl(e){const{url:t,options:i}=e.detail;i.href??=t}saveRedirectedUrl(e){const{url:t,options:i}=e.detail;i.href=t}replaceInitialState(t){const{options:i}=t.detail;!1===o.normalizeMode(i.history)||this.initialized||(e(()=>this.historyAdapter.replaceState(this.buildState(window.location.href,"replace",this.cursor,i),window.document.title,window.location.href)),this.initialized=!0)}configureMode(e){const{element:t,options:i}=e.detail;if(t.hasAttribute("data-naja-history")||t.form?.hasAttribute("data-naja-history")){const e=t.getAttribute("data-naja-history")??t.form?.getAttribute("data-naja-history");i.history=o.normalizeMode(e)}}static normalizeMode(e){return"off"!==e&&!1!==e&&("replace"!==e||"replace")}pushNewState(e){const{payload:t,options:i}=e.detail,n=o.normalizeMode(i.history);if(!1===n)return;t.postGet&&t.url&&(i.href=t.url);const r="replace"===n?"replaceState":"pushState",a="replace"===n?this.cursor:++this.cursor,l=this.buildState(i.href,n,a,i),c=window.document.title;window.document.title=i[s],this.historyAdapter[r](l,c,i.href),window.document.title=c}buildState(e,t,i,n){const r={source:"naja",cursor:i,href:e};return this.dispatchEvent(new CustomEvent("buildState",{detail:{state:r,operation:"replace"===t?"replaceState":"pushState",options:n}})),r}}class a extends EventTarget{constructor(e){super(),this.naja=e,this.currentSnippets=new Map,this.storages={off:new l(e),history:new c,session:new d},e.addEventListener("init",this.initializeIndex.bind(this)),e.snippetHandler.addEventListener("pendingUpdate",this.updateIndex.bind(this)),e.uiHandler.addEventListener("interaction",this.configureCache.bind(this)),e.historyHandler.addEventListener("buildState",this.buildHistoryState.bind(this)),e.historyHandler.addEventListener("restoreState",this.restoreHistoryState.bind(this))}resolveStorage(e){let t;return t=!0===e||void 0===e?"history":!1===e?"off":e,this.storages[t]}static shouldCacheSnippet(e){return!(e.hasAttribute("data-naja-history-nocache")||e.hasAttribute("data-history-nocache")||e.hasAttribute("data-naja-snippet-cache")&&"off"===e.getAttribute("data-naja-snippet-cache"))}initializeIndex(){e(()=>{const e=r.findSnippets(a.shouldCacheSnippet);this.currentSnippets=new Map(Object.entries(e))})}updateIndex(e){const{snippet:t,content:i,operation:n}=e.detail;if(!a.shouldCacheSnippet(t))return;const s=this.currentSnippets.get(t.id)??"",o="object"==typeof n?n.updateIndex:()=>i;this.currentSnippets.set(t.id,o(s,i));const l=a.parser.parseFromString(i,"text/html"),c=r.findSnippets(a.shouldCacheSnippet,l);for(const[e,t]of Object.entries(c))this.currentSnippets.set(e,t)}configureCache(e){const{element:t,options:i}=e.detail;if(t&&(t.hasAttribute("data-naja-snippet-cache")||t.form?.hasAttribute("data-naja-snippet-cache")||t.hasAttribute("data-naja-history-cache")||t.form?.hasAttribute("data-naja-history-cache"))){const e=t.getAttribute("data-naja-snippet-cache")??t.form?.getAttribute("data-naja-snippet-cache")??t.getAttribute("data-naja-history-cache")??t.form?.getAttribute("data-naja-history-cache");i.snippetCache=e}}buildHistoryState(e){const{state:t,options:i}=e.detail;"historyUiCache"in i&&(console.warn("Naja: options.historyUiCache is deprecated, use options.snippetCache instead."),i.snippetCache=i.historyUiCache);const n=Object.keys(r.findSnippets(a.shouldCacheSnippet)),s=Object.fromEntries(Array.from(this.currentSnippets).filter(([e])=>n.includes(e)));if(!this.dispatchEvent(new CustomEvent("store",{cancelable:!0,detail:{snippets:s,state:t,options:i}})))return;const o=this.resolveStorage(i.snippetCache);t.snippets={storage:o.type,key:o.store(s)}}restoreHistoryState(e){const{state:t,options:i}=e.detail;if(void 0===t.snippets)return;if(i.snippetCache=t.snippets.storage,!this.dispatchEvent(new CustomEvent("fetch",{cancelable:!0,detail:{state:t,options:i}})))return;const n=this.resolveStorage(i.snippetCache).fetch(t.snippets.key,t,i);null!==n&&this.dispatchEvent(new CustomEvent("restore",{cancelable:!0,detail:{snippets:n,state:t,options:i}}))&&this.naja.snippetHandler.updateSnippets(n,!0,i)}}a.parser=new DOMParser;class l{constructor(e){this.naja=e,this.type="off"}store(){return null}fetch(e,t,i){return this.naja.makeRequest("GET",t.href,null,{...i,history:!1,snippetCache:!1}),null}}class c{constructor(){this.type="history"}store(e){return e}fetch(e){return e}}class d{constructor(){this.type="session"}store(e){const t=Math.random().toString(36).substring(2,8);return window.sessionStorage.setItem(t,JSON.stringify(e)),t}fetch(e){const t=window.sessionStorage.getItem(e);return null===t?null:JSON.parse(t)}}class u{constructor(e){this.naja=e,this.loadedScripts=new Set,e.addEventListener("init",this.initialize.bind(this))}initialize(){e(()=>{document.querySelectorAll("script[data-naja-script-id]").forEach(e=>{const t=e.getAttribute("data-naja-script-id");null!==t&&""!==t&&this.loadedScripts.add(t)})}),this.naja.snippetHandler.addEventListener("afterUpdate",e=>{const{content:t}=e.detail;this.loadScripts(t)})}loadScripts(e){"string"!=typeof e?Object.keys(e).forEach(t=>{const i=e[t];this.loadScriptsInSnippet(i)}):this.loadScriptsInSnippet(e)}loadScriptsInSnippet(e){if(!/<script/i.test(e))return;u.parser.parseFromString(e,"text/html").querySelectorAll("script").forEach(e=>{const t=e.getAttribute("data-naja-script-id");if(null!==t&&""!==t&&this.loadedScripts.has(t))return;const i=window.document.createElement("script");if(i.innerHTML=e.innerHTML,e.hasAttributes())for(const t of e.attributes)i.setAttribute(t.name,t.value);window.document.head.appendChild(i).parentNode.removeChild(i),null!==t&&""!==t&&this.loadedScripts.add(t)})}}u.parser=new DOMParser;class h extends EventTarget{constructor(e,s,l,c,d,h,p){super(),this.VERSION=3,this.initialized=!1,this.extensions=[],this.defaultOptions={},this.uiHandler=new(e??t)(this),this.redirectHandler=new(s??n)(this),this.snippetHandler=new(l??r)(this),this.formsHandler=new(c??i)(this),this.historyHandler=new(d??o)(this),this.snippetCache=new(h??a)(this),this.scriptLoader=new(p??u)(this)}registerExtension(e){this.initialized&&e.initialize(this),this.extensions.push(e)}initialize(e={}){if(this.initialized)throw new Error("Cannot initialize Naja, it is already initialized.");this.defaultOptions=this.prepareOptions(e),this.extensions.forEach(e=>e.initialize(this)),this.dispatchEvent(new CustomEvent("init",{detail:{defaultOptions:this.defaultOptions}})),this.initialized=!0}prepareOptions(e){return{...this.defaultOptions,...e,fetch:{...this.defaultOptions.fetch,...e?.fetch}}}async makeRequest(e,t,i=null,n={}){"string"==typeof t&&(t=new URL(t,location.href)),n=this.prepareOptions(n);const r=new Headers(n.fetch.headers||{}),s=this.transformData(t,e,i),o=new AbortController,a=new Request(t.toString(),{credentials:"same-origin",...n.fetch,method:e,headers:r,body:s,signal:o.signal});if(a.headers.set("X-Requested-With","XMLHttpRequest"),a.headers.set("Accept","application/json"),!this.dispatchEvent(new CustomEvent("before",{cancelable:!0,detail:{request:a,method:e,url:t.toString(),data:i,options:n}})))return{};const l=window.fetch(a);let c,d;this.dispatchEvent(new CustomEvent("start",{detail:{request:a,promise:l,abortController:o,options:n}}));try{if(c=await l,!c.ok)throw new p(c);d=await c.json()}catch(e){if("AbortError"===e.name)return this.dispatchEvent(new CustomEvent("abort",{detail:{request:a,error:e,options:n}})),this.dispatchEvent(new CustomEvent("complete",{detail:{request:a,response:c,payload:void 0,error:e,options:n}})),{};throw this.dispatchEvent(new CustomEvent("error",{detail:{request:a,response:c,error:e,options:n}})),this.dispatchEvent(new CustomEvent("complete",{detail:{request:a,response:c,payload:void 0,error:e,options:n}})),e}return this.dispatchEvent(new CustomEvent("payload",{detail:{request:a,response:c,payload:d,options:n}})),this.dispatchEvent(new CustomEvent("success",{detail:{request:a,response:c,payload:d,options:n}})),this.dispatchEvent(new CustomEvent("complete",{detail:{request:a,response:c,payload:d,error:void 0,options:n}})),d}appendToQueryString(e,t,i){if(null!=i)if(Array.isArray(i)||Object.getPrototypeOf(i)===Object.prototype)for(const[n,r]of Object.entries(i))this.appendToQueryString(e,`${t}[${n}]`,r);else e.append(t,String(i))}transformData(e,t,i){const n=["GET","HEAD"].includes(t.toUpperCase());if(n&&i instanceof FormData){for(const[t,n]of i)null!=n&&e.searchParams.append(t,String(n));return null}if(null!==i&&Object.getPrototypeOf(i)===Object.prototype||Array.isArray(i)){const t=n?e.searchParams:new URLSearchParams;for(const[e,n]of Object.entries(i))this.appendToQueryString(t,e,n);return n?null:t}return i}}class p extends Error{constructor(e){const t=`HTTP ${e.status}: ${e.statusText}`;super(t),this.name=this.constructor.name,this.stack=new Error(t).stack,this.response=e}}const f=new h;function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}f.registerExtension(new class{constructor(){this.abortControllers=new Set}initialize(e){e.uiHandler.addEventListener("interaction",this.checkAbortable.bind(this)),e.addEventListener("init",this.onInitialize.bind(this)),e.addEventListener("start",this.saveAbortController.bind(this)),e.addEventListener("complete",this.removeAbortController.bind(this))}onInitialize(){document.addEventListener("keydown",e=>{if("Escape"===e.key&&!(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)){for(const e of this.abortControllers)e.abort();this.abortControllers.clear()}})}checkAbortable(e){const{element:t,options:i}=e.detail;(t.hasAttribute("data-naja-abort")||t.form?.hasAttribute("data-naja-abort"))&&(i.abort="off"!==(t.getAttribute("data-naja-abort")??t.form?.getAttribute("data-naja-abort")))}saveAbortController(e){const{abortController:t,options:i}=e.detail;!1!==i.abort&&(this.abortControllers.add(t),i.clearAbortExtension=()=>this.abortControllers.delete(t))}removeAbortController(e){const{options:t}=e.detail;!1!==t.abort&&t.clearAbortExtension&&t.clearAbortExtension()}}),f.registerExtension(new class{constructor(){this.abortControllers=new Map}initialize(e){e.uiHandler.addEventListener("interaction",this.checkUniqueness.bind(this)),e.addEventListener("start",this.abortPreviousRequest.bind(this)),e.addEventListener("complete",this.clearRequest.bind(this))}checkUniqueness(e){const{element:t,options:i}=e.detail;if(t.hasAttribute("data-naja-unique")??t.form?.hasAttribute("data-naja-unique")){const e=t.getAttribute("data-naja-unique")??t.form?.getAttribute("data-naja-unique");i.unique="off"!==e&&(e??"default")}}abortPreviousRequest(e){const{abortController:t,options:i}=e.detail;!1!==i.unique&&(this.abortControllers.get(i.unique??"default")?.abort(),this.abortControllers.set(i.unique??"default",t))}clearRequest(e){const{request:t,options:i}=e.detail;t.signal.aborted||!1===i.unique||this.abortControllers.delete(i.unique??"default")}});var m,v={exports:{}};
2
2
  /*!
3
3
  * NetteForms - simple form validation.
4
4
  *
5
5
  * This file is part of the Nette Framework (https://nette.org)
6
6
  * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
7
- */var b=(m||(m=1,v.exports=function(){class t{filled(t,e,i){return""!==i&&!1!==i&&null!==i&&(!Array.isArray(i)||i.length>0)&&(!(i instanceof FileList)||i.length>0)}blank(t,e,i){return!this.filled(t,e,i)}valid(t,e){return e.validateControl(t,void 0,!0)}equal(t,e,i){if(void 0===e)return null;let n=t=>"number"==typeof t||"string"==typeof t?""+t:!0===t?"1":"",r=Array.isArray(i)?i:[i],s=Array.isArray(e)?e:[e];t:for(let t of r){for(let e of s)if(n(t)===n(e))continue t;return!1}return r.length>0}notEqual(t,e,i){return void 0===e?null:!this.equal(t,e,i)}minLength(t,e,i){return(i="number"==typeof i?i.toString():i).length>=e}maxLength(t,e,i){return(i="number"==typeof i?i.toString():i).length<=e}length(t,e,i){return i="number"==typeof i?i.toString():i,(null===(e=Array.isArray(e)?e:[e,e])[0]||i.length>=e[0])&&(null===e[1]||i.length<=e[1])}email(t,e,i){return/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i.test(i)}url(t,e,i,n){return/^[a-z\d+.-]+:/.test(i)||(i="https://"+i),!!/^https?:\/\/((([-_0-9a-z\u00C0-\u02FF\u0370-\u1EFF]+\.)*[0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)?[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[[0-9a-f:]{3,39}\])(:\d{1,5})?(\/\S*)?$/i.test(i)&&(n.value=i,!0)}regexp(t,e,i){let n="string"==typeof e&&e.match(/^\/(.*)\/([imu]*)$/);try{return n&&new RegExp(n[1],n[2].replace("u","")).test(i)}catch{return null}}pattern(t,e,i,n,r){if("string"!=typeof e)return null;try{let t;try{t=new RegExp("^(?:"+e+")$",r?"ui":"u")}catch{t=new RegExp("^(?:"+e+")$",r?"i":"")}return i instanceof FileList?Array.from(i).every(e=>t.test(e.name)):t.test(i)}catch{return null}}patternCaseInsensitive(t,e,i){return this.pattern(t,e,i,null,!0)}numeric(t,e,i){return/^[0-9]+$/.test(i)}integer(t,e,i,n){return!!/^-?[0-9]+$/.test(i)&&(n.value=parseFloat(i),!0)}float(t,e,i,n){return i=i.replace(/ +/g,"").replace(/,/g,"."),!!/^-?[0-9]*\.?[0-9]+$/.test(i)&&(n.value=parseFloat(i),!0)}min(t,e,i){return Number.isFinite(e)&&(i=parseFloat(i)),i>=e}max(t,e,i){return Number.isFinite(e)&&(i=parseFloat(i)),i<=e}range(t,e,i){return Array.isArray(e)?"time"===t.type&&e[0]>e[1]?i>=e[0]||i<=e[1]:(null===e[0]||this.min(t,e[0],i))&&(null===e[1]||this.max(t,e[1],i)):null}submitted(t){return t.form["nette-submittedBy"]===t}fileSize(t,e,i){return Array.from(i).every(t=>t.size<=e)}mimeType(t,e,i){let n=[];(e=Array.isArray(e)?e:[e]).forEach(t=>n.push("^"+t.replace(/([^\w])/g,"\\$1").replace("\\*",".*")+"$"));let r=new RegExp(n.join("|"));return Array.from(i).every(t=>!t.type||r.test(t.type))}image(t,e,i){return this.mimeType(t,e??["image/gif","image/png","image/jpeg","image/webp"],i)}static(t,e){return e}}class e{formErrors=[];validators=new t;#t={};#e={};#i=new WeakMap;#n(t,e){let i=t.elements.namedItem(e);return i instanceof RadioNodeList?i[0]:i}#r(t){let e=t.form.elements.namedItem(t.name);return e instanceof RadioNodeList?Array.from(e):[e]}#s(t){"loading"!==document.readyState?t.call(this):document.addEventListener("DOMContentLoaded",t)}getValue(t){return t instanceof HTMLInputElement?"radio"===t.type?this.#r(t).find(t=>t.checked)?.value??null:"file"===t.type?t.files:"checkbox"===t.type?t.name.endsWith("[]")?this.#r(t).filter(t=>t.checked).map(t=>t.value):t.checked:t.value.trim():t instanceof HTMLSelectElement?t.multiple?Array.from(t.selectedOptions,t=>t.value):t.selectedOptions[0]?.value??null:t instanceof HTMLTextAreaElement?t.value:t instanceof RadioNodeList?this.getValue(t[0]):null}getEffectiveValue(t,e=!1){let i=this.getValue(t);if(i===t.getAttribute("data-nette-empty-value")&&(i=""),e&&void 0===this.#t[t.name]){this.#t[t.name]=!0;let e={value:i};this.validateControl(t,void 0,!0,e),i=e.value,delete this.#t[t.name]}return i}validateControl(t,e,i=!1,n,r){e??=JSON.parse(t.getAttribute("data-nette-rules")??"[]"),n??={value:this.getEffectiveValue(t)},r??=!this.validateRule(t,":filled",null,n);for(let s of e){let e=s.op.match(/(~)?([^?]+)/),o=s.control?this.#n(t.form,s.control):t;if(s.neg=!!e[1],s.op=e[2],s.condition=!!s.rules,!o)continue;if(r&&!s.condition&&":filled"!==s.op)continue;let a=this.validateRule(o,s.op,s.arg,t===o?n:void 0);if(null!==a)if(s.neg&&(a=!a),s.condition&&a){if(!this.validateControl(t,s.rules,i,n,":blank"!==s.op&&r))return!1}else if(!s.condition&&!a){if(this.isDisabled(o))continue;if(!i){let e=Array.isArray(s.arg)?s.arg:[s.arg],i=s.msg.replace(/%(value|\d+)/g,(i,n)=>this.getValue("value"===n?o:t.form.elements.namedItem(e[n].control)));this.addError(o,i)}return!1}}return!0}validateForm(t,e=!1){let i,n=t.form??t;if(this.formErrors=[],null!==t.getAttribute("formnovalidate")){let e=JSON.parse(t.getAttribute("data-nette-validation-scope")??"[]");if(!e.length)return this.showFormErrors(n,[]),!0;i=new RegExp("^("+e.join("-|")+"-)")}for(let t of n.elements)if(t.willValidate&&t.validity.badInput)return t.reportValidity(),!1;for(let t of n.elements)if(t.getAttribute("data-nette-rules")&&(!i||t.name.replace(/]\[|\[|]|$/g,"-").match(i))&&!this.isDisabled(t)&&!this.validateControl(t,void 0,e)&&!this.formErrors.length)return!1;let r=!this.formErrors.length;return this.showFormErrors(n,this.formErrors),r}isDisabled(t){return"radio"===t.type?this.#r(t).every(t=>t.disabled):t.disabled}addError(t,e){this.formErrors.push({element:t,message:e})}showFormErrors(t,e){let i,n=[];for(let t of e)n.indexOf(t.message)<0&&(n.push(t.message),i??=t.element);n.length&&this.showModal(n.join("\n"),()=>{i?.focus()})}showModal(t,e){let i=document.createElement("dialog");if(!i.showModal)return alert(t),void e();let n=document.createElement("style");n.innerText=".netteFormsModal { text-align: center; margin: auto; border: 2px solid black; padding: 1rem } .netteFormsModal button { padding: .1em 2em }";let r=document.createElement("button");r.innerText="OK",r.onclick=()=>{i.remove(),e()},i.setAttribute("class","netteFormsModal"),i.innerText=t+"\n\n",i.append(n,r),document.body.append(i),i.showModal()}validateRule(t,e,i,n){if(t.validity.badInput)return":filled"===e;n??={value:this.getEffectiveValue(t,!0)};let r=":"===e.charAt(0)?e.substring(1):e;r=r.replace("::","_").replaceAll("\\","");let s=Array.isArray(i)?i:[i];return s=s.map(e=>{if(e?.control){let i=this.#n(t.form,e.control);return i===t?n.value:this.getEffectiveValue(i,!0)}return e}),"valid"===r&&(s[0]=this),this.validators[r]?this.validators[r](t,Array.isArray(i)?s:s[0],n.value,n):null}toggleForm(t,e){this.#e={};for(let i of Array.from(t.elements))i.getAttribute("data-nette-rules")&&this.toggleControl(i,void 0,null,!e);for(let t in this.#e)this.toggle(t,this.#e[t].state,this.#e[t].elem,e)}toggleControl(t,e,i=null,n=!1,r,s){e??=JSON.parse(t.getAttribute("data-nette-rules")??"[]"),r??={value:this.getEffectiveValue(t)},s??=!this.validateRule(t,":filled",null,r);let o,a=!1;for(let l of e){let e=l.op.match(/(~)?([^?]+)/),c=l.control?this.#n(t.form,l.control):t;if(l.neg=!!e[1],l.op=e[2],l.condition=!!l.rules,c&&(!s||l.condition||":filled"===l.op)){if(o=i,!1!==i){if(o=this.validateRule(c,l.op,l.arg,t===c?r:void 0),null===o)continue;l.neg&&(o=!o),l.condition||(i=o)}if(l.condition&&this.toggleControl(t,l.rules,o,n,r,":blank"!==l.op&&s)||l.toggle){a=!0,n&&this.#r(c).filter(t=>!this.#i.has(t)).forEach(e=>{e.addEventListener("change",e=>this.toggleForm(t.form,e)),this.#i.set(e,null)});for(let e in l.toggle??{})this.#e[e]??={elem:t,state:!1},this.#e[e].state||=l.toggle[e]?!!o:!o}}}return a}toggle(t,e,i,n){/^\w[\w.:-]*$/.test(t)&&(t="#"+t),Array.from(document.querySelectorAll(t)).forEach(t=>t.hidden=!e)}compactCheckboxes(t,e){let i={};for(let n of t.elements)n instanceof HTMLInputElement&&"checkbox"===n.type&&n.name.endsWith("[]")&&n.checked&&!n.disabled&&(e.delete(n.name),i[n.name]??=[],i[n.name].push(n.value));for(let t in i)e.set(t.substring(0,t.length-2),i[t].join(","))}initForm(t){"get"===t.method&&t.hasAttribute("data-nette-compact")&&t.addEventListener("formdata",e=>this.compactCheckboxes(t,e.formData)),Array.from(t.elements).some(t=>t.getAttribute("data-nette-rules"))&&(this.toggleForm(t),t.noValidate||(t.noValidate=!0,t.addEventListener("submit",e=>{this.validateForm(e.submitter||t)||(e.stopImmediatePropagation(),e.preventDefault())}),t.addEventListener("reset",()=>{setTimeout(()=>this.toggleForm(t))})))}initOnLoad(){this.#s(()=>{Array.from(document.forms).forEach(t=>this.initForm(t))})}}let i={"á":"a","ä":"a","č":"c","ď":"d","é":"e","ě":"e","í":"i","ľ":"l","ň":"n","ó":"o","ô":"o","ř":"r","š":"s","ť":"t","ú":"u","ů":"u","ý":"y","ž":"z"};function n(t){t=t.toLowerCase();let e="";for(let n=0;n<t.length;n++){let r=i[t.charAt(n)];e+=r||t.charAt(n)}return e.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}var r="3.5.3";let s=new e;return s.version=r,s.webalize=n,s}()),v.exports),y=g(b);function _(t){return"Enter"===t.key}function w(){return null!=w?w:{}}function E(t,e=200){let i=null,n=!1;return(...r)=>{n||(i&&clearTimeout(i),i=setTimeout(()=>{const e=t(...r);var i;"object"==typeof(i=e)&&"function"==typeof i.then&&(n=!0,e.finally(()=>{n=!1}))},e))}}function A(t,e){t.split(/\s+/).forEach(t=>{e(t)})}class k{constructor(){this._events={}}on(t,e){A(t,t=>{const i=this._events[t]||[];i.push(e),this._events[t]=i})}off(t,e){var i=arguments.length;0!==i?A(t,t=>{if(1===i)return void delete this._events[t];const n=this._events[t];void 0!==n&&(n.splice(n.indexOf(e),1),this._events[t]=n)}):this._events={}}trigger(t,...e){var i=this;A(t,t=>{const n=i._events[t];void 0!==n&&n.forEach(t=>{t.apply(i,e)})})}}const S=t=>(t=t.filter(Boolean)).length<2?t[0]||"":1==T(t)?"["+t.join("")+"]":"(?:"+t.join("|")+")",C=t=>{if(!D(t))return t.join("");let e="",i=0;const n=()=>{i>1&&(e+="{"+i+"}")};return t.forEach((r,s)=>{r!==t[s-1]?(n(),e+=r,i=1):i++}),n(),e},O=t=>{let e=Array.from(t);return S(e)},D=t=>new Set(t).size!==t.length,x=t=>(t+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),T=t=>t.reduce((t,e)=>Math.max(t,L(e)),0),L=t=>Array.from(t).length,I=t=>{if(1===t.length)return[[t]];let e=[];const i=t.substring(1);return I(i).forEach(function(i){let n=i.slice(0);n[0]=t.charAt(0)+n[0],e.push(n),n=i.slice(0),n.unshift(t.charAt(0)),e.push(n)}),e},M=[[0,65535]];let F,N;const j={},P={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"};for(let t in P){let e=P[t]||"";for(let i=0;i<e.length;i++){let n=e.substring(i,i+1);j[n]=t}}const $=new RegExp(Object.keys(j).join("|")+"|[̀-ͯ·ʾʼ]","gu"),H=(t,e="NFKD")=>t.normalize(e),q=t=>Array.from(t).reduce((t,e)=>t+R(e),""),R=t=>(t=H(t).toLowerCase().replace($,t=>j[t]||""),H(t,"NFC"));const B=t=>{const e={},i=(t,i)=>{const n=e[t]||new Set,r=new RegExp("^"+O(n)+"$","iu");i.match(r)||(n.add(x(i)),e[t]=n)};for(let e of function*(t){for(const[e,i]of t)for(let t=e;t<=i;t++){let e=String.fromCharCode(t),i=q(e);i!=e.toLowerCase()&&(i.length>3||0!=i.length&&(yield{folded:i,composed:e,code_point:t}))}}(t))i(e.folded,e.folded),i(e.folded,e.composed);return e},V=t=>{const e=B(t),i={};let n=[];for(let t in e){let r=e[t];r&&(i[t]=O(r)),t.length>1&&n.push(x(t))}n.sort((t,e)=>e.length-t.length);const r=S(n);return N=new RegExp("^"+r,"u"),i},z=(t,e=1)=>(e=Math.max(e,t.length-1),S(I(t).map(t=>((t,e=1)=>{let i=0;return t=t.map(t=>(F[t]&&(i+=t.length),F[t]||t)),i>=e?C(t):""})(t,e)))),W=(t,e=!0)=>{let i=t.length>1?1:0;return S(t.map(t=>{let n=[];const r=e?t.length():t.length()-1;for(let e=0;e<r;e++)n.push(z(t.substrs[e]||"",i));return C(n)}))},Y=(t,e)=>{for(const i of e){if(i.start!=t.start||i.end!=t.end)continue;if(i.substrs.join("")!==t.substrs.join(""))continue;let e=t.parts;const n=t=>{for(const i of e){if(i.start===t.start&&i.substr===t.substr)return!1;if(1!=t.length&&1!=i.length){if(t.start<i.start&&t.end>i.start)return!0;if(i.start<t.start&&i.end>t.start)return!0}}return!1};if(!(i.parts.filter(n).length>0))return!0}return!1};class K{parts;substrs;start;end;constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(t){t&&(this.parts.push(t),this.substrs.push(t.substr),this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(t,e){let i=new K,n=JSON.parse(JSON.stringify(this.parts)),r=n.pop();for(const t of n)i.add(t);let s=e.substr.substring(0,t-r.start),o=s.length;return i.add({start:r.start,end:r.start+o,length:o,substr:s}),i}}const U=t=>{void 0===F&&(F=V(M)),t=q(t);let e="",i=[new K];for(let n=0;n<t.length;n++){let r=t.substring(n).match(N);const s=t.substring(n,n+1),o=r?r[0]:null;let a=[],l=new Set;for(const t of i){const e=t.last();if(!e||1==e.length||e.end<=n)if(o){const e=o.length;t.add({start:n,end:n+e,length:e,substr:o}),l.add("1")}else t.add({start:n,end:n+1,length:1,substr:s}),l.add("2");else if(o){let i=t.clone(n,e);const r=o.length;i.add({start:n,end:n+r,length:r,substr:o}),a.push(i)}else l.add("3")}if(a.length>0){a=a.sort((t,e)=>t.length()-e.length());for(let t of a)Y(t,i)||i.push(t)}else if(n>0&&1==l.size&&!l.has("3")){e+=W(i,!1);let t=new K;const n=i[0];n&&t.add(n.last()),i=[t]}}return e+=W(i,!0),e},X=(t,e)=>{if(t)return t[e]},Q=(t,e)=>{if(t){for(var i,n=e.split(".");(i=n.shift())&&(t=t[i]););return t}},G=(t,e,i)=>{var n,r;return t?(t+="",null==e.regex||-1===(r=t.search(e.regex))?0:(n=e.string.length/t.length,0===r&&(n+=.5),n*i)):0},J=(t,e)=>{var i=t[e];if("function"==typeof i)return i;i&&!Array.isArray(i)&&(t[e]=[i])},Z=(t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},tt=(t,e)=>"number"==typeof t&&"number"==typeof e?t>e?1:t<e?-1:0:(t=q(t+"").toLowerCase())>(e=q(e+"").toLowerCase())?1:e>t?-1:0;class et{items;settings;constructor(t,e){this.items=t,this.settings=e||{diacritics:!0}}tokenize(t,e,i){if(!t||!t.length)return[];const n=[],r=t.split(/\s+/);var s;return i&&(s=new RegExp("^("+Object.keys(i).map(x).join("|")+"):(.*)$")),r.forEach(t=>{let i,r=null,o=null;s&&(i=t.match(s))&&(r=i[1],t=i[2]),t.length>0&&(o=this.settings.diacritics?U(t)||null:x(t),o&&e&&(o="\\b"+o)),n.push({string:t,regex:o?new RegExp(o,"iu"):null,field:r})}),n}getScoreFunction(t,e){var i=this.prepareSearch(t,e);return this._getScoreFunction(i)}_getScoreFunction(t){const e=t.tokens,i=e.length;if(!i)return function(){return 0};const n=t.options.fields,r=t.weights,s=n.length,o=t.getAttrFn;if(!s)return function(){return 1};const a=1===s?function(t,e){const i=n[0].field;return G(o(e,i),t,r[i]||1)}:function(t,e){var i=0;if(t.field){const n=o(e,t.field);!t.regex&&n?i+=1/s:i+=G(n,t,1)}else Z(r,(n,r)=>{i+=G(o(e,r),t,n)});return i/s};return 1===i?function(t){return a(e[0],t)}:"and"===t.options.conjunction?function(t){var n,r=0;for(let i of e){if((n=a(i,t))<=0)return 0;r+=n}return r/i}:function(t){var n=0;return Z(e,e=>{n+=a(e,t)}),n/i}}getSortFunction(t,e){var i=this.prepareSearch(t,e);return this._getSortFunction(i)}_getSortFunction(t){var e,i=[];const n=this,r=t.options,s=!t.query&&r.sort_empty?r.sort_empty:r.sort;if("function"==typeof s)return s.bind(this);const o=function(e,i){return"$score"===e?i.score:t.getAttrFn(n.items[i.id],e)};if(s)for(let e of s)(t.query||"$score"!==e.field)&&i.push(e);if(t.query){e=!0;for(let t of i)if("$score"===t.field){e=!1;break}e&&i.unshift({field:"$score",direction:"desc"})}else i=i.filter(t=>"$score"!==t.field);return i.length?function(t,e){var n,r;for(let s of i){if(r=s.field,n=("desc"===s.direction?-1:1)*tt(o(r,t),o(r,e)))return n}return 0}:null}prepareSearch(t,e){const i={};var n=Object.assign({},e);if(J(n,"sort"),J(n,"sort_empty"),n.fields){J(n,"fields");const t=[];n.fields.forEach(e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),i[e.field]="weight"in e?e.weight:1}),n.fields=t}return{options:n,query:t.toLowerCase().trim(),tokens:this.tokenize(t,n.respect_word_boundaries,i),total:0,items:[],weights:i,getAttrFn:n.nesting?Q:X}}search(t,e){var i,n,r=this;n=this.prepareSearch(t,e),e=n.options,t=n.query;const s=e.score||r._getScoreFunction(n);t.length?Z(r.items,(t,r)=>{i=s(t),(!1===e.filter||i>0)&&n.items.push({score:i,id:r})}):Z(r.items,(t,e)=>{n.items.push({score:1,id:e})});const o=r._getSortFunction(n);return o&&n.items.sort(o),n.total=n.items.length,"number"==typeof e.limit&&(n.items=n.items.slice(0,e.limit)),n}}const it=t=>null==t?null:nt(t),nt=t=>"boolean"==typeof t?t?"1":"0":t+"",rt=t=>(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),st=(t,e)=>{var i;return function(n,r){var s=this;i&&(s.loading=Math.max(s.loading-1,0),clearTimeout(i)),i=setTimeout(function(){i=null,s.loadedSearches[n]=!0,t.call(s,n,r)},e)}},ot=(t,e,i)=>{var n,r=t.trigger,s={};for(n of(t.trigger=function(){var i=arguments[0];if(-1===e.indexOf(i))return r.apply(t,arguments);s[i]=arguments},i.apply(t,[]),t.trigger=r,e))n in s&&r.apply(t,s[n])},at=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},lt=(t,e,i,n)=>{t.addEventListener(e,i,n)},ct=(t,e)=>!!e&&(!!e[t]&&1===(e.altKey?1:0)+(e.ctrlKey?1:0)+(e.shiftKey?1:0)+(e.metaKey?1:0)),dt=(t,e)=>{const i=t.getAttribute("id");return i||(t.setAttribute("id",e),e)},ut=t=>t.replace(/[\\"']/g,"\\$&"),ht=(t,e)=>{e&&t.append(e)},pt=(t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},ft=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(gt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},gt=t=>"string"==typeof t&&t.indexOf("<")>-1,mt=(t,e)=>{var i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!1),t.dispatchEvent(i)},vt=(t,e)=>{Object.assign(t.style,e)},bt=(t,...e)=>{var i=_t(e);(t=wt(t)).map(t=>{i.map(e=>{t.classList.add(e)})})},yt=(t,...e)=>{var i=_t(e);(t=wt(t)).map(t=>{i.map(e=>{t.classList.remove(e)})})},_t=t=>{var e=[];return pt(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},wt=t=>(Array.isArray(t)||(t=[t]),t),Et=(t,e,i)=>{if(!i||i.contains(t))for(;t&&t.matches;){if(t.matches(e))return t;t=t.parentNode}},At=(t,e=0)=>e>0?t[t.length-1]:t[0],kt=(t,e)=>{if(!t)return-1;e=e||t.nodeName;for(var i=0;t=t.previousElementSibling;)t.matches(e)&&i++;return i},St=(t,e)=>{pt(e,(e,i)=>{null==e?t.removeAttribute(i):t.setAttribute(i,""+e)})},Ct=(t,e)=>{t.parentNode&&t.parentNode.replaceChild(e,t)},Ot=(t,e)=>{if(null===e)return;if("string"==typeof e){if(!e.length)return;e=new RegExp(e,"i")}const i=t=>3===t.nodeType?(t=>{var i=t.data.match(e);if(i&&t.data.length>0){var n=document.createElement("span");n.className="highlight";var r=t.splitText(i.index);r.splitText(i[0].length);var s=r.cloneNode(!0);return n.appendChild(s),Ct(r,n),1}return 0})(t):((t=>{1!==t.nodeType||!t.childNodes||/(script|style)/i.test(t.tagName)||"highlight"===t.className&&"SPAN"===t.tagName||Array.from(t.childNodes).forEach(t=>{i(t)})})(t),0);i(t)},Dt="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey";var xt={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,refreshThrottle:300,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(t){return t.length>0},render:{}};function Tt(t,e){var i=Object.assign({},xt,e),n=i.dataAttr,r=i.labelField,s=i.valueField,o=i.disabledField,a=i.optgroupField,l=i.optgroupLabelField,c=i.optgroupValueField,d=t.tagName.toLowerCase(),u=t.getAttribute("placeholder")||t.getAttribute("data-placeholder");if(!u&&!i.allowEmptyOption){let e=t.querySelector('option[value=""]');e&&(u=e.textContent)}var h={placeholder:u,options:[],optgroups:[],items:[],maxItems:null};return"select"===d?(()=>{var e,d=h.options,u={},p=1;let f=0;var g=t=>{var e=Object.assign({},t.dataset),i=n&&e[n];return"string"==typeof i&&i.length&&(e=Object.assign(e,JSON.parse(i))),e},m=(t,e)=>{var n=it(t.value);if(null!=n&&(n||i.allowEmptyOption)){if(u.hasOwnProperty(n)){if(e){var l=u[n][a];l?Array.isArray(l)?l.push(e):u[n][a]=[l,e]:u[n][a]=e}}else{var c=g(t);c[r]=c[r]||t.textContent,c[s]=c[s]||n,c[o]=c[o]||t.disabled,c[a]=c[a]||e,c.$option=t,c.$order=c.$order||++f,u[n]=c,d.push(c)}t.selected&&h.items.push(n)}};h.maxItems=t.hasAttribute("multiple")?null:1,pt(t.children,t=>{var i,n,r;"optgroup"===(e=t.tagName.toLowerCase())?((r=g(i=t))[l]=r[l]||i.getAttribute("label")||"",r[c]=r[c]||p++,r[o]=r[o]||i.disabled,r.$order=r.$order||++f,h.optgroups.push(r),n=r[c],pt(i.children,t=>{m(t,n)})):"option"===e&&m(t)})})():(()=>{const e=t.getAttribute(n);if(e)h.options=JSON.parse(e),pt(h.options,t=>{h.items.push(t[s])});else{var o=t.value.trim()||"";if(!i.allowEmptyOption&&!o.length)return;const e=o.split(i.delimiter);pt(e,t=>{const e={};e[r]=t,e[s]=t,h.options.push(e)}),h.items=e}})(),Object.assign({},xt,h,e)}var Lt=0;let It=class extends(function(t){return t.plugins={},class extends t{constructor(){super(...arguments),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(e,i){t.plugins[e]={name:e,fn:i}}initializePlugins(t){var e,i;const n=this,r=[];if(Array.isArray(t))t.forEach(t=>{"string"==typeof t?r.push(t):(n.plugins.settings[t.name]=t.options,r.push(t.name))});else if(t)for(e in t)t.hasOwnProperty(e)&&(n.plugins.settings[e]=t[e],r.push(e));for(;i=r.shift();)n.require(i)}loadPlugin(e){var i=this,n=i.plugins,r=t.plugins[e];if(!t.plugins.hasOwnProperty(e))throw new Error('Unable to find "'+e+'" plugin');n.requested[e]=!0,n.loaded[e]=r.fn.apply(i,[i.plugins.settings[e]||{}]),n.names.push(e)}require(t){var e=this,i=e.plugins;if(!e.plugins.loaded.hasOwnProperty(t)){if(i.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")');e.loadPlugin(t)}return i.loaded[t]}}}(k)){constructor(t,e){var i;super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.refreshTimeout=null,Lt++;var n=ft(t);if(n.tomselect)throw new Error("Tom Select already initialized on this element");n.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(n,null)).getPropertyValue("direction");const r=Tt(n,e);this.settings=r,this.input=n,this.tabIndex=n.tabIndex||0,this.is_select_tag="select"===n.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=dt(n,"tomselect-"+Lt),this.isRequired=n.required,this.sifter=new et(this.options,{diacritics:r.diacritics}),r.mode=r.mode||(1===r.maxItems?"single":"multi"),"boolean"!=typeof r.hideSelected&&(r.hideSelected="multi"===r.mode),"boolean"!=typeof r.hidePlaceholder&&(r.hidePlaceholder="multi"!==r.mode);var s=r.createFilter;"function"!=typeof s&&("string"==typeof s&&(s=new RegExp(s)),s instanceof RegExp?r.createFilter=t=>s.test(t):r.createFilter=t=>this.settings.duplicates||!this.options[t]),this.initializePlugins(r.plugins),this.setupCallbacks(),this.setupTemplates();const o=ft("<div>"),a=ft("<div>"),l=this._render("dropdown"),c=ft('<div role="listbox" tabindex="-1">'),d=this.input.getAttribute("class")||"",u=r.mode;var h;if(bt(o,r.wrapperClass,d,u),bt(a,r.controlClass),ht(o,a),bt(l,r.dropdownClass,u),r.copyClassesToDropdown&&bt(l,d),bt(c,r.dropdownContentClass),ht(l,c),ft(r.dropdownParent||o).appendChild(l),gt(r.controlInput)){h=ft(r.controlInput);pt(["autocorrect","autocapitalize","autocomplete","spellcheck"],t=>{n.getAttribute(t)&&St(h,{[t]:n.getAttribute(t)})}),h.tabIndex=-1,a.appendChild(h),this.focus_node=h}else r.controlInput?(h=ft(r.controlInput),this.focus_node=h):(h=ft("<input/>"),this.focus_node=a);this.wrapper=o,this.dropdown=l,this.dropdown_content=c,this.control=a,this.control_input=h,this.setup()}setup(){const t=this,e=t.settings,i=t.control_input,n=t.dropdown,r=t.dropdown_content,s=t.wrapper,o=t.control,a=t.input,l=t.focus_node,c={passive:!0},d=t.inputId+"-ts-dropdown";St(r,{id:d}),St(l,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":d});const u=dt(l,t.inputId+"-ts-control"),h="label[for='"+(t=>t.replace(/['"\\]/g,"\\$&"))(t.inputId)+"']",p=document.querySelector(h),f=t.focus.bind(t);if(p){lt(p,"click",f),St(p,{for:u});const e=dt(p,t.inputId+"-ts-label");St(l,{"aria-labelledby":e}),St(r,{"aria-labelledby":e})}if(s.style.width=a.style.width,t.plugins.names.length){const e="plugin-"+t.plugins.names.join(" plugin-");bt([s,n],e)}(null===e.maxItems||e.maxItems>1)&&t.is_select_tag&&St(a,{multiple:"multiple"}),e.placeholder&&St(i,{placeholder:e.placeholder}),!e.splitOn&&e.delimiter&&(e.splitOn=new RegExp("\\s*"+x(e.delimiter)+"+\\s*")),e.load&&e.loadThrottle&&(e.load=st(e.load,e.loadThrottle)),lt(n,"mousemove",()=>{t.ignoreHover=!1}),lt(n,"mouseenter",e=>{var i=Et(e.target,"[data-selectable]",n);i&&t.onOptionHover(e,i)},{capture:!0}),lt(n,"click",e=>{const i=Et(e.target,"[data-selectable]");i&&(t.onOptionSelect(e,i),at(e,!0))}),lt(o,"click",e=>{var n=Et(e.target,"[data-ts-item]",o);n&&t.onItemSelect(e,n)?at(e,!0):""==i.value&&(t.onClick(),at(e,!0))}),lt(l,"keydown",e=>t.onKeyDown(e)),lt(i,"keypress",e=>t.onKeyPress(e)),lt(i,"input",e=>t.onInput(e)),lt(l,"blur",e=>t.onBlur(e)),lt(l,"focus",e=>t.onFocus(e)),lt(i,"paste",e=>t.onPaste(e));const g=e=>{const r=e.composedPath()[0];if(!s.contains(r)&&!n.contains(r))return t.isFocused&&t.blur(),void t.inputState();r==i&&t.isOpen?e.stopPropagation():at(e,!0)},m=()=>{t.isOpen&&t.positionDropdown()};lt(document,"mousedown",g),lt(window,"scroll",m,c),lt(window,"resize",m,c),this._destroy=()=>{document.removeEventListener("mousedown",g),window.removeEventListener("scroll",m),window.removeEventListener("resize",m),p&&p.removeEventListener("click",f)},this.revertSettings={innerHTML:a.innerHTML,tabIndex:a.tabIndex},a.tabIndex=-1,a.insertAdjacentElement("afterend",t.wrapper),t.sync(!1),e.items=[],delete e.optgroups,delete e.options,lt(a,"invalid",()=>{t.isValid&&(t.isValid=!1,t.isInvalid=!0,t.refreshState())}),t.updateOriginalInput(),t.refreshItems(),t.close(!1),t.inputState(),t.isSetup=!0,a.disabled?t.disable():a.readOnly?t.setReadOnly(!0):t.enable(),t.on("change",this.onChange),bt(a,"tomselected","ts-hidden-accessible"),t.trigger("initialize"),!0===e.preload&&t.preload()}setupOptions(t=[],e=[]){this.addOptions(t),pt(e,t=>{this.registerOptionGroup(t)})}setupTemplates(){var t=this,e=t.settings.labelField,i=t.settings.optgroupLabelField,n={optgroup:t=>{let e=document.createElement("div");return e.className="optgroup",e.appendChild(t.options),e},optgroup_header:(t,e)=>'<div class="optgroup-header">'+e(t[i])+"</div>",option:(t,i)=>"<div>"+i(t[e])+"</div>",item:(t,i)=>"<div>"+i(t[e])+"</div>",option_create:(t,e)=>'<div class="create">Add <strong>'+e(t.input)+"</strong>&hellip;</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"};t.settings.render=Object.assign({},n,t.settings.render)}setupCallbacks(){var t,e,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(t in i)(e=this.settings[i[t]])&&this.on(t,e)}sync(t=!0){const e=this,i=t?Tt(e.input,{delimiter:e.settings.delimiter}):e.settings;e.setupOptions(i.options,i.optgroups),e.setValue(i.items||[],!0),e.lastQuery=null}onClick(){var t=this;if(t.activeItems.length>0)return t.clearActiveItems(),void t.focus();t.isFocused&&t.isOpen?t.blur():t.focus()}onMouseDown(){}onChange(){mt(this.input,"input"),mt(this.input,"change")}onPaste(t){var e=this;e.isInputHidden||e.isLocked?at(t):e.settings.splitOn&&setTimeout(()=>{var t=e.inputValue();if(t.match(e.settings.splitOn)){var i=t.trim().split(e.settings.splitOn);pt(i,t=>{it(t)&&(this.options[t]?e.addItem(t):e.createItem(t))})}},0)}onKeyPress(t){var e=this;if(!e.isLocked){var i=String.fromCharCode(t.keyCode||t.which);return e.settings.create&&"multi"===e.settings.mode&&i===e.settings.delimiter?(e.createItem(),void at(t)):void 0}at(t)}onKeyDown(t){var e=this;if(e.ignoreHover=!0,e.isLocked)9!==t.keyCode&&at(t);else{switch(t.keyCode){case 65:if(ct(Dt,t)&&""==e.control_input.value)return at(t),void e.selectAll();break;case 27:return e.isOpen&&(at(t,!0),e.close()),void e.clearActiveItems();case 40:if(!e.isOpen&&e.hasOptions)e.open();else if(e.activeOption){let t=e.getAdjacent(e.activeOption,1);t&&e.setActiveOption(t)}return void at(t);case 38:if(e.activeOption){let t=e.getAdjacent(e.activeOption,-1);t&&e.setActiveOption(t)}return void at(t);case 13:return void(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),at(t)):(e.settings.create&&e.createItem()||document.activeElement==e.control_input&&e.isOpen)&&at(t));case 37:return void e.advanceSelection(-1,t);case 39:return void e.advanceSelection(1,t);case 9:return void(e.settings.selectOnTab&&(e.canSelect(e.activeOption)&&(e.onOptionSelect(t,e.activeOption),at(t)),e.settings.create&&e.createItem()&&at(t)));case 8:case 46:return void e.deleteSelection(t)}e.isInputHidden&&!ct(Dt,t)&&at(t)}}onInput(t){if(this.isLocked)return;const e=this.inputValue();this.lastValue!==e&&(this.lastValue=e,""!=e?(this.refreshTimeout&&window.clearTimeout(this.refreshTimeout),this.refreshTimeout=((t,e)=>e>0?window.setTimeout(t,e):(t.call(null),null))(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)):this._onInput())}_onInput(){const t=this.lastValue;this.settings.shouldLoad.call(this,t)&&this.load(t),this.refreshOptions(),this.trigger("type",t)}onOptionHover(t,e){this.ignoreHover||this.setActiveOption(e,!1)}onFocus(t){var e=this,i=e.isFocused;if(e.isDisabled||e.isReadOnly)return e.blur(),void at(t);e.ignoreFocus||(e.isFocused=!0,"focus"===e.settings.preload&&e.preload(),i||e.trigger("focus"),e.activeItems.length||(e.inputState(),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())}onBlur(t){if(!1!==document.hasFocus()){var e=this;if(e.isFocused){e.isFocused=!1,e.ignoreFocus=!1;var i=()=>{e.close(),e.setActiveItem(),e.setCaret(e.items.length),e.trigger("blur")};e.settings.create&&e.settings.createOnBlur?e.createItem(null,i):i()}}}onOptionSelect(t,e){var i,n=this;e.parentElement&&e.parentElement.matches("[data-disabled]")||(e.classList.contains("create")?n.createItem(null,()=>{n.settings.closeAfterSelect&&n.close()}):void 0!==(i=e.dataset.value)&&(n.lastQuery=null,n.addItem(i),n.settings.closeAfterSelect&&n.close(),!n.settings.hideSelected&&t.type&&/click/.test(t.type)&&n.setActiveOption(e)))}canSelect(t){return!!(this.isOpen&&t&&this.dropdown_content.contains(t))}onItemSelect(t,e){var i=this;return!i.isLocked&&"multi"===i.settings.mode&&(at(t),i.setActiveItem(e,t),!0)}canLoad(t){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(t)}load(t){const e=this;if(!e.canLoad(t))return;bt(e.wrapper,e.settings.loadingClass),e.loading++;const i=e.loadCallback.bind(e);e.settings.load.call(e,t,i)}loadCallback(t,e){const i=this;i.loading=Math.max(i.loading-1,0),i.lastQuery=null,i.clearActiveOption(),i.setupOptions(t,e),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||yt(i.wrapper,i.settings.loadingClass),i.trigger("load",t,e)}preload(){var t=this.wrapper.classList;t.contains("preloaded")||(t.add("preloaded"),this.load(""))}setTextboxValue(t=""){var e=this.control_input;e.value!==t&&(e.value=t,mt(e,"update"),this.lastValue=t)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(t,e){ot(this,e?[]:["change"],()=>{this.clear(e),this.addItems(t,e)})}setMaxItems(t){0===t&&(t=null),this.settings.maxItems=t,this.refreshState()}setActiveItem(t,e){var i,n,r,s,o,a,l=this;if("single"!==l.settings.mode){if(!t)return l.clearActiveItems(),void(l.isFocused&&l.inputState());if("click"===(i=e&&e.type.toLowerCase())&&ct("shiftKey",e)&&l.activeItems.length){for(a=l.getLastActive(),(r=Array.prototype.indexOf.call(l.control.children,a))>(s=Array.prototype.indexOf.call(l.control.children,t))&&(o=r,r=s,s=o),n=r;n<=s;n++)t=l.control.children[n],-1===l.activeItems.indexOf(t)&&l.setActiveItemClass(t);at(e)}else"click"===i&&ct(Dt,e)||"keydown"===i&&ct("shiftKey",e)?t.classList.contains("active")?l.removeActiveItem(t):l.setActiveItemClass(t):(l.clearActiveItems(),l.setActiveItemClass(t));l.inputState(),l.isFocused||l.focus()}}setActiveItemClass(t){const e=this,i=e.control.querySelector(".last-active");i&&yt(i,"last-active"),bt(t,"active last-active"),e.trigger("item_select",t),-1==e.activeItems.indexOf(t)&&e.activeItems.push(t)}removeActiveItem(t){var e=this.activeItems.indexOf(t);this.activeItems.splice(e,1),yt(t,"active")}clearActiveItems(){yt(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t,e=!0){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,St(this.focus_node,{"aria-activedescendant":t.getAttribute("id")}),St(t,{"aria-selected":"true"}),bt(t,"active"),e&&this.scrollToOption(t)))}scrollToOption(t,e){if(!t)return;const i=this.dropdown_content,n=i.clientHeight,r=i.scrollTop||0,s=t.offsetHeight,o=t.getBoundingClientRect().top-i.getBoundingClientRect().top+r;o+s>n+r?this.scroll(o-n+s,e):o<r&&this.scroll(o,e)}scroll(t,e){const i=this.dropdown_content;e&&(i.style.scrollBehavior=e),i.scrollTop=t,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(yt(this.activeOption,"active"),St(this.activeOption,{"aria-selected":null})),this.activeOption=null,St(this.focus_node,{"aria-activedescendant":null})}selectAll(){const t=this;if("single"===t.settings.mode)return;const e=t.controlChildren();e.length&&(t.inputState(),t.close(),t.activeItems=e,pt(e,e=>{t.setActiveItemClass(e)}))}inputState(){var t=this;t.control.contains(t.control_input)&&(St(t.control_input,{placeholder:t.settings.placeholder}),t.activeItems.length>0||!t.isFocused&&t.settings.hidePlaceholder&&t.items.length>0?(t.setTextboxValue(),t.isInputHidden=!0):(t.settings.hidePlaceholder&&t.items.length>0&&St(t.control_input,{placeholder:""}),t.isInputHidden=!1),t.wrapper.classList.toggle("input-hidden",t.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var t=this;t.isDisabled||t.isReadOnly||(t.ignoreFocus=!0,t.control_input.offsetWidth?t.control_input.focus():t.focus_node.focus(),setTimeout(()=>{t.ignoreFocus=!1,t.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())}getSearchOptions(){var t=this.settings,e=t.sortField;return"string"==typeof t.sortField&&(e=[{field:t.sortField}]),{fields:t.searchField,conjunction:t.searchConjunction,sort:e,nesting:t.nesting}}search(t){var e,i,n=this,r=this.getSearchOptions();if(n.settings.score&&"function"!=typeof(i=n.settings.score.call(n,t)))throw new Error('Tom Select "score" setting must be a function that returns a function');return t!==n.lastQuery?(n.lastQuery=t,e=n.sifter.search(t,Object.assign(r,{score:i})),n.currentResults=e):e=Object.assign({},n.currentResults),n.settings.hideSelected&&(e.items=e.items.filter(t=>{let e=it(t.id);return!(e&&-1!==n.items.indexOf(e))})),e}refreshOptions(t=!0){var e,i,n,r,s,o,a,l,c,d;const u={},h=[];var p=this,f=p.inputValue();const g=f===p.lastQuery||""==f&&null==p.lastQuery;var m=p.search(f),v=null,b=p.settings.shouldOpen||!1,y=p.dropdown_content;g&&(v=p.activeOption)&&(c=v.closest("[data-group]")),r=m.items.length,"number"==typeof p.settings.maxOptions&&(r=Math.min(r,p.settings.maxOptions)),r>0&&(b=!0);const _=(t,e)=>{let i=u[t];if(void 0!==i){let t=h[i];if(void 0!==t)return[i,t.fragment]}let n=document.createDocumentFragment();return i=h.length,h.push({fragment:n,order:e,optgroup:t}),[i,n]};for(e=0;e<r;e++){let t=m.items[e];if(!t)continue;let r=t.id,a=p.options[r];if(void 0===a)continue;let l=nt(r),d=p.getOption(l,!0);for(p.settings.hideSelected||d.classList.toggle("selected",p.items.includes(l)),s=a[p.settings.optgroupField]||"",i=0,n=(o=Array.isArray(s)?s:[s])&&o.length;i<n;i++){s=o[i];let t=a.$order,e=p.optgroups[s];void 0===e?s="":t=e.$order;const[n,l]=_(s,t);i>0&&(d=d.cloneNode(!0),St(d,{id:a.$id+"-clone-"+i,"aria-selected":null}),d.classList.add("ts-cloned"),yt(d,"active"),p.activeOption&&p.activeOption.dataset.value==r&&c&&c.dataset.group===s.toString()&&(v=d)),l.appendChild(d),""!=s&&(u[s]=n)}}var w;p.settings.lockOptgroupOrder&&h.sort((t,e)=>t.order-e.order),a=document.createDocumentFragment(),pt(h,t=>{let e=t.fragment,i=t.optgroup;if(!e||!e.children.length)return;let n=p.optgroups[i];if(void 0!==n){let t=document.createDocumentFragment(),i=p.render("optgroup_header",n);ht(t,i),ht(t,e);let r=p.render("optgroup",{group:n,options:t});ht(a,r)}else ht(a,e)}),y.innerHTML="",ht(y,a),p.settings.highlight&&(w=y.querySelectorAll("span.highlight"),Array.prototype.forEach.call(w,function(t){var e=t.parentNode;e.replaceChild(t.firstChild,t),e.normalize()}),m.query.length&&m.tokens.length&&pt(m.tokens,t=>{Ot(y,t.regex)}));var E=t=>{let e=p.render(t,{input:f});return e&&(b=!0,y.insertBefore(e,y.firstChild)),e};if(p.loading?E("loading"):p.settings.shouldLoad.call(p,f)?0===m.items.length&&E("no_results"):E("not_loading"),(l=p.canCreate(f))&&(d=E("option_create")),p.hasOptions=m.items.length>0||l,b){if(m.items.length>0){if(v||"single"!==p.settings.mode||null==p.items[0]||(v=p.getOption(p.items[0])),!y.contains(v)){let t=0;d&&!p.settings.addPrecedence&&(t=1),v=p.selectable()[t]}}else d&&(v=d);t&&!p.isOpen&&(p.open(),p.scrollToOption(v,"auto")),p.setActiveOption(v)}else p.clearActiveOption(),t&&p.isOpen&&p.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(t,e=!1){const i=this;if(Array.isArray(t))return i.addOptions(t,e),!1;const n=it(t[i.settings.valueField]);return null!==n&&!i.options.hasOwnProperty(n)&&(t.$order=t.$order||++i.order,t.$id=i.inputId+"-opt-"+t.$order,i.options[n]=t,i.lastQuery=null,e&&(i.userOptions[n]=e,i.trigger("option_add",n,t)),n)}addOptions(t,e=!1){pt(t,t=>{this.addOption(t,e)})}registerOption(t){return this.addOption(t)}registerOptionGroup(t){var e=it(t[this.settings.optgroupValueField]);return null!==e&&(t.$order=t.$order||++this.order,this.optgroups[e]=t,e)}addOptionGroup(t,e){var i;e[this.settings.optgroupValueField]=t,(i=this.registerOptionGroup(e))&&this.trigger("optgroup_add",i,e)}removeOptionGroup(t){this.optgroups.hasOwnProperty(t)&&(delete this.optgroups[t],this.clearCache(),this.trigger("optgroup_remove",t))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(t,e){const i=this;var n,r;const s=it(t),o=it(e[i.settings.valueField]);if(null===s)return;const a=i.options[s];if(null==a)return;if("string"!=typeof o)throw new Error("Value must be set in option data");const l=i.getOption(s),c=i.getItem(s);if(e.$order=e.$order||a.$order,delete i.options[s],i.uncacheValue(o),i.options[o]=e,l){if(i.dropdown_content.contains(l)){const t=i._render("option",e);Ct(l,t),i.activeOption===l&&i.setActiveOption(t)}l.remove()}c&&(-1!==(r=i.items.indexOf(s))&&i.items.splice(r,1,o),n=i._render("item",e),c.classList.contains("active")&&bt(n,"active"),Ct(c,n)),i.lastQuery=null}removeOption(t,e){const i=this;t=nt(t),i.uncacheValue(t),delete i.userOptions[t],delete i.options[t],i.lastQuery=null,i.trigger("option_remove",t),i.removeItem(t,e)}clearOptions(t){const e=(t||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();const i={};pt(this.options,(t,n)=>{e(t,n)&&(i[n]=t)}),this.options=this.sifter.items=i,this.lastQuery=null,this.trigger("option_clear")}clearFilter(t,e){return this.items.indexOf(e)>=0}getOption(t,e=!1){const i=it(t);if(null===i)return null;const n=this.options[i];if(null!=n){if(n.$div)return n.$div;if(e)return this._render("option",n)}return null}getAdjacent(t,e,i="option"){var n;if(!t)return null;n="item"==i?this.controlChildren():this.dropdown_content.querySelectorAll("[data-selectable]");for(let i=0;i<n.length;i++)if(n[i]==t)return e>0?n[i+1]:n[i-1];return null}getItem(t){if("object"==typeof t)return t;var e=it(t);return null!==e?this.control.querySelector(`[data-value="${ut(e)}"]`):null}addItems(t,e){var i=this,n=Array.isArray(t)?t:[t];const r=(n=n.filter(t=>-1===i.items.indexOf(t)))[n.length-1];n.forEach(t=>{i.isPending=t!==r,i.addItem(t,e)})}addItem(t,e){ot(this,e?[]:["change","dropdown_close"],()=>{var i,n;const r=this,s=r.settings.mode,o=it(t);if((!o||-1===r.items.indexOf(o)||("single"===s&&r.close(),"single"!==s&&r.settings.duplicates))&&null!==o&&r.options.hasOwnProperty(o)&&("single"===s&&r.clear(e),"multi"!==s||!r.isFull())){if(i=r._render("item",r.options[o]),r.control.contains(i)&&(i=i.cloneNode(!0)),n=r.isFull(),r.items.splice(r.caretPos,0,o),r.insertAtCaret(i),r.isSetup){if(!r.isPending&&r.settings.hideSelected){let t=r.getOption(o),e=r.getAdjacent(t,1);e&&r.setActiveOption(e)}r.isPending||r.settings.closeAfterSelect||r.refreshOptions(r.isFocused&&"single"!==s),0!=r.settings.closeAfterSelect&&r.isFull()?r.close():r.isPending||r.positionDropdown(),r.trigger("item_add",o,i),r.isPending||r.updateOriginalInput({silent:e})}(!r.isPending||!n&&r.isFull())&&(r.inputState(),r.refreshState())}})}removeItem(t=null,e){const i=this;if(!(t=i.getItem(t)))return;var n,r;const s=t.dataset.value;n=kt(t),t.remove(),t.classList.contains("active")&&(r=i.activeItems.indexOf(t),i.activeItems.splice(r,1),yt(t,"active")),i.items.splice(n,1),i.lastQuery=null,!i.settings.persist&&i.userOptions.hasOwnProperty(s)&&i.removeOption(s,e),n<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:e}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",s,t)}createItem(t=null,e=()=>{}){3===arguments.length&&(e=arguments[2]),"function"!=typeof e&&(e=()=>{});var i,n=this,r=n.caretPos;if(t=t||n.inputValue(),!n.canCreate(t))return e(),!1;n.lock();var s=!1,o=t=>{if(n.unlock(),!t||"object"!=typeof t)return e();var i=it(t[n.settings.valueField]);if("string"!=typeof i)return e();n.setTextboxValue(),n.addOption(t,!0),n.setCaret(r),n.addItem(i),e(t),s=!0};return i="function"==typeof n.settings.create?n.settings.create.call(this,t,o):{[n.settings.labelField]:t,[n.settings.valueField]:t},s||o(i),!0}refreshItems(){var t=this;t.lastQuery=null,t.isSetup&&t.addItems(t.items),t.updateOriginalInput(),t.refreshState()}refreshState(){const t=this;t.refreshValidityState();const e=t.isFull(),i=t.isLocked;t.wrapper.classList.toggle("rtl",t.rtl);const n=t.wrapper.classList;var r;n.toggle("focus",t.isFocused),n.toggle("disabled",t.isDisabled),n.toggle("readonly",t.isReadOnly),n.toggle("required",t.isRequired),n.toggle("invalid",!t.isValid),n.toggle("locked",i),n.toggle("full",e),n.toggle("input-active",t.isFocused&&!t.isInputHidden),n.toggle("dropdown-active",t.isOpen),n.toggle("has-options",(r=t.options,0===Object.keys(r).length)),n.toggle("has-items",t.items.length>0)}refreshValidityState(){var t=this;t.input.validity&&(t.isValid=t.input.validity.valid,t.isInvalid=!t.isValid)}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(t={}){const e=this;var i,n;const r=e.input.querySelector('option[value=""]');if(e.is_select_tag){const s=[],o=e.input.querySelectorAll("option:checked").length;function a(t,i,n){return t||(t=ft('<option value="'+rt(i)+'">'+rt(n)+"</option>")),t!=r&&e.input.append(t),s.push(t),(t!=r||o>0)&&(t.selected=!0),t}e.input.querySelectorAll("option:checked").forEach(t=>{t.selected=!1}),0==e.items.length&&"single"==e.settings.mode?a(r,"",""):e.items.forEach(t=>{if(i=e.options[t],n=i[e.settings.labelField]||"",s.includes(i.$option)){a(e.input.querySelector(`option[value="${ut(t)}"]:not(:checked)`),t,n)}else i.$option=a(i.$option,t,n)})}else e.input.value=e.getValue();e.isSetup&&(t.silent||e.trigger("change",e.getValue()))}open(){var t=this;t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,St(t.focus_node,{"aria-expanded":"true"}),t.refreshState(),vt(t.dropdown,{visibility:"hidden",display:"block"}),t.positionDropdown(),vt(t.dropdown,{visibility:"visible",display:"block"}),t.focus(),t.trigger("dropdown_open",t.dropdown))}close(t=!0){var e=this,i=e.isOpen;t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.inputState()),e.isOpen=!1,St(e.focus_node,{"aria-expanded":"false"}),vt(e.dropdown,{display:"none"}),e.settings.hideSelected&&e.clearActiveOption(),e.refreshState(),i&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var t=this.control,e=t.getBoundingClientRect(),i=t.offsetHeight+e.top+window.scrollY,n=e.left+window.scrollX;vt(this.dropdown,{width:e.width+"px",top:i+"px",left:n+"px"})}}clear(t){var e=this;if(e.items.length){var i=e.controlChildren();pt(i,t=>{e.removeItem(t,!0)}),e.inputState(),t||e.updateOriginalInput(),e.trigger("clear")}}insertAtCaret(t){const e=this,i=e.caretPos,n=e.control;n.insertBefore(t,n.children[i]||null),e.setCaret(i+1)}deleteSelection(t){var e,i,n,r,s,o=this;e=t&&8===t.keyCode?-1:1,i={start:(s=o.control_input).selectionStart||0,length:(s.selectionEnd||0)-(s.selectionStart||0)};const a=[];if(o.activeItems.length)r=At(o.activeItems,e),n=kt(r),e>0&&n++,pt(o.activeItems,t=>a.push(t));else if((o.isFocused||"single"===o.settings.mode)&&o.items.length){const t=o.controlChildren();let n;e<0&&0===i.start&&0===i.length?n=t[o.caretPos-1]:e>0&&i.start===o.inputValue().length&&(n=t[o.caretPos]),void 0!==n&&a.push(n)}if(!o.shouldDelete(a,t))return!1;for(at(t,!0),void 0!==n&&o.setCaret(n);a.length;)o.removeItem(a.pop());return o.inputState(),o.positionDropdown(),o.refreshOptions(!1),!0}shouldDelete(t,e){const i=t.map(t=>t.dataset.value);return!(!i.length||"function"==typeof this.settings.onDelete&&!1===this.settings.onDelete(i,e))}advanceSelection(t,e){var i,n,r=this;r.rtl&&(t*=-1),r.inputValue().length||(ct(Dt,e)||ct("shiftKey",e)?(n=(i=r.getLastActive(t))?i.classList.contains("active")?r.getAdjacent(i,t,"item"):i:t>0?r.control_input.nextElementSibling:r.control_input.previousElementSibling)&&(n.classList.contains("active")&&r.removeActiveItem(i),r.setActiveItemClass(n)):r.moveCaret(t))}moveCaret(t){}getLastActive(t){let e=this.control.querySelector(".last-active");if(e)return e;var i=this.control.querySelectorAll(".active");return i?At(i,t):void 0}setCaret(t){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(t=this.isReadOnly||this.isDisabled){this.isLocked=t,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(t){this.focus_node.tabIndex=t?-1:this.tabIndex,this.isDisabled=t,this.input.disabled=t,this.control_input.disabled=t,this.setLocked()}setReadOnly(t){this.isReadOnly=t,this.input.readOnly=t,this.control_input.readOnly=t,this.setLocked()}destroy(){var t=this,e=t.revertSettings;t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.innerHTML=e.innerHTML,t.input.tabIndex=e.tabIndex,yt(t.input,"tomselected","ts-hidden-accessible"),t._destroy(),delete t.input.tomselect}render(t,e){var i,n;const r=this;if("function"!=typeof this.settings.render[t])return null;if(!(n=r.settings.render[t].call(this,e,rt)))return null;if(n=ft(n),"option"===t||"option_create"===t?e[r.settings.disabledField]?St(n,{"aria-disabled":"true"}):St(n,{"data-selectable":""}):"optgroup"===t&&(i=e.group[r.settings.optgroupValueField],St(n,{"data-group":i}),e.group[r.settings.disabledField]&&St(n,{"data-disabled":""})),"option"===t||"item"===t){const i=nt(e[r.settings.valueField]);St(n,{"data-value":i}),"item"===t?(bt(n,r.settings.itemClass),St(n,{"data-ts-item":""})):(bt(n,r.settings.optionClass),St(n,{role:"option",id:e.$id}),e.$div=n,r.options[i]=e)}return n}_render(t,e){const i=this.render(t,e);if(null==i)throw"HTMLElement expected";return i}clearCache(){pt(this.options,t=>{t.$div&&(t.$div.remove(),delete t.$div)})}uncacheValue(t){const e=this.getOption(t);e&&e.remove()}canCreate(t){return this.settings.create&&t.length>0&&this.settings.createFilter.call(this,t)}hook(t,e,i){var n=this,r=n[e];n[e]=function(){var e,s;return"after"===t&&(e=r.apply(n,arguments)),s=i.apply(n,arguments),"instead"===t?s:("before"===t&&(e=r.apply(n,arguments)),e)}}};const Mt=t=>"boolean"==typeof t?t?"1":"0":t+"",Ft=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},Nt=t=>"string"==typeof t&&t.indexOf("<")>-1;const jt=t=>"string"==typeof t&&t.indexOf("<")>-1;const Pt=(t,e,i,n)=>{t.addEventListener(e,i,n)},$t=t=>"string"==typeof t&&t.indexOf("<")>-1,Ht=(t,e)=>{((t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)})(e,(e,i)=>{null==e?t.removeAttribute(i):t.setAttribute(i,""+e)})};const qt=t=>"string"==typeof t&&t.indexOf("<")>-1;const Rt=t=>{var e=[];return((t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)})(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},Bt=t=>(Array.isArray(t)||(t=[t]),t);const Vt=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(zt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},zt=t=>"string"==typeof t&&t.indexOf("<")>-1,Wt=t=>{var e=[];return((t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)})(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},Yt=t=>(Array.isArray(t)||(t=[t]),t);const Kt=(t,e,i,n)=>{t.addEventListener(e,i,n)};const Ut=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},Xt=(t,e,i,n)=>{t.addEventListener(e,i,n)},Qt=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(Gt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},Gt=t=>"string"==typeof t&&t.indexOf("<")>-1;const Jt=t=>{var e=[];return((t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)})(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},Zt=t=>(Array.isArray(t)||(t=[t]),t);It.define("change_listener",function(){var t,e,i,n;t=this.input,e="change",i=()=>{this.sync()},t.addEventListener(e,i,n)}),It.define("checkbox_options",function(t){var e=this,i=e.onOptionSelect;e.settings.hideSelected=!1;const n=Object.assign({className:"tomselect-checkbox",checkedClassNames:void 0,uncheckedClassNames:void 0},t);var r=function(t,e){e?(t.checked=!0,n.uncheckedClassNames&&t.classList.remove(...n.uncheckedClassNames),n.checkedClassNames&&t.classList.add(...n.checkedClassNames)):(t.checked=!1,n.checkedClassNames&&t.classList.remove(...n.checkedClassNames),n.uncheckedClassNames&&t.classList.add(...n.uncheckedClassNames))},s=function(t){setTimeout(()=>{var e=t.querySelector("input."+n.className);e instanceof HTMLInputElement&&r(e,t.classList.contains("selected"))},1)};e.hook("after","setupTemplates",()=>{var t=e.settings.render.option;e.settings.render.option=(i,s)=>{var o=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(Nt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(t.call(e,i,s)),a=document.createElement("input");n.className&&a.classList.add(n.className),a.addEventListener("click",function(t){Ft(t)}),a.type="checkbox";const l=null==(c=i[e.settings.valueField])?null:Mt(c);var c;return r(a,!!(l&&e.items.indexOf(l)>-1)),o.prepend(a),o}}),e.on("item_remove",t=>{var i=e.getOption(t);i&&(i.classList.remove("selected"),s(i))}),e.on("item_add",t=>{var i=e.getOption(t);i&&s(i)}),e.hook("instead","onOptionSelect",(t,n)=>{if(n.classList.contains("selected"))return n.classList.remove("selected"),e.removeItem(n.dataset.value),e.refreshOptions(),void Ft(t,!0);i.call(e,t,n),s(n)})}),It.define("clear_button",function(t){const e=this,i=Object.assign({className:"clear-button",title:"Clear All",html:t=>`<div class="${t.className}" title="${t.title}">&#10799;</div>`},t);e.on("initialize",()=>{var t=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(jt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(i.html(i));t.addEventListener("click",t=>{e.isLocked||(e.clear(),"single"===e.settings.mode&&e.settings.allowEmptyOption&&e.addItem(""),t.preventDefault(),t.stopPropagation())}),e.control.appendChild(t)})}),It.define("drag_drop",function(){var t=this;if("multi"!==t.settings.mode)return;var e=t.lock,i=t.unlock;let n,r=!0;t.hook("after","setupTemplates",()=>{var e=t.settings.render.item;t.settings.render.item=(i,s)=>{const o=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if($t(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(e.call(t,i,s));Ht(o,{draggable:"true"});const a=t=>{t.preventDefault(),o.classList.add("ts-drag-over"),l(o,n)},l=(t,e)=>{var i,n,r;void 0!==e&&(((t,e)=>{do{var i;if(t==(e=null==(i=e)?void 0:i.previousElementSibling))return!0}while(e&&e.previousElementSibling);return!1})(e,o)?(n=e,null==(r=(i=t).parentNode)||r.insertBefore(n,i.nextSibling)):((t,e)=>{var i;null==(i=t.parentNode)||i.insertBefore(e,t)})(t,e))};return Pt(o,"mousedown",t=>{r||((t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())})(t),t.stopPropagation()}),Pt(o,"dragstart",t=>{n=o,setTimeout(()=>{o.classList.add("ts-dragging")},0)}),Pt(o,"dragenter",a),Pt(o,"dragover",a),Pt(o,"dragleave",()=>{o.classList.remove("ts-drag-over")}),Pt(o,"dragend",()=>{var e;document.querySelectorAll(".ts-drag-over").forEach(t=>t.classList.remove("ts-drag-over")),null==(e=n)||e.classList.remove("ts-dragging"),n=void 0;var i=[];t.control.querySelectorAll("[data-value]").forEach(t=>{if(t.dataset.value){let e=t.dataset.value;e&&i.push(e)}}),t.setValue(i)}),o}}),t.hook("instead","lock",()=>(r=!1,e.call(t))),t.hook("instead","unlock",()=>(r=!0,i.call(t)))}),It.define("dropdown_header",function(t){const e=this,i=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:t=>'<div class="'+t.headerClass+'"><div class="'+t.titleRowClass+'"><span class="'+t.labelClass+'">'+t.title+'</span><a class="'+t.closeClass+'">&times;</a></div></div>'},t);e.on("initialize",()=>{var t=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(qt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(i.html(i)),n=t.querySelector("."+i.closeClass);n&&n.addEventListener("click",t=>{((t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())})(t,!0),e.close()}),e.dropdown.insertBefore(t,e.dropdown.firstChild)})}),It.define("caret_position",function(){var t=this;t.hook("instead","setCaret",e=>{"single"!==t.settings.mode&&t.control.contains(t.control_input)?(e=Math.max(0,Math.min(t.items.length,e)))==t.caretPos||t.isPending||t.controlChildren().forEach((i,n)=>{n<e?t.control_input.insertAdjacentElement("beforebegin",i):t.control.appendChild(i)}):e=t.items.length,t.caretPos=e}),t.hook("instead","moveCaret",e=>{if(!t.isFocused)return;const i=t.getLastActive(e);if(i){const n=((t,e)=>{if(!t)return-1;e=e||t.nodeName;for(var i=0;t=t.previousElementSibling;)t.matches(e)&&i++;return i})(i);t.setCaret(e>0?n+1:n),t.setActiveItem(),((t,...e)=>{var i=Rt(e);(t=Bt(t)).map(t=>{i.map(e=>{t.classList.remove(e)})})})(i,"last-active")}else t.setCaret(t.caretPos+e)})}),It.define("dropdown_input",function(){const t=this;t.settings.shouldOpen=!0,t.hook("before","setup",()=>{t.focus_node=t.control,((t,...e)=>{var i=Wt(e);(t=Yt(t)).map(t=>{i.map(e=>{t.classList.add(e)})})})(t.control_input,"dropdown-input");const e=Vt('<div class="dropdown-input-wrap">');e.append(t.control_input),t.dropdown.insertBefore(e,t.dropdown.firstChild);const i=Vt('<input class="items-placeholder" tabindex="-1" />');i.placeholder=t.settings.placeholder||"",t.control.append(i)}),t.on("initialize",()=>{t.control_input.addEventListener("keydown",e=>{switch(e.keyCode){case 27:return t.isOpen&&(((t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())})(e,!0),t.close()),void t.clearActiveItems();case 9:t.focus_node.tabIndex=-1}return t.onKeyDown.call(t,e)}),t.on("blur",()=>{t.focus_node.tabIndex=t.isDisabled?-1:t.tabIndex}),t.on("dropdown_open",()=>{t.control_input.focus()});const e=t.onBlur;var i,n,r,s;t.hook("instead","onBlur",i=>{if(!i||i.relatedTarget!=t.control_input)return e.call(t)}),i=t.control_input,n="blur",r=()=>t.onBlur(),i.addEventListener(n,r,s),t.hook("before","close",()=>{t.isOpen&&t.focus_node.focus({preventScroll:!0})})})}),It.define("input_autogrow",function(){var t=this;t.on("initialize",()=>{var e=document.createElement("span"),i=t.control_input;e.style.cssText="position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ",t.wrapper.appendChild(e);for(const t of["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"])e.style[t]=i.style[t];var n=()=>{e.textContent=i.value,i.style.width=e.clientWidth+"px"};n(),t.on("update item_add item_remove",n),Kt(i,"input",n),Kt(i,"keyup",n),Kt(i,"blur",n),Kt(i,"update",n)})}),It.define("no_backspace_delete",function(){var t=this,e=t.deleteSelection;this.hook("instead","deleteSelection",i=>!!t.activeItems.length&&e.call(t,i))}),It.define("no_active_items",function(){this.hook("instead","setActiveItem",()=>{}),this.hook("instead","selectAll",()=>{})}),It.define("optgroup_columns",function(){var t=this,e=t.onKeyDown;t.hook("instead","onKeyDown",i=>{var n,r,s,o;if(!t.isOpen||37!==i.keyCode&&39!==i.keyCode)return e.call(t,i);t.ignoreHover=!0,o=((t,e)=>{for(;t&&t.matches;){if(t.matches(e))return t;t=t.parentNode}})(t.activeOption,"[data-group]"),n=((t,e)=>{if(!t)return-1;e=e||t.nodeName;for(var i=0;t=t.previousElementSibling;)t.matches(e)&&i++;return i})(t.activeOption,"[data-selectable]"),o&&(o=37===i.keyCode?o.previousSibling:o.nextSibling)&&(r=(s=o.querySelectorAll("[data-selectable]"))[Math.min(s.length-1,n)])&&t.setActiveOption(r)})}),It.define("remove_button",function(t){const e=Object.assign({label:"&times;",title:"Remove",className:"remove",append:!0},t);var i=this;if(e.append){var n='<a href="javascript:void(0)" class="'+e.className+'" tabindex="-1" title="'+((e.title+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")+'">')+e.label+"</a>";i.hook("after","setupTemplates",()=>{var t=i.settings.render.item;i.settings.render.item=(e,r)=>{var s=Qt(t.call(i,e,r)),o=Qt(n);return s.appendChild(o),Xt(o,"mousedown",t=>{Ut(t,!0)}),Xt(o,"click",t=>{i.isLocked||(Ut(t,!0),i.isLocked||i.shouldDelete([s],t)&&(i.removeItem(s),i.refreshOptions(!1),i.inputState()))}),s}})}}),It.define("restore_on_backspace",function(t){const e=this,i=Object.assign({text:t=>t[e.settings.labelField]},t);e.on("item_remove",function(t){if(e.isFocused&&""===e.control_input.value.trim()){var n=e.options[t];n&&e.setTextboxValue(i.text.call(e,n))}})}),It.define("virtual_scroll",function(){const t=this,e=t.canLoad,i=t.clearActiveOption,n=t.loadCallback;var r,s,o={},a=!1,l=[];if(t.settings.shouldLoadMore||(t.settings.shouldLoadMore=()=>{if(r.clientHeight/(r.scrollHeight-r.scrollTop)>.9)return!0;if(t.activeOption){var e=t.selectable();if(Array.from(e).indexOf(t.activeOption)>=e.length-2)return!0}return!1}),!t.settings.firstUrl)throw"virtual_scroll plugin requires a firstUrl() method";t.settings.sortField=[{field:"$order"},{field:"$score"}];const c=e=>!("number"==typeof t.settings.maxOptions&&r.children.length>=t.settings.maxOptions)&&!(!(e in o)||!o[e]),d=(e,i)=>t.items.indexOf(i)>=0||l.indexOf(i)>=0;t.setNextUrl=(t,e)=>{o[t]=e},t.getUrl=e=>{if(e in o){const t=o[e];return o[e]=!1,t}return t.clearPagination(),t.settings.firstUrl.call(t,e)},t.clearPagination=()=>{o={}},t.hook("instead","clearActiveOption",()=>{if(!a)return i.call(t)}),t.hook("instead","canLoad",i=>i in o?c(i):e.call(t,i)),t.hook("instead","loadCallback",(e,i)=>{if(a){if(s){const i=e[0];void 0!==i&&(s.dataset.value=i[t.settings.valueField])}}else t.clearOptions(d);n.call(t,e,i),a=!1}),t.hook("after","refreshOptions",()=>{const e=t.lastValue;var i;c(e)?(i=t.render("loading_more",{query:e}))&&(i.setAttribute("data-selectable",""),s=i):e in o&&!r.querySelector(".no-results")&&(i=t.render("no_more_results",{query:e})),i&&(((t,...e)=>{var i=Jt(e);(t=Zt(t)).map(t=>{i.map(e=>{t.classList.add(e)})})})(i,t.settings.optionClass),r.append(i))}),t.on("initialize",()=>{l=Object.keys(t.options),r=t.dropdown_content,t.settings.render=Object.assign({},{loading_more:()=>'<div class="loading-more-results">Loading more results ... </div>',no_more_results:()=>'<div class="no-more-results">No more results</div>'},t.settings.render),r.addEventListener("scroll",()=>{t.settings.shouldLoadMore.call(t)&&c(t.lastValue)&&(a||(a=!0,t.load.call(t,t.lastValue)))})})});class te{constructor(t){this.datepicker=t}onDatagridInit(t){return t.ajax.addEventListener("complete",e=>{this.initDatepicker(t)}),this.initDatepicker(t),!0}initDatepicker(t){const e=t.el.querySelectorAll("input[data-provide='datepicker']");e.length>=1&&this.datepicker.initDatepickers(Array.from(e),t)}}class ee{constructor(t){this.happy=t}onDatagridInit(t){var e,i;const n=null!==(i=null!==(e=this.happy)&&void 0!==e?e:w().happy)&&void 0!==i?i:null;return n&&n.init(),!0}}class ie{constructor(t){this.nette=t}onDatagridInit(t){var e,i;const n=null!==(i=null!==(e=this.nette)&&void 0!==e?e:w().Nette)&&void 0!==i?i:null;return n&&t.el.querySelectorAll("form").forEach(t=>n.initForm(t)),!0}}class ne{constructor(t){this.selectpicker=t}onDatagridInit(t){return t.ajax.addEventListener("complete",e=>{this.initSelectpicker(t)}),this.initSelectpicker(t),!0}initSelectpicker(t){const e=t.el.querySelectorAll("select.selectpicker");e.length>=1&&this.selectpicker.initSelectpickers(Array.from(e),t)}}class re{constructor(t){this.sortable=t}onDatagridInit(t){return t.ajax.addEventListener("before",t=>{}),this.sortable.initSortable(t),t.ajax.addEventListener("success",({detail:{payload:e}})=>{if(e._datagrid_sort){for(const i in e._datagrid_sort){const n=e._datagrid_sort[i],r=t.el.querySelector(`#datagrid-sort-${i}`);r&&(r.setAttribute("href",n),r.setAttribute("data-href",n))}this.sortable.initSortable(t)}if(e._datagrid_tree){const i=t.el.querySelector(`.datagrid-tree-item[data-id='${e._datagrid_tree}'] .datagrid-tree-item-children`);if(i&&e.snippets){i.classList.add("loaded");for(const t in e.snippets){const n=e.snippets[t],r=(new DOMParser).parseFromString(n,"text/html").firstElementChild;if(r){const e=document.createElement("div");e.id=t,e.classList.add("datagrid-tree-item"),e.setAttribute("data-id",t),r.hasAttribute("has-children")&&e.classList.add("has-children"),i.append(e)}}}this.sortable.initSortableTree(t)}}),!0}}class se{onDatagridInit(t){return t.ajax.addEventListener("complete",e=>{this.initPerPage(t),this.initChange(t)}),this.initPerPage(t),this.initChange(t),!0}initPerPage(t){t.el.querySelectorAll("select[data-autosubmit-per-page]").forEach(e=>{e.addEventListener("change",()=>{var i,n;let r=null===(i=e.parentElement)||void 0===i?void 0:i.querySelector("input[type=submit]");if(r||(r=null===(n=e.parentElement)||void 0===n?void 0:n.querySelector("button[type=submit]")),console.log({inputEl:r}),!(r instanceof HTMLElement))return;const s=r.closest("form");console.log({form:s}),s&&t.ajax.submitForm(s)})})}initChange(t){t.el.querySelectorAll("[data-autosubmit]").forEach(e=>{const i=e.closest("form");i&&"true"!==e.dataset.listenersAttached&&(e.dataset.listenersAttached="true",e instanceof HTMLSelectElement?e.addEventListener("change",()=>t.ajax.submitForm(i)):e instanceof HTMLInputElement&&(e.hasAttribute("data-autosubmit-change")&&e.addEventListener("change",E(()=>t.ajax.submitForm(i))),e.addEventListener("keyup",E(e=>{if(_(e)||!function(t,e,i){const n=1===t.key.length?t.key.charCodeAt(0):0;return n>=e&&n<=i}(e,9,40)&&!function(t){return 2===t.key.length&&t.key.startsWith("F")}(e))return t.ajax.submitForm(i)}))))})}}class oe{onDatagridInit(t){let e=null;t.el.addEventListener("click",t=>{if(t.target instanceof HTMLElement&&t.target.classList.contains("col-checkbox")&&(e=t.target,t.shiftKey&&e)){const t=e.closest("tr");if(!t)return;const i=e.closest("tr");if(!i)return;const n=i.closest("tbody");if(!n)return;const r=Array.from(n.querySelectorAll("tr")),[s,o]=[i.rowIndex,t.rowIndex].sort();r.slice(s,o+1).forEach(t=>{const e=t.querySelector('.col-checkbox input[type="checkbox"]');e&&(e.checked=!0)})}});let i=t.el.querySelectorAll(`input[data-check='${t.name}']`);const n=t.el.querySelector("select[name='group_action[group_action]']"),r=document.querySelectorAll(".row-group-actions *[type='submit']"),s=document.querySelector(".datagrid-selected-rows-count");return i.forEach(e=>{e.addEventListener("change",()=>{if(e.hasAttribute("data-check-all")){if(t.name!==e.getAttribute("data-check-all"))return;if(i.forEach(t=>t.checked=e.checked),r.forEach(t=>t.disabled=!e.checked),n&&(n.disabled=!e.checked),s){const t=Array.from(i).filter(t=>!t.hasAttribute("data-check-all")).length;s.innerText=`${e.checked?t:0}/${t}`}return}{const e=t.el.querySelector(`input[data-check='${t.name}'][data-check-all]`);e&&(e.checked=Array.from(i).filter(t=>!t.hasAttribute("data-check-all")).every(t=>t.checked))}const o=Array.from(i).filter(t=>t.checked&&!e.hasAttribute("data-check-all")),a=o.length>=1;r.forEach(t=>t.disabled=!a),n&&(n.disabled=!a),s&&(s.innerText=`${o.length}/${i.length}`)})}),!0}}const ae="data-datagrid-confirm";class le{onDatagridInit(t){return t.el.querySelectorAll(`[${ae}]:not(.ajax)`).forEach(e=>e.addEventListener("click",e=>this.confirmEventHandler.bind(t)(e.target,e))),t.ajax.addEventListener("interact",e=>this.confirmEventHandler.bind(t)(e.detail.element,e)),!0}confirmEventHandler(t,e){var i;const n=null===(i=t.closest("a"))||void 0===i?void 0:i.getAttribute(ae);n&&(window.confirm.bind(window)(n)||(e.stopPropagation(),e.preventDefault()))}}class ce{onInit(t){}onDatagridInit(t){return t.ajax.addEventListener("success",({detail:{payload:e}})=>{var i,n;if(e._datagrid_name&&e._datagrid_name===t.name){if(e._datagrid_inline_edited||e._datagrid_inline_edit_cancel){const i=t.el.querySelector(".datagrid-inline-edit-trigger");if(e._datagrid_inline_edited){t.el.querySelectorAll(`tr[data-id='${e._datagrid_inline_edited}'] > td`).forEach(t=>{t.classList.add("edited")})}return void(null==i||i.classList.remove("hidden"))}if(e._datagrid_inline_adding){const e=t.el.querySelector(".datagrid-row-inline-add");e&&(e.classList.remove("datagrid-row-inline-add-hidden"),null===(i=e.querySelector("input:not([readonly]), textarea:not([readonly])"))||void 0===i||i.focus())}e._datagrid_inline_editing&&(null===(n=t.el.querySelector(".datagrid-inline-edit-trigger"))||void 0===n||n.classList.add("hidden")),t.el.querySelectorAll(".datagrid-inline-edit input").forEach(t=>{t.addEventListener("keydown",e=>{var i,n;if(_(e))return e.stopPropagation(),e.preventDefault(),null===(n=null===(i=t.closest("tr"))||void 0===i?void 0:i.querySelector(".col-action-inline-edit [name='inline_edit[submit]']"))||void 0===n?void 0:n.click()})}),t.el.querySelectorAll(".datagrid-inline-add input").forEach(t=>{t.addEventListener("keydown",e=>{var i,n;if(_(e))return e.stopPropagation(),e.preventDefault(),null===(n=null===(i=t.closest("tr"))||void 0===i?void 0:i.querySelector(".col-action-inline-edit [name='inline_add[submit]']"))||void 0===n?void 0:n.click()})}),t.el.querySelectorAll("[data-datagrid-cancel-inline-add]").forEach(t=>{t.addEventListener("mouseup",e=>{if(0===e.button){e.stopPropagation(),e.preventDefault();const i=t.closest(".datagrid-row-inline-add");i&&i.classList.add("datagrid-row-inline-add-hidden")}})})}}),!0}}class de{onDatagridInit(t){return t.el.querySelectorAll("[data-toggle-detail-grid]").forEach(e=>{if(e.getAttribute("data-toggle-detail-grid")!==t.name)return;const i=e.getAttribute("data-toggle-detail");e.addEventListener("click",n=>{const r=t.el.querySelector(`.item-detail-${t.name}-id-${i}`);e.closest("tr"),r&&(r.classList.add("datagrid--content-row"),r.classList.toggle("is-active")),t.ajax.addEventListener("before",e=>{e.detail.params.url.includes(`do=${t.name}-getItemDetail`)&&e.detail.params.url.includes(`grid-id=${i}`)&&(e.stopPropagation(),e.preventDefault())})})}),t.ajax.addEventListener("success",({detail:{payload:e}})=>{var i;e._datagrid_redraw_item_id&&e._datagrid_redraw_item_class&&(null===(i=t.el.querySelector(`tr[data-id='${e._datagrid_redraw_item_id}']`))||void 0===i||i.setAttribute("class",e._datagrid_redraw_item_class))}),!0}}class ue{onDatagridInit(t){return t.ajax.addEventListener("before",t=>{}),t.ajax.addEventListener("success",({detail:{payload:t}})=>{var e,i;if(t._datagrid_tree){const n=t._datagrid_tree,r=document.querySelector(`.datagrid-tree-item[data-id="${n}"]`),s=document.querySelector(`.datagrid-tree-item[data-id="${n}"] .datagrid-tree-item-children`);if(s){if(s.classList.contains("showed")){if(s.innerHTML="",s.classList.remove("showed"),r){const t=r.querySelector("a.chevron");t&&(t.style.transform="rotate(0deg)")}return}if(s.classList.add("showed"),r){const t=r.querySelector("a.chevron");t&&(t.style.transform="rotate(90deg)")}const n=t.snippets;for(const t in n){const r=n[t],o=(new DOMParser).parseFromString(r,"text/html").querySelector("[data-id]"),a=null!==(e=null==o?void 0:o.getAttribute("data-id"))&&void 0!==e?e:"",l=`\n<div class="datagrid-tree-item" class='${null!==(i=null==o?void 0:o.hasAttribute("data-has-children"))&&void 0!==i&&i?"has-children":""}' id="${t}" data-id="${a}">${r}</div>`;s.innerHTML=l}}}}),!0}}class he{constructor(){this.colors=["primary","success","info","warning","danger","white","gray"],this.templates={radio:'<div class="happy-radio"><b></b></div>',checkbox:'<div class="happy-checkbox"><svg viewBox="0 0 30 30"><rect class="mark-storke" x="15" y="3" rx="1" ry="1" width="10" height="4"/><rect class="mark-storke" x="-7" y="21" rx="1" ry="1" width="19" height="4"/></svg></div>',text:"",textarea:""}}init(){this.removeBySelector(".happy-radio"),this.removeBySelector(".happy-checkbox"),this.initRadio(),this.initCheckbox()}reset(){this.init()}addColorToInput(t,e,i){t.classList.contains(i)&&e.classList.add(i),i=`${i}-border`,t.classList.contains(i)&&e.classList.add(i)}addThinkessToInput(t,e){t.classList.contains("thin")&&e.classList.add("thin")}setNames(t,e){var i,n;e.setAttribute("data-name",null!==(i=t.getAttribute("name"))&&void 0!==i?i:"");var r=t.getAttribute("value");"undefined"!==r&&null!==r&&e.setAttribute("data-value",null!==(n=t.getAttribute("value"))&&void 0!==n?n:"")}removeBySelector(t){document.querySelectorAll(t).forEach(t=>{var e;return null===(e=t.parentNode)||void 0===e?void 0:e.removeChild(t)})}initRadio(){document.querySelectorAll("input[type=radio].happy").forEach(t=>{t.insertAdjacentHTML("afterend",this.templates.radio);const e=t.nextElementSibling;e instanceof HTMLElement&&(this.colors.forEach(i=>{this.addColorToInput(t,e,i),this.setNames(t,e)}),this.addThinkessToInput(t,e)),this.checkRadioState(t),document.addEventListener("change",this.radioOnChange.bind(this))})}initCheckbox(){document.querySelectorAll("input[type=checkbox].happy").forEach(t=>{t.insertAdjacentHTML("afterend",this.templates.checkbox);const e=t.nextElementSibling;e instanceof HTMLElement&&(this.colors.forEach(i=>{this.addColorToInput(t,e,i),this.setNames(t,e)}),this.addThinkessToInput(t,e)),this.checkCheckboxState(t),document.addEventListener("click",this.checkCheckboxStateOnClick.bind(this)),document.addEventListener("change",this.checkCheckboxStateOnChange.bind(this))})}checkCheckboxStateOnClick(t){var e;const i=t.target,n=i instanceof SVGSVGElement?i.parentNode:i instanceof SVGGraphicsElement?null===(e=i.closest("svg"))||void 0===e?void 0:e.parentNode:i;if(!(n instanceof HTMLElement&&n.classList.contains("happy-checkbox")))return;t.preventDefault();const r=n.getAttribute("data-name"),s=n.getAttribute("data-value"),o=document.querySelector(`.happy-checkbox[data-name="${r}"]`+(s?`[value="${s}"]`:""));if(!(o instanceof HTMLInputElement))return;const a=n.classList.contains("active");o.checked=!a,a?n.classList.remove("active"):n.classList.add("active")}checkCheckboxStateOnChange({target:t}){t instanceof HTMLInputElement&&t.classList.contains("happy")&&this.checkCheckboxState(t)}checkRadioState(t){if(!t.checked||!t.hasAttribute("name"))return;const e=t.getAttribute("name"),i=t.getAttribute("value"),n=document.querySelector(`.happy-checkbox[data-name="${e}"]`+(i?`[data-value="${i}"]`:""));n&&n.classList.add("active")}checkCheckboxState(t){const e=t.getAttribute("name");if(!e)return;const i=t.getAttribute("value"),n=document.querySelector(`.happy-checkbox[data-name="${e}"]`+(i?`[data-value="${i}"]`:""));n&&(t.checked?n.classList.add("active"):n.classList.remove("active"))}radioOnChange({target:t}){if(!(t instanceof HTMLInputElement&&t.classList.contains("happy")&&t.hasAttribute("name")))return;const e=t.getAttribute("name");document.querySelectorAll(`.happy-radio[data-name="${e}"]`).forEach(t=>t.classList.remove("active")),this.checkRadioState(t)}}
7
+ */var b=(m||(m=1,v.exports=function(){class e{filled(e,t,i){return""!==i&&!1!==i&&null!==i&&(!Array.isArray(i)||i.length>0)&&(!(i instanceof FileList)||i.length>0)}blank(e,t,i){return!this.filled(e,t,i)}valid(e,t){return t.validateControl(e,void 0,!0)}equal(e,t,i){if(void 0===t)return null;let n=e=>"number"==typeof e||"string"==typeof e?""+e:!0===e?"1":"",r=Array.isArray(i)?i:[i],s=Array.isArray(t)?t:[t];e:for(let e of r){for(let t of s)if(n(e)===n(t))continue e;return!1}return r.length>0}notEqual(e,t,i){return void 0===t?null:!this.equal(e,t,i)}minLength(e,t,i){return(i="number"==typeof i?i.toString():i).length>=t}maxLength(e,t,i){return(i="number"==typeof i?i.toString():i).length<=t}length(e,t,i){return i="number"==typeof i?i.toString():i,(null===(t=Array.isArray(t)?t:[t,t])[0]||i.length>=t[0])&&(null===t[1]||i.length<=t[1])}email(e,t,i){return/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i.test(i)}url(e,t,i,n){return/^[a-z\d+.-]+:/.test(i)||(i="https://"+i),!!/^https?:\/\/((([-_0-9a-z\u00C0-\u02FF\u0370-\u1EFF]+\.)*[0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)?[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[[0-9a-f:]{3,39}\])(:\d{1,5})?(\/\S*)?$/i.test(i)&&(n.value=i,!0)}regexp(e,t,i){let n="string"==typeof t&&t.match(/^\/(.*)\/([imu]*)$/);try{return n&&new RegExp(n[1],n[2].replace("u","")).test(i)}catch{return null}}pattern(e,t,i,n,r){if("string"!=typeof t)return null;try{let e;try{e=new RegExp("^(?:"+t+")$",r?"ui":"u")}catch{e=new RegExp("^(?:"+t+")$",r?"i":"")}return i instanceof FileList?Array.from(i).every(t=>e.test(t.name)):e.test(i)}catch{return null}}patternCaseInsensitive(e,t,i){return this.pattern(e,t,i,null,!0)}numeric(e,t,i){return/^[0-9]+$/.test(i)}integer(e,t,i,n){return!!/^-?[0-9]+$/.test(i)&&(n.value=parseFloat(i),!0)}float(e,t,i,n){return i=i.replace(/ +/g,"").replace(/,/g,"."),!!/^-?[0-9]*\.?[0-9]+$/.test(i)&&(n.value=parseFloat(i),!0)}min(e,t,i){return Number.isFinite(t)&&(i=parseFloat(i)),i>=t}max(e,t,i){return Number.isFinite(t)&&(i=parseFloat(i)),i<=t}range(e,t,i){return Array.isArray(t)?"time"===e.type&&t[0]>t[1]?i>=t[0]||i<=t[1]:(null===t[0]||this.min(e,t[0],i))&&(null===t[1]||this.max(e,t[1],i)):null}submitted(e){return e.form["nette-submittedBy"]===e}fileSize(e,t,i){return Array.from(i).every(e=>e.size<=t)}mimeType(e,t,i){let n=[];(t=Array.isArray(t)?t:[t]).forEach(e=>n.push("^"+e.replace(/([^\w])/g,"\\$1").replace("\\*",".*")+"$"));let r=new RegExp(n.join("|"));return Array.from(i).every(e=>!e.type||r.test(e.type))}image(e,t,i){return this.mimeType(e,t??["image/gif","image/png","image/jpeg","image/webp"],i)}static(e,t){return t}}class t{formErrors=[];validators=new e;#e={};#t={};#i=new WeakMap;#n(e,t){let i=e.elements.namedItem(t);return i instanceof RadioNodeList?i[0]:i}#r(e){let t=e.form.elements.namedItem(e.name);return t instanceof RadioNodeList?Array.from(t):[t]}#s(e){"loading"!==document.readyState?e.call(this):document.addEventListener("DOMContentLoaded",e)}getValue(e){return e instanceof HTMLInputElement?"radio"===e.type?this.#r(e).find(e=>e.checked)?.value??null:"file"===e.type?e.files:"checkbox"===e.type?e.name.endsWith("[]")?this.#r(e).filter(e=>e.checked).map(e=>e.value):e.checked:e.value.trim():e instanceof HTMLSelectElement?e.multiple?Array.from(e.selectedOptions,e=>e.value):e.selectedOptions[0]?.value??null:e instanceof HTMLTextAreaElement?e.value:e instanceof RadioNodeList?this.getValue(e[0]):null}getEffectiveValue(e,t=!1){let i=this.getValue(e);if(i===e.getAttribute("data-nette-empty-value")&&(i=""),t&&void 0===this.#e[e.name]){this.#e[e.name]=!0;let t={value:i};this.validateControl(e,void 0,!0,t),i=t.value,delete this.#e[e.name]}return i}validateControl(e,t,i=!1,n,r){t??=JSON.parse(e.getAttribute("data-nette-rules")??"[]"),n??={value:this.getEffectiveValue(e)},r??=!this.validateRule(e,":filled",null,n);for(let s of t){let t=s.op.match(/(~)?([^?]+)/),o=s.control?this.#n(e.form,s.control):e;if(s.neg=!!t[1],s.op=t[2],s.condition=!!s.rules,!o)continue;if(r&&!s.condition&&":filled"!==s.op)continue;let a=this.validateRule(o,s.op,s.arg,e===o?n:void 0);if(null!==a)if(s.neg&&(a=!a),s.condition&&a){if(!this.validateControl(e,s.rules,i,n,":blank"!==s.op&&r))return!1}else if(!s.condition&&!a){if(this.isDisabled(o))continue;if(!i){let t=Array.isArray(s.arg)?s.arg:[s.arg],i=s.msg.replace(/%(value|\d+)/g,(i,n)=>this.getValue("value"===n?o:e.form.elements.namedItem(t[n].control)));this.addError(o,i)}return!1}}return!0}validateForm(e,t=!1){let i,n=e.form??e;if(this.formErrors=[],null!==e.getAttribute("formnovalidate")){let t=JSON.parse(e.getAttribute("data-nette-validation-scope")??"[]");if(!t.length)return this.showFormErrors(n,[]),!0;i=new RegExp("^("+t.join("-|")+"-)")}for(let e of n.elements)if(e.willValidate&&e.validity.badInput)return e.reportValidity(),!1;for(let e of n.elements)if(e.getAttribute("data-nette-rules")&&(!i||e.name.replace(/]\[|\[|]|$/g,"-").match(i))&&!this.isDisabled(e)&&!this.validateControl(e,void 0,t)&&!this.formErrors.length)return!1;let r=!this.formErrors.length;return this.showFormErrors(n,this.formErrors),r}isDisabled(e){return"radio"===e.type?this.#r(e).every(e=>e.disabled):e.disabled}addError(e,t){this.formErrors.push({element:e,message:t})}showFormErrors(e,t){let i,n=[];for(let e of t)n.indexOf(e.message)<0&&(n.push(e.message),i??=e.element);n.length&&this.showModal(n.join("\n"),()=>{i?.focus()})}showModal(e,t){let i=document.createElement("dialog");if(!i.showModal)return alert(e),void t();let n=document.createElement("style");n.innerText=".netteFormsModal { text-align: center; margin: auto; border: 2px solid black; padding: 1rem } .netteFormsModal button { padding: .1em 2em }";let r=document.createElement("button");r.innerText="OK",r.onclick=()=>{i.remove(),t()},i.setAttribute("class","netteFormsModal"),i.innerText=e+"\n\n",i.append(n,r),document.body.append(i),i.showModal()}validateRule(e,t,i,n){if(e.validity.badInput)return":filled"===t;n??={value:this.getEffectiveValue(e,!0)};let r=":"===t.charAt(0)?t.substring(1):t;r=r.replace("::","_").replaceAll("\\","");let s=Array.isArray(i)?i:[i];return s=s.map(t=>{if(t?.control){let i=this.#n(e.form,t.control);return i===e?n.value:this.getEffectiveValue(i,!0)}return t}),"valid"===r&&(s[0]=this),this.validators[r]?this.validators[r](e,Array.isArray(i)?s:s[0],n.value,n):null}toggleForm(e,t){this.#t={};for(let i of Array.from(e.elements))i.getAttribute("data-nette-rules")&&this.toggleControl(i,void 0,null,!t);for(let e in this.#t)this.toggle(e,this.#t[e].state,this.#t[e].elem,t)}toggleControl(e,t,i=null,n=!1,r,s){t??=JSON.parse(e.getAttribute("data-nette-rules")??"[]"),r??={value:this.getEffectiveValue(e)},s??=!this.validateRule(e,":filled",null,r);let o,a=!1;for(let l of t){let t=l.op.match(/(~)?([^?]+)/),c=l.control?this.#n(e.form,l.control):e;if(l.neg=!!t[1],l.op=t[2],l.condition=!!l.rules,c&&(!s||l.condition||":filled"===l.op)){if(o=i,!1!==i){if(o=this.validateRule(c,l.op,l.arg,e===c?r:void 0),null===o)continue;l.neg&&(o=!o),l.condition||(i=o)}if(l.condition&&this.toggleControl(e,l.rules,o,n,r,":blank"!==l.op&&s)||l.toggle){a=!0,n&&this.#r(c).filter(e=>!this.#i.has(e)).forEach(t=>{t.addEventListener("change",t=>this.toggleForm(e.form,t)),this.#i.set(t,null)});for(let t in l.toggle??{})this.#t[t]??={elem:e,state:!1},this.#t[t].state||=l.toggle[t]?!!o:!o}}}return a}toggle(e,t,i,n){/^\w[\w.:-]*$/.test(e)&&(e="#"+e),Array.from(document.querySelectorAll(e)).forEach(e=>e.hidden=!t)}compactCheckboxes(e,t){let i={};for(let n of e.elements)n instanceof HTMLInputElement&&"checkbox"===n.type&&n.name.endsWith("[]")&&n.checked&&!n.disabled&&(t.delete(n.name),i[n.name]??=[],i[n.name].push(n.value));for(let e in i)t.set(e.substring(0,e.length-2),i[e].join(","))}initForm(e){"get"===e.method&&e.hasAttribute("data-nette-compact")&&e.addEventListener("formdata",t=>this.compactCheckboxes(e,t.formData)),Array.from(e.elements).some(e=>e.getAttribute("data-nette-rules"))&&(this.toggleForm(e),e.noValidate||(e.noValidate=!0,e.addEventListener("submit",t=>{this.validateForm(t.submitter||e)||(t.stopImmediatePropagation(),t.preventDefault())}),e.addEventListener("reset",()=>{setTimeout(()=>this.toggleForm(e))})))}initOnLoad(){this.#s(()=>{Array.from(document.forms).forEach(e=>this.initForm(e))})}}let i={"á":"a","ä":"a","č":"c","ď":"d","é":"e","ě":"e","í":"i","ľ":"l","ň":"n","ó":"o","ô":"o","ř":"r","š":"s","ť":"t","ú":"u","ů":"u","ý":"y","ž":"z"};function n(e){e=e.toLowerCase();let t="";for(let n=0;n<e.length;n++){let r=i[e.charAt(n)];t+=r||e.charAt(n)}return t.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}var r="3.5.3";let s=new t;return s.version=r,s.webalize=n,s}()),v.exports),y=g(b);function _(e){return"Enter"===e.key}function w(){return null!=w?w:{}}function E(e,t=200){let i=null,n=!1;return(...r)=>{n||(i&&clearTimeout(i),i=setTimeout(()=>{const t=e(...r);var i;"object"==typeof(i=t)&&"function"==typeof i.then&&(n=!0,t.finally(()=>{n=!1}))},t))}}function A(e,t){e.split(/\s+/).forEach(e=>{t(e)})}class S{constructor(){this._events={}}on(e,t){A(e,e=>{const i=this._events[e]||[];i.push(t),this._events[e]=i})}off(e,t){var i=arguments.length;0!==i?A(e,e=>{if(1===i)return void delete this._events[e];const n=this._events[e];void 0!==n&&(n.splice(n.indexOf(t),1),this._events[e]=n)}):this._events={}}trigger(e,...t){var i=this;A(e,e=>{const n=i._events[e];void 0!==n&&n.forEach(e=>{e.apply(i,t)})})}}const k=e=>(e=e.filter(Boolean)).length<2?e[0]||"":1==T(e)?"["+e.join("")+"]":"(?:"+e.join("|")+")",O=e=>{if(!D(e))return e.join("");let t="",i=0;const n=()=>{i>1&&(t+="{"+i+"}")};return e.forEach((r,s)=>{r!==e[s-1]?(n(),t+=r,i=1):i++}),n(),t},C=e=>{let t=Array.from(e);return k(t)},D=e=>new Set(e).size!==e.length,x=e=>(e+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),T=e=>e.reduce((e,t)=>Math.max(e,L(t)),0),L=e=>Array.from(e).length,I=e=>{if(1===e.length)return[[e]];let t=[];const i=e.substring(1);return I(i).forEach(function(i){let n=i.slice(0);n[0]=e.charAt(0)+n[0],t.push(n),n=i.slice(0),n.unshift(e.charAt(0)),t.push(n)}),t},F=[[0,65535]];let M,N;const j={},P={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"};for(let e in P){let t=P[e]||"";for(let i=0;i<t.length;i++){let n=t.substring(i,i+1);j[n]=e}}const $=new RegExp(Object.keys(j).join("|")+"|[̀-ͯ·ʾʼ]","gu"),H=(e,t="NFKD")=>e.normalize(t),q=e=>Array.from(e).reduce((e,t)=>e+R(t),""),R=e=>(e=H(e).toLowerCase().replace($,e=>j[e]||""),H(e,"NFC"));const B=e=>{const t={},i=(e,i)=>{const n=t[e]||new Set,r=new RegExp("^"+C(n)+"$","iu");i.match(r)||(n.add(x(i)),t[e]=n)};for(let t of function*(e){for(const[t,i]of e)for(let e=t;e<=i;e++){let t=String.fromCharCode(e),i=q(t);i!=t.toLowerCase()&&(i.length>3||0!=i.length&&(yield{folded:i,composed:t,code_point:e}))}}(e))i(t.folded,t.folded),i(t.folded,t.composed);return t},V=e=>{const t=B(e),i={};let n=[];for(let e in t){let r=t[e];r&&(i[e]=C(r)),e.length>1&&n.push(x(e))}n.sort((e,t)=>t.length-e.length);const r=k(n);return N=new RegExp("^"+r,"u"),i},z=(e,t=1)=>(t=Math.max(t,e.length-1),k(I(e).map(e=>((e,t=1)=>{let i=0;return e=e.map(e=>(M[e]&&(i+=e.length),M[e]||e)),i>=t?O(e):""})(e,t)))),W=(e,t=!0)=>{let i=e.length>1?1:0;return k(e.map(e=>{let n=[];const r=t?e.length():e.length()-1;for(let t=0;t<r;t++)n.push(z(e.substrs[t]||"",i));return O(n)}))},Y=(e,t)=>{for(const i of t){if(i.start!=e.start||i.end!=e.end)continue;if(i.substrs.join("")!==e.substrs.join(""))continue;let t=e.parts;const n=e=>{for(const i of t){if(i.start===e.start&&i.substr===e.substr)return!1;if(1!=e.length&&1!=i.length){if(e.start<i.start&&e.end>i.start)return!0;if(i.start<e.start&&i.end>e.start)return!0}}return!1};if(!(i.parts.filter(n).length>0))return!0}return!1};class K{parts;substrs;start;end;constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(e){e&&(this.parts.push(e),this.substrs.push(e.substr),this.start=Math.min(e.start,this.start),this.end=Math.max(e.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(e,t){let i=new K,n=JSON.parse(JSON.stringify(this.parts)),r=n.pop();for(const e of n)i.add(e);let s=t.substr.substring(0,e-r.start),o=s.length;return i.add({start:r.start,end:r.start+o,length:o,substr:s}),i}}const U=e=>{void 0===M&&(M=V(F)),e=q(e);let t="",i=[new K];for(let n=0;n<e.length;n++){let r=e.substring(n).match(N);const s=e.substring(n,n+1),o=r?r[0]:null;let a=[],l=new Set;for(const e of i){const t=e.last();if(!t||1==t.length||t.end<=n)if(o){const t=o.length;e.add({start:n,end:n+t,length:t,substr:o}),l.add("1")}else e.add({start:n,end:n+1,length:1,substr:s}),l.add("2");else if(o){let i=e.clone(n,t);const r=o.length;i.add({start:n,end:n+r,length:r,substr:o}),a.push(i)}else l.add("3")}if(a.length>0){a=a.sort((e,t)=>e.length()-t.length());for(let e of a)Y(e,i)||i.push(e)}else if(n>0&&1==l.size&&!l.has("3")){t+=W(i,!1);let e=new K;const n=i[0];n&&e.add(n.last()),i=[e]}}return t+=W(i,!0),t},X=(e,t)=>{if(e)return e[t]},Q=(e,t)=>{if(e){for(var i,n=t.split(".");(i=n.shift())&&(e=e[i]););return e}},G=(e,t,i)=>{var n,r;return e?(e+="",null==t.regex||-1===(r=e.search(t.regex))?0:(n=t.string.length/e.length,0===r&&(n+=.5),n*i)):0},J=(e,t)=>{var i=e[t];if("function"==typeof i)return i;i&&!Array.isArray(i)&&(e[t]=[i])},Z=(e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)},ee=(e,t)=>"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=q(e+"").toLowerCase())>(t=q(t+"").toLowerCase())?1:t>e?-1:0;class te{items;settings;constructor(e,t){this.items=e,this.settings=t||{diacritics:!0}}tokenize(e,t,i){if(!e||!e.length)return[];const n=[],r=e.split(/\s+/);var s;return i&&(s=new RegExp("^("+Object.keys(i).map(x).join("|")+"):(.*)$")),r.forEach(e=>{let i,r=null,o=null;s&&(i=e.match(s))&&(r=i[1],e=i[2]),e.length>0&&(o=this.settings.diacritics?U(e)||null:x(e),o&&t&&(o="\\b"+o)),n.push({string:e,regex:o?new RegExp(o,"iu"):null,field:r})}),n}getScoreFunction(e,t){var i=this.prepareSearch(e,t);return this._getScoreFunction(i)}_getScoreFunction(e){const t=e.tokens,i=t.length;if(!i)return function(){return 0};const n=e.options.fields,r=e.weights,s=n.length,o=e.getAttrFn;if(!s)return function(){return 1};const a=1===s?function(e,t){const i=n[0].field;return G(o(t,i),e,r[i]||1)}:function(e,t){var i=0;if(e.field){const n=o(t,e.field);!e.regex&&n?i+=1/s:i+=G(n,e,1)}else Z(r,(n,r)=>{i+=G(o(t,r),e,n)});return i/s};return 1===i?function(e){return a(t[0],e)}:"and"===e.options.conjunction?function(e){var n,r=0;for(let i of t){if((n=a(i,e))<=0)return 0;r+=n}return r/i}:function(e){var n=0;return Z(t,t=>{n+=a(t,e)}),n/i}}getSortFunction(e,t){var i=this.prepareSearch(e,t);return this._getSortFunction(i)}_getSortFunction(e){var t,i=[];const n=this,r=e.options,s=!e.query&&r.sort_empty?r.sort_empty:r.sort;if("function"==typeof s)return s.bind(this);const o=function(t,i){return"$score"===t?i.score:e.getAttrFn(n.items[i.id],t)};if(s)for(let t of s)(e.query||"$score"!==t.field)&&i.push(t);if(e.query){t=!0;for(let e of i)if("$score"===e.field){t=!1;break}t&&i.unshift({field:"$score",direction:"desc"})}else i=i.filter(e=>"$score"!==e.field);return i.length?function(e,t){var n,r;for(let s of i){if(r=s.field,n=("desc"===s.direction?-1:1)*ee(o(r,e),o(r,t)))return n}return 0}:null}prepareSearch(e,t){const i={};var n=Object.assign({},t);if(J(n,"sort"),J(n,"sort_empty"),n.fields){J(n,"fields");const e=[];n.fields.forEach(t=>{"string"==typeof t&&(t={field:t,weight:1}),e.push(t),i[t.field]="weight"in t?t.weight:1}),n.fields=e}return{options:n,query:e.toLowerCase().trim(),tokens:this.tokenize(e,n.respect_word_boundaries,i),total:0,items:[],weights:i,getAttrFn:n.nesting?Q:X}}search(e,t){var i,n,r=this;n=this.prepareSearch(e,t),t=n.options,e=n.query;const s=t.score||r._getScoreFunction(n);e.length?Z(r.items,(e,r)=>{i=s(e),(!1===t.filter||i>0)&&n.items.push({score:i,id:r})}):Z(r.items,(e,t)=>{n.items.push({score:1,id:t})});const o=r._getSortFunction(n);return o&&n.items.sort(o),n.total=n.items.length,"number"==typeof t.limit&&(n.items=n.items.slice(0,t.limit)),n}}const ie=e=>null==e?null:ne(e),ne=e=>"boolean"==typeof e?e?"1":"0":e+"",re=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),se=(e,t)=>{var i;return function(n,r){var s=this;i&&(s.loading=Math.max(s.loading-1,0),clearTimeout(i)),i=setTimeout(function(){i=null,s.loadedSearches[n]=!0,e.call(s,n,r)},t)}},oe=(e,t,i)=>{var n,r=e.trigger,s={};for(n of(e.trigger=function(){var i=arguments[0];if(-1===t.indexOf(i))return r.apply(e,arguments);s[i]=arguments},i.apply(e,[]),e.trigger=r,t))n in s&&r.apply(e,s[n])},ae=(e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())},le=(e,t,i,n)=>{e.addEventListener(t,i,n)},ce=(e,t)=>!!t&&(!!t[e]&&1===(t.altKey?1:0)+(t.ctrlKey?1:0)+(t.shiftKey?1:0)+(t.metaKey?1:0)),de=(e,t)=>{const i=e.getAttribute("id");return i||(e.setAttribute("id",t),t)},ue=e=>e.replace(/[\\"']/g,"\\$&"),he=(e,t)=>{t&&e.append(t)},pe=(e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)},fe=e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(ge(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)},ge=e=>"string"==typeof e&&e.indexOf("<")>-1,me=(e,t)=>{var i=document.createEvent("HTMLEvents");i.initEvent(t,!0,!1),e.dispatchEvent(i)},ve=(e,t)=>{Object.assign(e.style,t)},be=(e,...t)=>{var i=_e(t);(e=we(e)).map(e=>{i.map(t=>{e.classList.add(t)})})},ye=(e,...t)=>{var i=_e(t);(e=we(e)).map(e=>{i.map(t=>{e.classList.remove(t)})})},_e=e=>{var t=[];return pe(e,e=>{"string"==typeof e&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},we=e=>(Array.isArray(e)||(e=[e]),e),Ee=(e,t,i)=>{if(!i||i.contains(e))for(;e&&e.matches;){if(e.matches(t))return e;e=e.parentNode}},Ae=(e,t=0)=>t>0?e[e.length-1]:e[0],Se=(e,t)=>{if(!e)return-1;t=t||e.nodeName;for(var i=0;e=e.previousElementSibling;)e.matches(t)&&i++;return i},ke=(e,t)=>{pe(t,(t,i)=>{null==t?e.removeAttribute(i):e.setAttribute(i,""+t)})},Oe=(e,t)=>{e.parentNode&&e.parentNode.replaceChild(t,e)},Ce=(e,t)=>{if(null===t)return;if("string"==typeof t){if(!t.length)return;t=new RegExp(t,"i")}const i=e=>3===e.nodeType?(e=>{var i=e.data.match(t);if(i&&e.data.length>0){var n=document.createElement("span");n.className="highlight";var r=e.splitText(i.index);r.splitText(i[0].length);var s=r.cloneNode(!0);return n.appendChild(s),Oe(r,n),1}return 0})(e):((e=>{1!==e.nodeType||!e.childNodes||/(script|style)/i.test(e.tagName)||"highlight"===e.className&&"SPAN"===e.tagName||Array.from(e.childNodes).forEach(e=>{i(e)})})(e),0);i(e)},De="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey";var xe={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,refreshThrottle:300,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(e){return e.length>0},render:{}};function Te(e,t){var i=Object.assign({},xe,t),n=i.dataAttr,r=i.labelField,s=i.valueField,o=i.disabledField,a=i.optgroupField,l=i.optgroupLabelField,c=i.optgroupValueField,d=e.tagName.toLowerCase(),u=e.getAttribute("placeholder")||e.getAttribute("data-placeholder");if(!u&&!i.allowEmptyOption){let t=e.querySelector('option[value=""]');t&&(u=t.textContent)}var h={placeholder:u,options:[],optgroups:[],items:[],maxItems:null};return"select"===d?(()=>{var t,d=h.options,u={},p=1;let f=0;var g=e=>{var t=Object.assign({},e.dataset),i=n&&t[n];return"string"==typeof i&&i.length&&(t=Object.assign(t,JSON.parse(i))),t},m=(e,t)=>{var n=ie(e.value);if(null!=n&&(n||i.allowEmptyOption)){if(u.hasOwnProperty(n)){if(t){var l=u[n][a];l?Array.isArray(l)?l.push(t):u[n][a]=[l,t]:u[n][a]=t}}else{var c=g(e);c[r]=c[r]||e.textContent,c[s]=c[s]||n,c[o]=c[o]||e.disabled,c[a]=c[a]||t,c.$option=e,c.$order=c.$order||++f,u[n]=c,d.push(c)}e.selected&&h.items.push(n)}};h.maxItems=e.hasAttribute("multiple")?null:1,pe(e.children,e=>{var i,n,r;"optgroup"===(t=e.tagName.toLowerCase())?((r=g(i=e))[l]=r[l]||i.getAttribute("label")||"",r[c]=r[c]||p++,r[o]=r[o]||i.disabled,r.$order=r.$order||++f,h.optgroups.push(r),n=r[c],pe(i.children,e=>{m(e,n)})):"option"===t&&m(e)})})():(()=>{const t=e.getAttribute(n);if(t)h.options=JSON.parse(t),pe(h.options,e=>{h.items.push(e[s])});else{var o=e.value.trim()||"";if(!i.allowEmptyOption&&!o.length)return;const t=o.split(i.delimiter);pe(t,e=>{const t={};t[r]=e,t[s]=e,h.options.push(t)}),h.items=t}})(),Object.assign({},xe,h,t)}var Le=0;let Ie=class extends(function(e){return e.plugins={},class extends e{constructor(){super(...arguments),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(t,i){e.plugins[t]={name:t,fn:i}}initializePlugins(e){var t,i;const n=this,r=[];if(Array.isArray(e))e.forEach(e=>{"string"==typeof e?r.push(e):(n.plugins.settings[e.name]=e.options,r.push(e.name))});else if(e)for(t in e)e.hasOwnProperty(t)&&(n.plugins.settings[t]=e[t],r.push(t));for(;i=r.shift();)n.require(i)}loadPlugin(t){var i=this,n=i.plugins,r=e.plugins[t];if(!e.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');n.requested[t]=!0,n.loaded[t]=r.fn.apply(i,[i.plugins.settings[t]||{}]),n.names.push(t)}require(e){var t=this,i=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(i.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return i.loaded[e]}}}(S)){constructor(e,t){var i;super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.refreshTimeout=null,Le++;var n=fe(e);if(n.tomselect)throw new Error("Tom Select already initialized on this element");n.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(n,null)).getPropertyValue("direction");const r=Te(n,t);this.settings=r,this.input=n,this.tabIndex=n.tabIndex||0,this.is_select_tag="select"===n.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=de(n,"tomselect-"+Le),this.isRequired=n.required,this.sifter=new te(this.options,{diacritics:r.diacritics}),r.mode=r.mode||(1===r.maxItems?"single":"multi"),"boolean"!=typeof r.hideSelected&&(r.hideSelected="multi"===r.mode),"boolean"!=typeof r.hidePlaceholder&&(r.hidePlaceholder="multi"!==r.mode);var s=r.createFilter;"function"!=typeof s&&("string"==typeof s&&(s=new RegExp(s)),s instanceof RegExp?r.createFilter=e=>s.test(e):r.createFilter=e=>this.settings.duplicates||!this.options[e]),this.initializePlugins(r.plugins),this.setupCallbacks(),this.setupTemplates();const o=fe("<div>"),a=fe("<div>"),l=this._render("dropdown"),c=fe('<div role="listbox" tabindex="-1">'),d=this.input.getAttribute("class")||"",u=r.mode;var h;if(be(o,r.wrapperClass,d,u),be(a,r.controlClass),he(o,a),be(l,r.dropdownClass,u),r.copyClassesToDropdown&&be(l,d),be(c,r.dropdownContentClass),he(l,c),fe(r.dropdownParent||o).appendChild(l),ge(r.controlInput)){h=fe(r.controlInput);pe(["autocorrect","autocapitalize","autocomplete","spellcheck"],e=>{n.getAttribute(e)&&ke(h,{[e]:n.getAttribute(e)})}),h.tabIndex=-1,a.appendChild(h),this.focus_node=h}else r.controlInput?(h=fe(r.controlInput),this.focus_node=h):(h=fe("<input/>"),this.focus_node=a);this.wrapper=o,this.dropdown=l,this.dropdown_content=c,this.control=a,this.control_input=h,this.setup()}setup(){const e=this,t=e.settings,i=e.control_input,n=e.dropdown,r=e.dropdown_content,s=e.wrapper,o=e.control,a=e.input,l=e.focus_node,c={passive:!0},d=e.inputId+"-ts-dropdown";ke(r,{id:d}),ke(l,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":d});const u=de(l,e.inputId+"-ts-control"),h="label[for='"+(e=>e.replace(/['"\\]/g,"\\$&"))(e.inputId)+"']",p=document.querySelector(h),f=e.focus.bind(e);if(p){le(p,"click",f),ke(p,{for:u});const t=de(p,e.inputId+"-ts-label");ke(l,{"aria-labelledby":t}),ke(r,{"aria-labelledby":t})}if(s.style.width=a.style.width,e.plugins.names.length){const t="plugin-"+e.plugins.names.join(" plugin-");be([s,n],t)}(null===t.maxItems||t.maxItems>1)&&e.is_select_tag&&ke(a,{multiple:"multiple"}),t.placeholder&&ke(i,{placeholder:t.placeholder}),!t.splitOn&&t.delimiter&&(t.splitOn=new RegExp("\\s*"+x(t.delimiter)+"+\\s*")),t.load&&t.loadThrottle&&(t.load=se(t.load,t.loadThrottle)),le(n,"mousemove",()=>{e.ignoreHover=!1}),le(n,"mouseenter",t=>{var i=Ee(t.target,"[data-selectable]",n);i&&e.onOptionHover(t,i)},{capture:!0}),le(n,"click",t=>{const i=Ee(t.target,"[data-selectable]");i&&(e.onOptionSelect(t,i),ae(t,!0))}),le(o,"click",t=>{var n=Ee(t.target,"[data-ts-item]",o);n&&e.onItemSelect(t,n)?ae(t,!0):""==i.value&&(e.onClick(),ae(t,!0))}),le(l,"keydown",t=>e.onKeyDown(t)),le(i,"keypress",t=>e.onKeyPress(t)),le(i,"input",t=>e.onInput(t)),le(l,"blur",t=>e.onBlur(t)),le(l,"focus",t=>e.onFocus(t)),le(i,"paste",t=>e.onPaste(t));const g=t=>{const r=t.composedPath()[0];if(!s.contains(r)&&!n.contains(r))return e.isFocused&&e.blur(),void e.inputState();r==i&&e.isOpen?t.stopPropagation():ae(t,!0)},m=()=>{e.isOpen&&e.positionDropdown()};le(document,"mousedown",g),le(window,"scroll",m,c),le(window,"resize",m,c),this._destroy=()=>{document.removeEventListener("mousedown",g),window.removeEventListener("scroll",m),window.removeEventListener("resize",m),p&&p.removeEventListener("click",f)},this.revertSettings={innerHTML:a.innerHTML,tabIndex:a.tabIndex},a.tabIndex=-1,a.insertAdjacentElement("afterend",e.wrapper),e.sync(!1),t.items=[],delete t.optgroups,delete t.options,le(a,"invalid",()=>{e.isValid&&(e.isValid=!1,e.isInvalid=!0,e.refreshState())}),e.updateOriginalInput(),e.refreshItems(),e.close(!1),e.inputState(),e.isSetup=!0,a.disabled?e.disable():a.readOnly?e.setReadOnly(!0):e.enable(),e.on("change",this.onChange),be(a,"tomselected","ts-hidden-accessible"),e.trigger("initialize"),!0===t.preload&&e.preload()}setupOptions(e=[],t=[]){this.addOptions(e),pe(t,e=>{this.registerOptionGroup(e)})}setupTemplates(){var e=this,t=e.settings.labelField,i=e.settings.optgroupLabelField,n={optgroup:e=>{let t=document.createElement("div");return t.className="optgroup",t.appendChild(e.options),t},optgroup_header:(e,t)=>'<div class="optgroup-header">'+t(e[i])+"</div>",option:(e,i)=>"<div>"+i(e[t])+"</div>",item:(e,i)=>"<div>"+i(e[t])+"</div>",option_create:(e,t)=>'<div class="create">Add <strong>'+t(e.input)+"</strong>&hellip;</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"};e.settings.render=Object.assign({},n,e.settings.render)}setupCallbacks(){var e,t,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in i)(t=this.settings[i[e]])&&this.on(e,t)}sync(e=!0){const t=this,i=e?Te(t.input,{delimiter:t.settings.delimiter}):t.settings;t.setupOptions(i.options,i.optgroups),t.setValue(i.items||[],!0),t.lastQuery=null}onClick(){var e=this;if(e.activeItems.length>0)return e.clearActiveItems(),void e.focus();e.isFocused&&e.isOpen?e.blur():e.focus()}onMouseDown(){}onChange(){me(this.input,"input"),me(this.input,"change")}onPaste(e){var t=this;t.isInputHidden||t.isLocked?ae(e):t.settings.splitOn&&setTimeout(()=>{var e=t.inputValue();if(e.match(t.settings.splitOn)){var i=e.trim().split(t.settings.splitOn);pe(i,e=>{ie(e)&&(this.options[e]?t.addItem(e):t.createItem(e))})}},0)}onKeyPress(e){var t=this;if(!t.isLocked){var i=String.fromCharCode(e.keyCode||e.which);return t.settings.create&&"multi"===t.settings.mode&&i===t.settings.delimiter?(t.createItem(),void ae(e)):void 0}ae(e)}onKeyDown(e){var t=this;if(t.ignoreHover=!0,t.isLocked)9!==e.keyCode&&ae(e);else{switch(e.keyCode){case 65:if(ce(De,e)&&""==t.control_input.value)return ae(e),void t.selectAll();break;case 27:return t.isOpen&&(ae(e,!0),t.close()),void t.clearActiveItems();case 40:if(!t.isOpen&&t.hasOptions)t.open();else if(t.activeOption){let e=t.getAdjacent(t.activeOption,1);e&&t.setActiveOption(e)}return void ae(e);case 38:if(t.activeOption){let e=t.getAdjacent(t.activeOption,-1);e&&t.setActiveOption(e)}return void ae(e);case 13:return void(t.canSelect(t.activeOption)?(t.onOptionSelect(e,t.activeOption),ae(e)):(t.settings.create&&t.createItem()||document.activeElement==t.control_input&&t.isOpen)&&ae(e));case 37:return void t.advanceSelection(-1,e);case 39:return void t.advanceSelection(1,e);case 9:return void(t.settings.selectOnTab&&(t.canSelect(t.activeOption)&&(t.onOptionSelect(e,t.activeOption),ae(e)),t.settings.create&&t.createItem()&&ae(e)));case 8:case 46:return void t.deleteSelection(e)}t.isInputHidden&&!ce(De,e)&&ae(e)}}onInput(e){if(this.isLocked)return;const t=this.inputValue();this.lastValue!==t&&(this.lastValue=t,""!=t?(this.refreshTimeout&&window.clearTimeout(this.refreshTimeout),this.refreshTimeout=((e,t)=>t>0?window.setTimeout(e,t):(e.call(null),null))(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)):this._onInput())}_onInput(){const e=this.lastValue;this.settings.shouldLoad.call(this,e)&&this.load(e),this.refreshOptions(),this.trigger("type",e)}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onFocus(e){var t=this,i=t.isFocused;if(t.isDisabled||t.isReadOnly)return t.blur(),void ae(e);t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.preload(),i||t.trigger("focus"),t.activeItems.length||(t.inputState(),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())}onBlur(e){if(!1!==document.hasFocus()){var t=this;if(t.isFocused){t.isFocused=!1,t.ignoreFocus=!1;var i=()=>{t.close(),t.setActiveItem(),t.setCaret(t.items.length),t.trigger("blur")};t.settings.create&&t.settings.createOnBlur?t.createItem(null,i):i()}}}onOptionSelect(e,t){var i,n=this;t.parentElement&&t.parentElement.matches("[data-disabled]")||(t.classList.contains("create")?n.createItem(null,()=>{n.settings.closeAfterSelect&&n.close()}):void 0!==(i=t.dataset.value)&&(n.lastQuery=null,n.addItem(i),n.settings.closeAfterSelect&&n.close(),!n.settings.hideSelected&&e.type&&/click/.test(e.type)&&n.setActiveOption(t)))}canSelect(e){return!!(this.isOpen&&e&&this.dropdown_content.contains(e))}onItemSelect(e,t){var i=this;return!i.isLocked&&"multi"===i.settings.mode&&(ae(e),i.setActiveItem(t,e),!0)}canLoad(e){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(e)}load(e){const t=this;if(!t.canLoad(e))return;be(t.wrapper,t.settings.loadingClass),t.loading++;const i=t.loadCallback.bind(t);t.settings.load.call(t,e,i)}loadCallback(e,t){const i=this;i.loading=Math.max(i.loading-1,0),i.lastQuery=null,i.clearActiveOption(),i.setupOptions(e,t),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||ye(i.wrapper,i.settings.loadingClass),i.trigger("load",e,t)}preload(){var e=this.wrapper.classList;e.contains("preloaded")||(e.add("preloaded"),this.load(""))}setTextboxValue(e=""){var t=this.control_input;t.value!==e&&(t.value=e,me(t,"update"),this.lastValue=e)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(e,t){oe(this,t?[]:["change"],()=>{this.clear(t),this.addItems(e,t)})}setMaxItems(e){0===e&&(e=null),this.settings.maxItems=e,this.refreshState()}setActiveItem(e,t){var i,n,r,s,o,a,l=this;if("single"!==l.settings.mode){if(!e)return l.clearActiveItems(),void(l.isFocused&&l.inputState());if("click"===(i=t&&t.type.toLowerCase())&&ce("shiftKey",t)&&l.activeItems.length){for(a=l.getLastActive(),(r=Array.prototype.indexOf.call(l.control.children,a))>(s=Array.prototype.indexOf.call(l.control.children,e))&&(o=r,r=s,s=o),n=r;n<=s;n++)e=l.control.children[n],-1===l.activeItems.indexOf(e)&&l.setActiveItemClass(e);ae(t)}else"click"===i&&ce(De,t)||"keydown"===i&&ce("shiftKey",t)?e.classList.contains("active")?l.removeActiveItem(e):l.setActiveItemClass(e):(l.clearActiveItems(),l.setActiveItemClass(e));l.inputState(),l.isFocused||l.focus()}}setActiveItemClass(e){const t=this,i=t.control.querySelector(".last-active");i&&ye(i,"last-active"),be(e,"active last-active"),t.trigger("item_select",e),-1==t.activeItems.indexOf(e)&&t.activeItems.push(e)}removeActiveItem(e){var t=this.activeItems.indexOf(e);this.activeItems.splice(t,1),ye(e,"active")}clearActiveItems(){ye(this.activeItems,"active"),this.activeItems=[]}setActiveOption(e,t=!0){e!==this.activeOption&&(this.clearActiveOption(),e&&(this.activeOption=e,ke(this.focus_node,{"aria-activedescendant":e.getAttribute("id")}),ke(e,{"aria-selected":"true"}),be(e,"active"),t&&this.scrollToOption(e)))}scrollToOption(e,t){if(!e)return;const i=this.dropdown_content,n=i.clientHeight,r=i.scrollTop||0,s=e.offsetHeight,o=e.getBoundingClientRect().top-i.getBoundingClientRect().top+r;o+s>n+r?this.scroll(o-n+s,t):o<r&&this.scroll(o,t)}scroll(e,t){const i=this.dropdown_content;t&&(i.style.scrollBehavior=t),i.scrollTop=e,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(ye(this.activeOption,"active"),ke(this.activeOption,{"aria-selected":null})),this.activeOption=null,ke(this.focus_node,{"aria-activedescendant":null})}selectAll(){const e=this;if("single"===e.settings.mode)return;const t=e.controlChildren();t.length&&(e.inputState(),e.close(),e.activeItems=t,pe(t,t=>{e.setActiveItemClass(t)}))}inputState(){var e=this;e.control.contains(e.control_input)&&(ke(e.control_input,{placeholder:e.settings.placeholder}),e.activeItems.length>0||!e.isFocused&&e.settings.hidePlaceholder&&e.items.length>0?(e.setTextboxValue(),e.isInputHidden=!0):(e.settings.hidePlaceholder&&e.items.length>0&&ke(e.control_input,{placeholder:""}),e.isInputHidden=!1),e.wrapper.classList.toggle("input-hidden",e.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var e=this;e.isDisabled||e.isReadOnly||(e.ignoreFocus=!0,e.control_input.offsetWidth?e.control_input.focus():e.focus_node.focus(),setTimeout(()=>{e.ignoreFocus=!1,e.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())}getSearchOptions(){var e=this.settings,t=e.sortField;return"string"==typeof e.sortField&&(t=[{field:e.sortField}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}}search(e){var t,i,n=this,r=this.getSearchOptions();if(n.settings.score&&"function"!=typeof(i=n.settings.score.call(n,e)))throw new Error('Tom Select "score" setting must be a function that returns a function');return e!==n.lastQuery?(n.lastQuery=e,t=n.sifter.search(e,Object.assign(r,{score:i})),n.currentResults=t):t=Object.assign({},n.currentResults),n.settings.hideSelected&&(t.items=t.items.filter(e=>{let t=ie(e.id);return!(t&&-1!==n.items.indexOf(t))})),t}refreshOptions(e=!0){var t,i,n,r,s,o,a,l,c,d;const u={},h=[];var p=this,f=p.inputValue();const g=f===p.lastQuery||""==f&&null==p.lastQuery;var m=p.search(f),v=null,b=p.settings.shouldOpen||!1,y=p.dropdown_content;g&&(v=p.activeOption)&&(c=v.closest("[data-group]")),r=m.items.length,"number"==typeof p.settings.maxOptions&&(r=Math.min(r,p.settings.maxOptions)),r>0&&(b=!0);const _=(e,t)=>{let i=u[e];if(void 0!==i){let e=h[i];if(void 0!==e)return[i,e.fragment]}let n=document.createDocumentFragment();return i=h.length,h.push({fragment:n,order:t,optgroup:e}),[i,n]};for(t=0;t<r;t++){let e=m.items[t];if(!e)continue;let r=e.id,a=p.options[r];if(void 0===a)continue;let l=ne(r),d=p.getOption(l,!0);for(p.settings.hideSelected||d.classList.toggle("selected",p.items.includes(l)),s=a[p.settings.optgroupField]||"",i=0,n=(o=Array.isArray(s)?s:[s])&&o.length;i<n;i++){s=o[i];let e=a.$order,t=p.optgroups[s];void 0===t?s="":e=t.$order;const[n,l]=_(s,e);i>0&&(d=d.cloneNode(!0),ke(d,{id:a.$id+"-clone-"+i,"aria-selected":null}),d.classList.add("ts-cloned"),ye(d,"active"),p.activeOption&&p.activeOption.dataset.value==r&&c&&c.dataset.group===s.toString()&&(v=d)),l.appendChild(d),""!=s&&(u[s]=n)}}var w;p.settings.lockOptgroupOrder&&h.sort((e,t)=>e.order-t.order),a=document.createDocumentFragment(),pe(h,e=>{let t=e.fragment,i=e.optgroup;if(!t||!t.children.length)return;let n=p.optgroups[i];if(void 0!==n){let e=document.createDocumentFragment(),i=p.render("optgroup_header",n);he(e,i),he(e,t);let r=p.render("optgroup",{group:n,options:e});he(a,r)}else he(a,t)}),y.innerHTML="",he(y,a),p.settings.highlight&&(w=y.querySelectorAll("span.highlight"),Array.prototype.forEach.call(w,function(e){var t=e.parentNode;t.replaceChild(e.firstChild,e),t.normalize()}),m.query.length&&m.tokens.length&&pe(m.tokens,e=>{Ce(y,e.regex)}));var E=e=>{let t=p.render(e,{input:f});return t&&(b=!0,y.insertBefore(t,y.firstChild)),t};if(p.loading?E("loading"):p.settings.shouldLoad.call(p,f)?0===m.items.length&&E("no_results"):E("not_loading"),(l=p.canCreate(f))&&(d=E("option_create")),p.hasOptions=m.items.length>0||l,b){if(m.items.length>0){if(v||"single"!==p.settings.mode||null==p.items[0]||(v=p.getOption(p.items[0])),!y.contains(v)){let e=0;d&&!p.settings.addPrecedence&&(e=1),v=p.selectable()[e]}}else d&&(v=d);e&&!p.isOpen&&(p.open(),p.scrollToOption(v,"auto")),p.setActiveOption(v)}else p.clearActiveOption(),e&&p.isOpen&&p.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(e,t=!1){const i=this;if(Array.isArray(e))return i.addOptions(e,t),!1;const n=ie(e[i.settings.valueField]);return null!==n&&!i.options.hasOwnProperty(n)&&(e.$order=e.$order||++i.order,e.$id=i.inputId+"-opt-"+e.$order,i.options[n]=e,i.lastQuery=null,t&&(i.userOptions[n]=t,i.trigger("option_add",n,e)),n)}addOptions(e,t=!1){pe(e,e=>{this.addOption(e,t)})}registerOption(e){return this.addOption(e)}registerOptionGroup(e){var t=ie(e[this.settings.optgroupValueField]);return null!==t&&(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)}addOptionGroup(e,t){var i;t[this.settings.optgroupValueField]=e,(i=this.registerOptionGroup(t))&&this.trigger("optgroup_add",i,t)}removeOptionGroup(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.clearCache(),this.trigger("optgroup_remove",e))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(e,t){const i=this;var n,r;const s=ie(e),o=ie(t[i.settings.valueField]);if(null===s)return;const a=i.options[s];if(null==a)return;if("string"!=typeof o)throw new Error("Value must be set in option data");const l=i.getOption(s),c=i.getItem(s);if(t.$order=t.$order||a.$order,delete i.options[s],i.uncacheValue(o),i.options[o]=t,l){if(i.dropdown_content.contains(l)){const e=i._render("option",t);Oe(l,e),i.activeOption===l&&i.setActiveOption(e)}l.remove()}c&&(-1!==(r=i.items.indexOf(s))&&i.items.splice(r,1,o),n=i._render("item",t),c.classList.contains("active")&&be(n,"active"),Oe(c,n)),i.lastQuery=null}removeOption(e,t){const i=this;e=ne(e),i.uncacheValue(e),delete i.userOptions[e],delete i.options[e],i.lastQuery=null,i.trigger("option_remove",e),i.removeItem(e,t)}clearOptions(e){const t=(e||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();const i={};pe(this.options,(e,n)=>{t(e,n)&&(i[n]=e)}),this.options=this.sifter.items=i,this.lastQuery=null,this.trigger("option_clear")}clearFilter(e,t){return this.items.indexOf(t)>=0}getOption(e,t=!1){const i=ie(e);if(null===i)return null;const n=this.options[i];if(null!=n){if(n.$div)return n.$div;if(t)return this._render("option",n)}return null}getAdjacent(e,t,i="option"){var n;if(!e)return null;n="item"==i?this.controlChildren():this.dropdown_content.querySelectorAll("[data-selectable]");for(let i=0;i<n.length;i++)if(n[i]==e)return t>0?n[i+1]:n[i-1];return null}getItem(e){if("object"==typeof e)return e;var t=ie(e);return null!==t?this.control.querySelector(`[data-value="${ue(t)}"]`):null}addItems(e,t){var i=this,n=Array.isArray(e)?e:[e];const r=(n=n.filter(e=>-1===i.items.indexOf(e)))[n.length-1];n.forEach(e=>{i.isPending=e!==r,i.addItem(e,t)})}addItem(e,t){oe(this,t?[]:["change","dropdown_close"],()=>{var i,n;const r=this,s=r.settings.mode,o=ie(e);if((!o||-1===r.items.indexOf(o)||("single"===s&&r.close(),"single"!==s&&r.settings.duplicates))&&null!==o&&r.options.hasOwnProperty(o)&&("single"===s&&r.clear(t),"multi"!==s||!r.isFull())){if(i=r._render("item",r.options[o]),r.control.contains(i)&&(i=i.cloneNode(!0)),n=r.isFull(),r.items.splice(r.caretPos,0,o),r.insertAtCaret(i),r.isSetup){if(!r.isPending&&r.settings.hideSelected){let e=r.getOption(o),t=r.getAdjacent(e,1);t&&r.setActiveOption(t)}r.isPending||r.settings.closeAfterSelect||r.refreshOptions(r.isFocused&&"single"!==s),0!=r.settings.closeAfterSelect&&r.isFull()?r.close():r.isPending||r.positionDropdown(),r.trigger("item_add",o,i),r.isPending||r.updateOriginalInput({silent:t})}(!r.isPending||!n&&r.isFull())&&(r.inputState(),r.refreshState())}})}removeItem(e=null,t){const i=this;if(!(e=i.getItem(e)))return;var n,r;const s=e.dataset.value;n=Se(e),e.remove(),e.classList.contains("active")&&(r=i.activeItems.indexOf(e),i.activeItems.splice(r,1),ye(e,"active")),i.items.splice(n,1),i.lastQuery=null,!i.settings.persist&&i.userOptions.hasOwnProperty(s)&&i.removeOption(s,t),n<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:t}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",s,e)}createItem(e=null,t=()=>{}){3===arguments.length&&(t=arguments[2]),"function"!=typeof t&&(t=()=>{});var i,n=this,r=n.caretPos;if(e=e||n.inputValue(),!n.canCreate(e))return t(),!1;n.lock();var s=!1,o=e=>{if(n.unlock(),!e||"object"!=typeof e)return t();var i=ie(e[n.settings.valueField]);if("string"!=typeof i)return t();n.setTextboxValue(),n.addOption(e,!0),n.setCaret(r),n.addItem(i),t(e),s=!0};return i="function"==typeof n.settings.create?n.settings.create.call(this,e,o):{[n.settings.labelField]:e,[n.settings.valueField]:e},s||o(i),!0}refreshItems(){var e=this;e.lastQuery=null,e.isSetup&&e.addItems(e.items),e.updateOriginalInput(),e.refreshState()}refreshState(){const e=this;e.refreshValidityState();const t=e.isFull(),i=e.isLocked;e.wrapper.classList.toggle("rtl",e.rtl);const n=e.wrapper.classList;var r;n.toggle("focus",e.isFocused),n.toggle("disabled",e.isDisabled),n.toggle("readonly",e.isReadOnly),n.toggle("required",e.isRequired),n.toggle("invalid",!e.isValid),n.toggle("locked",i),n.toggle("full",t),n.toggle("input-active",e.isFocused&&!e.isInputHidden),n.toggle("dropdown-active",e.isOpen),n.toggle("has-options",(r=e.options,0===Object.keys(r).length)),n.toggle("has-items",e.items.length>0)}refreshValidityState(){var e=this;e.input.validity&&(e.isValid=e.input.validity.valid,e.isInvalid=!e.isValid)}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(e={}){const t=this;var i,n;const r=t.input.querySelector('option[value=""]');if(t.is_select_tag){const s=[],o=t.input.querySelectorAll("option:checked").length;function a(e,i,n){return e||(e=fe('<option value="'+re(i)+'">'+re(n)+"</option>")),e!=r&&t.input.append(e),s.push(e),(e!=r||o>0)&&(e.selected=!0),e}t.input.querySelectorAll("option:checked").forEach(e=>{e.selected=!1}),0==t.items.length&&"single"==t.settings.mode?a(r,"",""):t.items.forEach(e=>{if(i=t.options[e],n=i[t.settings.labelField]||"",s.includes(i.$option)){a(t.input.querySelector(`option[value="${ue(e)}"]:not(:checked)`),e,n)}else i.$option=a(i.$option,e,n)})}else t.input.value=t.getValue();t.isSetup&&(e.silent||t.trigger("change",t.getValue()))}open(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.isOpen=!0,ke(e.focus_node,{"aria-expanded":"true"}),e.refreshState(),ve(e.dropdown,{visibility:"hidden",display:"block"}),e.positionDropdown(),ve(e.dropdown,{visibility:"visible",display:"block"}),e.focus(),e.trigger("dropdown_open",e.dropdown))}close(e=!0){var t=this,i=t.isOpen;e&&(t.setTextboxValue(),"single"===t.settings.mode&&t.items.length&&t.inputState()),t.isOpen=!1,ke(t.focus_node,{"aria-expanded":"false"}),ve(t.dropdown,{display:"none"}),t.settings.hideSelected&&t.clearActiveOption(),t.refreshState(),i&&t.trigger("dropdown_close",t.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var e=this.control,t=e.getBoundingClientRect(),i=e.offsetHeight+t.top+window.scrollY,n=t.left+window.scrollX;ve(this.dropdown,{width:t.width+"px",top:i+"px",left:n+"px"})}}clear(e){var t=this;if(t.items.length){var i=t.controlChildren();pe(i,e=>{t.removeItem(e,!0)}),t.inputState(),e||t.updateOriginalInput(),t.trigger("clear")}}insertAtCaret(e){const t=this,i=t.caretPos,n=t.control;n.insertBefore(e,n.children[i]||null),t.setCaret(i+1)}deleteSelection(e){var t,i,n,r,s,o=this;t=e&&8===e.keyCode?-1:1,i={start:(s=o.control_input).selectionStart||0,length:(s.selectionEnd||0)-(s.selectionStart||0)};const a=[];if(o.activeItems.length)r=Ae(o.activeItems,t),n=Se(r),t>0&&n++,pe(o.activeItems,e=>a.push(e));else if((o.isFocused||"single"===o.settings.mode)&&o.items.length){const e=o.controlChildren();let n;t<0&&0===i.start&&0===i.length?n=e[o.caretPos-1]:t>0&&i.start===o.inputValue().length&&(n=e[o.caretPos]),void 0!==n&&a.push(n)}if(!o.shouldDelete(a,e))return!1;for(ae(e,!0),void 0!==n&&o.setCaret(n);a.length;)o.removeItem(a.pop());return o.inputState(),o.positionDropdown(),o.refreshOptions(!1),!0}shouldDelete(e,t){const i=e.map(e=>e.dataset.value);return!(!i.length||"function"==typeof this.settings.onDelete&&!1===this.settings.onDelete(i,t))}advanceSelection(e,t){var i,n,r=this;r.rtl&&(e*=-1),r.inputValue().length||(ce(De,t)||ce("shiftKey",t)?(n=(i=r.getLastActive(e))?i.classList.contains("active")?r.getAdjacent(i,e,"item"):i:e>0?r.control_input.nextElementSibling:r.control_input.previousElementSibling)&&(n.classList.contains("active")&&r.removeActiveItem(i),r.setActiveItemClass(n)):r.moveCaret(e))}moveCaret(e){}getLastActive(e){let t=this.control.querySelector(".last-active");if(t)return t;var i=this.control.querySelectorAll(".active");return i?Ae(i,e):void 0}setCaret(e){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(e=this.isReadOnly||this.isDisabled){this.isLocked=e,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(e){this.focus_node.tabIndex=e?-1:this.tabIndex,this.isDisabled=e,this.input.disabled=e,this.control_input.disabled=e,this.setLocked()}setReadOnly(e){this.isReadOnly=e,this.input.readOnly=e,this.control_input.readOnly=e,this.setLocked()}destroy(){var e=this,t=e.revertSettings;e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.innerHTML=t.innerHTML,e.input.tabIndex=t.tabIndex,ye(e.input,"tomselected","ts-hidden-accessible"),e._destroy(),delete e.input.tomselect}render(e,t){var i,n;const r=this;if("function"!=typeof this.settings.render[e])return null;if(!(n=r.settings.render[e].call(this,t,re)))return null;if(n=fe(n),"option"===e||"option_create"===e?t[r.settings.disabledField]?ke(n,{"aria-disabled":"true"}):ke(n,{"data-selectable":""}):"optgroup"===e&&(i=t.group[r.settings.optgroupValueField],ke(n,{"data-group":i}),t.group[r.settings.disabledField]&&ke(n,{"data-disabled":""})),"option"===e||"item"===e){const i=ne(t[r.settings.valueField]);ke(n,{"data-value":i}),"item"===e?(be(n,r.settings.itemClass),ke(n,{"data-ts-item":""})):(be(n,r.settings.optionClass),ke(n,{role:"option",id:t.$id}),t.$div=n,r.options[i]=t)}return n}_render(e,t){const i=this.render(e,t);if(null==i)throw"HTMLElement expected";return i}clearCache(){pe(this.options,e=>{e.$div&&(e.$div.remove(),delete e.$div)})}uncacheValue(e){const t=this.getOption(e);t&&t.remove()}canCreate(e){return this.settings.create&&e.length>0&&this.settings.createFilter.call(this,e)}hook(e,t,i){var n=this,r=n[t];n[t]=function(){var t,s;return"after"===e&&(t=r.apply(n,arguments)),s=i.apply(n,arguments),"instead"===e?s:("before"===e&&(t=r.apply(n,arguments)),t)}}};const Fe=e=>"boolean"==typeof e?e?"1":"0":e+"",Me=(e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())},Ne=e=>"string"==typeof e&&e.indexOf("<")>-1;const je=e=>"string"==typeof e&&e.indexOf("<")>-1;const Pe=(e,t,i,n)=>{e.addEventListener(t,i,n)},$e=e=>"string"==typeof e&&e.indexOf("<")>-1,He=(e,t)=>{((e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)})(t,(t,i)=>{null==t?e.removeAttribute(i):e.setAttribute(i,""+t)})};const qe=e=>"string"==typeof e&&e.indexOf("<")>-1;const Re=e=>{var t=[];return((e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)})(e,e=>{"string"==typeof e&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},Be=e=>(Array.isArray(e)||(e=[e]),e);const Ve=e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(ze(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)},ze=e=>"string"==typeof e&&e.indexOf("<")>-1,We=e=>{var t=[];return((e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)})(e,e=>{"string"==typeof e&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},Ye=e=>(Array.isArray(e)||(e=[e]),e);const Ke=(e,t,i,n)=>{e.addEventListener(t,i,n)};const Ue=(e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())},Xe=(e,t,i,n)=>{e.addEventListener(t,i,n)},Qe=e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(Ge(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)},Ge=e=>"string"==typeof e&&e.indexOf("<")>-1;const Je=e=>{var t=[];return((e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)})(e,e=>{"string"==typeof e&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},Ze=e=>(Array.isArray(e)||(e=[e]),e);Ie.define("change_listener",function(){var e,t,i,n;e=this.input,t="change",i=()=>{this.sync()},e.addEventListener(t,i,n)}),Ie.define("checkbox_options",function(e){var t=this,i=t.onOptionSelect;t.settings.hideSelected=!1;const n=Object.assign({className:"tomselect-checkbox",checkedClassNames:void 0,uncheckedClassNames:void 0},e);var r=function(e,t){t?(e.checked=!0,n.uncheckedClassNames&&e.classList.remove(...n.uncheckedClassNames),n.checkedClassNames&&e.classList.add(...n.checkedClassNames)):(e.checked=!1,n.checkedClassNames&&e.classList.remove(...n.checkedClassNames),n.uncheckedClassNames&&e.classList.add(...n.uncheckedClassNames))},s=function(e){setTimeout(()=>{var t=e.querySelector("input."+n.className);t instanceof HTMLInputElement&&r(t,e.classList.contains("selected"))},1)};t.hook("after","setupTemplates",()=>{var e=t.settings.render.option;t.settings.render.option=(i,s)=>{var o=(e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(Ne(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)})(e.call(t,i,s)),a=document.createElement("input");n.className&&a.classList.add(n.className),a.addEventListener("click",function(e){Me(e)}),a.type="checkbox";const l=null==(c=i[t.settings.valueField])?null:Fe(c);var c;return r(a,!!(l&&t.items.indexOf(l)>-1)),o.prepend(a),o}}),t.on("item_remove",e=>{var i=t.getOption(e);i&&(i.classList.remove("selected"),s(i))}),t.on("item_add",e=>{var i=t.getOption(e);i&&s(i)}),t.hook("instead","onOptionSelect",(e,n)=>{if(n.classList.contains("selected"))return n.classList.remove("selected"),t.removeItem(n.dataset.value),t.refreshOptions(),void Me(e,!0);i.call(t,e,n),s(n)})}),Ie.define("clear_button",function(e){const t=this,i=Object.assign({className:"clear-button",title:"Clear All",html:e=>`<div class="${e.className}" title="${e.title}">&#10799;</div>`},e);t.on("initialize",()=>{var e=(e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(je(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)})(i.html(i));e.addEventListener("click",e=>{t.isLocked||(t.clear(),"single"===t.settings.mode&&t.settings.allowEmptyOption&&t.addItem(""),e.preventDefault(),e.stopPropagation())}),t.control.appendChild(e)})}),Ie.define("drag_drop",function(){var e=this;if("multi"!==e.settings.mode)return;var t=e.lock,i=e.unlock;let n,r=!0;e.hook("after","setupTemplates",()=>{var t=e.settings.render.item;e.settings.render.item=(i,s)=>{const o=(e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if($e(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)})(t.call(e,i,s));He(o,{draggable:"true"});const a=e=>{e.preventDefault(),o.classList.add("ts-drag-over"),l(o,n)},l=(e,t)=>{var i,n,r;void 0!==t&&(((e,t)=>{do{var i;if(e==(t=null==(i=t)?void 0:i.previousElementSibling))return!0}while(t&&t.previousElementSibling);return!1})(t,o)?(n=t,null==(r=(i=e).parentNode)||r.insertBefore(n,i.nextSibling)):((e,t)=>{var i;null==(i=e.parentNode)||i.insertBefore(t,e)})(e,t))};return Pe(o,"mousedown",e=>{r||((e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())})(e),e.stopPropagation()}),Pe(o,"dragstart",e=>{n=o,setTimeout(()=>{o.classList.add("ts-dragging")},0)}),Pe(o,"dragenter",a),Pe(o,"dragover",a),Pe(o,"dragleave",()=>{o.classList.remove("ts-drag-over")}),Pe(o,"dragend",()=>{var t;document.querySelectorAll(".ts-drag-over").forEach(e=>e.classList.remove("ts-drag-over")),null==(t=n)||t.classList.remove("ts-dragging"),n=void 0;var i=[];e.control.querySelectorAll("[data-value]").forEach(e=>{if(e.dataset.value){let t=e.dataset.value;t&&i.push(t)}}),e.setValue(i)}),o}}),e.hook("instead","lock",()=>(r=!1,t.call(e))),e.hook("instead","unlock",()=>(r=!0,i.call(e)))}),Ie.define("dropdown_header",function(e){const t=this,i=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:e=>'<div class="'+e.headerClass+'"><div class="'+e.titleRowClass+'"><span class="'+e.labelClass+'">'+e.title+'</span><a class="'+e.closeClass+'">&times;</a></div></div>'},e);t.on("initialize",()=>{var e=(e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(qe(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)})(i.html(i)),n=e.querySelector("."+i.closeClass);n&&n.addEventListener("click",e=>{((e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())})(e,!0),t.close()}),t.dropdown.insertBefore(e,t.dropdown.firstChild)})}),Ie.define("caret_position",function(){var e=this;e.hook("instead","setCaret",t=>{"single"!==e.settings.mode&&e.control.contains(e.control_input)?(t=Math.max(0,Math.min(e.items.length,t)))==e.caretPos||e.isPending||e.controlChildren().forEach((i,n)=>{n<t?e.control_input.insertAdjacentElement("beforebegin",i):e.control.appendChild(i)}):t=e.items.length,e.caretPos=t}),e.hook("instead","moveCaret",t=>{if(!e.isFocused)return;const i=e.getLastActive(t);if(i){const n=((e,t)=>{if(!e)return-1;t=t||e.nodeName;for(var i=0;e=e.previousElementSibling;)e.matches(t)&&i++;return i})(i);e.setCaret(t>0?n+1:n),e.setActiveItem(),((e,...t)=>{var i=Re(t);(e=Be(e)).map(e=>{i.map(t=>{e.classList.remove(t)})})})(i,"last-active")}else e.setCaret(e.caretPos+t)})}),Ie.define("dropdown_input",function(){const e=this;e.settings.shouldOpen=!0,e.hook("before","setup",()=>{e.focus_node=e.control,((e,...t)=>{var i=We(t);(e=Ye(e)).map(e=>{i.map(t=>{e.classList.add(t)})})})(e.control_input,"dropdown-input");const t=Ve('<div class="dropdown-input-wrap">');t.append(e.control_input),e.dropdown.insertBefore(t,e.dropdown.firstChild);const i=Ve('<input class="items-placeholder" tabindex="-1" />');i.placeholder=e.settings.placeholder||"",e.control.append(i)}),e.on("initialize",()=>{e.control_input.addEventListener("keydown",t=>{switch(t.keyCode){case 27:return e.isOpen&&(((e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())})(t,!0),e.close()),void e.clearActiveItems();case 9:e.focus_node.tabIndex=-1}return e.onKeyDown.call(e,t)}),e.on("blur",()=>{e.focus_node.tabIndex=e.isDisabled?-1:e.tabIndex}),e.on("dropdown_open",()=>{e.control_input.focus()});const t=e.onBlur;var i,n,r,s;e.hook("instead","onBlur",i=>{if(!i||i.relatedTarget!=e.control_input)return t.call(e)}),i=e.control_input,n="blur",r=()=>e.onBlur(),i.addEventListener(n,r,s),e.hook("before","close",()=>{e.isOpen&&e.focus_node.focus({preventScroll:!0})})})}),Ie.define("input_autogrow",function(){var e=this;e.on("initialize",()=>{var t=document.createElement("span"),i=e.control_input;t.style.cssText="position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ",e.wrapper.appendChild(t);for(const e of["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"])t.style[e]=i.style[e];var n=()=>{t.textContent=i.value,i.style.width=t.clientWidth+"px"};n(),e.on("update item_add item_remove",n),Ke(i,"input",n),Ke(i,"keyup",n),Ke(i,"blur",n),Ke(i,"update",n)})}),Ie.define("no_backspace_delete",function(){var e=this,t=e.deleteSelection;this.hook("instead","deleteSelection",i=>!!e.activeItems.length&&t.call(e,i))}),Ie.define("no_active_items",function(){this.hook("instead","setActiveItem",()=>{}),this.hook("instead","selectAll",()=>{})}),Ie.define("optgroup_columns",function(){var e=this,t=e.onKeyDown;e.hook("instead","onKeyDown",i=>{var n,r,s,o;if(!e.isOpen||37!==i.keyCode&&39!==i.keyCode)return t.call(e,i);e.ignoreHover=!0,o=((e,t)=>{for(;e&&e.matches;){if(e.matches(t))return e;e=e.parentNode}})(e.activeOption,"[data-group]"),n=((e,t)=>{if(!e)return-1;t=t||e.nodeName;for(var i=0;e=e.previousElementSibling;)e.matches(t)&&i++;return i})(e.activeOption,"[data-selectable]"),o&&(o=37===i.keyCode?o.previousSibling:o.nextSibling)&&(r=(s=o.querySelectorAll("[data-selectable]"))[Math.min(s.length-1,n)])&&e.setActiveOption(r)})}),Ie.define("remove_button",function(e){const t=Object.assign({label:"&times;",title:"Remove",className:"remove",append:!0},e);var i=this;if(t.append){var n='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+((t.title+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")+'">')+t.label+"</a>";i.hook("after","setupTemplates",()=>{var e=i.settings.render.item;i.settings.render.item=(t,r)=>{var s=Qe(e.call(i,t,r)),o=Qe(n);return s.appendChild(o),Xe(o,"mousedown",e=>{Ue(e,!0)}),Xe(o,"click",e=>{i.isLocked||(Ue(e,!0),i.isLocked||i.shouldDelete([s],e)&&(i.removeItem(s),i.refreshOptions(!1),i.inputState()))}),s}})}}),Ie.define("restore_on_backspace",function(e){const t=this,i=Object.assign({text:e=>e[t.settings.labelField]},e);t.on("item_remove",function(e){if(t.isFocused&&""===t.control_input.value.trim()){var n=t.options[e];n&&t.setTextboxValue(i.text.call(t,n))}})}),Ie.define("virtual_scroll",function(){const e=this,t=e.canLoad,i=e.clearActiveOption,n=e.loadCallback;var r,s,o={},a=!1,l=[];if(e.settings.shouldLoadMore||(e.settings.shouldLoadMore=()=>{if(r.clientHeight/(r.scrollHeight-r.scrollTop)>.9)return!0;if(e.activeOption){var t=e.selectable();if(Array.from(t).indexOf(e.activeOption)>=t.length-2)return!0}return!1}),!e.settings.firstUrl)throw"virtual_scroll plugin requires a firstUrl() method";e.settings.sortField=[{field:"$order"},{field:"$score"}];const c=t=>!("number"==typeof e.settings.maxOptions&&r.children.length>=e.settings.maxOptions)&&!(!(t in o)||!o[t]),d=(t,i)=>e.items.indexOf(i)>=0||l.indexOf(i)>=0;e.setNextUrl=(e,t)=>{o[e]=t},e.getUrl=t=>{if(t in o){const e=o[t];return o[t]=!1,e}return e.clearPagination(),e.settings.firstUrl.call(e,t)},e.clearPagination=()=>{o={}},e.hook("instead","clearActiveOption",()=>{if(!a)return i.call(e)}),e.hook("instead","canLoad",i=>i in o?c(i):t.call(e,i)),e.hook("instead","loadCallback",(t,i)=>{if(a){if(s){const i=t[0];void 0!==i&&(s.dataset.value=i[e.settings.valueField])}}else e.clearOptions(d);n.call(e,t,i),a=!1}),e.hook("after","refreshOptions",()=>{const t=e.lastValue;var i;c(t)?(i=e.render("loading_more",{query:t}))&&(i.setAttribute("data-selectable",""),s=i):t in o&&!r.querySelector(".no-results")&&(i=e.render("no_more_results",{query:t})),i&&(((e,...t)=>{var i=Je(t);(e=Ze(e)).map(e=>{i.map(t=>{e.classList.add(t)})})})(i,e.settings.optionClass),r.append(i))}),e.on("initialize",()=>{l=Object.keys(e.options),r=e.dropdown_content,e.settings.render=Object.assign({},{loading_more:()=>'<div class="loading-more-results">Loading more results ... </div>',no_more_results:()=>'<div class="no-more-results">No more results</div>'},e.settings.render),r.addEventListener("scroll",()=>{e.settings.shouldLoadMore.call(e)&&c(e.lastValue)&&(a||(a=!0,e.load.call(e,e.lastValue)))})})});class et{constructor(e){this.datepicker=e}onDatagridInit(e){return e.ajax.addEventListener("complete",t=>{this.initDatepicker(e)}),this.initDatepicker(e),!0}initDatepicker(e){const t=e.el.querySelectorAll("input[data-provide='datepicker']");t.length>=1&&this.datepicker.initDatepickers(Array.from(t),e)}}class tt{constructor(e){this.nette=e}onDatagridInit(e){return e.ajax.addEventListener("complete",t=>{this.initNetteForms(e)}),this.initNetteForms(e),!0}initNetteForms(e){var t,i;const n=null!==(i=null!==(t=this.nette)&&void 0!==t?t:w().Nette)&&void 0!==i?i:null;n&&e.el.querySelectorAll("form").forEach(e=>n.initForm(e))}}class it{constructor(e){this.selectpicker=e}onDatagridInit(e){return e.ajax.addEventListener("complete",t=>{this.initSelectpicker(e)}),this.initSelectpicker(e),!0}initSelectpicker(e){const t=e.el.querySelectorAll("select.selectpicker");t.length>=1&&this.selectpicker.initSelectpickers(Array.from(t),e)}}class nt{constructor(e){this.sortable=e}onDatagridInit(e){return e.ajax.addEventListener("before",e=>{}),this.sortable.initSortable(e),e.ajax.addEventListener("success",({detail:{payload:t}})=>{if(t._datagrid_sort){for(const i in t._datagrid_sort){const n=t._datagrid_sort[i],r=e.el.querySelector(`#datagrid-sort-${i}`);r&&(r.setAttribute("href",n),r.setAttribute("data-href",n))}this.sortable.initSortable(e)}if(t._datagrid_tree){const i=e.el.querySelector(`.datagrid-tree-item[data-id='${t._datagrid_tree}'] .datagrid-tree-item-children`);if(i&&t.snippets){i.classList.add("loaded");for(const e in t.snippets){const n=t.snippets[e],r=(new DOMParser).parseFromString(n,"text/html").firstElementChild;if(r){const t=document.createElement("div");t.id=e,t.classList.add("datagrid-tree-item"),t.setAttribute("data-id",e),r.hasAttribute("has-children")&&t.classList.add("has-children"),i.append(t)}}}this.sortable.initSortableTree(e)}}),!0}}class rt{onDatagridInit(e){return e.ajax.addEventListener("complete",t=>{this.initPerPage(e),this.initChange(e)}),this.initPerPage(e),this.initChange(e),!0}initPerPage(e){e.el.querySelectorAll("select[data-autosubmit-per-page]").forEach(t=>{t.addEventListener("change",()=>{var i,n;let r=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("input[type=submit]");if(r||(r=null===(n=t.parentElement)||void 0===n?void 0:n.querySelector("button[type=submit]")),console.log({inputEl:r}),!(r instanceof HTMLElement))return;const s=r.closest("form");console.log({form:s}),s&&e.ajax.submitForm(s)})})}initChange(e){e.el.querySelectorAll("[data-autosubmit]").forEach(t=>{const i=t.closest("form");i&&"true"!==t.dataset.listenersAttached&&(t.dataset.listenersAttached="true",t instanceof HTMLSelectElement?t.addEventListener("change",()=>e.ajax.submitForm(i)):t instanceof HTMLInputElement&&(t.hasAttribute("data-autosubmit-change")&&t.addEventListener("change",E(()=>e.ajax.submitForm(i))),t.addEventListener("keyup",E(t=>{if(_(t)||!function(e,t,i){const n=1===e.key.length?e.key.charCodeAt(0):0;return n>=t&&n<=i}(t,9,40)&&!function(e){return 2===e.key.length&&e.key.startsWith("F")}(t))return e.ajax.submitForm(i)}))))})}}class st{onDatagridInit(e){return e.ajax.addEventListener("complete",t=>{this.init(e)}),this.init(e)}init(e){let t=null;e.el.addEventListener("click",e=>{if(e.target instanceof HTMLElement&&e.target.classList.contains("col-checkbox")&&(t=e.target,e.shiftKey&&t)){const e=t.closest("tr");if(!e)return;const i=t.closest("tr");if(!i)return;const n=i.closest("tbody");if(!n)return;const r=Array.from(n.querySelectorAll("tr")),[s,o]=[i.rowIndex,e.rowIndex].sort();r.slice(s,o+1).forEach(e=>{const t=e.querySelector('.col-checkbox input[type="checkbox"]');t&&(t.checked=!0)})}});const i=Array.from(e.el.querySelectorAll(`input[data-check='${e.name}']:not([data-check-all])`)),n=e.el.querySelector(`input[data-check='${e.name}'][data-check-all]`),r=e.el.querySelector("select[name='group_action[group_action]']"),s=document.querySelectorAll(".row-group-actions *[type='submit']"),o=document.querySelector(".datagrid-selected-rows-count");return[...i,n].forEach(t=>{t&&t.addEventListener("change",()=>{if(t.hasAttribute("data-check-all")){if(e.name!==t.getAttribute("data-check-all"))return;if(i.forEach(e=>e.checked=t.checked),s.forEach(e=>e.disabled=!t.checked),r&&(r.disabled=!t.checked),o){const e=i.length;o.innerText=`${t.checked?e:0}/${e}`}return}n&&(n.checked=i.every(e=>e.checked));const a=i.filter(e=>e.checked),l=a.length>=1;s.forEach(e=>e.disabled=!l),r&&(r.disabled=!l),o&&(o.innerText=`${a.length}/${i.length}`)})}),!0}}const ot="data-datagrid-confirm";class at{onDatagridInit(e){return e.el.querySelectorAll(`[${ot}]:not(.ajax)`).forEach(t=>t.addEventListener("click",t=>this.confirmEventHandler.bind(e)(t.target,t))),e.ajax.addEventListener("interact",t=>this.confirmEventHandler.bind(e)(t.detail.element,t)),!0}confirmEventHandler(e,t){var i;const n=null===(i=e.closest("a"))||void 0===i?void 0:i.getAttribute(ot);n&&(window.confirm.bind(window)(n)||(t.stopPropagation(),t.preventDefault()))}}class lt{onInit(e){}onDatagridInit(e){return e.ajax.addEventListener("success",({detail:{payload:t}})=>{var i,n;if(t._datagrid_name&&t._datagrid_name===e.name){if(t._datagrid_inline_edited||t._datagrid_inline_edit_cancel){const i=e.el.querySelector(".datagrid-inline-edit-trigger");if(t._datagrid_inline_edited){e.el.querySelectorAll(`tr[data-id='${t._datagrid_inline_edited}'] > td`).forEach(e=>{e.classList.add("edited")})}return void(null==i||i.classList.remove("hidden"))}if(t._datagrid_inline_adding){const t=e.el.querySelector(".datagrid-row-inline-add");t&&(t.classList.remove("datagrid-row-inline-add-hidden"),null===(i=t.querySelector("input:not([readonly]), textarea:not([readonly])"))||void 0===i||i.focus())}t._datagrid_inline_editing&&(null===(n=e.el.querySelector(".datagrid-inline-edit-trigger"))||void 0===n||n.classList.add("hidden")),e.el.querySelectorAll(".datagrid-inline-edit input").forEach(e=>{e.addEventListener("keydown",t=>{var i,n;if(_(t))return t.stopPropagation(),t.preventDefault(),null===(n=null===(i=e.closest("tr"))||void 0===i?void 0:i.querySelector(".col-action-inline-edit [name='inline_edit[submit]']"))||void 0===n?void 0:n.click()})}),e.el.querySelectorAll(".datagrid-inline-add input").forEach(e=>{e.addEventListener("keydown",t=>{var i,n;if(_(t))return t.stopPropagation(),t.preventDefault(),null===(n=null===(i=e.closest("tr"))||void 0===i?void 0:i.querySelector(".col-action-inline-edit [name='inline_add[submit]']"))||void 0===n?void 0:n.click()})}),e.el.querySelectorAll("[data-datagrid-cancel-inline-add]").forEach(e=>{e.addEventListener("mouseup",t=>{if(0===t.button){t.stopPropagation(),t.preventDefault();const i=e.closest(".datagrid-row-inline-add");i&&i.classList.add("datagrid-row-inline-add-hidden")}})})}}),!0}}class ct{onDatagridInit(e){return e.el.querySelectorAll("[data-toggle-detail-grid]").forEach(t=>{if(t.getAttribute("data-toggle-detail-grid")!==e.name)return;const i=t.getAttribute("data-toggle-detail");t.addEventListener("click",n=>{const r=e.el.querySelector(`.item-detail-${e.name}-id-${i}`);t.closest("tr"),r&&(r.classList.add("datagrid--content-row"),r.classList.toggle("is-active")),e.ajax.addEventListener("before",t=>{t.detail.params.url.includes(`do=${e.name}-getItemDetail`)&&t.detail.params.url.includes(`grid-id=${i}`)&&(t.stopPropagation(),t.preventDefault())})})}),e.ajax.addEventListener("success",({detail:{payload:t}})=>{var i;t._datagrid_redraw_item_id&&t._datagrid_redraw_item_class&&(null===(i=e.el.querySelector(`tr[data-id='${t._datagrid_redraw_item_id}']`))||void 0===i||i.setAttribute("class",t._datagrid_redraw_item_class))}),!0}}class dt{onDatagridInit(e){return e.ajax.addEventListener("before",e=>{}),e.ajax.addEventListener("success",({detail:{payload:e}})=>{var t,i;if(e._datagrid_tree){const n=e._datagrid_tree,r=document.querySelector(`.datagrid-tree-item[data-id="${n}"]`),s=document.querySelector(`.datagrid-tree-item[data-id="${n}"] .datagrid-tree-item-children`);if(s){if(s.classList.contains("showed")){if(s.innerHTML="",s.classList.remove("showed"),r){const e=r.querySelector("a.chevron");e&&(e.style.transform="rotate(0deg)")}return}if(s.classList.add("showed"),r){const e=r.querySelector("a.chevron");e&&(e.style.transform="rotate(90deg)")}const n=e.snippets;for(const e in n){const r=n[e],o=(new DOMParser).parseFromString(r,"text/html").querySelector("[data-id]"),a=null!==(t=null==o?void 0:o.getAttribute("data-id"))&&void 0!==t?t:"",l=`\n<div class="datagrid-tree-item" class='${null!==(i=null==o?void 0:o.hasAttribute("data-has-children"))&&void 0!==i&&i?"has-children":""}' id="${e}" data-id="${a}">${r}</div>`;s.innerHTML=l}}}}),!0}}
8
8
  /**!
9
9
  * Sortable 1.15.6
10
10
  * @author RubaXa <trash@rubaxa.org>
11
11
  * @author owenm <owen23355@gmail.com>
12
12
  * @license MIT
13
- */function pe(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function fe(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?pe(Object(i),!0).forEach(function(e){me(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):pe(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function ge(t){return ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(t)}function me(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ve(){return ve=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},ve.apply(this,arguments)}function be(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},s=Object.keys(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function ye(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var _e=ye(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),we=ye(/Edge/i),Ee=ye(/firefox/i),Ae=ye(/safari/i)&&!ye(/chrome/i)&&!ye(/android/i),ke=ye(/iP(ad|od|hone)/i),Se=ye(/chrome/i)&&ye(/android/i),Ce={capture:!1,passive:!1};function Oe(t,e,i){t.addEventListener(e,i,!_e&&Ce)}function De(t,e,i){t.removeEventListener(e,i,!_e&&Ce)}function xe(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function Te(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Le(t,e,i,n){if(t){i=i||document;do{if(null!=e&&(">"===e[0]?t.parentNode===i&&xe(t,e):xe(t,e))||n&&t===i)return t;if(t===i)break}while(t=Te(t))}return null}var Ie,Me=/\s+/g;function Fe(t,e,i){if(t&&e)if(t.classList)t.classList[i?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(Me," ").replace(" "+e+" "," ");t.className=(n+(i?" "+e:"")).replace(Me," ")}}function Ne(t,e,i){var n=t&&t.style;if(n){if(void 0===i)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(i=t.currentStyle),void 0===e?i:i[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=i+("string"==typeof i?"":"px")}}function je(t,e){var i="";if("string"==typeof t)i=t;else do{var n=Ne(t,"transform");n&&"none"!==n&&(i=n+" "+i)}while(!e&&(t=t.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(i)}function Pe(t,e,i){if(t){var n=t.getElementsByTagName(e),r=0,s=n.length;if(i)for(;r<s;r++)i(n[r],r);return n}return[]}function $e(){var t=document.scrollingElement;return t||document.documentElement}function He(t,e,i,n,r){if(t.getBoundingClientRect||t===window){var s,o,a,l,c,d,u;if(t!==window&&t.parentNode&&t!==$e()?(o=(s=t.getBoundingClientRect()).top,a=s.left,l=s.bottom,c=s.right,d=s.height,u=s.width):(o=0,a=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(e||i)&&t!==window&&(r=r||t.parentNode,!_e))do{if(r&&r.getBoundingClientRect&&("none"!==Ne(r,"transform")||i&&"static"!==Ne(r,"position"))){var h=r.getBoundingClientRect();o-=h.top+parseInt(Ne(r,"border-top-width")),a-=h.left+parseInt(Ne(r,"border-left-width")),l=o+s.height,c=a+s.width;break}}while(r=r.parentNode);if(n&&t!==window){var p=je(r||t),f=p&&p.a,g=p&&p.d;p&&(l=(o/=g)+(d/=g),c=(a/=f)+(u/=f))}return{top:o,left:a,bottom:l,right:c,width:u,height:d}}}function qe(t,e,i){for(var n=We(t,!0),r=He(t)[e];n;){if(!(r>=He(n)[i]))return n;if(n===$e())break;n=We(n,!1)}return!1}function Re(t,e,i,n){for(var r=0,s=0,o=t.children;s<o.length;){if("none"!==o[s].style.display&&o[s]!==Xi.ghost&&(n||o[s]!==Xi.dragged)&&Le(o[s],i.draggable,t,!1)){if(r===e)return o[s];r++}s++}return null}function Be(t,e){for(var i=t.lastElementChild;i&&(i===Xi.ghost||"none"===Ne(i,"display")||e&&!xe(i,e));)i=i.previousElementSibling;return i||null}function Ve(t,e){var i=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===Xi.clone||e&&!xe(t,e)||i++;return i}function ze(t){var e=0,i=0,n=$e();if(t)do{var r=je(t),s=r.a,o=r.d;e+=t.scrollLeft*s,i+=t.scrollTop*o}while(t!==n&&(t=t.parentNode));return[e,i]}function We(t,e){if(!t||!t.getBoundingClientRect)return $e();var i=t,n=!1;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var r=Ne(i);if(i.clientWidth<i.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||i.clientHeight<i.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!i.getBoundingClientRect||i===document.body)return $e();if(n||e)return i;n=!0}}}while(i=i.parentNode);return $e()}function Ye(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function Ke(t,e){return function(){if(!Ie){var i=arguments;1===i.length?t.call(this,i[0]):t.apply(this,i),Ie=setTimeout(function(){Ie=void 0},e)}}}function Ue(t,e,i){t.scrollLeft+=e,t.scrollTop+=i}function Xe(t){var e=window.Polymer,i=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):i?i(t).clone(!0)[0]:t.cloneNode(!0)}function Qe(t,e,i){var n={};return Array.from(t.children).forEach(function(r){var s,o,a,l;if(Le(r,e.draggable,t,!1)&&!r.animated&&r!==i){var c=He(r);n.left=Math.min(null!==(s=n.left)&&void 0!==s?s:1/0,c.left),n.top=Math.min(null!==(o=n.top)&&void 0!==o?o:1/0,c.top),n.right=Math.max(null!==(a=n.right)&&void 0!==a?a:-1/0,c.right),n.bottom=Math.max(null!==(l=n.bottom)&&void 0!==l?l:-1/0,c.bottom)}}),n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}var Ge="Sortable"+(new Date).getTime();function Je(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach(function(t){if("none"!==Ne(t,"display")&&t!==Xi.ghost){e.push({target:t,rect:He(t)});var i=fe({},e[e.length-1].rect);if(t.thisAnimationDuration){var n=je(t,!0);n&&(i.top-=n.f,i.left-=n.e)}t.fromRect=i}})},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(function(t,e){for(var i in t)if(t.hasOwnProperty(i))for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t[i][n])return Number(i);return-1}(e,{target:t}),1)},animateAll:function(i){var n=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof i&&i());var r=!1,s=0;e.forEach(function(t){var e=0,i=t.target,o=i.fromRect,a=He(i),l=i.prevFromRect,c=i.prevToRect,d=t.rect,u=je(i,!0);u&&(a.top-=u.f,a.left-=u.e),i.toRect=a,i.thisAnimationDuration&&Ye(l,a)&&!Ye(o,a)&&(d.top-a.top)/(d.left-a.left)===(o.top-a.top)/(o.left-a.left)&&(e=function(t,e,i,n){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-i.top,2)+Math.pow(e.left-i.left,2))*n.animation}(d,l,c,n.options)),Ye(a,o)||(i.prevFromRect=o,i.prevToRect=a,e||(e=n.options.animation),n.animate(i,d,a,e)),e&&(r=!0,s=Math.max(s,e),clearTimeout(i.animationResetTimer),i.animationResetTimer=setTimeout(function(){i.animationTime=0,i.prevFromRect=null,i.fromRect=null,i.prevToRect=null,i.thisAnimationDuration=null},e),i.thisAnimationDuration=e)}),clearTimeout(t),r?t=setTimeout(function(){"function"==typeof i&&i()},s):"function"==typeof i&&i(),e=[]},animate:function(t,e,i,n){if(n){Ne(t,"transition",""),Ne(t,"transform","");var r=je(this.el),s=r&&r.a,o=r&&r.d,a=(e.left-i.left)/(s||1),l=(e.top-i.top)/(o||1);t.animatingX=!!a,t.animatingY=!!l,Ne(t,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),Ne(t,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),Ne(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout(function(){Ne(t,"transition",""),Ne(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1},n)}}}}var Ze=[],ti={initializeByDefault:!0},ei={mount:function(t){for(var e in ti)ti.hasOwnProperty(e)&&!(e in t)&&(t[e]=ti[e]);Ze.forEach(function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),Ze.push(t)},pluginEvent:function(t,e,i){var n=this;this.eventCanceled=!1,i.cancel=function(){n.eventCanceled=!0};var r=t+"Global";Ze.forEach(function(n){e[n.pluginName]&&(e[n.pluginName][r]&&e[n.pluginName][r](fe({sortable:e},i)),e.options[n.pluginName]&&e[n.pluginName][t]&&e[n.pluginName][t](fe({sortable:e},i)))})},initializePlugins:function(t,e,i,n){for(var r in Ze.forEach(function(n){var r=n.pluginName;if(t.options[r]||n.initializeByDefault){var s=new n(t,e,t.options);s.sortable=t,s.options=t.options,t[r]=s,ve(i,s.defaults)}}),t.options)if(t.options.hasOwnProperty(r)){var s=this.modifyOption(t,r,t.options[r]);void 0!==s&&(t.options[r]=s)}},getEventProperties:function(t,e){var i={};return Ze.forEach(function(n){"function"==typeof n.eventProperties&&ve(i,n.eventProperties.call(e[n.pluginName],t))}),i},modifyOption:function(t,e,i){var n;return Ze.forEach(function(r){t[r.pluginName]&&r.optionListeners&&"function"==typeof r.optionListeners[e]&&(n=r.optionListeners[e].call(t[r.pluginName],i))}),n}};var ii=["evt"],ni=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.evt,r=be(i,ii);ei.pluginEvent.bind(Xi)(t,e,fe({dragEl:si,parentEl:oi,ghostEl:ai,rootEl:li,nextEl:ci,lastDownEl:di,cloneEl:ui,cloneHidden:hi,dragStarted:Si,putSortable:bi,activeSortable:Xi.active,originalEvent:n,oldIndex:pi,oldDraggableIndex:gi,newIndex:fi,newDraggableIndex:mi,hideGhostForTarget:Wi,unhideGhostForTarget:Yi,cloneNowHidden:function(){hi=!0},cloneNowShown:function(){hi=!1},dispatchSortableEvent:function(t){ri({sortable:e,name:t,originalEvent:n})}},r))};function ri(t){!function(t){var e=t.sortable,i=t.rootEl,n=t.name,r=t.targetEl,s=t.cloneEl,o=t.toEl,a=t.fromEl,l=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,u=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||i&&i[Ge]){var g,m=e.options,v="on"+n.charAt(0).toUpperCase()+n.substr(1);!window.CustomEvent||_e||we?(g=document.createEvent("Event")).initEvent(n,!0,!0):g=new CustomEvent(n,{bubbles:!0,cancelable:!0}),g.to=o||i,g.from=a||i,g.item=r||i,g.clone=s,g.oldIndex=l,g.newIndex=c,g.oldDraggableIndex=d,g.newDraggableIndex=u,g.originalEvent=h,g.pullMode=p?p.lastPutMode:void 0;var b=fe(fe({},f),ei.getEventProperties(n,e));for(var y in b)g[y]=b[y];i&&i.dispatchEvent(g),m[v]&&m[v].call(e,g)}}(fe({putSortable:bi,cloneEl:ui,targetEl:si,rootEl:li,oldIndex:pi,oldDraggableIndex:gi,newIndex:fi,newDraggableIndex:mi},t))}var si,oi,ai,li,ci,di,ui,hi,pi,fi,gi,mi,vi,bi,yi,_i,wi,Ei,Ai,ki,Si,Ci,Oi,Di,xi,Ti=!1,Li=!1,Ii=[],Mi=!1,Fi=!1,Ni=[],ji=!1,Pi=[],$i="undefined"!=typeof document,Hi=ke,qi=we||_e?"cssFloat":"float",Ri=$i&&!Se&&!ke&&"draggable"in document.createElement("div"),Bi=function(){if($i){if(_e)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Vi=function(t,e){var i=Ne(t),n=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),r=Re(t,0,e),s=Re(t,1,e),o=r&&Ne(r),a=s&&Ne(s),l=o&&parseInt(o.marginLeft)+parseInt(o.marginRight)+He(r).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+He(s).width;if("flex"===i.display)return"column"===i.flexDirection||"column-reverse"===i.flexDirection?"vertical":"horizontal";if("grid"===i.display)return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&o.float&&"none"!==o.float){var d="left"===o.float?"left":"right";return!s||"both"!==a.clear&&a.clear!==d?"horizontal":"vertical"}return r&&("block"===o.display||"flex"===o.display||"table"===o.display||"grid"===o.display||l>=n&&"none"===i[qi]||s&&"none"===i[qi]&&l+c>n)?"vertical":"horizontal"},zi=function(t){function e(t,i){return function(n,r,s,o){var a=n.options.group.name&&r.options.group.name&&n.options.group.name===r.options.group.name;if(null==t&&(i||a))return!0;if(null==t||!1===t)return!1;if(i&&"clone"===t)return t;if("function"==typeof t)return e(t(n,r,s,o),i)(n,r,s,o);var l=(i?n:r).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var i={},n=t.group;n&&"object"==ge(n)||(n={name:n}),i.name=n.name,i.checkPull=e(n.pull,!0),i.checkPut=e(n.put),i.revertClone=n.revertClone,t.group=i},Wi=function(){!Bi&&ai&&Ne(ai,"display","none")},Yi=function(){!Bi&&ai&&Ne(ai,"display","")};$i&&!Se&&document.addEventListener("click",function(t){if(Li)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Li=!1,!1},!0);var Ki=function(t){if(si){t=t.touches?t.touches[0]:t;var e=(r=t.clientX,s=t.clientY,Ii.some(function(t){var e=t[Ge].options.emptyInsertThreshold;if(e&&!Be(t)){var i=He(t),n=r>=i.left-e&&r<=i.right+e,a=s>=i.top-e&&s<=i.bottom+e;return n&&a?o=t:void 0}}),o);if(e){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);i.target=i.rootEl=e,i.preventDefault=void 0,i.stopPropagation=void 0,e[Ge]._onDragOver(i)}}var r,s,o},Ui=function(t){si&&si.parentNode[Ge]._isOutsideThisEl(t.target)};function Xi(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=ve({},e),t[Ge]=this;var i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Vi(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Xi.supportPointer&&"PointerEvent"in window&&(!Ae||ke),emptyInsertThreshold:5};for(var n in ei.initializePlugins(this,t,i),i)!(n in e)&&(e[n]=i[n]);for(var r in zi(e),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!e.forceFallback&&Ri,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Oe(t,"pointerdown",this._onTapStart):(Oe(t,"mousedown",this._onTapStart),Oe(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Oe(t,"dragover",this),Oe(t,"dragenter",this)),Ii.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ve(this,Je())}function Qi(t,e,i,n,r,s,o,a){var l,c,d=t[Ge],u=d.options.onMove;return!window.CustomEvent||_e||we?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=i,l.draggedRect=n,l.related=r||e,l.relatedRect=s||He(e),l.willInsertAfter=a,l.originalEvent=o,t.dispatchEvent(l),u&&(c=u.call(d,l,o)),c}function Gi(t){t.draggable=!1}function Ji(){ji=!1}function Zi(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,i=e.length,n=0;i--;)n+=e.charCodeAt(i);return n.toString(36)}function tn(t){return setTimeout(t,0)}function en(t){return clearTimeout(t)}Xi.prototype={constructor:Xi,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(Ci=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,si):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,i=this.el,n=this.options,r=n.preventOnFilter,s=t.type,o=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(o||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=n.filter;if(function(t){Pi.length=0;var e=t.getElementsByTagName("input"),i=e.length;for(;i--;){var n=e[i];n.checked&&Pi.push(n)}}(i),!si&&!(/mousedown|pointerdown/.test(s)&&0!==t.button||n.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Ae||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=Le(a,n.draggable,i,!1))&&a.animated||di===a)){if(pi=Ve(a),gi=Ve(a,n.draggable),"function"==typeof c){if(c.call(this,t,a,this))return ri({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:i,fromEl:i}),ni("filter",e,{evt:t}),void(r&&t.preventDefault())}else if(c&&(c=c.split(",").some(function(n){if(n=Le(l,n.trim(),i,!1))return ri({sortable:e,rootEl:n,name:"filter",targetEl:a,fromEl:i,toEl:i}),ni("filter",e,{evt:t}),!0})))return void(r&&t.preventDefault());n.handle&&!Le(l,n.handle,i,!1)||this._prepareDragStart(t,o,a)}}},_prepareDragStart:function(t,e,i){var n,r=this,s=r.el,o=r.options,a=s.ownerDocument;if(i&&!si&&i.parentNode===s){var l=He(i);if(li=s,oi=(si=i).parentNode,ci=si.nextSibling,di=i,vi=o.group,Xi.dragged=si,yi={target:si,clientX:(e||t).clientX,clientY:(e||t).clientY},Ai=yi.clientX-l.left,ki=yi.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,si.style["will-change"]="all",n=function(){ni("delayEnded",r,{evt:t}),Xi.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!Ee&&r.nativeDraggable&&(si.draggable=!0),r._triggerDragStart(t,e),ri({sortable:r,name:"choose",originalEvent:t}),Fe(si,o.chosenClass,!0))},o.ignore.split(",").forEach(function(t){Pe(si,t.trim(),Gi)}),Oe(a,"dragover",Ki),Oe(a,"mousemove",Ki),Oe(a,"touchmove",Ki),o.supportPointer?(Oe(a,"pointerup",r._onDrop),!this.nativeDraggable&&Oe(a,"pointercancel",r._onDrop)):(Oe(a,"mouseup",r._onDrop),Oe(a,"touchend",r._onDrop),Oe(a,"touchcancel",r._onDrop)),Ee&&this.nativeDraggable&&(this.options.touchStartThreshold=4,si.draggable=!0),ni("delayStart",this,{evt:t}),!o.delay||o.delayOnTouchOnly&&!e||this.nativeDraggable&&(we||_e))n();else{if(Xi.eventCanceled)return void this._onDrop();o.supportPointer?(Oe(a,"pointerup",r._disableDelayedDrag),Oe(a,"pointercancel",r._disableDelayedDrag)):(Oe(a,"mouseup",r._disableDelayedDrag),Oe(a,"touchend",r._disableDelayedDrag),Oe(a,"touchcancel",r._disableDelayedDrag)),Oe(a,"mousemove",r._delayedDragTouchMoveHandler),Oe(a,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&Oe(a,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(n,o.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){si&&Gi(si),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;De(t,"mouseup",this._disableDelayedDrag),De(t,"touchend",this._disableDelayedDrag),De(t,"touchcancel",this._disableDelayedDrag),De(t,"pointerup",this._disableDelayedDrag),De(t,"pointercancel",this._disableDelayedDrag),De(t,"mousemove",this._delayedDragTouchMoveHandler),De(t,"touchmove",this._delayedDragTouchMoveHandler),De(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Oe(document,"pointermove",this._onTouchMove):Oe(document,e?"touchmove":"mousemove",this._onTouchMove):(Oe(si,"dragend",this),Oe(li,"dragstart",this._onDragStart));try{document.selection?tn(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(Ti=!1,li&&si){ni("dragStarted",this,{evt:e}),this.nativeDraggable&&Oe(document,"dragover",Ui);var i=this.options;!t&&Fe(si,i.dragClass,!1),Fe(si,i.ghostClass,!0),Xi.active=this,t&&this._appendGhost(),ri({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(_i){this._lastX=_i.clientX,this._lastY=_i.clientY,Wi();for(var t=document.elementFromPoint(_i.clientX,_i.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(_i.clientX,_i.clientY))!==e;)e=t;if(si.parentNode[Ge]._isOutsideThisEl(t),e)do{if(e[Ge]){if(e[Ge]._onDragOver({clientX:_i.clientX,clientY:_i.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=Te(e));Yi()}},_onTouchMove:function(t){if(yi){var e=this.options,i=e.fallbackTolerance,n=e.fallbackOffset,r=t.touches?t.touches[0]:t,s=ai&&je(ai,!0),o=ai&&s&&s.a,a=ai&&s&&s.d,l=Hi&&xi&&ze(xi),c=(r.clientX-yi.clientX+n.x)/(o||1)+(l?l[0]-Ni[0]:0)/(o||1),d=(r.clientY-yi.clientY+n.y)/(a||1)+(l?l[1]-Ni[1]:0)/(a||1);if(!Xi.active&&!Ti){if(i&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<i)return;this._onDragStart(t,!0)}if(ai){s?(s.e+=c-(wi||0),s.f+=d-(Ei||0)):s={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");Ne(ai,"webkitTransform",u),Ne(ai,"mozTransform",u),Ne(ai,"msTransform",u),Ne(ai,"transform",u),wi=c,Ei=d,_i=r}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!ai){var t=this.options.fallbackOnBody?document.body:li,e=He(si,!0,Hi,!0,t),i=this.options;if(Hi){for(xi=t;"static"===Ne(xi,"position")&&"none"===Ne(xi,"transform")&&xi!==document;)xi=xi.parentNode;xi!==document.body&&xi!==document.documentElement?(xi===document&&(xi=$e()),e.top+=xi.scrollTop,e.left+=xi.scrollLeft):xi=$e(),Ni=ze(xi)}Fe(ai=si.cloneNode(!0),i.ghostClass,!1),Fe(ai,i.fallbackClass,!0),Fe(ai,i.dragClass,!0),Ne(ai,"transition",""),Ne(ai,"transform",""),Ne(ai,"box-sizing","border-box"),Ne(ai,"margin",0),Ne(ai,"top",e.top),Ne(ai,"left",e.left),Ne(ai,"width",e.width),Ne(ai,"height",e.height),Ne(ai,"opacity","0.8"),Ne(ai,"position",Hi?"absolute":"fixed"),Ne(ai,"zIndex","100000"),Ne(ai,"pointerEvents","none"),Xi.ghost=ai,t.appendChild(ai),Ne(ai,"transform-origin",Ai/parseInt(ai.style.width)*100+"% "+ki/parseInt(ai.style.height)*100+"%")}},_onDragStart:function(t,e){var i=this,n=t.dataTransfer,r=i.options;ni("dragStart",this,{evt:t}),Xi.eventCanceled?this._onDrop():(ni("setupClone",this),Xi.eventCanceled||((ui=Xe(si)).removeAttribute("id"),ui.draggable=!1,ui.style["will-change"]="",this._hideClone(),Fe(ui,this.options.chosenClass,!1),Xi.clone=ui),i.cloneId=tn(function(){ni("clone",i),Xi.eventCanceled||(i.options.removeCloneOnHide||li.insertBefore(ui,si),i._hideClone(),ri({sortable:i,name:"clone"}))}),!e&&Fe(si,r.dragClass,!0),e?(Li=!0,i._loopId=setInterval(i._emulateDragOver,50)):(De(document,"mouseup",i._onDrop),De(document,"touchend",i._onDrop),De(document,"touchcancel",i._onDrop),n&&(n.effectAllowed="move",r.setData&&r.setData.call(i,n,si)),Oe(document,"drop",i),Ne(si,"transform","translateZ(0)")),Ti=!0,i._dragStartId=tn(i._dragStarted.bind(i,e,t)),Oe(document,"selectstart",i),Si=!0,window.getSelection().removeAllRanges(),Ae&&Ne(document.body,"user-select","none"))},_onDragOver:function(t){var e,i,n,r,s=this.el,o=t.target,a=this.options,l=a.group,c=Xi.active,d=vi===l,u=a.sort,h=bi||c,p=this,f=!1;if(!ji){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),o=Le(o,a.draggable,s,!0),x("dragOver"),Xi.eventCanceled)return f;if(si.contains(t.target)||o.animated&&o.animatingX&&o.animatingY||p._ignoreWhileAnimating===o)return L(!1);if(Li=!1,c&&!a.disabled&&(d?u||(n=oi!==li):bi===this||(this.lastPutMode=vi.checkPull(this,c,si,t))&&l.checkPut(this,c,si,t))){if(r="vertical"===this._getDirection(t,o),e=He(si),x("dragOverValid"),Xi.eventCanceled)return f;if(n)return oi=li,T(),this._hideClone(),x("revert"),Xi.eventCanceled||(ci?li.insertBefore(si,ci):li.appendChild(si)),L(!0);var g=Be(s,a.draggable);if(!g||function(t,e,i){var n=He(Be(i.el,i.options.draggable)),r=Qe(i.el,i.options,ai),s=10;return e?t.clientX>r.right+s||t.clientY>n.bottom&&t.clientX>n.left:t.clientY>r.bottom+s||t.clientX>n.right&&t.clientY>n.top}(t,r,this)&&!g.animated){if(g===si)return L(!1);if(g&&s===t.target&&(o=g),o&&(i=He(o)),!1!==Qi(li,s,si,e,o,i,t,!!o))return T(),g&&g.nextSibling?s.insertBefore(si,g.nextSibling):s.appendChild(si),oi=s,I(),L(!0)}else if(g&&function(t,e,i){var n=He(Re(i.el,0,i.options,!0)),r=Qe(i.el,i.options,ai),s=10;return e?t.clientX<r.left-s||t.clientY<n.top&&t.clientX<n.right:t.clientY<r.top-s||t.clientY<n.bottom&&t.clientX<n.left}(t,r,this)){var m=Re(s,0,a,!0);if(m===si)return L(!1);if(i=He(o=m),!1!==Qi(li,s,si,e,o,i,t,!1))return T(),s.insertBefore(si,m),oi=s,I(),L(!0)}else if(o.parentNode===s){i=He(o);var v,b,y,_=si.parentNode!==s,w=!function(t,e,i){var n=i?t.left:t.top,r=i?t.right:t.bottom,s=i?t.width:t.height,o=i?e.left:e.top,a=i?e.right:e.bottom,l=i?e.width:e.height;return n===o||r===a||n+s/2===o+l/2}(si.animated&&si.toRect||e,o.animated&&o.toRect||i,r),E=r?"top":"left",A=qe(o,"top","top")||qe(si,"top","top"),k=A?A.scrollTop:void 0;if(Ci!==o&&(b=i[E],Mi=!1,Fi=!w&&a.invertSwap||_),v=function(t,e,i,n,r,s,o,a){var l=n?t.clientY:t.clientX,c=n?i.height:i.width,d=n?i.top:i.left,u=n?i.bottom:i.right,h=!1;if(!o)if(a&&Di<c*r){if(!Mi&&(1===Oi?l>d+c*s/2:l<u-c*s/2)&&(Mi=!0),Mi)h=!0;else if(1===Oi?l<d+Di:l>u-Di)return-Oi}else if(l>d+c*(1-r)/2&&l<u-c*(1-r)/2)return function(t){return Ve(si)<Ve(t)?1:-1}(e);if((h=h||o)&&(l<d+c*s/2||l>u-c*s/2))return l>d+c/2?1:-1;return 0}(t,o,i,r,w?1:a.swapThreshold,null==a.invertedSwapThreshold?a.swapThreshold:a.invertedSwapThreshold,Fi,Ci===o),0!==v){var S=Ve(si);do{S-=v,y=oi.children[S]}while(y&&("none"===Ne(y,"display")||y===ai))}if(0===v||y===o)return L(!1);Ci=o,Oi=v;var C=o.nextElementSibling,O=!1,D=Qi(li,s,si,e,o,i,t,O=1===v);if(!1!==D)return 1!==D&&-1!==D||(O=1===D),ji=!0,setTimeout(Ji,30),T(),O&&!C?s.appendChild(si):o.parentNode.insertBefore(si,O?C:o),A&&Ue(A,0,k-A.scrollTop),oi=si.parentNode,void 0===b||Fi||(Di=Math.abs(b-He(o)[E])),I(),L(!0)}if(s.contains(si))return L(!1)}return!1}function x(a,l){ni(a,p,fe({evt:t,isOwner:d,axis:r?"vertical":"horizontal",revert:n,dragRect:e,targetRect:i,canSort:u,fromSortable:h,target:o,completed:L,onMove:function(i,n){return Qi(li,s,si,e,i,He(i),t,n)},changed:I},l))}function T(){x("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function L(e){return x("dragOverCompleted",{insertion:e}),e&&(d?c._hideClone():c._showClone(p),p!==h&&(Fe(si,bi?bi.options.ghostClass:c.options.ghostClass,!1),Fe(si,a.ghostClass,!0)),bi!==p&&p!==Xi.active?bi=p:p===Xi.active&&bi&&(bi=null),h===p&&(p._ignoreWhileAnimating=o),p.animateAll(function(){x("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(o===si&&!si.animated||o===s&&!o.animated)&&(Ci=null),a.dragoverBubble||t.rootEl||o===document||(si.parentNode[Ge]._isOutsideThisEl(t.target),!e&&Ki(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function I(){fi=Ve(si),mi=Ve(si,a.draggable),ri({sortable:p,name:"change",toEl:s,newIndex:fi,newDraggableIndex:mi,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){De(document,"mousemove",this._onTouchMove),De(document,"touchmove",this._onTouchMove),De(document,"pointermove",this._onTouchMove),De(document,"dragover",Ki),De(document,"mousemove",Ki),De(document,"touchmove",Ki)},_offUpEvents:function(){var t=this.el.ownerDocument;De(t,"mouseup",this._onDrop),De(t,"touchend",this._onDrop),De(t,"pointerup",this._onDrop),De(t,"pointercancel",this._onDrop),De(t,"touchcancel",this._onDrop),De(document,"selectstart",this)},_onDrop:function(t){var e=this.el,i=this.options;fi=Ve(si),mi=Ve(si,i.draggable),ni("drop",this,{evt:t}),oi=si&&si.parentNode,fi=Ve(si),mi=Ve(si,i.draggable),Xi.eventCanceled||(Ti=!1,Fi=!1,Mi=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),en(this.cloneId),en(this._dragStartId),this.nativeDraggable&&(De(document,"drop",this),De(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ae&&Ne(document.body,"user-select",""),Ne(si,"transform",""),t&&(Si&&(t.cancelable&&t.preventDefault(),!i.dropBubble&&t.stopPropagation()),ai&&ai.parentNode&&ai.parentNode.removeChild(ai),(li===oi||bi&&"clone"!==bi.lastPutMode)&&ui&&ui.parentNode&&ui.parentNode.removeChild(ui),si&&(this.nativeDraggable&&De(si,"dragend",this),Gi(si),si.style["will-change"]="",Si&&!Ti&&Fe(si,bi?bi.options.ghostClass:this.options.ghostClass,!1),Fe(si,this.options.chosenClass,!1),ri({sortable:this,name:"unchoose",toEl:oi,newIndex:null,newDraggableIndex:null,originalEvent:t}),li!==oi?(fi>=0&&(ri({rootEl:oi,name:"add",toEl:oi,fromEl:li,originalEvent:t}),ri({sortable:this,name:"remove",toEl:oi,originalEvent:t}),ri({rootEl:oi,name:"sort",toEl:oi,fromEl:li,originalEvent:t}),ri({sortable:this,name:"sort",toEl:oi,originalEvent:t})),bi&&bi.save()):fi!==pi&&fi>=0&&(ri({sortable:this,name:"update",toEl:oi,originalEvent:t}),ri({sortable:this,name:"sort",toEl:oi,originalEvent:t})),Xi.active&&(null!=fi&&-1!==fi||(fi=pi,mi=gi),ri({sortable:this,name:"end",toEl:oi,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){ni("nulling",this),li=si=oi=ai=ci=ui=di=hi=yi=_i=Si=fi=mi=pi=gi=Ci=Oi=bi=vi=Xi.dragged=Xi.ghost=Xi.clone=Xi.active=null,Pi.forEach(function(t){t.checked=!0}),Pi.length=wi=Ei=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":si&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],i=this.el.children,n=0,r=i.length,s=this.options;n<r;n++)Le(t=i[n],s.draggable,this.el,!1)&&e.push(t.getAttribute(s.dataIdAttr)||Zi(t));return e},sort:function(t,e){var i={},n=this.el;this.toArray().forEach(function(t,e){var r=n.children[e];Le(r,this.options.draggable,n,!1)&&(i[t]=r)},this),e&&this.captureAnimationState(),t.forEach(function(t){i[t]&&(n.removeChild(i[t]),n.appendChild(i[t]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return Le(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var i=this.options;if(void 0===e)return i[t];var n=ei.modifyOption(this,t,e);i[t]=void 0!==n?n:e,"group"===t&&zi(i)},destroy:function(){ni("destroy",this);var t=this.el;t[Ge]=null,De(t,"mousedown",this._onTapStart),De(t,"touchstart",this._onTapStart),De(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(De(t,"dragover",this),De(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Ii.splice(Ii.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!hi){if(ni("hideClone",this),Xi.eventCanceled)return;Ne(ui,"display","none"),this.options.removeCloneOnHide&&ui.parentNode&&ui.parentNode.removeChild(ui),hi=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(hi){if(ni("showClone",this),Xi.eventCanceled)return;si.parentNode!=li||this.options.group.revertClone?ci?li.insertBefore(ui,ci):li.appendChild(ui):li.insertBefore(ui,si),this.options.group.revertClone&&this.animate(si,ui),Ne(ui,"display",""),hi=!1}}else this._hideClone()}},$i&&Oe(document,"touchmove",function(t){(Xi.active||Ti)&&t.cancelable&&t.preventDefault()}),Xi.utils={on:Oe,off:De,css:Ne,find:Pe,is:function(t,e){return!!Le(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},throttle:Ke,closest:Le,toggleClass:Fe,clone:Xe,index:Ve,nextTick:tn,cancelNextTick:en,detectDirection:Vi,getChild:Re,expando:Ge},Xi.get=function(t){return t[Ge]},Xi.mount=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e[0].constructor===Array&&(e=e[0]),e.forEach(function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(Xi.utils=fe(fe({},Xi.utils),t.utils)),ei.mount(t)})},Xi.create=function(t,e){return new Xi(t,e)},Xi.version="1.15.6";var nn,rn,sn,on,an,ln,cn=[],dn=!1;function un(){cn.forEach(function(t){clearInterval(t.pid)}),cn=[]}function hn(){clearInterval(ln)}var pn=Ke(function(t,e,i,n){if(e.scroll){var r,s=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,l=e.scrollSpeed,c=$e(),d=!1;rn!==i&&(rn=i,un(),nn=e.scroll,r=e.scrollFn,!0===nn&&(nn=We(i,!0)));var u=0,h=nn;do{var p=h,f=He(p),g=f.top,m=f.bottom,v=f.left,b=f.right,y=f.width,_=f.height,w=void 0,E=void 0,A=p.scrollWidth,k=p.scrollHeight,S=Ne(p),C=p.scrollLeft,O=p.scrollTop;p===c?(w=y<A&&("auto"===S.overflowX||"scroll"===S.overflowX||"visible"===S.overflowX),E=_<k&&("auto"===S.overflowY||"scroll"===S.overflowY||"visible"===S.overflowY)):(w=y<A&&("auto"===S.overflowX||"scroll"===S.overflowX),E=_<k&&("auto"===S.overflowY||"scroll"===S.overflowY));var D=w&&(Math.abs(b-s)<=a&&C+y<A)-(Math.abs(v-s)<=a&&!!C),x=E&&(Math.abs(m-o)<=a&&O+_<k)-(Math.abs(g-o)<=a&&!!O);if(!cn[u])for(var T=0;T<=u;T++)cn[T]||(cn[T]={});cn[u].vx==D&&cn[u].vy==x&&cn[u].el===p||(cn[u].el=p,cn[u].vx=D,cn[u].vy=x,clearInterval(cn[u].pid),0==D&&0==x||(d=!0,cn[u].pid=setInterval(function(){n&&0===this.layer&&Xi.active._onTouchMove(an);var e=cn[this.layer].vy?cn[this.layer].vy*l:0,i=cn[this.layer].vx?cn[this.layer].vx*l:0;"function"==typeof r&&"continue"!==r.call(Xi.dragged.parentNode[Ge],i,e,t,an,cn[this.layer].el)||Ue(cn[this.layer].el,i,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=We(h,!1)));dn=d}},30),fn=function(t){var e=t.originalEvent,i=t.putSortable,n=t.dragEl,r=t.activeSortable,s=t.dispatchSortableEvent,o=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=i||r;o();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,d=document.elementFromPoint(c.clientX,c.clientY);a(),l&&!l.el.contains(d)&&(s("spill"),this.onSpill({dragEl:n,putSortable:i}))}};function gn(){}function mn(){}gn.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,i=t.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var n=Re(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(e,n):this.sortable.el.appendChild(e),this.sortable.animateAll(),i&&i.animateAll()},drop:fn},ve(gn,{pluginName:"revertOnSpill"}),mn.prototype={onSpill:function(t){var e=t.dragEl,i=t.putSortable||this.sortable;i.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),i.animateAll()},drop:fn},ve(mn,{pluginName:"removeOnSpill"}),Xi.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?Oe(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Oe(document,"pointermove",this._handleFallbackAutoScroll):e.touches?Oe(document,"touchmove",this._handleFallbackAutoScroll):Oe(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?De(document,"dragover",this._handleAutoScroll):(De(document,"pointermove",this._handleFallbackAutoScroll),De(document,"touchmove",this._handleFallbackAutoScroll),De(document,"mousemove",this._handleFallbackAutoScroll)),hn(),un(),clearTimeout(Ie),Ie=void 0},nulling:function(){an=rn=nn=dn=ln=sn=on=null,cn.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var i=this,n=(t.touches?t.touches[0]:t).clientX,r=(t.touches?t.touches[0]:t).clientY,s=document.elementFromPoint(n,r);if(an=t,e||this.options.forceAutoScrollFallback||we||_e||Ae){pn(t,this.options,s,e);var o=We(s,!0);!dn||ln&&n===sn&&r===on||(ln&&hn(),ln=setInterval(function(){var s=We(document.elementFromPoint(n,r),!0);s!==o&&(o=s,un()),pn(t,i.options,s,e)},10),sn=n,on=r)}else{if(!this.options.bubbleScroll||We(s,!0)===$e())return void un();pn(t,this.options,We(s,!1),!1)}}},ve(t,{pluginName:"scroll",initializeByDefault:!0})}),Xi.mount(mn,gn);class vn{initSortable(t){const e=t.el.querySelector("[data-sortable]");e&&new Xi(e,{handle:".handle-sort",draggable:"tr",sort:!0,direction:"vertical",async onEnd({item:e}){var i,n,r,s,o,a;const l=e.getAttribute("data-id");if(l){const c=null!==(n=null===(i=e.previousElementSibling)||void 0===i?void 0:i.getAttribute("data-id"))&&void 0!==n?n:null,d=null!==(s=null===(r=e.nextElementSibling)||void 0===r?void 0:r.getAttribute("data-id"))&&void 0!==s?s:null,u=t.el.querySelector("tbody");if(u){let e=null!==(o=u.getAttribute("data-sortable-parent-path"))&&void 0!==o?o:"";e.length&&(e=`${e}-`);const i=null!==(a=u.getAttribute("data-sortable-url"))&&void 0!==a?a:"?do=sort",n={[`${e}item_id`]:l,...c?{[`${e}prev_id`]:c}:{},...d?{[`${e}next_id`]:d}:{}};return await t.ajax.request({method:"GET",url:i,data:n})}}}})}initSortableTree(t){t.el.querySelectorAll(".datagrid-tree-item-children").forEach(t=>{new Xi(t,{handle:".handle-sort",draggable:".datagrid-tree-item:not(.datagrid-tree-header)",async onEnd({item:t}){}})})}}class bn{constructor(t,e={}){this.select=t,this.opts=e}initSelectpickers(t){var e,i,n;const r=null!==(n=null!==(e=this.select)&&void 0!==e?e:null===(i=w())||void 0===i?void 0:i.TomSelect)&&void 0!==n?n:null;r&&t.forEach(t=>{t.hasAttribute("data-Tom-Initialised")||(t.setAttribute("data-Tom-Initialised","true"),new r(t,"function"==typeof this.opts?this.opts(t):this.opts))})}}function yn(t){return t[t.length-1]}function _n(t,...e){return e.forEach(e=>{t.includes(e)||t.push(e)}),t}function wn(t,e){return t?t.split(e):[]}function En(t,e,i){return(void 0===e||t>=e)&&(void 0===i||t<=i)}function An(t,e,i){return t<e?e:t>i?i:t}function kn(t,e,i={},n=0,r=""){r+=`<${Object.keys(i).reduce((t,e)=>{let r=i[e];return"function"==typeof r&&(r=r(n)),`${t} ${e}="${r}"`},t)}></${t}>`;const s=n+1;return s<e?kn(t,e,i,s,r):r}function Sn(t){return t.replace(/>\s+/g,">").replace(/\s+</,"<")}function Cn(t){return new Date(t).setHours(0,0,0,0)}function On(){return(new Date).setHours(0,0,0,0)}function Dn(...t){switch(t.length){case 0:return On();case 1:return Cn(t[0])}const e=new Date(0);return e.setFullYear(...t),e.setHours(0,0,0,0)}function xn(t,e){const i=new Date(t);return i.setDate(i.getDate()+e)}function Tn(t,e){const i=new Date(t),n=i.getMonth()+e;let r=n%12;r<0&&(r+=12);const s=i.setMonth(n);return i.getMonth()!==r?i.setDate(0):s}function Ln(t,e){const i=new Date(t),n=i.getMonth(),r=i.setFullYear(i.getFullYear()+e);return 1===n&&2===i.getMonth()?i.setDate(0):r}function In(t,e){return(t-e+7)%7}function Mn(t,e,i=0){const n=new Date(t).getDay();return xn(t,In(e,i)-In(n,i))}function Fn(t,e){return Math.round((t-e)/6048e5)+1}function Nn(t){const e=Mn(t,4,1);return Fn(e,Mn(new Date(e).setMonth(0,4),4,1))}function jn(t,e){const i=Mn(new Date(t).setMonth(0,1),e,e),n=Mn(t,e,e),r=Fn(n,i);if(r<53)return r;return n===Mn(new Date(t).setDate(32),e,e)?1:r}function Pn(t){return jn(t,0)}function $n(t){return jn(t,6)}function Hn(t,e){const i=new Date(t).getFullYear();return Math.floor(i/e)*e}function qn(t,e,i){if(1!==e&&2!==e)return t;const n=new Date(t);return 1===e?i?n.setMonth(n.getMonth()+1,0):n.setDate(1):i?n.setFullYear(n.getFullYear()+1,0,0):n.setMonth(0,1),n.setHours(0,0,0,0)}const Rn=/dd?|DD?|mm?|MM?|yy?(?:yy)?/,Bn=/[\s!-/:-@[-`{-~年月日]+/;let Vn={};const zn={y:(t,e)=>new Date(t).setFullYear(parseInt(e,10)),m(t,e,i){const n=new Date(t);let r=parseInt(e,10)-1;if(isNaN(r)){if(!e)return NaN;const t=e.toLowerCase(),n=e=>e.toLowerCase().startsWith(t);if(r=i.monthsShort.findIndex(n),r<0&&(r=i.months.findIndex(n)),r<0)return NaN}return n.setMonth(r),n.getMonth()!==Yn(r)?n.setDate(0):n.getTime()},d:(t,e)=>new Date(t).setDate(parseInt(e,10))},Wn={d:t=>t.getDate(),dd:t=>Kn(t.getDate(),2),D:(t,e)=>e.daysShort[t.getDay()],DD:(t,e)=>e.days[t.getDay()],m:t=>t.getMonth()+1,mm:t=>Kn(t.getMonth()+1,2),M:(t,e)=>e.monthsShort[t.getMonth()],MM:(t,e)=>e.months[t.getMonth()],y:t=>t.getFullYear(),yy:t=>Kn(t.getFullYear(),2).slice(-2),yyyy:t=>Kn(t.getFullYear(),4)};function Yn(t){return t>-1?t%12:Yn(t+12)}function Kn(t,e){return t.toString().padStart(e,"0")}function Un(t){if("string"!=typeof t)throw new Error("Invalid date format.");if(t in Vn)return Vn[t];const e=t.split(Rn),i=t.match(new RegExp(Rn,"g"));if(0===e.length||!i)throw new Error("Invalid date format.");const n=i.map(t=>Wn[t]),r=Object.keys(zn).reduce((t,e)=>(i.find(t=>"D"!==t[0]&&t[0].toLowerCase()===e)&&t.push(e),t),[]);return Vn[t]={parser(t,e){const n=t.split(Bn).reduce((t,e,n)=>{if(e.length>0&&i[n]){const r=i[n][0];"M"===r?t.m=e:"D"!==r&&(t[r]=e)}return t},{});return r.reduce((t,i)=>{const r=zn[i](t,n[i],e);return isNaN(r)?t:r},On())},formatter(t,i){let r=n.reduce((n,r,s)=>n+`${e[s]}${r(t,i)}`,"");return r+yn(e)}}}function Xn(t,e,i){if(t instanceof Date||"number"==typeof t){const e=Cn(t);return isNaN(e)?void 0:e}if(t){if("today"===t)return On();if(e&&e.toValue){const n=e.toValue(t,e,i);return isNaN(n)?void 0:Cn(n)}return Un(e).parser(t,i)}}function Qn(t,e,i){if(isNaN(t)||!t&&0!==t)return"";const n="number"==typeof t?new Date(t):t;return e.toDisplay?e.toDisplay(n,e,i):Un(e).formatter(n,i)}const Gn=document.createRange();function Jn(t){return Gn.createContextualFragment(t)}function Zn(t){return t.parentElement||(t.parentNode instanceof ShadowRoot?t.parentNode.host:void 0)}function tr(t){return t.getRootNode().activeElement===t}function er(t){"none"!==t.style.display&&(t.style.display&&(t.dataset.styleDisplay=t.style.display),t.style.display="none")}function ir(t){"none"===t.style.display&&(t.dataset.styleDisplay?(t.style.display=t.dataset.styleDisplay,delete t.dataset.styleDisplay):t.style.display="")}function nr(t){t.firstChild&&(t.removeChild(t.firstChild),nr(t))}const rr=new WeakMap,{addEventListener:sr,removeEventListener:or}=EventTarget.prototype;function ar(t,e){let i=rr.get(t);i||(i=[],rr.set(t,i)),e.forEach(t=>{sr.call(...t),i.push(t)})}if(!Event.prototype.composedPath){const t=(e,i=[])=>{let n;return i.push(e),e.parentNode?n=e.parentNode:e.host?n=e.host:e.defaultView&&(n=e.defaultView),n?t(n,i):i};Event.prototype.composedPath=function(){return t(this.target)}}function lr(t,e,i){const[n,...r]=t;return e(n)?n:n!==i&&"HTML"!==n.tagName&&0!==r.length?lr(r,e,i):void 0}function cr(t,e){const i="function"==typeof e?e:t=>t instanceof Element&&t.matches(e);return lr(t.composedPath(),i,t.currentTarget)}var dr={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear",titleFormat:"MM y"}},ur={autohide:!1,beforeShowDay:null,beforeShowDecade:null,beforeShowMonth:null,beforeShowYear:null,clearButton:!1,dateDelimiter:",",datesDisabled:[],daysOfWeekDisabled:[],daysOfWeekHighlighted:[],defaultViewDate:void 0,disableTouchKeyboard:!1,enableOnReadonly:!0,format:"mm/dd/yyyy",language:"en",maxDate:null,maxNumberOfDates:1,maxView:3,minDate:null,nextArrow:"»",orientation:"auto",pickLevel:0,prevArrow:"«",showDaysOfWeek:!0,showOnClick:!0,showOnFocus:!0,startView:0,title:"",todayButton:!1,todayButtonMode:0,todayHighlight:!1,updateOnBlur:!0,weekNumbers:0,weekStart:0};const{language:hr,format:pr,weekStart:fr}=ur;function gr(t,e){return t.length<6&&e>=0&&e<7?_n(t,e):t}function mr(t,e){switch(4===t?6===e?3:!e+1:t){case 1:return Nn;case 2:return Pn;case 3:return $n}}function vr(t,e,i){return e.weekStart=t,e.weekEnd=(t+6)%7,4===i&&(e.getWeekNumber=mr(4,t)),t}function br(t,e,i,n){const r=Xn(t,e,i);return void 0!==r?r:n}function yr(t,e,i=3){const n=parseInt(t,10);return n>=0&&n<=i?n:e}function _r(t,e,i,n=void 0){e in t&&(i in t||(t[i]=n?n(t[e]):t[e]),delete t[e])}function wr(t,e){const i=Object.assign({},t),n={},r=e.constructor.locales,s=!!e.rangeSideIndex;let{datesDisabled:o,format:a,language:l,locale:c,maxDate:d,maxView:u,minDate:h,pickLevel:p,startView:f,weekNumbers:g,weekStart:m}=e.config||{};if(_r(i,"calendarWeeks","weekNumbers",t=>t?1:0),_r(i,"clearBtn","clearButton"),_r(i,"todayBtn","todayButton"),_r(i,"todayBtnMode","todayButtonMode"),i.language){let t;if(i.language!==l&&(r[i.language]?t=i.language:(t=i.language.split("-")[0],r[t]||(t=!1))),delete i.language,t){l=n.language=t;const e=c||r[hr];c=Object.assign({format:pr,weekStart:fr},r[hr]),l!==hr&&Object.assign(c,r[l]),n.locale=c,a===e.format&&(a=n.format=c.format),m===e.weekStart&&(m=vr(c.weekStart,n,g))}}if(i.format){const t="function"==typeof i.format.toDisplay,e="function"==typeof i.format.toValue,r=Rn.test(i.format);(t&&e||r)&&(a=n.format=i.format),delete i.format}let v=p;"pickLevel"in i&&(v=yr(i.pickLevel,p,2),delete i.pickLevel),v!==p&&(v>p&&("minDate"in i||(i.minDate=h),"maxDate"in i||(i.maxDate=d)),o&&!i.datesDisabled&&(i.datesDisabled=[]),p=n.pickLevel=v);let b=h,y=d;if("minDate"in i){const t=Dn(0,0,1);b=null===i.minDate?t:br(i.minDate,a,c,b),b!==t&&(b=qn(b,p,!1)),delete i.minDate}if("maxDate"in i&&(y=null===i.maxDate?void 0:br(i.maxDate,a,c,y),void 0!==y&&(y=qn(y,p,!0)),delete i.maxDate),y<b?(h=n.minDate=y,d=n.maxDate=b):(h!==b&&(h=n.minDate=b),d!==y&&(d=n.maxDate=y)),i.datesDisabled){const t=i.datesDisabled;if("function"==typeof t)n.datesDisabled=null,n.checkDisabled=(e,i)=>t(new Date(e),i,s);else{const e=n.datesDisabled=t.reduce((t,e)=>{const i=Xn(e,a,c);return void 0!==i?_n(t,qn(i,p,s)):t},[]);n.checkDisabled=t=>e.includes(t)}delete i.datesDisabled}if("defaultViewDate"in i){const t=Xn(i.defaultViewDate,a,c);void 0!==t&&(n.defaultViewDate=t),delete i.defaultViewDate}if("weekStart"in i){const t=Number(i.weekStart)%7;isNaN(t)||(m=vr(t,n,g)),delete i.weekStart}if(i.daysOfWeekDisabled&&(n.daysOfWeekDisabled=i.daysOfWeekDisabled.reduce(gr,[]),delete i.daysOfWeekDisabled),i.daysOfWeekHighlighted&&(n.daysOfWeekHighlighted=i.daysOfWeekHighlighted.reduce(gr,[]),delete i.daysOfWeekHighlighted),"weekNumbers"in i){let t=i.weekNumbers;if(t){const e="function"==typeof t?(e,i)=>t(new Date(e),i):mr(t=parseInt(t,10),m);e&&(g=n.weekNumbers=t,n.getWeekNumber=e)}else g=n.weekNumbers=0,n.getWeekNumber=null;delete i.weekNumbers}if("maxNumberOfDates"in i){const t=parseInt(i.maxNumberOfDates,10);t>=0&&(n.maxNumberOfDates=t,n.multidate=1!==t),delete i.maxNumberOfDates}i.dateDelimiter&&(n.dateDelimiter=String(i.dateDelimiter),delete i.dateDelimiter);let _=u;"maxView"in i&&(_=yr(i.maxView,u),delete i.maxView),_=p>_?p:_,_!==u&&(u=n.maxView=_);let w=f;if("startView"in i&&(w=yr(i.startView,w),delete i.startView),w<p?w=p:w>u&&(w=u),w!==f&&(n.startView=w),i.prevArrow){const t=Jn(i.prevArrow);t.childNodes.length>0&&(n.prevArrow=t.childNodes),delete i.prevArrow}if(i.nextArrow){const t=Jn(i.nextArrow);t.childNodes.length>0&&(n.nextArrow=t.childNodes),delete i.nextArrow}if("disableTouchKeyboard"in i&&(n.disableTouchKeyboard="ontouchstart"in document&&!!i.disableTouchKeyboard,delete i.disableTouchKeyboard),i.orientation){const t=i.orientation.toLowerCase().split(/\s+/g);n.orientation={x:t.find(t=>"left"===t||"right"===t)||"auto",y:t.find(t=>"top"===t||"bottom"===t)||"auto"},delete i.orientation}if("todayButtonMode"in i){switch(i.todayButtonMode){case 0:case 1:n.todayButtonMode=i.todayButtonMode}delete i.todayButtonMode}return Object.entries(i).forEach(([t,e])=>{void 0!==e&&t in ur&&(n[t]=e)}),n}const Er={show:{key:"ArrowDown"},hide:null,toggle:{key:"Escape"},prevButton:{key:"ArrowLeft",ctrlOrMetaKey:!0},nextButton:{key:"ArrowRight",ctrlOrMetaKey:!0},viewSwitch:{key:"ArrowUp",ctrlOrMetaKey:!0},clearButton:{key:"Backspace",ctrlOrMetaKey:!0},todayButton:{key:".",ctrlOrMetaKey:!0},exitEditMode:{key:"ArrowDown",ctrlOrMetaKey:!0}};const Ar=t=>t.map(t=>`<button type="button" class="%buttonClass% ${t}" tabindex="-1"></button>`).join("");var kr=Sn(`<div class="datepicker">\n <div class="datepicker-picker">\n <div class="datepicker-header">\n <div class="datepicker-title"></div>\n <div class="datepicker-controls">\n ${Ar(["prev-button prev-btn","view-switch","next-button next-btn"])}\n </div>\n </div>\n <div class="datepicker-main"></div>\n <div class="datepicker-footer">\n <div class="datepicker-controls">\n ${Ar(["today-button today-btn","clear-button clear-btn"])}\n </div>\n </div>\n </div>\n</div>`),Sr=Sn(`<div class="days">\n <div class="days-of-week">${kn("span",7,{class:"dow"})}</div>\n <div class="datepicker-grid">${kn("span",42)}</div>\n</div>`),Cr=Sn(`<div class="week-numbers calendar-weeks">\n <div class="days-of-week"><span class="dow"></span></div>\n <div class="weeks">${kn("span",6,{class:"week"})}</div>\n</div>`);class Or{constructor(t,e){Object.assign(this,e,{picker:t,element:Jn('<div class="datepicker-view"></div>').firstChild,selected:[],isRangeEnd:!!t.datepicker.rangeSideIndex}),this.init(this.picker.datepicker.config)}init(t){"pickLevel"in t&&(this.isMinView=this.id===t.pickLevel),this.setOptions(t),this.updateFocus(),this.updateSelection()}prepareForRender(t,e,i){this.disabled=[];const n=this.picker;n.setViewSwitchLabel(t),n.setPrevButtonDisabled(e),n.setNextButtonDisabled(i)}setDisabled(t,e){e.add("disabled"),_n(this.disabled,t)}performBeforeHook(t,e){let i=this.beforeShow(new Date(e));switch(typeof i){case"boolean":i={enabled:i};break;case"string":i={classes:i}}if(i){const n=t.classList;if(!1===i.enabled&&this.setDisabled(e,n),i.classes){const t=i.classes.split(/\s+/);n.add(...t),t.includes("disabled")&&this.setDisabled(e,n)}i.content&&function(t,e){nr(t),e instanceof DocumentFragment?t.appendChild(e):"string"==typeof e?t.appendChild(Jn(e)):"function"==typeof e.forEach&&e.forEach(e=>{t.appendChild(e)})}(t,i.content)}}renderCell(t,e,i,n,{selected:r,range:s},o,a=[]){t.textContent=e,this.isMinView&&(t.dataset.date=n);const l=t.classList;if(t.className=`datepicker-cell ${this.cellClass}`,i<this.first?l.add("prev"):i>this.last&&l.add("next"),l.add(...a),(o||this.checkDisabled(n,this.id))&&this.setDisabled(n,l),s){const[t,e]=s;i>t&&i<e&&l.add("range"),i===t&&l.add("range-start"),i===e&&l.add("range-end")}r.includes(i)&&l.add("selected"),i===this.focused&&l.add("focused"),this.beforeShow&&this.performBeforeHook(t,n)}refreshCell(t,e,i,[n,r]){const s=t.classList;s.remove("range","range-start","range-end","selected","focused"),e>n&&e<r&&s.add("range"),e===n&&s.add("range-start"),e===r&&s.add("range-end"),i.includes(e)&&s.add("selected"),e===this.focused&&s.add("focused")}changeFocusedCell(t){this.grid.querySelectorAll(".focused").forEach(t=>{t.classList.remove("focused")}),this.grid.children[t].classList.add("focused")}}class Dr extends Or{constructor(t){super(t,{id:0,name:"days",cellClass:"day"})}init(t,e=!0){if(e){const t=Jn(Sr).firstChild;this.dow=t.firstChild,this.grid=t.lastChild,this.element.appendChild(t)}super.init(t)}setOptions(t){let e;if("minDate"in t&&(this.minDate=t.minDate),"maxDate"in t&&(this.maxDate=t.maxDate),t.checkDisabled&&(this.checkDisabled=t.checkDisabled),t.daysOfWeekDisabled&&(this.daysOfWeekDisabled=t.daysOfWeekDisabled,e=!0),t.daysOfWeekHighlighted&&(this.daysOfWeekHighlighted=t.daysOfWeekHighlighted),"todayHighlight"in t&&(this.todayHighlight=t.todayHighlight),"weekStart"in t&&(this.weekStart=t.weekStart,this.weekEnd=t.weekEnd,e=!0),t.locale){const i=this.locale=t.locale;this.dayNames=i.daysMin,this.switchLabelFormat=i.titleFormat,e=!0}if("beforeShowDay"in t&&(this.beforeShow="function"==typeof t.beforeShowDay?t.beforeShowDay:void 0),"weekNumbers"in t)if(t.weekNumbers&&!this.weekNumbers){const t=Jn(Cr).firstChild;this.weekNumbers={element:t,dow:t.firstChild,weeks:t.lastChild},this.element.insertBefore(t,this.element.firstChild)}else this.weekNumbers&&!t.weekNumbers&&(this.element.removeChild(this.weekNumbers.element),this.weekNumbers=null);"getWeekNumber"in t&&(this.getWeekNumber=t.getWeekNumber),"showDaysOfWeek"in t&&(t.showDaysOfWeek?(ir(this.dow),this.weekNumbers&&ir(this.weekNumbers.dow)):(er(this.dow),this.weekNumbers&&er(this.weekNumbers.dow))),e&&Array.from(this.dow.children).forEach((t,e)=>{const i=(this.weekStart+e)%7;t.textContent=this.dayNames[i],t.className=this.daysOfWeekDisabled.includes(i)?"dow disabled":"dow"})}updateFocus(){const t=new Date(this.picker.viewDate),e=t.getFullYear(),i=t.getMonth(),n=Dn(e,i,1),r=Mn(n,this.weekStart,this.weekStart);this.first=n,this.last=Dn(e,i+1,0),this.start=r,this.focused=this.picker.viewDate}updateSelection(){const{dates:t,rangepicker:e}=this.picker.datepicker;this.selected=t,e&&(this.range=e.dates)}render(){if(this.today=this.todayHighlight?On():void 0,this.prepareForRender(Qn(this.focused,this.switchLabelFormat,this.locale),this.first<=this.minDate,this.last>=this.maxDate),this.weekNumbers){const t=this.weekStart,e=Mn(this.first,t,t);Array.from(this.weekNumbers.weeks.children).forEach((i,n)=>{const r=xn(e,7*n);i.textContent=this.getWeekNumber(r,t),n>3&&i.classList[r>this.last?"add":"remove"]("next")})}Array.from(this.grid.children).forEach((t,e)=>{const i=xn(this.start,e),n=new Date(i),r=n.getDay(),s=[];this.today===i&&s.push("today"),this.daysOfWeekHighlighted.includes(r)&&s.push("highlighted"),this.renderCell(t,n.getDate(),i,i,this,i<this.minDate||i>this.maxDate||this.daysOfWeekDisabled.includes(r),s)})}refresh(){const t=this.range||[];Array.from(this.grid.children).forEach(e=>{this.refreshCell(e,Number(e.dataset.date),this.selected,t)})}refreshFocus(){this.changeFocusedCell(Math.round((this.focused-this.start)/864e5))}}function xr(t,e){if(!t||!t[0]||!t[1])return;const[[i,n],[r,s]]=t;return i>e||r<e?void 0:[i===e?n:-1,r===e?s:12]}class Tr extends Or{constructor(t){super(t,{id:1,name:"months",cellClass:"month"})}init(t,e=!0){e&&(this.grid=this.element,this.element.classList.add("months","datepicker-grid"),this.grid.appendChild(Jn(kn("span",12,{"data-month":t=>t}))),this.first=0,this.last=11),super.init(t)}setOptions(t){if(t.locale&&(this.monthNames=t.locale.monthsShort),"minDate"in t)if(void 0===t.minDate)this.minYear=this.minMonth=this.minDate=void 0;else{const e=new Date(t.minDate);this.minYear=e.getFullYear(),this.minMonth=e.getMonth(),this.minDate=e.setDate(1)}if("maxDate"in t)if(void 0===t.maxDate)this.maxYear=this.maxMonth=this.maxDate=void 0;else{const e=new Date(t.maxDate);this.maxYear=e.getFullYear(),this.maxMonth=e.getMonth(),this.maxDate=Dn(this.maxYear,this.maxMonth+1,0)}t.checkDisabled&&(this.checkDisabled=this.isMinView||null===t.datesDisabled?t.checkDisabled:()=>!1),"beforeShowMonth"in t&&(this.beforeShow="function"==typeof t.beforeShowMonth?t.beforeShowMonth:void 0)}updateFocus(){const t=new Date(this.picker.viewDate);this.year=t.getFullYear(),this.focused=t.getMonth()}updateSelection(){const{dates:t,rangepicker:e}=this.picker.datepicker;this.selected=t.reduce((t,e)=>{const i=new Date(e),n=i.getFullYear(),r=i.getMonth();return void 0===t[n]?t[n]=[r]:_n(t[n],r),t},{}),e&&e.dates&&(this.range=e.dates.map(t=>{const e=new Date(t);return isNaN(e)?void 0:[e.getFullYear(),e.getMonth()]}))}render(){this.prepareForRender(this.year,this.year<=this.minYear,this.year>=this.maxYear);const t=this.selected[this.year]||[],e=this.year<this.minYear||this.year>this.maxYear,i=this.year===this.minYear,n=this.year===this.maxYear,r=xr(this.range,this.year);Array.from(this.grid.children).forEach((s,o)=>{const a=qn(new Date(this.year,o,1),1,this.isRangeEnd);this.renderCell(s,this.monthNames[o],o,a,{selected:t,range:r},e||i&&o<this.minMonth||n&&o>this.maxMonth)})}refresh(){const t=this.selected[this.year]||[],e=xr(this.range,this.year)||[];Array.from(this.grid.children).forEach((i,n)=>{this.refreshCell(i,n,t,e)})}refreshFocus(){this.changeFocusedCell(this.focused)}}class Lr extends Or{constructor(t,e){super(t,e)}init(t,e=!0){var i;e&&(this.navStep=10*this.step,this.beforeShowOption=`beforeShow${i=this.cellClass,[...i].reduce((t,e,i)=>t+(i?e:e.toUpperCase()),"")}`,this.grid=this.element,this.element.classList.add(this.name,"datepicker-grid"),this.grid.appendChild(Jn(kn("span",12)))),super.init(t)}setOptions(t){if("minDate"in t&&(void 0===t.minDate?this.minYear=this.minDate=void 0:(this.minYear=Hn(t.minDate,this.step),this.minDate=Dn(this.minYear,0,1))),"maxDate"in t&&(void 0===t.maxDate?this.maxYear=this.maxDate=void 0:(this.maxYear=Hn(t.maxDate,this.step),this.maxDate=Dn(this.maxYear,11,31))),t.checkDisabled&&(this.checkDisabled=this.isMinView||null===t.datesDisabled?t.checkDisabled:()=>!1),this.beforeShowOption in t){const e=t[this.beforeShowOption];this.beforeShow="function"==typeof e?e:void 0}}updateFocus(){const t=new Date(this.picker.viewDate),e=Hn(t,this.navStep),i=e+9*this.step;this.first=e,this.last=i,this.start=e-this.step,this.focused=Hn(t,this.step)}updateSelection(){const{dates:t,rangepicker:e}=this.picker.datepicker;this.selected=t.reduce((t,e)=>_n(t,Hn(e,this.step)),[]),e&&e.dates&&(this.range=e.dates.map(t=>{if(void 0!==t)return Hn(t,this.step)}))}render(){this.prepareForRender(`${this.first}-${this.last}`,this.first<=this.minYear,this.last>=this.maxYear),Array.from(this.grid.children).forEach((t,e)=>{const i=this.start+e*this.step,n=qn(new Date(i,0,1),2,this.isRangeEnd);t.dataset.year=i,this.renderCell(t,i,i,n,this,i<this.minYear||i>this.maxYear)})}refresh(){const t=this.range||[];Array.from(this.grid.children).forEach(e=>{this.refreshCell(e,Number(e.textContent),this.selected,t)})}refreshFocus(){this.changeFocusedCell(Math.round((this.focused-this.start)/this.step))}}function Ir(t,e){const i={bubbles:!0,cancelable:!0,detail:{date:t.getDate(),viewDate:new Date(t.picker.viewDate),viewId:t.picker.currentView.id,datepicker:t}};t.element.dispatchEvent(new CustomEvent(e,i))}function Mr(t,e){const{config:i,picker:n}=t,{currentView:r,viewDate:s}=n;let o;switch(r.id){case 0:o=Tn(s,e);break;case 1:o=Ln(s,e);break;default:o=Ln(s,e*r.navStep)}o=An(o,i.minDate,i.maxDate),n.changeFocus(o).render()}function Fr(t){const e=t.picker.currentView.id;e!==t.config.maxView&&t.picker.changeView(e+1).render()}function Nr(t){t.setDate({clear:!0})}function jr(t){const e=On();1===t.config.todayButtonMode?t.setDate(e,{forceRefresh:!0,viewDate:e}):t.setFocusedDate(e,!0)}function Pr(t){const e=()=>{t.config.updateOnBlur?t.update({revert:!0}):t.refresh("input"),t.hide()},i=t.element;tr(i)?i.addEventListener("blur",e,{once:!0}):e()}function $r(t,e){const i=t.picker,n=new Date(i.viewDate),r=i.currentView.id,s=1===r?Tn(n,e-n.getMonth()):Ln(n,e-n.getFullYear());i.changeFocus(s).changeView(r-1).render()}function Hr(t){Fr(t)}function qr(t){Mr(t,-1)}function Rr(t){Mr(t,1)}function Br(t,e){const i=cr(e,".datepicker-cell");if(!i||i.classList.contains("disabled"))return;const{id:n,isMinView:r}=t.picker.currentView,s=i.dataset;r?t.setDate(Number(s.date)):$r(t,Number(1===n?s.month:s.year))}function Vr(t){t.preventDefault()}const zr=["left","top","right","bottom"].reduce((t,e)=>(t[e]=`datepicker-orient-${e}`,t),{}),Wr=t=>t?`${t}px`:t;function Yr(t,e){if("title"in e&&(e.title?(t.controls.title.textContent=e.title,ir(t.controls.title)):(t.controls.title.textContent="",er(t.controls.title))),e.prevArrow){const i=t.controls.prevButton;nr(i),e.prevArrow.forEach(t=>{i.appendChild(t.cloneNode(!0))})}if(e.nextArrow){const i=t.controls.nextButton;nr(i),e.nextArrow.forEach(t=>{i.appendChild(t.cloneNode(!0))})}if(e.locale&&(t.controls.todayButton.textContent=e.locale.today,t.controls.clearButton.textContent=e.locale.clear),"todayButton"in e&&(e.todayButton?ir(t.controls.todayButton):er(t.controls.todayButton)),"minDate"in e||"maxDate"in e){const{minDate:e,maxDate:i}=t.datepicker.config;t.controls.todayButton.disabled=!En(On(),e,i)}"clearButton"in e&&(e.clearButton?ir(t.controls.clearButton):er(t.controls.clearButton))}function Kr(t){const{dates:e,config:i,rangeSideIndex:n}=t;return An(e.length>0?yn(e):qn(i.defaultViewDate,i.pickLevel,n),i.minDate,i.maxDate)}function Ur(t,e){"_oldViewDate"in t||e===t.viewDate||(t._oldViewDate=t.viewDate),t.viewDate=e;const{id:i,year:n,first:r,last:s}=t.currentView,o=new Date(e).getFullYear();switch(i){case 0:return e<r||e>s;case 1:return o!==n;default:return o<r||o>s}}function Xr(t){return window.getComputedStyle(t).direction}function Qr(t){const e=Zn(t);if(e!==document.body&&e)return"visible"!==window.getComputedStyle(e).overflow?e:Qr(e)}class Gr{constructor(t){const{config:e,inputField:i}=this.datepicker=t,n=kr.replace(/%buttonClass%/g,e.buttonClass),r=this.element=Jn(n).firstChild,[s,o,a]=r.firstChild.children,l=s.firstElementChild,[c,d,u]=s.lastElementChild.children,[h,p]=a.firstChild.children,f={title:l,prevButton:c,viewSwitch:d,nextButton:u,todayButton:h,clearButton:p};this.main=o,this.controls=f;const g=i?"dropdown":"inline";r.classList.add(`datepicker-${g}`),Yr(this,e),this.viewDate=Kr(t),ar(t,[[r,"mousedown",Vr],[o,"click",Br.bind(null,t)],[f.viewSwitch,"click",Hr.bind(null,t)],[f.prevButton,"click",qr.bind(null,t)],[f.nextButton,"click",Rr.bind(null,t)],[f.todayButton,"click",jr.bind(null,t)],[f.clearButton,"click",Nr.bind(null,t)]]),this.views=[new Dr(this),new Tr(this),new Lr(this,{id:2,name:"years",cellClass:"year",step:1}),new Lr(this,{id:3,name:"decades",cellClass:"decade",step:10})],this.currentView=this.views[e.startView],this.currentView.render(),this.main.appendChild(this.currentView.element),e.container?e.container.appendChild(this.element):i.after(this.element)}setOptions(t){Yr(this,t),this.views.forEach(e=>{e.init(t,!1)}),this.currentView.render()}detach(){this.element.remove()}show(){if(this.active)return;const{datepicker:t,element:e}=this,i=t.inputField;if(i){const n=Xr(i);n!==Xr(Zn(e))?e.dir=n:e.dir&&e.removeAttribute("dir"),this.place(),e.classList.add("active"),t.config.disableTouchKeyboard&&i.blur()}else e.classList.add("active");this.active=!0,Ir(t,"show")}hide(){this.active&&(this.datepicker.exitEditMode(),this.element.classList.remove("active"),this.active=!1,Ir(this.datepicker,"hide"))}place(){const{classList:t,style:e}=this.element;e.display="block";const{width:i,height:n}=this.element.getBoundingClientRect(),r=this.element.offsetParent;e.display="";const{config:s,inputField:o}=this.datepicker,{left:a,top:l,right:c,bottom:d,width:u,height:h}=o.getBoundingClientRect();let{x:p,y:f}=s.orientation,g=a,m=l;if(r!==document.body&&r){const t=r.getBoundingClientRect();g-=t.left-r.scrollLeft,m-=t.top-r.scrollTop}else g+=window.scrollX,m+=window.scrollY;const v=Qr(o);let b=0,y=0,{clientWidth:_,clientHeight:w}=document.documentElement;if(v){const t=v.getBoundingClientRect();t.top>0&&(y=t.top),t.left>0&&(b=t.left),t.right<_&&(_=t.right),t.bottom<w&&(w=t.bottom)}let E=0;"auto"===p&&(a<b?(p="left",E=b-a):a+i>_?(p="right",_<c&&(E=_-c)):p="rtl"===Xr(o)?c-i<b?"left":"right":"left"),"right"===p&&(g+=u-i),g+=E,"auto"===f&&(f=l-n>y&&d+n>w?"top":"bottom"),"top"===f?m-=n:m+=h,t.remove(...Object.values(zr)),t.add(zr[p],zr[f]),e.left=Wr(g),e.top=Wr(m)}setViewSwitchLabel(t){this.controls.viewSwitch.textContent=t}setPrevButtonDisabled(t){this.controls.prevButton.disabled=t}setNextButtonDisabled(t){this.controls.nextButton.disabled=t}changeView(t){const e=this.currentView;return t!==e.id&&(this._oldView||(this._oldView=e),this.currentView=this.views[t],this._renderMethod="render"),this}changeFocus(t){return this._renderMethod=Ur(this,t)?"render":"refreshFocus",this.views.forEach(t=>{t.updateFocus()}),this}update(t=void 0){const e=void 0===t?Kr(this.datepicker):t;return this._renderMethod=Ur(this,e)?"render":"refresh",this.views.forEach(t=>{t.updateFocus(),t.updateSelection()}),this}render(t=!0){const{currentView:e,datepicker:i,_oldView:n}=this,r=new Date(this._oldViewDate),s=t&&this._renderMethod||"render";if(delete this._oldView,delete this._oldViewDate,delete this._renderMethod,e[s](),n&&(this.main.replaceChild(e.element,n.element),Ir(i,"changeView")),!isNaN(r)){const t=new Date(this.viewDate);t.getFullYear()!==r.getFullYear()&&Ir(i,"changeYear"),t.getMonth()!==r.getMonth()&&Ir(i,"changeMonth")}}}function Jr(t,e,i,n,r,s){if(En(t,r,s)){if(n(t)){return Jr(e(t,i),e,i,n,r,s)}return t}}function Zr(t,e,i){const n=t.picker,r=n.currentView,s=r.step||1;let o,a=n.viewDate;switch(r.id){case 0:a=xn(a,i?7*e:e),o=xn;break;case 1:a=Tn(a,i?4*e:e),o=Tn;break;default:a=Ln(a,e*(i?4:1)*s),o=Ln}a=Jr(a,o,e<0?-s:s,t=>r.disabled.includes(t),r.minDate,r.maxDate),void 0!==a&&n.changeFocus(a).render()}function ts(t,e){const{config:i,picker:n,editMode:r}=t,s=n.active,{key:o,altKey:a,shiftKey:l}=e,c=e.ctrlKey||e.metaKey,d=()=>{e.preventDefault(),e.stopPropagation()};if("Tab"===o)return void Pr(t);if("Enter"===o){if(s)if(r)t.exitEditMode({update:!0,autohide:i.autohide});else{const e=n.currentView;e.isMinView?t.setDate(n.viewDate):(n.changeView(e.id-1).render(),d())}else t.update();return}const u=i.shortcutKeys,h={key:o,ctrlOrMetaKey:c,altKey:a,shiftKey:l},p=Object.keys(u).find(t=>{const e=u[t];return!Object.keys(e).find(t=>e[t]!==h[t])});if(p){let e;if("toggle"===p?e=p:r?"exitEditMode"===p&&(e=p):s?"hide"===p?e=p:"prevButton"===p?e=[Mr,[t,-1]]:"nextButton"===p?e=[Mr,[t,1]]:"viewSwitch"===p?e=[Fr,[t]]:i.clearButton&&"clearButton"===p?e=[Nr,[t]]:i.todayButton&&"todayButton"===p&&(e=[jr,[t]]):"show"===p&&(e=p),e)return Array.isArray(e)?e[0].apply(null,e[1]):t[e](),void d()}if(!s||r)return;const f=(i,n)=>{l||c||a?t.enterEditMode():(Zr(t,i,n),e.preventDefault())};"ArrowLeft"===o?f(-1,!1):"ArrowRight"===o?f(1,!1):"ArrowUp"===o?f(-1,!0):"ArrowDown"===o?f(1,!0):("Backspace"===o||"Delete"===o||o&&1===o.length&&!c)&&t.enterEditMode()}function es(t){t.config.showOnFocus&&!t._showing&&t.show()}function is(t,e){const i=e.target;(t.picker.active||t.config.showOnClick)&&(i._active=tr(i),i._clicking=setTimeout(()=>{delete i._active,delete i._clicking},2e3))}function ns(t,e){const i=e.target;i._clicking&&(clearTimeout(i._clicking),delete i._clicking,i._active&&t.enterEditMode(),delete i._active,t.config.showOnClick&&t.show())}function rs(t,e){e.clipboardData.types.includes("text/plain")&&t.enterEditMode()}function ss(t,e){const{element:i,picker:n}=t;if(!n.active&&!tr(i))return;const r=n.element;cr(e,t=>t===i||t===r)||Pr(t)}function os(t,e){return t.map(t=>Qn(t,e.format,e.locale)).join(e.dateDelimiter)}function as(t,e,i=!1){if(0===e.length)return i?[]:void 0;const{config:n,dates:r,rangeSideIndex:s}=t,{pickLevel:o,maxNumberOfDates:a}=n;let l=e.reduce((t,e)=>{let i=Xn(e,n.format,n.locale);return void 0===i||(i=qn(i,o,s),!En(i,n.minDate,n.maxDate)||t.includes(i)||n.checkDisabled(i,o)||!(o>0)&&n.daysOfWeekDisabled.includes(new Date(i).getDay())||t.push(i)),t},[]);return 0!==l.length?(n.multidate&&!i&&(l=l.reduce((t,e)=>(r.includes(e)||t.push(e),t),r.filter(t=>!l.includes(t)))),a&&l.length>a?l.slice(-1*a):l):void 0}function ls(t,e=3,i=!0,n=void 0){const{config:r,picker:s,inputField:o}=t;if(2&e){const t=s.active?r.pickLevel:r.startView;s.update(n).changeView(t).render(i)}1&e&&o&&(o.value=os(t.dates,r))}function cs(t,e,i){const n=t.config;let{clear:r,render:s,autohide:o,revert:a,forceRefresh:l,viewDate:c}=i;void 0===s&&(s=!0),s?void 0===o&&(o=n.autohide):o=l=!1,c=Xn(c,n.format,n.locale);const d=as(t,e,r);(d||a)&&(d&&d.toString()!==t.dates.toString()?(t.dates=d,ls(t,s?3:1,!0,c),Ir(t,"changeDate")):ls(t,l?3:1,!0,c),o&&t.hide())}function ds(t,e){return e?i=>Qn(i,e,t.config.locale):t=>new Date(t)}class us{constructor(t,e={},i=void 0){t.datepicker=this,this.element=t,this.dates=[];const n=this.config=Object.assign({buttonClass:e.buttonClass&&String(e.buttonClass)||"button",container:null,defaultViewDate:On(),maxDate:void 0,minDate:void 0},wr(ur,this));let r;if("INPUT"===t.tagName?(r=this.inputField=t,r.classList.add("datepicker-input"),e.container&&(n.container=e.container instanceof HTMLElement?e.container:document.querySelector(e.container))):n.container=t,i){const t=i.inputs.indexOf(r),e=i.datepickers;if(t<0||t>1||!Array.isArray(e))throw Error("Invalid rangepicker object.");e[t]=this,this.rangepicker=i,this.rangeSideIndex=t}this._options=e,Object.assign(n,wr(e,this)),n.shortcutKeys=function(t){return Object.keys(Er).reduce((e,i)=>{const n=void 0===t[i]?Er[i]:t[i],r=n&&n.key;if(!r||"string"!=typeof r)return e;const s={key:r,ctrlOrMetaKey:!!(n.ctrlOrMetaKey||n.ctrlKey||n.metaKey)};return r.length>1&&(s.altKey=!!n.altKey,s.shiftKey=!!n.shiftKey),e[i]=s,e},{})}(e.shortcutKeys||{});const s=wn(t.value||t.dataset.date,n.dateDelimiter);delete t.dataset.date;const o=as(this,s);o&&o.length>0&&(this.dates=o),r&&(r.value=os(this.dates,n));const a=this.picker=new Gr(this),l=[t,"keydown",ts.bind(null,this)];r?ar(this,[l,[r,"focus",es.bind(null,this)],[r,"mousedown",is.bind(null,this)],[r,"click",ns.bind(null,this)],[r,"paste",rs.bind(null,this)],[document,"mousedown",ss.bind(null,this)],[window,"resize",a.place.bind(a)]]):(ar(this,[l]),this.show())}static formatDate(t,e,i){return Qn(t,e,i&&dr[i]||dr.en)}static parseDate(t,e,i){return Xn(t,e,i&&dr[i]||dr.en)}static get locales(){return dr}get active(){return!(!this.picker||!this.picker.active)}get pickerElement(){return this.picker?this.picker.element:void 0}setOptions(t){const e=wr(t,this);Object.assign(this._options,t),Object.assign(this.config,e),this.picker.setOptions(e),ls(this,3)}show(){if(this.inputField){const{config:t,inputField:e}=this;if(e.disabled||e.readOnly&&!t.enableOnReadonly)return;tr(e)||t.disableTouchKeyboard||(this._showing=!0,e.focus(),delete this._showing)}this.picker.show()}hide(){this.inputField&&(this.picker.hide(),this.picker.update().changeView(this.config.startView).render())}toggle(){this.picker.active?this.inputField&&this.picker.hide():this.show()}destroy(){this.hide(),function(t){let e=rr.get(t);e&&(e.forEach(t=>{or.call(...t)}),rr.delete(t))}(this),this.picker.detach();const t=this.element;return t.classList.remove("datepicker-input"),delete t.datepicker,this}getDate(t=void 0){const e=ds(this,t);return this.config.multidate?this.dates.map(e):this.dates.length>0?e(this.dates[0]):void 0}setDate(...t){const e=[...t],i={},n=yn(t);!n||"object"!=typeof n||Array.isArray(n)||n instanceof Date||Object.assign(i,e.pop());cs(this,Array.isArray(e[0])?e[0]:e,i)}update(t=void 0){if(!this.inputField)return;const e=Object.assign(t||{},{clear:!0,render:!0,viewDate:void 0});cs(this,wn(this.inputField.value,this.config.dateDelimiter),e)}getFocusedDate(t=void 0){return ds(this,t)(this.picker.viewDate)}setFocusedDate(t,e=!1){const{config:i,picker:n,active:r,rangeSideIndex:s}=this,o=i.pickLevel,a=Xn(t,i.format,i.locale);void 0!==a&&(n.changeFocus(qn(a,o,s)),r&&e&&n.changeView(o),n.render())}refresh(t=void 0,e=!1){let i;t&&"string"!=typeof t&&(e=t,t=void 0),i="picker"===t?2:"input"===t?1:3,ls(this,i,!e)}enterEditMode(){const t=this.inputField;t&&!t.readOnly&&this.picker.active&&!this.editMode&&(this.editMode=!0,t.classList.add("in-edit"))}exitEditMode(t=void 0){if(!this.inputField||!this.editMode)return;const e=Object.assign({update:!1},t);delete this.editMode,this.inputField.classList.remove("in-edit"),e.update&&this.update(e)}}class hs{constructor(t={}){this.opts=t}initDatepickers(t){t.forEach(t=>{const e="function"==typeof this.opts?this.opts(t):this.opts;new us(t,{...e,updateOnBlur:!1}),t.addEventListener("changeDate",()=>{const e=t.closest("form");e&&e.submit()})})}}class ps extends EventTarget{constructor(t,e,i){super(),this.el=t,this.options={...ps.defaultOptions,...i};const n=this.resolveDatagridName();if(!n)throw new Error("Cannot resolve name of a datagrid!");this.name=n,this.ajax="function"==typeof e?e(this):e,this.ajax.addEventListener("success",t=>{var e,i;(null===(e=t.detail.payload)||void 0===e?void 0:e._datagrid_name)===this.name&&(null===(i=t.detail.payload)||void 0===i?void 0:i._datagrid_init)&&this.init()}),this.init()}init(){!this.dispatch("beforeInit",{datagrid:this})||this.options.plugins.forEach(t=>{var e;null===(e=t.onDatagridInit)||void 0===e||e.call(t,this)});const t=this.el.querySelectorAll("input[data-check]:checked");if(1===t.length&&"toggle-all"===t[0].getAttribute("name")){const e=t[0];e&&(e.checked=!1)}this.el.querySelectorAll("input[data-datagrid-manualsubmit]").forEach(t=>{const e=t.closest("form");e&&t.addEventListener("keydown",t=>{if(_(t))return t.stopPropagation(),t.preventDefault(),this.ajax.submitForm(e)})}),this.ajax.addEventListener("success",({detail:{payload:t}})=>{var e;if(t._datagrid_name&&t._datagrid_name===this.name){const i=t=>t.getAttribute("data-datagrid-reset-filter-by-column"),n=Array.from(this.el.querySelectorAll("[data-datagrid-reset-filter-by-column]")),r=t.non_empty_filters?t.non_empty_filters:[];if(n.forEach(t=>{const e=i(t);e&&r.includes(e)?t.classList.remove("hidden"):t.classList.add("hidden")}),r.length>0){const t=null===(e=this.el.querySelector(".reset-filter"))||void 0===e?void 0:e.getAttribute("href");t&&n.forEach(e=>{const n=i(e),r=t.replace("-resetFilter","-resetColumnFilter");e.setAttribute("href",`${r}&${this.name}-key=${n}`)})}}}),this.dispatch("afterInit",{datagrid:this})}confirm(t){return this.options.confirm.bind(this)(t)}resolveDatagridName(){return this.options.resolveDatagridName.bind(this)(this.el)}dispatch(t,e,i){return this.dispatchEvent(new CustomEvent(t,{detail:e}))}}ps.defaultOptions={confirm:confirm,resolveDatagridName:function(t){const e=t.getAttribute("data-datagrid-name");if(e)return e;console.warn("Deprecated name resolution for datagrid",t,": Please add a data-datagrid-name attribute instead!\nCurrently, the Datagrid library relies on matching the name from the 'datagrid-[name]' class, which is unreliable and may cause bugs if the default class names are not used (eg. if you add a datagrid-xx class, or change the name class completely!)\nAlternatively, you can customize the name resolution with the `resolveDatagridName` option. See TBD for more info.");const i=t.classList.value.split(" ");for(const t of i){if(!t.startsWith("datagrid-"))continue;const[,...e]=t.split("-"),i=e.join("-");return i.length<1?(console.error(`Failed to resolve datagrid name - ambigious class name '${t}'`),null):i}return null},plugins:[]};class fs{constructor(t,e={}){this.ajax=t,this.datagrids=[],this.options={selector:"div[data-datagrid-name]",datagrid:{},root:document.body,...e};const i="string"==typeof this.options.root?document.querySelector(this.options.root):this.options.root;if(!(i&&i instanceof HTMLElement))throw new Error("Root element not found or is not an HTMLElement");this.root=i,this.init()}init(){var t,e;this.ajax.onInit(),(null!==(e=null===(t=this.options.datagrid)||void 0===t?void 0:t.plugins)&&void 0!==e?e:[]).forEach(t=>{var e;return null===(e=t.onInit)||void 0===e?void 0:e.call(t,this)}),this.initDatagrids()}initDatagrids(){this.datagrids=Array.from(this.root.querySelectorAll(this.options.selector)).map(t=>new ps(t,this.ajax,this.options.datagrid))}}class gs extends EventTarget{constructor(t){if(!t.VERSION||t.VERSION<2)throw new Error("NajaAjax supports Naja 2 and higher"+(t.VERSION?`(version ${t.VERSION} provided)`:""));super(),this.client=t}onInit(){return this.client.addEventListener("before",t=>this.dispatch("before",{params:t.detail})),this.client.uiHandler.addEventListener("interaction",t=>{if(!(t.detail.element instanceof HTMLElement))throw new Error("Element is not an instanceof HTMLElement");const e=this.dispatch("interact",{...t.detail,element:t.detail.element});return e||(t.stopPropagation(),t.preventDefault()),e}),this.client.addEventListener("success",t=>this.dispatch("success",{...t.detail,params:t.detail.request,payload:t.detail.payload})),this.client.addEventListener("error",t=>this.dispatch("error",{...t.detail,params:t.detail.request,response:t.detail.response})),this.client.addEventListener("complete",t=>this.dispatch("complete",{...t.detail,params:t.detail.request,response:t.detail.response})),this}async request(t){return await this.client.makeRequest(t.method,t.url,t.data)}async submitForm(t){return await this.client.uiHandler.submitForm(t)}dispatch(t,e,i){return this.dispatchEvent(new CustomEvent(t,{detail:e,cancelable:!0}))}}var ms="top",vs="bottom",bs="right",ys="left",_s="auto",ws=[ms,vs,bs,ys],Es="start",As="end",ks="clippingParents",Ss="viewport",Cs="popper",Os="reference",Ds=ws.reduce(function(t,e){return t.concat([e+"-"+Es,e+"-"+As])},[]),xs=[].concat(ws,[_s]).reduce(function(t,e){return t.concat([e,e+"-"+Es,e+"-"+As])},[]),Ts="beforeRead",Ls="read",Is="afterRead",Ms="beforeMain",Fs="main",Ns="afterMain",js="beforeWrite",Ps="write",$s="afterWrite",Hs=[Ts,Ls,Is,Ms,Fs,Ns,js,Ps,$s];function qs(t){return t?(t.nodeName||"").toLowerCase():null}function Rs(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Bs(t){return t instanceof Rs(t).Element||t instanceof Element}function Vs(t){return t instanceof Rs(t).HTMLElement||t instanceof HTMLElement}function zs(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Rs(t).ShadowRoot||t instanceof ShadowRoot)}var Ws={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},r=e.elements[t];Vs(r)&&qs(r)&&(Object.assign(r.style,i),Object.keys(n).forEach(function(t){var e=n[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)}))})},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach(function(t){var n=e.elements[t],r=e.attributes[t]||{},s=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce(function(t,e){return t[e]="",t},{});Vs(n)&&qs(n)&&(Object.assign(n.style,s),Object.keys(r).forEach(function(t){n.removeAttribute(t)}))})}},requires:["computeStyles"]};function Ys(t){return t.split("-")[0]}var Ks=Math.max,Us=Math.min,Xs=Math.round;function Qs(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Gs(){return!/^((?!chrome|android).)*safari/i.test(Qs())}function Js(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),r=1,s=1;e&&Vs(t)&&(r=t.offsetWidth>0&&Xs(n.width)/t.offsetWidth||1,s=t.offsetHeight>0&&Xs(n.height)/t.offsetHeight||1);var o=(Bs(t)?Rs(t):window).visualViewport,a=!Gs()&&i,l=(n.left+(a&&o?o.offsetLeft:0))/r,c=(n.top+(a&&o?o.offsetTop:0))/s,d=n.width/r,u=n.height/s;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l,x:l,y:c}}function Zs(t){var e=Js(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function to(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&zs(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function eo(t){return Rs(t).getComputedStyle(t)}function io(t){return["table","td","th"].indexOf(qs(t))>=0}function no(t){return((Bs(t)?t.ownerDocument:t.document)||window.document).documentElement}function ro(t){return"html"===qs(t)?t:t.assignedSlot||t.parentNode||(zs(t)?t.host:null)||no(t)}function so(t){return Vs(t)&&"fixed"!==eo(t).position?t.offsetParent:null}function oo(t){for(var e=Rs(t),i=so(t);i&&io(i)&&"static"===eo(i).position;)i=so(i);return i&&("html"===qs(i)||"body"===qs(i)&&"static"===eo(i).position)?e:i||function(t){var e=/firefox/i.test(Qs());if(/Trident/i.test(Qs())&&Vs(t)&&"fixed"===eo(t).position)return null;var i=ro(t);for(zs(i)&&(i=i.host);Vs(i)&&["html","body"].indexOf(qs(i))<0;){var n=eo(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function ao(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function lo(t,e,i){return Ks(t,Us(e,i))}function co(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function uo(t,e){return e.reduce(function(e,i){return e[i]=t,e},{})}var ho={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,r=t.options,s=i.elements.arrow,o=i.modifiersData.popperOffsets,a=Ys(i.placement),l=ao(a),c=[ys,bs].indexOf(a)>=0?"height":"width";if(s&&o){var d=function(t,e){return co("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:uo(t,ws))}(r.padding,i),u=Zs(s),h="y"===l?ms:ys,p="y"===l?vs:bs,f=i.rects.reference[c]+i.rects.reference[l]-o[l]-i.rects.popper[c],g=o[l]-i.rects.reference[l],m=oo(s),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=f/2-g/2,y=d[h],_=v-u[c]-d[p],w=v/2-u[c]/2+b,E=lo(y,w,_),A=l;i.modifiersData[n]=((e={})[A]=E,e.centerOffset=E-w,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&to(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function po(t){return t.split("-")[1]}var fo={top:"auto",right:"auto",bottom:"auto",left:"auto"};function go(t){var e,i=t.popper,n=t.popperRect,r=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,d=t.roundOffsets,u=t.isFixed,h=o.x,p=void 0===h?0:h,f=o.y,g=void 0===f?0:f,m="function"==typeof d?d({x:p,y:g}):{x:p,y:g};p=m.x,g=m.y;var v=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),y=ys,_=ms,w=window;if(c){var E=oo(i),A="clientHeight",k="clientWidth";if(E===Rs(i)&&"static"!==eo(E=no(i)).position&&"absolute"===a&&(A="scrollHeight",k="scrollWidth"),r===ms||(r===ys||r===bs)&&s===As)_=vs,g-=(u&&E===w&&w.visualViewport?w.visualViewport.height:E[A])-n.height,g*=l?1:-1;if(r===ys||(r===ms||r===vs)&&s===As)y=bs,p-=(u&&E===w&&w.visualViewport?w.visualViewport.width:E[k])-n.width,p*=l?1:-1}var S,C=Object.assign({position:a},c&&fo),O=!0===d?function(t,e){var i=t.x,n=t.y,r=e.devicePixelRatio||1;return{x:Xs(i*r)/r||0,y:Xs(n*r)/r||0}}({x:p,y:g},Rs(i)):{x:p,y:g};return p=O.x,g=O.y,l?Object.assign({},C,((S={})[_]=b?"0":"",S[y]=v?"0":"",S.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",S)):Object.assign({},C,((e={})[_]=b?g+"px":"",e[y]=v?p+"px":"",e.transform="",e))}var mo={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,r=void 0===n||n,s=i.adaptive,o=void 0===s||s,a=i.roundOffsets,l=void 0===a||a,c={placement:Ys(e.placement),variation:po(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,go(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,go(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},vo={passive:!0};var bo={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,r=n.scroll,s=void 0===r||r,o=n.resize,a=void 0===o||o,l=Rs(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(t){t.addEventListener("scroll",i.update,vo)}),a&&l.addEventListener("resize",i.update,vo),function(){s&&c.forEach(function(t){t.removeEventListener("scroll",i.update,vo)}),a&&l.removeEventListener("resize",i.update,vo)}},data:{}},yo={left:"right",right:"left",bottom:"top",top:"bottom"};function _o(t){return t.replace(/left|right|bottom|top/g,function(t){return yo[t]})}var wo={start:"end",end:"start"};function Eo(t){return t.replace(/start|end/g,function(t){return wo[t]})}function Ao(t){var e=Rs(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ko(t){return Js(no(t)).left+Ao(t).scrollLeft}function So(t){var e=eo(t),i=e.overflow,n=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+r+n)}function Co(t){return["html","body","#document"].indexOf(qs(t))>=0?t.ownerDocument.body:Vs(t)&&So(t)?t:Co(ro(t))}function Oo(t,e){var i;void 0===e&&(e=[]);var n=Co(t),r=n===(null==(i=t.ownerDocument)?void 0:i.body),s=Rs(n),o=r?[s].concat(s.visualViewport||[],So(n)?n:[]):n,a=e.concat(o);return r?a:a.concat(Oo(ro(o)))}function Do(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function xo(t,e,i){return e===Ss?Do(function(t,e){var i=Rs(t),n=no(t),r=i.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;var c=Gs();(c||!c&&"fixed"===e)&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a+ko(t),y:l}}(t,i)):Bs(e)?function(t,e){var i=Js(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):Do(function(t){var e,i=no(t),n=Ao(t),r=null==(e=t.ownerDocument)?void 0:e.body,s=Ks(i.scrollWidth,i.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=Ks(i.scrollHeight,i.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-n.scrollLeft+ko(t),l=-n.scrollTop;return"rtl"===eo(r||i).direction&&(a+=Ks(i.clientWidth,r?r.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}(no(t)))}function To(t,e,i,n){var r="clippingParents"===e?function(t){var e=Oo(ro(t)),i=["absolute","fixed"].indexOf(eo(t).position)>=0&&Vs(t)?oo(t):t;return Bs(i)?e.filter(function(t){return Bs(t)&&to(t,i)&&"body"!==qs(t)}):[]}(t):[].concat(e),s=[].concat(r,[i]),o=s[0],a=s.reduce(function(e,i){var r=xo(t,i,n);return e.top=Ks(r.top,e.top),e.right=Us(r.right,e.right),e.bottom=Us(r.bottom,e.bottom),e.left=Ks(r.left,e.left),e},xo(t,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Lo(t){var e,i=t.reference,n=t.element,r=t.placement,s=r?Ys(r):null,o=r?po(r):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(s){case ms:e={x:a,y:i.y-n.height};break;case vs:e={x:a,y:i.y+i.height};break;case bs:e={x:i.x+i.width,y:l};break;case ys:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=s?ao(s):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case Es:e[c]=e[c]-(i[d]/2-n[d]/2);break;case As:e[c]=e[c]+(i[d]/2-n[d]/2)}}return e}function Io(t,e){void 0===e&&(e={});var i=e,n=i.placement,r=void 0===n?t.placement:n,s=i.strategy,o=void 0===s?t.strategy:s,a=i.boundary,l=void 0===a?ks:a,c=i.rootBoundary,d=void 0===c?Ss:c,u=i.elementContext,h=void 0===u?Cs:u,p=i.altBoundary,f=void 0!==p&&p,g=i.padding,m=void 0===g?0:g,v=co("number"!=typeof m?m:uo(m,ws)),b=h===Cs?Os:Cs,y=t.rects.popper,_=t.elements[f?b:h],w=To(Bs(_)?_:_.contextElement||no(t.elements.popper),l,d,o),E=Js(t.elements.reference),A=Lo({reference:E,element:y,placement:r}),k=Do(Object.assign({},y,A)),S=h===Cs?k:E,C={top:w.top-S.top+v.top,bottom:S.bottom-w.bottom+v.bottom,left:w.left-S.left+v.left,right:S.right-w.right+v.right},O=t.modifiersData.offset;if(h===Cs&&O){var D=O[r];Object.keys(C).forEach(function(t){var e=[bs,vs].indexOf(t)>=0?1:-1,i=[ms,vs].indexOf(t)>=0?"y":"x";C[t]+=D[i]*e})}return C}function Mo(t,e){void 0===e&&(e={});var i=e,n=i.placement,r=i.boundary,s=i.rootBoundary,o=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?xs:l,d=po(n),u=d?a?Ds:Ds.filter(function(t){return po(t)===d}):ws,h=u.filter(function(t){return c.indexOf(t)>=0});0===h.length&&(h=u);var p=h.reduce(function(e,i){return e[i]=Io(t,{placement:i,boundary:r,rootBoundary:s,padding:o})[Ys(i)],e},{});return Object.keys(p).sort(function(t,e){return p[t]-p[e]})}var Fo={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var r=i.mainAxis,s=void 0===r||r,o=i.altAxis,a=void 0===o||o,l=i.fallbackPlacements,c=i.padding,d=i.boundary,u=i.rootBoundary,h=i.altBoundary,p=i.flipVariations,f=void 0===p||p,g=i.allowedAutoPlacements,m=e.options.placement,v=Ys(m),b=l||(v===m||!f?[_o(m)]:function(t){if(Ys(t)===_s)return[];var e=_o(t);return[Eo(t),e,Eo(e)]}(m)),y=[m].concat(b).reduce(function(t,i){return t.concat(Ys(i)===_s?Mo(e,{placement:i,boundary:d,rootBoundary:u,padding:c,flipVariations:f,allowedAutoPlacements:g}):i)},[]),_=e.rects.reference,w=e.rects.popper,E=new Map,A=!0,k=y[0],S=0;S<y.length;S++){var C=y[S],O=Ys(C),D=po(C)===Es,x=[ms,vs].indexOf(O)>=0,T=x?"width":"height",L=Io(e,{placement:C,boundary:d,rootBoundary:u,altBoundary:h,padding:c}),I=x?D?bs:ys:D?vs:ms;_[T]>w[T]&&(I=_o(I));var M=_o(I),F=[];if(s&&F.push(L[O]<=0),a&&F.push(L[I]<=0,L[M]<=0),F.every(function(t){return t})){k=C,A=!1;break}E.set(C,F)}if(A)for(var N=function(t){var e=y.find(function(e){var i=E.get(e);if(i)return i.slice(0,t).every(function(t){return t})});if(e)return k=e,"break"},j=f?3:1;j>0;j--){if("break"===N(j))break}e.placement!==k&&(e.modifiersData[n]._skip=!0,e.placement=k,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function No(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function jo(t){return[ms,bs,vs,ys].some(function(e){return t[e]>=0})}var Po={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,r=e.rects.popper,s=e.modifiersData.preventOverflow,o=Io(e,{elementContext:"reference"}),a=Io(e,{altBoundary:!0}),l=No(o,n),c=No(a,r,s),d=jo(l),u=jo(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}};var $o={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.options,n=t.name,r=i.offset,s=void 0===r?[0,0]:r,o=xs.reduce(function(t,i){return t[i]=function(t,e,i){var n=Ys(t),r=[ys,ms].indexOf(n)>=0?-1:1,s="function"==typeof i?i(Object.assign({},e,{placement:t})):i,o=s[0],a=s[1];return o=o||0,a=(a||0)*r,[ys,bs].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}(i,e.rects,s),t},{}),a=o[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=o}};var Ho={name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,i=t.name;e.modifiersData[i]=Lo({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})},data:{}};var qo={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,r=i.mainAxis,s=void 0===r||r,o=i.altAxis,a=void 0!==o&&o,l=i.boundary,c=i.rootBoundary,d=i.altBoundary,u=i.padding,h=i.tether,p=void 0===h||h,f=i.tetherOffset,g=void 0===f?0:f,m=Io(e,{boundary:l,rootBoundary:c,padding:u,altBoundary:d}),v=Ys(e.placement),b=po(e.placement),y=!b,_=ao(v),w="x"===_?"y":"x",E=e.modifiersData.popperOffsets,A=e.rects.reference,k=e.rects.popper,S="function"==typeof g?g(Object.assign({},e.rects,{placement:e.placement})):g,C="number"==typeof S?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,D={x:0,y:0};if(E){if(s){var x,T="y"===_?ms:ys,L="y"===_?vs:bs,I="y"===_?"height":"width",M=E[_],F=M+m[T],N=M-m[L],j=p?-k[I]/2:0,P=b===Es?A[I]:k[I],$=b===Es?-k[I]:-A[I],H=e.elements.arrow,q=p&&H?Zs(H):{width:0,height:0},R=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},B=R[T],V=R[L],z=lo(0,A[I],q[I]),W=y?A[I]/2-j-z-B-C.mainAxis:P-z-B-C.mainAxis,Y=y?-A[I]/2+j+z+V+C.mainAxis:$+z+V+C.mainAxis,K=e.elements.arrow&&oo(e.elements.arrow),U=K?"y"===_?K.clientTop||0:K.clientLeft||0:0,X=null!=(x=null==O?void 0:O[_])?x:0,Q=M+Y-X,G=lo(p?Us(F,M+W-X-U):F,M,p?Ks(N,Q):N);E[_]=G,D[_]=G-M}if(a){var J,Z="x"===_?ms:ys,tt="x"===_?vs:bs,et=E[w],it="y"===w?"height":"width",nt=et+m[Z],rt=et-m[tt],st=-1!==[ms,ys].indexOf(v),ot=null!=(J=null==O?void 0:O[w])?J:0,at=st?nt:et-A[it]-k[it]-ot+C.altAxis,lt=st?et+A[it]+k[it]-ot-C.altAxis:rt,ct=p&&st?function(t,e,i){var n=lo(t,e,i);return n>i?i:n}(at,et,lt):lo(p?at:nt,et,p?lt:rt);E[w]=ct,D[w]=ct-et}e.modifiersData[n]=D}},requiresIfExists:["offset"]};function Ro(t,e,i){void 0===i&&(i=!1);var n,r,s=Vs(e),o=Vs(e)&&function(t){var e=t.getBoundingClientRect(),i=Xs(e.width)/t.offsetWidth||1,n=Xs(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=no(e),l=Js(t,o,i),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(s||!s&&!i)&&(("body"!==qs(e)||So(a))&&(c=(n=e)!==Rs(n)&&Vs(n)?{scrollLeft:(r=n).scrollLeft,scrollTop:r.scrollTop}:Ao(n)),Vs(e)?((d=Js(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):a&&(d.x=ko(a))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Bo(t){var e=new Map,i=new Set,n=[];function r(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){if(!i.has(t)){var n=e.get(t);n&&r(n)}}),n.push(t)}return t.forEach(function(t){e.set(t.name,t)}),t.forEach(function(t){i.has(t.name)||r(t)}),n}var Vo={placement:"bottom",modifiers:[],strategy:"absolute"};function zo(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}function Wo(t){void 0===t&&(t={});var e=t,i=e.defaultModifiers,n=void 0===i?[]:i,r=e.defaultOptions,s=void 0===r?Vo:r;return function(t,e,i){void 0===i&&(i=s);var r,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Vo,s),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,d={state:a,setOptions:function(i){var r="function"==typeof i?i(a.options):i;u(),a.options=Object.assign({},s,a.options,r),a.scrollParents={reference:Bs(t)?Oo(t):t.contextElement?Oo(t.contextElement):[],popper:Oo(e)};var o,c,h=function(t){var e=Bo(t);return Hs.reduce(function(t,i){return t.concat(e.filter(function(t){return t.phase===i}))},[])}((o=[].concat(n,a.options.modifiers),c=o.reduce(function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t},{}),Object.keys(c).map(function(t){return c[t]})));return a.orderedModifiers=h.filter(function(t){return t.enabled}),a.orderedModifiers.forEach(function(t){var e=t.name,i=t.options,n=void 0===i?{}:i,r=t.effect;if("function"==typeof r){var s=r({state:a,name:e,instance:d,options:n}),o=function(){};l.push(s||o)}}),d.update()},forceUpdate:function(){if(!c){var t=a.elements,e=t.reference,i=t.popper;if(zo(e,i)){a.rects={reference:Ro(e,oo(i),"fixed"===a.options.strategy),popper:Zs(i)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(t){return a.modifiersData[t.name]=Object.assign({},t.data)});for(var n=0;n<a.orderedModifiers.length;n++)if(!0!==a.reset){var r=a.orderedModifiers[n],s=r.fn,o=r.options,l=void 0===o?{}:o,u=r.name;"function"==typeof s&&(a=s({state:a,options:l,name:u,instance:d})||a)}else a.reset=!1,n=-1}}},update:(r=function(){return new Promise(function(t){d.forceUpdate(),t(a)})},function(){return o||(o=new Promise(function(t){Promise.resolve().then(function(){o=void 0,t(r())})})),o}),destroy:function(){u(),c=!0}};if(!zo(t,e))return d;function u(){l.forEach(function(t){return t()}),l=[]}return d.setOptions(i).then(function(t){!c&&i.onFirstUpdate&&i.onFirstUpdate(t)}),d}}var Yo=Wo(),Ko=Wo({defaultModifiers:[bo,Ho,mo,Ws]}),Uo=Wo({defaultModifiers:[bo,Ho,mo,Ws,$o,Fo,qo,ho,Po]}),Xo=Object.freeze({__proto__:null,afterMain:Ns,afterRead:Is,afterWrite:$s,applyStyles:Ws,arrow:ho,auto:_s,basePlacements:ws,beforeMain:Ms,beforeRead:Ts,beforeWrite:js,bottom:vs,clippingParents:ks,computeStyles:mo,createPopper:Uo,createPopperBase:Yo,createPopperLite:Ko,detectOverflow:Io,end:As,eventListeners:bo,flip:Fo,hide:Po,left:ys,main:Fs,modifierPhases:Hs,offset:$o,placements:xs,popper:Cs,popperGenerator:Wo,popperOffsets:Ho,preventOverflow:qo,read:Ls,reference:Os,right:bs,start:Es,top:ms,variationPlacements:Ds,viewport:Ss,write:Ps});
13
+ */function ut(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function ht(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(i),!0).forEach(function(t){ft(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ut(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function pt(e){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pt(e)}function ft(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function gt(){return gt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},gt.apply(this,arguments)}function mt(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function vt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var bt=vt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yt=vt(/Edge/i),_t=vt(/firefox/i),wt=vt(/safari/i)&&!vt(/chrome/i)&&!vt(/android/i),Et=vt(/iP(ad|od|hone)/i),At=vt(/chrome/i)&&vt(/android/i),St={capture:!1,passive:!1};function kt(e,t,i){e.addEventListener(t,i,!bt&&St)}function Ot(e,t,i){e.removeEventListener(t,i,!bt&&St)}function Ct(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function Dt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function xt(e,t,i,n){if(e){i=i||document;do{if(null!=t&&(">"===t[0]?e.parentNode===i&&Ct(e,t):Ct(e,t))||n&&e===i)return e;if(e===i)break}while(e=Dt(e))}return null}var Tt,Lt=/\s+/g;function It(e,t,i){if(e&&t)if(e.classList)e.classList[i?"add":"remove"](t);else{var n=(" "+e.className+" ").replace(Lt," ").replace(" "+t+" "," ");e.className=(n+(i?" "+t:"")).replace(Lt," ")}}function Ft(e,t,i){var n=e&&e.style;if(n){if(void 0===i)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(i=e.currentStyle),void 0===t?i:i[t];t in n||-1!==t.indexOf("webkit")||(t="-webkit-"+t),n[t]=i+("string"==typeof i?"":"px")}}function Mt(e,t){var i="";if("string"==typeof e)i=e;else do{var n=Ft(e,"transform");n&&"none"!==n&&(i=n+" "+i)}while(!t&&(e=e.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(i)}function Nt(e,t,i){if(e){var n=e.getElementsByTagName(t),r=0,s=n.length;if(i)for(;r<s;r++)i(n[r],r);return n}return[]}function jt(){var e=document.scrollingElement;return e||document.documentElement}function Pt(e,t,i,n,r){if(e.getBoundingClientRect||e===window){var s,o,a,l,c,d,u;if(e!==window&&e.parentNode&&e!==jt()?(o=(s=e.getBoundingClientRect()).top,a=s.left,l=s.bottom,c=s.right,d=s.height,u=s.width):(o=0,a=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(t||i)&&e!==window&&(r=r||e.parentNode,!bt))do{if(r&&r.getBoundingClientRect&&("none"!==Ft(r,"transform")||i&&"static"!==Ft(r,"position"))){var h=r.getBoundingClientRect();o-=h.top+parseInt(Ft(r,"border-top-width")),a-=h.left+parseInt(Ft(r,"border-left-width")),l=o+s.height,c=a+s.width;break}}while(r=r.parentNode);if(n&&e!==window){var p=Mt(r||e),f=p&&p.a,g=p&&p.d;p&&(l=(o/=g)+(d/=g),c=(a/=f)+(u/=f))}return{top:o,left:a,bottom:l,right:c,width:u,height:d}}}function $t(e,t,i){for(var n=Vt(e,!0),r=Pt(e)[t];n;){if(!(r>=Pt(n)[i]))return n;if(n===jt())break;n=Vt(n,!1)}return!1}function Ht(e,t,i,n){for(var r=0,s=0,o=e.children;s<o.length;){if("none"!==o[s].style.display&&o[s]!==Ki.ghost&&(n||o[s]!==Ki.dragged)&&xt(o[s],i.draggable,e,!1)){if(r===t)return o[s];r++}s++}return null}function qt(e,t){for(var i=e.lastElementChild;i&&(i===Ki.ghost||"none"===Ft(i,"display")||t&&!Ct(i,t));)i=i.previousElementSibling;return i||null}function Rt(e,t){var i=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Ki.clone||t&&!Ct(e,t)||i++;return i}function Bt(e){var t=0,i=0,n=jt();if(e)do{var r=Mt(e),s=r.a,o=r.d;t+=e.scrollLeft*s,i+=e.scrollTop*o}while(e!==n&&(e=e.parentNode));return[t,i]}function Vt(e,t){if(!e||!e.getBoundingClientRect)return jt();var i=e,n=!1;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var r=Ft(i);if(i.clientWidth<i.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||i.clientHeight<i.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!i.getBoundingClientRect||i===document.body)return jt();if(n||t)return i;n=!0}}}while(i=i.parentNode);return jt()}function zt(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function Wt(e,t){return function(){if(!Tt){var i=arguments;1===i.length?e.call(this,i[0]):e.apply(this,i),Tt=setTimeout(function(){Tt=void 0},t)}}}function Yt(e,t,i){e.scrollLeft+=t,e.scrollTop+=i}function Kt(e){var t=window.Polymer,i=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):i?i(e).clone(!0)[0]:e.cloneNode(!0)}function Ut(e,t,i){var n={};return Array.from(e.children).forEach(function(r){var s,o,a,l;if(xt(r,t.draggable,e,!1)&&!r.animated&&r!==i){var c=Pt(r);n.left=Math.min(null!==(s=n.left)&&void 0!==s?s:1/0,c.left),n.top=Math.min(null!==(o=n.top)&&void 0!==o?o:1/0,c.top),n.right=Math.max(null!==(a=n.right)&&void 0!==a?a:-1/0,c.right),n.bottom=Math.max(null!==(l=n.bottom)&&void 0!==l?l:-1/0,c.bottom)}}),n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}var Xt="Sortable"+(new Date).getTime();function Qt(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach(function(e){if("none"!==Ft(e,"display")&&e!==Ki.ghost){t.push({target:e,rect:Pt(e)});var i=ht({},t[t.length-1].rect);if(e.thisAnimationDuration){var n=Mt(e,!0);n&&(i.top-=n.f,i.left-=n.e)}e.fromRect=i}})},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var i in e)if(e.hasOwnProperty(i))for(var n in t)if(t.hasOwnProperty(n)&&t[n]===e[i][n])return Number(i);return-1}(t,{target:e}),1)},animateAll:function(i){var n=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof i&&i());var r=!1,s=0;t.forEach(function(e){var t=0,i=e.target,o=i.fromRect,a=Pt(i),l=i.prevFromRect,c=i.prevToRect,d=e.rect,u=Mt(i,!0);u&&(a.top-=u.f,a.left-=u.e),i.toRect=a,i.thisAnimationDuration&&zt(l,a)&&!zt(o,a)&&(d.top-a.top)/(d.left-a.left)===(o.top-a.top)/(o.left-a.left)&&(t=function(e,t,i,n){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-i.top,2)+Math.pow(t.left-i.left,2))*n.animation}(d,l,c,n.options)),zt(a,o)||(i.prevFromRect=o,i.prevToRect=a,t||(t=n.options.animation),n.animate(i,d,a,t)),t&&(r=!0,s=Math.max(s,t),clearTimeout(i.animationResetTimer),i.animationResetTimer=setTimeout(function(){i.animationTime=0,i.prevFromRect=null,i.fromRect=null,i.prevToRect=null,i.thisAnimationDuration=null},t),i.thisAnimationDuration=t)}),clearTimeout(e),r?e=setTimeout(function(){"function"==typeof i&&i()},s):"function"==typeof i&&i(),t=[]},animate:function(e,t,i,n){if(n){Ft(e,"transition",""),Ft(e,"transform","");var r=Mt(this.el),s=r&&r.a,o=r&&r.d,a=(t.left-i.left)/(s||1),l=(t.top-i.top)/(o||1);e.animatingX=!!a,e.animatingY=!!l,Ft(e,"transform","translate3d("+a+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),Ft(e,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),Ft(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout(function(){Ft(e,"transition",""),Ft(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1},n)}}}}var Gt=[],Jt={initializeByDefault:!0},Zt={mount:function(e){for(var t in Jt)Jt.hasOwnProperty(t)&&!(t in e)&&(e[t]=Jt[t]);Gt.forEach(function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),Gt.push(e)},pluginEvent:function(e,t,i){var n=this;this.eventCanceled=!1,i.cancel=function(){n.eventCanceled=!0};var r=e+"Global";Gt.forEach(function(n){t[n.pluginName]&&(t[n.pluginName][r]&&t[n.pluginName][r](ht({sortable:t},i)),t.options[n.pluginName]&&t[n.pluginName][e]&&t[n.pluginName][e](ht({sortable:t},i)))})},initializePlugins:function(e,t,i,n){for(var r in Gt.forEach(function(n){var r=n.pluginName;if(e.options[r]||n.initializeByDefault){var s=new n(e,t,e.options);s.sortable=e,s.options=e.options,e[r]=s,gt(i,s.defaults)}}),e.options)if(e.options.hasOwnProperty(r)){var s=this.modifyOption(e,r,e.options[r]);void 0!==s&&(e.options[r]=s)}},getEventProperties:function(e,t){var i={};return Gt.forEach(function(n){"function"==typeof n.eventProperties&&gt(i,n.eventProperties.call(t[n.pluginName],e))}),i},modifyOption:function(e,t,i){var n;return Gt.forEach(function(r){e[r.pluginName]&&r.optionListeners&&"function"==typeof r.optionListeners[t]&&(n=r.optionListeners[t].call(e[r.pluginName],i))}),n}};var ei=["evt"],ti=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.evt,r=mt(i,ei);Zt.pluginEvent.bind(Ki)(e,t,ht({dragEl:ni,parentEl:ri,ghostEl:si,rootEl:oi,nextEl:ai,lastDownEl:li,cloneEl:ci,cloneHidden:di,dragStarted:Ai,putSortable:mi,activeSortable:Ki.active,originalEvent:n,oldIndex:ui,oldDraggableIndex:pi,newIndex:hi,newDraggableIndex:fi,hideGhostForTarget:Vi,unhideGhostForTarget:zi,cloneNowHidden:function(){di=!0},cloneNowShown:function(){di=!1},dispatchSortableEvent:function(e){ii({sortable:t,name:e,originalEvent:n})}},r))};function ii(e){!function(e){var t=e.sortable,i=e.rootEl,n=e.name,r=e.targetEl,s=e.cloneEl,o=e.toEl,a=e.fromEl,l=e.oldIndex,c=e.newIndex,d=e.oldDraggableIndex,u=e.newDraggableIndex,h=e.originalEvent,p=e.putSortable,f=e.extraEventProperties;if(t=t||i&&i[Xt]){var g,m=t.options,v="on"+n.charAt(0).toUpperCase()+n.substr(1);!window.CustomEvent||bt||yt?(g=document.createEvent("Event")).initEvent(n,!0,!0):g=new CustomEvent(n,{bubbles:!0,cancelable:!0}),g.to=o||i,g.from=a||i,g.item=r||i,g.clone=s,g.oldIndex=l,g.newIndex=c,g.oldDraggableIndex=d,g.newDraggableIndex=u,g.originalEvent=h,g.pullMode=p?p.lastPutMode:void 0;var b=ht(ht({},f),Zt.getEventProperties(n,t));for(var y in b)g[y]=b[y];i&&i.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ht({putSortable:mi,cloneEl:ci,targetEl:ni,rootEl:oi,oldIndex:ui,oldDraggableIndex:pi,newIndex:hi,newDraggableIndex:fi},e))}var ni,ri,si,oi,ai,li,ci,di,ui,hi,pi,fi,gi,mi,vi,bi,yi,_i,wi,Ei,Ai,Si,ki,Oi,Ci,Di=!1,xi=!1,Ti=[],Li=!1,Ii=!1,Fi=[],Mi=!1,Ni=[],ji="undefined"!=typeof document,Pi=Et,$i=yt||bt?"cssFloat":"float",Hi=ji&&!At&&!Et&&"draggable"in document.createElement("div"),qi=function(){if(ji){if(bt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Ri=function(e,t){var i=Ft(e),n=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),r=Ht(e,0,t),s=Ht(e,1,t),o=r&&Ft(r),a=s&&Ft(s),l=o&&parseInt(o.marginLeft)+parseInt(o.marginRight)+Pt(r).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Pt(s).width;if("flex"===i.display)return"column"===i.flexDirection||"column-reverse"===i.flexDirection?"vertical":"horizontal";if("grid"===i.display)return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&o.float&&"none"!==o.float){var d="left"===o.float?"left":"right";return!s||"both"!==a.clear&&a.clear!==d?"horizontal":"vertical"}return r&&("block"===o.display||"flex"===o.display||"table"===o.display||"grid"===o.display||l>=n&&"none"===i[$i]||s&&"none"===i[$i]&&l+c>n)?"vertical":"horizontal"},Bi=function(e){function t(e,i){return function(n,r,s,o){var a=n.options.group.name&&r.options.group.name&&n.options.group.name===r.options.group.name;if(null==e&&(i||a))return!0;if(null==e||!1===e)return!1;if(i&&"clone"===e)return e;if("function"==typeof e)return t(e(n,r,s,o),i)(n,r,s,o);var l=(i?n:r).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var i={},n=e.group;n&&"object"==pt(n)||(n={name:n}),i.name=n.name,i.checkPull=t(n.pull,!0),i.checkPut=t(n.put),i.revertClone=n.revertClone,e.group=i},Vi=function(){!qi&&si&&Ft(si,"display","none")},zi=function(){!qi&&si&&Ft(si,"display","")};ji&&!At&&document.addEventListener("click",function(e){if(xi)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),xi=!1,!1},!0);var Wi=function(e){if(ni){e=e.touches?e.touches[0]:e;var t=(r=e.clientX,s=e.clientY,Ti.some(function(e){var t=e[Xt].options.emptyInsertThreshold;if(t&&!qt(e)){var i=Pt(e),n=r>=i.left-t&&r<=i.right+t,a=s>=i.top-t&&s<=i.bottom+t;return n&&a?o=e:void 0}}),o);if(t){var i={};for(var n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);i.target=i.rootEl=t,i.preventDefault=void 0,i.stopPropagation=void 0,t[Xt]._onDragOver(i)}}var r,s,o},Yi=function(e){ni&&ni.parentNode[Xt]._isOutsideThisEl(e.target)};function Ki(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=gt({},t),e[Xt]=this;var i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ri(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Ki.supportPointer&&"PointerEvent"in window&&(!wt||Et),emptyInsertThreshold:5};for(var n in Zt.initializePlugins(this,e,i),i)!(n in t)&&(t[n]=i[n]);for(var r in Bi(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&Hi,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?kt(e,"pointerdown",this._onTapStart):(kt(e,"mousedown",this._onTapStart),kt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(kt(e,"dragover",this),kt(e,"dragenter",this)),Ti.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),gt(this,Qt())}function Ui(e,t,i,n,r,s,o,a){var l,c,d=e[Xt],u=d.options.onMove;return!window.CustomEvent||bt||yt?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=i,l.draggedRect=n,l.related=r||t,l.relatedRect=s||Pt(t),l.willInsertAfter=a,l.originalEvent=o,e.dispatchEvent(l),u&&(c=u.call(d,l,o)),c}function Xi(e){e.draggable=!1}function Qi(){Mi=!1}function Gi(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,i=t.length,n=0;i--;)n+=t.charCodeAt(i);return n.toString(36)}function Ji(e){return setTimeout(e,0)}function Zi(e){return clearTimeout(e)}Ki.prototype={constructor:Ki,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Si=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,ni):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,i=this.el,n=this.options,r=n.preventOnFilter,s=e.type,o=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,a=(o||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||a,c=n.filter;if(function(e){Ni.length=0;var t=e.getElementsByTagName("input"),i=t.length;for(;i--;){var n=t[i];n.checked&&Ni.push(n)}}(i),!ni&&!(/mousedown|pointerdown/.test(s)&&0!==e.button||n.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!wt||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=xt(a,n.draggable,i,!1))&&a.animated||li===a)){if(ui=Rt(a),pi=Rt(a,n.draggable),"function"==typeof c){if(c.call(this,e,a,this))return ii({sortable:t,rootEl:l,name:"filter",targetEl:a,toEl:i,fromEl:i}),ti("filter",t,{evt:e}),void(r&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(n){if(n=xt(l,n.trim(),i,!1))return ii({sortable:t,rootEl:n,name:"filter",targetEl:a,fromEl:i,toEl:i}),ti("filter",t,{evt:e}),!0})))return void(r&&e.preventDefault());n.handle&&!xt(l,n.handle,i,!1)||this._prepareDragStart(e,o,a)}}},_prepareDragStart:function(e,t,i){var n,r=this,s=r.el,o=r.options,a=s.ownerDocument;if(i&&!ni&&i.parentNode===s){var l=Pt(i);if(oi=s,ri=(ni=i).parentNode,ai=ni.nextSibling,li=i,gi=o.group,Ki.dragged=ni,vi={target:ni,clientX:(t||e).clientX,clientY:(t||e).clientY},wi=vi.clientX-l.left,Ei=vi.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,ni.style["will-change"]="all",n=function(){ti("delayEnded",r,{evt:e}),Ki.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!_t&&r.nativeDraggable&&(ni.draggable=!0),r._triggerDragStart(e,t),ii({sortable:r,name:"choose",originalEvent:e}),It(ni,o.chosenClass,!0))},o.ignore.split(",").forEach(function(e){Nt(ni,e.trim(),Xi)}),kt(a,"dragover",Wi),kt(a,"mousemove",Wi),kt(a,"touchmove",Wi),o.supportPointer?(kt(a,"pointerup",r._onDrop),!this.nativeDraggable&&kt(a,"pointercancel",r._onDrop)):(kt(a,"mouseup",r._onDrop),kt(a,"touchend",r._onDrop),kt(a,"touchcancel",r._onDrop)),_t&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ni.draggable=!0),ti("delayStart",this,{evt:e}),!o.delay||o.delayOnTouchOnly&&!t||this.nativeDraggable&&(yt||bt))n();else{if(Ki.eventCanceled)return void this._onDrop();o.supportPointer?(kt(a,"pointerup",r._disableDelayedDrag),kt(a,"pointercancel",r._disableDelayedDrag)):(kt(a,"mouseup",r._disableDelayedDrag),kt(a,"touchend",r._disableDelayedDrag),kt(a,"touchcancel",r._disableDelayedDrag)),kt(a,"mousemove",r._delayedDragTouchMoveHandler),kt(a,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&kt(a,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(n,o.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){ni&&Xi(ni),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Ot(e,"mouseup",this._disableDelayedDrag),Ot(e,"touchend",this._disableDelayedDrag),Ot(e,"touchcancel",this._disableDelayedDrag),Ot(e,"pointerup",this._disableDelayedDrag),Ot(e,"pointercancel",this._disableDelayedDrag),Ot(e,"mousemove",this._delayedDragTouchMoveHandler),Ot(e,"touchmove",this._delayedDragTouchMoveHandler),Ot(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?kt(document,"pointermove",this._onTouchMove):kt(document,t?"touchmove":"mousemove",this._onTouchMove):(kt(ni,"dragend",this),kt(oi,"dragstart",this._onDragStart));try{document.selection?Ji(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Di=!1,oi&&ni){ti("dragStarted",this,{evt:t}),this.nativeDraggable&&kt(document,"dragover",Yi);var i=this.options;!e&&It(ni,i.dragClass,!1),It(ni,i.ghostClass,!0),Ki.active=this,e&&this._appendGhost(),ii({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(bi){this._lastX=bi.clientX,this._lastY=bi.clientY,Vi();for(var e=document.elementFromPoint(bi.clientX,bi.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(bi.clientX,bi.clientY))!==t;)t=e;if(ni.parentNode[Xt]._isOutsideThisEl(e),t)do{if(t[Xt]){if(t[Xt]._onDragOver({clientX:bi.clientX,clientY:bi.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=Dt(t));zi()}},_onTouchMove:function(e){if(vi){var t=this.options,i=t.fallbackTolerance,n=t.fallbackOffset,r=e.touches?e.touches[0]:e,s=si&&Mt(si,!0),o=si&&s&&s.a,a=si&&s&&s.d,l=Pi&&Ci&&Bt(Ci),c=(r.clientX-vi.clientX+n.x)/(o||1)+(l?l[0]-Fi[0]:0)/(o||1),d=(r.clientY-vi.clientY+n.y)/(a||1)+(l?l[1]-Fi[1]:0)/(a||1);if(!Ki.active&&!Di){if(i&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<i)return;this._onDragStart(e,!0)}if(si){s?(s.e+=c-(yi||0),s.f+=d-(_i||0)):s={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");Ft(si,"webkitTransform",u),Ft(si,"mozTransform",u),Ft(si,"msTransform",u),Ft(si,"transform",u),yi=c,_i=d,bi=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!si){var e=this.options.fallbackOnBody?document.body:oi,t=Pt(ni,!0,Pi,!0,e),i=this.options;if(Pi){for(Ci=e;"static"===Ft(Ci,"position")&&"none"===Ft(Ci,"transform")&&Ci!==document;)Ci=Ci.parentNode;Ci!==document.body&&Ci!==document.documentElement?(Ci===document&&(Ci=jt()),t.top+=Ci.scrollTop,t.left+=Ci.scrollLeft):Ci=jt(),Fi=Bt(Ci)}It(si=ni.cloneNode(!0),i.ghostClass,!1),It(si,i.fallbackClass,!0),It(si,i.dragClass,!0),Ft(si,"transition",""),Ft(si,"transform",""),Ft(si,"box-sizing","border-box"),Ft(si,"margin",0),Ft(si,"top",t.top),Ft(si,"left",t.left),Ft(si,"width",t.width),Ft(si,"height",t.height),Ft(si,"opacity","0.8"),Ft(si,"position",Pi?"absolute":"fixed"),Ft(si,"zIndex","100000"),Ft(si,"pointerEvents","none"),Ki.ghost=si,e.appendChild(si),Ft(si,"transform-origin",wi/parseInt(si.style.width)*100+"% "+Ei/parseInt(si.style.height)*100+"%")}},_onDragStart:function(e,t){var i=this,n=e.dataTransfer,r=i.options;ti("dragStart",this,{evt:e}),Ki.eventCanceled?this._onDrop():(ti("setupClone",this),Ki.eventCanceled||((ci=Kt(ni)).removeAttribute("id"),ci.draggable=!1,ci.style["will-change"]="",this._hideClone(),It(ci,this.options.chosenClass,!1),Ki.clone=ci),i.cloneId=Ji(function(){ti("clone",i),Ki.eventCanceled||(i.options.removeCloneOnHide||oi.insertBefore(ci,ni),i._hideClone(),ii({sortable:i,name:"clone"}))}),!t&&It(ni,r.dragClass,!0),t?(xi=!0,i._loopId=setInterval(i._emulateDragOver,50)):(Ot(document,"mouseup",i._onDrop),Ot(document,"touchend",i._onDrop),Ot(document,"touchcancel",i._onDrop),n&&(n.effectAllowed="move",r.setData&&r.setData.call(i,n,ni)),kt(document,"drop",i),Ft(ni,"transform","translateZ(0)")),Di=!0,i._dragStartId=Ji(i._dragStarted.bind(i,t,e)),kt(document,"selectstart",i),Ai=!0,window.getSelection().removeAllRanges(),wt&&Ft(document.body,"user-select","none"))},_onDragOver:function(e){var t,i,n,r,s=this.el,o=e.target,a=this.options,l=a.group,c=Ki.active,d=gi===l,u=a.sort,h=mi||c,p=this,f=!1;if(!Mi){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),o=xt(o,a.draggable,s,!0),x("dragOver"),Ki.eventCanceled)return f;if(ni.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||p._ignoreWhileAnimating===o)return L(!1);if(xi=!1,c&&!a.disabled&&(d?u||(n=ri!==oi):mi===this||(this.lastPutMode=gi.checkPull(this,c,ni,e))&&l.checkPut(this,c,ni,e))){if(r="vertical"===this._getDirection(e,o),t=Pt(ni),x("dragOverValid"),Ki.eventCanceled)return f;if(n)return ri=oi,T(),this._hideClone(),x("revert"),Ki.eventCanceled||(ai?oi.insertBefore(ni,ai):oi.appendChild(ni)),L(!0);var g=qt(s,a.draggable);if(!g||function(e,t,i){var n=Pt(qt(i.el,i.options.draggable)),r=Ut(i.el,i.options,si),s=10;return t?e.clientX>r.right+s||e.clientY>n.bottom&&e.clientX>n.left:e.clientY>r.bottom+s||e.clientX>n.right&&e.clientY>n.top}(e,r,this)&&!g.animated){if(g===ni)return L(!1);if(g&&s===e.target&&(o=g),o&&(i=Pt(o)),!1!==Ui(oi,s,ni,t,o,i,e,!!o))return T(),g&&g.nextSibling?s.insertBefore(ni,g.nextSibling):s.appendChild(ni),ri=s,I(),L(!0)}else if(g&&function(e,t,i){var n=Pt(Ht(i.el,0,i.options,!0)),r=Ut(i.el,i.options,si),s=10;return t?e.clientX<r.left-s||e.clientY<n.top&&e.clientX<n.right:e.clientY<r.top-s||e.clientY<n.bottom&&e.clientX<n.left}(e,r,this)){var m=Ht(s,0,a,!0);if(m===ni)return L(!1);if(i=Pt(o=m),!1!==Ui(oi,s,ni,t,o,i,e,!1))return T(),s.insertBefore(ni,m),ri=s,I(),L(!0)}else if(o.parentNode===s){i=Pt(o);var v,b,y,_=ni.parentNode!==s,w=!function(e,t,i){var n=i?e.left:e.top,r=i?e.right:e.bottom,s=i?e.width:e.height,o=i?t.left:t.top,a=i?t.right:t.bottom,l=i?t.width:t.height;return n===o||r===a||n+s/2===o+l/2}(ni.animated&&ni.toRect||t,o.animated&&o.toRect||i,r),E=r?"top":"left",A=$t(o,"top","top")||$t(ni,"top","top"),S=A?A.scrollTop:void 0;if(Si!==o&&(b=i[E],Li=!1,Ii=!w&&a.invertSwap||_),v=function(e,t,i,n,r,s,o,a){var l=n?e.clientY:e.clientX,c=n?i.height:i.width,d=n?i.top:i.left,u=n?i.bottom:i.right,h=!1;if(!o)if(a&&Oi<c*r){if(!Li&&(1===ki?l>d+c*s/2:l<u-c*s/2)&&(Li=!0),Li)h=!0;else if(1===ki?l<d+Oi:l>u-Oi)return-ki}else if(l>d+c*(1-r)/2&&l<u-c*(1-r)/2)return function(e){return Rt(ni)<Rt(e)?1:-1}(t);if((h=h||o)&&(l<d+c*s/2||l>u-c*s/2))return l>d+c/2?1:-1;return 0}(e,o,i,r,w?1:a.swapThreshold,null==a.invertedSwapThreshold?a.swapThreshold:a.invertedSwapThreshold,Ii,Si===o),0!==v){var k=Rt(ni);do{k-=v,y=ri.children[k]}while(y&&("none"===Ft(y,"display")||y===si))}if(0===v||y===o)return L(!1);Si=o,ki=v;var O=o.nextElementSibling,C=!1,D=Ui(oi,s,ni,t,o,i,e,C=1===v);if(!1!==D)return 1!==D&&-1!==D||(C=1===D),Mi=!0,setTimeout(Qi,30),T(),C&&!O?s.appendChild(ni):o.parentNode.insertBefore(ni,C?O:o),A&&Yt(A,0,S-A.scrollTop),ri=ni.parentNode,void 0===b||Ii||(Oi=Math.abs(b-Pt(o)[E])),I(),L(!0)}if(s.contains(ni))return L(!1)}return!1}function x(a,l){ti(a,p,ht({evt:e,isOwner:d,axis:r?"vertical":"horizontal",revert:n,dragRect:t,targetRect:i,canSort:u,fromSortable:h,target:o,completed:L,onMove:function(i,n){return Ui(oi,s,ni,t,i,Pt(i),e,n)},changed:I},l))}function T(){x("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function L(t){return x("dragOverCompleted",{insertion:t}),t&&(d?c._hideClone():c._showClone(p),p!==h&&(It(ni,mi?mi.options.ghostClass:c.options.ghostClass,!1),It(ni,a.ghostClass,!0)),mi!==p&&p!==Ki.active?mi=p:p===Ki.active&&mi&&(mi=null),h===p&&(p._ignoreWhileAnimating=o),p.animateAll(function(){x("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(o===ni&&!ni.animated||o===s&&!o.animated)&&(Si=null),a.dragoverBubble||e.rootEl||o===document||(ni.parentNode[Xt]._isOutsideThisEl(e.target),!t&&Wi(e)),!a.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),f=!0}function I(){hi=Rt(ni),fi=Rt(ni,a.draggable),ii({sortable:p,name:"change",toEl:s,newIndex:hi,newDraggableIndex:fi,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Ot(document,"mousemove",this._onTouchMove),Ot(document,"touchmove",this._onTouchMove),Ot(document,"pointermove",this._onTouchMove),Ot(document,"dragover",Wi),Ot(document,"mousemove",Wi),Ot(document,"touchmove",Wi)},_offUpEvents:function(){var e=this.el.ownerDocument;Ot(e,"mouseup",this._onDrop),Ot(e,"touchend",this._onDrop),Ot(e,"pointerup",this._onDrop),Ot(e,"pointercancel",this._onDrop),Ot(e,"touchcancel",this._onDrop),Ot(document,"selectstart",this)},_onDrop:function(e){var t=this.el,i=this.options;hi=Rt(ni),fi=Rt(ni,i.draggable),ti("drop",this,{evt:e}),ri=ni&&ni.parentNode,hi=Rt(ni),fi=Rt(ni,i.draggable),Ki.eventCanceled||(Di=!1,Ii=!1,Li=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Zi(this.cloneId),Zi(this._dragStartId),this.nativeDraggable&&(Ot(document,"drop",this),Ot(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),wt&&Ft(document.body,"user-select",""),Ft(ni,"transform",""),e&&(Ai&&(e.cancelable&&e.preventDefault(),!i.dropBubble&&e.stopPropagation()),si&&si.parentNode&&si.parentNode.removeChild(si),(oi===ri||mi&&"clone"!==mi.lastPutMode)&&ci&&ci.parentNode&&ci.parentNode.removeChild(ci),ni&&(this.nativeDraggable&&Ot(ni,"dragend",this),Xi(ni),ni.style["will-change"]="",Ai&&!Di&&It(ni,mi?mi.options.ghostClass:this.options.ghostClass,!1),It(ni,this.options.chosenClass,!1),ii({sortable:this,name:"unchoose",toEl:ri,newIndex:null,newDraggableIndex:null,originalEvent:e}),oi!==ri?(hi>=0&&(ii({rootEl:ri,name:"add",toEl:ri,fromEl:oi,originalEvent:e}),ii({sortable:this,name:"remove",toEl:ri,originalEvent:e}),ii({rootEl:ri,name:"sort",toEl:ri,fromEl:oi,originalEvent:e}),ii({sortable:this,name:"sort",toEl:ri,originalEvent:e})),mi&&mi.save()):hi!==ui&&hi>=0&&(ii({sortable:this,name:"update",toEl:ri,originalEvent:e}),ii({sortable:this,name:"sort",toEl:ri,originalEvent:e})),Ki.active&&(null!=hi&&-1!==hi||(hi=ui,fi=pi),ii({sortable:this,name:"end",toEl:ri,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){ti("nulling",this),oi=ni=ri=si=ai=ci=li=di=vi=bi=Ai=hi=fi=ui=pi=Si=ki=mi=gi=Ki.dragged=Ki.ghost=Ki.clone=Ki.active=null,Ni.forEach(function(e){e.checked=!0}),Ni.length=yi=_i=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":ni&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],i=this.el.children,n=0,r=i.length,s=this.options;n<r;n++)xt(e=i[n],s.draggable,this.el,!1)&&t.push(e.getAttribute(s.dataIdAttr)||Gi(e));return t},sort:function(e,t){var i={},n=this.el;this.toArray().forEach(function(e,t){var r=n.children[t];xt(r,this.options.draggable,n,!1)&&(i[e]=r)},this),t&&this.captureAnimationState(),e.forEach(function(e){i[e]&&(n.removeChild(i[e]),n.appendChild(i[e]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return xt(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var i=this.options;if(void 0===t)return i[e];var n=Zt.modifyOption(this,e,t);i[e]=void 0!==n?n:t,"group"===e&&Bi(i)},destroy:function(){ti("destroy",this);var e=this.el;e[Xt]=null,Ot(e,"mousedown",this._onTapStart),Ot(e,"touchstart",this._onTapStart),Ot(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(Ot(e,"dragover",this),Ot(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Ti.splice(Ti.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!di){if(ti("hideClone",this),Ki.eventCanceled)return;Ft(ci,"display","none"),this.options.removeCloneOnHide&&ci.parentNode&&ci.parentNode.removeChild(ci),di=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(di){if(ti("showClone",this),Ki.eventCanceled)return;ni.parentNode!=oi||this.options.group.revertClone?ai?oi.insertBefore(ci,ai):oi.appendChild(ci):oi.insertBefore(ci,ni),this.options.group.revertClone&&this.animate(ni,ci),Ft(ci,"display",""),di=!1}}else this._hideClone()}},ji&&kt(document,"touchmove",function(e){(Ki.active||Di)&&e.cancelable&&e.preventDefault()}),Ki.utils={on:kt,off:Ot,css:Ft,find:Nt,is:function(e,t){return!!xt(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},throttle:Wt,closest:xt,toggleClass:It,clone:Kt,index:Rt,nextTick:Ji,cancelNextTick:Zi,detectDirection:Ri,getChild:Ht,expando:Xt},Ki.get=function(e){return e[Xt]},Ki.mount=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t[0].constructor===Array&&(t=t[0]),t.forEach(function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(Ki.utils=ht(ht({},Ki.utils),e.utils)),Zt.mount(e)})},Ki.create=function(e,t){return new Ki(e,t)},Ki.version="1.15.6";var en,tn,nn,rn,sn,on,an=[],ln=!1;function cn(){an.forEach(function(e){clearInterval(e.pid)}),an=[]}function dn(){clearInterval(on)}var un=Wt(function(e,t,i,n){if(t.scroll){var r,s=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,a=t.scrollSensitivity,l=t.scrollSpeed,c=jt(),d=!1;tn!==i&&(tn=i,cn(),en=t.scroll,r=t.scrollFn,!0===en&&(en=Vt(i,!0)));var u=0,h=en;do{var p=h,f=Pt(p),g=f.top,m=f.bottom,v=f.left,b=f.right,y=f.width,_=f.height,w=void 0,E=void 0,A=p.scrollWidth,S=p.scrollHeight,k=Ft(p),O=p.scrollLeft,C=p.scrollTop;p===c?(w=y<A&&("auto"===k.overflowX||"scroll"===k.overflowX||"visible"===k.overflowX),E=_<S&&("auto"===k.overflowY||"scroll"===k.overflowY||"visible"===k.overflowY)):(w=y<A&&("auto"===k.overflowX||"scroll"===k.overflowX),E=_<S&&("auto"===k.overflowY||"scroll"===k.overflowY));var D=w&&(Math.abs(b-s)<=a&&O+y<A)-(Math.abs(v-s)<=a&&!!O),x=E&&(Math.abs(m-o)<=a&&C+_<S)-(Math.abs(g-o)<=a&&!!C);if(!an[u])for(var T=0;T<=u;T++)an[T]||(an[T]={});an[u].vx==D&&an[u].vy==x&&an[u].el===p||(an[u].el=p,an[u].vx=D,an[u].vy=x,clearInterval(an[u].pid),0==D&&0==x||(d=!0,an[u].pid=setInterval(function(){n&&0===this.layer&&Ki.active._onTouchMove(sn);var t=an[this.layer].vy?an[this.layer].vy*l:0,i=an[this.layer].vx?an[this.layer].vx*l:0;"function"==typeof r&&"continue"!==r.call(Ki.dragged.parentNode[Xt],i,t,e,sn,an[this.layer].el)||Yt(an[this.layer].el,i,t)}.bind({layer:u}),24))),u++}while(t.bubbleScroll&&h!==c&&(h=Vt(h,!1)));ln=d}},30),hn=function(e){var t=e.originalEvent,i=e.putSortable,n=e.dragEl,r=e.activeSortable,s=e.dispatchSortableEvent,o=e.hideGhostForTarget,a=e.unhideGhostForTarget;if(t){var l=i||r;o();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,d=document.elementFromPoint(c.clientX,c.clientY);a(),l&&!l.el.contains(d)&&(s("spill"),this.onSpill({dragEl:n,putSortable:i}))}};function pn(){}function fn(){}pn.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,i=e.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var n=Ht(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(t,n):this.sortable.el.appendChild(t),this.sortable.animateAll(),i&&i.animateAll()},drop:hn},gt(pn,{pluginName:"revertOnSpill"}),fn.prototype={onSpill:function(e){var t=e.dragEl,i=e.putSortable||this.sortable;i.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),i.animateAll()},drop:hn},gt(fn,{pluginName:"removeOnSpill"}),Ki.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?kt(document,"dragover",this._handleAutoScroll):this.options.supportPointer?kt(document,"pointermove",this._handleFallbackAutoScroll):t.touches?kt(document,"touchmove",this._handleFallbackAutoScroll):kt(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?Ot(document,"dragover",this._handleAutoScroll):(Ot(document,"pointermove",this._handleFallbackAutoScroll),Ot(document,"touchmove",this._handleFallbackAutoScroll),Ot(document,"mousemove",this._handleFallbackAutoScroll)),dn(),cn(),clearTimeout(Tt),Tt=void 0},nulling:function(){sn=tn=en=ln=on=nn=rn=null,an.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var i=this,n=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,s=document.elementFromPoint(n,r);if(sn=e,t||this.options.forceAutoScrollFallback||yt||bt||wt){un(e,this.options,s,t);var o=Vt(s,!0);!ln||on&&n===nn&&r===rn||(on&&dn(),on=setInterval(function(){var s=Vt(document.elementFromPoint(n,r),!0);s!==o&&(o=s,cn()),un(e,i.options,s,t)},10),nn=n,rn=r)}else{if(!this.options.bubbleScroll||Vt(s,!0)===jt())return void cn();un(e,this.options,Vt(s,!1),!1)}}},gt(e,{pluginName:"scroll",initializeByDefault:!0})}),Ki.mount(fn,pn);class gn{initSortable(e){const t=e.el.querySelector("[data-sortable]");t&&new Ki(t,{handle:".handle-sort",draggable:"tr",sort:!0,direction:"vertical",async onEnd({item:t}){var i,n,r,s,o,a;const l=t.getAttribute("data-id");if(l){const c=null!==(n=null===(i=t.previousElementSibling)||void 0===i?void 0:i.getAttribute("data-id"))&&void 0!==n?n:null,d=null!==(s=null===(r=t.nextElementSibling)||void 0===r?void 0:r.getAttribute("data-id"))&&void 0!==s?s:null,u=e.el.querySelector("tbody");if(u){let t=null!==(o=u.getAttribute("data-sortable-parent-path"))&&void 0!==o?o:"";t.length&&(t=`${t}-`);const i=null!==(a=u.getAttribute("data-sortable-url"))&&void 0!==a?a:"?do=sort",n={[`${t}item_id`]:l,...c?{[`${t}prev_id`]:c}:{},...d?{[`${t}next_id`]:d}:{}};return await e.ajax.request({method:"GET",url:i,data:n})}}}})}initSortableTree(e){e.el.querySelectorAll(".datagrid-tree-item-children").forEach(e=>{new Ki(e,{handle:".handle-sort",draggable:".datagrid-tree-item:not(.datagrid-tree-header)",async onEnd({item:e}){}})})}}class mn{constructor(e,t={}){this.select=e,this.opts=t}initSelectpickers(e){var t,i,n;const r=null!==(n=null!==(t=this.select)&&void 0!==t?t:null===(i=w())||void 0===i?void 0:i.TomSelect)&&void 0!==n?n:null;r&&e.forEach(e=>{e.hasAttribute("data-Tom-Initialised")||(e.setAttribute("data-Tom-Initialised","true"),new r(e,"function"==typeof this.opts?this.opts(e):this.opts))})}}function vn(e){return e[e.length-1]}function bn(e,...t){return t.forEach(t=>{e.includes(t)||e.push(t)}),e}function yn(e,t){return e?e.split(t):[]}function _n(e,t,i){return(void 0===t||e>=t)&&(void 0===i||e<=i)}function wn(e,t,i){return e<t?t:e>i?i:e}function En(e,t,i={},n=0,r=""){r+=`<${Object.keys(i).reduce((e,t)=>{let r=i[t];return"function"==typeof r&&(r=r(n)),`${e} ${t}="${r}"`},e)}></${e}>`;const s=n+1;return s<t?En(e,t,i,s,r):r}function An(e){return e.replace(/>\s+/g,">").replace(/\s+</,"<")}function Sn(e){return new Date(e).setHours(0,0,0,0)}function kn(){return(new Date).setHours(0,0,0,0)}function On(...e){switch(e.length){case 0:return kn();case 1:return Sn(e[0])}const t=new Date(0);return t.setFullYear(...e),t.setHours(0,0,0,0)}function Cn(e,t){const i=new Date(e);return i.setDate(i.getDate()+t)}function Dn(e,t){const i=new Date(e),n=i.getMonth()+t;let r=n%12;r<0&&(r+=12);const s=i.setMonth(n);return i.getMonth()!==r?i.setDate(0):s}function xn(e,t){const i=new Date(e),n=i.getMonth(),r=i.setFullYear(i.getFullYear()+t);return 1===n&&2===i.getMonth()?i.setDate(0):r}function Tn(e,t){return(e-t+7)%7}function Ln(e,t,i=0){const n=new Date(e).getDay();return Cn(e,Tn(t,i)-Tn(n,i))}function In(e,t){return Math.round((e-t)/6048e5)+1}function Fn(e){const t=Ln(e,4,1);return In(t,Ln(new Date(t).setMonth(0,4),4,1))}function Mn(e,t){const i=Ln(new Date(e).setMonth(0,1),t,t),n=Ln(e,t,t),r=In(n,i);if(r<53)return r;return n===Ln(new Date(e).setDate(32),t,t)?1:r}function Nn(e){return Mn(e,0)}function jn(e){return Mn(e,6)}function Pn(e,t){const i=new Date(e).getFullYear();return Math.floor(i/t)*t}function $n(e,t,i){if(1!==t&&2!==t)return e;const n=new Date(e);return 1===t?i?n.setMonth(n.getMonth()+1,0):n.setDate(1):i?n.setFullYear(n.getFullYear()+1,0,0):n.setMonth(0,1),n.setHours(0,0,0,0)}const Hn=/dd?|DD?|mm?|MM?|yy?(?:yy)?/,qn=/[\s!-/:-@[-`{-~年月日]+/;let Rn={};const Bn={y:(e,t)=>new Date(e).setFullYear(parseInt(t,10)),m(e,t,i){const n=new Date(e);let r=parseInt(t,10)-1;if(isNaN(r)){if(!t)return NaN;const e=t.toLowerCase(),n=t=>t.toLowerCase().startsWith(e);if(r=i.monthsShort.findIndex(n),r<0&&(r=i.months.findIndex(n)),r<0)return NaN}return n.setMonth(r),n.getMonth()!==zn(r)?n.setDate(0):n.getTime()},d:(e,t)=>new Date(e).setDate(parseInt(t,10))},Vn={d:e=>e.getDate(),dd:e=>Wn(e.getDate(),2),D:(e,t)=>t.daysShort[e.getDay()],DD:(e,t)=>t.days[e.getDay()],m:e=>e.getMonth()+1,mm:e=>Wn(e.getMonth()+1,2),M:(e,t)=>t.monthsShort[e.getMonth()],MM:(e,t)=>t.months[e.getMonth()],y:e=>e.getFullYear(),yy:e=>Wn(e.getFullYear(),2).slice(-2),yyyy:e=>Wn(e.getFullYear(),4)};function zn(e){return e>-1?e%12:zn(e+12)}function Wn(e,t){return e.toString().padStart(t,"0")}function Yn(e){if("string"!=typeof e)throw new Error("Invalid date format.");if(e in Rn)return Rn[e];const t=e.split(Hn),i=e.match(new RegExp(Hn,"g"));if(0===t.length||!i)throw new Error("Invalid date format.");const n=i.map(e=>Vn[e]),r=Object.keys(Bn).reduce((e,t)=>(i.find(e=>"D"!==e[0]&&e[0].toLowerCase()===t)&&e.push(t),e),[]);return Rn[e]={parser(e,t){const n=e.split(qn).reduce((e,t,n)=>{if(t.length>0&&i[n]){const r=i[n][0];"M"===r?e.m=t:"D"!==r&&(e[r]=t)}return e},{});return r.reduce((e,i)=>{const r=Bn[i](e,n[i],t);return isNaN(r)?e:r},kn())},formatter(e,i){let r=n.reduce((n,r,s)=>n+`${t[s]}${r(e,i)}`,"");return r+vn(t)}}}function Kn(e,t,i){if(e instanceof Date||"number"==typeof e){const t=Sn(e);return isNaN(t)?void 0:t}if(e){if("today"===e)return kn();if(t&&t.toValue){const n=t.toValue(e,t,i);return isNaN(n)?void 0:Sn(n)}return Yn(t).parser(e,i)}}function Un(e,t,i){if(isNaN(e)||!e&&0!==e)return"";const n="number"==typeof e?new Date(e):e;return t.toDisplay?t.toDisplay(n,t,i):Yn(t).formatter(n,i)}const Xn=document.createRange();function Qn(e){return Xn.createContextualFragment(e)}function Gn(e){return e.parentElement||(e.parentNode instanceof ShadowRoot?e.parentNode.host:void 0)}function Jn(e){return e.getRootNode().activeElement===e}function Zn(e){"none"!==e.style.display&&(e.style.display&&(e.dataset.styleDisplay=e.style.display),e.style.display="none")}function er(e){"none"===e.style.display&&(e.dataset.styleDisplay?(e.style.display=e.dataset.styleDisplay,delete e.dataset.styleDisplay):e.style.display="")}function tr(e){e.firstChild&&(e.removeChild(e.firstChild),tr(e))}const ir=new WeakMap,{addEventListener:nr,removeEventListener:rr}=EventTarget.prototype;function sr(e,t){let i=ir.get(e);i||(i=[],ir.set(e,i)),t.forEach(e=>{nr.call(...e),i.push(e)})}if(!Event.prototype.composedPath){const e=(t,i=[])=>{let n;return i.push(t),t.parentNode?n=t.parentNode:t.host?n=t.host:t.defaultView&&(n=t.defaultView),n?e(n,i):i};Event.prototype.composedPath=function(){return e(this.target)}}function or(e,t,i){const[n,...r]=e;return t(n)?n:n!==i&&"HTML"!==n.tagName&&0!==r.length?or(r,t,i):void 0}function ar(e,t){const i="function"==typeof t?t:e=>e instanceof Element&&e.matches(t);return or(e.composedPath(),i,e.currentTarget)}var lr={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear",titleFormat:"MM y"}},cr={autohide:!1,beforeShowDay:null,beforeShowDecade:null,beforeShowMonth:null,beforeShowYear:null,clearButton:!1,dateDelimiter:",",datesDisabled:[],daysOfWeekDisabled:[],daysOfWeekHighlighted:[],defaultViewDate:void 0,disableTouchKeyboard:!1,enableOnReadonly:!0,format:"mm/dd/yyyy",language:"en",maxDate:null,maxNumberOfDates:1,maxView:3,minDate:null,nextArrow:"»",orientation:"auto",pickLevel:0,prevArrow:"«",showDaysOfWeek:!0,showOnClick:!0,showOnFocus:!0,startView:0,title:"",todayButton:!1,todayButtonMode:0,todayHighlight:!1,updateOnBlur:!0,weekNumbers:0,weekStart:0};const{language:dr,format:ur,weekStart:hr}=cr;function pr(e,t){return e.length<6&&t>=0&&t<7?bn(e,t):e}function fr(e,t){switch(4===e?6===t?3:!t+1:e){case 1:return Fn;case 2:return Nn;case 3:return jn}}function gr(e,t,i){return t.weekStart=e,t.weekEnd=(e+6)%7,4===i&&(t.getWeekNumber=fr(4,e)),e}function mr(e,t,i,n){const r=Kn(e,t,i);return void 0!==r?r:n}function vr(e,t,i=3){const n=parseInt(e,10);return n>=0&&n<=i?n:t}function br(e,t,i,n=void 0){t in e&&(i in e||(e[i]=n?n(e[t]):e[t]),delete e[t])}function yr(e,t){const i=Object.assign({},e),n={},r=t.constructor.locales,s=!!t.rangeSideIndex;let{datesDisabled:o,format:a,language:l,locale:c,maxDate:d,maxView:u,minDate:h,pickLevel:p,startView:f,weekNumbers:g,weekStart:m}=t.config||{};if(br(i,"calendarWeeks","weekNumbers",e=>e?1:0),br(i,"clearBtn","clearButton"),br(i,"todayBtn","todayButton"),br(i,"todayBtnMode","todayButtonMode"),i.language){let e;if(i.language!==l&&(r[i.language]?e=i.language:(e=i.language.split("-")[0],r[e]||(e=!1))),delete i.language,e){l=n.language=e;const t=c||r[dr];c=Object.assign({format:ur,weekStart:hr},r[dr]),l!==dr&&Object.assign(c,r[l]),n.locale=c,a===t.format&&(a=n.format=c.format),m===t.weekStart&&(m=gr(c.weekStart,n,g))}}if(i.format){const e="function"==typeof i.format.toDisplay,t="function"==typeof i.format.toValue,r=Hn.test(i.format);(e&&t||r)&&(a=n.format=i.format),delete i.format}let v=p;"pickLevel"in i&&(v=vr(i.pickLevel,p,2),delete i.pickLevel),v!==p&&(v>p&&("minDate"in i||(i.minDate=h),"maxDate"in i||(i.maxDate=d)),o&&!i.datesDisabled&&(i.datesDisabled=[]),p=n.pickLevel=v);let b=h,y=d;if("minDate"in i){const e=On(0,0,1);b=null===i.minDate?e:mr(i.minDate,a,c,b),b!==e&&(b=$n(b,p,!1)),delete i.minDate}if("maxDate"in i&&(y=null===i.maxDate?void 0:mr(i.maxDate,a,c,y),void 0!==y&&(y=$n(y,p,!0)),delete i.maxDate),y<b?(h=n.minDate=y,d=n.maxDate=b):(h!==b&&(h=n.minDate=b),d!==y&&(d=n.maxDate=y)),i.datesDisabled){const e=i.datesDisabled;if("function"==typeof e)n.datesDisabled=null,n.checkDisabled=(t,i)=>e(new Date(t),i,s);else{const t=n.datesDisabled=e.reduce((e,t)=>{const i=Kn(t,a,c);return void 0!==i?bn(e,$n(i,p,s)):e},[]);n.checkDisabled=e=>t.includes(e)}delete i.datesDisabled}if("defaultViewDate"in i){const e=Kn(i.defaultViewDate,a,c);void 0!==e&&(n.defaultViewDate=e),delete i.defaultViewDate}if("weekStart"in i){const e=Number(i.weekStart)%7;isNaN(e)||(m=gr(e,n,g)),delete i.weekStart}if(i.daysOfWeekDisabled&&(n.daysOfWeekDisabled=i.daysOfWeekDisabled.reduce(pr,[]),delete i.daysOfWeekDisabled),i.daysOfWeekHighlighted&&(n.daysOfWeekHighlighted=i.daysOfWeekHighlighted.reduce(pr,[]),delete i.daysOfWeekHighlighted),"weekNumbers"in i){let e=i.weekNumbers;if(e){const t="function"==typeof e?(t,i)=>e(new Date(t),i):fr(e=parseInt(e,10),m);t&&(g=n.weekNumbers=e,n.getWeekNumber=t)}else g=n.weekNumbers=0,n.getWeekNumber=null;delete i.weekNumbers}if("maxNumberOfDates"in i){const e=parseInt(i.maxNumberOfDates,10);e>=0&&(n.maxNumberOfDates=e,n.multidate=1!==e),delete i.maxNumberOfDates}i.dateDelimiter&&(n.dateDelimiter=String(i.dateDelimiter),delete i.dateDelimiter);let _=u;"maxView"in i&&(_=vr(i.maxView,u),delete i.maxView),_=p>_?p:_,_!==u&&(u=n.maxView=_);let w=f;if("startView"in i&&(w=vr(i.startView,w),delete i.startView),w<p?w=p:w>u&&(w=u),w!==f&&(n.startView=w),i.prevArrow){const e=Qn(i.prevArrow);e.childNodes.length>0&&(n.prevArrow=e.childNodes),delete i.prevArrow}if(i.nextArrow){const e=Qn(i.nextArrow);e.childNodes.length>0&&(n.nextArrow=e.childNodes),delete i.nextArrow}if("disableTouchKeyboard"in i&&(n.disableTouchKeyboard="ontouchstart"in document&&!!i.disableTouchKeyboard,delete i.disableTouchKeyboard),i.orientation){const e=i.orientation.toLowerCase().split(/\s+/g);n.orientation={x:e.find(e=>"left"===e||"right"===e)||"auto",y:e.find(e=>"top"===e||"bottom"===e)||"auto"},delete i.orientation}if("todayButtonMode"in i){switch(i.todayButtonMode){case 0:case 1:n.todayButtonMode=i.todayButtonMode}delete i.todayButtonMode}return Object.entries(i).forEach(([e,t])=>{void 0!==t&&e in cr&&(n[e]=t)}),n}const _r={show:{key:"ArrowDown"},hide:null,toggle:{key:"Escape"},prevButton:{key:"ArrowLeft",ctrlOrMetaKey:!0},nextButton:{key:"ArrowRight",ctrlOrMetaKey:!0},viewSwitch:{key:"ArrowUp",ctrlOrMetaKey:!0},clearButton:{key:"Backspace",ctrlOrMetaKey:!0},todayButton:{key:".",ctrlOrMetaKey:!0},exitEditMode:{key:"ArrowDown",ctrlOrMetaKey:!0}};const wr=e=>e.map(e=>`<button type="button" class="%buttonClass% ${e}" tabindex="-1"></button>`).join("");var Er=An(`<div class="datepicker">\n <div class="datepicker-picker">\n <div class="datepicker-header">\n <div class="datepicker-title"></div>\n <div class="datepicker-controls">\n ${wr(["prev-button prev-btn","view-switch","next-button next-btn"])}\n </div>\n </div>\n <div class="datepicker-main"></div>\n <div class="datepicker-footer">\n <div class="datepicker-controls">\n ${wr(["today-button today-btn","clear-button clear-btn"])}\n </div>\n </div>\n </div>\n</div>`),Ar=An(`<div class="days">\n <div class="days-of-week">${En("span",7,{class:"dow"})}</div>\n <div class="datepicker-grid">${En("span",42)}</div>\n</div>`),Sr=An(`<div class="week-numbers calendar-weeks">\n <div class="days-of-week"><span class="dow"></span></div>\n <div class="weeks">${En("span",6,{class:"week"})}</div>\n</div>`);class kr{constructor(e,t){Object.assign(this,t,{picker:e,element:Qn('<div class="datepicker-view"></div>').firstChild,selected:[],isRangeEnd:!!e.datepicker.rangeSideIndex}),this.init(this.picker.datepicker.config)}init(e){"pickLevel"in e&&(this.isMinView=this.id===e.pickLevel),this.setOptions(e),this.updateFocus(),this.updateSelection()}prepareForRender(e,t,i){this.disabled=[];const n=this.picker;n.setViewSwitchLabel(e),n.setPrevButtonDisabled(t),n.setNextButtonDisabled(i)}setDisabled(e,t){t.add("disabled"),bn(this.disabled,e)}performBeforeHook(e,t){let i=this.beforeShow(new Date(t));switch(typeof i){case"boolean":i={enabled:i};break;case"string":i={classes:i}}if(i){const n=e.classList;if(!1===i.enabled&&this.setDisabled(t,n),i.classes){const e=i.classes.split(/\s+/);n.add(...e),e.includes("disabled")&&this.setDisabled(t,n)}i.content&&function(e,t){tr(e),t instanceof DocumentFragment?e.appendChild(t):"string"==typeof t?e.appendChild(Qn(t)):"function"==typeof t.forEach&&t.forEach(t=>{e.appendChild(t)})}(e,i.content)}}renderCell(e,t,i,n,{selected:r,range:s},o,a=[]){e.textContent=t,this.isMinView&&(e.dataset.date=n);const l=e.classList;if(e.className=`datepicker-cell ${this.cellClass}`,i<this.first?l.add("prev"):i>this.last&&l.add("next"),l.add(...a),(o||this.checkDisabled(n,this.id))&&this.setDisabled(n,l),s){const[e,t]=s;i>e&&i<t&&l.add("range"),i===e&&l.add("range-start"),i===t&&l.add("range-end")}r.includes(i)&&l.add("selected"),i===this.focused&&l.add("focused"),this.beforeShow&&this.performBeforeHook(e,n)}refreshCell(e,t,i,[n,r]){const s=e.classList;s.remove("range","range-start","range-end","selected","focused"),t>n&&t<r&&s.add("range"),t===n&&s.add("range-start"),t===r&&s.add("range-end"),i.includes(t)&&s.add("selected"),t===this.focused&&s.add("focused")}changeFocusedCell(e){this.grid.querySelectorAll(".focused").forEach(e=>{e.classList.remove("focused")}),this.grid.children[e].classList.add("focused")}}class Or extends kr{constructor(e){super(e,{id:0,name:"days",cellClass:"day"})}init(e,t=!0){if(t){const e=Qn(Ar).firstChild;this.dow=e.firstChild,this.grid=e.lastChild,this.element.appendChild(e)}super.init(e)}setOptions(e){let t;if("minDate"in e&&(this.minDate=e.minDate),"maxDate"in e&&(this.maxDate=e.maxDate),e.checkDisabled&&(this.checkDisabled=e.checkDisabled),e.daysOfWeekDisabled&&(this.daysOfWeekDisabled=e.daysOfWeekDisabled,t=!0),e.daysOfWeekHighlighted&&(this.daysOfWeekHighlighted=e.daysOfWeekHighlighted),"todayHighlight"in e&&(this.todayHighlight=e.todayHighlight),"weekStart"in e&&(this.weekStart=e.weekStart,this.weekEnd=e.weekEnd,t=!0),e.locale){const i=this.locale=e.locale;this.dayNames=i.daysMin,this.switchLabelFormat=i.titleFormat,t=!0}if("beforeShowDay"in e&&(this.beforeShow="function"==typeof e.beforeShowDay?e.beforeShowDay:void 0),"weekNumbers"in e)if(e.weekNumbers&&!this.weekNumbers){const e=Qn(Sr).firstChild;this.weekNumbers={element:e,dow:e.firstChild,weeks:e.lastChild},this.element.insertBefore(e,this.element.firstChild)}else this.weekNumbers&&!e.weekNumbers&&(this.element.removeChild(this.weekNumbers.element),this.weekNumbers=null);"getWeekNumber"in e&&(this.getWeekNumber=e.getWeekNumber),"showDaysOfWeek"in e&&(e.showDaysOfWeek?(er(this.dow),this.weekNumbers&&er(this.weekNumbers.dow)):(Zn(this.dow),this.weekNumbers&&Zn(this.weekNumbers.dow))),t&&Array.from(this.dow.children).forEach((e,t)=>{const i=(this.weekStart+t)%7;e.textContent=this.dayNames[i],e.className=this.daysOfWeekDisabled.includes(i)?"dow disabled":"dow"})}updateFocus(){const e=new Date(this.picker.viewDate),t=e.getFullYear(),i=e.getMonth(),n=On(t,i,1),r=Ln(n,this.weekStart,this.weekStart);this.first=n,this.last=On(t,i+1,0),this.start=r,this.focused=this.picker.viewDate}updateSelection(){const{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e,t&&(this.range=t.dates)}render(){if(this.today=this.todayHighlight?kn():void 0,this.prepareForRender(Un(this.focused,this.switchLabelFormat,this.locale),this.first<=this.minDate,this.last>=this.maxDate),this.weekNumbers){const e=this.weekStart,t=Ln(this.first,e,e);Array.from(this.weekNumbers.weeks.children).forEach((i,n)=>{const r=Cn(t,7*n);i.textContent=this.getWeekNumber(r,e),n>3&&i.classList[r>this.last?"add":"remove"]("next")})}Array.from(this.grid.children).forEach((e,t)=>{const i=Cn(this.start,t),n=new Date(i),r=n.getDay(),s=[];this.today===i&&s.push("today"),this.daysOfWeekHighlighted.includes(r)&&s.push("highlighted"),this.renderCell(e,n.getDate(),i,i,this,i<this.minDate||i>this.maxDate||this.daysOfWeekDisabled.includes(r),s)})}refresh(){const e=this.range||[];Array.from(this.grid.children).forEach(t=>{this.refreshCell(t,Number(t.dataset.date),this.selected,e)})}refreshFocus(){this.changeFocusedCell(Math.round((this.focused-this.start)/864e5))}}function Cr(e,t){if(!e||!e[0]||!e[1])return;const[[i,n],[r,s]]=e;return i>t||r<t?void 0:[i===t?n:-1,r===t?s:12]}class Dr extends kr{constructor(e){super(e,{id:1,name:"months",cellClass:"month"})}init(e,t=!0){t&&(this.grid=this.element,this.element.classList.add("months","datepicker-grid"),this.grid.appendChild(Qn(En("span",12,{"data-month":e=>e}))),this.first=0,this.last=11),super.init(e)}setOptions(e){if(e.locale&&(this.monthNames=e.locale.monthsShort),"minDate"in e)if(void 0===e.minDate)this.minYear=this.minMonth=this.minDate=void 0;else{const t=new Date(e.minDate);this.minYear=t.getFullYear(),this.minMonth=t.getMonth(),this.minDate=t.setDate(1)}if("maxDate"in e)if(void 0===e.maxDate)this.maxYear=this.maxMonth=this.maxDate=void 0;else{const t=new Date(e.maxDate);this.maxYear=t.getFullYear(),this.maxMonth=t.getMonth(),this.maxDate=On(this.maxYear,this.maxMonth+1,0)}e.checkDisabled&&(this.checkDisabled=this.isMinView||null===e.datesDisabled?e.checkDisabled:()=>!1),"beforeShowMonth"in e&&(this.beforeShow="function"==typeof e.beforeShowMonth?e.beforeShowMonth:void 0)}updateFocus(){const e=new Date(this.picker.viewDate);this.year=e.getFullYear(),this.focused=e.getMonth()}updateSelection(){const{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e.reduce((e,t)=>{const i=new Date(t),n=i.getFullYear(),r=i.getMonth();return void 0===e[n]?e[n]=[r]:bn(e[n],r),e},{}),t&&t.dates&&(this.range=t.dates.map(e=>{const t=new Date(e);return isNaN(t)?void 0:[t.getFullYear(),t.getMonth()]}))}render(){this.prepareForRender(this.year,this.year<=this.minYear,this.year>=this.maxYear);const e=this.selected[this.year]||[],t=this.year<this.minYear||this.year>this.maxYear,i=this.year===this.minYear,n=this.year===this.maxYear,r=Cr(this.range,this.year);Array.from(this.grid.children).forEach((s,o)=>{const a=$n(new Date(this.year,o,1),1,this.isRangeEnd);this.renderCell(s,this.monthNames[o],o,a,{selected:e,range:r},t||i&&o<this.minMonth||n&&o>this.maxMonth)})}refresh(){const e=this.selected[this.year]||[],t=Cr(this.range,this.year)||[];Array.from(this.grid.children).forEach((i,n)=>{this.refreshCell(i,n,e,t)})}refreshFocus(){this.changeFocusedCell(this.focused)}}class xr extends kr{constructor(e,t){super(e,t)}init(e,t=!0){var i;t&&(this.navStep=10*this.step,this.beforeShowOption=`beforeShow${i=this.cellClass,[...i].reduce((e,t,i)=>e+(i?t:t.toUpperCase()),"")}`,this.grid=this.element,this.element.classList.add(this.name,"datepicker-grid"),this.grid.appendChild(Qn(En("span",12)))),super.init(e)}setOptions(e){if("minDate"in e&&(void 0===e.minDate?this.minYear=this.minDate=void 0:(this.minYear=Pn(e.minDate,this.step),this.minDate=On(this.minYear,0,1))),"maxDate"in e&&(void 0===e.maxDate?this.maxYear=this.maxDate=void 0:(this.maxYear=Pn(e.maxDate,this.step),this.maxDate=On(this.maxYear,11,31))),e.checkDisabled&&(this.checkDisabled=this.isMinView||null===e.datesDisabled?e.checkDisabled:()=>!1),this.beforeShowOption in e){const t=e[this.beforeShowOption];this.beforeShow="function"==typeof t?t:void 0}}updateFocus(){const e=new Date(this.picker.viewDate),t=Pn(e,this.navStep),i=t+9*this.step;this.first=t,this.last=i,this.start=t-this.step,this.focused=Pn(e,this.step)}updateSelection(){const{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e.reduce((e,t)=>bn(e,Pn(t,this.step)),[]),t&&t.dates&&(this.range=t.dates.map(e=>{if(void 0!==e)return Pn(e,this.step)}))}render(){this.prepareForRender(`${this.first}-${this.last}`,this.first<=this.minYear,this.last>=this.maxYear),Array.from(this.grid.children).forEach((e,t)=>{const i=this.start+t*this.step,n=$n(new Date(i,0,1),2,this.isRangeEnd);e.dataset.year=i,this.renderCell(e,i,i,n,this,i<this.minYear||i>this.maxYear)})}refresh(){const e=this.range||[];Array.from(this.grid.children).forEach(t=>{this.refreshCell(t,Number(t.textContent),this.selected,e)})}refreshFocus(){this.changeFocusedCell(Math.round((this.focused-this.start)/this.step))}}function Tr(e,t){const i={bubbles:!0,cancelable:!0,detail:{date:e.getDate(),viewDate:new Date(e.picker.viewDate),viewId:e.picker.currentView.id,datepicker:e}};e.element.dispatchEvent(new CustomEvent(t,i))}function Lr(e,t){const{config:i,picker:n}=e,{currentView:r,viewDate:s}=n;let o;switch(r.id){case 0:o=Dn(s,t);break;case 1:o=xn(s,t);break;default:o=xn(s,t*r.navStep)}o=wn(o,i.minDate,i.maxDate),n.changeFocus(o).render()}function Ir(e){const t=e.picker.currentView.id;t!==e.config.maxView&&e.picker.changeView(t+1).render()}function Fr(e){e.setDate({clear:!0})}function Mr(e){const t=kn();1===e.config.todayButtonMode?e.setDate(t,{forceRefresh:!0,viewDate:t}):e.setFocusedDate(t,!0)}function Nr(e){const t=()=>{e.config.updateOnBlur?e.update({revert:!0}):e.refresh("input"),e.hide()},i=e.element;Jn(i)?i.addEventListener("blur",t,{once:!0}):t()}function jr(e,t){const i=e.picker,n=new Date(i.viewDate),r=i.currentView.id,s=1===r?Dn(n,t-n.getMonth()):xn(n,t-n.getFullYear());i.changeFocus(s).changeView(r-1).render()}function Pr(e){Ir(e)}function $r(e){Lr(e,-1)}function Hr(e){Lr(e,1)}function qr(e,t){const i=ar(t,".datepicker-cell");if(!i||i.classList.contains("disabled"))return;const{id:n,isMinView:r}=e.picker.currentView,s=i.dataset;r?e.setDate(Number(s.date)):jr(e,Number(1===n?s.month:s.year))}function Rr(e){e.preventDefault()}const Br=["left","top","right","bottom"].reduce((e,t)=>(e[t]=`datepicker-orient-${t}`,e),{}),Vr=e=>e?`${e}px`:e;function zr(e,t){if("title"in t&&(t.title?(e.controls.title.textContent=t.title,er(e.controls.title)):(e.controls.title.textContent="",Zn(e.controls.title))),t.prevArrow){const i=e.controls.prevButton;tr(i),t.prevArrow.forEach(e=>{i.appendChild(e.cloneNode(!0))})}if(t.nextArrow){const i=e.controls.nextButton;tr(i),t.nextArrow.forEach(e=>{i.appendChild(e.cloneNode(!0))})}if(t.locale&&(e.controls.todayButton.textContent=t.locale.today,e.controls.clearButton.textContent=t.locale.clear),"todayButton"in t&&(t.todayButton?er(e.controls.todayButton):Zn(e.controls.todayButton)),"minDate"in t||"maxDate"in t){const{minDate:t,maxDate:i}=e.datepicker.config;e.controls.todayButton.disabled=!_n(kn(),t,i)}"clearButton"in t&&(t.clearButton?er(e.controls.clearButton):Zn(e.controls.clearButton))}function Wr(e){const{dates:t,config:i,rangeSideIndex:n}=e;return wn(t.length>0?vn(t):$n(i.defaultViewDate,i.pickLevel,n),i.minDate,i.maxDate)}function Yr(e,t){"_oldViewDate"in e||t===e.viewDate||(e._oldViewDate=e.viewDate),e.viewDate=t;const{id:i,year:n,first:r,last:s}=e.currentView,o=new Date(t).getFullYear();switch(i){case 0:return t<r||t>s;case 1:return o!==n;default:return o<r||o>s}}function Kr(e){return window.getComputedStyle(e).direction}function Ur(e){const t=Gn(e);if(t!==document.body&&t)return"visible"!==window.getComputedStyle(t).overflow?t:Ur(t)}class Xr{constructor(e){const{config:t,inputField:i}=this.datepicker=e,n=Er.replace(/%buttonClass%/g,t.buttonClass),r=this.element=Qn(n).firstChild,[s,o,a]=r.firstChild.children,l=s.firstElementChild,[c,d,u]=s.lastElementChild.children,[h,p]=a.firstChild.children,f={title:l,prevButton:c,viewSwitch:d,nextButton:u,todayButton:h,clearButton:p};this.main=o,this.controls=f;const g=i?"dropdown":"inline";r.classList.add(`datepicker-${g}`),zr(this,t),this.viewDate=Wr(e),sr(e,[[r,"mousedown",Rr],[o,"click",qr.bind(null,e)],[f.viewSwitch,"click",Pr.bind(null,e)],[f.prevButton,"click",$r.bind(null,e)],[f.nextButton,"click",Hr.bind(null,e)],[f.todayButton,"click",Mr.bind(null,e)],[f.clearButton,"click",Fr.bind(null,e)]]),this.views=[new Or(this),new Dr(this),new xr(this,{id:2,name:"years",cellClass:"year",step:1}),new xr(this,{id:3,name:"decades",cellClass:"decade",step:10})],this.currentView=this.views[t.startView],this.currentView.render(),this.main.appendChild(this.currentView.element),t.container?t.container.appendChild(this.element):i.after(this.element)}setOptions(e){zr(this,e),this.views.forEach(t=>{t.init(e,!1)}),this.currentView.render()}detach(){this.element.remove()}show(){if(this.active)return;const{datepicker:e,element:t}=this,i=e.inputField;if(i){const n=Kr(i);n!==Kr(Gn(t))?t.dir=n:t.dir&&t.removeAttribute("dir"),this.place(),t.classList.add("active"),e.config.disableTouchKeyboard&&i.blur()}else t.classList.add("active");this.active=!0,Tr(e,"show")}hide(){this.active&&(this.datepicker.exitEditMode(),this.element.classList.remove("active"),this.active=!1,Tr(this.datepicker,"hide"))}place(){const{classList:e,style:t}=this.element;t.display="block";const{width:i,height:n}=this.element.getBoundingClientRect(),r=this.element.offsetParent;t.display="";const{config:s,inputField:o}=this.datepicker,{left:a,top:l,right:c,bottom:d,width:u,height:h}=o.getBoundingClientRect();let{x:p,y:f}=s.orientation,g=a,m=l;if(r!==document.body&&r){const e=r.getBoundingClientRect();g-=e.left-r.scrollLeft,m-=e.top-r.scrollTop}else g+=window.scrollX,m+=window.scrollY;const v=Ur(o);let b=0,y=0,{clientWidth:_,clientHeight:w}=document.documentElement;if(v){const e=v.getBoundingClientRect();e.top>0&&(y=e.top),e.left>0&&(b=e.left),e.right<_&&(_=e.right),e.bottom<w&&(w=e.bottom)}let E=0;"auto"===p&&(a<b?(p="left",E=b-a):a+i>_?(p="right",_<c&&(E=_-c)):p="rtl"===Kr(o)?c-i<b?"left":"right":"left"),"right"===p&&(g+=u-i),g+=E,"auto"===f&&(f=l-n>y&&d+n>w?"top":"bottom"),"top"===f?m-=n:m+=h,e.remove(...Object.values(Br)),e.add(Br[p],Br[f]),t.left=Vr(g),t.top=Vr(m)}setViewSwitchLabel(e){this.controls.viewSwitch.textContent=e}setPrevButtonDisabled(e){this.controls.prevButton.disabled=e}setNextButtonDisabled(e){this.controls.nextButton.disabled=e}changeView(e){const t=this.currentView;return e!==t.id&&(this._oldView||(this._oldView=t),this.currentView=this.views[e],this._renderMethod="render"),this}changeFocus(e){return this._renderMethod=Yr(this,e)?"render":"refreshFocus",this.views.forEach(e=>{e.updateFocus()}),this}update(e=void 0){const t=void 0===e?Wr(this.datepicker):e;return this._renderMethod=Yr(this,t)?"render":"refresh",this.views.forEach(e=>{e.updateFocus(),e.updateSelection()}),this}render(e=!0){const{currentView:t,datepicker:i,_oldView:n}=this,r=new Date(this._oldViewDate),s=e&&this._renderMethod||"render";if(delete this._oldView,delete this._oldViewDate,delete this._renderMethod,t[s](),n&&(this.main.replaceChild(t.element,n.element),Tr(i,"changeView")),!isNaN(r)){const e=new Date(this.viewDate);e.getFullYear()!==r.getFullYear()&&Tr(i,"changeYear"),e.getMonth()!==r.getMonth()&&Tr(i,"changeMonth")}}}function Qr(e,t,i,n,r,s){if(_n(e,r,s)){if(n(e)){return Qr(t(e,i),t,i,n,r,s)}return e}}function Gr(e,t,i){const n=e.picker,r=n.currentView,s=r.step||1;let o,a=n.viewDate;switch(r.id){case 0:a=Cn(a,i?7*t:t),o=Cn;break;case 1:a=Dn(a,i?4*t:t),o=Dn;break;default:a=xn(a,t*(i?4:1)*s),o=xn}a=Qr(a,o,t<0?-s:s,e=>r.disabled.includes(e),r.minDate,r.maxDate),void 0!==a&&n.changeFocus(a).render()}function Jr(e,t){const{config:i,picker:n,editMode:r}=e,s=n.active,{key:o,altKey:a,shiftKey:l}=t,c=t.ctrlKey||t.metaKey,d=()=>{t.preventDefault(),t.stopPropagation()};if("Tab"===o)return void Nr(e);if("Enter"===o){if(s)if(r)e.exitEditMode({update:!0,autohide:i.autohide});else{const t=n.currentView;t.isMinView?e.setDate(n.viewDate):(n.changeView(t.id-1).render(),d())}else e.update();return}const u=i.shortcutKeys,h={key:o,ctrlOrMetaKey:c,altKey:a,shiftKey:l},p=Object.keys(u).find(e=>{const t=u[e];return!Object.keys(t).find(e=>t[e]!==h[e])});if(p){let t;if("toggle"===p?t=p:r?"exitEditMode"===p&&(t=p):s?"hide"===p?t=p:"prevButton"===p?t=[Lr,[e,-1]]:"nextButton"===p?t=[Lr,[e,1]]:"viewSwitch"===p?t=[Ir,[e]]:i.clearButton&&"clearButton"===p?t=[Fr,[e]]:i.todayButton&&"todayButton"===p&&(t=[Mr,[e]]):"show"===p&&(t=p),t)return Array.isArray(t)?t[0].apply(null,t[1]):e[t](),void d()}if(!s||r)return;const f=(i,n)=>{l||c||a?e.enterEditMode():(Gr(e,i,n),t.preventDefault())};"ArrowLeft"===o?f(-1,!1):"ArrowRight"===o?f(1,!1):"ArrowUp"===o?f(-1,!0):"ArrowDown"===o?f(1,!0):("Backspace"===o||"Delete"===o||o&&1===o.length&&!c)&&e.enterEditMode()}function Zr(e){e.config.showOnFocus&&!e._showing&&e.show()}function es(e,t){const i=t.target;(e.picker.active||e.config.showOnClick)&&(i._active=Jn(i),i._clicking=setTimeout(()=>{delete i._active,delete i._clicking},2e3))}function ts(e,t){const i=t.target;i._clicking&&(clearTimeout(i._clicking),delete i._clicking,i._active&&e.enterEditMode(),delete i._active,e.config.showOnClick&&e.show())}function is(e,t){t.clipboardData.types.includes("text/plain")&&e.enterEditMode()}function ns(e,t){const{element:i,picker:n}=e;if(!n.active&&!Jn(i))return;const r=n.element;ar(t,e=>e===i||e===r)||Nr(e)}function rs(e,t){return e.map(e=>Un(e,t.format,t.locale)).join(t.dateDelimiter)}function ss(e,t,i=!1){if(0===t.length)return i?[]:void 0;const{config:n,dates:r,rangeSideIndex:s}=e,{pickLevel:o,maxNumberOfDates:a}=n;let l=t.reduce((e,t)=>{let i=Kn(t,n.format,n.locale);return void 0===i||(i=$n(i,o,s),!_n(i,n.minDate,n.maxDate)||e.includes(i)||n.checkDisabled(i,o)||!(o>0)&&n.daysOfWeekDisabled.includes(new Date(i).getDay())||e.push(i)),e},[]);return 0!==l.length?(n.multidate&&!i&&(l=l.reduce((e,t)=>(r.includes(t)||e.push(t),e),r.filter(e=>!l.includes(e)))),a&&l.length>a?l.slice(-1*a):l):void 0}function os(e,t=3,i=!0,n=void 0){const{config:r,picker:s,inputField:o}=e;if(2&t){const e=s.active?r.pickLevel:r.startView;s.update(n).changeView(e).render(i)}1&t&&o&&(o.value=rs(e.dates,r))}function as(e,t,i){const n=e.config;let{clear:r,render:s,autohide:o,revert:a,forceRefresh:l,viewDate:c}=i;void 0===s&&(s=!0),s?void 0===o&&(o=n.autohide):o=l=!1,c=Kn(c,n.format,n.locale);const d=ss(e,t,r);(d||a)&&(d&&d.toString()!==e.dates.toString()?(e.dates=d,os(e,s?3:1,!0,c),Tr(e,"changeDate")):os(e,l?3:1,!0,c),o&&e.hide())}function ls(e,t){return t?i=>Un(i,t,e.config.locale):e=>new Date(e)}class cs{constructor(e,t={},i=void 0){e.datepicker=this,this.element=e,this.dates=[];const n=this.config=Object.assign({buttonClass:t.buttonClass&&String(t.buttonClass)||"button",container:null,defaultViewDate:kn(),maxDate:void 0,minDate:void 0},yr(cr,this));let r;if("INPUT"===e.tagName?(r=this.inputField=e,r.classList.add("datepicker-input"),t.container&&(n.container=t.container instanceof HTMLElement?t.container:document.querySelector(t.container))):n.container=e,i){const e=i.inputs.indexOf(r),t=i.datepickers;if(e<0||e>1||!Array.isArray(t))throw Error("Invalid rangepicker object.");t[e]=this,this.rangepicker=i,this.rangeSideIndex=e}this._options=t,Object.assign(n,yr(t,this)),n.shortcutKeys=function(e){return Object.keys(_r).reduce((t,i)=>{const n=void 0===e[i]?_r[i]:e[i],r=n&&n.key;if(!r||"string"!=typeof r)return t;const s={key:r,ctrlOrMetaKey:!!(n.ctrlOrMetaKey||n.ctrlKey||n.metaKey)};return r.length>1&&(s.altKey=!!n.altKey,s.shiftKey=!!n.shiftKey),t[i]=s,t},{})}(t.shortcutKeys||{});const s=yn(e.value||e.dataset.date,n.dateDelimiter);delete e.dataset.date;const o=ss(this,s);o&&o.length>0&&(this.dates=o),r&&(r.value=rs(this.dates,n));const a=this.picker=new Xr(this),l=[e,"keydown",Jr.bind(null,this)];r?sr(this,[l,[r,"focus",Zr.bind(null,this)],[r,"mousedown",es.bind(null,this)],[r,"click",ts.bind(null,this)],[r,"paste",is.bind(null,this)],[document,"mousedown",ns.bind(null,this)],[window,"resize",a.place.bind(a)]]):(sr(this,[l]),this.show())}static formatDate(e,t,i){return Un(e,t,i&&lr[i]||lr.en)}static parseDate(e,t,i){return Kn(e,t,i&&lr[i]||lr.en)}static get locales(){return lr}get active(){return!(!this.picker||!this.picker.active)}get pickerElement(){return this.picker?this.picker.element:void 0}setOptions(e){const t=yr(e,this);Object.assign(this._options,e),Object.assign(this.config,t),this.picker.setOptions(t),os(this,3)}show(){if(this.inputField){const{config:e,inputField:t}=this;if(t.disabled||t.readOnly&&!e.enableOnReadonly)return;Jn(t)||e.disableTouchKeyboard||(this._showing=!0,t.focus(),delete this._showing)}this.picker.show()}hide(){this.inputField&&(this.picker.hide(),this.picker.update().changeView(this.config.startView).render())}toggle(){this.picker.active?this.inputField&&this.picker.hide():this.show()}destroy(){this.hide(),function(e){let t=ir.get(e);t&&(t.forEach(e=>{rr.call(...e)}),ir.delete(e))}(this),this.picker.detach();const e=this.element;return e.classList.remove("datepicker-input"),delete e.datepicker,this}getDate(e=void 0){const t=ls(this,e);return this.config.multidate?this.dates.map(t):this.dates.length>0?t(this.dates[0]):void 0}setDate(...e){const t=[...e],i={},n=vn(e);!n||"object"!=typeof n||Array.isArray(n)||n instanceof Date||Object.assign(i,t.pop());as(this,Array.isArray(t[0])?t[0]:t,i)}update(e=void 0){if(!this.inputField)return;const t=Object.assign(e||{},{clear:!0,render:!0,viewDate:void 0});as(this,yn(this.inputField.value,this.config.dateDelimiter),t)}getFocusedDate(e=void 0){return ls(this,e)(this.picker.viewDate)}setFocusedDate(e,t=!1){const{config:i,picker:n,active:r,rangeSideIndex:s}=this,o=i.pickLevel,a=Kn(e,i.format,i.locale);void 0!==a&&(n.changeFocus($n(a,o,s)),r&&t&&n.changeView(o),n.render())}refresh(e=void 0,t=!1){let i;e&&"string"!=typeof e&&(t=e,e=void 0),i="picker"===e?2:"input"===e?1:3,os(this,i,!t)}enterEditMode(){const e=this.inputField;e&&!e.readOnly&&this.picker.active&&!this.editMode&&(this.editMode=!0,e.classList.add("in-edit"))}exitEditMode(e=void 0){if(!this.inputField||!this.editMode)return;const t=Object.assign({update:!1},e);delete this.editMode,this.inputField.classList.remove("in-edit"),t.update&&this.update(t)}}class ds{constructor(e={}){this.opts=e}initDatepickers(e){e.forEach(e=>{const t="function"==typeof this.opts?this.opts(e):this.opts;new cs(e,{...t,updateOnBlur:!1}),e.addEventListener("changeDate",()=>{const t=e.closest("form");t&&t.submit()})})}}class us extends EventTarget{constructor(e,t,i){super(),this.el=e,this.options={...us.defaultOptions,...i};const n=this.resolveDatagridName();if(!n)throw new Error("Cannot resolve name of a datagrid!");this.name=n,this.ajax="function"==typeof t?t(this):t,this.ajax.addEventListener("success",e=>{var t,i;(null===(t=e.detail.payload)||void 0===t?void 0:t._datagrid_name)===this.name&&(null===(i=e.detail.payload)||void 0===i?void 0:i._datagrid_init)&&this.init()}),this.init()}init(){!this.dispatch("beforeInit",{datagrid:this})||this.options.plugins.forEach(e=>{var t;null===(t=e.onDatagridInit)||void 0===t||t.call(e,this)});const e=this.el.querySelectorAll("input[data-check]:checked");if(1===e.length&&"toggle-all"===e[0].getAttribute("name")){const t=e[0];t&&(t.checked=!1)}this.el.querySelectorAll("input[data-datagrid-manualsubmit]").forEach(e=>{const t=e.closest("form");t&&e.addEventListener("keydown",e=>{if(_(e))return e.stopPropagation(),e.preventDefault(),this.ajax.submitForm(t)})}),this.ajax.addEventListener("success",({detail:{payload:e}})=>{var t;if(e._datagrid_name&&e._datagrid_name===this.name){const i=e=>e.getAttribute("data-datagrid-reset-filter-by-column"),n=Array.from(this.el.querySelectorAll("[data-datagrid-reset-filter-by-column]")),r=e.non_empty_filters?e.non_empty_filters:[];if(n.forEach(e=>{const t=i(e);t&&r.includes(t)?e.classList.remove("hidden"):e.classList.add("hidden")}),r.length>0){const e=null===(t=this.el.querySelector(".reset-filter"))||void 0===t?void 0:t.getAttribute("href");e&&n.forEach(t=>{const n=i(t),r=e.replace("-resetFilter","-resetColumnFilter");t.setAttribute("href",`${r}&${this.name}-key=${n}`)})}}}),this.dispatch("afterInit",{datagrid:this})}confirm(e){return this.options.confirm.bind(this)(e)}resolveDatagridName(){return this.options.resolveDatagridName.bind(this)(this.el)}dispatch(e,t,i){return this.dispatchEvent(new CustomEvent(e,{detail:t}))}}us.defaultOptions={confirm:confirm,resolveDatagridName:function(e){const t=e.getAttribute("data-datagrid-name");if(t)return t;console.warn("Deprecated name resolution for datagrid",e,": Please add a data-datagrid-name attribute instead!\nCurrently, the Datagrid library relies on matching the name from the 'datagrid-[name]' class, which is unreliable and may cause bugs if the default class names are not used (eg. if you add a datagrid-xx class, or change the name class completely!)\nAlternatively, you can customize the name resolution with the `resolveDatagridName` option. See TBD for more info.");const i=e.classList.value.split(" ");for(const e of i){if(!e.startsWith("datagrid-"))continue;const[,...t]=e.split("-"),i=t.join("-");return i.length<1?(console.error(`Failed to resolve datagrid name - ambigious class name '${e}'`),null):i}return null},plugins:[]};class hs{constructor(e,t={}){this.ajax=e,this.datagrids=[],this.options={selector:"div[data-datagrid-name]",datagrid:{},root:document.body,...t};const i="string"==typeof this.options.root?document.querySelector(this.options.root):this.options.root;if(!(i&&i instanceof HTMLElement))throw new Error("Root element not found or is not an HTMLElement");this.root=i,this.init()}init(){var e,t;this.ajax.onInit(),(null!==(t=null===(e=this.options.datagrid)||void 0===e?void 0:e.plugins)&&void 0!==t?t:[]).forEach(e=>{var t;return null===(t=e.onInit)||void 0===t?void 0:t.call(e,this)}),this.initDatagrids()}initDatagrids(){this.datagrids=Array.from(this.root.querySelectorAll(this.options.selector)).map(e=>new us(e,this.ajax,this.options.datagrid))}}class ps extends EventTarget{constructor(e){if(!e.VERSION||e.VERSION<2)throw new Error("NajaAjax supports Naja 2 and higher"+(e.VERSION?`(version ${e.VERSION} provided)`:""));super(),this.client=e}onInit(){return this.client.addEventListener("before",e=>this.dispatch("before",{params:e.detail})),this.client.uiHandler.addEventListener("interaction",e=>{if(!(e.detail.element instanceof HTMLElement))throw new Error("Element is not an instanceof HTMLElement");const t=this.dispatch("interact",{...e.detail,element:e.detail.element});return t||(e.stopPropagation(),e.preventDefault()),t}),this.client.addEventListener("success",e=>this.dispatch("success",{...e.detail,params:e.detail.request,payload:e.detail.payload})),this.client.addEventListener("error",e=>this.dispatch("error",{...e.detail,params:e.detail.request,response:e.detail.response})),this.client.addEventListener("complete",e=>this.dispatch("complete",{...e.detail,params:e.detail.request,response:e.detail.response})),this}async request(e){return await this.client.makeRequest(e.method,e.url,e.data)}async submitForm(e){return await this.client.uiHandler.submitForm(e)}dispatch(e,t,i){return this.dispatchEvent(new CustomEvent(e,{detail:t,cancelable:!0}))}}var fs="top",gs="bottom",ms="right",vs="left",bs="auto",ys=[fs,gs,ms,vs],_s="start",ws="end",Es="clippingParents",As="viewport",Ss="popper",ks="reference",Os=ys.reduce(function(e,t){return e.concat([t+"-"+_s,t+"-"+ws])},[]),Cs=[].concat(ys,[bs]).reduce(function(e,t){return e.concat([t,t+"-"+_s,t+"-"+ws])},[]),Ds="beforeRead",xs="read",Ts="afterRead",Ls="beforeMain",Is="main",Fs="afterMain",Ms="beforeWrite",Ns="write",js="afterWrite",Ps=[Ds,xs,Ts,Ls,Is,Fs,Ms,Ns,js];function $s(e){return e?(e.nodeName||"").toLowerCase():null}function Hs(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function qs(e){return e instanceof Hs(e).Element||e instanceof Element}function Rs(e){return e instanceof Hs(e).HTMLElement||e instanceof HTMLElement}function Bs(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Hs(e).ShadowRoot||e instanceof ShadowRoot)}var Vs={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var i=t.styles[e]||{},n=t.attributes[e]||{},r=t.elements[e];Rs(r)&&$s(r)&&(Object.assign(r.style,i),Object.keys(n).forEach(function(e){var t=n[e];!1===t?r.removeAttribute(e):r.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(e){var n=t.elements[e],r=t.attributes[e]||{},s=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:i[e]).reduce(function(e,t){return e[t]="",e},{});Rs(n)&&$s(n)&&(Object.assign(n.style,s),Object.keys(r).forEach(function(e){n.removeAttribute(e)}))})}},requires:["computeStyles"]};function zs(e){return e.split("-")[0]}var Ws=Math.max,Ys=Math.min,Ks=Math.round;function Us(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Xs(){return!/^((?!chrome|android).)*safari/i.test(Us())}function Qs(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=!1);var n=e.getBoundingClientRect(),r=1,s=1;t&&Rs(e)&&(r=e.offsetWidth>0&&Ks(n.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Ks(n.height)/e.offsetHeight||1);var o=(qs(e)?Hs(e):window).visualViewport,a=!Xs()&&i,l=(n.left+(a&&o?o.offsetLeft:0))/r,c=(n.top+(a&&o?o.offsetTop:0))/s,d=n.width/r,u=n.height/s;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l,x:l,y:c}}function Gs(e){var t=Qs(e),i=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:n}}function Js(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&Bs(i)){var n=t;do{if(n&&e.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Zs(e){return Hs(e).getComputedStyle(e)}function eo(e){return["table","td","th"].indexOf($s(e))>=0}function to(e){return((qs(e)?e.ownerDocument:e.document)||window.document).documentElement}function io(e){return"html"===$s(e)?e:e.assignedSlot||e.parentNode||(Bs(e)?e.host:null)||to(e)}function no(e){return Rs(e)&&"fixed"!==Zs(e).position?e.offsetParent:null}function ro(e){for(var t=Hs(e),i=no(e);i&&eo(i)&&"static"===Zs(i).position;)i=no(i);return i&&("html"===$s(i)||"body"===$s(i)&&"static"===Zs(i).position)?t:i||function(e){var t=/firefox/i.test(Us());if(/Trident/i.test(Us())&&Rs(e)&&"fixed"===Zs(e).position)return null;var i=io(e);for(Bs(i)&&(i=i.host);Rs(i)&&["html","body"].indexOf($s(i))<0;){var n=Zs(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||t&&"filter"===n.willChange||t&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(e)||t}function so(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function oo(e,t,i){return Ws(e,Ys(t,i))}function ao(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function lo(e,t){return t.reduce(function(t,i){return t[i]=e,t},{})}var co={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,i=e.state,n=e.name,r=e.options,s=i.elements.arrow,o=i.modifiersData.popperOffsets,a=zs(i.placement),l=so(a),c=[vs,ms].indexOf(a)>=0?"height":"width";if(s&&o){var d=function(e,t){return ao("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:lo(e,ys))}(r.padding,i),u=Gs(s),h="y"===l?fs:vs,p="y"===l?gs:ms,f=i.rects.reference[c]+i.rects.reference[l]-o[l]-i.rects.popper[c],g=o[l]-i.rects.reference[l],m=ro(s),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=f/2-g/2,y=d[h],_=v-u[c]-d[p],w=v/2-u[c]/2+b,E=oo(y,w,_),A=l;i.modifiersData[n]=((t={})[A]=E,t.centerOffset=E-w,t)}},effect:function(e){var t=e.state,i=e.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=t.elements.popper.querySelector(n)))&&Js(t.elements.popper,n)&&(t.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function uo(e){return e.split("-")[1]}var ho={top:"auto",right:"auto",bottom:"auto",left:"auto"};function po(e){var t,i=e.popper,n=e.popperRect,r=e.placement,s=e.variation,o=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,u=e.isFixed,h=o.x,p=void 0===h?0:h,f=o.y,g=void 0===f?0:f,m="function"==typeof d?d({x:p,y:g}):{x:p,y:g};p=m.x,g=m.y;var v=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),y=vs,_=fs,w=window;if(c){var E=ro(i),A="clientHeight",S="clientWidth";if(E===Hs(i)&&"static"!==Zs(E=to(i)).position&&"absolute"===a&&(A="scrollHeight",S="scrollWidth"),r===fs||(r===vs||r===ms)&&s===ws)_=gs,g-=(u&&E===w&&w.visualViewport?w.visualViewport.height:E[A])-n.height,g*=l?1:-1;if(r===vs||(r===fs||r===gs)&&s===ws)y=ms,p-=(u&&E===w&&w.visualViewport?w.visualViewport.width:E[S])-n.width,p*=l?1:-1}var k,O=Object.assign({position:a},c&&ho),C=!0===d?function(e,t){var i=e.x,n=e.y,r=t.devicePixelRatio||1;return{x:Ks(i*r)/r||0,y:Ks(n*r)/r||0}}({x:p,y:g},Hs(i)):{x:p,y:g};return p=C.x,g=C.y,l?Object.assign({},O,((k={})[_]=b?"0":"",k[y]=v?"0":"",k.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",k)):Object.assign({},O,((t={})[_]=b?g+"px":"",t[y]=v?p+"px":"",t.transform="",t))}var fo={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,i=e.options,n=i.gpuAcceleration,r=void 0===n||n,s=i.adaptive,o=void 0===s||s,a=i.roundOffsets,l=void 0===a||a,c={placement:zs(t.placement),variation:uo(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,po(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,po(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},go={passive:!0};var mo={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,i=e.instance,n=e.options,r=n.scroll,s=void 0===r||r,o=n.resize,a=void 0===o||o,l=Hs(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&c.forEach(function(e){e.addEventListener("scroll",i.update,go)}),a&&l.addEventListener("resize",i.update,go),function(){s&&c.forEach(function(e){e.removeEventListener("scroll",i.update,go)}),a&&l.removeEventListener("resize",i.update,go)}},data:{}},vo={left:"right",right:"left",bottom:"top",top:"bottom"};function bo(e){return e.replace(/left|right|bottom|top/g,function(e){return vo[e]})}var yo={start:"end",end:"start"};function _o(e){return e.replace(/start|end/g,function(e){return yo[e]})}function wo(e){var t=Hs(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Eo(e){return Qs(to(e)).left+wo(e).scrollLeft}function Ao(e){var t=Zs(e),i=t.overflow,n=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+r+n)}function So(e){return["html","body","#document"].indexOf($s(e))>=0?e.ownerDocument.body:Rs(e)&&Ao(e)?e:So(io(e))}function ko(e,t){var i;void 0===t&&(t=[]);var n=So(e),r=n===(null==(i=e.ownerDocument)?void 0:i.body),s=Hs(n),o=r?[s].concat(s.visualViewport||[],Ao(n)?n:[]):n,a=t.concat(o);return r?a:a.concat(ko(io(o)))}function Oo(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Co(e,t,i){return t===As?Oo(function(e,t){var i=Hs(e),n=to(e),r=i.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;var c=Xs();(c||!c&&"fixed"===t)&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a+Eo(e),y:l}}(e,i)):qs(t)?function(e,t){var i=Qs(e,!1,"fixed"===t);return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}(t,i):Oo(function(e){var t,i=to(e),n=wo(e),r=null==(t=e.ownerDocument)?void 0:t.body,s=Ws(i.scrollWidth,i.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=Ws(i.scrollHeight,i.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-n.scrollLeft+Eo(e),l=-n.scrollTop;return"rtl"===Zs(r||i).direction&&(a+=Ws(i.clientWidth,r?r.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}(to(e)))}function Do(e,t,i,n){var r="clippingParents"===t?function(e){var t=ko(io(e)),i=["absolute","fixed"].indexOf(Zs(e).position)>=0&&Rs(e)?ro(e):e;return qs(i)?t.filter(function(e){return qs(e)&&Js(e,i)&&"body"!==$s(e)}):[]}(e):[].concat(t),s=[].concat(r,[i]),o=s[0],a=s.reduce(function(t,i){var r=Co(e,i,n);return t.top=Ws(r.top,t.top),t.right=Ys(r.right,t.right),t.bottom=Ys(r.bottom,t.bottom),t.left=Ws(r.left,t.left),t},Co(e,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function xo(e){var t,i=e.reference,n=e.element,r=e.placement,s=r?zs(r):null,o=r?uo(r):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(s){case fs:t={x:a,y:i.y-n.height};break;case gs:t={x:a,y:i.y+i.height};break;case ms:t={x:i.x+i.width,y:l};break;case vs:t={x:i.x-n.width,y:l};break;default:t={x:i.x,y:i.y}}var c=s?so(s):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case _s:t[c]=t[c]-(i[d]/2-n[d]/2);break;case ws:t[c]=t[c]+(i[d]/2-n[d]/2)}}return t}function To(e,t){void 0===t&&(t={});var i=t,n=i.placement,r=void 0===n?e.placement:n,s=i.strategy,o=void 0===s?e.strategy:s,a=i.boundary,l=void 0===a?Es:a,c=i.rootBoundary,d=void 0===c?As:c,u=i.elementContext,h=void 0===u?Ss:u,p=i.altBoundary,f=void 0!==p&&p,g=i.padding,m=void 0===g?0:g,v=ao("number"!=typeof m?m:lo(m,ys)),b=h===Ss?ks:Ss,y=e.rects.popper,_=e.elements[f?b:h],w=Do(qs(_)?_:_.contextElement||to(e.elements.popper),l,d,o),E=Qs(e.elements.reference),A=xo({reference:E,element:y,placement:r}),S=Oo(Object.assign({},y,A)),k=h===Ss?S:E,O={top:w.top-k.top+v.top,bottom:k.bottom-w.bottom+v.bottom,left:w.left-k.left+v.left,right:k.right-w.right+v.right},C=e.modifiersData.offset;if(h===Ss&&C){var D=C[r];Object.keys(O).forEach(function(e){var t=[ms,gs].indexOf(e)>=0?1:-1,i=[fs,gs].indexOf(e)>=0?"y":"x";O[e]+=D[i]*t})}return O}function Lo(e,t){void 0===t&&(t={});var i=t,n=i.placement,r=i.boundary,s=i.rootBoundary,o=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?Cs:l,d=uo(n),u=d?a?Os:Os.filter(function(e){return uo(e)===d}):ys,h=u.filter(function(e){return c.indexOf(e)>=0});0===h.length&&(h=u);var p=h.reduce(function(t,i){return t[i]=To(e,{placement:i,boundary:r,rootBoundary:s,padding:o})[zs(i)],t},{});return Object.keys(p).sort(function(e,t){return p[e]-p[t]})}var Io={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,i=e.options,n=e.name;if(!t.modifiersData[n]._skip){for(var r=i.mainAxis,s=void 0===r||r,o=i.altAxis,a=void 0===o||o,l=i.fallbackPlacements,c=i.padding,d=i.boundary,u=i.rootBoundary,h=i.altBoundary,p=i.flipVariations,f=void 0===p||p,g=i.allowedAutoPlacements,m=t.options.placement,v=zs(m),b=l||(v===m||!f?[bo(m)]:function(e){if(zs(e)===bs)return[];var t=bo(e);return[_o(e),t,_o(t)]}(m)),y=[m].concat(b).reduce(function(e,i){return e.concat(zs(i)===bs?Lo(t,{placement:i,boundary:d,rootBoundary:u,padding:c,flipVariations:f,allowedAutoPlacements:g}):i)},[]),_=t.rects.reference,w=t.rects.popper,E=new Map,A=!0,S=y[0],k=0;k<y.length;k++){var O=y[k],C=zs(O),D=uo(O)===_s,x=[fs,gs].indexOf(C)>=0,T=x?"width":"height",L=To(t,{placement:O,boundary:d,rootBoundary:u,altBoundary:h,padding:c}),I=x?D?ms:vs:D?gs:fs;_[T]>w[T]&&(I=bo(I));var F=bo(I),M=[];if(s&&M.push(L[C]<=0),a&&M.push(L[I]<=0,L[F]<=0),M.every(function(e){return e})){S=O,A=!1;break}E.set(O,M)}if(A)for(var N=function(e){var t=y.find(function(t){var i=E.get(t);if(i)return i.slice(0,e).every(function(e){return e})});if(t)return S=t,"break"},j=f?3:1;j>0;j--){if("break"===N(j))break}t.placement!==S&&(t.modifiersData[n]._skip=!0,t.placement=S,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Fo(e,t,i){return void 0===i&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function Mo(e){return[fs,ms,gs,vs].some(function(t){return e[t]>=0})}var No={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,i=e.name,n=t.rects.reference,r=t.rects.popper,s=t.modifiersData.preventOverflow,o=To(t,{elementContext:"reference"}),a=To(t,{altBoundary:!0}),l=Fo(o,n),c=Fo(a,r,s),d=Mo(l),u=Mo(c);t.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}};var jo={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,i=e.options,n=e.name,r=i.offset,s=void 0===r?[0,0]:r,o=Cs.reduce(function(e,i){return e[i]=function(e,t,i){var n=zs(e),r=[vs,fs].indexOf(n)>=0?-1:1,s="function"==typeof i?i(Object.assign({},t,{placement:e})):i,o=s[0],a=s[1];return o=o||0,a=(a||0)*r,[vs,ms].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}(i,t.rects,s),e},{}),a=o[t.placement],l=a.x,c=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[n]=o}};var Po={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,i=e.name;t.modifiersData[i]=xo({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})},data:{}};var $o={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,i=e.options,n=e.name,r=i.mainAxis,s=void 0===r||r,o=i.altAxis,a=void 0!==o&&o,l=i.boundary,c=i.rootBoundary,d=i.altBoundary,u=i.padding,h=i.tether,p=void 0===h||h,f=i.tetherOffset,g=void 0===f?0:f,m=To(t,{boundary:l,rootBoundary:c,padding:u,altBoundary:d}),v=zs(t.placement),b=uo(t.placement),y=!b,_=so(v),w="x"===_?"y":"x",E=t.modifiersData.popperOffsets,A=t.rects.reference,S=t.rects.popper,k="function"==typeof g?g(Object.assign({},t.rects,{placement:t.placement})):g,O="number"==typeof k?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),C=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,D={x:0,y:0};if(E){if(s){var x,T="y"===_?fs:vs,L="y"===_?gs:ms,I="y"===_?"height":"width",F=E[_],M=F+m[T],N=F-m[L],j=p?-S[I]/2:0,P=b===_s?A[I]:S[I],$=b===_s?-S[I]:-A[I],H=t.elements.arrow,q=p&&H?Gs(H):{width:0,height:0},R=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},B=R[T],V=R[L],z=oo(0,A[I],q[I]),W=y?A[I]/2-j-z-B-O.mainAxis:P-z-B-O.mainAxis,Y=y?-A[I]/2+j+z+V+O.mainAxis:$+z+V+O.mainAxis,K=t.elements.arrow&&ro(t.elements.arrow),U=K?"y"===_?K.clientTop||0:K.clientLeft||0:0,X=null!=(x=null==C?void 0:C[_])?x:0,Q=F+Y-X,G=oo(p?Ys(M,F+W-X-U):M,F,p?Ws(N,Q):N);E[_]=G,D[_]=G-F}if(a){var J,Z="x"===_?fs:vs,ee="x"===_?gs:ms,te=E[w],ie="y"===w?"height":"width",ne=te+m[Z],re=te-m[ee],se=-1!==[fs,vs].indexOf(v),oe=null!=(J=null==C?void 0:C[w])?J:0,ae=se?ne:te-A[ie]-S[ie]-oe+O.altAxis,le=se?te+A[ie]+S[ie]-oe-O.altAxis:re,ce=p&&se?function(e,t,i){var n=oo(e,t,i);return n>i?i:n}(ae,te,le):oo(p?ae:ne,te,p?le:re);E[w]=ce,D[w]=ce-te}t.modifiersData[n]=D}},requiresIfExists:["offset"]};function Ho(e,t,i){void 0===i&&(i=!1);var n,r,s=Rs(t),o=Rs(t)&&function(e){var t=e.getBoundingClientRect(),i=Ks(t.width)/e.offsetWidth||1,n=Ks(t.height)/e.offsetHeight||1;return 1!==i||1!==n}(t),a=to(t),l=Qs(e,o,i),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(s||!s&&!i)&&(("body"!==$s(t)||Ao(a))&&(c=(n=t)!==Hs(n)&&Rs(n)?{scrollLeft:(r=n).scrollLeft,scrollTop:r.scrollTop}:wo(n)),Rs(t)?((d=Qs(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):a&&(d.x=Eo(a))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function qo(e){var t=new Map,i=new Set,n=[];function r(e){i.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!i.has(e)){var n=t.get(e);n&&r(n)}}),n.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){i.has(e.name)||r(e)}),n}var Ro={placement:"bottom",modifiers:[],strategy:"absolute"};function Bo(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}function Vo(e){void 0===e&&(e={});var t=e,i=t.defaultModifiers,n=void 0===i?[]:i,r=t.defaultOptions,s=void 0===r?Ro:r;return function(e,t,i){void 0===i&&(i=s);var r,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ro,s),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,d={state:a,setOptions:function(i){var r="function"==typeof i?i(a.options):i;u(),a.options=Object.assign({},s,a.options,r),a.scrollParents={reference:qs(e)?ko(e):e.contextElement?ko(e.contextElement):[],popper:ko(t)};var o,c,h=function(e){var t=qo(e);return Ps.reduce(function(e,i){return e.concat(t.filter(function(e){return e.phase===i}))},[])}((o=[].concat(n,a.options.modifiers),c=o.reduce(function(e,t){var i=e[t.name];return e[t.name]=i?Object.assign({},i,t,{options:Object.assign({},i.options,t.options),data:Object.assign({},i.data,t.data)}):t,e},{}),Object.keys(c).map(function(e){return c[e]})));return a.orderedModifiers=h.filter(function(e){return e.enabled}),a.orderedModifiers.forEach(function(e){var t=e.name,i=e.options,n=void 0===i?{}:i,r=e.effect;if("function"==typeof r){var s=r({state:a,name:t,instance:d,options:n}),o=function(){};l.push(s||o)}}),d.update()},forceUpdate:function(){if(!c){var e=a.elements,t=e.reference,i=e.popper;if(Bo(t,i)){a.rects={reference:Ho(t,ro(i),"fixed"===a.options.strategy),popper:Gs(i)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(e){return a.modifiersData[e.name]=Object.assign({},e.data)});for(var n=0;n<a.orderedModifiers.length;n++)if(!0!==a.reset){var r=a.orderedModifiers[n],s=r.fn,o=r.options,l=void 0===o?{}:o,u=r.name;"function"==typeof s&&(a=s({state:a,options:l,name:u,instance:d})||a)}else a.reset=!1,n=-1}}},update:(r=function(){return new Promise(function(e){d.forceUpdate(),e(a)})},function(){return o||(o=new Promise(function(e){Promise.resolve().then(function(){o=void 0,e(r())})})),o}),destroy:function(){u(),c=!0}};if(!Bo(e,t))return d;function u(){l.forEach(function(e){return e()}),l=[]}return d.setOptions(i).then(function(e){!c&&i.onFirstUpdate&&i.onFirstUpdate(e)}),d}}var zo=Vo(),Wo=Vo({defaultModifiers:[mo,Po,fo,Vs]}),Yo=Vo({defaultModifiers:[mo,Po,fo,Vs,jo,Io,$o,co,No]}),Ko=Object.freeze({__proto__:null,afterMain:Fs,afterRead:Ts,afterWrite:js,applyStyles:Vs,arrow:co,auto:bs,basePlacements:ys,beforeMain:Ls,beforeRead:Ds,beforeWrite:Ms,bottom:gs,clippingParents:Es,computeStyles:fo,createPopper:Yo,createPopperBase:zo,createPopperLite:Wo,detectOverflow:To,end:ws,eventListeners:mo,flip:Io,hide:No,left:vs,main:Is,modifierPhases:Ps,offset:jo,placements:Cs,popper:Ss,popperGenerator:Vo,popperOffsets:Po,preventOverflow:$o,read:xs,reference:ks,right:ms,start:_s,top:fs,variationPlacements:Os,viewport:As,write:Ns});
14
14
  /*!
15
15
  * Bootstrap v5.3.7 (https://getbootstrap.com/)
16
16
  * Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
17
17
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
18
18
  */
19
- const Qo=new Map,Go={set(t,e,i){Qo.has(t)||Qo.set(t,new Map);const n=Qo.get(t);n.has(e)||0===n.size?n.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(t,e)=>Qo.has(t)&&Qo.get(t).get(e)||null,remove(t,e){if(!Qo.has(t))return;const i=Qo.get(t);i.delete(e),0===i.size&&Qo.delete(t)}},Jo="transitionend",Zo=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,(t,e)=>`#${CSS.escape(e)}`)),t),ta=t=>null==t?`${t}`:Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase(),ea=t=>{t.dispatchEvent(new Event(Jo))},ia=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),na=t=>ia(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(Zo(t)):null,ra=t=>{if(!ia(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},sa=t=>!t||t.nodeType!==Node.ELEMENT_NODE||(!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled"))),oa=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?oa(t.parentNode):null},aa=()=>{},la=t=>{t.offsetHeight},ca=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,da=[],ua=()=>"rtl"===document.documentElement.dir,ha=t=>{var e;e=()=>{const e=ca();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface)}},"loading"===document.readyState?(da.length||document.addEventListener("DOMContentLoaded",()=>{for(const t of da)t()}),da.push(e)):e()},pa=(t,e=[],i=t)=>"function"==typeof t?t.call(...e):i,fa=(t,e,i=!0)=>{if(!i)return void pa(t);const n=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),r=Number.parseFloat(i);return n||r?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(e)+5;let r=!1;const s=({target:i})=>{i===e&&(r=!0,e.removeEventListener(Jo,s),pa(t))};e.addEventListener(Jo,s),setTimeout(()=>{r||ea(e)},n)},ga=(t,e,i,n)=>{const r=t.length;let s=t.indexOf(e);return-1===s?!i&&n?t[r-1]:t[0]:(s+=i?1:-1,n&&(s=(s+r)%r),t[Math.max(0,Math.min(s,r-1))])},ma=/[^.]*(?=\..*)\.|.*/,va=/\..*/,ba=/::\d+$/,ya={};let _a=1;const wa={mouseenter:"mouseover",mouseleave:"mouseout"},Ea=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function Aa(t,e){return e&&`${e}::${_a++}`||t.uidEvent||_a++}function ka(t){const e=Aa(t);return t.uidEvent=e,ya[e]=ya[e]||{},ya[e]}function Sa(t,e,i=null){return Object.values(t).find(t=>t.callable===e&&t.delegationSelector===i)}function Ca(t,e,i){const n="string"==typeof e,r=n?i:e||i;let s=Ta(t);return Ea.has(s)||(s=t),[n,r,s]}function Oa(t,e,i,n,r){if("string"!=typeof e||!t)return;let[s,o,a]=Ca(e,i,n);if(e in wa){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};o=t(o)}const l=ka(t),c=l[a]||(l[a]={}),d=Sa(c,o,s?i:null);if(d)return void(d.oneOff=d.oneOff&&r);const u=Aa(o,e.replace(ma,"")),h=s?function(t,e,i){return function n(r){const s=t.querySelectorAll(e);for(let{target:o}=r;o&&o!==this;o=o.parentNode)for(const a of s)if(a===o)return Ia(r,{delegateTarget:o}),n.oneOff&&La.off(t,r.type,e,i),i.apply(o,[r])}}(t,i,o):function(t,e){return function i(n){return Ia(n,{delegateTarget:t}),i.oneOff&&La.off(t,n.type,e),e.apply(t,[n])}}(t,o);h.delegationSelector=s?i:null,h.callable=o,h.oneOff=r,h.uidEvent=u,c[u]=h,t.addEventListener(a,h,s)}function Da(t,e,i,n,r){const s=Sa(e[i],n,r);s&&(t.removeEventListener(i,s,Boolean(r)),delete e[i][s.uidEvent])}function xa(t,e,i,n){const r=e[i]||{};for(const[s,o]of Object.entries(r))s.includes(n)&&Da(t,e,i,o.callable,o.delegationSelector)}function Ta(t){return t=t.replace(va,""),wa[t]||t}const La={on(t,e,i,n){Oa(t,e,i,n,!1)},one(t,e,i,n){Oa(t,e,i,n,!0)},off(t,e,i,n){if("string"!=typeof e||!t)return;const[r,s,o]=Ca(e,i,n),a=o!==e,l=ka(t),c=l[o]||{},d=e.startsWith(".");if(void 0===s){if(d)for(const i of Object.keys(l))xa(t,l,i,e.slice(1));for(const[i,n]of Object.entries(c)){const r=i.replace(ba,"");a&&!e.includes(r)||Da(t,l,o,n.callable,n.delegationSelector)}}else{if(!Object.keys(c).length)return;Da(t,l,o,s,r?i:null)}},trigger(t,e,i){if("string"!=typeof e||!t)return null;const n=ca();let r=null,s=!0,o=!0,a=!1;e!==Ta(e)&&n&&(r=n.Event(e,i),n(t).trigger(r),s=!r.isPropagationStopped(),o=!r.isImmediatePropagationStopped(),a=r.isDefaultPrevented());const l=Ia(new Event(e,{bubbles:s,cancelable:!0}),i);return a&&l.preventDefault(),o&&t.dispatchEvent(l),l.defaultPrevented&&r&&r.preventDefault(),l}};function Ia(t,e={}){for(const[i,n]of Object.entries(e))try{t[i]=n}catch(e){Object.defineProperty(t,i,{configurable:!0,get:()=>n})}return t}function Ma(t){if("true"===t)return!0;if("false"===t)return!1;if(t===Number(t).toString())return Number(t);if(""===t||"null"===t)return null;if("string"!=typeof t)return t;try{return JSON.parse(decodeURIComponent(t))}catch(e){return t}}function Fa(t){return t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}const Na={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${Fa(e)}`,i)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${Fa(e)}`)},getDataAttributes(t){if(!t)return{};const e={},i=Object.keys(t.dataset).filter(t=>t.startsWith("bs")&&!t.startsWith("bsConfig"));for(const n of i){let i=n.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1),e[i]=Ma(t.dataset[n])}return e},getDataAttribute:(t,e)=>Ma(t.getAttribute(`data-bs-${Fa(e)}`))};class ja{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){return t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t}_mergeConfigObj(t,e){const i=ia(e)?Na.getDataAttribute(e,"config"):{};return{...this.constructor.Default,..."object"==typeof i?i:{},...ia(e)?Na.getDataAttributes(e):{},..."object"==typeof t?t:{}}}_typeCheckConfig(t,e=this.constructor.DefaultType){for(const[i,n]of Object.entries(e)){const e=t[i],r=ia(e)?"element":ta(e);if(!new RegExp(n).test(r))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${i}" provided type "${r}" but expected type "${n}".`)}}}class Pa extends ja{constructor(t,e){super(),(t=na(t))&&(this._element=t,this._config=this._getConfig(e),Go.set(this._element,this.constructor.DATA_KEY,this))}dispose(){Go.remove(this._element,this.constructor.DATA_KEY),La.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this))this[t]=null}_queueCallback(t,e,i=!0){fa(t,e,i)}_getConfig(t){return t=this._mergeConfigObj(t,this._element),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}static getInstance(t){return Go.get(na(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.3.7"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}const $a=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null}return e?e.split(",").map(t=>Zo(t)).join(","):null},Ha={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter(t=>t.matches(e)),parents(t,e){const i=[];let n=t.parentNode.closest(e);for(;n;)i.push(n),n=n.parentNode.closest(e);return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return[i];i=i.previousElementSibling}return[]},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return[i];i=i.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(t=>`${t}:not([tabindex^="-"])`).join(",");return this.find(e,t).filter(t=>!sa(t)&&ra(t))},getSelectorFromElement(t){const e=$a(t);return e&&Ha.findOne(e)?e:null},getElementFromSelector(t){const e=$a(t);return e?Ha.findOne(e):null},getMultipleElementsFromSelector(t){const e=$a(t);return e?Ha.find(e):[]}},qa=(t,e="hide")=>{const i=`click.dismiss${t.EVENT_KEY}`,n=t.NAME;La.on(document,i,`[data-bs-dismiss="${n}"]`,function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),sa(this))return;const r=Ha.getElementFromSelector(this)||this.closest(`.${n}`);t.getOrCreateInstance(r)[e]()})},Ra=".bs.alert",Ba=`close${Ra}`,Va=`closed${Ra}`;class za extends Pa{static get NAME(){return"alert"}close(){if(La.trigger(this._element,Ba).defaultPrevented)return;this._element.classList.remove("show");const t=this._element.classList.contains("fade");this._queueCallback(()=>this._destroyElement(),this._element,t)}_destroyElement(){this._element.remove(),La.trigger(this._element,Va),this.dispose()}static jQueryInterface(t){return this.each(function(){const e=za.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}})}}qa(za,"close"),ha(za);const Wa='[data-bs-toggle="button"]';class Ya extends Pa{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each(function(){const e=Ya.getOrCreateInstance(this);"toggle"===t&&e[t]()})}}La.on(document,"click.bs.button.data-api",Wa,t=>{t.preventDefault();const e=t.target.closest(Wa);Ya.getOrCreateInstance(e).toggle()}),ha(Ya);const Ka=".bs.swipe",Ua=`touchstart${Ka}`,Xa=`touchmove${Ka}`,Qa=`touchend${Ka}`,Ga=`pointerdown${Ka}`,Ja=`pointerup${Ka}`,Za={endCallback:null,leftCallback:null,rightCallback:null},tl={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class el extends ja{constructor(t,e){super(),this._element=t,t&&el.isSupported()&&(this._config=this._getConfig(e),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return Za}static get DefaultType(){return tl}static get NAME(){return"swipe"}dispose(){La.off(this._element,Ka)}_start(t){this._supportPointerEvents?this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX):this._deltaX=t.touches[0].clientX}_end(t){this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX-this._deltaX),this._handleSwipe(),pa(this._config.endCallback)}_move(t){this._deltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this._deltaX}_handleSwipe(){const t=Math.abs(this._deltaX);if(t<=40)return;const e=t/this._deltaX;this._deltaX=0,e&&pa(e>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(La.on(this._element,Ga,t=>this._start(t)),La.on(this._element,Ja,t=>this._end(t)),this._element.classList.add("pointer-event")):(La.on(this._element,Ua,t=>this._start(t)),La.on(this._element,Xa,t=>this._move(t)),La.on(this._element,Qa,t=>this._end(t)))}_eventIsPointerPenTouch(t){return this._supportPointerEvents&&("pen"===t.pointerType||"touch"===t.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const il=".bs.carousel",nl=".data-api",rl="ArrowLeft",sl="ArrowRight",ol="next",al="prev",ll="left",cl="right",dl=`slide${il}`,ul=`slid${il}`,hl=`keydown${il}`,pl=`mouseenter${il}`,fl=`mouseleave${il}`,gl=`dragstart${il}`,ml=`load${il}${nl}`,vl=`click${il}${nl}`,bl="carousel",yl="active",_l=".active",wl=".carousel-item",El=_l+wl,Al={[rl]:cl,[sl]:ll},kl={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},Sl={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class Cl extends Pa{constructor(t,e){super(t,e),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=Ha.findOne(".carousel-indicators",this._element),this._addEventListeners(),this._config.ride===bl&&this.cycle()}static get Default(){return kl}static get DefaultType(){return Sl}static get NAME(){return"carousel"}next(){this._slide(ol)}nextWhenVisible(){!document.hidden&&ra(this._element)&&this.next()}prev(){this._slide(al)}pause(){this._isSliding&&ea(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval(()=>this.nextWhenVisible(),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?La.one(this._element,ul,()=>this.cycle()):this.cycle())}to(t){const e=this._getItems();if(t>e.length-1||t<0)return;if(this._isSliding)return void La.one(this._element,ul,()=>this.to(t));const i=this._getItemIndex(this._getActive());if(i===t)return;const n=t>i?ol:al;this._slide(n,e[t])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(t){return t.defaultInterval=t.interval,t}_addEventListeners(){this._config.keyboard&&La.on(this._element,hl,t=>this._keydown(t)),"hover"===this._config.pause&&(La.on(this._element,pl,()=>this.pause()),La.on(this._element,fl,()=>this._maybeEnableCycle())),this._config.touch&&el.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const t of Ha.find(".carousel-item img",this._element))La.on(t,gl,t=>t.preventDefault());const t={leftCallback:()=>this._slide(this._directionToOrder(ll)),rightCallback:()=>this._slide(this._directionToOrder(cl)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout(()=>this._maybeEnableCycle(),500+this._config.interval))}};this._swipeHelper=new el(this._element,t)}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=Al[t.key];e&&(t.preventDefault(),this._slide(this._directionToOrder(e)))}_getItemIndex(t){return this._getItems().indexOf(t)}_setActiveIndicatorElement(t){if(!this._indicatorsElement)return;const e=Ha.findOne(_l,this._indicatorsElement);e.classList.remove(yl),e.removeAttribute("aria-current");const i=Ha.findOne(`[data-bs-slide-to="${t}"]`,this._indicatorsElement);i&&(i.classList.add(yl),i.setAttribute("aria-current","true"))}_updateInterval(){const t=this._activeElement||this._getActive();if(!t)return;const e=Number.parseInt(t.getAttribute("data-bs-interval"),10);this._config.interval=e||this._config.defaultInterval}_slide(t,e=null){if(this._isSliding)return;const i=this._getActive(),n=t===ol,r=e||ga(this._getItems(),i,n,this._config.wrap);if(r===i)return;const s=this._getItemIndex(r),o=e=>La.trigger(this._element,e,{relatedTarget:r,direction:this._orderToDirection(t),from:this._getItemIndex(i),to:s});if(o(dl).defaultPrevented)return;if(!i||!r)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(s),this._activeElement=r;const l=n?"carousel-item-start":"carousel-item-end",c=n?"carousel-item-next":"carousel-item-prev";r.classList.add(c),la(r),i.classList.add(l),r.classList.add(l);this._queueCallback(()=>{r.classList.remove(l,c),r.classList.add(yl),i.classList.remove(yl,c,l),this._isSliding=!1,o(ul)},i,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains("slide")}_getActive(){return Ha.findOne(El,this._element)}_getItems(){return Ha.find(wl,this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(t){return ua()?t===ll?al:ol:t===ll?ol:al}_orderToDirection(t){return ua()?t===al?ll:cl:t===al?cl:ll}static jQueryInterface(t){return this.each(function(){const e=Cl.getOrCreateInstance(this,t);if("number"!=typeof t){if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}else e.to(t)})}}La.on(document,vl,"[data-bs-slide], [data-bs-slide-to]",function(t){const e=Ha.getElementFromSelector(this);if(!e||!e.classList.contains(bl))return;t.preventDefault();const i=Cl.getOrCreateInstance(e),n=this.getAttribute("data-bs-slide-to");return n?(i.to(n),void i._maybeEnableCycle()):"next"===Na.getDataAttribute(this,"slide")?(i.next(),void i._maybeEnableCycle()):(i.prev(),void i._maybeEnableCycle())}),La.on(window,ml,()=>{const t=Ha.find('[data-bs-ride="carousel"]');for(const e of t)Cl.getOrCreateInstance(e)}),ha(Cl);const Ol=".bs.collapse",Dl=`show${Ol}`,xl=`shown${Ol}`,Tl=`hide${Ol}`,Ll=`hidden${Ol}`,Il=`click${Ol}.data-api`,Ml="show",Fl="collapse",Nl="collapsing",jl=`:scope .${Fl} .${Fl}`,Pl='[data-bs-toggle="collapse"]',$l={parent:null,toggle:!0},Hl={parent:"(null|element)",toggle:"boolean"};class ql extends Pa{constructor(t,e){super(t,e),this._isTransitioning=!1,this._triggerArray=[];const i=Ha.find(Pl);for(const t of i){const e=Ha.getSelectorFromElement(t),i=Ha.find(e).filter(t=>t===this._element);null!==e&&i.length&&this._triggerArray.push(t)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return $l}static get DefaultType(){return Hl}static get NAME(){return"collapse"}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t=[];if(this._config.parent&&(t=this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter(t=>t!==this._element).map(t=>ql.getOrCreateInstance(t,{toggle:!1}))),t.length&&t[0]._isTransitioning)return;if(La.trigger(this._element,Dl).defaultPrevented)return;for(const e of t)e.hide();const e=this._getDimension();this._element.classList.remove(Fl),this._element.classList.add(Nl),this._element.style[e]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const i=`scroll${e[0].toUpperCase()+e.slice(1)}`;this._queueCallback(()=>{this._isTransitioning=!1,this._element.classList.remove(Nl),this._element.classList.add(Fl,Ml),this._element.style[e]="",La.trigger(this._element,xl)},this._element,!0),this._element.style[e]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(La.trigger(this._element,Tl).defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,la(this._element),this._element.classList.add(Nl),this._element.classList.remove(Fl,Ml);for(const t of this._triggerArray){const e=Ha.getElementFromSelector(t);e&&!this._isShown(e)&&this._addAriaAndCollapsedClass([t],!1)}this._isTransitioning=!0;this._element.style[t]="",this._queueCallback(()=>{this._isTransitioning=!1,this._element.classList.remove(Nl),this._element.classList.add(Fl),La.trigger(this._element,Ll)},this._element,!0)}_isShown(t=this._element){return t.classList.contains(Ml)}_configAfterMerge(t){return t.toggle=Boolean(t.toggle),t.parent=na(t.parent),t}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const t=this._getFirstLevelChildren(Pl);for(const e of t){const t=Ha.getElementFromSelector(e);t&&this._addAriaAndCollapsedClass([e],this._isShown(t))}}_getFirstLevelChildren(t){const e=Ha.find(jl,this._config.parent);return Ha.find(t,this._config.parent).filter(t=>!e.includes(t))}_addAriaAndCollapsedClass(t,e){if(t.length)for(const i of t)i.classList.toggle("collapsed",!e),i.setAttribute("aria-expanded",e)}static jQueryInterface(t){const e={};return"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1),this.each(function(){const i=ql.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}})}}La.on(document,Il,Pl,function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();for(const t of Ha.getMultipleElementsFromSelector(this))ql.getOrCreateInstance(t,{toggle:!1}).toggle()}),ha(ql);const Rl="dropdown",Bl=".bs.dropdown",Vl=".data-api",zl="ArrowUp",Wl="ArrowDown",Yl=`hide${Bl}`,Kl=`hidden${Bl}`,Ul=`show${Bl}`,Xl=`shown${Bl}`,Ql=`click${Bl}${Vl}`,Gl=`keydown${Bl}${Vl}`,Jl=`keyup${Bl}${Vl}`,Zl="show",tc='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',ec=`${tc}.${Zl}`,ic=".dropdown-menu",nc=ua()?"top-end":"top-start",rc=ua()?"top-start":"top-end",sc=ua()?"bottom-end":"bottom-start",oc=ua()?"bottom-start":"bottom-end",ac=ua()?"left-start":"right-start",lc=ua()?"right-start":"left-start",cc={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},dc={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class uc extends Pa{constructor(t,e){super(t,e),this._popper=null,this._parent=this._element.parentNode,this._menu=Ha.next(this._element,ic)[0]||Ha.prev(this._element,ic)[0]||Ha.findOne(ic,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return cc}static get DefaultType(){return dc}static get NAME(){return Rl}toggle(){return this._isShown()?this.hide():this.show()}show(){if(sa(this._element)||this._isShown())return;const t={relatedTarget:this._element};if(!La.trigger(this._element,Ul,t).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(".navbar-nav"))for(const t of[].concat(...document.body.children))La.on(t,"mouseover",aa);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(Zl),this._element.classList.add(Zl),La.trigger(this._element,Xl,t)}}hide(){if(sa(this._element)||!this._isShown())return;const t={relatedTarget:this._element};this._completeHide(t)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(t){if(!La.trigger(this._element,Yl,t).defaultPrevented){if("ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))La.off(t,"mouseover",aa);this._popper&&this._popper.destroy(),this._menu.classList.remove(Zl),this._element.classList.remove(Zl),this._element.setAttribute("aria-expanded","false"),Na.removeDataAttribute(this._menu,"popper"),La.trigger(this._element,Kl,t),this._element.focus()}}_getConfig(t){if("object"==typeof(t=super._getConfig(t)).reference&&!ia(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError(`${Rl.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return t}_createPopper(){if(void 0===Xo)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org/docs/v2/)");let t=this._element;"parent"===this._config.reference?t=this._parent:ia(this._config.reference)?t=na(this._config.reference):"object"==typeof this._config.reference&&(t=this._config.reference);const e=this._getPopperConfig();this._popper=Uo(t,this._menu,e)}_isShown(){return this._menu.classList.contains(Zl)}_getPlacement(){const t=this._parent;if(t.classList.contains("dropend"))return ac;if(t.classList.contains("dropstart"))return lc;if(t.classList.contains("dropup-center"))return"top";if(t.classList.contains("dropdown-center"))return"bottom";const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?rc:nc:e?oc:sc}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map(t=>Number.parseInt(t,10)):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(Na.setDataAttribute(this._menu,"popper","static"),t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,...pa(this._config.popperConfig,[void 0,t])}}_selectMenuItem({key:t,target:e}){const i=Ha.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter(t=>ra(t));i.length&&ga(i,e,t===Wl,!i.includes(e)).focus()}static jQueryInterface(t){return this.each(function(){const e=uc.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}})}static clearMenus(t){if(2===t.button||"keyup"===t.type&&"Tab"!==t.key)return;const e=Ha.find(ec);for(const i of e){const e=uc.getInstance(i);if(!e||!1===e._config.autoClose)continue;const n=t.composedPath(),r=n.includes(e._menu);if(n.includes(e._element)||"inside"===e._config.autoClose&&!r||"outside"===e._config.autoClose&&r)continue;if(e._menu.contains(t.target)&&("keyup"===t.type&&"Tab"===t.key||/input|select|option|textarea|form/i.test(t.target.tagName)))continue;const s={relatedTarget:e._element};"click"===t.type&&(s.clickEvent=t),e._completeHide(s)}}static dataApiKeydownHandler(t){const e=/input|textarea/i.test(t.target.tagName),i="Escape"===t.key,n=[zl,Wl].includes(t.key);if(!n&&!i)return;if(e&&!i)return;t.preventDefault();const r=this.matches(tc)?this:Ha.prev(this,tc)[0]||Ha.next(this,tc)[0]||Ha.findOne(tc,t.delegateTarget.parentNode),s=uc.getOrCreateInstance(r);if(n)return t.stopPropagation(),s.show(),void s._selectMenuItem(t);s._isShown()&&(t.stopPropagation(),s.hide(),r.focus())}}La.on(document,Gl,tc,uc.dataApiKeydownHandler),La.on(document,Gl,ic,uc.dataApiKeydownHandler),La.on(document,Ql,uc.clearMenus),La.on(document,Jl,uc.clearMenus),La.on(document,Ql,tc,function(t){t.preventDefault(),uc.getOrCreateInstance(this).toggle()}),ha(uc);const hc="backdrop",pc="show",fc=`mousedown.bs.${hc}`,gc={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},mc={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class vc extends ja{constructor(t){super(),this._config=this._getConfig(t),this._isAppended=!1,this._element=null}static get Default(){return gc}static get DefaultType(){return mc}static get NAME(){return hc}show(t){if(!this._config.isVisible)return void pa(t);this._append();const e=this._getElement();this._config.isAnimated&&la(e),e.classList.add(pc),this._emulateAnimation(()=>{pa(t)})}hide(t){this._config.isVisible?(this._getElement().classList.remove(pc),this._emulateAnimation(()=>{this.dispose(),pa(t)})):pa(t)}dispose(){this._isAppended&&(La.off(this._element,fc),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_configAfterMerge(t){return t.rootElement=na(t.rootElement),t}_append(){if(this._isAppended)return;const t=this._getElement();this._config.rootElement.append(t),La.on(t,fc,()=>{pa(this._config.clickCallback)}),this._isAppended=!0}_emulateAnimation(t){fa(t,this._getElement(),this._config.isAnimated)}}const bc=".bs.focustrap",yc=`focusin${bc}`,_c=`keydown.tab${bc}`,wc="backward",Ec={autofocus:!0,trapElement:null},Ac={autofocus:"boolean",trapElement:"element"};class kc extends ja{constructor(t){super(),this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return Ec}static get DefaultType(){return Ac}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),La.off(document,bc),La.on(document,yc,t=>this._handleFocusin(t)),La.on(document,_c,t=>this._handleKeydown(t)),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,La.off(document,bc))}_handleFocusin(t){const{trapElement:e}=this._config;if(t.target===document||t.target===e||e.contains(t.target))return;const i=Ha.focusableChildren(e);0===i.length?e.focus():this._lastTabNavDirection===wc?i[i.length-1].focus():i[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?wc:"forward")}}const Sc=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",Cc=".sticky-top",Oc="padding-right",Dc="margin-right";class xc{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,Oc,e=>e+t),this._setElementAttributes(Sc,Oc,e=>e+t),this._setElementAttributes(Cc,Dc,e=>e-t)}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,Oc),this._resetElementAttributes(Sc,Oc),this._resetElementAttributes(Cc,Dc)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,i){const n=this.getWidth();this._applyManipulationCallback(t,t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+n)return;this._saveInitialAttribute(t,e);const r=window.getComputedStyle(t).getPropertyValue(e);t.style.setProperty(e,`${i(Number.parseFloat(r))}px`)})}_saveInitialAttribute(t,e){const i=t.style.getPropertyValue(e);i&&Na.setDataAttribute(t,e,i)}_resetElementAttributes(t,e){this._applyManipulationCallback(t,t=>{const i=Na.getDataAttribute(t,e);null!==i?(Na.removeDataAttribute(t,e),t.style.setProperty(e,i)):t.style.removeProperty(e)})}_applyManipulationCallback(t,e){if(ia(t))e(t);else for(const i of Ha.find(t,this._element))e(i)}}const Tc=".bs.modal",Lc=`hide${Tc}`,Ic=`hidePrevented${Tc}`,Mc=`hidden${Tc}`,Fc=`show${Tc}`,Nc=`shown${Tc}`,jc=`resize${Tc}`,Pc=`click.dismiss${Tc}`,$c=`mousedown.dismiss${Tc}`,Hc=`keydown.dismiss${Tc}`,qc=`click${Tc}.data-api`,Rc="modal-open",Bc="show",Vc="modal-static",zc={backdrop:!0,focus:!0,keyboard:!0},Wc={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class Yc extends Pa{constructor(t,e){super(t,e),this._dialog=Ha.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new xc,this._addEventListeners()}static get Default(){return zc}static get DefaultType(){return Wc}static get NAME(){return"modal"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){if(this._isShown||this._isTransitioning)return;La.trigger(this._element,Fc,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(Rc),this._adjustDialog(),this._backdrop.show(()=>this._showElement(t)))}hide(){if(!this._isShown||this._isTransitioning)return;La.trigger(this._element,Lc).defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(Bc),this._queueCallback(()=>this._hideModal(),this._element,this._isAnimated()))}dispose(){La.off(window,Tc),La.off(this._dialog,Tc),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new vc({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new kc({trapElement:this._element})}_showElement(t){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const e=Ha.findOne(".modal-body",this._dialog);e&&(e.scrollTop=0),la(this._element),this._element.classList.add(Bc);this._queueCallback(()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,La.trigger(this._element,Nc,{relatedTarget:t})},this._dialog,this._isAnimated())}_addEventListeners(){La.on(this._element,Hc,t=>{"Escape"===t.key&&(this._config.keyboard?this.hide():this._triggerBackdropTransition())}),La.on(window,jc,()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()}),La.on(this._element,$c,t=>{La.one(this._element,Pc,e=>{this._element===t.target&&this._element===e.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())})})}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide(()=>{document.body.classList.remove(Rc),this._resetAdjustments(),this._scrollBar.reset(),La.trigger(this._element,Mc)})}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(La.trigger(this._element,Ic).defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._element.style.overflowY;"hidden"===e||this._element.classList.contains(Vc)||(t||(this._element.style.overflowY="hidden"),this._element.classList.add(Vc),this._queueCallback(()=>{this._element.classList.remove(Vc),this._queueCallback(()=>{this._element.style.overflowY=e},this._dialog)},this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;if(i&&!t){const t=ua()?"paddingLeft":"paddingRight";this._element.style[t]=`${e}px`}if(!i&&t){const t=ua()?"paddingRight":"paddingLeft";this._element.style[t]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each(function(){const i=Yc.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e)}})}}La.on(document,qc,'[data-bs-toggle="modal"]',function(t){const e=Ha.getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),La.one(e,Fc,t=>{t.defaultPrevented||La.one(e,Mc,()=>{ra(this)&&this.focus()})});const i=Ha.findOne(".modal.show");i&&Yc.getInstance(i).hide();Yc.getOrCreateInstance(e).toggle(this)}),qa(Yc),ha(Yc);const Kc=".bs.offcanvas",Uc=".data-api",Xc=`load${Kc}${Uc}`,Qc="show",Gc="showing",Jc="hiding",Zc=".offcanvas.show",td=`show${Kc}`,ed=`shown${Kc}`,id=`hide${Kc}`,nd=`hidePrevented${Kc}`,rd=`hidden${Kc}`,sd=`resize${Kc}`,od=`click${Kc}${Uc}`,ad=`keydown.dismiss${Kc}`,ld={backdrop:!0,keyboard:!0,scroll:!1},cd={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class dd extends Pa{constructor(t,e){super(t,e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return ld}static get DefaultType(){return cd}static get NAME(){return"offcanvas"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){if(this._isShown)return;if(La.trigger(this._element,td,{relatedTarget:t}).defaultPrevented)return;this._isShown=!0,this._backdrop.show(),this._config.scroll||(new xc).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(Gc);this._queueCallback(()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(Qc),this._element.classList.remove(Gc),La.trigger(this._element,ed,{relatedTarget:t})},this._element,!0)}hide(){if(!this._isShown)return;if(La.trigger(this._element,id).defaultPrevented)return;this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(Jc),this._backdrop.hide();this._queueCallback(()=>{this._element.classList.remove(Qc,Jc),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new xc).reset(),La.trigger(this._element,rd)},this._element,!0)}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const t=Boolean(this._config.backdrop);return new vc({className:"offcanvas-backdrop",isVisible:t,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:t?()=>{"static"!==this._config.backdrop?this.hide():La.trigger(this._element,nd)}:null})}_initializeFocusTrap(){return new kc({trapElement:this._element})}_addEventListeners(){La.on(this._element,ad,t=>{"Escape"===t.key&&(this._config.keyboard?this.hide():La.trigger(this._element,nd))})}static jQueryInterface(t){return this.each(function(){const e=dd.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}})}}La.on(document,od,'[data-bs-toggle="offcanvas"]',function(t){const e=Ha.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),sa(this))return;La.one(e,rd,()=>{ra(this)&&this.focus()});const i=Ha.findOne(Zc);i&&i!==e&&dd.getInstance(i).hide();dd.getOrCreateInstance(e).toggle(this)}),La.on(window,Xc,()=>{for(const t of Ha.find(Zc))dd.getOrCreateInstance(t).show()}),La.on(window,sd,()=>{for(const t of Ha.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(t).position&&dd.getOrCreateInstance(t).hide()}),qa(dd),ha(dd);const ud={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],dd:[],div:[],dl:[],dt:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},hd=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),pd=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,fd=(t,e)=>{const i=t.nodeName.toLowerCase();return e.includes(i)?!hd.has(i)||Boolean(pd.test(t.nodeValue)):e.filter(t=>t instanceof RegExp).some(t=>t.test(i))};const gd={allowList:ud,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"<div></div>"},md={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},vd={entry:"(string|element|function|null)",selector:"(string|element)"};class bd extends ja{constructor(t){super(),this._config=this._getConfig(t)}static get Default(){return gd}static get DefaultType(){return md}static get NAME(){return"TemplateFactory"}getContent(){return Object.values(this._config.content).map(t=>this._resolvePossibleFunction(t)).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(t){return this._checkContent(t),this._config.content={...this._config.content,...t},this}toHtml(){const t=document.createElement("div");t.innerHTML=this._maybeSanitize(this._config.template);for(const[e,i]of Object.entries(this._config.content))this._setContent(t,i,e);const e=t.children[0],i=this._resolvePossibleFunction(this._config.extraClass);return i&&e.classList.add(...i.split(" ")),e}_typeCheckConfig(t){super._typeCheckConfig(t),this._checkContent(t.content)}_checkContent(t){for(const[e,i]of Object.entries(t))super._typeCheckConfig({selector:e,entry:i},vd)}_setContent(t,e,i){const n=Ha.findOne(i,t);n&&((e=this._resolvePossibleFunction(e))?ia(e)?this._putElementInTemplate(na(e),n):this._config.html?n.innerHTML=this._maybeSanitize(e):n.textContent=e:n.remove())}_maybeSanitize(t){return this._config.sanitize?function(t,e,i){if(!t.length)return t;if(i&&"function"==typeof i)return i(t);const n=(new window.DOMParser).parseFromString(t,"text/html"),r=[].concat(...n.body.querySelectorAll("*"));for(const t of r){const i=t.nodeName.toLowerCase();if(!Object.keys(e).includes(i)){t.remove();continue}const n=[].concat(...t.attributes),r=[].concat(e["*"]||[],e[i]||[]);for(const e of n)fd(e,r)||t.removeAttribute(e.nodeName)}return n.body.innerHTML}(t,this._config.allowList,this._config.sanitizeFn):t}_resolvePossibleFunction(t){return pa(t,[void 0,this])}_putElementInTemplate(t,e){if(this._config.html)return e.innerHTML="",void e.append(t);e.textContent=t.textContent}}const yd=new Set(["sanitize","allowList","sanitizeFn"]),_d="fade",wd="show",Ed=".tooltip-inner",Ad=".modal",kd="hide.bs.modal",Sd="hover",Cd="focus",Od="click",Dd={AUTO:"auto",TOP:"top",RIGHT:ua()?"left":"right",BOTTOM:"bottom",LEFT:ua()?"right":"left"},xd={allowList:ud,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,6],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',title:"",trigger:"hover focus"},Td={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class Ld extends Pa{constructor(t,e){if(void 0===Xo)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org/docs/v2/)");super(t,e),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return xd}static get DefaultType(){return Td}static get NAME(){return"tooltip"}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),La.off(this._element.closest(Ad),kd,this._hideModalHandler),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const t=La.trigger(this._element,this.constructor.eventName("show")),e=(oa(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(t.defaultPrevented||!e)return;this._disposePopper();const i=this._getTipElement();this._element.setAttribute("aria-describedby",i.getAttribute("id"));const{container:n}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(n.append(i),La.trigger(this._element,this.constructor.eventName("inserted"))),this._popper=this._createPopper(i),i.classList.add(wd),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))La.on(t,"mouseover",aa);this._queueCallback(()=>{La.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1},this.tip,this._isAnimated())}hide(){if(!this._isShown())return;if(La.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented)return;if(this._getTipElement().classList.remove(wd),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))La.off(t,"mouseover",aa);this._activeTrigger[Od]=!1,this._activeTrigger[Cd]=!1,this._activeTrigger[Sd]=!1,this._isHovered=null;this._queueCallback(()=>{this._isWithActiveTrigger()||(this._isHovered||this._disposePopper(),this._element.removeAttribute("aria-describedby"),La.trigger(this._element,this.constructor.eventName("hidden")))},this.tip,this._isAnimated())}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(t){const e=this._getTemplateFactory(t).toHtml();if(!e)return null;e.classList.remove(_d,wd),e.classList.add(`bs-${this.constructor.NAME}-auto`);const i=(t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t})(this.constructor.NAME).toString();return e.setAttribute("id",i),this._isAnimated()&&e.classList.add(_d),e}setContent(t){this._newContent=t,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(t){return this._templateFactory?this._templateFactory.changeContent(t):this._templateFactory=new bd({...this._config,content:t,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{[Ed]:this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(t){return this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(_d)}_isShown(){return this.tip&&this.tip.classList.contains(wd)}_createPopper(t){const e=pa(this._config.placement,[this,t,this._element]),i=Dd[e.toUpperCase()];return Uo(this._element,t,this._getPopperConfig(i))}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map(t=>Number.parseInt(t,10)):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return pa(t,[this._element,this._element])}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:t=>{this._getTipElement().setAttribute("data-popper-placement",t.state.placement)}}]};return{...e,...pa(this._config.popperConfig,[void 0,e])}}_setListeners(){const t=this._config.trigger.split(" ");for(const e of t)if("click"===e)La.on(this._element,this.constructor.eventName("click"),this._config.selector,t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger[Od]=!(e._isShown()&&e._activeTrigger[Od]),e.toggle()});else if("manual"!==e){const t=e===Sd?this.constructor.eventName("mouseenter"):this.constructor.eventName("focusin"),i=e===Sd?this.constructor.eventName("mouseleave"):this.constructor.eventName("focusout");La.on(this._element,t,this._config.selector,t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusin"===t.type?Cd:Sd]=!0,e._enter()}),La.on(this._element,i,this._config.selector,t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusout"===t.type?Cd:Sd]=e._element.contains(t.relatedTarget),e._leave()})}this._hideModalHandler=()=>{this._element&&this.hide()},La.on(this._element.closest(Ad),kd,this._hideModalHandler)}_fixTitle(){const t=this._element.getAttribute("title");t&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",t),this._element.setAttribute("data-bs-original-title",t),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout(()=>{this._isHovered&&this.show()},this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout(()=>{this._isHovered||this.hide()},this._config.delay.hide))}_setTimeout(t,e){clearTimeout(this._timeout),this._timeout=setTimeout(t,e)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(t){const e=Na.getDataAttributes(this._element);for(const t of Object.keys(e))yd.has(t)&&delete e[t];return t={...e,..."object"==typeof t&&t?t:{}},t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t.container=!1===t.container?document.body:na(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),t}_getDelegateConfig(){const t={};for(const[e,i]of Object.entries(this._config))this.constructor.Default[e]!==i&&(t[e]=i);return t.selector=!1,t.trigger="manual",t}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null),this.tip&&(this.tip.remove(),this.tip=null)}static jQueryInterface(t){return this.each(function(){const e=Ld.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}})}}ha(Ld);const Id=".popover-header",Md=".popover-body",Fd={...Ld.Default,content:"",offset:[0,8],placement:"right",template:'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>',trigger:"click"},Nd={...Ld.DefaultType,content:"(null|string|element|function)"};class jd extends Ld{static get Default(){return Fd}static get DefaultType(){return Nd}static get NAME(){return"popover"}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{[Id]:this._getTitle(),[Md]:this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(t){return this.each(function(){const e=jd.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}})}}ha(jd);const Pd=".bs.scrollspy",$d=`activate${Pd}`,Hd=`click${Pd}`,qd=`load${Pd}.data-api`,Rd="active",Bd="[href]",Vd=".nav-link",zd=`${Vd}, .nav-item > ${Vd}, .list-group-item`,Wd={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},Yd={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class Kd extends Pa{constructor(t,e){super(t,e),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return Wd}static get DefaultType(){return Yd}static get NAME(){return"scrollspy"}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const t of this._observableSections.values())this._observer.observe(t)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(t){return t.target=na(t.target)||document.body,t.rootMargin=t.offset?`${t.offset}px 0px -30%`:t.rootMargin,"string"==typeof t.threshold&&(t.threshold=t.threshold.split(",").map(t=>Number.parseFloat(t))),t}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(La.off(this._config.target,Hd),La.on(this._config.target,Hd,Bd,t=>{const e=this._observableSections.get(t.target.hash);if(e){t.preventDefault();const i=this._rootElement||window,n=e.offsetTop-this._element.offsetTop;if(i.scrollTo)return void i.scrollTo({top:n,behavior:"smooth"});i.scrollTop=n}}))}_getNewObserver(){const t={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver(t=>this._observerCallback(t),t)}_observerCallback(t){const e=t=>this._targetLinks.get(`#${t.target.id}`),i=t=>{this._previousScrollData.visibleEntryTop=t.target.offsetTop,this._process(e(t))},n=(this._rootElement||document.documentElement).scrollTop,r=n>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=n;for(const s of t){if(!s.isIntersecting){this._activeTarget=null,this._clearActiveClass(e(s));continue}const t=s.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(r&&t){if(i(s),!n)return}else r||t||i(s)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const t=Ha.find(Bd,this._config.target);for(const e of t){if(!e.hash||sa(e))continue;const t=Ha.findOne(decodeURI(e.hash),this._element);ra(t)&&(this._targetLinks.set(decodeURI(e.hash),e),this._observableSections.set(e.hash,t))}}_process(t){this._activeTarget!==t&&(this._clearActiveClass(this._config.target),this._activeTarget=t,t.classList.add(Rd),this._activateParents(t),La.trigger(this._element,$d,{relatedTarget:t}))}_activateParents(t){if(t.classList.contains("dropdown-item"))Ha.findOne(".dropdown-toggle",t.closest(".dropdown")).classList.add(Rd);else for(const e of Ha.parents(t,".nav, .list-group"))for(const t of Ha.prev(e,zd))t.classList.add(Rd)}_clearActiveClass(t){t.classList.remove(Rd);const e=Ha.find(`${Bd}.${Rd}`,t);for(const t of e)t.classList.remove(Rd)}static jQueryInterface(t){return this.each(function(){const e=Kd.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}})}}La.on(window,qd,()=>{for(const t of Ha.find('[data-bs-spy="scroll"]'))Kd.getOrCreateInstance(t)}),ha(Kd);const Ud=".bs.tab",Xd=`hide${Ud}`,Qd=`hidden${Ud}`,Gd=`show${Ud}`,Jd=`shown${Ud}`,Zd=`click${Ud}`,tu=`keydown${Ud}`,eu=`load${Ud}`,iu="ArrowLeft",nu="ArrowRight",ru="ArrowUp",su="ArrowDown",ou="Home",au="End",lu="active",cu="fade",du="show",uu=".dropdown-toggle",hu=`:not(${uu})`,pu='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',fu=`${`.nav-link${hu}, .list-group-item${hu}, [role="tab"]${hu}`}, ${pu}`,gu=`.${lu}[data-bs-toggle="tab"], .${lu}[data-bs-toggle="pill"], .${lu}[data-bs-toggle="list"]`;class mu extends Pa{constructor(t){super(t),this._parent=this._element.closest('.list-group, .nav, [role="tablist"]'),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),La.on(this._element,tu,t=>this._keydown(t)))}static get NAME(){return"tab"}show(){const t=this._element;if(this._elemIsActive(t))return;const e=this._getActiveElem(),i=e?La.trigger(e,Xd,{relatedTarget:t}):null;La.trigger(t,Gd,{relatedTarget:e}).defaultPrevented||i&&i.defaultPrevented||(this._deactivate(e,t),this._activate(t,e))}_activate(t,e){if(!t)return;t.classList.add(lu),this._activate(Ha.getElementFromSelector(t));this._queueCallback(()=>{"tab"===t.getAttribute("role")?(t.removeAttribute("tabindex"),t.setAttribute("aria-selected",!0),this._toggleDropDown(t,!0),La.trigger(t,Jd,{relatedTarget:e})):t.classList.add(du)},t,t.classList.contains(cu))}_deactivate(t,e){if(!t)return;t.classList.remove(lu),t.blur(),this._deactivate(Ha.getElementFromSelector(t));this._queueCallback(()=>{"tab"===t.getAttribute("role")?(t.setAttribute("aria-selected",!1),t.setAttribute("tabindex","-1"),this._toggleDropDown(t,!1),La.trigger(t,Qd,{relatedTarget:e})):t.classList.remove(du)},t,t.classList.contains(cu))}_keydown(t){if(![iu,nu,ru,su,ou,au].includes(t.key))return;t.stopPropagation(),t.preventDefault();const e=this._getChildren().filter(t=>!sa(t));let i;if([ou,au].includes(t.key))i=e[t.key===ou?0:e.length-1];else{const n=[nu,su].includes(t.key);i=ga(e,t.target,n,!0)}i&&(i.focus({preventScroll:!0}),mu.getOrCreateInstance(i).show())}_getChildren(){return Ha.find(fu,this._parent)}_getActiveElem(){return this._getChildren().find(t=>this._elemIsActive(t))||null}_setInitialAttributes(t,e){this._setAttributeIfNotExists(t,"role","tablist");for(const t of e)this._setInitialAttributesOnChild(t)}_setInitialAttributesOnChild(t){t=this._getInnerElement(t);const e=this._elemIsActive(t),i=this._getOuterElement(t);t.setAttribute("aria-selected",e),i!==t&&this._setAttributeIfNotExists(i,"role","presentation"),e||t.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(t,"role","tab"),this._setInitialAttributesOnTargetPanel(t)}_setInitialAttributesOnTargetPanel(t){const e=Ha.getElementFromSelector(t);e&&(this._setAttributeIfNotExists(e,"role","tabpanel"),t.id&&this._setAttributeIfNotExists(e,"aria-labelledby",`${t.id}`))}_toggleDropDown(t,e){const i=this._getOuterElement(t);if(!i.classList.contains("dropdown"))return;const n=(t,n)=>{const r=Ha.findOne(t,i);r&&r.classList.toggle(n,e)};n(uu,lu),n(".dropdown-menu",du),i.setAttribute("aria-expanded",e)}_setAttributeIfNotExists(t,e,i){t.hasAttribute(e)||t.setAttribute(e,i)}_elemIsActive(t){return t.classList.contains(lu)}_getInnerElement(t){return t.matches(fu)?t:Ha.findOne(fu,t)}_getOuterElement(t){return t.closest(".nav-item, .list-group-item")||t}static jQueryInterface(t){return this.each(function(){const e=mu.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}})}}La.on(document,Zd,pu,function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),sa(this)||mu.getOrCreateInstance(this).show()}),La.on(window,eu,()=>{for(const t of Ha.find(gu))mu.getOrCreateInstance(t)}),ha(mu);const vu=".bs.toast",bu=`mouseover${vu}`,yu=`mouseout${vu}`,_u=`focusin${vu}`,wu=`focusout${vu}`,Eu=`hide${vu}`,Au=`hidden${vu}`,ku=`show${vu}`,Su=`shown${vu}`,Cu="hide",Ou="show",Du="showing",xu={animation:"boolean",autohide:"boolean",delay:"number"},Tu={animation:!0,autohide:!0,delay:5e3};class Lu extends Pa{constructor(t,e){super(t,e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Tu}static get DefaultType(){return xu}static get NAME(){return"toast"}show(){if(La.trigger(this._element,ku).defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");this._element.classList.remove(Cu),la(this._element),this._element.classList.add(Ou,Du),this._queueCallback(()=>{this._element.classList.remove(Du),La.trigger(this._element,Su),this._maybeScheduleHide()},this._element,this._config.animation)}hide(){if(!this.isShown())return;if(La.trigger(this._element,Eu).defaultPrevented)return;this._element.classList.add(Du),this._queueCallback(()=>{this._element.classList.add(Cu),this._element.classList.remove(Du,Ou),La.trigger(this._element,Au)},this._element,this._config.animation)}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(Ou),super.dispose()}isShown(){return this._element.classList.contains(Ou)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout(()=>{this.hide()},this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){La.on(this._element,bu,t=>this._onInteraction(t,!0)),La.on(this._element,yu,t=>this._onInteraction(t,!1)),La.on(this._element,_u,t=>this._onInteraction(t,!0)),La.on(this._element,wu,t=>this._onInteraction(t,!1))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each(function(){const e=Lu.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}})}}qa(Lu),ha(Lu),document.addEventListener("DOMContentLoaded",()=>{Array.from(document.querySelectorAll(".dropdown")).forEach(t=>new uc(t)),f.formsHandler.netteForms=y,f.initialize(),((t,e={})=>{new fs(t,e)})(new gs(f),{datagrid:{plugins:[new se,new oe,new le,new ce,new de,new ie(y),new ee(new he),new re(new vn),new te(new hs({buttonClass:"btn"})),new ne(new bn(It)),new ue]}})});
19
+ const Uo=new Map,Xo={set(e,t,i){Uo.has(e)||Uo.set(e,new Map);const n=Uo.get(e);n.has(t)||0===n.size?n.set(t,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(e,t)=>Uo.has(e)&&Uo.get(e).get(t)||null,remove(e,t){if(!Uo.has(e))return;const i=Uo.get(e);i.delete(t),0===i.size&&Uo.delete(e)}},Qo="transitionend",Go=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,(e,t)=>`#${CSS.escape(t)}`)),e),Jo=e=>null==e?`${e}`:Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(),Zo=e=>{e.dispatchEvent(new Event(Qo))},ea=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),ta=e=>ea(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(Go(e)):null,ia=e=>{if(!ea(e)||0===e.getClientRects().length)return!1;const t="visible"===getComputedStyle(e).getPropertyValue("visibility"),i=e.closest("details:not([open])");if(!i)return t;if(i!==e){const t=e.closest("summary");if(t&&t.parentNode!==i)return!1;if(null===t)return!1}return t},na=e=>!e||e.nodeType!==Node.ELEMENT_NODE||(!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled"))),ra=e=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?ra(e.parentNode):null},sa=()=>{},oa=e=>{e.offsetHeight},aa=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,la=[],ca=()=>"rtl"===document.documentElement.dir,da=e=>{var t;t=()=>{const t=aa();if(t){const i=e.NAME,n=t.fn[i];t.fn[i]=e.jQueryInterface,t.fn[i].Constructor=e,t.fn[i].noConflict=()=>(t.fn[i]=n,e.jQueryInterface)}},"loading"===document.readyState?(la.length||document.addEventListener("DOMContentLoaded",()=>{for(const e of la)e()}),la.push(t)):t()},ua=(e,t=[],i=e)=>"function"==typeof e?e.call(...t):i,ha=(e,t,i=!0)=>{if(!i)return void ua(e);const n=(e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:i}=window.getComputedStyle(e);const n=Number.parseFloat(t),r=Number.parseFloat(i);return n||r?(t=t.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(i))):0})(t)+5;let r=!1;const s=({target:i})=>{i===t&&(r=!0,t.removeEventListener(Qo,s),ua(e))};t.addEventListener(Qo,s),setTimeout(()=>{r||Zo(t)},n)},pa=(e,t,i,n)=>{const r=e.length;let s=e.indexOf(t);return-1===s?!i&&n?e[r-1]:e[0]:(s+=i?1:-1,n&&(s=(s+r)%r),e[Math.max(0,Math.min(s,r-1))])},fa=/[^.]*(?=\..*)\.|.*/,ga=/\..*/,ma=/::\d+$/,va={};let ba=1;const ya={mouseenter:"mouseover",mouseleave:"mouseout"},_a=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function wa(e,t){return t&&`${t}::${ba++}`||e.uidEvent||ba++}function Ea(e){const t=wa(e);return e.uidEvent=t,va[t]=va[t]||{},va[t]}function Aa(e,t,i=null){return Object.values(e).find(e=>e.callable===t&&e.delegationSelector===i)}function Sa(e,t,i){const n="string"==typeof t,r=n?i:t||i;let s=Da(e);return _a.has(s)||(s=e),[n,r,s]}function ka(e,t,i,n,r){if("string"!=typeof t||!e)return;let[s,o,a]=Sa(t,i,n);if(t in ya){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};o=e(o)}const l=Ea(e),c=l[a]||(l[a]={}),d=Aa(c,o,s?i:null);if(d)return void(d.oneOff=d.oneOff&&r);const u=wa(o,t.replace(fa,"")),h=s?function(e,t,i){return function n(r){const s=e.querySelectorAll(t);for(let{target:o}=r;o&&o!==this;o=o.parentNode)for(const a of s)if(a===o)return Ta(r,{delegateTarget:o}),n.oneOff&&xa.off(e,r.type,t,i),i.apply(o,[r])}}(e,i,o):function(e,t){return function i(n){return Ta(n,{delegateTarget:e}),i.oneOff&&xa.off(e,n.type,t),t.apply(e,[n])}}(e,o);h.delegationSelector=s?i:null,h.callable=o,h.oneOff=r,h.uidEvent=u,c[u]=h,e.addEventListener(a,h,s)}function Oa(e,t,i,n,r){const s=Aa(t[i],n,r);s&&(e.removeEventListener(i,s,Boolean(r)),delete t[i][s.uidEvent])}function Ca(e,t,i,n){const r=t[i]||{};for(const[s,o]of Object.entries(r))s.includes(n)&&Oa(e,t,i,o.callable,o.delegationSelector)}function Da(e){return e=e.replace(ga,""),ya[e]||e}const xa={on(e,t,i,n){ka(e,t,i,n,!1)},one(e,t,i,n){ka(e,t,i,n,!0)},off(e,t,i,n){if("string"!=typeof t||!e)return;const[r,s,o]=Sa(t,i,n),a=o!==t,l=Ea(e),c=l[o]||{},d=t.startsWith(".");if(void 0===s){if(d)for(const i of Object.keys(l))Ca(e,l,i,t.slice(1));for(const[i,n]of Object.entries(c)){const r=i.replace(ma,"");a&&!t.includes(r)||Oa(e,l,o,n.callable,n.delegationSelector)}}else{if(!Object.keys(c).length)return;Oa(e,l,o,s,r?i:null)}},trigger(e,t,i){if("string"!=typeof t||!e)return null;const n=aa();let r=null,s=!0,o=!0,a=!1;t!==Da(t)&&n&&(r=n.Event(t,i),n(e).trigger(r),s=!r.isPropagationStopped(),o=!r.isImmediatePropagationStopped(),a=r.isDefaultPrevented());const l=Ta(new Event(t,{bubbles:s,cancelable:!0}),i);return a&&l.preventDefault(),o&&e.dispatchEvent(l),l.defaultPrevented&&r&&r.preventDefault(),l}};function Ta(e,t={}){for(const[i,n]of Object.entries(t))try{e[i]=n}catch(t){Object.defineProperty(e,i,{configurable:!0,get:()=>n})}return e}function La(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch(t){return e}}function Ia(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}const Fa={setDataAttribute(e,t,i){e.setAttribute(`data-bs-${Ia(t)}`,i)},removeDataAttribute(e,t){e.removeAttribute(`data-bs-${Ia(t)}`)},getDataAttributes(e){if(!e)return{};const t={},i=Object.keys(e.dataset).filter(e=>e.startsWith("bs")&&!e.startsWith("bsConfig"));for(const n of i){let i=n.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1),t[i]=La(e.dataset[n])}return t},getDataAttribute:(e,t)=>La(e.getAttribute(`data-bs-${Ia(t)}`))};class Ma{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const i=ea(t)?Fa.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof i?i:{},...ea(t)?Fa.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e,t=this.constructor.DefaultType){for(const[i,n]of Object.entries(t)){const t=e[i],r=ea(t)?"element":Jo(t);if(!new RegExp(n).test(r))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${i}" provided type "${r}" but expected type "${n}".`)}}}class Na extends Ma{constructor(e,t){super(),(e=ta(e))&&(this._element=e,this._config=this._getConfig(t),Xo.set(this._element,this.constructor.DATA_KEY,this))}dispose(){Xo.remove(this._element,this.constructor.DATA_KEY),xa.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t,i=!0){ha(e,t,i)}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return Xo.get(ta(e),this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"5.3.7"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const ja=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let i=e.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),t=i&&"#"!==i?i.trim():null}return t?t.split(",").map(e=>Go(e)).join(","):null},Pa={find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter(e=>e.matches(t)),parents(e,t){const i=[];let n=e.parentNode.closest(t);for(;n;)i.push(n),n=n.parentNode.closest(t);return i},prev(e,t){let i=e.previousElementSibling;for(;i;){if(i.matches(t))return[i];i=i.previousElementSibling}return[]},next(e,t){let i=e.nextElementSibling;for(;i;){if(i.matches(t))return[i];i=i.nextElementSibling}return[]},focusableChildren(e){const t=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(e=>`${e}:not([tabindex^="-"])`).join(",");return this.find(t,e).filter(e=>!na(e)&&ia(e))},getSelectorFromElement(e){const t=ja(e);return t&&Pa.findOne(t)?t:null},getElementFromSelector(e){const t=ja(e);return t?Pa.findOne(t):null},getMultipleElementsFromSelector(e){const t=ja(e);return t?Pa.find(t):[]}},$a=(e,t="hide")=>{const i=`click.dismiss${e.EVENT_KEY}`,n=e.NAME;xa.on(document,i,`[data-bs-dismiss="${n}"]`,function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),na(this))return;const r=Pa.getElementFromSelector(this)||this.closest(`.${n}`);e.getOrCreateInstance(r)[t]()})},Ha=".bs.alert",qa=`close${Ha}`,Ra=`closed${Ha}`;class Ba extends Na{static get NAME(){return"alert"}close(){if(xa.trigger(this._element,qa).defaultPrevented)return;this._element.classList.remove("show");const e=this._element.classList.contains("fade");this._queueCallback(()=>this._destroyElement(),this._element,e)}_destroyElement(){this._element.remove(),xa.trigger(this._element,Ra),this.dispose()}static jQueryInterface(e){return this.each(function(){const t=Ba.getOrCreateInstance(this);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}})}}$a(Ba,"close"),da(Ba);const Va='[data-bs-toggle="button"]';class za extends Na{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(e){return this.each(function(){const t=za.getOrCreateInstance(this);"toggle"===e&&t[e]()})}}xa.on(document,"click.bs.button.data-api",Va,e=>{e.preventDefault();const t=e.target.closest(Va);za.getOrCreateInstance(t).toggle()}),da(za);const Wa=".bs.swipe",Ya=`touchstart${Wa}`,Ka=`touchmove${Wa}`,Ua=`touchend${Wa}`,Xa=`pointerdown${Wa}`,Qa=`pointerup${Wa}`,Ga={endCallback:null,leftCallback:null,rightCallback:null},Ja={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class Za extends Ma{constructor(e,t){super(),this._element=e,e&&Za.isSupported()&&(this._config=this._getConfig(t),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return Ga}static get DefaultType(){return Ja}static get NAME(){return"swipe"}dispose(){xa.off(this._element,Wa)}_start(e){this._supportPointerEvents?this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX):this._deltaX=e.touches[0].clientX}_end(e){this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX-this._deltaX),this._handleSwipe(),ua(this._config.endCallback)}_move(e){this._deltaX=e.touches&&e.touches.length>1?0:e.touches[0].clientX-this._deltaX}_handleSwipe(){const e=Math.abs(this._deltaX);if(e<=40)return;const t=e/this._deltaX;this._deltaX=0,t&&ua(t>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(xa.on(this._element,Xa,e=>this._start(e)),xa.on(this._element,Qa,e=>this._end(e)),this._element.classList.add("pointer-event")):(xa.on(this._element,Ya,e=>this._start(e)),xa.on(this._element,Ka,e=>this._move(e)),xa.on(this._element,Ua,e=>this._end(e)))}_eventIsPointerPenTouch(e){return this._supportPointerEvents&&("pen"===e.pointerType||"touch"===e.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const el=".bs.carousel",tl=".data-api",il="ArrowLeft",nl="ArrowRight",rl="next",sl="prev",ol="left",al="right",ll=`slide${el}`,cl=`slid${el}`,dl=`keydown${el}`,ul=`mouseenter${el}`,hl=`mouseleave${el}`,pl=`dragstart${el}`,fl=`load${el}${tl}`,gl=`click${el}${tl}`,ml="carousel",vl="active",bl=".active",yl=".carousel-item",_l=bl+yl,wl={[il]:al,[nl]:ol},El={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},Al={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class Sl extends Na{constructor(e,t){super(e,t),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=Pa.findOne(".carousel-indicators",this._element),this._addEventListeners(),this._config.ride===ml&&this.cycle()}static get Default(){return El}static get DefaultType(){return Al}static get NAME(){return"carousel"}next(){this._slide(rl)}nextWhenVisible(){!document.hidden&&ia(this._element)&&this.next()}prev(){this._slide(sl)}pause(){this._isSliding&&Zo(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval(()=>this.nextWhenVisible(),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?xa.one(this._element,cl,()=>this.cycle()):this.cycle())}to(e){const t=this._getItems();if(e>t.length-1||e<0)return;if(this._isSliding)return void xa.one(this._element,cl,()=>this.to(e));const i=this._getItemIndex(this._getActive());if(i===e)return;const n=e>i?rl:sl;this._slide(n,t[e])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(e){return e.defaultInterval=e.interval,e}_addEventListeners(){this._config.keyboard&&xa.on(this._element,dl,e=>this._keydown(e)),"hover"===this._config.pause&&(xa.on(this._element,ul,()=>this.pause()),xa.on(this._element,hl,()=>this._maybeEnableCycle())),this._config.touch&&Za.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const e of Pa.find(".carousel-item img",this._element))xa.on(e,pl,e=>e.preventDefault());const e={leftCallback:()=>this._slide(this._directionToOrder(ol)),rightCallback:()=>this._slide(this._directionToOrder(al)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout(()=>this._maybeEnableCycle(),500+this._config.interval))}};this._swipeHelper=new Za(this._element,e)}_keydown(e){if(/input|textarea/i.test(e.target.tagName))return;const t=wl[e.key];t&&(e.preventDefault(),this._slide(this._directionToOrder(t)))}_getItemIndex(e){return this._getItems().indexOf(e)}_setActiveIndicatorElement(e){if(!this._indicatorsElement)return;const t=Pa.findOne(bl,this._indicatorsElement);t.classList.remove(vl),t.removeAttribute("aria-current");const i=Pa.findOne(`[data-bs-slide-to="${e}"]`,this._indicatorsElement);i&&(i.classList.add(vl),i.setAttribute("aria-current","true"))}_updateInterval(){const e=this._activeElement||this._getActive();if(!e)return;const t=Number.parseInt(e.getAttribute("data-bs-interval"),10);this._config.interval=t||this._config.defaultInterval}_slide(e,t=null){if(this._isSliding)return;const i=this._getActive(),n=e===rl,r=t||pa(this._getItems(),i,n,this._config.wrap);if(r===i)return;const s=this._getItemIndex(r),o=t=>xa.trigger(this._element,t,{relatedTarget:r,direction:this._orderToDirection(e),from:this._getItemIndex(i),to:s});if(o(ll).defaultPrevented)return;if(!i||!r)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(s),this._activeElement=r;const l=n?"carousel-item-start":"carousel-item-end",c=n?"carousel-item-next":"carousel-item-prev";r.classList.add(c),oa(r),i.classList.add(l),r.classList.add(l);this._queueCallback(()=>{r.classList.remove(l,c),r.classList.add(vl),i.classList.remove(vl,c,l),this._isSliding=!1,o(cl)},i,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains("slide")}_getActive(){return Pa.findOne(_l,this._element)}_getItems(){return Pa.find(yl,this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(e){return ca()?e===ol?sl:rl:e===ol?rl:sl}_orderToDirection(e){return ca()?e===sl?ol:al:e===sl?al:ol}static jQueryInterface(e){return this.each(function(){const t=Sl.getOrCreateInstance(this,e);if("number"!=typeof e){if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e]()}}else t.to(e)})}}xa.on(document,gl,"[data-bs-slide], [data-bs-slide-to]",function(e){const t=Pa.getElementFromSelector(this);if(!t||!t.classList.contains(ml))return;e.preventDefault();const i=Sl.getOrCreateInstance(t),n=this.getAttribute("data-bs-slide-to");return n?(i.to(n),void i._maybeEnableCycle()):"next"===Fa.getDataAttribute(this,"slide")?(i.next(),void i._maybeEnableCycle()):(i.prev(),void i._maybeEnableCycle())}),xa.on(window,fl,()=>{const e=Pa.find('[data-bs-ride="carousel"]');for(const t of e)Sl.getOrCreateInstance(t)}),da(Sl);const kl=".bs.collapse",Ol=`show${kl}`,Cl=`shown${kl}`,Dl=`hide${kl}`,xl=`hidden${kl}`,Tl=`click${kl}.data-api`,Ll="show",Il="collapse",Fl="collapsing",Ml=`:scope .${Il} .${Il}`,Nl='[data-bs-toggle="collapse"]',jl={parent:null,toggle:!0},Pl={parent:"(null|element)",toggle:"boolean"};class $l extends Na{constructor(e,t){super(e,t),this._isTransitioning=!1,this._triggerArray=[];const i=Pa.find(Nl);for(const e of i){const t=Pa.getSelectorFromElement(e),i=Pa.find(t).filter(e=>e===this._element);null!==t&&i.length&&this._triggerArray.push(e)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return jl}static get DefaultType(){return Pl}static get NAME(){return"collapse"}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let e=[];if(this._config.parent&&(e=this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter(e=>e!==this._element).map(e=>$l.getOrCreateInstance(e,{toggle:!1}))),e.length&&e[0]._isTransitioning)return;if(xa.trigger(this._element,Ol).defaultPrevented)return;for(const t of e)t.hide();const t=this._getDimension();this._element.classList.remove(Il),this._element.classList.add(Fl),this._element.style[t]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const i=`scroll${t[0].toUpperCase()+t.slice(1)}`;this._queueCallback(()=>{this._isTransitioning=!1,this._element.classList.remove(Fl),this._element.classList.add(Il,Ll),this._element.style[t]="",xa.trigger(this._element,Cl)},this._element,!0),this._element.style[t]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(xa.trigger(this._element,Dl).defaultPrevented)return;const e=this._getDimension();this._element.style[e]=`${this._element.getBoundingClientRect()[e]}px`,oa(this._element),this._element.classList.add(Fl),this._element.classList.remove(Il,Ll);for(const e of this._triggerArray){const t=Pa.getElementFromSelector(e);t&&!this._isShown(t)&&this._addAriaAndCollapsedClass([e],!1)}this._isTransitioning=!0;this._element.style[e]="",this._queueCallback(()=>{this._isTransitioning=!1,this._element.classList.remove(Fl),this._element.classList.add(Il),xa.trigger(this._element,xl)},this._element,!0)}_isShown(e=this._element){return e.classList.contains(Ll)}_configAfterMerge(e){return e.toggle=Boolean(e.toggle),e.parent=ta(e.parent),e}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const e=this._getFirstLevelChildren(Nl);for(const t of e){const e=Pa.getElementFromSelector(t);e&&this._addAriaAndCollapsedClass([t],this._isShown(e))}}_getFirstLevelChildren(e){const t=Pa.find(Ml,this._config.parent);return Pa.find(e,this._config.parent).filter(e=>!t.includes(e))}_addAriaAndCollapsedClass(e,t){if(e.length)for(const i of e)i.classList.toggle("collapsed",!t),i.setAttribute("aria-expanded",t)}static jQueryInterface(e){const t={};return"string"==typeof e&&/show|hide/.test(e)&&(t.toggle=!1),this.each(function(){const i=$l.getOrCreateInstance(this,t);if("string"==typeof e){if(void 0===i[e])throw new TypeError(`No method named "${e}"`);i[e]()}})}}xa.on(document,Tl,Nl,function(e){("A"===e.target.tagName||e.delegateTarget&&"A"===e.delegateTarget.tagName)&&e.preventDefault();for(const e of Pa.getMultipleElementsFromSelector(this))$l.getOrCreateInstance(e,{toggle:!1}).toggle()}),da($l);const Hl="dropdown",ql=".bs.dropdown",Rl=".data-api",Bl="ArrowUp",Vl="ArrowDown",zl=`hide${ql}`,Wl=`hidden${ql}`,Yl=`show${ql}`,Kl=`shown${ql}`,Ul=`click${ql}${Rl}`,Xl=`keydown${ql}${Rl}`,Ql=`keyup${ql}${Rl}`,Gl="show",Jl='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',Zl=`${Jl}.${Gl}`,ec=".dropdown-menu",tc=ca()?"top-end":"top-start",ic=ca()?"top-start":"top-end",nc=ca()?"bottom-end":"bottom-start",rc=ca()?"bottom-start":"bottom-end",sc=ca()?"left-start":"right-start",oc=ca()?"right-start":"left-start",ac={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},lc={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class cc extends Na{constructor(e,t){super(e,t),this._popper=null,this._parent=this._element.parentNode,this._menu=Pa.next(this._element,ec)[0]||Pa.prev(this._element,ec)[0]||Pa.findOne(ec,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return ac}static get DefaultType(){return lc}static get NAME(){return Hl}toggle(){return this._isShown()?this.hide():this.show()}show(){if(na(this._element)||this._isShown())return;const e={relatedTarget:this._element};if(!xa.trigger(this._element,Yl,e).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(".navbar-nav"))for(const e of[].concat(...document.body.children))xa.on(e,"mouseover",sa);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(Gl),this._element.classList.add(Gl),xa.trigger(this._element,Kl,e)}}hide(){if(na(this._element)||!this._isShown())return;const e={relatedTarget:this._element};this._completeHide(e)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(e){if(!xa.trigger(this._element,zl,e).defaultPrevented){if("ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))xa.off(e,"mouseover",sa);this._popper&&this._popper.destroy(),this._menu.classList.remove(Gl),this._element.classList.remove(Gl),this._element.setAttribute("aria-expanded","false"),Fa.removeDataAttribute(this._menu,"popper"),xa.trigger(this._element,Wl,e),this._element.focus()}}_getConfig(e){if("object"==typeof(e=super._getConfig(e)).reference&&!ea(e.reference)&&"function"!=typeof e.reference.getBoundingClientRect)throw new TypeError(`${Hl.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return e}_createPopper(){if(void 0===Ko)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org/docs/v2/)");let e=this._element;"parent"===this._config.reference?e=this._parent:ea(this._config.reference)?e=ta(this._config.reference):"object"==typeof this._config.reference&&(e=this._config.reference);const t=this._getPopperConfig();this._popper=Yo(e,this._menu,t)}_isShown(){return this._menu.classList.contains(Gl)}_getPlacement(){const e=this._parent;if(e.classList.contains("dropend"))return sc;if(e.classList.contains("dropstart"))return oc;if(e.classList.contains("dropup-center"))return"top";if(e.classList.contains("dropdown-center"))return"bottom";const t="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return e.classList.contains("dropup")?t?ic:tc:t?rc:nc}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:e}=this._config;return"string"==typeof e?e.split(",").map(e=>Number.parseInt(e,10)):"function"==typeof e?t=>e(t,this._element):e}_getPopperConfig(){const e={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(Fa.setDataAttribute(this._menu,"popper","static"),e.modifiers=[{name:"applyStyles",enabled:!1}]),{...e,...ua(this._config.popperConfig,[void 0,e])}}_selectMenuItem({key:e,target:t}){const i=Pa.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter(e=>ia(e));i.length&&pa(i,t,e===Vl,!i.includes(t)).focus()}static jQueryInterface(e){return this.each(function(){const t=cc.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}})}static clearMenus(e){if(2===e.button||"keyup"===e.type&&"Tab"!==e.key)return;const t=Pa.find(Zl);for(const i of t){const t=cc.getInstance(i);if(!t||!1===t._config.autoClose)continue;const n=e.composedPath(),r=n.includes(t._menu);if(n.includes(t._element)||"inside"===t._config.autoClose&&!r||"outside"===t._config.autoClose&&r)continue;if(t._menu.contains(e.target)&&("keyup"===e.type&&"Tab"===e.key||/input|select|option|textarea|form/i.test(e.target.tagName)))continue;const s={relatedTarget:t._element};"click"===e.type&&(s.clickEvent=e),t._completeHide(s)}}static dataApiKeydownHandler(e){const t=/input|textarea/i.test(e.target.tagName),i="Escape"===e.key,n=[Bl,Vl].includes(e.key);if(!n&&!i)return;if(t&&!i)return;e.preventDefault();const r=this.matches(Jl)?this:Pa.prev(this,Jl)[0]||Pa.next(this,Jl)[0]||Pa.findOne(Jl,e.delegateTarget.parentNode),s=cc.getOrCreateInstance(r);if(n)return e.stopPropagation(),s.show(),void s._selectMenuItem(e);s._isShown()&&(e.stopPropagation(),s.hide(),r.focus())}}xa.on(document,Xl,Jl,cc.dataApiKeydownHandler),xa.on(document,Xl,ec,cc.dataApiKeydownHandler),xa.on(document,Ul,cc.clearMenus),xa.on(document,Ql,cc.clearMenus),xa.on(document,Ul,Jl,function(e){e.preventDefault(),cc.getOrCreateInstance(this).toggle()}),da(cc);const dc="backdrop",uc="show",hc=`mousedown.bs.${dc}`,pc={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},fc={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class gc extends Ma{constructor(e){super(),this._config=this._getConfig(e),this._isAppended=!1,this._element=null}static get Default(){return pc}static get DefaultType(){return fc}static get NAME(){return dc}show(e){if(!this._config.isVisible)return void ua(e);this._append();const t=this._getElement();this._config.isAnimated&&oa(t),t.classList.add(uc),this._emulateAnimation(()=>{ua(e)})}hide(e){this._config.isVisible?(this._getElement().classList.remove(uc),this._emulateAnimation(()=>{this.dispose(),ua(e)})):ua(e)}dispose(){this._isAppended&&(xa.off(this._element,hc),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const e=document.createElement("div");e.className=this._config.className,this._config.isAnimated&&e.classList.add("fade"),this._element=e}return this._element}_configAfterMerge(e){return e.rootElement=ta(e.rootElement),e}_append(){if(this._isAppended)return;const e=this._getElement();this._config.rootElement.append(e),xa.on(e,hc,()=>{ua(this._config.clickCallback)}),this._isAppended=!0}_emulateAnimation(e){ha(e,this._getElement(),this._config.isAnimated)}}const mc=".bs.focustrap",vc=`focusin${mc}`,bc=`keydown.tab${mc}`,yc="backward",_c={autofocus:!0,trapElement:null},wc={autofocus:"boolean",trapElement:"element"};class Ec extends Ma{constructor(e){super(),this._config=this._getConfig(e),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return _c}static get DefaultType(){return wc}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),xa.off(document,mc),xa.on(document,vc,e=>this._handleFocusin(e)),xa.on(document,bc,e=>this._handleKeydown(e)),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,xa.off(document,mc))}_handleFocusin(e){const{trapElement:t}=this._config;if(e.target===document||e.target===t||t.contains(e.target))return;const i=Pa.focusableChildren(t);0===i.length?t.focus():this._lastTabNavDirection===yc?i[i.length-1].focus():i[0].focus()}_handleKeydown(e){"Tab"===e.key&&(this._lastTabNavDirection=e.shiftKey?yc:"forward")}}const Ac=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",Sc=".sticky-top",kc="padding-right",Oc="margin-right";class Cc{constructor(){this._element=document.body}getWidth(){const e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}hide(){const e=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,kc,t=>t+e),this._setElementAttributes(Ac,kc,t=>t+e),this._setElementAttributes(Sc,Oc,t=>t-e)}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,kc),this._resetElementAttributes(Ac,kc),this._resetElementAttributes(Sc,Oc)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(e,t,i){const n=this.getWidth();this._applyManipulationCallback(e,e=>{if(e!==this._element&&window.innerWidth>e.clientWidth+n)return;this._saveInitialAttribute(e,t);const r=window.getComputedStyle(e).getPropertyValue(t);e.style.setProperty(t,`${i(Number.parseFloat(r))}px`)})}_saveInitialAttribute(e,t){const i=e.style.getPropertyValue(t);i&&Fa.setDataAttribute(e,t,i)}_resetElementAttributes(e,t){this._applyManipulationCallback(e,e=>{const i=Fa.getDataAttribute(e,t);null!==i?(Fa.removeDataAttribute(e,t),e.style.setProperty(t,i)):e.style.removeProperty(t)})}_applyManipulationCallback(e,t){if(ea(e))t(e);else for(const i of Pa.find(e,this._element))t(i)}}const Dc=".bs.modal",xc=`hide${Dc}`,Tc=`hidePrevented${Dc}`,Lc=`hidden${Dc}`,Ic=`show${Dc}`,Fc=`shown${Dc}`,Mc=`resize${Dc}`,Nc=`click.dismiss${Dc}`,jc=`mousedown.dismiss${Dc}`,Pc=`keydown.dismiss${Dc}`,$c=`click${Dc}.data-api`,Hc="modal-open",qc="show",Rc="modal-static",Bc={backdrop:!0,focus:!0,keyboard:!0},Vc={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class zc extends Na{constructor(e,t){super(e,t),this._dialog=Pa.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new Cc,this._addEventListeners()}static get Default(){return Bc}static get DefaultType(){return Vc}static get NAME(){return"modal"}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown||this._isTransitioning)return;xa.trigger(this._element,Ic,{relatedTarget:e}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(Hc),this._adjustDialog(),this._backdrop.show(()=>this._showElement(e)))}hide(){if(!this._isShown||this._isTransitioning)return;xa.trigger(this._element,xc).defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(qc),this._queueCallback(()=>this._hideModal(),this._element,this._isAnimated()))}dispose(){xa.off(window,Dc),xa.off(this._dialog,Dc),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new gc({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Ec({trapElement:this._element})}_showElement(e){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const t=Pa.findOne(".modal-body",this._dialog);t&&(t.scrollTop=0),oa(this._element),this._element.classList.add(qc);this._queueCallback(()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,xa.trigger(this._element,Fc,{relatedTarget:e})},this._dialog,this._isAnimated())}_addEventListeners(){xa.on(this._element,Pc,e=>{"Escape"===e.key&&(this._config.keyboard?this.hide():this._triggerBackdropTransition())}),xa.on(window,Mc,()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()}),xa.on(this._element,jc,e=>{xa.one(this._element,Nc,t=>{this._element===e.target&&this._element===t.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())})})}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide(()=>{document.body.classList.remove(Hc),this._resetAdjustments(),this._scrollBar.reset(),xa.trigger(this._element,Lc)})}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(xa.trigger(this._element,Tc).defaultPrevented)return;const e=this._element.scrollHeight>document.documentElement.clientHeight,t=this._element.style.overflowY;"hidden"===t||this._element.classList.contains(Rc)||(e||(this._element.style.overflowY="hidden"),this._element.classList.add(Rc),this._queueCallback(()=>{this._element.classList.remove(Rc),this._queueCallback(()=>{this._element.style.overflowY=t},this._dialog)},this._dialog),this._element.focus())}_adjustDialog(){const e=this._element.scrollHeight>document.documentElement.clientHeight,t=this._scrollBar.getWidth(),i=t>0;if(i&&!e){const e=ca()?"paddingLeft":"paddingRight";this._element.style[e]=`${t}px`}if(!i&&e){const e=ca()?"paddingRight":"paddingLeft";this._element.style[e]=`${t}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(e,t){return this.each(function(){const i=zc.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===i[e])throw new TypeError(`No method named "${e}"`);i[e](t)}})}}xa.on(document,$c,'[data-bs-toggle="modal"]',function(e){const t=Pa.getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&e.preventDefault(),xa.one(t,Ic,e=>{e.defaultPrevented||xa.one(t,Lc,()=>{ia(this)&&this.focus()})});const i=Pa.findOne(".modal.show");i&&zc.getInstance(i).hide();zc.getOrCreateInstance(t).toggle(this)}),$a(zc),da(zc);const Wc=".bs.offcanvas",Yc=".data-api",Kc=`load${Wc}${Yc}`,Uc="show",Xc="showing",Qc="hiding",Gc=".offcanvas.show",Jc=`show${Wc}`,Zc=`shown${Wc}`,ed=`hide${Wc}`,td=`hidePrevented${Wc}`,id=`hidden${Wc}`,nd=`resize${Wc}`,rd=`click${Wc}${Yc}`,sd=`keydown.dismiss${Wc}`,od={backdrop:!0,keyboard:!0,scroll:!1},ad={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class ld extends Na{constructor(e,t){super(e,t),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return od}static get DefaultType(){return ad}static get NAME(){return"offcanvas"}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown)return;if(xa.trigger(this._element,Jc,{relatedTarget:e}).defaultPrevented)return;this._isShown=!0,this._backdrop.show(),this._config.scroll||(new Cc).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(Xc);this._queueCallback(()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(Uc),this._element.classList.remove(Xc),xa.trigger(this._element,Zc,{relatedTarget:e})},this._element,!0)}hide(){if(!this._isShown)return;if(xa.trigger(this._element,ed).defaultPrevented)return;this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(Qc),this._backdrop.hide();this._queueCallback(()=>{this._element.classList.remove(Uc,Qc),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new Cc).reset(),xa.trigger(this._element,id)},this._element,!0)}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const e=Boolean(this._config.backdrop);return new gc({className:"offcanvas-backdrop",isVisible:e,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:e?()=>{"static"!==this._config.backdrop?this.hide():xa.trigger(this._element,td)}:null})}_initializeFocusTrap(){return new Ec({trapElement:this._element})}_addEventListeners(){xa.on(this._element,sd,e=>{"Escape"===e.key&&(this._config.keyboard?this.hide():xa.trigger(this._element,td))})}static jQueryInterface(e){return this.each(function(){const t=ld.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}})}}xa.on(document,rd,'[data-bs-toggle="offcanvas"]',function(e){const t=Pa.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&e.preventDefault(),na(this))return;xa.one(t,id,()=>{ia(this)&&this.focus()});const i=Pa.findOne(Gc);i&&i!==t&&ld.getInstance(i).hide();ld.getOrCreateInstance(t).toggle(this)}),xa.on(window,Kc,()=>{for(const e of Pa.find(Gc))ld.getOrCreateInstance(e).show()}),xa.on(window,nd,()=>{for(const e of Pa.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(e).position&&ld.getOrCreateInstance(e).hide()}),$a(ld),da(ld);const cd={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],dd:[],div:[],dl:[],dt:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},dd=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),ud=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,hd=(e,t)=>{const i=e.nodeName.toLowerCase();return t.includes(i)?!dd.has(i)||Boolean(ud.test(e.nodeValue)):t.filter(e=>e instanceof RegExp).some(e=>e.test(i))};const pd={allowList:cd,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"<div></div>"},fd={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},gd={entry:"(string|element|function|null)",selector:"(string|element)"};class md extends Ma{constructor(e){super(),this._config=this._getConfig(e)}static get Default(){return pd}static get DefaultType(){return fd}static get NAME(){return"TemplateFactory"}getContent(){return Object.values(this._config.content).map(e=>this._resolvePossibleFunction(e)).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(e){return this._checkContent(e),this._config.content={...this._config.content,...e},this}toHtml(){const e=document.createElement("div");e.innerHTML=this._maybeSanitize(this._config.template);for(const[t,i]of Object.entries(this._config.content))this._setContent(e,i,t);const t=e.children[0],i=this._resolvePossibleFunction(this._config.extraClass);return i&&t.classList.add(...i.split(" ")),t}_typeCheckConfig(e){super._typeCheckConfig(e),this._checkContent(e.content)}_checkContent(e){for(const[t,i]of Object.entries(e))super._typeCheckConfig({selector:t,entry:i},gd)}_setContent(e,t,i){const n=Pa.findOne(i,e);n&&((t=this._resolvePossibleFunction(t))?ea(t)?this._putElementInTemplate(ta(t),n):this._config.html?n.innerHTML=this._maybeSanitize(t):n.textContent=t:n.remove())}_maybeSanitize(e){return this._config.sanitize?function(e,t,i){if(!e.length)return e;if(i&&"function"==typeof i)return i(e);const n=(new window.DOMParser).parseFromString(e,"text/html"),r=[].concat(...n.body.querySelectorAll("*"));for(const e of r){const i=e.nodeName.toLowerCase();if(!Object.keys(t).includes(i)){e.remove();continue}const n=[].concat(...e.attributes),r=[].concat(t["*"]||[],t[i]||[]);for(const t of n)hd(t,r)||e.removeAttribute(t.nodeName)}return n.body.innerHTML}(e,this._config.allowList,this._config.sanitizeFn):e}_resolvePossibleFunction(e){return ua(e,[void 0,this])}_putElementInTemplate(e,t){if(this._config.html)return t.innerHTML="",void t.append(e);t.textContent=e.textContent}}const vd=new Set(["sanitize","allowList","sanitizeFn"]),bd="fade",yd="show",_d=".tooltip-inner",wd=".modal",Ed="hide.bs.modal",Ad="hover",Sd="focus",kd="click",Od={AUTO:"auto",TOP:"top",RIGHT:ca()?"left":"right",BOTTOM:"bottom",LEFT:ca()?"right":"left"},Cd={allowList:cd,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,6],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',title:"",trigger:"hover focus"},Dd={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class xd extends Na{constructor(e,t){if(void 0===Ko)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org/docs/v2/)");super(e,t),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return Cd}static get DefaultType(){return Dd}static get NAME(){return"tooltip"}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),xa.off(this._element.closest(wd),Ed,this._hideModalHandler),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const e=xa.trigger(this._element,this.constructor.eventName("show")),t=(ra(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(e.defaultPrevented||!t)return;this._disposePopper();const i=this._getTipElement();this._element.setAttribute("aria-describedby",i.getAttribute("id"));const{container:n}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(n.append(i),xa.trigger(this._element,this.constructor.eventName("inserted"))),this._popper=this._createPopper(i),i.classList.add(yd),"ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))xa.on(e,"mouseover",sa);this._queueCallback(()=>{xa.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1},this.tip,this._isAnimated())}hide(){if(!this._isShown())return;if(xa.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented)return;if(this._getTipElement().classList.remove(yd),"ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))xa.off(e,"mouseover",sa);this._activeTrigger[kd]=!1,this._activeTrigger[Sd]=!1,this._activeTrigger[Ad]=!1,this._isHovered=null;this._queueCallback(()=>{this._isWithActiveTrigger()||(this._isHovered||this._disposePopper(),this._element.removeAttribute("aria-describedby"),xa.trigger(this._element,this.constructor.eventName("hidden")))},this.tip,this._isAnimated())}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(e){const t=this._getTemplateFactory(e).toHtml();if(!t)return null;t.classList.remove(bd,yd),t.classList.add(`bs-${this.constructor.NAME}-auto`);const i=(e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e})(this.constructor.NAME).toString();return t.setAttribute("id",i),this._isAnimated()&&t.classList.add(bd),t}setContent(e){this._newContent=e,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(e){return this._templateFactory?this._templateFactory.changeContent(e):this._templateFactory=new md({...this._config,content:e,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{[_d]:this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(e){return this.constructor.getOrCreateInstance(e.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(bd)}_isShown(){return this.tip&&this.tip.classList.contains(yd)}_createPopper(e){const t=ua(this._config.placement,[this,e,this._element]),i=Od[t.toUpperCase()];return Yo(this._element,e,this._getPopperConfig(i))}_getOffset(){const{offset:e}=this._config;return"string"==typeof e?e.split(",").map(e=>Number.parseInt(e,10)):"function"==typeof e?t=>e(t,this._element):e}_resolvePossibleFunction(e){return ua(e,[this._element,this._element])}_getPopperConfig(e){const t={placement:e,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:e=>{this._getTipElement().setAttribute("data-popper-placement",e.state.placement)}}]};return{...t,...ua(this._config.popperConfig,[void 0,t])}}_setListeners(){const e=this._config.trigger.split(" ");for(const t of e)if("click"===t)xa.on(this._element,this.constructor.eventName("click"),this._config.selector,e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger[kd]=!(t._isShown()&&t._activeTrigger[kd]),t.toggle()});else if("manual"!==t){const e=t===Ad?this.constructor.eventName("mouseenter"):this.constructor.eventName("focusin"),i=t===Ad?this.constructor.eventName("mouseleave"):this.constructor.eventName("focusout");xa.on(this._element,e,this._config.selector,e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger["focusin"===e.type?Sd:Ad]=!0,t._enter()}),xa.on(this._element,i,this._config.selector,e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger["focusout"===e.type?Sd:Ad]=t._element.contains(e.relatedTarget),t._leave()})}this._hideModalHandler=()=>{this._element&&this.hide()},xa.on(this._element.closest(wd),Ed,this._hideModalHandler)}_fixTitle(){const e=this._element.getAttribute("title");e&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",e),this._element.setAttribute("data-bs-original-title",e),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout(()=>{this._isHovered&&this.show()},this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout(()=>{this._isHovered||this.hide()},this._config.delay.hide))}_setTimeout(e,t){clearTimeout(this._timeout),this._timeout=setTimeout(e,t)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(e){const t=Fa.getDataAttributes(this._element);for(const e of Object.keys(t))vd.has(e)&&delete t[e];return e={...t,..."object"==typeof e&&e?e:{}},e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e.container=!1===e.container?document.body:ta(e.container),"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),e}_getDelegateConfig(){const e={};for(const[t,i]of Object.entries(this._config))this.constructor.Default[t]!==i&&(e[t]=i);return e.selector=!1,e.trigger="manual",e}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null),this.tip&&(this.tip.remove(),this.tip=null)}static jQueryInterface(e){return this.each(function(){const t=xd.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}})}}da(xd);const Td=".popover-header",Ld=".popover-body",Id={...xd.Default,content:"",offset:[0,8],placement:"right",template:'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>',trigger:"click"},Fd={...xd.DefaultType,content:"(null|string|element|function)"};class Md extends xd{static get Default(){return Id}static get DefaultType(){return Fd}static get NAME(){return"popover"}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{[Td]:this._getTitle(),[Ld]:this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(e){return this.each(function(){const t=Md.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}})}}da(Md);const Nd=".bs.scrollspy",jd=`activate${Nd}`,Pd=`click${Nd}`,$d=`load${Nd}.data-api`,Hd="active",qd="[href]",Rd=".nav-link",Bd=`${Rd}, .nav-item > ${Rd}, .list-group-item`,Vd={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},zd={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class Wd extends Na{constructor(e,t){super(e,t),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return Vd}static get DefaultType(){return zd}static get NAME(){return"scrollspy"}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const e of this._observableSections.values())this._observer.observe(e)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(e){return e.target=ta(e.target)||document.body,e.rootMargin=e.offset?`${e.offset}px 0px -30%`:e.rootMargin,"string"==typeof e.threshold&&(e.threshold=e.threshold.split(",").map(e=>Number.parseFloat(e))),e}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(xa.off(this._config.target,Pd),xa.on(this._config.target,Pd,qd,e=>{const t=this._observableSections.get(e.target.hash);if(t){e.preventDefault();const i=this._rootElement||window,n=t.offsetTop-this._element.offsetTop;if(i.scrollTo)return void i.scrollTo({top:n,behavior:"smooth"});i.scrollTop=n}}))}_getNewObserver(){const e={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver(e=>this._observerCallback(e),e)}_observerCallback(e){const t=e=>this._targetLinks.get(`#${e.target.id}`),i=e=>{this._previousScrollData.visibleEntryTop=e.target.offsetTop,this._process(t(e))},n=(this._rootElement||document.documentElement).scrollTop,r=n>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=n;for(const s of e){if(!s.isIntersecting){this._activeTarget=null,this._clearActiveClass(t(s));continue}const e=s.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(r&&e){if(i(s),!n)return}else r||e||i(s)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const e=Pa.find(qd,this._config.target);for(const t of e){if(!t.hash||na(t))continue;const e=Pa.findOne(decodeURI(t.hash),this._element);ia(e)&&(this._targetLinks.set(decodeURI(t.hash),t),this._observableSections.set(t.hash,e))}}_process(e){this._activeTarget!==e&&(this._clearActiveClass(this._config.target),this._activeTarget=e,e.classList.add(Hd),this._activateParents(e),xa.trigger(this._element,jd,{relatedTarget:e}))}_activateParents(e){if(e.classList.contains("dropdown-item"))Pa.findOne(".dropdown-toggle",e.closest(".dropdown")).classList.add(Hd);else for(const t of Pa.parents(e,".nav, .list-group"))for(const e of Pa.prev(t,Bd))e.classList.add(Hd)}_clearActiveClass(e){e.classList.remove(Hd);const t=Pa.find(`${qd}.${Hd}`,e);for(const e of t)e.classList.remove(Hd)}static jQueryInterface(e){return this.each(function(){const t=Wd.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e]()}})}}xa.on(window,$d,()=>{for(const e of Pa.find('[data-bs-spy="scroll"]'))Wd.getOrCreateInstance(e)}),da(Wd);const Yd=".bs.tab",Kd=`hide${Yd}`,Ud=`hidden${Yd}`,Xd=`show${Yd}`,Qd=`shown${Yd}`,Gd=`click${Yd}`,Jd=`keydown${Yd}`,Zd=`load${Yd}`,eu="ArrowLeft",tu="ArrowRight",iu="ArrowUp",nu="ArrowDown",ru="Home",su="End",ou="active",au="fade",lu="show",cu=".dropdown-toggle",du=`:not(${cu})`,uu='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',hu=`${`.nav-link${du}, .list-group-item${du}, [role="tab"]${du}`}, ${uu}`,pu=`.${ou}[data-bs-toggle="tab"], .${ou}[data-bs-toggle="pill"], .${ou}[data-bs-toggle="list"]`;class fu extends Na{constructor(e){super(e),this._parent=this._element.closest('.list-group, .nav, [role="tablist"]'),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),xa.on(this._element,Jd,e=>this._keydown(e)))}static get NAME(){return"tab"}show(){const e=this._element;if(this._elemIsActive(e))return;const t=this._getActiveElem(),i=t?xa.trigger(t,Kd,{relatedTarget:e}):null;xa.trigger(e,Xd,{relatedTarget:t}).defaultPrevented||i&&i.defaultPrevented||(this._deactivate(t,e),this._activate(e,t))}_activate(e,t){if(!e)return;e.classList.add(ou),this._activate(Pa.getElementFromSelector(e));this._queueCallback(()=>{"tab"===e.getAttribute("role")?(e.removeAttribute("tabindex"),e.setAttribute("aria-selected",!0),this._toggleDropDown(e,!0),xa.trigger(e,Qd,{relatedTarget:t})):e.classList.add(lu)},e,e.classList.contains(au))}_deactivate(e,t){if(!e)return;e.classList.remove(ou),e.blur(),this._deactivate(Pa.getElementFromSelector(e));this._queueCallback(()=>{"tab"===e.getAttribute("role")?(e.setAttribute("aria-selected",!1),e.setAttribute("tabindex","-1"),this._toggleDropDown(e,!1),xa.trigger(e,Ud,{relatedTarget:t})):e.classList.remove(lu)},e,e.classList.contains(au))}_keydown(e){if(![eu,tu,iu,nu,ru,su].includes(e.key))return;e.stopPropagation(),e.preventDefault();const t=this._getChildren().filter(e=>!na(e));let i;if([ru,su].includes(e.key))i=t[e.key===ru?0:t.length-1];else{const n=[tu,nu].includes(e.key);i=pa(t,e.target,n,!0)}i&&(i.focus({preventScroll:!0}),fu.getOrCreateInstance(i).show())}_getChildren(){return Pa.find(hu,this._parent)}_getActiveElem(){return this._getChildren().find(e=>this._elemIsActive(e))||null}_setInitialAttributes(e,t){this._setAttributeIfNotExists(e,"role","tablist");for(const e of t)this._setInitialAttributesOnChild(e)}_setInitialAttributesOnChild(e){e=this._getInnerElement(e);const t=this._elemIsActive(e),i=this._getOuterElement(e);e.setAttribute("aria-selected",t),i!==e&&this._setAttributeIfNotExists(i,"role","presentation"),t||e.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(e,"role","tab"),this._setInitialAttributesOnTargetPanel(e)}_setInitialAttributesOnTargetPanel(e){const t=Pa.getElementFromSelector(e);t&&(this._setAttributeIfNotExists(t,"role","tabpanel"),e.id&&this._setAttributeIfNotExists(t,"aria-labelledby",`${e.id}`))}_toggleDropDown(e,t){const i=this._getOuterElement(e);if(!i.classList.contains("dropdown"))return;const n=(e,n)=>{const r=Pa.findOne(e,i);r&&r.classList.toggle(n,t)};n(cu,ou),n(".dropdown-menu",lu),i.setAttribute("aria-expanded",t)}_setAttributeIfNotExists(e,t,i){e.hasAttribute(t)||e.setAttribute(t,i)}_elemIsActive(e){return e.classList.contains(ou)}_getInnerElement(e){return e.matches(hu)?e:Pa.findOne(hu,e)}_getOuterElement(e){return e.closest(".nav-item, .list-group-item")||e}static jQueryInterface(e){return this.each(function(){const t=fu.getOrCreateInstance(this);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e]()}})}}xa.on(document,Gd,uu,function(e){["A","AREA"].includes(this.tagName)&&e.preventDefault(),na(this)||fu.getOrCreateInstance(this).show()}),xa.on(window,Zd,()=>{for(const e of Pa.find(pu))fu.getOrCreateInstance(e)}),da(fu);const gu=".bs.toast",mu=`mouseover${gu}`,vu=`mouseout${gu}`,bu=`focusin${gu}`,yu=`focusout${gu}`,_u=`hide${gu}`,wu=`hidden${gu}`,Eu=`show${gu}`,Au=`shown${gu}`,Su="hide",ku="show",Ou="showing",Cu={animation:"boolean",autohide:"boolean",delay:"number"},Du={animation:!0,autohide:!0,delay:5e3};class xu extends Na{constructor(e,t){super(e,t),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Du}static get DefaultType(){return Cu}static get NAME(){return"toast"}show(){if(xa.trigger(this._element,Eu).defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");this._element.classList.remove(Su),oa(this._element),this._element.classList.add(ku,Ou),this._queueCallback(()=>{this._element.classList.remove(Ou),xa.trigger(this._element,Au),this._maybeScheduleHide()},this._element,this._config.animation)}hide(){if(!this.isShown())return;if(xa.trigger(this._element,_u).defaultPrevented)return;this._element.classList.add(Ou),this._queueCallback(()=>{this._element.classList.add(Su),this._element.classList.remove(Ou,ku),xa.trigger(this._element,wu)},this._element,this._config.animation)}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(ku),super.dispose()}isShown(){return this._element.classList.contains(ku)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout(()=>{this.hide()},this._config.delay)))}_onInteraction(e,t){switch(e.type){case"mouseover":case"mouseout":this._hasMouseInteraction=t;break;case"focusin":case"focusout":this._hasKeyboardInteraction=t}if(t)return void this._clearTimeout();const i=e.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){xa.on(this._element,mu,e=>this._onInteraction(e,!0)),xa.on(this._element,vu,e=>this._onInteraction(e,!1)),xa.on(this._element,bu,e=>this._onInteraction(e,!0)),xa.on(this._element,yu,e=>this._onInteraction(e,!1))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(e){return this.each(function(){const t=xu.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e](this)}})}}$a(xu),da(xu),document.addEventListener("DOMContentLoaded",()=>{Array.from(document.querySelectorAll(".dropdown")).forEach(e=>new cc(e)),f.formsHandler.netteForms=y,f.initialize(),((e,t={})=>{new hs(e,t)})(new ps(f),{datagrid:{plugins:[new rt,new st,new at,new lt,new ct,new tt(y),new nt(new gn),new et(new ds({buttonClass:"btn"})),new it(new mn(Ie)),new dt]}})});
20
20
  //# sourceMappingURL=datagrid-full.js.map