@keenmate/web-multiselect 2.2.0-rc01 → 2.2.0
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.
- package/README.md +9 -13
- package/custom-elements.json +107 -1
- package/dist/index.d.ts +175 -36
- package/dist/multiselect.js +775 -684
- package/dist/multiselect.umd.js +12 -12
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/css/options.css +6 -4
- package/vscode.html-custom-data.json +5 -0
- package/web-types.json +11 -1
package/dist/multiselect.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(k,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(k=typeof globalThis<"u"?globalThis:k||self,T(k.MultiSelect={}))})(this,function(k){"use strict";var On=Object.defineProperty;var Ao=k=>{throw TypeError(k)};var Pn=(k,T,R)=>T in k?On(k,T,{enumerable:!0,configurable:!0,writable:!0,value:R}):k[T]=R;var m=(k,T,R)=>Pn(k,typeof T!="symbol"?T+"":T,R),ps=(k,T,R)=>T.has(k)||Ao("Cannot "+R);var h=(k,T,R)=>(ps(k,T,"read from private field"),R?R.call(k):T.get(k)),z=(k,T,R)=>T.has(k)?Ao("Cannot add the same private member more than once"):T instanceof WeakSet?T.add(k):T.set(k,R),P=(k,T,R,L)=>(ps(k,T,"write to private field"),L?L.call(k,R):T.set(k,R),R),v=(k,T,R)=>(ps(k,T,"access private method"),R);var fe,ht,Se,ut,Te,mt,Kt,Ie,ge,Oe,Pe,Re,Be,He,Fe,Ke,We,Wt,ce,je,M,zo,No,$o,ee,Vo,Do,fs,gs,vt,bs,Ro,V,Z,S,be,pt,Ge,ft,gt,bt,Ue,qe,Le,y,vs,jt,ve,Gt,ws,ys,xs,Ut,Bo,Ho,Fo,Xe,_s,Ko,Wo,jo,ks,Go,Uo,Cs,Ss;function T(s,e={}){const t=new Set(s),o=e.shouldNullOnInvalid?null:e.default??null;return{values:s,fromAttribute(i){return i===null?e.default??o:t.has(i)?i:o},validate(i){return typeof i=="string"&&t.has(i)},toAttribute(i){return i==null?null:String(i)}}}function R(s={}){const e=o=>(s.min==null||o>=s.min)&&(s.max==null||o<=s.max),t=s.default;return{fromAttribute(o){if(o===null)return t;const i=Number.parseInt(o,10);return Number.isNaN(i)||!e(i)?t:i},validate(o){return typeof o=="number"&&Number.isInteger(o)&&e(o)},toAttribute(o){return o==null?null:String(o)}}}function L(s={}){const e=s.isNullable===!0,t=s.default??(e?null:""),o=i=>s.shouldTrim?i.trim():i;return{fromAttribute(i){if(i===null)return t;const r=o(i);return!s.isEmptyAllowed&&r===""?t:r},validate(i){return i===null?e:typeof i=="string"&&(s.isEmptyAllowed===!0||i!=="")},toAttribute(i){return i==null?null:String(i)}}}const qo=new Set(["","true","1","yes","on"]),Xo=new Set(["false","0","no","off"]);function W(s="presence"){const e=t=>{const o=t.trim().toLowerCase();return qo.has(o)?!0:Xo.has(o)?!1:null};return{fromAttribute(t){switch(s){case"presence":return t!==null;case"default-true":return t===null?!0:e(t)??!0;case"default-false":return t===null?!1:e(t)??!1;case"tristate":return t===null?null:e(t)}},validate(t){return s==="tristate"?t===!0||t===!1||t===null:typeof t=="boolean"},toAttribute(t){return s==="presence"?t?"":null:t==null?null:String(t)}}}function Jo(s={}){const e=s.default;return{fromAttribute(t){if(t===null||t.trim()==="")return e;let o;try{o=JSON.parse(t)}catch{return e}return s.validate&&!s.validate(o)?e:o},validate:s.validate,toAttribute(t){return t==null?null:JSON.stringify(t)}}}function Yo(s={}){const e=s.default??[],t=o=>Array.isArray(o)&&(!s.validateItem||o.every(s.validateItem));return{fromAttribute(o){if(o===null||o.trim()==="")return e;let i;try{i=JSON.parse(o)}catch{return e}return t(i)?i:e},validate:t,toAttribute(o){return Array.isArray(o)?JSON.stringify(o):null}}}function Zo(){return{validate(s){return s==null||typeof s=="function"}}}function Qo(s,e,t){const o=s.converter,i=o!=null&&o.fromAttribute?o.fromAttribute(e,t,s.attribute??s.configKey):e??s.default;return{configKey:s.configKey,field:s.field,value:i,on:s.on??"update"}}function ei(s,e){const t=s.converter;return t!=null&&t.validate&&!t.validate(e)?null:{configKey:s.configKey,field:s.field,value:e,on:s.on??"update"}}function ti(){const s=new Set;let e=!1;const t=()=>{e=!1;const o=[...s];s.clear();for(const i of o)i()};return{schedule(o){s.add(o),e||(e=!0,queueMicrotask(t))},flush(){if(s.size===0)return;e=!1;const o=[...s];s.clear();for(const i of o)i()},cancel(){s.clear(),e=!1}}}const Ts={pointer:"fine",hasCoarsePointer:!1,canHover:!0,isTouchPrimary:!1,orientation:"landscape",viewportWidth:1024,viewportHeight:768,breakpoint:"desktop",os:"unknown",isApple:!1,isAndroid:!1};let wt=Os({mobile:640,tablet:1024,desktop:1/0});const Je=new Set,Ye=new Set;let ye=null,yt=[],xt=!1;const Is=30;let Ae,_t=0;function Os(s){return Object.entries(s).sort((e,t)=>e[1]-t[1])}function si(s){for(const[t,o]of wt)if(s<=o)return t;const e=wt[wt.length-1];return e?e[0]:"desktop"}function qt(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Ps(){return typeof navigator<"u"&&(navigator.maxTouchPoints??0)>1}function oi(){var o;if(typeof navigator>"u")return"unknown";const s=navigator.userAgentData,e=(o=s==null?void 0:s.platform)==null?void 0:o.toLowerCase();if(e){if(e.includes("android"))return"android";if(e.includes("ios"))return"ios";if(e.includes("mac"))return Ps()?"ios":"macos";if(e.includes("windows"))return"windows";if(e.includes("linux"))return"linux"}const t=navigator.userAgent??"";return/android/i.test(t)?"android":/iphone|ipod|ipad/i.test(t)?"ios":/macintosh|mac os x/i.test(t)?Ps()?"ios":"macos":/windows/i.test(t)?"windows":/linux/i.test(t)?"linux":"unknown"}let ii;function ri(){return ii??(ii=oi())}function Ze(s){return qt()&&window.matchMedia(s).matches}function Xt(){if(!qt())return{...Ts};const s=Ze("(any-pointer: coarse)"),e=Ze("(pointer: coarse)"),t=Ze("(pointer: fine)"),o=Ze("(hover: hover)"),i=e?"coarse":t?"fine":"none",r=window.innerWidth,n=window.innerHeight,a=ri();return{pointer:i,hasCoarsePointer:s,canHover:o,isTouchPrimary:e&&!o,orientation:Ze("(orientation: portrait)")?"portrait":"landscape",viewportWidth:r,viewportHeight:n,breakpoint:si(r),os:a,isApple:a==="ios"||a==="macos",isAndroid:a==="android"}}function ni(s,e){return s.pointer===e.pointer&&s.hasCoarsePointer===e.hasCoarsePointer&&s.canHover===e.canHover&&s.isTouchPrimary===e.isTouchPrimary&&s.orientation===e.orientation&&s.breakpoint===e.breakpoint}function ai(s,e){return s.viewportWidth===e.viewportWidth&&s.viewportHeight===e.viewportHeight}function kt(){const s=Xt(),e=ye;if(ye=s,!e||!ni(e,s))for(const t of[...Je])t(s);Ye.size>0&&(!e||!ai(e,s))&&li()}function Ms(){const s=ye;if(s)for(const e of[...Ye])e(s)}function li(){if(Ae!==void 0)return;const s=Date.now()-_t;s>=Is?(_t=Date.now(),Ms()):Ae=setTimeout(()=>{Ae=void 0,_t=Date.now(),Ms()},Is-s)}const Ct=()=>kt(),Ls=()=>{if(typeof requestAnimationFrame=="function"){if(xt)return;xt=!0,requestAnimationFrame(()=>{xt=!1,kt()})}else kt()};function ci(s){typeof s.addEventListener=="function"?s.addEventListener("change",Ct):typeof s.addListener=="function"&&s.addListener(Ct)}function di(s){typeof s.removeEventListener=="function"?s.removeEventListener("change",Ct):typeof s.removeListener=="function"&&s.removeListener(Ct)}function Es(){if(!qt()){ye={...Ts};return}yt=[window.matchMedia("(pointer: coarse)"),window.matchMedia("(pointer: fine)"),window.matchMedia("(any-pointer: coarse)"),window.matchMedia("(hover: hover)"),window.matchMedia("(orientation: portrait)")];for(const s of yt)ci(s);typeof window.addEventListener=="function"&&window.addEventListener("resize",Ls),ye=Xt()}function As(){for(const s of yt)di(s);yt=[],typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",Ls),xt=!1,Ae!==void 0&&(clearTimeout(Ae),Ae=void 0),_t=0,ye=null}function St(){return Je.size+Ye.size}function Qe(){return ye??Xt()}function zs(s,e={}){const t=St()===0;Je.add(s),t&&Es(),e.immediate!==!1&&s(Qe());let o=!0;return()=>{o&&(o=!1,Je.delete(s),St()===0&&As())}}function Ns(s,e={}){const t=St()===0;Ye.add(s),t&&Es(),e.immediate!==!1&&s(Qe());let o=!0;return()=>{o&&(o=!1,Ye.delete(s),St()===0&&As())}}function hi(s){wt=Os(s),Je.size>0&&kt()}const $s=600;function Vs(s){return s.isTouchPrimary?Math.min(s.viewportWidth,s.viewportHeight)<$s?"mobile":"tablet":"desktop"}const ui=30;let oe=null;const et=new WeakMap;let Jt=0;function mi(){return typeof ResizeObserver<"u"}function Ds(s){if(typeof s.getBoundingClientRect!="function")return{width:0,height:0};const e=s.getBoundingClientRect();return{width:e.width,height:e.height}}function pi(s,e){return!!s&&s.width===e.width&&s.height===e.height}function fi(s,e){if(pi(s.lastFired,e)||(s.pendingSize=e,s.timer!==void 0))return;const t=Date.now()-s.lastNotify;t>=s.throttleMs?(s.lastNotify=Date.now(),Rs(s)):s.timer=setTimeout(()=>{s.timer=void 0,s.lastNotify=Date.now(),Rs(s)},s.throttleMs-t)}function Rs(s){const e=s.pendingSize;e&&(s.lastFired=e,s.cb(e,s.el))}function gi(s){for(const e of s){const t=et.get(e.target);if(!t)continue;const o=Ds(e.target);for(const i of[...t])fi(i,o)}}function bi(){return mi()?(oe||(oe=new ResizeObserver(gi)),oe):null}function vi(s,e,t={}){const o={el:s,cb:e,throttleMs:t.throttleMs??ui,lastNotify:0};if(t.immediate!==!1){const n=Ds(s);o.lastFired=n,o.lastNotify=Date.now(),e(n,s)}const i=bi();if(i){let n=et.get(s);n||(et.set(s,n=new Set),Jt++,i.observe(s)),n.add(o)}let r=!0;return()=>{if(!r)return;r=!1,o.timer!==void 0&&(clearTimeout(o.timer),o.timer=void 0);const n=et.get(s);n&&(n.delete(o),n.size===0&&(et.delete(s),oe==null||oe.unobserve(s),Jt--,Jt===0&&oe&&(oe.disconnect(),oe=null)))}}const Tt=new Map;function wi(s,e){let t=Tt.get(s);t||Tt.set(s,t=new Set),t.add(e)}function yi(s,e){var t;(t=Tt.get(s))==null||t.delete(e)}function xi(s){return Array.from(Tt.get(s)??[])}const Bs=new Map;function _i(s,e){Bs.set(s.toLowerCase(),e)}function ki(s){return Bs.get(s.toLowerCase())}function Ci(s,e,t,o={}){return s.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:o.bubbles??!0,composed:o.composed??!0,cancelable:o.cancelable??!1}))}function Si(s){return s.split(/[-_]/).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function Ti(s){return`on${Si(s)}`}function Ii(s){return s?s.map(e=>{const t=typeof e=="string"?{name:e}:e,o=t.property===!1?null:t.property??Ti(t.name);return{name:t.name,property:o,bubbles:t.bubbles,composed:t.composed,cancelable:t.cancelable}}):[]}const Oi=typeof HTMLElement<"u"?HTMLElement:class{},Hs=new WeakSet;let Pi=0;const Mi={trace(){},debug(){},info(){},warn(){},error(){}},Li=new Proxy({},{get:()=>Mi}),Me=class Me extends Oi{constructor(){super();z(this,M);z(this,fe,{});z(this,ht,new Map);z(this,Se,new Map);z(this,ut,new Map);z(this,Te,new Map);z(this,mt,ti());z(this,Kt,()=>v(this,M,bs).call(this));z(this,Ie,null);z(this,ge,!1);z(this,Oe,[]);z(this,Pe,!1);z(this,Re,null);z(this,Be,!1);z(this,He);z(this,Fe);z(this,Ke);z(this,We);z(this,Wt);z(this,ce);z(this,je);const t=this.constructor,o=t.inputs??[],i=Ii(t.events);v(this,M,$o).call(this,o,i);for(const r of o)h(this,ht).set(r.configKey,r),r.attribute&&h(this,Se).set(r.attribute,r);for(const r of i)h(this,ut).set(r.name,r);v(this,M,zo).call(this,o),v(this,M,Vo).call(this,o),v(this,M,Do).call(this,i)}static get observedAttributes(){const t=(this.inputs??[]).filter(o=>o.attribute).map(o=>o.attribute);return t.includes("dir")?t:[...t,"dir"]}attributeChangedCallback(t,o,i){var a;if(h(this,Be))return;if(t==="dir"&&!h(this,Se).has("dir")){h(this,Pe)&&this.directionChanged(this.isRTL);return}const r=h(this,Se).get(t);if(!r||!h(this,Pe)&&((a=h(this,Re))!=null&&a.has(r.configKey)))return;let n;try{n=Qo(r,i,this)}catch(l){v(this,M,ee).call(this,`converter for "${r.configKey}" threw parsing attribute ${t}="${i}"; using default`,l),n=v(this,M,No).call(this,r)}v(this,M,gs).call(this,n)}connectedCallback(){wi(this.localName,this),h(this,Pe)||(P(this,Pe,!0),P(this,Re,null),P(this,ge,!0)),v(this,M,vt).call(this),this.connect(),this.environmentChanged!==Me.prototype.environmentChanged&&P(this,He,zs(t=>this.environmentChanged(t))),this.viewportChanged!==Me.prototype.viewportChanged&&P(this,Fe,Ns(t=>this.viewportChanged(t))),this.resized!==Me.prototype.resized&&P(this,Ke,vi(this,t=>this.resized(t),{immediate:!1}))}disconnectedCallback(){var t,o,i;yi(this.localName,this),(t=h(this,He))==null||t.call(this),P(this,He,void 0),(o=h(this,Fe))==null||o.call(this),P(this,Fe,void 0),(i=h(this,Ke))==null||i.call(this),P(this,Ke,void 0),this.disconnect()}setAttributes(t){for(const[o,i]of Object.entries(t)){const r=h(this,ht).get(o)??h(this,Se).get(o);r&&v(this,M,fs).call(this,r,i)}v(this,M,vt).call(this)}batch(t){t(),v(this,M,vt).call(this)}flush(){v(this,M,vt).call(this)}whenSettled(){return!h(this,Ie)&&!h(this,ge)?Promise.resolve():new Promise(t=>h(this,Oe).push(t))}get config(){return h(this,fe)}get log(){if(h(this,je))return h(this,je);const t=ki(this.localName);if(!t)return Li;const o=h(this,Wt)??P(this,Wt,`${this.localName}#${this.id||++Pi}`);return P(this,je,t.forInstance(o,()=>h(this,ce)))}enableLogging(t="debug"){P(this,ce,t)}disableLogging(){P(this,ce,void 0)}get isLoggingEnabled(){return h(this,ce)!=null&&h(this,ce)!=="silent"&&h(this,ce)!==5}reinit(){}update(t){}connect(){}disconnect(){}environmentChanged(t){}viewportChanged(t){}resized(t){}get isRTL(){return typeof getComputedStyle=="function"&&getComputedStyle(this).direction==="rtl"}directionChanged(t){}get internals(){if(h(this,We))return h(this,We);if(typeof this.attachInternals!="function")return null;try{return P(this,We,this.attachInternals())}catch{return null}}get form(){var t;return((t=this.internals)==null?void 0:t.form)??null}emit(t,o,i){const r=h(this,ut).get(t);return Ci(this,t,o,{bubbles:(i==null?void 0:i.bubbles)??(r==null?void 0:r.bubbles),composed:(i==null?void 0:i.composed)??(r==null?void 0:r.composed),cancelable:(i==null?void 0:i.cancelable)??(r==null?void 0:r.cancelable)})}on(t,o,i){const r=o;return this.addEventListener(t,r,i),()=>this.removeEventListener(t,r,i)}async runHook(t,o,i){const r=h(this,fe)[t];if(typeof r!="function")return i.whenUnset;try{return await Promise.resolve(r(o))}catch(n){if(i.onError)return i.onError(n);throw n}}};fe=new WeakMap,ht=new WeakMap,Se=new WeakMap,ut=new WeakMap,Te=new WeakMap,mt=new WeakMap,Kt=new WeakMap,Ie=new WeakMap,ge=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,Be=new WeakMap,He=new WeakMap,Fe=new WeakMap,Ke=new WeakMap,We=new WeakMap,Wt=new WeakMap,ce=new WeakMap,je=new WeakMap,M=new WeakSet,zo=function(t){var o;for(const i of t){let r=i.default;if((o=i.converter)!=null&&o.fromAttribute)try{r=i.converter.fromAttribute(null,this,i.attribute??i.configKey)}catch(n){v(this,M,ee).call(this,`converter for "${i.configKey}" threw computing its default; using \`default\``,n),r=i.default}h(this,fe)[i.configKey]=r,i.field&&(this[i.field]=r)}},No=function(t){return{configKey:t.configKey,field:t.field,value:t.default,on:t.on??"update"}},$o=function(t,o){var l;const i=this.constructor;if(Hs.has(i))return;Hs.add(i);const r=new Set,n=new Set;for(const c of t)r.has(c.configKey)&&v(this,M,ee).call(this,`invalid input table: duplicate configKey "${c.configKey}"`),r.add(c.configKey),c.attribute&&(n.has(c.attribute)&&v(this,M,ee).call(this,`invalid input table: duplicate attribute "${c.attribute}"`),n.add(c.attribute)),c.reflect&&!c.attribute&&v(this,M,ee).call(this,`invalid input table: "${c.configKey}" has reflect:true but no attribute to reflect to`),c.reflect&&!((l=c.converter)!=null&&l.toAttribute)&&v(this,M,ee).call(this,`invalid input table: "${c.configKey}" has reflect:true but its converter has no toAttribute`);const a=new Set;for(const c of o)a.has(c.name)&&v(this,M,ee).call(this,`invalid event table: duplicate event "${c.name}"`),a.add(c.name),/^[a-z][a-z0-9-]*$/.test(c.name)||v(this,M,ee).call(this,`invalid event table: event "${c.name}" should be lowercase kebab-case (e.g. "date-select")`),c.property&&r.has(c.property)&&v(this,M,ee).call(this,`invalid event table: event "${c.name}" property "${c.property}" collides with an input configKey`)},ee=function(t,...o){console.warn(`[BlissElement] <${this.localName??"unknown"}> ${t}`,...o)},Vo=function(t){for(const o of t){const i=o.configKey,r=Object.prototype.hasOwnProperty.call(this,i),n=r?this[i]:void 0;r&&delete this[i],Object.defineProperty(this,i,{configurable:!0,enumerable:!0,get:()=>h(this,fe)[i],set:a=>v(this,M,fs).call(this,o,a)}),r&&((h(this,Re)??P(this,Re,new Set)).add(i),this[i]=n)}},Do=function(t){for(const o of t){const i=o.property;if(!i)continue;const r=o.name,n=Object.prototype.hasOwnProperty.call(this,i),a=n?this[i]:void 0;n&&delete this[i],Object.defineProperty(this,i,{configurable:!0,enumerable:!0,get:()=>h(this,Te).get(r)??null,set:l=>{const c=h(this,Te).get(r);if(c&&this.removeEventListener(r,c),typeof l=="function"){const d=l;h(this,Te).set(r,d),this.addEventListener(r,d)}else h(this,Te).delete(r)}}),n&&(this[i]=a)}},fs=function(t,o){var r;const i=ei(t,o);if(!i){v(this,M,ee).call(this,`rejected invalid value for property "${t.configKey}"; keeping previous value`,o);return}if(v(this,M,gs).call(this,i),t.reflect&&t.attribute&&((r=t.converter)!=null&&r.toAttribute)){const n=t.converter.toAttribute(i.value);P(this,Be,!0);try{n===null?this.removeAttribute(t.attribute):this.setAttribute(t.attribute,n)}finally{P(this,Be,!1)}}},gs=function(t){h(this,fe)[t.configKey]=t.value,t.field&&(this[t.field]=t.value),t.on!=="none"&&(t.on==="reinit"&&P(this,ge,!0),(h(this,Ie)??P(this,Ie,{}))[t.configKey]=t.value,h(this,mt).schedule(h(this,Kt)))},vt=function(){h(this,mt).cancel(),v(this,M,bs).call(this)},bs=function(){if(!this.isConnected)return;const t=h(this,ge),o=h(this,Ie);P(this,ge,!1),P(this,Ie,null),t?this.reinit():o&&Object.keys(o).length>0&&this.update(o),v(this,M,Ro).call(this)},Ro=function(){if(h(this,Oe).length===0)return;const t=h(this,Oe);P(this,Oe,[]);for(const o of t)o()},m(Me,"inputs"),m(Me,"events");let Yt=Me;function Fs(s,e,t){typeof customElements>"u"||customElements.get(s)||customElements.define(s,e,t)}function Ei(s){return{enableLogging:e=>s.enableLogging(e),disableLogging:()=>s.disableLogging(),setLogLevel:e=>s.setLogLevel(e),setCategoryLevel:(e,t)=>s.setCategoryLevel(e,t),getCategories:()=>[...s.LOGGING_CATEGORIES]}}function Ai(s,e,t){const{config:o,logging:i,shouldAutoDefine:r=!0}=t;i&&_i(s,i);const n={version:()=>o.version,config:o,...i?{logging:Ei(i)}:{},register:()=>Fs(s,e),getInstances:()=>xi(s)};return typeof window<"u"&&((window.components??(window.components={}))[s]=n),r&&Fs(s,e),n}const Ks=new Map,Ws=new WeakMap;let It;function zi(s){if(typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in s))return!1;if(It===void 0)try{new CSSStyleSheet().replaceSync(""),It=!0}catch{It=!1}return It}function Ni(s,...e){if(typeof document>"u")return;let t=Ws.get(s);t||Ws.set(s,t=new Set);const o=e.filter(r=>r&&!t.has(r));if(o.length===0)return;for(const r of o)t.add(r);if(zi(s)){const r=o.map(n=>{let a=Ks.get(n);return a||(a=new CSSStyleSheet,a.replaceSync(n),Ks.set(n,a)),a});s.adoptedStyleSheets=[...s.adoptedStyleSheets,...r];return}const i=s.head??s;for(const r of o){const n=document.createElement("style");n.textContent=r,i.appendChild(n)}}function $i(s,e={}){const t=e.position??"last",o=s.head??s;let i=null;const r=()=>typeof document>"u"?null:(i||(i=document.createElement("style"),e.className&&(i.className=e.className)),i.parentNode!==o&&(t==="first"&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i)),i),n=()=>{i==null||i.remove()};return{set(a){if(!a){n();return}const l=r();l&&(l.textContent=a)},clear:n,destroy(){i==null||i.remove(),i=null}}}function js(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vi(s,e){const t=new Set,o=new RegExp(`var\\(\\s*(${js(e)}[a-z0-9-]+)`,"gi");let i;for(;i=o.exec(s);)i[1]&&t.add(i[1]);return t}function Di(s,e){const t=new Set,o=new RegExp(`(${js(e)}[a-z0-9-]+)\\s*:`,"gi");let i;for(;i=o.exec(s);)i[1]&&t.add(i[1]);return[...t]}function Ri(s,e,t={}){const o=t.minScore??3,i=t.limit??3,r=new Set(s.split("-").filter(Boolean));return[...e].map(n=>({k:n,score:n.split("-").filter(a=>r.has(a)).length})).filter(n=>n.score>=o).sort((n,a)=>a.score-n.score).slice(0,i).map(n=>n.k)}function Bi(s,e){if(e.consumed.size===0)return[];const t=[];for(const o of Di(s,e.prefix))e.consumed.has(o)||t.push({name:o,suggestions:Ri(o,e.consumed,{minScore:e.minScore})});return t}const Hi={mobile:"fullscreen",tablet:"floating",desktop:"floating"};function Fi(s,e,t={}){if(s!=="auto")return s;const o=Vs(e);return t[o]??Hi[o]}function tt(s){return{presentation:s,isFullscreen:s==="fullscreen",isModal:s==="modal"}}let st=0,Ot=null;function Ki(){if(typeof document>"u")return()=>{};st===0&&(Ot=document.body.style.overflow,document.body.style.overflow="hidden"),st++;let s=!1;return()=>{s||(s=!0,st=Math.max(0,st-1),st===0&&Ot!==null&&(document.body.style.overflow=Ot,Ot=null))}}function Wi(s){const e=typeof window<"u"?window.visualViewport:null;if(!e)return()=>{};let t=!1;const o=()=>{t=!1,s.style.height=`${e.height}px`,s.style.top=`${e.offsetTop}px`},i=()=>{t||(t=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(o):o())};return e.addEventListener("resize",i),e.addEventListener("scroll",i),i(),()=>{e.removeEventListener("resize",i),e.removeEventListener("scroll",i),s.style.height="",s.style.top=""}}const Zt="km-overlay-activated",ji=Symbol("km-overlay-all-groups"),Pt=new Set,ot=new Map;let Mt=!1;function Qt(){return typeof document<"u"}function Gi(s,e){return e===ji||s===e}function Gs(s){const e=s.detail,t=e==null?void 0:e.source,o=e==null?void 0:e.group;for(const i of Array.from(Pt))i.id!==t&&Gi(i.group,o)&&i.dismiss()}function Ui(){Mt||!Qt()||(document.addEventListener(Zt,Gs),Mt=!0)}function qi(){Mt&&Pt.size===0&&Qt()&&(document.removeEventListener(Zt,Gs),Mt=!1)}function Xi(s,e){Qt()&&document.dispatchEvent(new CustomEvent(Zt,{detail:{source:s,group:e}}))}function Ji(s,e){const t={id:{},group:e,dismiss:s};return Pt.add(t),Ui(),{activate(){ot.set(t.group,t),Xi(t.id,t.group)},deactivate(){ot.get(t.group)===t&&ot.delete(t.group)},dispose(){Pt.delete(t),ot.get(t.group)===t&&ot.delete(t.group),qi()}}}const q={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Us=["trace","debug","info","warn","error"],Lt=()=>{};let Yi="km-log";function qs(s){const t=console[s];return typeof t=="function"?t.bind(console):Lt}function Zi(s){if(s==="debug"&&(s="log"),typeof console>"u")return Lt;const e=console;return e[s]!==void 0?qs(s):e.log!==void 0?qs("log"):Lt}const Qi=s=>Zi(s);function it(s){let e=s;const t=q;if(typeof e=="string"&&t[e.toUpperCase()]!==void 0&&(e=t[e.toUpperCase()]),typeof e=="number"&&e>=0&&e<=q.SILENT)return e;throw new TypeError(`setLevel() called with an invalid level: ${String(s)}`)}let he;const Et={};class Xs{constructor(e,t){m(this,"name");m(this,"levels",q);m(this,"methodFactory");m(this,"trace");m(this,"debug");m(this,"info");m(this,"warn");m(this,"error");m(this,"log");m(this,"inheritedLevel");m(this,"defaultLevel",null);m(this,"userLevel",null);this.name=e,this.methodFactory=t,this.inheritedLevel=it(he?he.getLevel():"WARN");const o=this.getPersistedLevel();o!=null&&(this.userLevel=it(o)),this.replaceLoggingMethods()}storageKey(){return typeof this.name=="string"?`${Yi}:${this.name}`:void 0}persist(e){const t=this.storageKey();if(typeof window>"u"||!t)return;const o=(Us[e]??"silent").toUpperCase();try{window.localStorage[t]=o}catch{}}getPersistedLevel(){const e=this.storageKey();if(typeof window>"u"||!e)return;let t;try{t=window.localStorage[e]}catch{}if(!(t===void 0||q[t]===void 0))return t}clearPersisted(){const e=this.storageKey();if(!(typeof window>"u"||!e))try{window.localStorage.removeItem(e)}catch{}}replaceLoggingMethods(){const e=this.getLevel();Us.forEach((t,o)=>{this[t]=o<e?Lt:this.methodFactory(t,e,this.name)}),this.log=this.debug}getLevel(){return this.userLevel!=null?this.userLevel:this.defaultLevel!=null?this.defaultLevel:this.inheritedLevel}setLevel(e,t){this.userLevel=it(e),t!==!1&&this.persist(this.userLevel),this.replaceLoggingMethods()}setDefaultLevel(e){this.defaultLevel=it(e),this.getPersistedLevel()||this.setLevel(e,!1)}resetLevel(){this.userLevel=null,this.clearPersisted(),this.replaceLoggingMethods()}enableAll(e){this.setLevel(q.TRACE,e)}disableAll(e){this.setLevel(q.SILENT,e)}rebuild(){if(he&&he!==this&&(this.inheritedLevel=it(he.getLevel())),this.replaceLoggingMethods(),he===this)for(const e in Et)Et[e].rebuild()}}he=new Xs(void 0,Qi);function er(s){if(typeof s!="string"||s==="")throw new TypeError("You must supply a non-empty name when creating a logger.");let e=Et[s];return e||(e=Et[s]=new Xs(s,he.methodFactory)),e}const tr=["INIT","DATA","UI"],sr="debug",Js=["#4c8bf5","#2ea043","#d29922","#a371f7","#db61a2","#e5534b","#3fb0ac","#8a6d3b"],Ys=new WeakSet;function or(s,e,t){if(Ys.has(s))return;Ys.add(s);const o=s.methodFactory,i=`color:${t};font-weight:bold`;s.methodFactory=(r,n,a)=>{const l=o(r,n,a);return(...c)=>l(`%c[${e}]`,i,...c)},s.setLevel(s.getLevel(),!1)}function ir(s){return typeof s=="number"?s:q[s.toUpperCase()]??q.SILENT}const rr=[["trace",q.TRACE,"debug"],["debug",q.DEBUG,"debug"],["info",q.INFO,"info"],["warn",q.WARN,"warn"],["error",q.ERROR,"error"]];function nr(s,e,t){const o=`color:${s.color};font-weight:bold`,i="color:#888",r={};for(const[n,a,l]of rr)r[n]=(...c)=>{const d=t(),u=Math.min(s.logger.getLevel(),d==null?q.SILENT:ir(d));if(a<u)return;(console[l]??console.log).bind(console)(`%c[${s.label}]%c ${e}`,o,i,...c)};return r}function ar(s,e=tr){const t={},o={};e.forEach((r,n)=>{const a=`${s}:${r}`,l=Js[n%Js.length],c=er(a);or(c,a,l),t[r]=c,o[r]={label:a,color:l,logger:c}});const i=r=>{for(const n of e)t[n].setLevel(r,!1)};return{loggers:t,LOGGING_CATEGORIES:e,enableLogging(r=sr){i(r)},disableLogging(){i("silent")},setLogLevel(r){i(r)},setCategoryLevel(r,n){var a;(a=t[r])==null||a.setLevel(n,!1)},forInstance(r,n){const a={};for(const l of e)a[l]=nr(o[l],r,n);return a}}}const ue=Math.min,ie=Math.max,At=Math.round,zt=Math.floor,re=s=>({x:s,y:s}),lr={left:"right",right:"left",bottom:"top",top:"bottom"};function Zs(s,e,t){return ie(s,ue(e,t))}function ze(s,e){return typeof s=="function"?s(e):s}function xe(s){return s.split("-")[0]}function Ne(s){return s.split("-")[1]}function Qs(s){return s==="x"?"y":"x"}function es(s){return s==="y"?"height":"width"}function ne(s){const e=s[0];return e==="t"||e==="b"?"y":"x"}function ts(s){return Qs(ne(s))}function cr(s,e,t){t===void 0&&(t=!1);const o=Ne(s),i=ts(s),r=es(i);let n=i==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(n=Nt(n)),[n,Nt(n)]}function dr(s){const e=Nt(s);return[ss(s),e,ss(e)]}function ss(s){return s.includes("start")?s.replace("start","end"):s.replace("end","start")}const eo=["left","right"],to=["right","left"],hr=["top","bottom"],ur=["bottom","top"];function mr(s,e,t){switch(s){case"top":case"bottom":return t?e?to:eo:e?eo:to;case"left":case"right":return e?hr:ur;default:return[]}}function pr(s,e,t,o){const i=Ne(s);let r=mr(xe(s),t==="start",o);return i&&(r=r.map(n=>n+"-"+i),e&&(r=r.concat(r.map(ss)))),r}function Nt(s){const e=xe(s);return lr[e]+s.slice(e.length)}function fr(s){var e,t,o,i;return{top:(e=s.top)!=null?e:0,right:(t=s.right)!=null?t:0,bottom:(o=s.bottom)!=null?o:0,left:(i=s.left)!=null?i:0}}function so(s){return typeof s!="number"?fr(s):{top:s,right:s,bottom:s,left:s}}function $t(s){const{x:e,y:t,width:o,height:i}=s;return{width:o,height:i,top:t,left:e,right:e+o,bottom:t+i,x:e,y:t}}function oo(s,e,t){let{reference:o,floating:i}=s;const r=ne(e),n=ts(e),a=es(n),l=xe(e),c=r==="y",d=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2;let p;switch(l){case"top":p={x:d,y:o.y-i.height};break;case"bottom":p={x:d,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:u};break;case"left":p={x:o.x-i.width,y:u};break;default:p={x:o.x,y:o.y}}const g=Ne(e);return g&&(p[n]+=f*(g==="end"?1:-1)*(t&&c?-1:1)),p}async function gr(s,e){var t;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:n,elements:a,strategy:l}=s,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=ze(e,s),g=so(p),x=a[f?u==="floating"?"reference":"floating":u],b=$t(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(x)))==null||t?x:x.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),_=u==="floating"?{x:o,y:i,width:n.floating.width,height:n.floating.height}:n.reference,C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),E=await(r.isElement==null?void 0:r.isElement(C))&&await(r.getScale==null?void 0:r.getScale(C))||{x:1,y:1},D=$t(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:C,strategy:l}):_);return{top:(b.top-D.top+g.top)/E.y,bottom:(D.bottom-b.bottom+g.bottom)/E.y,left:(b.left-D.left+g.left)/E.x,right:(D.right-b.right+g.right)/E.x}}const br=50,vr=async(s,e,t)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:n}=t,a=n.detectOverflow?n:{...n,detectOverflow:gr},l=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:s,floating:e,strategy:i}),{x:d,y:u}=oo(c,o,l),f=o,p=0;const g={};for(let w=0;w<r.length;w++){const x=r[w];if(!x)continue;const{name:b,fn:_}=x,{x:C,y:E,data:D,reset:F}=await _({x:d,y:u,initialPlacement:o,placement:f,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:s,floating:e}});d=C??d,u=E??u,g[b]={...g[b],...D},F&&p<br&&(p++,typeof F=="object"&&(F.placement&&(f=F.placement),F.rects&&(c=F.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:i}):F.rects),{x:d,y:u}=oo(c,f,l)),w=-1)}return{x:d,y:u,placement:f,strategy:i,middlewareData:g}},wr=s=>({name:"arrow",options:s,async fn(e){const{x:t,y:o,placement:i,rects:r,platform:n,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=ze(s,e)||{};if(c==null)return{};const u=so(d),f={x:t,y:o},p=ts(i),g=es(p),w=await n.getDimensions(c),x=p==="y",b=x?"top":"left",_=x?"bottom":"right",C=x?"clientHeight":"clientWidth",E=r.reference[g]+r.reference[p]-f[p]-r.floating[g],D=f[p]-r.reference[p],F=await(n.getOffsetParent==null?void 0:n.getOffsetParent(c));let U=F?F[C]:0;(!U||!await(n.isElement==null?void 0:n.isElement(F)))&&(U=a.floating[C]||r.floating[g]);const J=E/2-D/2,B=U/2-w[g]/2-1,I=ue(u[b],B),A=ue(u[_],B),$=U-w[g]-A,K=U/2-w[g]/2+J,O=Zs(I,K,$),j=!l.arrow&&Ne(i)!=null&&K!==O&&r.reference[g]/2-(K<I?I:A)-w[g]/2<0,de=j?K<I?K-I:K-$:0;return{[p]:f[p]+de,data:{[p]:O,centerOffset:K-O-de,...j&&{alignmentOffset:de}},reset:j}}}),yr=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,o;const{placement:i,middlewareData:r,rects:n,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...x}=ze(s,e);if((t=r.arrow)!=null&&t.alignmentOffset)return{};const b=xe(i),_=ne(a),C=xe(a)===a,E=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=f||(C||!w?[Nt(a)]:dr(a)),F=g!=="none";!f&&F&&D.push(...pr(a,w,g,E));const U=[a,...D],J=await l.detectOverflow(e,x),B=[];let I=((o=r.flip)==null?void 0:o.overflows)||[];if(d&&B.push(J[b]),u){const O=cr(i,n,E);B.push(J[O[0]],J[O[1]])}if(I=[...I,{placement:i,overflows:B}],!B.every(O=>O<=0)){var A,$;const O=(((A=r.flip)==null?void 0:A.index)||0)+1,j=U[O];if(j&&(!(u==="alignment"?_!==ne(j):!1)||I.every(Q=>ne(Q.placement)===_?Q.overflows[0]>0:!0)))return{data:{index:O,overflows:I},reset:{placement:j}};let de=($=I.filter(Ee=>Ee.overflows[0]<=0).sort((Ee,Q)=>Ee.overflows[1]-Q.overflows[1])[0])==null?void 0:$.placement;if(!de)switch(p){case"bestFit":{var K;const Ee=(K=I.filter(Q=>{if(F){const we=ne(Q.placement);return we===_||we==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(we=>we>0).reduce((we,In)=>we+In,0)]).sort((Q,we)=>Q[1]-we[1])[0])==null?void 0:K[0];Ee&&(de=Ee);break}case"initialPlacement":de=a;break}if(i!==de)return{reset:{placement:de}}}return{}}}},xr=new Set(["left","top"]);async function _r(s,e){const{placement:t,platform:o,elements:i}=s,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),n=xe(t),a=Ne(t),l=ne(t)==="y",c=xr.has(n)?-1:1,d=r&&l?-1:1,u=ze(e,s);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}const kr=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,o;const{x:i,y:r,placement:n,middlewareData:a}=e,l=await _r(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:n}}}}},Cr=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(e){const{x:t,y:o,placement:i,platform:r}=e,{mainAxis:n=!0,crossAxis:a=!1,limiter:l={fn:_=>{let{x:C,y:E}=_;return{x:C,y:E}}},...c}=ze(s,e),d={x:t,y:o},u=await r.detectOverflow(e,c),f=ne(i),p=Qs(f);let g=d[p],w=d[f];const x=(_,C)=>Zs(C+u[_==="y"?"top":"left"],C,C-u[_==="y"?"bottom":"right"]);n&&(g=x(p,g)),a&&(w=x(f,w));const b=l.fn({...e,[p]:g,[f]:w});return{...b,data:{x:b.x-t,y:b.y-o,enabled:{[p]:n,[f]:a}}}}}},Sr=function(s){return s===void 0&&(s={}),{name:"size",options:s,async fn(e){const{placement:t,rects:o,platform:i,elements:r}=e,{apply:n=()=>{},...a}=ze(s,e),l=await i.detectOverflow(e,a),c=xe(t),d=Ne(t),u=ne(t)==="y",{width:f,height:p}=o.floating;let g,w;c==="top"||c==="bottom"?(g=c,w=d===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(w=c,g=d==="end"?"top":"bottom");const x=p-l.top-l.bottom,b=f-l.left-l.right,_=ue(p-l[g],x),C=ue(f-l[w],b),E=e.middlewareData.shift,D=!E;let F=_,U=C;E!=null&&E.enabled.x&&(U=b),E!=null&&E.enabled.y&&(F=x),D&&!d&&(u?U=f-2*ie(l.left,l.right):F=p-2*ie(l.top,l.bottom)),await n({...e,availableWidth:U,availableHeight:F});const J=await i.getDimensions(r.floating);return f!==J.width||p!==J.height?{reset:{rects:!0}}:{}}}};function Vt(){return typeof window<"u"}function $e(s){return io(s)?(s.nodeName||"").toLowerCase():"#document"}function X(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function ae(s){var e;return(e=(io(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function io(s){return Vt()?s instanceof Node||s instanceof X(s).Node:!1}function te(s){return Vt()?s instanceof Element||s instanceof X(s).Element:!1}function me(s){return Vt()?s instanceof HTMLElement||s instanceof X(s).HTMLElement:!1}function ro(s){return!Vt()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof X(s).ShadowRoot}function Dt(s){const{overflow:e,overflowX:t,overflowY:o,display:i}=se(s);return/auto|scroll|overlay|hidden|clip/.test(e+o+t)&&i!=="inline"&&i!=="contents"}function Tr(s){return/^(table|td|th)$/.test($e(s))}function Rt(s){try{if(s.matches(":popover-open"))return!0}catch{}try{return s.matches(":modal")}catch{return!1}}const Ir=/transform|translate|scale|rotate|perspective|filter/,Or=/paint|layout|strict|content/,_e=s=>!!s&&s!=="none";let os;function is(s){const e=te(s)?se(s):s;return _e(e.transform)||_e(e.translate)||_e(e.scale)||_e(e.rotate)||_e(e.perspective)||!rs()&&(_e(e.backdropFilter)||_e(e.filter))||Ir.test(e.willChange||"")||Or.test(e.contain||"")}function Pr(s){let e=ke(s);for(;me(e)&&!rt(e);){if(is(e))return e;if(Rt(e))return null;e=ke(e)}return null}function rs(){return os==null&&(os=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),os}function rt(s){return/^(html|body|#document)$/.test($e(s))}function se(s){return X(s).getComputedStyle(s)}function Bt(s){return te(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function ke(s){if($e(s)==="html")return s;const e=s.assignedSlot||s.parentNode||ro(s)&&s.host||ae(s);return ro(e)?e.host:e}function no(s){const e=ke(s);return rt(e)?(s.ownerDocument||s).body:me(e)&&Dt(e)?e:no(e)}function nt(s,e,t){var o;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=no(s),r=i===((o=s.ownerDocument)==null?void 0:o.body),n=X(i);if(r){const a=ns(n);return e.concat(n,n.visualViewport||[],Dt(i)?i:[],a&&t?nt(a):[])}else return e.concat(i,nt(i,[],t))}function ns(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function ao(s){const e=se(s);let t=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=me(s),r=i?s.offsetWidth:t,n=i?s.offsetHeight:o,a=At(t)!==r||At(o)!==n;return a&&(t=r,o=n),{width:t,height:o,$:a}}function as(s){return te(s)?s:s.contextElement}function Ve(s){const e=as(s);if(!me(e))return re(1);const t=e.getBoundingClientRect(),{width:o,height:i,$:r}=ao(e);let n=(r?At(t.width):t.width)/o,a=(r?At(t.height):t.height)/i;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Mr=re(0);function lo(s){const e=X(s);return!rs()||!e.visualViewport?Mr:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Lr(s,e,t){return e===void 0&&(e=!1),!!t&&e&&t===X(s)}function Ce(s,e,t,o){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=as(s);let n=re(1);e&&(o?te(o)&&(n=Ve(o)):n=Ve(s));const a=Lr(r,t,o)?lo(r):re(0);let l=(i.left+a.x)/n.x,c=(i.top+a.y)/n.y,d=i.width/n.x,u=i.height/n.y;if(r&&o){const f=X(r),p=te(o)?X(o):o;let g=f,w=ns(g);for(;w&&p!==g;){const x=Ve(w),b=w.getBoundingClientRect(),_=se(w),C=b.left+(w.clientLeft+parseFloat(_.paddingLeft))*x.x,E=b.top+(w.clientTop+parseFloat(_.paddingTop))*x.y;l*=x.x,c*=x.y,d*=x.x,u*=x.y,l+=C,c+=E,g=X(w),w=ns(g)}}return $t({width:d,height:u,x:l,y:c})}function Ht(s,e){const t=Bt(s).scrollLeft;return e?e.left+t:Ce(ae(s)).left+t}function co(s,e){const t=s.getBoundingClientRect(),o=t.left+e.scrollLeft-Ht(s,t),i=t.top+e.scrollTop;return{x:o,y:i}}function Er(s){let{elements:e,rect:t,offsetParent:o,strategy:i}=s;const r=i==="fixed",n=ae(o),a=e?Rt(e.floating):!1;if(o===n||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=re(1);const d=re(0),u=me(o);if((u||!r)&&(($e(o)!=="body"||Dt(n))&&(l=Bt(o)),u)){const p=Ce(o);c=Ve(o),d.x=p.x+o.clientLeft,d.y=p.y+o.clientTop}const f=n&&!u&&!r?co(n,l):re(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:t.y*c.y-l.scrollTop*c.y+d.y+f.y}}function Ar(s){return s.getClientRects?Array.from(s.getClientRects()):[]}function zr(s){const e=Bt(s),t=s.ownerDocument.body,o=ie(s.scrollWidth,s.clientWidth,t.scrollWidth,t.clientWidth),i=ie(s.scrollHeight,s.clientHeight,t.scrollHeight,t.clientHeight);let r=-e.scrollLeft+Ht(s);const n=-e.scrollTop;return se(t).direction==="rtl"&&(r+=ie(s.clientWidth,t.clientWidth)-o),{width:o,height:i,x:r,y:n}}const Nr=25;function $r(s,e,t){t===void 0&&(t="viewport");const o=t==="layoutViewport",i=X(s),r=ae(s),n=i.visualViewport;let a=r.clientWidth,l=r.clientHeight,c=0,d=0;if(n){const f=!rs()||e==="fixed";o?f||(c=-n.offsetLeft,d=-n.offsetTop):(a=n.width,l=n.height,f&&(c=n.offsetLeft,d=n.offsetTop))}if(Ht(r)<=0){const f=r.ownerDocument,p=f.body,g=getComputedStyle(p),w=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-w),b=getComputedStyle(r).scrollbarGutter==="stable both-edges"?x/2:x;b<=Nr&&(a-=b)}return{width:a,height:l,x:c,y:d}}function Vr(s,e){const t=Ce(s,!0,e==="fixed"),o=t.top+s.clientTop,i=t.left+s.clientLeft,r=Ve(s),n=s.clientWidth*r.x,a=s.clientHeight*r.y,l=i*r.x,c=o*r.y;return{width:n,height:a,x:l,y:c}}function ho(s,e,t){let o;if(e==="viewport"||e==="layoutViewport")o=$r(s,t,e);else if(e==="document")o=zr(ae(s));else if(te(e))o=Vr(e,t);else{const i=lo(s);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return $t(o)}function Dr(s,e){const t=e.get(s);if(t)return t;let o=nt(s,[],!1).filter(a=>te(a)&&$e(a)!=="body"),i=null;const r=se(s).position==="fixed";let n=r?ke(s):s;for(;te(n)&&!rt(n);){const a=se(n),l=is(n),c=i?i.position:r?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?o=o.filter(u=>u!==n):i=a,n=ke(n)}return e.set(s,o),o}function Rr(s){let{element:e,boundary:t,rootBoundary:o,strategy:i}=s;const n=[...t==="clippingAncestors"?Rt(e)?[]:Dr(e,this._c):[].concat(t),o],a=ho(e,n[0],i);let l=a.top,c=a.right,d=a.bottom,u=a.left;for(let f=1;f<n.length;f++){const p=ho(e,n[f],i);l=ie(p.top,l),c=ue(p.right,c),d=ue(p.bottom,d),u=ie(p.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function Br(s){const{width:e,height:t}=ao(s);return{width:e,height:t}}function Hr(s,e,t){const o=me(e),i=ae(e),r=t==="fixed",n=Ce(s,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=re(0);if((o||!r)&&(($e(e)!=="body"||Dt(i))&&(a=Bt(e)),o)){const f=Ce(e,!0,r,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}!o&&i&&(l.x=Ht(i));const c=i&&!o&&!r?co(i,a):re(0),d=n.left+a.scrollLeft-l.x-c.x,u=n.top+a.scrollTop-l.y-c.y;return{x:d,y:u,width:n.width,height:n.height}}function ls(s){return se(s).position==="static"}function uo(s,e){if(!me(s)||se(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return ae(s)===t&&(t=t.ownerDocument.body),t}function mo(s,e){const t=X(s);if(Rt(s))return t;if(!me(s)){let i=ke(s);for(;i&&!rt(i);){if(te(i)&&!ls(i))return i;i=ke(i)}return t}let o=uo(s,e);for(;o&&Tr(o)&&ls(o);)o=uo(o,e);return o&&rt(o)&&ls(o)&&!is(o)?t:o||Pr(s)||t}const Fr=async function(s){const e=this.getOffsetParent||mo,t=this.getDimensions,o=await t(s.floating);return{reference:Hr(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Kr(s){return se(s).direction==="rtl"}const po={convertOffsetParentRelativeRectToViewportRelativeRect:Er,getDocumentElement:ae,getClippingRect:Rr,getOffsetParent:mo,getElementRects:Fr,getClientRects:Ar,getDimensions:Br,getScale:Ve,isElement:te,isRTL:Kr};function fo(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function Wr(s,e,t){let o=null,i;const r=ae(s);function n(){var d;clearTimeout(i),(d=o)==null||d.disconnect(),o=null}function a(d,u){d===void 0&&(d=!1),u===void 0&&(u=1),n();const f=s.getBoundingClientRect(),{left:p,top:g,width:w,height:x}=f;if(d||e(),!w||!x)return;const b=zt(g),_=zt(r.clientWidth-(p+w)),C=zt(r.clientHeight-(g+x)),E=zt(p),F={rootMargin:-b+"px "+-_+"px "+-C+"px "+-E+"px",threshold:ie(0,ue(1,u))||1};let U=!0;function J(B){const I=B[0].intersectionRatio;if(!fo(f,s.getBoundingClientRect()))return a();if(I!==u){if(!U)return a();I?a(!1,I):i=setTimeout(()=>{a(!1,1e-7)},1e3)}U=!1}try{o=new IntersectionObserver(J,{...F,root:r.ownerDocument})}catch{o=new IntersectionObserver(J,F)}o.observe(s)}const l=X(s),c=()=>a(t);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),n()}}function jr(s,e,t,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,c=as(s),d=i||r?[...c?nt(c):[],...e?nt(e):[]]:[];d.forEach(b=>{i&&b.addEventListener("scroll",t),r&&b.addEventListener("resize",t)});const u=c&&a?Wr(c,t,r):null;let f=-1,p=null;n&&(p=new ResizeObserver(b=>{let[_]=b;_&&_.target===c&&p&&e&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(e)})),t()}),c&&!l&&p.observe(c),e&&p.observe(e));let g,w=l?Ce(s):null;l&&x();function x(){const b=Ce(s);w&&!fo(w,b)&&t(),w=b,g=requestAnimationFrame(x)}return t(),()=>{var b;d.forEach(_=>{i&&_.removeEventListener("scroll",t),r&&_.removeEventListener("resize",t)}),u==null||u(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Gr=kr,Ur=Cr,qr=yr,cs=Sr,Xr=wr,Jr=(s,e,t)=>{const o=new Map,i=t??{},r={...po,...i.platform,_c:o};return vr(s,e,{...i,platform:r})};function ds(s){const e=s.parentNode??null;return e instanceof ShadowRoot?e.host:e}function Yr(s){if(s.transform!=="none"||s.perspective!=="none"||s.filter!=="none")return!0;const e=s.backdropFilter;return!!(e&&e!=="none"||s.willChange&&/\b(transform|filter|perspective)\b/.test(s.willChange))}function hs(s){let e=ds(s);for(;e&&!(e===document.body||e===document.documentElement);){if(e instanceof Element&&Yr(getComputedStyle(e)))return e;e=ds(e)}return window}function Zr(s,e,t){let o=s;for(;o&&!(o===document.body||o===document.documentElement);){if(o instanceof Element){const i=o.getBoundingClientRect();if(Math.abs(i.x-e)<2&&Math.abs(i.y-t)<2)return o}o=ds(o)}return null}function go(s){const e=getComputedStyle(s),t=[];e.transform!=="none"&&t.push(`transform: ${e.transform}`),e.perspective!=="none"&&t.push(`perspective: ${e.perspective}`),e.filter!=="none"&&t.push(`filter: ${e.filter}`);const o=e.backdropFilter;o&&o!=="none"&&t.push(`backdrop-filter: ${o}`),e.willChange&&/\b(transform|filter|perspective)\b/.test(e.willChange)&&t.push(`will-change: ${e.willChange}`),e.contain&&/\b(paint|layout|strict|content)\b/.test(e.contain)&&t.push(`contain: ${e.contain}`);const i=e.containerType;return i&&i!=="normal"&&t.push(`container-type: ${i}`),t.join("; ")}function Qr(s){const e=s.id?`#${s.id}`:"",t=typeof s.className=="string"&&s.className?"."+s.className.split(/\s+/).filter(Boolean).slice(0,2).join("."):"";return`<${s.tagName.toLowerCase()}${e}${t}>`}function en(s){const e=s.tolerance??1.5;let t=0,o=0;if(s.offsetParent instanceof Element){const l=s.offsetParent.getBoundingClientRect(),c=getComputedStyle(s.offsetParent);t=l.x+(parseFloat(c.borderLeftWidth)||0),o=l.y+(parseFloat(c.borderTopWidth)||0)}const i=s.panel.getBoundingClientRect(),r=i.x-(t+s.expectedX),n=i.y-(o+s.expectedY);if(Math.abs(r)<e&&Math.abs(n)<e)return null;const a=Zr(s.reference,r,n);return{driftX:r,driftY:n,culprit:a,culpritDescription:a?Qr(a):"an ancestor element (could not auto-identify)",culpritCss:a?go(a):""}}function tn(s,e){var i;const t=(i=s.closest)==null?void 0:i.call(s,"[data-theme]"),o=t==null?void 0:t.getAttribute("data-theme");o!=null&&e.setAttribute("data-theme",o)}const sn={top:"bottom",right:"left",bottom:"top",left:"right"};function on(s,e,t){if(!t)return;const o=e.split("-")[0],i=sn[o];s.style.left=t.x!=null?`${t.x}px`:"",s.style.top=t.y!=null?`${t.y}px`:"",s.style.right="",s.style.bottom="",s.style[i]=`-${s.offsetWidth/2}px`}function bo(s,e){const t=[Gr(s.offset??4)];if(s.matchWidth){const i=s.matchWidth;t.push(cs({apply({rects:r,elements:n}){const a=`${r.reference.width}px`;i==="exact"?n.floating.style.width=a:n.floating.style.minWidth=a}}))}e&&t.push(qr({...s.lockPlacement===!0?{fallbackStrategy:"initialPlacement"}:{},...s.flipPadding!=null?{padding:s.flipPadding}:{}}));const o=s.shift??8;if(o!==!1&&t.push(Ur({padding:o})),s.maxHeight){const i=typeof s.maxHeight=="object"?s.maxHeight.padding:void 0;t.push(cs({padding:i,apply({availableHeight:r,elements:n}){n.floating.style.maxHeight=`${Math.max(0,r)}px`}}))}if(s.maxWidth){const i=typeof s.maxWidth=="object"?s.maxWidth.padding:void 0;t.push(cs({padding:i,apply({availableWidth:r,elements:n}){n.floating.style.maxWidth=`${Math.max(0,r)}px`}}))}return s.arrow&&t.push(Xr({element:s.arrow.element,padding:s.arrow.padding})),t}function at(s,e,t={}){const o=t.strategy??"fixed";t.inheritThemeFrom&&tn(t.inheritThemeFrom,s),s.style.position=o,s.style.left="0",s.style.top="0";let i=t.placement??"bottom-start",r=t.flip??!0,n=bo(t,r);const a=t.lockPlacement==="freeze";let l=!1;const c=!!t.fixedContainingBlock&&!t.platform,d=t.platform??(c?{...po,getOffsetParent:()=>hs(s)}:void 0),u=()=>{var p;(p=t.beforeCompute)==null||p.call(t),Jr(e,s,{placement:i,strategy:o,middleware:n,...d?{platform:d}:{}}).then(({x:g,y:w,placement:x,middlewareData:b})=>{var _,C;if(s.style.left=`${g}px`,s.style.top=`${w}px`,t.arrow&&on(t.arrow.element,x,b.arrow),a&&!l&&(l=!0,i=x,r=!1,n=bo(t,!1)),(_=t.onPlaced)==null||_.call(t,x),(C=t.onComputed)==null||C.call(t,{x:g,y:w,placement:x}),t.onDrift&&e instanceof Element){const E=c?hs(s):window,D=en({panel:s,reference:e,expectedX:g,expectedY:w,offsetParent:E});D&&t.onDrift(D)}})};let f;return t.autoUpdate??!0?f=jr(e,s,u,t.autoUpdateOptions):u(),{update:u,destroy(){f==null||f(),f=void 0}}}function rn(s){return typeof s=="number"?{show:s,hide:s}:{show:(s==null?void 0:s.show)??0,hide:(s==null?void 0:s.hide)??0}}function nn(s){const e=s.container??document.body,t=s.placement??"top",o=s.visibleClass??"is-visible",i=rn(s.delay),r=document.createElement("div");r.setAttribute("role","tooltip"),s.cssClass&&(r.className=s.cssClass),typeof s.content=="string"?r.textContent=s.content:r.append(s.content);let n,a=!1,l,c,d;const u={getBoundingClientRect:()=>d??s.trigger.getBoundingClientRect(),contextElement:s.trigger},f=_=>{d=new DOMRect(_.clientX,_.clientY,0,0),n==null||n.update()},p=()=>{l&&clearTimeout(l),c&&clearTimeout(c),l=c=void 0},g=()=>{var C;if(p(),a)return;(C=s.onBeforeShow)==null||C.call(s),a=!0,e.append(r);const _=s.followCursor?u:s.trigger;n=at(r,_,{placement:t,strategy:s.strategy,offset:s.offset??8,inheritThemeFrom:s.inheritThemeFrom??s.trigger}),s.followCursor&&s.trigger.addEventListener("mousemove",f),r.classList.add(o)},w=()=>{p(),a&&(a=!1,r.classList.remove(o),s.followCursor&&s.trigger.removeEventListener("mousemove",f),n==null||n.destroy(),n=void 0,r.remove())},x=()=>{p(),i.show>0?l=setTimeout(g,i.show):g()},b=()=>{p(),i.hide>0?c=setTimeout(w,i.hide):w()};return s.trigger.addEventListener("mouseenter",x),s.trigger.addEventListener("mouseleave",b),s.trigger.addEventListener("focusin",x),s.trigger.addEventListener("focusout",b),{element:r,get isVisible(){return a},show:g,hide:w,destroy(){s.trigger.removeEventListener("mouseenter",x),s.trigger.removeEventListener("mouseleave",b),s.trigger.removeEventListener("focusin",x),s.trigger.removeEventListener("focusout",b),w()}}}function an(s){const e=s.container??document.body;let t,o=!1;const i=s.inheritThemeFrom??(s.reference instanceof HTMLElement?s.reference:void 0);return{get isOpen(){return o},open(){o||(o=!0,e.append(s.panel),t=at(s.panel,s.reference,{placement:s.placement??"bottom-start",strategy:s.strategy,offset:s.offset,matchWidth:s.matchWidth,lockPlacement:s.lockPlacement,...s.flip!==void 0?{flip:s.flip}:{},...s.shift!==void 0?{shift:s.shift}:{},...s.autoUpdate!==void 0?{autoUpdate:s.autoUpdate}:{},...s.beforeCompute?{beforeCompute:s.beforeCompute}:{},...s.platform?{platform:s.platform}:{},...i?{inheritThemeFrom:i}:{},...s.onPlaced?{onPlaced:s.onPlaced}:{}}))},close(){o&&(o=!1,t==null||t.destroy(),t=void 0,s.panel.remove())},update(){t==null||t.update()},destroy(){this.close()}}}const vo=["INIT","DATA","UI","INTERACTION"],le=ar("MULTISELECT",vo),lt=le.loggers.INIT,G=le.loggers.DATA,Y=le.loggers.UI,H=le.loggers.INTERACTION,ln=vo.map(s=>`MULTISELECT:${s}`);function cn(){le.enableLogging()}function dn(){le.disableLogging()}function hn(s){le.setLogLevel(s)}function un(s,e){const t=s.includes(":")?s.split(":").pop():s;le.setCategoryLevel(t,e)}class wo{constructor(e){m(this,"container");m(this,"wrapper");m(this,"viewport");m(this,"itemHeight");m(this,"items");m(this,"renderItem");m(this,"bufferSize");m(this,"onVisibleRangeChange");m(this,"onScroll");m(this,"scrollTop",0);m(this,"viewportHeight",0);m(this,"visibleStart",0);m(this,"visibleEnd",0);m(this,"scrollHandler");m(this,"resizeObserver");this.container=e.container,this.itemHeight=e.itemHeight,this.items=e.items,this.renderItem=e.renderItem,this.bufferSize=e.bufferSize??10,this.onVisibleRangeChange=e.onVisibleRangeChange,this.onScroll=e.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 e=this.container.clientHeight;e>0&&(this.viewportHeight=e)}handleScroll(){this.scrollTop=this.container.scrollTop,this.onScroll&&this.onScroll(this.scrollTop),this.render()}calculateVisibleRange(){const e=Math.floor(this.scrollTop/this.itemHeight),t=Math.ceil((this.scrollTop+this.viewportHeight)/this.itemHeight),o=Math.max(0,e-this.bufferSize),i=Math.min(this.items.length,t+this.bufferSize);return{start:o,end:i}}render(){const{start:e,end:t}=this.calculateVisibleRange();if(e===this.visibleStart&&t===this.visibleEnd)return;this.visibleStart=e,this.visibleEnd=t;let o="";for(let i=e;i<t;i++){const r=this.items[i],n=this.renderItem(r,i),a=i*this.itemHeight;o+=`<div class="ms__virtual-item" style="position: absolute; top: ${a}px; left: 0; right: 0; height: ${this.itemHeight}px;" data-index="${i}">`,o+=n,o+="</div>"}this.viewport.innerHTML=o,this.onVisibleRangeChange&&this.onVisibleRangeChange(e,t)}setItems(e){const t=e!==this.items||e.length!==this.items.length;this.items=e,this.wrapper.style.height=`${e.length*this.itemHeight}px`,this.updateViewportHeight(),t&&(this.scrollTop=0,this.container.scrollTop=0),this.visibleStart=-1,this.visibleEnd=-1,this.render()}scrollToIndex(e,t="start"){if(e<0||e>=this.items.length)return;this.updateViewportHeight();const o=e*this.itemHeight,i=o+this.itemHeight,r=Math.max(0,this.items.length*this.itemHeight-this.viewportHeight);let n;if(t==="center")n=o-(this.viewportHeight-this.itemHeight)/2;else if(t==="nearest"){const a=this.container.scrollTop,l=a+this.viewportHeight;if(o>=a&&i<=l)return;n=o<a?o:i-this.viewportHeight}else n=o;n=Math.max(0,Math.min(n,r)),this.container.scrollTop=n,this.scrollTop=n,this.render()}getVisibleRange(){return{start:this.visibleStart,end:this.visibleEnd}}getItemCount(){return this.items.length}setItemHeight(e){this.itemHeight=e,this.wrapper.style.height=`${this.items.length*e}px`,this.visibleStart=-1,this.visibleEnd=-1,this.render()}setBufferSize(e){this.bufferSize=e,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=""}}function yo(s){return{treeId:"",id:-1,path:"",pathSegment:"",parentPath:void 0,level:void 0,children:{},hasChildren:!1,isSelectable:!0,data:void 0,...s}}const ct=s=>!s||typeof s=="string"&&s.trim()==="";function mn(s,e="."){if(!s||typeof s!="string")return null;const t=s.lastIndexOf(e);return t===-1?"":s.substring(0,t)}function xo(s,e,t="."){return ct(e)?s:s.startsWith(e+t)?s.substring(e.length+t.length):s}function _o(s,e=0,t=1,o="."){return s.split(o).slice(e,e+t).join(o)}function pn(s,e){return s.split(e).length}function pe(s,e){return s[e]}function fn(s={}){const e=s.idMember,t=s.pathMember,o=s.getPathCallback,i=s.parentPathMember,r=s.levelMember,n=s.hasChildrenMember,a=s.isSelectableMember,l=s.getIsSelectableCallback,c=s.treeId||"multiselect-tree",d=s.orderMember,u=s.getDisplayValueCallback,f=ct(i),p=ct(r),g=ct(n),w=ct(a),x="x",b=s.treePathSeparator||".",_=yo();let C=0,E=null;const D=B=>o?o(B):t?pe(B,t):void 0,F={treePathSeparator:b,root:_,get tree(){return Object.values(_.children)},get flatNodes(){if(E)return E;const B=[],I=s.isSorted??!1,A=s.sortCallback;function $(K){let O=Object.values(K.children);I&&A&&O.length>0&&(O=A(O));for(const j of O)B.push(j),j.hasChildren&&$(j)}return $(_),E=B,B},insertArray(B){B=B||[],_.children={},C=0,E=null;const I=[];let A=B.map(($,K)=>{const O=yo();O.treeId=c,O.id=e?pe($,e):void 0;const j=D($);return j==null||j===""||typeof j!="string"?(I.push(`index ${K}`),null):(O.path=j,(O.id===void 0||O.id===-1)&&(O.id=j),f?O.parentPath=mn(O.path,b):O.parentPath=pe($,i),O.pathSegment=_o(xo(O.path,O.parentPath??"",b),0,1,b),p?O.level=pn(O.path,b):O.level=pe($,r),g||(O.hasChildren=pe($,n)),O.data=$,O)}).filter($=>$!==null);s.isSorted||(s.sortCallback?A=s.sortCallback(A):A=J(A));for(const $ of A)U($.parentPath??"",$);if(l||!w)for(const $ of A)if(l)$.isSelectable=l($)!==!1;else{const K=pe($.data,a);$.isSelectable=K==null?!0:!!K}I.length>0&&console.warn(`[ltree ${c}] ${I.length} option(s) had an invalid path and were skipped (pathMember="${t}"). Offending: ${I.slice(0,5).join(", ")}`+(I.length>5?", …":""))},getNodeByPath(B,I){let A=I||_;if(B){const $=B.split(b);for(let K=0;K<$.length;K++){const O=x+$[K];if(!A.children.hasOwnProperty(O))return null;A=A.children[O]}}return A}};function U(B,I){const A=F.getNodeByPath(B);if(!A)return`Node: ${I.path} - Could not find parent node: ${B}`;p&&(I.level=(A.level||0)+1);const $=x+_o(xo(I.path,B,b),0,1,b);return A.children.hasOwnProperty($)||(A.children[$]=I,g&&!A.hasChildren&&(A.hasChildren=!0),C=Math.max(C,I.level||0)),null}function J(B){return B.sort((I,A)=>{const $=I.level||0,K=A.level||0;if($!==K)return $-K;if(I.parentPath!==A.parentPath)return I.parentPath?A.parentPath?I.parentPath.localeCompare(A.parentPath):1:-1;if(d&&I.data&&A.data){const O=pe(I.data,d)??0,j=pe(A.data,d)??0;if(O!==j)return O-j}return u?u(I).localeCompare(u(A)):I.path.localeCompare(A.path)})}return F}function ko(s,e){const t=new Map,o=new Map,i=new Set,r=l=>String(e(l.data)),n=l=>{t.set(r(l),l);const c=[];for(const u of Object.values(l.children))c.push(...n(u));let d;return c.length>0?d=c:l.isSelectable!==!1?(d=[r(l)],i.add(l.path)):d=[],o.set(l.path,d),d},a=s.tree;for(const l of a)n(l);return{nodeByValue:t,atomsUnder:o,atomPaths:i,roots:a}}function us(s,e,t){const o=s.atomsUnder.get(e.path);if(!o||o.length===0)return"unchecked";let i=0;for(const r of o)t.has(r)&&i++;return i===0?"unchecked":i===o.length?"checked":"indeterminate"}function dt(s,e){const t=new Set;for(const o of e){const i=s.nodeByValue.get(String(o));if(i)for(const r of s.atomsUnder.get(i.path)??[])t.add(r)}return t}function gn(s,e,t){const o=s.atomsUnder.get(e.path)??[],i=new Set(t),r=us(s,e,t),n=[],a=[];if(r==="checked")for(const l of o)i.delete(l)&&a.push(l);else for(const l of o)i.has(l)||(i.add(l),n.push(l));return{checkedAtoms:i,addedAtoms:n,removedAtoms:a}}function ms(s,e,t,o){const i=a=>String(o(a.data)),r=[],n=a=>{const l=us(s,a,e);if(l==="unchecked")return;const c=a.isSelectable!==!1,d=Object.values(a.children);if(t==="leaves"){s.atomPaths.has(a.path)&&l==="checked"&&r.push(i(a));for(const u of d)n(u);return}if(t==="all"){l==="checked"&&c&&r.push(i(a));for(const u of d)n(u);return}if(l==="checked"&&c){r.push(i(a));return}for(const u of d)n(u)};for(const a of s.roots)n(a);return r}class Co{constructor(e,t={}){m(this,"element");m(this,"instanceId");m(this,"options");z(this,V,!1);m(this,"selectedValues",new Set);m(this,"selectedOptions",new Map);m(this,"allOptions",[]);m(this,"filteredOptions",[]);m(this,"tree",null);m(this,"treeNodes",[]);m(this,"cascadeIndex",null);m(this,"cascadeCheckedAtoms",new Set);m(this,"hiddenInputs",[]);m(this,"focusedIndex",-1);m(this,"keyboardController",null);m(this,"matchingIndices",new Set);m(this,"searchTerm","");m(this,"addNewFocused",!1);m(this,"addNewPending",!1);m(this,"isLoading",!1);m(this,"searchDebounceTimer");m(this,"searchAbortController");m(this,"showSelectedPopover",!1);m(this,"selectedPopoverPlacement",null);m(this,"dropdownPlacement",null);m(this,"isRTL",!1);m(this,"effectiveBadgesPosition","bottom");m(this,"justClosedViaClick",!1);m(this,"justOpenedViaClick",!1);m(this,"positioningDriftWarned",!1);m(this,"fullscreenContainingBlockWarned",!1);m(this,"presentationMode","floating");m(this,"fullscreenHeader",null);m(this,"fullscreenSearchInput",null);m(this,"fullscreenSearchClear",null);m(this,"fullscreenModeToggle",null);m(this,"fullscreenNav",null);m(this,"fullscreenNavCount",null);m(this,"fullscreenNavPrev",null);m(this,"fullscreenNavNext",null);m(this,"bodyScrollUnlock",null);m(this,"overflowXClamp",null);m(this,"keyboardInsetCleanup",null);m(this,"overlayHistoryActive",!1);m(this,"onOverlayPopstate",()=>this.handleOverlayPopstate());m(this,"dropdownCleanup",null);m(this,"hintCleanup",null);m(this,"selectedPopoverCleanup",null);m(this,"tooltips",new Map);m(this,"labelRevealTrigger",null);m(this,"labelRevealPanel",null);m(this,"labelRevealPopover",null);m(this,"messageEl",null);m(this,"messageCleanup",null);m(this,"messageTimer",null);m(this,"onDropdownScroll",()=>{this.hideOptionTooltips(),this.hideLabelReveal()});m(this,"virtualScroll",null);m(this,"optionsContainer",null);m(this,"selectedPopoverVirtualScroll",null);m(this,"selectedPopoverContainer",null);m(this,"input");m(this,"inputWrapper");m(this,"dropdown");m(this,"dropdownInner");m(this,"badgesContainer");m(this,"counter");m(this,"clearButton");m(this,"hint");m(this,"selectedPopover");m(this,"documentKeydownHandler",null);m(this,"documentClickHandler",null);m(this,"overlayCoord",null);this.element=e,this.instanceId=`MS-${Math.random().toString(36).slice(2,11)}`,this.options={searchHint:e.dataset.searchHint||"",searchPlaceholder:e.dataset.searchPlaceholder||void 0,selectPlaceholder:e.dataset.selectPlaceholder||"Pick an option...",noDataPlaceholder:e.dataset.noDataPlaceholder||void 0,dropdownMinWidth:e.dataset.dropdownMinWidth||void 0,dropdownMaxWidth:e.dataset.dropdownMaxWidth||void 0,badgesDisplayMode:e.dataset.badgesDisplayMode||"badges",badgesPosition:e.dataset.badgesPosition||"bottom",badgesThresholdMode:e.dataset.badgesThresholdMode||"count",maxHeight:e.dataset.maxHeight||"20rem",emptyMessage:e.dataset.emptyMessage||"No results found",addNewText:e.dataset.addNewText||void 0,addNewPendingText:e.dataset.addNewPendingText||void 0,loadingMessage:e.dataset.loadingMessage||"Loading...",searchInputMode:e.dataset.searchInputMode||"normal",searchMode:e.dataset.searchMode||"filter",badgesThreshold:e.dataset.badgesThreshold?parseInt(e.dataset.badgesThreshold):void 0,minSearchLength:parseInt(e.dataset.minSearchLength||"0")||0,searchDebounce:parseInt(e.dataset.searchDebounce||"0")||0,isMultipleEnabled:e.dataset.multiple!=="false",isGroupsAllowed:e.dataset.allowGroups!=="false",isCheckboxesShown:e.dataset.showCheckboxes!=="false",isActionsSticky:e.dataset.stickyActions!=="false",isCloseOnSelect:e.dataset.closeOnSelect==="true",isPlacementLocked:e.dataset.lockPlacement!=="false",isSearchEnabled:e.dataset.enableSearch!=="false",isAddNewAllowed:e.dataset.allowAddNew==="true",isCounterShown:e.dataset.showCounter==="true",isSelectedPopoverEnabled:e.dataset.enableSelectedPopover!=="false",isSearchModeToggleShown:e.dataset.showSearchModeToggle==="true",isKeepOptionsOnSearch:e.dataset.keepOptionsOnSearch!=="false",shouldKeepSearchOnClose:e.dataset.keepSearchOnClose!=="false",options:[],container:void 0,...t},this.init()}extractField(e,t){if(Array.isArray(e)&&e.length===2){if(t.tupleSkip)return typeof t.fallback=="function"?t.fallback():t.fallback;if(t.tupleIndex!==void 0){const i=e[t.tupleIndex];return t.transform?t.transform(i):i}}if(t.member&&e[t.member]!==void 0){const i=e[t.member];return t.transform?t.transform(i):i}return t.callback?t.callback(e):typeof t.fallback=="function"?t.fallback():t.fallback}getItemValue(e){return this.extractField(e,{tupleIndex:0,member:this.options.valueMember,callback:this.options.getValueCallback,fallback:"[N/A]"})}getItemDisplayValue(e){return this.extractField(e,{tupleIndex:1,member:this.options.displayValueMember,callback:this.options.getDisplayValueCallback,transform:String,fallback:"[N/A]"})}getItemBadgeDisplayValue(e){if(this.options.getBadgeDisplayCallback)return this.options.getBadgeDisplayCallback(e);if(this.options.isBadgeFullTitleShown){const t=this.getItemFullTitle(e);if(t)return t}return this.getItemDisplayValue(e)}getItemFullTitle(e){return this.extractField(e,{tupleSkip:!0,member:this.options.fullTitleMember,callback:this.options.getFullTitleCallback,transform:String,fallback:void 0})}getItemSearchValue(e){return this.extractField(e,{member:this.options.searchValueMember,callback:this.options.getSearchValueCallback,transform:String,fallback:()=>this.getItemDisplayValue(e)})}getItemSortKey(e){return this.extractField(e,{tupleSkip:!0,member:this.options.selectedOrderMember,callback:this.options.getSelectedOrderCallback,fallback:""})}getOrderedSelectedOptions(){const e=Array.from(this.selectedOptions.values()),t=this.options.selectedOrder??"as-selected";if(t==="as-selected"||e.length<2)return e;const o=e.slice();switch(t){case"label-asc":o.sort((i,r)=>this.getItemBadgeDisplayValue(i).localeCompare(this.getItemBadgeDisplayValue(r)));break;case"label-desc":o.sort((i,r)=>this.getItemBadgeDisplayValue(r).localeCompare(this.getItemBadgeDisplayValue(i)));break;case"member":o.sort((i,r)=>{const n=this.getItemSortKey(i),a=this.getItemSortKey(r);return typeof n=="number"&&typeof a=="number"?n-a:String(n).localeCompare(String(a))});break;case"custom":this.options.selectedOrderCompareCallback&&o.sort(this.options.selectedOrderCompareCallback);break}return o}getItemIcon(e){return this.extractField(e,{tupleSkip:!0,member:this.options.iconMember,callback:this.options.getIconCallback,transform:String,fallback:void 0})}getItemSubtitle(e){return this.extractField(e,{tupleSkip:!0,member:this.options.subtitleMember,callback:this.options.getSubtitleCallback,transform:String,fallback:void 0})}getItemGroup(e){return this.extractField(e,{tupleSkip:!0,member:this.options.groupMember,callback:this.options.getGroupCallback,transform:String,fallback:void 0})}getItemDisabled(e){return this.extractField(e,{tupleSkip:!0,member:this.options.disabledMember,callback:this.options.getDisabledCallback,transform:Boolean,fallback:!1})}isIndexSelectable(e){if(!this.isTreeMode())return!0;const t=this.treeNodes[e];return t?t.isSelectable!==!1:!0}isOptionSelectable(e){if(!this.isTreeMode())return!0;const t=this.filteredOptions.indexOf(e);if(t>=0)return this.isIndexSelectable(t);const o=String(this.getItemValue(e)),i=this.treeNodes.find(r=>String(this.getItemValue(r.data))===o);return i?i.isSelectable!==!1:!0}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),lt.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 e=this.element.dataset.options;if(e)try{this.allOptions=JSON.parse(e)}catch(t){G.error(`[${this.instanceId}] Failed to parse data-options:`,t),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=fn({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:e=>this.getItemDisplayValue(e.data)}),this.tree.insertArray(this.allOptions),this.cascadeIndex=this.isCascadeMode()?ko(this.tree,e=>String(this.getItemValue(e))):null,this.rebuildTreeVisible()}isCascadeMode(){return this.isTreeMode()&&this.options.isMultipleEnabled!==!1&&this.options.checkboxMode!=="independent"}cascadePolicy(){return this.options.cascadeSelectPolicy??"rolled-up"}refreshCascadeAtoms(){this.isCascadeMode()&&this.cascadeIndex&&(this.cascadeCheckedAtoms=dt(this.cascadeIndex,this.selectedValues))}toggleTreeCascade(e){const t=this.cascadeIndex,o=dt(t,this.selectedValues),{checkedAtoms:i}=gn(t,e,o);this.commitCascadeAtoms(i)}commitCascadeAtoms(e){var l;const t=this.cascadeIndex,o=ms(t,e,this.cascadePolicy(),c=>String(this.getItemValue(c))),i=new Set(o),r=[],n=[];for(const[c,d]of this.selectedOptions)i.has(c)||n.push(d);const a=new Map;for(const c of o){const u=((l=t.nodeByValue.get(c))==null?void 0:l.data)??this.selectedOptions.get(c);u!==void 0&&(a.set(c,u),this.selectedValues.has(c)||r.push(u))}this.selectedValues=i,this.selectedOptions=a,this.cascadeCheckedAtoms=e,this.commit({added:r,removed:n})}counterSelection(){if(this.isCascadeMode()&&this.cascadeIndex){const e=ms(this.cascadeIndex,this.cascadeCheckedAtoms,"rolled-up",o=>String(this.getItemValue(o))),t=[];for(const o of e){const i=this.cascadeIndex.nodeByValue.get(o),r=(i==null?void 0:i.data)??this.selectedOptions.get(o);r!==void 0&&t.push(r)}return t}return Array.from(this.selectedOptions.values())}buildCounterTooltip(e){const o=e.slice(0,12).map(i=>this.getItemBadgeDisplayValue(i));return e.length>12&&o.push(`…and ${e.length-12} more`),o.join(`
|
|
2
|
-
`)}rebuildTreeVisible(){if(!this.tree){this.treeNodes=[];return}const e=this.tree.flatNodes,t=this.options.isSearchEnabled?(this.searchTerm||"").trim().toLowerCase():"";let o;if(!t)o=e;else{const i=this.tree.treePathSeparator,r=new Set;for(const n of e)if(this.getItemSearchValue(n.data).toLowerCase().includes(t)){const l=n.path.split(i);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(i))}o=e.filter(n=>r.has(n.path))}this.treeNodes=o,this.filteredOptions=o.map(i=>i.data)}resetVisibleToAll(){this.isTreeMode()?this.rebuildTreeVisible():this.filteredOptions=[...this.allOptions]}rebuildTreeVisibleFromMatches(e){if(!this.tree){this.treeNodes=[],this.filteredOptions=[];return}const t=this.tree.flatNodes,o=this.tree.treePathSeparator,i=new Set((e||[]).map(a=>String(this.getItemValue(a)))),r=new Set;for(const a of t)if(i.has(String(this.getItemValue(a.data)))){const l=a.path.split(o);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(o))}const n=t.filter(a=>r.has(a.path));this.treeNodes=n,this.filteredOptions=n.map(a=>a.data)}rebuildTreeVisibleForNavigate(){if(this.matchingIndices.clear(),!this.tree)return this.treeNodes=[],this.filteredOptions=[],-1;const e=this.tree.flatNodes;this.treeNodes=e,this.filteredOptions=e.map(i=>i.data);const t=(this.searchTerm||"").trim().toLowerCase();if(!t)return-1;let o=-1;return e.forEach((i,r)=>{this.getItemSearchValue(i.data).toLowerCase().includes(t)&&(this.matchingIndices.add(r),o===-1&&(o=r))}),o}detectRTL(){const e=this.element.getRootNode(),t=e instanceof ShadowRoot?e.host:this.element,o=t.getAttribute("dir")==="rtl",i=t.closest('[dir="rtl"]')!==null;this.isRTL=o||i,lt.debug(`[${this.instanceId}] RTL Debug:`,{isShadowRoot:e instanceof ShadowRoot,elementDir:t.getAttribute("dir"),hasElementDir:o,hasAncestorDir:i,isRTL:this.isRTL}),this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left"))}refreshDirection(){if(!this.element)return;const e=this.isRTL;this.detectRTL(),this.element.classList.toggle("ms--rtl",this.isRTL);const t=this.isRTL?"rtl":"ltr";this.dropdown&&(this.dropdown.dir=t),this.hint&&(this.hint.dir=t),this.selectedPopover&&(this.selectedPopover.dir=t),e!==this.isRTL&&this.renderBadges()}buildHTML(){const e=this.options.container||document.body;this.detectRTL(),this.element.classList.add("ms"),this.isRTL&&(this.element.classList.add("ms--rtl"),lt.debug(`[${this.instanceId}] Added ms--rtl class to element`)),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ms--no-checkboxes"),this.options.isSelectedPopoverEnabled||this.element.classList.add("ms--no-selected-popover");const t=document.createElement("div");t.className="ms__input-wrapper",this.inputWrapper=t,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.visibility="hidden");const o=document.createElement("span");o.className="ms__toggle",o.addEventListener("mousedown",n=>{n.preventDefault(),n.stopPropagation(),h(this,V)?(this.justClosedViaClick=!0,this.close(),setTimeout(()=>{this.justClosedViaClick=!1},0)):(this.open(),this.presentationMode!=="fullscreen"&&this.input.focus())}),this.counter=document.createElement("span"),this.counter.className="ms__counter",this.counter.style.display="none",this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="ms__input-clear",this.clearButton.tabIndex=-1,this.clearButton.setAttribute("aria-label","Clear selection"),this.clearButton.style.display="none",this.clearButton.addEventListener("mousedown",n=>n.preventDefault()),this.clearButton.addEventListener("click",n=>{n.stopPropagation(),this.clearClick()}),t.appendChild(this.input),t.appendChild(this.counter),t.appendChild(this.clearButton),t.appendChild(o),this.badgesContainer=document.createElement("div"),this.badgesContainer.className="ms__badges";const i=document.createElement("div");i.className="ms__wrapper",(this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")&&i.classList.add("ms__wrapper--inline"),i.appendChild(t),i.appendChild(this.badgesContainer),this.element.appendChild(i);const r=this.isRTL?"rtl":null;this.dropdown=document.createElement("div"),this.dropdown.className="ms__dropdown",r&&(this.dropdown.dir=r),this.dropdownInner=document.createElement("div"),this.dropdownInner.className="ms__dropdown-inner",this.dropdown.appendChild(this.dropdownInner),e.appendChild(this.dropdown),this.options.searchHint&&(this.hint=document.createElement("div"),this.hint.className="ms__hint",r&&(this.hint.dir=r),this.hint.textContent=this.options.searchHint,e.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ms__selected-popover",r&&(this.selectedPopover.dir=r),e.appendChild(this.selectedPopover),this.renderDropdown()}shouldUseVirtualScroll(){if(!this.options.isVirtualScrollEnabled||this.options.isGroupsAllowed&&this.hasGroups())return!1;const e=this.options.virtualScrollThreshold??100;return this.filteredOptions.length>=e}hasGroups(){return this.filteredOptions.some(e=>{const t=this.getItemGroup(e);return t&&t.trim()!==""})}isGroupCascadeActive(){return!this.isTreeMode()&&this.options.isMultipleEnabled!==!1&&!!this.options.isGroupsAllowed&&this.options.groupSelectMode==="cascade"&&this.hasGroups()}groupCheckState(e){return this.groupSelectionInfo(e).checkState}groupSelectionInfo(e){let t=0,o=0;const i=[];for(const n of e){const a=this.getItemDisabled(n),l=this.selectedValues.has(String(this.getItemValue(n)));a||t++,l&&(i.push(n),a||o++)}const r=t===0||o===0?"unchecked":o===t?"checked":"indeterminate";return{members:e,selectedMembers:i,selectedCount:i.length,memberCount:e.length,selectableCount:t,checkState:r}}formatCountLabel(e,t){return this.options.getCountLabelCallback?this.options.getCountLabelCallback(e,t):`[${e}]`}groupCountHtml(e,t){if(e<=0)return"";const o=this.formatCountLabel(e,t);return`<span class="ms__group-count" aria-label="${e} selected">${this.escapeHtml(o)}</span>`}checkboxHtml(e={}){const t=e.indeterminate?"ms__checkbox ms__checkbox--indeterminate":"ms__checkbox",o=[e.checked?"checked":"",e.indeterminate?'aria-checked="mixed"':"",e.disabled?"disabled":""].filter(Boolean).join(" ");return`<input type="checkbox" class="${t}"${o?" "+o:""}>`}groupCheckboxHtml(e){return this.checkboxHtml({checked:e==="checked",indeterminate:e==="indeterminate"})}renderDropdown(e){var a;if(this.destroyAllActionButtonTooltips(),this.hideLabelReveal(),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 o=this.renderActionsHTML(),i=this.options.actionsPosition==="bottom";if(i||(t+=o),this.options.isVirtualScrollEnabled){const l=this.scaledOptionHeight();t+=`<div class="ms__options ms__options--fixed-height" style="--ms-option-height: ${l}px;">`}else t+='<div class="ms__options">';if(this.filteredOptions.length===0)t+=this.renderEmptyStateHTML();else if(this.isTreeMode())this.treeNodes.forEach((l,c)=>{t+=this.renderTreeNode(l,c)});else if(this.options.isGroupsAllowed){const l=this.groupOptions(this.filteredOptions),c=new Map;this.filteredOptions.forEach((u,f)=>c.set(u,f));const d=this.isGroupCascadeActive();Object.keys(l).forEach(u=>{if(t+='<div class="ms__group">',u!=="__ungrouped__"){const f=` data-group="${this.escapeHtml(u)}"`,p=d?' data-group-select="cascade"':"",g=this.groupSelectionInfo(l[u]),w=d?this.groupCheckboxHtml(g.checkState):"",x=d?"ms__group-label ms__group-label--selectable":"ms__group-label";if(this.options.renderGroupLabelContentCallback){const b={...tt(this.presentationMode),groupName:u,...g},_=this.options.renderGroupLabelContentCallback(u,b);if(_ instanceof HTMLElement){const C=document.createElement("div");if(C.className=x,C.dataset.group=u,d){C.dataset.groupSelect="cascade";const E=document.createElement("template");E.innerHTML=w,E.content.firstChild&&C.appendChild(E.content.firstChild)}C.appendChild(_),t+=C.outerHTML}else t+=`<div class="${x}"${f}${p}>${w}${_}</div>`}else{const b=this.groupCountHtml(g.selectedCount,g.memberCount),_=b?`${x} ms__group-label--has-count`:x;t+=`<div class="${_}"${f}${p}>${w}${this.escapeHtml(u)}${b}</div>`}}l[u].forEach(f=>{t+=this.renderOption(f,c.get(f)??-1)}),t+="</div>"})}else this.filteredOptions.forEach((l,c)=>{t+=this.renderOption(l,c)});t+="</div>",i&&(t+=o);let r=0,n=0;if(e!=null&&e.preserveScroll&&(r=this.dropdownInner.scrollTop,n=((a=this.dropdownInner.querySelector(".ms__options"))==null?void 0:a.scrollTop)??0),this.dropdownInner.innerHTML=t,e!=null&&e.preserveScroll){this.dropdownInner.scrollTop=r;const l=this.dropdownInner.querySelector(".ms__options");l&&(l.scrollTop=n)}this.attachActionButtonTooltips(),this.attachOptionTooltips(),this.markTruncatedOptions(),this.applyEdgeOptionRadii()}applyEdgeOptionRadii(){const e=this.dropdownInner.querySelector(".ms__options");if(!e)return;const t=e.scrollHeight>e.clientHeight+1?e:this.dropdownInner,o=t.offsetWidth-t.clientWidth<=0,i="var(--ms-dropdown-inner-border-radius)",r=Array.from(e.querySelectorAll(".ms__option, .ms__group-label"));r.forEach(l=>{l.style.borderStartStartRadius="",l.style.borderStartEndRadius="",l.style.borderEndStartRadius="",l.style.borderEndEndRadius=""});const n=r[0];n&&(n.style.borderStartStartRadius=i,o&&(n.style.borderStartEndRadius=i));let a;for(let l=r.length-1;l>=0;l--)if(r[l].classList.contains("ms__option")){a=r[l];break}a&&(a.style.borderEndStartRadius=i,o&&(a.style.borderEndEndRadius=i))}renderDropdownVirtual(){if(this.destroyAllActionButtonTooltips(),!this.virtualScroll){let o="";const i=this.renderActionsHTML(),r=this.options.actionsPosition==="bottom";r||(o+=i),o+='<div class="ms__options ms__options--virtual" style="overflow-y: auto; position: relative;"></div>',r&&(o+=i),this.dropdownInner.innerHTML=o,this.optionsContainer=this.dropdownInner.querySelector(".ms__options")}if(this.applyVirtualOptionsSizing(this.optionsContainer),this.filteredOptions.length===0){this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.optionsContainer.innerHTML=this.renderEmptyStateHTML();return}const e=this.scaledOptionHeight(),t=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.optionsContainer&&(this.virtualScroll?(this.virtualScroll.setItemHeight(e),this.virtualScroll.setItems(this.filteredOptions)):this.virtualScroll=new wo({container:this.optionsContainer,itemHeight:e,items:this.filteredOptions,renderItem:(o,i)=>this.isTreeMode()?this.renderTreeNode(this.treeNodes[i],i):this.renderOption(o,i),bufferSize:t,onVisibleRangeChange:()=>{this.attachOptionTooltips(),this.markTruncatedOptions(),this.applyEdgeOptionRadii()}}),this.attachActionButtonTooltips())})}getBuiltInActionDisabled(e){return e==="select-all"?!this.filteredOptions.some(t=>!this.getItemDisabled(t)&&!this.selectedValues.has(String(this.getItemValue(t)))):e==="clear-all"?this.selectedValues.size===0:!1}renderActionsHTML(){const e=this.options.actionButtons;if(!this.options.isMultipleEnabled||!e||e.length===0)return"";const t=this.options.actionsPosition==="bottom"?"bottom":"top",o=this.options.actionsAlign??"stretch",i=` ms__actions--${t}`,r=this.options.isActionsSticky?" ms__actions--sticky":"",n=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"",a=` ms__actions--align-${o}`,l=new Map;if(e.forEach((d,u)=>{if(!(d.getIsVisibleCallback?d.getIsVisibleCallback(this):d.isVisible??!0))return;let p;d.getIsDisabledCallback?p=d.getIsDisabledCallback(this):d.isDisabled!==void 0?p=d.isDisabled:p=this.getBuiltInActionDisabled(d.action);const g=p?" disabled":"",w=d.getTextCallback?d.getTextCallback(this):d.text;let x="";if(d.getClassCallback){const C=this.classSuffix(d.getClassCallback(this));C&&(x=` ${C}`)}else d.cssClass&&(x=` ${d.cssClass}`);const b=Math.max(1,Math.floor(d.row??1)),_=`<button type="button"${g} class="ms__action-btn${x}" data-action="${d.action}" data-button-index="${u}">${w}</button>`;l.has(b)||l.set(b,[]),l.get(b).push(_)}),l.size===0)return"";const c=Array.from(l.keys()).sort((d,u)=>d-u).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(e,t){const o=this.getItemValue(e),i=this.getItemDisplayValue(e),r=this.getItemIcon(e),n=this.getItemSubtitle(e),a=this.getItemDisabled(e),l=this.selectedValues.has(String(o)),c=t===this.focusedIndex,d=this.matchingIndices.has(t),u=["ms__option"];l&&u.push("ms__option--selected"),c&&u.push("ms__option--focused"),d&&u.push("ms__option--matched"),a&&u.push("ms__option--disabled");const f=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"";let p=`<div class="${u.join(" ")}" data-value="${o}" data-index="${t}"${f}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(p+=this.checkboxHtml({checked:l,disabled:a})),p+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const g={index:t,isSelected:l,isFocused:c,isMatched:d,isDisabled:a,...tt(this.presentationMode),isTreeNode:!1};p+=this.toHtml(this.options.renderOptionContentCallback(e,g))}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+=this.renderOptionInfoButton(),p+="</div>",p+="</div>",p}renderOptionInfoButton(){return this.presentationMode!=="fullscreen"?"":'<button type="button" class="ms__option-info" tabindex="-1" aria-label="Show full label"></button>'}renderTreeNode(e,t){const o=e.data,i=this.getItemValue(o),r=this.getItemDisplayValue(o),n=this.getItemIcon(o),a=this.getItemSubtitle(o),l=this.getItemDisabled(o),c=this.isCascadeMode()&&this.cascadeIndex,d=c?us(this.cascadeIndex,e,this.cascadeCheckedAtoms):null,u=c?d==="checked":this.selectedValues.has(String(i)),f=d==="indeterminate",p=t===this.focusedIndex,g=this.matchingIndices.has(t),w=e.isSelectable!==!1,x=e.level??1,b=Math.max(0,x-1),_=["ms__option","ms__option--tree"];_.push(e.hasChildren?"ms__option--tree-branch":"ms__option--tree-leaf"),u&&_.push("ms__option--selected"),f&&_.push("ms__option--indeterminate"),p&&_.push("ms__option--focused"),g&&_.push("ms__option--matched"),l&&_.push("ms__option--disabled"),w||_.push("ms__option--tree-unselectable");const C=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"",E=w?"":' data-selectable="false"';let D=`<div class="${_.join(" ")}" data-value="${i}" data-index="${t}" data-path="${e.path}" data-level="${x}" style="--ms-tree-depth: ${b};"${C}${E}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&w&&(D+=this.checkboxHtml({checked:u,indeterminate:f,disabled:l})),D+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const F={index:t,isSelected:u,isFocused:p,isMatched:g,isDisabled:l,...tt(this.presentationMode),isTreeNode:!0,isBranch:e.hasChildren,isLeaf:!e.hasChildren,childCount:Object.keys(e.children).length,level:x,depth:b,path:e.path,isSelectable:w,isIndeterminate:f};D+=this.toHtml(this.options.renderOptionContentCallback(o,F))}else n&&(D+=`<span class="ms__option-icon">${n}</span>`),D+='<div class="ms__option-text">',D+=`<div class="ms__option-title">${this.highlightMatch(r,this.searchTerm)}</div>`,a&&(D+=`<div class="ms__option-subtitle">${a}</div>`),D+="</div>";return D+=this.renderOptionInfoButton(),D+="</div>",D+="</div>",D}renderEmptyStateHTML(){if(this.isAddNewPromptShown()){const e=(this.searchTerm||"").trim();return this.addNewPending?`<div class="ms__add-new ms__add-new--loading" aria-busy="true"><span class="ms__add-new-spinner" aria-hidden="true"></span><span class="ms__add-new-text">${this.getAddNewPendingText(e)}</span></div>`:`<div class="ms__add-new${this.addNewFocused?" ms__add-new--focused":""}" role="button" data-action="add-new"><span class="ms__add-new-icon" aria-hidden="true"></span><span class="ms__add-new-text">${this.getAddNewText(e)}</span></div>`}return`<div class="ms__empty">${this.options.emptyMessage}</div>`}isAddNewPromptShown(){return!!this.options.isAddNewAllowed&&this.filteredOptions.length===0&&!!(this.searchTerm||"").trim()}getAddNewText(e){return this.options.getAddNewTextCallback?this.escapeHtml(this.options.getAddNewTextCallback(e)):(this.options.addNewText??'Add "{value}"').replace(/\{value\}/g,this.escapeHtml(e))}getAddNewPendingText(e){return(this.options.addNewPendingText??'Adding "{value}"…').replace(/\{value\}/g,this.escapeHtml(e))}escapeHtml(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}highlightMatch(e,t){if(!t)return e;const o=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(o,"<mark>$1</mark>")}groupOptions(e){const t={};return e.forEach(o=>{const i=this.getItemGroup(o)||"__ungrouped__";t[i]||(t[i]=[]),t[i].push(o)}),t}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.getSearchPlaceholder():this.options.selectPlaceholder||this.getSearchPlaceholder()}getSearchPlaceholder(){return this.options.searchPlaceholder?this.options.searchPlaceholder:this.options.isSearchModeToggleShown?(this.options.searchMode||"filter")==="navigate"?"Search…":"Filter…":"Search..."}refreshSearchPlaceholder(){const e=this.getPlaceholderText();this.input&&(this.input.placeholder=e),this.fullscreenSearchInput&&(this.fullscreenSearchInput.placeholder=e)}renderBadges(){this.updateClearButton(),this.destroyAllBadgeTooltips();const e=this.getOrderedSelectedOptions(),t=this.selectedValues.size;if(!this.options.isMultipleEnabled){this.badgesContainer.innerHTML="",this.counter.style.display="none";let r;e[0]&&(this.options.renderSelectedContentCallback?r=this.options.renderSelectedContentCallback(e[0],tt(this.presentationMode)):r=this.getItemDisplayValue(e[0])),!h(this,V)&&t>0&&e.length>0?this.input.value=r:h(this,V)||(this.input.value="");return}let o=this.options.badgesDisplayMode;if(this.options.badgesThreshold!==null&&t>this.options.badgesThreshold&&o!=="none"&&(o=this.options.badgesThresholdMode||"count"),!h(this,V))if(t>0&&o==="count"){const r=this.options.getCounterCallback?this.options.getCounterCallback(t):`${t} selected`;this.input.placeholder=r}else this.input.placeholder=this.getPlaceholderText();if(this.options.isCounterShown&&t>0){const r=this.counterSelection(),n=r.length;this.counter.textContent=this.formatCountLabel(n,this.allOptions.length),this.counter.title=this.buildCounterTooltip(r),this.counter.style.display=n>0?"":"none"}else this.counter.title="",this.counter.style.display="none";if(o==="none"){this.badgesContainer.innerHTML="";return}if(o==="badges")this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,this.badgesContainer.innerHTML=e.map(r=>this.renderBadgeHTML(r,{displayMode:"badges",isInPopover:!1})).join("");else if(o==="partial"){this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`;const r=this.options.badgesMaxVisible||3,n=e.slice(0,r),a=t-r,l=n.map(d=>this.renderBadgeHTML(d,{displayMode:"partial",isInPopover:!1})).join("");let c="";a>0&&(c=`
|
|
1
|
+
(function(k,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(k=typeof globalThis<"u"?globalThis:k||self,T(k.MultiSelect={}))})(this,function(k){"use strict";var On=Object.defineProperty;var No=k=>{throw TypeError(k)};var Mn=(k,T,R)=>T in k?On(k,T,{enumerable:!0,configurable:!0,writable:!0,value:R}):k[T]=R;var m=(k,T,R)=>Mn(k,typeof T!="symbol"?T+"":T,R),ps=(k,T,R)=>T.has(k)||No("Cannot "+R);var h=(k,T,R)=>(ps(k,T,"read from private field"),R?R.call(k):T.get(k)),N=(k,T,R)=>T.has(k)?No("Cannot add the same private member more than once"):T instanceof WeakSet?T.add(k):T.set(k,R),M=(k,T,R,E)=>(ps(k,T,"write to private field"),E?E.call(k,R):T.set(k,R),R),b=(k,T,R)=>(ps(k,T,"access private method"),R);var ge,ht,Te,ut,Ie,mt,Kt,Oe,be,Me,Pe,Be,He,Fe,Ke,We,je,Wt,ce,Ge,L,zo,$o,Vo,ee,Do,Ro,fs,gs,vt,bs,Bo,V,Z,S,ve,pt,Ue,ft,gt,bt,qe,Xe,Ee,y,vs,jt,we,Gt,ws,ys,xs,Ut,Ho,Fo,Ko,Je,_s,ks,Wo,jo,Cs,Go,Uo,Ss,Ts;function T(s,e={}){const t=new Set(s),o=e.shouldNullOnInvalid?null:e.default??null;return{values:s,fromAttribute(i){return i===null?e.default??o:t.has(i)?i:o},validate(i){return typeof i=="string"&&t.has(i)},toAttribute(i){return i==null?null:String(i)}}}function R(s={}){const e=o=>(s.min==null||o>=s.min)&&(s.max==null||o<=s.max),t=s.default;return{fromAttribute(o){if(o===null)return t;const i=Number.parseInt(o,10);return Number.isNaN(i)||!e(i)?t:i},validate(o){return typeof o=="number"&&Number.isInteger(o)&&e(o)},toAttribute(o){return o==null?null:String(o)}}}function E(s={}){const e=s.isNullable===!0,t=s.default??(e?null:""),o=i=>s.shouldTrim?i.trim():i;return{fromAttribute(i){if(i===null)return t;const r=o(i);return!s.isEmptyAllowed&&r===""?t:r},validate(i){return i===null?e:typeof i=="string"&&(s.isEmptyAllowed===!0||i!=="")},toAttribute(i){return i==null?null:String(i)}}}const qo=new Set(["","true","1","yes","on"]),Xo=new Set(["false","0","no","off"]);function W(s="presence"){const e=t=>{const o=t.trim().toLowerCase();return qo.has(o)?!0:Xo.has(o)?!1:null};return{fromAttribute(t){switch(s){case"presence":return t!==null;case"default-true":return t===null?!0:e(t)??!0;case"default-false":return t===null?!1:e(t)??!1;case"tristate":return t===null?null:e(t)}},validate(t){return s==="tristate"?t===!0||t===!1||t===null:typeof t=="boolean"},toAttribute(t){return s==="presence"?t?"":null:t==null?null:String(t)}}}function Jo(s={}){const e=s.default;return{fromAttribute(t){if(t===null||t.trim()==="")return e;let o;try{o=JSON.parse(t)}catch{return e}return s.validate&&!s.validate(o)?e:o},validate:s.validate,toAttribute(t){return t==null?null:JSON.stringify(t)}}}function Yo(s={}){const e=s.default??[],t=o=>Array.isArray(o)&&(!s.validateItem||o.every(s.validateItem));return{fromAttribute(o){if(o===null||o.trim()==="")return e;let i;try{i=JSON.parse(o)}catch{return e}return t(i)?i:e},validate:t,toAttribute(o){return Array.isArray(o)?JSON.stringify(o):null}}}function Zo(){return{validate(s){return s==null||typeof s=="function"}}}function Qo(s,e,t){const o=s.converter,i=o!=null&&o.fromAttribute?o.fromAttribute(e,t,s.attribute??s.configKey):e??s.default;return{configKey:s.configKey,field:s.field,value:i,on:s.on??"update"}}function ei(s,e){const t=s.converter;return t!=null&&t.validate&&!t.validate(e)?null:{configKey:s.configKey,field:s.field,value:e,on:s.on??"update"}}function ti(){const s=new Set;let e=!1;const t=()=>{e=!1;const o=[...s];s.clear();for(const i of o)i()};return{schedule(o){s.add(o),e||(e=!0,queueMicrotask(t))},flush(){if(s.size===0)return;e=!1;const o=[...s];s.clear();for(const i of o)i()},cancel(){s.clear(),e=!1}}}const Is={pointer:"fine",hasCoarsePointer:!1,canHover:!0,isTouchPrimary:!1,orientation:"landscape",viewportWidth:1024,viewportHeight:768,breakpoint:"desktop",os:"unknown",isApple:!1,isAndroid:!1};let wt=Ms({mobile:640,tablet:1024,desktop:1/0});const Ye=new Set,Ze=new Set;let xe=null,yt=[],xt=!1;const Os=30;let Ne,_t=0;function Ms(s){return Object.entries(s).sort((e,t)=>e[1]-t[1])}function si(s){for(const[t,o]of wt)if(s<=o)return t;const e=wt[wt.length-1];return e?e[0]:"desktop"}function qt(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Ps(){return typeof navigator<"u"&&(navigator.maxTouchPoints??0)>1}function oi(){var o;if(typeof navigator>"u")return"unknown";const s=navigator.userAgentData,e=(o=s==null?void 0:s.platform)==null?void 0:o.toLowerCase();if(e){if(e.includes("android"))return"android";if(e.includes("ios"))return"ios";if(e.includes("mac"))return Ps()?"ios":"macos";if(e.includes("windows"))return"windows";if(e.includes("linux"))return"linux"}const t=navigator.userAgent??"";return/android/i.test(t)?"android":/iphone|ipod|ipad/i.test(t)?"ios":/macintosh|mac os x/i.test(t)?Ps()?"ios":"macos":/windows/i.test(t)?"windows":/linux/i.test(t)?"linux":"unknown"}let ii;function ri(){return ii??(ii=oi())}function Qe(s){return qt()&&window.matchMedia(s).matches}function Xt(){if(!qt())return{...Is};const s=Qe("(any-pointer: coarse)"),e=Qe("(pointer: coarse)"),t=Qe("(pointer: fine)"),o=Qe("(hover: hover)"),i=e?"coarse":t?"fine":"none",r=window.innerWidth,n=window.innerHeight,a=ri();return{pointer:i,hasCoarsePointer:s,canHover:o,isTouchPrimary:e&&!o,orientation:Qe("(orientation: portrait)")?"portrait":"landscape",viewportWidth:r,viewportHeight:n,breakpoint:si(r),os:a,isApple:a==="ios"||a==="macos",isAndroid:a==="android"}}function ni(s,e){return s.pointer===e.pointer&&s.hasCoarsePointer===e.hasCoarsePointer&&s.canHover===e.canHover&&s.isTouchPrimary===e.isTouchPrimary&&s.orientation===e.orientation&&s.breakpoint===e.breakpoint}function ai(s,e){return s.viewportWidth===e.viewportWidth&&s.viewportHeight===e.viewportHeight}function kt(){const s=Xt(),e=xe;if(xe=s,!e||!ni(e,s))for(const t of[...Ye])t(s);Ze.size>0&&(!e||!ai(e,s))&&li()}function Ls(){const s=xe;if(s)for(const e of[...Ze])e(s)}function li(){if(Ne!==void 0)return;const s=Date.now()-_t;s>=Os?(_t=Date.now(),Ls()):Ne=setTimeout(()=>{Ne=void 0,_t=Date.now(),Ls()},Os-s)}const Ct=()=>kt(),Es=()=>{if(typeof requestAnimationFrame=="function"){if(xt)return;xt=!0,requestAnimationFrame(()=>{xt=!1,kt()})}else kt()};function ci(s){typeof s.addEventListener=="function"?s.addEventListener("change",Ct):typeof s.addListener=="function"&&s.addListener(Ct)}function di(s){typeof s.removeEventListener=="function"?s.removeEventListener("change",Ct):typeof s.removeListener=="function"&&s.removeListener(Ct)}function As(){if(!qt()){xe={...Is};return}yt=[window.matchMedia("(pointer: coarse)"),window.matchMedia("(pointer: fine)"),window.matchMedia("(any-pointer: coarse)"),window.matchMedia("(hover: hover)"),window.matchMedia("(orientation: portrait)")];for(const s of yt)ci(s);typeof window.addEventListener=="function"&&window.addEventListener("resize",Es),xe=Xt()}function Ns(){for(const s of yt)di(s);yt=[],typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",Es),xt=!1,Ne!==void 0&&(clearTimeout(Ne),Ne=void 0),_t=0,xe=null}function St(){return Ye.size+Ze.size}function et(){return xe??Xt()}function zs(s,e={}){const t=St()===0;Ye.add(s),t&&As(),e.immediate!==!1&&s(et());let o=!0;return()=>{o&&(o=!1,Ye.delete(s),St()===0&&Ns())}}function $s(s,e={}){const t=St()===0;Ze.add(s),t&&As(),e.immediate!==!1&&s(et());let o=!0;return()=>{o&&(o=!1,Ze.delete(s),St()===0&&Ns())}}function hi(s){wt=Ms(s),Ye.size>0&&kt()}const Vs=600;function Ds(s){return s.isTouchPrimary?Math.min(s.viewportWidth,s.viewportHeight)<Vs?"mobile":"tablet":"desktop"}const ui=30;let oe=null;const tt=new WeakMap;let Jt=0;function mi(){return typeof ResizeObserver<"u"}function Rs(s){if(typeof s.getBoundingClientRect!="function")return{width:0,height:0};const e=s.getBoundingClientRect();return{width:e.width,height:e.height}}function pi(s,e){return!!s&&s.width===e.width&&s.height===e.height}function fi(s,e){if(pi(s.lastFired,e)||(s.pendingSize=e,s.timer!==void 0))return;const t=Date.now()-s.lastNotify;t>=s.throttleMs?(s.lastNotify=Date.now(),Bs(s)):s.timer=setTimeout(()=>{s.timer=void 0,s.lastNotify=Date.now(),Bs(s)},s.throttleMs-t)}function Bs(s){const e=s.pendingSize;e&&(s.lastFired=e,s.cb(e,s.el))}function gi(s){for(const e of s){const t=tt.get(e.target);if(!t)continue;const o=Rs(e.target);for(const i of[...t])fi(i,o)}}function bi(){return mi()?(oe||(oe=new ResizeObserver(gi)),oe):null}function vi(s,e,t={}){const o={el:s,cb:e,throttleMs:t.throttleMs??ui,lastNotify:0};if(t.immediate!==!1){const n=Rs(s);o.lastFired=n,o.lastNotify=Date.now(),e(n,s)}const i=bi();if(i){let n=tt.get(s);n||(tt.set(s,n=new Set),Jt++,i.observe(s)),n.add(o)}let r=!0;return()=>{if(!r)return;r=!1,o.timer!==void 0&&(clearTimeout(o.timer),o.timer=void 0);const n=tt.get(s);n&&(n.delete(o),n.size===0&&(tt.delete(s),oe==null||oe.unobserve(s),Jt--,Jt===0&&oe&&(oe.disconnect(),oe=null)))}}const Tt=new Map;function wi(s,e){let t=Tt.get(s);t||Tt.set(s,t=new Set),t.add(e)}function yi(s,e){var t;(t=Tt.get(s))==null||t.delete(e)}function xi(s){return Array.from(Tt.get(s)??[])}const Hs=new Map;function _i(s,e){Hs.set(s.toLowerCase(),e)}function ki(s){return Hs.get(s.toLowerCase())}function Ci(s,e,t,o={}){return s.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:o.bubbles??!0,composed:o.composed??!0,cancelable:o.cancelable??!1}))}function Si(s){return s.split(/[-_]/).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function Ti(s){return`on${Si(s)}`}function Ii(s){return s?s.map(e=>{const t=typeof e=="string"?{name:e}:e,o=t.property===!1?null:t.property??Ti(t.name);return{name:t.name,property:o,bubbles:t.bubbles,composed:t.composed,cancelable:t.cancelable}}):[]}const Oi=typeof HTMLElement<"u"?HTMLElement:class{},Fs=new WeakSet;let Mi=0;const Pi={trace(){},debug(){},info(){},warn(){},error(){}},Li=new Proxy({},{get:()=>Pi}),Le=class Le extends Oi{constructor(){super();N(this,L);N(this,ge,{});N(this,ht,new Map);N(this,Te,new Map);N(this,ut,new Map);N(this,Ie,new Map);N(this,mt,ti());N(this,Kt,()=>b(this,L,bs).call(this));N(this,Oe,null);N(this,be,!1);N(this,Me,[]);N(this,Pe,!1);N(this,Be,null);N(this,He,!1);N(this,Fe);N(this,Ke);N(this,We);N(this,je);N(this,Wt);N(this,ce);N(this,Ge);const t=this.constructor,o=t.inputs??[],i=Ii(t.events);b(this,L,Vo).call(this,o,i);for(const r of o)h(this,ht).set(r.configKey,r),r.attribute&&h(this,Te).set(r.attribute,r);for(const r of i)h(this,ut).set(r.name,r);b(this,L,zo).call(this,o),b(this,L,Do).call(this,o),b(this,L,Ro).call(this,i)}static get observedAttributes(){const t=(this.inputs??[]).filter(o=>o.attribute).map(o=>o.attribute);return t.includes("dir")?t:[...t,"dir"]}attributeChangedCallback(t,o,i){var a;if(h(this,He))return;if(t==="dir"&&!h(this,Te).has("dir")){h(this,Pe)&&this.directionChanged(this.isRTL);return}const r=h(this,Te).get(t);if(!r||!h(this,Pe)&&((a=h(this,Be))!=null&&a.has(r.configKey)))return;let n;try{n=Qo(r,i,this)}catch(l){b(this,L,ee).call(this,`converter for "${r.configKey}" threw parsing attribute ${t}="${i}"; using default`,l),n=b(this,L,$o).call(this,r)}b(this,L,gs).call(this,n)}connectedCallback(){wi(this.localName,this),h(this,Pe)||(M(this,Pe,!0),M(this,Be,null),M(this,be,!0)),b(this,L,vt).call(this),this.connect(),this.environmentChanged!==Le.prototype.environmentChanged&&M(this,Fe,zs(t=>this.environmentChanged(t))),this.viewportChanged!==Le.prototype.viewportChanged&&M(this,Ke,$s(t=>this.viewportChanged(t))),this.resized!==Le.prototype.resized&&M(this,We,vi(this,t=>this.resized(t),{immediate:!1}))}disconnectedCallback(){var t,o,i;yi(this.localName,this),(t=h(this,Fe))==null||t.call(this),M(this,Fe,void 0),(o=h(this,Ke))==null||o.call(this),M(this,Ke,void 0),(i=h(this,We))==null||i.call(this),M(this,We,void 0),this.disconnect()}setAttributes(t){for(const[o,i]of Object.entries(t)){const r=h(this,ht).get(o)??h(this,Te).get(o);r&&b(this,L,fs).call(this,r,i)}b(this,L,vt).call(this)}batch(t){t(),b(this,L,vt).call(this)}flush(){b(this,L,vt).call(this)}whenSettled(){return!h(this,Oe)&&!h(this,be)?Promise.resolve():new Promise(t=>h(this,Me).push(t))}get config(){return h(this,ge)}get log(){if(h(this,Ge))return h(this,Ge);const t=ki(this.localName);if(!t)return Li;const o=h(this,Wt)??M(this,Wt,`${this.localName}#${this.id||++Mi}`);return M(this,Ge,t.forInstance(o,()=>h(this,ce)))}enableLogging(t="debug"){M(this,ce,t)}disableLogging(){M(this,ce,void 0)}get isLoggingEnabled(){return h(this,ce)!=null&&h(this,ce)!=="silent"&&h(this,ce)!==5}reinit(){}update(t){}connect(){}disconnect(){}environmentChanged(t){}viewportChanged(t){}resized(t){}get isRTL(){return typeof getComputedStyle=="function"&&getComputedStyle(this).direction==="rtl"}directionChanged(t){}get internals(){if(h(this,je))return h(this,je);if(typeof this.attachInternals!="function")return null;try{return M(this,je,this.attachInternals())}catch{return null}}get form(){var t;return((t=this.internals)==null?void 0:t.form)??null}emit(t,o,i){const r=h(this,ut).get(t);return Ci(this,t,o,{bubbles:(i==null?void 0:i.bubbles)??(r==null?void 0:r.bubbles),composed:(i==null?void 0:i.composed)??(r==null?void 0:r.composed),cancelable:(i==null?void 0:i.cancelable)??(r==null?void 0:r.cancelable)})}on(t,o,i){const r=o;return this.addEventListener(t,r,i),()=>this.removeEventListener(t,r,i)}async runHook(t,o,i){const r=h(this,ge)[t];if(typeof r!="function")return i.whenUnset;try{return await Promise.resolve(r(o))}catch(n){if(i.onError)return i.onError(n);throw n}}};ge=new WeakMap,ht=new WeakMap,Te=new WeakMap,ut=new WeakMap,Ie=new WeakMap,mt=new WeakMap,Kt=new WeakMap,Oe=new WeakMap,be=new WeakMap,Me=new WeakMap,Pe=new WeakMap,Be=new WeakMap,He=new WeakMap,Fe=new WeakMap,Ke=new WeakMap,We=new WeakMap,je=new WeakMap,Wt=new WeakMap,ce=new WeakMap,Ge=new WeakMap,L=new WeakSet,zo=function(t){var o;for(const i of t){let r=i.default;if((o=i.converter)!=null&&o.fromAttribute)try{r=i.converter.fromAttribute(null,this,i.attribute??i.configKey)}catch(n){b(this,L,ee).call(this,`converter for "${i.configKey}" threw computing its default; using \`default\``,n),r=i.default}h(this,ge)[i.configKey]=r,i.field&&(this[i.field]=r)}},$o=function(t){return{configKey:t.configKey,field:t.field,value:t.default,on:t.on??"update"}},Vo=function(t,o){var l;const i=this.constructor;if(Fs.has(i))return;Fs.add(i);const r=new Set,n=new Set;for(const c of t)r.has(c.configKey)&&b(this,L,ee).call(this,`invalid input table: duplicate configKey "${c.configKey}"`),r.add(c.configKey),c.attribute&&(n.has(c.attribute)&&b(this,L,ee).call(this,`invalid input table: duplicate attribute "${c.attribute}"`),n.add(c.attribute)),c.reflect&&!c.attribute&&b(this,L,ee).call(this,`invalid input table: "${c.configKey}" has reflect:true but no attribute to reflect to`),c.reflect&&!((l=c.converter)!=null&&l.toAttribute)&&b(this,L,ee).call(this,`invalid input table: "${c.configKey}" has reflect:true but its converter has no toAttribute`);const a=new Set;for(const c of o)a.has(c.name)&&b(this,L,ee).call(this,`invalid event table: duplicate event "${c.name}"`),a.add(c.name),/^[a-z][a-z0-9-]*$/.test(c.name)||b(this,L,ee).call(this,`invalid event table: event "${c.name}" should be lowercase kebab-case (e.g. "date-select")`),c.property&&r.has(c.property)&&b(this,L,ee).call(this,`invalid event table: event "${c.name}" property "${c.property}" collides with an input configKey`)},ee=function(t,...o){console.warn(`[BlissElement] <${this.localName??"unknown"}> ${t}`,...o)},Do=function(t){for(const o of t){const i=o.configKey,r=Object.prototype.hasOwnProperty.call(this,i),n=r?this[i]:void 0;r&&delete this[i],Object.defineProperty(this,i,{configurable:!0,enumerable:!0,get:()=>h(this,ge)[i],set:a=>b(this,L,fs).call(this,o,a)}),r&&((h(this,Be)??M(this,Be,new Set)).add(i),this[i]=n)}},Ro=function(t){for(const o of t){const i=o.property;if(!i)continue;const r=o.name,n=Object.prototype.hasOwnProperty.call(this,i),a=n?this[i]:void 0;n&&delete this[i],Object.defineProperty(this,i,{configurable:!0,enumerable:!0,get:()=>h(this,Ie).get(r)??null,set:l=>{const c=h(this,Ie).get(r);if(c&&this.removeEventListener(r,c),typeof l=="function"){const d=l;h(this,Ie).set(r,d),this.addEventListener(r,d)}else h(this,Ie).delete(r)}}),n&&(this[i]=a)}},fs=function(t,o){var r;const i=ei(t,o);if(!i){b(this,L,ee).call(this,`rejected invalid value for property "${t.configKey}"; keeping previous value`,o);return}if(b(this,L,gs).call(this,i),t.reflect&&t.attribute&&((r=t.converter)!=null&&r.toAttribute)){const n=t.converter.toAttribute(i.value);M(this,He,!0);try{n===null?this.removeAttribute(t.attribute):this.setAttribute(t.attribute,n)}finally{M(this,He,!1)}}},gs=function(t){h(this,ge)[t.configKey]=t.value,t.field&&(this[t.field]=t.value),t.on!=="none"&&(t.on==="reinit"&&M(this,be,!0),(h(this,Oe)??M(this,Oe,{}))[t.configKey]=t.value,h(this,mt).schedule(h(this,Kt)))},vt=function(){h(this,mt).cancel(),b(this,L,bs).call(this)},bs=function(){if(!this.isConnected)return;const t=h(this,be),o=h(this,Oe);M(this,be,!1),M(this,Oe,null),t?this.reinit():o&&Object.keys(o).length>0&&this.update(o),b(this,L,Bo).call(this)},Bo=function(){if(h(this,Me).length===0)return;const t=h(this,Me);M(this,Me,[]);for(const o of t)o()},m(Le,"inputs"),m(Le,"events");let Yt=Le;function Ks(s,e,t){typeof customElements>"u"||customElements.get(s)||customElements.define(s,e,t)}function Ei(s){return{enableLogging:e=>s.enableLogging(e),disableLogging:()=>s.disableLogging(),setLogLevel:e=>s.setLogLevel(e),setCategoryLevel:(e,t)=>s.setCategoryLevel(e,t),getCategories:()=>[...s.LOGGING_CATEGORIES]}}function Ai(s,e,t){const{config:o,logging:i,shouldAutoDefine:r=!0}=t;i&&_i(s,i);const n={version:()=>o.version,config:o,...i?{logging:Ei(i)}:{},register:()=>Ks(s,e),getInstances:()=>xi(s)};return typeof window<"u"&&((window.components??(window.components={}))[s]=n),r&&Ks(s,e),n}const Ws=new Map,js=new WeakMap;let It;function Ni(s){if(typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in s))return!1;if(It===void 0)try{new CSSStyleSheet().replaceSync(""),It=!0}catch{It=!1}return It}function zi(s,...e){if(typeof document>"u")return;let t=js.get(s);t||js.set(s,t=new Set);const o=e.filter(r=>r&&!t.has(r));if(o.length===0)return;for(const r of o)t.add(r);if(Ni(s)){const r=o.map(n=>{let a=Ws.get(n);return a||(a=new CSSStyleSheet,a.replaceSync(n),Ws.set(n,a)),a});s.adoptedStyleSheets=[...s.adoptedStyleSheets,...r];return}const i=s.head??s;for(const r of o){const n=document.createElement("style");n.textContent=r,i.appendChild(n)}}function $i(s,e={}){const t=e.position??"last",o=s.head??s;let i=null;const r=()=>typeof document>"u"?null:(i||(i=document.createElement("style"),e.className&&(i.className=e.className)),i.parentNode!==o&&(t==="first"&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i)),i),n=()=>{i==null||i.remove()};return{set(a){if(!a){n();return}const l=r();l&&(l.textContent=a)},clear:n,destroy(){i==null||i.remove(),i=null}}}function Gs(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vi(s,e){const t=new Set,o=new RegExp(`var\\(\\s*(${Gs(e)}[a-z0-9-]+)`,"gi");let i;for(;i=o.exec(s);)i[1]&&t.add(i[1]);return t}function Di(s,e){const t=new Set,o=new RegExp(`(${Gs(e)}[a-z0-9-]+)\\s*:`,"gi");let i;for(;i=o.exec(s);)i[1]&&t.add(i[1]);return[...t]}function Ri(s,e,t={}){const o=t.minScore??3,i=t.limit??3,r=new Set(s.split("-").filter(Boolean));return[...e].map(n=>({k:n,score:n.split("-").filter(a=>r.has(a)).length})).filter(n=>n.score>=o).sort((n,a)=>a.score-n.score).slice(0,i).map(n=>n.k)}function Bi(s,e){if(e.consumed.size===0)return[];const t=[];for(const o of Di(s,e.prefix))e.consumed.has(o)||t.push({name:o,suggestions:Ri(o,e.consumed,{minScore:e.minScore})});return t}const Hi={mobile:"fullscreen",tablet:"floating",desktop:"floating"};function Fi(s,e,t={}){if(s!=="auto")return s;const o=Ds(e);return t[o]??Hi[o]}function he(s){return{presentation:s,isFullscreen:s==="fullscreen",isModal:s==="modal"}}let st=0,Ot=null;function Ki(){if(typeof document>"u")return()=>{};st===0&&(Ot=document.body.style.overflow,document.body.style.overflow="hidden"),st++;let s=!1;return()=>{s||(s=!0,st=Math.max(0,st-1),st===0&&Ot!==null&&(document.body.style.overflow=Ot,Ot=null))}}function Wi(s){const e=typeof window<"u"?window.visualViewport:null;if(!e)return()=>{};let t=!1;const o=()=>{t=!1,s.style.height=`${e.height}px`,s.style.top=`${e.offsetTop}px`},i=()=>{t||(t=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(o):o())};return e.addEventListener("resize",i),e.addEventListener("scroll",i),i(),()=>{e.removeEventListener("resize",i),e.removeEventListener("scroll",i),s.style.height="",s.style.top=""}}const Zt="km-overlay-activated",ji=Symbol("km-overlay-all-groups"),Mt=new Set,ot=new Map;let Pt=!1;function Qt(){return typeof document<"u"}function Gi(s,e){return e===ji||s===e}function Us(s){const e=s.detail,t=e==null?void 0:e.source,o=e==null?void 0:e.group;for(const i of Array.from(Mt))i.id!==t&&Gi(i.group,o)&&i.dismiss()}function Ui(){Pt||!Qt()||(document.addEventListener(Zt,Us),Pt=!0)}function qi(){Pt&&Mt.size===0&&Qt()&&(document.removeEventListener(Zt,Us),Pt=!1)}function Xi(s,e){Qt()&&document.dispatchEvent(new CustomEvent(Zt,{detail:{source:s,group:e}}))}function Ji(s,e){const t={id:{},group:e,dismiss:s};return Mt.add(t),Ui(),{activate(){ot.set(t.group,t),Xi(t.id,t.group)},deactivate(){ot.get(t.group)===t&&ot.delete(t.group)},dispose(){Mt.delete(t),ot.get(t.group)===t&&ot.delete(t.group),qi()}}}const q={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},qs=["trace","debug","info","warn","error"],Lt=()=>{};let Yi="km-log";function Xs(s){const t=console[s];return typeof t=="function"?t.bind(console):Lt}function Zi(s){if(s==="debug"&&(s="log"),typeof console>"u")return Lt;const e=console;return e[s]!==void 0?Xs(s):e.log!==void 0?Xs("log"):Lt}const Qi=s=>Zi(s);function it(s){let e=s;const t=q;if(typeof e=="string"&&t[e.toUpperCase()]!==void 0&&(e=t[e.toUpperCase()]),typeof e=="number"&&e>=0&&e<=q.SILENT)return e;throw new TypeError(`setLevel() called with an invalid level: ${String(s)}`)}let ue;const Et={};class Js{constructor(e,t){m(this,"name");m(this,"levels",q);m(this,"methodFactory");m(this,"trace");m(this,"debug");m(this,"info");m(this,"warn");m(this,"error");m(this,"log");m(this,"inheritedLevel");m(this,"defaultLevel",null);m(this,"userLevel",null);this.name=e,this.methodFactory=t,this.inheritedLevel=it(ue?ue.getLevel():"WARN");const o=this.getPersistedLevel();o!=null&&(this.userLevel=it(o)),this.replaceLoggingMethods()}storageKey(){return typeof this.name=="string"?`${Yi}:${this.name}`:void 0}persist(e){const t=this.storageKey();if(typeof window>"u"||!t)return;const o=(qs[e]??"silent").toUpperCase();try{window.localStorage[t]=o}catch{}}getPersistedLevel(){const e=this.storageKey();if(typeof window>"u"||!e)return;let t;try{t=window.localStorage[e]}catch{}if(!(t===void 0||q[t]===void 0))return t}clearPersisted(){const e=this.storageKey();if(!(typeof window>"u"||!e))try{window.localStorage.removeItem(e)}catch{}}replaceLoggingMethods(){const e=this.getLevel();qs.forEach((t,o)=>{this[t]=o<e?Lt:this.methodFactory(t,e,this.name)}),this.log=this.debug}getLevel(){return this.userLevel!=null?this.userLevel:this.defaultLevel!=null?this.defaultLevel:this.inheritedLevel}setLevel(e,t){this.userLevel=it(e),t!==!1&&this.persist(this.userLevel),this.replaceLoggingMethods()}setDefaultLevel(e){this.defaultLevel=it(e),this.getPersistedLevel()||this.setLevel(e,!1)}resetLevel(){this.userLevel=null,this.clearPersisted(),this.replaceLoggingMethods()}enableAll(e){this.setLevel(q.TRACE,e)}disableAll(e){this.setLevel(q.SILENT,e)}rebuild(){if(ue&&ue!==this&&(this.inheritedLevel=it(ue.getLevel())),this.replaceLoggingMethods(),ue===this)for(const e in Et)Et[e].rebuild()}}ue=new Js(void 0,Qi);function er(s){if(typeof s!="string"||s==="")throw new TypeError("You must supply a non-empty name when creating a logger.");let e=Et[s];return e||(e=Et[s]=new Js(s,ue.methodFactory)),e}const tr=["INIT","DATA","UI"],sr="debug",Ys=["#4c8bf5","#2ea043","#d29922","#a371f7","#db61a2","#e5534b","#3fb0ac","#8a6d3b"],Zs=new WeakSet;function or(s,e,t){if(Zs.has(s))return;Zs.add(s);const o=s.methodFactory,i=`color:${t};font-weight:bold`;s.methodFactory=(r,n,a)=>{const l=o(r,n,a);return(...c)=>l(`%c[${e}]`,i,...c)},s.setLevel(s.getLevel(),!1)}function ir(s){return typeof s=="number"?s:q[s.toUpperCase()]??q.SILENT}const rr=[["trace",q.TRACE,"debug"],["debug",q.DEBUG,"debug"],["info",q.INFO,"info"],["warn",q.WARN,"warn"],["error",q.ERROR,"error"]];function nr(s,e,t){const o=`color:${s.color};font-weight:bold`,i="color:#888",r={};for(const[n,a,l]of rr)r[n]=(...c)=>{const d=t(),u=Math.min(s.logger.getLevel(),d==null?q.SILENT:ir(d));if(a<u)return;(console[l]??console.log).bind(console)(`%c[${s.label}]%c ${e}`,o,i,...c)};return r}function ar(s,e=tr){const t={},o={};e.forEach((r,n)=>{const a=`${s}:${r}`,l=Ys[n%Ys.length],c=er(a);or(c,a,l),t[r]=c,o[r]={label:a,color:l,logger:c}});const i=r=>{for(const n of e)t[n].setLevel(r,!1)};return{loggers:t,LOGGING_CATEGORIES:e,enableLogging(r=sr){i(r)},disableLogging(){i("silent")},setLogLevel(r){i(r)},setCategoryLevel(r,n){var a;(a=t[r])==null||a.setLevel(n,!1)},forInstance(r,n){const a={};for(const l of e)a[l]=nr(o[l],r,n);return a}}}const me=Math.min,ie=Math.max,At=Math.round,Nt=Math.floor,re=s=>({x:s,y:s}),lr={left:"right",right:"left",bottom:"top",top:"bottom"};function Qs(s,e,t){return ie(s,me(e,t))}function ze(s,e){return typeof s=="function"?s(e):s}function _e(s){return s.split("-")[0]}function $e(s){return s.split("-")[1]}function eo(s){return s==="x"?"y":"x"}function es(s){return s==="y"?"height":"width"}function ne(s){const e=s[0];return e==="t"||e==="b"?"y":"x"}function ts(s){return eo(ne(s))}function cr(s,e,t){t===void 0&&(t=!1);const o=$e(s),i=ts(s),r=es(i);let n=i==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(n=zt(n)),[n,zt(n)]}function dr(s){const e=zt(s);return[ss(s),e,ss(e)]}function ss(s){return s.includes("start")?s.replace("start","end"):s.replace("end","start")}const to=["left","right"],so=["right","left"],hr=["top","bottom"],ur=["bottom","top"];function mr(s,e,t){switch(s){case"top":case"bottom":return t?e?so:to:e?to:so;case"left":case"right":return e?hr:ur;default:return[]}}function pr(s,e,t,o){const i=$e(s);let r=mr(_e(s),t==="start",o);return i&&(r=r.map(n=>n+"-"+i),e&&(r=r.concat(r.map(ss)))),r}function zt(s){const e=_e(s);return lr[e]+s.slice(e.length)}function fr(s){var e,t,o,i;return{top:(e=s.top)!=null?e:0,right:(t=s.right)!=null?t:0,bottom:(o=s.bottom)!=null?o:0,left:(i=s.left)!=null?i:0}}function oo(s){return typeof s!="number"?fr(s):{top:s,right:s,bottom:s,left:s}}function $t(s){const{x:e,y:t,width:o,height:i}=s;return{width:o,height:i,top:t,left:e,right:e+o,bottom:t+i,x:e,y:t}}function io(s,e,t){let{reference:o,floating:i}=s;const r=ne(e),n=ts(e),a=es(n),l=_e(e),c=r==="y",d=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2;let p;switch(l){case"top":p={x:d,y:o.y-i.height};break;case"bottom":p={x:d,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:u};break;case"left":p={x:o.x-i.width,y:u};break;default:p={x:o.x,y:o.y}}const g=$e(e);return g&&(p[n]+=f*(g==="end"?1:-1)*(t&&c?-1:1)),p}async function gr(s,e){var t;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:n,elements:a,strategy:l}=s,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=ze(e,s),g=oo(p),_=a[f?u==="floating"?"reference":"floating":u],v=$t(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(_)))==null||t?_:_.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),x=u==="floating"?{x:o,y:i,width:n.floating.width,height:n.floating.height}:n.reference,C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),P=await(r.isElement==null?void 0:r.isElement(C))&&await(r.getScale==null?void 0:r.getScale(C))||{x:1,y:1},D=$t(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:C,strategy:l}):x);return{top:(v.top-D.top+g.top)/P.y,bottom:(D.bottom-v.bottom+g.bottom)/P.y,left:(v.left-D.left+g.left)/P.x,right:(D.right-v.right+g.right)/P.x}}const br=50,vr=async(s,e,t)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:n}=t,a=n.detectOverflow?n:{...n,detectOverflow:gr},l=await(n.isRTL==null?void 0:n.isRTL(e));let c=await n.getElementRects({reference:s,floating:e,strategy:i}),{x:d,y:u}=io(c,o,l),f=o,p=0;const g={};for(let w=0;w<r.length;w++){const _=r[w];if(!_)continue;const{name:v,fn:x}=_,{x:C,y:P,data:D,reset:F}=await x({x:d,y:u,initialPlacement:o,placement:f,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:s,floating:e}});d=C??d,u=P??u,g[v]={...g[v],...D},F&&p<br&&(p++,typeof F=="object"&&(F.placement&&(f=F.placement),F.rects&&(c=F.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:i}):F.rects),{x:d,y:u}=io(c,f,l)),w=-1)}return{x:d,y:u,placement:f,strategy:i,middlewareData:g}},wr=s=>({name:"arrow",options:s,async fn(e){const{x:t,y:o,placement:i,rects:r,platform:n,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=ze(s,e)||{};if(c==null)return{};const u=oo(d),f={x:t,y:o},p=ts(i),g=es(p),w=await n.getDimensions(c),_=p==="y",v=_?"top":"left",x=_?"bottom":"right",C=_?"clientHeight":"clientWidth",P=r.reference[g]+r.reference[p]-f[p]-r.floating[g],D=f[p]-r.reference[p],F=await(n.getOffsetParent==null?void 0:n.getOffsetParent(c));let U=F?F[C]:0;(!U||!await(n.isElement==null?void 0:n.isElement(F)))&&(U=a.floating[C]||r.floating[g]);const J=P/2-D/2,B=U/2-w[g]/2-1,I=me(u[v],B),A=me(u[x],B),$=U-w[g]-A,K=U/2-w[g]/2+J,O=Qs(I,K,$),j=!l.arrow&&$e(i)!=null&&K!==O&&r.reference[g]/2-(K<I?I:A)-w[g]/2<0,de=j?K<I?K-I:K-$:0;return{[p]:f[p]+de,data:{[p]:O,centerOffset:K-O-de,...j&&{alignmentOffset:de}},reset:j}}}),yr=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,o;const{placement:i,middlewareData:r,rects:n,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,..._}=ze(s,e);if((t=r.arrow)!=null&&t.alignmentOffset)return{};const v=_e(i),x=ne(a),C=_e(a)===a,P=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=f||(C||!w?[zt(a)]:dr(a)),F=g!=="none";!f&&F&&D.push(...pr(a,w,g,P));const U=[a,...D],J=await l.detectOverflow(e,_),B=[];let I=((o=r.flip)==null?void 0:o.overflows)||[];if(d&&B.push(J[v]),u){const O=cr(i,n,P);B.push(J[O[0]],J[O[1]])}if(I=[...I,{placement:i,overflows:B}],!B.every(O=>O<=0)){var A,$;const O=(((A=r.flip)==null?void 0:A.index)||0)+1,j=U[O];if(j&&(!(u==="alignment"?x!==ne(j):!1)||I.every(Q=>ne(Q.placement)===x?Q.overflows[0]>0:!0)))return{data:{index:O,overflows:I},reset:{placement:j}};let de=($=I.filter(Ae=>Ae.overflows[0]<=0).sort((Ae,Q)=>Ae.overflows[1]-Q.overflows[1])[0])==null?void 0:$.placement;if(!de)switch(p){case"bestFit":{var K;const Ae=(K=I.filter(Q=>{if(F){const ye=ne(Q.placement);return ye===x||ye==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(ye=>ye>0).reduce((ye,In)=>ye+In,0)]).sort((Q,ye)=>Q[1]-ye[1])[0])==null?void 0:K[0];Ae&&(de=Ae);break}case"initialPlacement":de=a;break}if(i!==de)return{reset:{placement:de}}}return{}}}},xr=new Set(["left","top"]);async function _r(s,e){const{placement:t,platform:o,elements:i}=s,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),n=_e(t),a=$e(t),l=ne(t)==="y",c=xr.has(n)?-1:1,d=r&&l?-1:1,u=ze(e,s);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}const kr=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,o;const{x:i,y:r,placement:n,middlewareData:a}=e,l=await _r(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:n}}}}},Cr=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(e){const{x:t,y:o,placement:i,platform:r}=e,{mainAxis:n=!0,crossAxis:a=!1,limiter:l={fn:x=>{let{x:C,y:P}=x;return{x:C,y:P}}},...c}=ze(s,e),d={x:t,y:o},u=await r.detectOverflow(e,c),f=ne(i),p=eo(f);let g=d[p],w=d[f];const _=(x,C)=>Qs(C+u[x==="y"?"top":"left"],C,C-u[x==="y"?"bottom":"right"]);n&&(g=_(p,g)),a&&(w=_(f,w));const v=l.fn({...e,[p]:g,[f]:w});return{...v,data:{x:v.x-t,y:v.y-o,enabled:{[p]:n,[f]:a}}}}}},Sr=function(s){return s===void 0&&(s={}),{name:"size",options:s,async fn(e){const{placement:t,rects:o,platform:i,elements:r}=e,{apply:n=()=>{},...a}=ze(s,e),l=await i.detectOverflow(e,a),c=_e(t),d=$e(t),u=ne(t)==="y",{width:f,height:p}=o.floating;let g,w;c==="top"||c==="bottom"?(g=c,w=d===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(w=c,g=d==="end"?"top":"bottom");const _=p-l.top-l.bottom,v=f-l.left-l.right,x=me(p-l[g],_),C=me(f-l[w],v),P=e.middlewareData.shift,D=!P;let F=x,U=C;P!=null&&P.enabled.x&&(U=v),P!=null&&P.enabled.y&&(F=_),D&&!d&&(u?U=f-2*ie(l.left,l.right):F=p-2*ie(l.top,l.bottom)),await n({...e,availableWidth:U,availableHeight:F});const J=await i.getDimensions(r.floating);return f!==J.width||p!==J.height?{reset:{rects:!0}}:{}}}};function Vt(){return typeof window<"u"}function Ve(s){return ro(s)?(s.nodeName||"").toLowerCase():"#document"}function X(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function ae(s){var e;return(e=(ro(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function ro(s){return Vt()?s instanceof Node||s instanceof X(s).Node:!1}function te(s){return Vt()?s instanceof Element||s instanceof X(s).Element:!1}function pe(s){return Vt()?s instanceof HTMLElement||s instanceof X(s).HTMLElement:!1}function no(s){return!Vt()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof X(s).ShadowRoot}function Dt(s){const{overflow:e,overflowX:t,overflowY:o,display:i}=se(s);return/auto|scroll|overlay|hidden|clip/.test(e+o+t)&&i!=="inline"&&i!=="contents"}function Tr(s){return/^(table|td|th)$/.test(Ve(s))}function Rt(s){try{if(s.matches(":popover-open"))return!0}catch{}try{return s.matches(":modal")}catch{return!1}}const Ir=/transform|translate|scale|rotate|perspective|filter/,Or=/paint|layout|strict|content/,ke=s=>!!s&&s!=="none";let os;function is(s){const e=te(s)?se(s):s;return ke(e.transform)||ke(e.translate)||ke(e.scale)||ke(e.rotate)||ke(e.perspective)||!rs()&&(ke(e.backdropFilter)||ke(e.filter))||Ir.test(e.willChange||"")||Or.test(e.contain||"")}function Mr(s){let e=Ce(s);for(;pe(e)&&!rt(e);){if(is(e))return e;if(Rt(e))return null;e=Ce(e)}return null}function rs(){return os==null&&(os=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),os}function rt(s){return/^(html|body|#document)$/.test(Ve(s))}function se(s){return X(s).getComputedStyle(s)}function Bt(s){return te(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function Ce(s){if(Ve(s)==="html")return s;const e=s.assignedSlot||s.parentNode||no(s)&&s.host||ae(s);return no(e)?e.host:e}function ao(s){const e=Ce(s);return rt(e)?(s.ownerDocument||s).body:pe(e)&&Dt(e)?e:ao(e)}function nt(s,e,t){var o;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=ao(s),r=i===((o=s.ownerDocument)==null?void 0:o.body),n=X(i);if(r){const a=ns(n);return e.concat(n,n.visualViewport||[],Dt(i)?i:[],a&&t?nt(a):[])}else return e.concat(i,nt(i,[],t))}function ns(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function lo(s){const e=se(s);let t=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=pe(s),r=i?s.offsetWidth:t,n=i?s.offsetHeight:o,a=At(t)!==r||At(o)!==n;return a&&(t=r,o=n),{width:t,height:o,$:a}}function as(s){return te(s)?s:s.contextElement}function De(s){const e=as(s);if(!pe(e))return re(1);const t=e.getBoundingClientRect(),{width:o,height:i,$:r}=lo(e);let n=(r?At(t.width):t.width)/o,a=(r?At(t.height):t.height)/i;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Pr=re(0);function co(s){const e=X(s);return!rs()||!e.visualViewport?Pr:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Lr(s,e,t){return e===void 0&&(e=!1),!!t&&e&&t===X(s)}function Se(s,e,t,o){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=as(s);let n=re(1);e&&(o?te(o)&&(n=De(o)):n=De(s));const a=Lr(r,t,o)?co(r):re(0);let l=(i.left+a.x)/n.x,c=(i.top+a.y)/n.y,d=i.width/n.x,u=i.height/n.y;if(r&&o){const f=X(r),p=te(o)?X(o):o;let g=f,w=ns(g);for(;w&&p!==g;){const _=De(w),v=w.getBoundingClientRect(),x=se(w),C=v.left+(w.clientLeft+parseFloat(x.paddingLeft))*_.x,P=v.top+(w.clientTop+parseFloat(x.paddingTop))*_.y;l*=_.x,c*=_.y,d*=_.x,u*=_.y,l+=C,c+=P,g=X(w),w=ns(g)}}return $t({width:d,height:u,x:l,y:c})}function Ht(s,e){const t=Bt(s).scrollLeft;return e?e.left+t:Se(ae(s)).left+t}function ho(s,e){const t=s.getBoundingClientRect(),o=t.left+e.scrollLeft-Ht(s,t),i=t.top+e.scrollTop;return{x:o,y:i}}function Er(s){let{elements:e,rect:t,offsetParent:o,strategy:i}=s;const r=i==="fixed",n=ae(o),a=e?Rt(e.floating):!1;if(o===n||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=re(1);const d=re(0),u=pe(o);if((u||!r)&&((Ve(o)!=="body"||Dt(n))&&(l=Bt(o)),u)){const p=Se(o);c=De(o),d.x=p.x+o.clientLeft,d.y=p.y+o.clientTop}const f=n&&!u&&!r?ho(n,l):re(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:t.y*c.y-l.scrollTop*c.y+d.y+f.y}}function Ar(s){return s.getClientRects?Array.from(s.getClientRects()):[]}function Nr(s){const e=Bt(s),t=s.ownerDocument.body,o=ie(s.scrollWidth,s.clientWidth,t.scrollWidth,t.clientWidth),i=ie(s.scrollHeight,s.clientHeight,t.scrollHeight,t.clientHeight);let r=-e.scrollLeft+Ht(s);const n=-e.scrollTop;return se(t).direction==="rtl"&&(r+=ie(s.clientWidth,t.clientWidth)-o),{width:o,height:i,x:r,y:n}}const zr=25;function $r(s,e,t){t===void 0&&(t="viewport");const o=t==="layoutViewport",i=X(s),r=ae(s),n=i.visualViewport;let a=r.clientWidth,l=r.clientHeight,c=0,d=0;if(n){const f=!rs()||e==="fixed";o?f||(c=-n.offsetLeft,d=-n.offsetTop):(a=n.width,l=n.height,f&&(c=n.offsetLeft,d=n.offsetTop))}if(Ht(r)<=0){const f=r.ownerDocument,p=f.body,g=getComputedStyle(p),w=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,_=Math.abs(r.clientWidth-p.clientWidth-w),v=getComputedStyle(r).scrollbarGutter==="stable both-edges"?_/2:_;v<=zr&&(a-=v)}return{width:a,height:l,x:c,y:d}}function Vr(s,e){const t=Se(s,!0,e==="fixed"),o=t.top+s.clientTop,i=t.left+s.clientLeft,r=De(s),n=s.clientWidth*r.x,a=s.clientHeight*r.y,l=i*r.x,c=o*r.y;return{width:n,height:a,x:l,y:c}}function uo(s,e,t){let o;if(e==="viewport"||e==="layoutViewport")o=$r(s,t,e);else if(e==="document")o=Nr(ae(s));else if(te(e))o=Vr(e,t);else{const i=co(s);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return $t(o)}function Dr(s,e){const t=e.get(s);if(t)return t;let o=nt(s,[],!1).filter(a=>te(a)&&Ve(a)!=="body"),i=null;const r=se(s).position==="fixed";let n=r?Ce(s):s;for(;te(n)&&!rt(n);){const a=se(n),l=is(n),c=i?i.position:r?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?o=o.filter(u=>u!==n):i=a,n=Ce(n)}return e.set(s,o),o}function Rr(s){let{element:e,boundary:t,rootBoundary:o,strategy:i}=s;const n=[...t==="clippingAncestors"?Rt(e)?[]:Dr(e,this._c):[].concat(t),o],a=uo(e,n[0],i);let l=a.top,c=a.right,d=a.bottom,u=a.left;for(let f=1;f<n.length;f++){const p=uo(e,n[f],i);l=ie(p.top,l),c=me(p.right,c),d=me(p.bottom,d),u=ie(p.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function Br(s){const{width:e,height:t}=lo(s);return{width:e,height:t}}function Hr(s,e,t){const o=pe(e),i=ae(e),r=t==="fixed",n=Se(s,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=re(0);if((o||!r)&&((Ve(e)!=="body"||Dt(i))&&(a=Bt(e)),o)){const f=Se(e,!0,r,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}!o&&i&&(l.x=Ht(i));const c=i&&!o&&!r?ho(i,a):re(0),d=n.left+a.scrollLeft-l.x-c.x,u=n.top+a.scrollTop-l.y-c.y;return{x:d,y:u,width:n.width,height:n.height}}function ls(s){return se(s).position==="static"}function mo(s,e){if(!pe(s)||se(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return ae(s)===t&&(t=t.ownerDocument.body),t}function po(s,e){const t=X(s);if(Rt(s))return t;if(!pe(s)){let i=Ce(s);for(;i&&!rt(i);){if(te(i)&&!ls(i))return i;i=Ce(i)}return t}let o=mo(s,e);for(;o&&Tr(o)&&ls(o);)o=mo(o,e);return o&&rt(o)&&ls(o)&&!is(o)?t:o||Mr(s)||t}const Fr=async function(s){const e=this.getOffsetParent||po,t=this.getDimensions,o=await t(s.floating);return{reference:Hr(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Kr(s){return se(s).direction==="rtl"}const fo={convertOffsetParentRelativeRectToViewportRelativeRect:Er,getDocumentElement:ae,getClippingRect:Rr,getOffsetParent:po,getElementRects:Fr,getClientRects:Ar,getDimensions:Br,getScale:De,isElement:te,isRTL:Kr};function go(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function Wr(s,e,t){let o=null,i;const r=ae(s);function n(){var d;clearTimeout(i),(d=o)==null||d.disconnect(),o=null}function a(d,u){d===void 0&&(d=!1),u===void 0&&(u=1),n();const f=s.getBoundingClientRect(),{left:p,top:g,width:w,height:_}=f;if(d||e(),!w||!_)return;const v=Nt(g),x=Nt(r.clientWidth-(p+w)),C=Nt(r.clientHeight-(g+_)),P=Nt(p),F={rootMargin:-v+"px "+-x+"px "+-C+"px "+-P+"px",threshold:ie(0,me(1,u))||1};let U=!0;function J(B){const I=B[0].intersectionRatio;if(!go(f,s.getBoundingClientRect()))return a();if(I!==u){if(!U)return a();I?a(!1,I):i=setTimeout(()=>{a(!1,1e-7)},1e3)}U=!1}try{o=new IntersectionObserver(J,{...F,root:r.ownerDocument})}catch{o=new IntersectionObserver(J,F)}o.observe(s)}const l=X(s),c=()=>a(t);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),n()}}function jr(s,e,t,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,c=as(s),d=i||r?[...c?nt(c):[],...e?nt(e):[]]:[];d.forEach(v=>{i&&v.addEventListener("scroll",t),r&&v.addEventListener("resize",t)});const u=c&&a?Wr(c,t,r):null;let f=-1,p=null;n&&(p=new ResizeObserver(v=>{let[x]=v;x&&x.target===c&&p&&e&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(e)})),t()}),c&&!l&&p.observe(c),e&&p.observe(e));let g,w=l?Se(s):null;l&&_();function _(){const v=Se(s);w&&!go(w,v)&&t(),w=v,g=requestAnimationFrame(_)}return t(),()=>{var v;d.forEach(x=>{i&&x.removeEventListener("scroll",t),r&&x.removeEventListener("resize",t)}),u==null||u(),(v=p)==null||v.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Gr=kr,Ur=Cr,qr=yr,cs=Sr,Xr=wr,Jr=(s,e,t)=>{const o=new Map,i=t??{},r={...fo,...i.platform,_c:o};return vr(s,e,{...i,platform:r})};function ds(s){const e=s.parentNode??null;return e instanceof ShadowRoot?e.host:e}function Yr(s){if(s.transform!=="none"||s.perspective!=="none"||s.filter!=="none")return!0;const e=s.backdropFilter;return!!(e&&e!=="none"||s.willChange&&/\b(transform|filter|perspective)\b/.test(s.willChange))}function hs(s){let e=ds(s);for(;e&&!(e===document.body||e===document.documentElement);){if(e instanceof Element&&Yr(getComputedStyle(e)))return e;e=ds(e)}return window}function Zr(s,e,t){let o=s;for(;o&&!(o===document.body||o===document.documentElement);){if(o instanceof Element){const i=o.getBoundingClientRect();if(Math.abs(i.x-e)<2&&Math.abs(i.y-t)<2)return o}o=ds(o)}return null}function bo(s){const e=getComputedStyle(s),t=[];e.transform!=="none"&&t.push(`transform: ${e.transform}`),e.perspective!=="none"&&t.push(`perspective: ${e.perspective}`),e.filter!=="none"&&t.push(`filter: ${e.filter}`);const o=e.backdropFilter;o&&o!=="none"&&t.push(`backdrop-filter: ${o}`),e.willChange&&/\b(transform|filter|perspective)\b/.test(e.willChange)&&t.push(`will-change: ${e.willChange}`),e.contain&&/\b(paint|layout|strict|content)\b/.test(e.contain)&&t.push(`contain: ${e.contain}`);const i=e.containerType;return i&&i!=="normal"&&t.push(`container-type: ${i}`),t.join("; ")}function Qr(s){const e=s.id?`#${s.id}`:"",t=typeof s.className=="string"&&s.className?"."+s.className.split(/\s+/).filter(Boolean).slice(0,2).join("."):"";return`<${s.tagName.toLowerCase()}${e}${t}>`}function en(s){const e=s.tolerance??1.5;let t=0,o=0;if(s.offsetParent instanceof Element){const l=s.offsetParent.getBoundingClientRect(),c=getComputedStyle(s.offsetParent);t=l.x+(parseFloat(c.borderLeftWidth)||0),o=l.y+(parseFloat(c.borderTopWidth)||0)}const i=s.panel.getBoundingClientRect(),r=i.x-(t+s.expectedX),n=i.y-(o+s.expectedY);if(Math.abs(r)<e&&Math.abs(n)<e)return null;const a=Zr(s.reference,r,n);return{driftX:r,driftY:n,culprit:a,culpritDescription:a?Qr(a):"an ancestor element (could not auto-identify)",culpritCss:a?bo(a):""}}function tn(s,e){var i;const t=(i=s.closest)==null?void 0:i.call(s,"[data-theme]"),o=t==null?void 0:t.getAttribute("data-theme");o!=null&&e.setAttribute("data-theme",o)}const sn={top:"bottom",right:"left",bottom:"top",left:"right"};function on(s,e,t){if(!t)return;const o=e.split("-")[0],i=sn[o];s.style.left=t.x!=null?`${t.x}px`:"",s.style.top=t.y!=null?`${t.y}px`:"",s.style.right="",s.style.bottom="",s.style[i]=`-${s.offsetWidth/2}px`}function vo(s,e){const t=[Gr(s.offset??4)];if(s.matchWidth){const i=s.matchWidth;t.push(cs({apply({rects:r,elements:n}){const a=`${r.reference.width}px`;i==="exact"?n.floating.style.width=a:n.floating.style.minWidth=a}}))}e&&t.push(qr({...s.lockPlacement===!0?{fallbackStrategy:"initialPlacement"}:{},...s.flipPadding!=null?{padding:s.flipPadding}:{}}));const o=s.shift??8;if(o!==!1&&t.push(Ur({padding:o})),s.maxHeight){const i=typeof s.maxHeight=="object"?s.maxHeight.padding:void 0;t.push(cs({padding:i,apply({availableHeight:r,elements:n}){n.floating.style.maxHeight=`${Math.max(0,r)}px`}}))}if(s.maxWidth){const i=typeof s.maxWidth=="object"?s.maxWidth.padding:void 0;t.push(cs({padding:i,apply({availableWidth:r,elements:n}){n.floating.style.maxWidth=`${Math.max(0,r)}px`}}))}return s.arrow&&t.push(Xr({element:s.arrow.element,padding:s.arrow.padding})),t}function at(s,e,t={}){const o=t.strategy??"fixed";t.inheritThemeFrom&&tn(t.inheritThemeFrom,s),s.style.position=o,s.style.left="0",s.style.top="0";let i=t.placement??"bottom-start",r=t.flip??!0,n=vo(t,r);const a=t.lockPlacement==="freeze";let l=!1;const c=!!t.fixedContainingBlock&&!t.platform,d=t.platform??(c?{...fo,getOffsetParent:()=>hs(s)}:void 0),u=()=>{var p;(p=t.beforeCompute)==null||p.call(t),Jr(e,s,{placement:i,strategy:o,middleware:n,...d?{platform:d}:{}}).then(({x:g,y:w,placement:_,middlewareData:v})=>{var x,C;if(s.style.left=`${g}px`,s.style.top=`${w}px`,t.arrow&&on(t.arrow.element,_,v.arrow),a&&!l&&(l=!0,i=_,r=!1,n=vo(t,!1)),(x=t.onPlaced)==null||x.call(t,_),(C=t.onComputed)==null||C.call(t,{x:g,y:w,placement:_}),t.onDrift&&e instanceof Element){const P=c?hs(s):window,D=en({panel:s,reference:e,expectedX:g,expectedY:w,offsetParent:P});D&&t.onDrift(D)}})};let f;return t.autoUpdate??!0?f=jr(e,s,u,t.autoUpdateOptions):u(),{update:u,destroy(){f==null||f(),f=void 0}}}function rn(s){return typeof s=="number"?{show:s,hide:s}:{show:(s==null?void 0:s.show)??0,hide:(s==null?void 0:s.hide)??0}}function nn(s){const e=s.container??document.body,t=s.placement??"top",o=s.visibleClass??"is-visible",i=rn(s.delay),r=document.createElement("div");r.setAttribute("role","tooltip"),s.cssClass&&(r.className=s.cssClass),typeof s.content=="string"?r.textContent=s.content:r.append(s.content);let n,a=!1,l,c,d;const u={getBoundingClientRect:()=>d??s.trigger.getBoundingClientRect(),contextElement:s.trigger},f=x=>{d=new DOMRect(x.clientX,x.clientY,0,0),n==null||n.update()},p=()=>{l&&clearTimeout(l),c&&clearTimeout(c),l=c=void 0},g=()=>{var C;if(p(),a)return;(C=s.onBeforeShow)==null||C.call(s),a=!0,e.append(r);const x=s.followCursor?u:s.trigger;n=at(r,x,{placement:t,strategy:s.strategy,offset:s.offset??8,inheritThemeFrom:s.inheritThemeFrom??s.trigger}),s.followCursor&&s.trigger.addEventListener("mousemove",f),r.classList.add(o)},w=()=>{p(),a&&(a=!1,r.classList.remove(o),s.followCursor&&s.trigger.removeEventListener("mousemove",f),n==null||n.destroy(),n=void 0,r.remove())},_=()=>{p(),i.show>0?l=setTimeout(g,i.show):g()},v=()=>{p(),i.hide>0?c=setTimeout(w,i.hide):w()};return s.trigger.addEventListener("mouseenter",_),s.trigger.addEventListener("mouseleave",v),s.trigger.addEventListener("focusin",_),s.trigger.addEventListener("focusout",v),{element:r,get isVisible(){return a},show:g,hide:w,destroy(){s.trigger.removeEventListener("mouseenter",_),s.trigger.removeEventListener("mouseleave",v),s.trigger.removeEventListener("focusin",_),s.trigger.removeEventListener("focusout",v),w()}}}function an(s){const e=s.container??document.body;let t,o=!1;const i=s.inheritThemeFrom??(s.reference instanceof HTMLElement?s.reference:void 0);return{get isOpen(){return o},open(){o||(o=!0,e.append(s.panel),t=at(s.panel,s.reference,{placement:s.placement??"bottom-start",strategy:s.strategy,offset:s.offset,matchWidth:s.matchWidth,lockPlacement:s.lockPlacement,...s.flip!==void 0?{flip:s.flip}:{},...s.shift!==void 0?{shift:s.shift}:{},...s.autoUpdate!==void 0?{autoUpdate:s.autoUpdate}:{},...s.beforeCompute?{beforeCompute:s.beforeCompute}:{},...s.platform?{platform:s.platform}:{},...i?{inheritThemeFrom:i}:{},...s.onPlaced?{onPlaced:s.onPlaced}:{}}))},close(){o&&(o=!1,t==null||t.destroy(),t=void 0,s.panel.remove())},update(){t==null||t.update()},destroy(){this.close()}}}const wo=["INIT","DATA","UI","INTERACTION"],le=ar("MULTISELECT",wo),lt=le.loggers.INIT,G=le.loggers.DATA,Y=le.loggers.UI,H=le.loggers.INTERACTION,ln=wo.map(s=>`MULTISELECT:${s}`);function cn(){le.enableLogging()}function dn(){le.disableLogging()}function hn(s){le.setLogLevel(s)}function un(s,e){const t=s.includes(":")?s.split(":").pop():s;le.setCategoryLevel(t,e)}class yo{constructor(e){m(this,"container");m(this,"wrapper");m(this,"viewport");m(this,"itemHeight");m(this,"items");m(this,"renderItem");m(this,"bufferSize");m(this,"onVisibleRangeChange");m(this,"onScroll");m(this,"scrollTop",0);m(this,"viewportHeight",0);m(this,"visibleStart",0);m(this,"visibleEnd",0);m(this,"scrollHandler");m(this,"resizeObserver");this.container=e.container,this.itemHeight=e.itemHeight,this.items=e.items,this.renderItem=e.renderItem,this.bufferSize=e.bufferSize??10,this.onVisibleRangeChange=e.onVisibleRangeChange,this.onScroll=e.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 e=this.container.clientHeight;e>0&&(this.viewportHeight=e)}handleScroll(){this.scrollTop=this.container.scrollTop,this.onScroll&&this.onScroll(this.scrollTop),this.render()}calculateVisibleRange(){const e=Math.floor(this.scrollTop/this.itemHeight),t=Math.ceil((this.scrollTop+this.viewportHeight)/this.itemHeight),o=Math.max(0,e-this.bufferSize),i=Math.min(this.items.length,t+this.bufferSize);return{start:o,end:i}}render(){const{start:e,end:t}=this.calculateVisibleRange();if(e===this.visibleStart&&t===this.visibleEnd)return;this.visibleStart=e,this.visibleEnd=t;let o="";for(let i=e;i<t;i++){const r=this.items[i],n=this.renderItem(r,i),a=i*this.itemHeight;o+=`<div class="ms__virtual-item" style="position: absolute; top: ${a}px; left: 0; right: 0; height: ${this.itemHeight}px;" data-index="${i}">`,o+=n,o+="</div>"}this.viewport.innerHTML=o,this.onVisibleRangeChange&&this.onVisibleRangeChange(e,t)}setItems(e){const t=e!==this.items||e.length!==this.items.length;this.items=e,this.wrapper.style.height=`${e.length*this.itemHeight}px`,this.updateViewportHeight(),t&&(this.scrollTop=0,this.container.scrollTop=0),this.visibleStart=-1,this.visibleEnd=-1,this.render()}scrollToIndex(e,t="start"){if(e<0||e>=this.items.length)return;this.updateViewportHeight();const o=e*this.itemHeight,i=o+this.itemHeight,r=Math.max(0,this.items.length*this.itemHeight-this.viewportHeight);let n;if(t==="center")n=o-(this.viewportHeight-this.itemHeight)/2;else if(t==="nearest"){const a=this.container.scrollTop,l=a+this.viewportHeight;if(o>=a&&i<=l)return;n=o<a?o:i-this.viewportHeight}else n=o;n=Math.max(0,Math.min(n,r)),this.container.scrollTop=n,this.scrollTop=n,this.render()}getVisibleRange(){return{start:this.visibleStart,end:this.visibleEnd}}getItemCount(){return this.items.length}setItemHeight(e){this.itemHeight=e,this.wrapper.style.height=`${this.items.length*e}px`,this.visibleStart=-1,this.visibleEnd=-1,this.render()}setBufferSize(e){this.bufferSize=e,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=""}}function xo(s){return{treeId:"",id:-1,path:"",pathSegment:"",parentPath:void 0,level:void 0,children:{},hasChildren:!1,isSelectable:!0,data:void 0,...s}}const ct=s=>!s||typeof s=="string"&&s.trim()==="";function mn(s,e="."){if(!s||typeof s!="string")return null;const t=s.lastIndexOf(e);return t===-1?"":s.substring(0,t)}function _o(s,e,t="."){return ct(e)?s:s.startsWith(e+t)?s.substring(e.length+t.length):s}function ko(s,e=0,t=1,o="."){return s.split(o).slice(e,e+t).join(o)}function pn(s,e){return s.split(e).length}function fe(s,e){return s[e]}function fn(s={}){const e=s.idMember,t=s.pathMember,o=s.getPathCallback,i=s.parentPathMember,r=s.levelMember,n=s.hasChildrenMember,a=s.isSelectableMember,l=s.getIsSelectableCallback,c=s.treeId||"multiselect-tree",d=s.orderMember,u=s.getDisplayValueCallback,f=ct(i),p=ct(r),g=ct(n),w=ct(a),_="x",v=s.treePathSeparator||".",x=xo();let C=0,P=null;const D=B=>o?o(B):t?fe(B,t):void 0,F={treePathSeparator:v,root:x,get tree(){return Object.values(x.children)},get flatNodes(){if(P)return P;const B=[],I=s.isSorted??!1,A=s.sortCallback;function $(K){let O=Object.values(K.children);I&&A&&O.length>0&&(O=A(O));for(const j of O)B.push(j),j.hasChildren&&$(j)}return $(x),P=B,B},insertArray(B){B=B||[],x.children={},C=0,P=null;const I=[];let A=B.map(($,K)=>{const O=xo();O.treeId=c,O.id=e?fe($,e):void 0;const j=D($);return j==null||j===""||typeof j!="string"?(I.push(`index ${K}`),null):(O.path=j,(O.id===void 0||O.id===-1)&&(O.id=j),f?O.parentPath=mn(O.path,v):O.parentPath=fe($,i),O.pathSegment=ko(_o(O.path,O.parentPath??"",v),0,1,v),p?O.level=pn(O.path,v):O.level=fe($,r),g||(O.hasChildren=fe($,n)),O.data=$,O)}).filter($=>$!==null);s.isSorted||(s.sortCallback?A=s.sortCallback(A):A=J(A));for(const $ of A)U($.parentPath??"",$);if(l||!w)for(const $ of A)if(l)$.isSelectable=l($)!==!1;else{const K=fe($.data,a);$.isSelectable=K==null?!0:!!K}I.length>0&&console.warn(`[ltree ${c}] ${I.length} option(s) had an invalid path and were skipped (pathMember="${t}"). Offending: ${I.slice(0,5).join(", ")}`+(I.length>5?", …":""))},getNodeByPath(B,I){let A=I||x;if(B){const $=B.split(v);for(let K=0;K<$.length;K++){const O=_+$[K];if(!A.children.hasOwnProperty(O))return null;A=A.children[O]}}return A}};function U(B,I){const A=F.getNodeByPath(B);if(!A)return`Node: ${I.path} - Could not find parent node: ${B}`;p&&(I.level=(A.level||0)+1);const $=_+ko(_o(I.path,B,v),0,1,v);return A.children.hasOwnProperty($)||(A.children[$]=I,g&&!A.hasChildren&&(A.hasChildren=!0),C=Math.max(C,I.level||0)),null}function J(B){return B.sort((I,A)=>{const $=I.level||0,K=A.level||0;if($!==K)return $-K;if(I.parentPath!==A.parentPath)return I.parentPath?A.parentPath?I.parentPath.localeCompare(A.parentPath):1:-1;if(d&&I.data&&A.data){const O=fe(I.data,d)??0,j=fe(A.data,d)??0;if(O!==j)return O-j}return u?u(I).localeCompare(u(A)):I.path.localeCompare(A.path)})}return F}function Co(s,e){const t=new Map,o=new Map,i=new Set,r=l=>String(e(l.data)),n=l=>{t.set(r(l),l);const c=[];for(const u of Object.values(l.children))c.push(...n(u));let d;return c.length>0?d=c:l.isSelectable!==!1?(d=[r(l)],i.add(l.path)):d=[],o.set(l.path,d),d},a=s.tree;for(const l of a)n(l);return{nodeByValue:t,atomsUnder:o,atomPaths:i,roots:a}}function us(s,e,t){const o=s.atomsUnder.get(e.path);if(!o||o.length===0)return"unchecked";let i=0;for(const r of o)t.has(r)&&i++;return i===0?"unchecked":i===o.length?"checked":"indeterminate"}function dt(s,e){const t=new Set;for(const o of e){const i=s.nodeByValue.get(String(o));if(i)for(const r of s.atomsUnder.get(i.path)??[])t.add(r)}return t}function gn(s,e,t){const o=s.atomsUnder.get(e.path)??[],i=new Set(t),r=us(s,e,t),n=[],a=[];if(r==="checked")for(const l of o)i.delete(l)&&a.push(l);else for(const l of o)i.has(l)||(i.add(l),n.push(l));return{checkedAtoms:i,addedAtoms:n,removedAtoms:a}}function ms(s,e,t,o){const i=a=>String(o(a.data)),r=[],n=a=>{const l=us(s,a,e);if(l==="unchecked")return;const c=a.isSelectable!==!1,d=Object.values(a.children);if(t==="leaves"){s.atomPaths.has(a.path)&&l==="checked"&&r.push(i(a));for(const u of d)n(u);return}if(t==="all"){l==="checked"&&c&&r.push(i(a));for(const u of d)n(u);return}if(l==="checked"&&c){r.push(i(a));return}for(const u of d)n(u)};for(const a of s.roots)n(a);return r}class So{constructor(e,t={}){m(this,"element");m(this,"instanceId");m(this,"options");N(this,V,!1);m(this,"selectedValues",new Set);m(this,"selectedOptions",new Map);m(this,"allOptions",[]);m(this,"filteredOptions",[]);m(this,"tree",null);m(this,"treeNodes",[]);m(this,"cascadeIndex",null);m(this,"cascadeCheckedAtoms",new Set);m(this,"hiddenInputs",[]);m(this,"focusedIndex",-1);m(this,"keyboardController",null);m(this,"matchingIndices",new Set);m(this,"searchTerm","");m(this,"addNewFocused",!1);m(this,"addNewPending",!1);m(this,"isLoading",!1);m(this,"searchDebounceTimer");m(this,"searchAbortController");m(this,"showSelectedPopover",!1);m(this,"selectedPopoverPlacement",null);m(this,"dropdownPlacement",null);m(this,"isRTL",!1);m(this,"effectiveBadgesPosition","bottom");m(this,"justClosedViaClick",!1);m(this,"justOpenedViaClick",!1);m(this,"positioningDriftWarned",!1);m(this,"fullscreenContainingBlockWarned",!1);m(this,"presentationMode","floating");m(this,"fullscreenHeader",null);m(this,"fullscreenSearchInput",null);m(this,"fullscreenSearchClear",null);m(this,"fullscreenModeToggle",null);m(this,"fullscreenNav",null);m(this,"fullscreenNavCount",null);m(this,"fullscreenNavPrev",null);m(this,"fullscreenNavNext",null);m(this,"bodyScrollUnlock",null);m(this,"overflowXClamp",null);m(this,"keyboardInsetCleanup",null);m(this,"overlayHistoryActive",!1);m(this,"onOverlayPopstate",()=>this.handleOverlayPopstate());m(this,"dropdownCleanup",null);m(this,"hintCleanup",null);m(this,"selectedPopoverCleanup",null);m(this,"tooltips",new Map);m(this,"labelRevealTrigger",null);m(this,"labelRevealPanel",null);m(this,"labelRevealPopover",null);m(this,"messageEl",null);m(this,"messageCleanup",null);m(this,"messageTimer",null);m(this,"onDropdownScroll",()=>{this.hideOptionTooltips(),this.hideLabelReveal()});m(this,"virtualScroll",null);m(this,"optionsContainer",null);m(this,"selectedPopoverVirtualScroll",null);m(this,"selectedPopoverContainer",null);m(this,"input");m(this,"inputWrapper");m(this,"dropdown");m(this,"dropdownInner");m(this,"badgesContainer");m(this,"counter");m(this,"clearButton");m(this,"hint");m(this,"selectedPopover");m(this,"documentKeydownHandler",null);m(this,"documentClickHandler",null);m(this,"overlayCoord",null);this.element=e,this.instanceId=`MS-${Math.random().toString(36).slice(2,11)}`,this.options={searchHint:e.dataset.searchHint||"",searchPlaceholder:e.dataset.searchPlaceholder||void 0,selectPlaceholder:e.dataset.selectPlaceholder||"Pick an option...",noDataPlaceholder:e.dataset.noDataPlaceholder||void 0,dropdownMinWidth:e.dataset.dropdownMinWidth||void 0,dropdownMaxWidth:e.dataset.dropdownMaxWidth||void 0,badgesDisplayMode:e.dataset.badgesDisplayMode||"badges",badgesPosition:e.dataset.badgesPosition||"bottom",badgesThresholdMode:e.dataset.badgesThresholdMode||"count",maxHeight:e.dataset.maxHeight||"20rem",emptyMessage:e.dataset.emptyMessage||"No results found",addNewText:e.dataset.addNewText||void 0,addNewPendingText:e.dataset.addNewPendingText||void 0,loadingMessage:e.dataset.loadingMessage||"Loading...",searchInputMode:e.dataset.searchInputMode||"normal",searchMode:e.dataset.searchMode||"filter",badgesThreshold:e.dataset.badgesThreshold?parseInt(e.dataset.badgesThreshold):void 0,minSearchLength:parseInt(e.dataset.minSearchLength||"0")||0,searchDebounce:parseInt(e.dataset.searchDebounce||"0")||0,isMultipleEnabled:e.dataset.multiple!=="false",isGroupsAllowed:e.dataset.allowGroups!=="false",isCheckboxesShown:e.dataset.showCheckboxes!=="false",isActionsSticky:e.dataset.stickyActions!=="false",isCloseOnSelect:e.dataset.closeOnSelect==="true",isPlacementLocked:e.dataset.lockPlacement!=="false",isSearchEnabled:e.dataset.enableSearch!=="false",isAddNewAllowed:e.dataset.allowAddNew==="true",isCounterShown:e.dataset.showCounter==="true",isSelectedPopoverEnabled:e.dataset.enableSelectedPopover!=="false",isSearchModeToggleShown:e.dataset.showSearchModeToggle==="true",isKeepOptionsOnSearch:e.dataset.keepOptionsOnSearch!=="false",shouldKeepSearchOnClose:e.dataset.keepSearchOnClose!=="false",options:[],container:void 0,...t},this.init()}extractField(e,t){if(Array.isArray(e)&&e.length===2){if(t.tupleSkip)return typeof t.fallback=="function"?t.fallback():t.fallback;if(t.tupleIndex!==void 0){const i=e[t.tupleIndex];return t.transform?t.transform(i):i}}if(t.member&&e[t.member]!==void 0){const i=e[t.member];return t.transform?t.transform(i):i}return t.callback?t.callback(e):typeof t.fallback=="function"?t.fallback():t.fallback}getItemValue(e){return this.extractField(e,{tupleIndex:0,member:this.options.valueMember,callback:this.options.getValueCallback,fallback:"[N/A]"})}getItemDisplayValue(e){return this.extractField(e,{tupleIndex:1,member:this.options.displayValueMember,callback:this.options.getDisplayValueCallback,transform:String,fallback:"[N/A]"})}getItemBadgeDisplayValue(e,t){if(this.options.getBadgeDisplayCallback)return this.options.getBadgeDisplayCallback(e,t);if(this.options.isBadgeFullTitleShown){const o=this.getItemFullTitle(e);if(o)return o}return this.getItemDisplayValue(e)}getItemFullTitle(e){return this.extractField(e,{tupleSkip:!0,member:this.options.fullTitleMember,callback:this.options.getFullTitleCallback,transform:String,fallback:void 0})}getItemSearchValue(e){return this.extractField(e,{member:this.options.searchValueMember,callback:this.options.getSearchValueCallback,transform:String,fallback:()=>this.getItemDisplayValue(e)})}getItemSortKey(e){return this.extractField(e,{tupleSkip:!0,member:this.options.selectedOrderMember,callback:this.options.getSelectedOrderCallback,fallback:""})}getOrderedSelectedOptions(){const e=Array.from(this.selectedOptions.values()),t=this.options.selectedOrder??"as-selected";if(t==="as-selected"||e.length<2)return e;const o=e.slice();switch(t){case"label-asc":o.sort((i,r)=>this.getItemBadgeDisplayValue(i).localeCompare(this.getItemBadgeDisplayValue(r)));break;case"label-desc":o.sort((i,r)=>this.getItemBadgeDisplayValue(r).localeCompare(this.getItemBadgeDisplayValue(i)));break;case"member":o.sort((i,r)=>{const n=this.getItemSortKey(i),a=this.getItemSortKey(r);return typeof n=="number"&&typeof a=="number"?n-a:String(n).localeCompare(String(a))});break;case"custom":this.options.selectedOrderCompareCallback&&o.sort(this.options.selectedOrderCompareCallback);break}return o}getItemIcon(e){return this.extractField(e,{tupleSkip:!0,member:this.options.iconMember,callback:this.options.getIconCallback,transform:String,fallback:void 0})}getItemSubtitle(e){return this.extractField(e,{tupleSkip:!0,member:this.options.subtitleMember,callback:this.options.getSubtitleCallback,transform:String,fallback:void 0})}getItemGroup(e){return this.extractField(e,{tupleSkip:!0,member:this.options.groupMember,callback:this.options.getGroupCallback,transform:String,fallback:void 0})}getItemDisabled(e){return this.extractField(e,{tupleSkip:!0,member:this.options.disabledMember,callback:this.options.getDisabledCallback,transform:Boolean,fallback:!1})}isIndexSelectable(e){if(!this.isTreeMode())return!0;const t=this.treeNodes[e];return t?t.isSelectable!==!1:!0}isOptionSelectable(e){if(!this.isTreeMode())return!0;const t=this.filteredOptions.indexOf(e);if(t>=0)return this.isIndexSelectable(t);const o=String(this.getItemValue(e)),i=this.treeNodes.find(r=>String(this.getItemValue(r.data))===o);return i?i.isSelectable!==!1:!0}init(){this.parseOptions(),this.buildHTML(),this.attachEvents(),this.parseInitialSelection(),lt.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 e=this.element.dataset.options;if(e)try{this.allOptions=JSON.parse(e)}catch(t){G.error(`[${this.instanceId}] Failed to parse data-options:`,t),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=fn({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:e=>this.getItemDisplayValue(e.data)}),this.tree.insertArray(this.allOptions),this.cascadeIndex=this.isCascadeMode()?Co(this.tree,e=>String(this.getItemValue(e))):null,this.rebuildTreeVisible()}isCascadeMode(){return this.isTreeMode()&&this.options.isMultipleEnabled!==!1&&this.options.checkboxMode!=="independent"}cascadePolicy(){return this.options.cascadeSelectPolicy??"rolled-up"}refreshCascadeAtoms(){this.isCascadeMode()&&this.cascadeIndex&&(this.cascadeCheckedAtoms=dt(this.cascadeIndex,this.selectedValues))}toggleTreeCascade(e){const t=this.cascadeIndex,o=dt(t,this.selectedValues),{checkedAtoms:i}=gn(t,e,o);this.commitCascadeAtoms(i)}commitCascadeAtoms(e){var l;const t=this.cascadeIndex,o=ms(t,e,this.cascadePolicy(),c=>String(this.getItemValue(c))),i=new Set(o),r=[],n=[];for(const[c,d]of this.selectedOptions)i.has(c)||n.push(d);const a=new Map;for(const c of o){const u=((l=t.nodeByValue.get(c))==null?void 0:l.data)??this.selectedOptions.get(c);u!==void 0&&(a.set(c,u),this.selectedValues.has(c)||r.push(u))}this.selectedValues=i,this.selectedOptions=a,this.cascadeCheckedAtoms=e,this.commit({added:r,removed:n})}counterSelection(){if(this.isCascadeMode()&&this.cascadeIndex){const e=ms(this.cascadeIndex,this.cascadeCheckedAtoms,"rolled-up",o=>String(this.getItemValue(o))),t=[];for(const o of e){const i=this.cascadeIndex.nodeByValue.get(o),r=(i==null?void 0:i.data)??this.selectedOptions.get(o);r!==void 0&&t.push(r)}return t}return Array.from(this.selectedOptions.values())}buildCounterTooltip(e){const o=e.slice(0,12).map(i=>this.getItemBadgeDisplayValue(i));return e.length>12&&o.push(`…and ${e.length-12} more`),o.join(`
|
|
2
|
+
`)}rebuildTreeVisible(){if(!this.tree){this.treeNodes=[];return}const e=this.tree.flatNodes,t=this.options.isSearchEnabled?(this.searchTerm||"").trim().toLowerCase():"";let o;if(!t)o=e;else{const i=this.tree.treePathSeparator,r=new Set;for(const n of e)if(this.getItemSearchValue(n.data).toLowerCase().includes(t)){const l=n.path.split(i);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(i))}o=e.filter(n=>r.has(n.path))}this.treeNodes=o,this.filteredOptions=o.map(i=>i.data)}resetVisibleToAll(){this.isTreeMode()?this.rebuildTreeVisible():this.filteredOptions=[...this.allOptions]}rebuildTreeVisibleFromMatches(e){if(!this.tree){this.treeNodes=[],this.filteredOptions=[];return}const t=this.tree.flatNodes,o=this.tree.treePathSeparator,i=new Set((e||[]).map(a=>String(this.getItemValue(a)))),r=new Set;for(const a of t)if(i.has(String(this.getItemValue(a.data)))){const l=a.path.split(o);for(let c=1;c<=l.length;c++)r.add(l.slice(0,c).join(o))}const n=t.filter(a=>r.has(a.path));this.treeNodes=n,this.filteredOptions=n.map(a=>a.data)}rebuildTreeVisibleForNavigate(){if(this.matchingIndices.clear(),!this.tree)return this.treeNodes=[],this.filteredOptions=[],-1;const e=this.tree.flatNodes;this.treeNodes=e,this.filteredOptions=e.map(i=>i.data);const t=(this.searchTerm||"").trim().toLowerCase();if(!t)return-1;let o=-1;return e.forEach((i,r)=>{this.getItemSearchValue(i.data).toLowerCase().includes(t)&&(this.matchingIndices.add(r),o===-1&&(o=r))}),o}detectRTL(){const e=this.element.getRootNode(),t=e instanceof ShadowRoot?e.host:this.element,o=t.getAttribute("dir")==="rtl",i=t.closest('[dir="rtl"]')!==null;this.isRTL=o||i,lt.debug(`[${this.instanceId}] RTL Debug:`,{isShadowRoot:e instanceof ShadowRoot,elementDir:t.getAttribute("dir"),hasElementDir:o,hasAncestorDir:i,isRTL:this.isRTL}),this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left"))}refreshDirection(){if(!this.element)return;const e=this.isRTL;this.detectRTL(),this.element.classList.toggle("ms--rtl",this.isRTL);const t=this.isRTL?"rtl":"ltr";this.dropdown&&(this.dropdown.dir=t),this.hint&&(this.hint.dir=t),this.selectedPopover&&(this.selectedPopover.dir=t),e!==this.isRTL&&this.renderBadges()}buildHTML(){const e=this.options.container||document.body;this.detectRTL(),this.element.classList.add("ms"),this.isRTL&&(this.element.classList.add("ms--rtl"),lt.debug(`[${this.instanceId}] Added ms--rtl class to element`)),(!this.options.isCheckboxesShown||!this.options.isMultipleEnabled)&&this.element.classList.add("ms--no-checkboxes"),this.options.isSelectedPopoverEnabled||this.element.classList.add("ms--no-selected-popover");const t=document.createElement("div");t.className="ms__input-wrapper",this.inputWrapper=t,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.visibility="hidden");const o=document.createElement("span");o.className="ms__toggle",o.addEventListener("mousedown",n=>{n.preventDefault(),n.stopPropagation(),h(this,V)?(this.justClosedViaClick=!0,this.close(),setTimeout(()=>{this.justClosedViaClick=!1},0)):(this.open(),this.presentationMode!=="fullscreen"&&this.input.focus())}),this.counter=document.createElement("span"),this.counter.className="ms__counter",this.counter.style.display="none",this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="ms__input-clear",this.clearButton.tabIndex=-1,this.clearButton.setAttribute("aria-label","Clear selection"),this.clearButton.style.display="none",this.clearButton.addEventListener("mousedown",n=>n.preventDefault()),this.clearButton.addEventListener("click",n=>{n.stopPropagation(),this.clearClick()}),t.appendChild(this.input),t.appendChild(this.counter),t.appendChild(this.clearButton),t.appendChild(o),this.badgesContainer=document.createElement("div"),this.badgesContainer.className="ms__badges";const i=document.createElement("div");i.className="ms__wrapper",(this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")&&i.classList.add("ms__wrapper--inline"),i.appendChild(t),i.appendChild(this.badgesContainer),this.element.appendChild(i);const r=this.isRTL?"rtl":null;this.dropdown=document.createElement("div"),this.dropdown.className="ms__dropdown",r&&(this.dropdown.dir=r),this.dropdownInner=document.createElement("div"),this.dropdownInner.className="ms__dropdown-inner",this.dropdown.appendChild(this.dropdownInner),e.appendChild(this.dropdown),this.options.searchHint&&(this.hint=document.createElement("div"),this.hint.className="ms__hint",r&&(this.hint.dir=r),this.hint.textContent=this.options.searchHint,e.appendChild(this.hint)),this.selectedPopover=document.createElement("div"),this.selectedPopover.className="ms__selected-popover",r&&(this.selectedPopover.dir=r),e.appendChild(this.selectedPopover),this.renderDropdown()}shouldUseVirtualScroll(){if(!this.options.isVirtualScrollEnabled||this.options.isGroupsAllowed&&this.hasGroups())return!1;const e=this.options.virtualScrollThreshold??100;return this.filteredOptions.length>=e}hasGroups(){return this.filteredOptions.some(e=>{const t=this.getItemGroup(e);return t&&t.trim()!==""})}isGroupCascadeActive(){return!this.isTreeMode()&&this.options.isMultipleEnabled!==!1&&!!this.options.isGroupsAllowed&&this.options.groupSelectMode==="cascade"&&this.hasGroups()}groupCheckState(e){return this.groupSelectionInfo(e).checkState}groupSelectionInfo(e){let t=0,o=0;const i=[];for(const n of e){const a=this.getItemDisabled(n),l=this.selectedValues.has(String(this.getItemValue(n)));a||t++,l&&(i.push(n),a||o++)}const r=t===0||o===0?"unchecked":o===t?"checked":"indeterminate";return{members:e,selectedMembers:i,selectedCount:i.length,memberCount:e.length,selectableCount:t,checkState:r}}formatCountLabel(e,t){return this.options.getCountLabelCallback?this.options.getCountLabelCallback(e,t):`[${e}]`}groupCountHtml(e,t){if(e<=0)return"";const o=this.formatCountLabel(e,t);return`<span class="ms__group-count" aria-label="${e} selected">${this.escapeHtml(o)}</span>`}checkboxHtml(e={}){const t=e.indeterminate?"ms__checkbox ms__checkbox--indeterminate":"ms__checkbox",o=[e.checked?"checked":"",e.indeterminate?'aria-checked="mixed"':"",e.disabled?"disabled":""].filter(Boolean).join(" ");return`<input type="checkbox" class="${t}"${o?" "+o:""}>`}groupCheckboxHtml(e){return this.checkboxHtml({checked:e==="checked",indeterminate:e==="indeterminate"})}renderDropdown(e){var a;if(this.destroyAllActionButtonTooltips(),this.hideLabelReveal(),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 o=this.renderActionsHTML(),i=this.options.actionsPosition==="bottom";if(i||(t+=o),this.options.isVirtualScrollEnabled){const l=this.scaledOptionHeight();t+=`<div class="ms__options ms__options--fixed-height" style="--ms-option-height: ${l}px;">`}else t+='<div class="ms__options">';if(this.filteredOptions.length===0)t+=this.renderEmptyStateHTML();else if(this.isTreeMode())this.treeNodes.forEach((l,c)=>{t+=this.renderTreeNode(l,c)});else if(this.options.isGroupsAllowed){const l=this.groupOptions(this.filteredOptions),c=new Map;this.filteredOptions.forEach((u,f)=>c.set(u,f));const d=this.isGroupCascadeActive();Object.keys(l).forEach(u=>{if(t+='<div class="ms__group">',u!=="__ungrouped__"){const f=` data-group="${this.escapeHtml(u)}"`,p=d?' data-group-select="cascade"':"",g=this.groupSelectionInfo(l[u]),w=d?this.groupCheckboxHtml(g.checkState):"",_=d?"ms__group-label ms__group-label--selectable":"ms__group-label";if(this.options.renderGroupLabelContentCallback){const v={...he(this.presentationMode),groupName:u,...g},x=this.options.renderGroupLabelContentCallback(u,v);if(x instanceof HTMLElement){const C=document.createElement("div");if(C.className=_,C.dataset.group=u,d){C.dataset.groupSelect="cascade";const P=document.createElement("template");P.innerHTML=w,P.content.firstChild&&C.appendChild(P.content.firstChild)}C.appendChild(x),t+=C.outerHTML}else t+=`<div class="${_}"${f}${p}>${w}${x}</div>`}else{const v=this.groupCountHtml(g.selectedCount,g.memberCount),x=v?`${_} ms__group-label--has-count`:_;t+=`<div class="${x}"${f}${p}>${w}${this.escapeHtml(u)}${v}</div>`}}l[u].forEach(f=>{t+=this.renderOption(f,c.get(f)??-1)}),t+="</div>"})}else this.filteredOptions.forEach((l,c)=>{t+=this.renderOption(l,c)});t+="</div>",i&&(t+=o);let r=0,n=0;if(e!=null&&e.preserveScroll&&(r=this.dropdownInner.scrollTop,n=((a=this.dropdownInner.querySelector(".ms__options"))==null?void 0:a.scrollTop)??0),this.dropdownInner.innerHTML=t,e!=null&&e.preserveScroll){this.dropdownInner.scrollTop=r;const l=this.dropdownInner.querySelector(".ms__options");l&&(l.scrollTop=n)}this.attachActionButtonTooltips(),this.attachOptionTooltips(),this.markTruncatedOptions(),this.applyEdgeOptionRadii()}applyEdgeOptionRadii(){const e=this.dropdownInner.querySelector(".ms__options");if(!e)return;const t=e.scrollHeight>e.clientHeight+1?e:this.dropdownInner,o=t.offsetWidth-t.clientWidth<=0,i="var(--ms-dropdown-inner-border-radius)",r=Array.from(e.querySelectorAll(".ms__option, .ms__group-label"));r.forEach(l=>{l.style.borderStartStartRadius="",l.style.borderStartEndRadius="",l.style.borderEndStartRadius="",l.style.borderEndEndRadius=""});const n=r[0];n&&(n.style.borderStartStartRadius=i,o&&(n.style.borderStartEndRadius=i));let a;for(let l=r.length-1;l>=0;l--)if(r[l].classList.contains("ms__option")){a=r[l];break}a&&(a.style.borderEndStartRadius=i,o&&(a.style.borderEndEndRadius=i))}renderDropdownVirtual(){if(this.destroyAllActionButtonTooltips(),!this.virtualScroll){let o="";const i=this.renderActionsHTML(),r=this.options.actionsPosition==="bottom";r||(o+=i),o+='<div class="ms__options ms__options--virtual" style="overflow-y: auto; position: relative;"></div>',r&&(o+=i),this.dropdownInner.innerHTML=o,this.optionsContainer=this.dropdownInner.querySelector(".ms__options")}if(this.applyVirtualOptionsSizing(this.optionsContainer),this.filteredOptions.length===0){this.virtualScroll&&(this.virtualScroll.destroy(),this.virtualScroll=null),this.optionsContainer.innerHTML=this.renderEmptyStateHTML();return}const e=this.scaledOptionHeight(),t=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.optionsContainer&&(this.virtualScroll?(this.virtualScroll.setItemHeight(e),this.virtualScroll.setItems(this.filteredOptions)):this.virtualScroll=new yo({container:this.optionsContainer,itemHeight:e,items:this.filteredOptions,renderItem:(o,i)=>this.isTreeMode()?this.renderTreeNode(this.treeNodes[i],i):this.renderOption(o,i),bufferSize:t,onVisibleRangeChange:()=>{this.attachOptionTooltips(),this.markTruncatedOptions(),this.applyEdgeOptionRadii()}}),this.attachActionButtonTooltips())})}getBuiltInActionDisabled(e){return e==="select-all"?!this.filteredOptions.some(t=>!this.getItemDisabled(t)&&!this.selectedValues.has(String(this.getItemValue(t)))):e==="clear-all"?this.selectedValues.size===0:!1}renderActionsHTML(){const e=this.options.actionButtons;if(!this.options.isMultipleEnabled||!e||e.length===0)return"";const t=this.options.actionsPosition==="bottom"?"bottom":"top",o=this.options.actionsAlign??"stretch",i=` ms__actions--${t}`,r=this.options.isActionsSticky?" ms__actions--sticky":"",n=this.options.actionsLayout==="wrap"?" ms__actions--wrap":"",a=` ms__actions--align-${o}`,l=new Map;if(e.forEach((d,u)=>{const f=this.buildActionContext(d);if(!(d.getIsVisibleCallback?d.getIsVisibleCallback(this,f):d.isVisible??!0))return;let g;d.getIsDisabledCallback?g=d.getIsDisabledCallback(this,f):d.isDisabled!==void 0?g=d.isDisabled:g=this.getBuiltInActionDisabled(d.action);const w=g?" disabled":"",_=d.getTextCallback?d.getTextCallback(this,f):d.text;let v="";if(d.getClassCallback){const P=this.classSuffix(d.getClassCallback(this,f));P&&(v=` ${P}`)}else d.cssClass&&(v=` ${d.cssClass}`);const x=Math.max(1,Math.floor(d.row??1)),C=`<button type="button"${w} class="ms__action-btn${v}" data-action="${d.action}" data-button-index="${u}">${_}</button>`;l.has(x)||l.set(x,[]),l.get(x).push(C)}),l.size===0)return"";const c=Array.from(l.keys()).sort((d,u)=>d-u).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(e,t){const o=this.getItemValue(e),i=this.getItemDisplayValue(e),r=this.getItemIcon(e),n=this.getItemSubtitle(e),a=this.getItemDisabled(e),l=this.selectedValues.has(String(o)),c=t===this.focusedIndex,d=this.matchingIndices.has(t),u=["ms__option"];l&&u.push("ms__option--selected"),c&&u.push("ms__option--focused"),d&&u.push("ms__option--matched"),a&&u.push("ms__option--disabled");const f=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"";let p=`<div class="${u.join(" ")}" data-value="${o}" data-index="${t}"${f}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&(p+=this.checkboxHtml({checked:l,disabled:a})),p+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const g={index:t,isSelected:l,isFocused:c,isMatched:d,isDisabled:a,...he(this.presentationMode),isTreeNode:!1};p+=this.toHtml(this.options.renderOptionContentCallback(e,g))}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+=this.renderOptionInfoButton(),p+="</div>",p+="</div>",p}renderOptionInfoButton(){return this.presentationMode!=="fullscreen"?"":'<button type="button" class="ms__option-info" tabindex="-1" aria-label="Show full label"></button>'}renderTreeNode(e,t){const o=e.data,i=this.getItemValue(o),r=this.getItemDisplayValue(o),n=this.getItemIcon(o),a=this.getItemSubtitle(o),l=this.getItemDisabled(o),c=this.isCascadeMode()&&this.cascadeIndex,d=c?us(this.cascadeIndex,e,this.cascadeCheckedAtoms):null,u=c?d==="checked":this.selectedValues.has(String(i)),f=d==="indeterminate",p=t===this.focusedIndex,g=this.matchingIndices.has(t),w=e.isSelectable!==!1,_=e.level??1,v=Math.max(0,_-1),x=["ms__option","ms__option--tree"];x.push(e.hasChildren?"ms__option--tree-branch":"ms__option--tree-leaf"),u&&x.push("ms__option--selected"),f&&x.push("ms__option--indeterminate"),p&&x.push("ms__option--focused"),g&&x.push("ms__option--matched"),l&&x.push("ms__option--disabled"),w||x.push("ms__option--tree-unselectable");const C=this.options.checkboxAlign&&this.options.checkboxAlign!=="center"?` data-checkbox-align="${this.options.checkboxAlign}"`:"",P=w?"":' data-selectable="false"';let D=`<div class="${x.join(" ")}" data-value="${i}" data-index="${t}" data-path="${e.path}" data-level="${_}" style="--ms-tree-depth: ${v};"${C}${P}>`;if(this.options.isCheckboxesShown&&this.options.isMultipleEnabled&&w&&(D+=this.checkboxHtml({checked:u,indeterminate:f,disabled:l})),D+='<div class="ms__option-content">',this.options.renderOptionContentCallback){const F={index:t,isSelected:u,isFocused:p,isMatched:g,isDisabled:l,...he(this.presentationMode),isTreeNode:!0,isBranch:e.hasChildren,isLeaf:!e.hasChildren,childCount:Object.keys(e.children).length,level:_,depth:v,path:e.path,isSelectable:w,isIndeterminate:f};D+=this.toHtml(this.options.renderOptionContentCallback(o,F))}else n&&(D+=`<span class="ms__option-icon">${n}</span>`),D+='<div class="ms__option-text">',D+=`<div class="ms__option-title">${this.highlightMatch(r,this.searchTerm)}</div>`,a&&(D+=`<div class="ms__option-subtitle">${a}</div>`),D+="</div>";return D+=this.renderOptionInfoButton(),D+="</div>",D+="</div>",D}renderEmptyStateHTML(){if(this.isAddNewPromptShown()){const e=(this.searchTerm||"").trim();return this.addNewPending?`<div class="ms__add-new ms__add-new--loading" aria-busy="true"><span class="ms__add-new-spinner" aria-hidden="true"></span><span class="ms__add-new-text">${this.getAddNewPendingText(e)}</span></div>`:`<div class="ms__add-new${this.addNewFocused?" ms__add-new--focused":""}" role="button" data-action="add-new"><span class="ms__add-new-icon" aria-hidden="true"></span><span class="ms__add-new-text">${this.getAddNewText(e)}</span></div>`}return`<div class="ms__empty">${this.options.emptyMessage}</div>`}isAddNewPromptShown(){return!!this.options.isAddNewAllowed&&this.filteredOptions.length===0&&!!(this.searchTerm||"").trim()}getAddNewText(e){return this.options.getAddNewTextCallback?this.escapeHtml(this.options.getAddNewTextCallback(e)):(this.options.addNewText??'Add "{value}"').replace(/\{value\}/g,this.escapeHtml(e))}getAddNewPendingText(e){return(this.options.addNewPendingText??'Adding "{value}"…').replace(/\{value\}/g,this.escapeHtml(e))}escapeHtml(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}highlightMatch(e,t){if(!t)return e;const o=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(o,"<mark>$1</mark>")}groupOptions(e){const t={};return e.forEach(o=>{const i=this.getItemGroup(o)||"__ungrouped__";t[i]||(t[i]=[]),t[i].push(o)}),t}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.getSearchPlaceholder():this.options.selectPlaceholder||this.getSearchPlaceholder()}getSearchPlaceholder(){return this.options.searchPlaceholder?this.options.searchPlaceholder:this.options.isSearchModeToggleShown?(this.options.searchMode||"filter")==="navigate"?"Search…":"Filter…":"Search..."}refreshSearchPlaceholder(){const e=this.getPlaceholderText();this.input&&(this.input.placeholder=e),this.fullscreenSearchInput&&(this.fullscreenSearchInput.placeholder=e)}renderBadges(){this.updateClearButton(),this.destroyAllBadgeTooltips();const e=this.getOrderedSelectedOptions(),t=this.selectedValues.size;if(!this.options.isMultipleEnabled){this.badgesContainer.innerHTML="",this.counter.style.display="none";let r;e[0]&&(this.options.renderSelectedContentCallback?r=this.options.renderSelectedContentCallback(e[0],he(this.presentationMode)):r=this.getItemDisplayValue(e[0])),!h(this,V)&&t>0&&e.length>0?this.input.value=r:h(this,V)||(this.input.value="");return}let o=this.options.badgesDisplayMode;if(this.options.badgesThreshold!==null&&t>this.options.badgesThreshold&&o!=="none"&&(o=this.options.badgesThresholdMode||"count"),!h(this,V))if(t>0&&o==="count"){const r=this.options.getCounterCallback?this.options.getCounterCallback(t):`${t} selected`;this.input.placeholder=r}else this.input.placeholder=this.getPlaceholderText();if(this.options.isCounterShown&&t>0){const r=this.counterSelection(),n=r.length;this.counter.textContent=this.formatCountLabel(n,this.allOptions.length),this.counter.title=this.buildCounterTooltip(r),this.counter.style.display=n>0?"":"none"}else this.counter.title="",this.counter.style.display="none";if(o==="none"){this.badgesContainer.innerHTML="";return}if(o==="badges")this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`,this.badgesContainer.innerHTML=e.map(r=>this.renderBadgeHTML(r,{displayMode:"badges",isInPopover:!1})).join("");else if(o==="partial"){this.badgesContainer.className=`ms__badges ms__badges--${this.effectiveBadgesPosition}`;const r=this.options.badgesMaxVisible||3,n=e.slice(0,r),a=t-r,l=n.map(d=>this.renderBadgeHTML(d,{displayMode:"partial",isInPopover:!1})).join("");let c="";a>0&&(c=`
|
|
3
3
|
<div class="ms__badge ms__badge--counter ms__badge--more" data-action="show-selected">
|
|
4
4
|
<span class="ms__badge-text">${this.options.getCounterCallback?this.options.getCounterCallback(t,a):`+${a} more`}</span>
|
|
5
5
|
<button type="button" class="ms__badge-remove" data-action="remove-hidden" aria-label="Remove ${a} hidden items"></button>
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
<span class="ms__badge-text">${r}</span>
|
|
15
15
|
<button type="button" class="ms__badge-remove" data-action="clear-count" aria-label="Clear all selections"></button>
|
|
16
16
|
</div>
|
|
17
|
-
`}else this.badgesContainer.innerHTML="";this.attachBadgeTooltips()}attachEvents(){this.input.addEventListener("mousedown",e=>{e.stopPropagation(),h(this,V)?(this.justClosedViaClick=!0,this.close(),setTimeout(()=>{this.justClosedViaClick=!1},0)):(this.presentationMode==="fullscreen"&&e.preventDefault(),this.open())}),this.input.addEventListener("focus",()=>{!h(this,V)&&!this.justClosedViaClick&&this.open()}),this.input.addEventListener("input",e=>{const t=e.target.value;this.options.isSearchEnabled&&!h(this,V)&&this.open(),this.handleSearch(t)}),this.input.addEventListener("keydown",e=>this.handleKeydown(e)),this.documentClickHandler=e=>this.handleClickOutside(e),setTimeout(()=>{document.addEventListener("click",this.documentClickHandler)},0),this.overlayCoord=Ji(()=>this.close(),this.options.overlayGroup||void 0),this.documentKeydownHandler=e=>{e.key==="Escape"&&this.showSelectedPopover&&(e.preventDefault(),this.hideSelectedPopover())},document.addEventListener("keydown",this.documentKeydownHandler),this.dropdown.addEventListener("mousedown",e=>{if(this.presentationMode!=="fullscreen")return;e.target.closest(".ms__option")&&e.preventDefault()}),this.dropdown.addEventListener("touchmove",e=>{var t;this.presentationMode==="fullscreen"&&e.target.closest(".ms__options")&&((t=this.fullscreenSearchInput)==null||t.blur())},{passive:!0}),this.dropdown.addEventListener("click",e=>this.handleDropdownClick(e)),this.dropdownInner.addEventListener("wheel",e=>{if(this.virtualScroll)return;const t=e.currentTarget,o=t.scrollTop===0,i=t.scrollTop+t.clientHeight>=t.scrollHeight;(e.deltaY<0&&o||e.deltaY>0&&i)&&e.preventDefault(),e.stopPropagation()},{passive:!1}),this.badgesContainer.addEventListener("mousedown",e=>{e.target.closest('[data-action="show-selected"]')&&!this.showSelectedPopover&&e.stopPropagation()}),this.badgesContainer.addEventListener("click",e=>this.handleBadgeClick(e)),this.counter.addEventListener("mousedown",e=>{this.showSelectedPopover||e.stopPropagation()}),this.counter.addEventListener("click",e=>{e.stopPropagation(),this.toggleSelectedPopover()}),this.selectedPopover.addEventListener("click",e=>this.handleSelectedPopoverClick(e))}async handleSearch(e){if(this.searchTerm=e,this.addNewFocused=!1,!this.options.isSearchEnabled)return;let t=e;if(this.options.beforeSearchCallback){const o=this.options.beforeSearchCallback(e);if(o===null){G.debug(`[${this.instanceId}] beforeSearchCallback blocked search for term:`,e),this.abortInFlightSearch(),this.matchingIndices.clear(),this.isTreeMode()?(this.searchTerm="",this.rebuildTreeVisible()):this.filteredOptions=[...this.allOptions],this.renderDropdown();return}t=o,t!==e&&G.debug(`[${this.instanceId}] beforeSearchCallback transformed: "${e}" -> "${t}"`)}if(this.options.searchCallback){if(t.length<this.options.minSearchLength){this.abortInFlightSearch(),this.isLoading=!1,this.options.isKeepOptionsOnSearch?(this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions],G.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 o=this.options.searchDebounce||0;o>0?this.searchDebounceTimer=setTimeout(()=>{this.searchDebounceTimer=void 0,this.searchTerm===e&&this.performAsyncSearch(e,t)},o):await this.performAsyncSearch(e,t)}else{if(this.isTreeMode()){if((this.options.searchMode||"filter")==="navigate"){const o=this.rebuildTreeVisibleForNavigate();this.searchTerm.trim()?o>=0&&(this.focusedIndex=o):this.focusedIndex=-1,this.renderDropdown(),this.focusedIndex>=0&&this.scrollToFocused(),this.updateFullscreenNav();return}this.rebuildTreeVisible(),this.matchingIndices.clear(),this.focusedIndex=this.searchTerm.trim()&&this.filteredOptions.length>0?0:-1,this.renderDropdown();return}if(!t)this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.focusedIndex=-1;else{const o=this.options.searchMode||"filter",i=t.toLowerCase();if(o==="filter")this.filteredOptions=this.allOptions.filter(r=>this.getItemSearchValue(r).toLowerCase().includes(i)),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,G.debug(`[${this.instanceId}] Filter mode: ${this.filteredOptions.length} matches for "${t}"`);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,G.debug(`[${this.instanceId}] Navigate mode: ${this.matchingIndices.size} matches, jumped to index ${r}`)):G.debug(`[${this.instanceId}] Navigate mode: No matches found, keeping previous focus`)}}this.renderDropdown(),this.options.searchMode==="navigate"&&this.focusedIndex>=0&&this.scrollToFocused(),this.updateFullscreenNav()}}abortInFlightSearch(){this.searchAbortController&&(this.searchAbortController.abort(),this.searchAbortController=void 0)}async performAsyncSearch(e,t){this.abortInFlightSearch();const o=new AbortController;this.searchAbortController=o,this.isLoading=!0,this.renderDropdown(),G.debug(`[${this.instanceId}] Loading data for search term:`,t);try{const i=await this.options.searchCallback(t,o.signal);if(o.signal.aborted||this.searchTerm!==e)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(),G.debug(`[${this.instanceId}] Loaded ${r.length} results`)}catch(i){if(o.signal.aborted)return;G.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===o&&(this.searchAbortController=void 0)}}handleKeydown(e){var t;if(!(this.options.keydownCallback&&this.options.keydownCallback({event:e,key:e.key,isOpen:h(this,V),presentation:this.presentationMode,searchTerm:this.searchTerm,focusedIndex:this.focusedIndex,focusedOption:(this.focusedIndex>=0?this.filteredOptions[this.focusedIndex]:null)??null,filteredOptions:this.filteredOptions,selectedValues:[...this.selectedValues],controller:this.getKeyboardController()})===!0)){if(!h(this,V)){(e.key==="Enter"||e.key==="ArrowDown")&&(e.preventDefault(),this.open());return}if(!this.options.isSearchEnabled){const o=e.key.length===1||e.key==="Backspace"||e.key==="Delete",i=["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key);if(o&&!i){e.preventDefault();return}}switch(e.key){case"ArrowDown":e.preventDefault(),this.isAddNewPromptShown()?this.focusAddNewPrompt():e.ctrlKey||e.metaKey?this.focusNextMatch():this.focusNext();break;case"ArrowUp":e.preventDefault(),this.isAddNewPromptShown()?this.focusAddNewPrompt():e.ctrlKey||e.metaKey?this.focusPreviousMatch():this.focusPrevious();break;case"Enter":e.preventDefault(),this.focusedIndex>=0?this.toggleOption(this.filteredOptions[this.focusedIndex]):this.options.isAddNewAllowed&&this.filteredOptions.length===0&&(this.searchTerm||"").trim()&&this.handleAddNew((this.searchTerm||"").trim()),this.presentationMode==="fullscreen"&&((t=this.fullscreenSearchInput)==null||t.blur());break;case"Escape":e.preventDefault(),this.showSelectedPopover?this.hideSelectedPopover():this.input.value?this.clearSearch():this.close();break;case"Tab":this.close();break;case"PageUp":e.preventDefault(),this.focusPageUp();break;case"PageDown":e.preventDefault(),this.focusPageDown();break;case"Home":case"End":{const o=e.target instanceof HTMLInputElement?e.target:null;let i;if(!o)i=!0;else if(o.selectionStart!==o.selectionEnd)i=!1;else{const r=o.selectionStart??0;i=e.key==="Home"?r===0:r===o.value.length}i&&(e.preventDefault(),e.key==="Home"?this.focusFirst():this.focusLast());break}}}}handleDropdownClick(e){var n,a,l;H.debug(`[${this.instanceId}] Dropdown clicked`,{target:e.target.className}),e.stopPropagation();const t=e.target.closest(".ms__option-info");if(t){e.preventDefault(),this.toggleLabelReveal(t);return}this.hideLabelReveal();const o=e.target.closest("[data-action]");if(o){e.preventDefault();const c=o.dataset.action;if(H.debug(`[${this.instanceId}] Action button clicked:`,c),c==="select-all")this.selectAll();else if(c==="clear-all")this.clearAll();else if(c==="add-new"){const d=(this.searchTerm||"").trim();d&&this.handleAddNew(d)}else if(c==="custom"){const d=parseInt(o.dataset.buttonIndex||"-1"),u=(n=this.options.actionButtons)==null?void 0:n[d];u!=null&&u.onClick&&u.onClick(this)}return}const i=e.target.closest('.ms__group-label[data-group-select="cascade"]');if(i&&i.dataset.group){e.preventDefault(),H.debug(`[${this.instanceId}] Group header cascade toggle:`,i.dataset.group),this.toggleGroup(i.dataset.group),h(this,V)&&this.presentationMode!=="fullscreen"?this.input.focus():this.presentationMode==="fullscreen"&&((a=this.fullscreenSearchInput)==null||a.blur());return}const r=e.target.closest(".ms__option");if(r&&!r.classList.contains("ms__option--disabled")){e.preventDefault();const c=r.dataset.value,d=this.filteredOptions.findIndex(u=>String(this.getItemValue(u))===c);H.debug(`[${this.instanceId}] Option clicked:`,{value:c,optionIndex:d,closeOnSelect:this.options.isCloseOnSelect,placeholder:this.options.searchPlaceholder}),d>=0&&(this.focusedIndex=d,this.toggleOption(this.filteredOptions[d]),h(this,V)&&this.presentationMode!=="fullscreen"?this.input.focus():this.presentationMode==="fullscreen"&&((l=this.fullscreenSearchInput)==null||l.blur()))}}handleBadgeClick(e){var r;if(e.target.closest('[data-action="clear-count"]')){e.preventDefault(),e.stopPropagation(),H.debug(`[${this.instanceId}] Clear count button clicked`),this.clearAll();return}const o=e.target.closest('.ms__badge-remove, [data-action="remove"]');if(o){if(e.preventDefault(),e.stopPropagation(),o.dataset.action==="remove-hidden"){H.debug(`[${this.instanceId}] Remove hidden items button clicked`);const l=this.options.badgesMaxVisible||3;this.getOrderedSelectedOptions().slice(l).forEach(u=>this.interactiveDeselect(u));return}const n=o.dataset.value??((r=o.closest("[data-value]"))==null?void 0:r.dataset.value)??"",a=this.selectedOptions.get(n);a&&this.interactiveDeselect(a);return}if(e.target.closest('[data-action="show-selected"]')){e.preventDefault(),e.stopPropagation(),this.toggleSelectedPopover();return}}handleClickOutside(e){var i;const t=e.composedPath();if(this.showSelectedPopover&&!t.some(n=>n instanceof Node&&(this.selectedPopover.contains(n)||this.counter.contains(n)||n.closest&&n.closest('[data-action="show-selected"]')))){Y.debug(`[${this.instanceId}] Closing selected popover due to click outside`),this.hideSelectedPopover();return}if(!h(this,V)||this.justOpenedViaClick)return;const o=t.some(r=>r instanceof Node&&(this.element.contains(r)||this.dropdown.contains(r)||this.hint&&this.hint.contains(r)));H.debug(`[${this.instanceId}] handleClickOutside`,{target:e.target.className,targetTag:e.target.tagName,clickedInside:o,pathLength:t.length,firstInPath:(i=t[0])==null?void 0:i.tagName,elementContains:t.some(r=>r instanceof Node&&this.element.contains(r)),dropdownContains:t.some(r=>r instanceof Node&&this.dropdown.contains(r)),isConnected:this.dropdown.isConnected}),o||(H.warn(`[${this.instanceId}] Closing dropdown due to click outside`),this.close())}focusBy(e,t=1){const o=this.filteredOptions.length;if(o===0)return;const i=e(this.focusedIndex,o);if(i<0)return;const r=this.resolveSelectableIndex(i,t,o);r<0||(this.focusedIndex=r,this.renderDropdown(),this.scrollToFocused(),this.updateFullscreenNav())}resolveSelectableIndex(e,t,o){if(!this.isTreeMode())return e;let i=e;for(;i>=0&&i<o&&!this.isIndexSelectable(i);)i+=t;if(i<0||i>=o)for(i=e-t;i>=0&&i<o&&!this.isIndexSelectable(i);)i-=t;return i>=0&&i<o?i:-1}focusNext(){this.focusBy((e,t)=>Math.min(t-1,e+1),1)}focusPrevious(){this.focusBy(e=>Math.max(0,e-1),-1)}focusFirst(){this.focusBy(()=>0,1)}focusLast(){this.focusBy((e,t)=>t-1,-1)}focusPageUp(){this.focusBy(e=>Math.max(0,e-10),-1)}focusPageDown(){this.focusBy((e,t)=>Math.min(t-1,e+10),1)}focusAddNewPrompt(){this.addNewFocused||(this.addNewFocused=!0,this.renderDropdown())}focusNextMatch(){if(this.matchingIndices.size===0)return;const e=Array.from(this.matchingIndices).sort((i,r)=>i-r),t=e.findIndex(i=>i===this.focusedIndex),o=(t+1)%e.length;this.focusBy(()=>e[o]),H.debug(`[${this.instanceId}] Jumped to next match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}focusPreviousMatch(){if(this.matchingIndices.size===0)return;const e=Array.from(this.matchingIndices).sort((i,r)=>i-r),t=e.findIndex(i=>i===this.focusedIndex),o=t<=0?e.length-1:t-1;this.focusBy(()=>e[o]),H.debug(`[${this.instanceId}] Jumped to previous match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}getKeyboardController(){return this.keyboardController?this.keyboardController:(this.keyboardController={focusNext:()=>this.focusNext(),focusPrevious:()=>this.focusPrevious(),focusFirst:()=>this.focusFirst(),focusLast:()=>this.focusLast(),focusPageUp:()=>this.focusPageUp(),focusPageDown:()=>this.focusPageDown(),focusNextMatch:()=>this.focusNextMatch(),focusPreviousMatch:()=>this.focusPreviousMatch(),focusIndex:e=>this.focusBy(()=>e,1),toggleFocused:()=>{this.focusedIndex>=0&&this.toggleOption(this.filteredOptions[this.focusedIndex])},toggleValue:e=>{const t=this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},selectValue:e=>{if(this.selectedValues.has(String(e)))return;const t=this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},deselectValue:e=>{if(!this.selectedValues.has(String(e)))return;const t=this.selectedOptions.get(String(e))??this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},open:()=>this.open(),close:()=>this.close(),setSearch:e=>{this.input.value=e,this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=e),this.handleSearch(e)},clearSearch:()=>this.clearSearch()},this.keyboardController)}clearSearch(){this.input.value="",this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.searchTerm="",this.resetVisibleToAll(),this.matchingIndices.clear(),this.focusedIndex=-1,this.renderDropdown(),this.updateFullscreenNav(),this.updateFullscreenSearchClear()}search(e){const t=e??"";this.input.value=t,this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=t),this.handleSearch(t),this.updateFullscreenSearchClear()}scrollToFocused(){if(this.virtualScroll&&this.focusedIndex>=0){this.virtualScroll.scrollToIndex(this.focusedIndex,"nearest");return}const e=this.dropdown.querySelector(".ms__option--focused");e&&this.applyScrollIntoView(e)}applyScrollIntoView(e,t){this.presentationMode==="fullscreen"?e.scrollIntoView({block:(t==null?void 0:t.block)??"center",behavior:"auto"}):e.scrollIntoView({block:(t==null?void 0:t.block)??"nearest",behavior:"smooth"})}scrollToIndex(e,t){const o=(t==null?void 0:t.block)??"start";return h(this,V)?e<0||e>=this.filteredOptions.length?(H.debug(`[${this.instanceId}] scrollToIndex(${e}) → false (out of range, ${this.filteredOptions.length} options)`),!1):(H.debug(`[${this.instanceId}] scrollToIndex(${e}, block=${o}) — virtual=${!!this.virtualScroll}, mode=${this.presentationMode}`),this.armClickGuard(),this.scrollToRenderedIndex(e,{block:o}),!0):(H.debug(`[${this.instanceId}] scrollToIndex(${e}) → false (closed)`),!1)}scrollToValue(e,t){const o=this.filteredOptions.findIndex(i=>String(this.getItemValue(i))===String(e));return H.debug(`[${this.instanceId}] scrollToValue(${String(e)}) → index ${o} of ${this.filteredOptions.length}`),o<0?!1:this.scrollToIndex(o,t)}scrollToGroup(e,t){const o=(t==null?void 0:t.block)??"start";if(!h(this,V)||this.isTreeMode())return H.debug(`[${this.instanceId}] scrollToGroup(${e}) → false (${this.isTreeMode()?"tree mode":"closed"})`),!1;if(this.armClickGuard(),!this.virtualScroll){const r=this.dropdown.querySelector(`.ms__group-label[data-group="${CSS.escape(e)}"]`);if(r)return H.debug(`[${this.instanceId}] scrollToGroup(${e}) — header found, scrolling label into view (block=${o})`),this.applyScrollIntoView(r,{block:o}),!0}const i=this.filteredOptions.findIndex(r=>(this.getItemGroup(r)||"")===e);return H.debug(`[${this.instanceId}] scrollToGroup(${e}) — no header (virtual=${!!this.virtualScroll}), first member index ${i}`),i<0?!1:this.scrollToIndex(i,{block:o})}scrollToRenderedIndex(e,t,o=!1){if(!h(this,V)||e<0||e>=this.filteredOptions.length)return;if(this.virtualScroll){const r=(t==null?void 0:t.block)==="center"?"center":(t==null?void 0:t.block)==="nearest"?"nearest":"start";this.virtualScroll.scrollToIndex(e,r),H.debug(`[${this.instanceId}] scrollToRenderedIndex(${e}) via virtual (block=${r})`);return}const i=this.dropdown.querySelector(`.ms__option[data-index="${e}"]`);if(i){this.applyScrollIntoView(i,t),H.debug(`[${this.instanceId}] scrollToRenderedIndex(${e}) via DOM scrollIntoView`);return}o||(H.debug(`[${this.instanceId}] scrollToRenderedIndex(${e}) not rendered yet — deferring one frame`),requestAnimationFrame(()=>this.scrollToRenderedIndex(e,t,!0)))}toggleOption(e){if(this.getItemDisabled(e)){H.debug(`[${this.instanceId}] toggleOption ignored — option is disabled`);return}if(!this.isOptionSelectable(e)){H.debug(`[${this.instanceId}] toggleOption ignored — node is not selectable`);return}const t=this.getItemValue(e),o=String(t);if(H.debug(`[${this.instanceId}] toggleOption called`,{value:t,multiple:this.options.isMultipleEnabled}),this.isCascadeMode()&&this.cascadeIndex){const n=this.cascadeIndex.nodeByValue.get(o);if(n){this.toggleTreeCascade(n),this.options.isCloseOnSelect&&this.close();return}}const i=this.selectedValues.has(o);if(i&&!this.options.isMultipleEnabled){this.close();return}(i?this.interactiveDeselect(e):this.interactiveSelect(e))&&(this.options.isMultipleEnabled?this.options.isCloseOnSelect&&this.close():this.close())}interactiveSelect(e){var o,i;const t=(i=(o=this.options).beforeSelectCallback)==null?void 0:i.call(o,e,this.getSelected());return t===!1||typeof t=="string"?(typeof t=="string"&&this.showMessage(t,{variant:"warning"}),H.debug(`[${this.instanceId}] Selection blocked by beforeSelectCallback`),!1):(this.options.isMultipleEnabled||(this.selectedValues.clear(),this.selectedOptions.clear()),this.selectOption(e),!0)}interactiveDeselect(e){var o,i;const t=(i=(o=this.options).beforeDeselectCallback)==null?void 0:i.call(o,e,this.getSelected());return t===!1||typeof t=="string"?(typeof t=="string"&&this.showMessage(t,{variant:"warning"}),H.debug(`[${this.instanceId}] Deselection blocked by beforeDeselectCallback`),!1):(this.deselectOption(e),!0)}async handleAddNew(e){var t,o;try{let i;if(this.options.addNewCallback){G.debug(`[${this.instanceId}] Adding new option:`,e),this.addNewFocused=!1,this.addNewPending=!0,this.renderDropdown();let r;try{r=await this.options.addNewCallback(e)}finally{this.addNewPending=!1}if(r==null){G.debug(`[${this.instanceId}] addNewCallback canceled creation for:`,e),this.renderDropdown();return}i=r,this.allOptions.push(i),this.searchTerm="",this.input.value="",this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.matchingIndices.clear(),this.focusedIndex=-1,this.addNewFocused=!1,this.resetVisibleToAll(),this.selectOption(i),this.updateFullscreenSearchClear()}(o=(t=this.options).onAddNew)==null||o.call(t,{value:e,option:i}),i&&this.options.isCloseOnSelect&&this.close()}catch(i){this.addNewPending=!1,G.error(`[${this.instanceId}] Error adding new option:`,i),this.renderDropdown()}}selectOption(e){const t=this.getItemValue(e),o=String(t);this.selectedValues.add(o),this.selectedOptions.set(o,e),this.commit({added:[e]})}deselectOption(e){const t=this.getItemValue(e),o=String(t);if(this.isCascadeMode()&&this.cascadeIndex){const i=this.cascadeIndex.nodeByValue.get(o);if(i){const r=this.cascadeIndex.atomsUnder.get(i.path)??[],n=new Set(dt(this.cascadeIndex,this.selectedValues));for(const a of r)n.delete(a);this.commitCascadeAtoms(n);return}}this.selectedValues.delete(o),this.selectedOptions.delete(o),this.commit({removed:[e]})}selectAll(){if(this.isCascadeMode()&&this.cascadeIndex){const t=this.cascadeIndex,o=new Set(dt(t,this.selectedValues));for(const i of this.treeNodes)t.atomPaths.has(i.path)&&(this.getItemDisabled(i.data)||o.add(String(this.getItemValue(i.data))));this.commitCascadeAtoms(o);return}const e=[];this.filteredOptions.forEach((t,o)=>{if(this.getItemDisabled(t)||!this.isIndexSelectable(o))return;const i=String(this.getItemValue(t));this.selectedValues.has(i)||(this.selectedValues.add(i),this.selectedOptions.set(i,t),e.push(t))}),this.commit({added:e})}clearAll(){const e=Array.from(this.selectedOptions.values());this.selectedValues.clear(),this.selectedOptions.clear(),this.commit({removed:e})}toggleGroup(e){const t=this.groupOptions(this.filteredOptions)[e];if(!(!t||t.length===0))if(this.groupCheckState(t)==="checked"){const o=[];for(const i of t){const r=String(this.getItemValue(i));this.selectedValues.delete(r)&&(this.selectedOptions.delete(r),o.push(i))}this.commit({removed:o})}else{const o=[];for(const i of t){if(this.getItemDisabled(i))continue;const r=String(this.getItemValue(i));this.selectedValues.has(r)||(this.selectedValues.add(r),this.selectedOptions.set(r,i),o.push(i))}this.commit({added:o})}}clearClick(){H.debug(`[${this.instanceId}] input clear (✕) clicked`),this.clearAll(),(this.searchTerm||this.input.value)&&this.clearSearch(),this.showSelectedPopover&&this.hideSelectedPopover(),this.justClosedViaClick=!0,this.input.focus(),setTimeout(()=>{this.justClosedViaClick=!1},0)}updateClearButton(){if(!this.clearButton)return;const e=!this.element.classList.contains("ms--disabled"),t=!!this.options.isClearShown&&this.selectedValues.size>0&&e;this.clearButton.style.display=t?"":"none"}commit(e){this.renderDropdown({preserveScroll:!0}),this.renderBadges(),this.updateHiddenInput();const t=e.added??[],o=e.removed??[];this.options.onSelect&&t.forEach(i=>this.options.onSelect(i)),this.options.onDeselect&&o.forEach(i=>this.options.onDeselect(i)),(t.length>0||o.length>0)&&this.options.onChange&&this.options.onChange(this.getSelected())}armClickGuard(){this.justOpenedViaClick=!0,setTimeout(()=>{this.justOpenedViaClick=!1},0)}open(){var e;Y.debug(`[${this.instanceId}] open() called`,{isOpen:h(this,V)}),this.armClickGuard(),!h(this,V)&&(this.hideMessage(),P(this,V,!0),this.element.classList.add("ms--open"),this.dropdown.classList.add("ms__dropdown--visible"),Y.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],Y.debug(`[${this.instanceId}] Showing ${this.allOptions.length} initial options on open`)),this.presentationMode==="fullscreen"&&this.enterFullscreen(),this.renderDropdown(),this.presentationMode!=="fullscreen"&&this.positionDropdown(),this.dropdown.addEventListener("scroll",this.onDropdownScroll,!0),this.hint&&this.presentationMode==="floating"&&(this.hint.classList.add("ms__hint--visible"),this.positionHint()),(e=this.overlayCoord)==null||e.activate())}close(){var e;Y.debug(`[${this.instanceId}] close() called`,{isOpen:h(this,V)}),h(this,V)&&(P(this,V,!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.dropdown.removeEventListener("scroll",this.onDropdownScroll,!0),this.destroyAllOptionTooltips(),this.hideLabelReveal(),this.hideMessage(),this.renderBadges(),this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.exitFullscreen(),this.dropdownPlacement=null,(e=this.overlayCoord)==null||e.deactivate(),Y.debug(`[${this.instanceId}] Dropdown closed`))}toggle(){h(this,V)?this.close():this.open()}get isOpen(){return h(this,V)}set isOpen(e){e?this.open():this.close()}anchorFloatingPanel(e,t){var r;const o=((r=t.isLocked)==null?void 0:r.call(t))??!0,i=at(e,this.inputWrapper,{strategy:"fixed",placement:"bottom-start",offset:4,shift:8,lockPlacement:o?"freeze":!1,fixedContainingBlock:!0,maxWidth:{padding:8},onDrift:n=>this.warnDrift(n),beforeCompute:()=>{(this.options.hostElement??this.element).style.setProperty("--ms-input-current-width",`${this.inputWrapper.offsetWidth}px`),this.options.dropdownMinWidth&&(e.style.minWidth=this.options.dropdownMinWidth)},onPlaced:n=>{var a;if(t.getPlacement()||t.setPlacement(n),t.applyMaxWidth&&this.options.dropdownMaxWidth){const l=e.style.maxWidth;e.style.maxWidth=l?`min(${this.options.dropdownMaxWidth}, ${l})`:this.options.dropdownMaxWidth}(a=t.afterPosition)==null||a.call(t)}});return()=>i.destroy()}warnDrift(e){this.positioningDriftWarned||(this.positioningDriftWarned=!0,console.warn(`[@keenmate/web-multiselect] Dropdown panel rendered ${e.driftX.toFixed(0)}px / ${e.driftY.toFixed(0)}px away from where the library positioned it. Most likely culprit: ${e.culpritDescription}`+(e.culpritCss?` (has ${e.culpritCss})`:"")+".\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."))}warnFullscreenContainingBlock(){if(this.fullscreenContainingBlockWarned||typeof window>"u")return;const e=hs(this.dropdown);if(e===window)return;this.fullscreenContainingBlockWarned=!0;const t=e,o=t.id?`#${t.id}`:"",i=t.classList.length?`.${Array.from(t.classList).join(".")}`:"",r=`<${t.tagName.toLowerCase()}${o}${i}>`,n=go(t);console.warn(`[@keenmate/web-multiselect] Fullscreen overlay is anchored to an ancestor ${r}`+(n?` (has ${n})`:"")+` instead of the viewport, so it may not cover the screen (offset, clipped, or mis-sized).
|
|
18
|
-
An ancestor of <web-multiselect> establishes a fixed-positioning containing block (transform / perspective / filter / backdrop-filter / will-change). Fix on your side: move the component out of that ancestor's subtree, OR remove/replace that property. If neither is acceptable, please file an issue at https://github.com/keenmate/web-multiselect/issues with the ancestor's computed CSS.`)}positionDropdown(){this.presentationMode!=="fullscreen"&&(this.dropdownCleanup=this.anchorFloatingPanel(this.dropdown,{getPlacement:()=>this.dropdownPlacement,setPlacement:e=>{this.dropdownPlacement=e,Y.debug(`[${this.instanceId}] Locked dropdown placement:`,e)},isLocked:()=>!!this.options.isPlacementLocked,applyMaxWidth:!0,afterPosition:()=>{this.hint&&h(this,V)&&this.positionHint()}}))}setPresentation(e){e!==this.presentationMode&&(this.presentationMode=e,h(this,V)?e==="fullscreen"?(this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.hint&&this.hint.classList.remove("ms__hint--visible"),this.dropdownPlacement=null,this.enterFullscreen(),this.renderDropdown()):(this.exitFullscreen(),this.renderDropdown(),this.positionDropdown(),this.hint&&(this.hint.classList.add("ms__hint--visible"),this.positionHint())):this.showSelectedPopover&&(e==="fullscreen"?(this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null),this.selectedPopoverPlacement=null,this.clearFloatingInlineGeometry(this.selectedPopover),this.selectedPopover.classList.add("ms__selected-popover--fullscreen"),this.lockBodyScroll()):(this.selectedPopover.classList.remove("ms__selected-popover--fullscreen"),this.unlockBodyScroll(),this.positionSelectedPopover())))}lockBodyScroll(){this.bodyScrollUnlock||(this.bodyScrollUnlock=Ki())}unlockBodyScroll(){this.bodyScrollUnlock&&(this.bodyScrollUnlock(),this.bodyScrollUnlock=null)}clampDocumentOverflowX(){if(this.overflowXClamp||typeof document>"u")return;const e=document.documentElement;this.overflowXClamp={html:e.style.overflowX},e.style.overflowX="hidden"}releaseDocumentOverflowX(){!this.overflowXClamp||typeof document>"u"||(document.documentElement.style.overflowX=this.overflowXClamp.html,this.overflowXClamp=null)}observeKeyboardInset(){this.keyboardInsetCleanup=Wi(this.dropdown)}unobserveKeyboardInset(){this.keyboardInsetCleanup&&(this.keyboardInsetCleanup(),this.keyboardInsetCleanup=null)}fullscreenScale(){if(this.presentationMode!=="fullscreen"||typeof getComputedStyle!="function")return 1;const e=this.options.hostElement??this.element,t=getComputedStyle(e),o=parseFloat(t.getPropertyValue("--ms-rem"))||10;return(parseFloat(t.getPropertyValue("--ms-fullscreen-rem"))||o*1.2)/o}scaledOptionHeight(){return Math.round((this.options.optionHeight??50)*this.fullscreenScale())}applyVirtualOptionsSizing(e){if(e.style.setProperty("--ms-option-height",`${this.scaledOptionHeight()}px`),this.presentationMode==="fullscreen")e.style.flex="1 1 0",e.style.minHeight="0",e.style.height="",e.style.maxHeight="";else{const t=this.options.maxHeight||"20rem";e.style.flex="",e.style.minHeight="",e.style.height=t,e.style.maxHeight=t}}scaledBadgeHeight(){const e=this.options.badgeHeight??36;return this.presentationMode!=="fullscreen"?e:Math.round(e*this.fullscreenScale()*1.2)}clearFloatingInlineGeometry(e){e.style.position="",e.style.left="",e.style.top="",e.style.right="",e.style.bottom="",e.style.transform="",e.style.maxWidth="",e.style.minWidth="",e.style.width=""}enterFullscreen(){var e;this.clearFloatingInlineGeometry(this.dropdown),this.dropdown.classList.add("ms__dropdown--fullscreen"),this.warnFullscreenContainingBlock(),this.buildFullscreenHeader(),this.lockBodyScroll(),this.clampDocumentOverflowX(),this.pushOverlayHistory(),this.observeKeyboardInset(),this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=this.searchTerm),this.updateFullscreenSearchClear(),this.options.fullscreenAutofocus?(e=this.fullscreenSearchInput)==null||e.focus():this.input.blur()}exitFullscreen(){this.unobserveKeyboardInset(),this.popOverlayHistory(),this.dropdown.classList.remove("ms__dropdown--fullscreen"),this.fullscreenHeader&&(this.fullscreenHeader.remove(),this.fullscreenHeader=null,this.fullscreenSearchInput=null,this.fullscreenSearchClear=null,this.fullscreenModeToggle=null,this.fullscreenNav=null,this.fullscreenNavCount=null,this.fullscreenNavPrev=null,this.fullscreenNavNext=null),this.unlockBodyScroll(),this.releaseDocumentOverflowX()}pushOverlayHistory(){this.overlayHistoryActive||typeof history>"u"||typeof window>"u"||(this.overlayHistoryActive=!0,history.pushState({msOverlay:this.instanceId},""),window.addEventListener("popstate",this.onOverlayPopstate))}handleOverlayPopstate(){this.overlayHistoryActive&&(this.overlayHistoryActive=!1,window.removeEventListener("popstate",this.onOverlayPopstate),h(this,V)?this.close():this.showSelectedPopover&&this.hideSelectedPopover())}popOverlayHistory(){this.overlayHistoryActive&&(this.overlayHistoryActive=!1,window.removeEventListener("popstate",this.onOverlayPopstate),history.back())}buildFullscreenHeader(){if(this.fullscreenHeader)return;const e=document.createElement("div");if(e.className="ms__fullscreen-header",this.options.isSearchEnabled&&this.options.searchInputMode!=="hidden"){const o=document.createElement("div");if(o.className="ms__fullscreen-search-wrapper",this.options.isSearchModeToggleShown){const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-mode-toggle",r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>this.toggleSearchModeLive()),o.appendChild(r),this.fullscreenModeToggle=r}const i=document.createElement("input");if(i.type="text",i.className="ms__fullscreen-search",i.placeholder=this.getPlaceholderText(),i.autocomplete="off",this.options.searchInputMode==="readonly"&&(i.readOnly=!0),i.addEventListener("input",r=>{const n=r.target.value;this.input.value=n,this.handleSearch(n),this.updateFullscreenSearchClear()}),i.addEventListener("keydown",r=>this.handleKeydown(r)),o.appendChild(i),this.fullscreenSearchInput=i,this.options.searchInputMode!=="readonly"){const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-search-clear",r.setAttribute("aria-label","Clear search"),r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>this.clearFullscreenSearch()),o.appendChild(r),this.fullscreenSearchClear=r}e.appendChild(o)}const t=document.createElement("button");t.type="button",t.className="ms__fullscreen-close",t.setAttribute("aria-label","Close"),t.addEventListener("click",()=>this.close()),e.appendChild(t),this.dropdown.insertBefore(e,this.dropdownInner),this.fullscreenHeader=e,this.options.isSearchEnabled&&(this.options.searchMode||"filter")==="navigate"&&this.ensureFullscreenNav(),this.updateFullscreenModeToggle(),this.updateFullscreenNav(),this.updateFullscreenSearchClear()}ensureFullscreenNav(){if(this.fullscreenNav||!this.fullscreenHeader)return;const e=document.createElement("div");e.className="ms__fullscreen-nav";const t=document.createElement("span");t.className="ms__fullscreen-nav-count",e.appendChild(t);const o=document.createElement("div");o.className="ms__fullscreen-nav-controls";const i=document.createElement("button");i.type="button",i.className="ms__fullscreen-nav-btn ms__fullscreen-nav-btn--prev",i.setAttribute("aria-label","Previous match"),i.addEventListener("click",()=>this.focusPreviousMatch());const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-nav-btn ms__fullscreen-nav-btn--next",r.setAttribute("aria-label","Next match"),r.addEventListener("click",()=>this.focusNextMatch()),o.appendChild(i),o.appendChild(r),e.appendChild(o),this.fullscreenHeader.appendChild(e),this.fullscreenNav=e,this.fullscreenNavCount=t,this.fullscreenNavPrev=i,this.fullscreenNavNext=r}removeFullscreenNav(){this.fullscreenNav&&(this.fullscreenNav.remove(),this.fullscreenNav=null,this.fullscreenNavCount=null,this.fullscreenNavPrev=null,this.fullscreenNavNext=null)}toggleSearchModeLive(){const e=(this.options.searchMode||"filter")==="navigate"?"filter":"navigate";this.setSearchModeLive(e)}setSearchModeLive(e){var t;(this.options.searchMode||"filter")!==e&&(this.options.searchMode=e,e==="navigate"?this.ensureFullscreenNav():this.removeFullscreenNav(),this.updateFullscreenModeToggle(),this.refreshSearchPlaceholder(),this.handleSearch(this.searchTerm),(t=this.fullscreenSearchInput)==null||t.focus())}updateFullscreenModeToggle(){if(!this.fullscreenModeToggle)return;const e=this.options.searchMode||"filter";this.fullscreenModeToggle.dataset.mode=e;const t=e==="navigate"?"filter":"navigate";this.fullscreenModeToggle.setAttribute("aria-label",`Switch to ${t} mode`),this.fullscreenModeToggle.setAttribute("title",`Switch to ${t} mode`),this.fullscreenModeToggle.setAttribute("aria-pressed",String(e==="navigate"))}updateFullscreenNav(){if(!this.fullscreenNav)return;const e=this.matchingIndices.size,t=!!this.searchTerm;if(this.fullscreenNav.style.display=t?"":"none",this.fullscreenNavCount)if(e===0)this.fullscreenNavCount.textContent=this.options.emptyMessage||"No matches";else{const r=Array.from(this.matchingIndices).sort((n,a)=>n-a).indexOf(this.focusedIndex);this.fullscreenNavCount.textContent=r>=0?`${r+1} of ${e}`:`${e} match${e===1?"":"es"}`}const o=e===0;this.fullscreenNavPrev&&(this.fullscreenNavPrev.disabled=o),this.fullscreenNavNext&&(this.fullscreenNavNext.disabled=o)}updateFullscreenSearchClear(){if(!this.fullscreenSearchClear)return;const e=!!(this.fullscreenSearchInput&&this.fullscreenSearchInput.value);this.fullscreenSearchClear.style.display=e?"":"none"}clearFullscreenSearch(){var e;this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.input.value="",this.handleSearch(""),this.updateFullscreenSearchClear(),(e=this.fullscreenSearchInput)==null||e.focus()}positionHint(){if(!this.hint)return;this.hintCleanup&&this.hintCleanup();let e="top-start";this.dropdownPlacement&&(this.dropdownPlacement.startsWith("bottom")?e=this.dropdownPlacement.replace("bottom","top"):this.dropdownPlacement.startsWith("top")&&(e=this.dropdownPlacement.replace("top","bottom")));const t=at(this.hint,this.inputWrapper,{strategy:"fixed",placement:e,offset:4,shift:8,flip:!1});this.hintCleanup=()=>t.destroy()}parseInitialSelection(){const e=this.element.dataset.initialValues;if(e)try{JSON.parse(e).forEach(o=>{this.selectedValues.add(String(o))}),this.reconcileSelectedOptions(),this.renderBadges()}catch(t){G.error(`[${this.instanceId}] Failed to parse initial values:`,t)}}reconcileSelectedOptions(){this.selectedValues.size===0||this.allOptions.length===0||this.selectedValues.forEach(e=>{if(this.selectedOptions.has(e))return;const t=this.allOptions.find(o=>String(this.getItemValue(o))===e);t&&this.selectedOptions.set(e,t)})}toggleSelectedPopover(){this.showSelectedPopover?this.hideSelectedPopover():this.showPopover()}showPopover(){if(Y.debug(`[${this.instanceId}] showPopover() called`),!this.options.isSelectedPopoverEnabled){Y.debug(`[${this.instanceId}] showPopover() suppressed (isSelectedPopoverEnabled=false)`);return}h(this,V)&&this.close(),this.hideMessage(),this.showSelectedPopover=!0,this.renderSelectedPopover(),this.selectedPopover.classList.add("ms__selected-popover--visible");const e=this.options.virtualScrollThreshold??100;this.selectedValues.size>=e&&this.selectedPopover.classList.add("ms__selected-popover--virtual"),this.presentationMode==="fullscreen"?(this.selectedPopover.classList.add("ms__selected-popover--fullscreen"),this.lockBodyScroll(),this.clampDocumentOverflowX(),this.pushOverlayHistory()):this.positionSelectedPopover()}hideSelectedPopover(){var e;Y.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.selectedPopover.classList.remove("ms__selected-popover--fullscreen"),this.unlockBodyScroll(),this.releaseDocumentOverflowX(),this.popOverlayHistory(),this.hideMessage(),this.selectedPopoverPlacement=null,this.selectedPopoverVirtualScroll&&(this.selectedPopoverVirtualScroll.destroy(),this.selectedPopoverVirtualScroll=null,this.selectedPopoverContainer=null),this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null);for(const t of Array.from(this.tooltips.keys()))t.startsWith("popover-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}renderSelectedPopover(){const e=this.getOrderedSelectedOptions(),t=this.selectedValues.size,o=this.options.virtualScrollThreshold??100;if(t>=o){this.renderSelectedPopoverVirtual(e,t);return}this.selectedPopover.innerHTML=`
|
|
17
|
+
`}else this.badgesContainer.innerHTML="";this.attachBadgeTooltips()}attachEvents(){this.input.addEventListener("mousedown",e=>{e.stopPropagation(),h(this,V)?(this.justClosedViaClick=!0,this.close(),setTimeout(()=>{this.justClosedViaClick=!1},0)):(this.presentationMode==="fullscreen"&&e.preventDefault(),this.open())}),this.input.addEventListener("focus",()=>{!h(this,V)&&!this.justClosedViaClick&&this.open()}),this.input.addEventListener("input",e=>{const t=e.target.value;this.options.isSearchEnabled&&!h(this,V)&&this.open(),this.handleSearch(t)}),this.input.addEventListener("keydown",e=>this.handleKeydown(e)),this.documentClickHandler=e=>this.handleClickOutside(e),setTimeout(()=>{document.addEventListener("click",this.documentClickHandler)},0),this.overlayCoord=Ji(()=>this.close(),this.options.overlayGroup||void 0),this.documentKeydownHandler=e=>{e.key==="Escape"&&this.showSelectedPopover&&(e.preventDefault(),this.hideSelectedPopover())},document.addEventListener("keydown",this.documentKeydownHandler),this.dropdown.addEventListener("mousedown",e=>{if(this.presentationMode!=="fullscreen")return;e.target.closest(".ms__option")&&e.preventDefault()}),this.dropdown.addEventListener("touchmove",e=>{var t;this.presentationMode==="fullscreen"&&e.target.closest(".ms__options")&&((t=this.fullscreenSearchInput)==null||t.blur())},{passive:!0}),this.dropdown.addEventListener("click",e=>this.handleDropdownClick(e)),this.dropdownInner.addEventListener("wheel",e=>{if(this.virtualScroll)return;const t=e.currentTarget,o=t.scrollTop===0,i=t.scrollTop+t.clientHeight>=t.scrollHeight;(e.deltaY<0&&o||e.deltaY>0&&i)&&e.preventDefault(),e.stopPropagation()},{passive:!1}),this.badgesContainer.addEventListener("mousedown",e=>{e.target.closest('[data-action="show-selected"]')&&!this.showSelectedPopover&&e.stopPropagation()}),this.badgesContainer.addEventListener("click",e=>this.handleBadgeClick(e)),this.counter.addEventListener("mousedown",e=>{this.showSelectedPopover||e.stopPropagation()}),this.counter.addEventListener("click",e=>{e.stopPropagation(),this.toggleSelectedPopover()}),this.selectedPopover.addEventListener("click",e=>this.handleSelectedPopoverClick(e))}async handleSearch(e){if(this.searchTerm=e,this.addNewFocused=!1,!this.options.isSearchEnabled)return;let t=e;if(this.options.beforeSearchCallback){const o=this.options.beforeSearchCallback(e);if(o===null){G.debug(`[${this.instanceId}] beforeSearchCallback blocked search for term:`,e),this.abortInFlightSearch(),this.matchingIndices.clear(),this.isTreeMode()?(this.searchTerm="",this.rebuildTreeVisible()):this.filteredOptions=[...this.allOptions],this.renderDropdown();return}t=o,t!==e&&G.debug(`[${this.instanceId}] beforeSearchCallback transformed: "${e}" -> "${t}"`)}if(this.options.searchCallback){if(t.length<this.options.minSearchLength){this.abortInFlightSearch(),this.isLoading=!1,this.options.isKeepOptionsOnSearch?(this.isTreeMode()?this.rebuildTreeVisibleFromMatches(this.allOptions):this.filteredOptions=[...this.allOptions],G.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 o=this.options.searchDebounce||0;o>0?this.searchDebounceTimer=setTimeout(()=>{this.searchDebounceTimer=void 0,this.searchTerm===e&&this.performAsyncSearch(e,t)},o):await this.performAsyncSearch(e,t)}else{if(this.isTreeMode()){if((this.options.searchMode||"filter")==="navigate"){const o=this.rebuildTreeVisibleForNavigate();this.searchTerm.trim()?o>=0&&(this.focusedIndex=o):this.focusedIndex=-1,this.renderDropdown(),this.focusedIndex>=0&&this.scrollToFocused(),this.updateFullscreenNav();return}this.rebuildTreeVisible(),this.matchingIndices.clear(),this.focusedIndex=this.searchTerm.trim()&&this.filteredOptions.length>0?0:-1,this.renderDropdown();return}if(!t)this.filteredOptions=[...this.allOptions],this.matchingIndices.clear(),this.focusedIndex=-1;else{const o=this.options.searchMode||"filter",i=t.toLowerCase();if(o==="filter")this.filteredOptions=this.allOptions.filter(r=>this.getItemSearchValue(r).toLowerCase().includes(i)),this.matchingIndices.clear(),this.focusedIndex=this.filteredOptions.length>0?0:-1,G.debug(`[${this.instanceId}] Filter mode: ${this.filteredOptions.length} matches for "${t}"`);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,G.debug(`[${this.instanceId}] Navigate mode: ${this.matchingIndices.size} matches, jumped to index ${r}`)):G.debug(`[${this.instanceId}] Navigate mode: No matches found, keeping previous focus`)}}this.renderDropdown(),this.options.searchMode==="navigate"&&this.focusedIndex>=0&&this.scrollToFocused(),this.updateFullscreenNav()}}abortInFlightSearch(){this.searchAbortController&&(this.searchAbortController.abort(),this.searchAbortController=void 0)}async performAsyncSearch(e,t){this.abortInFlightSearch();const o=new AbortController;this.searchAbortController=o,this.isLoading=!0,this.renderDropdown(),G.debug(`[${this.instanceId}] Loading data for search term:`,t);try{const i=await this.options.searchCallback(t,o.signal);if(o.signal.aborted||this.searchTerm!==e)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(),this.repositionDropdown(),G.debug(`[${this.instanceId}] Loaded ${r.length} results`)}catch(i){if(o.signal.aborted)return;G.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(),this.repositionDropdown()}finally{this.searchAbortController===o&&(this.searchAbortController=void 0)}}handleKeydown(e){var t;if(!(this.options.keydownCallback&&this.options.keydownCallback({event:e,key:e.key,isOpen:h(this,V),presentation:this.presentationMode,searchTerm:this.searchTerm,focusedIndex:this.focusedIndex,focusedOption:(this.focusedIndex>=0?this.filteredOptions[this.focusedIndex]:null)??null,filteredOptions:this.filteredOptions,selectedValues:[...this.selectedValues],controller:this.getKeyboardController()})===!0)){if(!h(this,V)){(e.key==="Enter"||e.key==="ArrowDown")&&(e.preventDefault(),this.open());return}if(!this.options.isSearchEnabled){const o=e.key.length===1||e.key==="Backspace"||e.key==="Delete",i=["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key);if(o&&!i){e.preventDefault();return}}switch(e.key){case"ArrowDown":e.preventDefault(),this.isAddNewPromptShown()?this.focusAddNewPrompt():e.ctrlKey||e.metaKey?this.focusNextMatch():this.focusNext();break;case"ArrowUp":e.preventDefault(),this.isAddNewPromptShown()?this.focusAddNewPrompt():e.ctrlKey||e.metaKey?this.focusPreviousMatch():this.focusPrevious();break;case"Enter":e.preventDefault(),this.focusedIndex>=0?this.toggleOption(this.filteredOptions[this.focusedIndex]):this.options.isAddNewAllowed&&this.filteredOptions.length===0&&(this.searchTerm||"").trim()&&this.handleAddNew((this.searchTerm||"").trim()),this.presentationMode==="fullscreen"&&((t=this.fullscreenSearchInput)==null||t.blur());break;case"Escape":e.preventDefault(),this.showSelectedPopover?this.hideSelectedPopover():this.input.value?this.clearSearch():this.close();break;case"Tab":this.close();break;case"PageUp":e.preventDefault(),this.focusPageUp();break;case"PageDown":e.preventDefault(),this.focusPageDown();break;case"Home":case"End":{const o=e.target instanceof HTMLInputElement?e.target:null;let i;if(!o)i=!0;else if(o.selectionStart!==o.selectionEnd)i=!1;else{const r=o.selectionStart??0;i=e.key==="Home"?r===0:r===o.value.length}i&&(e.preventDefault(),e.key==="Home"?this.focusFirst():this.focusLast());break}}}}handleDropdownClick(e){var n,a,l;H.debug(`[${this.instanceId}] Dropdown clicked`,{target:e.target.className}),e.stopPropagation();const t=e.target.closest(".ms__option-info");if(t){e.preventDefault(),this.toggleLabelReveal(t);return}this.hideLabelReveal();const o=e.target.closest("[data-action]");if(o){e.preventDefault();const c=o.dataset.action;if(H.debug(`[${this.instanceId}] Action button clicked:`,c),c==="select-all")this.selectAll();else if(c==="clear-all")this.clearAll();else if(c==="add-new"){const d=(this.searchTerm||"").trim();d&&this.handleAddNew(d)}else if(c==="custom"){const d=parseInt(o.dataset.buttonIndex||"-1"),u=(n=this.options.actionButtons)==null?void 0:n[d];u!=null&&u.onClick&&u.onClick(this,this.buildActionContext(u))}return}const i=e.target.closest('.ms__group-label[data-group-select="cascade"]');if(i&&i.dataset.group){e.preventDefault(),H.debug(`[${this.instanceId}] Group header cascade toggle:`,i.dataset.group),this.toggleGroup(i.dataset.group),h(this,V)&&this.presentationMode!=="fullscreen"?this.input.focus():this.presentationMode==="fullscreen"&&((a=this.fullscreenSearchInput)==null||a.blur());return}const r=e.target.closest(".ms__option");if(r&&!r.classList.contains("ms__option--disabled")){e.preventDefault();const c=r.dataset.value,d=this.filteredOptions.findIndex(u=>String(this.getItemValue(u))===c);H.debug(`[${this.instanceId}] Option clicked:`,{value:c,optionIndex:d,closeOnSelect:this.options.isCloseOnSelect,placeholder:this.options.searchPlaceholder}),d>=0&&(this.focusedIndex=d,this.toggleOption(this.filteredOptions[d]),h(this,V)&&this.presentationMode!=="fullscreen"?this.input.focus():this.presentationMode==="fullscreen"&&((l=this.fullscreenSearchInput)==null||l.blur()))}}handleBadgeClick(e){var r;if(e.target.closest('[data-action="clear-count"]')){e.preventDefault(),e.stopPropagation(),H.debug(`[${this.instanceId}] Clear count button clicked`),this.clearAll();return}const o=e.target.closest('.ms__badge-remove, [data-action="remove"]');if(o){if(e.preventDefault(),e.stopPropagation(),o.dataset.action==="remove-hidden"){H.debug(`[${this.instanceId}] Remove hidden items button clicked`);const l=this.options.badgesMaxVisible||3;this.getOrderedSelectedOptions().slice(l).forEach(u=>this.interactiveDeselect(u));return}const n=o.dataset.value??((r=o.closest("[data-value]"))==null?void 0:r.dataset.value)??"",a=this.selectedOptions.get(n);a&&this.interactiveDeselect(a);return}if(e.target.closest('[data-action="show-selected"]')){e.preventDefault(),e.stopPropagation(),this.toggleSelectedPopover();return}}handleClickOutside(e){var i;const t=e.composedPath();if(this.showSelectedPopover&&!t.some(n=>n instanceof Node&&(this.selectedPopover.contains(n)||this.counter.contains(n)||n.closest&&n.closest('[data-action="show-selected"]')))){Y.debug(`[${this.instanceId}] Closing selected popover due to click outside`),this.hideSelectedPopover();return}if(!h(this,V)||this.justOpenedViaClick)return;const o=t.some(r=>r instanceof Node&&(this.element.contains(r)||this.dropdown.contains(r)||this.hint&&this.hint.contains(r)));H.debug(`[${this.instanceId}] handleClickOutside`,{target:e.target.className,targetTag:e.target.tagName,clickedInside:o,pathLength:t.length,firstInPath:(i=t[0])==null?void 0:i.tagName,elementContains:t.some(r=>r instanceof Node&&this.element.contains(r)),dropdownContains:t.some(r=>r instanceof Node&&this.dropdown.contains(r)),isConnected:this.dropdown.isConnected}),o||(H.warn(`[${this.instanceId}] Closing dropdown due to click outside`),this.close())}focusBy(e,t=1){const o=this.filteredOptions.length;if(o===0)return;const i=e(this.focusedIndex,o);if(i<0)return;const r=this.resolveSelectableIndex(i,t,o);r<0||(this.focusedIndex=r,this.renderDropdown(),this.scrollToFocused(),this.updateFullscreenNav())}resolveSelectableIndex(e,t,o){if(!this.isTreeMode())return e;let i=e;for(;i>=0&&i<o&&!this.isIndexSelectable(i);)i+=t;if(i<0||i>=o)for(i=e-t;i>=0&&i<o&&!this.isIndexSelectable(i);)i-=t;return i>=0&&i<o?i:-1}focusNext(){this.focusBy((e,t)=>Math.min(t-1,e+1),1)}focusPrevious(){this.focusBy(e=>Math.max(0,e-1),-1)}focusFirst(){this.focusBy(()=>0,1)}focusLast(){this.focusBy((e,t)=>t-1,-1)}focusPageUp(){this.focusBy(e=>Math.max(0,e-10),-1)}focusPageDown(){this.focusBy((e,t)=>Math.min(t-1,e+10),1)}focusAddNewPrompt(){this.addNewFocused||(this.addNewFocused=!0,this.renderDropdown())}focusNextMatch(){if(this.matchingIndices.size===0)return;const e=Array.from(this.matchingIndices).sort((i,r)=>i-r),t=e.findIndex(i=>i===this.focusedIndex),o=(t+1)%e.length;this.focusBy(()=>e[o]),H.debug(`[${this.instanceId}] Jumped to next match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}focusPreviousMatch(){if(this.matchingIndices.size===0)return;const e=Array.from(this.matchingIndices).sort((i,r)=>i-r),t=e.findIndex(i=>i===this.focusedIndex),o=t<=0?e.length-1:t-1;this.focusBy(()=>e[o]),H.debug(`[${this.instanceId}] Jumped to previous match: index ${this.focusedIndex} (${t+1} of ${e.length})`)}getKeyboardController(){return this.keyboardController?this.keyboardController:(this.keyboardController={getSelected:()=>this.getSelected(),getValue:()=>this.getValue(),getOptions:()=>this.allOptions,setSelected:(e,t)=>this.setSelected(e,t),selectAll:()=>this.selectAll(),clearAll:()=>this.clearAll(),toggle:()=>this.toggle(),search:e=>this.search(e),scrollToValue:e=>{this.scrollToValue(e)},scrollToGroup:e=>{this.scrollToGroup(e)},scrollToIndex:e=>{this.scrollToIndex(e)},showMessage:(e,t)=>this.showMessage(e,t),hideMessage:()=>this.hideMessage(),focusNext:()=>this.focusNext(),focusPrevious:()=>this.focusPrevious(),focusFirst:()=>this.focusFirst(),focusLast:()=>this.focusLast(),focusPageUp:()=>this.focusPageUp(),focusPageDown:()=>this.focusPageDown(),focusNextMatch:()=>this.focusNextMatch(),focusPreviousMatch:()=>this.focusPreviousMatch(),focusIndex:e=>this.focusBy(()=>e,1),toggleFocused:()=>{this.focusedIndex>=0&&this.toggleOption(this.filteredOptions[this.focusedIndex])},toggleValue:e=>{const t=this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},selectValue:e=>{if(this.selectedValues.has(String(e)))return;const t=this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},deselectValue:e=>{if(!this.selectedValues.has(String(e)))return;const t=this.selectedOptions.get(String(e))??this.allOptions.find(o=>String(this.getItemValue(o))===String(e));t&&this.toggleOption(t)},open:()=>this.open(),close:()=>this.close(),setSearch:e=>{this.input.value=e,this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=e),this.handleSearch(e)},clearSearch:()=>this.clearSearch()},this.keyboardController)}hostEl(){const e=this.element.getRootNode();return e instanceof ShadowRoot?e.host:this.element}buildActionContext(e){const t=this.getSelected();return{button:e,selectedValues:t.map(o=>this.getItemValue(o)),selectedOptions:t,options:this.allOptions,selectedCount:t.length,optionCount:this.allOptions.length,isOpen:this.isOpen,searchTerm:this.searchTerm,controller:this.getKeyboardController(),element:this.hostEl(),...he(this.presentationMode)}}clearSearch(){this.input.value="",this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.searchTerm="",this.resetVisibleToAll(),this.matchingIndices.clear(),this.focusedIndex=-1,this.renderDropdown(),this.updateFullscreenNav(),this.updateFullscreenSearchClear()}search(e){const t=e??"";this.input.value=t,this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=t),this.handleSearch(t),this.updateFullscreenSearchClear()}scrollToFocused(){if(this.virtualScroll&&this.focusedIndex>=0){this.virtualScroll.scrollToIndex(this.focusedIndex,"nearest");return}const e=this.dropdown.querySelector(".ms__option--focused");e&&this.applyScrollIntoView(e)}applyScrollIntoView(e,t){this.presentationMode==="fullscreen"?e.scrollIntoView({block:(t==null?void 0:t.block)??"center",behavior:"auto"}):e.scrollIntoView({block:(t==null?void 0:t.block)??"nearest",behavior:"smooth"})}scrollToIndex(e,t){const o=(t==null?void 0:t.block)??"start";return h(this,V)?e<0||e>=this.filteredOptions.length?(H.debug(`[${this.instanceId}] scrollToIndex(${e}) → false (out of range, ${this.filteredOptions.length} options)`),!1):(H.debug(`[${this.instanceId}] scrollToIndex(${e}, block=${o}) — virtual=${!!this.virtualScroll}, mode=${this.presentationMode}`),this.armClickGuard(),this.scrollToRenderedIndex(e,{block:o}),!0):(H.debug(`[${this.instanceId}] scrollToIndex(${e}) → false (closed)`),!1)}scrollToValue(e,t){const o=this.filteredOptions.findIndex(i=>String(this.getItemValue(i))===String(e));return H.debug(`[${this.instanceId}] scrollToValue(${String(e)}) → index ${o} of ${this.filteredOptions.length}`),o<0?!1:this.scrollToIndex(o,t)}scrollToGroup(e,t){const o=(t==null?void 0:t.block)??"start";if(!h(this,V)||this.isTreeMode())return H.debug(`[${this.instanceId}] scrollToGroup(${e}) → false (${this.isTreeMode()?"tree mode":"closed"})`),!1;if(this.armClickGuard(),!this.virtualScroll){const r=this.dropdown.querySelector(`.ms__group-label[data-group="${CSS.escape(e)}"]`);if(r)return H.debug(`[${this.instanceId}] scrollToGroup(${e}) — header found, scrolling label into view (block=${o})`),this.applyScrollIntoView(r,{block:o}),!0}const i=this.filteredOptions.findIndex(r=>(this.getItemGroup(r)||"")===e);return H.debug(`[${this.instanceId}] scrollToGroup(${e}) — no header (virtual=${!!this.virtualScroll}), first member index ${i}`),i<0?!1:this.scrollToIndex(i,{block:o})}scrollToRenderedIndex(e,t,o=!1){if(!h(this,V)||e<0||e>=this.filteredOptions.length)return;if(this.virtualScroll){const r=(t==null?void 0:t.block)==="center"?"center":(t==null?void 0:t.block)==="nearest"?"nearest":"start";this.virtualScroll.scrollToIndex(e,r),H.debug(`[${this.instanceId}] scrollToRenderedIndex(${e}) via virtual (block=${r})`);return}const i=this.dropdown.querySelector(`.ms__option[data-index="${e}"]`);if(i){this.applyScrollIntoView(i,t),H.debug(`[${this.instanceId}] scrollToRenderedIndex(${e}) via DOM scrollIntoView`);return}o||(H.debug(`[${this.instanceId}] scrollToRenderedIndex(${e}) not rendered yet — deferring one frame`),requestAnimationFrame(()=>this.scrollToRenderedIndex(e,t,!0)))}toggleOption(e){if(this.getItemDisabled(e)){H.debug(`[${this.instanceId}] toggleOption ignored — option is disabled`);return}if(!this.isOptionSelectable(e)){H.debug(`[${this.instanceId}] toggleOption ignored — node is not selectable`);return}const t=this.getItemValue(e),o=String(t);if(H.debug(`[${this.instanceId}] toggleOption called`,{value:t,multiple:this.options.isMultipleEnabled}),this.isCascadeMode()&&this.cascadeIndex){const n=this.cascadeIndex.nodeByValue.get(o);if(n){this.toggleTreeCascade(n),this.options.isCloseOnSelect&&this.close();return}}const i=this.selectedValues.has(o);if(i&&!this.options.isMultipleEnabled){this.close();return}(i?this.interactiveDeselect(e):this.interactiveSelect(e))&&(this.options.isMultipleEnabled?this.options.isCloseOnSelect&&this.close():this.close())}interactiveSelect(e){var o,i;const t=(i=(o=this.options).beforeSelectCallback)==null?void 0:i.call(o,e,this.getSelected());return t===!1||typeof t=="string"?(typeof t=="string"&&this.showMessage(t,{variant:"warning"}),H.debug(`[${this.instanceId}] Selection blocked by beforeSelectCallback`),!1):(this.options.isMultipleEnabled||(this.selectedValues.clear(),this.selectedOptions.clear()),this.selectOption(e),!0)}interactiveDeselect(e){var o,i;const t=(i=(o=this.options).beforeDeselectCallback)==null?void 0:i.call(o,e,this.getSelected());return t===!1||typeof t=="string"?(typeof t=="string"&&this.showMessage(t,{variant:"warning"}),H.debug(`[${this.instanceId}] Deselection blocked by beforeDeselectCallback`),!1):(this.deselectOption(e),!0)}async handleAddNew(e){var t,o;try{let i;if(this.options.addNewCallback){G.debug(`[${this.instanceId}] Adding new option:`,e),this.addNewFocused=!1,this.addNewPending=!0,this.renderDropdown();let r;try{r=await this.options.addNewCallback(e)}finally{this.addNewPending=!1}if(r==null){G.debug(`[${this.instanceId}] addNewCallback canceled creation for:`,e),this.renderDropdown();return}i=r,this.allOptions.push(i),this.searchTerm="",this.input.value="",this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.matchingIndices.clear(),this.focusedIndex=-1,this.addNewFocused=!1,this.resetVisibleToAll(),this.selectOption(i),this.updateFullscreenSearchClear()}(o=(t=this.options).onAddNew)==null||o.call(t,{value:e,option:i}),i&&this.options.isCloseOnSelect&&this.close()}catch(i){this.addNewPending=!1,G.error(`[${this.instanceId}] Error adding new option:`,i),this.renderDropdown()}}selectOption(e){const t=this.getItemValue(e),o=String(t);this.selectedValues.add(o),this.selectedOptions.set(o,e),this.commit({added:[e]})}deselectOption(e){const t=this.getItemValue(e),o=String(t);if(this.isCascadeMode()&&this.cascadeIndex){const i=this.cascadeIndex.nodeByValue.get(o);if(i){const r=this.cascadeIndex.atomsUnder.get(i.path)??[],n=new Set(dt(this.cascadeIndex,this.selectedValues));for(const a of r)n.delete(a);this.commitCascadeAtoms(n);return}}this.selectedValues.delete(o),this.selectedOptions.delete(o),this.commit({removed:[e]})}selectAll(){if(this.isCascadeMode()&&this.cascadeIndex){const t=this.cascadeIndex,o=new Set(dt(t,this.selectedValues));for(const i of this.treeNodes)t.atomPaths.has(i.path)&&(this.getItemDisabled(i.data)||o.add(String(this.getItemValue(i.data))));this.commitCascadeAtoms(o);return}const e=[];this.filteredOptions.forEach((t,o)=>{if(this.getItemDisabled(t)||!this.isIndexSelectable(o))return;const i=String(this.getItemValue(t));this.selectedValues.has(i)||(this.selectedValues.add(i),this.selectedOptions.set(i,t),e.push(t))}),this.commit({added:e})}clearAll(){const e=Array.from(this.selectedOptions.values());this.selectedValues.clear(),this.selectedOptions.clear(),this.commit({removed:e})}toggleGroup(e){const t=this.groupOptions(this.filteredOptions)[e];if(!(!t||t.length===0))if(this.groupCheckState(t)==="checked"){const o=[];for(const i of t){const r=String(this.getItemValue(i));this.selectedValues.delete(r)&&(this.selectedOptions.delete(r),o.push(i))}this.commit({removed:o})}else{const o=[];for(const i of t){if(this.getItemDisabled(i))continue;const r=String(this.getItemValue(i));this.selectedValues.has(r)||(this.selectedValues.add(r),this.selectedOptions.set(r,i),o.push(i))}this.commit({added:o})}}clearClick(){H.debug(`[${this.instanceId}] input clear (✕) clicked`),this.clearAll(),(this.searchTerm||this.input.value)&&this.clearSearch(),this.showSelectedPopover&&this.hideSelectedPopover(),this.justClosedViaClick=!0,this.input.focus(),setTimeout(()=>{this.justClosedViaClick=!1},0)}updateClearButton(){if(!this.clearButton)return;const e=!this.element.classList.contains("ms--disabled"),t=!!this.options.isClearShown&&this.selectedValues.size>0&&e;this.clearButton.style.display=t?"":"none"}commit(e){this.renderDropdown({preserveScroll:!0}),this.renderBadges(),this.updateHiddenInput();const t=e.added??[],o=e.removed??[];this.options.onSelect&&t.forEach(i=>this.options.onSelect(i)),this.options.onDeselect&&o.forEach(i=>this.options.onDeselect(i)),(t.length>0||o.length>0)&&this.options.onChange&&this.options.onChange(this.getSelected())}armClickGuard(){this.justOpenedViaClick=!0,setTimeout(()=>{this.justOpenedViaClick=!1},0)}open(){var e;Y.debug(`[${this.instanceId}] open() called`,{isOpen:h(this,V)}),this.armClickGuard(),!h(this,V)&&(this.hideMessage(),M(this,V,!0),this.element.classList.add("ms--open"),this.dropdown.classList.add("ms__dropdown--visible"),Y.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],Y.debug(`[${this.instanceId}] Showing ${this.allOptions.length} initial options on open`)),this.presentationMode==="fullscreen"&&this.enterFullscreen(),this.renderDropdown(),this.presentationMode!=="fullscreen"&&this.positionDropdown(),this.dropdown.addEventListener("scroll",this.onDropdownScroll,!0),this.hint&&this.presentationMode==="floating"&&(this.hint.classList.add("ms__hint--visible"),this.positionHint()),(e=this.overlayCoord)==null||e.activate())}close(){var e;Y.debug(`[${this.instanceId}] close() called`,{isOpen:h(this,V)}),h(this,V)&&(M(this,V,!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.dropdown.removeEventListener("scroll",this.onDropdownScroll,!0),this.destroyAllOptionTooltips(),this.hideLabelReveal(),this.hideMessage(),this.renderBadges(),this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.exitFullscreen(),this.dropdownPlacement=null,(e=this.overlayCoord)==null||e.deactivate(),Y.debug(`[${this.instanceId}] Dropdown closed`))}toggle(){h(this,V)?this.close():this.open()}get isOpen(){return h(this,V)}set isOpen(e){e?this.open():this.close()}anchorFloatingPanel(e,t){var r;const o=((r=t.isLocked)==null?void 0:r.call(t))??!0,i=at(e,this.inputWrapper,{strategy:"fixed",placement:"bottom-start",offset:4,shift:8,lockPlacement:o?"freeze":!1,fixedContainingBlock:!0,maxWidth:{padding:8},onDrift:n=>this.warnDrift(n),beforeCompute:()=>{(this.options.hostElement??this.element).style.setProperty("--ms-input-current-width",`${this.inputWrapper.offsetWidth}px`),this.options.dropdownMinWidth&&(e.style.minWidth=this.options.dropdownMinWidth)},onPlaced:n=>{var a;if(t.getPlacement()||t.setPlacement(n),t.applyMaxWidth&&this.options.dropdownMaxWidth){const l=e.style.maxWidth;e.style.maxWidth=l?`min(${this.options.dropdownMaxWidth}, ${l})`:this.options.dropdownMaxWidth}(a=t.afterPosition)==null||a.call(t)}});return()=>i.destroy()}warnDrift(e){this.positioningDriftWarned||(this.positioningDriftWarned=!0,console.warn(`[@keenmate/web-multiselect] Dropdown panel rendered ${e.driftX.toFixed(0)}px / ${e.driftY.toFixed(0)}px away from where the library positioned it. Most likely culprit: ${e.culpritDescription}`+(e.culpritCss?` (has ${e.culpritCss})`:"")+".\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."))}warnFullscreenContainingBlock(){if(this.fullscreenContainingBlockWarned||typeof window>"u")return;const e=hs(this.dropdown);if(e===window)return;this.fullscreenContainingBlockWarned=!0;const t=e,o=t.id?`#${t.id}`:"",i=t.classList.length?`.${Array.from(t.classList).join(".")}`:"",r=`<${t.tagName.toLowerCase()}${o}${i}>`,n=bo(t);console.warn(`[@keenmate/web-multiselect] Fullscreen overlay is anchored to an ancestor ${r}`+(n?` (has ${n})`:"")+` instead of the viewport, so it may not cover the screen (offset, clipped, or mis-sized).
|
|
18
|
+
An ancestor of <web-multiselect> establishes a fixed-positioning containing block (transform / perspective / filter / backdrop-filter / will-change). Fix on your side: move the component out of that ancestor's subtree, OR remove/replace that property. If neither is acceptable, please file an issue at https://github.com/keenmate/web-multiselect/issues with the ancestor's computed CSS.`)}repositionDropdown(){!h(this,V)||this.presentationMode==="fullscreen"||(this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.dropdownPlacement=null,this.positionDropdown())}positionDropdown(){this.presentationMode!=="fullscreen"&&(this.dropdownCleanup=this.anchorFloatingPanel(this.dropdown,{getPlacement:()=>this.dropdownPlacement,setPlacement:e=>{this.dropdownPlacement=e,Y.debug(`[${this.instanceId}] Locked dropdown placement:`,e)},isLocked:()=>!!this.options.isPlacementLocked,applyMaxWidth:!0,afterPosition:()=>{this.hint&&h(this,V)&&this.positionHint()}}))}setPresentation(e){e!==this.presentationMode&&(this.presentationMode=e,h(this,V)?e==="fullscreen"?(this.dropdownCleanup&&(this.dropdownCleanup(),this.dropdownCleanup=null),this.hintCleanup&&(this.hintCleanup(),this.hintCleanup=null),this.hint&&this.hint.classList.remove("ms__hint--visible"),this.dropdownPlacement=null,this.enterFullscreen(),this.renderDropdown()):(this.exitFullscreen(),this.renderDropdown(),this.positionDropdown(),this.hint&&(this.hint.classList.add("ms__hint--visible"),this.positionHint())):this.showSelectedPopover&&(e==="fullscreen"?(this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null),this.selectedPopoverPlacement=null,this.clearFloatingInlineGeometry(this.selectedPopover),this.selectedPopover.classList.add("ms__selected-popover--fullscreen"),this.lockBodyScroll()):(this.selectedPopover.classList.remove("ms__selected-popover--fullscreen"),this.unlockBodyScroll(),this.positionSelectedPopover())))}lockBodyScroll(){this.bodyScrollUnlock||(this.bodyScrollUnlock=Ki())}unlockBodyScroll(){this.bodyScrollUnlock&&(this.bodyScrollUnlock(),this.bodyScrollUnlock=null)}clampDocumentOverflowX(){if(this.overflowXClamp||typeof document>"u")return;const e=document.documentElement;this.overflowXClamp={html:e.style.overflowX},e.style.overflowX="hidden"}releaseDocumentOverflowX(){!this.overflowXClamp||typeof document>"u"||(document.documentElement.style.overflowX=this.overflowXClamp.html,this.overflowXClamp=null)}observeKeyboardInset(){this.keyboardInsetCleanup=Wi(this.dropdown)}unobserveKeyboardInset(){this.keyboardInsetCleanup&&(this.keyboardInsetCleanup(),this.keyboardInsetCleanup=null)}fullscreenScale(){if(this.presentationMode!=="fullscreen"||typeof getComputedStyle!="function")return 1;const e=this.options.hostElement??this.element,t=getComputedStyle(e),o=parseFloat(t.getPropertyValue("--ms-rem"))||10;return(parseFloat(t.getPropertyValue("--ms-fullscreen-rem"))||o*1.2)/o}scaledOptionHeight(){return Math.round((this.options.optionHeight??50)*this.fullscreenScale())}applyVirtualOptionsSizing(e){if(e.style.setProperty("--ms-option-height",`${this.scaledOptionHeight()}px`),this.presentationMode==="fullscreen")e.style.flex="1 1 0",e.style.minHeight="0",e.style.height="",e.style.maxHeight="";else{const t=this.options.maxHeight||"20rem";e.style.flex="",e.style.minHeight="",e.style.height=t,e.style.maxHeight=t}}scaledBadgeHeight(){const e=this.options.badgeHeight??36;return this.presentationMode!=="fullscreen"?e:Math.round(e*this.fullscreenScale()*1.2)}clearFloatingInlineGeometry(e){e.style.position="",e.style.left="",e.style.top="",e.style.right="",e.style.bottom="",e.style.transform="",e.style.maxWidth="",e.style.minWidth="",e.style.width=""}enterFullscreen(){var e;this.clearFloatingInlineGeometry(this.dropdown),this.dropdown.classList.add("ms__dropdown--fullscreen"),this.warnFullscreenContainingBlock(),this.buildFullscreenHeader(),this.lockBodyScroll(),this.clampDocumentOverflowX(),this.pushOverlayHistory(),this.observeKeyboardInset(),this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=this.searchTerm),this.updateFullscreenSearchClear(),this.options.fullscreenAutofocus?(e=this.fullscreenSearchInput)==null||e.focus():this.input.blur()}exitFullscreen(){this.unobserveKeyboardInset(),this.popOverlayHistory(),this.dropdown.classList.remove("ms__dropdown--fullscreen"),this.fullscreenHeader&&(this.fullscreenHeader.remove(),this.fullscreenHeader=null,this.fullscreenSearchInput=null,this.fullscreenSearchClear=null,this.fullscreenModeToggle=null,this.fullscreenNav=null,this.fullscreenNavCount=null,this.fullscreenNavPrev=null,this.fullscreenNavNext=null),this.unlockBodyScroll(),this.releaseDocumentOverflowX()}pushOverlayHistory(){this.overlayHistoryActive||typeof history>"u"||typeof window>"u"||(this.overlayHistoryActive=!0,history.pushState({msOverlay:this.instanceId},""),window.addEventListener("popstate",this.onOverlayPopstate))}handleOverlayPopstate(){this.overlayHistoryActive&&(this.overlayHistoryActive=!1,window.removeEventListener("popstate",this.onOverlayPopstate),h(this,V)?this.close():this.showSelectedPopover&&this.hideSelectedPopover())}popOverlayHistory(){this.overlayHistoryActive&&(this.overlayHistoryActive=!1,window.removeEventListener("popstate",this.onOverlayPopstate),history.back())}buildFullscreenHeader(){if(this.fullscreenHeader)return;const e=document.createElement("div");if(e.className="ms__fullscreen-header",this.options.isSearchEnabled&&this.options.searchInputMode!=="hidden"){const o=document.createElement("div");if(o.className="ms__fullscreen-search-wrapper",this.options.isSearchModeToggleShown){const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-mode-toggle",r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>this.toggleSearchModeLive()),o.appendChild(r),this.fullscreenModeToggle=r}const i=document.createElement("input");if(i.type="text",i.className="ms__fullscreen-search",i.placeholder=this.getPlaceholderText(),i.autocomplete="off",this.options.searchInputMode==="readonly"&&(i.readOnly=!0),i.addEventListener("input",r=>{const n=r.target.value;this.input.value=n,this.handleSearch(n),this.updateFullscreenSearchClear()}),i.addEventListener("keydown",r=>this.handleKeydown(r)),o.appendChild(i),this.fullscreenSearchInput=i,this.options.searchInputMode!=="readonly"){const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-search-clear",r.setAttribute("aria-label","Clear search"),r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>this.clearFullscreenSearch()),o.appendChild(r),this.fullscreenSearchClear=r}e.appendChild(o)}const t=document.createElement("button");t.type="button",t.className="ms__fullscreen-close",t.setAttribute("aria-label","Close"),t.addEventListener("click",()=>this.close()),e.appendChild(t),this.dropdown.insertBefore(e,this.dropdownInner),this.fullscreenHeader=e,this.options.isSearchEnabled&&(this.options.searchMode||"filter")==="navigate"&&this.ensureFullscreenNav(),this.updateFullscreenModeToggle(),this.updateFullscreenNav(),this.updateFullscreenSearchClear()}ensureFullscreenNav(){if(this.fullscreenNav||!this.fullscreenHeader)return;const e=document.createElement("div");e.className="ms__fullscreen-nav";const t=document.createElement("span");t.className="ms__fullscreen-nav-count",e.appendChild(t);const o=document.createElement("div");o.className="ms__fullscreen-nav-controls";const i=document.createElement("button");i.type="button",i.className="ms__fullscreen-nav-btn ms__fullscreen-nav-btn--prev",i.setAttribute("aria-label","Previous match"),i.addEventListener("click",()=>this.focusPreviousMatch());const r=document.createElement("button");r.type="button",r.className="ms__fullscreen-nav-btn ms__fullscreen-nav-btn--next",r.setAttribute("aria-label","Next match"),r.addEventListener("click",()=>this.focusNextMatch()),o.appendChild(i),o.appendChild(r),e.appendChild(o),this.fullscreenHeader.appendChild(e),this.fullscreenNav=e,this.fullscreenNavCount=t,this.fullscreenNavPrev=i,this.fullscreenNavNext=r}removeFullscreenNav(){this.fullscreenNav&&(this.fullscreenNav.remove(),this.fullscreenNav=null,this.fullscreenNavCount=null,this.fullscreenNavPrev=null,this.fullscreenNavNext=null)}toggleSearchModeLive(){const e=(this.options.searchMode||"filter")==="navigate"?"filter":"navigate";this.setSearchModeLive(e)}setSearchModeLive(e){var t;(this.options.searchMode||"filter")!==e&&(this.options.searchMode=e,e==="navigate"?this.ensureFullscreenNav():this.removeFullscreenNav(),this.updateFullscreenModeToggle(),this.refreshSearchPlaceholder(),this.handleSearch(this.searchTerm),(t=this.fullscreenSearchInput)==null||t.focus())}updateFullscreenModeToggle(){if(!this.fullscreenModeToggle)return;const e=this.options.searchMode||"filter";this.fullscreenModeToggle.dataset.mode=e;const t=e==="navigate"?"filter":"navigate";this.fullscreenModeToggle.setAttribute("aria-label",`Switch to ${t} mode`),this.fullscreenModeToggle.setAttribute("title",`Switch to ${t} mode`),this.fullscreenModeToggle.setAttribute("aria-pressed",String(e==="navigate"))}updateFullscreenNav(){if(!this.fullscreenNav)return;const e=this.matchingIndices.size,t=!!this.searchTerm;if(this.fullscreenNav.style.display=t?"":"none",this.fullscreenNavCount)if(e===0)this.fullscreenNavCount.textContent=this.options.emptyMessage||"No matches";else{const r=Array.from(this.matchingIndices).sort((n,a)=>n-a).indexOf(this.focusedIndex);this.fullscreenNavCount.textContent=r>=0?`${r+1} of ${e}`:`${e} match${e===1?"":"es"}`}const o=e===0;this.fullscreenNavPrev&&(this.fullscreenNavPrev.disabled=o),this.fullscreenNavNext&&(this.fullscreenNavNext.disabled=o)}updateFullscreenSearchClear(){if(!this.fullscreenSearchClear)return;const e=!!(this.fullscreenSearchInput&&this.fullscreenSearchInput.value);this.fullscreenSearchClear.style.display=e?"":"none"}clearFullscreenSearch(){var e;this.fullscreenSearchInput&&(this.fullscreenSearchInput.value=""),this.input.value="",this.handleSearch(""),this.updateFullscreenSearchClear(),(e=this.fullscreenSearchInput)==null||e.focus()}positionHint(){if(!this.hint)return;this.hintCleanup&&this.hintCleanup();let e="top-start";this.dropdownPlacement&&(this.dropdownPlacement.startsWith("bottom")?e=this.dropdownPlacement.replace("bottom","top"):this.dropdownPlacement.startsWith("top")&&(e=this.dropdownPlacement.replace("top","bottom")));const t=at(this.hint,this.inputWrapper,{strategy:"fixed",placement:e,offset:4,shift:8,flip:!1});this.hintCleanup=()=>t.destroy()}parseInitialSelection(){const e=this.element.dataset.initialValues;if(e)try{const t=JSON.parse(e);(this.options.isMultipleEnabled===!1?t.slice(0,1):t).forEach(i=>{this.selectedValues.add(String(i))}),this.reconcileSelectedOptions(),this.renderBadges()}catch(t){G.error(`[${this.instanceId}] Failed to parse initial values:`,t)}}reconcileSelectedOptions(){this.selectedValues.size===0||this.allOptions.length===0||this.selectedValues.forEach(e=>{if(this.selectedOptions.has(e))return;const t=this.allOptions.find(o=>String(this.getItemValue(o))===e);t&&this.selectedOptions.set(e,t)})}toggleSelectedPopover(){this.showSelectedPopover?this.hideSelectedPopover():this.showPopover()}showPopover(){if(Y.debug(`[${this.instanceId}] showPopover() called`),!this.options.isSelectedPopoverEnabled){Y.debug(`[${this.instanceId}] showPopover() suppressed (isSelectedPopoverEnabled=false)`);return}h(this,V)&&this.close(),this.hideMessage(),this.showSelectedPopover=!0,this.renderSelectedPopover(),this.selectedPopover.classList.add("ms__selected-popover--visible");const e=this.options.virtualScrollThreshold??100;this.selectedValues.size>=e&&this.selectedPopover.classList.add("ms__selected-popover--virtual"),this.presentationMode==="fullscreen"?(this.selectedPopover.classList.add("ms__selected-popover--fullscreen"),this.lockBodyScroll(),this.clampDocumentOverflowX(),this.pushOverlayHistory()):this.positionSelectedPopover()}hideSelectedPopover(){var e;Y.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.selectedPopover.classList.remove("ms__selected-popover--fullscreen"),this.unlockBodyScroll(),this.releaseDocumentOverflowX(),this.popOverlayHistory(),this.hideMessage(),this.selectedPopoverPlacement=null,this.selectedPopoverVirtualScroll&&(this.selectedPopoverVirtualScroll.destroy(),this.selectedPopoverVirtualScroll=null,this.selectedPopoverContainer=null),this.selectedPopoverCleanup&&(this.selectedPopoverCleanup(),this.selectedPopoverCleanup=null);for(const t of Array.from(this.tooltips.keys()))t.startsWith("popover-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}renderSelectedPopover(){const e=this.getOrderedSelectedOptions(),t=this.selectedValues.size,o=this.options.virtualScrollThreshold??100;if(t>=o){this.renderSelectedPopoverVirtual(e,t);return}this.selectedPopover.innerHTML=`
|
|
19
19
|
<div class="ms__selected-popover-header">
|
|
20
20
|
<span>Selected Items (${t})</span>
|
|
21
21
|
<button type="button" class="ms__selected-popover-close" aria-label="Close"></button>
|
|
@@ -29,17 +29,17 @@ An ancestor of <web-multiselect> establishes a fixed-positioning containing bloc
|
|
|
29
29
|
<button type="button" class="ms__selected-popover-close" aria-label="Close"></button>
|
|
30
30
|
</div>
|
|
31
31
|
<div class="ms__selected-popover-body ms__selected-popover-body--virtual" style="${l} overflow-y: auto; position: relative; --ms-badge-height-virtual: ${a}px;"></div>
|
|
32
|
-
`;this.selectedPopover.innerHTML=c,this.selectedPopoverContainer=this.selectedPopover.querySelector(".ms__selected-popover-body")}if(!this.selectedPopoverContainer)return;const o=this.scaledBadgeHeight(),i=Math.round(4*this.fullscreenScale()),r=o+i,n=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.selectedPopoverContainer&&(this.selectedPopoverVirtualScroll?this.selectedPopoverVirtualScroll.setItems(e):this.selectedPopoverVirtualScroll=new
|
|
32
|
+
`;this.selectedPopover.innerHTML=c,this.selectedPopoverContainer=this.selectedPopover.querySelector(".ms__selected-popover-body")}if(!this.selectedPopoverContainer)return;const o=this.scaledBadgeHeight(),i=Math.round(4*this.fullscreenScale()),r=o+i,n=this.options.virtualScrollBuffer??10;requestAnimationFrame(()=>{this.selectedPopoverContainer&&(this.selectedPopoverVirtualScroll?this.selectedPopoverVirtualScroll.setItems(e):this.selectedPopoverVirtualScroll=new yo({container:this.selectedPopoverContainer,itemHeight:r,items:e,renderItem:a=>this.renderBadgeHTML(a,{displayMode:this.options.badgesDisplayMode||"badges",isInPopover:!0}),bufferSize:n,onVisibleRangeChange:()=>{this.attachBadgeTooltips(this.selectedPopoverContainer)}}))})}toHtml(e){return e==null?"":typeof e=="string"?e:e.outerHTML}classSuffix(e){return(e==null?[]:Array.isArray(e)?e:[e]).filter(Boolean).join(" ")}badgeRenderContext(e){return{displayMode:this.options.badgesDisplayMode??"badges",isInPopover:e,...he(this.presentationMode)}}renderBadgeHTML(e,t){const o=this.getItemValue(e),i={...t,...he(this.presentationMode)};if(!t.isInPopover&&this.options.renderBadgeCallback){const d=this.toHtml(this.options.renderBadgeCallback(e,i));if(d.trim()!==""){const u=this.options.getBadgeClassCallback;let f="ms__badge ms__badge--custom";if(u){const p=this.classSuffix(u(e,i));p&&(f+=" "+p)}return`<div class="${f}" data-value="${o}">${d}</div>`}}let r;const n=t.isInPopover?this.options.renderSelectedItemContentCallback:void 0;n?r=this.toHtml(n(e,i)):this.options.renderBadgeContentCallback?r=this.toHtml(this.options.renderBadgeContentCallback(e,i)):r=this.getItemBadgeDisplayValue(e,i);const a=t.isInPopover?this.options.getSelectedItemClassCallback||this.options.getBadgeClassCallback:this.options.getBadgeClassCallback;let l="ms__badge";if(a){const d=this.classSuffix(a(e,i));d&&(l+=" "+d)}const c=this.getItemBadgeDisplayValue(e,i);return`
|
|
33
33
|
<div class="${l}">
|
|
34
34
|
<span class="ms__badge-text">${r}</span>
|
|
35
35
|
<button type="button" class="ms__badge-remove" data-value="${o}" aria-label="Remove ${c}"></button>
|
|
36
36
|
</div>
|
|
37
|
-
`}handleSelectedPopoverClick(e){if(e.stopPropagation(),e.target.closest(".ms__selected-popover-close")){e.preventDefault(),this.hideSelectedPopover();return}const o=e.target.closest(".ms__badge-remove");if(o){e.preventDefault();const i=o.dataset.value,r=this.selectedOptions.get(i);r&&this.interactiveDeselect(r)&&(this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.presentationMode!=="fullscreen"&&(this.selectedPopoverCleanup=this.anchorFloatingPanel(this.selectedPopover,{getPlacement:()=>this.selectedPopoverPlacement,setPlacement:e=>{this.selectedPopoverPlacement=e,Y.debug(`[${this.instanceId}] Locked popover placement:`,e)}}))}updateHiddenInput(){if(!this.options.formFieldId)return;this.hiddenInputs.forEach(i=>i.remove()),this.hiddenInputs=[];const e=this.options.valueFormat||"json",t=Array.from(this.selectedOptions.values()).map(i=>this.getItemValue(i)),o=this.options.hostElement||this.element;if(e==="array")t.forEach(i=>{const r=document.createElement("input");r.type="hidden",r.name=`${this.options.formFieldId}[]`,r.value=String(i),o.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(),o.appendChild(i),this.hiddenInputs.push(i)}}getFormValue(){const e=Array.from(this.selectedOptions.values()).map(o=>this.getItemValue(o));return this.options.getValueFormatCallback?this.options.getValueFormatCallback(e):(this.options.valueFormat||"json")==="csv"?e.join(","):JSON.stringify(e)}getSelected(){return Array.from(this.selectedOptions.values())}setSelected(e,t={}){this.selectedValues=new Set(e.map(o=>String(o))),this.selectedOptions.clear(),e.forEach(o=>{const i=String(o),r=this.allOptions.find(n=>String(this.getItemValue(n))===i);r&&this.selectedOptions.set(i,r)}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),t.notify&&this.options.onChange&&this.options.onChange(this.getSelected())}updateOptions(e){var n;const t=!!this.hint,o="searchHint"in e?!!e.searchHint:t;if(t!==o)return!1;Object.assign(this.options,e);const i="pathMember"in e||"getPathCallback"in e||"parentPathMember"in e||"levelMember"in e||"hasChildrenMember"in e||"treePathSeparator"in e||"isTreeEnabled"in e||"isSelectableMember"in e||"getIsSelectableCallback"in e;if("options"in e&&e.options!==void 0?(this.allOptions=e.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]),("checkboxMode"in e||"cascadeSelectPolicy"in e)&&!i&&!("options"in e)&&this.isTreeMode()&&(this.cascadeIndex=this.isCascadeMode()?
|
|
38
|
-
${
|
|
39
|
-
${
|
|
40
|
-
`;function
|
|
41
|
-
`:e==="\\t"?" ":e==="\\r"?"\r":"\\")}function vn(s){let e;try{e=JSON.parse(s)}catch(t){return{options:[],error:`data-options is not valid JSON: ${t.message}`}}return Array.isArray(e)?{options:e}:{options:[],error:"data-options JSON must be an array"}}function wn(s,e,t){return{options:s.split(t).flatMap(i=>i.split(e)).map(i=>i.trim()).filter(i=>i.length>0).map(i=>[i,i])}}function yn(s,e,t){const o=xn(s,e,t).filter(n=>!(n.length===1&&n[0].trim()===""));if(o.length<2)return{options:[],error:"data-options CSV needs a header row and at least one data row"};const i=o[0].map(n=>n.trim());return{options:o.slice(1).map(n=>{const a={};return i.forEach((l,c)=>{a[l]=(n[c]??"").trim()}),a})}}function xn(s,e,t){const o=[];let i=[],r="",n=!1;for(let a=0;a<s.length;){const l=s[a];if(n){l==='"'?s[a+1]==='"'?(r+='"',a+=2):(n=!1,a+=1):(r+=l,a+=1);continue}l==='"'?(n=!0,a+=1):s.startsWith(e,a)?(i.push(r),r="",a+=e.length):s.startsWith(t,a)?(i.push(r),o.push(i),i=[],r="",a+=t.length):(l==="\r"||(r+=l),a+=1)}return i.push(r),o.push(i),o}const Mo=`@layer variables,component,overrides;@layer variables{:host{display:block;--ms-rem: var(--base-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(#cbd5e1, #52525b));--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-toggle-icon-color: var(--ms-text-color-3);--ms-toggle-icon-color-open: var(--ms-text-color-3);--ms-toggle-icon-size: calc(1.6 * var(--ms-rem));--ms-toggle-rotate-closed: 90deg;--ms-toggle-rotate-open: -90deg;--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: color-mix(in srgb, var(--ms-badge-bg) 88%, var(--ms-badge-text-color) 12%);--ms-badge-bg-active: var(--ms-accent-color-light-hover);--ms-badge-text-bg-hover: color-mix(in srgb, var(--ms-badge-text-bg) 88%, var(--ms-badge-text-color) 12%);--ms-badge-text-color-hover: var(--ms-badge-text-color);--ms-badge-counter-border-color: var(--ms-border-color);--ms-badge-counter-text-bg: color-mix(in srgb, var(--ms-text-color-1) 10%, transparent);--ms-badge-counter-text-bg-hover: color-mix(in srgb, var(--ms-text-color-1) 16%, transparent);--ms-badge-counter-text-color: var(--ms-text-color-1);--ms-badge-counter-text-color-hover: var(--ms-text-color-1);--ms-badge-counter-remove-bg: color-mix(in srgb, var(--ms-text-color-1) 10%, transparent);--ms-badge-counter-remove-bg-hover: color-mix(in srgb, var(--ms-text-color-1) 16%, transparent);--ms-badge-counter-remove-color: var(--ms-text-color-3);--ms-badge-counter-remove-color-hover: var(--ms-text-color-1);--ms-counter-wrapper-border-color: var(--ms-border-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-input-padding-h: calc(1.2 * var(--ms-rem));--ms-input-gap: calc(.6 * 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: var(--base-input-bg-disabled, rgba(107, 114, 128, .05));--ms-toggle-color: var(--ms-text-color-3);--ms-transform-rotate-180: 180deg;--ms-input-clear-size: calc(2.4 * var(--ms-rem));--ms-input-clear-icon-size: calc(1.4 * var(--ms-rem));--ms-input-clear-color: var(--base-input-clear-color, var(--ms-text-secondary));--ms-input-clear-bg-hover: var(--base-input-clear-bg-hover, var(--ms-option-bg-matched, transparent));--ms-input-clear-border-radius: var(--ms-border-radius);--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-inner-border-radius: max(0px, calc(var(--ms-dropdown-border-radius) - 1px));--ms-dropdown-box-shadow: var(--base-dropdown-box-shadow, 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1));--ms-input-current-width: auto;--ms-dropdown-width: var(--ms-input-current-width);--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-z-index-fullscreen: 10001;--ms-z-index-fullscreen-tooltip: 10002;--ms-fullscreen-rem: 12px;--ms-fullscreen-bg: var(--ms-dropdown-bg);--ms-fullscreen-text-color: var(--ms-dropdown-text-color);--ms-fullscreen-header-bg: var(--ms-dropdown-bg);--ms-fullscreen-header-border: 1px solid var(--ms-dropdown-border-color);--ms-fullscreen-header-gap: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding-v: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding-h: calc(1.2 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding: var(--ms-fullscreen-header-padding-v) var(--ms-fullscreen-header-padding-h);--ms-fullscreen-header-min-height: calc(5.6 * var(--ms-fullscreen-rem));--ms-fullscreen-title-font-size: calc(1.7 * var(--ms-fullscreen-rem));--ms-fullscreen-title-font-weight: var(--base-font-weight-semibold, 600);--ms-fullscreen-search-border: var(--ms-input-border);--ms-fullscreen-search-border-radius: var(--ms-input-border-radius);--ms-fullscreen-search-padding: calc(.8 * var(--ms-fullscreen-rem)) calc(1.2 * var(--ms-fullscreen-rem));--ms-fullscreen-search-font-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-icon-size: calc(1.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-inset: calc(.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-gutter: calc(3.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-search-clear-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-mode-toggle-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-mode-toggle-icon-size: calc(1.5 * var(--ms-fullscreen-rem));--ms-fullscreen-mode-toggle-gap: var(--ms-fullscreen-header-gap);--ms-fullscreen-mode-toggle-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-mode-toggle-bg: transparent;--ms-fullscreen-mode-toggle-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-close-size: calc(3.6 * var(--ms-fullscreen-rem));--ms-fullscreen-close-icon-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-close-color: var(--ms-dropdown-text-color);--ms-fullscreen-close-bg: transparent;--ms-fullscreen-close-border: none;--ms-fullscreen-close-border-radius: 50%;--ms-fullscreen-close-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-close-edge-nudge: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-icon-size: calc(1.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-color: var(--ms-accent-color);--ms-fullscreen-info-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-nav-gap: calc(.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-padding-top: calc(.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-count-font-size: calc(1.3 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-count-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-nav-btn-size: calc(3.2 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-btn-icon-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-btn-color: var(--ms-dropdown-text-color);--ms-fullscreen-nav-btn-bg: var(--ms-option-bg-matched, transparent);--ms-fullscreen-nav-btn-bg-hover: color-mix(in srgb, var(--ms-accent-color) 22%, transparent);--ms-fullscreen-nav-btn-icon: var(--ms-icon-chevron);--ms-icon-chevron: var(--base-icon-chevron, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m9 18 6-6-6-6'/></svg>"));--ms-icon-info: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/><circle cx='12' cy='7.5' r='1.3' fill='black'/><path d='M12 11v6' stroke='black' stroke-width='2' stroke-linecap='round' fill='none'/></svg>");--ms-fullscreen-tree-base-indent: calc(.7 * var(--ms-fullscreen-rem));--ms-fullscreen-tree-indent: calc(1.2 * var(--ms-fullscreen-rem));--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: 0;--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-add-new-padding: var(--ms-option-padding);--ms-add-new-gap: var(--ms-option-gap);--ms-add-new-font-size: var(--ms-empty-font-size);--ms-add-new-color: var(--ms-accent-color);--ms-add-new-color-hover: var(--ms-accent-color);--ms-add-new-bg-hover: var(--ms-option-bg-hover);--ms-add-new-icon-size: calc(1.6 * var(--ms-rem));--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.4 * var(--ms-rem));--ms-icon-remove: var(--base-icon-remove, var(--base-icon-close, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M18 6 6 18'/><path d='m6 6 12 12'/></svg>")));--ms-icon-search-clear: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m13.5 8.5-5 5'/><path d='m8.5 8.5 5 5'/><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");--ms-icon-search: var(--base-icon-search, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>"));--ms-icon-filter: var(--base-icon-filter, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3'/></svg>"));--ms-icon-check: var(--base-icon-check, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>"));--ms-icon-indeterminate: var(--base-icon-indeterminate, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14'/></svg>"));--ms-icon-check-size: var(--base-icon-check-size, 68%);--ms-icon-add-new: var(--base-icon-plus, var(--base-icon-add, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14'/><path d='M12 5v14'/></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: var(--ms-accent-color);--ms-count-clear-color-hover: var(--ms-text-color-on-accent);--ms-count-clear-icon-size: calc(1.4 * var(--ms-rem));--ms-icon-clear: var(--base-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-message-bg: var(--ms-message-info-bg);--ms-message-color: var(--ms-message-info-color);--ms-message-border: 1px solid transparent;--ms-message-border-radius: var(--ms-border-radius-lg);--ms-message-padding: calc(1 * var(--ms-rem)) calc(1.4 * var(--ms-rem));--ms-message-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-message-font-weight: var(--base-font-weight-medium, 500);--ms-message-max-width: calc(40 * var(--ms-rem));--ms-message-shadow: 0 4px 16px rgb(0 0 0 / .18);--ms-message-fullscreen-offset: calc(2.4 * var(--ms-fullscreen-rem));--ms-message-z-index: var(--ms-z-index-fullscreen-tooltip);--ms-message-info-bg: var(--ms-tooltip-bg);--ms-message-info-color: var(--ms-tooltip-text-color);--ms-message-warning-bg: var(--base-warning-bg, #f59e0b);--ms-message-warning-color: var(--base-warning-color, #1a1a1a);--ms-message-error-bg: var(--base-danger-bg, #ef4444);--ms-message-error-color: var(--base-danger-color, #ffffff);--ms-message-success-bg: var(--base-success-bg, #10b981);--ms-message-success-color: var(--base-success-color, #ffffff);--ms-z-index-popover: 10000;--ms-selected-popover-width: var(--ms-input-current-width);--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: var(--ms-accent-color);--ms-selected-popover-close-color-hover: var(--ms-text-color-on-accent);--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: var(--base-ease-standard, 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}:host([defer]:not([is-ready])){display:block;min-height:calc(3.5 * var(--ms-rem))}:host{-webkit-tap-highlight-color: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{box-sizing:border-box;position:relative;display:flex;align-items:center;gap:var(--ms-input-gap);height:var(--ms-input-height);padding-inline:var(--ms-input-padding-h);background:var(--ms-input-bg);color:var(--ms-input-color);border:var(--ms-input-border);border-radius:var(--ms-input-border-radius);cursor:pointer;transition:border var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__input-wrapper:hover:not(:focus-within){border:var(--ms-input-border-hover)}.ms__input-wrapper:focus-within{border:var(--ms-input-border-focus)}.ms__input{flex:1 1 auto;min-width:0;box-sizing:border-box;font-family:inherit;height:100%;padding:0;border:none;background:transparent;font-size:var(--ms-input-font-size);color:var(--ms-input-color);cursor:pointer;outline:none}.ms__input::placeholder{color:var(--ms-input-placeholder-color);opacity:0;transition:opacity var(--ms-transition-fast) var(--ms-easing-snappy)}:host([data-placeholder-ready]) .ms__input::placeholder{opacity:var(--ms-placeholder-opacity)}.ms__toggle{flex:0 0 auto;display:block;width:var(--ms-toggle-icon-size);height:var(--ms-toggle-icon-size);color:var(--ms-toggle-icon-color);cursor:pointer}.ms__toggle:before{content:"";display:block;width:100%;height:100%;background-color:currentColor;-webkit-mask:var(--ms-icon-chevron) center / contain no-repeat;mask:var(--ms-icon-chevron) center / contain no-repeat;transform:rotate(var(--ms-toggle-rotate-closed, 90deg));transition:transform var(--ms-transition-fast) var(--ms-easing-snappy)}.ms--open .ms__toggle{color:var(--ms-toggle-icon-color-open)}.ms--open .ms__toggle:before{transform:rotate(var(--ms-toggle-rotate-open, -90deg))}.ms__counter{flex:0 0 auto;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:scale(var(--ms-transform-scale-hover))}.ms__input-clear{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-input-clear-size);height:var(--ms-input-clear-size);padding:0;color:var(--ms-input-clear-color);background:transparent;border:none;border-radius:var(--ms-input-clear-border-radius);cursor:pointer;transition:background var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__input-clear:hover{background:var(--ms-input-clear-bg-hover)}.ms__input-clear:before{content:"";display:block;width:var(--ms-input-clear-icon-size);height:var(--ms-input-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}.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)}@media (hover: hover){.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;box-sizing:border-box;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);width:var(--ms-dropdown-width);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--fullscreen,.ms__selected-popover--fullscreen{--ms-rem: var(--ms-fullscreen-rem);--ms-option-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-option-gap: calc(.8 * var(--ms-rem));--ms-option-title-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-option-subtitle-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-option-icon-font-size: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-checkbox-size: calc(1.6 * var(--ms-rem));--ms-group-label-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-group-label-padding: calc(.4 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-tree-base-indent: var(--ms-fullscreen-tree-base-indent);--ms-tree-indent: var(--ms-fullscreen-tree-indent)}.ms__selected-popover--fullscreen{--ms-badge-gap: calc(.8 * var(--ms-rem));--ms-badge-height: calc(4.2 * var(--ms-rem));--ms-badge-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-badge-text-padding: 0 calc(1.2 * var(--ms-rem));--ms-badge-remove-width: calc(3.6 * var(--ms-rem));--ms-badge-remove-icon-size: calc(1.2 * var(--ms-rem));--ms-badge-remove-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem))}.ms__dropdown--fullscreen{--ms-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-action-btn-padding: calc(.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-action-btn-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem))}.ms__dropdown--fullscreen{position:fixed;top:0;inset-inline-start:0;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:none;border-radius:0;--ms-dropdown-inner-border-radius: 0;background:var(--ms-fullscreen-bg);color:var(--ms-fullscreen-text-color);z-index:var(--ms-z-index-fullscreen);box-sizing:border-box;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.ms__dropdown--fullscreen .ms__dropdown-inner{display:flex;flex-direction:column;flex:1;min-height:0;max-height:none;overflow:hidden}.ms__dropdown--fullscreen .ms__options{flex:1 1 0;min-height:0;height:auto;max-height:none;overflow-y:auto;padding-bottom:var(--ms-option-gap)}.ms__dropdown--fullscreen .ms__actions{flex:0 0 auto}.ms__fullscreen-header,.ms__selected-popover--fullscreen .ms__selected-popover-header{flex:0 0 auto;display:flex;align-items:center;flex-wrap:wrap;gap:var(--ms-fullscreen-header-gap);min-height:var(--ms-fullscreen-header-min-height);padding:var(--ms-fullscreen-header-padding);background:var(--ms-fullscreen-header-bg);border-bottom:var(--ms-fullscreen-header-border)}.ms__fullscreen-header{align-content:flex-start}.ms__fullscreen-header>.ms__fullscreen-search-wrapper{min-height:var(--ms-fullscreen-header-min-height)}.ms__fullscreen-nav{flex:0 0 100%;display:flex;align-items:center;justify-content:space-between;gap:var(--ms-fullscreen-nav-gap);padding-top:var(--ms-fullscreen-nav-padding-top)}.ms__fullscreen-nav-count{font-size:var(--ms-fullscreen-nav-count-font-size);color:var(--ms-fullscreen-nav-count-color)}.ms__fullscreen-nav-controls{display:flex;align-items:center;gap:var(--ms-fullscreen-nav-gap)}.ms__fullscreen-nav-btn{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-nav-btn-size);height:var(--ms-fullscreen-nav-btn-size);padding:0;color:var(--ms-fullscreen-nav-btn-color);background:var(--ms-fullscreen-nav-btn-bg);border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-nav-btn:hover:not(:disabled){background:var(--ms-fullscreen-nav-btn-bg-hover)}.ms__fullscreen-nav-btn:disabled{opacity:.4;cursor:default}.ms__fullscreen-nav-btn:before{content:"";display:block;width:var(--ms-fullscreen-nav-btn-icon-size);height:var(--ms-fullscreen-nav-btn-icon-size);background-color:currentColor;-webkit-mask:var(--ms-fullscreen-nav-btn-icon) center / contain no-repeat;mask:var(--ms-fullscreen-nav-btn-icon) center / contain no-repeat;transform:rotate(-90deg)}.ms__fullscreen-nav-btn--next:before{transform:rotate(90deg)}.ms__fullscreen-header>.ms__fullscreen-search-wrapper,.ms__selected-popover--fullscreen .ms__selected-popover-header>span{flex:1 1 0;min-width:0}.ms__fullscreen-search-wrapper{position:relative;display:flex;align-items:center}.ms__selected-popover--fullscreen .ms__selected-popover-header{font-size:var(--ms-fullscreen-title-font-size);font-weight:var(--ms-fullscreen-title-font-weight);color:var(--ms-fullscreen-text-color)}.ms__fullscreen-search{flex:1 1 auto;min-width:0;font-family:inherit;font-size:var(--ms-fullscreen-search-font-size);color:inherit;background:transparent;border:var(--ms-fullscreen-search-border);border-radius:var(--ms-fullscreen-search-border-radius);padding:var(--ms-fullscreen-search-padding);padding-inline-end:var(--ms-fullscreen-search-clear-gutter)}.ms__fullscreen-search:focus{outline:none;border:var(--ms-input-border-focus)}.ms__fullscreen-search-clear{position:absolute;inset-inline-end:var(--ms-fullscreen-search-clear-inset);top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-search-clear-size);height:var(--ms-fullscreen-search-clear-size);padding:0;color:var(--ms-fullscreen-search-clear-color);background:transparent;border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-search-clear:hover{background:var(--ms-fullscreen-search-clear-bg-hover)}.ms__fullscreen-search-clear:before{content:"";display:block;width:var(--ms-fullscreen-search-clear-icon-size);height:var(--ms-fullscreen-search-clear-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-search-clear) center / contain no-repeat;mask:var(--ms-icon-search-clear) center / contain no-repeat}.ms__fullscreen-mode-toggle{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-mode-toggle-size);height:var(--ms-fullscreen-mode-toggle-size);margin-inline-end:var(--ms-fullscreen-mode-toggle-gap);margin-inline-start:calc((var(--ms-fullscreen-close-size) - var(--ms-fullscreen-mode-toggle-size)) / 2 - var(--ms-fullscreen-close-edge-nudge));padding:0;color:var(--ms-fullscreen-mode-toggle-color);background:var(--ms-fullscreen-mode-toggle-bg);border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-mode-toggle:hover{background:var(--ms-fullscreen-mode-toggle-bg-hover)}.ms__fullscreen-mode-toggle:before{content:"";display:block;width:var(--ms-fullscreen-mode-toggle-icon-size);height:var(--ms-fullscreen-mode-toggle-icon-size);background-color:currentColor;-webkit-mask:var(--ms-fullscreen-mode-toggle-icon, var(--ms-icon-search)) center / contain no-repeat;mask:var(--ms-fullscreen-mode-toggle-icon, var(--ms-icon-search)) center / contain no-repeat}.ms__fullscreen-mode-toggle[data-mode=navigate]{--ms-fullscreen-mode-toggle-icon: var(--ms-icon-search)}.ms__fullscreen-mode-toggle[data-mode=filter]{--ms-fullscreen-mode-toggle-icon: var(--ms-icon-filter)}.ms__fullscreen-close,.ms__selected-popover--fullscreen .ms__selected-popover-close{flex:0 0 auto;position:relative;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-close-size);height:var(--ms-fullscreen-close-size);margin-inline-end:calc(-1 * var(--ms-fullscreen-close-edge-nudge));padding:0;color:var(--ms-fullscreen-close-color);background:var(--ms-fullscreen-close-bg);border:var(--ms-fullscreen-close-border);border-radius:var(--ms-fullscreen-close-border-radius);cursor:pointer}.ms__fullscreen-close:after,.ms__selected-popover--fullscreen .ms__selected-popover-close:after{content:"";position:absolute;inset-block-start:calc(-1 * var(--ms-fullscreen-close-size));inset-block-end:calc(-1 * var(--ms-fullscreen-header-padding-v));inset-inline-end:calc(-1 * var(--ms-fullscreen-header-padding-h));inset-inline-start:calc(-1 * var(--ms-fullscreen-header-gap))}.ms__fullscreen-close:hover,.ms__selected-popover--fullscreen .ms__selected-popover-close:hover{background:var(--ms-fullscreen-close-bg-hover);color:var(--ms-fullscreen-close-color)}.ms__fullscreen-close:before,.ms__selected-popover--fullscreen .ms__selected-popover-close:before{content:"";display:block;width:var(--ms-fullscreen-close-icon-size);height:var(--ms-fullscreen-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__dropdown--fullscreen .ms__option-info{flex:0 0 auto;display:none;align-items:center;justify-content:center;width:var(--ms-fullscreen-info-size);height:var(--ms-fullscreen-info-size);margin-inline-start:var(--ms-option-gap);padding:0;color:var(--ms-fullscreen-info-color);background:transparent;border:none;border-radius:50%;cursor:pointer}.ms__dropdown--fullscreen .ms__option--truncated .ms__option-info{display:inline-flex}@media (hover: hover){.ms__dropdown--fullscreen .ms__option-info:hover{background:var(--ms-fullscreen-info-bg-hover)}}.ms__dropdown--fullscreen .ms__option-info:before{content:"";display:block;width:var(--ms-fullscreen-info-icon-size);height:var(--ms-fullscreen-info-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-info) center / contain no-repeat;mask:var(--ms-icon-info) center / contain no-repeat}.ms__dropdown-inner{flex:1;overflow-y:auto;border-radius:var(--ms-dropdown-inner-border-radius);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:hidden}.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__option-tooltip--fullscreen{z-index:var(--ms-z-index-fullscreen-tooltip)}.ms__message{position:fixed;z-index:var(--ms-message-z-index);box-sizing:border-box;max-width:var(--ms-message-max-width);padding:var(--ms-message-padding);font-family:inherit;font-size:var(--ms-message-font-size);font-weight:var(--ms-message-font-weight);line-height:var(--ms-line-height-normal);color:var(--ms-message-color);background:var(--ms-message-bg);border:var(--ms-message-border);border-radius:var(--ms-message-border-radius);box-shadow:var(--ms-message-shadow);cursor:pointer;opacity:0;transition:opacity var(--ms-transition-normal) ease;-webkit-tap-highlight-color:transparent}.ms__message--visible{opacity:1}.ms__message--info{background:var(--ms-message-info-bg);color:var(--ms-message-info-color)}.ms__message--warning{background:var(--ms-message-warning-bg);color:var(--ms-message-warning-color)}.ms__message--error{background:var(--ms-message-error-bg);color:var(--ms-message-error-color)}.ms__message--success{background:var(--ms-message-success-bg);color:var(--ms-message-success-color)}.ms__message--fullscreen{left:50%;right:auto;bottom:calc(var(--ms-message-fullscreen-offset) + env(safe-area-inset-bottom));transform:translate(-50%);max-width:min(var(--ms-message-max-width),calc(100vw - 4 * var(--ms-fullscreen-rem)));padding:calc(1 * var(--ms-fullscreen-rem)) calc(1.4 * var(--ms-fullscreen-rem));font-size:calc(var(--base-font-size-sm, 1.4) * var(--ms-fullscreen-rem))}.ms__selected-popover{display:none;position:fixed;box-sizing:border-box;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--fullscreen{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:none;border-radius:0;overflow:hidden;background:var(--ms-fullscreen-bg);color:var(--ms-fullscreen-text-color);z-index:var(--ms-z-index-fullscreen);box-sizing:border-box;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.ms__selected-popover--fullscreen .ms__selected-popover-body{flex:1 1 0;min-height:0;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);flex-shrink:0}.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-wrapper{opacity:var(--ms-disabled-input-opacity);background:var(--ms-input-bg-disabled);cursor:not-allowed}.ms--disabled .ms__input{cursor:not-allowed}.ms--no-checkboxes .ms__option{gap:0;padding-inline-start:var(--ms-option-padding-h)}.ms--no-checkboxes .ms__option-content{padding-inline-start:0}.ms--no-selected-popover .ms__counter,.ms--no-selected-popover .ms__badge[data-action=show-selected],.ms--no-selected-popover .ms__badge--counter,.ms--no-selected-popover .ms__badge--more{cursor:default}}@layer component{@keyframes ms-spin{to{transform:rotate(360deg)}}}@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--custom{display:block;height:auto;max-width:none;overflow:visible;border-radius:0;font-size:inherit;font-weight:inherit}.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-inline-end:none;border-start-start-radius:var(--ms-badge-border-radius);border-end-start-radius:var(--ms-badge-border-radius);border-start-end-radius:0;border-end-end-radius:0;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;padding:0;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-inline-start:none;border-start-end-radius:var(--ms-badge-border-radius);border-end-end-radius:var(--ms-badge-border-radius);border-start-start-radius:0;border-end-start-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-inline-end: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-inline-start:none}.ms__badge--counter .ms__badge-remove:hover{background:var(--ms-badge-counter-remove-bg-hover);color:var(--ms-badge-counter-remove-color-hover, var(--ms-badge-counter-remove-color))}.ms__badge--counter:hover .ms__badge-text{background:var(--ms-badge-counter-text-bg-hover, var(--ms-badge-counter-text-bg));color:var(--ms-badge-counter-text-color-hover, var(--ms-badge-counter-text-color))}.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-inline-end: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__group-label--selectable{display:flex;align-items:center;gap:var(--ms-option-gap);cursor:pointer;-webkit-user-select:none;user-select:none}@media (hover: hover){.ms__group-label--selectable:hover{background:var(--ms-option-bg-hover)}}.ms__group-label--has-count{display:flex;align-items:center;gap:var(--ms-option-gap)}.ms__group-count{margin-inline-start:auto;flex:0 0 auto;box-sizing:border-box;min-width:calc(2 * var(--ms-rem));padding-block:0;padding-inline:calc(.4 * var(--ms-rem));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);text-align:center}.ms__option{display:flex;align-items:var(--ms-checkbox-align, center);gap:var(--ms-option-gap);padding:var(--ms-option-padding);position:relative;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}@media (hover: hover){.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)}.ms__option--matched:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;border-inline-start:var(--ms-option-border-matched);pointer-events:none}.ms__option--selected{background:var(--ms-option-bg-selected)}@media (hover: hover){.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)}@media (hover: hover){.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)}.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-checkbox-margin-top: calc(.2 * var(--ms-rem))}.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-inline-end:var(--ms-checkbox-margin-right);margin-bottom:var(--ms-checkbox-margin-bottom);margin-inline-start: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;top:0;right:0;bottom:0;left:0;background-color:var(--ms-checkbox-checkmark-color);-webkit-mask:var(--ms-icon-check) no-repeat center / var(--ms-icon-check-size);mask:var(--ms-icon-check) no-repeat center / var(--ms-icon-check-size)}.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;-webkit-mask-image:var(--ms-icon-indeterminate);mask-image:var(--ms-icon-indeterminate)}.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)}@media (hover: hover){.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))}@media (hover: hover){.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)}@media (hover: hover){.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))}@media (hover: hover){.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__add-new{display:flex;align-items:center;gap:var(--ms-add-new-gap);padding:var(--ms-add-new-padding);font-size:var(--ms-add-new-font-size);color:var(--ms-add-new-color);cursor:pointer;user-select:none;-webkit-user-select:none}@media (hover: hover){.ms__add-new:hover{background:var(--ms-add-new-bg-hover);color:var(--ms-add-new-color-hover)}}.ms__add-new--focused{background:var(--ms-add-new-bg-hover);color:var(--ms-add-new-color-hover)}.ms__add-new--loading{cursor:default}.ms__add-new-spinner{flex-shrink:0;width:var(--ms-add-new-icon-size);height:var(--ms-add-new-icon-size);border-radius:50%;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;animation:ms-spin .6s linear infinite}@media (prefers-reduced-motion: reduce){.ms__add-new-spinner{animation-duration:1.5s}}.ms__add-new-icon{flex-shrink:0;width:var(--ms-add-new-icon-size);height:var(--ms-add-new-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-add-new) center / contain no-repeat;mask:var(--ms-icon-add-new) center / contain no-repeat}.ms__add-new-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.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__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__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)}}@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}}`,Lo=["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],N=()=>Zo(),_n=[{configKey:"searchHint",attribute:"search-hint",converter:L({isNullable:!0}),on:"update",description:"Small hint text shown beneath the search input."},{configKey:"searchPlaceholder",attribute:"search-placeholder",converter:L({isNullable:!0}),on:"update",description:'Placeholder text for the search input. When unset it defaults to "Search..."; if `show-search-mode-toggle` is on, the default instead becomes mode-aware ("Search…" in navigate, "Filter…" in filter). An explicit value always wins and stays fixed.'},{configKey:"selectPlaceholder",attribute:"select-placeholder",converter:L({default:"Pick an option..."}),on:"update",description:"Placeholder shown on the control when nothing is selected."},{configKey:"noDataPlaceholder",attribute:"no-data-placeholder",converter:L({isNullable:!0}),on:"update",description:"Text shown when there are no options at all."},{configKey:"dropdownMinWidth",attribute:"dropdown-min-width",converter:L({isNullable:!0}),on:"update",description:"Minimum width of the dropdown panel (any CSS length)."},{configKey:"dropdownMaxWidth",attribute:"dropdown-max-width",converter:L({isNullable:!0}),on:"update",description:"Maximum width of the dropdown panel (any CSS length)."},{configKey:"maxHeight",attribute:"max-height",converter:L({default:"20rem"}),on:"update",description:"Maximum height of the dropdown list before it scrolls."},{configKey:"emptyMessage",attribute:"empty-message",converter:L({default:"No results found"}),on:"update",description:"Message shown when a search yields no matches."},{configKey:"addNewText",attribute:"add-new-text",converter:L({isNullable:!0}),on:"update",description:'Template for the clickable "add new" prompt shown (when `allow-add-new` is on) in place of the empty message once a search yields no matches. `{value}` is replaced with the typed text. Default: `Add "{value}"`. A `getAddNewTextCallback` wins.'},{configKey:"addNewPendingText",attribute:"add-new-pending-text",converter:L({isNullable:!0}),on:"update",description:'Template for the pending prompt (spinner + text) shown while an async `addNewCallback` runs. `{value}` is replaced with the typed text. Default: `Adding "{value}"…`.'},{configKey:"loadingMessage",attribute:"loading-message",converter:L({default:"Loading..."}),on:"update",description:"Message shown while options are loading."},{configKey:"removeButtonTooltipText",attribute:"remove-button-tooltip-text",converter:L({isNullable:!0}),on:"update",description:"Tooltip text for a badge remove (×) button."},{configKey:"formFieldId",attribute:"name",converter:L({isNullable:!0}),on:"reinit",description:"HTML form field name/id used for the hidden input(s)."},{configKey:"dropdownWidth",attribute:"dropdown-width",converter:L({isNullable:!0}),on:"update",description:"Fixed dropdown width; mirrored to the `--ms-dropdown-width` CSS variable."},{configKey:"selectedPopoverWidth",attribute:"selected-popover-width",converter:L({isNullable:!0}),on:"update",description:"Selected-items popover width; mirrored to `--ms-selected-popover-width`."},{configKey:"valueMember",attribute:"value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name on an option object that holds its value."},{configKey:"displayValueMember",attribute:"display-value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option display label."},{configKey:"searchValueMember",attribute:"search-value-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name searched against (falls back to the display value)."},{configKey:"iconMember",attribute:"icon-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option icon."},{configKey:"subtitleMember",attribute:"subtitle-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option subtitle."},{configKey:"fullTitleMember",attribute:"full-title-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option full/long title."},{configKey:"groupMember",attribute:"group-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name used to group options under headers."},{configKey:"disabledMember",attribute:"disabled-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that marks an option disabled."},{configKey:"pathMember",attribute:"path-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node materialized tree path."},{configKey:"parentPathMember",attribute:"parent-path-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node parent path."},{configKey:"levelMember",attribute:"level-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node depth level."},{configKey:"hasChildrenMember",attribute:"has-children-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name flagging that a node has children."},{configKey:"isSelectableMember",attribute:"is-selectable-member",converter:L({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name marking whether a node can be selected."},{configKey:"treePathSeparator",attribute:"tree-path-separator",converter:L({default:"."}),reflect:!0,on:"reinit",description:"Separator between segments in a materialized tree path."},{configKey:"isTreeEnabled",converter:W("tristate"),on:"reinit",type:"boolean",description:"Force tree mode on/off. Property-only; when unset (null) tree mode auto-enables if a path source (path-member / getPathCallback) is present."},{configKey:"checkboxMode",attribute:"checkbox-mode",converter:T(["independent","cascade"],{default:"cascade"}),reflect:!0,on:"update",description:"Tree checkbox interaction.\n- `cascade` (default) — checks a node's whole subtree and shows a tristate (checked / indeterminate / unchecked) box on branches. This is what most tree-select UIs do, so it's the default.\n- `independent` — toggles only the clicked node, ignoring ancestors/descendants.\n\nTree + multiple only — has no effect on flat lists or single-select (there is no subtree to cascade into)."},{configKey:"cascadeSelectPolicy",attribute:"cascade-select-policy",converter:T(["rolled-up","leaves","all"],{default:"rolled-up"}),reflect:!0,on:"update",description:"In `cascade` mode, which values a selection emits (badges / form / change):\n- `rolled-up` (default) — minimal cover: a fully-selected subtree collapses to its root; partially-selected branches emit their individually-checked descendants.\n- `leaves` — only the checked leaf-level nodes.\n- `all` — every fully-checked node (branches and leaves)."},{configKey:"groupSelectMode",attribute:"group-select-mode",converter:T(["none","cascade"],{default:"none"}),reflect:!0,on:"update",description:"Group-header selection in a FLAT (non-tree) grouped, multi-select list.\n- `none` (default) — group headers are inert labels.\n- `cascade` — each header shows a tristate checkbox that checks/unchecks all of that group's currently-visible members; a partially-selected group reads indeterminate. The group itself is never a selected value (getValue / badges / form carry member values only).\n\nFlat + multiple only — no effect in tree mode (use `checkbox-mode`) or single-select."},{configKey:"badgesDisplayMode",attribute:"badges-display-mode",converter:T(["badges","count","compact","partial","none"],{default:"badges"}),on:"update",description:"How the current selection is shown in the control."},{configKey:"badgesPosition",attribute:"badges-position",converter:T(["top","bottom","left","right"],{default:"bottom"}),on:"update",description:"Where the badges/selection appear relative to the input."},{configKey:"badgesThresholdMode",attribute:"badges-threshold-mode",converter:T(["count","partial"],{default:"count"}),on:"update",description:'How `badgesThreshold` is interpreted: collapse to a count badge, or keep partial badges + a "more" badge.'},{configKey:"selectedOrder",attribute:"selected-order",converter:T(["as-selected","label-asc","label-desc","member","custom"],{default:"as-selected"}),reflect:!0,on:"update",description:'Order of the CURRENTLY-SELECTED items where they are displayed — badges, partial mode (which items sit behind the "+N more" badge), and the selected-items popover. Display only: `getValue()`, the form output, and `getSelected()` keep as-selected (insertion) order, and the options dropdown is never reordered.\n- `as-selected` (default) — the order items were picked.\n- `label-asc` / `label-desc` — by the badge label, A→Z / Z→A (locale-aware).\n- `member` — by the `selected-order-member` property (or `getSelectedOrderCallback`); numeric keys sort numerically, everything else with a locale string compare.\n- `custom` — delegate to `selectedOrderCompareCallback`.'},{configKey:"selectedOrderMember",attribute:"selected-order-member",converter:L({isNullable:!0}),reflect:!0,on:"update",description:'Property name used as the sort key when `selected-order="member"`. Sorts the SELECTED-items display only (not the dropdown). Overridden by `getSelectedOrderCallback`.'},{configKey:"searchInputMode",attribute:"search-input-mode",converter:T(["normal","readonly","hidden"],{default:"normal"}),on:"reinit",description:"Search field mode: editable, read-only, or hidden."},{configKey:"searchMode",attribute:"search-mode",converter:T(["filter","navigate"],{default:"filter"}),on:"reinit",description:"Whether typing filters the list or navigates it."},{configKey:"overlayGroup",attribute:"overlay-group",converter:L({isNullable:!0}),on:"reinit",description:'Scope the "one overlay open at a time" coordination to a named group. Overlays (multiselects, datepickers, external popovers) sharing a group dismiss each other when one opens; different groups are independent. Unset = the default (ungrouped) group.'},{configKey:"actionsLayout",attribute:"actions-layout",converter:T(["nowrap","wrap"],{default:"nowrap"}),on:"reinit",description:"Whether the action bar wraps or stays on one line."},{configKey:"actionsPosition",attribute:"actions-position",converter:T(["top","bottom"],{default:"top"}),on:"reinit",description:"Whether the action bar sits above or below the list."},{configKey:"actionsAlign",attribute:"actions-align",converter:T(["stretch","left","right","center","space-between"],{default:"stretch"}),on:"update",description:"Horizontal alignment of the action buttons."},{configKey:"checkboxAlign",attribute:"checkbox-align",converter:T(["top","center","bottom"],{default:"center"}),on:"update",description:"Vertical alignment of an option checkbox."},{configKey:"valueFormat",attribute:"value-format",converter:T(["json","csv","array"],{default:"json"}),on:"reinit",description:"Serialization format the control emits its value in."},{configKey:"badgeTooltipPlacement",attribute:"badge-tooltip-placement",converter:T(Lo,{default:"top"}),on:"update",description:"Preferred placement of a badge tooltip relative to its badge (floating-ui placement)."},{configKey:"optionTooltipPlacement",attribute:"option-tooltip-placement",converter:T(Lo,{default:"top-start"}),on:"update",description:"Preferred placement of an option tooltip (floating-ui placement)."},{configKey:"mobilePresentation",attribute:"mobile-presentation",converter:T(["auto","floating","fullscreen"],{default:"auto"}),reflect:!0,on:"update",description:"How the open dropdown is presented on phones. `auto` (default) keeps the floating panel on desktop/tablet and switches to a full-screen overlay on phone-sized touch devices (touch primary + shorter viewport side < 600px, orientation-robust); `floating` forces the anchored panel everywhere; `fullscreen` forces the full-screen overlay on any device (handy for previews/testing). Resolved reactively from the device/viewport environment."},{configKey:"fullscreenAutofocus",attribute:"fullscreen-autofocus",converter:W("default-false"),on:"update",description:"In the phone fullscreen overlay, auto-focus the search field on open (pops the soft keyboard immediately). Default `false`: the sheet opens with the list visible and the keyboard closed, appearing only when the user taps the search. Set `true` to type-to-filter right away. No effect in the floating presentation."},{configKey:"badgesThreshold",attribute:"badges-threshold",converter:R(),on:"update",description:"Threshold at which badges collapse to a count/compact view."},{configKey:"badgesMaxVisible",attribute:"badges-max-visible",converter:R(),on:"update",description:"Maximum number of badges rendered before overflow."},{configKey:"collapseBadgesBelow",attribute:"collapse-badges-below",converter:R(),on:"update",description:'Container-responsive opt-in (off by default). When set to a px width, the control watches its OWN border box (not the window, via the core `resized` hook / a shared ResizeObserver) and collapses `badges-display-mode` to `count` ("N selected") while the box is narrower than this — so a picker in a narrow column/sidebar never overflows with pills, even on a wide monitor. Widening past the threshold restores the configured badges mode. Element-only: the override is applied to the live picker, never to your `badges-display-mode` config.'},{configKey:"minSearchLength",attribute:"min-search-length",converter:R({default:0}),on:"update",description:"Minimum characters before searching/filtering starts."},{configKey:"searchDebounce",attribute:"search-debounce",converter:R({default:0}),on:"update",description:"Debounce delay in ms applied to the search input."},{configKey:"virtualScrollThreshold",attribute:"virtual-scroll-threshold",converter:R({default:100}),on:"reinit",description:"Option count above which virtual scrolling turns on."},{configKey:"optionHeight",attribute:"option-height",converter:R({default:50}),on:"update",description:"Fixed row height in px used by virtual scrolling."},{configKey:"badgeHeight",attribute:"badge-height",converter:R({default:36}),on:"update",description:"Fixed badge height in px used for layout/virtualization."},{configKey:"virtualScrollBuffer",attribute:"virtual-scroll-buffer",converter:R({default:10}),on:"update",description:"Extra rows rendered above/below the viewport when virtualizing."},{configKey:"badgeTooltipDelay",attribute:"badge-tooltip-delay",converter:R({default:100}),on:"update",description:"Delay in ms before a badge tooltip appears."},{configKey:"badgeTooltipOffset",attribute:"badge-tooltip-offset",converter:R({default:8}),on:"update",description:"Gap in px between a badge and its tooltip."},{configKey:"optionTooltipDelay",attribute:"option-tooltip-delay",converter:R(),on:"update",description:"Delay in ms before an option tooltip appears (falls back to badgeTooltipDelay)."},{configKey:"optionTooltipOffset",attribute:"option-tooltip-offset",converter:R(),on:"update",description:"Gap in px between an option and its tooltip."},{configKey:"isMultipleEnabled",attribute:"multiple",converter:W("default-true"),on:"reinit",description:"Allow selecting multiple options. When off, selecting one replaces the previous."},{configKey:"isGroupsAllowed",attribute:"allow-groups",converter:W("default-true"),on:"reinit",description:"Allow grouping options under group headers."},{configKey:"isCheckboxesShown",attribute:"show-checkboxes",converter:W("default-true"),on:"reinit",description:"Show a checkbox on each option."},{configKey:"isActionsSticky",attribute:"sticky-actions",converter:W("default-true"),on:"update",description:"Keep the action bar pinned while the list scrolls."},{configKey:"isPlacementLocked",attribute:"lock-placement",converter:W("default-true"),on:"update",description:"Keep the dropdown initial placement instead of flipping when it fits."},{configKey:"isSearchEnabled",attribute:"enable-search",converter:W("default-true"),on:"reinit",description:"Show the search input."},{configKey:"isKeepOptionsOnSearch",attribute:"keep-options-on-search",converter:W("default-true"),on:"update",description:"Keep already-selected options visible while filtering."},{configKey:"shouldKeepSearchOnClose",attribute:"should-keep-search-on-close",converter:W("default-true"),on:"update",description:"Preserve the search text after the dropdown closes."},{configKey:"isSelectedPopoverEnabled",attribute:"enable-selected-popover",converter:W("default-true"),on:"update",description:'Allow the selected-items popover to open (from the count/compact/"+X more" badge or the in-input counter). Turn off when you render your own selection UI, so those affordances become inert.'},{configKey:"isCloseOnSelect",attribute:"close-on-select",converter:W("default-false"),on:"update",description:"Close the dropdown immediately after a selection."},{configKey:"isAddNewAllowed",attribute:"allow-add-new",converter:W("default-false"),on:"reinit",description:"Allow adding a new option from the search text."},{configKey:"isCounterShown",attribute:"show-counter",converter:W("default-false"),on:"update",description:"Show a selected-count indicator."},{configKey:"isClearShown",attribute:"show-clear",converter:W("default-false"),on:"update",description:"Show an inline clear (✕) button inside the input that wipes the whole selection. Appears only while something is selected and the control is enabled; clicking it clears the selection and any search text, fires `change`, and refocuses."},{configKey:"isBadgeFullTitleShown",attribute:"show-badge-full-title",converter:W("default-false"),on:"update",description:"Show the full title on badges instead of the short label."},{configKey:"isVirtualScrollEnabled",attribute:"enable-virtual-scroll",converter:W("default-false"),on:"reinit",description:"Force virtual scrolling on regardless of the threshold."},{configKey:"isBadgeTooltipsEnabled",attribute:"enable-badge-tooltips",converter:W("default-false"),on:"update",description:"Enable tooltips on badges."},{configKey:"isOptionTooltipsEnabled",attribute:"enable-option-tooltips",converter:W("default-false"),on:"update",description:"Enable tooltips on options."},{configKey:"isOptionTooltipFollowCursor",attribute:"option-tooltip-follow-cursor",converter:W("default-false"),on:"update",description:"Make option tooltips follow the pointer."},{configKey:"isSearchModeToggleShown",attribute:"show-search-mode-toggle",converter:W("default-false"),on:"update",description:"Show a clickable toggle in the phone fullscreen overlay search header that flips `search-mode` between `filter` and `navigate` live. Fullscreen-only; no effect in the floating presentation or when search is disabled."},{configKey:"initialValues",attribute:"initial-values",converter:bn(),default:[],on:"reinit",type:"Array<string | number>",description:'Values selected on first render. Accepts a JSON array (`["a","b"]`) or a bare CSV (`a,b,c`).'},{configKey:"showDebugInfo",attribute:"show-debug-info",converter:W("default-false"),on:"update",description:"Render an in-component debug panel.",deprecated:"Use per-instance logging (el.enableLogging()) instead."},{configKey:"deferRender",attribute:"defer",converter:W("presence"),on:"reinit",description:"Hold the initial render. When the `defer` attribute is present on upgrade the component builds nothing (it only reserves space) — so options, callbacks (e.g. `customStylesCallback`) and event listeners can all be wired first, then released with `el.ready()` (or by removing the `defer` attribute, for server-driven frameworks). The release builds the picker ONCE with everything already in place, avoiding the upgrade-then-restyle flash. Absent (default): builds immediately on connect. Latched — once released the gate never re-closes."},{configKey:"options",converter:Yo(),on:"reinit",type:"ReadonlyArray<Record<string, unknown>>",description:"The array of option objects to render. The JS API — assign `el.options` directly. For HTML authoring use the `data-options` attribute (parsed per `data-options-format`) or declarative <option> children; both feed the same list and take precedence over this property in the order: <option> children > property > data-options."},{configKey:"optionsSource",attribute:"data-options",converter:L({isNullable:!0}),on:"reinit",type:"string",description:"HTML-authoring source for the option list, parsed per `data-options-format`. Reactive: changing either attribute re-renders. Prefer the `options` property in JS; a set `options` property and declarative <option> children both win over this."},{configKey:"optionsFormat",attribute:"data-options-format",converter:T(So,{default:"json"}),on:"reinit",type:"'json' | 'csv' | 'plain'",description:"How to parse the `data-options` attribute: `json` (a JSON array of objects or [value, label] tuples), `csv` (rows split on `data-options-row-splitter`, cells on `data-options-splitter`; the first row is a header — map columns via *-member), or `plain` (bare values split on both splitters -> [value, label] tuples, value === label). Default `json`."},{configKey:"optionsSplitter",attribute:"data-options-splitter",converter:L({default:","}),on:"reinit",type:"string",description:'Field/cell delimiter for the `csv` and `plain` `data-options` formats. Default `,`. Escapes `\\t` `\\n` `\\r` are honoured (e.g. `data-options-splitter="\\t"` for TSV). Ignored for `json`.'},{configKey:"optionsRowSplitter",attribute:"data-options-row-splitter",converter:L({default:`
|
|
42
|
-
`}),on:"reinit",type:"string",description:'Row/record delimiter for the `csv` and `plain` `data-options` formats. Default newline. Escapes honoured (e.g. `data-options-row-splitter=";"` for single-line data). Ignored for `json`.'},{configKey:"actionButtons",converter:Jo({validate:s=>Array.isArray(s)}),on:"reinit",type:"Array<Record<string, unknown>>",description:"Custom action buttons for the dropdown footer/header. Property-only; when unset the default Select-All / Clear buttons apply."},{configKey:"getValueCallback",converter:N(),on:"reinit",type:"(item: unknown) => string | number",description:"Extract an option value (overrides valueMember)."},{configKey:"getPathCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Extract a node tree path (enables tree mode; overrides pathMember)."},{configKey:"getGroupCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Extract the group name from an option (overrides groupMember)."},{configKey:"getDisabledCallback",converter:N(),on:"reinit",type:"(item: unknown) => boolean",description:"Whether an option is disabled (overrides disabledMember)."},{configKey:"getIsSelectableCallback",converter:N(),on:"reinit",type:"(node: unknown) => boolean",description:"Whether a tree node can be selected (overrides is-selectable-member)."},{configKey:"getSearchValueCallback",converter:N(),on:"reinit",type:"(item: unknown) => string",description:"Text an option is searched against (overrides searchValueMember)."},{configKey:"searchCallback",converter:N(),on:"reinit",type:"(searchTerm: string, signal?: AbortSignal) => Promise<unknown[]>",description:"Custom / async search; return the filtered options."},{configKey:"getDisplayValueCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Compute the display label for an option (overrides displayValueMember)."},{configKey:"getBadgeDisplayCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Compute the text shown on an option badge."},{configKey:"getBadgeClassCallback",converter:N(),on:"update",type:"(item: unknown) => string | string[]",description:"Extra CSS class(es) for an option badge."},{configKey:"getSelectedOrderCallback",converter:N(),on:"update",type:"(item: unknown) => string | number",description:'Sort key for the selected-items display when `selected-order="member"` (overrides `selected-order-member`).'},{configKey:"selectedOrderCompareCallback",converter:N(),on:"update",type:"(a: unknown, b: unknown) => number",description:'Comparator for the selected-items display when `selected-order="custom"`.'},{configKey:"getIconCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Icon for an option (overrides iconMember)."},{configKey:"getSubtitleCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Subtitle for an option (overrides subtitleMember)."},{configKey:"getFullTitleCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Full title for an option (used by badges when show-badge-full-title is on)."},{configKey:"getCounterCallback",converter:N(),on:"update",type:"(count: number, moreCount?: number) => string",description:"Render the selected-count label."},{configKey:"getCountLabelCallback",converter:N(),on:"update",type:"(selected: number, total: number) => string",description:"Format the small count chip shared by the in-input counter and each group header count (default `[selected]`; e.g. `(s,t)=>`${s}/${t}``). One callback drives both."},{configKey:"getValueFormatCallback",converter:N(),on:"update",type:"(selectedValues: (string | number)[]) => string",description:"Serialize the selected values for form submission."},{configKey:"getBadgeTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Tooltip content for an option badge."},{configKey:"getOptionTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Tooltip content for an option row."},{configKey:"getRemoveButtonTooltipCallback",converter:N(),on:"update",type:"(item: unknown) => string",description:"Tooltip text for a badge remove button."},{configKey:"getSelectedItemClassCallback",converter:N(),on:"update",type:"(item: unknown) => string | string[]",description:"Extra CSS class(es) for a selected item."},{configKey:"renderOptionContentCallback",converter:N(),on:"update",type:"(item: unknown, context: OptionContentRenderContext) => string | HTMLElement",description:"Custom render for an option row; may return HTML or an element."},{configKey:"renderBadgeContentCallback",converter:N(),on:"update",type:"(item: unknown, context: BadgeContentRenderContext) => string | HTMLElement",description:"Custom render for a badge content (fills the built-in pill); may return HTML or an element."},{configKey:"renderBadgeCallback",converter:N(),on:"update",type:"(item: unknown, context: BadgeContentRenderContext) => string | HTMLElement | null",description:'Custom render for the WHOLE badge (main area), not just its content — return the entire pill/card. The component wraps it in `.ms__badge.ms__badge--custom` with `data-value` and delegates removal to any inner element with `data-action="remove"` (or `.ms__badge-remove`). Return null/empty to fall back to the default pill for that item.'},{configKey:"renderGroupLabelContentCallback",converter:N(),on:"update",type:"(groupName: string, context: GroupLabelRenderContext) => string | HTMLElement",description:"Customize a group label; may return an HTML string or element. The second arg carries the group members + selection (e.g. `context.selectedCount`) so a custom header can show a per-group count."},{configKey:"renderSelectedContentCallback",converter:N(),on:"update",type:"(item: unknown, context: SelectedContentRenderContext) => string",description:"Custom render for the single-select selected value (2nd arg carries the presentation context)."},{configKey:"renderSelectedItemContentCallback",converter:N(),on:"update",type:"(item: unknown, context: BadgeContentRenderContext) => string | HTMLElement",description:"Custom render for one selected item in the popover (2nd arg is a BadgeContentRenderContext; isInPopover=true)."},{configKey:"customStylesCallback",converter:N(),on:"update",type:"() => string",description:"Returns a CSS string injected into the component via a replaceable style slot (§12.8)."},{configKey:"beforeSearchCallback",converter:N(),on:"update",type:"(searchTerm: string) => string | null",description:"Runs before a search; return a rewritten term or null to veto."},{configKey:"beforeSelectCallback",converter:N(),on:"update",type:"(option: unknown, selectedOptions: unknown[]) => boolean | string | void",description:"Runs before selecting; return false to veto, or a string to veto and show it as a message."},{configKey:"beforeDeselectCallback",converter:N(),on:"update",type:"(option: unknown, selectedOptions: unknown[]) => boolean | string | void",description:"Runs before deselecting; return false to veto, or a string to veto and show it as a message."},{configKey:"addNewCallback",converter:N(),on:"update",type:"(value: string) => unknown | null | undefined | Promise<unknown | null | undefined>",description:"Create a new option from the typed text. May return a rich option object (renders via the same get*/render* callbacks as any option). Async + cancelable: return null/undefined to abort (no add, no `add` event). Omit entirely to handle creation yourself via the `add` event."},{configKey:"getAddNewTextCallback",converter:N(),on:"update",type:"(value: string) => string",description:'Dynamically compute the "add new" prompt label from the typed text (returns plain text). Takes precedence over `add-new-text`.'},{configKey:"keydownCallback",converter:N(),on:"update",type:"(context: MultiSelectKeydownContext) => boolean | void",description:"Intercept keydown before built-in handling; return true to suppress the default. Gets the event, current state, and an imperative controller."}],kn=[{name:"select",description:"An option was selected. `detail.option` is the selected option; `detail.selectedOptions`/`detail.selectedValues` are the full selection."},{name:"deselect",description:"An option was removed from the selection. `detail.option` is that option."},{name:"change",description:"The selection changed. `detail.selectedOptions`/`detail.selectedValues` are the full selection."},{name:"add",description:'The user chose to create a new option from the typed text (via the "add new" prompt or Enter) — requires `allow-add-new`. `detail.value` is the typed text; `detail.option` is the created item when `addNewCallback` produced one.'},{name:"ready",description:"The picker was built and painted for the first time (once per element lifetime). Fires right after the first build — synchronously during upgrade for a normal element, or when the render gate is released (`el.ready()` / removing `defer`) for a deferred one. No detail."}],Eo=new Set(["dropdownWidth","selectedPopoverWidth","showDebugInfo","initialValues","optionsSource","optionsFormat","optionsSplitter","optionsRowSplitter","mobilePresentation","collapseBadgesBelow","deferRender"]),Ft={dropdownWidth:"--ms-dropdown-width",selectedPopoverWidth:"--ms-selected-popover-width"};let Cn=null;function Sn(){return Cn??(Cn=Vi(Mo,"--ms-"))}const Tn=[{key:"valueMember",member:"value",callbackKey:"getValueCallback"},{key:"displayValueMember",member:"label",callbackKey:"getDisplayValueCallback"},{key:"groupMember",member:"group",callbackKey:"getGroupCallback"},{key:"iconMember",member:"icon",callbackKey:"getIconCallback"},{key:"subtitleMember",member:"subtitle",callbackKey:"getSubtitleCallback"},{key:"disabledMember",member:"disabled",callbackKey:"getDisabledCallback"}];class De extends Yt{constructor(){super();z(this,y);z(this,Z);z(this,S);z(this,be);z(this,pt);z(this,Ge,!1);z(this,ft,null);z(this,gt,new Set);z(this,bt,!1);z(this,Ue,!1);z(this,qe);z(this,Le);z(this,ve,!1);P(this,Z,this.attachShadow({mode:"open"})),Ni(h(this,Z),Mo),typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>this.setAttribute("data-placeholder-ready","")):this.setAttribute("data-placeholder-ready","")}formResetCallback(){var t;(t=h(this,S))==null||t.clearAll()}directionChanged(t){var o;(o=h(this,S))==null||o.refreshDirection()}reinit(){v(this,y,Wo).call(this),this.isConnected&&!v(this,y,vs).call(this)&&v(this,y,xs).call(this)}update(t){v(this,y,jo).call(this,t),"customStylesCallback"in t&&v(this,y,_s).call(this),"showDebugInfo"in t&&v(this,y,Cs).call(this);const o={};for(const[i,r]of Object.entries(t))Eo.has(i)||(o[i]=r===null?void 0:r);h(this,S)&&Object.keys(o).length>0&&(h(this,S).updateOptions(o)||v(this,y,xs).call(this)),"mobilePresentation"in t&&v(this,y,jt).call(this,Qe()),"collapseBadgesBelow"in t&&v(this,y,Gt).call(this,this.getBoundingClientRect().width)}connect(){!h(this,S)&&!v(this,y,vs).call(this)&&v(this,y,Ut).call(this)}disconnect(){var t;(t=h(this,S))==null||t.destroy(),P(this,S,void 0)}environmentChanged(t){v(this,y,jt).call(this,t)}resized({width:t}){v(this,y,Gt).call(this,t)}get name(){return this.getAttribute("name")}set name(t){t?this.setAttribute("name",t):this.removeAttribute("name")}get selectedValue(){var t;return this.flush(),((t=h(this,S))==null?void 0:t.selectedValue)??null}get selectedItem(){var t;return this.flush(),((t=h(this,S))==null?void 0:t.selectedItem)??null}getSelected(){return this.flush(),h(this,S)?h(this,S).getSelected():[]}setSelected(t,o={}){var i;this.flush(),(i=h(this,S))==null||i.setSelected(t,o)}getValue(){return this.flush(),h(this,S)?h(this,S).getValue():null}showMessage(t,o){var i;this.flush(),(i=h(this,S))==null||i.showMessage(t,o)}hideMessage(){var t;(t=h(this,S))==null||t.hideMessage()}clearSearch(){var t;this.flush(),(t=h(this,S))==null||t.clearSearch()}get searchText(){var t;return this.flush(),((t=h(this,S))==null?void 0:t.searchText)??""}search(t){var o;this.flush(),(o=h(this,S))==null||o.search(t)}scrollToIndex(t,o){var i;return this.flush(),((i=h(this,S))==null?void 0:i.scrollToIndex(t,o))??!1}scrollToValue(t,o){var i;return this.flush(),((i=h(this,S))==null?void 0:i.scrollToValue(t,o))??!1}scrollToGroup(t,o){var i;return this.flush(),((i=h(this,S))==null?void 0:i.scrollToGroup(t,o))??!1}open(){var t;this.flush(),(t=h(this,S))==null||t.open()}close(){var t;this.flush(),(t=h(this,S))==null||t.close()}toggle(){var t;this.flush(),(t=h(this,S))==null||t.toggle()}get isOpen(){var t;return this.flush(),((t=h(this,S))==null?void 0:t.isOpen)??!1}set isOpen(t){this.flush(),h(this,S)&&(h(this,S).isOpen=t)}destroy(){var t;(t=h(this,S))==null||t.destroy()}ready(){P(this,Ge,!0),this.flush(),this.isConnected&&!h(this,S)&&v(this,y,Ut).call(this)}get isReady(){return this.hasAttribute("is-ready")}}Z=new WeakMap,S=new WeakMap,be=new WeakMap,pt=new WeakMap,Ge=new WeakMap,ft=new WeakMap,gt=new WeakMap,bt=new WeakMap,Ue=new WeakMap,qe=new WeakMap,Le=new WeakMap,y=new WeakSet,vs=function(){return this.config.deferRender===!0&&!h(this,Ge)},jt=function(t){var r;const o=this.config.mobilePresentation??"auto",i=Fi(o,t);(r=h(this,S))==null||r.setPresentation(i==="modal"?"fullscreen":i)},ve=new WeakMap,Gt=function(t){const o=this.config.collapseBadgesBelow;if(o==null){h(this,ve)&&(P(this,ve,!1),v(this,y,ws).call(this));return}const i=t>0&&t<o;i!==h(this,ve)&&(P(this,ve,i),i?v(this,y,ys).call(this,"count"):v(this,y,ws).call(this))},ws=function(){const t=this.config.badgesDisplayMode??"badges";v(this,y,ys).call(this,t)},ys=function(t){var o;(o=h(this,S))==null||o.updateOptions({badgesDisplayMode:t})},xs=function(){var o;const t=h(this,S)?v(this,y,Xe).call(this):void 0;(o=h(this,S))==null||o.destroy(),P(this,S,void 0),v(this,y,Ut).call(this,t)},Ut=function(t){v(this,y,Bo).call(this),v(this,y,Go).call(this);const o=v(this,y,Ho).call(this),i=v(this,y,Fo).call(this),r=JSON.stringify(i??null),a=t!==void 0&&t.length>0&&r===h(this,pt)?t:i;P(this,pt,r),a&&a.length>0?h(this,be).dataset.initialValues=JSON.stringify(a):delete h(this,be).dataset.initialValues,P(this,S,new Co(h(this,be),o)),v(this,y,_s).call(this),v(this,y,Cs).call(this),v(this,y,jt).call(this,Qe()),P(this,ve,!1),v(this,y,Gt).call(this,this.getBoundingClientRect().width),this.hasAttribute("is-ready")||(P(this,Ge,!0),this.setAttribute("is-ready",""),this.emit("ready"))},Bo=function(){if(h(this,be))return;const t=document.createElement("div");t.setAttribute("data-multiselect",""),this.className&&(t.className=this.className),h(this,Z).appendChild(t),P(this,ft,$i(h(this,Z),{position:"first",className:"ms-custom-styles"})),P(this,be,t)},Ho=function(){const t={...this.config};for(const i of Eo)delete t[i];for(const i of Object.keys(t))t[i]===null&&delete t[i];let o=t.options;if(h(this,Ue)&&h(this,qe))o&&o.length>0&&G.warn("[MultiSelectElement] Both declarative <option> elements and programmatic .options detected. Using declarative options."),o=h(this,qe);else if(!o||o.length===0){const i=this.config.optionsSource;if(i!=null){const r=this.config.optionsFormat??"json",{options:n,error:a}=Oo(i,r,{splitter:this.config.optionsSplitter,rowSplitter:this.config.optionsRowSplitter});a&&G.error(`[MultiSelectElement] ${a}`),o=n}}if(t.options=o,h(this,Ue))for(const{key:i,member:r,callbackKey:n}of Tn)t[i]===void 0&&!t[n]&&(t[i]=r);return t.getCounterCallback||(t.getCounterCallback=(i,r)=>r!==void 0?`+${r} more`:`${i} selected`),t.onSelect=i=>{var r;this.emit("select",{option:i,selectedOptions:((r=h(this,S))==null?void 0:r.getSelected())??[],selectedValues:v(this,y,Xe).call(this)})},t.onDeselect=i=>{var r;this.emit("deselect",{option:i,selectedOptions:((r=h(this,S))==null?void 0:r.getSelected())??[],selectedValues:v(this,y,Xe).call(this)})},t.onChange=i=>{this.emit("change",{selectedOptions:i,selectedValues:v(this,y,Xe).call(this)})},t.onAddNew=i=>{var r;this.emit("add",{value:i.value,option:i.option,selectedOptions:((r=h(this,S))==null?void 0:r.getSelected())??[],selectedValues:v(this,y,Xe).call(this)})},t.container=h(this,Z),t.hostElement=this,t},Fo=function(){if(h(this,Le)&&h(this,Le).length>0)return h(this,Le);const t=this.config.initialValues;return t&&t.length>0?t:void 0},Xe=function(){var o;const t=(o=h(this,S))==null?void 0:o.getValue();return t==null?[]:Array.isArray(t)?t:[t]},_s=function(){const t=h(this,ft);if(!t)return;const o=this.config.customStylesCallback;if(typeof o!="function"){t.clear();return}try{const i=o();t.set(i),i&&v(this,y,Ko).call(this,i)}catch(i){G.warn("[MultiSelectElement] customStylesCallback threw",i),t.clear()}},Ko=function(t){const o=Sn();if(o.size!==0)for(const{name:i,suggestions:r}of Bi(t,{prefix:"--ms-",consumed:o}))h(this,gt).has(i)||(h(this,gt).add(i),console.warn(`[web-multiselect] customStylesCallback sets "${i}", which no web-multiselect style consumes — it will have no effect.`+(r.length?` Did you mean: ${r.join(", ")}?`:"")+" (If it's for your own custom-rendered content, ignore this.)"))},Wo=function(){for(const t of Object.keys(Ft))v(this,y,ks).call(this,Ft[t],this.config[t])},jo=function(t){for(const o of Object.keys(Ft))o in t&&v(this,y,ks).call(this,Ft[o],t[o])},ks=function(t,o){o==null||o===""?this.style.removeProperty(t):this.style.setProperty(t,String(o))},Go=function(){if(h(this,bt))return;P(this,bt,!0);const t=v(this,y,Uo).call(this);t&&(P(this,qe,t),P(this,Ue,!0))},Uo=function(){const t=Array.from(this.children);if(t.length===0)return null;const o=[];let i=!1;const r=(n,a)=>{var c,d;const l={value:n.value||((c=n.textContent)==null?void 0:c.trim())||"",label:((d=n.textContent)==null?void 0:d.trim())||n.value||""};a&&(l.group=a),n.hasAttribute("selected")&&(h(this,Le)??P(this,Le,[])).push(l.value),n.hasAttribute("disabled")&&(l.disabled=!0),n.hasAttribute("data-icon")&&(l.icon=n.getAttribute("data-icon")),n.hasAttribute("data-subtitle")&&(l.subtitle=n.getAttribute("data-subtitle")),o.push(l),i=!0};for(const n of t)if(n.tagName==="OPTION")r(n);else if(n.tagName==="OPTGROUP"){const a=n,l=a.label||a.getAttribute("label")||"Group";for(const c of Array.from(a.querySelectorAll("option")))r(c,l)}if(!i)return null;G.debug(`[MultiSelectElement] Parsed ${o.length} declarative options from Light DOM`);for(const n of t)(n.tagName==="OPTION"||n.tagName==="OPTGROUP")&&n.remove();return o},Cs=function(){const t=h(this,Z).querySelector(".ms__debug-info");if(t&&t.remove(),!this.config.showDebugInfo)return;const o=document.createElement("div");o.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),o.appendChild(i),h(this,Z).appendChild(o),v(this,y,Ss).call(this)},Ss=function(){var l,c,d,u;const t=h(this,Z).querySelector(".ms__debug-stats");if(!t||!h(this,S))return;const o="2.2.0-rc01",i=typeof window<"u"&&((c=(l=window.components)==null?void 0:l["web-multiselect"])==null?void 0:c.getInstances().length)||0,r=h(this,S).getSelected().length,n=((d=this.config.options)==null?void 0:d.length)||0,a=h(this,S);t.innerHTML=`
|
|
37
|
+
`}handleSelectedPopoverClick(e){if(e.stopPropagation(),e.target.closest(".ms__selected-popover-close")){e.preventDefault(),this.hideSelectedPopover();return}const o=e.target.closest(".ms__badge-remove");if(o){e.preventDefault();const i=o.dataset.value,r=this.selectedOptions.get(i);r&&this.interactiveDeselect(r)&&(this.renderSelectedPopover(),this.selectedValues.size===0&&this.hideSelectedPopover())}}positionSelectedPopover(){this.presentationMode!=="fullscreen"&&(this.selectedPopoverCleanup=this.anchorFloatingPanel(this.selectedPopover,{getPlacement:()=>this.selectedPopoverPlacement,setPlacement:e=>{this.selectedPopoverPlacement=e,Y.debug(`[${this.instanceId}] Locked popover placement:`,e)}}))}updateHiddenInput(){if(!this.options.formFieldId)return;this.hiddenInputs.forEach(i=>i.remove()),this.hiddenInputs=[];const e=this.options.valueFormat||"json",t=Array.from(this.selectedOptions.values()).map(i=>this.getItemValue(i)),o=this.options.hostElement||this.element;if(e==="array")t.forEach(i=>{const r=document.createElement("input");r.type="hidden",r.name=`${this.options.formFieldId}[]`,r.value=String(i),o.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(),o.appendChild(i),this.hiddenInputs.push(i)}}getFormValue(){const e=Array.from(this.selectedOptions.values()).map(o=>this.getItemValue(o));return this.options.getValueFormatCallback?this.options.getValueFormatCallback(e):(this.options.valueFormat||"json")==="csv"?e.join(","):JSON.stringify(e)}getSelected(){return Array.from(this.selectedOptions.values())}setSelected(e,t={}){this.selectedValues=new Set(e.map(o=>String(o))),this.selectedOptions.clear(),e.forEach(o=>{const i=String(o),r=this.allOptions.find(n=>String(this.getItemValue(n))===i);r&&this.selectedOptions.set(i,r)}),this.renderDropdown(),this.renderBadges(),this.updateHiddenInput(),t.notify&&this.options.onChange&&this.options.onChange(this.getSelected())}updateOptions(e){var n;const t=!!this.hint,o="searchHint"in e?!!e.searchHint:t;if(t!==o)return!1;Object.assign(this.options,e);const i="pathMember"in e||"getPathCallback"in e||"parentPathMember"in e||"levelMember"in e||"hasChildrenMember"in e||"treePathSeparator"in e||"isTreeEnabled"in e||"isSelectableMember"in e||"getIsSelectableCallback"in e;if("options"in e&&e.options!==void 0?(this.allOptions=e.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]),("checkboxMode"in e||"cascadeSelectPolicy"in e)&&!i&&!("options"in e)&&this.isTreeMode()&&(this.cascadeIndex=this.isCascadeMode()?Co(this.tree,a=>String(this.getItemValue(a))):null,this.isCascadeMode()&&this.cascadeIndex)){this.cascadeCheckedAtoms=dt(this.cascadeIndex,this.selectedValues);const a=ms(this.cascadeIndex,this.cascadeCheckedAtoms,this.cascadePolicy(),c=>String(this.getItemValue(c))),l=new Map;for(const c of a){const d=((n=this.cascadeIndex.nodeByValue.get(c))==null?void 0:n.data)??this.selectedOptions.get(c);d!==void 0&&l.set(c,d)}this.selectedValues=new Set(a),this.selectedOptions=l}if(this.element.classList.toggle("ms--no-checkboxes",!this.options.isCheckboxesShown||!this.options.isMultipleEnabled),this.element.classList.toggle("ms--no-selected-popover",!this.options.isSelectedPopoverEnabled),"badgesPosition"in e){this.effectiveBadgesPosition=this.options.badgesPosition||"bottom",this.isRTL&&(this.effectiveBadgesPosition==="left"?this.effectiveBadgesPosition="right":this.effectiveBadgesPosition==="right"&&(this.effectiveBadgesPosition="left"));const a=this.element.querySelector(".ms__wrapper");a==null||a.classList.toggle("ms__wrapper--inline",this.effectiveBadgesPosition==="left"||this.effectiveBadgesPosition==="right")}return h(this,V)||(this.input.placeholder=this.getPlaceholderText()),"searchInputMode"in e&&(this.input.readOnly=this.options.searchInputMode==="readonly",this.input.style.visibility=this.options.searchInputMode==="hidden"?"hidden":""),"searchHint"in e&&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 searchText(){return this.searchTerm}get selectedValue(){if(!this.options.valueMember&&!this.options.getValueCallback)return null;if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const e=Array.from(this.selectedOptions.values()).map(t=>this.getItemValue(t));return this.options.isMultipleEnabled?e:e[0]??null}getValue(){if(this.selectedOptions.size===0)return this.options.isMultipleEnabled?[]:null;const e=Array.from(this.selectedOptions.values()).map(t=>this.getItemValue(t));return this.options.isMultipleEnabled?e:e[0]??null}spawnTooltip(e){var r;(r=this.tooltips.get(e.id))==null||r.destroy();const t=this.element.getRootNode(),o=t instanceof ShadowRoot?t:null,i=nn({trigger:e.trigger,container:this.options.container??o??document.body,content:e.content,placement:e.placement??this.options.badgeTooltipPlacement??"top",offset:e.offsetDistance??this.options.badgeTooltipOffset??8,delay:{show:e.showDelay??this.options.badgeTooltipDelay??100,hide:100},cssClass:e.cssClass??"ms__badge-tooltip",visibleClass:e.visibleClass??"ms__badge-tooltip--visible",followCursor:e.followCursor,onBeforeShow:e.onBeforeShow});this.tooltips.set(e.id,i)}destroyAllTooltips(){this.tooltips.forEach(e=>e.destroy()),this.tooltips.clear()}buildBadgeTooltipContent(e,t){if(this.options.getBadgeTooltipCallback)return this.options.getBadgeTooltipCallback(e,t);const o=this.getItemBadgeDisplayValue(e,t),i=this.getItemSubtitle(e);return i?`${o}
|
|
38
|
+
${i}`:o}buildRemoveButtonTooltipText(e,t,o){return t&&this.options.getRemoveButtonTooltipCallback?this.options.getRemoveButtonTooltipCallback(t,o):this.options.removeButtonTooltipText?this.options.removeButtonTooltipText.replace("{0}",e):`Remove ${e}`}attachBadgeTooltips(e){if(!this.options.isBadgeTooltipsEnabled)return;const t=!!e,o=this.badgeRenderContext(t),i=e||this.badgesContainer,r=t?"popover-":"";if(i.querySelectorAll(".ms__badge:not(.ms__badge--more)").forEach(a=>{const l=a.querySelector(".ms__badge-remove");if(!l)return;const c=l.dataset.value,d=this.selectedOptions.get(c);if(!d)return;const u=`${r}${c}`,f=`${r}${c}-remove`,p=a.querySelector(".ms__badge-text");p&&this.spawnTooltip({id:u,trigger:p,content:this.buildBadgeTooltipContent(d,o)});const g=this.getItemBadgeDisplayValue(d,o);this.spawnTooltip({id:f,trigger:l,content:this.buildRemoveButtonTooltipText(g,d,o),onBeforeShow:()=>{var w;return(w=this.tooltips.get(u))==null?void 0:w.hide()}})}),!t){const a=this.badgesContainer.querySelector(".ms__badge--more"),l=a==null?void 0:a.querySelector(".ms__badge-remove");if(l&&l.dataset.action==="remove-hidden"){const c=this.options.badgesMaxVisible||3,d=this.selectedOptions.size-c;this.spawnTooltip({id:"more-badge-remove",trigger:l,content:this.buildRemoveButtonTooltipText(`${d} hidden items`)})}}}buildOptionTooltipContent(e,t){if(this.options.getOptionTooltipCallback)return this.options.getOptionTooltipCallback(e,t);const o=this.getItemDisplayValue(e),i=this.getItemSubtitle(e);return i?`${o}
|
|
39
|
+
${i}`:o}attachOptionTooltips(){if(this.destroyAllOptionTooltips(),!this.options.isOptionTooltipsEnabled)return;this.dropdown.querySelectorAll(".ms__option").forEach(t=>{const o=t,i=parseInt(o.dataset.index??"-1",10);if(i<0)return;const r=this.filteredOptions[i];if(!r)return;const n=this.getItemValue(r),a={index:i,isSelected:this.selectedValues.has(String(n)),isFocused:i===this.focusedIndex,isMatched:this.matchingIndices.has(i),isDisabled:this.getItemDisabled(r),...he(this.presentationMode),isTreeNode:!1},l=this.buildOptionTooltipContent(r,a);l&&this.spawnTooltip({id:`option-${i}`,trigger:o,content:l,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})})}markTruncatedOptions(){if(this.presentationMode!=="fullscreen")return;this.dropdown.querySelectorAll(".ms__option").forEach(t=>{const o=t,i=o.querySelector(".ms__option-title"),r=!!i&&i.scrollWidth>i.clientWidth+1;o.classList.toggle("ms__option--truncated",r)})}toggleLabelReveal(e){var d;if(this.labelRevealPopover&&this.labelRevealTrigger===e){this.hideLabelReveal();return}this.hideLabelReveal();const t=e.closest(".ms__option");if(!t)return;const o=parseInt(t.dataset.index??"-1",10);if(o<0)return;const i=this.isTreeMode()?(d=this.treeNodes[o])==null?void 0:d.data:this.filteredOptions[o];if(!i)return;const r=this.buildOptionTooltipContent(i);if(!r)return;const n=document.createElement("div");n.className="ms__option-tooltip ms__option-tooltip--fullscreen",typeof r=="string"?n.textContent=r:n.appendChild(r);const a=this.element.getRootNode(),l=a instanceof ShadowRoot?a:null,c=this.options.container??l??document.body;this.labelRevealTrigger=e,this.labelRevealPanel=n,this.labelRevealPopover=an({reference:e,panel:n,container:c,placement:"top-end",offset:this.options.optionTooltipOffset??this.options.badgeTooltipOffset??8,shift:8,strategy:"fixed"}),this.labelRevealPopover.open(),requestAnimationFrame(()=>n.classList.add("ms__option-tooltip--visible"))}hideLabelReveal(){this.labelRevealPopover&&(this.labelRevealPopover.destroy(),this.labelRevealPopover=null),this.labelRevealPanel&&(this.labelRevealPanel.remove(),this.labelRevealPanel=null),this.labelRevealTrigger=null}showMessage(e,t){this.hideMessage();const o=(t==null?void 0:t.variant)??"info",i=(t==null?void 0:t.duration)??3e3,r=o==="error"||o==="warning",n=document.createElement("div");n.className=`ms__message ms__message--${o}`,n.setAttribute("role",r?"alert":"status"),n.setAttribute("aria-live",r?"assertive":"polite"),typeof e=="string"?n.textContent=e:n.appendChild(e),n.addEventListener("click",()=>this.hideMessage());const a=this.element.getRootNode(),l=a instanceof ShadowRoot?a:null;if((this.options.container??l??document.body).appendChild(n),this.messageEl=n,this.presentationMode==="fullscreen"&&(h(this,V)||this.showSelectedPopover))n.classList.add("ms__message--fullscreen");else{const u=at(n,this.inputWrapper,{strategy:"fixed",placement:(t==null?void 0:t.placement)??"bottom",offset:8,shift:8,lockPlacement:"freeze"});this.messageCleanup=()=>u.destroy()}requestAnimationFrame(()=>n.classList.add("ms__message--visible")),i>0&&(this.messageTimer=setTimeout(()=>this.hideMessage(),i))}hideMessage(){this.messageTimer!==null&&(clearTimeout(this.messageTimer),this.messageTimer=null),this.messageCleanup&&(this.messageCleanup(),this.messageCleanup=null),this.messageEl&&(this.messageEl.remove(),this.messageEl=null)}hideOptionTooltips(){for(const[e,t]of this.tooltips)e.startsWith("option-")&&t.hide()}destroyAllOptionTooltips(){var e;for(const t of Array.from(this.tooltips.keys()))t.startsWith("option-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}attachActionButtonTooltips(){this.dropdown.querySelectorAll(".ms__action-btn").forEach(t=>{var c,d;const o=t,i=o.dataset.action;if(!i)return;const r=parseInt(o.dataset.buttonIndex||"-1"),n=r>=0?(c=this.options.actionButtons)==null?void 0:c[r]:(d=this.options.actionButtons)==null?void 0:d.find(u=>u.action===i);if(!n)return;const a=n.getTooltipCallback?n.getTooltipCallback(this,this.buildActionContext(n)):n.tooltip;if(!a)return;const l=`action-${r>=0?r:i}`;this.spawnTooltip({id:l,trigger:o,content:a})})}destroyAllActionButtonTooltips(){var e;for(const t of Array.from(this.tooltips.keys()))t.startsWith("action-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}destroyAllBadgeTooltips(){var e;for(const t of Array.from(this.tooltips.keys()))!t.startsWith("action-")&&!t.startsWith("popover-")&&((e=this.tooltips.get(t))==null||e.destroy(),this.tooltips.delete(t))}destroy(){var e;this.destroyAllTooltips(),this.hideLabelReveal(),this.hideMessage(),this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0),this.abortInFlightSearch(),this.dropdownCleanup&&this.dropdownCleanup(),this.hintCleanup&&this.hintCleanup(),this.selectedPopoverCleanup&&this.selectedPopoverCleanup(),this.overlayHistoryActive&&(this.overlayHistoryActive=!1,typeof window<"u"&&window.removeEventListener("popstate",this.onOverlayPopstate)),this.exitFullscreen(),this.documentClickHandler&&(document.removeEventListener("click",this.documentClickHandler),this.documentClickHandler=null),this.documentKeydownHandler&&(document.removeEventListener("keydown",this.documentKeydownHandler),this.documentKeydownHandler=null),(e=this.overlayCoord)==null||e.dispose(),this.overlayCoord=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"),lt.info(`[${this.instanceId}] Component destroyed`)}}V=new WeakMap;function bn(){return{fromAttribute(s){if(s===null||s.trim()==="")return[];const e=s.trim();if(e.startsWith("["))try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map(t=>t.trim())},validate(s){return Array.isArray(s)&&s.every(e=>typeof e=="string"||typeof e=="number")},toAttribute(s){return Array.isArray(s)?JSON.stringify(s):null}}}const To=["json","csv","plain"],Io=",",Oo=`
|
|
40
|
+
`;function Mo(s,e,t={}){if(s==null||s.trim()==="")return{options:[]};const o=Po(t.splitter??Io)||Io,i=Po(t.rowSplitter??Oo)||Oo;switch(e){case"csv":return yn(s,o,i);case"plain":return wn(s,o,i);case"json":default:return vn(s)}}function Po(s){return s.replace(/\\[ntr\\]/g,e=>e==="\\n"?`
|
|
41
|
+
`:e==="\\t"?" ":e==="\\r"?"\r":"\\")}function vn(s){let e;try{e=JSON.parse(s)}catch(t){return{options:[],error:`data-options is not valid JSON: ${t.message}`}}return Array.isArray(e)?{options:e}:{options:[],error:"data-options JSON must be an array"}}function wn(s,e,t){return{options:s.split(t).flatMap(i=>i.split(e)).map(i=>i.trim()).filter(i=>i.length>0).map(i=>[i,i])}}function yn(s,e,t){const o=xn(s,e,t).filter(n=>!(n.length===1&&n[0].trim()===""));if(o.length<2)return{options:[],error:"data-options CSV needs a header row and at least one data row"};const i=o[0].map(n=>n.trim());return{options:o.slice(1).map(n=>{const a={};return i.forEach((l,c)=>{a[l]=(n[c]??"").trim()}),a})}}function xn(s,e,t){const o=[];let i=[],r="",n=!1;for(let a=0;a<s.length;){const l=s[a];if(n){l==='"'?s[a+1]==='"'?(r+='"',a+=2):(n=!1,a+=1):(r+=l,a+=1);continue}l==='"'?(n=!0,a+=1):s.startsWith(e,a)?(i.push(r),r="",a+=e.length):s.startsWith(t,a)?(i.push(r),o.push(i),i=[],r="",a+=t.length):(l==="\r"||(r+=l),a+=1)}return i.push(r),o.push(i),o}const Lo=`@layer variables,component,overrides;@layer variables{:host{display:block;--ms-rem: var(--base-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(#cbd5e1, #52525b));--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-toggle-icon-color: var(--ms-text-color-3);--ms-toggle-icon-color-open: var(--ms-text-color-3);--ms-toggle-icon-size: calc(1.6 * var(--ms-rem));--ms-toggle-rotate-closed: 90deg;--ms-toggle-rotate-open: -90deg;--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: color-mix(in srgb, var(--ms-badge-bg) 88%, var(--ms-badge-text-color) 12%);--ms-badge-bg-active: var(--ms-accent-color-light-hover);--ms-badge-text-bg-hover: color-mix(in srgb, var(--ms-badge-text-bg) 88%, var(--ms-badge-text-color) 12%);--ms-badge-text-color-hover: var(--ms-badge-text-color);--ms-badge-counter-border-color: var(--ms-border-color);--ms-badge-counter-text-bg: color-mix(in srgb, var(--ms-text-color-1) 10%, transparent);--ms-badge-counter-text-bg-hover: color-mix(in srgb, var(--ms-text-color-1) 16%, transparent);--ms-badge-counter-text-color: var(--ms-text-color-1);--ms-badge-counter-text-color-hover: var(--ms-text-color-1);--ms-badge-counter-remove-bg: color-mix(in srgb, var(--ms-text-color-1) 10%, transparent);--ms-badge-counter-remove-bg-hover: color-mix(in srgb, var(--ms-text-color-1) 16%, transparent);--ms-badge-counter-remove-color: var(--ms-text-color-3);--ms-badge-counter-remove-color-hover: var(--ms-text-color-1);--ms-counter-wrapper-border-color: var(--ms-border-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-input-padding-h: calc(1.2 * var(--ms-rem));--ms-input-gap: calc(.6 * 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: var(--base-input-bg-disabled, rgba(107, 114, 128, .05));--ms-toggle-color: var(--ms-text-color-3);--ms-transform-rotate-180: 180deg;--ms-input-clear-size: calc(2.4 * var(--ms-rem));--ms-input-clear-icon-size: calc(1.4 * var(--ms-rem));--ms-input-clear-color: var(--base-input-clear-color, var(--ms-text-secondary));--ms-input-clear-bg-hover: var(--base-input-clear-bg-hover, var(--ms-option-bg-matched, transparent));--ms-input-clear-border-radius: var(--ms-border-radius);--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-inner-border-radius: max(0px, calc(var(--ms-dropdown-border-radius) - 1px));--ms-dropdown-box-shadow: var(--base-dropdown-box-shadow, 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1));--ms-input-current-width: auto;--ms-dropdown-width: var(--ms-input-current-width);--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-z-index-fullscreen: 10001;--ms-z-index-fullscreen-tooltip: 10002;--ms-fullscreen-rem: 12px;--ms-fullscreen-bg: var(--ms-dropdown-bg);--ms-fullscreen-text-color: var(--ms-dropdown-text-color);--ms-fullscreen-header-bg: var(--ms-dropdown-bg);--ms-fullscreen-header-border: 1px solid var(--ms-dropdown-border-color);--ms-fullscreen-header-gap: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding-v: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding-h: calc(1.2 * var(--ms-fullscreen-rem));--ms-fullscreen-header-padding: var(--ms-fullscreen-header-padding-v) var(--ms-fullscreen-header-padding-h);--ms-fullscreen-header-min-height: calc(5.6 * var(--ms-fullscreen-rem));--ms-fullscreen-title-font-size: calc(1.7 * var(--ms-fullscreen-rem));--ms-fullscreen-title-font-weight: var(--base-font-weight-semibold, 600);--ms-fullscreen-search-border: var(--ms-input-border);--ms-fullscreen-search-border-radius: var(--ms-input-border-radius);--ms-fullscreen-search-padding: calc(.8 * var(--ms-fullscreen-rem)) calc(1.2 * var(--ms-fullscreen-rem));--ms-fullscreen-search-font-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-icon-size: calc(1.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-inset: calc(.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-gutter: calc(3.4 * var(--ms-fullscreen-rem));--ms-fullscreen-search-clear-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-search-clear-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-mode-toggle-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-mode-toggle-icon-size: calc(1.5 * var(--ms-fullscreen-rem));--ms-fullscreen-mode-toggle-gap: var(--ms-fullscreen-header-gap);--ms-fullscreen-mode-toggle-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-mode-toggle-bg: transparent;--ms-fullscreen-mode-toggle-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-close-size: calc(3.6 * var(--ms-fullscreen-rem));--ms-fullscreen-close-icon-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-close-color: var(--ms-dropdown-text-color);--ms-fullscreen-close-bg: transparent;--ms-fullscreen-close-border: none;--ms-fullscreen-close-border-radius: 50%;--ms-fullscreen-close-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-close-edge-nudge: calc(.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-size: calc(2.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-icon-size: calc(1.8 * var(--ms-fullscreen-rem));--ms-fullscreen-info-color: var(--ms-accent-color);--ms-fullscreen-info-bg-hover: var(--ms-option-bg-matched, transparent);--ms-fullscreen-nav-gap: calc(.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-padding-top: calc(.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-count-font-size: calc(1.3 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-count-color: var(--ms-text-muted-color, var(--ms-dropdown-text-color));--ms-fullscreen-nav-btn-size: calc(3.2 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-btn-icon-size: calc(1.6 * var(--ms-fullscreen-rem));--ms-fullscreen-nav-btn-color: var(--ms-dropdown-text-color);--ms-fullscreen-nav-btn-bg: var(--ms-option-bg-matched, transparent);--ms-fullscreen-nav-btn-bg-hover: color-mix(in srgb, var(--ms-accent-color) 22%, transparent);--ms-fullscreen-nav-btn-icon: var(--ms-icon-chevron);--ms-icon-chevron: var(--base-icon-chevron, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m9 18 6-6-6-6'/></svg>"));--ms-icon-info: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/><circle cx='12' cy='7.5' r='1.3' fill='black'/><path d='M12 11v6' stroke='black' stroke-width='2' stroke-linecap='round' fill='none'/></svg>");--ms-fullscreen-tree-base-indent: calc(.7 * var(--ms-fullscreen-rem));--ms-fullscreen-tree-indent: calc(1.2 * var(--ms-fullscreen-rem));--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: 0;--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-add-new-padding: var(--ms-option-padding);--ms-add-new-gap: var(--ms-option-gap);--ms-add-new-font-size: var(--ms-empty-font-size);--ms-add-new-color: var(--ms-accent-color);--ms-add-new-color-hover: var(--ms-accent-color);--ms-add-new-bg-hover: var(--ms-option-bg-hover);--ms-add-new-icon-size: calc(1.6 * var(--ms-rem));--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.4 * var(--ms-rem));--ms-icon-remove: var(--base-icon-remove, var(--base-icon-close, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M18 6 6 18'/><path d='m6 6 12 12'/></svg>")));--ms-icon-search-clear: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m13.5 8.5-5 5'/><path d='m8.5 8.5 5 5'/><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");--ms-icon-search: var(--base-icon-search, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>"));--ms-icon-filter: var(--base-icon-filter, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3'/></svg>"));--ms-icon-check: var(--base-icon-check, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>"));--ms-icon-indeterminate: var(--base-icon-indeterminate, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14'/></svg>"));--ms-icon-check-size: var(--base-icon-check-size, 68%);--ms-icon-add-new: var(--base-icon-plus, var(--base-icon-add, url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14'/><path d='M12 5v14'/></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: var(--ms-accent-color);--ms-count-clear-color-hover: var(--ms-text-color-on-accent);--ms-count-clear-icon-size: calc(1.4 * var(--ms-rem));--ms-icon-clear: var(--base-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-message-bg: var(--ms-message-info-bg);--ms-message-color: var(--ms-message-info-color);--ms-message-border: 1px solid transparent;--ms-message-border-radius: var(--ms-border-radius-lg);--ms-message-padding: calc(1 * var(--ms-rem)) calc(1.4 * var(--ms-rem));--ms-message-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-message-font-weight: var(--base-font-weight-medium, 500);--ms-message-max-width: calc(40 * var(--ms-rem));--ms-message-shadow: 0 4px 16px rgb(0 0 0 / .18);--ms-message-fullscreen-offset: calc(2.4 * var(--ms-fullscreen-rem));--ms-message-z-index: var(--ms-z-index-fullscreen-tooltip);--ms-message-info-bg: var(--ms-tooltip-bg);--ms-message-info-color: var(--ms-tooltip-text-color);--ms-message-warning-bg: var(--base-warning-bg, #f59e0b);--ms-message-warning-color: var(--base-warning-color, #1a1a1a);--ms-message-error-bg: var(--base-danger-bg, #ef4444);--ms-message-error-color: var(--base-danger-color, #ffffff);--ms-message-success-bg: var(--base-success-bg, #10b981);--ms-message-success-color: var(--base-success-color, #ffffff);--ms-z-index-popover: 10000;--ms-selected-popover-width: var(--ms-input-current-width);--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: var(--ms-accent-color);--ms-selected-popover-close-color-hover: var(--ms-text-color-on-accent);--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: var(--base-ease-standard, 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}:host([defer]:not([is-ready])){display:block;min-height:calc(3.5 * var(--ms-rem))}:host{-webkit-tap-highlight-color: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{box-sizing:border-box;position:relative;display:flex;align-items:center;gap:var(--ms-input-gap);height:var(--ms-input-height);padding-inline:var(--ms-input-padding-h);background:var(--ms-input-bg);color:var(--ms-input-color);border:var(--ms-input-border);border-radius:var(--ms-input-border-radius);cursor:pointer;transition:border var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__input-wrapper:hover:not(:focus-within){border:var(--ms-input-border-hover)}.ms__input-wrapper:focus-within{border:var(--ms-input-border-focus)}.ms__input{flex:1 1 auto;min-width:0;box-sizing:border-box;font-family:inherit;height:100%;padding:0;border:none;background:transparent;font-size:var(--ms-input-font-size);color:var(--ms-input-color);cursor:pointer;outline:none}.ms__input::placeholder{color:var(--ms-input-placeholder-color);opacity:0;transition:opacity var(--ms-transition-fast) var(--ms-easing-snappy)}:host([data-placeholder-ready]) .ms__input::placeholder{opacity:var(--ms-placeholder-opacity)}.ms__toggle{flex:0 0 auto;display:block;width:var(--ms-toggle-icon-size);height:var(--ms-toggle-icon-size);color:var(--ms-toggle-icon-color);cursor:pointer}.ms__toggle:before{content:"";display:block;width:100%;height:100%;background-color:currentColor;-webkit-mask:var(--ms-icon-chevron) center / contain no-repeat;mask:var(--ms-icon-chevron) center / contain no-repeat;transform:rotate(var(--ms-toggle-rotate-closed, 90deg));transition:transform var(--ms-transition-fast) var(--ms-easing-snappy)}.ms--open .ms__toggle{color:var(--ms-toggle-icon-color-open)}.ms--open .ms__toggle:before{transform:rotate(var(--ms-toggle-rotate-open, -90deg))}.ms__counter{flex:0 0 auto;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:scale(var(--ms-transform-scale-hover))}.ms__input-clear{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-input-clear-size);height:var(--ms-input-clear-size);padding:0;color:var(--ms-input-clear-color);background:transparent;border:none;border-radius:var(--ms-input-clear-border-radius);cursor:pointer;transition:background var(--ms-transition-fast) var(--ms-easing-snappy)}.ms__input-clear:hover{background:var(--ms-input-clear-bg-hover)}.ms__input-clear:before{content:"";display:block;width:var(--ms-input-clear-icon-size);height:var(--ms-input-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}.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)}@media (hover: hover){.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;box-sizing:border-box;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);width:var(--ms-dropdown-width);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--fullscreen,.ms__selected-popover--fullscreen{--ms-rem: var(--ms-fullscreen-rem);--ms-option-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-option-gap: calc(.8 * var(--ms-rem));--ms-option-title-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-option-subtitle-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-option-icon-font-size: calc(var(--base-font-size-base, 1.6) * var(--ms-rem));--ms-checkbox-size: calc(1.6 * var(--ms-rem));--ms-group-label-font-size: calc(var(--base-font-size-xs, 1.2) * var(--ms-rem));--ms-group-label-padding: calc(.4 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-tree-base-indent: var(--ms-fullscreen-tree-base-indent);--ms-tree-indent: var(--ms-fullscreen-tree-indent)}.ms__selected-popover--fullscreen{--ms-badge-gap: calc(.8 * var(--ms-rem));--ms-badge-height: calc(4.2 * var(--ms-rem));--ms-badge-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem));--ms-badge-text-padding: 0 calc(1.2 * var(--ms-rem));--ms-badge-remove-width: calc(3.6 * var(--ms-rem));--ms-badge-remove-icon-size: calc(1.2 * var(--ms-rem));--ms-badge-remove-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem))}.ms__dropdown--fullscreen{--ms-actions-gap: calc(.4 * var(--ms-rem));--ms-actions-padding: calc(.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-action-btn-padding: calc(.6 * var(--ms-rem)) calc(1.2 * var(--ms-rem));--ms-action-btn-font-size: calc(var(--base-font-size-sm, 1.4) * var(--ms-rem))}.ms__dropdown--fullscreen{position:fixed;top:0;inset-inline-start:0;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:none;border-radius:0;--ms-dropdown-inner-border-radius: 0;background:var(--ms-fullscreen-bg);color:var(--ms-fullscreen-text-color);z-index:var(--ms-z-index-fullscreen);box-sizing:border-box;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.ms__dropdown--fullscreen .ms__dropdown-inner{display:flex;flex-direction:column;flex:1;min-height:0;max-height:none;overflow:hidden}.ms__dropdown--fullscreen .ms__options{flex:1 1 0;min-height:0;height:auto;max-height:none;overflow-y:auto;padding-bottom:var(--ms-option-gap)}.ms__dropdown--fullscreen .ms__actions{flex:0 0 auto}.ms__fullscreen-header,.ms__selected-popover--fullscreen .ms__selected-popover-header{flex:0 0 auto;display:flex;align-items:center;flex-wrap:wrap;gap:var(--ms-fullscreen-header-gap);min-height:var(--ms-fullscreen-header-min-height);padding:var(--ms-fullscreen-header-padding);background:var(--ms-fullscreen-header-bg);border-bottom:var(--ms-fullscreen-header-border)}.ms__fullscreen-header{align-content:flex-start}.ms__fullscreen-header>.ms__fullscreen-search-wrapper{min-height:var(--ms-fullscreen-header-min-height)}.ms__fullscreen-nav{flex:0 0 100%;display:flex;align-items:center;justify-content:space-between;gap:var(--ms-fullscreen-nav-gap);padding-top:var(--ms-fullscreen-nav-padding-top)}.ms__fullscreen-nav-count{font-size:var(--ms-fullscreen-nav-count-font-size);color:var(--ms-fullscreen-nav-count-color)}.ms__fullscreen-nav-controls{display:flex;align-items:center;gap:var(--ms-fullscreen-nav-gap)}.ms__fullscreen-nav-btn{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-nav-btn-size);height:var(--ms-fullscreen-nav-btn-size);padding:0;color:var(--ms-fullscreen-nav-btn-color);background:var(--ms-fullscreen-nav-btn-bg);border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-nav-btn:hover:not(:disabled){background:var(--ms-fullscreen-nav-btn-bg-hover)}.ms__fullscreen-nav-btn:disabled{opacity:.4;cursor:default}.ms__fullscreen-nav-btn:before{content:"";display:block;width:var(--ms-fullscreen-nav-btn-icon-size);height:var(--ms-fullscreen-nav-btn-icon-size);background-color:currentColor;-webkit-mask:var(--ms-fullscreen-nav-btn-icon) center / contain no-repeat;mask:var(--ms-fullscreen-nav-btn-icon) center / contain no-repeat;transform:rotate(-90deg)}.ms__fullscreen-nav-btn--next:before{transform:rotate(90deg)}.ms__fullscreen-header>.ms__fullscreen-search-wrapper,.ms__selected-popover--fullscreen .ms__selected-popover-header>span{flex:1 1 0;min-width:0}.ms__fullscreen-search-wrapper{position:relative;display:flex;align-items:center}.ms__selected-popover--fullscreen .ms__selected-popover-header{font-size:var(--ms-fullscreen-title-font-size);font-weight:var(--ms-fullscreen-title-font-weight);color:var(--ms-fullscreen-text-color)}.ms__fullscreen-search{flex:1 1 auto;min-width:0;font-family:inherit;font-size:var(--ms-fullscreen-search-font-size);color:inherit;background:transparent;border:var(--ms-fullscreen-search-border);border-radius:var(--ms-fullscreen-search-border-radius);padding:var(--ms-fullscreen-search-padding);padding-inline-end:var(--ms-fullscreen-search-clear-gutter)}.ms__fullscreen-search:focus{outline:none;border:var(--ms-input-border-focus)}.ms__fullscreen-search-clear{position:absolute;inset-inline-end:var(--ms-fullscreen-search-clear-inset);top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-search-clear-size);height:var(--ms-fullscreen-search-clear-size);padding:0;color:var(--ms-fullscreen-search-clear-color);background:transparent;border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-search-clear:hover{background:var(--ms-fullscreen-search-clear-bg-hover)}.ms__fullscreen-search-clear:before{content:"";display:block;width:var(--ms-fullscreen-search-clear-icon-size);height:var(--ms-fullscreen-search-clear-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-search-clear) center / contain no-repeat;mask:var(--ms-icon-search-clear) center / contain no-repeat}.ms__fullscreen-mode-toggle{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-mode-toggle-size);height:var(--ms-fullscreen-mode-toggle-size);margin-inline-end:var(--ms-fullscreen-mode-toggle-gap);margin-inline-start:calc((var(--ms-fullscreen-close-size) - var(--ms-fullscreen-mode-toggle-size)) / 2 - var(--ms-fullscreen-close-edge-nudge));padding:0;color:var(--ms-fullscreen-mode-toggle-color);background:var(--ms-fullscreen-mode-toggle-bg);border:none;border-radius:50%;cursor:pointer}.ms__fullscreen-mode-toggle:hover{background:var(--ms-fullscreen-mode-toggle-bg-hover)}.ms__fullscreen-mode-toggle:before{content:"";display:block;width:var(--ms-fullscreen-mode-toggle-icon-size);height:var(--ms-fullscreen-mode-toggle-icon-size);background-color:currentColor;-webkit-mask:var(--ms-fullscreen-mode-toggle-icon, var(--ms-icon-search)) center / contain no-repeat;mask:var(--ms-fullscreen-mode-toggle-icon, var(--ms-icon-search)) center / contain no-repeat}.ms__fullscreen-mode-toggle[data-mode=navigate]{--ms-fullscreen-mode-toggle-icon: var(--ms-icon-search)}.ms__fullscreen-mode-toggle[data-mode=filter]{--ms-fullscreen-mode-toggle-icon: var(--ms-icon-filter)}.ms__fullscreen-close,.ms__selected-popover--fullscreen .ms__selected-popover-close{flex:0 0 auto;position:relative;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:var(--ms-fullscreen-close-size);height:var(--ms-fullscreen-close-size);margin-inline-end:calc(-1 * var(--ms-fullscreen-close-edge-nudge));padding:0;color:var(--ms-fullscreen-close-color);background:var(--ms-fullscreen-close-bg);border:var(--ms-fullscreen-close-border);border-radius:var(--ms-fullscreen-close-border-radius);cursor:pointer}.ms__fullscreen-close:after,.ms__selected-popover--fullscreen .ms__selected-popover-close:after{content:"";position:absolute;inset-block-start:calc(-1 * var(--ms-fullscreen-close-size));inset-block-end:calc(-1 * var(--ms-fullscreen-header-padding-v));inset-inline-end:calc(-1 * var(--ms-fullscreen-header-padding-h));inset-inline-start:calc(-1 * var(--ms-fullscreen-header-gap))}.ms__fullscreen-close:hover,.ms__selected-popover--fullscreen .ms__selected-popover-close:hover{background:var(--ms-fullscreen-close-bg-hover);color:var(--ms-fullscreen-close-color)}.ms__fullscreen-close:before,.ms__selected-popover--fullscreen .ms__selected-popover-close:before{content:"";display:block;width:var(--ms-fullscreen-close-icon-size);height:var(--ms-fullscreen-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__dropdown--fullscreen .ms__option-info{flex:0 0 auto;display:none;align-items:center;justify-content:center;width:var(--ms-fullscreen-info-size);height:var(--ms-fullscreen-info-size);margin-inline-start:var(--ms-option-gap);padding:0;color:var(--ms-fullscreen-info-color);background:transparent;border:none;border-radius:50%;cursor:pointer}.ms__dropdown--fullscreen .ms__option--truncated .ms__option-info{display:inline-flex}@media (hover: hover){.ms__dropdown--fullscreen .ms__option-info:hover{background:var(--ms-fullscreen-info-bg-hover)}}.ms__dropdown--fullscreen .ms__option-info:before{content:"";display:block;width:var(--ms-fullscreen-info-icon-size);height:var(--ms-fullscreen-info-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-info) center / contain no-repeat;mask:var(--ms-icon-info) center / contain no-repeat}.ms__dropdown-inner{flex:1;overflow-y:auto;border-radius:var(--ms-dropdown-inner-border-radius);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:hidden}.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__option-tooltip--fullscreen{z-index:var(--ms-z-index-fullscreen-tooltip)}.ms__message{position:fixed;z-index:var(--ms-message-z-index);box-sizing:border-box;max-width:var(--ms-message-max-width);padding:var(--ms-message-padding);font-family:inherit;font-size:var(--ms-message-font-size);font-weight:var(--ms-message-font-weight);line-height:var(--ms-line-height-normal);color:var(--ms-message-color);background:var(--ms-message-bg);border:var(--ms-message-border);border-radius:var(--ms-message-border-radius);box-shadow:var(--ms-message-shadow);cursor:pointer;opacity:0;transition:opacity var(--ms-transition-normal) ease;-webkit-tap-highlight-color:transparent}.ms__message--visible{opacity:1}.ms__message--info{background:var(--ms-message-info-bg);color:var(--ms-message-info-color)}.ms__message--warning{background:var(--ms-message-warning-bg);color:var(--ms-message-warning-color)}.ms__message--error{background:var(--ms-message-error-bg);color:var(--ms-message-error-color)}.ms__message--success{background:var(--ms-message-success-bg);color:var(--ms-message-success-color)}.ms__message--fullscreen{left:50%;right:auto;bottom:calc(var(--ms-message-fullscreen-offset) + env(safe-area-inset-bottom));transform:translate(-50%);max-width:min(var(--ms-message-max-width),calc(100vw - 4 * var(--ms-fullscreen-rem)));padding:calc(1 * var(--ms-fullscreen-rem)) calc(1.4 * var(--ms-fullscreen-rem));font-size:calc(var(--base-font-size-sm, 1.4) * var(--ms-fullscreen-rem))}.ms__selected-popover{display:none;position:fixed;box-sizing:border-box;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--fullscreen{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:none;border-radius:0;overflow:hidden;background:var(--ms-fullscreen-bg);color:var(--ms-fullscreen-text-color);z-index:var(--ms-z-index-fullscreen);box-sizing:border-box;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.ms__selected-popover--fullscreen .ms__selected-popover-body{flex:1 1 0;min-height:0;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);flex-shrink:0}.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-wrapper{opacity:var(--ms-disabled-input-opacity);background:var(--ms-input-bg-disabled);cursor:not-allowed}.ms--disabled .ms__input{cursor:not-allowed}.ms--no-checkboxes .ms__option{gap:0;padding-inline-start:var(--ms-option-padding-h)}.ms--no-checkboxes .ms__option-content{padding-inline-start:0}.ms--no-selected-popover .ms__counter,.ms--no-selected-popover .ms__badge[data-action=show-selected],.ms--no-selected-popover .ms__badge--counter,.ms--no-selected-popover .ms__badge--more{cursor:default}}@layer component{@keyframes ms-spin{to{transform:rotate(360deg)}}}@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--custom{display:block;height:auto;max-width:none;overflow:visible;border-radius:0;font-size:inherit;font-weight:inherit}.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-inline-end:none;border-start-start-radius:var(--ms-badge-border-radius);border-end-start-radius:var(--ms-badge-border-radius);border-start-end-radius:0;border-end-end-radius:0;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;padding:0;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-inline-start:none;border-start-end-radius:var(--ms-badge-border-radius);border-end-end-radius:var(--ms-badge-border-radius);border-start-start-radius:0;border-end-start-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-inline-end: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-inline-start:none}.ms__badge--counter .ms__badge-remove:hover{background:var(--ms-badge-counter-remove-bg-hover);color:var(--ms-badge-counter-remove-color-hover, var(--ms-badge-counter-remove-color))}.ms__badge--counter:hover .ms__badge-text{background:var(--ms-badge-counter-text-bg-hover, var(--ms-badge-counter-text-bg));color:var(--ms-badge-counter-text-color-hover, var(--ms-badge-counter-text-color))}.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-inline-end: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__group-label--selectable{display:flex;align-items:center;gap:var(--ms-option-gap);cursor:pointer;-webkit-user-select:none;user-select:none}@media (hover: hover){.ms__group-label--selectable:hover{background:var(--ms-option-bg-hover)}}.ms__group-label--has-count{display:flex;align-items:center;gap:var(--ms-option-gap)}.ms__group-count{margin-inline-start:auto;flex:0 0 auto;box-sizing:border-box;min-width:calc(2 * var(--ms-rem));padding-block:0;padding-inline:calc(.4 * var(--ms-rem));background:var(--ms-counter-badge-bg);color:var(--ms-counter-badge-color);font-weight:var(--ms-counter-font-weight);border-radius:var(--ms-counter-border-radius);text-align:center}.ms__option{display:flex;align-items:var(--ms-checkbox-align, center);gap:var(--ms-option-gap);padding:var(--ms-option-padding);position:relative;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}@media (hover: hover){.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)}.ms__option--matched:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;border-inline-start:var(--ms-option-border-matched);pointer-events:none}.ms__option--selected{background:var(--ms-option-bg-selected)}@media (hover: hover){.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)}@media (hover: hover){.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)}.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-checkbox-margin-top: calc(.2 * var(--ms-rem))}.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-inline-end:var(--ms-checkbox-margin-right);margin-bottom:var(--ms-checkbox-margin-bottom);margin-inline-start: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;top:0;right:0;bottom:0;left:0;background-color:var(--ms-checkbox-checkmark-color);-webkit-mask:var(--ms-icon-check) no-repeat center / var(--ms-icon-check-size);mask:var(--ms-icon-check) no-repeat center / var(--ms-icon-check-size)}.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;-webkit-mask-image:var(--ms-icon-indeterminate);mask-image:var(--ms-icon-indeterminate)}.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)}@media (hover: hover){.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))}@media (hover: hover){.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)}@media (hover: hover){.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))}@media (hover: hover){.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__add-new{display:flex;align-items:center;gap:var(--ms-add-new-gap);padding:var(--ms-add-new-padding);font-size:var(--ms-add-new-font-size);color:var(--ms-add-new-color);cursor:pointer;user-select:none;-webkit-user-select:none}@media (hover: hover){.ms__add-new:hover{background:var(--ms-add-new-bg-hover);color:var(--ms-add-new-color-hover)}}.ms__add-new--focused{background:var(--ms-add-new-bg-hover);color:var(--ms-add-new-color-hover)}.ms__add-new--loading{cursor:default}.ms__add-new-spinner{flex-shrink:0;width:var(--ms-add-new-icon-size);height:var(--ms-add-new-icon-size);border-radius:50%;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;animation:ms-spin .6s linear infinite}@media (prefers-reduced-motion: reduce){.ms__add-new-spinner{animation-duration:1.5s}}.ms__add-new-icon{flex-shrink:0;width:var(--ms-add-new-icon-size);height:var(--ms-add-new-icon-size);background-color:currentColor;-webkit-mask:var(--ms-icon-add-new) center / contain no-repeat;mask:var(--ms-icon-add-new) center / contain no-repeat}.ms__add-new-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.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__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__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)}}@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}}`,Eo=["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"],z=()=>Zo(),_n=[{configKey:"searchHint",attribute:"search-hint",converter:E({isNullable:!0}),on:"update",description:"Small hint text shown beneath the search input."},{configKey:"searchPlaceholder",attribute:"search-placeholder",converter:E({isNullable:!0}),on:"update",description:'Placeholder text for the search input. When unset it defaults to "Search..."; if `show-search-mode-toggle` is on, the default instead becomes mode-aware ("Search…" in navigate, "Filter…" in filter). An explicit value always wins and stays fixed.'},{configKey:"selectPlaceholder",attribute:"select-placeholder",converter:E({default:"Pick an option..."}),on:"update",description:"Placeholder shown on the control when nothing is selected."},{configKey:"noDataPlaceholder",attribute:"no-data-placeholder",converter:E({isNullable:!0}),on:"update",description:"Text shown when there are no options at all."},{configKey:"dropdownMinWidth",attribute:"dropdown-min-width",converter:E({isNullable:!0}),on:"update",description:"Minimum width of the dropdown panel (any CSS length)."},{configKey:"dropdownMaxWidth",attribute:"dropdown-max-width",converter:E({isNullable:!0}),on:"update",description:"Maximum width of the dropdown panel (any CSS length)."},{configKey:"maxHeight",attribute:"max-height",converter:E({default:"20rem"}),on:"update",description:"Maximum height of the dropdown list before it scrolls."},{configKey:"emptyMessage",attribute:"empty-message",converter:E({default:"No results found"}),on:"update",description:"Message shown when a search yields no matches."},{configKey:"addNewText",attribute:"add-new-text",converter:E({isNullable:!0}),on:"update",description:'Template for the clickable "add new" prompt shown (when `allow-add-new` is on) in place of the empty message once a search yields no matches. `{value}` is replaced with the typed text. Default: `Add "{value}"`. A `getAddNewTextCallback` wins.'},{configKey:"addNewPendingText",attribute:"add-new-pending-text",converter:E({isNullable:!0}),on:"update",description:'Template for the pending prompt (spinner + text) shown while an async `addNewCallback` runs. `{value}` is replaced with the typed text. Default: `Adding "{value}"…`.'},{configKey:"loadingMessage",attribute:"loading-message",converter:E({default:"Loading..."}),on:"update",description:"Message shown while options are loading."},{configKey:"removeButtonTooltipText",attribute:"remove-button-tooltip-text",converter:E({isNullable:!0}),on:"update",description:"Tooltip text for a badge remove (×) button."},{configKey:"formFieldId",attribute:"name",converter:E({isNullable:!0}),on:"reinit",description:"HTML form field name/id used for the hidden input(s)."},{configKey:"customStyles",attribute:"custom-styles",converter:E({isNullable:!0}),on:"update",description:"Raw CSS injected into the Shadow DOM — the declarative alternative to `customStylesCallback`. The value is a full stylesheet (selectors and all), dropped verbatim into a replaceable style slot at the top of the shadow root. `customStylesCallback` takes precedence when both are set."},{configKey:"dropdownWidth",attribute:"dropdown-width",converter:E({isNullable:!0}),on:"update",description:"Fixed dropdown width; mirrored to the `--ms-dropdown-width` CSS variable."},{configKey:"selectedPopoverWidth",attribute:"selected-popover-width",converter:E({isNullable:!0}),on:"update",description:"Selected-items popover width; mirrored to `--ms-selected-popover-width`."},{configKey:"valueMember",attribute:"value-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name on an option object that holds its value."},{configKey:"displayValueMember",attribute:"display-value-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option display label."},{configKey:"searchValueMember",attribute:"search-value-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name searched against (falls back to the display value)."},{configKey:"iconMember",attribute:"icon-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option icon."},{configKey:"subtitleMember",attribute:"subtitle-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option subtitle."},{configKey:"fullTitleMember",attribute:"full-title-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that holds an option full/long title."},{configKey:"groupMember",attribute:"group-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name used to group options under headers."},{configKey:"disabledMember",attribute:"disabled-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name that marks an option disabled."},{configKey:"pathMember",attribute:"path-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node materialized tree path."},{configKey:"parentPathMember",attribute:"parent-path-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node parent path."},{configKey:"levelMember",attribute:"level-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name holding a node depth level."},{configKey:"hasChildrenMember",attribute:"has-children-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name flagging that a node has children."},{configKey:"isSelectableMember",attribute:"is-selectable-member",converter:E({isNullable:!0}),reflect:!0,on:"reinit",description:"Property name marking whether a node can be selected."},{configKey:"treePathSeparator",attribute:"tree-path-separator",converter:E({default:"."}),reflect:!0,on:"reinit",description:"Separator between segments in a materialized tree path."},{configKey:"isTreeEnabled",converter:W("tristate"),on:"reinit",type:"boolean",description:"Force tree mode on/off. Property-only; when unset (null) tree mode auto-enables if a path source (path-member / getPathCallback) is present."},{configKey:"checkboxMode",attribute:"checkbox-mode",converter:T(["independent","cascade"],{default:"cascade"}),reflect:!0,on:"update",description:"Tree checkbox interaction.\n- `cascade` (default) — checks a node's whole subtree and shows a tristate (checked / indeterminate / unchecked) box on branches. This is what most tree-select UIs do, so it's the default.\n- `independent` — toggles only the clicked node, ignoring ancestors/descendants.\n\nTree + multiple only — has no effect on flat lists or single-select (there is no subtree to cascade into)."},{configKey:"cascadeSelectPolicy",attribute:"cascade-select-policy",converter:T(["rolled-up","leaves","all"],{default:"rolled-up"}),reflect:!0,on:"update",description:"In `cascade` mode, which values a selection emits (badges / form / change):\n- `rolled-up` (default) — minimal cover: a fully-selected subtree collapses to its root; partially-selected branches emit their individually-checked descendants.\n- `leaves` — only the checked leaf-level nodes.\n- `all` — every fully-checked node (branches and leaves)."},{configKey:"groupSelectMode",attribute:"group-select-mode",converter:T(["none","cascade"],{default:"none"}),reflect:!0,on:"update",description:"Group-header selection in a FLAT (non-tree) grouped, multi-select list.\n- `none` (default) — group headers are inert labels.\n- `cascade` — each header shows a tristate checkbox that checks/unchecks all of that group's currently-visible members; a partially-selected group reads indeterminate. The group itself is never a selected value (getValue / badges / form carry member values only).\n\nFlat + multiple only — no effect in tree mode (use `checkbox-mode`) or single-select."},{configKey:"badgesDisplayMode",attribute:"badges-display-mode",converter:T(["badges","count","compact","partial","none"],{default:"badges"}),on:"update",description:"How the current selection is shown in the control."},{configKey:"badgesPosition",attribute:"badges-position",converter:T(["top","bottom","left","right"],{default:"bottom"}),on:"update",description:"Where the badges/selection appear relative to the input."},{configKey:"badgesThresholdMode",attribute:"badges-threshold-mode",converter:T(["count","partial"],{default:"count"}),on:"update",description:'How `badgesThreshold` is interpreted: collapse to a count badge, or keep partial badges + a "more" badge.'},{configKey:"selectedOrder",attribute:"selected-order",converter:T(["as-selected","label-asc","label-desc","member","custom"],{default:"as-selected"}),reflect:!0,on:"update",description:'Order of the CURRENTLY-SELECTED items where they are displayed — badges, partial mode (which items sit behind the "+N more" badge), and the selected-items popover. Display only: `getValue()`, the form output, and `getSelected()` keep as-selected (insertion) order, and the options dropdown is never reordered.\n- `as-selected` (default) — the order items were picked.\n- `label-asc` / `label-desc` — by the badge label, A→Z / Z→A (locale-aware).\n- `member` — by the `selected-order-member` property (or `getSelectedOrderCallback`); numeric keys sort numerically, everything else with a locale string compare.\n- `custom` — delegate to `selectedOrderCompareCallback`.'},{configKey:"selectedOrderMember",attribute:"selected-order-member",converter:E({isNullable:!0}),reflect:!0,on:"update",description:'Property name used as the sort key when `selected-order="member"`. Sorts the SELECTED-items display only (not the dropdown). Overridden by `getSelectedOrderCallback`.'},{configKey:"searchInputMode",attribute:"search-input-mode",converter:T(["normal","readonly","hidden"],{default:"normal"}),on:"reinit",description:"Search field mode: editable, read-only, or hidden."},{configKey:"searchMode",attribute:"search-mode",converter:T(["filter","navigate"],{default:"filter"}),on:"reinit",description:"Whether typing filters the list or navigates it."},{configKey:"overlayGroup",attribute:"overlay-group",converter:E({isNullable:!0}),on:"reinit",description:'Scope the "one overlay open at a time" coordination to a named group. Overlays (multiselects, datepickers, external popovers) sharing a group dismiss each other when one opens; different groups are independent. Unset = the default (ungrouped) group.'},{configKey:"actionsLayout",attribute:"actions-layout",converter:T(["nowrap","wrap"],{default:"nowrap"}),on:"reinit",description:"Whether the action bar wraps or stays on one line."},{configKey:"actionsPosition",attribute:"actions-position",converter:T(["top","bottom"],{default:"top"}),on:"reinit",description:"Whether the action bar sits above or below the list."},{configKey:"actionsAlign",attribute:"actions-align",converter:T(["stretch","left","right","center","space-between"],{default:"stretch"}),on:"update",description:"Horizontal alignment of the action buttons."},{configKey:"checkboxAlign",attribute:"checkbox-align",converter:T(["top","center","bottom"],{default:"center"}),on:"update",description:"Vertical alignment of an option checkbox."},{configKey:"valueFormat",attribute:"value-format",converter:T(["json","csv","array"],{default:"json"}),on:"reinit",description:"Serialization format the control emits its value in."},{configKey:"badgeTooltipPlacement",attribute:"badge-tooltip-placement",converter:T(Eo,{default:"top"}),on:"update",description:"Preferred placement of a badge tooltip relative to its badge (floating-ui placement)."},{configKey:"optionTooltipPlacement",attribute:"option-tooltip-placement",converter:T(Eo,{default:"top-start"}),on:"update",description:"Preferred placement of an option tooltip (floating-ui placement)."},{configKey:"mobilePresentation",attribute:"mobile-presentation",converter:T(["auto","floating","fullscreen"],{default:"auto"}),reflect:!0,on:"update",description:"How the open dropdown is presented on phones. `auto` (default) keeps the floating panel on desktop/tablet and switches to a full-screen overlay on phone-sized touch devices (touch primary + shorter viewport side < 600px, orientation-robust); `floating` forces the anchored panel everywhere; `fullscreen` forces the full-screen overlay on any device (handy for previews/testing). Resolved reactively from the device/viewport environment."},{configKey:"fullscreenAutofocus",attribute:"fullscreen-autofocus",converter:W("default-false"),on:"update",description:"In the phone fullscreen overlay, auto-focus the search field on open (pops the soft keyboard immediately). Default `false`: the sheet opens with the list visible and the keyboard closed, appearing only when the user taps the search. Set `true` to type-to-filter right away. No effect in the floating presentation."},{configKey:"badgesThreshold",attribute:"badges-threshold",converter:R(),on:"update",description:"Threshold at which badges collapse to a count/compact view."},{configKey:"badgesMaxVisible",attribute:"badges-max-visible",converter:R(),on:"update",description:"Maximum number of badges rendered before overflow."},{configKey:"collapseBadgesBelow",attribute:"collapse-badges-below",converter:R(),on:"update",description:'Container-responsive opt-in (off by default). When set to a px width, the control watches its OWN border box (not the window, via the core `resized` hook / a shared ResizeObserver) and collapses `badges-display-mode` to `count` ("N selected") while the box is narrower than this — so a picker in a narrow column/sidebar never overflows with pills, even on a wide monitor. Widening past the threshold restores the configured badges mode. Element-only: the override is applied to the live picker, never to your `badges-display-mode` config.'},{configKey:"minSearchLength",attribute:"min-search-length",converter:R({default:0}),on:"update",description:"Minimum characters before searching/filtering starts."},{configKey:"searchDebounce",attribute:"search-debounce",converter:R({default:0}),on:"update",description:"Debounce delay in ms applied to the search input."},{configKey:"virtualScrollThreshold",attribute:"virtual-scroll-threshold",converter:R({default:100}),on:"reinit",description:"Option count above which virtual scrolling turns on."},{configKey:"optionHeight",attribute:"option-height",converter:R({default:50}),on:"update",description:"Fixed row height in px used by virtual scrolling."},{configKey:"badgeHeight",attribute:"badge-height",converter:R({default:36}),on:"update",description:"Fixed badge height in px used for layout/virtualization."},{configKey:"virtualScrollBuffer",attribute:"virtual-scroll-buffer",converter:R({default:10}),on:"update",description:"Extra rows rendered above/below the viewport when virtualizing."},{configKey:"badgeTooltipDelay",attribute:"badge-tooltip-delay",converter:R({default:100}),on:"update",description:"Delay in ms before a badge tooltip appears."},{configKey:"badgeTooltipOffset",attribute:"badge-tooltip-offset",converter:R({default:8}),on:"update",description:"Gap in px between a badge and its tooltip."},{configKey:"optionTooltipDelay",attribute:"option-tooltip-delay",converter:R(),on:"update",description:"Delay in ms before an option tooltip appears (falls back to badgeTooltipDelay)."},{configKey:"optionTooltipOffset",attribute:"option-tooltip-offset",converter:R(),on:"update",description:"Gap in px between an option and its tooltip."},{configKey:"isMultipleEnabled",attribute:"multiple",converter:W("default-true"),on:"reinit",description:"Allow selecting multiple options. When off, selecting one replaces the previous."},{configKey:"isGroupsAllowed",attribute:"allow-groups",converter:W("default-true"),on:"reinit",description:"Allow grouping options under group headers."},{configKey:"isCheckboxesShown",attribute:"show-checkboxes",converter:W("default-true"),on:"reinit",description:"Show a checkbox on each option."},{configKey:"isActionsSticky",attribute:"sticky-actions",converter:W("default-true"),on:"update",description:"Keep the action bar pinned while the list scrolls."},{configKey:"isPlacementLocked",attribute:"lock-placement",converter:W("default-true"),on:"update",description:"Keep the dropdown initial placement instead of flipping when it fits."},{configKey:"isSearchEnabled",attribute:"enable-search",converter:W("default-true"),on:"reinit",description:"Show the search input."},{configKey:"isKeepOptionsOnSearch",attribute:"keep-options-on-search",converter:W("default-true"),on:"update",description:"Keep already-selected options visible while filtering."},{configKey:"shouldKeepSearchOnClose",attribute:"should-keep-search-on-close",converter:W("default-true"),on:"update",description:"Preserve the search text after the dropdown closes."},{configKey:"isSelectedPopoverEnabled",attribute:"enable-selected-popover",converter:W("default-true"),on:"update",description:'Allow the selected-items popover to open (from the count/compact/"+X more" badge or the in-input counter). Turn off when you render your own selection UI, so those affordances become inert.'},{configKey:"isCloseOnSelect",attribute:"close-on-select",converter:W("default-false"),on:"update",description:"Close the dropdown immediately after a selection."},{configKey:"isAddNewAllowed",attribute:"allow-add-new",converter:W("default-false"),on:"reinit",description:"Allow adding a new option from the search text."},{configKey:"isCounterShown",attribute:"show-counter",converter:W("default-false"),on:"update",description:"Show a selected-count indicator."},{configKey:"isClearShown",attribute:"show-clear",converter:W("default-false"),on:"update",description:"Show an inline clear (✕) button inside the input that wipes the whole selection. Appears only while something is selected and the control is enabled; clicking it clears the selection and any search text, fires `change`, and refocuses."},{configKey:"isBadgeFullTitleShown",attribute:"show-badge-full-title",converter:W("default-false"),on:"update",description:"Show the full title on badges instead of the short label."},{configKey:"isVirtualScrollEnabled",attribute:"enable-virtual-scroll",converter:W("default-false"),on:"reinit",description:"Force virtual scrolling on regardless of the threshold."},{configKey:"isBadgeTooltipsEnabled",attribute:"enable-badge-tooltips",converter:W("default-false"),on:"update",description:"Enable tooltips on badges."},{configKey:"isOptionTooltipsEnabled",attribute:"enable-option-tooltips",converter:W("default-false"),on:"update",description:"Enable tooltips on options."},{configKey:"isOptionTooltipFollowCursor",attribute:"option-tooltip-follow-cursor",converter:W("default-false"),on:"update",description:"Make option tooltips follow the pointer."},{configKey:"isSearchModeToggleShown",attribute:"show-search-mode-toggle",converter:W("default-false"),on:"update",description:"Show a clickable toggle in the phone fullscreen overlay search header that flips `search-mode` between `filter` and `navigate` live. Fullscreen-only; no effect in the floating presentation or when search is disabled."},{configKey:"initialValues",attribute:"initial-values",converter:bn(),default:[],on:"reinit",type:"Array<string | number>",description:'Values selected on first render. Accepts a JSON array (`["a","b"]`) or a bare CSV (`a,b,c`).'},{configKey:"showDebugInfo",attribute:"show-debug-info",converter:W("default-false"),on:"update",description:"Render an in-component debug panel.",deprecated:"Use per-instance logging (el.enableLogging()) instead."},{configKey:"deferRender",attribute:"defer",converter:W("presence"),on:"reinit",description:"Hold the initial render. When the `defer` attribute is present on upgrade the component builds nothing (it only reserves space) — so options, callbacks (e.g. `customStylesCallback`) and event listeners can all be wired first, then released with `el.ready()` (or by removing the `defer` attribute, for server-driven frameworks). The release builds the picker ONCE with everything already in place, avoiding the upgrade-then-restyle flash. Absent (default): builds immediately on connect. Latched — once released the gate never re-closes."},{configKey:"options",converter:Yo(),on:"reinit",type:"ReadonlyArray<Record<string, unknown>>",description:"The array of option objects to render. The JS API — assign `el.options` directly. For HTML authoring use the `data-options` attribute (parsed per `data-options-format`) or declarative <option> children; both feed the same list and take precedence over this property in the order: <option> children > property > data-options."},{configKey:"optionsSource",attribute:"data-options",converter:E({isNullable:!0}),on:"reinit",type:"string",description:"HTML-authoring source for the option list, parsed per `data-options-format`. Reactive: changing either attribute re-renders. Prefer the `options` property in JS; a set `options` property and declarative <option> children both win over this."},{configKey:"optionsFormat",attribute:"data-options-format",converter:T(To,{default:"json"}),on:"reinit",type:"'json' | 'csv' | 'plain'",description:"How to parse the `data-options` attribute: `json` (a JSON array of objects or [value, label] tuples), `csv` (rows split on `data-options-row-splitter`, cells on `data-options-splitter`; the first row is a header — map columns via *-member), or `plain` (bare values split on both splitters -> [value, label] tuples, value === label). Default `json`."},{configKey:"optionsSplitter",attribute:"data-options-splitter",converter:E({default:","}),on:"reinit",type:"string",description:'Field/cell delimiter for the `csv` and `plain` `data-options` formats. Default `,`. Escapes `\\t` `\\n` `\\r` are honoured (e.g. `data-options-splitter="\\t"` for TSV). Ignored for `json`.'},{configKey:"optionsRowSplitter",attribute:"data-options-row-splitter",converter:E({default:`
|
|
42
|
+
`}),on:"reinit",type:"string",description:'Row/record delimiter for the `csv` and `plain` `data-options` formats. Default newline. Escapes honoured (e.g. `data-options-row-splitter=";"` for single-line data). Ignored for `json`.'},{configKey:"actionButtons",converter:Jo({validate:s=>Array.isArray(s)}),on:"reinit",type:"Array<Record<string, unknown>>",description:"Custom action buttons for the dropdown footer/header. Property-only; when unset the default Select-All / Clear buttons apply."},{configKey:"getValueCallback",converter:z(),on:"reinit",type:"(item: unknown) => string | number",description:"Extract an option value (overrides valueMember)."},{configKey:"getPathCallback",converter:z(),on:"reinit",type:"(item: unknown) => string",description:"Extract a node tree path (enables tree mode; overrides pathMember)."},{configKey:"getGroupCallback",converter:z(),on:"reinit",type:"(item: unknown) => string",description:"Extract the group name from an option (overrides groupMember)."},{configKey:"getDisabledCallback",converter:z(),on:"reinit",type:"(item: unknown) => boolean",description:"Whether an option is disabled (overrides disabledMember)."},{configKey:"getIsSelectableCallback",converter:z(),on:"reinit",type:"(node: unknown) => boolean",description:"Whether a tree node can be selected (overrides is-selectable-member)."},{configKey:"getSearchValueCallback",converter:z(),on:"reinit",type:"(item: unknown) => string",description:"Text an option is searched against (overrides searchValueMember)."},{configKey:"searchCallback",converter:z(),on:"reinit",type:"(searchTerm: string, signal?: AbortSignal) => Promise<unknown[]>",description:"Custom / async search; return the filtered options."},{configKey:"getDisplayValueCallback",converter:z(),on:"update",type:"(item: unknown) => string",description:"Compute the display label for an option (overrides displayValueMember)."},{configKey:"getBadgeDisplayCallback",converter:z(),on:"update",type:"(item: unknown) => string",description:"Compute the text shown on an option badge."},{configKey:"getBadgeClassCallback",converter:z(),on:"update",type:"(item: unknown) => string | string[]",description:"Extra CSS class(es) for an option badge."},{configKey:"getSelectedOrderCallback",converter:z(),on:"update",type:"(item: unknown) => string | number",description:'Sort key for the selected-items display when `selected-order="member"` (overrides `selected-order-member`).'},{configKey:"selectedOrderCompareCallback",converter:z(),on:"update",type:"(a: unknown, b: unknown) => number",description:'Comparator for the selected-items display when `selected-order="custom"`.'},{configKey:"getIconCallback",converter:z(),on:"update",type:"(item: unknown) => string",description:"Icon for an option (overrides iconMember)."},{configKey:"getSubtitleCallback",converter:z(),on:"update",type:"(item: unknown) => string",description:"Subtitle for an option (overrides subtitleMember)."},{configKey:"getFullTitleCallback",converter:z(),on:"update",type:"(item: unknown) => string",description:"Full title for an option (used by badges when show-badge-full-title is on)."},{configKey:"getCounterCallback",converter:z(),on:"update",type:"(count: number, moreCount?: number) => string",description:"Render the selected-count label."},{configKey:"getCountLabelCallback",converter:z(),on:"update",type:"(selected: number, total: number) => string",description:"Format the small count chip shared by the in-input counter and each group header count (default `[selected]`; e.g. `(s,t)=>`${s}/${t}``). One callback drives both."},{configKey:"getValueFormatCallback",converter:z(),on:"update",type:"(selectedValues: (string | number)[]) => string",description:"Serialize the selected values for form submission."},{configKey:"getBadgeTooltipCallback",converter:z(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Tooltip content for an option badge."},{configKey:"getOptionTooltipCallback",converter:z(),on:"update",type:"(item: unknown) => string | HTMLElement",description:"Tooltip content for an option row."},{configKey:"getRemoveButtonTooltipCallback",converter:z(),on:"update",type:"(item: unknown) => string",description:"Tooltip text for a badge remove button."},{configKey:"getSelectedItemClassCallback",converter:z(),on:"update",type:"(item: unknown) => string | string[]",description:"Extra CSS class(es) for a selected item."},{configKey:"renderOptionContentCallback",converter:z(),on:"update",type:"(item: unknown, context: OptionContentRenderContext) => string | HTMLElement",description:"Custom render for an option row; may return HTML or an element."},{configKey:"renderBadgeContentCallback",converter:z(),on:"update",type:"(item: unknown, context: BadgeContentRenderContext) => string | HTMLElement",description:"Custom render for a badge content (fills the built-in pill); may return HTML or an element."},{configKey:"renderBadgeCallback",converter:z(),on:"update",type:"(item: unknown, context: BadgeContentRenderContext) => string | HTMLElement | null",description:'Custom render for the WHOLE badge (main area), not just its content — return the entire pill/card. The component wraps it in `.ms__badge.ms__badge--custom` with `data-value` and delegates removal to any inner element with `data-action="remove"` (or `.ms__badge-remove`). Return null/empty to fall back to the default pill for that item.'},{configKey:"renderGroupLabelContentCallback",converter:z(),on:"update",type:"(groupName: string, context: GroupLabelRenderContext) => string | HTMLElement",description:"Customize a group label; may return an HTML string or element. The second arg carries the group members + selection (e.g. `context.selectedCount`) so a custom header can show a per-group count."},{configKey:"renderSelectedContentCallback",converter:z(),on:"update",type:"(item: unknown, context: SelectedContentRenderContext) => string",description:"Custom render for the single-select selected value (2nd arg carries the presentation context)."},{configKey:"renderSelectedItemContentCallback",converter:z(),on:"update",type:"(item: unknown, context: BadgeContentRenderContext) => string | HTMLElement",description:"Custom render for one selected item in the popover (2nd arg is a BadgeContentRenderContext; isInPopover=true)."},{configKey:"customStylesCallback",converter:z(),on:"update",type:"() => string",description:"Returns a CSS string injected into the component via a replaceable style slot (§12.8)."},{configKey:"beforeSearchCallback",converter:z(),on:"update",type:"(searchTerm: string) => string | null",description:"Runs before a search; return a rewritten term or null to veto."},{configKey:"beforeSelectCallback",converter:z(),on:"update",type:"(option: unknown, selectedOptions: unknown[]) => boolean | string | void",description:"Runs before selecting; return false to veto, or a string to veto and show it as a message."},{configKey:"beforeDeselectCallback",converter:z(),on:"update",type:"(option: unknown, selectedOptions: unknown[]) => boolean | string | void",description:"Runs before deselecting; return false to veto, or a string to veto and show it as a message."},{configKey:"addNewCallback",converter:z(),on:"update",type:"(value: string) => unknown | null | undefined | Promise<unknown | null | undefined>",description:"Create a new option from the typed text. May return a rich option object (renders via the same get*/render* callbacks as any option). Async + cancelable: return null/undefined to abort (no add, no `add` event). Omit entirely to handle creation yourself via the `add` event."},{configKey:"getAddNewTextCallback",converter:z(),on:"update",type:"(value: string) => string",description:'Dynamically compute the "add new" prompt label from the typed text (returns plain text). Takes precedence over `add-new-text`.'},{configKey:"keydownCallback",converter:z(),on:"update",type:"(context: MultiSelectKeydownContext) => boolean | void",description:"Intercept keydown before built-in handling; return true to suppress the default. Gets the event, current state, and an imperative controller."}],kn=[{name:"select",description:"An option was selected. `detail.option` is the selected option; `detail.selectedOptions`/`detail.selectedValues` are the full selection."},{name:"deselect",description:"An option was removed from the selection. `detail.option` is that option."},{name:"change",description:"The selection changed. `detail.selectedOptions`/`detail.selectedValues` are the full selection."},{name:"add",description:'The user chose to create a new option from the typed text (via the "add new" prompt or Enter) — requires `allow-add-new`. `detail.value` is the typed text; `detail.option` is the created item when `addNewCallback` produced one.'},{name:"ready",description:"The picker was built and painted for the first time (once per element lifetime). Fires right after the first build — synchronously during upgrade for a normal element, or when the render gate is released (`el.ready()` / removing `defer`) for a deferred one. No detail."}],Ao=new Set(["dropdownWidth","selectedPopoverWidth","showDebugInfo","initialValues","optionsSource","optionsFormat","optionsSplitter","optionsRowSplitter","mobilePresentation","collapseBadgesBelow","deferRender","customStyles"]),Ft={dropdownWidth:"--ms-dropdown-width",selectedPopoverWidth:"--ms-selected-popover-width"};let Cn=null;function Sn(){return Cn??(Cn=Vi(Lo,"--ms-"))}const Tn=[{key:"valueMember",member:"value",callbackKey:"getValueCallback"},{key:"displayValueMember",member:"label",callbackKey:"getDisplayValueCallback"},{key:"groupMember",member:"group",callbackKey:"getGroupCallback"},{key:"iconMember",member:"icon",callbackKey:"getIconCallback"},{key:"subtitleMember",member:"subtitle",callbackKey:"getSubtitleCallback"},{key:"disabledMember",member:"disabled",callbackKey:"getDisabledCallback"}];class Re extends Yt{constructor(){super();N(this,y);N(this,Z);N(this,S);N(this,ve);N(this,pt);N(this,Ue,!1);N(this,ft,null);N(this,gt,new Set);N(this,bt,!1);N(this,qe,!1);N(this,Xe);N(this,Ee);N(this,we,!1);M(this,Z,this.attachShadow({mode:"open"})),zi(h(this,Z),Lo),typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>this.setAttribute("data-placeholder-ready","")):this.setAttribute("data-placeholder-ready","")}formResetCallback(){var t;(t=h(this,S))==null||t.clearAll()}directionChanged(t){var o;(o=h(this,S))==null||o.refreshDirection()}reinit(){b(this,y,Wo).call(this),this.isConnected&&!b(this,y,vs).call(this)&&b(this,y,xs).call(this)}update(t){b(this,y,jo).call(this,t),("customStylesCallback"in t||"customStyles"in t)&&b(this,y,_s).call(this),"showDebugInfo"in t&&b(this,y,Ss).call(this);const o={};for(const[i,r]of Object.entries(t))Ao.has(i)||(o[i]=r===null?void 0:r);h(this,S)&&Object.keys(o).length>0&&(h(this,S).updateOptions(o)||b(this,y,xs).call(this)),"mobilePresentation"in t&&b(this,y,jt).call(this,et()),"collapseBadgesBelow"in t&&b(this,y,Gt).call(this,this.getBoundingClientRect().width)}connect(){!h(this,S)&&!b(this,y,vs).call(this)&&b(this,y,Ut).call(this)}disconnect(){var t;(t=h(this,S))==null||t.destroy(),M(this,S,void 0)}environmentChanged(t){b(this,y,jt).call(this,t)}resized({width:t}){b(this,y,Gt).call(this,t)}get name(){return this.getAttribute("name")}set name(t){t?this.setAttribute("name",t):this.removeAttribute("name")}get selectedValue(){var t;return this.flush(),((t=h(this,S))==null?void 0:t.selectedValue)??null}get selectedItem(){var t;return this.flush(),((t=h(this,S))==null?void 0:t.selectedItem)??null}getSelected(){return this.flush(),h(this,S)?h(this,S).getSelected():[]}setSelected(t,o={}){var i;this.flush(),(i=h(this,S))==null||i.setSelected(t,o)}getValue(){return this.flush(),h(this,S)?h(this,S).getValue():null}showMessage(t,o){var i;this.flush(),(i=h(this,S))==null||i.showMessage(t,o)}hideMessage(){var t;(t=h(this,S))==null||t.hideMessage()}clearSearch(){var t;this.flush(),(t=h(this,S))==null||t.clearSearch()}get searchText(){var t;return this.flush(),((t=h(this,S))==null?void 0:t.searchText)??""}search(t){var o;this.flush(),(o=h(this,S))==null||o.search(t)}scrollToIndex(t,o){var i;return this.flush(),((i=h(this,S))==null?void 0:i.scrollToIndex(t,o))??!1}scrollToValue(t,o){var i;return this.flush(),((i=h(this,S))==null?void 0:i.scrollToValue(t,o))??!1}scrollToGroup(t,o){var i;return this.flush(),((i=h(this,S))==null?void 0:i.scrollToGroup(t,o))??!1}open(){var t;this.flush(),(t=h(this,S))==null||t.open()}close(){var t;this.flush(),(t=h(this,S))==null||t.close()}toggle(){var t;this.flush(),(t=h(this,S))==null||t.toggle()}get isOpen(){var t;return this.flush(),((t=h(this,S))==null?void 0:t.isOpen)??!1}set isOpen(t){this.flush(),h(this,S)&&(h(this,S).isOpen=t)}destroy(){var t;(t=h(this,S))==null||t.destroy()}ready(){M(this,Ue,!0),this.flush(),this.isConnected&&!h(this,S)&&b(this,y,Ut).call(this)}get isReady(){return this.hasAttribute("is-ready")}}Z=new WeakMap,S=new WeakMap,ve=new WeakMap,pt=new WeakMap,Ue=new WeakMap,ft=new WeakMap,gt=new WeakMap,bt=new WeakMap,qe=new WeakMap,Xe=new WeakMap,Ee=new WeakMap,y=new WeakSet,vs=function(){return this.config.deferRender===!0&&!h(this,Ue)},jt=function(t){var r;const o=this.config.mobilePresentation??"auto",i=Fi(o,t);(r=h(this,S))==null||r.setPresentation(i==="modal"?"fullscreen":i)},we=new WeakMap,Gt=function(t){const o=this.config.collapseBadgesBelow;if(o==null){h(this,we)&&(M(this,we,!1),b(this,y,ws).call(this));return}const i=t>0&&t<o;i!==h(this,we)&&(M(this,we,i),i?b(this,y,ys).call(this,"count"):b(this,y,ws).call(this))},ws=function(){const t=this.config.badgesDisplayMode??"badges";b(this,y,ys).call(this,t)},ys=function(t){var o;(o=h(this,S))==null||o.updateOptions({badgesDisplayMode:t})},xs=function(){var o;const t=h(this,S)?b(this,y,Je).call(this):void 0;(o=h(this,S))==null||o.destroy(),M(this,S,void 0),b(this,y,Ut).call(this,t)},Ut=function(t){b(this,y,Ho).call(this),b(this,y,Go).call(this);const o=b(this,y,Fo).call(this),i=b(this,y,Ko).call(this),r=JSON.stringify(i??null),a=t!==void 0&&t.length>0&&r===h(this,pt)?t:i;M(this,pt,r),a&&a.length>0?h(this,ve).dataset.initialValues=JSON.stringify(a):delete h(this,ve).dataset.initialValues,M(this,S,new So(h(this,ve),o)),b(this,y,_s).call(this),b(this,y,Ss).call(this),b(this,y,jt).call(this,et()),M(this,we,!1),b(this,y,Gt).call(this,this.getBoundingClientRect().width),this.hasAttribute("is-ready")||(M(this,Ue,!0),this.setAttribute("is-ready",""),this.emit("ready"))},Ho=function(){if(h(this,ve))return;const t=document.createElement("div");t.setAttribute("data-multiselect",""),this.className&&(t.className=this.className),h(this,Z).appendChild(t),M(this,ft,$i(h(this,Z),{position:"first",className:"ms-custom-styles"})),M(this,ve,t)},Fo=function(){const t={...this.config};for(const i of Ao)delete t[i];for(const i of Object.keys(t))t[i]===null&&delete t[i];let o=t.options;if(h(this,qe)&&h(this,Xe))o&&o.length>0&&G.warn("[MultiSelectElement] Both declarative <option> elements and programmatic .options detected. Using declarative options."),o=h(this,Xe);else if(!o||o.length===0){const i=this.config.optionsSource;if(i!=null){const r=this.config.optionsFormat??"json",{options:n,error:a}=Mo(i,r,{splitter:this.config.optionsSplitter,rowSplitter:this.config.optionsRowSplitter});a&&G.error(`[MultiSelectElement] ${a}`),o=n}}if(t.options=o,h(this,qe))for(const{key:i,member:r,callbackKey:n}of Tn)t[i]===void 0&&!t[n]&&(t[i]=r);return t.getCounterCallback||(t.getCounterCallback=(i,r)=>r!==void 0?`+${r} more`:`${i} selected`),t.onSelect=i=>{var r;this.emit("select",{option:i,selectedOptions:((r=h(this,S))==null?void 0:r.getSelected())??[],selectedValues:b(this,y,Je).call(this)})},t.onDeselect=i=>{var r;this.emit("deselect",{option:i,selectedOptions:((r=h(this,S))==null?void 0:r.getSelected())??[],selectedValues:b(this,y,Je).call(this)})},t.onChange=i=>{this.emit("change",{selectedOptions:i,selectedValues:b(this,y,Je).call(this)})},t.onAddNew=i=>{var r;this.emit("add",{value:i.value,option:i.option,selectedOptions:((r=h(this,S))==null?void 0:r.getSelected())??[],selectedValues:b(this,y,Je).call(this)})},t.container=h(this,Z),t.hostElement=this,t},Ko=function(){if(h(this,Ee)&&h(this,Ee).length>0)return h(this,Ee);const t=this.config.initialValues;return t&&t.length>0?t:void 0},Je=function(){var o;const t=(o=h(this,S))==null?void 0:o.getValue();return t==null?[]:Array.isArray(t)?t:[t]},_s=function(){const t=h(this,ft);if(!t)return;const o=this.config.customStylesCallback,i=this.config.customStyles??null;if(typeof o!="function"){t.set(i),i&&b(this,y,ks).call(this,i);return}try{const r=o();t.set(r),r&&b(this,y,ks).call(this,r)}catch(r){G.warn("[MultiSelectElement] customStylesCallback threw",r),t.set(i)}},ks=function(t){const o=Sn();if(o.size!==0)for(const{name:i,suggestions:r}of Bi(t,{prefix:"--ms-",consumed:o}))h(this,gt).has(i)||(h(this,gt).add(i),console.warn(`[web-multiselect] customStylesCallback sets "${i}", which no web-multiselect style consumes — it will have no effect.`+(r.length?` Did you mean: ${r.join(", ")}?`:"")+" (If it's for your own custom-rendered content, ignore this.)"))},Wo=function(){for(const t of Object.keys(Ft))b(this,y,Cs).call(this,Ft[t],this.config[t])},jo=function(t){for(const o of Object.keys(Ft))o in t&&b(this,y,Cs).call(this,Ft[o],t[o])},Cs=function(t,o){o==null||o===""?this.style.removeProperty(t):this.style.setProperty(t,String(o))},Go=function(){if(h(this,bt))return;M(this,bt,!0);const t=b(this,y,Uo).call(this);t&&(M(this,Xe,t),M(this,qe,!0))},Uo=function(){const t=Array.from(this.children);if(t.length===0)return null;const o=[];let i=!1;const r=(n,a)=>{var c,d;const l={value:n.value||((c=n.textContent)==null?void 0:c.trim())||"",label:((d=n.textContent)==null?void 0:d.trim())||n.value||""};a&&(l.group=a),n.hasAttribute("selected")&&(h(this,Ee)??M(this,Ee,[])).push(l.value),n.hasAttribute("disabled")&&(l.disabled=!0),n.hasAttribute("data-icon")&&(l.icon=n.getAttribute("data-icon")),n.hasAttribute("data-subtitle")&&(l.subtitle=n.getAttribute("data-subtitle")),o.push(l),i=!0};for(const n of t)if(n.tagName==="OPTION")r(n);else if(n.tagName==="OPTGROUP"){const a=n,l=a.label||a.getAttribute("label")||"Group";for(const c of Array.from(a.querySelectorAll("option")))r(c,l)}if(!i)return null;G.debug(`[MultiSelectElement] Parsed ${o.length} declarative options from Light DOM`);for(const n of t)(n.tagName==="OPTION"||n.tagName==="OPTGROUP")&&n.remove();return o},Ss=function(){const t=h(this,Z).querySelector(".ms__debug-info");if(t&&t.remove(),!this.config.showDebugInfo)return;const o=document.createElement("div");o.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),o.appendChild(i),h(this,Z).appendChild(o),b(this,y,Ts).call(this)},Ts=function(){var l,c,d,u;const t=h(this,Z).querySelector(".ms__debug-stats");if(!t||!h(this,S))return;const o="2.2.0",i=typeof window<"u"&&((c=(l=window.components)==null?void 0:l["web-multiselect"])==null?void 0:c.getInstances().length)||0,r=h(this,S).getSelected().length,n=((d=this.config.options)==null?void 0:d.length)||0,a=h(this,S);t.innerHTML=`
|
|
43
43
|
<span>Version: ${o}</span>
|
|
44
44
|
<span>Total Instances: ${i}</span>
|
|
45
45
|
<span>Options: ${n}</span>
|
|
@@ -48,4 +48,4 @@ ${o}`:t}attachOptionTooltips(){if(this.destroyAllOptionTooltips(),!this.options.
|
|
|
48
48
|
<span>Dropdown: ${a.isOpen?"Open":"Closed"}</span>
|
|
49
49
|
<span>Search: ${a.searchTerm||"none"}</span>
|
|
50
50
|
<span>Loading: ${a.isLoading?"Yes":"No"}</span>
|
|
51
|
-
`,setTimeout(()=>{this.config.showDebugInfo&&
|
|
51
|
+
`,setTimeout(()=>{this.config.showDebugInfo&&b(this,y,Ts).call(this)},500)},m(Re,"formAssociated",!0),m(Re,"inputs",_n),m(Re,"events",kn),typeof customElements<"u"&&!customElements.get("web-multiselect")&&customElements.define("web-multiselect",Re),Ai("web-multiselect",Re,{config:{name:"@keenmate/web-multiselect",version:"2.2.0",author:"Keenmate s.r.o.",license:"MIT",repository:"git+https://github.com/keenmate/web-multiselect.git",homepage:"https://web-multiselect.keenmate.dev"},logging:le}),k.LOGGING_CATEGORIES=ln,k.MultiSelectElement=Re,k.OPTIONS_FORMATS=To,k.TABLET_MIN_SHORT_SIDE=Vs,k.WebMultiSelect=So,k.classifyDevice=Ds,k.configureBreakpoints=hi,k.dataLogger=G,k.disableLogging=dn,k.enableLogging=cn,k.getEnvironment=et,k.initLogger=lt,k.interactionLogger=H,k.observeEnvironment=zs,k.observeViewport=$s,k.parseOptionsData=Mo,k.setCategoryLevel=un,k.setLogLevel=hn,k.uiLogger=Y,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|