diff --git a/netbox/project-static/dist/netbox.js b/netbox/project-static/dist/netbox.js index 37ee33cc7c8..24b951df206 100644 --- a/netbox/project-static/dist/netbox.js +++ b/netbox/project-static/dist/netbox.js @@ -1,7 +1,7 @@ (()=>{var fh=Object.create;var Jo=Object.defineProperty,hh=Object.defineProperties,ph=Object.getOwnPropertyDescriptor,mh=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertyNames,Jc=Object.getOwnPropertySymbols,vh=Object.getPrototypeOf,Qc=Object.prototype.hasOwnProperty,_h=Object.prototype.propertyIsEnumerable;var $l=(ii,ti,ei)=>ti in ii?Jo(ii,ti,{enumerable:!0,configurable:!0,writable:!0,value:ei}):ii[ti]=ei,Xn=(ii,ti)=>{for(var ei in ti||(ti={}))Qc.call(ti,ei)&&$l(ii,ei,ti[ei]);if(Jc)for(var ei of Jc(ti))_h.call(ti,ei)&&$l(ii,ei,ti[ei]);return ii},Aa=(ii,ti)=>hh(ii,mh(ti)),Zc=ii=>Jo(ii,"__esModule",{value:!0});var Un=(ii,ti)=>()=>(ti||ii((ti={exports:{}}).exports,ti),ti.exports),yh=(ii,ti)=>{Zc(ii);for(var ei in ti)Jo(ii,ei,{get:ti[ei],enumerable:!0})},bh=(ii,ti,ei)=>{if(ti&&typeof ti=="object"||typeof ti=="function")for(let ni of gh(ti))!Qc.call(ii,ni)&&ni!=="default"&&Jo(ii,ni,{get:()=>ti[ni],enumerable:!(ei=ph(ti,ni))||ei.enumerable});return ii},Ls=ii=>bh(Zc(Jo(ii!=null?fh(vh(ii)):{},"default",ii&&ii.__esModule&&"default"in ii?{get:()=>ii.default,enumerable:!0}:{value:ii,enumerable:!0})),ii);var Rn=(ii,ti,ei)=>($l(ii,typeof ti!="symbol"?ti+"":ti,ei),ei);var fs=(ii,ti,ei)=>new Promise((ni,ri)=>{var si=fi=>{try{ci(ei.next(fi))}catch(vi){ri(vi)}},ai=fi=>{try{ci(ei.throw(fi))}catch(vi){ri(vi)}},ci=fi=>fi.done?ni(fi.value):Promise.resolve(fi.value).then(si,ai);ci((ei=ei.apply(ii,ti)).next())});var bd=Un((exports,module)=>{(function(ii,ti){typeof define=="function"&&define.amd?define([],ti):ii.htmx=ii.htmx||ti()})(typeof self!="undefined"?self:exports,function(){return function(){"use strict";var U={onLoad:t,process:vt,on:X,off:F,trigger:$,ajax:nr,find:R,findAll:O,closest:N,values:function(ii,ti){var ei=Pt(ii,ti||"post");return ei.values},remove:q,addClass:L,removeClass:T,toggleClass:A,takeClass:H,defineExtension:fr,removeExtension:cr,logAll:C,logger:null,config:{historyEnabled:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:!1,scrollBehavior:"smooth",defaultFocusScroll:!1},parseInterval:v,_:e,createEventSource:function(ii){return new EventSource(ii,{withCredentials:!0})},createWebSocket:function(ii){return new WebSocket(ii,[])},version:"1.8.0"},r={addTriggerHandler:st,bodyContains:K,canAccessLocalStorage:E,filterValues:Ut,hasAttribute:o,getAttributeValue:V,getClosestMatch:h,getExpressionVars:Qt,getHeaders:Bt,getInputValues:Pt,getInternalData:W,getSwapSpecification:_t,getTriggerSpecs:Me,getTarget:re,makeFragment:g,mergeObjects:Y,makeSettleInfo:Gt,oobSwap:ae,selectAndSwap:Ee,settleImmediately:Lt,shouldCancel:je,triggerEvent:$,triggerErrorEvent:J,withExtensions:xt},n=["get","post","put","delete","patch"],i=n.map(function(ii){return"[hx-"+ii+"], [data-hx-"+ii+"]"}).join(", ");function v(ii){if(ii!=null)return ii.slice(-2)=="ms"?parseFloat(ii.slice(0,-2))||void 0:ii.slice(-1)=="s"?parseFloat(ii.slice(0,-1))*1e3||void 0:ii.slice(-1)=="m"?parseFloat(ii.slice(0,-1))*1e3*60||void 0:parseFloat(ii)||void 0}function f(ii,ti){return ii.getAttribute&&ii.getAttribute(ti)}function o(ii,ti){return ii.hasAttribute&&(ii.hasAttribute(ti)||ii.hasAttribute("data-"+ti))}function V(ii,ti){return f(ii,ti)||f(ii,"data-"+ti)}function u(ii){return ii.parentElement}function _(){return document}function h(ii,ti){for(;ii&&!ti(ii);)ii=u(ii);return ii||null}function a(ii,ti,ei){var ni=V(ti,ei),ri=V(ti,"hx-disinherit");return ii!==ti&&ri&&(ri==="*"||ri.split(" ").indexOf(ei)>=0)?"unset":ni}function z(ii,ti){var ei=null;if(h(ii,function(ni){return ei=a(ii,ni,ti)}),ei!=="unset")return ei}function d(ii,ti){var ei=ii.matches||ii.matchesSelector||ii.msMatchesSelector||ii.mozMatchesSelector||ii.webkitMatchesSelector||ii.oMatchesSelector;return ei&&ei.call(ii,ti)}function s(ii){var ti=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,ei=ti.exec(ii);return ei?ei[1].toLowerCase():""}function l(ii,ti){for(var ei=new DOMParser,ni=ei.parseFromString(ii,"text/html"),ri=ni.body;ti>0;)ti--,ri=ri.firstChild;return ri==null&&(ri=_().createDocumentFragment()),ri}function g(ii){if(U.config.useTemplateFragments){var ti=l("",0);return ti.querySelector("template").content}else{var ei=s(ii);switch(ei){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return l(""+ii+"
",1);case"col":return l(""+ii+"
",2);case"tr":return l(""+ii+"
",2);case"td":case"th":return l(""+ii+"
",3);case"script":return l("
"+ii+"
",1);default:return l(ii,0)}}}function Z(ii){ii&&ii()}function p(ii,ti){return Object.prototype.toString.call(ii)==="[object "+ti+"]"}function m(ii){return p(ii,"Function")}function x(ii){return p(ii,"Object")}function W(ii){var ti="htmx-internal-data",ei=ii[ti];return ei||(ei=ii[ti]={}),ei}function y(ii){var ti=[];if(ii)for(var ei=0;ei=0}function K(ii){return ii.getRootNode()instanceof ShadowRoot?_().body.contains(ii.getRootNode().host):_().body.contains(ii)}function w(ii){return ii.trim().split(/\s+/)}function Y(ii,ti){for(var ei in ti)ti.hasOwnProperty(ei)&&(ii[ei]=ti[ei]);return ii}function S(ii){try{return JSON.parse(ii)}catch(ti){return yt(ti),null}}function E(){var ii="htmx:localStorageTest";try{return localStorage.setItem(ii,ii),localStorage.removeItem(ii),!0}catch(ti){return!1}}function e(e){return Zt(_().body,function(){return eval(e)})}function t(ii){var ti=U.on("htmx:load",function(ei){ii(ei.detail.elt)});return ti}function C(){U.logger=function(ii,ti,ei){console&&console.log(ti,ii,ei)}}function R(ii,ti){return ti?ii.querySelector(ti):R(_(),ii)}function O(ii,ti){return ti?ii.querySelectorAll(ti):O(_(),ii)}function q(ii,ti){ii=D(ii),ti?setTimeout(function(){q(ii)},ti):ii.parentElement.removeChild(ii)}function L(ii,ti,ei){ii=D(ii),ei?setTimeout(function(){L(ii,ti)},ei):ii.classList&&ii.classList.add(ti)}function T(ii,ti,ei){ii=D(ii),ei?setTimeout(function(){T(ii,ti)},ei):ii.classList&&(ii.classList.remove(ti),ii.classList.length===0&&ii.removeAttribute("class"))}function A(ii,ti){ii=D(ii),ii.classList.toggle(ti)}function H(ii,ti){ii=D(ii),G(ii.parentElement.children,function(ei){T(ei,ti)}),L(ii,ti)}function N(ii,ti){if(ii=D(ii),ii.closest)return ii.closest(ti);do if(ii==null||d(ii,ti))return ii;while(ii=ii&&u(ii))}function I(ii,ti){return ti.indexOf("closest ")===0?[N(ii,ti.substr(8))]:ti.indexOf("find ")===0?[R(ii,ti.substr(5))]:ti.indexOf("next ")===0?[k(ii,ti.substr(5))]:ti.indexOf("previous ")===0?[M(ii,ti.substr(9))]:ti==="document"?[document]:ti==="window"?[window]:_().querySelectorAll(ti)}var k=function(ii,ti){for(var ei=_().querySelectorAll(ti),ni=0;ni=0;ni--){var ri=ei[ni];if(ri.compareDocumentPosition(ii)===Node.DOCUMENT_POSITION_FOLLOWING)return ri}};function Q(ii,ti){return ti?I(ii,ti)[0]:I(_().body,ii)[0]}function D(ii){return p(ii,"String")?R(ii):ii}function P(ii,ti,ei){return m(ti)?{target:_().body,event:ii,listener:ti}:{target:D(ii),event:ti,listener:ei}}function X(ii,ti,ei){dr(function(){var ri=P(ii,ti,ei);ri.target.addEventListener(ri.event,ri.listener)});var ni=m(ti);return ni?ti:ei}function F(ii,ti,ei){return dr(function(){var ni=P(ii,ti,ei);ni.target.removeEventListener(ni.event,ni.listener)}),m(ti)?ti:ei}var ee=_().createElement("output");function j(ii,ti){var ei=z(ii,ti);if(ei){if(ei==="this")return[te(ii,ti)];var ni=I(ii,ei);return ni.length===0?(yt('The selector "'+ei+'" on '+ti+" returned no matches!"),[ee]):ni}}function te(ii,ti){return h(ii,function(ei){return V(ei,ti)!=null})}function re(ii){var ti=z(ii,"hx-target");if(ti)return ti==="this"?te(ii,"hx-target"):Q(ii,ti);var ei=W(ii);return ei.boosted?_().body:ii}function B(ii){for(var ti=U.config.attributesToSettle,ei=0;ei0?(ri=ii.substr(0,ii.indexOf(":")),ni=ii.substr(ii.indexOf(":")+1,ii.length)):ri=ii);var si=_().querySelectorAll(ni);return si?(G(si,function(ai){var ci,fi=ti.cloneNode(!0);ci=_().createDocumentFragment(),ci.appendChild(fi),ie(ri,ai)||(ci=fi);var vi={shouldSwap:!0,target:ai,fragment:ci};!$(ai,"htmx:oobBeforeSwap",vi)||(ai=vi.target,vi.shouldSwap&&we(ri,ai,ai,ci,ei),G(ei.elts,function(hi){$(hi,"htmx:oobAfterSwap",vi)}))}),ti.parentNode.removeChild(ti)):(ti.parentNode.removeChild(ti),J(_().body,"htmx:oobErrorNoTarget",{content:ti})),ii}function oe(ii,ti,ei){var ni=z(ii,"hx-select-oob");if(ni){var ri=ni.split(",");for(let vi=0;vi0){var ri=ii.querySelector(ni.tagName+"[id='"+ni.id+"']");if(ri&&ri!==ii){var si=ni.cloneNode();ne(ni,ri),ei.tasks.push(function(){ne(ni,si)})}}})}function ue(ii){return function(){T(ii,U.config.addedClass),vt(ii),ut(ii),fe(ii),$(ii,"htmx:load")}}function fe(ii){var ti="[autofocus]",ei=d(ii,ti)?ii:ii.querySelector(ti);ei!=null&&ei.focus()}function ce(ii,ti,ei,ni){for(le(ii,ei,ni);ei.childNodes.length>0;){var ri=ei.firstChild;L(ri,U.config.addedClass),ii.insertBefore(ri,ti),ri.nodeType!==Node.TEXT_NODE&&ri.nodeType!==Node.COMMENT_NODE&&ni.tasks.push(ue(ri))}}function he(ii){var ti=W(ii);ti.webSocket&&ti.webSocket.close(),ti.sseEventSource&&ti.sseEventSource.close(),$(ii,"htmx:beforeCleanupElement"),ti.listenerInfos&&G(ti.listenerInfos,function(ei){ii!==ei.on&&ei.on.removeEventListener(ei.trigger,ei.listener)}),ii.children&&G(ii.children,function(ei){he(ei)})}function de(ii,ti,ei){if(ii.tagName==="BODY")return ye(ii,ti,ei);var ni,ri=ii.previousSibling;for(ce(u(ii),ii,ti,ei),ri==null?ni=u(ii).firstChild:ni=ri.nextSibling,W(ii).replacedWith=ni,ei.elts=[];ni&&ni!==ii;)ni.nodeType===Node.ELEMENT_NODE&&ei.elts.push(ni),ni=ni.nextElementSibling;he(ii),u(ii).removeChild(ii)}function ve(ii,ti,ei){return ce(ii,ii.firstChild,ti,ei)}function ge(ii,ti,ei){return ce(u(ii),ii,ti,ei)}function pe(ii,ti,ei){return ce(ii,null,ti,ei)}function me(ii,ti,ei){return ce(u(ii),ii.nextSibling,ti,ei)}function xe(ii,ti,ei){return he(ii),u(ii).removeChild(ii)}function ye(ii,ti,ei){var ni=ii.firstChild;if(ce(ii,ni,ti,ei),ni){for(;ni.nextSibling;)he(ni.nextSibling),ii.removeChild(ni.nextSibling);he(ni),ii.removeChild(ni)}}function be(ii,ti){var ei=z(ii,"hx-select");if(ei){var ni=_().createDocumentFragment();G(ti.querySelectorAll(ei),function(ri){ni.appendChild(ri)}),ti=ni}return ti}function we(ii,ti,ei,ni,ri){switch(ii){case"none":return;case"outerHTML":de(ei,ni,ri);return;case"afterbegin":ve(ei,ni,ri);return;case"beforebegin":ge(ei,ni,ri);return;case"beforeend":pe(ei,ni,ri);return;case"afterend":me(ei,ni,ri);return;case"delete":xe(ei,ni,ri);return;default:for(var si=hr(ti),ai=0;ai-1){var ti=ii.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,""),ei=ti.match(/]*>|>)([\s\S]*?)<\/title>/im);if(ei)return ei[2]}}function Ee(ii,ti,ei,ni,ri){ri.title=Se(ni);var si=g(ni);if(si)return oe(ei,si,ri),si=be(ei,si),se(si),we(ii,ei,ti,si,ri)}function Ce(ii,ti,ei){var ni=ii.getResponseHeader(ti);if(ni.indexOf("{")===0){var ri=S(ni);for(var si in ri)if(ri.hasOwnProperty(si)){var ai=ri[si];x(ai)||(ai={value:ai}),$(ei,si,ai)}}else $(ei,ni,[])}var Re=/\s/,Oe=/[\s,]/,qe=/[_$a-zA-Z]/,Le=/[_$a-zA-Z0-9]/,Te=['"',"'","/"],Ae=/[^\s]/;function He(ii){for(var ti=[],ei=0;ei0;){var ai=ti[0];if(ai==="]"){if(ni--,ni===0){si===null&&(ri=ri+"true"),ti.shift(),ri+=")})";try{var ci=Zt(ii,function(){return Function(ri)()},function(){return!0});return ci.source=ri,ci}catch(fi){return J(_().body,"htmx:syntax:error",{error:fi,source:ri}),null}}}else ai==="["&&ni++;Ne(ai,si,ei)?ri+="(("+ei+"."+ai+") ? ("+ei+"."+ai+") : (window."+ai+"))":ri=ri+ai,si=ti.shift()}}}function c(ii,ti){for(var ei="";ii.length>0&&!ii[0].match(ti);)ei+=ii.shift();return ei}var ke="input, textarea, select";function Me(ii){var ti=V(ii,"hx-trigger"),ei=[];if(ti){var ni=He(ti);do{c(ni,Ae);var ri=ni.length,si=c(ni,/[,\[\s]/);if(si!=="")if(si==="every"){var ai={trigger:"every"};c(ni,Ae),ai.pollInterval=v(c(ni,/[,\[\s]/)),c(ni,Ae);var ci=Ie(ii,ni,"event");ci&&(ai.eventFilter=ci),ei.push(ai)}else if(si.indexOf("sse:")===0)ei.push({trigger:"sse",sseEvent:si.substr(4)});else{var fi={trigger:si},ci=Ie(ii,ni,"event");for(ci&&(fi.eventFilter=ci);ni.length>0&&ni[0]!==",";){c(ni,Ae);var vi=ni.shift();if(vi==="changed")fi.changed=!0;else if(vi==="once")fi.once=!0;else if(vi==="consume")fi.consume=!0;else if(vi==="delay"&&ni[0]===":")ni.shift(),fi.delay=v(c(ni,Oe));else if(vi==="from"&&ni[0]===":"){ni.shift();var hi=c(ni,Oe);(hi==="closest"||hi==="find"||hi==="next"||hi==="previous")&&(ni.shift(),hi+=" "+c(ni,Oe)),fi.from=hi}else vi==="target"&&ni[0]===":"?(ni.shift(),fi.target=c(ni,Oe)):vi==="throttle"&&ni[0]===":"?(ni.shift(),fi.throttle=v(c(ni,Oe))):vi==="queue"&&ni[0]===":"?(ni.shift(),fi.queue=c(ni,Oe)):(vi==="root"||vi==="threshold")&&ni[0]===":"?(ni.shift(),fi[vi]=c(ni,Oe)):J(ii,"htmx:syntax:error",{token:ni.shift()})}ei.push(fi)}ni.length===ri&&J(ii,"htmx:syntax:error",{token:ni.shift()}),c(ni,Ae)}while(ni[0]===","&&ni.shift())}return ei.length>0?ei:d(ii,"form")?[{trigger:"submit"}]:d(ii,'input[type="button"]')?[{trigger:"click"}]:d(ii,ke)?[{trigger:"change"}]:[{trigger:"click"}]}function De(ii){W(ii).cancelled=!0}function Pe(ii,ti,ei){var ni=W(ii);ni.timeout=setTimeout(function(){K(ii)&&ni.cancelled!==!0&&(Ue(ei,pt("hx:poll:trigger",{triggerSpec:ei,target:ii}))||ti(ii),Pe(ii,ti,ei))},ei.pollInterval)}function Xe(ii){return location.hostname===ii.hostname&&f(ii,"href")&&f(ii,"href").indexOf("#")!==0}function Fe(ii,ti,ei){if(ii.tagName==="A"&&Xe(ii)&&(ii.target===""||ii.target==="_self")||ii.tagName==="FORM"){ti.boosted=!0;var ni,ri;if(ii.tagName==="A")ni="get",ri=f(ii,"href");else{var si=f(ii,"method");ni=si?si.toLowerCase():"get",ri=f(ii,"action")}ei.forEach(function(ai){Ve(ii,function(ci){ar(ni,ri,ii,ci)},ti,ai,!0)})}}function je(ii,ti){return!!((ii.type==="submit"||ii.type==="click")&&(ti.tagName==="FORM"||d(ti,'input[type="submit"], button')&&N(ti,"form")!==null||ti.tagName==="A"&&ti.href&&(ti.getAttribute("href")==="#"||ti.getAttribute("href").indexOf("#")!==0)))}function Be(ii,ti){return W(ii).boosted&&ii.tagName==="A"&&ti.type==="click"&&(ti.ctrlKey||ti.metaKey)}function Ue(ii,ti){var ei=ii.eventFilter;if(ei)try{return ei(ti)!==!0}catch(ni){return J(_().body,"htmx:eventFilter:error",{error:ni,source:ei.source}),!0}return!1}function Ve(ii,ti,ei,ni,ri){var si;ni.from?si=I(ii,ni.from):si=[ii],G(si,function(ai){var ci=function(fi){if(!K(ii)){ai.removeEventListener(ni.trigger,ci);return}if(!Be(ii,fi)&&((ri||je(fi,ii))&&fi.preventDefault(),!Ue(ni,fi))){var vi=W(fi);vi.triggerSpec=ni,vi.handledFor==null&&(vi.handledFor=[]);var hi=W(ii);if(vi.handledFor.indexOf(ii)<0){if(vi.handledFor.push(ii),ni.consume&&fi.stopPropagation(),ni.target&&fi.target&&!d(fi.target,ni.target))return;if(ni.once){if(hi.triggeredOnce)return;hi.triggeredOnce=!0}if(ni.changed){if(hi.lastValue===ii.value)return;hi.lastValue=ii.value}if(hi.delayed&&clearTimeout(hi.delayed),hi.throttle)return;ni.throttle?hi.throttle||(ti(ii,fi),hi.throttle=setTimeout(function(){hi.throttle=null},ni.throttle)):ni.delay?hi.delayed=setTimeout(function(){ti(ii,fi)},ni.delay):ti(ii,fi)}}};ei.listenerInfos==null&&(ei.listenerInfos=[]),ei.listenerInfos.push({trigger:ni.trigger,listener:ci,on:ai}),ai.addEventListener(ni.trigger,ci)})}var _e=!1,ze=null;function We(){ze||(ze=function(){_e=!0},window.addEventListener("scroll",ze),setInterval(function(){_e&&(_e=!1,G(_().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(ii){Ge(ii)}))},200))}function Ge(ii){if(!o(ii,"data-hx-revealed")&&b(ii)){ii.setAttribute("data-hx-revealed","true");var ti=W(ii);ti.initialized?$(ii,"revealed"):ii.addEventListener("htmx:afterProcessNode",function(ei){$(ii,"revealed")},{once:!0})}}function Je(ii,ti,ei){for(var ni=w(ei),ri=0;ri=0){var ai=Ye(ei);setTimeout(function(){$e(ii,ti,ei+1)},ai)}},ri.onopen=function(si){ei=0},W(ii).webSocket=ri,ri.addEventListener("message",function(si){if(!Ze(ii)){var ai=si.data;xt(ii,function(wi){ai=wi.transformResponse(ai,null,ii)});for(var ci=Gt(ii),fi=g(ai),vi=y(fi.children),hi=0;hi0){$(ii,"htmx:validation:halted",ai);return}ni.send(JSON.stringify(hi)),je(ei,ii)&&ei.preventDefault()}):J(ii,"htmx:noWebSocketSourceError")}function Ye(ii){var ti=U.config.wsReconnectDelay;if(typeof ti=="function")return ti(ii);if(ti==="full-jitter"){var ei=Math.min(ii,6),ni=1e3*Math.pow(2,ei);return ni*Math.random()}yt('htmx.config.wsReconnectDelay must either be a function or the string "full-jitter"')}function Qe(ii,ti,ei){for(var ni=w(ei),ri=0;riU.config.historyCacheSize;)ri.shift();for(;ri.length>0;)try{localStorage.setItem("htmx-history-cache",JSON.stringify(ri));break}catch(ai){J(_().body,"htmx:historyCacheError",{cause:ai,cache:ri}),ri.shift()}}}function Et(ii){if(!E())return null;for(var ti=S(localStorage.getItem("htmx-history-cache"))||[],ei=0;ei=200&&this.status<400){$(_().body,"htmx:historyCacheMissLoad",ei);var ni=g(this.response);ni=ni.querySelector("[hx-history-elt],[data-hx-history-elt]")||ni;var ri=wt(),si=Gt(ri);ye(ri,ni,si),Lt(si.tasks),bt=ii,$(_().body,"htmx:historyRestore",{path:ii})}else J(_().body,"htmx:historyCacheMissLoadError",ei)},ti.send()}function At(ii){Rt(),ii=ii||location.pathname+location.search;var ti=Et(ii);if(ti){var ei=g(ti.content),ni=wt(),ri=Gt(ni);ye(ni,ei,ri),Lt(ri.tasks),document.title=ti.title,window.scrollTo(0,ti.scroll),bt=ii,$(_().body,"htmx:historyRestore",{path:ii})}else U.config.refreshOnHistoryMiss?window.location.reload(!0):Tt(ii)}function Ht(ii){var ti=j(ii,"hx-indicator");return ti==null&&(ti=[ii]),G(ti,function(ei){ei.classList.add.call(ei.classList,U.config.requestClass)}),ti}function Nt(ii){G(ii,function(ti){ti.classList.remove.call(ti.classList,U.config.requestClass)})}function It(ii,ti){for(var ei=0;ei=0}function _t(ii,ti){var ei=ti||z(ii,"hx-swap"),ni={swapStyle:W(ii).boosted?"innerHTML":U.config.defaultSwapStyle,swapDelay:U.config.defaultSwapDelay,settleDelay:U.config.defaultSettleDelay};if(W(ii).boosted&&!Vt(ii)&&(ni.show="top"),ei){var ri=w(ei);if(ri.length>0){ni.swapStyle=ri[0];for(var si=1;si0?fi.join(":"):null;ni.scroll=vi,ni.scrollTarget=hi}if(ai.indexOf("show:")===0){var bi=ai.substr(5),fi=bi.split(":"),wi=fi.pop(),hi=fi.length>0?fi.join(":"):null;ni.show=wi,ni.showTarget=hi}if(ai.indexOf("focus-scroll:")===0){var Ti=ai.substr("focus-scroll:".length);ni.focusScroll=Ti=="true"}}}}return ni}function zt(ii){return z(ii,"hx-encoding")==="multipart/form-data"||d(ii,"form")&&f(ii,"enctype")==="multipart/form-data"}function Wt(ii,ti,ei){var ni=null;return xt(ti,function(ri){ni==null&&(ni=ri.encodeParameters(ii,ei,ti))}),ni!=null?ni:zt(ti)?jt(ei):Ft(ei)}function Gt(ii){return{tasks:[],elts:[ii]}}function Jt(ii,ti){var ei=ii[0],ni=ii[ii.length-1];if(ti.scroll){var ri=null;ti.scrollTarget&&(ri=Q(ei,ti.scrollTarget)),ti.scroll==="top"&&(ei||ri)&&(ri=ri||ei,ri.scrollTop=0),ti.scroll==="bottom"&&(ni||ri)&&(ri=ri||ni,ri.scrollTop=ri.scrollHeight)}if(ti.show){var ri=null;if(ti.showTarget){var si=ti.showTarget;ti.showTarget==="window"&&(si="body"),ri=Q(ei,si)}ti.show==="top"&&(ei||ri)&&(ri=ri||ei,ri.scrollIntoView({block:"start",behavior:U.config.scrollBehavior})),ti.show==="bottom"&&(ni||ri)&&(ri=ri||ni,ri.scrollIntoView({block:"end",behavior:U.config.scrollBehavior}))}}function $t(ii,ti,ei,ni){if(ni==null&&(ni={}),ii==null)return ni;var ri=V(ii,ti);if(ri){var si=ri.trim(),ai=ei;si.indexOf("javascript:")===0?(si=si.substr(11),ai=!0):si.indexOf("js:")===0&&(si=si.substr(3),ai=!0),si.indexOf("{")!==0&&(si="{"+si+"}");var ci;ai?ci=Zt(ii,function(){return Function("return ("+si+")")()},{}):ci=S(si);for(var fi in ci)ci.hasOwnProperty(fi)&&ni[fi]==null&&(ni[fi]=ci[fi])}return $t(u(ii),ti,ei,ni)}function Zt(ii,ti,ei){return U.config.allowEval?ti():(J(ii,"htmx:evalDisallowedError"),ei)}function Kt(ii,ti){return $t(ii,"hx-vars",!0,ti)}function Yt(ii,ti){return $t(ii,"hx-vals",!1,ti)}function Qt(ii){return Y(Kt(ii),Yt(ii))}function er(ii,ti,ei){if(ei!==null)try{ii.setRequestHeader(ti,ei)}catch(ni){ii.setRequestHeader(ti,encodeURIComponent(ei)),ii.setRequestHeader(ti+"-URI-AutoEncoded","true")}}function tr(ii){if(ii.responseURL&&typeof URL!="undefined")try{var ti=new URL(ii.responseURL);return ti.pathname+ti.search}catch(ei){J(_().body,"htmx:badResponseUrl",{url:ii.responseURL})}}function rr(ii,ti){return ii.getAllResponseHeaders().match(ti)}function nr(ii,ti,ei){return ii=ii.toLowerCase(),ei?ei instanceof Element||p(ei,"String")?ar(ii,ti,null,null,{targetOverride:D(ei),returnPromise:!0}):ar(ii,ti,D(ei.source),ei.event,{handler:ei.handler,headers:ei.headers,values:ei.values,targetOverride:D(ei.target),swapOverride:ei.swap,returnPromise:!0}):ar(ii,ti,null,null,{returnPromise:!0})}function ir(ii){for(var ti=[];ii;)ti.push(ii),ii=ii.parentElement;return ti}function ar(ii,ti,ei,ni,ri){var si=null,ai=null;if(ri=ri!=null?ri:{},ri.returnPromise&&typeof Promise!="undefined")var ci=new Promise(function(fn,On){si=fn,ai=On});ei==null&&(ei=_().body);var fi=ri.handler||sr;if(!!K(ei)){var vi=ri.targetOverride||re(ei);if(vi==null||vi==ee){J(ei,"htmx:targetError",{target:V(ei,"hx-target")});return}var hi=ei,bi=W(ei),wi=z(ei,"hx-sync"),Ti=null,ki=!1;if(wi){var Ci=wi.split(":"),Bi=Ci[0].trim();if(Bi==="this"?hi=te(ei,"hx-sync"):hi=Q(ei,Bi),wi=(Ci[1]||"drop").trim(),bi=W(hi),wi==="drop"&&bi.xhr&&bi.abortable!==!0)return;if(wi==="abort"){if(bi.xhr)return;ki=!0}else if(wi==="replace")$(hi,"htmx:abort");else if(wi.indexOf("queue")===0){var rn=wi.split(" ");Ti=(rn[1]||"last").trim()}}if(bi.xhr)if(bi.abortable)$(hi,"htmx:abort");else{if(Ti==null){if(ni){var nn=W(ni);nn&&nn.triggerSpec&&nn.triggerSpec.queue&&(Ti=nn.triggerSpec.queue)}Ti==null&&(Ti="last")}bi.queuedRequests==null&&(bi.queuedRequests=[]),Ti==="first"&&bi.queuedRequests.length===0?bi.queuedRequests.push(function(){ar(ii,ti,ei,ni,ri)}):Ti==="all"?bi.queuedRequests.push(function(){ar(ii,ti,ei,ni,ri)}):Ti==="last"&&(bi.queuedRequests=[],bi.queuedRequests.push(function(){ar(ii,ti,ei,ni,ri)}));return}var Ji=new XMLHttpRequest;bi.xhr=Ji,bi.abortable=ki;var Yi=function(){if(bi.xhr=null,bi.abortable=!1,bi.queuedRequests!=null&&bi.queuedRequests.length>0){var fn=bi.queuedRequests.shift();fn()}},ln=z(ei,"hx-prompt");if(ln){var Gi=prompt(ln);if(Gi===null||!$(ei,"htmx:prompt",{prompt:Gi,target:vi}))return Z(si),Yi(),ci}var dn=z(ei,"hx-confirm");if(dn&&!confirm(dn))return Z(si),Yi(),ci;var un=Bt(ei,vi,Gi);ri.headers&&(un=Y(un,ri.headers));var pn=Pt(ei,ii),gn=pn.errors,Cn=pn.values;ri.values&&(Cn=Y(Cn,ri.values));var kn=Qt(ei),En=Y(Cn,kn),Li=Ut(En,ei);ii!=="get"&&!zt(ei)&&(un["Content-Type"]="application/x-www-form-urlencoded"),(ti==null||ti==="")&&(ti=_().location.href);var Ui=$t(ei,"hx-request"),ji={parameters:Li,unfilteredParameters:En,headers:un,target:vi,verb:ii,errors:gn,withCredentials:ri.credentials||Ui.credentials||U.config.withCredentials,timeout:ri.timeout||Ui.timeout||U.config.timeout,path:ti,triggeringEvent:ni};if(!$(ei,"htmx:configRequest",ji))return Z(si),Yi(),ci;if(ti=ji.path,ii=ji.verb,un=ji.headers,Li=ji.parameters,gn=ji.errors,gn&&gn.length>0)return $(ei,"htmx:validation:halted",ji),Z(si),Yi(),ci;var Fi=ti.split("#"),vn=Fi[0],sn=Fi[1],Pi=null;if(ii==="get"){Pi=vn;var Mi=Object.keys(Li).length!==0;Mi&&(Pi.indexOf("?")<0?Pi+="?":Pi+="&",Pi+=Ft(Li),sn&&(Pi+="#"+sn)),Ji.open("GET",Pi,!0)}else Ji.open(ii.toUpperCase(),ti,!0);if(Ji.overrideMimeType("text/html"),Ji.withCredentials=ji.withCredentials,Ji.timeout=ji.timeout,!Ui.noHeaders){for(var $i in un)if(un.hasOwnProperty($i)){var en=un[$i];er(Ji,$i,en)}}var Ii={xhr:Ji,target:vi,requestConfig:ji,etc:ri,pathInfo:{requestPath:ti,finalRequestPath:Pi||ti,anchor:sn}};if(Ji.onload=function(){try{var fn=ir(ei);if(Ii.pathInfo.responsePath=tr(Ji),fi(ei,Ii),Nt(Ri),$(ei,"htmx:afterRequest",Ii),$(ei,"htmx:afterOnLoad",Ii),!K(ei)){for(var On=null;fn.length>0&&On==null;){var In=fn.shift();K(In)&&(On=In)}On&&($(On,"htmx:afterRequest",Ii),$(On,"htmx:afterOnLoad",Ii))}Z(si),Yi()}catch(br){throw J(ei,"htmx:onLoadError",Y({error:br},Ii)),br}},Ji.onerror=function(){Nt(Ri),J(ei,"htmx:afterRequest",Ii),J(ei,"htmx:sendError",Ii),Z(ai),Yi()},Ji.onabort=function(){Nt(Ri),J(ei,"htmx:afterRequest",Ii),J(ei,"htmx:sendAbort",Ii),Z(ai),Yi()},Ji.ontimeout=function(){Nt(Ri),J(ei,"htmx:afterRequest",Ii),J(ei,"htmx:timeout",Ii),Z(ai),Yi()},!$(ei,"htmx:beforeRequest",Ii))return Z(si),Yi(),ci;var Ri=Ht(ei);return G(["loadstart","loadend","progress","abort"],function(fn){G([Ji,Ji.upload],function(On){On.addEventListener(fn,function(In){$(ei,"htmx:xhr:"+fn,{lengthComputable:In.lengthComputable,loaded:In.loaded,total:In.total})})})}),$(ei,"htmx:beforeSend",Ii),Ji.send(ii==="get"?null:Wt(Ji,ei,Li)),ci}}function or(ii,ti){var ei=ti.xhr,ni=null,ri=null;if(rr(ei,/HX-Push:/i)?(ni=ei.getResponseHeader("HX-Push"),ri="push"):rr(ei,/HX-Push-Url:/i)?(ni=ei.getResponseHeader("HX-Push-Url"),ri="push"):rr(ei,/HX-Replace-Url:/i)&&(ni=ei.getResponseHeader("HX-Replace-Url"),ri="replace"),ni)return ni==="false"?{}:{type:ri,path:ni};var si=ti.pathInfo.finalRequestPath,ai=ti.pathInfo.responsePath,ci=z(ii,"hx-push-url"),fi=z(ii,"hx-replace-url"),vi=W(ii).boosted,hi=null,bi=null;return ci?(hi="push",bi=ci):fi?(hi="replace",bi=fi):vi&&(hi="push",bi=ai||si),bi?bi==="false"?{}:(bi==="true"&&(bi=ai||si),ti.pathInfo.anchor&&bi.indexOf("#")===-1&&(bi=bi+"#"+ti.pathInfo.anchor),{type:hi,path:bi}):{}}function sr(ii,ti){var ei=ti.xhr,ni=ti.target,ri=ti.etc;if(!!$(ii,"htmx:beforeOnLoad",ti)){if(rr(ei,/HX-Trigger:/i)&&Ce(ei,"HX-Trigger",ii),rr(ei,/HX-Location:/i)){Rt();var si=ei.getResponseHeader("HX-Location"),ai;si.indexOf("{")===0&&(ai=S(si),si=ai.path,delete ai.path),nr("GET",si,ai).then(()=>{Ot(si)});return}if(rr(ei,/HX-Redirect:/i)){location.href=ei.getResponseHeader("HX-Redirect");return}if(rr(ei,/HX-Refresh:/i)&&ei.getResponseHeader("HX-Refresh")==="true"){location.reload();return}rr(ei,/HX-Retarget:/i)&&(ti.target=_().querySelector(ei.getResponseHeader("HX-Retarget")));var ci=or(ii,ti),fi=ei.status>=200&&ei.status<400&&ei.status!==204,vi=ei.response,hi=ei.status>=400,bi=Y({shouldSwap:fi,serverResponse:vi,isError:hi},ti);if(!!$(ni,"htmx:beforeSwap",bi)){if(ni=bi.target,vi=bi.serverResponse,hi=bi.isError,ti.failed=hi,ti.successful=!hi,bi.shouldSwap){ei.status===286&&De(ii),xt(ii,function(Ci){vi=Ci.transformResponse(vi,ei,ii)}),ci.type&&Rt();var wi=ri.swapOverride;rr(ei,/HX-Reswap:/i)&&(wi=ei.getResponseHeader("HX-Reswap"));var ai=_t(ii,wi);ni.classList.add(U.config.swappingClass);var Ti=function(){try{var Ci=document.activeElement,Bi={};try{Bi={elt:Ci,start:Ci?Ci.selectionStart:null,end:Ci?Ci.selectionEnd:null}}catch(Gi){}var rn=Gt(ni);if(Ee(ai.swapStyle,ni,ii,vi,rn),Bi.elt&&!K(Bi.elt)&&Bi.elt.id){var nn=document.getElementById(Bi.elt.id),Ji={preventScroll:ai.focusScroll!==void 0?!ai.focusScroll:!U.config.defaultFocusScroll};nn&&(Bi.start&&nn.setSelectionRange&&nn.setSelectionRange(Bi.start,Bi.end),nn.focus(Ji))}if(ni.classList.remove(U.config.swappingClass),G(rn.elts,function(Gi){Gi.classList&&Gi.classList.add(U.config.settlingClass),$(Gi,"htmx:afterSwap",ti)}),rr(ei,/HX-Trigger-After-Swap:/i)){var Yi=ii;K(ii)||(Yi=_().body),Ce(ei,"HX-Trigger-After-Swap",Yi)}var ln=function(){if(G(rn.tasks,function(pn){pn.call()}),G(rn.elts,function(pn){pn.classList&&pn.classList.remove(U.config.settlingClass),$(pn,"htmx:afterSettle",ti)}),ci.type&&(ci.type==="push"?(Ot(ci.path),$(_().body,"htmx:pushedIntoHistory",{path:ci.path})):(qt(ci.path),$(_().body,"htmx:replacedInHistory",{path:ci.path}))),ti.pathInfo.anchor){var Gi=R("#"+ti.pathInfo.anchor);Gi&&Gi.scrollIntoView({block:"start",behavior:"auto"})}if(rn.title){var dn=R("title");dn?dn.innerHTML=rn.title:window.document.title=rn.title}if(Jt(rn.elts,ai),rr(ei,/HX-Trigger-After-Settle:/i)){var un=ii;K(ii)||(un=_().body),Ce(ei,"HX-Trigger-After-Settle",un)}};ai.settleDelay>0?setTimeout(ln,ai.settleDelay):ln()}catch(Gi){throw J(ii,"htmx:swapError",ti),Gi}};ai.swapDelay>0?setTimeout(Ti,ai.swapDelay):Ti()}hi&&J(ii,"htmx:responseError",Y({error:"Response Status Error Code "+ei.status+" from "+ti.pathInfo.path},ti))}}}var lr={};function ur(){return{init:function(ii){return null},onEvent:function(ii,ti){return!0},transformResponse:function(ii,ti,ei){return ii},isInlineSwap:function(ii){return!1},handleSwap:function(ii,ti,ei,ni){return!1},encodeParameters:function(ii,ti,ei){return null}}}function fr(ii,ti){ti.init&&ti.init(r),lr[ii]=Y(ur(),ti)}function cr(ii){delete lr[ii]}function hr(ii,ti,ei){if(ii==null)return ti;ti==null&&(ti=[]),ei==null&&(ei=[]);var ni=V(ii,"hx-ext");return ni&&G(ni.split(","),function(ri){if(ri=ri.replace(/ /g,""),ri.slice(0,7)=="ignore:"){ei.push(ri.slice(7));return}if(ei.indexOf(ri)<0){var si=lr[ri];si&&ti.indexOf(si)<0&&ti.push(si)}}),hr(u(ii),ti,ei)}function dr(ii){_().readyState!=="loading"?ii():_().addEventListener("DOMContentLoaded",ii)}function vr(){U.config.includeIndicatorStyles!==!1&&_().head.insertAdjacentHTML("beforeend","")}function gr(){var ii=_().querySelector('meta[name="htmx-config"]');return ii?S(ii.content):null}function pr(){var ii=gr();ii&&(U.config=Y(U.config,ii))}return dr(function(){pr(),vr();var ii=_().body;vt(ii);var ti=_().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");ii.addEventListener("htmx:abort",function(ei){var ni=ei.target,ri=W(ni);ri&&ri.xhr&&ri.xhr.abort()}),window.onpopstate=function(ei){ei.state&&ei.state.htmx&&(At(),G(ti,function(ni){$(ni,"htmx:restored",{document:_(),triggerEvent:$})}))},setTimeout(function(){$(ii,"htmx:load",{})},0)}),U}()})});var Qa=Un((Tc,Cc)=>{(function(ii,ti){typeof Tc=="object"&&typeof Cc!="undefined"?Cc.exports=ti():typeof define=="function"&&define.amd?define(ti):(ii=typeof globalThis!="undefined"?globalThis:ii||self,ii.TomSelect=ti())})(Tc,function(){"use strict";function ii(di,oi){di.split(/\s+/).forEach(li=>{oi(li)})}class ti{constructor(){this._events=void 0,this._events={}}on(oi,li){ii(oi,ui=>{let mi=this._events[ui]||[];mi.push(li),this._events[ui]=mi})}off(oi,li){var ui=arguments.length;if(ui===0){this._events={};return}ii(oi,mi=>{if(ui===1){delete this._events[mi];return}let yi=this._events[mi];yi!==void 0&&(yi.splice(yi.indexOf(li),1),this._events[mi]=yi)})}trigger(oi,...li){var ui=this;ii(oi,mi=>{let yi=ui._events[mi];yi!==void 0&&yi.forEach(_i=>{_i.apply(ui,li)})})}}function ei(di){return di.plugins={},class extends di{constructor(...oi){super(...oi);this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(oi,li){di.plugins[oi]={name:oi,fn:li}}initializePlugins(oi){var li,ui;let mi=this,yi=[];if(Array.isArray(oi))oi.forEach(_i=>{typeof _i=="string"?yi.push(_i):(mi.plugins.settings[_i.name]=_i.options,yi.push(_i.name))});else if(oi)for(li in oi)oi.hasOwnProperty(li)&&(mi.plugins.settings[li]=oi[li],yi.push(li));for(;ui=yi.shift();)mi.require(ui)}loadPlugin(oi){var li=this,ui=li.plugins,mi=di.plugins[oi];if(!di.plugins.hasOwnProperty(oi))throw new Error('Unable to find "'+oi+'" plugin');ui.requested[oi]=!0,ui.loaded[oi]=mi.fn.apply(li,[li.plugins.settings[oi]||{}]),ui.names.push(oi)}require(oi){var li=this,ui=li.plugins;if(!li.plugins.loaded.hasOwnProperty(oi)){if(ui.requested[oi])throw new Error('Plugin has circular dependency ("'+oi+'")');li.loadPlugin(oi)}return ui.loaded[oi]}}}let ni=di=>(di=di.filter(Boolean),di.length<2?di[0]||"":fi(di)==1?"["+di.join("")+"]":"(?:"+di.join("|")+")"),ri=di=>{if(!ai(di))return di.join("");let oi="",li=0,ui=()=>{li>1&&(oi+="{"+li+"}")};return di.forEach((mi,yi)=>{if(mi===di[yi-1]){li++;return}ui(),oi+=mi,li=1}),ui(),oi},si=di=>{let oi=hi(di);return ni(oi)},ai=di=>new Set(di).size!==di.length,ci=di=>(di+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),fi=di=>di.reduce((oi,li)=>Math.max(oi,vi(li)),0),vi=di=>hi(di).length,hi=di=>Array.from(di);let bi=di=>{if(di.length===1)return[[di]];let oi=[],li=di.substring(1);return bi(li).forEach(function(mi){let yi=mi.slice(0);yi[0]=di.charAt(0)+yi[0],oi.push(yi),yi=mi.slice(0),yi.unshift(di.charAt(0)),oi.push(yi)}),oi};let wi=[[0,65535]],Ti="[\u0300-\u036F\xB7\u02BE\u02BC]",ki,Ci,Bi=3,rn={},nn={"/":"\u2044\u2215","0":"\u07C0",a:"\u2C65\u0250\u0251",aa:"\uA733",ae:"\xE6\u01FD\u01E3",ao:"\uA735",au:"\uA737",av:"\uA739\uA73B",ay:"\uA73D",b:"\u0180\u0253\u0183",c:"\uA73F\u0188\u023C\u2184",d:"\u0111\u0257\u0256\u1D05\u018C\uABB7\u0501\u0266",e:"\u025B\u01DD\u1D07\u0247",f:"\uA77C\u0192",g:"\u01E5\u0260\uA7A1\u1D79\uA77F\u0262",h:"\u0127\u2C68\u2C76\u0265",i:"\u0268\u0131",j:"\u0249\u0237",k:"\u0199\u2C6A\uA741\uA743\uA745\uA7A3",l:"\u0142\u019A\u026B\u2C61\uA749\uA747\uA781\u026D",m:"\u0271\u026F\u03FB",n:"\uA7A5\u019E\u0272\uA791\u1D0E\u043B\u0509",o:"\xF8\u01FF\u0254\u0275\uA74B\uA74D\u1D11",oe:"\u0153",oi:"\u01A3",oo:"\uA74F",ou:"\u0223",p:"\u01A5\u1D7D\uA751\uA753\uA755\u03C1",q:"\uA757\uA759\u024B",r:"\u024D\u027D\uA75B\uA7A7\uA783",s:"\xDF\u023F\uA7A9\uA785\u0282",t:"\u0167\u01AD\u0288\u2C66\uA787",th:"\xFE",tz:"\uA729",u:"\u0289",v:"\u028B\uA75F\u028C",vy:"\uA761",w:"\u2C73",y:"\u01B4\u024F\u1EFF",z:"\u01B6\u0225\u0240\u2C6C\uA763",hv:"\u0195"};for(let di in nn){let oi=nn[di]||"";for(let li=0;li{ki===void 0&&(ki=gn(di||wi))},ln=(di,oi="NFKD")=>di.normalize(oi),Gi=di=>hi(di).reduce((oi,li)=>oi+dn(li),""),dn=di=>(di=ln(di).toLowerCase().replace(Ji,oi=>rn[oi]||""),ln(di,"NFC"));function*un(di){for(let[oi,li]of di)for(let ui=oi;ui<=li;ui++){let mi=String.fromCharCode(ui),yi=Gi(mi);yi!=mi.toLowerCase()&&(yi.length>Bi||yi.length!=0&&(yield{folded:yi,composed:mi,code_point:ui}))}}let pn=di=>{let oi={},li=(ui,mi)=>{let yi=oi[ui]||new Set,_i=new RegExp("^"+si(yi)+"$","iu");mi.match(_i)||(yi.add(ci(mi)),oi[ui]=yi)};for(let ui of un(di))li(ui.folded,ui.folded),li(ui.folded,ui.composed);return oi},gn=di=>{let oi=pn(di),li={},ui=[];for(let yi in oi){let _i=oi[yi];_i&&(li[yi]=si(_i)),yi.length>1&&ui.push(ci(yi))}ui.sort((yi,_i)=>_i.length-yi.length);let mi=ni(ui);return Ci=new RegExp("^"+mi,"u"),li},Cn=(di,oi=1)=>{let li=0;return di=di.map(ui=>(ki[ui]&&(li+=ui.length),ki[ui]||ui)),li>=oi?ri(di):""},kn=(di,oi=1)=>(oi=Math.max(oi,di.length-1),ni(bi(di).map(li=>Cn(li,oi)))),En=(di,oi=!0)=>{let li=di.length>1?1:0;return ni(di.map(ui=>{let mi=[],yi=oi?ui.length():ui.length()-1;for(let _i=0;_i{for(let li of oi){if(li.start!=di.start||li.end!=di.end||li.substrs.join("")!==di.substrs.join(""))continue;let ui=di.parts,mi=_i=>{for(let Si of ui){if(Si.start===_i.start&&Si.substr===_i.substr)return!1;if(!(_i.length==1||Si.length==1)&&(_i.startSi.start||Si.start<_i.start&&Si.end>_i.start))return!0}return!1};if(!(li.parts.filter(mi).length>0))return!0}return!1};class Ui{constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(oi){oi&&(this.parts.push(oi),this.substrs.push(oi.substr),this.start=Math.min(oi.start,this.start),this.end=Math.max(oi.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(oi,li){let ui=new Ui,mi=JSON.parse(JSON.stringify(this.parts)),yi=mi.pop();for(let Ai of mi)ui.add(Ai);let _i=li.substr.substring(0,oi-yi.start),Si=_i.length;return ui.add({start:yi.start,end:yi.start+Si,length:Si,substr:_i}),ui}}let ji=di=>{Yi(),di=Gi(di);let oi="",li=[new Ui];for(let ui=0;ui0){Ai=Ai.sort((zi,Hi)=>zi.length()-Hi.length());for(let zi of Ai)Li(zi,li)||li.push(zi);continue}if(ui>0&&Di.size==1&&!Di.has("3")){oi+=En(li,!1);let zi=new Ui,Hi=li[0];Hi&&zi.add(Hi.last()),li=[zi]}}return oi+=En(li,!0),oi};let Fi=(di,oi)=>{if(!!di)return di[oi]},vn=(di,oi)=>{if(!!di){for(var li,ui=oi.split(".");(li=ui.shift())&&(di=di[li]););return di}},sn=(di,oi,li)=>{var ui,mi;return!di||(di=di+"",oi.regex==null)||(mi=di.search(oi.regex),mi===-1)?0:(ui=oi.string.length/di.length,mi===0&&(ui+=.5),ui*li)},Pi=(di,oi)=>{var li=di[oi];if(typeof li=="function")return li;li&&!Array.isArray(li)&&(di[oi]=[li])},Mi=(di,oi)=>{if(Array.isArray(di))di.forEach(oi);else for(var li in di)di.hasOwnProperty(li)&&oi(di[li],li)},$i=(di,oi)=>typeof di=="number"&&typeof oi=="number"?di>oi?1:dioi?1:oi>di?-1:0);class en{constructor(oi,li){this.items=void 0,this.settings=void 0,this.items=oi,this.settings=li||{diacritics:!0}}tokenize(oi,li,ui){if(!oi||!oi.length)return[];let mi=[],yi=oi.split(/\s+/);var _i;return ui&&(_i=new RegExp("^("+Object.keys(ui).map(ci).join("|")+"):(.*)$")),yi.forEach(Si=>{let Ai,Di=null,zi=null;_i&&(Ai=Si.match(_i))&&(Di=Ai[1],Si=Ai[2]),Si.length>0&&(this.settings.diacritics?zi=ji(Si)||null:zi=ci(Si),zi&&li&&(zi="\\b"+zi)),mi.push({string:Si,regex:zi?new RegExp(zi,"iu"):null,field:Di})}),mi}getScoreFunction(oi,li){var ui=this.prepareSearch(oi,li);return this._getScoreFunction(ui)}_getScoreFunction(oi){let li=oi.tokens,ui=li.length;if(!ui)return function(){return 0};let mi=oi.options.fields,yi=oi.weights,_i=mi.length,Si=oi.getAttrFn;if(!_i)return function(){return 1};let Ai=function(){return _i===1?function(Di,zi){let Hi=mi[0].field;return sn(Si(zi,Hi),Di,yi[Hi]||1)}:function(Di,zi){var Hi=0;if(Di.field){let Zi=Si(zi,Di.field);!Di.regex&&Zi?Hi+=1/_i:Hi+=sn(Zi,Di,1)}else Mi(yi,(Zi,Pn)=>{Hi+=sn(Si(zi,Pn),Di,Zi)});return Hi/_i}}();return ui===1?function(Di){return Ai(li[0],Di)}:oi.options.conjunction==="and"?function(Di){var zi,Hi=0;for(let Zi of li){if(zi=Ai(Zi,Di),zi<=0)return 0;Hi+=zi}return Hi/ui}:function(Di){var zi=0;return Mi(li,Hi=>{zi+=Ai(Hi,Di)}),zi/ui}}getSortFunction(oi,li){var ui=this.prepareSearch(oi,li);return this._getSortFunction(ui)}_getSortFunction(oi){var li,ui=[];let mi=this,yi=oi.options,_i=!oi.query&&yi.sort_empty?yi.sort_empty:yi.sort;if(typeof _i=="function")return _i.bind(this);let Si=function(zi,Hi){return zi==="$score"?Hi.score:oi.getAttrFn(mi.items[Hi.id],zi)};if(_i)for(let Di of _i)(oi.query||Di.field!=="$score")&&ui.push(Di);if(oi.query){li=!0;for(let Di of ui)if(Di.field==="$score"){li=!1;break}li&&ui.unshift({field:"$score",direction:"desc"})}else ui=ui.filter(Di=>Di.field!=="$score");return ui.length?function(Di,zi){var Hi,Zi;for(let Pn of ui)if(Zi=Pn.field,Hi=(Pn.direction==="desc"?-1:1)*$i(Si(Zi,Di),Si(Zi,zi)),Hi)return Hi;return 0}:null}prepareSearch(oi,li){let ui={};var mi=Object.assign({},li);if(Pi(mi,"sort"),Pi(mi,"sort_empty"),mi.fields){Pi(mi,"fields");let yi=[];mi.fields.forEach(_i=>{typeof _i=="string"&&(_i={field:_i,weight:1}),yi.push(_i),ui[_i.field]="weight"in _i?_i.weight:1}),mi.fields=yi}return{options:mi,query:oi.toLowerCase().trim(),tokens:this.tokenize(oi,mi.respect_word_boundaries,ui),total:0,items:[],weights:ui,getAttrFn:mi.nesting?vn:Fi}}search(oi,li){var ui=this,mi,yi;yi=this.prepareSearch(oi,li),li=yi.options,oi=yi.query;let _i=li.score||ui._getScoreFunction(yi);oi.length?Mi(ui.items,(Ai,Di)=>{mi=_i(Ai),(li.filter===!1||mi>0)&&yi.items.push({score:mi,id:Di})}):Mi(ui.items,(Ai,Di)=>{yi.items.push({score:1,id:Di})});let Si=ui._getSortFunction(yi);return Si&&yi.items.sort(Si),yi.total=yi.items.length,typeof li.limit=="number"&&(yi.items=yi.items.slice(0,li.limit)),yi}}let Ii=(di,oi)=>{if(Array.isArray(di))di.forEach(oi);else for(var li in di)di.hasOwnProperty(li)&&oi(di[li],li)},Ri=di=>{if(di.jquery)return di[0];if(di instanceof HTMLElement)return di;if(fn(di)){var oi=document.createElement("template");return oi.innerHTML=di.trim(),oi.content.firstChild}return document.querySelector(di)},fn=di=>typeof di=="string"&&di.indexOf("<")>-1,On=di=>di.replace(/['"\\]/g,"\\$&"),In=(di,oi)=>{var li=document.createEvent("HTMLEvents");li.initEvent(oi,!0,!1),di.dispatchEvent(li)},br=(di,oi)=>{Object.assign(di.style,oi)},Kn=(di,...oi)=>{var li=us(oi);di=zs(di),di.map(ui=>{li.map(mi=>{ui.classList.add(mi)})})},Er=(di,...oi)=>{var li=us(oi);di=zs(di),di.map(ui=>{li.map(mi=>{ui.classList.remove(mi)})})},us=di=>{var oi=[];return Ii(di,li=>{typeof li=="string"&&(li=li.trim().split(/[\11\12\14\15\40]/)),Array.isArray(li)&&(oi=oi.concat(li))}),oi.filter(Boolean)},zs=di=>(Array.isArray(di)||(di=[di]),di),Ss=(di,oi,li)=>{if(!(li&&!li.contains(di)))for(;di&&di.matches;){if(di.matches(oi))return di;di=di.parentNode}},qs=(di,oi=0)=>oi>0?di[di.length-1]:di[0],ho=di=>Object.keys(di).length===0,is=(di,oi)=>{if(!di)return-1;oi=oi||di.nodeName;for(var li=0;di=di.previousElementSibling;)di.matches(oi)&&li++;return li},Dn=(di,oi)=>{Ii(oi,(li,ui)=>{li==null?di.removeAttribute(ui):di.setAttribute(ui,""+li)})},ns=(di,oi)=>{di.parentNode&&di.parentNode.replaceChild(oi,di)},Kr=(di,oi)=>{if(oi===null)return;if(typeof oi=="string"){if(!oi.length)return;oi=new RegExp(oi,"i")}let li=yi=>{var _i=yi.data.match(oi);if(_i&&yi.data.length>0){var Si=document.createElement("span");Si.className="highlight";var Ai=yi.splitText(_i.index);Ai.splitText(_i[0].length);var Di=Ai.cloneNode(!0);return Si.appendChild(Di),ns(Ai,Si),1}return 0},ui=yi=>{yi.nodeType===1&&yi.childNodes&&!/(script|style)/i.test(yi.tagName)&&(yi.className!=="highlight"||yi.tagName!=="SPAN")&&Array.from(yi.childNodes).forEach(_i=>{mi(_i)})},mi=yi=>yi.nodeType===3?li(yi):(ui(yi),0);mi(di)},Ts=di=>{var oi=di.querySelectorAll("span.highlight");Array.prototype.forEach.call(oi,function(li){var ui=li.parentNode;ui.replaceChild(li.firstChild,li),ui.normalize()})},Ws=65,Cs=13,ds=27,Xr=37,po=38,Ds=39,mo=40,Go=8,Ol=46,Ko=9,go=(typeof navigator=="undefined"?!1:/Mac/.test(navigator.userAgent))?"metaKey":"ctrlKey";var Sa={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:'',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(di){return di.length>0},render:{}};let _n=di=>typeof di=="undefined"||di===null?null:As(di),As=di=>typeof di=="boolean"?di?"1":"0":di+"",Os=di=>(di+"").replace(/&/g,"&").replace(//g,">").replace(/"/g,"""),Ll=(di,oi)=>oi>0?setTimeout(di,oi):(di.call(null),null),vo=(di,oi)=>{var li;return function(ui,mi){var yi=this;li&&(yi.loading=Math.max(yi.loading-1,0),clearTimeout(li)),li=setTimeout(function(){li=null,yi.loadedSearches[ui]=!0,di.call(yi,ui,mi)},oi)}},_o=(di,oi,li)=>{var ui,mi=di.trigger,yi={};di.trigger=function(){var _i=arguments[0];if(oi.indexOf(_i)!==-1)yi[_i]=arguments;else return mi.apply(di,arguments)},li.apply(di,[]),di.trigger=mi;for(ui of oi)ui in yi&&mi.apply(di,yi[ui])},Jr=di=>({start:di.selectionStart||0,length:(di.selectionEnd||0)-(di.selectionStart||0)}),xn=(di,oi=!1)=>{di&&(di.preventDefault(),oi&&di.stopPropagation())},Sn=(di,oi,li,ui)=>{di.addEventListener(oi,li,ui)},pi=(di,oi)=>{if(!oi||!oi[di])return!1;var li=(oi.altKey?1:0)+(oi.ctrlKey?1:0)+(oi.shiftKey?1:0)+(oi.metaKey?1:0);return li===1},gi=(di,oi)=>{let li=di.getAttribute("id");return li||(di.setAttribute("id",oi),oi)},Ei=di=>di.replace(/[\\"']/g,"\\$&"),xi=(di,oi)=>{oi&&di.append(oi)};function Ni(di,oi){var li=Object.assign({},Sa,oi),ui=li.dataAttr,mi=li.labelField,yi=li.valueField,_i=li.disabledField,Si=li.optgroupField,Ai=li.optgroupLabelField,Di=li.optgroupValueField,zi=di.tagName.toLowerCase(),Hi=di.getAttribute("placeholder")||di.getAttribute("data-placeholder");if(!Hi&&!li.allowEmptyOption){let bn=di.querySelector('option[value=""]');bn&&(Hi=bn.textContent)}var Zi={placeholder:Hi,options:[],optgroups:[],items:[],maxItems:null},Pn=()=>{var bn,Hn=Zi.options,Ln={},an=1;let Fn=0;var rs=yn=>{var An=Object.assign({},yn.dataset),mn=ui&&An[ui];return typeof mn=="string"&&mn.length&&(An=Object.assign(An,JSON.parse(mn))),An},Ta=(yn,An)=>{var mn=_n(yn.value);if(mn!=null&&!(!mn&&!li.allowEmptyOption)){if(Ln.hasOwnProperty(mn)){if(An){var wr=Ln[mn][Si];wr?Array.isArray(wr)?wr.push(An):Ln[mn][Si]=[wr,An]:Ln[mn][Si]=An}}else{var Nn=rs(yn);Nn[mi]=Nn[mi]||yn.textContent,Nn[yi]=Nn[yi]||mn,Nn[_i]=Nn[_i]||yn.disabled,Nn[Si]=Nn[Si]||An,Nn.$option=yn,Nn.$order=Nn.$order||++Fn,Ln[mn]=Nn,Hn.push(Nn)}yn.selected&&Zi.items.push(mn)}},yo=yn=>{var An,mn;mn=rs(yn),mn[Ai]=mn[Ai]||yn.getAttribute("label")||"",mn[Di]=mn[Di]||an++,mn[_i]=mn[_i]||yn.disabled,mn.$order=mn.$order||++Fn,Zi.optgroups.push(mn),An=mn[Di],Ii(yn.children,wr=>{Ta(wr,An)})};Zi.maxItems=di.hasAttribute("multiple")?null:1,Ii(di.children,yn=>{bn=yn.tagName.toLowerCase(),bn==="optgroup"?yo(yn):bn==="option"&&Ta(yn)})},Xi=()=>{let bn=di.getAttribute(ui);if(bn)Zi.options=JSON.parse(bn),Ii(Zi.options,Ln=>{Zi.items.push(Ln[yi])});else{var Hn=di.value.trim()||"";if(!li.allowEmptyOption&&!Hn.length)return;let Ln=Hn.split(li.delimiter);Ii(Ln,an=>{let Fn={};Fn[mi]=an,Fn[yi]=an,Zi.options.push(Fn)}),Zi.items=Ln}};return zi==="select"?Pn():Xi(),Object.assign({},Sa,Zi,oi)}var Vi=0;class tn extends ei(ti){constructor(oi,li){super();this.control_input=void 0,this.wrapper=void 0,this.dropdown=void 0,this.control=void 0,this.dropdown_content=void 0,this.focus_node=void 0,this.order=0,this.settings=void 0,this.input=void 0,this.tabIndex=void 0,this.is_select_tag=void 0,this.rtl=void 0,this.inputId=void 0,this._destroy=void 0,this.sifter=void 0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isRequired=void 0,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.currentResults=void 0,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,Vi++;var ui,mi=Ri(oi);if(mi.tomselect)throw new Error("Tom Select already initialized on this element");mi.tomselect=this;var yi=window.getComputedStyle&&window.getComputedStyle(mi,null);ui=yi.getPropertyValue("direction");let _i=Ni(mi,li);this.settings=_i,this.input=mi,this.tabIndex=mi.tabIndex||0,this.is_select_tag=mi.tagName.toLowerCase()==="select",this.rtl=/rtl/i.test(ui),this.inputId=gi(mi,"tomselect-"+Vi),this.isRequired=mi.required,this.sifter=new en(this.options,{diacritics:_i.diacritics}),_i.mode=_i.mode||(_i.maxItems===1?"single":"multi"),typeof _i.hideSelected!="boolean"&&(_i.hideSelected=_i.mode==="multi"),typeof _i.hidePlaceholder!="boolean"&&(_i.hidePlaceholder=_i.mode!=="multi");var Si=_i.createFilter;typeof Si!="function"&&(typeof Si=="string"&&(Si=new RegExp(Si)),Si instanceof RegExp?_i.createFilter=Hn=>Si.test(Hn):_i.createFilter=Hn=>this.settings.duplicates||!this.options[Hn]),this.initializePlugins(_i.plugins),this.setupCallbacks(),this.setupTemplates();let Ai=Ri("
"),Di=Ri("
"),zi=this._render("dropdown"),Hi=Ri('
'),Zi=this.input.getAttribute("class")||"",Pn=_i.mode;var Xi;if(Kn(Ai,_i.wrapperClass,Zi,Pn),Kn(Di,_i.controlClass),xi(Ai,Di),Kn(zi,_i.dropdownClass,Pn),_i.copyClassesToDropdown&&Kn(zi,Zi),Kn(Hi,_i.dropdownContentClass),xi(zi,Hi),Ri(_i.dropdownParent||Ai).appendChild(zi),fn(_i.controlInput)){Xi=Ri(_i.controlInput);var bn=["autocorrect","autocapitalize","autocomplete","spellcheck"];Mi(bn,Hn=>{mi.getAttribute(Hn)&&Dn(Xi,{[Hn]:mi.getAttribute(Hn)})}),Xi.tabIndex=-1,Di.appendChild(Xi),this.focus_node=Xi}else _i.controlInput?(Xi=Ri(_i.controlInput),this.focus_node=Xi):(Xi=Ri(""),this.focus_node=Di);this.wrapper=Ai,this.dropdown=zi,this.dropdown_content=Hi,this.control=Di,this.control_input=Xi,this.setup()}setup(){let oi=this,li=oi.settings,ui=oi.control_input,mi=oi.dropdown,yi=oi.dropdown_content,_i=oi.wrapper,Si=oi.control,Ai=oi.input,Di=oi.focus_node,zi={passive:!0},Hi=oi.inputId+"-ts-dropdown";Dn(yi,{id:Hi}),Dn(Di,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":Hi});let Zi=gi(Di,oi.inputId+"-ts-control"),Pn="label[for='"+On(oi.inputId)+"']",Xi=document.querySelector(Pn),bn=oi.focus.bind(oi);if(Xi){Sn(Xi,"click",bn),Dn(Xi,{for:Zi});let an=gi(Xi,oi.inputId+"-ts-label");Dn(Di,{"aria-labelledby":an}),Dn(yi,{"aria-labelledby":an})}if(_i.style.width=Ai.style.width,oi.plugins.names.length){let an="plugin-"+oi.plugins.names.join(" plugin-");Kn([_i,mi],an)}(li.maxItems===null||li.maxItems>1)&&oi.is_select_tag&&Dn(Ai,{multiple:"multiple"}),li.placeholder&&Dn(ui,{placeholder:li.placeholder}),!li.splitOn&&li.delimiter&&(li.splitOn=new RegExp("\\s*"+ci(li.delimiter)+"+\\s*")),li.load&&li.loadThrottle&&(li.load=vo(li.load,li.loadThrottle)),Sn(mi,"mousemove",()=>{oi.ignoreHover=!1}),Sn(mi,"mouseenter",an=>{var Fn=Ss(an.target,"[data-selectable]",mi);Fn&&oi.onOptionHover(an,Fn)},{capture:!0}),Sn(mi,"click",an=>{let Fn=Ss(an.target,"[data-selectable]");Fn&&(oi.onOptionSelect(an,Fn),xn(an,!0))}),Sn(Si,"click",an=>{var Fn=Ss(an.target,"[data-ts-item]",Si);if(Fn&&oi.onItemSelect(an,Fn)){xn(an,!0);return}ui.value==""&&(oi.onClick(),xn(an,!0))}),Sn(Di,"keydown",an=>oi.onKeyDown(an)),Sn(ui,"keypress",an=>oi.onKeyPress(an)),Sn(ui,"input",an=>oi.onInput(an)),Sn(Di,"blur",an=>oi.onBlur(an)),Sn(Di,"focus",an=>oi.onFocus(an)),Sn(ui,"paste",an=>oi.onPaste(an));let Hn=an=>{let Fn=an.composedPath()[0];if(!_i.contains(Fn)&&!mi.contains(Fn)){oi.isFocused&&oi.blur(),oi.inputState();return}Fn==ui&&oi.isOpen?an.stopPropagation():xn(an,!0)},Ln=()=>{oi.isOpen&&oi.positionDropdown()};Sn(document,"mousedown",Hn),Sn(window,"scroll",Ln,zi),Sn(window,"resize",Ln,zi),this._destroy=()=>{document.removeEventListener("mousedown",Hn),window.removeEventListener("scroll",Ln),window.removeEventListener("resize",Ln),Xi&&Xi.removeEventListener("click",bn)},this.revertSettings={innerHTML:Ai.innerHTML,tabIndex:Ai.tabIndex},Ai.tabIndex=-1,Ai.insertAdjacentElement("afterend",oi.wrapper),oi.sync(!1),li.items=[],delete li.optgroups,delete li.options,Sn(Ai,"invalid",()=>{oi.isValid&&(oi.isValid=!1,oi.isInvalid=!0,oi.refreshState())}),oi.updateOriginalInput(),oi.refreshItems(),oi.close(!1),oi.inputState(),oi.isSetup=!0,Ai.disabled?oi.disable():Ai.readOnly?oi.setReadOnly(!0):oi.enable(),oi.on("change",this.onChange),Kn(Ai,"tomselected","ts-hidden-accessible"),oi.trigger("initialize"),li.preload===!0&&oi.preload()}setupOptions(oi=[],li=[]){this.addOptions(oi),Mi(li,ui=>{this.registerOptionGroup(ui)})}setupTemplates(){var oi=this,li=oi.settings.labelField,ui=oi.settings.optgroupLabelField,mi={optgroup:yi=>{let _i=document.createElement("div");return _i.className="optgroup",_i.appendChild(yi.options),_i},optgroup_header:(yi,_i)=>'
'+_i(yi[ui])+"
",option:(yi,_i)=>"
"+_i(yi[li])+"
",item:(yi,_i)=>"
"+_i(yi[li])+"
",option_create:(yi,_i)=>'
Add '+_i(yi.input)+"
",no_results:()=>'
No results found
',loading:()=>'
',not_loading:()=>{},dropdown:()=>"
"};oi.settings.render=Object.assign({},mi,oi.settings.render)}setupCallbacks(){var oi,li,ui={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(oi in ui)li=this.settings[ui[oi]],li&&this.on(oi,li)}sync(oi=!0){let li=this,ui=oi?Ni(li.input,{delimiter:li.settings.delimiter}):li.settings;li.setupOptions(ui.options,ui.optgroups),li.setValue(ui.items||[],!0),li.lastQuery=null}onClick(){var oi=this;if(oi.activeItems.length>0){oi.clearActiveItems(),oi.focus();return}oi.isFocused&&oi.isOpen?oi.blur():oi.focus()}onMouseDown(){}onChange(){In(this.input,"input"),In(this.input,"change")}onPaste(oi){var li=this;if(li.isInputHidden||li.isLocked){xn(oi);return}!li.settings.splitOn||setTimeout(()=>{var ui=li.inputValue();if(!!ui.match(li.settings.splitOn)){var mi=ui.trim().split(li.settings.splitOn);Mi(mi,yi=>{_n(yi)&&(this.options[yi]?li.addItem(yi):li.createItem(yi))})}},0)}onKeyPress(oi){var li=this;if(li.isLocked){xn(oi);return}var ui=String.fromCharCode(oi.keyCode||oi.which);if(li.settings.create&&li.settings.mode==="multi"&&ui===li.settings.delimiter){li.createItem(),xn(oi);return}}onKeyDown(oi){var li=this;if(li.ignoreHover=!0,li.isLocked){oi.keyCode!==Ko&&xn(oi);return}switch(oi.keyCode){case Ws:if(pi(go,oi)&&li.control_input.value==""){xn(oi),li.selectAll();return}break;case ds:li.isOpen&&(xn(oi,!0),li.close()),li.clearActiveItems();return;case mo:if(!li.isOpen&&li.hasOptions)li.open();else if(li.activeOption){let ui=li.getAdjacent(li.activeOption,1);ui&&li.setActiveOption(ui)}xn(oi);return;case po:if(li.activeOption){let ui=li.getAdjacent(li.activeOption,-1);ui&&li.setActiveOption(ui)}xn(oi);return;case Cs:li.canSelect(li.activeOption)?(li.onOptionSelect(oi,li.activeOption),xn(oi)):(li.settings.create&&li.createItem()||document.activeElement==li.control_input&&li.isOpen)&&xn(oi);return;case Xr:li.advanceSelection(-1,oi);return;case Ds:li.advanceSelection(1,oi);return;case Ko:li.settings.selectOnTab&&(li.canSelect(li.activeOption)&&(li.onOptionSelect(oi,li.activeOption),xn(oi)),li.settings.create&&li.createItem()&&xn(oi));return;case Go:case Ol:li.deleteSelection(oi);return}li.isInputHidden&&!pi(go,oi)&&xn(oi)}onInput(oi){if(this.isLocked)return;let li=this.inputValue();if(this.lastValue!==li){if(this.lastValue=li,li==""){this._onInput();return}this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=Ll(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)}}_onInput(){let oi=this.lastValue;this.settings.shouldLoad.call(this,oi)&&this.load(oi),this.refreshOptions(),this.trigger("type",oi)}onOptionHover(oi,li){this.ignoreHover||this.setActiveOption(li,!1)}onFocus(oi){var li=this,ui=li.isFocused;if(li.isDisabled||li.isReadOnly){li.blur(),xn(oi);return}li.ignoreFocus||(li.isFocused=!0,li.settings.preload==="focus"&&li.preload(),ui||li.trigger("focus"),li.activeItems.length||(li.inputState(),li.refreshOptions(!!li.settings.openOnFocus)),li.refreshState())}onBlur(oi){if(document.hasFocus()!==!1){var li=this;if(!!li.isFocused){li.isFocused=!1,li.ignoreFocus=!1;var ui=()=>{li.close(),li.setActiveItem(),li.setCaret(li.items.length),li.trigger("blur")};li.settings.create&&li.settings.createOnBlur?li.createItem(null,ui):ui()}}}onOptionSelect(oi,li){var ui,mi=this;li.parentElement&&li.parentElement.matches("[data-disabled]")||(li.classList.contains("create")?mi.createItem(null,()=>{mi.settings.closeAfterSelect&&mi.close()}):(ui=li.dataset.value,typeof ui!="undefined"&&(mi.lastQuery=null,mi.addItem(ui),mi.settings.closeAfterSelect&&mi.close(),!mi.settings.hideSelected&&oi.type&&/click/.test(oi.type)&&mi.setActiveOption(li))))}canSelect(oi){return!!(this.isOpen&&oi&&this.dropdown_content.contains(oi))}onItemSelect(oi,li){var ui=this;return!ui.isLocked&&ui.settings.mode==="multi"?(xn(oi),ui.setActiveItem(li,oi),!0):!1}canLoad(oi){return!(!this.settings.load||this.loadedSearches.hasOwnProperty(oi))}load(oi){let li=this;if(!li.canLoad(oi))return;Kn(li.wrapper,li.settings.loadingClass),li.loading++;let ui=li.loadCallback.bind(li);li.settings.load.call(li,oi,ui)}loadCallback(oi,li){let ui=this;ui.loading=Math.max(ui.loading-1,0),ui.lastQuery=null,ui.clearActiveOption(),ui.setupOptions(oi,li),ui.refreshOptions(ui.isFocused&&!ui.isInputHidden),ui.loading||Er(ui.wrapper,ui.settings.loadingClass),ui.trigger("load",oi,li)}preload(){var oi=this.wrapper.classList;oi.contains("preloaded")||(oi.add("preloaded"),this.load(""))}setTextboxValue(oi=""){var li=this.control_input,ui=li.value!==oi;ui&&(li.value=oi,In(li,"update"),this.lastValue=oi)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(oi,li){var ui=li?[]:["change"];_o(this,ui,()=>{this.clear(li),this.addItems(oi,li)})}setMaxItems(oi){oi===0&&(oi=null),this.settings.maxItems=oi,this.refreshState()}setActiveItem(oi,li){var ui=this,mi,yi,_i,Si,Ai,Di;if(ui.settings.mode!=="single"){if(!oi){ui.clearActiveItems(),ui.isFocused&&ui.inputState();return}if(mi=li&&li.type.toLowerCase(),mi==="click"&&pi("shiftKey",li)&&ui.activeItems.length){for(Di=ui.getLastActive(),_i=Array.prototype.indexOf.call(ui.control.children,Di),Si=Array.prototype.indexOf.call(ui.control.children,oi),_i>Si&&(Ai=_i,_i=Si,Si=Ai),yi=_i;yi<=Si;yi++)oi=ui.control.children[yi],ui.activeItems.indexOf(oi)===-1&&ui.setActiveItemClass(oi);xn(li)}else mi==="click"&&pi(go,li)||mi==="keydown"&&pi("shiftKey",li)?oi.classList.contains("active")?ui.removeActiveItem(oi):ui.setActiveItemClass(oi):(ui.clearActiveItems(),ui.setActiveItemClass(oi));ui.inputState(),ui.isFocused||ui.focus()}}setActiveItemClass(oi){let li=this,ui=li.control.querySelector(".last-active");ui&&Er(ui,"last-active"),Kn(oi,"active last-active"),li.trigger("item_select",oi),li.activeItems.indexOf(oi)==-1&&li.activeItems.push(oi)}removeActiveItem(oi){var li=this.activeItems.indexOf(oi);this.activeItems.splice(li,1),Er(oi,"active")}clearActiveItems(){Er(this.activeItems,"active"),this.activeItems=[]}setActiveOption(oi,li=!0){oi!==this.activeOption&&(this.clearActiveOption(),!!oi&&(this.activeOption=oi,Dn(this.focus_node,{"aria-activedescendant":oi.getAttribute("id")}),Dn(oi,{"aria-selected":"true"}),Kn(oi,"active"),li&&this.scrollToOption(oi)))}scrollToOption(oi,li){if(!oi)return;let ui=this.dropdown_content,mi=ui.clientHeight,yi=ui.scrollTop||0,_i=oi.offsetHeight,Si=oi.getBoundingClientRect().top-ui.getBoundingClientRect().top+yi;Si+_i>mi+yi?this.scroll(Si-mi+_i,li):Si{oi.setActiveItemClass(ui)}))}inputState(){var oi=this;!oi.control.contains(oi.control_input)||(Dn(oi.control_input,{placeholder:oi.settings.placeholder}),oi.activeItems.length>0||!oi.isFocused&&oi.settings.hidePlaceholder&&oi.items.length>0?(oi.setTextboxValue(),oi.isInputHidden=!0):(oi.settings.hidePlaceholder&&oi.items.length>0&&Dn(oi.control_input,{placeholder:""}),oi.isInputHidden=!1),oi.wrapper.classList.toggle("input-hidden",oi.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var oi=this;oi.isDisabled||oi.isReadOnly||(oi.ignoreFocus=!0,oi.control_input.offsetWidth?oi.control_input.focus():oi.focus_node.focus(),setTimeout(()=>{oi.ignoreFocus=!1,oi.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(oi){return this.sifter.getScoreFunction(oi,this.getSearchOptions())}getSearchOptions(){var oi=this.settings,li=oi.sortField;return typeof oi.sortField=="string"&&(li=[{field:oi.sortField}]),{fields:oi.searchField,conjunction:oi.searchConjunction,sort:li,nesting:oi.nesting}}search(oi){var li,ui,mi=this,yi=this.getSearchOptions();if(mi.settings.score&&(ui=mi.settings.score.call(mi,oi),typeof ui!="function"))throw new Error('Tom Select "score" setting must be a function that returns a function');return oi!==mi.lastQuery?(mi.lastQuery=oi,li=mi.sifter.search(oi,Object.assign(yi,{score:ui})),mi.currentResults=li):li=Object.assign({},mi.currentResults),mi.settings.hideSelected&&(li.items=li.items.filter(_i=>{let Si=_n(_i.id);return!(Si&&mi.items.indexOf(Si)!==-1)})),li}refreshOptions(oi=!0){var li,ui,mi,yi,_i,Si,Ai,Di,zi,Hi;let Zi={},Pn=[];var Xi=this,bn=Xi.inputValue();let Hn=bn===Xi.lastQuery||bn==""&&Xi.lastQuery==null;var Ln=Xi.search(bn),an=null,Fn=Xi.settings.shouldOpen||!1,rs=Xi.dropdown_content;Hn&&(an=Xi.activeOption,an&&(zi=an.closest("[data-group]"))),yi=Ln.items.length,typeof Xi.settings.maxOptions=="number"&&(yi=Math.min(yi,Xi.settings.maxOptions)),yi>0&&(Fn=!0);let Ta=(yn,An)=>{let mn=Zi[yn];if(mn!==void 0){let Nn=Pn[mn];if(Nn!==void 0)return[mn,Nn.fragment]}let wr=document.createDocumentFragment();return mn=Pn.length,Pn.push({fragment:wr,order:An,optgroup:yn}),[mn,wr]};for(li=0;li0&&(Nn=Nn.cloneNode(!0),Dn(Nn,{id:mn.$id+"-clone-"+ui,"aria-selected":null}),Nn.classList.add("ts-cloned"),Er(Nn,"active"),Xi.activeOption&&Xi.activeOption.dataset.value==An&&zi&&zi.dataset.group===_i.toString()&&(an=Nn)),dh.appendChild(Nn),_i!=""&&(Zi[_i]=uh)}}Xi.settings.lockOptgroupOrder&&Pn.sort((yn,An)=>yn.order-An.order),Ai=document.createDocumentFragment(),Mi(Pn,yn=>{let An=yn.fragment,mn=yn.optgroup;if(!An||!An.children.length)return;let wr=Xi.optgroups[mn];if(wr!==void 0){let Nn=document.createDocumentFragment(),Ca=Xi.render("optgroup_header",wr);xi(Nn,Ca),xi(Nn,An);let Da=Xi.render("optgroup",{group:wr,options:Nn});xi(Ai,Da)}else xi(Ai,An)}),rs.innerHTML="",xi(rs,Ai),Xi.settings.highlight&&(Ts(rs),Ln.query.length&&Ln.tokens.length&&Mi(Ln.tokens,yn=>{Kr(rs,yn.regex)}));var yo=yn=>{let An=Xi.render(yn,{input:bn});return An&&(Fn=!0,rs.insertBefore(An,rs.firstChild)),An};if(Xi.loading?yo("loading"):Xi.settings.shouldLoad.call(Xi,bn)?Ln.items.length===0&&yo("no_results"):yo("not_loading"),Di=Xi.canCreate(bn),Di&&(Hi=yo("option_create")),Xi.hasOptions=Ln.items.length>0||Di,Fn){if(Ln.items.length>0){if(!an&&Xi.settings.mode==="single"&&Xi.items[0]!=null&&(an=Xi.getOption(Xi.items[0])),!rs.contains(an)){let yn=0;Hi&&!Xi.settings.addPrecedence&&(yn=1),an=Xi.selectable()[yn]}}else Hi&&(an=Hi);oi&&!Xi.isOpen&&(Xi.open(),Xi.scrollToOption(an,"auto")),Xi.setActiveOption(an)}else Xi.clearActiveOption(),oi&&Xi.isOpen&&Xi.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(oi,li=!1){let ui=this;if(Array.isArray(oi))return ui.addOptions(oi,li),!1;let mi=_n(oi[ui.settings.valueField]);return mi===null||ui.options.hasOwnProperty(mi)?!1:(oi.$order=oi.$order||++ui.order,oi.$id=ui.inputId+"-opt-"+oi.$order,ui.options[mi]=oi,ui.lastQuery=null,li&&(ui.userOptions[mi]=li,ui.trigger("option_add",mi,oi)),mi)}addOptions(oi,li=!1){Mi(oi,ui=>{this.addOption(ui,li)})}registerOption(oi){return this.addOption(oi)}registerOptionGroup(oi){var li=_n(oi[this.settings.optgroupValueField]);return li===null?!1:(oi.$order=oi.$order||++this.order,this.optgroups[li]=oi,li)}addOptionGroup(oi,li){var ui;li[this.settings.optgroupValueField]=oi,(ui=this.registerOptionGroup(li))&&this.trigger("optgroup_add",ui,li)}removeOptionGroup(oi){this.optgroups.hasOwnProperty(oi)&&(delete this.optgroups[oi],this.clearCache(),this.trigger("optgroup_remove",oi))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(oi,li){let ui=this;var mi,yi;let _i=_n(oi),Si=_n(li[ui.settings.valueField]);if(_i===null)return;let Ai=ui.options[_i];if(Ai==null)return;if(typeof Si!="string")throw new Error("Value must be set in option data");let Di=ui.getOption(_i),zi=ui.getItem(_i);if(li.$order=li.$order||Ai.$order,delete ui.options[_i],ui.uncacheValue(Si),ui.options[Si]=li,Di){if(ui.dropdown_content.contains(Di)){let Hi=ui._render("option",li);ns(Di,Hi),ui.activeOption===Di&&ui.setActiveOption(Hi)}Di.remove()}zi&&(yi=ui.items.indexOf(_i),yi!==-1&&ui.items.splice(yi,1,Si),mi=ui._render("item",li),zi.classList.contains("active")&&Kn(mi,"active"),ns(zi,mi)),ui.lastQuery=null}removeOption(oi,li){let ui=this;oi=As(oi),ui.uncacheValue(oi),delete ui.userOptions[oi],delete ui.options[oi],ui.lastQuery=null,ui.trigger("option_remove",oi),ui.removeItem(oi,li)}clearOptions(oi){let li=(oi||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();let ui={};Mi(this.options,(mi,yi)=>{li(mi,yi)&&(ui[yi]=mi)}),this.options=this.sifter.items=ui,this.lastQuery=null,this.trigger("option_clear")}clearFilter(oi,li){return this.items.indexOf(li)>=0}getOption(oi,li=!1){let ui=_n(oi);if(ui===null)return null;let mi=this.options[ui];if(mi!=null){if(mi.$div)return mi.$div;if(li)return this._render("option",mi)}return null}getAdjacent(oi,li,ui="option"){var mi=this,yi;if(!oi)return null;ui=="item"?yi=mi.controlChildren():yi=mi.dropdown_content.querySelectorAll("[data-selectable]");for(let _i=0;_i0?yi[_i+1]:yi[_i-1];return null}getItem(oi){if(typeof oi=="object")return oi;var li=_n(oi);return li!==null?this.control.querySelector(`[data-value="${Ei(li)}"]`):null}addItems(oi,li){var ui=this,mi=Array.isArray(oi)?oi:[oi];mi=mi.filter(_i=>ui.items.indexOf(_i)===-1);let yi=mi[mi.length-1];mi.forEach(_i=>{ui.isPending=_i!==yi,ui.addItem(_i,li)})}addItem(oi,li){var ui=li?[]:["change","dropdown_close"];_o(this,ui,()=>{var mi,yi;let _i=this,Si=_i.settings.mode,Ai=_n(oi);if(!(Ai&&_i.items.indexOf(Ai)!==-1&&(Si==="single"&&_i.close(),Si==="single"||!_i.settings.duplicates))&&!(Ai===null||!_i.options.hasOwnProperty(Ai))&&(Si==="single"&&_i.clear(li),!(Si==="multi"&&_i.isFull()))){if(mi=_i._render("item",_i.options[Ai]),_i.control.contains(mi)&&(mi=mi.cloneNode(!0)),yi=_i.isFull(),_i.items.splice(_i.caretPos,0,Ai),_i.insertAtCaret(mi),_i.isSetup){if(!_i.isPending&&_i.settings.hideSelected){let Di=_i.getOption(Ai),zi=_i.getAdjacent(Di,1);zi&&_i.setActiveOption(zi)}!_i.isPending&&!_i.settings.closeAfterSelect&&_i.refreshOptions(_i.isFocused&&Si!=="single"),_i.settings.closeAfterSelect!=!1&&_i.isFull()?_i.close():_i.isPending||_i.positionDropdown(),_i.trigger("item_add",Ai,mi),_i.isPending||_i.updateOriginalInput({silent:li})}(!_i.isPending||!yi&&_i.isFull())&&(_i.inputState(),_i.refreshState())}})}removeItem(oi=null,li){let ui=this;if(oi=ui.getItem(oi),!oi)return;var mi,yi;let _i=oi.dataset.value;mi=is(oi),oi.remove(),oi.classList.contains("active")&&(yi=ui.activeItems.indexOf(oi),ui.activeItems.splice(yi,1),Er(oi,"active")),ui.items.splice(mi,1),ui.lastQuery=null,!ui.settings.persist&&ui.userOptions.hasOwnProperty(_i)&&ui.removeOption(_i,li),mi{}){arguments.length===3&&(li=arguments[2]),typeof li!="function"&&(li=()=>{});var ui=this,mi=ui.caretPos,yi;if(oi=oi||ui.inputValue(),!ui.canCreate(oi))return li(),!1;ui.lock();var _i=!1,Si=Ai=>{if(ui.unlock(),!Ai||typeof Ai!="object")return li();var Di=_n(Ai[ui.settings.valueField]);if(typeof Di!="string")return li();ui.setTextboxValue(),ui.addOption(Ai,!0),ui.setCaret(mi),ui.addItem(Di),li(Ai),_i=!0};return typeof ui.settings.create=="function"?yi=ui.settings.create.call(this,oi,Si):yi={[ui.settings.labelField]:oi,[ui.settings.valueField]:oi},_i||Si(yi),!0}refreshItems(){var oi=this;oi.lastQuery=null,oi.isSetup&&oi.addItems(oi.items),oi.updateOriginalInput(),oi.refreshState()}refreshState(){let oi=this;oi.refreshValidityState();let li=oi.isFull(),ui=oi.isLocked;oi.wrapper.classList.toggle("rtl",oi.rtl);let mi=oi.wrapper.classList;mi.toggle("focus",oi.isFocused),mi.toggle("disabled",oi.isDisabled),mi.toggle("readonly",oi.isReadOnly),mi.toggle("required",oi.isRequired),mi.toggle("invalid",!oi.isValid),mi.toggle("locked",ui),mi.toggle("full",li),mi.toggle("input-active",oi.isFocused&&!oi.isInputHidden),mi.toggle("dropdown-active",oi.isOpen),mi.toggle("has-options",ho(oi.options)),mi.toggle("has-items",oi.items.length>0)}refreshValidityState(){var oi=this;!oi.input.validity||(oi.isValid=oi.input.validity.valid,oi.isInvalid=!oi.isValid)}isFull(){return this.settings.maxItems!==null&&this.items.length>=this.settings.maxItems}updateOriginalInput(oi={}){let li=this;var ui,mi;let yi=li.input.querySelector('option[value=""]');if(li.is_select_tag){let Ai=function(Di,zi,Hi){return Di||(Di=Ri('")),Di!=yi&&li.input.append(Di),_i.push(Di),(Di!=yi||Si>0)&&(Di.selected=!0),Di},_i=[],Si=li.input.querySelectorAll("option:checked").length;li.input.querySelectorAll("option:checked").forEach(Di=>{Di.selected=!1}),li.items.length==0&&li.settings.mode=="single"?Ai(yi,"",""):li.items.forEach(Di=>{if(ui=li.options[Di],mi=ui[li.settings.labelField]||"",_i.includes(ui.$option)){let zi=li.input.querySelector(`option[value="${Ei(Di)}"]:not(:checked)`);Ai(zi,Di,mi)}else ui.$option=Ai(ui.$option,Di,mi)})}else li.input.value=li.getValue();li.isSetup&&(oi.silent||li.trigger("change",li.getValue()))}open(){var oi=this;oi.isLocked||oi.isOpen||oi.settings.mode==="multi"&&oi.isFull()||(oi.isOpen=!0,Dn(oi.focus_node,{"aria-expanded":"true"}),oi.refreshState(),br(oi.dropdown,{visibility:"hidden",display:"block"}),oi.positionDropdown(),br(oi.dropdown,{visibility:"visible",display:"block"}),oi.focus(),oi.trigger("dropdown_open",oi.dropdown))}close(oi=!0){var li=this,ui=li.isOpen;oi&&(li.setTextboxValue(),li.settings.mode==="single"&&li.items.length&&li.inputState()),li.isOpen=!1,Dn(li.focus_node,{"aria-expanded":"false"}),br(li.dropdown,{display:"none"}),li.settings.hideSelected&&li.clearActiveOption(),li.refreshState(),ui&&li.trigger("dropdown_close",li.dropdown)}positionDropdown(){if(this.settings.dropdownParent==="body"){var oi=this.control,li=oi.getBoundingClientRect(),ui=oi.offsetHeight+li.top+window.scrollY,mi=li.left+window.scrollX;br(this.dropdown,{width:li.width+"px",top:ui+"px",left:mi+"px"})}}clear(oi){var li=this;if(!!li.items.length){var ui=li.controlChildren();Mi(ui,mi=>{li.removeItem(mi,!0)}),li.inputState(),oi||li.updateOriginalInput(),li.trigger("clear")}}insertAtCaret(oi){let li=this,ui=li.caretPos,mi=li.control;mi.insertBefore(oi,mi.children[ui]||null),li.setCaret(ui+1)}deleteSelection(oi){var li,ui,mi,yi,_i=this;li=oi&&oi.keyCode===Go?-1:1,ui=Jr(_i.control_input);let Si=[];if(_i.activeItems.length)yi=qs(_i.activeItems,li),mi=is(yi),li>0&&mi++,Mi(_i.activeItems,Ai=>Si.push(Ai));else if((_i.isFocused||_i.settings.mode==="single")&&_i.items.length){let Ai=_i.controlChildren(),Di;li<0&&ui.start===0&&ui.length===0?Di=Ai[_i.caretPos-1]:li>0&&ui.start===_i.inputValue().length&&(Di=Ai[_i.caretPos]),Di!==void 0&&Si.push(Di)}if(!_i.shouldDelete(Si,oi))return!1;for(xn(oi,!0),typeof mi!="undefined"&&_i.setCaret(mi);Si.length;)_i.removeItem(Si.pop());return _i.inputState(),_i.positionDropdown(),_i.refreshOptions(!1),!0}shouldDelete(oi,li){let ui=oi.map(mi=>mi.dataset.value);return!(!ui.length||typeof this.settings.onDelete=="function"&&this.settings.onDelete(ui,li)===!1)}advanceSelection(oi,li){var ui,mi,yi=this;yi.rtl&&(oi*=-1),!yi.inputValue().length&&(pi(go,li)||pi("shiftKey",li)?(ui=yi.getLastActive(oi),ui?ui.classList.contains("active")?mi=yi.getAdjacent(ui,oi,"item"):mi=ui:oi>0?mi=yi.control_input.nextElementSibling:mi=yi.control_input.previousElementSibling,mi&&(mi.classList.contains("active")&&yi.removeActiveItem(ui),yi.setActiveItemClass(mi))):yi.moveCaret(oi))}moveCaret(oi){}getLastActive(oi){let li=this.control.querySelector(".last-active");if(li)return li;var ui=this.control.querySelectorAll(".active");if(ui)return qs(ui,oi)}setCaret(oi){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(oi=this.isReadOnly||this.isDisabled){this.isLocked=oi,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(oi){this.focus_node.tabIndex=oi?-1:this.tabIndex,this.isDisabled=oi,this.input.disabled=oi,this.control_input.disabled=oi,this.setLocked()}setReadOnly(oi){this.isReadOnly=oi,this.input.readOnly=oi,this.control_input.readOnly=oi,this.setLocked()}destroy(){var oi=this,li=oi.revertSettings;oi.trigger("destroy"),oi.off(),oi.wrapper.remove(),oi.dropdown.remove(),oi.input.innerHTML=li.innerHTML,oi.input.tabIndex=li.tabIndex,Er(oi.input,"tomselected","ts-hidden-accessible"),oi._destroy(),delete oi.input.tomselect}render(oi,li){var ui,mi;let yi=this;if(typeof this.settings.render[oi]!="function"||(mi=yi.settings.render[oi].call(this,li,Os),!mi))return null;if(mi=Ri(mi),oi==="option"||oi==="option_create"?li[yi.settings.disabledField]?Dn(mi,{"aria-disabled":"true"}):Dn(mi,{"data-selectable":""}):oi==="optgroup"&&(ui=li.group[yi.settings.optgroupValueField],Dn(mi,{"data-group":ui}),li.group[yi.settings.disabledField]&&Dn(mi,{"data-disabled":""})),oi==="option"||oi==="item"){let _i=As(li[yi.settings.valueField]);Dn(mi,{"data-value":_i}),oi==="item"?(Kn(mi,yi.settings.itemClass),Dn(mi,{"data-ts-item":""})):(Kn(mi,yi.settings.optionClass),Dn(mi,{role:"option",id:li.$id}),li.$div=mi,yi.options[_i]=li)}return mi}_render(oi,li){let ui=this.render(oi,li);if(ui==null)throw"HTMLElement expected";return ui}clearCache(){Mi(this.options,oi=>{oi.$div&&(oi.$div.remove(),delete oi.$div)})}uncacheValue(oi){let li=this.getOption(oi);li&&li.remove()}canCreate(oi){return this.settings.create&&oi.length>0&&this.settings.createFilter.call(this,oi)}hook(oi,li,ui){var mi=this,yi=mi[li];mi[li]=function(){var _i,Si;return oi==="after"&&(_i=yi.apply(mi,arguments)),Si=ui.apply(mi,arguments),oi==="instead"?Si:(oi==="before"&&(_i=yi.apply(mi,arguments)),_i)}}}function Qi(){Sn(this.input,"change",()=>{this.sync()})}function hn(di){var oi=this,li=oi.onOptionSelect;oi.settings.hideSelected=!1;let ui=Object.assign({className:"tomselect-checkbox",checkedClassNames:void 0,uncheckedClassNames:void 0},di);var mi=function(Si,Ai){Ai?(Si.checked=!0,ui.uncheckedClassNames&&Si.classList.remove(...ui.uncheckedClassNames),ui.checkedClassNames&&Si.classList.add(...ui.checkedClassNames)):(Si.checked=!1,ui.checkedClassNames&&Si.classList.remove(...ui.checkedClassNames),ui.uncheckedClassNames&&Si.classList.add(...ui.uncheckedClassNames))},yi=function(Si){setTimeout(()=>{var Ai=Si.querySelector("input."+ui.className);Ai instanceof HTMLInputElement&&mi(Ai,Si.classList.contains("selected"))},1)};oi.hook("after","setupTemplates",()=>{var _i=oi.settings.render.option;oi.settings.render.option=(Si,Ai)=>{var Di=Ri(_i.call(oi,Si,Ai)),zi=document.createElement("input");ui.className&&zi.classList.add(ui.className),zi.addEventListener("click",function(Zi){xn(Zi)}),zi.type="checkbox";let Hi=_n(Si[oi.settings.valueField]);return mi(zi,!!(Hi&&oi.items.indexOf(Hi)>-1)),Di.prepend(zi),Di}}),oi.on("item_remove",_i=>{var Si=oi.getOption(_i);Si&&(Si.classList.remove("selected"),yi(Si))}),oi.on("item_add",_i=>{var Si=oi.getOption(_i);Si&&yi(Si)}),oi.hook("instead","onOptionSelect",(_i,Si)=>{if(Si.classList.contains("selected")){Si.classList.remove("selected"),oi.removeItem(Si.dataset.value),oi.refreshOptions(),xn(_i,!0);return}li.call(oi,_i,Si),yi(Si)})}function Ki(di){let oi=this,li=Object.assign({className:"clear-button",title:"Clear All",html:ui=>`
`},di);oi.on("initialize",()=>{var ui=Ri(li.html(li));ui.addEventListener("click",mi=>{oi.isLocked||(oi.clear(),oi.settings.mode==="single"&&oi.settings.allowEmptyOption&&oi.addItem(""),mi.preventDefault(),mi.stopPropagation())}),oi.control.appendChild(ui)})}let cn=(di,oi)=>{var li;(li=di.parentNode)==null||li.insertBefore(oi,di.nextSibling)},Mn=(di,oi)=>{var li;(li=di.parentNode)==null||li.insertBefore(oi,di)},Hr=(di,oi)=>{do{var li;if(oi=(li=oi)==null?void 0:li.previousElementSibling,di==oi)return!0}while(oi&&oi.previousElementSibling);return!1};function Dr(){var di=this;if(di.settings.mode!=="multi")return;var oi=di.lock,li=di.unlock;let ui=!0,mi;di.hook("after","setupTemplates",()=>{var yi=di.settings.render.item;di.settings.render.item=(_i,Si)=>{let Ai=Ri(yi.call(di,_i,Si));Dn(Ai,{draggable:"true"});let Di=bn=>{ui||xn(bn),bn.stopPropagation()},zi=bn=>{mi=Ai,setTimeout(()=>{Ai.classList.add("ts-dragging")},0)},Hi=bn=>{bn.preventDefault(),Ai.classList.add("ts-drag-over"),Pn(Ai,mi)},Zi=()=>{Ai.classList.remove("ts-drag-over")},Pn=(bn,Hn)=>{Hn!==void 0&&(Hr(Hn,Ai)?cn(bn,Hn):Mn(bn,Hn))},Xi=()=>{var bn;document.querySelectorAll(".ts-drag-over").forEach(Ln=>Ln.classList.remove("ts-drag-over")),(bn=mi)==null||bn.classList.remove("ts-dragging"),mi=void 0;var Hn=[];di.control.querySelectorAll("[data-value]").forEach(Ln=>{if(Ln.dataset.value){let an=Ln.dataset.value;an&&Hn.push(an)}}),di.setValue(Hn)};return Sn(Ai,"mousedown",Di),Sn(Ai,"dragstart",zi),Sn(Ai,"dragenter",Hi),Sn(Ai,"dragover",Hi),Sn(Ai,"dragleave",Zi),Sn(Ai,"dragend",Xi),Ai}}),di.hook("instead","lock",()=>(ui=!1,oi.call(di))),di.hook("instead","unlock",()=>(ui=!0,li.call(di)))}function Ys(di){let oi=this,li=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:ui=>'
'+ui.title+'×
'},di);oi.on("initialize",()=>{var ui=Ri(li.html(li)),mi=ui.querySelector("."+li.closeClass);mi&&mi.addEventListener("click",yi=>{xn(yi,!0),oi.close()}),oi.dropdown.insertBefore(ui,oi.dropdown.firstChild)})}function Ms(){var di=this;di.hook("instead","setCaret",oi=>{di.settings.mode==="single"||!di.control.contains(di.control_input)?oi=di.items.length:(oi=Math.max(0,Math.min(di.items.length,oi)),oi!=di.caretPos&&!di.isPending&&di.controlChildren().forEach((li,ui)=>{ui{if(!di.isFocused)return;let li=di.getLastActive(oi);if(li){let ui=is(li);di.setCaret(oi>0?ui+1:ui),di.setActiveItem(),Er(li,"last-active")}else di.setCaret(di.caretPos+oi)})}function Nl(){let di=this;di.settings.shouldOpen=!0,di.hook("before","setup",()=>{di.focus_node=di.control,Kn(di.control_input,"dropdown-input");let oi=Ri('