@keenmate/web-multiselect 1.12.0-rc06 → 1.12.0-rc07

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,9 +1,9 @@
1
- (function(O,P){typeof exports=="object"&&typeof module<"u"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(O=typeof globalThis<"u"?globalThis:O||self,P(O.MultiSelect={}))})(this,function(O){"use strict";var Fs=Object.defineProperty;var Hs=(O,P,B)=>P in O?Fs(O,P,{enumerable:!0,configurable:!0,writable:!0,value:B}):O[P]=B;var h=(O,P,B)=>Hs(O,typeof P!="symbol"?P+"":P,B);const P=Math.min,B=Math.max,me=Math.round,pe=Math.floor,j=o=>({x:o,y:o}),Ct={left:"right",right:"left",bottom:"top",top:"bottom"},St={start:"end",end:"start"};function $e(o,t,e){return B(o,P(t,e))}function ue(o,t){return typeof o=="function"?o(t):o}function J(o){return o.split("-")[0]}function be(o){return o.split("-")[1]}function Re(o){return o==="x"?"y":"x"}function Fe(o){return o==="y"?"height":"width"}const Tt=new Set(["top","bottom"]);function G(o){return Tt.has(J(o))?"y":"x"}function He(o){return Re(G(o))}function It(o,t,e){e===void 0&&(e=!1);const s=be(o),i=He(o),r=Fe(i);let n=i==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(n=ge(n)),[n,ge(n)]}function Mt(o){const t=ge(o);return[xe(o),t,xe(t)]}function xe(o){return o.replace(/start|end/g,t=>St[t])}const Ne=["left","right"],je=["right","left"],Ot=["top","bottom"],At=["bottom","top"];function Pt(o,t,e){switch(o){case"top":case"bottom":return e?t?je:Ne:t?Ne:je;case"left":case"right":return t?Ot:At;default:return[]}}function Lt(o,t,e,s){const i=be(o);let r=Pt(J(o),e==="start",s);return i&&(r=r.map(n=>n+"-"+i),t&&(r=r.concat(r.map(xe)))),r}function ge(o){return o.replace(/left|right|bottom|top/g,t=>Ct[t])}function Et(o){return{top:0,right:0,bottom:0,left:0,...o}}function Vt(o){return typeof o!="number"?Et(o):{top:o,right:o,bottom:o,left:o}}function fe(o){const{x:t,y:e,width:s,height:i}=o;return{width:s,height:i,top:e,left:t,right:t+s,bottom:e+i,x:t,y:e}}function We(o,t,e){let{reference:s,floating:i}=o;const r=G(t),n=He(t),a=Fe(n),l=J(t),d=r==="y",c=s.x+s.width/2-i.width/2,m=s.y+s.height/2-i.height/2,u=s[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:s.y-i.height};break;case"bottom":p={x:c,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:m};break;case"left":p={x:s.x-i.width,y:m};break;default:p={x:s.x,y:s.y}}switch(be(t)){case"start":p[n]-=u*(e&&d?-1:1);break;case"end":p[n]+=u*(e&&d?-1:1);break}return p}const Dt=async(o,t,e)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:n}=e,a=r.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(t));let d=await n.getElementRects({reference:o,floating:t,strategy:i}),{x:c,y:m}=We(d,s,l),u=s,p={},b=0;for(let v=0;v<a.length;v++){const{name:f,fn:g}=a[v],{x:_,y,data:w,reset:M}=await g({x:c,y:m,initialPlacement:s,placement:u,strategy:i,middlewareData:p,rects:d,platform:n,elements:{reference:o,floating:t}});c=_??c,m=y??m,p={...p,[f]:{...p[f],...w}},M&&b<=50&&(b++,typeof M=="object"&&(M.placement&&(u=M.placement),M.rects&&(d=M.rects===!0?await n.getElementRects({reference:o,floating:t,strategy:i}):M.rects),{x:c,y:m}=We(d,u,l)),v=-1)}return{x:c,y:m,placement:u,strategy:i,middlewareData:p}};async function Ue(o,t){var e;t===void 0&&(t={});const{x:s,y:i,platform:r,rects:n,elements:a,strategy:l}=o,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:m="floating",altBoundary:u=!1,padding:p=0}=ue(t,o),b=Vt(p),f=a[u?m==="floating"?"reference":"floating":m],g=fe(await r.getClippingRect({element:(e=await(r.isElement==null?void 0:r.isElement(f)))==null||e?f:f.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),_=m==="floating"?{x:s,y:i,width:n.floating.width,height:n.floating.height}:n.reference,y=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),w=await(r.isElement==null?void 0:r.isElement(y))?await(r.getScale==null?void 0:r.getScale(y))||{x:1,y:1}:{x:1,y:1},M=fe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:y,strategy:l}):_);return{top:(g.top-M.top+b.top)/w.y,bottom:(M.bottom-g.bottom+b.bottom)/w.y,left:(g.left-M.left+b.left)/w.x,right:(M.right-g.right+b.right)/w.x}}const zt=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(t){var e,s;const{placement:i,middlewareData:r,rects:n,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:c=!0,crossAxis:m=!0,fallbackPlacements:u,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...f}=ue(o,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};const g=J(i),_=G(a),y=J(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(d.floating)),M=u||(y||!v?[ge(a)]:Mt(a)),z=b!=="none";!u&&z&&M.push(...Lt(a,v,b,w));const Y=[a,...M],de=await Ue(t,f),I=[];let C=((s=r.flip)==null?void 0:s.overflows)||[];if(c&&I.push(de[g]),m){const k=It(i,n,w);I.push(de[k[0]],de[k[1]])}if(C=[...C,{placement:i,overflows:I}],!I.every(k=>k<=0)){var x,S;const k=(((x=r.flip)==null?void 0:x.index)||0)+1,V=Y[k];if(V&&(!(m==="alignment"?_!==G(V):!1)||C.every(N=>G(N.placement)===_?N.overflows[0]>0:!0)))return{data:{index:k,overflows:C},reset:{placement:V}};let he=(S=C.filter(ee=>ee.overflows[0]<=0).sort((ee,N)=>ee.overflows[1]-N.overflows[1])[0])==null?void 0:S.placement;if(!he)switch(p){case"bestFit":{var E;const ee=(E=C.filter(N=>{if(z){const X=G(N.placement);return X===_||X==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(X=>X>0).reduce((X,Rs)=>X+Rs,0)]).sort((N,X)=>N[1]-X[1])[0])==null?void 0:E[0];ee&&(he=ee);break}case"initialPlacement":he=a;break}if(i!==he)return{reset:{placement:he}}}return{}}}},Bt=new Set(["left","top"]);async function $t(o,t){const{placement:e,platform:s,elements:i}=o,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),n=J(e),a=be(e),l=G(e)==="y",d=Bt.has(n)?-1:1,c=r&&l?-1:1,m=ue(t,o);let{mainAxis:u,crossAxis:p,alignmentAxis:b}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return a&&typeof b=="number"&&(p=a==="end"?b*-1:b),l?{x:p*c,y:u*d}:{x:u*d,y:p*c}}const Rt=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(t){var e,s;const{x:i,y:r,placement:n,middlewareData:a}=t,l=await $t(t,o);return n===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:n}}}}},Ft=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(t){const{x:e,y:s,placement:i}=t,{mainAxis:r=!0,crossAxis:n=!1,limiter:a={fn:f=>{let{x:g,y:_}=f;return{x:g,y:_}}},...l}=ue(o,t),d={x:e,y:s},c=await Ue(t,l),m=G(J(i)),u=Re(m);let p=d[u],b=d[m];if(r){const f=u==="y"?"top":"left",g=u==="y"?"bottom":"right",_=p+c[f],y=p-c[g];p=$e(_,p,y)}if(n){const f=m==="y"?"top":"left",g=m==="y"?"bottom":"right",_=b+c[f],y=b-c[g];b=$e(_,b,y)}const v=a.fn({...t,[u]:p,[m]:b});return{...v,data:{x:v.x-e,y:v.y-s,enabled:{[u]:r,[m]:n}}}}}};function ve(){return typeof window<"u"}function te(o){return Ge(o)?(o.nodeName||"").toLowerCase():"#document"}function D(o){var t;return(o==null||(t=o.ownerDocument)==null?void 0:t.defaultView)||window}function W(o){var t;return(t=(Ge(o)?o.ownerDocument:o.document)||window.document)==null?void 0:t.documentElement}function Ge(o){return ve()?o instanceof Node||o instanceof D(o).Node:!1}function $(o){return ve()?o instanceof Element||o instanceof D(o).Element:!1}function U(o){return ve()?o instanceof HTMLElement||o instanceof D(o).HTMLElement:!1}function Ke(o){return!ve()||typeof ShadowRoot>"u"?!1:o instanceof ShadowRoot||o instanceof D(o).ShadowRoot}const Ht=new Set(["inline","contents"]);function ie(o){const{overflow:t,overflowX:e,overflowY:s,display:i}=R(o);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!Ht.has(i)}const Nt=new Set(["table","td","th"]);function jt(o){return Nt.has(te(o))}const Wt=[":popover-open",":modal"];function _e(o){return Wt.some(t=>{try{return o.matches(t)}catch{return!1}})}const Ut=["transform","translate","scale","rotate","perspective"],Gt=["transform","translate","scale","rotate","perspective","filter"],Kt=["paint","layout","strict","content"];function Ce(o){const t=Se(),e=$(o)?R(o):o;return Ut.some(s=>e[s]?e[s]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||Gt.some(s=>(e.willChange||"").includes(s))||Kt.some(s=>(e.contain||"").includes(s))}function qt(o){let t=K(o);for(;U(t)&&!se(t);){if(Ce(t))return t;if(_e(t))return null;t=K(t)}return null}function Se(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Yt=new Set(["html","body","#document"]);function se(o){return Yt.has(te(o))}function R(o){return D(o).getComputedStyle(o)}function ke(o){return $(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function K(o){if(te(o)==="html")return o;const t=o.assignedSlot||o.parentNode||Ke(o)&&o.host||W(o);return Ke(t)?t.host:t}function qe(o){const t=K(o);return se(t)?o.ownerDocument?o.ownerDocument.body:o.body:U(t)&&ie(t)?t:qe(t)}function re(o,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=qe(o),r=i===((s=o.ownerDocument)==null?void 0:s.body),n=D(i);if(r){const a=Te(n);return t.concat(n,n.visualViewport||[],ie(i)?i:[],a&&e?re(a):[])}return t.concat(i,re(i,[],e))}function Te(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function Ye(o){const t=R(o);let e=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=U(o),r=i?o.offsetWidth:e,n=i?o.offsetHeight:s,a=me(e)!==r||me(s)!==n;return a&&(e=r,s=n),{width:e,height:s,$:a}}function Ie(o){return $(o)?o:o.contextElement}function oe(o){const t=Ie(o);if(!U(t))return j(1);const e=t.getBoundingClientRect(),{width:s,height:i,$:r}=Ye(t);let n=(r?me(e.width):e.width)/s,a=(r?me(e.height):e.height)/i;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Xt=j(0);function Xe(o){const t=D(o);return!Se()||!t.visualViewport?Xt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jt(o,t,e){return t===void 0&&(t=!1),!e||t&&e!==D(o)?!1:t}function Z(o,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=o.getBoundingClientRect(),r=Ie(o);let n=j(1);t&&(s?$(s)&&(n=oe(s)):n=oe(o));const a=Jt(r,e,s)?Xe(r):j(0);let l=(i.left+a.x)/n.x,d=(i.top+a.y)/n.y,c=i.width/n.x,m=i.height/n.y;if(r){const u=D(r),p=s&&$(s)?D(s):s;let b=u,v=Te(b);for(;v&&s&&p!==b;){const f=oe(v),g=v.getBoundingClientRect(),_=R(v),y=g.left+(v.clientLeft+parseFloat(_.paddingLeft))*f.x,w=g.top+(v.clientTop+parseFloat(_.paddingTop))*f.y;l*=f.x,d*=f.y,c*=f.x,m*=f.y,l+=y,d+=w,b=D(v),v=Te(b)}}return fe({width:c,height:m,x:l,y:d})}function ye(o,t){const e=ke(o).scrollLeft;return t?t.left+e:Z(W(o)).left+e}function Je(o,t){const e=o.getBoundingClientRect(),s=e.left+t.scrollLeft-ye(o,e),i=e.top+t.scrollTop;return{x:s,y:i}}function Zt(o){let{elements:t,rect:e,offsetParent:s,strategy:i}=o;const r=i==="fixed",n=W(s),a=t?_e(t.floating):!1;if(s===n||a&&r)return e;let l={scrollLeft:0,scrollTop:0},d=j(1);const c=j(0),m=U(s);if((m||!m&&!r)&&((te(s)!=="body"||ie(n))&&(l=ke(s)),U(s))){const p=Z(s);d=oe(s),c.x=p.x+s.clientLeft,c.y=p.y+s.clientTop}const u=n&&!m&&!r?Je(n,l):j(0);return{width:e.width*d.x,height:e.height*d.y,x:e.x*d.x-l.scrollLeft*d.x+c.x+u.x,y:e.y*d.y-l.scrollTop*d.y+c.y+u.y}}function Qt(o){return Array.from(o.getClientRects())}function es(o){const t=W(o),e=ke(o),s=o.ownerDocument.body,i=B(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=B(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let n=-e.scrollLeft+ye(o);const a=-e.scrollTop;return R(s).direction==="rtl"&&(n+=B(t.clientWidth,s.clientWidth)-i),{width:i,height:r,x:n,y:a}}const Ze=25;function ts(o,t){const e=D(o),s=W(o),i=e.visualViewport;let r=s.clientWidth,n=s.clientHeight,a=0,l=0;if(i){r=i.width,n=i.height;const c=Se();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const d=ye(s);if(d<=0){const c=s.ownerDocument,m=c.body,u=getComputedStyle(m),p=c.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,b=Math.abs(s.clientWidth-m.clientWidth-p);b<=Ze&&(r-=b)}else d<=Ze&&(r+=d);return{width:r,height:n,x:a,y:l}}const ss=new Set(["absolute","fixed"]);function os(o,t){const e=Z(o,!0,t==="fixed"),s=e.top+o.clientTop,i=e.left+o.clientLeft,r=U(o)?oe(o):j(1),n=o.clientWidth*r.x,a=o.clientHeight*r.y,l=i*r.x,d=s*r.y;return{width:n,height:a,x:l,y:d}}function Qe(o,t,e){let s;if(t==="viewport")s=ts(o,e);else if(t==="document")s=es(W(o));else if($(t))s=os(t,e);else{const i=Xe(o);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return fe(s)}function et(o,t){const e=K(o);return e===t||!$(e)||se(e)?!1:R(e).position==="fixed"||et(e,t)}function is(o,t){const e=t.get(o);if(e)return e;let s=re(o,[],!1).filter(a=>$(a)&&te(a)!=="body"),i=null;const r=R(o).position==="fixed";let n=r?K(o):o;for(;$(n)&&!se(n);){const a=R(n),l=Ce(n);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&ss.has(i.position)||ie(n)&&!l&&et(o,n))?s=s.filter(c=>c!==n):i=a,n=K(n)}return t.set(o,s),s}function rs(o){let{element:t,boundary:e,rootBoundary:s,strategy:i}=o;const n=[...e==="clippingAncestors"?_e(t)?[]:is(t,this._c):[].concat(e),s],a=n[0],l=n.reduce((d,c)=>{const m=Qe(t,c,i);return d.top=B(m.top,d.top),d.right=P(m.right,d.right),d.bottom=P(m.bottom,d.bottom),d.left=B(m.left,d.left),d},Qe(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ns(o){const{width:t,height:e}=Ye(o);return{width:t,height:e}}function as(o,t,e){const s=U(t),i=W(t),r=e==="fixed",n=Z(o,!0,r,t);let a={scrollLeft:0,scrollTop:0};const l=j(0);function d(){l.x=ye(i)}if(s||!s&&!r)if((te(t)!=="body"||ie(i))&&(a=ke(t)),s){const p=Z(t,!0,r,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else i&&d();r&&!s&&i&&d();const c=i&&!s&&!r?Je(i,a):j(0),m=n.left+a.scrollLeft-l.x-c.x,u=n.top+a.scrollTop-l.y-c.y;return{x:m,y:u,width:n.width,height:n.height}}function Me(o){return R(o).position==="static"}function tt(o,t){if(!U(o)||R(o).position==="fixed")return null;if(t)return t(o);let e=o.offsetParent;return W(o)===e&&(e=e.ownerDocument.body),e}function st(o,t){const e=D(o);if(_e(o))return e;if(!U(o)){let i=K(o);for(;i&&!se(i);){if($(i)&&!Me(i))return i;i=K(i)}return e}let s=tt(o,t);for(;s&&jt(s)&&Me(s);)s=tt(s,t);return s&&se(s)&&Me(s)&&!Ce(s)?e:s||qt(o)||e}const ls=async function(o){const t=this.getOffsetParent||st,e=this.getDimensions,s=await e(o.floating);return{reference:as(o.reference,await t(o.floating),o.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function cs(o){return R(o).direction==="rtl"}const ot={convertOffsetParentRelativeRectToViewportRelativeRect:Zt,getDocumentElement:W,getClippingRect:rs,getOffsetParent:st,getElementRects:ls,getClientRects:Qt,getDimensions:ns,getScale:oe,isElement:$,isRTL:cs};function it(o,t){return o.x===t.x&&o.y===t.y&&o.width===t.width&&o.height===t.height}function ds(o,t){let e=null,s;const i=W(o);function r(){var a;clearTimeout(s),(a=e)==null||a.disconnect(),e=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();const d=o.getBoundingClientRect(),{left:c,top:m,width:u,height:p}=d;if(a||t(),!u||!p)return;const b=pe(m),v=pe(i.clientWidth-(c+u)),f=pe(i.clientHeight-(m+p)),g=pe(c),y={rootMargin:-b+"px "+-v+"px "+-f+"px "+-g+"px",threshold:B(0,P(1,l))||1};let w=!0;function M(z){const Y=z[0].intersectionRatio;if(Y!==l){if(!w)return n();Y?n(!1,Y):s=setTimeout(()=>{n(!1,1e-7)},1e3)}Y===1&&!it(d,o.getBoundingClientRect())&&n(),w=!1}try{e=new IntersectionObserver(M,{...y,root:i.ownerDocument})}catch{e=new IntersectionObserver(M,y)}e.observe(o)}return n(!0),r}function Oe(o,t,e,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,d=Ie(o),c=i||r?[...d?re(d):[],...re(t)]:[];c.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),r&&g.addEventListener("resize",e)});const m=d&&a?ds(d,e):null;let u=-1,p=null;n&&(p=new ResizeObserver(g=>{let[_]=g;_&&_.target===d&&p&&(p.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var y;(y=p)==null||y.observe(t)})),e()}),d&&!l&&p.observe(d),p.observe(t));let b,v=l?Z(o):null;l&&f();function f(){const g=Z(o);v&&!it(v,g)&&e(),v=g,b=requestAnimationFrame(f)}return e(),()=>{var g;c.forEach(_=>{i&&_.removeEventListener("scroll",e),r&&_.removeEventListener("resize",e)}),m==null||m(),(g=p)==null||g.disconnect(),p=null,l&&cancelAnimationFrame(b)}}const Ae=Rt,Pe=Ft,rt=zt,Le=(o,t,e)=>{const s=new Map,i={platform:ot,...e},r={...i.platform,_c:s};return Dt(o,t,{...i,platform:r})};var nt=function(){},F="undefined",hs=typeof window!==F&&typeof window.navigator!==F&&/Trident\/|MSIE /.test(window.navigator.userAgent),Ee=["trace","debug","info","warn","error"],ne={},T=null;function at(o,t){var e=o[t];if(typeof e.bind=="function")return e.bind(o);try{return Function.prototype.bind.call(e,o)}catch{return function(){return Function.prototype.apply.apply(e,[o,arguments])}}}function ms(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function ps(o){return o==="debug"&&(o="log"),typeof console===F?!1:o==="trace"&&hs?ms:console[o]!==void 0?at(console,o):console.log!==void 0?at(console,"log"):nt}function ae(){for(var o=this.getLevel(),t=0;t<Ee.length;t++){var e=Ee[t];this[e]=t<o?nt:this.methodFactory(e,o,this.name)}if(this.log=this.debug,typeof console===F&&o<this.levels.SILENT)return"No console available for logging"}function us(o){return function(){typeof console!==F&&(ae.call(this),this[o].apply(this,arguments))}}function bs(o,t,e){return ps(o)||us.apply(this,arguments)}function lt(o,t){var e=this,s,i,r,n="loglevel";typeof o=="string"?n+=":"+o:typeof o=="symbol"&&(n=void 0);function a(u){var p=(Ee[u]||"silent").toUpperCase();if(!(typeof window===F||!n)){try{window.localStorage[n]=p;return}catch{}try{window.document.cookie=encodeURIComponent(n)+"="+p+";"}catch{}}}function l(){var u;if(!(typeof window===F||!n)){try{u=window.localStorage[n]}catch{}if(typeof u===F)try{var p=window.document.cookie,b=encodeURIComponent(n),v=p.indexOf(b+"=");v!==-1&&(u=/^([^;]+)/.exec(p.slice(v+b.length+1))[1])}catch{}return e.levels[u]===void 0&&(u=void 0),u}}function d(){if(!(typeof window===F||!n)){try{window.localStorage.removeItem(n)}catch{}try{window.document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function c(u){var p=u;if(typeof p=="string"&&e.levels[p.toUpperCase()]!==void 0&&(p=e.levels[p.toUpperCase()]),typeof p=="number"&&p>=0&&p<=e.levels.SILENT)return p;throw new TypeError("log.setLevel() called with invalid level: "+u)}e.name=o,e.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},e.methodFactory=t||bs,e.getLevel=function(){return r??i??s},e.setLevel=function(u,p){return r=c(u),p!==!1&&a(r),ae.call(e)},e.setDefaultLevel=function(u){i=c(u),l()||e.setLevel(u,!1)},e.resetLevel=function(){r=null,d(),ae.call(e)},e.enableAll=function(u){e.setLevel(e.levels.TRACE,u)},e.disableAll=function(u){e.setLevel(e.levels.SILENT,u)},e.rebuild=function(){if(T!==e&&(s=c(T.getLevel())),ae.call(e),T===e)for(var u in ne)ne[u].rebuild()},s=c(T?T.getLevel():"WARN");var m=l();m!=null&&(r=c(m)),ae.call(e)}T=new lt,T.getLogger=function(t){if(typeof t!="symbol"&&typeof t!="string"||t==="")throw new TypeError("You must supply a name when creating a logger.");var e=ne[t];return e||(e=ne[t]=new lt(t,T.methodFactory)),e};var gs=typeof window!==F?window.log:void 0;T.noConflict=function(){return typeof window!==F&&window.log===T&&(window.log=gs),T},T.getLoggers=function(){return ne},T.default=T;var fs=function(o){for(var t=1,e=arguments.length,s;t<e;t++)for(s in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],s)&&(o[s]=arguments[t][s]);return o},vs={template:"[%t] %l:",levelFormatter:function(o){return o.toUpperCase()},nameFormatter:function(o){return o||"root"},timestampFormatter:function(o){return o.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},ct,Q={},_s=function(o){if(!o||!o.getLogger)throw new TypeError("Argument is not a root logger");ct=o},ks=function(o,t){if(!o||!o.setLevel)throw new TypeError("Argument is not a logger");var e=o.methodFactory,s=o.name||"",i=Q[s]||Q[""]||vs;function r(n,a,l){var d=e(n,a,l),c=Q[l]||Q[""],m=c.template.indexOf("%t")!==-1,u=c.template.indexOf("%l")!==-1,p=c.template.indexOf("%n")!==-1;return function(){for(var b="",v=arguments.length,f=Array(v),g=0;g<v;g++)f[g]=arguments[g];if(s||!Q[l]){var _=c.timestampFormatter(new Date),y=c.levelFormatter(n),w=c.nameFormatter(l);c.format?b+=c.format(y,w,_):(b+=c.template,m&&(b=b.replace(/%t/,_)),u&&(b=b.replace(/%l/,y)),p&&(b=b.replace(/%n/,w))),f.length&&typeof f[0]=="string"?f[0]=b+" "+f[0]:f.unshift(b)}d.apply(void 0,f)}}return Q[s]||(o.methodFactory=r),t=t||{},t.template&&(t.format=void 0),Q[s]=fs({},i,t),o.setLevel(o.getLevel()),ct||o.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),o},ys={reg:_s,apply:ks};const ws={debug:"#0ea5e9",info:"#10b981",warn:"#f59e0b",error:"#ef4444"};ys.reg(T);const xs=o=>o.toTimeString().split(" ")[0]+"."+o.getMilliseconds().toString().padStart(3,"0"),Cs=T.methodFactory;T.methodFactory=function(o,t,e){const s=Cs(o,t,e),r=`color: ${ws[o]||"#666"}; font-weight: bold;`,n="color: inherit;";return function(...a){const l=xs(new Date),d=o.toUpperCase(),c=e?`%c[${l}]%c %c[${d}]%c %c[${e}]%c`:`%c[${l}]%c %c[${d}]%c`;s(c,...e?[r,n,r,n,r,n]:[r,n,r,n],...a)}},typeof T.setDefaultLevel=="function"?T.setDefaultLevel("silent"):T.setLevel("silent",!1);const le=T.getLogger("MULTISELECT:INIT"),A=T.getLogger("MULTISELECT:DATA"),H=T.getLogger("MULTISELECT:UI"),L=T.getLogger("MULTISELECT:INTERACTION"),dt=["MULTISELECT:INIT","MULTISELECT:DATA","MULTISELECT:UI","MULTISELECT:INTERACTION"];function Ve(){typeof T.rebuild=="function"&&T.rebuild()}function ht(){T.setLevel("debug"),Ve()}function mt(){T.setLevel("silent"),Ve()}function pt(o){T.setLevel(o),Ve()}function ut(o,t){const e=o.includes(":")?o:`MULTISELECT:${o}`;T.getLogger(e).setLevel(t)}class bt{constructor(t){h(this,"container");h(this,"wrapper");h(this,"viewport");h(this,"itemHeight");h(this,"items");h(this,"renderItem");h(this,"bufferSize");h(this,"onVisibleRangeChange");h(this,"onScroll");h(this,"scrollTop",0);h(this,"viewportHeight",0);h(this,"visibleStart",0);h(this,"visibleEnd",0);h(this,"scrollHandler");h(this,"resizeObserver");this.container=t.container,this.itemHeight=t.itemHeight,this.items=t.items,this.renderItem=t.renderItem,this.bufferSize=t.bufferSize??10,this.onVisibleRangeChange=t.onVisibleRangeChange,this.onScroll=t.onScroll,this.scrollHandler=this.handleScroll.bind(this),this.init()}init(){this.container.innerHTML="",this.wrapper=document.createElement("div"),this.wrapper.style.position="relative",this.wrapper.style.width="100%",this.wrapper.style.height=`${this.items.length*this.itemHeight}px`,this.wrapper.className="ms__virtual-scroll-wrapper",this.viewport=document.createElement("div"),this.viewport.style.position="absolute",this.viewport.style.top="0",this.viewport.style.left="0",this.viewport.style.right="0",this.viewport.style.width="100%",this.viewport.className="ms__virtual-scroll-viewport",this.wrapper.appendChild(this.viewport),this.container.appendChild(this.wrapper),this.container.addEventListener("scroll",this.scrollHandler),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.updateViewportHeight(),this.render()}),this.resizeObserver.observe(this.container)),this.updateViewportHeight(),this.render()}updateViewportHeight(){const t=this.container.clientHeight;t>0&&(this.viewportHeight=t)}handleScroll(){this.scrollTop=this.container.scrollTop,this.onScroll&&this.onScroll(this.scrollTop),this.render()}calculateVisibleRange(){const t=Math.floor(this.scrollTop/this.itemHeight),e=Math.ceil((this.scrollTop+this.viewportHeight)/this.itemHeight),s=Math.max(0,t-this.bufferSize),i=Math.min(this.items.length,e+this.bufferSize);return{start:s,end:i}}render(){const{start:t,end:e}=this.calculateVisibleRange();if(t===this.visibleStart&&e===this.visibleEnd)return;this.visibleStart=t,this.visibleEnd=e,this.onVisibleRangeChange&&this.onVisibleRangeChange(t,e);let s="";for(let i=t;i<e;i++){const r=this.items[i],n=this.renderItem(r,i),a=i*this.itemHeight;s+=`<div class="ms__virtual-item" style="position: absolute; top: ${a}px; left: 0; right: 0; height: ${this.itemHeight}px;" data-index="${i}">`,s+=n,s+="</div>"}this.viewport.innerHTML=s}setItems(t){const e=t!==this.items||t.length!==this.items.length;this.items=t,this.wrapper.style.height=`${t.length*this.itemHeight}px`,this.updateViewportHeight(),e&&(this.scrollTop=0,this.container.scrollTop=0),this.visibleStart=-1,this.visibleEnd=-1,this.render()}scrollToIndex(t){if(t<0||t>=this.items.length)return;const e=t*this.itemHeight,s=e+this.itemHeight,i=this.container.scrollTop,r=i+this.viewportHeight;e<i?this.container.scrollTop=e:s>r&&(this.container.scrollTop=s-this.viewportHeight)}getVisibleRange(){return{start:this.visibleStart,end:this.visibleEnd}}getItemCount(){return this.items.length}setItemHeight(t){this.itemHeight=t,this.wrapper.style.height=`${this.items.length*t}px`,this.visibleStart=-1,this.visibleEnd=-1,this.render()}setBufferSize(t){this.bufferSize=t,this.visibleStart=-1,this.visibleEnd=-1,this.render()}refresh(){this.visibleStart=-1,this.visibleEnd=-1,this.render()}destroy(){this.container.removeEventListener("scroll",this.scrollHandler),this.resizeObserver&&this.resizeObserver.disconnect(),this.container.innerHTML=""}}class Ss{constructor(t){h(this,"element");h(this,"trigger");h(this,"container");h(this,"placement");h(this,"offsetDistance");h(this,"showDelay");h(this,"hideDelay");h(this,"visibleClass");h(this,"followCursor");h(this,"onBeforeShow");h(this,"showTimer",null);h(this,"hideTimer",null);h(this,"positionCleanup",null);h(this,"visible",!1);h(this,"cursorX",0);h(this,"cursorY",0);h(this,"handleMouseEnter");h(this,"handleMouseLeave");h(this,"handleMouseMove");this.trigger=t.trigger,this.container=t.container,this.placement=t.placement??"top",this.offsetDistance=t.offsetDistance??8,this.showDelay=t.showDelay??100,this.hideDelay=t.hideDelay??100,this.visibleClass=t.visibleClass??"ms__badge-tooltip--visible",this.followCursor=t.followCursor??!1,this.onBeforeShow=t.onBeforeShow,this.element=document.createElement("div"),this.element.className=t.cssClass??"ms__badge-tooltip",typeof t.content=="string"?this.element.textContent=t.content:this.element.appendChild(t.content),this.container.appendChild(this.element),this.handleMouseEnter=e=>{this.followCursor&&(this.cursorX=e.clientX,this.cursorY=e.clientY),this.scheduleShow()},this.handleMouseLeave=()=>this.scheduleHide(),this.trigger.addEventListener("mouseenter",this.handleMouseEnter),this.trigger.addEventListener("mouseleave",this.handleMouseLeave),this.followCursor&&(this.handleMouseMove=e=>{this.cursorX=e.clientX,this.cursorY=e.clientY,this.visible&&this.positionAtCursor()},this.trigger.addEventListener("mousemove",this.handleMouseMove))}scheduleShow(){this.hideTimer!==null&&(clearTimeout(this.hideTimer),this.hideTimer=null),this.showTimer===null&&(this.showTimer=window.setTimeout(()=>{this.showTimer=null,this.show()},this.showDelay))}scheduleHide(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null),this.hideTimer===null&&(this.hideTimer=window.setTimeout(()=>{this.hideTimer=null,this.hide()},this.hideDelay))}show(){var t;(t=this.onBeforeShow)==null||t.call(this),this.visible=!0,this.element.classList.add(this.visibleClass),this.positionCleanup&&(this.positionCleanup(),this.positionCleanup=null),this.followCursor?this.positionAtCursor():this.positionCleanup=Oe(this.trigger,this.element,()=>this.computeAt(this.trigger))}computeAt(t){Le(t,this.element,{placement:this.placement,strategy:"fixed",middleware:[Ae(this.offsetDistance),rt(),Pe({padding:8})]}).then(({x:e,y:s})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${s}px`})})}positionAtCursor(){const t=this.cursorX,e=this.cursorY,s={getBoundingClientRect:()=>({width:0,height:0,x:t,y:e,top:e,left:t,right:t,bottom:e})};this.computeAt(s)}hide(){this.visible=!1,this.element.classList.remove(this.visibleClass),this.positionCleanup&&(this.positionCleanup(),this.positionCleanup=null)}hideImmediate(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null),this.hideTimer!==null&&(clearTimeout(this.hideTimer),this.hideTimer=null),this.hide()}destroy(){this.showTimer!==null&&clearTimeout(this.showTimer),this.hideTimer!==null&&clearTimeout(this.hideTimer),this.showTimer=null,this.hideTimer=null,this.positionCleanup&&(this.positionCleanup(),this.positionCleanup=null),this.trigger.removeEventListener("mouseenter",this.handleMouseEnter),this.trigger.removeEventListener("mouseleave",this.handleMouseLeave),this.handleMouseMove&&this.trigger.removeEventListener("mousemove",this.handleMouseMove),this.element.remove()}}function gt(o){return{treeId:"",id:-1,path:"",pathSegment:"",parentPath:void 0,level:void 0,children:{},hasChildren:!1,isSelectable:!0,data:void 0,...o}}const ce=o=>!o||typeof o=="string"&&o.trim()==="";function Ts(o,t="."){if(!o||typeof o!="string")return null;const e=o.lastIndexOf(t);return e===-1?"":o.substring(0,e)}function ft(o,t,e="."){return ce(t)?o:o.startsWith(t+e)?o.substring(t.length+e.length):o}function vt(o,t=0,e=1,s="."){return o.split(s).slice(t,t+e).join(s)}function Is(o,t){return o.split(t).length}function q(o,t){return o[t]}function Ms(o={}){const t=o.idMember,e=o.pathMember,s=o.getPathCallback,i=o.parentPathMember,r=o.levelMember,n=o.hasChildrenMember,a=o.isSelectableMember,l=o.getIsSelectableCallback,d=o.treeId||"multiselect-tree",c=o.orderMember,m=o.getDisplayValueCallback,u=ce(i),p=ce(r),b=ce(n),v=ce(a),f="x",g=o.treePathSeparator||".",_=gt();let y=0,w=null;const M=I=>s?s(I):e?q(I,e):void 0,z={treePathSeparator:g,root:_,get tree(){return Object.values(_.children)},get flatNodes(){if(w)return w;const I=[],C=o.isSorted??!1,x=o.sortCallback;function S(E){let k=Object.values(E.children);C&&x&&k.length>0&&(k=x(k));for(const V of k)I.push(V),V.hasChildren&&S(V)}return S(_),w=I,I},insertArray(I){I=I||[],_.children={},y=0,w=null;const C=[];let x=I.map((S,E)=>{const k=gt();k.treeId=d,k.id=t?q(S,t):void 0;const V=M(S);return V==null||V===""||typeof V!="string"?(C.push(`index ${E}`),null):(k.path=V,(k.id===void 0||k.id===-1)&&(k.id=V),u?k.parentPath=Ts(k.path,g):k.parentPath=q(S,i),k.pathSegment=vt(ft(k.path,k.parentPath??"",g),0,1,g),p?k.level=Is(k.path,g):k.level=q(S,r),b||(k.hasChildren=q(S,n)),k.data=S,k)}).filter(S=>S!==null);o.isSorted||(o.sortCallback?x=o.sortCallback(x):x=de(x));for(const S of x)Y(S.parentPath??"",S);if(l||!v)for(const S of x)if(l)S.isSelectable=l(S)!==!1;else{const E=q(S.data,a);S.isSelectable=E==null?!0:!!E}C.length>0&&console.warn(`[ltree ${d}] ${C.length} option(s) had an invalid path and were skipped (pathMember="${e}"). Offending: ${C.slice(0,5).join(", ")}`+(C.length>5?", …":""))},getNodeByPath(I,C){let x=C||_;if(I){const S=I.split(g);for(let E=0;E<S.length;E++){const k=f+S[E];if(!x.children.hasOwnProperty(k))return null;x=x.children[k]}}return x}};function Y(I,C){const x=z.getNodeByPath(I);if(!x)return`Node: ${C.path} - Could not find parent node: ${I}`;p&&(C.level=(x.level||0)+1);const S=f+vt(ft(C.path,I,g),0,1,g);return x.children.hasOwnProperty(S)||(x.children[S]=C,b&&!x.hasChildren&&(x.hasChildren=!0),y=Math.max(y,C.level||0)),null}function de(I){return I.sort((C,x)=>{const S=C.level||0,E=x.level||0;if(S!==E)return S-E;if(C.parentPath!==x.parentPath)return C.parentPath?x.parentPath?C.parentPath.localeCompare(x.parentPath):1:-1;if(c&&C.data&&x.data){const k=q(C.data,c)??0,V=q(x.data,c)??0;if(k!==V)return k-V}return m?m(C).localeCompare(m(x)):C.path.localeCompare(x.path)})}return z}function Os(o,t){const e=new Map,s=new Map,i=new Set,r=l=>String(t(l.data)),n=l=>{e.set(r(l),l);const d=[];for(const m of Object.values(l.children))d.push(...n(m));let c;return d.length>0?c=d:l.isSelectable!==!1?(c=[r(l)],i.add(l.path)):c=[],s.set(l.path,c),c},a=o.tree;for(const l of a)n(l);return{nodeByValue:e,atomsUnder:s,atomPaths:i,roots:a}}function De(o,t,e){const s=o.atomsUnder.get(t.path);if(!s||s.length===0)return"unchecked";let i=0;for(const r of s)e.has(r)&&i++;return i===0?"unchecked":i===s.length?"checked":"indeterminate"}function _t(o,t){const e=new Set;for(const s of t){const i=o.nodeByValue.get(String(s));if(i)for(const r of o.atomsUnder.get(i.path)??[])e.add(r)}return e}function As(o,t,e){const s=o.atomsUnder.get(t.path)??[],i=new Set(e),r=De(o,t,e),n=[],a=[];if(r==="checked")for(const l of s)i.delete(l)&&a.push(l);else for(const l of s)i.has(l)||(i.add(l),n.push(l));return{checkedAtoms:i,addedAtoms:n,removedAtoms:a}}function Ps(o,t,e,s){const i=a=>String(s(a.data)),r=[],n=a=>{const l=De(o,a,t);if(l==="unchecked")return;const d=a.isSelectable!==!1,c=Object.values(a.children);if(e==="leaves"){o.atomPaths.has(a.path)&&l==="checked"&&r.push(i(a));for(const m of c)n(m);return}if(e==="all"){l==="checked"&&d&&r.push(i(a));for(const m of c)n(m);return}if(l==="checked"&&d){r.push(i(a));return}for(const m of c)n(m)};for(const a of o.roots)n(a);return r}function Ls(o){let t=o;for(;t&&!(t===document.body||t===document.documentElement);){if(t instanceof Element){const s=getComputedStyle(t);if(s.transform!=="none"||s.perspective!=="none"||s.filter!=="none")return t;const i=s.backdropFilter;if(i&&i!=="none"||s.willChange&&/\b(transform|filter|perspective)\b/.test(s.willChange))return t}const e=t.parentNode;t=e instanceof ShadowRoot?e.host:e}return window}function Es(o,t,e){let s=o;for(;s&&!(s===document.body||s===document.documentElement);){if(s instanceof Element){const r=s.getBoundingClientRect();if(Math.abs(r.x-t)<2&&Math.abs(r.y-e)<2)return s}const i=s.parentNode;s=i instanceof ShadowRoot?i.host:i}return null}function Vs(o){const t=getComputedStyle(o),e=[];t.transform!=="none"&&e.push(`transform: ${t.transform}`),t.perspective!=="none"&&e.push(`perspective: ${t.perspective}`),t.filter!=="none"&&e.push(`filter: ${t.filter}`);const s=t.backdropFilter;return s&&s!=="none"&&e.push(`backdrop-filter: ${s}`),t.willChange&&/\b(transform|filter|perspective)\b/.test(t.willChange)&&e.push(`will-change: ${t.willChange}`),t.contain&&/\b(paint|layout|strict|content)\b/.test(t.contain)&&e.push(`contain: ${t.contain}`),t.containerType&&t.containerType!=="normal"&&e.push(`container-type: ${t.containerType}`),e.join("; ")}class kt{constructor(t,e={}){h(this,"element");h(this,"instanceId");h(this,"options");h(this,"isOpen",!1);h(this,"selectedValues",new Set);h(this,"selectedOptions",new Map);h(this,"allOptions",[]);h(this,"filteredOptions",[]);h(this,"tree",null);h(this,"treeNodes",[]);h(this,"cascadeIndex",null);h(this,"cascadeCheckedAtoms",new Set);h(this,"hiddenInputs",[]);h(this,"focusedIndex",-1);h(this,"matchingIndices",new Set);h(this,"searchTerm","");h(this,"isLoading",!1);h(this,"searchDebounceTimer");h(this,"searchAbortController");h(this,"showSelectedPopover",!1);h(this,"selectedPopoverPlacement",null);h(this,"dropdownPlacement",null);h(this,"isRTL",!1);h(this,"effectiveBadgesPosition","bottom");h(this,"justClosedViaClick",!1);h(this,"positioningDriftWarned",!1);h(this,"dropdownCleanup",null);h(this,"hintCleanup",null);h(this,"selectedPopoverCleanup",null);h(this,"tooltips",new Map);h(this,"virtualScroll",null);h(this,"optionsContainer",null);h(this,"selectedPopoverVirtualScroll",null);h(this,"selectedPopoverContainer",null);h(this,"input");h(this,"dropdown");h(this,"dropdownInner");h(this,"badgesContainer");h(this,"counter");h(this,"hint");h(this,"selectedPopover");h(this,"documentKeydownHandler",null);h(this,"documentClickHandler",null);this.element=t,this.instanceId=`MS-${Math.random().toString(36).slice(2,11)}`,this.options={searchHint:t.dataset.searchHint||"",searchPlaceholder:t.dataset.searchPlaceholder||"Search...",selectPlaceholder:t.dataset.selectPlaceholder||"Pick an option...",noDataPlaceholder:t.dataset.noDataPlaceholder||void 0,dropdownMinWidth:t.dataset.dropdownMinWidth||void 0,dropdownMaxWidth:t.dataset.dropdownMaxWidth||void 0,badgesDisplayMode:t.dataset.badgesDisplayMode||"badges",badgesPosition:t.dataset.badgesPosition||"bottom",badgesThresholdMode:t.dataset.badgesThresholdMode||"count",maxHeight:t.dataset.maxHeight||"20rem",emptyMessage:t.dataset.emptyMessage||"No results found",loadingMessage:t.dataset.loadingMessage||"Loading...",searchInputMode:t.dataset.searchInputMode||"normal",searchMode:t.dataset.searchMode||"filter",badgesThreshold:t.dataset.badgesThreshold?parseInt(t.dataset.badgesThreshold):void 0,minSearchLength:parseInt(t.dataset.minSearchLength||"0")||0,searchDebounce:parseInt(t.dataset.searchDebounce||"0")||0,isMultipleEnabled:t.dataset.multiple!=="false",isGroupsAllowed:t.dataset.allowGroups!=="false",isCheckboxesShown:t.dataset.showCheckboxes!=="false",isActionsSticky:t.dataset.stickyActions!=="false",isCloseOnSelect:t.dataset.closeOnSelect==="true",isPlacementLocked:t.dataset.lockPlacement!=="false",isSearchEnabled:t.dataset.enableSearch!=="false",isAddNewAllowed:t.dataset.allowAddNew==="true",isCounterShown:t.dataset.showCounter==="true",isKeepOptionsOnSearch:t.dataset.keepOptionsOnSearch!=="false",shouldKeepSearchOnClose:t.dataset.keepSearchOnClose!=="false",options:[],container:void 0,...e},this.init()}extractField(t,e){if(Array.isArray(t)&&t.length===2){if(e.tupleSkip)return typeof e.fallback=="function"?e.fallback():e.fallback;if(e.tupleIndex!==void 0){const i=t[e.tupleIndex];return e.transform?e.transform(i):i}}if(e.member&&t[e.member]!==void 0){const i=t[e.member];return e.transform?e.transform(i):i}return e.callback?e.callback(t):typeof e.fallback=="function"?e.fallback():e.fallback}getItemValue(t){return this.extractField(t,{tupleIndex:0,member:this.options.valueMember,callback:this.options.getValueCallback,fallback:"[N/A]"})}getItemDisplayValue(t){return this.extractField(t,{tupleIndex:1,member:this.options.displayValueMember,callback:this.options.getDisplayValueCallback,transform:String,fallback:"[N/A]"})}getItemBadgeDisplayValue(t){if(this.options.getBadgeDisplayCallback)return this.options.getBadgeDisplayCallback(t);if(this.options.isBadgeFullTitleShown){const e=this.getItemFullTitle(t);if(e)return e}return this.getItemDisplayValue(t)}getItemFullTitle(t){return this.extractField(t,{tupleSkip:!0,member:this.options.fullTitleMember,callback:this.options.getFullTitleCallback,transform:String,fallback:void 0})}getItemSearchValue(t){return this.extractField(t,{member:this.options.searchValueMember,callback:this.options.getSearchValueCallback,transform:String,fallback:()=>this.getItemDisplayValue(t)})}getItemIcon(t){return this.extractField(t,{tupleSkip:!0,member:this.options.iconMember,callback:this.options.getIconCallback,transform:String,fallback:void 0})}getItemSubtitle(t){return this.extractField(t,{tupleSkip:!0,member:this.options.subtitleMember,callback:this.options.getSubtitleCallback,transform:String,fallback:void 0})}getItemGroup(t){return this.extractField(t,{tupleSkip:!0,member:this.options.groupMember,callback:this.options.getGroupCallback,transform:String,fallback:void 0})}getItemDisabled(t){return this.extractField(t,{tupleSkip:!0,member:this.options.disabledMember,callback:this.options.getDisabledCallback,transform:Boolean,fallback:!1})}isIndexSelectable(t){if(!this.isTreeMode())return!0;const e=this.treeNodes[t];return e?e.isSelectable!==!1:!0}isOptionSelectable(t){if(!this.isTreeMode())return!0;const e=this.filteredOptions.indexOf(t);if(e>=0)return this.isIndexSelectable(e);const s=String(this.getItemValue(t)),i=this.treeNodes.find(r=>String(this.getItemValue(r.data))===s);return i?i.isSelectable!==!1:!0}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),le.debug(`Initialized [${this.instanceId}] with options:`,{placeholder:this.options.searchPlaceholder,totalOptions:this.allOptions.length,isCloseOnSelect:this.options.isCloseOnSelect,dataAttribute:this.element.dataset.closeOnSelect})}parseOptions(){const t=this.element.dataset.options;if(t)try{this.allOptions=JSON.parse(t)}catch(e){A.error(`[${this.instanceId}] Failed to parse data-options:`,e),this.allOptions=[]}else this.options.options&&(this.allOptions=this.options.options);this.filteredOptions=[...this.allOptions],this.isTreeMode()&&this.buildTree()}isTreeMode(){return this.options.isTreeEnabled===!1?!1:!!(this.options.isTreeEnabled||this.options.pathMember||this.options.getPathCallback)}buildTree(){this.tree=Ms({idMember:this.options.valueMember,pathMember:this.options.pathMember,getPathCallback:this.options.getPathCallback,parentPathMember:this.options.parentPathMember,levelMember:this.options.levelMember,hasChildrenMember:this.options.hasChildrenMember,isSelectableMember:this.options.isSelectableMember,getIsSelectableCallback:this.options.getIsSelectableCallback,treePathSeparator:this.options.treePathSeparator,treeId:this.instanceId,getDisplayValueCallback:t=>this.getItemDisplayValue(t.data)}),this.tree.insertArray(this.allOptions),this.cascadeIndex=this.isCascadeMode()?Os(this.tree,t=>String(this.getItemValue(t))):null,this.rebuildTreeVisible()}isCascadeMode(){return this.isTreeMode()&&this.options.isMultipleEnabled!==!1&&this.options.checkboxMode==="cascade"}cascadePolicy(){return this.options.cascadeSelectPolicy??"rolled-up"}refreshCascadeAtoms(){this.isCascadeMode()&&this.cascadeIndex&&(this.cascadeCheckedAtoms=_t(this.cascadeIndex,this.selectedValues))}toggleTreeCascade(t){var c;const e=this.cascadeIndex,s=_t(e,this.selectedValues),{checkedAtoms:i}=As(e,t,s),r=Ps(e,i,this.cascadePolicy(),m=>String(this.getItemValue(m))),n=new Set(r),a=[],l=[];for(const[m,u]of this.selectedOptions)n.has(m)||l.push(u);const d=new Map;for(const m of r){const p=((c=e.nodeByValue.get(m))==null?void 0:c.data)??this.selectedOptions.get(m);p!==void 0&&(d.set(m,p),this.selectedValues.has(m)||a.push(p))}this.selectedValues=n,this.selectedOptions=d,this.cascadeCheckedAtoms=i,this.commit({added:a,removed:l})}rebuildTreeVisible(){if(!this.tree){this.treeNodes=[];return}const t=this.tree.flatNodes,e=this.options.isSearchEnabled?(this.searchTerm||"").trim().toLowerCase():"";let s;if(!e)s=t;else{const i=this.tree.treePathSeparator,r=new Set;for(const n of t)if(this.getItemSearchValue(n.data).toLowerCase().includes(e)){const l=n.path.split(i);for(let d=1;d<=l.length;d++)r.add(l.slice(0,d).join(i))}s=t.filter(n=>r.has(n.path))}this.treeNodes=s,this.filteredOptions=s.map(i=>i.data)}resetVisibleToAll(){this.isTreeMode()?this.rebuildTreeVisible():this.filteredOptions=[...this.allOptions]}rebuildTreeVisibleFromMatches(t){if(!this.tree){this.treeNodes=[],this.filteredOptions=[];return}const e=this.tree.flatNodes,s=this.tree.treePathSeparator,i=new Set((t||[]).map(a=>String(this.getItemValue(a)))),r=new Set;for(const a of e)if(i.has(String(this.getItemValue(a.data)))){const l=a.path.split(s);for(let d=1;d<=l.length;d++)r.add(l.slice(0,d).join(s))}const n=e.filter(a=>r.has(a.path));this.treeNodes=n,this.filteredOptions=n.map(a=>a.data)}buildHTML(){const t=this.options.container||document.body,e=this.element.getRootNode(),s=e instanceof ShadowRoot?e.host:this.element,i=s.getAttribute("dir")==="rtl",r=s.closest('[dir="rtl"]')!==null;this.isRTL=i||r,le.debug(`[${this.instanceId}] RTL Debug:`,{isShadowRoot:e instanceof ShadowRoot,hostElement:s,elementDir:s.getAttribute("dir"),hasElementDir:i,hasAncestorDir:r,isRTL:this.isRTL}),this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left")),this.element.classList.add("ms"),this.isRTL&&(this.element.classList.add("ms--rtl"),le.debug(`[${this.instanceId}] Added ms--rtl class to element`)),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ms--no-checkboxes");const n=document.createElement("div");n.className="ms__input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="ms__input",this.input.placeholder=this.getPlaceholderText(),this.input.autocomplete="off",this.options.searchInputMode==="readonly"?this.input.readOnly=!0:this.options.searchInputMode==="hidden"&&(this.input.style.display="none");const a=document.createElement("span");a.className="ms__toggle",a.innerHTML="▼",this.counter=document.createElement("span"),this.counter.className="ms__counter",this.counter.style.display="none",n.appendChild(this.input),n.appendChild(this.counter),n.appendChild(a),this.badgesContainer=document.createElement("div"),this.badgesContainer.className="ms__badges";const l=document.createElement("div");l.className="ms__wrapper",(this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")&&l.classList.add("ms__wrapper--inline"),l.appendChild(n),l.appendChild(this.badgesContainer),this.element.appendChild(l),this.dropdown=document.createElement("div"),this.dropdown.className="ms__dropdown",this.dropdownInner=document.createElement("div"),this.dropdownInner.className="ms__dropdown-inner",this.dropdown.appendChild(this.dropdownInner),t.appendChild(this.dropdown),this.options.searchHint&&(this.hint=document.createElement("div"),this.hint.className="ms__hint",this.hint.textContent=this.options.searchHint,t.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ms__selected-popover",t.appendChild(this.selectedPopover),this.renderDropdown()}shouldUseVirtualScroll(){if(!this.options.isVirtualScrollEnabled||this.options.isGroupsAllowed&&this.hasGroups())return!1;const t=this.options.virtualScrollThreshold??100;return this.filteredOptions.length>=t}hasGroups(){return this.filteredOptions.some(t=>{const e=this.getItemGroup(t);return e&&e.trim()!==""})}renderDropdown(){if(this.destroyAllActionButtonTooltips(),this.refreshCascadeAtoms(),this.shouldUseVirtualScroll()){this.dropdown.classList.add("ms__dropdown--virtual"),this.renderDropdownVirtual();return}this.dropdown.classList.remove("ms__dropdown--virtual"),this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null,this.optionsContainer=null);let t="";if(this.isLoading){t+='<div class="ms__loader">',t+='<div class="pa-loader pa-loader--sm"></div>',t+=`<div class="ms__loading-text">${this.options.loadingMessage}</div>`,t+="</div>",this.dropdownInner.innerHTML=t;return}const e=this.renderActionsHTML(),s=this.options.actionsPosition==="bottom";if(s||(t+=e),this.options.isVirtualScrollEnabled){const i=this.options.optionHeight??50;t+=`<div class="ms__options ms__options--fixed-height" style="--ms-option-height: ${i}px;">`}else t+='<div class="ms__options">';if(this.filteredOptions.length===0)t+=`<div class="ms__empty">${this.options.emptyMessage}</div>`;else if(this.isTreeMode())this.treeNodes.forEach((i,r)=>{t+=this.renderTreeNode(i,r)});else if(this.options.isGroupsAllowed){const i=this.groupOptions(this.filteredOptions),r=new Map;this.filteredOptions.forEach((n,a)=>r.set(n,a)),Object.keys(i).forEach(n=>{if(t+='<div class="ms__group">',n!=="__ungrouped__")if(this.options.renderGroupLabelContentCallback){const a=this.options.renderGroupLabelContentCallback(n);if(a instanceof HTMLElement){const l=document.createElement("div");l.className="ms__group-label",l.appendChild(a),t+=l.outerHTML}else t+=`<div class="ms__group-label">${a}</div>`}else t+=`<div class="ms__group-label">${n}</div>`;i[n].forEach(a=>{t+=this.renderOption(a,r.get(a)??-1)}),t+="</div>"})}else this.filteredOptions.forEach((i,r)=>{t+=this.renderOption(i,r)});t+="</div>",s&&(t+=e),this.dropdownInner.innerHTML=t,this.attachActionButtonTooltips(),this.attachOptionTooltips()}renderDropdownVirtual(){if(this.destroyAllActionButtonTooltips(),!this.virtualScroll){let s="";const i=this.renderActionsHTML(),r=this.options.actionsPosition==="bottom";r||(s+=i);const n=this.options.maxHeight||"20rem",a=this.options.optionHeight??50;s+=`<div class="ms__options ms__options--virtual" style="height: ${n}; max-height: ${n}; overflow-y: auto; position: relative; --ms-option-height: ${a}px;"></div>`,r&&(s+=i),this.dropdownInner.innerHTML=s,this.optionsContainer=this.dropdownInner.querySelector(".ms__options")}if(this.filteredOptions.length===0){this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.optionsContainer.innerHTML=`<div class="ms__empty">${this.options.emptyMessage}</div>`;return}const t=this.options.optionHeight??50,e=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.optionsContainer&&(this.virtualScroll?this.virtualScroll.setItems(this.filteredOptions):this.virtualScroll=new bt({container:this.optionsContainer,itemHeight:t,items:this.filteredOptions,renderItem:(s,i)=>this.isTreeMode()?this.renderTreeNode(this.treeNodes[i],i):this.renderOption(s,i),bufferSize:e,onVisibleRangeChange:()=>{this.attachOptionTooltips()}}),this.attachActionButtonTooltips())})}getBuiltInActionDisabled(t){return t==="select-all"?!this.filteredOptions.some(e=>!this.getItemDisabled(e)&&!this.selectedValues.has(String(this.getItemValue(e)))):t==="clear-all"?this.selectedValues.size===0:!1}renderActionsHTML(){const t=this.options.actionButtons;if(!this.options.isMultipleEnabled||!t||t.length===0)return"";const e=this.options.actionsPosition==="bottom"?"bottom":"top",s=this.options.actionsAlign??"stretch",i=` ms__actions--${e}`,r=this.options.isActionsSticky?" ms__actions--sticky":"",n=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"",a=` ms__actions--align-${s}`,l=new Map;if(t.forEach((c,m)=>{if(!(c.getIsVisibleCallback?c.getIsVisibleCallback(this):c.isVisible??!0))return;let p;c.getIsDisabledCallback?p=c.getIsDisabledCallback(this):c.isDisabled!==void 0?p=c.isDisabled:p=this.getBuiltInActionDisabled(c.action);const b=p?" disabled":"",v=c.getTextCallback?c.getTextCallback(this):c.text;let f="";if(c.getClassCallback){const y=c.getClassCallback(this);f=Array.isArray(y)?` ${y.join(" ")}`:y?` ${y}`:""}else c.cssClass&&(f=` ${c.cssClass}`);const g=Math.max(1,Math.floor(c.row??1)),_=`<button type="button"${b} class="ms__action-btn${f}" data-action="${c.action}" data-button-index="${m}">${v}</button>`;l.has(g)||l.set(g,[]),l.get(g).push(_)}),l.size===0)return"";const d=Array.from(l.keys()).sort((c,m)=>c-m).map(c=>`<div class="ms__actions-row" data-row="${c}">${l.get(c).join("")}</div>`).join("");return`<div class="ms__actions${i}${r}${n}${a}">${d}</div>`}renderOption(t,e){const s=this.getItemValue(t),i=this.getItemDisplayValue(t),r=this.getItemIcon(t),n=this.getItemSubtitle(t),a=this.getItemDisabled(t),l=this.selectedValues.has(String(s)),d=e===this.focusedIndex,c=this.matchingIndices.has(e),m=["ms__option"];l&&m.push("ms__option--selected"),d&&m.push("ms__option--focused"),c&&m.push("ms__option--matched"),a&&m.push("ms__option--disabled");const u=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"";let p=`<div class="${m.join(" ")}" data-value="${s}" data-index="${e}"${u}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(p+=`<input type="checkbox" class="ms__checkbox" ${l?"checked":""} ${a?"disabled":""}>`),p+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const b={index:e,isSelected:l,isFocused:d,isMatched:c,isDisabled:a},v=this.options.renderOptionContentCallback(t,b);typeof v=="string"?p+=v:p+=v.outerHTML}else r&&(p+=`<span class="ms__option-icon">${r}</span>`),p+='<div class="ms__option-text">',p+=`<div class="ms__option-title">${this.highlightMatch(i,this.searchTerm)}</div>`,n&&(p+=`<div class="ms__option-subtitle">${n}</div>`),p+="</div>";return p+="</div>",p+="</div>",p}renderTreeNode(t,e){const s=t.data,i=this.getItemValue(s),r=this.getItemDisplayValue(s),n=this.getItemIcon(s),a=this.getItemSubtitle(s),l=this.getItemDisabled(s),d=this.isCascadeMode()&&this.cascadeIndex,c=d?De(this.cascadeIndex,t,this.cascadeCheckedAtoms):null,m=d?c==="checked":this.selectedValues.has(String(i)),u=c==="indeterminate",p=e===this.focusedIndex,b=t.isSelectable!==!1,v=t.level??1,f=Math.max(0,v-1),g=["ms__option","ms__option--tree"];g.push(t.hasChildren?"ms__option--tree-branch":"ms__option--tree-leaf"),m&&g.push("ms__option--selected"),u&&g.push("ms__option--indeterminate"),p&&g.push("ms__option--focused"),l&&g.push("ms__option--disabled"),b||g.push("ms__option--tree-unselectable");const _=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"",y=b?"":' data-selectable="false"';let w=`<div class="${g.join(" ")}" data-value="${i}" data-index="${e}" data-path="${t.path}" data-level="${v}" style="--ms-tree-depth: ${f};"${_}${y}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&b&&(w+=`<input type="checkbox" class="${u?"ms__checkbox ms__checkbox--indeterminate":"ms__checkbox"}" ${m?"checked":""}${u?' aria-checked="mixed"':""} ${l?"disabled":""}>`),w+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const M={index:e,isSelected:m,isFocused:p,isMatched:!1,isDisabled:l},z=this.options.renderOptionContentCallback(s,M);w+=typeof z=="string"?z:z.outerHTML}else n&&(w+=`<span class="ms__option-icon">${n}</span>`),w+='<div class="ms__option-text">',w+=`<div class="ms__option-title">${this.highlightMatch(r,this.searchTerm)}</div>`,a&&(w+=`<div class="ms__option-subtitle">${a}</div>`),w+="</div>";return w+="</div>",w+="</div>",w}highlightMatch(t,e){if(!e)return t;const s=new RegExp(`(${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return t.replace(s,"<mark>$1</mark>")}groupOptions(t){const e={};return t.forEach(s=>{const i=this.getItemGroup(s)||"__ungrouped__";e[i]||(e[i]=[]),e[i].push(s)}),e}get isSearchUsable(){return!!this.options.isSearchEnabled&&this.options.searchInputMode!=="readonly"&&this.options.searchInputMode!=="hidden"}getPlaceholderText(){return this.options.noDataPlaceholder&&this.allOptions.length===0?this.options.noDataPlaceholder:this.isSearchUsable?this.options.searchPlaceholder:this.options.selectPlaceholder||this.options.searchPlaceholder}renderBadges(){this.destroyAllBadgeTooltips();const t=Array.from(this.selectedOptions.values()),e=this.selectedValues.size;if(!this.options.isMultipleEnabled){this.badgesContainer.innerHTML="",this.counter.style.display="none";let r;t[0]&&(this.options.renderSelectedContentCallback?r=this.options.renderSelectedContentCallback(t[0]):r=this.getItemDisplayValue(t[0])),!this.isOpen&&e>0&&t.length>0?this.input.value=r:this.isOpen||(this.input.value="");return}let s=this.options.badgesDisplayMode;if(this.options.badgesThreshold!==null&&e>this.options.badgesThreshold&&s!=="none"&&(s=this.options.badgesThresholdMode||"count"),!this.isOpen)if(e>0&&s==="count"){const r=this.options.getCounterCallback?this.options.getCounterCallback(e):`${e} selected`;this.input.placeholder=r}else this.input.placeholder=this.getPlaceholderText();if(this.options.isCounterShown&&e>0?(this.counter.textContent=`[${e}]`,this.counter.style.display=""):this.counter.style.display="none",s==="none"){this.badgesContainer.innerHTML="";return}if(s==="badges")this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,this.badgesContainer.innerHTML=t.map(r=>this.renderBadgeHTML(r,{displayMode:"badges",isInPopover:!1})).join("");else if(s==="partial"){this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`;const r=this.options.badgesMaxVisible||3,n=t.slice(0,r),a=e-r,l=n.map(c=>this.renderBadgeHTML(c,{displayMode:"partial",isInPopover:!1})).join("");let d="";a>0&&(d=`
1
+ (function(O,P){typeof exports=="object"&&typeof module<"u"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(O=typeof globalThis<"u"?globalThis:O||self,P(O.MultiSelect={}))})(this,function(O){"use strict";var Fs=Object.defineProperty;var Hs=(O,P,B)=>P in O?Fs(O,P,{enumerable:!0,configurable:!0,writable:!0,value:B}):O[P]=B;var h=(O,P,B)=>Hs(O,typeof P!="symbol"?P+"":P,B);const P=Math.min,B=Math.max,me=Math.round,pe=Math.floor,j=o=>({x:o,y:o}),Ct={left:"right",right:"left",bottom:"top",top:"bottom"},St={start:"end",end:"start"};function Re(o,t,e){return B(o,P(t,e))}function ue(o,t){return typeof o=="function"?o(t):o}function J(o){return o.split("-")[0]}function be(o){return o.split("-")[1]}function Fe(o){return o==="x"?"y":"x"}function He(o){return o==="y"?"height":"width"}const Tt=new Set(["top","bottom"]);function G(o){return Tt.has(J(o))?"y":"x"}function Ne(o){return Fe(G(o))}function It(o,t,e){e===void 0&&(e=!1);const s=be(o),i=Ne(o),r=He(i);let n=i==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(n=ge(n)),[n,ge(n)]}function Mt(o){const t=ge(o);return[xe(o),t,xe(t)]}function xe(o){return o.replace(/start|end/g,t=>St[t])}const je=["left","right"],We=["right","left"],Ot=["top","bottom"],At=["bottom","top"];function Pt(o,t,e){switch(o){case"top":case"bottom":return e?t?We:je:t?je:We;case"left":case"right":return t?Ot:At;default:return[]}}function Lt(o,t,e,s){const i=be(o);let r=Pt(J(o),e==="start",s);return i&&(r=r.map(n=>n+"-"+i),t&&(r=r.concat(r.map(xe)))),r}function ge(o){return o.replace(/left|right|bottom|top/g,t=>Ct[t])}function Et(o){return{top:0,right:0,bottom:0,left:0,...o}}function Vt(o){return typeof o!="number"?Et(o):{top:o,right:o,bottom:o,left:o}}function fe(o){const{x:t,y:e,width:s,height:i}=o;return{width:s,height:i,top:e,left:t,right:t+s,bottom:e+i,x:t,y:e}}function Ue(o,t,e){let{reference:s,floating:i}=o;const r=G(t),n=Ne(t),a=He(n),l=J(t),c=r==="y",d=s.x+s.width/2-i.width/2,p=s.y+s.height/2-i.height/2,u=s[a]/2-i[a]/2;let m;switch(l){case"top":m={x:d,y:s.y-i.height};break;case"bottom":m={x:d,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:p};break;case"left":m={x:s.x-i.width,y:p};break;default:m={x:s.x,y:s.y}}switch(be(t)){case"start":m[n]-=u*(e&&c?-1:1);break;case"end":m[n]+=u*(e&&c?-1:1);break}return m}const Dt=async(o,t,e)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:n}=e,a=r.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(t));let c=await n.getElementRects({reference:o,floating:t,strategy:i}),{x:d,y:p}=Ue(c,s,l),u=s,m={},b=0;for(let v=0;v<a.length;v++){const{name:f,fn:g}=a[v],{x:_,y,data:w,reset:M}=await g({x:d,y:p,initialPlacement:s,placement:u,strategy:i,middlewareData:m,rects:c,platform:n,elements:{reference:o,floating:t}});d=_??d,p=y??p,m={...m,[f]:{...m[f],...w}},M&&b<=50&&(b++,typeof M=="object"&&(M.placement&&(u=M.placement),M.rects&&(c=M.rects===!0?await n.getElementRects({reference:o,floating:t,strategy:i}):M.rects),{x:d,y:p}=Ue(c,u,l)),v=-1)}return{x:d,y:p,placement:u,strategy:i,middlewareData:m}};async function Ge(o,t){var e;t===void 0&&(t={});const{x:s,y:i,platform:r,rects:n,elements:a,strategy:l}=o,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:u=!1,padding:m=0}=ue(t,o),b=Vt(m),f=a[u?p==="floating"?"reference":"floating":p],g=fe(await r.getClippingRect({element:(e=await(r.isElement==null?void 0:r.isElement(f)))==null||e?f:f.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),_=p==="floating"?{x:s,y:i,width:n.floating.width,height:n.floating.height}:n.reference,y=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),w=await(r.isElement==null?void 0:r.isElement(y))?await(r.getScale==null?void 0:r.getScale(y))||{x:1,y:1}:{x:1,y:1},M=fe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:y,strategy:l}):_);return{top:(g.top-M.top+b.top)/w.y,bottom:(M.bottom-g.bottom+b.bottom)/w.y,left:(g.left-M.left+b.left)/w.x,right:(M.right-g.right+b.right)/w.x}}const zt=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(t){var e,s;const{placement:i,middlewareData:r,rects:n,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:u,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...f}=ue(o,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};const g=J(i),_=G(a),y=J(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),M=u||(y||!v?[ge(a)]:Mt(a)),z=b!=="none";!u&&z&&M.push(...Lt(a,v,b,w));const Y=[a,...M],de=await Ge(t,f),I=[];let C=((s=r.flip)==null?void 0:s.overflows)||[];if(d&&I.push(de[g]),p){const k=It(i,n,w);I.push(de[k[0]],de[k[1]])}if(C=[...C,{placement:i,overflows:I}],!I.every(k=>k<=0)){var x,S;const k=(((x=r.flip)==null?void 0:x.index)||0)+1,V=Y[k];if(V&&(!(p==="alignment"?_!==G(V):!1)||C.every(N=>G(N.placement)===_?N.overflows[0]>0:!0)))return{data:{index:k,overflows:C},reset:{placement:V}};let he=(S=C.filter(ee=>ee.overflows[0]<=0).sort((ee,N)=>ee.overflows[1]-N.overflows[1])[0])==null?void 0:S.placement;if(!he)switch(m){case"bestFit":{var E;const ee=(E=C.filter(N=>{if(z){const X=G(N.placement);return X===_||X==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(X=>X>0).reduce((X,Rs)=>X+Rs,0)]).sort((N,X)=>N[1]-X[1])[0])==null?void 0:E[0];ee&&(he=ee);break}case"initialPlacement":he=a;break}if(i!==he)return{reset:{placement:he}}}return{}}}},Bt=new Set(["left","top"]);async function $t(o,t){const{placement:e,platform:s,elements:i}=o,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),n=J(e),a=be(e),l=G(e)==="y",c=Bt.has(n)?-1:1,d=r&&l?-1:1,p=ue(t,o);let{mainAxis:u,crossAxis:m,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof b=="number"&&(m=a==="end"?b*-1:b),l?{x:m*d,y:u*c}:{x:u*c,y:m*d}}const Rt=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(t){var e,s;const{x:i,y:r,placement:n,middlewareData:a}=t,l=await $t(t,o);return n===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:n}}}}},Ft=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(t){const{x:e,y:s,placement:i}=t,{mainAxis:r=!0,crossAxis:n=!1,limiter:a={fn:f=>{let{x:g,y:_}=f;return{x:g,y:_}}},...l}=ue(o,t),c={x:e,y:s},d=await Ge(t,l),p=G(J(i)),u=Fe(p);let m=c[u],b=c[p];if(r){const f=u==="y"?"top":"left",g=u==="y"?"bottom":"right",_=m+d[f],y=m-d[g];m=Re(_,m,y)}if(n){const f=p==="y"?"top":"left",g=p==="y"?"bottom":"right",_=b+d[f],y=b-d[g];b=Re(_,b,y)}const v=a.fn({...t,[u]:m,[p]:b});return{...v,data:{x:v.x-e,y:v.y-s,enabled:{[u]:r,[p]:n}}}}}};function ve(){return typeof window<"u"}function te(o){return Ke(o)?(o.nodeName||"").toLowerCase():"#document"}function D(o){var t;return(o==null||(t=o.ownerDocument)==null?void 0:t.defaultView)||window}function W(o){var t;return(t=(Ke(o)?o.ownerDocument:o.document)||window.document)==null?void 0:t.documentElement}function Ke(o){return ve()?o instanceof Node||o instanceof D(o).Node:!1}function $(o){return ve()?o instanceof Element||o instanceof D(o).Element:!1}function U(o){return ve()?o instanceof HTMLElement||o instanceof D(o).HTMLElement:!1}function qe(o){return!ve()||typeof ShadowRoot>"u"?!1:o instanceof ShadowRoot||o instanceof D(o).ShadowRoot}const Ht=new Set(["inline","contents"]);function ie(o){const{overflow:t,overflowX:e,overflowY:s,display:i}=R(o);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!Ht.has(i)}const Nt=new Set(["table","td","th"]);function jt(o){return Nt.has(te(o))}const Wt=[":popover-open",":modal"];function _e(o){return Wt.some(t=>{try{return o.matches(t)}catch{return!1}})}const Ut=["transform","translate","scale","rotate","perspective"],Gt=["transform","translate","scale","rotate","perspective","filter"],Kt=["paint","layout","strict","content"];function Ce(o){const t=Se(),e=$(o)?R(o):o;return Ut.some(s=>e[s]?e[s]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||Gt.some(s=>(e.willChange||"").includes(s))||Kt.some(s=>(e.contain||"").includes(s))}function qt(o){let t=K(o);for(;U(t)&&!se(t);){if(Ce(t))return t;if(_e(t))return null;t=K(t)}return null}function Se(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Yt=new Set(["html","body","#document"]);function se(o){return Yt.has(te(o))}function R(o){return D(o).getComputedStyle(o)}function ke(o){return $(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function K(o){if(te(o)==="html")return o;const t=o.assignedSlot||o.parentNode||qe(o)&&o.host||W(o);return qe(t)?t.host:t}function Ye(o){const t=K(o);return se(t)?o.ownerDocument?o.ownerDocument.body:o.body:U(t)&&ie(t)?t:Ye(t)}function re(o,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=Ye(o),r=i===((s=o.ownerDocument)==null?void 0:s.body),n=D(i);if(r){const a=Te(n);return t.concat(n,n.visualViewport||[],ie(i)?i:[],a&&e?re(a):[])}return t.concat(i,re(i,[],e))}function Te(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function Xe(o){const t=R(o);let e=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=U(o),r=i?o.offsetWidth:e,n=i?o.offsetHeight:s,a=me(e)!==r||me(s)!==n;return a&&(e=r,s=n),{width:e,height:s,$:a}}function Ie(o){return $(o)?o:o.contextElement}function oe(o){const t=Ie(o);if(!U(t))return j(1);const e=t.getBoundingClientRect(),{width:s,height:i,$:r}=Xe(t);let n=(r?me(e.width):e.width)/s,a=(r?me(e.height):e.height)/i;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Xt=j(0);function Je(o){const t=D(o);return!Se()||!t.visualViewport?Xt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jt(o,t,e){return t===void 0&&(t=!1),!e||t&&e!==D(o)?!1:t}function Z(o,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=o.getBoundingClientRect(),r=Ie(o);let n=j(1);t&&(s?$(s)&&(n=oe(s)):n=oe(o));const a=Jt(r,e,s)?Je(r):j(0);let l=(i.left+a.x)/n.x,c=(i.top+a.y)/n.y,d=i.width/n.x,p=i.height/n.y;if(r){const u=D(r),m=s&&$(s)?D(s):s;let b=u,v=Te(b);for(;v&&s&&m!==b;){const f=oe(v),g=v.getBoundingClientRect(),_=R(v),y=g.left+(v.clientLeft+parseFloat(_.paddingLeft))*f.x,w=g.top+(v.clientTop+parseFloat(_.paddingTop))*f.y;l*=f.x,c*=f.y,d*=f.x,p*=f.y,l+=y,c+=w,b=D(v),v=Te(b)}}return fe({width:d,height:p,x:l,y:c})}function ye(o,t){const e=ke(o).scrollLeft;return t?t.left+e:Z(W(o)).left+e}function Ze(o,t){const e=o.getBoundingClientRect(),s=e.left+t.scrollLeft-ye(o,e),i=e.top+t.scrollTop;return{x:s,y:i}}function Zt(o){let{elements:t,rect:e,offsetParent:s,strategy:i}=o;const r=i==="fixed",n=W(s),a=t?_e(t.floating):!1;if(s===n||a&&r)return e;let l={scrollLeft:0,scrollTop:0},c=j(1);const d=j(0),p=U(s);if((p||!p&&!r)&&((te(s)!=="body"||ie(n))&&(l=ke(s)),U(s))){const m=Z(s);c=oe(s),d.x=m.x+s.clientLeft,d.y=m.y+s.clientTop}const u=n&&!p&&!r?Ze(n,l):j(0);return{width:e.width*c.x,height:e.height*c.y,x:e.x*c.x-l.scrollLeft*c.x+d.x+u.x,y:e.y*c.y-l.scrollTop*c.y+d.y+u.y}}function Qt(o){return Array.from(o.getClientRects())}function es(o){const t=W(o),e=ke(o),s=o.ownerDocument.body,i=B(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=B(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let n=-e.scrollLeft+ye(o);const a=-e.scrollTop;return R(s).direction==="rtl"&&(n+=B(t.clientWidth,s.clientWidth)-i),{width:i,height:r,x:n,y:a}}const Qe=25;function ts(o,t){const e=D(o),s=W(o),i=e.visualViewport;let r=s.clientWidth,n=s.clientHeight,a=0,l=0;if(i){r=i.width,n=i.height;const d=Se();(!d||d&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=ye(s);if(c<=0){const d=s.ownerDocument,p=d.body,u=getComputedStyle(p),m=d.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,b=Math.abs(s.clientWidth-p.clientWidth-m);b<=Qe&&(r-=b)}else c<=Qe&&(r+=c);return{width:r,height:n,x:a,y:l}}const ss=new Set(["absolute","fixed"]);function os(o,t){const e=Z(o,!0,t==="fixed"),s=e.top+o.clientTop,i=e.left+o.clientLeft,r=U(o)?oe(o):j(1),n=o.clientWidth*r.x,a=o.clientHeight*r.y,l=i*r.x,c=s*r.y;return{width:n,height:a,x:l,y:c}}function et(o,t,e){let s;if(t==="viewport")s=ts(o,e);else if(t==="document")s=es(W(o));else if($(t))s=os(t,e);else{const i=Je(o);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return fe(s)}function tt(o,t){const e=K(o);return e===t||!$(e)||se(e)?!1:R(e).position==="fixed"||tt(e,t)}function is(o,t){const e=t.get(o);if(e)return e;let s=re(o,[],!1).filter(a=>$(a)&&te(a)!=="body"),i=null;const r=R(o).position==="fixed";let n=r?K(o):o;for(;$(n)&&!se(n);){const a=R(n),l=Ce(n);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&ss.has(i.position)||ie(n)&&!l&&tt(o,n))?s=s.filter(d=>d!==n):i=a,n=K(n)}return t.set(o,s),s}function rs(o){let{element:t,boundary:e,rootBoundary:s,strategy:i}=o;const n=[...e==="clippingAncestors"?_e(t)?[]:is(t,this._c):[].concat(e),s],a=n[0],l=n.reduce((c,d)=>{const p=et(t,d,i);return c.top=B(p.top,c.top),c.right=P(p.right,c.right),c.bottom=P(p.bottom,c.bottom),c.left=B(p.left,c.left),c},et(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ns(o){const{width:t,height:e}=Xe(o);return{width:t,height:e}}function as(o,t,e){const s=U(t),i=W(t),r=e==="fixed",n=Z(o,!0,r,t);let a={scrollLeft:0,scrollTop:0};const l=j(0);function c(){l.x=ye(i)}if(s||!s&&!r)if((te(t)!=="body"||ie(i))&&(a=ke(t)),s){const m=Z(t,!0,r,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else i&&c();r&&!s&&i&&c();const d=i&&!s&&!r?Ze(i,a):j(0),p=n.left+a.scrollLeft-l.x-d.x,u=n.top+a.scrollTop-l.y-d.y;return{x:p,y:u,width:n.width,height:n.height}}function Me(o){return R(o).position==="static"}function st(o,t){if(!U(o)||R(o).position==="fixed")return null;if(t)return t(o);let e=o.offsetParent;return W(o)===e&&(e=e.ownerDocument.body),e}function ot(o,t){const e=D(o);if(_e(o))return e;if(!U(o)){let i=K(o);for(;i&&!se(i);){if($(i)&&!Me(i))return i;i=K(i)}return e}let s=st(o,t);for(;s&&jt(s)&&Me(s);)s=st(s,t);return s&&se(s)&&Me(s)&&!Ce(s)?e:s||qt(o)||e}const ls=async function(o){const t=this.getOffsetParent||ot,e=this.getDimensions,s=await e(o.floating);return{reference:as(o.reference,await t(o.floating),o.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function cs(o){return R(o).direction==="rtl"}const it={convertOffsetParentRelativeRectToViewportRelativeRect:Zt,getDocumentElement:W,getClippingRect:rs,getOffsetParent:ot,getElementRects:ls,getClientRects:Qt,getDimensions:ns,getScale:oe,isElement:$,isRTL:cs};function rt(o,t){return o.x===t.x&&o.y===t.y&&o.width===t.width&&o.height===t.height}function ds(o,t){let e=null,s;const i=W(o);function r(){var a;clearTimeout(s),(a=e)==null||a.disconnect(),e=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();const c=o.getBoundingClientRect(),{left:d,top:p,width:u,height:m}=c;if(a||t(),!u||!m)return;const b=pe(p),v=pe(i.clientWidth-(d+u)),f=pe(i.clientHeight-(p+m)),g=pe(d),y={rootMargin:-b+"px "+-v+"px "+-f+"px "+-g+"px",threshold:B(0,P(1,l))||1};let w=!0;function M(z){const Y=z[0].intersectionRatio;if(Y!==l){if(!w)return n();Y?n(!1,Y):s=setTimeout(()=>{n(!1,1e-7)},1e3)}Y===1&&!rt(c,o.getBoundingClientRect())&&n(),w=!1}try{e=new IntersectionObserver(M,{...y,root:i.ownerDocument})}catch{e=new IntersectionObserver(M,y)}e.observe(o)}return n(!0),r}function Oe(o,t,e,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,c=Ie(o),d=i||r?[...c?re(c):[],...re(t)]:[];d.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),r&&g.addEventListener("resize",e)});const p=c&&a?ds(c,e):null;let u=-1,m=null;n&&(m=new ResizeObserver(g=>{let[_]=g;_&&_.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(t)})),e()}),c&&!l&&m.observe(c),m.observe(t));let b,v=l?Z(o):null;l&&f();function f(){const g=Z(o);v&&!rt(v,g)&&e(),v=g,b=requestAnimationFrame(f)}return e(),()=>{var g;d.forEach(_=>{i&&_.removeEventListener("scroll",e),r&&_.removeEventListener("resize",e)}),p==null||p(),(g=m)==null||g.disconnect(),m=null,l&&cancelAnimationFrame(b)}}const Ae=Rt,Pe=Ft,nt=zt,Le=(o,t,e)=>{const s=new Map,i={platform:it,...e},r={...i.platform,_c:s};return Dt(o,t,{...i,platform:r})};var at=function(){},F="undefined",hs=typeof window!==F&&typeof window.navigator!==F&&/Trident\/|MSIE /.test(window.navigator.userAgent),Ee=["trace","debug","info","warn","error"],ne={},T=null;function lt(o,t){var e=o[t];if(typeof e.bind=="function")return e.bind(o);try{return Function.prototype.bind.call(e,o)}catch{return function(){return Function.prototype.apply.apply(e,[o,arguments])}}}function ms(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function ps(o){return o==="debug"&&(o="log"),typeof console===F?!1:o==="trace"&&hs?ms:console[o]!==void 0?lt(console,o):console.log!==void 0?lt(console,"log"):at}function ae(){for(var o=this.getLevel(),t=0;t<Ee.length;t++){var e=Ee[t];this[e]=t<o?at:this.methodFactory(e,o,this.name)}if(this.log=this.debug,typeof console===F&&o<this.levels.SILENT)return"No console available for logging"}function us(o){return function(){typeof console!==F&&(ae.call(this),this[o].apply(this,arguments))}}function bs(o,t,e){return ps(o)||us.apply(this,arguments)}function ct(o,t){var e=this,s,i,r,n="loglevel";typeof o=="string"?n+=":"+o:typeof o=="symbol"&&(n=void 0);function a(u){var m=(Ee[u]||"silent").toUpperCase();if(!(typeof window===F||!n)){try{window.localStorage[n]=m;return}catch{}try{window.document.cookie=encodeURIComponent(n)+"="+m+";"}catch{}}}function l(){var u;if(!(typeof window===F||!n)){try{u=window.localStorage[n]}catch{}if(typeof u===F)try{var m=window.document.cookie,b=encodeURIComponent(n),v=m.indexOf(b+"=");v!==-1&&(u=/^([^;]+)/.exec(m.slice(v+b.length+1))[1])}catch{}return e.levels[u]===void 0&&(u=void 0),u}}function c(){if(!(typeof window===F||!n)){try{window.localStorage.removeItem(n)}catch{}try{window.document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function d(u){var m=u;if(typeof m=="string"&&e.levels[m.toUpperCase()]!==void 0&&(m=e.levels[m.toUpperCase()]),typeof m=="number"&&m>=0&&m<=e.levels.SILENT)return m;throw new TypeError("log.setLevel() called with invalid level: "+u)}e.name=o,e.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},e.methodFactory=t||bs,e.getLevel=function(){return r??i??s},e.setLevel=function(u,m){return r=d(u),m!==!1&&a(r),ae.call(e)},e.setDefaultLevel=function(u){i=d(u),l()||e.setLevel(u,!1)},e.resetLevel=function(){r=null,c(),ae.call(e)},e.enableAll=function(u){e.setLevel(e.levels.TRACE,u)},e.disableAll=function(u){e.setLevel(e.levels.SILENT,u)},e.rebuild=function(){if(T!==e&&(s=d(T.getLevel())),ae.call(e),T===e)for(var u in ne)ne[u].rebuild()},s=d(T?T.getLevel():"WARN");var p=l();p!=null&&(r=d(p)),ae.call(e)}T=new ct,T.getLogger=function(t){if(typeof t!="symbol"&&typeof t!="string"||t==="")throw new TypeError("You must supply a name when creating a logger.");var e=ne[t];return e||(e=ne[t]=new ct(t,T.methodFactory)),e};var gs=typeof window!==F?window.log:void 0;T.noConflict=function(){return typeof window!==F&&window.log===T&&(window.log=gs),T},T.getLoggers=function(){return ne},T.default=T;var fs=function(o){for(var t=1,e=arguments.length,s;t<e;t++)for(s in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],s)&&(o[s]=arguments[t][s]);return o},vs={template:"[%t] %l:",levelFormatter:function(o){return o.toUpperCase()},nameFormatter:function(o){return o||"root"},timestampFormatter:function(o){return o.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},dt,Q={},_s=function(o){if(!o||!o.getLogger)throw new TypeError("Argument is not a root logger");dt=o},ks=function(o,t){if(!o||!o.setLevel)throw new TypeError("Argument is not a logger");var e=o.methodFactory,s=o.name||"",i=Q[s]||Q[""]||vs;function r(n,a,l){var c=e(n,a,l),d=Q[l]||Q[""],p=d.template.indexOf("%t")!==-1,u=d.template.indexOf("%l")!==-1,m=d.template.indexOf("%n")!==-1;return function(){for(var b="",v=arguments.length,f=Array(v),g=0;g<v;g++)f[g]=arguments[g];if(s||!Q[l]){var _=d.timestampFormatter(new Date),y=d.levelFormatter(n),w=d.nameFormatter(l);d.format?b+=d.format(y,w,_):(b+=d.template,p&&(b=b.replace(/%t/,_)),u&&(b=b.replace(/%l/,y)),m&&(b=b.replace(/%n/,w))),f.length&&typeof f[0]=="string"?f[0]=b+" "+f[0]:f.unshift(b)}c.apply(void 0,f)}}return Q[s]||(o.methodFactory=r),t=t||{},t.template&&(t.format=void 0),Q[s]=fs({},i,t),o.setLevel(o.getLevel()),dt||o.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),o},ys={reg:_s,apply:ks};const ws={debug:"#0ea5e9",info:"#10b981",warn:"#f59e0b",error:"#ef4444"};ys.reg(T);const xs=o=>o.toTimeString().split(" ")[0]+"."+o.getMilliseconds().toString().padStart(3,"0"),Cs=T.methodFactory;T.methodFactory=function(o,t,e){const s=Cs(o,t,e),r=`color: ${ws[o]||"#666"}; font-weight: bold;`,n="color: inherit;";return function(...a){const l=xs(new Date),c=o.toUpperCase(),d=e?`%c[${l}]%c %c[${c}]%c %c[${e}]%c`:`%c[${l}]%c %c[${c}]%c`;s(d,...e?[r,n,r,n,r,n]:[r,n,r,n],...a)}},typeof T.setDefaultLevel=="function"?T.setDefaultLevel("silent"):T.setLevel("silent",!1);const le=T.getLogger("MULTISELECT:INIT"),A=T.getLogger("MULTISELECT:DATA"),H=T.getLogger("MULTISELECT:UI"),L=T.getLogger("MULTISELECT:INTERACTION"),ht=["MULTISELECT:INIT","MULTISELECT:DATA","MULTISELECT:UI","MULTISELECT:INTERACTION"];function Ve(){typeof T.rebuild=="function"&&T.rebuild()}function mt(){T.setLevel("debug"),Ve()}function pt(){T.setLevel("silent"),Ve()}function ut(o){T.setLevel(o),Ve()}function bt(o,t){const e=o.includes(":")?o:`MULTISELECT:${o}`;T.getLogger(e).setLevel(t)}class gt{constructor(t){h(this,"container");h(this,"wrapper");h(this,"viewport");h(this,"itemHeight");h(this,"items");h(this,"renderItem");h(this,"bufferSize");h(this,"onVisibleRangeChange");h(this,"onScroll");h(this,"scrollTop",0);h(this,"viewportHeight",0);h(this,"visibleStart",0);h(this,"visibleEnd",0);h(this,"scrollHandler");h(this,"resizeObserver");this.container=t.container,this.itemHeight=t.itemHeight,this.items=t.items,this.renderItem=t.renderItem,this.bufferSize=t.bufferSize??10,this.onVisibleRangeChange=t.onVisibleRangeChange,this.onScroll=t.onScroll,this.scrollHandler=this.handleScroll.bind(this),this.init()}init(){this.container.innerHTML="",this.wrapper=document.createElement("div"),this.wrapper.style.position="relative",this.wrapper.style.width="100%",this.wrapper.style.height=`${this.items.length*this.itemHeight}px`,this.wrapper.className="ms__virtual-scroll-wrapper",this.viewport=document.createElement("div"),this.viewport.style.position="absolute",this.viewport.style.top="0",this.viewport.style.left="0",this.viewport.style.right="0",this.viewport.style.width="100%",this.viewport.className="ms__virtual-scroll-viewport",this.wrapper.appendChild(this.viewport),this.container.appendChild(this.wrapper),this.container.addEventListener("scroll",this.scrollHandler),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.updateViewportHeight(),this.render()}),this.resizeObserver.observe(this.container)),this.updateViewportHeight(),this.render()}updateViewportHeight(){const t=this.container.clientHeight;t>0&&(this.viewportHeight=t)}handleScroll(){this.scrollTop=this.container.scrollTop,this.onScroll&&this.onScroll(this.scrollTop),this.render()}calculateVisibleRange(){const t=Math.floor(this.scrollTop/this.itemHeight),e=Math.ceil((this.scrollTop+this.viewportHeight)/this.itemHeight),s=Math.max(0,t-this.bufferSize),i=Math.min(this.items.length,e+this.bufferSize);return{start:s,end:i}}render(){const{start:t,end:e}=this.calculateVisibleRange();if(t===this.visibleStart&&e===this.visibleEnd)return;this.visibleStart=t,this.visibleEnd=e,this.onVisibleRangeChange&&this.onVisibleRangeChange(t,e);let s="";for(let i=t;i<e;i++){const r=this.items[i],n=this.renderItem(r,i),a=i*this.itemHeight;s+=`<div class="ms__virtual-item" style="position: absolute; top: ${a}px; left: 0; right: 0; height: ${this.itemHeight}px;" data-index="${i}">`,s+=n,s+="</div>"}this.viewport.innerHTML=s}setItems(t){const e=t!==this.items||t.length!==this.items.length;this.items=t,this.wrapper.style.height=`${t.length*this.itemHeight}px`,this.updateViewportHeight(),e&&(this.scrollTop=0,this.container.scrollTop=0),this.visibleStart=-1,this.visibleEnd=-1,this.render()}scrollToIndex(t){if(t<0||t>=this.items.length)return;const e=t*this.itemHeight,s=e+this.itemHeight,i=this.container.scrollTop,r=i+this.viewportHeight;e<i?this.container.scrollTop=e:s>r&&(this.container.scrollTop=s-this.viewportHeight)}getVisibleRange(){return{start:this.visibleStart,end:this.visibleEnd}}getItemCount(){return this.items.length}setItemHeight(t){this.itemHeight=t,this.wrapper.style.height=`${this.items.length*t}px`,this.visibleStart=-1,this.visibleEnd=-1,this.render()}setBufferSize(t){this.bufferSize=t,this.visibleStart=-1,this.visibleEnd=-1,this.render()}refresh(){this.visibleStart=-1,this.visibleEnd=-1,this.render()}destroy(){this.container.removeEventListener("scroll",this.scrollHandler),this.resizeObserver&&this.resizeObserver.disconnect(),this.container.innerHTML=""}}class Ss{constructor(t){h(this,"element");h(this,"trigger");h(this,"container");h(this,"placement");h(this,"offsetDistance");h(this,"showDelay");h(this,"hideDelay");h(this,"visibleClass");h(this,"followCursor");h(this,"onBeforeShow");h(this,"showTimer",null);h(this,"hideTimer",null);h(this,"positionCleanup",null);h(this,"visible",!1);h(this,"cursorX",0);h(this,"cursorY",0);h(this,"handleMouseEnter");h(this,"handleMouseLeave");h(this,"handleMouseMove");this.trigger=t.trigger,this.container=t.container,this.placement=t.placement??"top",this.offsetDistance=t.offsetDistance??8,this.showDelay=t.showDelay??100,this.hideDelay=t.hideDelay??100,this.visibleClass=t.visibleClass??"ms__badge-tooltip--visible",this.followCursor=t.followCursor??!1,this.onBeforeShow=t.onBeforeShow,this.element=document.createElement("div"),this.element.className=t.cssClass??"ms__badge-tooltip",typeof t.content=="string"?this.element.textContent=t.content:this.element.appendChild(t.content),this.container.appendChild(this.element),this.handleMouseEnter=e=>{this.followCursor&&(this.cursorX=e.clientX,this.cursorY=e.clientY),this.scheduleShow()},this.handleMouseLeave=()=>this.scheduleHide(),this.trigger.addEventListener("mouseenter",this.handleMouseEnter),this.trigger.addEventListener("mouseleave",this.handleMouseLeave),this.followCursor&&(this.handleMouseMove=e=>{this.cursorX=e.clientX,this.cursorY=e.clientY,this.visible&&this.positionAtCursor()},this.trigger.addEventListener("mousemove",this.handleMouseMove))}scheduleShow(){this.hideTimer!==null&&(clearTimeout(this.hideTimer),this.hideTimer=null),this.showTimer===null&&(this.showTimer=window.setTimeout(()=>{this.showTimer=null,this.show()},this.showDelay))}scheduleHide(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null),this.hideTimer===null&&(this.hideTimer=window.setTimeout(()=>{this.hideTimer=null,this.hide()},this.hideDelay))}show(){var t;(t=this.onBeforeShow)==null||t.call(this),this.visible=!0,this.element.classList.add(this.visibleClass),this.positionCleanup&&(this.positionCleanup(),this.positionCleanup=null),this.followCursor?this.positionAtCursor():this.positionCleanup=Oe(this.trigger,this.element,()=>this.computeAt(this.trigger))}computeAt(t){Le(t,this.element,{placement:this.placement,strategy:"fixed",middleware:[Ae(this.offsetDistance),nt(),Pe({padding:8})]}).then(({x:e,y:s})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${s}px`})})}positionAtCursor(){const t=this.cursorX,e=this.cursorY,s={getBoundingClientRect:()=>({width:0,height:0,x:t,y:e,top:e,left:t,right:t,bottom:e})};this.computeAt(s)}hide(){this.visible=!1,this.element.classList.remove(this.visibleClass),this.positionCleanup&&(this.positionCleanup(),this.positionCleanup=null)}hideImmediate(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null),this.hideTimer!==null&&(clearTimeout(this.hideTimer),this.hideTimer=null),this.hide()}destroy(){this.showTimer!==null&&clearTimeout(this.showTimer),this.hideTimer!==null&&clearTimeout(this.hideTimer),this.showTimer=null,this.hideTimer=null,this.positionCleanup&&(this.positionCleanup(),this.positionCleanup=null),this.trigger.removeEventListener("mouseenter",this.handleMouseEnter),this.trigger.removeEventListener("mouseleave",this.handleMouseLeave),this.handleMouseMove&&this.trigger.removeEventListener("mousemove",this.handleMouseMove),this.element.remove()}}function ft(o){return{treeId:"",id:-1,path:"",pathSegment:"",parentPath:void 0,level:void 0,children:{},hasChildren:!1,isSelectable:!0,data:void 0,...o}}const ce=o=>!o||typeof o=="string"&&o.trim()==="";function Ts(o,t="."){if(!o||typeof o!="string")return null;const e=o.lastIndexOf(t);return e===-1?"":o.substring(0,e)}function vt(o,t,e="."){return ce(t)?o:o.startsWith(t+e)?o.substring(t.length+e.length):o}function _t(o,t=0,e=1,s="."){return o.split(s).slice(t,t+e).join(s)}function Is(o,t){return o.split(t).length}function q(o,t){return o[t]}function Ms(o={}){const t=o.idMember,e=o.pathMember,s=o.getPathCallback,i=o.parentPathMember,r=o.levelMember,n=o.hasChildrenMember,a=o.isSelectableMember,l=o.getIsSelectableCallback,c=o.treeId||"multiselect-tree",d=o.orderMember,p=o.getDisplayValueCallback,u=ce(i),m=ce(r),b=ce(n),v=ce(a),f="x",g=o.treePathSeparator||".",_=ft();let y=0,w=null;const M=I=>s?s(I):e?q(I,e):void 0,z={treePathSeparator:g,root:_,get tree(){return Object.values(_.children)},get flatNodes(){if(w)return w;const I=[],C=o.isSorted??!1,x=o.sortCallback;function S(E){let k=Object.values(E.children);C&&x&&k.length>0&&(k=x(k));for(const V of k)I.push(V),V.hasChildren&&S(V)}return S(_),w=I,I},insertArray(I){I=I||[],_.children={},y=0,w=null;const C=[];let x=I.map((S,E)=>{const k=ft();k.treeId=c,k.id=t?q(S,t):void 0;const V=M(S);return V==null||V===""||typeof V!="string"?(C.push(`index ${E}`),null):(k.path=V,(k.id===void 0||k.id===-1)&&(k.id=V),u?k.parentPath=Ts(k.path,g):k.parentPath=q(S,i),k.pathSegment=_t(vt(k.path,k.parentPath??"",g),0,1,g),m?k.level=Is(k.path,g):k.level=q(S,r),b||(k.hasChildren=q(S,n)),k.data=S,k)}).filter(S=>S!==null);o.isSorted||(o.sortCallback?x=o.sortCallback(x):x=de(x));for(const S of x)Y(S.parentPath??"",S);if(l||!v)for(const S of x)if(l)S.isSelectable=l(S)!==!1;else{const E=q(S.data,a);S.isSelectable=E==null?!0:!!E}C.length>0&&console.warn(`[ltree ${c}] ${C.length} option(s) had an invalid path and were skipped (pathMember="${e}"). Offending: ${C.slice(0,5).join(", ")}`+(C.length>5?", …":""))},getNodeByPath(I,C){let x=C||_;if(I){const S=I.split(g);for(let E=0;E<S.length;E++){const k=f+S[E];if(!x.children.hasOwnProperty(k))return null;x=x.children[k]}}return x}};function Y(I,C){const x=z.getNodeByPath(I);if(!x)return`Node: ${C.path} - Could not find parent node: ${I}`;m&&(C.level=(x.level||0)+1);const S=f+_t(vt(C.path,I,g),0,1,g);return x.children.hasOwnProperty(S)||(x.children[S]=C,b&&!x.hasChildren&&(x.hasChildren=!0),y=Math.max(y,C.level||0)),null}function de(I){return I.sort((C,x)=>{const S=C.level||0,E=x.level||0;if(S!==E)return S-E;if(C.parentPath!==x.parentPath)return C.parentPath?x.parentPath?C.parentPath.localeCompare(x.parentPath):1:-1;if(d&&C.data&&x.data){const k=q(C.data,d)??0,V=q(x.data,d)??0;if(k!==V)return k-V}return p?p(C).localeCompare(p(x)):C.path.localeCompare(x.path)})}return z}function Os(o,t){const e=new Map,s=new Map,i=new Set,r=l=>String(t(l.data)),n=l=>{e.set(r(l),l);const c=[];for(const p of Object.values(l.children))c.push(...n(p));let d;return c.length>0?d=c:l.isSelectable!==!1?(d=[r(l)],i.add(l.path)):d=[],s.set(l.path,d),d},a=o.tree;for(const l of a)n(l);return{nodeByValue:e,atomsUnder:s,atomPaths:i,roots:a}}function De(o,t,e){const s=o.atomsUnder.get(t.path);if(!s||s.length===0)return"unchecked";let i=0;for(const r of s)e.has(r)&&i++;return i===0?"unchecked":i===s.length?"checked":"indeterminate"}function ze(o,t){const e=new Set;for(const s of t){const i=o.nodeByValue.get(String(s));if(i)for(const r of o.atomsUnder.get(i.path)??[])e.add(r)}return e}function As(o,t,e){const s=o.atomsUnder.get(t.path)??[],i=new Set(e),r=De(o,t,e),n=[],a=[];if(r==="checked")for(const l of s)i.delete(l)&&a.push(l);else for(const l of s)i.has(l)||(i.add(l),n.push(l));return{checkedAtoms:i,addedAtoms:n,removedAtoms:a}}function Ps(o,t,e,s){const i=a=>String(s(a.data)),r=[],n=a=>{const l=De(o,a,t);if(l==="unchecked")return;const c=a.isSelectable!==!1,d=Object.values(a.children);if(e==="leaves"){o.atomPaths.has(a.path)&&l==="checked"&&r.push(i(a));for(const p of d)n(p);return}if(e==="all"){l==="checked"&&c&&r.push(i(a));for(const p of d)n(p);return}if(l==="checked"&&c){r.push(i(a));return}for(const p of d)n(p)};for(const a of o.roots)n(a);return r}function Ls(o){let t=o;for(;t&&!(t===document.body||t===document.documentElement);){if(t instanceof Element){const s=getComputedStyle(t);if(s.transform!=="none"||s.perspective!=="none"||s.filter!=="none")return t;const i=s.backdropFilter;if(i&&i!=="none"||s.willChange&&/\b(transform|filter|perspective)\b/.test(s.willChange))return t}const e=t.parentNode;t=e instanceof ShadowRoot?e.host:e}return window}function Es(o,t,e){let s=o;for(;s&&!(s===document.body||s===document.documentElement);){if(s instanceof Element){const r=s.getBoundingClientRect();if(Math.abs(r.x-t)<2&&Math.abs(r.y-e)<2)return s}const i=s.parentNode;s=i instanceof ShadowRoot?i.host:i}return null}function Vs(o){const t=getComputedStyle(o),e=[];t.transform!=="none"&&e.push(`transform: ${t.transform}`),t.perspective!=="none"&&e.push(`perspective: ${t.perspective}`),t.filter!=="none"&&e.push(`filter: ${t.filter}`);const s=t.backdropFilter;return s&&s!=="none"&&e.push(`backdrop-filter: ${s}`),t.willChange&&/\b(transform|filter|perspective)\b/.test(t.willChange)&&e.push(`will-change: ${t.willChange}`),t.contain&&/\b(paint|layout|strict|content)\b/.test(t.contain)&&e.push(`contain: ${t.contain}`),t.containerType&&t.containerType!=="normal"&&e.push(`container-type: ${t.containerType}`),e.join("; ")}class kt{constructor(t,e={}){h(this,"element");h(this,"instanceId");h(this,"options");h(this,"isOpen",!1);h(this,"selectedValues",new Set);h(this,"selectedOptions",new Map);h(this,"allOptions",[]);h(this,"filteredOptions",[]);h(this,"tree",null);h(this,"treeNodes",[]);h(this,"cascadeIndex",null);h(this,"cascadeCheckedAtoms",new Set);h(this,"hiddenInputs",[]);h(this,"focusedIndex",-1);h(this,"matchingIndices",new Set);h(this,"searchTerm","");h(this,"isLoading",!1);h(this,"searchDebounceTimer");h(this,"searchAbortController");h(this,"showSelectedPopover",!1);h(this,"selectedPopoverPlacement",null);h(this,"dropdownPlacement",null);h(this,"isRTL",!1);h(this,"effectiveBadgesPosition","bottom");h(this,"justClosedViaClick",!1);h(this,"positioningDriftWarned",!1);h(this,"dropdownCleanup",null);h(this,"hintCleanup",null);h(this,"selectedPopoverCleanup",null);h(this,"tooltips",new Map);h(this,"virtualScroll",null);h(this,"optionsContainer",null);h(this,"selectedPopoverVirtualScroll",null);h(this,"selectedPopoverContainer",null);h(this,"input");h(this,"dropdown");h(this,"dropdownInner");h(this,"badgesContainer");h(this,"counter");h(this,"hint");h(this,"selectedPopover");h(this,"documentKeydownHandler",null);h(this,"documentClickHandler",null);this.element=t,this.instanceId=`MS-${Math.random().toString(36).slice(2,11)}`,this.options={searchHint:t.dataset.searchHint||"",searchPlaceholder:t.dataset.searchPlaceholder||"Search...",selectPlaceholder:t.dataset.selectPlaceholder||"Pick an option...",noDataPlaceholder:t.dataset.noDataPlaceholder||void 0,dropdownMinWidth:t.dataset.dropdownMinWidth||void 0,dropdownMaxWidth:t.dataset.dropdownMaxWidth||void 0,badgesDisplayMode:t.dataset.badgesDisplayMode||"badges",badgesPosition:t.dataset.badgesPosition||"bottom",badgesThresholdMode:t.dataset.badgesThresholdMode||"count",maxHeight:t.dataset.maxHeight||"20rem",emptyMessage:t.dataset.emptyMessage||"No results found",loadingMessage:t.dataset.loadingMessage||"Loading...",searchInputMode:t.dataset.searchInputMode||"normal",searchMode:t.dataset.searchMode||"filter",badgesThreshold:t.dataset.badgesThreshold?parseInt(t.dataset.badgesThreshold):void 0,minSearchLength:parseInt(t.dataset.minSearchLength||"0")||0,searchDebounce:parseInt(t.dataset.searchDebounce||"0")||0,isMultipleEnabled:t.dataset.multiple!=="false",isGroupsAllowed:t.dataset.allowGroups!=="false",isCheckboxesShown:t.dataset.showCheckboxes!=="false",isActionsSticky:t.dataset.stickyActions!=="false",isCloseOnSelect:t.dataset.closeOnSelect==="true",isPlacementLocked:t.dataset.lockPlacement!=="false",isSearchEnabled:t.dataset.enableSearch!=="false",isAddNewAllowed:t.dataset.allowAddNew==="true",isCounterShown:t.dataset.showCounter==="true",isKeepOptionsOnSearch:t.dataset.keepOptionsOnSearch!=="false",shouldKeepSearchOnClose:t.dataset.keepSearchOnClose!=="false",options:[],container:void 0,...e},this.init()}extractField(t,e){if(Array.isArray(t)&&t.length===2){if(e.tupleSkip)return typeof e.fallback=="function"?e.fallback():e.fallback;if(e.tupleIndex!==void 0){const i=t[e.tupleIndex];return e.transform?e.transform(i):i}}if(e.member&&t[e.member]!==void 0){const i=t[e.member];return e.transform?e.transform(i):i}return e.callback?e.callback(t):typeof e.fallback=="function"?e.fallback():e.fallback}getItemValue(t){return this.extractField(t,{tupleIndex:0,member:this.options.valueMember,callback:this.options.getValueCallback,fallback:"[N/A]"})}getItemDisplayValue(t){return this.extractField(t,{tupleIndex:1,member:this.options.displayValueMember,callback:this.options.getDisplayValueCallback,transform:String,fallback:"[N/A]"})}getItemBadgeDisplayValue(t){if(this.options.getBadgeDisplayCallback)return this.options.getBadgeDisplayCallback(t);if(this.options.isBadgeFullTitleShown){const e=this.getItemFullTitle(t);if(e)return e}return this.getItemDisplayValue(t)}getItemFullTitle(t){return this.extractField(t,{tupleSkip:!0,member:this.options.fullTitleMember,callback:this.options.getFullTitleCallback,transform:String,fallback:void 0})}getItemSearchValue(t){return this.extractField(t,{member:this.options.searchValueMember,callback:this.options.getSearchValueCallback,transform:String,fallback:()=>this.getItemDisplayValue(t)})}getItemIcon(t){return this.extractField(t,{tupleSkip:!0,member:this.options.iconMember,callback:this.options.getIconCallback,transform:String,fallback:void 0})}getItemSubtitle(t){return this.extractField(t,{tupleSkip:!0,member:this.options.subtitleMember,callback:this.options.getSubtitleCallback,transform:String,fallback:void 0})}getItemGroup(t){return this.extractField(t,{tupleSkip:!0,member:this.options.groupMember,callback:this.options.getGroupCallback,transform:String,fallback:void 0})}getItemDisabled(t){return this.extractField(t,{tupleSkip:!0,member:this.options.disabledMember,callback:this.options.getDisabledCallback,transform:Boolean,fallback:!1})}isIndexSelectable(t){if(!this.isTreeMode())return!0;const e=this.treeNodes[t];return e?e.isSelectable!==!1:!0}isOptionSelectable(t){if(!this.isTreeMode())return!0;const e=this.filteredOptions.indexOf(t);if(e>=0)return this.isIndexSelectable(e);const s=String(this.getItemValue(t)),i=this.treeNodes.find(r=>String(this.getItemValue(r.data))===s);return i?i.isSelectable!==!1:!0}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),le.debug(`Initialized [${this.instanceId}] with options:`,{placeholder:this.options.searchPlaceholder,totalOptions:this.allOptions.length,isCloseOnSelect:this.options.isCloseOnSelect,dataAttribute:this.element.dataset.closeOnSelect})}parseOptions(){const t=this.element.dataset.options;if(t)try{this.allOptions=JSON.parse(t)}catch(e){A.error(`[${this.instanceId}] Failed to parse data-options:`,e),this.allOptions=[]}else this.options.options&&(this.allOptions=this.options.options);this.filteredOptions=[...this.allOptions],this.isTreeMode()&&this.buildTree()}isTreeMode(){return this.options.isTreeEnabled===!1?!1:!!(this.options.isTreeEnabled||this.options.pathMember||this.options.getPathCallback)}buildTree(){this.tree=Ms({idMember:this.options.valueMember,pathMember:this.options.pathMember,getPathCallback:this.options.getPathCallback,parentPathMember:this.options.parentPathMember,levelMember:this.options.levelMember,hasChildrenMember:this.options.hasChildrenMember,isSelectableMember:this.options.isSelectableMember,getIsSelectableCallback:this.options.getIsSelectableCallback,treePathSeparator:this.options.treePathSeparator,treeId:this.instanceId,getDisplayValueCallback:t=>this.getItemDisplayValue(t.data)}),this.tree.insertArray(this.allOptions),this.cascadeIndex=this.isCascadeMode()?Os(this.tree,t=>String(this.getItemValue(t))):null,this.rebuildTreeVisible()}isCascadeMode(){return this.isTreeMode()&&this.options.isMultipleEnabled!==!1&&this.options.checkboxMode==="cascade"}cascadePolicy(){return this.options.cascadeSelectPolicy??"rolled-up"}refreshCascadeAtoms(){this.isCascadeMode()&&this.cascadeIndex&&(this.cascadeCheckedAtoms=ze(this.cascadeIndex,this.selectedValues))}toggleTreeCascade(t){const e=this.cascadeIndex,s=ze(e,this.selectedValues),{checkedAtoms:i}=As(e,t,s);this.commitCascadeAtoms(i)}commitCascadeAtoms(t){var l;const e=this.cascadeIndex,s=Ps(e,t,this.cascadePolicy(),c=>String(this.getItemValue(c))),i=new Set(s),r=[],n=[];for(const[c,d]of this.selectedOptions)i.has(c)||n.push(d);const a=new Map;for(const c of s){const p=((l=e.nodeByValue.get(c))==null?void 0:l.data)??this.selectedOptions.get(c);p!==void 0&&(a.set(c,p),this.selectedValues.has(c)||r.push(p))}this.selectedValues=i,this.selectedOptions=a,this.cascadeCheckedAtoms=t,this.commit({added:r,removed:n})}rebuildTreeVisible(){if(!this.tree){this.treeNodes=[];return}const t=this.tree.flatNodes,e=this.options.isSearchEnabled?(this.searchTerm||"").trim().toLowerCase():"";let s;if(!e)s=t;else{const i=this.tree.treePathSeparator,r=new Set;for(const n of t)if(this.getItemSearchValue(n.data).toLowerCase().includes(e)){const l=n.path.split(i);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(i))}s=t.filter(n=>r.has(n.path))}this.treeNodes=s,this.filteredOptions=s.map(i=>i.data)}resetVisibleToAll(){this.isTreeMode()?this.rebuildTreeVisible():this.filteredOptions=[...this.allOptions]}rebuildTreeVisibleFromMatches(t){if(!this.tree){this.treeNodes=[],this.filteredOptions=[];return}const e=this.tree.flatNodes,s=this.tree.treePathSeparator,i=new Set((t||[]).map(a=>String(this.getItemValue(a)))),r=new Set;for(const a of e)if(i.has(String(this.getItemValue(a.data)))){const l=a.path.split(s);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(s))}const n=e.filter(a=>r.has(a.path));this.treeNodes=n,this.filteredOptions=n.map(a=>a.data)}buildHTML(){const t=this.options.container||document.body,e=this.element.getRootNode(),s=e instanceof ShadowRoot?e.host:this.element,i=s.getAttribute("dir")==="rtl",r=s.closest('[dir="rtl"]')!==null;this.isRTL=i||r,le.debug(`[${this.instanceId}] RTL Debug:`,{isShadowRoot:e instanceof ShadowRoot,hostElement:s,elementDir:s.getAttribute("dir"),hasElementDir:i,hasAncestorDir:r,isRTL:this.isRTL}),this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left")),this.element.classList.add("ms"),this.isRTL&&(this.element.classList.add("ms--rtl"),le.debug(`[${this.instanceId}] Added ms--rtl class to element`)),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ms--no-checkboxes");const n=document.createElement("div");n.className="ms__input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="ms__input",this.input.placeholder=this.getPlaceholderText(),this.input.autocomplete="off",this.options.searchInputMode==="readonly"?this.input.readOnly=!0:this.options.searchInputMode==="hidden"&&(this.input.style.display="none");const a=document.createElement("span");a.className="ms__toggle",a.innerHTML="▼",this.counter=document.createElement("span"),this.counter.className="ms__counter",this.counter.style.display="none",n.appendChild(this.input),n.appendChild(this.counter),n.appendChild(a),this.badgesContainer=document.createElement("div"),this.badgesContainer.className="ms__badges";const l=document.createElement("div");l.className="ms__wrapper",(this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")&&l.classList.add("ms__wrapper--inline"),l.appendChild(n),l.appendChild(this.badgesContainer),this.element.appendChild(l),this.dropdown=document.createElement("div"),this.dropdown.className="ms__dropdown",this.dropdownInner=document.createElement("div"),this.dropdownInner.className="ms__dropdown-inner",this.dropdown.appendChild(this.dropdownInner),t.appendChild(this.dropdown),this.options.searchHint&&(this.hint=document.createElement("div"),this.hint.className="ms__hint",this.hint.textContent=this.options.searchHint,t.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ms__selected-popover",t.appendChild(this.selectedPopover),this.renderDropdown()}shouldUseVirtualScroll(){if(!this.options.isVirtualScrollEnabled||this.options.isGroupsAllowed&&this.hasGroups())return!1;const t=this.options.virtualScrollThreshold??100;return this.filteredOptions.length>=t}hasGroups(){return this.filteredOptions.some(t=>{const e=this.getItemGroup(t);return e&&e.trim()!==""})}renderDropdown(){if(this.destroyAllActionButtonTooltips(),this.refreshCascadeAtoms(),this.shouldUseVirtualScroll()){this.dropdown.classList.add("ms__dropdown--virtual"),this.renderDropdownVirtual();return}this.dropdown.classList.remove("ms__dropdown--virtual"),this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null,this.optionsContainer=null);let t="";if(this.isLoading){t+='<div class="ms__loader">',t+='<div class="pa-loader pa-loader--sm"></div>',t+=`<div class="ms__loading-text">${this.options.loadingMessage}</div>`,t+="</div>",this.dropdownInner.innerHTML=t;return}const e=this.renderActionsHTML(),s=this.options.actionsPosition==="bottom";if(s||(t+=e),this.options.isVirtualScrollEnabled){const i=this.options.optionHeight??50;t+=`<div class="ms__options ms__options--fixed-height" style="--ms-option-height: ${i}px;">`}else t+='<div class="ms__options">';if(this.filteredOptions.length===0)t+=`<div class="ms__empty">${this.options.emptyMessage}</div>`;else if(this.isTreeMode())this.treeNodes.forEach((i,r)=>{t+=this.renderTreeNode(i,r)});else if(this.options.isGroupsAllowed){const i=this.groupOptions(this.filteredOptions),r=new Map;this.filteredOptions.forEach((n,a)=>r.set(n,a)),Object.keys(i).forEach(n=>{if(t+='<div class="ms__group">',n!=="__ungrouped__")if(this.options.renderGroupLabelContentCallback){const a=this.options.renderGroupLabelContentCallback(n);if(a instanceof HTMLElement){const l=document.createElement("div");l.className="ms__group-label",l.appendChild(a),t+=l.outerHTML}else t+=`<div class="ms__group-label">${a}</div>`}else t+=`<div class="ms__group-label">${n}</div>`;i[n].forEach(a=>{t+=this.renderOption(a,r.get(a)??-1)}),t+="</div>"})}else this.filteredOptions.forEach((i,r)=>{t+=this.renderOption(i,r)});t+="</div>",s&&(t+=e),this.dropdownInner.innerHTML=t,this.attachActionButtonTooltips(),this.attachOptionTooltips()}renderDropdownVirtual(){if(this.destroyAllActionButtonTooltips(),!this.virtualScroll){let s="";const i=this.renderActionsHTML(),r=this.options.actionsPosition==="bottom";r||(s+=i);const n=this.options.maxHeight||"20rem",a=this.options.optionHeight??50;s+=`<div class="ms__options ms__options--virtual" style="height: ${n}; max-height: ${n}; overflow-y: auto; position: relative; --ms-option-height: ${a}px;"></div>`,r&&(s+=i),this.dropdownInner.innerHTML=s,this.optionsContainer=this.dropdownInner.querySelector(".ms__options")}if(this.filteredOptions.length===0){this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.optionsContainer.innerHTML=`<div class="ms__empty">${this.options.emptyMessage}</div>`;return}const t=this.options.optionHeight??50,e=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.optionsContainer&&(this.virtualScroll?this.virtualScroll.setItems(this.filteredOptions):this.virtualScroll=new gt({container:this.optionsContainer,itemHeight:t,items:this.filteredOptions,renderItem:(s,i)=>this.isTreeMode()?this.renderTreeNode(this.treeNodes[i],i):this.renderOption(s,i),bufferSize:e,onVisibleRangeChange:()=>{this.attachOptionTooltips()}}),this.attachActionButtonTooltips())})}getBuiltInActionDisabled(t){return t==="select-all"?!this.filteredOptions.some(e=>!this.getItemDisabled(e)&&!this.selectedValues.has(String(this.getItemValue(e)))):t==="clear-all"?this.selectedValues.size===0:!1}renderActionsHTML(){const t=this.options.actionButtons;if(!this.options.isMultipleEnabled||!t||t.length===0)return"";const e=this.options.actionsPosition==="bottom"?"bottom":"top",s=this.options.actionsAlign??"stretch",i=` ms__actions--${e}`,r=this.options.isActionsSticky?" ms__actions--sticky":"",n=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"",a=` ms__actions--align-${s}`,l=new Map;if(t.forEach((d,p)=>{if(!(d.getIsVisibleCallback?d.getIsVisibleCallback(this):d.isVisible??!0))return;let m;d.getIsDisabledCallback?m=d.getIsDisabledCallback(this):d.isDisabled!==void 0?m=d.isDisabled:m=this.getBuiltInActionDisabled(d.action);const b=m?" disabled":"",v=d.getTextCallback?d.getTextCallback(this):d.text;let f="";if(d.getClassCallback){const y=d.getClassCallback(this);f=Array.isArray(y)?` ${y.join(" ")}`:y?` ${y}`:""}else d.cssClass&&(f=` ${d.cssClass}`);const g=Math.max(1,Math.floor(d.row??1)),_=`<button type="button"${b} class="ms__action-btn${f}" data-action="${d.action}" data-button-index="${p}">${v}</button>`;l.has(g)||l.set(g,[]),l.get(g).push(_)}),l.size===0)return"";const c=Array.from(l.keys()).sort((d,p)=>d-p).map(d=>`<div class="ms__actions-row" data-row="${d}">${l.get(d).join("")}</div>`).join("");return`<div class="ms__actions${i}${r}${n}${a}">${c}</div>`}renderOption(t,e){const s=this.getItemValue(t),i=this.getItemDisplayValue(t),r=this.getItemIcon(t),n=this.getItemSubtitle(t),a=this.getItemDisabled(t),l=this.selectedValues.has(String(s)),c=e===this.focusedIndex,d=this.matchingIndices.has(e),p=["ms__option"];l&&p.push("ms__option--selected"),c&&p.push("ms__option--focused"),d&&p.push("ms__option--matched"),a&&p.push("ms__option--disabled");const u=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"";let m=`<div class="${p.join(" ")}" data-value="${s}" data-index="${e}"${u}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(m+=`<input type="checkbox" class="ms__checkbox" ${l?"checked":""} ${a?"disabled":""}>`),m+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const b={index:e,isSelected:l,isFocused:c,isMatched:d,isDisabled:a},v=this.options.renderOptionContentCallback(t,b);typeof v=="string"?m+=v:m+=v.outerHTML}else r&&(m+=`<span class="ms__option-icon">${r}</span>`),m+='<div class="ms__option-text">',m+=`<div class="ms__option-title">${this.highlightMatch(i,this.searchTerm)}</div>`,n&&(m+=`<div class="ms__option-subtitle">${n}</div>`),m+="</div>";return m+="</div>",m+="</div>",m}renderTreeNode(t,e){const s=t.data,i=this.getItemValue(s),r=this.getItemDisplayValue(s),n=this.getItemIcon(s),a=this.getItemSubtitle(s),l=this.getItemDisabled(s),c=this.isCascadeMode()&&this.cascadeIndex,d=c?De(this.cascadeIndex,t,this.cascadeCheckedAtoms):null,p=c?d==="checked":this.selectedValues.has(String(i)),u=d==="indeterminate",m=e===this.focusedIndex,b=t.isSelectable!==!1,v=t.level??1,f=Math.max(0,v-1),g=["ms__option","ms__option--tree"];g.push(t.hasChildren?"ms__option--tree-branch":"ms__option--tree-leaf"),p&&g.push("ms__option--selected"),u&&g.push("ms__option--indeterminate"),m&&g.push("ms__option--focused"),l&&g.push("ms__option--disabled"),b||g.push("ms__option--tree-unselectable");const _=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"",y=b?"":' data-selectable="false"';let w=`<div class="${g.join(" ")}" data-value="${i}" data-index="${e}" data-path="${t.path}" data-level="${v}" style="--ms-tree-depth: ${f};"${_}${y}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&b&&(w+=`<input type="checkbox" class="${u?"ms__checkbox ms__checkbox--indeterminate":"ms__checkbox"}" ${p?"checked":""}${u?' aria-checked="mixed"':""} ${l?"disabled":""}>`),w+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const M={index:e,isSelected:p,isFocused:m,isMatched:!1,isDisabled:l},z=this.options.renderOptionContentCallback(s,M);w+=typeof z=="string"?z:z.outerHTML}else n&&(w+=`<span class="ms__option-icon">${n}</span>`),w+='<div class="ms__option-text">',w+=`<div class="ms__option-title">${this.highlightMatch(r,this.searchTerm)}</div>`,a&&(w+=`<div class="ms__option-subtitle">${a}</div>`),w+="</div>";return w+="</div>",w+="</div>",w}highlightMatch(t,e){if(!e)return t;const s=new RegExp(`(${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return t.replace(s,"<mark>$1</mark>")}groupOptions(t){const e={};return t.forEach(s=>{const i=this.getItemGroup(s)||"__ungrouped__";e[i]||(e[i]=[]),e[i].push(s)}),e}get isSearchUsable(){return!!this.options.isSearchEnabled&&this.options.searchInputMode!=="readonly"&&this.options.searchInputMode!=="hidden"}getPlaceholderText(){return this.options.noDataPlaceholder&&this.allOptions.length===0?this.options.noDataPlaceholder:this.isSearchUsable?this.options.searchPlaceholder:this.options.selectPlaceholder||this.options.searchPlaceholder}renderBadges(){this.destroyAllBadgeTooltips();const t=Array.from(this.selectedOptions.values()),e=this.selectedValues.size;if(!this.options.isMultipleEnabled){this.badgesContainer.innerHTML="",this.counter.style.display="none";let r;t[0]&&(this.options.renderSelectedContentCallback?r=this.options.renderSelectedContentCallback(t[0]):r=this.getItemDisplayValue(t[0])),!this.isOpen&&e>0&&t.length>0?this.input.value=r:this.isOpen||(this.input.value="");return}let s=this.options.badgesDisplayMode;if(this.options.badgesThreshold!==null&&e>this.options.badgesThreshold&&s!=="none"&&(s=this.options.badgesThresholdMode||"count"),!this.isOpen)if(e>0&&s==="count"){const r=this.options.getCounterCallback?this.options.getCounterCallback(e):`${e} selected`;this.input.placeholder=r}else this.input.placeholder=this.getPlaceholderText();if(this.options.isCounterShown&&e>0?(this.counter.textContent=`[${e}]`,this.counter.style.display=""):this.counter.style.display="none",s==="none"){this.badgesContainer.innerHTML="";return}if(s==="badges")this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,this.badgesContainer.innerHTML=t.map(r=>this.renderBadgeHTML(r,{displayMode:"badges",isInPopover:!1})).join("");else if(s==="partial"){this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`;const r=this.options.badgesMaxVisible||3,n=t.slice(0,r),a=e-r,l=n.map(d=>this.renderBadgeHTML(d,{displayMode:"partial",isInPopover:!1})).join("");let c="";a>0&&(c=`
2
2
  <div class="ms__badge ms__badge--counter ms__badge--more" data-action="show-selected">
3
3
  <span class="ms__badge-text">${this.options.getCounterCallback?this.options.getCounterCallback(e,a):`+${a} more`}</span>
4
4
  <button type="button" class="ms__badge-remove" data-action="remove-hidden" aria-label="Remove ${a} hidden items"></button>
5
5
  </div>
6
- `),this.badgesContainer.innerHTML=l+d}else if(s==="compact")if(this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,e>0){const r=t[0],n=this.getItemBadgeDisplayValue(r),a=e-1;let l=n;if(a>0){const d=this.options.getCounterCallback?this.options.getCounterCallback(e,a):`+${a} more`;l=`${n} (${d})`}this.badgesContainer.innerHTML=`
6
+ `),this.badgesContainer.innerHTML=l+c}else if(s==="compact")if(this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,e>0){const r=t[0],n=this.getItemBadgeDisplayValue(r),a=e-1;let l=n;if(a>0){const c=this.options.getCounterCallback?this.options.getCounterCallback(e,a):`+${a} more`;l=`${n} (${c})`}this.badgesContainer.innerHTML=`
7
7
  <div class="ms__badge" data-action="show-selected">
8
8
  <span class="ms__badge-text">${l}</span>
9
9
  <button type="button" class="ms__badge-remove" data-action="clear-count" aria-label="Clear all selections"></button>
@@ -13,7 +13,7 @@
13
13
  <span class="ms__badge-text">${r}</span>
14
14
  <button type="button" class="ms__badge-remove" data-action="clear-count" aria-label="Clear all selections"></button>
15
15
  </div>
16
- `}else this.badgesContainer.innerHTML="";this.attachBadgeTooltips()}attachEvents(){this.input.addEventListener("mousedown",t=>{t.stopPropagation(),this.isOpen?(this.justClosedViaClick=!0,this.close(),setTimeout(()=>{this.justClosedViaClick=!1},0)):this.open()}),this.input.addEventListener("focus",()=>{!this.isOpen&&!this.justClosedViaClick&&this.open()}),this.input.addEventListener("input",t=>{const e=t.target.value;this.options.isSearchEnabled&&!this.isOpen&&this.open(),this.handleSearch(e)}),this.input.addEventListener("keydown",t=>this.handleKeydown(t)),this.documentClickHandler=t=>this.handleClickOutside(t),setTimeout(()=>{document.addEventListener("click",this.documentClickHandler)},0),this.documentKeydownHandler=t=>{t.key==="Escape"&&this.showSelectedPopover&&(t.preventDefault(),this.hideSelectedPopover())},document.addEventListener("keydown",this.documentKeydownHandler),this.dropdown.addEventListener("click",t=>this.handleDropdownClick(t)),this.dropdownInner.addEventListener("wheel",t=>{if(this.virtualScroll)return;const e=t.currentTarget,s=e.scrollTop===0,i=e.scrollTop+e.clientHeight>=e.scrollHeight;(t.deltaY<0&&s||t.deltaY>0&&i)&&t.preventDefault(),t.stopPropagation()},{passive:!1}),this.badgesContainer.addEventListener("mousedown",t=>{t.target.closest('[data-action="show-selected"]')&&!this.showSelectedPopover&&t.stopPropagation()}),this.badgesContainer.addEventListener("click",t=>this.handleBadgeClick(t)),this.counter.addEventListener("mousedown",t=>{this.showSelectedPopover||t.stopPropagation()}),this.counter.addEventListener("click",t=>{t.stopPropagation(),this.toggleSelectedPopover()}),this.selectedPopover.addEventListener("click",t=>this.handleSelectedPopoverClick(t))}async handleSearch(t){if(this.searchTerm=t,!this.options.isSearchEnabled)return;let e=t;if(this.options.beforeSearchCallback){const s=this.options.beforeSearchCallback(t);if(s===null){A.debug(`[${this.instanceId}] beforeSearchCallback blocked search for term:`,t),this.abortInFlightSearch(),this.matchingIndices.clear(),this.isTreeMode()?(this.searchTerm="",this.rebuildTreeVisible()):this.filteredOptions=[...this.allOptions],this.renderDropdown();return}e=s,e!==t&&A.debug(`[${this.instanceId}] beforeSearchCallback transformed: "${t}" -> "${e}"`)}if(this.options.searchCallback){if(e.length<this.options.minSearchLength){this.abortInFlightSearch(),this.isLoading=!1,this.options.isKeepOptionsOnSearch?(this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions],A.debug(`[${this.instanceId}] Search term below minimum, showing ${this.allOptions.length} initial options`)):(this.filteredOptions=[],this.isTreeMode()&&(this.treeNodes=[])),this.matchingIndices.clear(),this.renderDropdown();return}this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0);const s=this.options.searchDebounce||0;s>0?this.searchDebounceTimer=setTimeout(()=>{this.searchDebounceTimer=void 0,this.searchTerm===t&&this.performAsyncSearch(t,e)},s):await this.performAsyncSearch(t,e)}else{if(this.isTreeMode()){this.rebuildTreeVisible(),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,this.renderDropdown();return}if(!e)this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1;else{const s=this.options.searchMode||"filter",i=e.toLowerCase();if(s==="filter")this.filteredOptions=this.allOptions.filter(r=>this.getItemSearchValue(r).toLowerCase().includes(i)),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,A.debug(`[${this.instanceId}] Filter mode: ${this.filteredOptions.length} matches for "${e}"`);else{this.filteredOptions=[...this.allOptions],this.matchingIndices.clear();let r=-1;this.allOptions.forEach((n,a)=>{this.getItemSearchValue(n).toLowerCase().includes(i)&&(this.matchingIndices.add(a),r===-1&&(r=a))}),r>=0?(this.focusedIndex=r,A.debug(`[${this.instanceId}] Navigate mode: ${this.matchingIndices.size} matches, jumped to index ${r}`)):A.debug(`[${this.instanceId}] Navigate mode: No matches found, keeping previous focus`)}}this.renderDropdown(),this.options.searchMode==="navigate"&&this.focusedIndex>=0&&this.scrollToFocused()}}abortInFlightSearch(){this.searchAbortController&&(this.searchAbortController.abort(),this.searchAbortController=void 0)}async performAsyncSearch(t,e){this.abortInFlightSearch();const s=new AbortController;this.searchAbortController=s,this.isLoading=!0,this.renderDropdown(),A.debug(`[${this.instanceId}] Loading data for search term:`,e);try{const i=await this.options.searchCallback(e,s.signal);if(s.signal.aborted||this.searchTerm!==t)return;const r=i||[];this.isTreeMode()?this.rebuildTreeVisibleFromMatches(r):this.filteredOptions=[...r],this.isLoading=!1,this.matchingIndices.clear(),this.focusedIndex=this.options.isSearchEnabled&&this.filteredOptions.length>0?0:-1,this.renderDropdown(),A.debug(`[${this.instanceId}] Loaded ${r.length} results`)}catch(i){if(s.signal.aborted)return;A.error(`[${this.instanceId}] Error loading data:`,i),this.isLoading=!1,this.options.isKeepOptionsOnSearch?this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions]:(this.filteredOptions=[],this.isTreeMode()&&(this.treeNodes=[])),this.matchingIndices.clear(),this.renderDropdown()}finally{this.searchAbortController===s&&(this.searchAbortController=void 0)}}handleKeydown(t){if(!this.isOpen){(t.key==="Enter"||t.key==="ArrowDown")&&(t.preventDefault(),this.open());return}if(!this.options.isSearchEnabled){const e=t.key.length===1||t.key==="Backspace"||t.key==="Delete",s=["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(t.key);if(e&&!s){t.preventDefault();return}}switch(t.key){case"ArrowDown":t.preventDefault(),t.ctrlKey||t.metaKey?this.focusNextMatch():this.focusNext();break;case"ArrowUp":t.preventDefault(),t.ctrlKey||t.metaKey?this.focusPreviousMatch():this.focusPrevious();break;case"Enter":t.preventDefault(),this.focusedIndex>=0?this.toggleOption(this.filteredOptions[this.focusedIndex]):this.options.isAddNewAllowed&&this.options.addNewCallback&&this.input.value.trim()&&this.handleAddNew(this.input.value.trim());break;case"Escape":t.preventDefault(),this.showSelectedPopover?this.hideSelectedPopover():this.input.value?(this.input.value="",this.searchTerm="",this.resetVisibleToAll(),this.matchingIndices.clear(),this.focusedIndex=-1,this.renderDropdown()):this.close();break;case"Tab":this.close();break;case"PageUp":t.preventDefault(),this.focusPageUp();break;case"PageDown":t.preventDefault(),this.focusPageDown();break;case"Home":t.preventDefault(),this.focusFirst();break;case"End":t.preventDefault(),this.focusLast();break}}handleDropdownClick(t){var i;L.debug(`[${this.instanceId}] Dropdown clicked`,{target:t.target.className}),t.stopPropagation();const e=t.target.closest("[data-action]");if(e){t.preventDefault();const r=e.dataset.action;if(L.debug(`[${this.instanceId}] Action button clicked:`,r),r==="select-all")this.selectAll();else if(r==="clear-all")this.clearAll();else if(r==="custom"){const n=parseInt(e.dataset.buttonIndex||"-1"),a=(i=this.options.actionButtons)==null?void 0:i[n];a!=null&&a.onClick&&a.onClick(this)}return}const s=t.target.closest(".ms__option");if(s&&!s.classList.contains("ms__option--disabled")){t.preventDefault();const r=s.dataset.value,n=this.filteredOptions.findIndex(a=>String(this.getItemValue(a))===r);L.debug(`[${this.instanceId}] Option clicked:`,{value:r,optionIndex:n,closeOnSelect:this.options.isCloseOnSelect,placeholder:this.options.searchPlaceholder}),n>=0&&(this.focusedIndex=n,this.toggleOption(this.filteredOptions[n]),this.isOpen&&this.input.focus())}}handleBadgeClick(t){if(t.target.closest('[data-action="clear-count"]')){t.preventDefault(),t.stopPropagation(),L.debug(`[${this.instanceId}] Clear count button clicked`),this.clearAll();return}if(t.target.closest('[data-action="show-selected"]')){t.preventDefault(),t.stopPropagation(),this.toggleSelectedPopover();return}const i=t.target.closest(".ms__badge-remove");if(i){if(t.preventDefault(),t.stopPropagation(),i.dataset.action==="remove-hidden"){L.debug(`[${this.instanceId}] Remove hidden items button clicked`);const l=this.options.badgesMaxVisible||3;Array.from(this.selectedOptions.values()).slice(l).forEach(m=>this.interactiveDeselect(m));return}const n=i.dataset.value,a=this.selectedOptions.get(n);a&&this.interactiveDeselect(a);return}if(t.target.closest(".ms__badge--more")&&!t.target.closest(".ms__badge-remove")){t.preventDefault(),t.stopPropagation(),L.debug(`[${this.instanceId}] '+X more' badge clicked, showing popover`),this.toggleSelectedPopover();return}}handleClickOutside(t){var i;const e=t.composedPath();if(this.showSelectedPopover&&!e.some(n=>n instanceof Node&&(this.selectedPopover.contains(n)||this.counter.contains(n)||n.closest&&n.closest('[data-action="show-selected"]')))){H.debug(`[${this.instanceId}] Closing selected popover due to click outside`),this.hideSelectedPopover();return}if(!this.isOpen)return;const s=e.some(r=>r instanceof Node&&(this.element.contains(r)||this.dropdown.contains(r)||this.hint&&this.hint.contains(r)));L.debug(`[${this.instanceId}] handleClickOutside`,{target:t.target.className,targetTag:t.target.tagName,clickedInside:s,pathLength:e.length,firstInPath:(i=e[0])==null?void 0:i.tagName,elementContains:e.some(r=>r instanceof Node&&this.element.contains(r)),dropdownContains:e.some(r=>r instanceof Node&&this.dropdown.contains(r)),isConnected:this.dropdown.isConnected}),s||(L.warn(`[${this.instanceId}] Closing dropdown due to click outside`),this.close())}focusBy(t,e=1){const s=this.filteredOptions.length;if(s===0)return;const i=t(this.focusedIndex,s);if(i<0)return;const r=this.resolveSelectableIndex(i,e,s);r<0||(this.focusedIndex=r,this.renderDropdown(),this.scrollToFocused())}resolveSelectableIndex(t,e,s){if(!this.isTreeMode())return t;let i=t;for(;i>=0&&i<s&&!this.isIndexSelectable(i);)i+=e;if(i<0||i>=s)for(i=t-e;i>=0&&i<s&&!this.isIndexSelectable(i);)i-=e;return i>=0&&i<s?i:-1}focusNext(){this.focusBy((t,e)=>Math.min(e-1,t+1),1)}focusPrevious(){this.focusBy(t=>Math.max(0,t-1),-1)}focusFirst(){this.focusBy(()=>0,1)}focusLast(){this.focusBy((t,e)=>e-1,-1)}focusPageUp(){this.focusBy(t=>Math.max(0,t-10),-1)}focusPageDown(){this.focusBy((t,e)=>Math.min(e-1,t+10),1)}focusNextMatch(){if(this.matchingIndices.size===0)return;const t=Array.from(this.matchingIndices).sort((i,r)=>i-r),e=t.findIndex(i=>i===this.focusedIndex),s=(e+1)%t.length;this.focusBy(()=>t[s]),L.debug(`[${this.instanceId}] Jumped to next match: index ${this.focusedIndex} (${e+1} of ${t.length})`)}focusPreviousMatch(){if(this.matchingIndices.size===0)return;const t=Array.from(this.matchingIndices).sort((i,r)=>i-r),e=t.findIndex(i=>i===this.focusedIndex),s=e<=0?t.length-1:e-1;this.focusBy(()=>t[s]),L.debug(`[${this.instanceId}] Jumped to previous match: index ${this.focusedIndex} (${e+1} of ${t.length})`)}scrollToFocused(){if(this.virtualScroll&&this.focusedIndex>=0)this.virtualScroll.scrollToIndex(this.focusedIndex);else{const t=this.dropdown.querySelector(".ms__option--focused");t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}}toggleOption(t){if(this.getItemDisabled(t)){L.debug(`[${this.instanceId}] toggleOption ignored — option is disabled`);return}if(!this.isOptionSelectable(t)){L.debug(`[${this.instanceId}] toggleOption ignored — node is not selectable`);return}const e=this.getItemValue(t),s=String(e);if(L.debug(`[${this.instanceId}] toggleOption called`,{value:e,multiple:this.options.isMultipleEnabled}),this.isCascadeMode()&&this.cascadeIndex){const n=this.cascadeIndex.nodeByValue.get(s);if(n){this.toggleTreeCascade(n),this.options.isCloseOnSelect&&this.close();return}}(this.selectedValues.has(s)?this.interactiveDeselect(t):this.interactiveSelect(t))&&(this.options.isMultipleEnabled?this.options.isCloseOnSelect&&this.close():this.close())}interactiveSelect(t){return this.options.beforeSelectCallback&&this.options.beforeSelectCallback(t,this.getSelected())===!1?(L.debug(`[${this.instanceId}] Selection blocked by beforeSelectCallback`),!1):(this.options.isMultipleEnabled||(this.selectedValues.clear(),this.selectedOptions.clear()),this.selectOption(t),!0)}interactiveDeselect(t){return this.options.beforeDeselectCallback&&this.options.beforeDeselectCallback(t,this.getSelected())===!1?(L.debug(`[${this.instanceId}] Deselection blocked by beforeDeselectCallback`),!1):(this.deselectOption(t),!0)}async handleAddNew(t){if(this.options.addNewCallback)try{A.debug(`[${this.instanceId}] Adding new option:`,t);const e=await this.options.addNewCallback(t);this.allOptions.push(e),this.filteredOptions.push(e),this.selectOption(e),this.input.value="",this.renderDropdown(),this.renderBadges(),this.options.isCloseOnSelect&&this.close()}catch(e){A.error(`[${this.instanceId}] Error adding new option:`,e)}}selectOption(t){const e=this.getItemValue(t),s=String(e);this.selectedValues.add(s),this.selectedOptions.set(s,t),this.commit({added:[t]})}deselectOption(t){const e=this.getItemValue(t),s=String(e);this.selectedValues.delete(s),this.selectedOptions.delete(s),this.commit({removed:[t]})}selectAll(){const t=[];this.filteredOptions.forEach((e,s)=>{if(this.getItemDisabled(e)||!this.isIndexSelectable(s))return;const i=String(this.getItemValue(e));this.selectedValues.has(i)||(this.selectedValues.add(i),this.selectedOptions.set(i,e),t.push(e))}),this.commit({added:t})}clearAll(){const t=Array.from(this.selectedOptions.values());this.selectedValues.clear(),this.selectedOptions.clear(),this.commit({removed:t})}commit(t){this.renderDropdown(),this.renderBadges(),this.updateHiddenInput();const e=t.added??[],s=t.removed??[];this.options.onSelect&&e.forEach(i=>this.options.onSelect(i)),this.options.onDeselect&&s.forEach(i=>this.options.onDeselect(i)),(e.length>0||s.length>0)&&this.options.onChange&&this.options.onChange(this.getSelected())}open(){H.debug(`[${this.instanceId}] open() called`,{isOpen:this.isOpen}),!this.isOpen&&(this.isOpen=!0,this.element.classList.add("ms--open"),this.dropdown.classList.add("ms__dropdown--visible"),H.info(`[${this.instanceId}] Dropdown opened`),this.input.placeholder=this.getPlaceholderText(),!this.options.isMultipleEnabled&&this.options.isSearchEnabled&&(this.input.value=this.searchTerm),this.options.searchCallback&&this.options.isKeepOptionsOnSearch&&!this.searchTerm&&(this.filteredOptions=[...this.allOptions],H.debug(`[${this.instanceId}] Showing ${this.allOptions.length} initial options on open`)),this.renderDropdown(),this.positionDropdown(),this.hint&&(this.hint.classList.add("ms__hint--visible"),this.positionHint()))}close(){H.debug(`[${this.instanceId}] close() called`,{isOpen:this.isOpen}),this.isOpen&&(this.isOpen=!1,this.element.classList.remove("ms--open"),this.dropdown.classList.remove("ms__dropdown--visible"),this.hint&&this.hint.classList.remove("ms__hint--visible"),this.options.shouldKeepSearchOnClose||(this.searchTerm="",(this.options.isMultipleEnabled||this.options.isSearchEnabled)&&(this.input.value=""),this.resetVisibleToAll()),this.focusedIndex=-1,this.destroyAllOptionTooltips(),this.renderBadges(),this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.dropdownPlacement=null,H.debug(`[${this.instanceId}] Dropdown closed`))}anchorFloatingPanel(t,e){const s={...ot,getOffsetParent:()=>Ls(this.input)};return Oe(this.input,t,()=>{var l;t.style.width=`${this.input.offsetWidth}px`,this.options.dropdownMinWidth&&(t.style.minWidth=this.options.dropdownMinWidth),e.applyMaxWidth&&this.options.dropdownMaxWidth&&(t.style.maxWidth=this.options.dropdownMaxWidth);const i=((l=e.isLocked)==null?void 0:l.call(e))??!0,r=e.getPlacement(),n=i&&r?r:"bottom-start",a=[Ae(4),...i&&r?[]:[rt()],Pe({padding:8})];Le(this.input,t,{placement:n,strategy:"fixed",middleware:a,platform:s}).then(({x:d,y:c,placement:m})=>{var u;r||e.setPlacement(m),Object.assign(t.style,{position:"fixed",left:`${d}px`,top:`${c}px`}),this.verifyPanelLanded(t,d,c),(u=e.afterPosition)==null||u.call(e)})})}verifyPanelLanded(t,e,s){if(this.positioningDriftWarned)return;const i=t.getBoundingClientRect(),r=i.x-e,n=i.y-s;if(Math.abs(r)<1&&Math.abs(n)<1)return;this.positioningDriftWarned=!0;const a=Es(this.input,r,n),l=a?`<${a.tagName.toLowerCase()}${a.id?"#"+a.id:""}${typeof a.className=="string"&&a.className?"."+a.className.split(/\s+/).filter(Boolean).slice(0,2).join("."):""}>`:"an ancestor element (could not auto-identify)",d=a?Vs(a):"";console.warn(`[@keenmate/web-multiselect] Dropdown panel rendered ${r.toFixed(0)}px / ${n.toFixed(0)}px away from where the library positioned it. Most likely culprit: ${l}`+(d?` (has ${d})`:"")+".\nAn ancestor of <web-multiselect> establishes a fixed-positioning containing block that the library's heuristic doesn't recognize. Fix on your side: replace the property with `transform: translateZ(0)` on that ancestor, OR move the trigger out of that ancestor's subtree. If neither is acceptable, please file an issue at https://github.com/keenmate/web-multiselect/issues with the ancestor's computed CSS.")}positionDropdown(){this.dropdownCleanup=this.anchorFloatingPanel(this.dropdown,{getPlacement:()=>this.dropdownPlacement,setPlacement:t=>{this.dropdownPlacement=t,H.debug(`[${this.instanceId}] Locked dropdown placement:`,t)},isLocked:()=>!!this.options.isPlacementLocked,applyMaxWidth:!0,afterPosition:()=>{this.hint&&this.isOpen&&this.positionHint()}})}positionHint(){this.hint&&(this.hintCleanup&&this.hintCleanup(),this.hintCleanup=Oe(this.input,this.hint,()=>{let t="top-start";this.dropdownPlacement&&(this.dropdownPlacement.startsWith("bottom")?t=this.dropdownPlacement.replace("bottom","top"):this.dropdownPlacement.startsWith("top")&&(t=this.dropdownPlacement.replace("top","bottom"))),Le(this.input,this.hint,{placement:t,strategy:"fixed",middleware:[Ae(4),Pe({padding:8})]}).then(({x:e,y:s})=>{Object.assign(this.hint.style,{position:"fixed",left:`${e}px`,top:`${s}px`})})}))}parseInitialSelection(){const t=this.element.dataset.initialValues;if(t)try{JSON.parse(t).forEach(s=>{this.selectedValues.add(String(s))}),this.reconcileSelectedOptions(),this.renderBadges()}catch(e){A.error(`[${this.instanceId}] Failed to parse initial values:`,e)}}reconcileSelectedOptions(){this.selectedValues.size===0||this.allOptions.length===0||this.selectedValues.forEach(t=>{if(this.selectedOptions.has(t))return;const e=this.allOptions.find(s=>String(this.getItemValue(s))===t);e&&this.selectedOptions.set(t,e)})}toggleSelectedPopover(){this.showSelectedPopover?this.hideSelectedPopover():this.showPopover()}showPopover(){H.debug(`[${this.instanceId}] showPopover() called`),this.isOpen&&this.close(),this.showSelectedPopover=!0,this.renderSelectedPopover(),this.selectedPopover.classList.add("ms__selected-popover--visible");const t=this.options.virtualScrollThreshold??100;this.selectedValues.size>=t&&this.selectedPopover.classList.add("ms__selected-popover--virtual"),this.positionSelectedPopover()}hideSelectedPopover(){var t;H.debug(`[${this.instanceId}] hideSelectedPopover() called`),this.showSelectedPopover=!1,this.selectedPopover.classList.remove("ms__selected-popover--visible"),this.selectedPopover.classList.remove("ms__selected-popover--virtual"),this.selectedPopoverPlacement=null,this.selectedPopoverVirtualScroll&&(this.selectedPopoverVirtualScroll.destroy(),this.selectedPopoverVirtualScroll=null,this.selectedPopoverContainer=null),this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null);for(const e of Array.from(this.tooltips.keys()))e.startsWith("popover-")&&((t=this.tooltips.get(e))==null||t.destroy(),this.tooltips.delete(e))}renderSelectedPopover(){const t=Array.from(this.selectedOptions.values()),e=this.selectedValues.size,s=this.options.virtualScrollThreshold??100;if(e>=s){this.renderSelectedPopoverVirtual(t,e);return}this.selectedPopover.innerHTML=`
16
+ `}else this.badgesContainer.innerHTML="";this.attachBadgeTooltips()}attachEvents(){this.input.addEventListener("mousedown",t=>{t.stopPropagation(),this.isOpen?(this.justClosedViaClick=!0,this.close(),setTimeout(()=>{this.justClosedViaClick=!1},0)):this.open()}),this.input.addEventListener("focus",()=>{!this.isOpen&&!this.justClosedViaClick&&this.open()}),this.input.addEventListener("input",t=>{const e=t.target.value;this.options.isSearchEnabled&&!this.isOpen&&this.open(),this.handleSearch(e)}),this.input.addEventListener("keydown",t=>this.handleKeydown(t)),this.documentClickHandler=t=>this.handleClickOutside(t),setTimeout(()=>{document.addEventListener("click",this.documentClickHandler)},0),this.documentKeydownHandler=t=>{t.key==="Escape"&&this.showSelectedPopover&&(t.preventDefault(),this.hideSelectedPopover())},document.addEventListener("keydown",this.documentKeydownHandler),this.dropdown.addEventListener("click",t=>this.handleDropdownClick(t)),this.dropdownInner.addEventListener("wheel",t=>{if(this.virtualScroll)return;const e=t.currentTarget,s=e.scrollTop===0,i=e.scrollTop+e.clientHeight>=e.scrollHeight;(t.deltaY<0&&s||t.deltaY>0&&i)&&t.preventDefault(),t.stopPropagation()},{passive:!1}),this.badgesContainer.addEventListener("mousedown",t=>{t.target.closest('[data-action="show-selected"]')&&!this.showSelectedPopover&&t.stopPropagation()}),this.badgesContainer.addEventListener("click",t=>this.handleBadgeClick(t)),this.counter.addEventListener("mousedown",t=>{this.showSelectedPopover||t.stopPropagation()}),this.counter.addEventListener("click",t=>{t.stopPropagation(),this.toggleSelectedPopover()}),this.selectedPopover.addEventListener("click",t=>this.handleSelectedPopoverClick(t))}async handleSearch(t){if(this.searchTerm=t,!this.options.isSearchEnabled)return;let e=t;if(this.options.beforeSearchCallback){const s=this.options.beforeSearchCallback(t);if(s===null){A.debug(`[${this.instanceId}] beforeSearchCallback blocked search for term:`,t),this.abortInFlightSearch(),this.matchingIndices.clear(),this.isTreeMode()?(this.searchTerm="",this.rebuildTreeVisible()):this.filteredOptions=[...this.allOptions],this.renderDropdown();return}e=s,e!==t&&A.debug(`[${this.instanceId}] beforeSearchCallback transformed: "${t}" -> "${e}"`)}if(this.options.searchCallback){if(e.length<this.options.minSearchLength){this.abortInFlightSearch(),this.isLoading=!1,this.options.isKeepOptionsOnSearch?(this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions],A.debug(`[${this.instanceId}] Search term below minimum, showing ${this.allOptions.length} initial options`)):(this.filteredOptions=[],this.isTreeMode()&&(this.treeNodes=[])),this.matchingIndices.clear(),this.renderDropdown();return}this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0);const s=this.options.searchDebounce||0;s>0?this.searchDebounceTimer=setTimeout(()=>{this.searchDebounceTimer=void 0,this.searchTerm===t&&this.performAsyncSearch(t,e)},s):await this.performAsyncSearch(t,e)}else{if(this.isTreeMode()){this.rebuildTreeVisible(),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,this.renderDropdown();return}if(!e)this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1;else{const s=this.options.searchMode||"filter",i=e.toLowerCase();if(s==="filter")this.filteredOptions=this.allOptions.filter(r=>this.getItemSearchValue(r).toLowerCase().includes(i)),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,A.debug(`[${this.instanceId}] Filter mode: ${this.filteredOptions.length} matches for "${e}"`);else{this.filteredOptions=[...this.allOptions],this.matchingIndices.clear();let r=-1;this.allOptions.forEach((n,a)=>{this.getItemSearchValue(n).toLowerCase().includes(i)&&(this.matchingIndices.add(a),r===-1&&(r=a))}),r>=0?(this.focusedIndex=r,A.debug(`[${this.instanceId}] Navigate mode: ${this.matchingIndices.size} matches, jumped to index ${r}`)):A.debug(`[${this.instanceId}] Navigate mode: No matches found, keeping previous focus`)}}this.renderDropdown(),this.options.searchMode==="navigate"&&this.focusedIndex>=0&&this.scrollToFocused()}}abortInFlightSearch(){this.searchAbortController&&(this.searchAbortController.abort(),this.searchAbortController=void 0)}async performAsyncSearch(t,e){this.abortInFlightSearch();const s=new AbortController;this.searchAbortController=s,this.isLoading=!0,this.renderDropdown(),A.debug(`[${this.instanceId}] Loading data for search term:`,e);try{const i=await this.options.searchCallback(e,s.signal);if(s.signal.aborted||this.searchTerm!==t)return;const r=i||[];this.isTreeMode()?this.rebuildTreeVisibleFromMatches(r):this.filteredOptions=[...r],this.isLoading=!1,this.matchingIndices.clear(),this.focusedIndex=this.options.isSearchEnabled&&this.filteredOptions.length>0?0:-1,this.renderDropdown(),A.debug(`[${this.instanceId}] Loaded ${r.length} results`)}catch(i){if(s.signal.aborted)return;A.error(`[${this.instanceId}] Error loading data:`,i),this.isLoading=!1,this.options.isKeepOptionsOnSearch?this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions]:(this.filteredOptions=[],this.isTreeMode()&&(this.treeNodes=[])),this.matchingIndices.clear(),this.renderDropdown()}finally{this.searchAbortController===s&&(this.searchAbortController=void 0)}}handleKeydown(t){if(!this.isOpen){(t.key==="Enter"||t.key==="ArrowDown")&&(t.preventDefault(),this.open());return}if(!this.options.isSearchEnabled){const e=t.key.length===1||t.key==="Backspace"||t.key==="Delete",s=["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(t.key);if(e&&!s){t.preventDefault();return}}switch(t.key){case"ArrowDown":t.preventDefault(),t.ctrlKey||t.metaKey?this.focusNextMatch():this.focusNext();break;case"ArrowUp":t.preventDefault(),t.ctrlKey||t.metaKey?this.focusPreviousMatch():this.focusPrevious();break;case"Enter":t.preventDefault(),this.focusedIndex>=0?this.toggleOption(this.filteredOptions[this.focusedIndex]):this.options.isAddNewAllowed&&this.options.addNewCallback&&this.input.value.trim()&&this.handleAddNew(this.input.value.trim());break;case"Escape":t.preventDefault(),this.showSelectedPopover?this.hideSelectedPopover():this.input.value?(this.input.value="",this.searchTerm="",this.resetVisibleToAll(),this.matchingIndices.clear(),this.focusedIndex=-1,this.renderDropdown()):this.close();break;case"Tab":this.close();break;case"PageUp":t.preventDefault(),this.focusPageUp();break;case"PageDown":t.preventDefault(),this.focusPageDown();break;case"Home":t.preventDefault(),this.focusFirst();break;case"End":t.preventDefault(),this.focusLast();break}}handleDropdownClick(t){var i;L.debug(`[${this.instanceId}] Dropdown clicked`,{target:t.target.className}),t.stopPropagation();const e=t.target.closest("[data-action]");if(e){t.preventDefault();const r=e.dataset.action;if(L.debug(`[${this.instanceId}] Action button clicked:`,r),r==="select-all")this.selectAll();else if(r==="clear-all")this.clearAll();else if(r==="custom"){const n=parseInt(e.dataset.buttonIndex||"-1"),a=(i=this.options.actionButtons)==null?void 0:i[n];a!=null&&a.onClick&&a.onClick(this)}return}const s=t.target.closest(".ms__option");if(s&&!s.classList.contains("ms__option--disabled")){t.preventDefault();const r=s.dataset.value,n=this.filteredOptions.findIndex(a=>String(this.getItemValue(a))===r);L.debug(`[${this.instanceId}] Option clicked:`,{value:r,optionIndex:n,closeOnSelect:this.options.isCloseOnSelect,placeholder:this.options.searchPlaceholder}),n>=0&&(this.focusedIndex=n,this.toggleOption(this.filteredOptions[n]),this.isOpen&&this.input.focus())}}handleBadgeClick(t){if(t.target.closest('[data-action="clear-count"]')){t.preventDefault(),t.stopPropagation(),L.debug(`[${this.instanceId}] Clear count button clicked`),this.clearAll();return}if(t.target.closest('[data-action="show-selected"]')){t.preventDefault(),t.stopPropagation(),this.toggleSelectedPopover();return}const i=t.target.closest(".ms__badge-remove");if(i){if(t.preventDefault(),t.stopPropagation(),i.dataset.action==="remove-hidden"){L.debug(`[${this.instanceId}] Remove hidden items button clicked`);const l=this.options.badgesMaxVisible||3;Array.from(this.selectedOptions.values()).slice(l).forEach(p=>this.interactiveDeselect(p));return}const n=i.dataset.value,a=this.selectedOptions.get(n);a&&this.interactiveDeselect(a);return}if(t.target.closest(".ms__badge--more")&&!t.target.closest(".ms__badge-remove")){t.preventDefault(),t.stopPropagation(),L.debug(`[${this.instanceId}] '+X more' badge clicked, showing popover`),this.toggleSelectedPopover();return}}handleClickOutside(t){var i;const e=t.composedPath();if(this.showSelectedPopover&&!e.some(n=>n instanceof Node&&(this.selectedPopover.contains(n)||this.counter.contains(n)||n.closest&&n.closest('[data-action="show-selected"]')))){H.debug(`[${this.instanceId}] Closing selected popover due to click outside`),this.hideSelectedPopover();return}if(!this.isOpen)return;const s=e.some(r=>r instanceof Node&&(this.element.contains(r)||this.dropdown.contains(r)||this.hint&&this.hint.contains(r)));L.debug(`[${this.instanceId}] handleClickOutside`,{target:t.target.className,targetTag:t.target.tagName,clickedInside:s,pathLength:e.length,firstInPath:(i=e[0])==null?void 0:i.tagName,elementContains:e.some(r=>r instanceof Node&&this.element.contains(r)),dropdownContains:e.some(r=>r instanceof Node&&this.dropdown.contains(r)),isConnected:this.dropdown.isConnected}),s||(L.warn(`[${this.instanceId}] Closing dropdown due to click outside`),this.close())}focusBy(t,e=1){const s=this.filteredOptions.length;if(s===0)return;const i=t(this.focusedIndex,s);if(i<0)return;const r=this.resolveSelectableIndex(i,e,s);r<0||(this.focusedIndex=r,this.renderDropdown(),this.scrollToFocused())}resolveSelectableIndex(t,e,s){if(!this.isTreeMode())return t;let i=t;for(;i>=0&&i<s&&!this.isIndexSelectable(i);)i+=e;if(i<0||i>=s)for(i=t-e;i>=0&&i<s&&!this.isIndexSelectable(i);)i-=e;return i>=0&&i<s?i:-1}focusNext(){this.focusBy((t,e)=>Math.min(e-1,t+1),1)}focusPrevious(){this.focusBy(t=>Math.max(0,t-1),-1)}focusFirst(){this.focusBy(()=>0,1)}focusLast(){this.focusBy((t,e)=>e-1,-1)}focusPageUp(){this.focusBy(t=>Math.max(0,t-10),-1)}focusPageDown(){this.focusBy((t,e)=>Math.min(e-1,t+10),1)}focusNextMatch(){if(this.matchingIndices.size===0)return;const t=Array.from(this.matchingIndices).sort((i,r)=>i-r),e=t.findIndex(i=>i===this.focusedIndex),s=(e+1)%t.length;this.focusBy(()=>t[s]),L.debug(`[${this.instanceId}] Jumped to next match: index ${this.focusedIndex} (${e+1} of ${t.length})`)}focusPreviousMatch(){if(this.matchingIndices.size===0)return;const t=Array.from(this.matchingIndices).sort((i,r)=>i-r),e=t.findIndex(i=>i===this.focusedIndex),s=e<=0?t.length-1:e-1;this.focusBy(()=>t[s]),L.debug(`[${this.instanceId}] Jumped to previous match: index ${this.focusedIndex} (${e+1} of ${t.length})`)}scrollToFocused(){if(this.virtualScroll&&this.focusedIndex>=0)this.virtualScroll.scrollToIndex(this.focusedIndex);else{const t=this.dropdown.querySelector(".ms__option--focused");t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}}toggleOption(t){if(this.getItemDisabled(t)){L.debug(`[${this.instanceId}] toggleOption ignored — option is disabled`);return}if(!this.isOptionSelectable(t)){L.debug(`[${this.instanceId}] toggleOption ignored — node is not selectable`);return}const e=this.getItemValue(t),s=String(e);if(L.debug(`[${this.instanceId}] toggleOption called`,{value:e,multiple:this.options.isMultipleEnabled}),this.isCascadeMode()&&this.cascadeIndex){const n=this.cascadeIndex.nodeByValue.get(s);if(n){this.toggleTreeCascade(n),this.options.isCloseOnSelect&&this.close();return}}(this.selectedValues.has(s)?this.interactiveDeselect(t):this.interactiveSelect(t))&&(this.options.isMultipleEnabled?this.options.isCloseOnSelect&&this.close():this.close())}interactiveSelect(t){return this.options.beforeSelectCallback&&this.options.beforeSelectCallback(t,this.getSelected())===!1?(L.debug(`[${this.instanceId}] Selection blocked by beforeSelectCallback`),!1):(this.options.isMultipleEnabled||(this.selectedValues.clear(),this.selectedOptions.clear()),this.selectOption(t),!0)}interactiveDeselect(t){return this.options.beforeDeselectCallback&&this.options.beforeDeselectCallback(t,this.getSelected())===!1?(L.debug(`[${this.instanceId}] Deselection blocked by beforeDeselectCallback`),!1):(this.deselectOption(t),!0)}async handleAddNew(t){if(this.options.addNewCallback)try{A.debug(`[${this.instanceId}] Adding new option:`,t);const e=await this.options.addNewCallback(t);this.allOptions.push(e),this.filteredOptions.push(e),this.selectOption(e),this.input.value="",this.renderDropdown(),this.renderBadges(),this.options.isCloseOnSelect&&this.close()}catch(e){A.error(`[${this.instanceId}] Error adding new option:`,e)}}selectOption(t){const e=this.getItemValue(t),s=String(e);this.selectedValues.add(s),this.selectedOptions.set(s,t),this.commit({added:[t]})}deselectOption(t){const e=this.getItemValue(t),s=String(e);this.selectedValues.delete(s),this.selectedOptions.delete(s),this.commit({removed:[t]})}selectAll(){if(this.isCascadeMode()&&this.cascadeIndex){const e=this.cascadeIndex,s=new Set(ze(e,this.selectedValues));for(const i of this.treeNodes)e.atomPaths.has(i.path)&&(this.getItemDisabled(i.data)||s.add(String(this.getItemValue(i.data))));this.commitCascadeAtoms(s);return}const t=[];this.filteredOptions.forEach((e,s)=>{if(this.getItemDisabled(e)||!this.isIndexSelectable(s))return;const i=String(this.getItemValue(e));this.selectedValues.has(i)||(this.selectedValues.add(i),this.selectedOptions.set(i,e),t.push(e))}),this.commit({added:t})}clearAll(){const t=Array.from(this.selectedOptions.values());this.selectedValues.clear(),this.selectedOptions.clear(),this.commit({removed:t})}commit(t){this.renderDropdown(),this.renderBadges(),this.updateHiddenInput();const e=t.added??[],s=t.removed??[];this.options.onSelect&&e.forEach(i=>this.options.onSelect(i)),this.options.onDeselect&&s.forEach(i=>this.options.onDeselect(i)),(e.length>0||s.length>0)&&this.options.onChange&&this.options.onChange(this.getSelected())}open(){H.debug(`[${this.instanceId}] open() called`,{isOpen:this.isOpen}),!this.isOpen&&(this.isOpen=!0,this.element.classList.add("ms--open"),this.dropdown.classList.add("ms__dropdown--visible"),H.info(`[${this.instanceId}] Dropdown opened`),this.input.placeholder=this.getPlaceholderText(),!this.options.isMultipleEnabled&&this.options.isSearchEnabled&&(this.input.value=this.searchTerm),this.options.searchCallback&&this.options.isKeepOptionsOnSearch&&!this.searchTerm&&(this.filteredOptions=[...this.allOptions],H.debug(`[${this.instanceId}] Showing ${this.allOptions.length} initial options on open`)),this.renderDropdown(),this.positionDropdown(),this.hint&&(this.hint.classList.add("ms__hint--visible"),this.positionHint()))}close(){H.debug(`[${this.instanceId}] close() called`,{isOpen:this.isOpen}),this.isOpen&&(this.isOpen=!1,this.element.classList.remove("ms--open"),this.dropdown.classList.remove("ms__dropdown--visible"),this.hint&&this.hint.classList.remove("ms__hint--visible"),this.options.shouldKeepSearchOnClose||(this.searchTerm="",(this.options.isMultipleEnabled||this.options.isSearchEnabled)&&(this.input.value=""),this.resetVisibleToAll()),this.focusedIndex=-1,this.destroyAllOptionTooltips(),this.renderBadges(),this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.dropdownPlacement=null,H.debug(`[${this.instanceId}] Dropdown closed`))}anchorFloatingPanel(t,e){const s={...it,getOffsetParent:()=>Ls(this.input)};return Oe(this.input,t,()=>{var l;t.style.width=`${this.input.offsetWidth}px`,this.options.dropdownMinWidth&&(t.style.minWidth=this.options.dropdownMinWidth),e.applyMaxWidth&&this.options.dropdownMaxWidth&&(t.style.maxWidth=this.options.dropdownMaxWidth);const i=((l=e.isLocked)==null?void 0:l.call(e))??!0,r=e.getPlacement(),n=i&&r?r:"bottom-start",a=[Ae(4),...i&&r?[]:[nt()],Pe({padding:8})];Le(this.input,t,{placement:n,strategy:"fixed",middleware:a,platform:s}).then(({x:c,y:d,placement:p})=>{var u;r||e.setPlacement(p),Object.assign(t.style,{position:"fixed",left:`${c}px`,top:`${d}px`}),this.verifyPanelLanded(t,c,d),(u=e.afterPosition)==null||u.call(e)})})}verifyPanelLanded(t,e,s){if(this.positioningDriftWarned)return;const i=t.getBoundingClientRect(),r=i.x-e,n=i.y-s;if(Math.abs(r)<1&&Math.abs(n)<1)return;this.positioningDriftWarned=!0;const a=Es(this.input,r,n),l=a?`<${a.tagName.toLowerCase()}${a.id?"#"+a.id:""}${typeof a.className=="string"&&a.className?"."+a.className.split(/\s+/).filter(Boolean).slice(0,2).join("."):""}>`:"an ancestor element (could not auto-identify)",c=a?Vs(a):"";console.warn(`[@keenmate/web-multiselect] Dropdown panel rendered ${r.toFixed(0)}px / ${n.toFixed(0)}px away from where the library positioned it. Most likely culprit: ${l}`+(c?` (has ${c})`:"")+".\nAn ancestor of <web-multiselect> establishes a fixed-positioning containing block that the library's heuristic doesn't recognize. Fix on your side: replace the property with `transform: translateZ(0)` on that ancestor, OR move the trigger out of that ancestor's subtree. If neither is acceptable, please file an issue at https://github.com/keenmate/web-multiselect/issues with the ancestor's computed CSS.")}positionDropdown(){this.dropdownCleanup=this.anchorFloatingPanel(this.dropdown,{getPlacement:()=>this.dropdownPlacement,setPlacement:t=>{this.dropdownPlacement=t,H.debug(`[${this.instanceId}] Locked dropdown placement:`,t)},isLocked:()=>!!this.options.isPlacementLocked,applyMaxWidth:!0,afterPosition:()=>{this.hint&&this.isOpen&&this.positionHint()}})}positionHint(){this.hint&&(this.hintCleanup&&this.hintCleanup(),this.hintCleanup=Oe(this.input,this.hint,()=>{let t="top-start";this.dropdownPlacement&&(this.dropdownPlacement.startsWith("bottom")?t=this.dropdownPlacement.replace("bottom","top"):this.dropdownPlacement.startsWith("top")&&(t=this.dropdownPlacement.replace("top","bottom"))),Le(this.input,this.hint,{placement:t,strategy:"fixed",middleware:[Ae(4),Pe({padding:8})]}).then(({x:e,y:s})=>{Object.assign(this.hint.style,{position:"fixed",left:`${e}px`,top:`${s}px`})})}))}parseInitialSelection(){const t=this.element.dataset.initialValues;if(t)try{JSON.parse(t).forEach(s=>{this.selectedValues.add(String(s))}),this.reconcileSelectedOptions(),this.renderBadges()}catch(e){A.error(`[${this.instanceId}] Failed to parse initial values:`,e)}}reconcileSelectedOptions(){this.selectedValues.size===0||this.allOptions.length===0||this.selectedValues.forEach(t=>{if(this.selectedOptions.has(t))return;const e=this.allOptions.find(s=>String(this.getItemValue(s))===t);e&&this.selectedOptions.set(t,e)})}toggleSelectedPopover(){this.showSelectedPopover?this.hideSelectedPopover():this.showPopover()}showPopover(){H.debug(`[${this.instanceId}] showPopover() called`),this.isOpen&&this.close(),this.showSelectedPopover=!0,this.renderSelectedPopover(),this.selectedPopover.classList.add("ms__selected-popover--visible");const t=this.options.virtualScrollThreshold??100;this.selectedValues.size>=t&&this.selectedPopover.classList.add("ms__selected-popover--virtual"),this.positionSelectedPopover()}hideSelectedPopover(){var t;H.debug(`[${this.instanceId}] hideSelectedPopover() called`),this.showSelectedPopover=!1,this.selectedPopover.classList.remove("ms__selected-popover--visible"),this.selectedPopover.classList.remove("ms__selected-popover--virtual"),this.selectedPopoverPlacement=null,this.selectedPopoverVirtualScroll&&(this.selectedPopoverVirtualScroll.destroy(),this.selectedPopoverVirtualScroll=null,this.selectedPopoverContainer=null),this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null);for(const e of Array.from(this.tooltips.keys()))e.startsWith("popover-")&&((t=this.tooltips.get(e))==null||t.destroy(),this.tooltips.delete(e))}renderSelectedPopover(){const t=Array.from(this.selectedOptions.values()),e=this.selectedValues.size,s=this.options.virtualScrollThreshold??100;if(e>=s){this.renderSelectedPopoverVirtual(t,e);return}this.selectedPopover.innerHTML=`
17
17
  <div class="ms__selected-popover-header">
18
18
  <span>Selected Items (${e})</span>
19
19
  <button type="button" class="ms__selected-popover-close" aria-label="Close"></button>
@@ -27,20 +27,20 @@
27
27
  <button type="button" class="ms__selected-popover-close" aria-label="Close"></button>
28
28
  </div>
29
29
  <div class="ms__selected-popover-body ms__selected-popover-body--virtual" style="height: 18rem; overflow-y: auto; position: relative; --ms-badge-height-virtual: ${a}px;"></div>
30
- `;this.selectedPopover.innerHTML=l,this.selectedPopoverContainer=this.selectedPopover.querySelector(".ms__selected-popover-body")}if(!this.selectedPopoverContainer)return;const r=(this.options.badgeHeight??36)+4,n=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.selectedPopoverContainer&&(this.selectedPopoverVirtualScroll?this.selectedPopoverVirtualScroll.setItems(t):this.selectedPopoverVirtualScroll=new bt({container:this.selectedPopoverContainer,itemHeight:r,items:t,renderItem:a=>this.renderBadgeHTML(a,{displayMode:this.options.badgesDisplayMode||"badges",isInPopover:!0}),bufferSize:n,onVisibleRangeChange:()=>{this.attachBadgeTooltips(this.selectedPopoverContainer)}}))})}renderBadgeHTML(t,e){const s=this.getItemValue(t);let i;const r=e.isInPopover?this.options.renderSelectedItemContentCallback:void 0;if(r){const d=r(t);i=typeof d=="string"?d:d.outerHTML}else if(this.options.renderBadgeContentCallback){const d=this.options.renderBadgeContentCallback(t,e);i=typeof d=="string"?d:d.outerHTML}else i=this.getItemBadgeDisplayValue(t);const n=e.isInPopover?this.options.getSelectedItemClassCallback||this.options.getBadgeClassCallback:this.options.getBadgeClassCallback;let a="ms__badge";if(n){const d=n(t),c=Array.isArray(d)?d:[d];a+=" "+c.filter(m=>m).join(" ")}const l=this.getItemBadgeDisplayValue(t);return`
30
+ `;this.selectedPopover.innerHTML=l,this.selectedPopoverContainer=this.selectedPopover.querySelector(".ms__selected-popover-body")}if(!this.selectedPopoverContainer)return;const r=(this.options.badgeHeight??36)+4,n=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.selectedPopoverContainer&&(this.selectedPopoverVirtualScroll?this.selectedPopoverVirtualScroll.setItems(t):this.selectedPopoverVirtualScroll=new gt({container:this.selectedPopoverContainer,itemHeight:r,items:t,renderItem:a=>this.renderBadgeHTML(a,{displayMode:this.options.badgesDisplayMode||"badges",isInPopover:!0}),bufferSize:n,onVisibleRangeChange:()=>{this.attachBadgeTooltips(this.selectedPopoverContainer)}}))})}renderBadgeHTML(t,e){const s=this.getItemValue(t);let i;const r=e.isInPopover?this.options.renderSelectedItemContentCallback:void 0;if(r){const c=r(t);i=typeof c=="string"?c:c.outerHTML}else if(this.options.renderBadgeContentCallback){const c=this.options.renderBadgeContentCallback(t,e);i=typeof c=="string"?c:c.outerHTML}else i=this.getItemBadgeDisplayValue(t);const n=e.isInPopover?this.options.getSelectedItemClassCallback||this.options.getBadgeClassCallback:this.options.getBadgeClassCallback;let a="ms__badge";if(n){const c=n(t),d=Array.isArray(c)?c:[c];a+=" "+d.filter(p=>p).join(" ")}const l=this.getItemBadgeDisplayValue(t);return`
31
31
  <div class="${a}">
32
32
  <span class="ms__badge-text">${i}</span>
33
33
  <button type="button" class="ms__badge-remove" data-value="${s}" aria-label="Remove ${l}"></button>
34
34
  </div>
35
- `}handleSelectedPopoverClick(t){if(t.stopPropagation(),t.target.closest(".ms__selected-popover-close")){t.preventDefault(),this.hideSelectedPopover();return}const s=t.target.closest(".ms__badge-remove");if(s){t.preventDefault();const i=s.dataset.value,r=this.selectedOptions.get(i);r&&this.interactiveDeselect(r)&&(this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.selectedPopoverCleanup=this.anchorFloatingPanel(this.selectedPopover,{getPlacement:()=>this.selectedPopoverPlacement,setPlacement:t=>{this.selectedPopoverPlacement=t,H.debug(`[${this.instanceId}] Locked popover placement:`,t)}})}updateHiddenInput(){if(!this.options.formFieldId)return;this.hiddenInputs.forEach(i=>i.remove()),this.hiddenInputs=[];const t=this.options.valueFormat||"json",e=Array.from(this.selectedOptions.values()).map(i=>this.getItemValue(i)),s=this.options.hostElement||this.element;if(t==="array")e.forEach(i=>{const r=document.createElement("input");r.type="hidden",r.name=`${this.options.formFieldId}[]`,r.value=String(i),s.appendChild(r),this.hiddenInputs.push(r)});else{const i=document.createElement("input");i.type="hidden",i.name=this.options.formFieldId,i.id=this.options.formFieldId,i.value=this.getFormValue(),s.appendChild(i),this.hiddenInputs.push(i)}}getFormValue(){const t=Array.from(this.selectedOptions.values()).map(s=>this.getItemValue(s));return this.options.getValueFormatCallback?this.options.getValueFormatCallback(t):(this.options.valueFormat||"json")==="csv"?t.join(","):JSON.stringify(t)}getSelected(){return Array.from(this.selectedOptions.values())}setSelected(t){this.selectedValues=new Set(t.map(e=>String(e))),this.selectedOptions.clear(),t.forEach(e=>{const s=String(e),i=this.allOptions.find(r=>String(this.getItemValue(r))===s);i&&this.selectedOptions.set(s,i)}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput()}updateOptions(t){const e=!!this.hint,s="searchHint"in t?!!t.searchHint:e;if(e!==s)return!1;Object.assign(this.options,t);const i="pathMember"in t||"getPathCallback"in t||"parentPathMember"in t||"levelMember"in t||"hasChildrenMember"in t||"treePathSeparator"in t||"isTreeEnabled"in t||"isSelectableMember"in t||"getIsSelectableCallback"in t;if("options"in t&&t.options!==void 0?(this.allOptions=t.options,this.reconcileSelectedOptions(),this.isTreeMode()?this.buildTree():this.filteredOptions=this.searchTerm?this.filteredOptions:[...this.allOptions]):i&&(this.isTreeMode()?this.buildTree():this.filteredOptions=this.searchTerm?this.filteredOptions:[...this.allOptions]),this.element.classList.toggle("ms--no-checkboxes",!this.options.isCheckboxesShown||!this.options.isMultipleEnabled),"badgesPosition"in t){this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left"));const r=this.element.querySelector(".ms__wrapper");r==null||r.classList.toggle("ms__wrapper--inline",this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")}return this.isOpen||(this.input.placeholder=this.getPlaceholderText()),"searchInputMode"in t&&(this.input.readOnly=this.options.searchInputMode==="readonly",this.input.style.display=this.options.searchInputMode==="hidden"?"none":""),"searchHint"in t&&this.hint&&(this.hint.textContent=this.options.searchHint||""),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),!0}get selectedItem(){return this.selectedOptions.size===0?null:Array.from(this.selectedOptions.values())[0]}get selectedValue(){if(!this.options.valueMember&&!this.options.getValueCallback)return null;if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const t=Array.from(this.selectedOptions.values()).map(e=>this.getItemValue(e));return this.options.isMultipleEnabled?t:t[0]??null}getValue(){if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const t=Array.from(this.selectedOptions.values()).map(e=>this.getItemValue(e));return this.options.isMultipleEnabled?t:t[0]??null}spawnTooltip(t){var r;(r=this.tooltips.get(t.id))==null||r.destroy();const e=this.element.getRootNode(),s=e instanceof ShadowRoot?e:null,i=new Ss({trigger:t.trigger,container:this.options.container??s??document.body,content:t.content,placement:t.placement??this.options.badgeTooltipPlacement??"top",offsetDistance:t.offsetDistance??this.options.badgeTooltipOffset??8,showDelay:t.showDelay??this.options.badgeTooltipDelay??100,cssClass:t.cssClass,visibleClass:t.visibleClass,followCursor:t.followCursor,onBeforeShow:t.onBeforeShow});this.tooltips.set(t.id,i)}destroyAllTooltips(){this.tooltips.forEach(t=>t.destroy()),this.tooltips.clear()}buildBadgeTooltipContent(t){if(this.options.getBadgeTooltipCallback)return this.options.getBadgeTooltipCallback(t);const e=this.getItemBadgeDisplayValue(t),s=this.getItemSubtitle(t);return s?`${e}
36
- ${s}`:e}buildRemoveButtonTooltipText(t,e){return e&&this.options.getRemoveButtonTooltipCallback?this.options.getRemoveButtonTooltipCallback(e):this.options.removeButtonTooltipText?this.options.removeButtonTooltipText.replace("{0}",t):`Remove ${t}`}attachBadgeTooltips(t){if(!this.options.isBadgeTooltipsEnabled)return;const e=!!t,s=t||this.badgesContainer,i=e?"popover-":"";if(s.querySelectorAll(".ms__badge:not(.ms__badge--more)").forEach(n=>{const a=n.querySelector(".ms__badge-remove");if(!a)return;const l=a.dataset.value,d=this.selectedOptions.get(l);if(!d)return;const c=`${i}${l}`,m=`${i}${l}-remove`,u=n.querySelector(".ms__badge-text");u&&this.spawnTooltip({id:c,trigger:u,content:this.buildBadgeTooltipContent(d)});const p=this.getItemBadgeDisplayValue(d);this.spawnTooltip({id:m,trigger:a,content:this.buildRemoveButtonTooltipText(p,d),onBeforeShow:()=>{var b;return(b=this.tooltips.get(c))==null?void 0:b.hideImmediate()}})}),!e){const n=this.badgesContainer.querySelector(".ms__badge--more"),a=n==null?void 0:n.querySelector(".ms__badge-remove");if(a&&a.dataset.action==="remove-hidden"){const l=this.options.badgesMaxVisible||3,d=this.selectedOptions.size-l;this.spawnTooltip({id:"more-badge-remove",trigger:a,content:this.buildRemoveButtonTooltipText(`${d} hidden items`)})}}}buildOptionTooltipContent(t){if(this.options.getOptionTooltipCallback)return this.options.getOptionTooltipCallback(t);const e=this.getItemDisplayValue(t),s=this.getItemSubtitle(t);return s?`${e}
37
- ${s}`:e}attachOptionTooltips(){if(this.destroyAllOptionTooltips(),!this.options.isOptionTooltipsEnabled)return;this.dropdown.querySelectorAll(".ms__option").forEach(e=>{const s=e,i=parseInt(s.dataset.index??"-1",10);if(i<0)return;const r=this.filteredOptions[i];if(!r)return;const n=this.buildOptionTooltipContent(r);n&&this.spawnTooltip({id:`option-${i}`,trigger:s,content:n,placement:this.options.optionTooltipPlacement??"top-start",offsetDistance:this.options.optionTooltipOffset??this.options.badgeTooltipOffset??8,showDelay:this.options.optionTooltipDelay??this.options.badgeTooltipDelay??100,cssClass:"ms__option-tooltip",visibleClass:"ms__option-tooltip--visible",followCursor:this.options.isOptionTooltipFollowCursor})})}destroyAllOptionTooltips(){var t;for(const e of Array.from(this.tooltips.keys()))e.startsWith("option-")&&((t=this.tooltips.get(e))==null||t.destroy(),this.tooltips.delete(e))}attachActionButtonTooltips(){this.dropdown.querySelectorAll(".ms__action-btn").forEach(e=>{var d,c;const s=e,i=s.dataset.action;if(!i)return;const r=parseInt(s.dataset.buttonIndex||"-1"),n=r>=0?(d=this.options.actionButtons)==null?void 0:d[r]:(c=this.options.actionButtons)==null?void 0:c.find(m=>m.action===i);if(!n)return;const a=n.getTooltipCallback?n.getTooltipCallback(this):n.tooltip;if(!a)return;const l=`action-${r>=0?r:i}`;this.spawnTooltip({id:l,trigger:s,content:a})})}destroyAllActionButtonTooltips(){var t;for(const e of Array.from(this.tooltips.keys()))e.startsWith("action-")&&((t=this.tooltips.get(e))==null||t.destroy(),this.tooltips.delete(e))}destroyAllBadgeTooltips(){var t;for(const e of Array.from(this.tooltips.keys()))!e.startsWith("action-")&&!e.startsWith("popover-")&&((t=this.tooltips.get(e))==null||t.destroy(),this.tooltips.delete(e))}destroy(){this.destroyAllTooltips(),this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0),this.abortInFlightSearch(),this.dropdownCleanup&&this.dropdownCleanup(),this.hintCleanup&&this.hintCleanup(),this.selectedPopoverCleanup&&this.selectedPopoverCleanup(),this.documentClickHandler&&(document.removeEventListener("click",this.documentClickHandler),this.documentClickHandler=null),this.documentKeydownHandler&&(document.removeEventListener("keydown",this.documentKeydownHandler),this.documentKeydownHandler=null),this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.dropdown&&this.dropdown.remove(),this.hint&&this.hint.remove(),this.selectedPopover&&this.selectedPopover.remove(),this.element.innerHTML="",this.element.classList.remove("ms","ms--open","ms--no-checkboxes"),le.info(`[${this.instanceId}] Component destroyed`)}}const Ds=`@layer variables,component,overrides;@layer variables{:host{display:block;--ms-rem: 10px;font-family:var(--ms-font-family, var(--base-font-family, inherit));--ms-accent-color: var(--base-accent-color, #3b82f6);--ms-accent-color-hover: var(--base-accent-color-hover, #2563eb);--ms-accent-color-active: var(--base-accent-color-active, #1d4ed8);--ms-accent-color-light: var(--base-accent-color-light, light-dark(#eff6ff, #1e3a5f));--ms-accent-color-light-hover: var(--base-accent-color-light-hover, light-dark(#e0f2fe, #264a73));--ms-text-color-1: var(--base-text-color-1, light-dark(#111827, #f5f5f5));--ms-text-color-2: var(--base-text-color-2, light-dark(#353b47, #d4d4d4));--ms-text-color-3: var(--base-text-color-3, light-dark(#6b7280, #a3a3a3));--ms-text-color-4: var(--base-text-color-4, light-dark(#a0a3a9, #737373));--ms-text-color-on-accent: var(--base-text-color-on-accent, #ffffff);--ms-text-primary: var(--ms-text-color-1);--ms-text-secondary: var(--ms-text-color-3);--ms-primary-bg: var(--base-hover-bg, color-mix(in srgb, var(--ms-text-color-1) 8%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--ms-primary-bg-hover: var(--base-active-bg, color-mix(in srgb, var(--ms-text-color-1) 14%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--ms-border-color: var(--base-border-color, light-dark(#e5e7eb, #3a3a3a));--ms-border: var(--base-border, 1px solid var(--ms-border-color));--ms-input-bg: var(--base-input-bg, light-dark(#ffffff, #1a1a1a));--ms-input-color: var(--base-input-color, var(--ms-text-color-1));--ms-input-border: var(--base-input-border, 1px solid var(--ms-border-color));--ms-input-border-hover: var(--base-input-border-hover, 1px solid var(--ms-accent-color));--ms-input-border-focus: var(--base-input-border-focus, 1px solid var(--ms-accent-color));--ms-input-placeholder-color: var(--base-input-placeholder-color, var(--ms-text-color-4));--ms-input-bg-disabled: var(--base-input-bg-disabled, rgba(107, 114, 128, .05));--ms-toggle-icon-color: var(--ms-text-color-3);--ms-toggle-icon-color-open: var(--ms-text-color-3);--ms-counter-badge-bg: var(--ms-accent-color);--ms-counter-badge-bg-hover: var(--ms-accent-color-hover);--ms-counter-badge-color: var(--ms-text-color-on-accent);--ms-hint-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-hint-color: var(--ms-text-color-4);--ms-hint-border-color: var(--ms-border-color);--ms-dropdown-bg: var(--base-dropdown-bg, var(--base-elevated-bg, light-dark(#ffffff, #1a1a1a)));--ms-dropdown-text-color: var(--ms-text-color-1);--ms-dropdown-border-color: var(--ms-border-color);--ms-dropdown-box-shadow-semantic: var(--base-dropdown-box-shadow, 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1));--ms-actions-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-actions-border-color: var(--ms-border-color);--ms-action-button-bg: transparent;--ms-action-button-bg-hover: var(--ms-primary-bg);--ms-action-button-border-color: var(--ms-border-color);--ms-action-button-border-color-hover: var(--ms-accent-color);--ms-action-button-color: var(--ms-text-color-1);--ms-group-border-color: var(--ms-border-color);--ms-option-text-color: var(--ms-text-color-1);--ms-option-bg: transparent;--ms-option-bg-hover: var(--ms-primary-bg);--ms-option-color-hover: inherit;--ms-option-bg-focused: var(--ms-primary-bg);--ms-option-color-focused: inherit;--ms-option-outline-color-focused: var(--ms-accent-color);--ms-option-bg-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-option-bg-matched: color-mix(in srgb, var(--ms-accent-color) 8%, transparent);--ms-option-color-matched: inherit;--ms-option-border-matched-color: color-mix(in srgb, var(--ms-accent-color) 40%, transparent);--ms-option-title-color: var(--ms-text-color-1);--ms-option-subtitle-color: var(--ms-text-color-3);--ms-option-mark-bg: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-option-mark-color: inherit;--ms-loading-color: var(--ms-text-color-3);--ms-badge-bg: var(--ms-accent-color-light);--ms-badge-bg-hover: var(--base-hover-bg, var(--ms-input-bg));--ms-badge-bg-active: var(--ms-accent-color-light-hover);--ms-badge-text-bg-hover: var(--base-hover-bg, var(--ms-input-bg));--ms-badge-text-color-hover: var(--ms-badge-text-color);--ms-badge-counter-border-color: var(--ms-border-color);--ms-badge-counter-text-bg: var(--ms-primary-bg-hover);--ms-badge-counter-text-color: var(--ms-text-color-1);--ms-badge-counter-remove-bg: var(--ms-text-color-3);--ms-badge-counter-remove-bg-hover: var(--ms-text-color-1);--ms-badge-counter-remove-color: var(--ms-text-color-on-accent);--ms-counter-wrapper-border-color: var(--ms-border-color);--ms-count-clear-bg-hover: var(--ms-accent-color);--ms-tooltip-bg: var(--base-tooltip-bg, var(--base-inverse-bg, light-dark(#333333, #f5f5f5)));--ms-tooltip-text-color: var(--base-tooltip-text-color, light-dark(#ffffff, #1a1a1a));--ms-selected-popover-bg: var(--base-dropdown-bg, var(--base-elevated-bg, light-dark(#ffffff, #1a1a1a)));--ms-selected-popover-border-color: var(--ms-border-color);--ms-selected-popover-header-border-color: var(--ms-border-color);--ms-selected-popover-close-bg-hover: var(--ms-accent-color);--ms-input-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-input-padding-right: calc(4 * var(--ms-rem));--ms-input-padding-h: calc(1.2 * var(--ms-rem));--ms-input-height: calc(var(--base-input-size-md-height, 3.5) * var(--ms-rem));--ms-input-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-border-width: 1px;--ms-input-border-radius: var(--ms-border-radius-md);--ms-input-text: var(--ms-text-color-1);--ms-input-bg-disabled: rgba(107, 114, 128, .05);--ms-input-size-xs-font: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-input-size-xs-padding-v: calc(.4 * var(--ms-rem));--ms-input-size-xs-padding-h: calc(.8 * var(--ms-rem));--ms-input-size-xs-height: calc(var(--base-input-size-xs-height, 3.1) * var(--ms-rem));--ms-input-size-sm-font: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-size-sm-padding-v: calc(.5 * var(--ms-rem));--ms-input-size-sm-padding-h: calc(1 * var(--ms-rem));--ms-input-size-sm-height: calc(var(--base-input-size-sm-height, 3.3) * var(--ms-rem));--ms-input-size-md-font: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-size-md-padding-v: calc(.8 * var(--ms-rem));--ms-input-size-md-padding-h: calc(1.2 * var(--ms-rem));--ms-input-size-md-height: calc(var(--base-input-size-md-height, 3.5) * var(--ms-rem));--ms-input-size-lg-font: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-input-size-lg-padding-v: calc(1 * var(--ms-rem));--ms-input-size-lg-padding-h: calc(1.4 * var(--ms-rem));--ms-input-size-lg-height: calc(var(--base-input-size-lg-height, 3.8) * var(--ms-rem));--ms-input-size-xl-font: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-input-size-xl-padding-v: calc(1.2 * var(--ms-rem));--ms-input-size-xl-padding-h: calc(1.6 * var(--ms-rem));--ms-input-size-xl-height: calc(var(--base-input-size-xl-height, 4.1) * var(--ms-rem));--ms-toggle-right: calc(1.2 * var(--ms-rem));--ms-toggle-color: var(--ms-text-color-3);--ms-transform-center-y: translateY(-50%);--ms-transform-rotate-180: 180deg;--ms-counter-offset: calc(3.2 * var(--ms-rem));--ms-counter-padding: calc(.2 * var(--ms-rem)) calc(.4 * var(--ms-rem));--ms-counter-bg: var(--ms-accent-color);--ms-counter-color: var(--ms-text-color-on-accent);--ms-counter-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-counter-font-weight: var(--base-font-weight-semibold, 600);--ms-counter-border-radius: var(--ms-border-radius-sm);--ms-counter-bg-hover: var(--ms-accent-color-hover);--ms-transform-scale-hover: 1.1;--ms-hint-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-hint-border: 1px solid var(--ms-hint-border-color);--ms-hint-border-radius: var(--ms-border-radius-lg);--ms-hint-box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ms-hint-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-dropdown-border: var(--base-dropdown-border, 1px solid var(--ms-dropdown-border-color));--ms-dropdown-border-radius: var(--ms-border-radius-lg);--ms-dropdown-box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ms-options-max-height: calc(32 * var(--ms-rem));--ms-option-color: var(--ms-text-color-1);--ms-z-index-dropdown: 9999;--ms-z-index-sticky: 1;--ms-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem));--ms-actions-border-bottom: 1px solid var(--ms-actions-border-color);--ms-action-btn-padding: calc(.4 * var(--ms-rem)) calc(.8 * var(--ms-rem));--ms-action-btn-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-action-btn-border: var(--ms-border);--ms-action-btn-border-radius: var(--ms-border-radius-sm);--ms-action-btn-bg: transparent;--ms-action-btn-color: inherit;--ms-action-btn-bg-hover: var(--ms-primary-bg);--ms-action-btn-border-color-hover: var(--ms-accent-color);--ms-transform-scale-active: .98;--ms-options-padding: 0;--ms-group-border-top: 1px solid var(--ms-group-border-color);--ms-group-margin-top: calc(.4 * var(--ms-rem));--ms-group-padding-top: calc(.4 * var(--ms-rem));--ms-group-label-padding: calc(.4 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-group-label-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-group-label-font-weight: var(--base-font-weight-semibold, 600);--ms-group-label-color: var(--ms-text-color-3);--ms-group-label-transform: uppercase;--ms-group-label-letter-spacing: .05em;--ms-option-gap: calc(.8 * var(--ms-rem));--ms-option-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-option-padding-h: calc(1.2 * var(--ms-rem));--ms-option-min-height: auto;--ms-option-outline-focused: 2px solid var(--ms-option-outline-color-focused);--ms-option-focus-outline-offset: -2px;--ms-option-border-matched: 3px solid var(--ms-option-border-matched-color);--ms-option-bg-focused-hover: var(--ms-primary-bg);--ms-option-bg-matched-hover: color-mix(in srgb, var(--ms-accent-color) 12%, transparent);--ms-option-bg-selected-focused: color-mix(in srgb, var(--ms-accent-color) 15%, transparent);--ms-option-bg-selected-matched: color-mix(in srgb, var(--ms-accent-color) 15%, transparent);--ms-option-disabled-bg: var(--base-disabled-bg, transparent);--ms-option-bg-disabled-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-disabled-opacity: .5;--ms-option-content-gap: calc(.8 * var(--ms-rem));--ms-option-icon-size: calc(2 * var(--ms-rem));--ms-option-icon-font-size: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-option-title-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-option-mark-font-weight: var(--base-font-weight-semibold, 600);--ms-option-title-white-space: normal;--ms-option-title-overflow: visible;--ms-option-title-text-overflow: clip;--ms-option-subtitle-margin-top: calc(.4 * var(--ms-rem));--ms-option-subtitle-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-option-subtitle-line-height: var(--base-line-height-tight, 1.25);--ms-checkbox-margin-top: calc(.2 * var(--ms-rem));--ms-checkbox-margin-right: 0;--ms-checkbox-margin-bottom: 0;--ms-checkbox-margin-left: 0;--ms-checkbox-size: calc(1.6 * var(--ms-rem));--ms-checkbox-scale: 1;--ms-checkbox-align: center;--ms-checkbox-bg: var(--ms-input-bg);--ms-checkbox-border-width: 1px;--ms-checkbox-border-color: var(--base-checkbox-border-color, #8f8f8f);--ms-checkbox-border: var(--ms-checkbox-border-width) solid var(--ms-checkbox-border-color);--ms-checkbox-border-radius: calc(.3 * var(--ms-rem));--ms-checkbox-checkmark-thickness: 2.5px;--ms-checkbox-checked-bg: var(--ms-accent-color);--ms-checkbox-checked-border: var(--ms-checkbox-border-width) solid var(--ms-accent-color);--ms-checkbox-checkmark-color: var(--ms-text-color-on-accent);--ms-checkbox-hover-border-color: var(--ms-accent-color);--ms-checkbox-disabled-bg: var(--ms-primary-bg);--ms-checkbox-disabled-border: var(--ms-checkbox-border-width) solid var(--ms-border-color);--ms-checkbox-checked-bg-hover: var(--ms-accent-color-hover);--ms-checkbox-checked-border-color-hover: var(--ms-accent-color-hover);--ms-state-min-height: calc(8 * var(--ms-rem));--ms-empty-padding: calc(1.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-empty-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-empty-color: var(--ms-text-color-3);--ms-loader-padding: calc(1.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-loader-gap: calc(.8 * var(--ms-rem));--ms-loading-text-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-loading-text-color: var(--ms-text-color-3);--ms-badges-gap: calc(.8 * var(--ms-rem));--ms-badges-margin-bottom: calc(.8 * var(--ms-rem));--ms-badges-margin-top: calc(.8 * var(--ms-rem));--ms-badges-margin-left: calc(.4 * var(--ms-rem));--ms-badges-margin-right: calc(.4 * var(--ms-rem));--ms-inline-align: center;--ms-badge-gap: calc(.8 * var(--ms-rem));--ms-badge-height: calc(2.7 * var(--ms-rem));--ms-badge-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-badge-font-weight: var(--base-font-weight-semibold, 600);--ms-badge-border-radius: var(--ms-border-radius-sm);--ms-order-first: -1;--ms-badge-text-padding: 0 calc(.8 * var(--ms-rem));--ms-badge-text-bg: var(--ms-accent-color-light);--ms-badge-text-color: var(--ms-accent-color);--ms-badge-text-border: none;--ms-badge-remove-width: calc(2.7 * var(--ms-rem));--ms-badge-remove-bg: var(--ms-accent-color);--ms-badge-remove-color: var(--ms-text-color-on-accent);--ms-badge-remove-border: none;--ms-badge-remove-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-badge-remove-bg-hover: var(--ms-accent-color-hover);--ms-badge-remove-box-shadow-focus: 0 0 0 2px color-mix(in srgb, var(--ms-accent-color) 50%, transparent);--ms-badge-remove-icon-size: calc(1 * var(--ms-rem));--ms-icon-remove: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 6L18 18M18 6L6 18' stroke='black' stroke-width='2.5' stroke-linecap='round' fill='none'/></svg>");--ms-badge-counter-bg: transparent;--ms-badge-counter-border: 1px solid var(--ms-badge-counter-border-color);--ms-badge-counter-border-radius: var(--ms-border-radius-sm);--ms-more-badge-bg: var(--ms-accent-color-light);--ms-more-badge-hover-bg: var(--ms-badge-bg-hover);--ms-more-badge-active-bg: var(--ms-accent-color-light-hover);--ms-count-display-margin-bottom: calc(.8 * var(--ms-rem));--ms-count-display-margin-top: calc(.8 * var(--ms-rem));--ms-count-display-margin-left: calc(.8 * var(--ms-rem));--ms-count-display-margin-right: calc(.8 * var(--ms-rem));--ms-counter-wrapper-bg: transparent;--ms-counter-wrapper-border: var(--ms-border);--ms-counter-wrapper-border-radius: var(--ms-border-radius-sm);--ms-counter-wrapper-padding: calc(.4 * var(--ms-rem)) calc(.8 * var(--ms-rem));--ms-counter-wrapper-gap: calc(.4 * var(--ms-rem));--ms-counter-wrapper-bg-hover: var(--ms-primary-bg);--ms-counter-wrapper-border-color-hover: var(--ms-accent-color);--ms-count-text-bg: transparent;--ms-count-text-border: none;--ms-count-text-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-count-text-color: var(--ms-text-color-1);--ms-count-clear-size: calc(1.6 * var(--ms-rem));--ms-count-clear-bg: transparent;--ms-count-clear-color: var(--ms-text-color-3);--ms-count-clear-font-size: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-count-clear-border-radius: var(--ms-border-radius-sm);--ms-count-clear-bg-hover: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-count-clear-color-hover: var(--ms-accent-color);--ms-count-clear-icon-size: calc(1.4 * var(--ms-rem));--ms-icon-clear: var(--ms-icon-remove);--ms-tooltip-color: var(--ms-tooltip-text-color);--ms-tooltip-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-tooltip-border-radius: var(--ms-border-radius-lg);--ms-tooltip-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-tooltip-max-width: calc(32 * var(--ms-rem));--ms-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .15);--ms-tooltip-z-index: 10000;--ms-option-tooltip-bg: var(--ms-tooltip-bg);--ms-option-tooltip-text-color: var(--ms-tooltip-text-color);--ms-option-tooltip-padding: var(--ms-tooltip-padding);--ms-option-tooltip-border-radius: var(--ms-tooltip-border-radius);--ms-option-tooltip-font-size: var(--ms-tooltip-font-size);--ms-option-tooltip-max-width: var(--ms-tooltip-max-width);--ms-option-tooltip-shadow: var(--ms-tooltip-shadow);--ms-option-tooltip-z-index: var(--ms-tooltip-z-index);--ms-z-index-popover: 10000;--ms-selected-popover-width: calc(32 * var(--ms-rem));--ms-selected-popover-max-height: calc(32 * var(--ms-rem));--ms-selected-popover-border: 1px solid var(--ms-selected-popover-border-color);--ms-selected-popover-border-radius: var(--ms-border-radius-lg);--ms-selected-popover-box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ms-selected-popover-header-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-selected-popover-header-bg: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-selected-popover-header-border-bottom: 1px solid var(--ms-selected-popover-header-border-color);--ms-selected-popover-header-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-selected-popover-header-font-weight: var(--base-font-weight-semibold, 600);--ms-selected-popover-header-color: var(--ms-text-color-1);--ms-popover-close-size: calc(2.4 * var(--ms-rem));--ms-selected-popover-close-bg: transparent;--ms-selected-popover-close-color: var(--ms-text-color-3);--ms-selected-popover-close-font-size: calc(var(--base-font-size-xl, 2) * var(--ms-rem));--ms-selected-popover-close-border-radius: var(--ms-border-radius-sm);--ms-selected-popover-close-bg-hover: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-selected-popover-close-color-hover: var(--ms-accent-color);--ms-selected-popover-close-icon-size: calc(1.4 * var(--ms-rem));--ms-selected-popover-body-gap: calc(.4 * var(--ms-rem));--ms-selected-popover-body-padding: calc(.8 * var(--ms-rem));--ms-selected-popover-body-max-height: calc(28.8 * var(--ms-rem));--ms-font-size-2xs: calc(var(--base-font-size-2xs, 1) * var(--ms-rem));--ms-font-size-xs: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-font-size-sm: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-font-size-base: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-font-size-lg: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-font-weight-normal: var(--base-font-weight-normal, 400);--ms-font-weight-medium: var(--base-font-weight-medium, 500);--ms-font-weight-semibold: var(--base-font-weight-semibold, 600);--ms-line-height-none: 1;--ms-line-height-tight: var(--base-line-height-tight, 1.25);--ms-line-height-normal: var(--base-line-height-normal, 1.5);--ms-line-height-relaxed: var(--base-line-height-relaxed, 1.75);--ms-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--ms-rem));--ms-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--ms-rem));--ms-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--ms-rem));--ms-border-radius: var(--ms-border-radius-md);--ms-spacing-xs: calc(.4 * var(--ms-rem));--ms-spacing-sm: calc(.8 * var(--ms-rem));--ms-spacing-md: calc(1.2 * var(--ms-rem));--ms-spacing-lg: calc(1.6 * var(--ms-rem));--ms-transition-fast: .15s;--ms-transition-normal: .2s;--ms-easing-snappy: cubic-bezier(.4, 0, .2, 1);--ms-placeholder-opacity: .6;--ms-disabled-input-opacity: .6;--ms-scrollbar-width: 8px;--ms-scrollbar-track-bg: transparent;--ms-scrollbar-thumb-bg: var(--ms-border-color);--ms-scrollbar-thumb-bg-hover: var(--ms-text-color-3);--ms-scrollbar-thumb-border-radius: 4px;--ms-debug-bg: var(--base-elevated-bg, light-dark(#f9fafb, #2b2b2b));--ms-debug-border-color: var(--ms-border-color);--ms-debug-text-color: var(--ms-text-color-1);--ms-debug-border-radius: var(--ms-border-radius-md);--ms-debug-summary-color: var(--ms-accent-color);--ms-debug-summary-bg-hover: var(--ms-primary-bg);--ms-debug-summary-outline-color: var(--ms-accent-color);--ms-debug-summary-border-radius: var(--ms-border-radius-sm);--ms-debug-stats-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-debug-stats-border-radius: var(--ms-border-radius-sm);--ms-debug-bullet-color: var(--ms-accent-color)}}@layer component{web-multiselect:not(:defined){display:block;min-height:calc(3.5 * var(--ms-rem));color:transparent!important;background:transparent}.ms__wrapper{display:flex;flex-direction:column;align-items:stretch}.ms__wrapper--inline{flex-direction:row;align-items:var(--ms-inline-align, center)}.ms{position:relative;width:100%}}@layer component{.ms__input-wrapper{position:relative;display:flex;align-items:center}.ms__input{box-sizing:border-box;width:100%;font-family:inherit;height:var(--ms-input-height);padding:var(--ms-input-padding);padding-right:var(--ms-input-padding-right);font-size:var(--ms-input-font-size);border:var(--ms-input-border);border-radius:var(--ms-input-border-radius);background:var(--ms-input-bg);color:var(--ms-input-color);cursor:pointer;transition:border var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__input:hover:not(:focus):not(:disabled){border:var(--ms-input-border-hover)}.ms__input:focus{outline:none;border:var(--ms-input-border-focus)}.ms__input::placeholder{color:var(--ms-input-placeholder-color);opacity:0;transition:opacity var(--ms-transition-fast) var(--ms-easing-snappy)}:host([data-ready]) .ms__input::placeholder{opacity:var(--ms-placeholder-opacity)}.ms__input.ms__input--xs{font-size:var(--ms-input-size-xs-font);padding:var(--ms-input-size-xs-padding-v) var(--ms-input-size-xs-padding-h);padding-right:calc(var(--ms-input-size-xs-padding-h) * 2.5);height:var(--ms-input-size-xs-height)}.ms__input.ms__input--sm{font-size:var(--ms-input-size-sm-font);padding:var(--ms-input-size-sm-padding-v) var(--ms-input-size-sm-padding-h);padding-right:calc(var(--ms-input-size-sm-padding-h) * 2.5);height:var(--ms-input-size-sm-height)}.ms__input.ms__input--lg{font-size:var(--ms-input-size-lg-font);padding:var(--ms-input-size-lg-padding-v) var(--ms-input-size-lg-padding-h);padding-right:calc(var(--ms-input-size-lg-padding-h) * 2.5);height:var(--ms-input-size-lg-height)}.ms__input.ms__input--xl{font-size:var(--ms-input-size-xl-font);padding:var(--ms-input-size-xl-padding-v) var(--ms-input-size-xl-padding-h);padding-right:calc(var(--ms-input-size-xl-padding-h) * 2.5);height:var(--ms-input-size-xl-height)}.ms__toggle{position:absolute;right:var(--ms-toggle-right);top:50%;transform:var(--ms-transform-center-y);pointer-events:none;color:var(--ms-toggle-icon-color);transition:transform var(--ms-transition-fast) var(--ms-easing-snappy)}.ms--open .ms__toggle{transform:var(--ms-transform-center-y) rotate(var(--ms-transform-rotate-180));color:var(--ms-toggle-icon-color-open)}.ms__counter{position:absolute;right:var(--ms-counter-offset);top:50%;transform:var(--ms-transform-center-y);padding:var(--ms-counter-padding);background:var(--ms-counter-badge-bg);color:var(--ms-counter-badge-color);font-size:var(--ms-counter-font-size);font-weight:var(--ms-counter-font-weight);border-radius:var(--ms-counter-border-radius);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__counter:hover{background:var(--ms-counter-badge-bg-hover);transform:var(--ms-transform-center-y) scale(var(--ms-transform-scale-hover))}.ms__actions{display:flex;flex-direction:column;gap:var(--ms-actions-gap);padding:var(--ms-actions-padding)}.ms__actions--top{border-bottom:var(--ms-actions-border-bottom)}.ms__actions--bottom{flex-direction:column-reverse;border-top:var(--ms-actions-border-bottom)}.ms__actions-row{display:flex;flex-wrap:nowrap;gap:var(--ms-actions-gap)}.ms__actions--wrap .ms__actions-row{flex-wrap:wrap}.ms__actions--sticky{position:sticky;z-index:var(--ms-z-index-sticky);background:var(--ms-actions-bg)}.ms__actions--sticky.ms__actions--top{top:0}.ms__actions--sticky.ms__actions--bottom{bottom:0}.ms__actions--align-stretch .ms__action-btn{flex:1}.ms__actions--align-left .ms__actions-row{justify-content:flex-start}.ms__actions--align-right .ms__actions-row{justify-content:flex-end}.ms__actions--align-center .ms__actions-row{justify-content:center}.ms__actions--align-space-between .ms__actions-row{justify-content:space-between}.ms__action-btn{font-family:inherit;padding:var(--ms-action-btn-padding);font-size:var(--ms-action-btn-font-size);border:var(--ms-action-btn-border);border-radius:var(--ms-action-btn-border-radius);background:var(--ms-action-button-bg);color:var(--ms-action-button-color);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__action-btn:hover{background:var(--ms-action-button-bg-hover);border-color:var(--ms-action-button-border-color-hover)}.ms__action-btn:active{transform:scale(var(--ms-transform-scale-active))}.ms__action-btn:disabled,.ms__action-btn[disabled]{opacity:var(--ms-disabled-opacity);cursor:not-allowed;pointer-events:none}}@layer component{.ms__hint{display:none;position:fixed;z-index:var(--ms-z-index-popover);padding:var(--ms-hint-padding);background:var(--ms-hint-bg);border:var(--ms-hint-border);border-radius:var(--ms-hint-border-radius);box-shadow:var(--ms-hint-box-shadow);font-size:var(--ms-hint-font-size);color:var(--ms-hint-color);line-height:var(--ms-line-height-relaxed);max-width:100%}.ms__hint--visible{display:block}.ms__dropdown{display:none;position:fixed;font-family:inherit;z-index:var(--ms-z-index-dropdown);background:var(--ms-dropdown-bg);border:var(--ms-dropdown-border);border-radius:var(--ms-dropdown-border-radius);box-shadow:var(--ms-dropdown-box-shadow);max-height:var(--ms-options-max-height);overflow:hidden;color:var(--ms-dropdown-text-color)}.ms__dropdown--visible{display:flex;flex-direction:column}.ms__dropdown-inner{flex:1;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__dropdown-inner::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__dropdown-inner::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__dropdown-inner::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__dropdown-inner::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__dropdown--virtual{max-height:none}.ms__dropdown--virtual .ms__dropdown-inner{overflow-y:visible}.ms__badge-tooltip{position:fixed;z-index:var(--ms-tooltip-z-index);opacity:0;visibility:hidden;transition:opacity var(--ms-transition-normal) ease,visibility var(--ms-transition-normal) ease;background:var(--ms-tooltip-bg);color:var(--ms-tooltip-text-color);padding:var(--ms-tooltip-padding);border-radius:var(--ms-tooltip-border-radius);font-size:var(--ms-tooltip-font-size);line-height:var(--ms-line-height-relaxed);max-width:var(--ms-tooltip-max-width);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ms-tooltip-shadow);pointer-events:none}.ms__badge-tooltip--visible{opacity:1;visibility:visible}.ms__option-tooltip{position:fixed;z-index:var(--ms-option-tooltip-z-index);opacity:0;visibility:hidden;transition:opacity var(--ms-transition-normal) ease,visibility var(--ms-transition-normal) ease;background:var(--ms-option-tooltip-bg);color:var(--ms-option-tooltip-text-color);padding:var(--ms-option-tooltip-padding);border-radius:var(--ms-option-tooltip-border-radius);font-size:var(--ms-option-tooltip-font-size);line-height:var(--ms-line-height-relaxed);max-width:var(--ms-option-tooltip-max-width);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ms-option-tooltip-shadow);pointer-events:none}.ms__option-tooltip--visible{opacity:1;visibility:visible}.ms__selected-popover{display:none;position:fixed;z-index:var(--ms-z-index-popover);background:var(--ms-selected-popover-bg);border:var(--ms-selected-popover-border);border-radius:var(--ms-selected-popover-border-radius);box-shadow:var(--ms-selected-popover-box-shadow);width:var(--ms-selected-popover-width);max-height:var(--ms-selected-popover-max-height);overflow:hidden}.ms__selected-popover--visible{display:flex;flex-direction:column}.ms__selected-popover--virtual{display:block;overflow:visible;max-height:none}.ms__selected-popover-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ms-selected-popover-header-padding);background:var(--ms-selected-popover-header-bg);border-bottom:var(--ms-selected-popover-header-border-bottom);font-size:var(--ms-selected-popover-header-font-size);font-weight:var(--ms-selected-popover-header-font-weight);color:var(--ms-selected-popover-header-color)}.ms__selected-popover-close{display:flex;align-items:center;justify-content:center;width:var(--ms-popover-close-size);height:var(--ms-popover-close-size);padding:0;border:none;background:var(--ms-selected-popover-close-bg);color:var(--ms-selected-popover-close-color);font-size:var(--ms-selected-popover-close-font-size);line-height:var(--ms-line-height-none);cursor:pointer;border-radius:var(--ms-selected-popover-close-border-radius);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__selected-popover-close:hover{background:var(--ms-selected-popover-close-bg-hover);color:var(--ms-selected-popover-close-color-hover)}.ms__selected-popover-close:before{content:"";display:block;width:var(--ms-selected-popover-close-icon-size);height:var(--ms-selected-popover-close-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__selected-popover-body{display:flex;flex-direction:column;gap:var(--ms-selected-popover-body-gap);padding:var(--ms-selected-popover-body-padding);overflow-y:auto;max-height:var(--ms-selected-popover-body-max-height);scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__selected-popover-body::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__selected-popover-body::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__selected-popover-body::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__selected-popover-body::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__selected-popover-body .ms__badge{width:100%;min-height:fit-content;line-height:var(--ms-line-height-relaxed)}.ms__selected-popover-body .ms__badge-text{flex:1;min-width:0;white-space:normal;word-wrap:break-word}.ms__selected-popover-body--virtual{display:block;max-height:none;padding:0}.ms__selected-popover-body--virtual .ms__badge{height:var(--ms-badge-height-virtual, 36px);min-height:var(--ms-badge-height-virtual, 36px);max-height:var(--ms-badge-height-virtual, 36px);margin-bottom:var(--ms-selected-popover-body-gap);overflow:hidden;box-sizing:border-box}.ms__selected-popover-body--virtual .ms__badge-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}@layer component{.ms--disabled .ms__input{opacity:var(--ms-disabled-input-opacity);cursor:not-allowed;background:var(--ms-input-bg-disabled)}.ms--disabled .ms__toggle{opacity:var(--ms-disabled-input-opacity)}.ms--no-checkboxes .ms__option{gap:0;padding-left:var(--ms-option-padding-h)}.ms--no-checkboxes .ms__option-content{padding-left:0}}@layer component;@layer component{.ms__badges{display:flex;flex-wrap:wrap;gap:var(--ms-badges-gap);padding:0}.ms__badges:empty{display:none}.ms__badges--bottom{margin-top:var(--ms-badges-margin-bottom)}.ms__badges--top{margin-bottom:var(--ms-badges-margin-top);order:var(--ms-order-first)}.ms__badges--left{order:var(--ms-order-first);margin-right:var(--ms-badges-margin-left);justify-content:flex-end}.ms__badges--right{margin-left:var(--ms-badges-margin-right);justify-content:flex-start}.ms__badge{display:inline-flex;align-items:center;height:var(--ms-badge-height);font-size:var(--ms-badge-font-size);font-weight:var(--ms-badge-font-weight);line-height:var(--ms-line-height-none);border-radius:var(--ms-badge-border-radius);overflow:hidden;max-width:100%}.ms__badge-text{display:flex;align-items:center;box-sizing:border-box;height:100%;padding:var(--ms-badge-text-padding);background:var(--ms-badge-text-bg);color:var(--ms-badge-text-color);border:var(--ms-badge-text-border);border-right:none;border-radius:var(--ms-badge-border-radius) 0 0 var(--ms-badge-border-radius);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:background-color var(--ms-transition-normal) ease,color var(--ms-transition-normal) ease}.ms__badge:hover .ms__badge-text{background:var(--ms-badge-text-bg-hover, var(--ms-badge-text-bg));color:var(--ms-badge-text-color-hover, var(--ms-badge-text-color))}.ms__badge-remove{display:flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:inherit;width:var(--ms-badge-remove-width);height:100%;flex-shrink:0;background:var(--ms-badge-remove-bg);color:var(--ms-badge-remove-color);border:var(--ms-badge-remove-border);border-left:none;border-radius:0 var(--ms-badge-border-radius) var(--ms-badge-border-radius) 0;cursor:pointer;transition:background-color var(--ms-transition-normal) ease;font-size:var(--ms-badge-remove-font-size)}.ms__badge-remove:hover{background:var(--ms-badge-remove-bg-hover)}.ms__badge-remove:focus{outline:none}.ms__badge-remove:focus-visible{outline:none;box-shadow:var(--ms-badge-remove-box-shadow-focus)}.ms__badge-remove:before{content:"";display:block;width:var(--ms-badge-remove-icon-size);height:var(--ms-badge-remove-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__badge--counter{cursor:pointer}.ms__badge--counter .ms__badge-text{background:var(--ms-badge-counter-text-bg);color:var(--ms-badge-counter-text-color);border:var(--ms-badge-counter-border);border-right:none}.ms__badge--counter .ms__badge-remove{background:var(--ms-badge-counter-remove-bg);color:var(--ms-badge-counter-remove-color);border:var(--ms-badge-counter-border);border-left:none}.ms__badge--counter .ms__badge-remove:hover{background:var(--ms-badge-counter-remove-bg-hover)}.ms__badge--more,.ms__badge[data-action=show-selected]{cursor:pointer}}@layer component{.ms__count-display{display:flex;align-items:center}.ms__count-display:empty{display:none}.ms__count-display--bottom{margin-top:var(--ms-count-display-margin-bottom)}.ms__count-display--top{margin-bottom:var(--ms-count-display-margin-top);order:var(--ms-order-first)}.ms__count-display--left{order:var(--ms-order-first);margin-right:var(--ms-count-display-margin-left);justify-content:flex-start}.ms__count-display--right{margin-left:var(--ms-count-display-margin-right);justify-content:flex-end}.ms__counter-wrapper{display:inline-flex;align-items:center;gap:var(--ms-counter-wrapper-gap);background:var(--ms-counter-wrapper-bg);border:var(--ms-counter-wrapper-border);border-radius:var(--ms-counter-wrapper-border-radius);padding:var(--ms-counter-wrapper-padding);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__counter-wrapper:hover{background:var(--ms-counter-wrapper-bg-hover);border-color:var(--ms-counter-wrapper-border-color-hover)}.ms__count-text{display:inline-flex;align-items:center;background:var(--ms-count-text-bg);border:var(--ms-count-text-border);padding:0;font-size:var(--ms-count-text-font-size);color:var(--ms-count-text-color);cursor:pointer;transition:color var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__count-clear{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:var(--ms-count-clear-size);height:var(--ms-count-clear-size);padding:0;border:none;background:var(--ms-count-clear-bg);color:var(--ms-count-clear-color);font-size:var(--ms-count-clear-font-size);line-height:var(--ms-line-height-none);cursor:pointer;border-radius:var(--ms-count-clear-border-radius);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__count-clear:hover{background:var(--ms-count-clear-bg-hover);color:var(--ms-count-clear-color-hover)}.ms__count-clear:before{content:"";display:block;width:var(--ms-count-clear-icon-size);height:var(--ms-count-clear-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-clear) center / contain no-repeat;mask:var(--ms-icon-clear) center / contain no-repeat}}@layer component{.ms__debug-info{margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:var(--ms-debug-bg);border:1px solid var(--ms-debug-border-color);border-radius:var(--ms-debug-border-radius);font-size:calc(1.2 * var(--ms-rem));color:var(--ms-debug-text-color)}.ms__debug-info details summary{cursor:pointer;font-weight:600;color:var(--ms-debug-summary-color);-webkit-user-select:none;user-select:none;padding:calc(.4 * var(--ms-rem));border-radius:var(--ms-debug-summary-border-radius)}.ms__debug-info details summary:hover{background-color:var(--ms-debug-summary-bg-hover)}.ms__debug-info details summary:focus{outline:2px solid var(--ms-debug-summary-outline-color);outline-offset:2px}.ms__debug-info .ms__debug-stats{display:flex;flex-direction:column;gap:calc(.4 * var(--ms-rem));margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:var(--ms-debug-stats-bg);border-radius:var(--ms-debug-stats-border-radius)}.ms__debug-info .ms__debug-stats span{display:flex;justify-content:space-between;padding:2px 4px;font-family:monospace;font-size:calc(1 * var(--ms-rem))}.ms__debug-info .ms__debug-stats span:before{content:"•";margin-right:calc(.4 * var(--ms-rem));color:var(--ms-debug-bullet-color)}}@layer component{.ms__options{padding:var(--ms-options-padding);scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__options::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__options::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__options::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__options::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__options--virtual .ms__option,.ms__options--fixed-height .ms__option{height:var(--ms-option-height, 50px);min-height:var(--ms-option-height, 50px);max-height:var(--ms-option-height, 50px);overflow:hidden;box-sizing:border-box}.ms__group+.ms__group{border-top:var(--ms-group-border-top);margin-top:var(--ms-group-margin-top);padding-top:var(--ms-group-padding-top)}.ms__group-label{padding:var(--ms-group-label-padding);font-size:var(--ms-group-label-font-size);font-weight:var(--ms-group-label-font-weight);color:var(--ms-group-label-color);text-transform:var(--ms-group-label-transform);letter-spacing:var(--ms-group-label-letter-spacing)}.ms__option{display:flex;align-items:var(--ms-checkbox-align, center);gap:var(--ms-option-gap);padding:var(--ms-option-padding);min-height:var(--ms-option-min-height, auto);color:var(--ms-option-text-color);background:var(--ms-option-bg);cursor:pointer}.ms__option:hover{background:var(--ms-option-bg-hover);color:var(--ms-option-color-hover, inherit)}.ms__option--focused{background:var(--ms-option-bg-focused);color:var(--ms-option-color-focused, inherit);outline:var(--ms-option-outline-focused);outline-offset:var(--ms-option-focus-outline-offset)}.ms__option--matched{background:var(--ms-option-bg-matched);color:var(--ms-option-color-matched, inherit);border-left:var(--ms-option-border-matched)}.ms__option--selected{background:var(--ms-option-bg-selected)}.ms__option--selected:hover{background:var(--ms-option-bg-selected-hover, var(--ms-option-bg-selected))}.ms__option--disabled{opacity:var(--ms-disabled-opacity);cursor:not-allowed;background:var(--ms-option-disabled-bg)}.ms__option--disabled:hover{background:var(--ms-option-disabled-bg)}.ms__option--focused:hover{background:var(--ms-option-bg-focused-hover);color:var(--ms-option-color-focused-hover, var(--ms-option-color-focused, var(--ms-option-text-color)))}.ms__option--matched:hover{background:var(--ms-option-bg-matched-hover);color:var(--ms-option-color-matched-hover, var(--ms-option-color-matched, var(--ms-option-text-color)))}.ms__option--selected.ms__option--focused{background:var(--ms-option-bg-selected-focused);outline:var(--ms-option-outline-focused);outline-offset:var(--ms-option-focus-outline-offset)}.ms__option--selected.ms__option--matched{background:var(--ms-option-bg-selected-matched);border-left:var(--ms-option-border-matched)}.ms__option--disabled.ms__option--selected{background:var(--ms-option-bg-disabled-selected)}.ms__option--disabled.ms__option--focused{outline:none}.ms__option[data-checkbox-align=top]{--ms-checkbox-align: flex-start}.ms__option[data-checkbox-align=bottom]{--ms-checkbox-align: flex-end}.ms__checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;flex-shrink:0;position:relative;margin-top:var(--ms-checkbox-margin-top);margin-right:var(--ms-checkbox-margin-right);margin-bottom:var(--ms-checkbox-margin-bottom);margin-left:var(--ms-checkbox-margin-left);width:var(--ms-checkbox-size);height:var(--ms-checkbox-size);transform:scale(var(--ms-checkbox-scale));transform-origin:top left;cursor:pointer;background:var(--ms-checkbox-bg);border:var(--ms-checkbox-border);border-radius:var(--ms-checkbox-border-radius);transition:background-color .15s ease,border-color .15s ease}.ms__checkbox:after{content:"";position:absolute;display:none;left:50%;top:40%;width:30%;height:55%;transform:translate(-50%,-50%) rotate(45deg);border:solid var(--ms-checkbox-checkmark-color);border-width:0 var(--ms-checkbox-checkmark-thickness, 2px) var(--ms-checkbox-checkmark-thickness, 2px) 0}.ms__checkbox:hover:not(:disabled){border-color:var(--ms-checkbox-hover-border-color)}.ms__checkbox:checked{background:var(--ms-checkbox-checked-bg);border:var(--ms-checkbox-checked-border)}.ms__checkbox:checked:after{display:block}.ms__checkbox--indeterminate{background:var(--ms-checkbox-checked-bg);border:var(--ms-checkbox-checked-border)}.ms__checkbox--indeterminate:after{display:block;top:50%;left:50%;width:55%;height:0;transform:translate(-50%,-50%);border:none;border-bottom:var(--ms-checkbox-checkmark-thickness, 2px) solid var(--ms-checkbox-checkmark-color)}.ms__checkbox--indeterminate:hover:not(:disabled){background:var(--ms-checkbox-checked-bg-hover);border-color:var(--ms-checkbox-checked-border-color-hover)}.ms__checkbox:checked:hover:not(:disabled){background:var(--ms-checkbox-checked-bg-hover);border-color:var(--ms-checkbox-checked-border-color-hover)}.ms__checkbox:focus-visible{outline:2px solid var(--ms-checkbox-checked-bg);outline-offset:2px}.ms__checkbox:disabled{cursor:not-allowed;background:var(--ms-checkbox-disabled-bg);border:var(--ms-checkbox-disabled-border);opacity:.6}.ms__checkbox:disabled:checked{background:var(--ms-checkbox-disabled-bg)}.ms__option--disabled .ms__checkbox{cursor:not-allowed}.ms__option-content{flex:1;display:flex;align-items:center;gap:var(--ms-option-content-gap);min-width:0}.ms__option-icon{flex-shrink:0;width:var(--ms-option-icon-size);height:var(--ms-option-icon-size);display:flex;align-items:center;justify-content:center;font-size:var(--ms-option-icon-font-size)}.ms__option-icon svg{width:100%;height:100%;fill:currentColor}.ms__option-text{flex:1;min-width:0}.ms__option-title{font-size:var(--ms-option-title-font-size);color:var(--ms-option-title-color);line-height:var(--ms-line-height-relaxed);white-space:var(--ms-option-title-white-space, normal);overflow:var(--ms-option-title-overflow, visible);text-overflow:var(--ms-option-title-text-overflow, clip)}.ms__option:hover .ms__option-title{color:var(--ms-option-title-color-hover, var(--ms-option-title-color))}.ms__option--selected .ms__option-title{color:var(--ms-option-title-color-selected, var(--ms-option-title-color))}.ms__option--selected:hover .ms__option-title{color:var(--ms-option-title-color-selected-hover, var(--ms-option-title-color-selected, var(--ms-option-title-color)))}.ms__option-title mark{background:var(--ms-option-mark-bg);color:var(--ms-option-mark-color);font-weight:var(--ms-option-mark-font-weight)}.ms__option-subtitle{margin-top:var(--ms-option-subtitle-margin-top);font-size:var(--ms-option-subtitle-font-size);color:var(--ms-option-subtitle-color);line-height:var(--ms-option-subtitle-line-height)}.ms__option:hover .ms__option-subtitle{color:var(--ms-option-subtitle-color-hover, var(--ms-option-subtitle-color))}.ms__option--selected .ms__option-subtitle{color:var(--ms-option-subtitle-color-selected, var(--ms-option-subtitle-color))}.ms__option--selected:hover .ms__option-subtitle{color:var(--ms-option-subtitle-color-selected-hover, var(--ms-option-subtitle-color-selected, var(--ms-option-subtitle-color)))}.ms__empty{display:flex;align-items:center;justify-content:center;min-height:var(--ms-state-min-height);padding:var(--ms-empty-padding);text-align:center;font-size:var(--ms-empty-font-size);color:var(--ms-empty-color)}.ms__loader{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:var(--ms-state-min-height);padding:var(--ms-loader-padding);gap:var(--ms-loader-gap)}.ms__loading-text{font-size:var(--ms-loading-text-font-size);color:var(--ms-loading-color)}}@layer component{.ms--rtl .ms__input-wrapper{direction:rtl}.ms--rtl .ms__input{text-align:right;padding-left:var(--ms-input-padding-right);padding-right:var(--ms-input-padding-h)}.ms--rtl .ms__toggle{left:var(--ms-toggle-right)!important;right:auto!important}.ms--rtl .ms__counter{left:var(--ms-counter-offset)!important;right:auto!important}.ms--rtl .ms__dropdown{direction:rtl;text-align:right}.ms--rtl .ms__option{flex-direction:row-reverse}.ms--rtl .ms__checkbox{margin-left:var(--ms-spacing-sm);margin-right:0}.ms--rtl .ms__option-content{text-align:right}.ms--rtl .ms__option-icon{margin-left:var(--ms-spacing-xs);margin-right:0}.ms--rtl .ms__badges{direction:rtl}.ms--rtl .ms__badges--right{margin-left:0;margin-right:var(--ms-badges-margin-right)}.ms--rtl .ms__badges--left{margin-right:0;margin-left:var(--ms-badges-margin-left)}.ms--rtl .ms__badge{flex-direction:row-reverse}.ms--rtl .ms__badge-remove{border-radius:var(--ms-badge-border-radius) 0 0 var(--ms-badge-border-radius);border-left:var(--ms-badge-remove-border);border-right:none}.ms--rtl .ms__badge-text{border-radius:0 var(--ms-badge-border-radius) var(--ms-badge-border-radius) 0;border-right:var(--ms-badge-text-border);border-left:none}.ms--rtl .ms__count-display{direction:rtl}.ms--rtl .ms__count-display--right{margin-left:0;margin-right:var(--ms-count-display-margin-right)}.ms--rtl .ms__count-display--left{margin-right:0;margin-left:var(--ms-count-display-margin-left)}.ms--rtl .ms__counter-wrapper{flex-direction:row-reverse}.ms--rtl .ms__selected-popover{direction:rtl;text-align:right}.ms--rtl .ms__actions{direction:rtl}.ms--rtl .ms__group-label,.ms--rtl .ms__empty{text-align:right}.ms--rtl .ms__hint{direction:rtl;text-align:right}}@layer component{.ms__option--tree{padding-inline-start:calc(var(--ms-tree-base-indent, .75rem) + var(--ms-tree-depth, 0) * var(--ms-tree-indent, 1.25rem))}.ms__option--tree-unselectable{cursor:default}.ms__option--tree-unselectable:hover{background:transparent}}@layer overrides{:host-context([data-theme="dark"]),:host-context([data-bs-theme="dark"]),:host-context(.dark){color-scheme:dark}:host-context([data-theme="light"]),:host-context([data-bs-theme="light"]),:host-context(.light){color-scheme:light}:host([data-theme="dark"]){color-scheme:dark}:host([data-theme="light"]){color-scheme:light}}`,zs=typeof HTMLElement<"u"?HTMLElement:class{},ze=[{attr:"search-hint",key:"searchHint",parser:"string-or-undefined"},{attr:"search-placeholder",key:"searchPlaceholder",parser:"string",default:"Search..."},{attr:"select-placeholder",key:"selectPlaceholder",parser:"string",default:"Pick an option..."},{attr:"no-data-placeholder",key:"noDataPlaceholder",parser:"string-or-undefined"},{attr:"dropdown-min-width",key:"dropdownMinWidth",parser:"string-or-undefined"},{attr:"dropdown-max-width",key:"dropdownMaxWidth",parser:"string-or-undefined"},{attr:"max-height",key:"maxHeight",parser:"string",default:"20rem"},{attr:"empty-message",key:"emptyMessage",parser:"string",default:"No results found"},{attr:"loading-message",key:"loadingMessage",parser:"string",default:"Loading..."},{attr:"remove-button-tooltip-text",key:"removeButtonTooltipText",parser:"string-or-undefined"},{attr:"name",key:"formFieldId",parser:"string-or-undefined"},{attr:"value-member",key:"valueMember",parser:"string-or-undefined"},{attr:"display-value-member",key:"displayValueMember",parser:"string-or-undefined"},{attr:"search-value-member",key:"searchValueMember",parser:"string-or-undefined"},{attr:"icon-member",key:"iconMember",parser:"string-or-undefined"},{attr:"subtitle-member",key:"subtitleMember",parser:"string-or-undefined"},{attr:"full-title-member",key:"fullTitleMember",parser:"string-or-undefined"},{attr:"group-member",key:"groupMember",parser:"string-or-undefined"},{attr:"disabled-member",key:"disabledMember",parser:"string-or-undefined"},{attr:"path-member",key:"pathMember",parser:"string-or-undefined"},{attr:"parent-path-member",key:"parentPathMember",parser:"string-or-undefined"},{attr:"level-member",key:"levelMember",parser:"string-or-undefined"},{attr:"has-children-member",key:"hasChildrenMember",parser:"string-or-undefined"},{attr:"is-selectable-member",key:"isSelectableMember",parser:"string-or-undefined"},{attr:"tree-path-separator",key:"treePathSeparator",parser:"string",default:"."},{attr:"checkbox-mode",key:"checkboxMode",parser:"enum",enumValues:["independent","cascade"],default:"independent"},{attr:"cascade-select-policy",key:"cascadeSelectPolicy",parser:"enum",enumValues:["rolled-up","leaves","all"],default:"rolled-up"},{attr:"badges-display-mode",key:"badgesDisplayMode",parser:"enum",enumValues:["badges","count","compact","partial","none"],default:"badges"},{attr:"badges-position",key:"badgesPosition",parser:"enum",enumValues:["top","bottom","left","right"],default:"bottom"},{attr:"badges-threshold-mode",key:"badgesThresholdMode",parser:"enum",enumValues:["count","partial"],default:"count"},{attr:"search-input-mode",key:"searchInputMode",parser:"enum",enumValues:["normal","readonly","hidden"],default:"normal"},{attr:"search-mode",key:"searchMode",parser:"enum",enumValues:["filter","navigate"],default:"filter"},{attr:"actions-layout",key:"actionsLayout",parser:"enum",enumValues:["nowrap","wrap"],default:"nowrap"},{attr:"actions-position",key:"actionsPosition",parser:"enum",enumValues:["top","bottom"],default:"top"},{attr:"actions-align",key:"actionsAlign",parser:"enum",enumValues:["stretch","left","right","center","space-between"],default:"stretch"},{attr:"checkbox-align",key:"checkboxAlign",parser:"enum",enumValues:["top","center","bottom"],default:"center"},{attr:"value-format",key:"valueFormat",parser:"enum",enumValues:["json","csv","array"],default:"json"},{attr:"badge-tooltip-placement",key:"badgeTooltipPlacement",parser:"enum",enumValues:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],default:"top"},{attr:"option-tooltip-placement",key:"optionTooltipPlacement",parser:"enum",enumValues:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],default:"top-start"},{attr:"badges-threshold",key:"badgesThreshold",parser:"int"},{attr:"badges-max-visible",key:"badgesMaxVisible",parser:"int"},{attr:"min-search-length",key:"minSearchLength",parser:"int",default:0},{attr:"search-debounce",key:"searchDebounce",parser:"int",default:0},{attr:"virtual-scroll-threshold",key:"virtualScrollThreshold",parser:"int",default:100},{attr:"option-height",key:"optionHeight",parser:"int",default:50},{attr:"badge-height",key:"badgeHeight",parser:"int",default:36},{attr:"virtual-scroll-buffer",key:"virtualScrollBuffer",parser:"int",default:10},{attr:"badge-tooltip-delay",key:"badgeTooltipDelay",parser:"int",default:100},{attr:"badge-tooltip-offset",key:"badgeTooltipOffset",parser:"int",default:8},{attr:"option-tooltip-delay",key:"optionTooltipDelay",parser:"int"},{attr:"option-tooltip-offset",key:"optionTooltipOffset",parser:"int"},{attr:"multiple",key:"isMultipleEnabled",parser:"bool-default-true"},{attr:"allow-groups",key:"isGroupsAllowed",parser:"bool-default-true"},{attr:"show-checkboxes",key:"isCheckboxesShown",parser:"bool-default-true"},{attr:"sticky-actions",key:"isActionsSticky",parser:"bool-default-true"},{attr:"lock-placement",key:"isPlacementLocked",parser:"bool-default-true"},{attr:"enable-search",key:"isSearchEnabled",parser:"bool-default-true"},{attr:"keep-options-on-search",key:"isKeepOptionsOnSearch",parser:"bool-default-true"},{attr:"should-keep-search-on-close",key:"shouldKeepSearchOnClose",parser:"bool-default-true"},{attr:"close-on-select",key:"isCloseOnSelect",parser:"bool-default-false"},{attr:"allow-add-new",key:"isAddNewAllowed",parser:"bool-default-false"},{attr:"show-counter",key:"isCounterShown",parser:"bool-default-false"},{attr:"show-badge-full-title",key:"isBadgeFullTitleShown",parser:"bool-default-false"},{attr:"enable-virtual-scroll",key:"isVirtualScrollEnabled",parser:"bool-default-false"},{attr:"enable-badge-tooltips",key:"isBadgeTooltipsEnabled",parser:"bool-default-false"},{attr:"enable-option-tooltips",key:"isOptionTooltipsEnabled",parser:"bool-default-false"},{attr:"option-tooltip-follow-cursor",key:"isOptionTooltipFollowCursor",parser:"bool-default-false"}],Bs=new Map(ze.map(o=>[o.attr,o])),yt=[{key:"valueMember",field:"_valueMember"},{key:"displayValueMember",field:"_displayValueMember"},{key:"searchValueMember",field:"_searchValueMember"},{key:"iconMember",field:"_iconMember"},{key:"subtitleMember",field:"_subtitleMember"},{key:"groupMember",field:"_groupMember"},{key:"disabledMember",field:"_disabledMember"}],$s=[{key:"valueMember",member:"value"},{key:"displayValueMember",member:"label"},{key:"groupMember",member:"group"},{key:"iconMember",member:"icon"},{key:"subtitleMember",member:"subtitle"},{key:"disabledMember",member:"disabled"}];function wt(o,t){if(t===null||t==="")switch(o.parser){case"bool-default-true":return!0;case"bool-default-false":return!1;default:return o.default}switch(o.parser){case"string":case"string-or-undefined":return t;case"enum":return o.enumValues.includes(t)?t:o.default;case"int":{const e=parseInt(t);return isNaN(e)?o.default:e}case"bool-default-true":return t!=="false";case"bool-default-false":return t==="true"}}const Be=new Set;function xt(){return Array.from(Be)}class we extends zs{constructor(){super();h(this,"picker");h(this,"containerElement");h(this,"shadow");h(this,"internals");h(this,"_options");h(this,"_hasDeclarativeOptions",!1);h(this,"_valueMember");h(this,"_getValueCallback");h(this,"_displayValueMember");h(this,"_getDisplayValueCallback");h(this,"_getBadgeDisplayCallback");h(this,"_getBadgeClassCallback");h(this,"_customStylesCallback");h(this,"_searchValueMember");h(this,"_getSearchValueCallback");h(this,"_iconMember");h(this,"_getIconCallback");h(this,"_subtitleMember");h(this,"_getSubtitleCallback");h(this,"_getFullTitleCallback");h(this,"_groupMember");h(this,"_getGroupCallback");h(this,"_renderGroupLabelContentCallback");h(this,"_disabledMember");h(this,"_getDisabledCallback");h(this,"_getPathCallback");h(this,"_isTreeEnabled");h(this,"_getIsSelectableCallback");h(this,"_getValueFormatCallback");h(this,"_getBadgeTooltipCallback");h(this,"_getOptionTooltipCallback");h(this,"_getRemoveButtonTooltipCallback");h(this,"_renderOptionContentCallback");h(this,"_renderBadgeContentCallback");h(this,"_renderSelectedItemContentCallback");h(this,"_getSelectedItemClassCallback");h(this,"_renderSelectedContentCallback");h(this,"_getCounterCallback");h(this,"_actionButtons");h(this,"_batchDepth",0);h(this,"_batchPartial",{});h(this,"_batchNeedsReinit",!1);h(this,"_beforeSearchCallback");h(this,"_beforeSelectCallback");h(this,"_beforeDeselectCallback");h(this,"_searchCallback");h(this,"_addNewCallback");h(this,"_onSelect");h(this,"_onDeselect");h(this,"_onChange");h(this,"_declarativeSelectedValues");if(this.shadow=this.attachShadow({mode:"open"}),typeof this.attachInternals=="function")try{this.internals=this.attachInternals()}catch{}const e=document.createElement("style");e.textContent=Ds,this.shadow.appendChild(e),requestAnimationFrame(()=>{this.setAttribute("data-ready","")})}static get observedAttributes(){return[...ze.map(e=>e.attr),"initial-values","show-debug-info"]}formResetCallback(){var e;(e=this.picker)==null||e.clearAll()}connectedCallback(){Be.add(this),this.render();const e=this.parseDeclarativeOptions();e&&(this._options&&this._options.length>0&&A.warn("[MultiSelectElement] Both declarative <option> elements and programmatic .options detected. Using declarative options."),this._options=e,this._hasDeclarativeOptions=!0),this.initializePicker()}disconnectedCallback(){Be.delete(this),this.picker&&this.picker.destroy()}attributeChangedCallback(e,s,i){var n;if(s===i||!this.picker||e==="initial-values")return;if(e==="show-debug-info"){const a=this.shadow.querySelector(".ms__debug-info");a&&a.remove(),i==="true"&&this.renderDebugInfo();return}const r=Bs.get(e);if(r){const a=wt(r,i),l=(n=yt.find(u=>u.key===r.key))==null?void 0:n.field,d=a===void 0&&l?this[l]:a;if(this._batchDepth>0){this._batchPartial[r.key]=d;return}const c={[r.key]:d};if(this.picker.updateOptions(c))return}if(this._batchDepth>0){this._batchNeedsReinit=!0;return}this.reinitialize()}setAttributes(e){this._batchDepth++;try{for(const[r,n]of Object.entries(e))n==null||n===!1?this.removeAttribute(r):this.setAttribute(r,n===!0?"":String(n))}finally{this._batchDepth--}if(this._batchDepth>0)return;const s=this._batchPartial,i=this._batchNeedsReinit;if(this._batchPartial={},this._batchNeedsReinit=!1,!!this.picker){if(i){this.reinitialize();return}Object.keys(s).length>0&&(this.picker.updateOptions(s)||this.reinitialize())}}render(){this.containerElement=document.createElement("div"),this.containerElement.setAttribute("data-multiselect",""),this.className&&(this.containerElement.className=this.className),this.shadow.appendChild(this.containerElement),this.getAttribute("show-debug-info")==="true"&&this.renderDebugInfo()}renderDebugInfo(){const e=this.shadow.querySelector(".ms__debug-info");e&&e.remove();const s=document.createElement("div");s.className="ms__debug-info";const i=document.createElement("details"),r=document.createElement("summary");r.textContent="Debug Info";const n=document.createElement("div");n.className="ms__debug-stats",i.appendChild(r),i.appendChild(n),s.appendChild(i),this.shadow.appendChild(s),this.updateDebugInfo()}updateDebugInfo(){var p,b;const e=this.shadow.querySelector(".ms__debug-stats");if(!e||!this.picker)return;const s="1.12.0-rc06",i=xt().length,n=this.picker.getSelected().length,a=((p=this._options)==null?void 0:p.length)||0,l=this.picker,d=l.isOpen||!1,c=l.searchTerm||"",m=l.isLoading||!1,u=((b=l.filteredOptions)==null?void 0:b.length)||0;e.innerHTML=`
35
+ `}handleSelectedPopoverClick(t){if(t.stopPropagation(),t.target.closest(".ms__selected-popover-close")){t.preventDefault(),this.hideSelectedPopover();return}const s=t.target.closest(".ms__badge-remove");if(s){t.preventDefault();const i=s.dataset.value,r=this.selectedOptions.get(i);r&&this.interactiveDeselect(r)&&(this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.selectedPopoverCleanup=this.anchorFloatingPanel(this.selectedPopover,{getPlacement:()=>this.selectedPopoverPlacement,setPlacement:t=>{this.selectedPopoverPlacement=t,H.debug(`[${this.instanceId}] Locked popover placement:`,t)}})}updateHiddenInput(){if(!this.options.formFieldId)return;this.hiddenInputs.forEach(i=>i.remove()),this.hiddenInputs=[];const t=this.options.valueFormat||"json",e=Array.from(this.selectedOptions.values()).map(i=>this.getItemValue(i)),s=this.options.hostElement||this.element;if(t==="array")e.forEach(i=>{const r=document.createElement("input");r.type="hidden",r.name=`${this.options.formFieldId}[]`,r.value=String(i),s.appendChild(r),this.hiddenInputs.push(r)});else{const i=document.createElement("input");i.type="hidden",i.name=this.options.formFieldId,i.id=this.options.formFieldId,i.value=this.getFormValue(),s.appendChild(i),this.hiddenInputs.push(i)}}getFormValue(){const t=Array.from(this.selectedOptions.values()).map(s=>this.getItemValue(s));return this.options.getValueFormatCallback?this.options.getValueFormatCallback(t):(this.options.valueFormat||"json")==="csv"?t.join(","):JSON.stringify(t)}getSelected(){return Array.from(this.selectedOptions.values())}setSelected(t,e={}){this.selectedValues=new Set(t.map(s=>String(s))),this.selectedOptions.clear(),t.forEach(s=>{const i=String(s),r=this.allOptions.find(n=>String(this.getItemValue(n))===i);r&&this.selectedOptions.set(i,r)}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),e.notify&&this.options.onChange&&this.options.onChange(this.getSelected())}updateOptions(t){const e=!!this.hint,s="searchHint"in t?!!t.searchHint:e;if(e!==s)return!1;Object.assign(this.options,t);const i="pathMember"in t||"getPathCallback"in t||"parentPathMember"in t||"levelMember"in t||"hasChildrenMember"in t||"treePathSeparator"in t||"isTreeEnabled"in t||"isSelectableMember"in t||"getIsSelectableCallback"in t;if("options"in t&&t.options!==void 0?(this.allOptions=t.options,this.reconcileSelectedOptions(),this.isTreeMode()?this.buildTree():this.filteredOptions=this.searchTerm?this.filteredOptions:[...this.allOptions]):i&&(this.isTreeMode()?this.buildTree():this.filteredOptions=this.searchTerm?this.filteredOptions:[...this.allOptions]),this.element.classList.toggle("ms--no-checkboxes",!this.options.isCheckboxesShown||!this.options.isMultipleEnabled),"badgesPosition"in t){this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left"));const r=this.element.querySelector(".ms__wrapper");r==null||r.classList.toggle("ms__wrapper--inline",this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")}return this.isOpen||(this.input.placeholder=this.getPlaceholderText()),"searchInputMode"in t&&(this.input.readOnly=this.options.searchInputMode==="readonly",this.input.style.display=this.options.searchInputMode==="hidden"?"none":""),"searchHint"in t&&this.hint&&(this.hint.textContent=this.options.searchHint||""),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),!0}get selectedItem(){return this.selectedOptions.size===0?null:Array.from(this.selectedOptions.values())[0]}get selectedValue(){if(!this.options.valueMember&&!this.options.getValueCallback)return null;if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const t=Array.from(this.selectedOptions.values()).map(e=>this.getItemValue(e));return this.options.isMultipleEnabled?t:t[0]??null}getValue(){if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const t=Array.from(this.selectedOptions.values()).map(e=>this.getItemValue(e));return this.options.isMultipleEnabled?t:t[0]??null}spawnTooltip(t){var r;(r=this.tooltips.get(t.id))==null||r.destroy();const e=this.element.getRootNode(),s=e instanceof ShadowRoot?e:null,i=new Ss({trigger:t.trigger,container:this.options.container??s??document.body,content:t.content,placement:t.placement??this.options.badgeTooltipPlacement??"top",offsetDistance:t.offsetDistance??this.options.badgeTooltipOffset??8,showDelay:t.showDelay??this.options.badgeTooltipDelay??100,cssClass:t.cssClass,visibleClass:t.visibleClass,followCursor:t.followCursor,onBeforeShow:t.onBeforeShow});this.tooltips.set(t.id,i)}destroyAllTooltips(){this.tooltips.forEach(t=>t.destroy()),this.tooltips.clear()}buildBadgeTooltipContent(t){if(this.options.getBadgeTooltipCallback)return this.options.getBadgeTooltipCallback(t);const e=this.getItemBadgeDisplayValue(t),s=this.getItemSubtitle(t);return s?`${e}
36
+ ${s}`:e}buildRemoveButtonTooltipText(t,e){return e&&this.options.getRemoveButtonTooltipCallback?this.options.getRemoveButtonTooltipCallback(e):this.options.removeButtonTooltipText?this.options.removeButtonTooltipText.replace("{0}",t):`Remove ${t}`}attachBadgeTooltips(t){if(!this.options.isBadgeTooltipsEnabled)return;const e=!!t,s=t||this.badgesContainer,i=e?"popover-":"";if(s.querySelectorAll(".ms__badge:not(.ms__badge--more)").forEach(n=>{const a=n.querySelector(".ms__badge-remove");if(!a)return;const l=a.dataset.value,c=this.selectedOptions.get(l);if(!c)return;const d=`${i}${l}`,p=`${i}${l}-remove`,u=n.querySelector(".ms__badge-text");u&&this.spawnTooltip({id:d,trigger:u,content:this.buildBadgeTooltipContent(c)});const m=this.getItemBadgeDisplayValue(c);this.spawnTooltip({id:p,trigger:a,content:this.buildRemoveButtonTooltipText(m,c),onBeforeShow:()=>{var b;return(b=this.tooltips.get(d))==null?void 0:b.hideImmediate()}})}),!e){const n=this.badgesContainer.querySelector(".ms__badge--more"),a=n==null?void 0:n.querySelector(".ms__badge-remove");if(a&&a.dataset.action==="remove-hidden"){const l=this.options.badgesMaxVisible||3,c=this.selectedOptions.size-l;this.spawnTooltip({id:"more-badge-remove",trigger:a,content:this.buildRemoveButtonTooltipText(`${c} hidden items`)})}}}buildOptionTooltipContent(t){if(this.options.getOptionTooltipCallback)return this.options.getOptionTooltipCallback(t);const e=this.getItemDisplayValue(t),s=this.getItemSubtitle(t);return s?`${e}
37
+ ${s}`:e}attachOptionTooltips(){if(this.destroyAllOptionTooltips(),!this.options.isOptionTooltipsEnabled)return;this.dropdown.querySelectorAll(".ms__option").forEach(e=>{const s=e,i=parseInt(s.dataset.index??"-1",10);if(i<0)return;const r=this.filteredOptions[i];if(!r)return;const n=this.buildOptionTooltipContent(r);n&&this.spawnTooltip({id:`option-${i}`,trigger:s,content:n,placement:this.options.optionTooltipPlacement??"top-start",offsetDistance:this.options.optionTooltipOffset??this.options.badgeTooltipOffset??8,showDelay:this.options.optionTooltipDelay??this.options.badgeTooltipDelay??100,cssClass:"ms__option-tooltip",visibleClass:"ms__option-tooltip--visible",followCursor:this.options.isOptionTooltipFollowCursor})})}destroyAllOptionTooltips(){var t;for(const e of Array.from(this.tooltips.keys()))e.startsWith("option-")&&((t=this.tooltips.get(e))==null||t.destroy(),this.tooltips.delete(e))}attachActionButtonTooltips(){this.dropdown.querySelectorAll(".ms__action-btn").forEach(e=>{var c,d;const s=e,i=s.dataset.action;if(!i)return;const r=parseInt(s.dataset.buttonIndex||"-1"),n=r>=0?(c=this.options.actionButtons)==null?void 0:c[r]:(d=this.options.actionButtons)==null?void 0:d.find(p=>p.action===i);if(!n)return;const a=n.getTooltipCallback?n.getTooltipCallback(this):n.tooltip;if(!a)return;const l=`action-${r>=0?r:i}`;this.spawnTooltip({id:l,trigger:s,content:a})})}destroyAllActionButtonTooltips(){var t;for(const e of Array.from(this.tooltips.keys()))e.startsWith("action-")&&((t=this.tooltips.get(e))==null||t.destroy(),this.tooltips.delete(e))}destroyAllBadgeTooltips(){var t;for(const e of Array.from(this.tooltips.keys()))!e.startsWith("action-")&&!e.startsWith("popover-")&&((t=this.tooltips.get(e))==null||t.destroy(),this.tooltips.delete(e))}destroy(){this.destroyAllTooltips(),this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0),this.abortInFlightSearch(),this.dropdownCleanup&&this.dropdownCleanup(),this.hintCleanup&&this.hintCleanup(),this.selectedPopoverCleanup&&this.selectedPopoverCleanup(),this.documentClickHandler&&(document.removeEventListener("click",this.documentClickHandler),this.documentClickHandler=null),this.documentKeydownHandler&&(document.removeEventListener("keydown",this.documentKeydownHandler),this.documentKeydownHandler=null),this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.dropdown&&this.dropdown.remove(),this.hint&&this.hint.remove(),this.selectedPopover&&this.selectedPopover.remove(),this.element.innerHTML="",this.element.classList.remove("ms","ms--open","ms--no-checkboxes"),le.info(`[${this.instanceId}] Component destroyed`)}}const Ds=`@layer variables,component,overrides;@layer variables{:host{display:block;--ms-rem: 10px;font-family:var(--ms-font-family, var(--base-font-family, inherit));--ms-accent-color: var(--base-accent-color, #3b82f6);--ms-accent-color-hover: var(--base-accent-color-hover, #2563eb);--ms-accent-color-active: var(--base-accent-color-active, #1d4ed8);--ms-accent-color-light: var(--base-accent-color-light, light-dark(#eff6ff, #1e3a5f));--ms-accent-color-light-hover: var(--base-accent-color-light-hover, light-dark(#e0f2fe, #264a73));--ms-text-color-1: var(--base-text-color-1, light-dark(#111827, #f5f5f5));--ms-text-color-2: var(--base-text-color-2, light-dark(#353b47, #d4d4d4));--ms-text-color-3: var(--base-text-color-3, light-dark(#6b7280, #a3a3a3));--ms-text-color-4: var(--base-text-color-4, light-dark(#a0a3a9, #737373));--ms-text-color-on-accent: var(--base-text-color-on-accent, #ffffff);--ms-text-primary: var(--ms-text-color-1);--ms-text-secondary: var(--ms-text-color-3);--ms-primary-bg: var(--base-hover-bg, color-mix(in srgb, var(--ms-text-color-1) 8%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--ms-primary-bg-hover: var(--base-active-bg, color-mix(in srgb, var(--ms-text-color-1) 14%, var(--base-main-bg, light-dark(#ffffff, #1a1a1a))));--ms-border-color: var(--base-border-color, light-dark(#e5e7eb, #3a3a3a));--ms-border: var(--base-border, 1px solid var(--ms-border-color));--ms-input-bg: var(--base-input-bg, light-dark(#ffffff, #1a1a1a));--ms-input-color: var(--base-input-color, var(--ms-text-color-1));--ms-input-border: var(--base-input-border, 1px solid var(--ms-border-color));--ms-input-border-hover: var(--base-input-border-hover, 1px solid var(--ms-accent-color));--ms-input-border-focus: var(--base-input-border-focus, 1px solid var(--ms-accent-color));--ms-input-placeholder-color: var(--base-input-placeholder-color, var(--ms-text-color-4));--ms-input-bg-disabled: var(--base-input-bg-disabled, rgba(107, 114, 128, .05));--ms-toggle-icon-color: var(--ms-text-color-3);--ms-toggle-icon-color-open: var(--ms-text-color-3);--ms-counter-badge-bg: var(--ms-accent-color);--ms-counter-badge-bg-hover: var(--ms-accent-color-hover);--ms-counter-badge-color: var(--ms-text-color-on-accent);--ms-hint-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-hint-color: var(--ms-text-color-4);--ms-hint-border-color: var(--ms-border-color);--ms-dropdown-bg: var(--base-dropdown-bg, var(--base-elevated-bg, light-dark(#ffffff, #1a1a1a)));--ms-dropdown-text-color: var(--ms-text-color-1);--ms-dropdown-border-color: var(--ms-border-color);--ms-dropdown-box-shadow-semantic: var(--base-dropdown-box-shadow, 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1));--ms-actions-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-actions-border-color: var(--ms-border-color);--ms-action-button-bg: transparent;--ms-action-button-bg-hover: var(--ms-primary-bg);--ms-action-button-border-color: var(--ms-border-color);--ms-action-button-border-color-hover: var(--ms-accent-color);--ms-action-button-color: var(--ms-text-color-1);--ms-group-border-color: var(--ms-border-color);--ms-option-text-color: var(--ms-text-color-1);--ms-option-bg: transparent;--ms-option-bg-hover: var(--ms-primary-bg);--ms-option-color-hover: inherit;--ms-option-bg-focused: var(--ms-primary-bg);--ms-option-color-focused: inherit;--ms-option-outline-color-focused: var(--ms-accent-color);--ms-option-bg-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-option-bg-matched: color-mix(in srgb, var(--ms-accent-color) 8%, transparent);--ms-option-color-matched: inherit;--ms-option-border-matched-color: color-mix(in srgb, var(--ms-accent-color) 40%, transparent);--ms-option-title-color: var(--ms-text-color-1);--ms-option-subtitle-color: var(--ms-text-color-3);--ms-option-mark-bg: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-option-mark-color: inherit;--ms-loading-color: var(--ms-text-color-3);--ms-badge-bg: var(--ms-accent-color-light);--ms-badge-bg-hover: var(--base-hover-bg, var(--ms-input-bg));--ms-badge-bg-active: var(--ms-accent-color-light-hover);--ms-badge-text-bg-hover: var(--base-hover-bg, var(--ms-input-bg));--ms-badge-text-color-hover: var(--ms-badge-text-color);--ms-badge-counter-border-color: var(--ms-border-color);--ms-badge-counter-text-bg: var(--ms-primary-bg-hover);--ms-badge-counter-text-color: var(--ms-text-color-1);--ms-badge-counter-remove-bg: var(--ms-text-color-3);--ms-badge-counter-remove-bg-hover: var(--ms-text-color-1);--ms-badge-counter-remove-color: var(--ms-text-color-on-accent);--ms-counter-wrapper-border-color: var(--ms-border-color);--ms-count-clear-bg-hover: var(--ms-accent-color);--ms-tooltip-bg: var(--base-tooltip-bg, var(--base-inverse-bg, light-dark(#333333, #f5f5f5)));--ms-tooltip-text-color: var(--base-tooltip-text-color, light-dark(#ffffff, #1a1a1a));--ms-selected-popover-bg: var(--base-dropdown-bg, var(--base-elevated-bg, light-dark(#ffffff, #1a1a1a)));--ms-selected-popover-border-color: var(--ms-border-color);--ms-selected-popover-header-border-color: var(--ms-border-color);--ms-selected-popover-close-bg-hover: var(--ms-accent-color);--ms-input-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-input-padding-right: calc(4 * var(--ms-rem));--ms-input-padding-h: calc(1.2 * var(--ms-rem));--ms-input-height: calc(var(--base-input-size-md-height, 3.5) * var(--ms-rem));--ms-input-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-border-width: 1px;--ms-input-border-radius: var(--ms-border-radius-md);--ms-input-text: var(--ms-text-color-1);--ms-input-bg-disabled: rgba(107, 114, 128, .05);--ms-input-size-xs-font: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-input-size-xs-padding-v: calc(.4 * var(--ms-rem));--ms-input-size-xs-padding-h: calc(.8 * var(--ms-rem));--ms-input-size-xs-height: calc(var(--base-input-size-xs-height, 3.1) * var(--ms-rem));--ms-input-size-sm-font: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-size-sm-padding-v: calc(.5 * var(--ms-rem));--ms-input-size-sm-padding-h: calc(1 * var(--ms-rem));--ms-input-size-sm-height: calc(var(--base-input-size-sm-height, 3.3) * var(--ms-rem));--ms-input-size-md-font: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-input-size-md-padding-v: calc(.8 * var(--ms-rem));--ms-input-size-md-padding-h: calc(1.2 * var(--ms-rem));--ms-input-size-md-height: calc(var(--base-input-size-md-height, 3.5) * var(--ms-rem));--ms-input-size-lg-font: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-input-size-lg-padding-v: calc(1 * var(--ms-rem));--ms-input-size-lg-padding-h: calc(1.4 * var(--ms-rem));--ms-input-size-lg-height: calc(var(--base-input-size-lg-height, 3.8) * var(--ms-rem));--ms-input-size-xl-font: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-input-size-xl-padding-v: calc(1.2 * var(--ms-rem));--ms-input-size-xl-padding-h: calc(1.6 * var(--ms-rem));--ms-input-size-xl-height: calc(var(--base-input-size-xl-height, 4.1) * var(--ms-rem));--ms-toggle-right: calc(1.2 * var(--ms-rem));--ms-toggle-color: var(--ms-text-color-3);--ms-transform-center-y: translateY(-50%);--ms-transform-rotate-180: 180deg;--ms-counter-offset: calc(3.2 * var(--ms-rem));--ms-counter-padding: calc(.2 * var(--ms-rem)) calc(.4 * var(--ms-rem));--ms-counter-bg: var(--ms-accent-color);--ms-counter-color: var(--ms-text-color-on-accent);--ms-counter-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-counter-font-weight: var(--base-font-weight-semibold, 600);--ms-counter-border-radius: var(--ms-border-radius-sm);--ms-counter-bg-hover: var(--ms-accent-color-hover);--ms-transform-scale-hover: 1.1;--ms-hint-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-hint-border: 1px solid var(--ms-hint-border-color);--ms-hint-border-radius: var(--ms-border-radius-lg);--ms-hint-box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--ms-hint-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-dropdown-border: var(--base-dropdown-border, 1px solid var(--ms-dropdown-border-color));--ms-dropdown-border-radius: var(--ms-border-radius-lg);--ms-dropdown-box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ms-options-max-height: calc(32 * var(--ms-rem));--ms-option-color: var(--ms-text-color-1);--ms-z-index-dropdown: 9999;--ms-z-index-sticky: 1;--ms-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem));--ms-actions-border-bottom: 1px solid var(--ms-actions-border-color);--ms-action-btn-padding: calc(.4 * var(--ms-rem)) calc(.8 * var(--ms-rem));--ms-action-btn-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-action-btn-border: var(--ms-border);--ms-action-btn-border-radius: var(--ms-border-radius-sm);--ms-action-btn-bg: transparent;--ms-action-btn-color: inherit;--ms-action-btn-bg-hover: var(--ms-primary-bg);--ms-action-btn-border-color-hover: var(--ms-accent-color);--ms-transform-scale-active: .98;--ms-options-padding: 0;--ms-group-border-top: 1px solid var(--ms-group-border-color);--ms-group-margin-top: calc(.4 * var(--ms-rem));--ms-group-padding-top: calc(.4 * var(--ms-rem));--ms-group-label-padding: calc(.4 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-group-label-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-group-label-font-weight: var(--base-font-weight-semibold, 600);--ms-group-label-color: var(--ms-text-color-3);--ms-group-label-transform: uppercase;--ms-group-label-letter-spacing: .05em;--ms-option-gap: calc(.8 * var(--ms-rem));--ms-option-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-option-padding-h: calc(1.2 * var(--ms-rem));--ms-option-min-height: auto;--ms-option-outline-focused: 2px solid var(--ms-option-outline-color-focused);--ms-option-focus-outline-offset: -2px;--ms-option-border-matched: 3px solid var(--ms-option-border-matched-color);--ms-option-bg-focused-hover: var(--ms-primary-bg);--ms-option-bg-matched-hover: color-mix(in srgb, var(--ms-accent-color) 12%, transparent);--ms-option-bg-selected-focused: color-mix(in srgb, var(--ms-accent-color) 15%, transparent);--ms-option-bg-selected-matched: color-mix(in srgb, var(--ms-accent-color) 15%, transparent);--ms-option-disabled-bg: var(--base-disabled-bg, transparent);--ms-option-bg-disabled-selected: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-disabled-opacity: .5;--ms-option-content-gap: calc(.8 * var(--ms-rem));--ms-option-icon-size: calc(2 * var(--ms-rem));--ms-option-icon-font-size: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-option-title-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-option-mark-font-weight: var(--base-font-weight-semibold, 600);--ms-option-title-white-space: normal;--ms-option-title-overflow: visible;--ms-option-title-text-overflow: clip;--ms-option-subtitle-margin-top: calc(.4 * var(--ms-rem));--ms-option-subtitle-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-option-subtitle-line-height: var(--base-line-height-tight, 1.25);--ms-checkbox-margin-top: calc(.2 * var(--ms-rem));--ms-checkbox-margin-right: 0;--ms-checkbox-margin-bottom: 0;--ms-checkbox-margin-left: 0;--ms-checkbox-size: calc(1.6 * var(--ms-rem));--ms-checkbox-scale: 1;--ms-checkbox-align: center;--ms-checkbox-bg: var(--ms-input-bg);--ms-checkbox-border-width: 1px;--ms-checkbox-border-color: var(--base-checkbox-border-color, #8f8f8f);--ms-checkbox-border: var(--ms-checkbox-border-width) solid var(--ms-checkbox-border-color);--ms-checkbox-border-radius: calc(.3 * var(--ms-rem));--ms-checkbox-checkmark-thickness: 2.5px;--ms-checkbox-checked-bg: var(--ms-accent-color);--ms-checkbox-checked-border: var(--ms-checkbox-border-width) solid var(--ms-accent-color);--ms-checkbox-checkmark-color: var(--ms-text-color-on-accent);--ms-checkbox-hover-border-color: var(--ms-accent-color);--ms-checkbox-disabled-bg: var(--ms-primary-bg);--ms-checkbox-disabled-border: var(--ms-checkbox-border-width) solid var(--ms-border-color);--ms-checkbox-checked-bg-hover: var(--ms-accent-color-hover);--ms-checkbox-checked-border-color-hover: var(--ms-accent-color-hover);--ms-state-min-height: calc(8 * var(--ms-rem));--ms-empty-padding: calc(1.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-empty-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-empty-color: var(--ms-text-color-3);--ms-loader-padding: calc(1.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-loader-gap: calc(.8 * var(--ms-rem));--ms-loading-text-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-loading-text-color: var(--ms-text-color-3);--ms-badges-gap: calc(.8 * var(--ms-rem));--ms-badges-margin-bottom: calc(.8 * var(--ms-rem));--ms-badges-margin-top: calc(.8 * var(--ms-rem));--ms-badges-margin-left: calc(.4 * var(--ms-rem));--ms-badges-margin-right: calc(.4 * var(--ms-rem));--ms-inline-align: center;--ms-badge-gap: calc(.8 * var(--ms-rem));--ms-badge-height: calc(2.7 * var(--ms-rem));--ms-badge-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-badge-font-weight: var(--base-font-weight-semibold, 600);--ms-badge-border-radius: var(--ms-border-radius-sm);--ms-order-first: -1;--ms-badge-text-padding: 0 calc(.8 * var(--ms-rem));--ms-badge-text-bg: var(--ms-accent-color-light);--ms-badge-text-color: var(--ms-accent-color);--ms-badge-text-border: none;--ms-badge-remove-width: calc(2.7 * var(--ms-rem));--ms-badge-remove-bg: var(--ms-accent-color);--ms-badge-remove-color: var(--ms-text-color-on-accent);--ms-badge-remove-border: none;--ms-badge-remove-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-badge-remove-bg-hover: var(--ms-accent-color-hover);--ms-badge-remove-box-shadow-focus: 0 0 0 2px color-mix(in srgb, var(--ms-accent-color) 50%, transparent);--ms-badge-remove-icon-size: calc(1 * var(--ms-rem));--ms-icon-remove: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 6L18 18M18 6L6 18' stroke='black' stroke-width='2.5' stroke-linecap='round' fill='none'/></svg>");--ms-badge-counter-bg: transparent;--ms-badge-counter-border: 1px solid var(--ms-badge-counter-border-color);--ms-badge-counter-border-radius: var(--ms-border-radius-sm);--ms-more-badge-bg: var(--ms-accent-color-light);--ms-more-badge-hover-bg: var(--ms-badge-bg-hover);--ms-more-badge-active-bg: var(--ms-accent-color-light-hover);--ms-count-display-margin-bottom: calc(.8 * var(--ms-rem));--ms-count-display-margin-top: calc(.8 * var(--ms-rem));--ms-count-display-margin-left: calc(.8 * var(--ms-rem));--ms-count-display-margin-right: calc(.8 * var(--ms-rem));--ms-counter-wrapper-bg: transparent;--ms-counter-wrapper-border: var(--ms-border);--ms-counter-wrapper-border-radius: var(--ms-border-radius-sm);--ms-counter-wrapper-padding: calc(.4 * var(--ms-rem)) calc(.8 * var(--ms-rem));--ms-counter-wrapper-gap: calc(.4 * var(--ms-rem));--ms-counter-wrapper-bg-hover: var(--ms-primary-bg);--ms-counter-wrapper-border-color-hover: var(--ms-accent-color);--ms-count-text-bg: transparent;--ms-count-text-border: none;--ms-count-text-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-count-text-color: var(--ms-text-color-1);--ms-count-clear-size: calc(1.6 * var(--ms-rem));--ms-count-clear-bg: transparent;--ms-count-clear-color: var(--ms-text-color-3);--ms-count-clear-font-size: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-count-clear-border-radius: var(--ms-border-radius-sm);--ms-count-clear-bg-hover: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-count-clear-color-hover: var(--ms-accent-color);--ms-count-clear-icon-size: calc(1.4 * var(--ms-rem));--ms-icon-clear: var(--ms-icon-remove);--ms-tooltip-color: var(--ms-tooltip-text-color);--ms-tooltip-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-tooltip-border-radius: var(--ms-border-radius-lg);--ms-tooltip-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-tooltip-max-width: calc(32 * var(--ms-rem));--ms-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .15);--ms-tooltip-z-index: 10000;--ms-option-tooltip-bg: var(--ms-tooltip-bg);--ms-option-tooltip-text-color: var(--ms-tooltip-text-color);--ms-option-tooltip-padding: var(--ms-tooltip-padding);--ms-option-tooltip-border-radius: var(--ms-tooltip-border-radius);--ms-option-tooltip-font-size: var(--ms-tooltip-font-size);--ms-option-tooltip-max-width: var(--ms-tooltip-max-width);--ms-option-tooltip-shadow: var(--ms-tooltip-shadow);--ms-option-tooltip-z-index: var(--ms-tooltip-z-index);--ms-z-index-popover: 10000;--ms-selected-popover-width: calc(32 * var(--ms-rem));--ms-selected-popover-max-height: calc(32 * var(--ms-rem));--ms-selected-popover-border: 1px solid var(--ms-selected-popover-border-color);--ms-selected-popover-border-radius: var(--ms-border-radius-lg);--ms-selected-popover-box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--ms-selected-popover-header-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-selected-popover-header-bg: color-mix(in srgb, var(--ms-accent-color) 10%, transparent);--ms-selected-popover-header-border-bottom: 1px solid var(--ms-selected-popover-header-border-color);--ms-selected-popover-header-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-selected-popover-header-font-weight: var(--base-font-weight-semibold, 600);--ms-selected-popover-header-color: var(--ms-text-color-1);--ms-popover-close-size: calc(2.4 * var(--ms-rem));--ms-selected-popover-close-bg: transparent;--ms-selected-popover-close-color: var(--ms-text-color-3);--ms-selected-popover-close-font-size: calc(var(--base-font-size-xl, 2) * var(--ms-rem));--ms-selected-popover-close-border-radius: var(--ms-border-radius-sm);--ms-selected-popover-close-bg-hover: color-mix(in srgb, var(--ms-accent-color) 20%, transparent);--ms-selected-popover-close-color-hover: var(--ms-accent-color);--ms-selected-popover-close-icon-size: calc(1.4 * var(--ms-rem));--ms-selected-popover-body-gap: calc(.4 * var(--ms-rem));--ms-selected-popover-body-padding: calc(.8 * var(--ms-rem));--ms-selected-popover-body-max-height: calc(28.8 * var(--ms-rem));--ms-font-size-2xs: calc(var(--base-font-size-2xs, 1) * var(--ms-rem));--ms-font-size-xs: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-font-size-sm: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-font-size-base: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-font-size-lg: calc(var(--base-font-size-lg, 1.8) * var(--ms-rem));--ms-font-weight-normal: var(--base-font-weight-normal, 400);--ms-font-weight-medium: var(--base-font-weight-medium, 500);--ms-font-weight-semibold: var(--base-font-weight-semibold, 600);--ms-line-height-none: 1;--ms-line-height-tight: var(--base-line-height-tight, 1.25);--ms-line-height-normal: var(--base-line-height-normal, 1.5);--ms-line-height-relaxed: var(--base-line-height-relaxed, 1.75);--ms-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--ms-rem));--ms-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--ms-rem));--ms-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--ms-rem));--ms-border-radius: var(--ms-border-radius-md);--ms-spacing-xs: calc(.4 * var(--ms-rem));--ms-spacing-sm: calc(.8 * var(--ms-rem));--ms-spacing-md: calc(1.2 * var(--ms-rem));--ms-spacing-lg: calc(1.6 * var(--ms-rem));--ms-transition-fast: .15s;--ms-transition-normal: .2s;--ms-easing-snappy: cubic-bezier(.4, 0, .2, 1);--ms-placeholder-opacity: .6;--ms-disabled-input-opacity: .6;--ms-scrollbar-width: 8px;--ms-scrollbar-track-bg: transparent;--ms-scrollbar-thumb-bg: var(--ms-border-color);--ms-scrollbar-thumb-bg-hover: var(--ms-text-color-3);--ms-scrollbar-thumb-border-radius: 4px;--ms-debug-bg: var(--base-elevated-bg, light-dark(#f9fafb, #2b2b2b));--ms-debug-border-color: var(--ms-border-color);--ms-debug-text-color: var(--ms-text-color-1);--ms-debug-border-radius: var(--ms-border-radius-md);--ms-debug-summary-color: var(--ms-accent-color);--ms-debug-summary-bg-hover: var(--ms-primary-bg);--ms-debug-summary-outline-color: var(--ms-accent-color);--ms-debug-summary-border-radius: var(--ms-border-radius-sm);--ms-debug-stats-bg: var(--base-main-bg, light-dark(#ffffff, #1a1a1a));--ms-debug-stats-border-radius: var(--ms-border-radius-sm);--ms-debug-bullet-color: var(--ms-accent-color)}}@layer component{web-multiselect:not(:defined){display:block;min-height:calc(3.5 * var(--ms-rem));color:transparent!important;background:transparent}.ms__wrapper{display:flex;flex-direction:column;align-items:stretch}.ms__wrapper--inline{flex-direction:row;align-items:var(--ms-inline-align, center)}.ms{position:relative;width:100%}}@layer component{.ms__input-wrapper{position:relative;display:flex;align-items:center}.ms__input{box-sizing:border-box;width:100%;font-family:inherit;height:var(--ms-input-height);padding:var(--ms-input-padding);padding-right:var(--ms-input-padding-right);font-size:var(--ms-input-font-size);border:var(--ms-input-border);border-radius:var(--ms-input-border-radius);background:var(--ms-input-bg);color:var(--ms-input-color);cursor:pointer;transition:border var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__input:hover:not(:focus):not(:disabled){border:var(--ms-input-border-hover)}.ms__input:focus{outline:none;border:var(--ms-input-border-focus)}.ms__input::placeholder{color:var(--ms-input-placeholder-color);opacity:0;transition:opacity var(--ms-transition-fast) var(--ms-easing-snappy)}:host([data-ready]) .ms__input::placeholder{opacity:var(--ms-placeholder-opacity)}.ms__input.ms__input--xs{font-size:var(--ms-input-size-xs-font);padding:var(--ms-input-size-xs-padding-v) var(--ms-input-size-xs-padding-h);padding-right:calc(var(--ms-input-size-xs-padding-h) * 2.5);height:var(--ms-input-size-xs-height)}.ms__input.ms__input--sm{font-size:var(--ms-input-size-sm-font);padding:var(--ms-input-size-sm-padding-v) var(--ms-input-size-sm-padding-h);padding-right:calc(var(--ms-input-size-sm-padding-h) * 2.5);height:var(--ms-input-size-sm-height)}.ms__input.ms__input--lg{font-size:var(--ms-input-size-lg-font);padding:var(--ms-input-size-lg-padding-v) var(--ms-input-size-lg-padding-h);padding-right:calc(var(--ms-input-size-lg-padding-h) * 2.5);height:var(--ms-input-size-lg-height)}.ms__input.ms__input--xl{font-size:var(--ms-input-size-xl-font);padding:var(--ms-input-size-xl-padding-v) var(--ms-input-size-xl-padding-h);padding-right:calc(var(--ms-input-size-xl-padding-h) * 2.5);height:var(--ms-input-size-xl-height)}.ms__toggle{position:absolute;right:var(--ms-toggle-right);top:50%;transform:var(--ms-transform-center-y);pointer-events:none;color:var(--ms-toggle-icon-color);transition:transform var(--ms-transition-fast) var(--ms-easing-snappy)}.ms--open .ms__toggle{transform:var(--ms-transform-center-y) rotate(var(--ms-transform-rotate-180));color:var(--ms-toggle-icon-color-open)}.ms__counter{position:absolute;right:var(--ms-counter-offset);top:50%;transform:var(--ms-transform-center-y);padding:var(--ms-counter-padding);background:var(--ms-counter-badge-bg);color:var(--ms-counter-badge-color);font-size:var(--ms-counter-font-size);font-weight:var(--ms-counter-font-weight);border-radius:var(--ms-counter-border-radius);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__counter:hover{background:var(--ms-counter-badge-bg-hover);transform:var(--ms-transform-center-y) scale(var(--ms-transform-scale-hover))}.ms__actions{display:flex;flex-direction:column;gap:var(--ms-actions-gap);padding:var(--ms-actions-padding)}.ms__actions--top{border-bottom:var(--ms-actions-border-bottom)}.ms__actions--bottom{flex-direction:column-reverse;border-top:var(--ms-actions-border-bottom)}.ms__actions-row{display:flex;flex-wrap:nowrap;gap:var(--ms-actions-gap)}.ms__actions--wrap .ms__actions-row{flex-wrap:wrap}.ms__actions--sticky{position:sticky;z-index:var(--ms-z-index-sticky);background:var(--ms-actions-bg)}.ms__actions--sticky.ms__actions--top{top:0}.ms__actions--sticky.ms__actions--bottom{bottom:0}.ms__actions--align-stretch .ms__action-btn{flex:1}.ms__actions--align-left .ms__actions-row{justify-content:flex-start}.ms__actions--align-right .ms__actions-row{justify-content:flex-end}.ms__actions--align-center .ms__actions-row{justify-content:center}.ms__actions--align-space-between .ms__actions-row{justify-content:space-between}.ms__action-btn{font-family:inherit;padding:var(--ms-action-btn-padding);font-size:var(--ms-action-btn-font-size);border:var(--ms-action-btn-border);border-radius:var(--ms-action-btn-border-radius);background:var(--ms-action-button-bg);color:var(--ms-action-button-color);cursor:pointer;transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__action-btn:hover{background:var(--ms-action-button-bg-hover);border-color:var(--ms-action-button-border-color-hover)}.ms__action-btn:active{transform:scale(var(--ms-transform-scale-active))}.ms__action-btn:disabled,.ms__action-btn[disabled]{opacity:var(--ms-disabled-opacity);cursor:not-allowed;pointer-events:none}}@layer component{.ms__hint{display:none;position:fixed;z-index:var(--ms-z-index-popover);padding:var(--ms-hint-padding);background:var(--ms-hint-bg);border:var(--ms-hint-border);border-radius:var(--ms-hint-border-radius);box-shadow:var(--ms-hint-box-shadow);font-size:var(--ms-hint-font-size);color:var(--ms-hint-color);line-height:var(--ms-line-height-relaxed);max-width:100%}.ms__hint--visible{display:block}.ms__dropdown{display:none;position:fixed;font-family:inherit;z-index:var(--ms-z-index-dropdown);background:var(--ms-dropdown-bg);border:var(--ms-dropdown-border);border-radius:var(--ms-dropdown-border-radius);box-shadow:var(--ms-dropdown-box-shadow);max-height:var(--ms-options-max-height);overflow:hidden;color:var(--ms-dropdown-text-color)}.ms__dropdown--visible{display:flex;flex-direction:column}.ms__dropdown-inner{flex:1;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__dropdown-inner::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__dropdown-inner::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__dropdown-inner::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__dropdown-inner::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__dropdown--virtual{max-height:none}.ms__dropdown--virtual .ms__dropdown-inner{overflow-y:visible}.ms__badge-tooltip{position:fixed;z-index:var(--ms-tooltip-z-index);opacity:0;visibility:hidden;transition:opacity var(--ms-transition-normal) ease,visibility var(--ms-transition-normal) ease;background:var(--ms-tooltip-bg);color:var(--ms-tooltip-text-color);padding:var(--ms-tooltip-padding);border-radius:var(--ms-tooltip-border-radius);font-size:var(--ms-tooltip-font-size);line-height:var(--ms-line-height-relaxed);max-width:var(--ms-tooltip-max-width);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ms-tooltip-shadow);pointer-events:none}.ms__badge-tooltip--visible{opacity:1;visibility:visible}.ms__option-tooltip{position:fixed;z-index:var(--ms-option-tooltip-z-index);opacity:0;visibility:hidden;transition:opacity var(--ms-transition-normal) ease,visibility var(--ms-transition-normal) ease;background:var(--ms-option-tooltip-bg);color:var(--ms-option-tooltip-text-color);padding:var(--ms-option-tooltip-padding);border-radius:var(--ms-option-tooltip-border-radius);font-size:var(--ms-option-tooltip-font-size);line-height:var(--ms-line-height-relaxed);max-width:var(--ms-option-tooltip-max-width);word-wrap:break-word;white-space:pre-wrap;box-shadow:var(--ms-option-tooltip-shadow);pointer-events:none}.ms__option-tooltip--visible{opacity:1;visibility:visible}.ms__selected-popover{display:none;position:fixed;z-index:var(--ms-z-index-popover);background:var(--ms-selected-popover-bg);border:var(--ms-selected-popover-border);border-radius:var(--ms-selected-popover-border-radius);box-shadow:var(--ms-selected-popover-box-shadow);width:var(--ms-selected-popover-width);max-height:var(--ms-selected-popover-max-height);overflow:hidden}.ms__selected-popover--visible{display:flex;flex-direction:column}.ms__selected-popover--virtual{display:block;overflow:visible;max-height:none}.ms__selected-popover-header{display:flex;align-items:center;justify-content:space-between;padding:var(--ms-selected-popover-header-padding);background:var(--ms-selected-popover-header-bg);border-bottom:var(--ms-selected-popover-header-border-bottom);font-size:var(--ms-selected-popover-header-font-size);font-weight:var(--ms-selected-popover-header-font-weight);color:var(--ms-selected-popover-header-color)}.ms__selected-popover-close{display:flex;align-items:center;justify-content:center;width:var(--ms-popover-close-size);height:var(--ms-popover-close-size);padding:0;border:none;background:var(--ms-selected-popover-close-bg);color:var(--ms-selected-popover-close-color);font-size:var(--ms-selected-popover-close-font-size);line-height:var(--ms-line-height-none);cursor:pointer;border-radius:var(--ms-selected-popover-close-border-radius);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__selected-popover-close:hover{background:var(--ms-selected-popover-close-bg-hover);color:var(--ms-selected-popover-close-color-hover)}.ms__selected-popover-close:before{content:"";display:block;width:var(--ms-selected-popover-close-icon-size);height:var(--ms-selected-popover-close-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__selected-popover-body{display:flex;flex-direction:column;gap:var(--ms-selected-popover-body-gap);padding:var(--ms-selected-popover-body-padding);overflow-y:auto;max-height:var(--ms-selected-popover-body-max-height);scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__selected-popover-body::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__selected-popover-body::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__selected-popover-body::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__selected-popover-body::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__selected-popover-body .ms__badge{width:100%;min-height:fit-content;line-height:var(--ms-line-height-relaxed)}.ms__selected-popover-body .ms__badge-text{flex:1;min-width:0;white-space:normal;word-wrap:break-word}.ms__selected-popover-body--virtual{display:block;max-height:none;padding:0}.ms__selected-popover-body--virtual .ms__badge{height:var(--ms-badge-height-virtual, 36px);min-height:var(--ms-badge-height-virtual, 36px);max-height:var(--ms-badge-height-virtual, 36px);margin-bottom:var(--ms-selected-popover-body-gap);overflow:hidden;box-sizing:border-box}.ms__selected-popover-body--virtual .ms__badge-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}@layer component{.ms--disabled .ms__input{opacity:var(--ms-disabled-input-opacity);cursor:not-allowed;background:var(--ms-input-bg-disabled)}.ms--disabled .ms__toggle{opacity:var(--ms-disabled-input-opacity)}.ms--no-checkboxes .ms__option{gap:0;padding-left:var(--ms-option-padding-h)}.ms--no-checkboxes .ms__option-content{padding-left:0}}@layer component;@layer component{.ms__badges{display:flex;flex-wrap:wrap;gap:var(--ms-badges-gap);padding:0}.ms__badges:empty{display:none}.ms__badges--bottom{margin-top:var(--ms-badges-margin-bottom)}.ms__badges--top{margin-bottom:var(--ms-badges-margin-top);order:var(--ms-order-first)}.ms__badges--left{order:var(--ms-order-first);margin-right:var(--ms-badges-margin-left);justify-content:flex-end}.ms__badges--right{margin-left:var(--ms-badges-margin-right);justify-content:flex-start}.ms__badge{display:inline-flex;align-items:center;height:var(--ms-badge-height);font-size:var(--ms-badge-font-size);font-weight:var(--ms-badge-font-weight);line-height:var(--ms-line-height-none);border-radius:var(--ms-badge-border-radius);overflow:hidden;max-width:100%}.ms__badge-text{display:flex;align-items:center;box-sizing:border-box;height:100%;padding:var(--ms-badge-text-padding);background:var(--ms-badge-text-bg);color:var(--ms-badge-text-color);border:var(--ms-badge-text-border);border-right:none;border-radius:var(--ms-badge-border-radius) 0 0 var(--ms-badge-border-radius);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:background-color var(--ms-transition-normal) ease,color var(--ms-transition-normal) ease}.ms__badge:hover .ms__badge-text{background:var(--ms-badge-text-bg-hover, var(--ms-badge-text-bg));color:var(--ms-badge-text-color-hover, var(--ms-badge-text-color))}.ms__badge-remove{display:flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:inherit;width:var(--ms-badge-remove-width);height:100%;flex-shrink:0;background:var(--ms-badge-remove-bg);color:var(--ms-badge-remove-color);border:var(--ms-badge-remove-border);border-left:none;border-radius:0 var(--ms-badge-border-radius) var(--ms-badge-border-radius) 0;cursor:pointer;transition:background-color var(--ms-transition-normal) ease;font-size:var(--ms-badge-remove-font-size)}.ms__badge-remove:hover{background:var(--ms-badge-remove-bg-hover)}.ms__badge-remove:focus{outline:none}.ms__badge-remove:focus-visible{outline:none;box-shadow:var(--ms-badge-remove-box-shadow-focus)}.ms__badge-remove:before{content:"";display:block;width:var(--ms-badge-remove-icon-size);height:var(--ms-badge-remove-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-remove) center / contain no-repeat;mask:var(--ms-icon-remove) center / contain no-repeat}.ms__badge--counter{cursor:pointer}.ms__badge--counter .ms__badge-text{background:var(--ms-badge-counter-text-bg);color:var(--ms-badge-counter-text-color);border:var(--ms-badge-counter-border);border-right:none}.ms__badge--counter .ms__badge-remove{background:var(--ms-badge-counter-remove-bg);color:var(--ms-badge-counter-remove-color);border:var(--ms-badge-counter-border);border-left:none}.ms__badge--counter .ms__badge-remove:hover{background:var(--ms-badge-counter-remove-bg-hover)}.ms__badge--more,.ms__badge[data-action=show-selected]{cursor:pointer}}@layer component{.ms__count-display{display:flex;align-items:center}.ms__count-display:empty{display:none}.ms__count-display--bottom{margin-top:var(--ms-count-display-margin-bottom)}.ms__count-display--top{margin-bottom:var(--ms-count-display-margin-top);order:var(--ms-order-first)}.ms__count-display--left{order:var(--ms-order-first);margin-right:var(--ms-count-display-margin-left);justify-content:flex-start}.ms__count-display--right{margin-left:var(--ms-count-display-margin-right);justify-content:flex-end}.ms__counter-wrapper{display:inline-flex;align-items:center;gap:var(--ms-counter-wrapper-gap);background:var(--ms-counter-wrapper-bg);border:var(--ms-counter-wrapper-border);border-radius:var(--ms-counter-wrapper-border-radius);padding:var(--ms-counter-wrapper-padding);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__counter-wrapper:hover{background:var(--ms-counter-wrapper-bg-hover);border-color:var(--ms-counter-wrapper-border-color-hover)}.ms__count-text{display:inline-flex;align-items:center;background:var(--ms-count-text-bg);border:var(--ms-count-text-border);padding:0;font-size:var(--ms-count-text-font-size);color:var(--ms-count-text-color);cursor:pointer;transition:color var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__count-clear{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:var(--ms-count-clear-size);height:var(--ms-count-clear-size);padding:0;border:none;background:var(--ms-count-clear-bg);color:var(--ms-count-clear-color);font-size:var(--ms-count-clear-font-size);line-height:var(--ms-line-height-none);cursor:pointer;border-radius:var(--ms-count-clear-border-radius);transition:all var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__count-clear:hover{background:var(--ms-count-clear-bg-hover);color:var(--ms-count-clear-color-hover)}.ms__count-clear:before{content:"";display:block;width:var(--ms-count-clear-icon-size);height:var(--ms-count-clear-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-clear) center / contain no-repeat;mask:var(--ms-icon-clear) center / contain no-repeat}}@layer component{.ms__debug-info{margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:var(--ms-debug-bg);border:1px solid var(--ms-debug-border-color);border-radius:var(--ms-debug-border-radius);font-size:calc(1.2 * var(--ms-rem));color:var(--ms-debug-text-color)}.ms__debug-info details summary{cursor:pointer;font-weight:600;color:var(--ms-debug-summary-color);-webkit-user-select:none;user-select:none;padding:calc(.4 * var(--ms-rem));border-radius:var(--ms-debug-summary-border-radius)}.ms__debug-info details summary:hover{background-color:var(--ms-debug-summary-bg-hover)}.ms__debug-info details summary:focus{outline:2px solid var(--ms-debug-summary-outline-color);outline-offset:2px}.ms__debug-info .ms__debug-stats{display:flex;flex-direction:column;gap:calc(.4 * var(--ms-rem));margin-top:calc(.4 * var(--ms-rem));padding:calc(.4 * var(--ms-rem));background-color:var(--ms-debug-stats-bg);border-radius:var(--ms-debug-stats-border-radius)}.ms__debug-info .ms__debug-stats span{display:flex;justify-content:space-between;padding:2px 4px;font-family:monospace;font-size:calc(1 * var(--ms-rem))}.ms__debug-info .ms__debug-stats span:before{content:"•";margin-right:calc(.4 * var(--ms-rem));color:var(--ms-debug-bullet-color)}}@layer component{.ms__options{padding:var(--ms-options-padding);scrollbar-width:thin;scrollbar-color:var(--ms-scrollbar-thumb-bg) var(--ms-scrollbar-track-bg)}.ms__options::-webkit-scrollbar{width:var(--ms-scrollbar-width)}.ms__options::-webkit-scrollbar-track{background:var(--ms-scrollbar-track-bg)}.ms__options::-webkit-scrollbar-thumb{background:var(--ms-scrollbar-thumb-bg);border-radius:var(--ms-scrollbar-thumb-border-radius)}.ms__options::-webkit-scrollbar-thumb:hover{background:var(--ms-scrollbar-thumb-bg-hover)}.ms__options--virtual .ms__option,.ms__options--fixed-height .ms__option{height:var(--ms-option-height, 50px);min-height:var(--ms-option-height, 50px);max-height:var(--ms-option-height, 50px);overflow:hidden;box-sizing:border-box}.ms__group+.ms__group{border-top:var(--ms-group-border-top);margin-top:var(--ms-group-margin-top);padding-top:var(--ms-group-padding-top)}.ms__group-label{padding:var(--ms-group-label-padding);font-size:var(--ms-group-label-font-size);font-weight:var(--ms-group-label-font-weight);color:var(--ms-group-label-color);text-transform:var(--ms-group-label-transform);letter-spacing:var(--ms-group-label-letter-spacing)}.ms__option{display:flex;align-items:var(--ms-checkbox-align, center);gap:var(--ms-option-gap);padding:var(--ms-option-padding);min-height:var(--ms-option-min-height, auto);color:var(--ms-option-text-color);background:var(--ms-option-bg);cursor:pointer;user-select:none;-webkit-user-select:none}.ms__option:hover{background:var(--ms-option-bg-hover);color:var(--ms-option-color-hover, inherit)}.ms__option--focused{background:var(--ms-option-bg-focused);color:var(--ms-option-color-focused, inherit);outline:var(--ms-option-outline-focused);outline-offset:var(--ms-option-focus-outline-offset)}.ms__option--matched{background:var(--ms-option-bg-matched);color:var(--ms-option-color-matched, inherit);border-left:var(--ms-option-border-matched)}.ms__option--selected{background:var(--ms-option-bg-selected)}.ms__option--selected:hover{background:var(--ms-option-bg-selected-hover, var(--ms-option-bg-selected))}.ms__option--disabled{opacity:var(--ms-disabled-opacity);cursor:not-allowed;background:var(--ms-option-disabled-bg)}.ms__option--disabled:hover{background:var(--ms-option-disabled-bg)}.ms__option--focused:hover{background:var(--ms-option-bg-focused-hover);color:var(--ms-option-color-focused-hover, var(--ms-option-color-focused, var(--ms-option-text-color)))}.ms__option--matched:hover{background:var(--ms-option-bg-matched-hover);color:var(--ms-option-color-matched-hover, var(--ms-option-color-matched, var(--ms-option-text-color)))}.ms__option--selected.ms__option--focused{background:var(--ms-option-bg-selected-focused);outline:var(--ms-option-outline-focused);outline-offset:var(--ms-option-focus-outline-offset)}.ms__option--selected.ms__option--matched{background:var(--ms-option-bg-selected-matched);border-left:var(--ms-option-border-matched)}.ms__option--disabled.ms__option--selected{background:var(--ms-option-bg-disabled-selected)}.ms__option--disabled.ms__option--focused{outline:none}.ms__option[data-checkbox-align=top]{--ms-checkbox-align: flex-start}.ms__option[data-checkbox-align=bottom]{--ms-checkbox-align: flex-end}.ms__checkbox{appearance:none;-webkit-appearance:none;-moz-appearance:none;flex-shrink:0;position:relative;margin-top:var(--ms-checkbox-margin-top);margin-right:var(--ms-checkbox-margin-right);margin-bottom:var(--ms-checkbox-margin-bottom);margin-left:var(--ms-checkbox-margin-left);width:var(--ms-checkbox-size);height:var(--ms-checkbox-size);transform:scale(var(--ms-checkbox-scale));transform-origin:top left;cursor:pointer;background:var(--ms-checkbox-bg);border:var(--ms-checkbox-border);border-radius:var(--ms-checkbox-border-radius);transition:background-color .15s ease,border-color .15s ease}.ms__checkbox:after{content:"";position:absolute;display:none;left:50%;top:40%;width:30%;height:55%;transform:translate(-50%,-50%) rotate(45deg);border:solid var(--ms-checkbox-checkmark-color);border-width:0 var(--ms-checkbox-checkmark-thickness, 2px) var(--ms-checkbox-checkmark-thickness, 2px) 0}.ms__checkbox:hover:not(:disabled){border-color:var(--ms-checkbox-hover-border-color)}.ms__checkbox:checked{background:var(--ms-checkbox-checked-bg);border:var(--ms-checkbox-checked-border)}.ms__checkbox:checked:after{display:block}.ms__checkbox--indeterminate{background:var(--ms-checkbox-checked-bg);border:var(--ms-checkbox-checked-border)}.ms__checkbox--indeterminate:after{display:block;top:50%;left:50%;width:55%;height:0;transform:translate(-50%,-50%);border:none;border-bottom:var(--ms-checkbox-checkmark-thickness, 2px) solid var(--ms-checkbox-checkmark-color)}.ms__checkbox--indeterminate:hover:not(:disabled){background:var(--ms-checkbox-checked-bg-hover);border-color:var(--ms-checkbox-checked-border-color-hover)}.ms__checkbox:checked:hover:not(:disabled){background:var(--ms-checkbox-checked-bg-hover);border-color:var(--ms-checkbox-checked-border-color-hover)}.ms__checkbox:focus-visible{outline:2px solid var(--ms-checkbox-checked-bg);outline-offset:2px}.ms__checkbox:disabled{cursor:not-allowed;background:var(--ms-checkbox-disabled-bg);border:var(--ms-checkbox-disabled-border);opacity:.6}.ms__checkbox:disabled:checked{background:var(--ms-checkbox-disabled-bg)}.ms__option--disabled .ms__checkbox{cursor:not-allowed}.ms__option-content{flex:1;display:flex;align-items:center;gap:var(--ms-option-content-gap);min-width:0}.ms__option-icon{flex-shrink:0;width:var(--ms-option-icon-size);height:var(--ms-option-icon-size);display:flex;align-items:center;justify-content:center;font-size:var(--ms-option-icon-font-size)}.ms__option-icon svg{width:100%;height:100%;fill:currentColor}.ms__option-text{flex:1;min-width:0}.ms__option-title{font-size:var(--ms-option-title-font-size);color:var(--ms-option-title-color);line-height:var(--ms-line-height-relaxed);white-space:var(--ms-option-title-white-space, normal);overflow:var(--ms-option-title-overflow, visible);text-overflow:var(--ms-option-title-text-overflow, clip)}.ms__option:hover .ms__option-title{color:var(--ms-option-title-color-hover, var(--ms-option-title-color))}.ms__option--selected .ms__option-title{color:var(--ms-option-title-color-selected, var(--ms-option-title-color))}.ms__option--selected:hover .ms__option-title{color:var(--ms-option-title-color-selected-hover, var(--ms-option-title-color-selected, var(--ms-option-title-color)))}.ms__option-title mark{background:var(--ms-option-mark-bg);color:var(--ms-option-mark-color);font-weight:var(--ms-option-mark-font-weight)}.ms__option-subtitle{margin-top:var(--ms-option-subtitle-margin-top);font-size:var(--ms-option-subtitle-font-size);color:var(--ms-option-subtitle-color);line-height:var(--ms-option-subtitle-line-height)}.ms__option:hover .ms__option-subtitle{color:var(--ms-option-subtitle-color-hover, var(--ms-option-subtitle-color))}.ms__option--selected .ms__option-subtitle{color:var(--ms-option-subtitle-color-selected, var(--ms-option-subtitle-color))}.ms__option--selected:hover .ms__option-subtitle{color:var(--ms-option-subtitle-color-selected-hover, var(--ms-option-subtitle-color-selected, var(--ms-option-subtitle-color)))}.ms__empty{display:flex;align-items:center;justify-content:center;min-height:var(--ms-state-min-height);padding:var(--ms-empty-padding);text-align:center;font-size:var(--ms-empty-font-size);color:var(--ms-empty-color)}.ms__loader{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:var(--ms-state-min-height);padding:var(--ms-loader-padding);gap:var(--ms-loader-gap)}.ms__loading-text{font-size:var(--ms-loading-text-font-size);color:var(--ms-loading-color)}}@layer component{.ms--rtl .ms__input-wrapper{direction:rtl}.ms--rtl .ms__input{text-align:right;padding-left:var(--ms-input-padding-right);padding-right:var(--ms-input-padding-h)}.ms--rtl .ms__toggle{left:var(--ms-toggle-right)!important;right:auto!important}.ms--rtl .ms__counter{left:var(--ms-counter-offset)!important;right:auto!important}.ms--rtl .ms__dropdown{direction:rtl;text-align:right}.ms--rtl .ms__option{flex-direction:row-reverse}.ms--rtl .ms__checkbox{margin-left:var(--ms-spacing-sm);margin-right:0}.ms--rtl .ms__option-content{text-align:right}.ms--rtl .ms__option-icon{margin-left:var(--ms-spacing-xs);margin-right:0}.ms--rtl .ms__badges{direction:rtl}.ms--rtl .ms__badges--right{margin-left:0;margin-right:var(--ms-badges-margin-right)}.ms--rtl .ms__badges--left{margin-right:0;margin-left:var(--ms-badges-margin-left)}.ms--rtl .ms__badge{flex-direction:row-reverse}.ms--rtl .ms__badge-remove{border-radius:var(--ms-badge-border-radius) 0 0 var(--ms-badge-border-radius);border-left:var(--ms-badge-remove-border);border-right:none}.ms--rtl .ms__badge-text{border-radius:0 var(--ms-badge-border-radius) var(--ms-badge-border-radius) 0;border-right:var(--ms-badge-text-border);border-left:none}.ms--rtl .ms__count-display{direction:rtl}.ms--rtl .ms__count-display--right{margin-left:0;margin-right:var(--ms-count-display-margin-right)}.ms--rtl .ms__count-display--left{margin-right:0;margin-left:var(--ms-count-display-margin-left)}.ms--rtl .ms__counter-wrapper{flex-direction:row-reverse}.ms--rtl .ms__selected-popover{direction:rtl;text-align:right}.ms--rtl .ms__actions{direction:rtl}.ms--rtl .ms__group-label,.ms--rtl .ms__empty{text-align:right}.ms--rtl .ms__hint{direction:rtl;text-align:right}}@layer component{.ms__option--tree{padding-inline-start:calc(var(--ms-tree-base-indent, .75rem) + var(--ms-tree-depth, 0) * var(--ms-tree-indent, 1.25rem))}.ms__option--tree-unselectable{cursor:default}.ms__option--tree-unselectable:hover{background:transparent}}@layer overrides{:host-context([data-theme="dark"]),:host-context([data-bs-theme="dark"]),:host-context(.dark){color-scheme:dark}:host-context([data-theme="light"]),:host-context([data-bs-theme="light"]),:host-context(.light){color-scheme:light}:host([data-theme="dark"]){color-scheme:dark}:host([data-theme="light"]){color-scheme:light}}`,zs=typeof HTMLElement<"u"?HTMLElement:class{},Be=[{attr:"search-hint",key:"searchHint",parser:"string-or-undefined"},{attr:"search-placeholder",key:"searchPlaceholder",parser:"string",default:"Search..."},{attr:"select-placeholder",key:"selectPlaceholder",parser:"string",default:"Pick an option..."},{attr:"no-data-placeholder",key:"noDataPlaceholder",parser:"string-or-undefined"},{attr:"dropdown-min-width",key:"dropdownMinWidth",parser:"string-or-undefined"},{attr:"dropdown-max-width",key:"dropdownMaxWidth",parser:"string-or-undefined"},{attr:"max-height",key:"maxHeight",parser:"string",default:"20rem"},{attr:"empty-message",key:"emptyMessage",parser:"string",default:"No results found"},{attr:"loading-message",key:"loadingMessage",parser:"string",default:"Loading..."},{attr:"remove-button-tooltip-text",key:"removeButtonTooltipText",parser:"string-or-undefined"},{attr:"name",key:"formFieldId",parser:"string-or-undefined"},{attr:"value-member",key:"valueMember",parser:"string-or-undefined"},{attr:"display-value-member",key:"displayValueMember",parser:"string-or-undefined"},{attr:"search-value-member",key:"searchValueMember",parser:"string-or-undefined"},{attr:"icon-member",key:"iconMember",parser:"string-or-undefined"},{attr:"subtitle-member",key:"subtitleMember",parser:"string-or-undefined"},{attr:"full-title-member",key:"fullTitleMember",parser:"string-or-undefined"},{attr:"group-member",key:"groupMember",parser:"string-or-undefined"},{attr:"disabled-member",key:"disabledMember",parser:"string-or-undefined"},{attr:"path-member",key:"pathMember",parser:"string-or-undefined"},{attr:"parent-path-member",key:"parentPathMember",parser:"string-or-undefined"},{attr:"level-member",key:"levelMember",parser:"string-or-undefined"},{attr:"has-children-member",key:"hasChildrenMember",parser:"string-or-undefined"},{attr:"is-selectable-member",key:"isSelectableMember",parser:"string-or-undefined"},{attr:"tree-path-separator",key:"treePathSeparator",parser:"string",default:"."},{attr:"checkbox-mode",key:"checkboxMode",parser:"enum",enumValues:["independent","cascade"],default:"independent"},{attr:"cascade-select-policy",key:"cascadeSelectPolicy",parser:"enum",enumValues:["rolled-up","leaves","all"],default:"rolled-up"},{attr:"badges-display-mode",key:"badgesDisplayMode",parser:"enum",enumValues:["badges","count","compact","partial","none"],default:"badges"},{attr:"badges-position",key:"badgesPosition",parser:"enum",enumValues:["top","bottom","left","right"],default:"bottom"},{attr:"badges-threshold-mode",key:"badgesThresholdMode",parser:"enum",enumValues:["count","partial"],default:"count"},{attr:"search-input-mode",key:"searchInputMode",parser:"enum",enumValues:["normal","readonly","hidden"],default:"normal"},{attr:"search-mode",key:"searchMode",parser:"enum",enumValues:["filter","navigate"],default:"filter"},{attr:"actions-layout",key:"actionsLayout",parser:"enum",enumValues:["nowrap","wrap"],default:"nowrap"},{attr:"actions-position",key:"actionsPosition",parser:"enum",enumValues:["top","bottom"],default:"top"},{attr:"actions-align",key:"actionsAlign",parser:"enum",enumValues:["stretch","left","right","center","space-between"],default:"stretch"},{attr:"checkbox-align",key:"checkboxAlign",parser:"enum",enumValues:["top","center","bottom"],default:"center"},{attr:"value-format",key:"valueFormat",parser:"enum",enumValues:["json","csv","array"],default:"json"},{attr:"badge-tooltip-placement",key:"badgeTooltipPlacement",parser:"enum",enumValues:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],default:"top"},{attr:"option-tooltip-placement",key:"optionTooltipPlacement",parser:"enum",enumValues:["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],default:"top-start"},{attr:"badges-threshold",key:"badgesThreshold",parser:"int"},{attr:"badges-max-visible",key:"badgesMaxVisible",parser:"int"},{attr:"min-search-length",key:"minSearchLength",parser:"int",default:0},{attr:"search-debounce",key:"searchDebounce",parser:"int",default:0},{attr:"virtual-scroll-threshold",key:"virtualScrollThreshold",parser:"int",default:100},{attr:"option-height",key:"optionHeight",parser:"int",default:50},{attr:"badge-height",key:"badgeHeight",parser:"int",default:36},{attr:"virtual-scroll-buffer",key:"virtualScrollBuffer",parser:"int",default:10},{attr:"badge-tooltip-delay",key:"badgeTooltipDelay",parser:"int",default:100},{attr:"badge-tooltip-offset",key:"badgeTooltipOffset",parser:"int",default:8},{attr:"option-tooltip-delay",key:"optionTooltipDelay",parser:"int"},{attr:"option-tooltip-offset",key:"optionTooltipOffset",parser:"int"},{attr:"multiple",key:"isMultipleEnabled",parser:"bool-default-true"},{attr:"allow-groups",key:"isGroupsAllowed",parser:"bool-default-true"},{attr:"show-checkboxes",key:"isCheckboxesShown",parser:"bool-default-true"},{attr:"sticky-actions",key:"isActionsSticky",parser:"bool-default-true"},{attr:"lock-placement",key:"isPlacementLocked",parser:"bool-default-true"},{attr:"enable-search",key:"isSearchEnabled",parser:"bool-default-true"},{attr:"keep-options-on-search",key:"isKeepOptionsOnSearch",parser:"bool-default-true"},{attr:"should-keep-search-on-close",key:"shouldKeepSearchOnClose",parser:"bool-default-true"},{attr:"close-on-select",key:"isCloseOnSelect",parser:"bool-default-false"},{attr:"allow-add-new",key:"isAddNewAllowed",parser:"bool-default-false"},{attr:"show-counter",key:"isCounterShown",parser:"bool-default-false"},{attr:"show-badge-full-title",key:"isBadgeFullTitleShown",parser:"bool-default-false"},{attr:"enable-virtual-scroll",key:"isVirtualScrollEnabled",parser:"bool-default-false"},{attr:"enable-badge-tooltips",key:"isBadgeTooltipsEnabled",parser:"bool-default-false"},{attr:"enable-option-tooltips",key:"isOptionTooltipsEnabled",parser:"bool-default-false"},{attr:"option-tooltip-follow-cursor",key:"isOptionTooltipFollowCursor",parser:"bool-default-false"}],Bs=new Map(Be.map(o=>[o.attr,o])),yt=[{key:"valueMember",field:"_valueMember"},{key:"displayValueMember",field:"_displayValueMember"},{key:"searchValueMember",field:"_searchValueMember"},{key:"iconMember",field:"_iconMember"},{key:"subtitleMember",field:"_subtitleMember"},{key:"groupMember",field:"_groupMember"},{key:"disabledMember",field:"_disabledMember"}],$s=[{key:"valueMember",member:"value"},{key:"displayValueMember",member:"label"},{key:"groupMember",member:"group"},{key:"iconMember",member:"icon"},{key:"subtitleMember",member:"subtitle"},{key:"disabledMember",member:"disabled"}];function wt(o,t){if(t===null||t==="")switch(o.parser){case"bool-default-true":return!0;case"bool-default-false":return!1;default:return o.default}switch(o.parser){case"string":case"string-or-undefined":return t;case"enum":return o.enumValues.includes(t)?t:o.default;case"int":{const e=parseInt(t);return isNaN(e)?o.default:e}case"bool-default-true":return t!=="false";case"bool-default-false":return t==="true"}}const $e=new Set;function xt(){return Array.from($e)}class we extends zs{constructor(){super();h(this,"picker");h(this,"containerElement");h(this,"shadow");h(this,"internals");h(this,"_options");h(this,"_hasDeclarativeOptions",!1);h(this,"_valueMember");h(this,"_getValueCallback");h(this,"_displayValueMember");h(this,"_getDisplayValueCallback");h(this,"_getBadgeDisplayCallback");h(this,"_getBadgeClassCallback");h(this,"_customStylesCallback");h(this,"_searchValueMember");h(this,"_getSearchValueCallback");h(this,"_iconMember");h(this,"_getIconCallback");h(this,"_subtitleMember");h(this,"_getSubtitleCallback");h(this,"_getFullTitleCallback");h(this,"_groupMember");h(this,"_getGroupCallback");h(this,"_renderGroupLabelContentCallback");h(this,"_disabledMember");h(this,"_getDisabledCallback");h(this,"_getPathCallback");h(this,"_isTreeEnabled");h(this,"_getIsSelectableCallback");h(this,"_getValueFormatCallback");h(this,"_getBadgeTooltipCallback");h(this,"_getOptionTooltipCallback");h(this,"_getRemoveButtonTooltipCallback");h(this,"_renderOptionContentCallback");h(this,"_renderBadgeContentCallback");h(this,"_renderSelectedItemContentCallback");h(this,"_getSelectedItemClassCallback");h(this,"_renderSelectedContentCallback");h(this,"_getCounterCallback");h(this,"_actionButtons");h(this,"_batchDepth",0);h(this,"_batchPartial",{});h(this,"_batchNeedsReinit",!1);h(this,"_beforeSearchCallback");h(this,"_beforeSelectCallback");h(this,"_beforeDeselectCallback");h(this,"_searchCallback");h(this,"_addNewCallback");h(this,"_onSelect");h(this,"_onDeselect");h(this,"_onChange");h(this,"_declarativeSelectedValues");if(this.shadow=this.attachShadow({mode:"open"}),typeof this.attachInternals=="function")try{this.internals=this.attachInternals()}catch{}const e=document.createElement("style");e.textContent=Ds,this.shadow.appendChild(e),requestAnimationFrame(()=>{this.setAttribute("data-ready","")})}static get observedAttributes(){return[...Be.map(e=>e.attr),"initial-values","show-debug-info"]}formResetCallback(){var e;(e=this.picker)==null||e.clearAll()}connectedCallback(){$e.add(this),this.render();const e=this.parseDeclarativeOptions();e&&(this._options&&this._options.length>0&&A.warn("[MultiSelectElement] Both declarative <option> elements and programmatic .options detected. Using declarative options."),this._options=e,this._hasDeclarativeOptions=!0),this.initializePicker()}disconnectedCallback(){$e.delete(this),this.picker&&this.picker.destroy()}attributeChangedCallback(e,s,i){var n;if(s===i||!this.picker||e==="initial-values")return;if(e==="show-debug-info"){const a=this.shadow.querySelector(".ms__debug-info");a&&a.remove(),i==="true"&&this.renderDebugInfo();return}const r=Bs.get(e);if(r){const a=wt(r,i),l=(n=yt.find(u=>u.key===r.key))==null?void 0:n.field,c=a===void 0&&l?this[l]:a;if(this._batchDepth>0){this._batchPartial[r.key]=c;return}const d={[r.key]:c};if(this.picker.updateOptions(d))return}if(this._batchDepth>0){this._batchNeedsReinit=!0;return}this.reinitialize()}setAttributes(e){this._batchDepth++;try{for(const[r,n]of Object.entries(e))n==null||n===!1?this.removeAttribute(r):this.setAttribute(r,n===!0?"":String(n))}finally{this._batchDepth--}if(this._batchDepth>0)return;const s=this._batchPartial,i=this._batchNeedsReinit;if(this._batchPartial={},this._batchNeedsReinit=!1,!!this.picker){if(i){this.reinitialize();return}Object.keys(s).length>0&&(this.picker.updateOptions(s)||this.reinitialize())}}render(){this.containerElement=document.createElement("div"),this.containerElement.setAttribute("data-multiselect",""),this.className&&(this.containerElement.className=this.className),this.shadow.appendChild(this.containerElement),this.getAttribute("show-debug-info")==="true"&&this.renderDebugInfo()}renderDebugInfo(){const e=this.shadow.querySelector(".ms__debug-info");e&&e.remove();const s=document.createElement("div");s.className="ms__debug-info";const i=document.createElement("details"),r=document.createElement("summary");r.textContent="Debug Info";const n=document.createElement("div");n.className="ms__debug-stats",i.appendChild(r),i.appendChild(n),s.appendChild(i),this.shadow.appendChild(s),this.updateDebugInfo()}updateDebugInfo(){var m,b;const e=this.shadow.querySelector(".ms__debug-stats");if(!e||!this.picker)return;const s="1.12.0-rc07",i=xt().length,n=this.picker.getSelected().length,a=((m=this._options)==null?void 0:m.length)||0,l=this.picker,c=l.isOpen||!1,d=l.searchTerm||"",p=l.isLoading||!1,u=((b=l.filteredOptions)==null?void 0:b.length)||0;e.innerHTML=`
38
38
  <span>Version: ${s}</span>
39
39
  <span>Total Instances: ${i}</span>
40
40
  <span>Options: ${a}</span>
41
41
  <span>Filtered: ${u}</span>
42
42
  <span>Selected: ${n}</span>
43
- <span>Dropdown: ${d?"Open":"Closed"}</span>
44
- <span>Search: ${c||"none"}</span>
45
- <span>Loading: ${m?"Yes":"No"}</span>
46
- `,setTimeout(()=>{this.getAttribute("show-debug-info")==="true"&&this.updateDebugInfo()},500)}parseDeclarativeOptions(){var r,n,a,l;const e=[],s=Array.from(this.children);if(s.length===0)return null;let i=!1;for(const d of s)if(d.tagName==="OPTION"){const c=d,m={value:c.value||((r=c.textContent)==null?void 0:r.trim())||"",label:((n=c.textContent)==null?void 0:n.trim())||c.value||""};c.hasAttribute("selected")&&(this._declarativeSelectedValues||(this._declarativeSelectedValues=[]),this._declarativeSelectedValues.push(m.value)),c.hasAttribute("disabled")&&(m.disabled=!0),c.hasAttribute("data-icon")&&(m.icon=c.getAttribute("data-icon")),c.hasAttribute("data-subtitle")&&(m.subtitle=c.getAttribute("data-subtitle")),e.push(m),i=!0}else if(d.tagName==="OPTGROUP"){const c=d,m=c.label||c.getAttribute("label")||"Group",u=Array.from(c.querySelectorAll("option"));for(const p of u){const b={value:p.value||((a=p.textContent)==null?void 0:a.trim())||"",label:((l=p.textContent)==null?void 0:l.trim())||p.value||"",group:m};p.hasAttribute("selected")&&(this._declarativeSelectedValues||(this._declarativeSelectedValues=[]),this._declarativeSelectedValues.push(b.value)),p.hasAttribute("disabled")&&(b.disabled=!0),p.hasAttribute("data-icon")&&(b.icon=p.getAttribute("data-icon")),p.hasAttribute("data-subtitle")&&(b.subtitle=p.getAttribute("data-subtitle")),e.push(b),i=!0}}return i?(A.debug(`[MultiSelectElement] Parsed ${e.length} declarative options from Light DOM`),s.forEach(d=>{(d.tagName==="OPTION"||d.tagName==="OPTGROUP")&&d.remove()}),e):null}parseAttributesFromTable(){const e={};for(const s of ze){const i=wt(s,this.getAttribute(s.attr));i!==void 0&&(e[s.key]=i)}return e}initializePicker(){if(!this.containerElement)return;let e;const s=this.getAttribute("data-options");if(s&&this._options===void 0)try{e=JSON.parse(s)}catch(n){A.error("[MultiSelectElement] Failed to parse data-options:",n)}let i;if(this._declarativeSelectedValues&&this._declarativeSelectedValues.length>0)i=this._declarativeSelectedValues,A.debug(`[MultiSelectElement] Using ${i.length} declaratively selected values`);else{const n=this.getAttribute("initial-values");if(n)try{i=JSON.parse(n)}catch(a){A.error("[MultiSelectElement] Failed to parse initial-values:",a)}}const r=this.parseAttributesFromTable();for(const{key:n,field:a}of yt)r[n]===void 0&&(r[n]=this[a]);if(this._hasDeclarativeOptions){const n={valueMember:this._getValueCallback,displayValueMember:this._getDisplayValueCallback,groupMember:this._getGroupCallback,iconMember:this._getIconCallback,subtitleMember:this._getSubtitleCallback,disabledMember:this._getDisabledCallback};for(const{key:a,member:l}of $s)r[a]===void 0&&!n[a]&&(r[a]=l)}if(Object.assign(r,{actionButtons:this._actionButtons,getValueCallback:this._getValueCallback,getDisplayValueCallback:this._getDisplayValueCallback,getBadgeDisplayCallback:this._getBadgeDisplayCallback,getBadgeClassCallback:this._getBadgeClassCallback,customStylesCallback:this._customStylesCallback,getSearchValueCallback:this._getSearchValueCallback,getIconCallback:this._getIconCallback,getSubtitleCallback:this._getSubtitleCallback,getFullTitleCallback:this._getFullTitleCallback,getGroupCallback:this._getGroupCallback,getPathCallback:this._getPathCallback,isTreeEnabled:this._isTreeEnabled,getIsSelectableCallback:this._getIsSelectableCallback,renderGroupLabelContentCallback:this._renderGroupLabelContentCallback,getDisabledCallback:this._getDisabledCallback,renderOptionContentCallback:this._renderOptionContentCallback,renderBadgeContentCallback:this._renderBadgeContentCallback,renderSelectedItemContentCallback:this._renderSelectedItemContentCallback,getSelectedItemClassCallback:this._getSelectedItemClassCallback,renderSelectedContentCallback:this._renderSelectedContentCallback,getValueFormatCallback:this._getValueFormatCallback,getBadgeTooltipCallback:this._getBadgeTooltipCallback,getOptionTooltipCallback:this._getOptionTooltipCallback,getRemoveButtonTooltipCallback:this._getRemoveButtonTooltipCallback,getCounterCallback:this._getCounterCallback||((n,a)=>a!==void 0?`+${a} more`:`${n} selected`),options:this._options??e,beforeSearchCallback:this._beforeSearchCallback,beforeSelectCallback:this._beforeSelectCallback,beforeDeselectCallback:this._beforeDeselectCallback,searchCallback:this._searchCallback,addNewCallback:this._addNewCallback,onSelect:n=>{var a;this._onSelect&&this._onSelect(n),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{option:n,selectedOptions:(a=this.picker)==null?void 0:a.getSelected(),selectedValues:this.collectSelectedValues()}}))},onDeselect:n=>{var a;this._onDeselect&&this._onDeselect(n),this.dispatchEvent(new CustomEvent("deselect",{bubbles:!0,composed:!0,detail:{option:n,selectedOptions:(a=this.picker)==null?void 0:a.getSelected(),selectedValues:this.collectSelectedValues()}}))},onChange:n=>{this._onChange&&this._onChange(n),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{selectedOptions:n,selectedValues:this.collectSelectedValues()}}))},container:this.shadow,hostElement:this}),i&&(this.containerElement.dataset.initialValues=JSON.stringify(i)),this.picker=new kt(this.containerElement,r),this._customStylesCallback){const n=this._customStylesCallback();if(n){const a=document.createElement("style");a.className="ms-custom-styles",a.textContent=n,this.shadow.insertBefore(a,this.shadow.firstChild)}}}reinitialize(){this.picker&&(this.picker.destroy(),this.initializePicker())}updatePicker(e){this.picker&&(this.picker.updateOptions(e)||this.reinitialize())}collectSelectedValues(){var s;const e=(s=this.picker)==null?void 0:s.getValue();return e==null?[]:Array.isArray(e)?e:[e]}get options(){return this._options}set options(e){this._options=e,this.updatePicker({options:e})}set valueMember(e){this._valueMember=e||void 0,e?this.setAttribute("value-member",e):this.removeAttribute("value-member")}get valueMember(){return this.getAttribute("value-member")}set displayValueMember(e){this._displayValueMember=e||void 0,e?this.setAttribute("display-value-member",e):this.removeAttribute("display-value-member")}get displayValueMember(){return this.getAttribute("display-value-member")}set searchValueMember(e){this._searchValueMember=e||void 0,e?this.setAttribute("search-value-member",e):this.removeAttribute("search-value-member")}get searchValueMember(){return this.getAttribute("search-value-member")}set iconMember(e){this._iconMember=e||void 0,e?this.setAttribute("icon-member",e):this.removeAttribute("icon-member")}get iconMember(){return this.getAttribute("icon-member")}set subtitleMember(e){this._subtitleMember=e||void 0,e?this.setAttribute("subtitle-member",e):this.removeAttribute("subtitle-member")}get subtitleMember(){return this.getAttribute("subtitle-member")}set fullTitleMember(e){e?this.setAttribute("full-title-member",e):this.removeAttribute("full-title-member")}get fullTitleMember(){return this.getAttribute("full-title-member")}set groupMember(e){this._groupMember=e||void 0,e?this.setAttribute("group-member",e):this.removeAttribute("group-member")}get groupMember(){return this.getAttribute("group-member")}set disabledMember(e){this._disabledMember=e||void 0,e?this.setAttribute("disabled-member",e):this.removeAttribute("disabled-member")}get disabledMember(){return this.getAttribute("disabled-member")}set pathMember(e){e?this.setAttribute("path-member",e):this.removeAttribute("path-member")}get pathMember(){return this.getAttribute("path-member")}set parentPathMember(e){e?this.setAttribute("parent-path-member",e):this.removeAttribute("parent-path-member")}get parentPathMember(){return this.getAttribute("parent-path-member")}set levelMember(e){e?this.setAttribute("level-member",e):this.removeAttribute("level-member")}get levelMember(){return this.getAttribute("level-member")}set hasChildrenMember(e){e?this.setAttribute("has-children-member",e):this.removeAttribute("has-children-member")}get hasChildrenMember(){return this.getAttribute("has-children-member")}set isSelectableMember(e){e?this.setAttribute("is-selectable-member",e):this.removeAttribute("is-selectable-member")}get isSelectableMember(){return this.getAttribute("is-selectable-member")}set treePathSeparator(e){e?this.setAttribute("tree-path-separator",e):this.removeAttribute("tree-path-separator")}get treePathSeparator(){return this.getAttribute("tree-path-separator")}set checkboxMode(e){e?this.setAttribute("checkbox-mode",e):this.removeAttribute("checkbox-mode")}get checkboxMode(){return this.getAttribute("checkbox-mode")}set cascadeSelectPolicy(e){e?this.setAttribute("cascade-select-policy",e):this.removeAttribute("cascade-select-policy")}get cascadeSelectPolicy(){return this.getAttribute("cascade-select-policy")}set getValueCallback(e){this._getValueCallback=e,this.updatePicker({getValueCallback:e})}get getValueCallback(){return this._getValueCallback}set getDisplayValueCallback(e){this._getDisplayValueCallback=e,this.updatePicker({getDisplayValueCallback:e})}get getDisplayValueCallback(){return this._getDisplayValueCallback}set getBadgeDisplayCallback(e){this._getBadgeDisplayCallback=e,this.updatePicker({getBadgeDisplayCallback:e})}get getBadgeDisplayCallback(){return this._getBadgeDisplayCallback}set getBadgeClassCallback(e){this._getBadgeClassCallback=e,this.updatePicker({getBadgeClassCallback:e})}get getBadgeClassCallback(){return this._getBadgeClassCallback}set customStylesCallback(e){if(this._customStylesCallback=e,this.picker&&e){const s=e();if(s){const i=this.shadow.querySelector("style.ms-custom-styles");i&&i.remove();const r=document.createElement("style");r.className="ms-custom-styles",r.textContent=s,this.shadow.appendChild(r),this.picker.renderBadges()}}}get customStylesCallback(){return this._customStylesCallback}set getSearchValueCallback(e){this._getSearchValueCallback=e,this.updatePicker({getSearchValueCallback:e})}get getSearchValueCallback(){return this._getSearchValueCallback}set getIconCallback(e){this._getIconCallback=e,this.updatePicker({getIconCallback:e})}get getIconCallback(){return this._getIconCallback}set getSubtitleCallback(e){this._getSubtitleCallback=e,this.updatePicker({getSubtitleCallback:e})}get getSubtitleCallback(){return this._getSubtitleCallback}set getFullTitleCallback(e){this._getFullTitleCallback=e,this.updatePicker({getFullTitleCallback:e})}get getFullTitleCallback(){return this._getFullTitleCallback}set getGroupCallback(e){this._getGroupCallback=e,this.updatePicker({getGroupCallback:e})}get getGroupCallback(){return this._getGroupCallback}set getPathCallback(e){this._getPathCallback=e,this.updatePicker({getPathCallback:e})}get getPathCallback(){return this._getPathCallback}set isTreeEnabled(e){this._isTreeEnabled=e,this.updatePicker({isTreeEnabled:e})}get isTreeEnabled(){return this._isTreeEnabled}set getIsSelectableCallback(e){this._getIsSelectableCallback=e,this.updatePicker({getIsSelectableCallback:e})}get getIsSelectableCallback(){return this._getIsSelectableCallback}set renderGroupLabelContentCallback(e){this._renderGroupLabelContentCallback=e,this.updatePicker({renderGroupLabelContentCallback:e})}get renderGroupLabelContentCallback(){return this._renderGroupLabelContentCallback}set getDisabledCallback(e){this._getDisabledCallback=e,this.updatePicker({getDisabledCallback:e})}get getDisabledCallback(){return this._getDisabledCallback}set renderOptionContentCallback(e){this._renderOptionContentCallback=e,this.updatePicker({renderOptionContentCallback:e})}get renderOptionContentCallback(){return this._renderOptionContentCallback}set renderBadgeContentCallback(e){this._renderBadgeContentCallback=e,this.updatePicker({renderBadgeContentCallback:e})}get renderBadgeContentCallback(){return this._renderBadgeContentCallback}set renderSelectedItemContentCallback(e){this._renderSelectedItemContentCallback=e,this.updatePicker({renderSelectedItemContentCallback:e})}get renderSelectedItemContentCallback(){return this._renderSelectedItemContentCallback}set getSelectedItemClassCallback(e){this._getSelectedItemClassCallback=e,this.updatePicker({getSelectedItemClassCallback:e})}get getSelectedItemClassCallback(){return this._getSelectedItemClassCallback}set renderSelectedContentCallback(e){this._renderSelectedContentCallback=e,this.updatePicker({renderSelectedContentCallback:e})}get renderSelectedContentCallback(){return this._renderSelectedContentCallback}set name(e){e?this.setAttribute("name",e):this.removeAttribute("name")}get name(){return this.getAttribute("name")}set valueFormat(e){e?this.setAttribute("value-format",e):this.removeAttribute("value-format")}get valueFormat(){return this.getAttribute("value-format")}set getValueFormatCallback(e){this._getValueFormatCallback=e,this.updatePicker({getValueFormatCallback:e})}get getValueFormatCallback(){return this._getValueFormatCallback}set thresholdMode(e){e?this.setAttribute("threshold-mode",e):this.removeAttribute("threshold-mode")}get thresholdMode(){return this.getAttribute("threshold-mode")}set badgesMaxVisible(e){e!==null?this.setAttribute("badges-max-visible",String(e)):this.removeAttribute("badges-max-visible")}get badgesMaxVisible(){const e=this.getAttribute("badges-max-visible");return e?parseInt(e):null}set checkboxAlign(e){e?this.setAttribute("checkbox-align",e):this.removeAttribute("checkbox-align")}get checkboxAlign(){return this.getAttribute("checkbox-align")}set enableBadgeTooltips(e){e?this.setAttribute("enable-badge-tooltips","true"):this.removeAttribute("enable-badge-tooltips")}get enableBadgeTooltips(){return this.getAttribute("enable-badge-tooltips")==="true"}set enableOptionTooltips(e){e?this.setAttribute("enable-option-tooltips","true"):this.removeAttribute("enable-option-tooltips")}get enableOptionTooltips(){return this.getAttribute("enable-option-tooltips")==="true"}set getOptionTooltipCallback(e){this._getOptionTooltipCallback=e,this.updatePicker({getOptionTooltipCallback:e})}get getOptionTooltipCallback(){return this._getOptionTooltipCallback}set optionTooltipPlacement(e){e?this.setAttribute("option-tooltip-placement",e):this.removeAttribute("option-tooltip-placement")}get optionTooltipPlacement(){return this.getAttribute("option-tooltip-placement")}set optionTooltipFollowCursor(e){e?this.setAttribute("option-tooltip-follow-cursor","true"):this.removeAttribute("option-tooltip-follow-cursor")}get optionTooltipFollowCursor(){return this.getAttribute("option-tooltip-follow-cursor")==="true"}set actionsPosition(e){e?this.setAttribute("actions-position",e):this.removeAttribute("actions-position")}get actionsPosition(){return this.getAttribute("actions-position")}set actionsAlign(e){e?this.setAttribute("actions-align",e):this.removeAttribute("actions-align")}get actionsAlign(){return this.getAttribute("actions-align")}set badgeTooltipPlacement(e){e?this.setAttribute("badge-tooltip-placement",e):this.removeAttribute("badge-tooltip-placement")}get badgeTooltipPlacement(){return this.getAttribute("badge-tooltip-placement")}set getBadgeTooltipCallback(e){this._getBadgeTooltipCallback=e,this.updatePicker({getBadgeTooltipCallback:e})}get getBadgeTooltipCallback(){return this._getBadgeTooltipCallback}set getRemoveButtonTooltipCallback(e){this._getRemoveButtonTooltipCallback=e,this.updatePicker({getRemoveButtonTooltipCallback:e})}get getRemoveButtonTooltipCallback(){return this._getRemoveButtonTooltipCallback}set removeButtonTooltipText(e){e?this.setAttribute("remove-button-tooltip-text",e):this.removeAttribute("remove-button-tooltip-text")}get removeButtonTooltipText(){return this.getAttribute("remove-button-tooltip-text")}set getCounterCallback(e){this._getCounterCallback=e,this.updatePicker({getCounterCallback:e})}get getCounterCallback(){return this._getCounterCallback}get beforeSearchCallback(){return this._beforeSearchCallback}set beforeSearchCallback(e){this._beforeSearchCallback=e,this.updatePicker({beforeSearchCallback:e})}get beforeSelectCallback(){return this._beforeSelectCallback}set beforeSelectCallback(e){this._beforeSelectCallback=e,this.updatePicker({beforeSelectCallback:e})}get beforeDeselectCallback(){return this._beforeDeselectCallback}set beforeDeselectCallback(e){this._beforeDeselectCallback=e,this.updatePicker({beforeDeselectCallback:e})}get searchCallback(){return this._searchCallback}set searchCallback(e){this._searchCallback=e,this.updatePicker({searchCallback:e})}get addNewCallback(){return this._addNewCallback}set addNewCallback(e){this._addNewCallback=e,this.updatePicker({addNewCallback:e})}get onSelect(){return this._onSelect}set onSelect(e){this._onSelect=e}get onDeselect(){return this._onDeselect}set onDeselect(e){this._onDeselect=e}get onChange(){return this._onChange}set onChange(e){this._onChange=e}get actionButtons(){return this._actionButtons}set actionButtons(e){this._actionButtons=e,this.updatePicker({actionButtons:e})}get selectedValue(){var e;return((e=this.picker)==null?void 0:e.selectedValue)??null}get selectedItem(){var e;return((e=this.picker)==null?void 0:e.selectedItem)??null}getSelected(){return this.picker?this.picker.getSelected():[]}setSelected(e){this.picker&&this.picker.setSelected(e)}getValue(){return this.picker?this.picker.getValue():null}destroy(){this.picker&&this.picker.destroy()}}h(we,"formAssociated",!0),typeof window<"u"&&typeof customElements<"u"&&(customElements.get("web-multiselect")||customElements.define("web-multiselect",we)),typeof window<"u"&&(window.components=window.components||{},window.components["web-multiselect"]={version:()=>"1.12.0-rc06",config:{name:"@keenmate/web-multiselect",version:"1.12.0-rc06",author:"Keenmate",license:"MIT",repository:"git+https://github.com/keenmate/web-multiselect.git",homepage:"https://web-multiselect.keenmate.dev"},logging:{enableLogging:ht,disableLogging:mt,setLogLevel:pt,setCategoryLevel:ut,getCategories:()=>[...dt]},register:()=>{typeof customElements<"u"&&!customElements.get("web-multiselect")&&customElements.define("web-multiselect",we)},getInstances:()=>xt()}),O.LOGGING_CATEGORIES=dt,O.MultiSelectElement=we,O.WebMultiSelect=kt,O.dataLogger=A,O.disableLogging=mt,O.enableLogging=ht,O.initLogger=le,O.interactionLogger=L,O.setCategoryLevel=ut,O.setLogLevel=pt,O.uiLogger=H,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
43
+ <span>Dropdown: ${c?"Open":"Closed"}</span>
44
+ <span>Search: ${d||"none"}</span>
45
+ <span>Loading: ${p?"Yes":"No"}</span>
46
+ `,setTimeout(()=>{this.getAttribute("show-debug-info")==="true"&&this.updateDebugInfo()},500)}parseDeclarativeOptions(){var r,n,a,l;const e=[],s=Array.from(this.children);if(s.length===0)return null;let i=!1;for(const c of s)if(c.tagName==="OPTION"){const d=c,p={value:d.value||((r=d.textContent)==null?void 0:r.trim())||"",label:((n=d.textContent)==null?void 0:n.trim())||d.value||""};d.hasAttribute("selected")&&(this._declarativeSelectedValues||(this._declarativeSelectedValues=[]),this._declarativeSelectedValues.push(p.value)),d.hasAttribute("disabled")&&(p.disabled=!0),d.hasAttribute("data-icon")&&(p.icon=d.getAttribute("data-icon")),d.hasAttribute("data-subtitle")&&(p.subtitle=d.getAttribute("data-subtitle")),e.push(p),i=!0}else if(c.tagName==="OPTGROUP"){const d=c,p=d.label||d.getAttribute("label")||"Group",u=Array.from(d.querySelectorAll("option"));for(const m of u){const b={value:m.value||((a=m.textContent)==null?void 0:a.trim())||"",label:((l=m.textContent)==null?void 0:l.trim())||m.value||"",group:p};m.hasAttribute("selected")&&(this._declarativeSelectedValues||(this._declarativeSelectedValues=[]),this._declarativeSelectedValues.push(b.value)),m.hasAttribute("disabled")&&(b.disabled=!0),m.hasAttribute("data-icon")&&(b.icon=m.getAttribute("data-icon")),m.hasAttribute("data-subtitle")&&(b.subtitle=m.getAttribute("data-subtitle")),e.push(b),i=!0}}return i?(A.debug(`[MultiSelectElement] Parsed ${e.length} declarative options from Light DOM`),s.forEach(c=>{(c.tagName==="OPTION"||c.tagName==="OPTGROUP")&&c.remove()}),e):null}parseAttributesFromTable(){const e={};for(const s of Be){const i=wt(s,this.getAttribute(s.attr));i!==void 0&&(e[s.key]=i)}return e}initializePicker(){if(!this.containerElement)return;let e;const s=this.getAttribute("data-options");if(s&&this._options===void 0)try{e=JSON.parse(s)}catch(n){A.error("[MultiSelectElement] Failed to parse data-options:",n)}let i;if(this._declarativeSelectedValues&&this._declarativeSelectedValues.length>0)i=this._declarativeSelectedValues,A.debug(`[MultiSelectElement] Using ${i.length} declaratively selected values`);else{const n=this.getAttribute("initial-values");if(n)try{i=JSON.parse(n)}catch(a){A.error("[MultiSelectElement] Failed to parse initial-values:",a)}}const r=this.parseAttributesFromTable();for(const{key:n,field:a}of yt)r[n]===void 0&&(r[n]=this[a]);if(this._hasDeclarativeOptions){const n={valueMember:this._getValueCallback,displayValueMember:this._getDisplayValueCallback,groupMember:this._getGroupCallback,iconMember:this._getIconCallback,subtitleMember:this._getSubtitleCallback,disabledMember:this._getDisabledCallback};for(const{key:a,member:l}of $s)r[a]===void 0&&!n[a]&&(r[a]=l)}if(Object.assign(r,{actionButtons:this._actionButtons,getValueCallback:this._getValueCallback,getDisplayValueCallback:this._getDisplayValueCallback,getBadgeDisplayCallback:this._getBadgeDisplayCallback,getBadgeClassCallback:this._getBadgeClassCallback,customStylesCallback:this._customStylesCallback,getSearchValueCallback:this._getSearchValueCallback,getIconCallback:this._getIconCallback,getSubtitleCallback:this._getSubtitleCallback,getFullTitleCallback:this._getFullTitleCallback,getGroupCallback:this._getGroupCallback,getPathCallback:this._getPathCallback,isTreeEnabled:this._isTreeEnabled,getIsSelectableCallback:this._getIsSelectableCallback,renderGroupLabelContentCallback:this._renderGroupLabelContentCallback,getDisabledCallback:this._getDisabledCallback,renderOptionContentCallback:this._renderOptionContentCallback,renderBadgeContentCallback:this._renderBadgeContentCallback,renderSelectedItemContentCallback:this._renderSelectedItemContentCallback,getSelectedItemClassCallback:this._getSelectedItemClassCallback,renderSelectedContentCallback:this._renderSelectedContentCallback,getValueFormatCallback:this._getValueFormatCallback,getBadgeTooltipCallback:this._getBadgeTooltipCallback,getOptionTooltipCallback:this._getOptionTooltipCallback,getRemoveButtonTooltipCallback:this._getRemoveButtonTooltipCallback,getCounterCallback:this._getCounterCallback||((n,a)=>a!==void 0?`+${a} more`:`${n} selected`),options:this._options??e,beforeSearchCallback:this._beforeSearchCallback,beforeSelectCallback:this._beforeSelectCallback,beforeDeselectCallback:this._beforeDeselectCallback,searchCallback:this._searchCallback,addNewCallback:this._addNewCallback,onSelect:n=>{var a;this._onSelect&&this._onSelect(n),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{option:n,selectedOptions:(a=this.picker)==null?void 0:a.getSelected(),selectedValues:this.collectSelectedValues()}}))},onDeselect:n=>{var a;this._onDeselect&&this._onDeselect(n),this.dispatchEvent(new CustomEvent("deselect",{bubbles:!0,composed:!0,detail:{option:n,selectedOptions:(a=this.picker)==null?void 0:a.getSelected(),selectedValues:this.collectSelectedValues()}}))},onChange:n=>{this._onChange&&this._onChange(n),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{selectedOptions:n,selectedValues:this.collectSelectedValues()}}))},container:this.shadow,hostElement:this}),i&&(this.containerElement.dataset.initialValues=JSON.stringify(i)),this.picker=new kt(this.containerElement,r),this._customStylesCallback){const n=this._customStylesCallback();if(n){const a=document.createElement("style");a.className="ms-custom-styles",a.textContent=n,this.shadow.insertBefore(a,this.shadow.firstChild)}}}reinitialize(){this.picker&&(this.picker.destroy(),this.initializePicker())}updatePicker(e){this.picker&&(this.picker.updateOptions(e)||this.reinitialize())}collectSelectedValues(){var s;const e=(s=this.picker)==null?void 0:s.getValue();return e==null?[]:Array.isArray(e)?e:[e]}get options(){return this._options}set options(e){this._options=e,this.updatePicker({options:e})}set valueMember(e){this._valueMember=e||void 0,e?this.setAttribute("value-member",e):this.removeAttribute("value-member")}get valueMember(){return this.getAttribute("value-member")}set displayValueMember(e){this._displayValueMember=e||void 0,e?this.setAttribute("display-value-member",e):this.removeAttribute("display-value-member")}get displayValueMember(){return this.getAttribute("display-value-member")}set searchValueMember(e){this._searchValueMember=e||void 0,e?this.setAttribute("search-value-member",e):this.removeAttribute("search-value-member")}get searchValueMember(){return this.getAttribute("search-value-member")}set iconMember(e){this._iconMember=e||void 0,e?this.setAttribute("icon-member",e):this.removeAttribute("icon-member")}get iconMember(){return this.getAttribute("icon-member")}set subtitleMember(e){this._subtitleMember=e||void 0,e?this.setAttribute("subtitle-member",e):this.removeAttribute("subtitle-member")}get subtitleMember(){return this.getAttribute("subtitle-member")}set fullTitleMember(e){e?this.setAttribute("full-title-member",e):this.removeAttribute("full-title-member")}get fullTitleMember(){return this.getAttribute("full-title-member")}set groupMember(e){this._groupMember=e||void 0,e?this.setAttribute("group-member",e):this.removeAttribute("group-member")}get groupMember(){return this.getAttribute("group-member")}set disabledMember(e){this._disabledMember=e||void 0,e?this.setAttribute("disabled-member",e):this.removeAttribute("disabled-member")}get disabledMember(){return this.getAttribute("disabled-member")}set pathMember(e){e?this.setAttribute("path-member",e):this.removeAttribute("path-member")}get pathMember(){return this.getAttribute("path-member")}set parentPathMember(e){e?this.setAttribute("parent-path-member",e):this.removeAttribute("parent-path-member")}get parentPathMember(){return this.getAttribute("parent-path-member")}set levelMember(e){e?this.setAttribute("level-member",e):this.removeAttribute("level-member")}get levelMember(){return this.getAttribute("level-member")}set hasChildrenMember(e){e?this.setAttribute("has-children-member",e):this.removeAttribute("has-children-member")}get hasChildrenMember(){return this.getAttribute("has-children-member")}set isSelectableMember(e){e?this.setAttribute("is-selectable-member",e):this.removeAttribute("is-selectable-member")}get isSelectableMember(){return this.getAttribute("is-selectable-member")}set treePathSeparator(e){e?this.setAttribute("tree-path-separator",e):this.removeAttribute("tree-path-separator")}get treePathSeparator(){return this.getAttribute("tree-path-separator")}set checkboxMode(e){e?this.setAttribute("checkbox-mode",e):this.removeAttribute("checkbox-mode")}get checkboxMode(){return this.getAttribute("checkbox-mode")}set cascadeSelectPolicy(e){e?this.setAttribute("cascade-select-policy",e):this.removeAttribute("cascade-select-policy")}get cascadeSelectPolicy(){return this.getAttribute("cascade-select-policy")}set getValueCallback(e){this._getValueCallback=e,this.updatePicker({getValueCallback:e})}get getValueCallback(){return this._getValueCallback}set getDisplayValueCallback(e){this._getDisplayValueCallback=e,this.updatePicker({getDisplayValueCallback:e})}get getDisplayValueCallback(){return this._getDisplayValueCallback}set getBadgeDisplayCallback(e){this._getBadgeDisplayCallback=e,this.updatePicker({getBadgeDisplayCallback:e})}get getBadgeDisplayCallback(){return this._getBadgeDisplayCallback}set getBadgeClassCallback(e){this._getBadgeClassCallback=e,this.updatePicker({getBadgeClassCallback:e})}get getBadgeClassCallback(){return this._getBadgeClassCallback}set customStylesCallback(e){if(this._customStylesCallback=e,this.picker&&e){const s=e();if(s){const i=this.shadow.querySelector("style.ms-custom-styles");i&&i.remove();const r=document.createElement("style");r.className="ms-custom-styles",r.textContent=s,this.shadow.appendChild(r),this.picker.renderBadges()}}}get customStylesCallback(){return this._customStylesCallback}set getSearchValueCallback(e){this._getSearchValueCallback=e,this.updatePicker({getSearchValueCallback:e})}get getSearchValueCallback(){return this._getSearchValueCallback}set getIconCallback(e){this._getIconCallback=e,this.updatePicker({getIconCallback:e})}get getIconCallback(){return this._getIconCallback}set getSubtitleCallback(e){this._getSubtitleCallback=e,this.updatePicker({getSubtitleCallback:e})}get getSubtitleCallback(){return this._getSubtitleCallback}set getFullTitleCallback(e){this._getFullTitleCallback=e,this.updatePicker({getFullTitleCallback:e})}get getFullTitleCallback(){return this._getFullTitleCallback}set getGroupCallback(e){this._getGroupCallback=e,this.updatePicker({getGroupCallback:e})}get getGroupCallback(){return this._getGroupCallback}set getPathCallback(e){this._getPathCallback=e,this.updatePicker({getPathCallback:e})}get getPathCallback(){return this._getPathCallback}set isTreeEnabled(e){this._isTreeEnabled=e,this.updatePicker({isTreeEnabled:e})}get isTreeEnabled(){return this._isTreeEnabled}set getIsSelectableCallback(e){this._getIsSelectableCallback=e,this.updatePicker({getIsSelectableCallback:e})}get getIsSelectableCallback(){return this._getIsSelectableCallback}set renderGroupLabelContentCallback(e){this._renderGroupLabelContentCallback=e,this.updatePicker({renderGroupLabelContentCallback:e})}get renderGroupLabelContentCallback(){return this._renderGroupLabelContentCallback}set getDisabledCallback(e){this._getDisabledCallback=e,this.updatePicker({getDisabledCallback:e})}get getDisabledCallback(){return this._getDisabledCallback}set renderOptionContentCallback(e){this._renderOptionContentCallback=e,this.updatePicker({renderOptionContentCallback:e})}get renderOptionContentCallback(){return this._renderOptionContentCallback}set renderBadgeContentCallback(e){this._renderBadgeContentCallback=e,this.updatePicker({renderBadgeContentCallback:e})}get renderBadgeContentCallback(){return this._renderBadgeContentCallback}set renderSelectedItemContentCallback(e){this._renderSelectedItemContentCallback=e,this.updatePicker({renderSelectedItemContentCallback:e})}get renderSelectedItemContentCallback(){return this._renderSelectedItemContentCallback}set getSelectedItemClassCallback(e){this._getSelectedItemClassCallback=e,this.updatePicker({getSelectedItemClassCallback:e})}get getSelectedItemClassCallback(){return this._getSelectedItemClassCallback}set renderSelectedContentCallback(e){this._renderSelectedContentCallback=e,this.updatePicker({renderSelectedContentCallback:e})}get renderSelectedContentCallback(){return this._renderSelectedContentCallback}set name(e){e?this.setAttribute("name",e):this.removeAttribute("name")}get name(){return this.getAttribute("name")}set valueFormat(e){e?this.setAttribute("value-format",e):this.removeAttribute("value-format")}get valueFormat(){return this.getAttribute("value-format")}set getValueFormatCallback(e){this._getValueFormatCallback=e,this.updatePicker({getValueFormatCallback:e})}get getValueFormatCallback(){return this._getValueFormatCallback}set thresholdMode(e){e?this.setAttribute("threshold-mode",e):this.removeAttribute("threshold-mode")}get thresholdMode(){return this.getAttribute("threshold-mode")}set badgesMaxVisible(e){e!==null?this.setAttribute("badges-max-visible",String(e)):this.removeAttribute("badges-max-visible")}get badgesMaxVisible(){const e=this.getAttribute("badges-max-visible");return e?parseInt(e):null}set checkboxAlign(e){e?this.setAttribute("checkbox-align",e):this.removeAttribute("checkbox-align")}get checkboxAlign(){return this.getAttribute("checkbox-align")}set enableBadgeTooltips(e){e?this.setAttribute("enable-badge-tooltips","true"):this.removeAttribute("enable-badge-tooltips")}get enableBadgeTooltips(){return this.getAttribute("enable-badge-tooltips")==="true"}set enableOptionTooltips(e){e?this.setAttribute("enable-option-tooltips","true"):this.removeAttribute("enable-option-tooltips")}get enableOptionTooltips(){return this.getAttribute("enable-option-tooltips")==="true"}set getOptionTooltipCallback(e){this._getOptionTooltipCallback=e,this.updatePicker({getOptionTooltipCallback:e})}get getOptionTooltipCallback(){return this._getOptionTooltipCallback}set optionTooltipPlacement(e){e?this.setAttribute("option-tooltip-placement",e):this.removeAttribute("option-tooltip-placement")}get optionTooltipPlacement(){return this.getAttribute("option-tooltip-placement")}set optionTooltipFollowCursor(e){e?this.setAttribute("option-tooltip-follow-cursor","true"):this.removeAttribute("option-tooltip-follow-cursor")}get optionTooltipFollowCursor(){return this.getAttribute("option-tooltip-follow-cursor")==="true"}set actionsPosition(e){e?this.setAttribute("actions-position",e):this.removeAttribute("actions-position")}get actionsPosition(){return this.getAttribute("actions-position")}set actionsAlign(e){e?this.setAttribute("actions-align",e):this.removeAttribute("actions-align")}get actionsAlign(){return this.getAttribute("actions-align")}set badgeTooltipPlacement(e){e?this.setAttribute("badge-tooltip-placement",e):this.removeAttribute("badge-tooltip-placement")}get badgeTooltipPlacement(){return this.getAttribute("badge-tooltip-placement")}set getBadgeTooltipCallback(e){this._getBadgeTooltipCallback=e,this.updatePicker({getBadgeTooltipCallback:e})}get getBadgeTooltipCallback(){return this._getBadgeTooltipCallback}set getRemoveButtonTooltipCallback(e){this._getRemoveButtonTooltipCallback=e,this.updatePicker({getRemoveButtonTooltipCallback:e})}get getRemoveButtonTooltipCallback(){return this._getRemoveButtonTooltipCallback}set removeButtonTooltipText(e){e?this.setAttribute("remove-button-tooltip-text",e):this.removeAttribute("remove-button-tooltip-text")}get removeButtonTooltipText(){return this.getAttribute("remove-button-tooltip-text")}set getCounterCallback(e){this._getCounterCallback=e,this.updatePicker({getCounterCallback:e})}get getCounterCallback(){return this._getCounterCallback}get beforeSearchCallback(){return this._beforeSearchCallback}set beforeSearchCallback(e){this._beforeSearchCallback=e,this.updatePicker({beforeSearchCallback:e})}get beforeSelectCallback(){return this._beforeSelectCallback}set beforeSelectCallback(e){this._beforeSelectCallback=e,this.updatePicker({beforeSelectCallback:e})}get beforeDeselectCallback(){return this._beforeDeselectCallback}set beforeDeselectCallback(e){this._beforeDeselectCallback=e,this.updatePicker({beforeDeselectCallback:e})}get searchCallback(){return this._searchCallback}set searchCallback(e){this._searchCallback=e,this.updatePicker({searchCallback:e})}get addNewCallback(){return this._addNewCallback}set addNewCallback(e){this._addNewCallback=e,this.updatePicker({addNewCallback:e})}get onSelect(){return this._onSelect}set onSelect(e){this._onSelect=e}get onDeselect(){return this._onDeselect}set onDeselect(e){this._onDeselect=e}get onChange(){return this._onChange}set onChange(e){this._onChange=e}get actionButtons(){return this._actionButtons}set actionButtons(e){this._actionButtons=e,this.updatePicker({actionButtons:e})}get selectedValue(){var e;return((e=this.picker)==null?void 0:e.selectedValue)??null}get selectedItem(){var e;return((e=this.picker)==null?void 0:e.selectedItem)??null}getSelected(){return this.picker?this.picker.getSelected():[]}setSelected(e,s={}){this.picker&&this.picker.setSelected(e,s)}getValue(){return this.picker?this.picker.getValue():null}destroy(){this.picker&&this.picker.destroy()}}h(we,"formAssociated",!0),typeof window<"u"&&typeof customElements<"u"&&(customElements.get("web-multiselect")||customElements.define("web-multiselect",we)),typeof window<"u"&&(window.components=window.components||{},window.components["web-multiselect"]={version:()=>"1.12.0-rc07",config:{name:"@keenmate/web-multiselect",version:"1.12.0-rc07",author:"Keenmate",license:"MIT",repository:"git+https://github.com/keenmate/web-multiselect.git",homepage:"https://web-multiselect.keenmate.dev"},logging:{enableLogging:mt,disableLogging:pt,setLogLevel:ut,setCategoryLevel:bt,getCategories:()=>[...ht]},register:()=>{typeof customElements<"u"&&!customElements.get("web-multiselect")&&customElements.define("web-multiselect",we)},getInstances:()=>xt()}),O.LOGGING_CATEGORIES=ht,O.MultiSelectElement=we,O.WebMultiSelect=kt,O.dataLogger=A,O.disableLogging=pt,O.enableLogging=mt,O.initLogger=le,O.interactionLogger=L,O.setCategoryLevel=bt,O.setLogLevel=ut,O.uiLogger=H,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});