@vmscloud/moz-ui-components-core 0.1.54 → 0.1.55

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/dist/index.cjs CHANGED
@@ -1515,7 +1515,7 @@
1515
1515
  <path d="M3.8501 2.35718H11.1358" stroke=${e} stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path>
1516
1516
  <path d="M3.8501 6H11.1358" stroke=${e} stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path>
1517
1517
  <path d="M3.8501 9.64282H11.1358" stroke=${e} stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path>
1518
- </svg>`}const Ht={keyProp:"code",displayProp:"name",categoryLv1ID:"categoryLv1ID",categoryLv1Label:"categoryLv1Label",categoryLv2ID:"categoryLv2ID",categoryLv2Label:"categoryLv2Label",description:"description"};function Zn(e,t){const s=a=>t.displayProp&&a[t.displayProp]?a[t.displayProp]:a[t.keyProp],n=a=>t.categoryLv1Label&&a[t.categoryLv1Label]?a[t.categoryLv1Label]:t.categoryLv1ID?a[t.categoryLv1ID]:"",i=a=>t.categoryLv2Label&&a[t.categoryLv2Label]?a[t.categoryLv2Label]:t.categoryLv2ID?a[t.categoryLv2ID]:"";return e.map(a=>({code:a[t.keyProp],name:s(a),categoryLv1ID:t.categoryLv1ID&&a[t.categoryLv1ID]||"",categoryLv1Label:n(a),categoryLv2ID:t.categoryLv2ID&&a[t.categoryLv2ID]||"",categoryLv2Label:i(a),description:t.description&&a[t.description]||""}))}function wt(e,t){let s=e.get(t);return s||(s=[],e.set(t,s)),s}function jn(e){const t=new Map([["depth0",[]],["depth1",[]],["depth2",[]]]),s=new Map,n=new Map;e.forEach(m=>{const d=m.categoryLv1ID;if(!s.get(d)){const l={code:d,name:m.categoryLv1Label??d};s.set(d,l),wt(t,"depth0").push(l)}if(!m.categoryLv2ID||m.categoryLv2ID.trim()==="")wt(t,"depth1").push({...m,parent:m.categoryLv1ID});else{const l=`${m.categoryLv1ID}-${m.categoryLv2ID}`;if(!n.get(l)){const h={code:m.categoryLv2ID,name:m.categoryLv2Label??m.categoryLv2ID,parent:m.categoryLv1ID,isSubCategory:!0};n.set(l,h),wt(t,"depth1").push(h)}wt(t,"depth2").push({...m,parent:m.categoryLv2ID})}});function i(m,d,l,h){const r=`depth${d}`,p=`depth${d+1}`,u=l.get(p),v={...m,depth:d};if(d!==0&&(v.isHidden=!1),u&&u.length>0){const $=h[r],R=h[p],b=u.filter(V=>V[R]===(m.isSubCategory?m.code:m[$]));v.isExpanded=!0;const y=[v];return b.forEach(V=>{y.push(...i(V,d+1,l,h))}),y}return[v]}const a={depth0:"code",depth1:"parent",depth2:"parent"};return(t.get("depth0")??[]).flatMap(m=>i(m,0,t,a))}function Xn(e){return new Set(e.map(t=>t.code))}function Ke(e,t){return t===e}function St(e,t){return e.filter(s=>s.categoryLv1ID===t.code||s.categoryLv2ID===t.code)}function Ct(e){return new Set(e.map(t=>t.code))}function Vt(e,t){return{childDepthList:St(e,t)}}function wo(e,t){for(const s of e)if(!t.has(s))return!1;return!0}function xt(e,t,s){t===0&&e.categoryLv1Set.delete(s),t===1&&e.categoryLv2Set.delete(s)}function dt(e,t,s){t===0&&e.categoryLv1Set.add(s),t===1&&e.categoryLv2Set.add(s)}function Qn(e,t,s){t.length&&e.categoryLv1Set.add(t),s.length&&e.categoryLv2Set.add(s)}function bt(e){e.categoryLv1Set.clear(),e.categoryLv2Set.clear()}function cs(e,t,s,n){if(dt(e,s.depth,s.code),s.parent){const i=t.find(a=>a.code===s.parent);i&&cs(e,t,i)}}function ds(e,t,s,n){if(dt(e,s.depth,s.code),Ke(n,s.depth))return;t.filter(a=>a.parent===s.code).forEach(a=>{Ke(n,a.depth)||ds(e,t,a,n)})}function Co(e,t,s,n){cs(e,t,s),ds(e,t,s,n)}function us(e,t,s,n){if(xt(e,s.depth,s.code),s.parent){const i=t.find(a=>a.code===s.parent);i&&us(e,t,i)}}function ps(e,t,s,n){if(xt(e,s.depth,s.code),Ke(n,s.depth))return;t.filter(a=>a.parent===s.code).forEach(a=>{Ke(n,a.depth)||ps(e,t,a,n)})}function bo(e,t,s,n){us(e,t,s),ps(e,t,s,n)}const Jn=new Set(["modelValue","itemsSource","label","placeholder","required","disabled","isReadOnly","width","rules","keyProp","displayProp","useFilter","useSelectAll","class","style"]),hs=ve({name:"moz-tree-select",defaults:{label:null,width:200,required:!1,readonly:!1,disabled:!1,disabledProp:"disabled",rules:[],useSelectAll:!0,useFilter:!0,headerFormat:"ITEMS ({count})",listBoxWidth:0,useSpecificSelect:!0,treeLevels:1,useMultiSelect:!1,treeProps:Ht,modelValue:[]},setup(e){const t=N.createRef(),s=N.createRef(),n=N.createRef(),i=N.createRef(),a=N.createRef();let m=null;const d=(e.props.treeLevels??1)-1,l=d,h=()=>!!e.props.useMultiSelect,r=()=>e.props.disabledProp||"disabled",p=()=>e.props.treeProps??Ht;let u=e.props.modelValue??(h()?[]:"");const v=()=>e.controlled("modelValue")?e.props.modelValue??[]:u,$=()=>{const w=v();return Array.isArray(w)?w:w?[w]:[]},R=w=>{e.controlled("modelValue")||(u=w),e.emit("update:modelValue",w),e.requestUpdate()};let b=!1,y="",V=!1,S=!1,D=!1,G={},Z=[];const J={change:"",blur:"",save:""},le=new Set,ue=new Set,W={categoryLv1Set:le,categoryLv2Set:ue},z=(()=>{try{const w=getComputedStyle(document.documentElement).getPropertyValue("--size-input-dropdown-item-height");return w?+w.trim().replace("px",""):24}catch{return 24}})();let K=z;const ee=()=>e.slots.has("list-item");let ne=[],Q=[],B=e.props.itemsSource;const E=()=>{ne=Zn(e.props.itemsSource??[],p()),Q=jn(ne)};E();const T=()=>{const w=new Map;return ne.forEach(P=>w.set(P.code,P)),w},U=w=>w.name??"",k=w=>new Set($()).has(w.code),L=w=>Z.some(P=>it(P.item,w)),A=()=>new Set($()),F=()=>{let w=[];if(!y)w=Q;else{const P=[],_=new Set,ae=re=>`depth${re.depth}_${re.code}`;for(const re of Q)if(re.depth!==l){for(;P.length&&P[P.length-1].depth>=re.depth;)P.pop();P.push(re)}else if(U(re).toLowerCase().indexOf(y.toLowerCase())>-1){for(const me of P){const ze=ae(me);_.has(ze)||(w.push(me),_.add(ze))}const he=ae(re);_.has(he)||(w.push(re),_.add(he))}}if(D){const P=new Set,_=T(),ae=A();w.filter(he=>{if(we(he,ae))return!0;if(h()&&!Ke(d,he.depth)){const me=St(Q,he);if(me.length>0&&me.some(ze=>ae.has(ze.code)))return!0}return!1}).forEach(he=>{let me=he;for(;me&&(P.add(me.code),!!me.parent);)me=_.get(me.parent)}),w=w.filter(he=>P.has(he.code))}return w},f=()=>F().filter(w=>!(w.categoryLv1ID||w.categoryLv2ID)),O=()=>{const w=f();return F().filter(P=>!w.includes(P))},Y=()=>new Set(O().map(w=>w.code)),X=()=>Xn(O()),we=(w,P)=>h()?Ke(l,w.depth)?P.has(w.code):le.has(w.code)||ue.has(w.code):v()===w.code,De=w=>{if(Ke(d,w.depth))return!0;const P=St(F(),w);return P.length===0?!0:wo(Ct(P),A())},Ne=()=>{const w=$().length,P=f().length;if(w<P||w===0||P===0)return!1;for(const _ of X())if(!A().has(_))return!1;return!0},Oe=()=>{const w=X(),P=A();return!w.size||!P.size||P.size<w.size?!1:Array.from(w).every(_=>P.has(_))},c=()=>h()?!!e.props.useSelectAll:!1,x=()=>{const w=v(),P=T();if(typeof w=="string")return P.has(w)?P.get(w).name:w;const _=Array.isArray(w)?w:[],ae=_.filter(re=>P.has(re)).map(re=>P.get(re).name);return _.length?h()&&ae.length>1?e.props.headerFormat.replace(/\{count(:.*?)?}/g,`${ae.length.toLocaleString()}`):ae.join(", ")||"":""},j=()=>J.save||J.blur||J.change,ie=()=>{const w=[];return e.props.required&&w.push({message:e.locale.TreeSelect.required.replace("{label}",e.props.label||""),type:"save",validator:P=>!!P.length}),[...w,...e.props.rules??[]]},ce=async(w,P)=>{const _=ie();if(_.length<=0)return;if(e.props.disabled)return!0;J[P]="",e.requestUpdate();const ae=_.filter(re=>re.type===P);for(const re of ae)if(!await re.validator(w))return J[P]=re.message,e.requestUpdate(),!1;return!0},Se=async(w="save")=>j()!==""?!1:await ce($(),w)??!0,be={validate:Se,initValidator:()=>{J.change="",J.blur="",J.save="",e.requestUpdate()}};e.validator&&(e.validator.addValidator(be),e.onCleanup(()=>{We==null||We.release(),We=null}),e.onCleanup(()=>{var w;return(w=e.validator)==null?void 0:w.removeValidator(be)}));const C=(w,P)=>w.filter(_=>k(_)!==P).map(_=>_.code),q=w=>{const P=Array.from(new Set(w));it($(),P)||(R(P),e.emit("change",P,P.filter(Boolean)),ce(P,"change"),Ce(P))},Ce=w=>{w.length===ne.length?f().forEach(P=>dt(W,P.depth,P.code)):w.forEach(P=>{const _=O().find(ae=>ae.code===P);_&&Qn(W,_.categoryLv1ID??"",_.categoryLv2ID??"")})},ke=(w,P,_)=>{if(_.shiftKey&&Z.length>0){const ae=Z[0],re=Math.min(ae.index,P),he=Math.max(ae.index,P);Z=F().slice(re,he+1).map((me,ze)=>({item:me,index:re+ze}))}else _.ctrlKey?Z.push({item:w,index:P}):Z=[{item:w,index:P}]},Ee=(w,P)=>{if(!Ke(d,w.depth)){const{childDepthList:_}=Vt(F(),w);if(P){const ae=Ct(_);R($().filter(re=>!ae.has(re))),bo(W,F(),w,l)}else{const ae=_.map(re=>re.code);R([...$(),...ae])}}},Te=(w,P)=>{const ae=Z.map(me=>me.item).filter(me=>me.depth===l),re=C(ae,w);let he=[];if(P.depth!==d){const{childDepthList:me}=Vt(F(),P),ze=Ct(me);he=$().filter(He=>!ze.has(He))}else he=$();w?P.depth===d?he=[...he,...re]:Co(W,F(),P,l):(bt(W),he=he.filter(me=>!re.some(ze=>me===ze))),q(he)},Ve=(w,P,_,ae)=>{const re=Z.some(he=>he.item.code===w.code);(Z.length<=1||!re)&&ke(w,P,{shiftKey:!1,ctrlKey:!1}),Te(!ae,w),Ee(w,ae),e.requestUpdate()},Ue=(w,P,_,ae)=>{w[r()]!==!0&&(!_.ctrlKey&&!_.shiftKey&&Z.length<=1&&Ve(w,P,_,ae),ke(w,P,_),e.requestUpdate())},Qe=(w,P,_)=>{if(w[r()]===!0)return;let ae=[],re=!1;const he=w.code;if(Ke(d,w.depth))re=$().length===1&&$()[0]===he,re||(ae=[he]),bt(W);else{const{childDepthList:me}=Vt(F(),w),ze=Ct(me);re=wo(ze,A())&&ze.size===A().size,re?bo(W,F(),w,l):(ae=[],bt(W),Co(W,F(),w,l))}q(ae),Ee(w,re),ke(w,P,_),e.requestUpdate()},ot=w=>{R(w),et(!1)},Je=(w,P)=>{F().filter(ae=>ae.parent===w).forEach(ae=>{if(ae.isHidden=P,ae.depth===l)return;const he=!P&&!ae.isExpanded?!0:P;Je(ae.code,he)})},Ze=(w,P)=>{P.stopPropagation(),w.isExpanded=!w.isExpanded,Je(w.code,!w.isExpanded),queueMicrotask(()=>Re.measure()),e.requestUpdate()},g=w=>{Q.forEach(P=>{P.isExpanded=w,P.depth>0?P.isHidden=!w:P.isHidden=!1}),queueMicrotask(()=>Re.measure()),e.requestUpdate()},H=w=>{w.stopPropagation(),Y().size===A().size&&[...Y()].every(_=>A().has(_))?(f().forEach(_=>xt(W,_.depth,_.code)),q([])):(bt(W),f().forEach(_=>dt(W,_.depth,_.code)),q([...Y()]))},I=w=>{if(w.stopPropagation(),Oe()){const P=X();q($().filter(_=>!P.has(_))),f().forEach(_=>xt(W,_.depth,_.code))}else{const P=new Set([...$(),...Y()]);q(Array.from(P)),f().forEach(_=>dt(W,_.depth,_.code))}},te=w=>{V=w.target.scrollTop>0,e.requestUpdate()},se=()=>{const w=s.value;if(!w)return;const P=w.getBoundingClientRect();let _=`${P.width}px`;e.props.listBoxWidth&&(_=typeof e.props.listBoxWidth=="number"?`${e.props.listBoxWidth}px`:e.props.listBoxWidth),G={width:String(_),left:`${P.left}px`,top:`${P.top+(S?0:P.height)}px`},e.requestUpdate()},pe=(w,P,_=10)=>{const ae=window.innerHeight||document.documentElement.clientHeight,re=window.innerWidth||document.documentElement.clientWidth,he=w.getBoundingClientRect(),me=P.getBoundingClientRect(),ze=he.bottom+me.height+_>ae;if(!ze)return!1;const He=he.top-me.height-_<0,qe=he.right+me.width+_>re,_e=he.left-me.width-_<0;return ze&&!He||qe&&!_e},fe=w=>{w.target!==m&&et(!1)},ye=w=>{var P,_;!((P=t.value)!=null&&P.contains(w.target))&&!((_=n.value)!=null&&_.contains(w.target))&&(et(!1),document.removeEventListener("click",ye,{capture:!0}))},Me=w=>{var _;`${w.ctrlKey?"ctrl+":""}${w.altKey?"alt+":""}${w.key.toLowerCase()}`==="escape"&&(et(!1),(_=i.value)==null||_.focus())};e.onCleanup(()=>{document.body.removeEventListener("scroll",fe,{capture:!0}),document.removeEventListener("click",ye,{capture:!0}),window.removeEventListener("keydown",Me)});let We=null;const et=w=>{b!==w&&(b=w,e.requestUpdate(),w?(We=ht(),document.body.addEventListener("scroll",fe,{capture:!0}),document.addEventListener("click",ye,{capture:!0}),J.save="",window.addEventListener("keydown",Me),se(),queueMicrotask(()=>{var P;s.value&&m&&(S=pe(s.value,m)),se(),a.value?a.value.focus():(P=i.value)==null||P.focus()})):(We==null||We.release(),We=null,document.body.removeEventListener("scroll",fe,{capture:!0}),document.removeEventListener("click",ye,{capture:!0}),ce($(),"blur"),window.removeEventListener("keydown",Me),y="",e.emit("close")))},rt=()=>{e.props.disabled||et(!b)};let st;const zt=w=>{const P=w.target.value;st&&clearTimeout(st),st=setTimeout(()=>{y=P,e.requestUpdate(),queueMicrotask(()=>{Re.setOptions({...Re.options,count:F().length}),Re.measure()})},300)},Ge=w=>{D=w,e.requestUpdate(),queueMicrotask(()=>{Re.setOptions({...Re.options,count:F().length}),Re.measure()})},Re=new Fe.Virtualizer({count:0,getScrollElement:()=>m,estimateSize:w=>{const P=F()[w];return P!=null&&P.isHidden?0:ee()&&P&&Ke(d,P.depth)?K:z},measureElement:w=>w.getBoundingClientRect().height,overscan:3,observeElementRect:Fe.observeElementRect,observeElementOffset:Fe.observeElementOffset,scrollToFn:Fe.elementScroll,onChange:()=>e.requestUpdate()});e.onCleanup(Re._didMount());const Rs=w=>{m=w??null,w&&(Re._willUpdate(),e.requestUpdate())},qs=(w,P)=>{w&&P===d&&(K=w.getBoundingClientRect().height)},Is=w=>w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ro=(w,P)=>{if(!y||!Ke(d,P))return[{part:w,highlight:!1}];const _=new RegExp(`(${Is(y)})`,"gi");return w.split(_).map(ae=>({part:ae,highlight:y.toLowerCase()===ae.toLowerCase()}))};let ao=v();const Fs=w=>{const{index:P,item:_,start:ae,isSelected:re,isIndeterminate:he,isDisabled:me,isFocused:ze}=w;if(_.isHidden)return o.nothing;const He=e.props,qe=_.depth,_e=Ke(d,qe),je=h(),nt=Ie=>{qe!==d?Ze(_,Ie):ot(_.code)},ft=Ie=>{je?Ue(_,P,Ie,re&&De(_)):nt(Ie)},At=()=>{Ve(_,P,{},re&&De(_))},Dt=_e?"하나만":"그룹만";return o.html`<div
1518
+ </svg>`}const Ht={keyProp:"code",displayProp:"name",categoryLv1ID:"categoryLv1ID",categoryLv1Label:"categoryLv1Label",categoryLv2ID:"categoryLv2ID",categoryLv2Label:"categoryLv2Label",description:"description"};function Zn(e,t){const s=a=>t.displayProp&&a[t.displayProp]?a[t.displayProp]:a[t.keyProp],n=a=>t.categoryLv1Label&&a[t.categoryLv1Label]?a[t.categoryLv1Label]:t.categoryLv1ID?a[t.categoryLv1ID]:"",i=a=>t.categoryLv2Label&&a[t.categoryLv2Label]?a[t.categoryLv2Label]:t.categoryLv2ID?a[t.categoryLv2ID]:"";return e.map(a=>({code:a[t.keyProp],name:s(a),categoryLv1ID:t.categoryLv1ID&&a[t.categoryLv1ID]||"",categoryLv1Label:n(a),categoryLv2ID:t.categoryLv2ID&&a[t.categoryLv2ID]||"",categoryLv2Label:i(a),description:t.description&&a[t.description]||""}))}function wt(e,t){let s=e.get(t);return s||(s=[],e.set(t,s)),s}function jn(e){const t=new Map([["depth0",[]],["depth1",[]],["depth2",[]]]),s=new Map,n=new Map;e.forEach(m=>{const d=m.categoryLv1ID;if(!s.get(d)){const l={code:d,name:m.categoryLv1Label??d};s.set(d,l),wt(t,"depth0").push(l)}if(!m.categoryLv2ID||m.categoryLv2ID.trim()==="")wt(t,"depth1").push({...m,parent:m.categoryLv1ID});else{const l=`${m.categoryLv1ID}-${m.categoryLv2ID}`;if(!n.get(l)){const h={code:m.categoryLv2ID,name:m.categoryLv2Label??m.categoryLv2ID,parent:m.categoryLv1ID,isSubCategory:!0};n.set(l,h),wt(t,"depth1").push(h)}wt(t,"depth2").push({...m,parent:m.categoryLv2ID})}});function i(m,d,l,h){const r=`depth${d}`,p=`depth${d+1}`,u=l.get(p),v={...m,depth:d};if(d!==0&&(v.isHidden=!1),u&&u.length>0){const $=h[r],R=h[p],b=u.filter(V=>V[R]===(m.isSubCategory?m.code:m[$]));v.isExpanded=!0;const y=[v];return b.forEach(V=>{y.push(...i(V,d+1,l,h))}),y}return[v]}const a={depth0:"code",depth1:"parent",depth2:"parent"};return(t.get("depth0")??[]).flatMap(m=>i(m,0,t,a))}function Xn(e){return new Set(e.map(t=>t.code))}function Ke(e,t){return t===e}function St(e,t){return e.filter(s=>s.categoryLv1ID===t.code||s.categoryLv2ID===t.code)}function Ct(e){return new Set(e.map(t=>t.code))}function Vt(e,t){return{childDepthList:St(e,t)}}function wo(e,t){for(const s of e)if(!t.has(s))return!1;return!0}function xt(e,t,s){t===0&&e.categoryLv1Set.delete(s),t===1&&e.categoryLv2Set.delete(s)}function dt(e,t,s){t===0&&e.categoryLv1Set.add(s),t===1&&e.categoryLv2Set.add(s)}function Qn(e,t,s){t.length&&e.categoryLv1Set.add(t),s.length&&e.categoryLv2Set.add(s)}function bt(e){e.categoryLv1Set.clear(),e.categoryLv2Set.clear()}function cs(e,t,s,n){if(dt(e,s.depth,s.code),s.parent){const i=t.find(a=>a.code===s.parent);i&&cs(e,t,i)}}function ds(e,t,s,n){if(dt(e,s.depth,s.code),Ke(n,s.depth))return;t.filter(a=>a.parent===s.code).forEach(a=>{Ke(n,a.depth)||ds(e,t,a,n)})}function Co(e,t,s,n){cs(e,t,s),ds(e,t,s,n)}function us(e,t,s,n){if(xt(e,s.depth,s.code),s.parent){const i=t.find(a=>a.code===s.parent);i&&us(e,t,i)}}function ps(e,t,s,n){if(xt(e,s.depth,s.code),Ke(n,s.depth))return;t.filter(a=>a.parent===s.code).forEach(a=>{Ke(n,a.depth)||ps(e,t,a,n)})}function bo(e,t,s,n){us(e,t,s),ps(e,t,s,n)}const Jn=new Set(["modelValue","itemsSource","label","placeholder","required","disabled","isReadOnly","width","rules","keyProp","displayProp","useFilter","useSelectAll","class","style"]),hs=ve({name:"moz-tree-select",defaults:{label:null,width:200,required:!1,readonly:!1,disabled:!1,disabledProp:"disabled",rules:[],useSelectAll:!0,useFilter:!0,headerFormat:"ITEMS ({count})",listBoxWidth:0,useSpecificSelect:!0,treeLevels:1,useMultiSelect:!1,treeProps:Ht,modelValue:[]},setup(e){const t=N.createRef(),s=N.createRef(),n=N.createRef(),i=N.createRef(),a=N.createRef();let m=null;const d=(e.props.treeLevels??1)-1,l=d,h=()=>!!e.props.useMultiSelect,r=()=>e.props.disabledProp||"disabled",p=()=>e.props.treeProps??Ht;let u=e.props.modelValue??(h()?[]:"");const v=()=>e.controlled("modelValue")?e.props.modelValue??[]:u,$=()=>{const w=v();return Array.isArray(w)?w:w?[w]:[]},R=w=>{e.controlled("modelValue")||(u=w),e.emit("update:modelValue",w),e.requestUpdate()};let b=!1,y="",V=!1,S=!1,D=!1,G={},Z=[];const J={change:"",blur:"",save:""},le=new Set,ue=new Set,W={categoryLv1Set:le,categoryLv2Set:ue},z=(()=>{try{const w=getComputedStyle(document.documentElement).getPropertyValue("--size-input-dropdown-item-height");return w?+w.trim().replace("px",""):24}catch{return 24}})();let K=z;const ee=()=>e.slots.has("list-item");let ne=[],Q=[],B=e.props.itemsSource;const E=()=>{ne=Zn(e.props.itemsSource??[],p()),Q=jn(ne)};E();const T=()=>{const w=new Map;return ne.forEach(P=>w.set(P.code,P)),w},U=w=>w.name??"",k=w=>new Set($()).has(w.code),L=w=>Z.some(P=>it(P.item,w)),A=()=>new Set($()),F=()=>{let w=[];if(!y)w=Q;else{const P=[],_=new Set,ae=re=>`depth${re.depth}_${re.code}`;for(const re of Q)if(re.depth!==l){for(;P.length&&P[P.length-1].depth>=re.depth;)P.pop();P.push(re)}else if(U(re).toLowerCase().indexOf(y.toLowerCase())>-1){for(const me of P){const ze=ae(me);_.has(ze)||(w.push(me),_.add(ze))}const he=ae(re);_.has(he)||(w.push(re),_.add(he))}}if(D){const P=new Set,_=T(),ae=A();w.filter(he=>{if(we(he,ae))return!0;if(h()&&!Ke(d,he.depth)){const me=St(Q,he);if(me.length>0&&me.some(ze=>ae.has(ze.code)))return!0}return!1}).forEach(he=>{let me=he;for(;me&&(P.add(me.code),!!me.parent);)me=_.get(me.parent)}),w=w.filter(he=>P.has(he.code))}return w},f=()=>F().filter(w=>!(w.categoryLv1ID||w.categoryLv2ID)),O=()=>{const w=f();return F().filter(P=>!w.includes(P))},Y=()=>new Set(O().map(w=>w.code)),X=()=>Xn(O()),we=(w,P)=>h()?Ke(l,w.depth)?P.has(w.code):le.has(w.code)||ue.has(w.code):v()===w.code,De=w=>{if(Ke(d,w.depth))return!0;const P=St(F(),w);return P.length===0?!0:wo(Ct(P),A())},Ne=()=>{const w=$().length,P=f().length;if(w<P||w===0||P===0)return!1;for(const _ of X())if(!A().has(_))return!1;return!0},Oe=()=>{const w=X(),P=A();return!w.size||!P.size||P.size<w.size?!1:Array.from(w).every(_=>P.has(_))},c=()=>h()?!!e.props.useSelectAll:!1,x=()=>{const w=v(),P=T();if(typeof w=="string")return P.has(w)?P.get(w).name:w;const _=Array.isArray(w)?w:[],ae=_.filter(re=>P.has(re)).map(re=>P.get(re).name);return _.length?h()&&ae.length>1?e.props.headerFormat.replace(/\{count(:.*?)?}/g,`${ae.length.toLocaleString()}`):ae.join(", ")||"":""},j=()=>J.save||J.blur||J.change,ie=()=>{const w=[];return e.props.required&&w.push({message:e.locale.TreeSelect.required.replace("{label}",e.props.label||""),type:"save",validator:P=>!!P.length}),[...w,...e.props.rules??[]]},ce=async(w,P)=>{const _=ie();if(_.length<=0)return;if(e.props.disabled)return!0;J[P]="",e.requestUpdate();const ae=_.filter(re=>re.type===P);for(const re of ae)if(!await re.validator(w))return J[P]=re.message,e.requestUpdate(),!1;return!0},Se=async(w="save")=>j()!==""?!1:await ce($(),w)??!0,be={validate:Se,initValidator:()=>{J.change="",J.blur="",J.save="",e.requestUpdate()}};e.validator&&(e.validator.addValidator(be),e.onCleanup(()=>{We==null||We.release(),We=null}),e.onCleanup(()=>{var w;return(w=e.validator)==null?void 0:w.removeValidator(be)}));const C=(w,P)=>w.filter(_=>k(_)!==P).map(_=>_.code),q=w=>{const P=Array.from(new Set(w));it($(),P)||(R(P),e.emit("change",P,P.filter(Boolean)),ce(P,"change"),Ce(P))},Ce=w=>{w.length===ne.length?f().forEach(P=>dt(W,P.depth,P.code)):w.forEach(P=>{const _=O().find(ae=>ae.code===P);_&&Qn(W,_.categoryLv1ID??"",_.categoryLv2ID??"")})},ke=(w,P,_)=>{if(_.shiftKey&&Z.length>0){const ae=Z[0],re=Math.min(ae.index,P),he=Math.max(ae.index,P);Z=F().slice(re,he+1).map((me,ze)=>({item:me,index:re+ze}))}else _.ctrlKey?Z.push({item:w,index:P}):Z=[{item:w,index:P}]},Ee=(w,P)=>{if(!Ke(d,w.depth)){const{childDepthList:_}=Vt(F(),w);if(P){const ae=Ct(_);R($().filter(re=>!ae.has(re))),bo(W,F(),w,l)}else{const ae=_.map(re=>re.code);R([...$(),...ae])}}},Te=(w,P)=>{const ae=Z.map(me=>me.item).filter(me=>me.depth===l),re=C(ae,w);let he=[];if(P.depth!==d){const{childDepthList:me}=Vt(F(),P),ze=Ct(me);he=$().filter(He=>!ze.has(He))}else he=$();w?P.depth===d?he=[...he,...re]:Co(W,F(),P,l):(bt(W),he=he.filter(me=>!re.some(ze=>me===ze))),q(he)},Ve=(w,P,_,ae)=>{const re=Z.some(he=>he.item.code===w.code);(Z.length<=1||!re)&&ke(w,P,{shiftKey:!1,ctrlKey:!1}),Te(!ae,w),Ee(w,ae),e.requestUpdate()},Ue=(w,P,_,ae)=>{w[r()]!==!0&&(!_.ctrlKey&&!_.shiftKey&&Z.length<=1&&Ve(w,P,_,ae),ke(w,P,_),e.requestUpdate())},Qe=(w,P,_)=>{if(w[r()]===!0)return;let ae=[],re=!1;const he=w.code;if(Ke(d,w.depth))re=$().length===1&&$()[0]===he,re||(ae=[he]),bt(W);else{const{childDepthList:me}=Vt(F(),w),ze=Ct(me);re=wo(ze,A())&&ze.size===A().size,re?bo(W,F(),w,l):(ae=[],bt(W),Co(W,F(),w,l))}q(ae),Ee(w,re),ke(w,P,_),e.requestUpdate()},ot=w=>{R(w),et(!1)},Je=(w,P)=>{F().filter(ae=>ae.parent===w).forEach(ae=>{if(ae.isHidden=P,ae.depth===l)return;const he=!P&&!ae.isExpanded?!0:P;Je(ae.code,he)})},Ze=(w,P)=>{P.stopPropagation(),w.isExpanded=!w.isExpanded,Je(w.code,!w.isExpanded),queueMicrotask(()=>Re.measure()),e.requestUpdate()},g=w=>{Q.forEach(P=>{P.isExpanded=w,P.depth>0?P.isHidden=!w:P.isHidden=!1}),queueMicrotask(()=>Re.measure()),e.requestUpdate()},H=w=>{w.stopPropagation(),Y().size===A().size&&[...Y()].every(_=>A().has(_))?(f().forEach(_=>xt(W,_.depth,_.code)),q([])):(bt(W),f().forEach(_=>dt(W,_.depth,_.code)),q([...Y()]))},I=w=>{if(w.stopPropagation(),Oe()){const P=X();q($().filter(_=>!P.has(_))),f().forEach(_=>xt(W,_.depth,_.code))}else{const P=new Set([...$(),...Y()]);q(Array.from(P)),f().forEach(_=>dt(W,_.depth,_.code))}},te=w=>{V=w.target.scrollTop>0,e.requestUpdate()},se=()=>{const w=s.value;if(!w)return;const P=w.getBoundingClientRect();let _=`${P.width}px`;e.props.listBoxWidth&&(_=typeof e.props.listBoxWidth=="number"?`${e.props.listBoxWidth}px`:e.props.listBoxWidth),G={width:String(_),left:`${P.left}px`,top:`${P.top+(S?0:P.height)}px`},e.requestUpdate()},pe=(w,P,_=10)=>{const ae=window.innerHeight||document.documentElement.clientHeight,re=window.innerWidth||document.documentElement.clientWidth,he=w.getBoundingClientRect(),me=P.getBoundingClientRect(),ze=he.bottom+me.height+_>ae;if(!ze)return!1;const He=he.top-me.height-_<0,qe=he.right+me.width+_>re,_e=he.left-me.width-_<0;return ze&&!He||qe&&!_e},fe=w=>{w.target!==m&&et(!1)},ye=w=>{var P,_;!((P=t.value)!=null&&P.contains(w.target))&&!((_=n.value)!=null&&_.contains(w.target))&&(et(!1),document.removeEventListener("click",ye,{capture:!0}))},Me=w=>{var _;`${w.ctrlKey?"ctrl+":""}${w.altKey?"alt+":""}${w.key.toLowerCase()}`==="escape"&&(et(!1),(_=i.value)==null||_.focus())};e.onCleanup(()=>{document.body.removeEventListener("scroll",fe,{capture:!0}),document.removeEventListener("click",ye,{capture:!0}),window.removeEventListener("keydown",Me)});let We=null;const et=w=>{b!==w&&(b=w,e.requestUpdate(),w?(We=ht(),document.body.addEventListener("scroll",fe,{capture:!0}),document.addEventListener("click",ye,{capture:!0}),J.save="",window.addEventListener("keydown",Me),se(),queueMicrotask(()=>{var P;s.value&&m&&(S=pe(s.value,m)),se(),a.value?a.value.focus():(P=i.value)==null||P.focus()})):(We==null||We.release(),We=null,document.body.removeEventListener("scroll",fe,{capture:!0}),document.removeEventListener("click",ye,{capture:!0}),ce($(),"blur"),window.removeEventListener("keydown",Me),y="",e.emit("close")))},rt=()=>{e.props.disabled||et(!b)};let st;const zt=w=>{const P=w.target.value;st&&clearTimeout(st),st=setTimeout(()=>{y=P,e.requestUpdate(),queueMicrotask(()=>{Re.setOptions({...Re.options,count:F().length}),Re.measure()})},300)},Ge=w=>{D=w,e.requestUpdate(),queueMicrotask(()=>{Re.setOptions({...Re.options,count:F().length}),Re.measure()})},Re=new Fe.Virtualizer({count:0,getScrollElement:()=>m,estimateSize:w=>{const P=F()[w];return P!=null&&P.isHidden?0:ee()&&P&&Ke(d,P.depth)?K:z},measureElement:w=>{const P=w.getBoundingClientRect().height;return P>0?P:Re.options.estimateSize(Number(w.dataset.index))},overscan:3,observeElementRect:Fe.observeElementRect,observeElementOffset:Fe.observeElementOffset,scrollToFn:Fe.elementScroll,onChange:()=>e.requestUpdate()});e.onCleanup(Re._didMount());const Rs=w=>{m=w??null,w&&(Re._willUpdate(),e.requestUpdate())},qs=(w,P)=>{if(!w||P!==d)return;const _=w.getBoundingClientRect().height;_>0&&(K=_)},Is=w=>w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ro=(w,P)=>{if(!y||!Ke(d,P))return[{part:w,highlight:!1}];const _=new RegExp(`(${Is(y)})`,"gi");return w.split(_).map(ae=>({part:ae,highlight:y.toLowerCase()===ae.toLowerCase()}))};let ao=v();const Fs=w=>{const{index:P,item:_,start:ae,isSelected:re,isIndeterminate:he,isDisabled:me,isFocused:ze}=w;if(_.isHidden)return o.nothing;const He=e.props,qe=_.depth,_e=Ke(d,qe),je=h(),nt=Ie=>{qe!==d?Ze(_,Ie):ot(_.code)},ft=Ie=>{je?Ue(_,P,Ie,re&&De(_)):nt(Ie)},At=()=>{Ve(_,P,{},re&&De(_))},Dt=_e?"하나만":"그룹만";return o.html`<div
1519
1519
  data-index=${P}
1520
1520
  ${N.ref(Ie=>{Ie&&(Re.measureElement(Ie),qs(Ie,qe))})}
1521
1521
  style=${oe.styleMap({transform:`translateY(${ae}px)`})}