selective-ui 1.2.4 → 1.2.6

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.
Files changed (67) hide show
  1. package/README.md +7 -0
  2. package/dist/selective-ui.css +64 -58
  3. package/dist/selective-ui.css.map +1 -1
  4. package/dist/selective-ui.esm.js +4396 -1344
  5. package/dist/selective-ui.esm.js.map +1 -1
  6. package/dist/selective-ui.esm.min.js +2 -2
  7. package/dist/selective-ui.esm.min.js.br +0 -0
  8. package/dist/selective-ui.min.css +1 -1
  9. package/dist/selective-ui.min.css.br +0 -0
  10. package/dist/selective-ui.min.js +2 -2
  11. package/dist/selective-ui.min.js.br +0 -0
  12. package/dist/selective-ui.umd.js +4401 -1345
  13. package/dist/selective-ui.umd.js.map +1 -1
  14. package/package.json +3 -3
  15. package/src/css/components/accessorybox.css +1 -1
  16. package/src/css/components/directive.css +2 -2
  17. package/src/css/components/option-handle.css +4 -4
  18. package/src/css/components/placeholder.css +1 -1
  19. package/src/css/components/popup/empty-state.css +3 -3
  20. package/src/css/components/popup/loading-state.css +3 -3
  21. package/src/css/components/popup/popup.css +5 -5
  22. package/src/css/components/searchbox.css +2 -2
  23. package/src/css/components/selectbox.css +7 -7
  24. package/src/css/views/group-view.css +8 -8
  25. package/src/css/views/option-view.css +22 -22
  26. package/src/ts/adapter/mixed-adapter.ts +248 -92
  27. package/src/ts/components/accessorybox.ts +170 -73
  28. package/src/ts/components/directive.ts +55 -26
  29. package/src/ts/components/option-handle.ts +127 -60
  30. package/src/ts/components/placeholder.ts +73 -35
  31. package/src/ts/components/popup/empty-state.ts +71 -35
  32. package/src/ts/components/popup/loading-state.ts +73 -33
  33. package/src/ts/components/popup/popup.ts +19 -39
  34. package/src/ts/components/searchbox.ts +189 -50
  35. package/src/ts/components/selectbox.ts +401 -40
  36. package/src/ts/core/base/adapter.ts +160 -79
  37. package/src/ts/core/base/fenwick.ts +147 -0
  38. package/src/ts/core/base/lifecycle.ts +118 -35
  39. package/src/ts/core/base/model.ts +94 -36
  40. package/src/ts/core/base/recyclerview.ts +0 -1
  41. package/src/ts/core/base/view.ts +54 -23
  42. package/src/ts/core/base/virtual-recyclerview.ts +365 -283
  43. package/src/ts/core/model-manager.ts +172 -92
  44. package/src/ts/core/search-controller.ts +166 -93
  45. package/src/ts/global.ts +26 -5
  46. package/src/ts/index.ts +22 -3
  47. package/src/ts/models/group-model.ts +138 -32
  48. package/src/ts/models/option-model.ts +197 -53
  49. package/src/ts/services/dataset-observer.ts +72 -10
  50. package/src/ts/services/ea-observer.ts +87 -10
  51. package/src/ts/services/effector.ts +181 -32
  52. package/src/ts/services/refresher.ts +32 -7
  53. package/src/ts/services/resize-observer.ts +136 -19
  54. package/src/ts/services/select-observer.ts +115 -50
  55. package/src/ts/types/core/base/view.type.ts +3 -3
  56. package/src/ts/types/core/base/virtual-recyclerview.type.ts +1 -1
  57. package/src/ts/types/plugins/plugin.type.ts +46 -0
  58. package/src/ts/types/utils/ievents.type.ts +6 -1
  59. package/src/ts/types/utils/istorage.type.ts +8 -4
  60. package/src/ts/types/utils/libs.type.ts +2 -2
  61. package/src/ts/types/utils/selective.type.ts +14 -1
  62. package/src/ts/utils/callback-scheduler.ts +115 -37
  63. package/src/ts/utils/ievents.ts +91 -29
  64. package/src/ts/utils/libs.ts +41 -65
  65. package/src/ts/utils/selective.ts +412 -79
  66. package/src/ts/views/group-view.ts +142 -31
  67. package/src/ts/views/option-view.ts +272 -60
@@ -1,2 +1,2 @@
1
- /*! Selective UI v1.2.4 | MIT License */
2
- function t(t){return new m(t??null)}function bind(t,i={}){$.bind(t,i)}function find(t){return $.find(t)}function destroy(t=null){$.destroy(t)}function rebind(t,i={}){$.rebind(t,i)}function effector(i){return t(i)}function i(){k||(k=!0,document.addEventListener("mousedown",()=>{const t=e.t();if(t.length>0){const i=$.find(t.join(", "));i.isEmpty||i.close()}}),$.i())}class s{constructor(){this.h={accessoryVisible:!0,virtualScroll:!0,accessoryStyle:"top",multiple:!1,minWidth:"50px",width:"0px",offsetWidth:null,minHeight:"30px",height:"30px",panelHeight:"220px",panelMinHeight:"100px",disabled:!1,readonly:!1,selectall:!0,keepSelected:!0,placeholder:"Select value",altMask:"",autoclose:!1,autoscroll:!0,autofocus:!0,searchable:!0,loadingfield:!0,visible:!0,skipError:!1,customDelimiter:",",textLoading:"Processing...",textNoData:"No data available",textNotFound:"Not found",textSelectAll:"Select all",textDeselectAll:"Deselect all",textAccessoryDeselect:"Deselect: ",animationtime:200,delaysearchtime:200,allowHtml:!1,maxSelected:0,labelHalign:"left",labelValign:"center",imageMode:!1,imageWidth:"60px",imageHeight:"60px",imageBorderRadius:"4px",imagePosition:"right",ajax:null,on:{load:[],beforeShow:[],show:[],beforeChange:[],change:[],beforeClose:[],close:[]}},this.o=new Map,this.l=new Map,this.u=[]}}class e{static get p(){return this.m||(this.m=new s),this.m}static v(t){if(null===t||"object"!=typeof t)return t;const i=Array.isArray(t)?[]:{};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=this.v(t[s]));return i}static O(t=6){let i="";for(let s=0;s<t;s++)i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return i}static M(t){if(!t)return[];if("string"==typeof t){const i=document.querySelectorAll(t);return Array.from(i)}return t instanceof Element?[t]:t instanceof NodeList||Array.isArray(t)?Array.from(t):[]}static A(t={}){return this.S(document.createElement(t.node??"div"),t,!0)}static S(t=document.documentElement,i=null,s=!1){const e={...i??{}},h=s?t:this.H(t.cloneNode(!0)),n=e.classList;return"string"==typeof n?h.classList.add(n):Array.isArray(n)&&h.classList.add(...n),delete e.classList,["style","dataset"].forEach(t=>{const i=e[t];i&&"object"==typeof i&&Object.assign(h[t],i),delete e[t]}),e.role&&(h.setAttribute("role",e.role+""),delete e.role),e.ariaLive&&(h.setAttribute("aria-live",e.ariaLive+""),delete e.ariaLive),e.T&&(h.setAttribute("aria-labelledby",e.T+""),delete e.T),e.C&&(h.setAttribute("aria-controls",e.C+""),delete e.C),e.L&&(h.setAttribute("aria-haspopup",e.L+""),delete e.L),e.P&&(h.setAttribute("aria-multiselectable",e.P+""),delete e.P),e.I&&(h.setAttribute("aria-autocomplete",e.I+""),delete e.I),e.event&&"object"==typeof e.event&&(Object.entries(e.event).forEach(([t,i])=>{h.addEventListener(t,i)}),delete e.event),Object.entries(e).forEach(([t,i])=>{null===i?h.removeAttribute(t):h[t]=i}),h}static H(t){if(t instanceof Element)return t;throw new TypeError("Node is not an Element")}static F(t){return this.j(t)}static j(t,i=null,s=!1,e=!1,h={}){let n=null;for(const o in t){const r=t[o],l=r?.tag?.tagName?r.tag:this.A(r.tag);h[o]=l,r?.$&&this.j(r.$,l,!1,!1,h),i?s?i.prepend(l):i.append(l):e||n||(n=l)}return e||(h.id=this.O(7),i||(h={tags:h,view:n})),h}static V(t,i){const s=this.v(i);for(const i in s){const e=t[i];e?s[i]="boolean"==typeof s[i]?this.k(e):e:void 0!==t?.dataset?.[i]&&(s[i]="boolean"==typeof s[i]?this.k(t.dataset[i]):t.dataset[i])}return s}static R(...t){if(0===t.length)return{};if(1===t.length)return this.v(t[0]);const i=this.v(t[0]);for(let s=1;s<t.length;s++){const e=t[s];for(const t in e)if("on"===t){const s=e[t];for(const e in s)i[t][e].push(s[e])}else i[t]=e[t]}return i}static k(t){if("boolean"==typeof t)return t;if("string"!=typeof t)return!!t;switch(t.trim().toLowerCase()){case"true":case"1":case"yes":case"on":return!0;default:return!1}}static D(t){return this.p.o.delete(t)}static _(t){return this.p.o.get(t)}static N(t,i){this.p.o.set(t,i)}static B(t){return this.p.l.delete(t)}static U(t){return this.p.l.get(t)}static G(t,i){this.p.l.set(t,i)}static W(){return this.p.h}static t(){return this.p.u}static q(t){if(null==t)return"";let i=(t+"").replace(/<`/g,"<").replace(/`>/g,">").replace(/\<\`/g,"<").replace(/\`\>/g,">").trim();const s=globalThis?.document;if(!s||"function"!=typeof s.createElement)return i=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<iframe\b[^>]*>[\s\S]*?<\/iframe>/gi,"").replace(/<(object|embed|link)\b[^>]*>[\s\S]*?<\/\1>/gi,""),i=i.replace(/\son[a-z]+\s*=\s*(['"]).*?\1/gi,""),i=i.replace(/\s([a-z-:]+)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi,""),i;const e=s.createElement("div");return e.innerHTML=i,e.querySelectorAll("script, style, iframe, object, embed, link").forEach(t=>t.remove()),e.querySelectorAll("*").forEach(t=>{for(const i in t.attributes){const s=t.attributes[i],e=s.name??"",h=s.value??"";if(/^on/i.test(e))return void t.removeAttribute(e);/^(href|src|xlink:href)$/i.test(e)&&/^javascript:/i.test(h)&&t.removeAttribute(e)}}),(e.innerHTML??"").trim()}static J(t){const i=document.createElement("DIV");i.innerHTML=t;const s=i.textContent??i.innerText??"";return i.remove(),s.trim()}static K(t){return null==t?"":(t+"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/đ/g,"d").replace(/Đ/g,"d")}static Y(t){const i=[];return Array.from(t.children).forEach(t=>{if("OPTGROUP"===t.tagName){const s=t;i.push(s),Array.from(s.children).forEach(t=>{t.__parentGroup=s,i.push(t)})}else"OPTION"===t.tagName&&i.push(t)}),i}static X(){const t=navigator.userAgent;return/iP(hone|ad|od)/.test(t)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1}static Z(t){const i=(t+"").trim();if(i.endsWith("px"))return i;if(i.endsWith("vh"))return window.innerHeight*parseFloat(i)/100+"px";if(i.endsWith("vw"))return window.innerWidth*parseFloat(i)/100+"px";const s=parseFloat(getComputedStyle(document.documentElement).fontSize);if(i.endsWith("rem"))return s*parseFloat(i)+"px";const e=this.A({node:"div",style:{height:i,opacity:"0"}});document.body.appendChild(e);const h=e.offsetHeight+"px";return e.remove(),h}}e.m=null,e.tt=new class{constructor(){this.it=new Map,this.st=new Map}on(t,i,s={}){const e=s.et??50,h=s.once??!1;this.it.has(t)||this.it.set(t,[]),this.it.get(t).push({ht:i,timeout:e,once:h})}off(t){const i=this.st.get(t);if(i){for(const t of i.values())clearTimeout(t);i.clear(),this.st.delete(t)}this.it.delete(t)}run(t,...i){const s=this.it.get(t);if(!s||0===s.length)return Promise.resolve();this.st.has(t)||this.st.set(t,new Map);const e=this.st.get(t),h=[];for(let t=0;t<s.length;t++){const n=s[t];if(!n)continue;const o=e.get(t);o&&clearTimeout(o);const r=new Promise(h=>{const o=setTimeout(async()=>{try{const t=n.ht(i.length>0?i:null);t instanceof Promise&&await t}catch{}finally{if(n.once){s[t]=void 0;const i=e.get(t);i&&clearTimeout(i),e.delete(t)}h()}},n.timeout);e.set(t,o)});h.push(r)}return Promise.all(h).then(()=>{})}clear(t){if(void 0===t)for(const t of Array.from(this.it.keys()))this.off(t);else this.off(t)}};class h{static nt(){const t={isContinue:!0,isCancel:!1};return{token:{get isContinue(){return t.isContinue},get isCancel(){return t.isCancel}},ht:{stopPropagation(){t.isContinue=!1},cancel(){t.isCancel=!0,t.isContinue=!1}}}}static ot(t,...i){const{token:s,ht:e}=this.nt();for(let h=0;h<i.length;h++){const n=i[h];if("function"==typeof n&&(t&&Array.isArray(t)?n(e,...t):n(e),s.isCancel||!s.isContinue))break}return s}static rt(t,i,s={bubbles:!0,cancelable:!0}){const e=new Event(i,s);return t.dispatchEvent(e),e}static lt(t,...i){if(Array.isArray(t))for(const s of t)"function"==typeof s&&s(...i)}}class n{static ct(t,i){const s=e._(t);if(!s?.options)return;const h=s.options,n=h.minWidth,o=h.minHeight,r=Number.parseInt(h.width,10),l=Number.parseInt(h.height,10);let a=t.offsetWidth+"px",c=t.offsetHeight+"px";const u=getComputedStyle(t);"0px"===a&&"auto"!==u.width&&(a=u.width),"0px"===c&&"auto"!==u.height&&(c=u.height),r>0&&(a=h.width),l>0&&(c=h.height),Object.assign(i.style,{width:a,height:c,minWidth:n,minHeight:o})}}var o;(t=>{t.NEW="new",t.INITIALIZED="initialized",t.MOUNTED="mounted",t.UPDATED="updated",t.DESTROYED="destroyed"})(o||(o={}));class r{constructor(){this.state=o.NEW,this.ut=new Map,this.ut.set("onInit",new Set),this.ut.set("onMount",new Set),this.ut.set("onUpdate",new Set),this.ut.set("onDestroy",new Set)}on(t,i){return this.ut.get(t).add(i),this}off(t,i){return this.ut.get(t).delete(i),this}emit(t,i){const s={state:this.state,dt:i};for(const i of this.ut.get(t))try{i(s)}catch(i){this.gt(i,t)}}gt(t,i){console.error(`[Lifecycle:${i}]`,t)}init(){if(this.state!==o.NEW)return;const t=this.state;this.state=o.INITIALIZED,this.emit("onInit",t)}mount(){if(this.state!==o.INITIALIZED)return;const t=this.state;this.state=o.MOUNTED,this.emit("onMount",t)}update(){if(this.state!==o.MOUNTED&&this.state!==o.UPDATED)return;const t=this.state;this.state=o.UPDATED,this.emit("onUpdate",t)}destroy(){if(this.state===o.DESTROYED)return;const t=this.state;this.state=o.DESTROYED,this.emit("onDestroy",t),this.ft()}getState(){return this.state}is(t){return this.state===t}ft(){for(const t of this.ut.values())t.clear()}}class l extends r{constructor(t){super(),this.node=null,this.options=null,t&&this.initialize(t)}initialize(t){this.node=e.A({node:"div",classList:"selective-ui-placeholder",innerHTML:t.placeholder}),this.options=t,this.init()}get(){return this.options?.placeholder??""}set(t,i=!0){if(!this.node||!this.options)return;i&&(this.options.placeholder=t);const s=e.q(t);this.node.innerHTML=this.options.allowHtml?s:e.J(s)}destroy(){this.is(o.DESTROYED)||(this.node?.remove(),this.node=null,this.options=null,super.destroy())}}class a extends r{constructor(){super(),this.init()}init(){this.node=e.A({node:"div",classList:"selective-ui-directive",role:"button",ariaLabel:"Toggle dropdown"}),super.init(),this.mount()}bt(t){this.node.classList.toggle("drop-down",!!t)}destroy(){this.is(o.DESTROYED)||(this.node.remove(),this.node=null,super.destroy())}}class c extends r{constructor(t=null){super(),this.yt=null,this.node=null,this.options=null,this.wt=[],this.vt=[],t&&this.initialize(t)}initialize(t){this.yt=e.j({xt:{tag:{node:"div",classList:["selective-ui-option-handle","hide"]},$:{Ot:{tag:{node:"a",classList:"selective-ui-option-handle-item",textContent:t.textSelectAll,onclick:()=>{h.lt(this.wt)}}},Mt:{tag:{node:"a",classList:"selective-ui-option-handle-item",textContent:t.textDeselectAll,onclick:()=>{h.lt(this.vt)}}}}}}),this.node=this.yt.view,this.options=t,this.init()}available(){return!!this.options&&e.k(this.options.multiple)&&e.k(this.options.selectall)}update(){this.node&&(this.available()?this.show():this.hide()),super.update()}show(){this.node&&this.node.classList.remove("hide")}hide(){this.node&&this.node.classList.add("hide")}At(t=null){"function"==typeof t&&this.wt.push(t)}St(t=null){"function"==typeof t&&this.vt.push(t)}destroy(){this.is(o.DESTROYED)||(this.node.remove(),this.options=null,this.wt=null,this.vt=null,this.node=null,super.destroy())}}class u extends r{constructor(t=null){super(),this.node=null,this.options=null,t&&this.initialize(t)}initialize(t){this.options=t,this.node=e.A({node:"div",classList:["selective-ui-empty-state","hide"],role:"status",ariaLive:"polite"}),this.init()}show(t="nodata"){this.node&&this.options&&(this.node.textContent="notfound"===t?this.options.textNotFound:this.options.textNoData,this.node.classList.remove("hide"))}hide(){this.node&&this.node.classList.add("hide")}get isVisible(){return!!this.node&&!this.node.classList.contains("hide")}destroy(){this.is(o.DESTROYED)||(this.options=null,this.node?.remove(),this.node=null,super.destroy())}}class d extends r{constructor(t=null){super(),this.node=null,this.options=null,t&&this.initialize(t)}initialize(t){this.options=t,this.node=e.A({node:"div",classList:["selective-ui-loading-state","hide"],textContent:t.textLoading,role:"status",ariaLive:"polite"}),this.init()}show(t){this.node&&this.options&&(this.node.textContent=this.options.textLoading,this.node.classList.toggle("small",!!t),this.node.classList.remove("hide"))}hide(){this.node&&this.node.classList.add("hide")}get isVisible(){return!!this.node&&!this.node.classList.contains("hide")}destroy(){this.is(o.DESTROYED)||(this.options=null,this.node?.remove(),this.node=null,super.destroy())}}class p{constructor(){this.Ht=!1,this.element=null,this.Tt=null,this.Ct=null,this.Ht=!0,this.Lt=this.Pt.bind(this)}It(t){}Pt(){const t=this.element;if(!t||"function"!=typeof t.getBoundingClientRect)return void this.It({width:0,height:0,top:0,left:0,padding:{top:0,right:0,bottom:0,left:0},border:{top:0,right:0,bottom:0,left:0},margin:{top:0,right:0,bottom:0,left:0}});const i=t.getBoundingClientRect(),s="undefined"!=typeof window&&"function"==typeof window.getComputedStyle?window.getComputedStyle(t):null;this.It({width:i?.width??0,height:i?.height??0,top:i?.top??0,left:i?.left??0,padding:{top:parseFloat(s?.paddingTop??"0"),right:parseFloat(s?.paddingRight??"0"),bottom:parseFloat(s?.paddingBottom??"0"),left:parseFloat(s?.paddingLeft??"0")},border:{top:parseFloat(s?.borderTopWidth??"0"),right:parseFloat(s?.borderRightWidth??"0"),bottom:parseFloat(s?.borderBottomWidth??"0"),left:parseFloat(s?.borderLeftWidth??"0")},margin:{top:parseFloat(s?.marginTop??"0"),right:parseFloat(s?.marginRight??"0"),bottom:parseFloat(s?.marginBottom??"0"),left:parseFloat(s?.marginLeft??"0")}})}rt(){this.Pt()}connect(t){if(!(t instanceof Element))throw Error("Invalid element");this.element=t,this.Tt=new ResizeObserver(this.Lt),this.Tt.observe(t),this.Ct=new MutationObserver(this.Lt),this.Ct.observe(t,{attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("scroll",this.Lt,!0),window.addEventListener("resize",this.Lt),window.visualViewport&&(window.visualViewport.addEventListener("resize",this.Lt),window.visualViewport.addEventListener("scroll",this.Lt))}disconnect(){this.Tt?.disconnect(),this.Ct?.disconnect(),this.It=()=>{},window.removeEventListener("scroll",this.Lt,!0),window.removeEventListener("resize",this.Lt),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.Lt),window.visualViewport.removeEventListener("scroll",this.Lt)),this.Tt=null,this.Ct=null,this.element=null}}class g extends r{constructor(t=null,i=null,s=null){super(),this.options=null,this.Et=!1,this.Ft=null,this.node=null,this.jt=null,this.$t=null,this.parent=null,this.Vt=null,this.kt=null,this.Rt=null,this.Dt=null,this.zt=null,this._t=null,this.Nt=null,this.Bt={Ut:36,Gt:8,Wt:!0},this.qt=s,t&&i&&this.initialize(t,i)}initialize(t,i){if(!this.qt)throw Error("Popup requires a ModelManager instance.");this.Vt=new c(i),this.kt=new u(i),this.Rt=new d(i);const s=e.j({Jt:{tag:{node:"div",classList:"selective-ui-popup",style:{maxHeight:i.panelHeight}},$:{xt:{tag:this.Vt.node},Kt:{tag:{id:i.Qt,node:"div",classList:"selective-ui-options-container",role:"listbox"}},Yt:{tag:this.Rt.node},Xt:{tag:this.kt.node}}}},null);this.node=s.view,this.zt=s.tags.Kt,this.parent=e._(t),this.options=i,this.init(),this.qt.load(this.zt,{isMultiple:i.multiple},i.virtualScroll?{Zt:this.node,Ut:this.Bt.Ut,Gt:this.Bt.Gt,Wt:this.Bt.Wt}:{});const h=this.qt.ti();this.Ft=h.ii,this.Dt=h.Dt,this.Vt.At(()=>{h.ii.si(!0)}),this.Vt.St(()=>{h.ii.si(!1)}),this.ei(),this.mount()}async hi(){this.options&&this.Rt&&this.Vt&&this.Ft&&this.qt&&(this.Nt&&clearTimeout(this.Nt),this.qt.ni(!0),!1!==e.k(this.options.loadingfield)&&(this.kt.hide(),this.Rt.show(this.Ft.ri().oi),this.li()))}async ai(){this.options&&this.Rt&&this.Ft&&this.qt&&(this.Nt&&clearTimeout(this.Nt),this.Nt=setTimeout(()=>{this.qt?.ni(!1),this.Rt?.hide();const t=this.Ft?.ri();this.ci(t??void 0),this.li()},this.options.animationtime))}ei(){this.Ft&&(this.Ft.ui(t=>{this.ci(t)}),this.Ft.di("items",()=>{const t=this.Ft.ri();this.ci(t),this.li()}))}ci(t){if(!(this.Ft&&this.kt&&this.Vt&&this.zt))return;const i=t??this.Ft.ri();i.isEmpty?(this.kt.show("nodata"),this.zt.classList.add("hide"),this.Vt.hide()):i.oi?(this.kt.hide(),this.zt.classList.remove("hide"),this.Vt.update()):(this.kt.show("notfound"),this.zt.classList.add("hide"),this.Vt.hide())}pi(t,i){this.Ft?.gi(t,i)}fi(t,i){this.Ft?.di(t,i)}mi(t){this.jt=t}open(t=null,i){if(!(this.node&&this.options&&this.Vt&&this.parent&&this.jt))return;this.Et||(document.body.appendChild(this.node),this.Et=!0,this.$t=new p,this.jt.bi(this.node),this.node.addEventListener("mousedown",t=>{t.stopPropagation(),t.preventDefault()})),this.Vt.update(),i&&this.ci();const s=this.yi(),{position:e,top:h,maxHeight:n,wi:o}=this.xi(s);this.jt.expand({duration:this.options.animationtime,display:"flex",width:s.width,left:s.left,top:h,maxHeight:n,wi:o,position:e,Oi:()=>{if(!this.$t||!this.parent)return;this.$t.It=()=>{const t=this.yi();this.Mi(t)},this.$t.connect(this.parent.container.tags.Ai),t?.();const i=this.Dt;i?.resume?.()}})}close(t=null){if(!(this.Et&&this.options&&this.$t&&this.jt))return;const i=this.Dt;i?.suspend?.(),this.$t.disconnect(),this.jt.collapse({duration:this.options.animationtime,Oi:t??void 0})}li(){this.Et&&this.$t?.rt()}Si(t,i){this.node&&(this._t=async()=>{const i=t.Hi();if(!i.Ti)return;const s=this.node;if(s.scrollHeight-s.scrollTop-s.clientHeight<100&&!i.Ci&&i.hasMore){const i=await t.Li();!i.Pi&&i.message&&console.log("Load more:",i.message)}},this.node.addEventListener("scroll",this._t))}destroy(){if(!this.is(o.DESTROYED)){this.Nt&&(clearTimeout(this.Nt),this.Nt=null),this.node&&this._t&&(this.node.removeEventListener("scroll",this._t),this._t=null),this.kt.destroy(),this.Rt.destroy(),this.Vt.destroy(),this.Dt.destroy();try{this.$t?.disconnect()}catch(t){}this.$t=null;try{this.jt?.bi?.(null)}catch(t){}if(this.jt=null,this.node)try{const t=this.node.cloneNode(!0);this.node.replaceWith(t),t.remove()}catch(t){this.node.remove()}this.node=null,this.zt=null;try{this.qt?.ni?.(!1),this.Dt?.clear?.(),this.Dt=null,this.Ft=null,this.node.remove()}catch(t){}this.qt=null,this.Vt=null,this.kt=null,this.Rt=null,this.parent=null,this.options=null,this.Et=!1,super.destroy()}}yi(){const t=this.parent.container.tags.Ai,i=t.getBoundingClientRect(),s=window.getComputedStyle(t);return{width:i.width,height:i.height,top:i.top,left:i.left,padding:{top:parseFloat(s.paddingTop),right:parseFloat(s.paddingRight),bottom:parseFloat(s.paddingBottom),left:parseFloat(s.paddingLeft)},border:{top:parseFloat(s.borderTopWidth),right:parseFloat(s.borderRightWidth),bottom:parseFloat(s.borderBottomWidth),left:parseFloat(s.borderLeftWidth)}}}xi(t){const i=window.visualViewport,s=e.X(),h=i?.height??window.innerHeight,n=this.jt.Ii("flex").scrollHeight,o=parseFloat(this.options?.panelHeight??"220")||220,r=parseFloat(this.options?.panelMinHeight??"100")||100,l=h-(t.top+t.height)-3,a=t.top-3;let c="bottom",u=o,d=Math.min(n,u);const p=l-15;(d>=r?p>=r:p>=d)?(c="bottom",u=Math.min(l-15,o)):a>=Math.max(d,r)?(c="top",u=Math.min(a-15,o)):l>=a?(c="bottom",u=Math.max(l-15,r)):(c="top",u=Math.max(a-15,r)),d=Math.min(n,u);const g=i&&s?i.offsetTop:0;return{position:c,top:"bottom"===c?t.top+t.height+3+g:t.top-d-3+g,maxHeight:u,wi:d,Ei:n}}Mi(t){if(!this.options||!this.jt)return;const{position:i,top:s,maxHeight:e,wi:h}=this.xi(t);this.jt.resize({duration:this.options.animationtime,width:t.width,left:t.left,top:s,maxHeight:e,wi:h,position:i,animate:!0})}}class f extends r{constructor(t=null){super(),this.yt=null,this.node=null,this.Fi=null,this.ji=null,this.options=null,this.$i=null,this.Vi=null,this.ki=null,this.options=t,t&&this.initialize(t)}initialize(t){this.yt=e.j({Ri:{tag:{node:"div",classList:["selective-ui-searchbox","hide"]},$:{Fi:{tag:{id:e.O(),node:"input",type:"search",classList:["selective-ui-searchbox-input"],placeholder:t.placeholder,role:"searchbox",C:t.Qt,I:"list"}}}}}),this.node=this.yt.view,this.Fi=this.yt.tags.Fi;let i=!1;const s=this.yt.tags.Fi;s.addEventListener("mousedown",t=>{t.stopPropagation()}),s.addEventListener("mouseup",t=>{t.stopPropagation()}),s.addEventListener("keydown",t=>{i=!1,"ArrowDown"===t.key||"Tab"===t.key?(t.preventDefault(),t.stopPropagation(),i=!0,this.$i?.(1)):"ArrowUp"===t.key?(t.preventDefault(),t.stopPropagation(),i=!0,this.$i?.(-1)):"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),i=!0,this.Vi?.()):"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),i=!0,this.ki?.()),t.stopPropagation()}),s.addEventListener("input",()=>{i||this.ji?.(s.value,!0)}),this.init()}show(){this.node&&this.Fi&&this.options&&(this.node.classList.remove("hide"),this.Fi.readOnly=!this.options.searchable,this.options.searchable&&requestAnimationFrame(()=>{this.Fi?.focus()}))}hide(){this.node&&this.node.classList.add("hide")}clear(t=!0){this.yt&&(this.yt.tags.Fi.value="",this.ji?.("",t))}Di(t){this.Fi&&(this.Fi.placeholder=e.J(t))}zi(t){this.Fi&&this.Fi.setAttribute("aria-activedescendant",t)}destroy(){this.is(o.DESTROYED)||(this.node?.remove(),this.yt=null,this.node=null,this.Fi=null,this.ji=null,this.options=null,this.$i=null,this.Vi=null,this.ki=null,super.destroy())}}class m{constructor(t=null){this._i=null,this.Ni=null,this.Bi=!1,t&&this.bi(t)}bi(t){if("string"==typeof t){const i=document.querySelector(t);return void(i instanceof HTMLElement&&(this.element=i))}this.element=t}cancel(){return this._i&&(clearTimeout(this._i),this._i=null),this.Ni&&(clearTimeout(this.Ni),this.Ni=null),this.Bi=!1,this}Ii(t="flex"){if(!this.element)return{width:0,height:0,scrollHeight:0};const i={display:this.element.style.display,visibility:this.element.style.visibility,position:this.element.style.position,height:this.element.style.height,width:this.element.style.width};Object.assign(this.element.style,{display:t,visibility:"hidden",position:"fixed",height:"fit-content",width:"fit-content"});const s=window.getComputedStyle(this.element),e=parseFloat(s.borderTopWidth),h=parseFloat(s.borderBottomWidth),n=this.element.scrollHeight+e+h,o=this.element.getBoundingClientRect(),r={width:o.width,height:o.height+e+h,scrollHeight:n};return Object.assign(this.element.style,i),r}expand(t){if(!this.element)return this;this.cancel(),this.Bi=!0;const{duration:i=200,display:s="flex",width:e,left:h,top:n,maxHeight:o,wi:r,position:l="bottom",Oi:a}=t;return Object.assign(this.element.style,{display:s,width:e+"px",left:h+"px",top:("bottom"===l?n:n+r)+"px",maxHeight:o+"px",height:"0px",opacity:"0",overflow:"hidden",transition:"none"}),this.element.classList.toggle("position-top","top"===l),this.element.classList.toggle("position-bottom","bottom"===l),requestAnimationFrame(()=>{Object.assign(this.element.style,{transition:`top ${i}ms, height ${i}ms, opacity ${i}ms`,top:n+"px",height:r+"px",opacity:"1",overflow:r>=o?"auto":"hidden"}),this._i=setTimeout(()=>{this.element.style.transition="none",this.Bi=!1,a?.()},i)}),this}collapse(t){if(!this.element)return this;this.cancel(),this.Bi=!0;const{duration:i=200,Oi:s}=t,e=this.element.offsetHeight,h=this.element.offsetTop,n=this.element.classList.contains("position-top")?"top":"bottom",o=this.element.scrollHeight-this.element.offsetHeight>0,r="top"===n?h+e:h;return requestAnimationFrame(()=>{Object.assign(this.element.style,{transition:`height ${i}ms, top ${i}ms, opacity ${i}ms`,height:"0px",top:r+"px",opacity:"0",overflow:o?"auto":"hidden"}),this._i=setTimeout(()=>{Object.assign(this.element.style,{display:"none",transition:"none"}),this.Bi=!1,s?.()},i)}),this}showSwipeWidth(t){if(!this.element)return this;this.cancel(),this.Bi=!0;const{duration:i=200,display:s="block",Oi:e}=t;Object.assign(this.element.style,{transition:"none",display:s,width:"fit-content"});const h=this.Ii(s).width;return Object.assign(this.element.style,{width:"0px"}),requestAnimationFrame(()=>{Object.assign(this.element.style,{transition:`width ${i}ms`,width:h+"px",overflow:"hidden"})}),this._i=setTimeout(()=>{Object.assign(this.element.style,{width:"",overflow:"",transition:""}),this.Bi=!1,e?.()},i),this}hideSwipeWidth(t){if(!this.element)return this;this.cancel(),this.Bi=!0;const{duration:i=200,Oi:s}=t,e=this.Ii().width;return Object.assign(this.element.style,{transition:"none",width:e+"px"}),requestAnimationFrame(()=>{Object.assign(this.element.style,{transition:`width ${i}ms`,width:"0px",overflow:"hidden"})}),this._i=setTimeout(()=>{Object.assign(this.element.style,{width:"",overflow:"",transition:"",display:""}),this.Bi=!1,s?.()},i),this}resize(t){if(!this.element)return this;this.cancel();const{duration:i=200,width:s,left:e,top:h,maxHeight:n,wi:o,position:r="bottom",animate:l=!0,Oi:a}=t,c=(this.element.classList.contains("position-top")?"top":"bottom")!==r,u=this.element.scrollHeight>n;return this.element.classList.toggle("position-top","top"===r),this.element.classList.toggle("position-bottom","bottom"===r),c&&(this.element.style.transition=`top ${i}ms ease-out, height ${i}ms ease-out, max-height ${i}ms ease-out;`),requestAnimationFrame(()=>{const t={width:s+"px",left:e+"px",top:h+"px",maxHeight:n+"px",height:o+"px",overflowY:u?"auto":"hidden"},r=Math.abs(this.element.offsetHeight-o);l&&(c||r>5)?t.transition=`height ${i}ms, top ${i}ms`:this.Ni=setTimeout(()=>{this.element?.style&&(this.element.style.transition=null)},i),Object.assign(this.element.style,t),l&&(c||r>1)?this.Ni=setTimeout(()=>{this.element.style.transition=null,c&&delete this.element.style.transition,a?.()},i):(c&&delete this.element.style.transition,a?.())}),this}get Ui(){return this.Bi}}class b extends r{get value(){return this.targetElement?.getAttribute("value")??null}constructor(t,i=null,s=null){super(),this.targetElement=null,this.view=null,this.position=-1,this.Ht=!1,this.Gi=!1,this.options=t,this.targetElement=i,this.view=s,this.init()}Wi(t){this.targetElement=t,this.update()}qi(){}destroy(){this.is(o.DESTROYED)||(this.targetElement=null,this.view?.destroy(),this.view=null,this.Gi=!0,super.destroy())}}class y extends b{constructor(t,i){super(t,i??null,null),this.label="",this.items=[],this.collapsed=!1,this.Ji=[]}init(){this.targetElement&&(this.label=this.targetElement.label,this.collapsed=e.k(this.targetElement.dataset?.collapsed)),super.init(),this.mount()}get value(){return this.items.map(t=>t.value)}get Ki(){return this.items.filter(t=>t.selected)}get Qi(){return this.items.filter(t=>t.visible)}get Yi(){return this.Qi.length>0}Wi(t){this.label=t.label,this.view?.Xi(this.label),this.update()}update(){this.view&&(this.view.Xi(this.label),this.view.Zi(this.collapsed)),super.update()}destroy(){this.is(o.DESTROYED)||(this.items.forEach(t=>{t.destroy()}),this.items=[],super.destroy())}ts(t){this.Ji.push(t)}ss(){this.collapsed=!this.collapsed,this.view?.Zi(this.collapsed),h.ot([this,this.collapsed],...this.Ji)}es(t){this.items.push(t),t.group=this}removeItem(t){const i=this.items.indexOf(t);i>-1&&(this.items.splice(i,1),t.group=null)}hs(){this.view?.hs()}}class w extends b{constructor(t,i=null,s=null){super(t,i,s),this.ns=[],this.rs=[],this.ls=[],this.cs=!0,this.us=!1,this.group=null}init(){this.ds=e.K(this.textContent.toLowerCase()),super.init(),this.mount()}get ps(){return this.dataset?.imgsrc||this.dataset?.image||""}get hasImage(){return!!this.ps}get value(){return this.targetElement?.value??""}get selected(){return!!this.targetElement?.selected}set selected(t){this.gs=t,h.ot([this,t],...this.ns)}get visible(){return this.cs}set visible(t){if(this.cs===t)return;this.cs=t;const i=this.view?.fs?.();i&&i.classList.toggle("hide",!t),h.ot([this,t],...this.ls)}get gs(){return this.selected}set gs(t){const i=this.view?.view?.tags?.bs,s=this.view?.fs?.();i&&(i.checked=t),s&&this.targetElement&&(s.classList.toggle("checked",!!t),s.setAttribute("aria-selected",t?"true":"false"),this.targetElement.toggleAttribute("selected",!!t)),this.targetElement&&(this.targetElement.selected=t),h.ot([this,t],...this.rs)}get text(){const t=e.q(this.dataset?.mask??this.targetElement?.text??"");return this.options.allowHtml?t:e.J(t)}get textContent(){return this.options.allowHtml?e.J(this.text).trim():this.text.trim()}get dataset(){return this.targetElement?.dataset??{}}get ys(){return this.us}set ys(t){const i=!!t,s=this.view?.fs?.();this.us!==i&&(this.us=i),s&&s.classList.toggle("highlight",i)}ws(t){this.ns.push(t)}vs(t){this.rs.push(t)}ui(t){this.ls.push(t)}update(){if(this.ds=e.K(this.textContent.toLowerCase()),!this.view)return void super.update();const t=this.view.view.tags.xs;t&&(this.options.allowHtml?t.innerHTML=this.text:t.textContent=this.textContent);const i=this.view.view.tags.Os;i&&this.hasImage&&(i.src=this.ps,i.alt=this.text),this.targetElement&&(this.gs=this.targetElement.selected),super.update()}destroy(){this.is(o.DESTROYED)||(this.ns=[],this.rs=[],this.ls=[],this.group=null,this.ds=null,super.destroy())}}class v{constructor(t){this.Ms=[],this.As=null,this.Ss=null,this.Hs=null,this.options=null,this.Ts=0,this.options=t}Cs(t){this.Ls=t}Ps(t){this.Is=t}Es(t){const i=this.Fs(t),s=i!==this.Hs;return s&&(this.Hs=i),s}Fs(t){return t.map(t=>{if("OPTGROUP"===t.tagName){const i=t,s=Array.from(i.children).map(t=>`${t.value}:${t.text}:${t.selected}`).join("\n");return`G:${i.label}:${s}`}return`O:${t.value}:${t.text}:${t.selected}`}).join("\n\n")}js(t){this.Ms=[];let i=null;return t.forEach(t=>{if("OPTGROUP"===t.tagName)i=new y(this.options,t),this.Ms.push(i);else if("OPTION"===t.tagName){const s=t,e=new w(this.options,s),h=s.__parentGroup;h&&i&&h===i.targetElement?(i.es(e),e.group=i):(this.Ms.push(e),i=null)}}),this.Ms}async replace(t){this.Hs=null,this.js(t),this.As&&await this.As.$s(this.Ms),this.refresh(!1)}notify(){this.As&&this.refresh(!1)}load(t,i={},s={}){this.As=new this.Ls(this.Ms),Object.assign(this.As,i),this.Ss=new this.Is(t),Object.assign(this.Ss,s),this.Ss.Vs(this.As)}update(t){if(!this.Es(t))return;const i=this.Ms,s=[],e=new Map,h=new Map;i.forEach(t=>{t instanceof y?e.set(t.label,t):t instanceof w&&h.set(`${t.value}::${t.textContent}`,t)});let n=null,o=0;t.forEach(t=>{if("OPTGROUP"===t.tagName){const i=t,h=e.get(i.label);h?(h.label!==i.label&&h.Wi(i),h.position=o,h.items=[],n=h,s.push(h),e.delete(i.label)):(n=new y(this.options,i),n.position=o,s.push(n)),o++}else if("OPTION"===t.tagName){const i=t,e=`${i.value}::${i.text}`,r=h.get(e);if(r)r.Wi(i),r.position=o,i.__parentGroup&&n?(n.es(r),r.group=n):(r.group=null,s.push(r)),h.delete(e);else{const t=new w(this.options,i);t.position=o,i.__parentGroup&&n?(n.es(t),t.group=n):s.push(t)}o++}});let r=!0;0==this.Ts&&(r=!1),this.Ts=o,e.forEach(t=>{r=!1,t.destroy()}),h.forEach(t=>{r=!1,t.destroy()}),this.Ms=s,this.As&&this.As.ks(this.Ms),this.refresh(r)}onUpdated(){}ni(t){this.As&&(this.As.Rs=t)}refresh(t){this.Ss&&(this.Ss.refresh(t),this.onUpdated())}ti(){return{Ds:this.Ms,ii:this.As,Dt:this.Ss}}zs(t){return this.As?._s(t)}Ns(t){return this.As?.Bs(t)}}class x extends r{constructor(t=null){super(),this.Us=null,this.ii=null,this.Us=t,this.init()}Vs(t){this.ii=t,t.gi("items",()=>{this.clear()}),t.di("items",()=>{this.Gs()}),t.mount(),this.mount(),this.Gs()}clear(){this.Us&&this.Us.replaceChildren()}Gs(){this.ii&&this.Us&&(this.ii.Ws(this.Us),this.update())}refresh(t){this.Gs()}destroy(){this.is(o.DESTROYED)||(this.ii?.destroy?.(),this.Us=null,this.ii=null,super.destroy())}}class O extends r{constructor(t=null){super(),this.yt=null,this.node=null,this.options=null,this.qs=null,this.Js=null,this.qt=null,this.Ks=[],t&&this.initialize(t)}initialize(t){this.options=t,this.init()}init(){this.state===o.NEW&&(this.yt=e.j({Qs:{tag:{node:"div",classList:["selective-ui-accessorybox","hide"],onmouseup:t=>{t.stopPropagation()}}}}),this.node=this.yt.view,super.init())}Ys(t){this.qs=t,this.Js=t.parentElement,this.Xs(),this.mount()}mount(){this.is(o.INITIALIZED)&&super.mount()}Xs(){this.Js&&this.node&&this.qs&&this.options&&this.Js.insertBefore(this.node,"top"===this.options.accessoryStyle?this.qs:this.qs.nextSibling)}Zs(t){this.qt=t}te(t){this.node&&this.options&&(this.node.replaceChildren(),t.length>0&&this.options.multiple?t.forEach(t=>{e.j({ie:{tag:{node:"div",classList:["accessory-item"]},$:{se:{tag:{node:"span",classList:["accessory-item-button"],role:"button",ariaLabel:`${this.options.textAccessoryDeselect}${t.textContent}`,title:`${this.options.textAccessoryDeselect}${t.textContent}`,onclick:async i=>{i.preventDefault(),await(this.qt?.zs?.("select")),t.selected=!1}}},ee:{tag:{node:"span",classList:["accessory-item-content"],innerHTML:t.text}}}}},this.node)}):t=[],this.Ks=t,this.he(),this.update(),h.rt(window,"resize"))}update(){this.state===o.MOUNTED&&super.update()}he(){this.options?.accessoryVisible&&this.Ks.length>0&&this.options.multiple?this.show():this.hide()}show(){this.node?.classList.remove("hide")}hide(){this.node?.classList.add("hide")}destroy(){this.state!==o.DESTROYED&&(this.node?.remove(),this.yt=null,this.node=null,this.options=null,this.qs=null,this.Js=null,this.qt=null,this.Ks=[],super.destroy())}}class M extends r{constructor(t,i,s){super(),this.ne=null,this.oe=null,this.re=null,this.le=null,this.ae={currentPage:0,totalPages:1,hasMore:!1,Ci:!1,ce:"",Ti:!1},this.initialize(t,i,s)}initialize(t,i,s){this.select=t,this.qt=i,this.le=s,this.init()}ue(){return!!this.ne}async de(t){if(!this.ne)return{Pi:!1,items:[],message:"Ajax not configured"};const i=Array.isArray(t)?t:[t];if(0===i.length)return{Pi:!0,items:[]};try{const t=this.ne;let s,e;if(s="function"==typeof t.pe?t.pe(i):{values:i.join(","),ge:"1",..."function"==typeof t.data?t.data.bind(this.le.fe.find(this.le.container.targetElement))("",0):t.data??{}},"POST"===(t.method??"GET")){const i=new URLSearchParams;Object.keys(s).forEach(t=>i.append(t,s[t]+"")),e=await fetch(t.url,{method:"POST",body:i,headers:{"Content-Type":"application/x-www-form-urlencoded"}})}else{const i=""+new URLSearchParams(s);e=await fetch(`${t.url}?${i}`)}if(!e.ok)throw Error("HTTP error! status: "+e.status);const h=await e.json(),n=this.me(h);return this.update(),{Pi:!0,items:n.items}}catch(t){return console.error("Load by values error:",t),{Pi:!1,message:t?.message,items:[]}}}be(t){const i=Array.from(this.select.options).map(t=>t.value);return{ye:t.filter(t=>i.includes(t)),we:t.filter(t=>!i.includes(t))}}ve(t){this.ne=t}setPopup(t){this.re=t}Hi(){return{...this.ae}}xe(){this.ae={currentPage:0,totalPages:1,hasMore:!1,Ci:!1,ce:"",Ti:this.ae.Ti}}clear(){this.ae.ce="";const{Ds:t}=this.qt.ti(),i=[];for(const s of t)s instanceof w?i.push(s):s instanceof y&&Array.isArray(s.items)&&i.push(...s.items);i.forEach(t=>{t.visible=!0})}async search(t,i=!1){return this.ne?this.Oe(t,i):this.Me(t)}async Li(){return this.ne?this.ae.Ci?{Pi:!1,message:"Already loading"}:this.ae.Ti?this.ae.hasMore?(this.ae.currentPage++,this.Oe(this.ae.ce,!0)):{Pi:!1,message:"No more data"}:{Pi:!1,message:"Pagination not enabled"}:{Pi:!1,message:"Ajax not enabled"}}async Me(t){this.Ae(t)&&(this.ae.ce=t);const i=((t??"")+"").toLowerCase(),s=e.K(i),{Ds:h}=this.qt.ti(),n=[];for(const t of h)t instanceof w?n.push(t):t instanceof y&&Array.isArray(t.items)&&n.push(...t.items);let o=!1;return n.forEach(t=>{const e=""===i||t.ds.includes(s);t.visible=e,e&&(o=!0)}),this.update(),{Pi:!0,Se:o,isEmpty:0===n.length}}Ae(t){return t!==this.ae.ce}async Oe(t,i=!1){const s=this.ne;this.Ae(t)&&(this.xe(),this.ae.ce=t,i=!1),this.ae.Ci=!0,this.re?.hi(),this.oe?.abort(),this.oe=new AbortController;const e=this.ae.currentPage,h=Array.from(this.select.selectedOptions).map(t=>t.value).join(",");let n;"function"==typeof s.data?(n=s.data.bind(this.le.fe.find(this.le.container.targetElement))(t,e),n&&void 0===n.selectedValue&&(n.selectedValue=h)):n={search:t,page:e,selectedValue:h,...s.data??{}};try{let t;if("POST"===(s.method??"GET")){const i=new URLSearchParams;Object.keys(n).forEach(t=>i.append(t,n[t]+"")),t=await fetch(s.url,{method:"POST",body:i,headers:{"Content-Type":"application/x-www-form-urlencoded"},signal:this.oe.signal})}else{const i=""+new URLSearchParams(n);t=await fetch(`${s.url}?${i}`,{signal:this.oe.signal})}const e=await t.json(),h=this.me(e);return h.He?(this.ae.Ti=!0,this.ae.currentPage=h.page,this.ae.totalPages=h.totalPages,this.ae.hasMore=h.hasMore):this.ae.Ti=!1,this.Te(h.items,!!s.keepSelected,i),this.ae.Ci=!1,this.re?.ai(),this.update(),{Pi:!0,Se:h.items.length>0,isEmpty:0===h.items.length,He:h.He,hasMore:h.hasMore,currentPage:h.page,totalPages:h.totalPages}}catch(t){return this.ae.Ci=!1,this.re?.ai(),"AbortError"===t?.name?{Pi:!1,message:"Request aborted"}:(console.error("Ajax search error:",t),{Pi:!1,message:t?.message})}}me(t){let i=[],s=!1,e=0,h=1,n=!1;return t.object&&Array.isArray(t.object)?(i=t.object,void 0!==t.page&&(s=!0,e=parseInt(t.page??0,10),h=parseInt(t.totalPages??t.total_page??1,10),n=e<h-1)):t.data&&Array.isArray(t.data)?(i=t.data,void 0!==t.page&&(s=!0,e=parseInt(t.page??0,10),h=parseInt(t.totalPages??t.total_page??1,10),n=t.hasMore??e<h-1)):Array.isArray(t)?i=t:t.items&&Array.isArray(t.items)&&(i=t.items,t.pagination&&(s=!0,e=parseInt(t.pagination.page??0,10),h=parseInt(t.pagination.totalPages??t.pagination.total_page??1,10),n=t.pagination.hasMore??e<h-1)),{items:i.map(t=>{if(t instanceof HTMLOptionElement||t instanceof HTMLOptGroupElement)return t;if("optgroup"===t.type||t.Ce||t.group||t.label)return{type:"optgroup",label:t.label??t.name??t.title??"",data:t.data??{},options:(t.options??t.items??[]).map(t=>({value:t.value??t.id??t.key??"",text:t.text??t.label??t.name??t.title??"",selected:t.selected??!1,data:t.data??(t.imgsrc?{imgsrc:t.imgsrc}:{})}))};const i=t.data??{};return t?.imgsrc&&(i.imgsrc=t.imgsrc),{type:"option",value:t.value??t.id??t.key??"",text:t.text??t.label??t.name??t.title??"",selected:t.selected??!1,data:i}}),He:s,page:e,totalPages:h,hasMore:n}}Te(t,i,s=!1){const e=this.select;let h=[];i&&(h=Array.from(e.selectedOptions).map(t=>t.value)),s||(e.innerHTML=""),t.forEach(t=>{if("option"!==t.type&&t.type||""!==t.value||""!==t.text)if(t instanceof HTMLOptionElement||t instanceof HTMLOptGroupElement)e.appendChild(t);else if("optgroup"===t.type){const s=document.createElement("optgroup");s.label=t.label,t.data&&Object.keys(t.data).forEach(i=>{s.dataset[i]=t.data[i]+""}),Array.isArray(t.options)&&t.options.forEach(t=>{const e=document.createElement("option");e.value=t.value,e.text=t.text,t.data&&Object.keys(t.data).forEach(i=>{e.dataset[i]=t.data[i]+""}),(t.selected||i&&h.includes(e.value))&&(e.selected=!0),s.appendChild(e)}),e.appendChild(s)}else{const s=document.createElement("option");s.value=t.value,s.text=t.text,t.data&&Object.keys(t.data).forEach(i=>{s.dataset[i]=t.data[i]+""}),(t.selected||i&&h.includes(s.value))&&(s.selected=!0),e.appendChild(s)}})}destroy(){this.is(o.DESTROYED)||(this.select=null,this.qt=null,this.ne=null,this.oe=null,this.re=null,this.le=null,super.destroy())}}class A{constructor(t){this.Le=null,this.Pe=null,this.Ie=50,this.select=t,this.Pe=this.Ee(),this.Fe=new MutationObserver(()=>{this.Le&&clearTimeout(this.Le),this.Le=setTimeout(()=>{this.je()},this.Ie)})}Ee(){const t=Array.from(this.select.options);return{length:t.length,values:t.map(t=>t.value).join(","),$e:t.map(t=>t.text).join(","),selected:t.map(t=>t.selected+"").join(",")}}Ve(){const t=this.Ee(),i=JSON.stringify(t)!==JSON.stringify(this.Pe);return i&&(this.Pe=t),i}je(){this.Ve()&&this.It(this.select)}connect(){this.Fe.observe(this.select,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["selected","value","disabled"]})}It(t){}disconnect(){this.Le&&clearTimeout(this.Le),this.Le=null,this.Fe.disconnect()}}class S{constructor(t){this.Le=null,this.element=t,this.Fe=new MutationObserver(t=>{let i=!1;for(const s of t)if("attributes"===s.type&&s.attributeName?.startsWith("data-")){i=!0;break}i&&(this.Le&&clearTimeout(this.Le),this.Le=setTimeout(()=>{this.It({...this.element.dataset})},50))}),t.addEventListener("dataset:changed",()=>{this.It({...this.element.dataset})})}connect(){this.Fe.observe(this.element,{attributes:!0,attributeOldValue:!0})}It(t){}disconnect(){this.Le&&clearTimeout(this.Le),this.Le=null,this.Fe.disconnect()}}class H extends r{constructor(t=[]){super(),this.items=[],this.ke=e.O(12),this.Rs=!1,this.items=t,this.init()}Re(t,i,s){const e=i;t.Ht?e?.update?.():e?.mount?.()}gi(t,i){e.tt.on(`${t}ing_${this.ke}`,i,{et:0})}di(t,i){e.tt.on(`${t}_${this.ke}`,i,{et:0})}Bs(t,...i){return e.tt.run(`${t}_${this.ke}`,...i)}_s(t,...i){return e.tt.run(`${t}ing_${this.ke}`,...i)}De(t,i){return null}ze(){return this.items.length}async _e(t){await this._s("items",t),this.items=t,await this.Bs("items",t),this.update()}async $s(t){await this._e(t)}Ws(t){for(let i=0;i<this.ze();i++){const s=this.items[i];let e=s.view;s.Ht||(e=this.De(t,s),s.view=e),this.Re(s,e,i),s.Ht=!0}}ks(t){}destroy(){this.is(o.DESTROYED)||(this.Dt=null,this.items.forEach(t=>{t?.destroy?.()}),this.items=[])}}class T extends r{constructor(t){super(),this.parent=null,this.view=null,this.parent=t,this.init()}fs(){if(!this.view?.view)throw Error("View is not mounted. Did you forget to set this.view?");return this.view.view}destroy(){this.is(o.DESTROYED)||(this.fs()?.remove?.(),this.parent=null,this.view=null,super.destroy())}}class C extends T{constructor(){super(...arguments),this.view=null}mount(){const t=e.O(7);this.view=e.F({Ne:{tag:{node:"div",classList:["selective-ui-group"],role:"group",T:`seui-${t}-header`,id:`seui-${t}-group`},$:{Be:{tag:{node:"div",classList:["selective-ui-group-header"],role:"presentation",id:`seui-${t}-header`}},Ue:{tag:{node:"div",classList:["selective-ui-group-items"],role:"group"}}}}}),this.parent.appendChild(this.view.view),super.mount()}update(){this.Xi(),super.update()}Xi(t=null){this.view&&null!==t&&(this.view.tags.Be.textContent=t)}Ge(){if(!this.view)throw Error("GroupView has not been rendered.");return this.view.tags.Ue}hs(){if(!this.view)return;const t=Array.from(this.view.tags.Ue.children).filter(t=>!t.classList.contains("hide"));this.view.view.classList.toggle("hide",0===t.length)}Zi(t){this.view&&(this.view.view.classList.toggle("collapsed",t),this.view.tags.Be.setAttribute("aria-expanded",t?"false":"true"))}}class L extends T{constructor(t){super(t),this.view=null,this.config=null,this.We=null,this.qe=!1,this.initialize()}initialize(){const t=this;this.config={isMultiple:!1,hasImage:!1,imagePosition:"right",imageWidth:"60px",imageHeight:"60px",imageBorderRadius:"4px",labelValign:"center",labelHalign:"left"},this.We=new Proxy(this.config,{set(i,s,e){if("string"!=typeof s)return!0;const h=s,n=i[h];return n!==e&&(i[h]=e,t.qe&&t.Je(h,e,n)),!0}}),this.init()}get isMultiple(){return this.config.isMultiple}set isMultiple(t){this.We.isMultiple=!!t}get hasImage(){return this.config.hasImage}set hasImage(t){this.We.hasImage=!!t}get Ke(){return this.We}set Ke(t){if(!t||!this.We||!this.config)return;const i={};void 0!==t.imageWidth&&t.imageWidth!==this.config.imageWidth&&(i.imageWidth=t.imageWidth),void 0!==t.imageHeight&&t.imageHeight!==this.config.imageHeight&&(i.imageHeight=t.imageHeight),void 0!==t.imageBorderRadius&&t.imageBorderRadius!==this.config.imageBorderRadius&&(i.imageBorderRadius=t.imageBorderRadius),void 0!==t.imagePosition&&t.imagePosition!==this.config.imagePosition&&(i.imagePosition=t.imagePosition),void 0!==t.labelValign&&t.labelValign!==this.config.labelValign&&(i.labelValign=t.labelValign),void 0!==t.labelHalign&&t.labelHalign!==this.config.labelHalign&&(i.labelHalign=t.labelHalign),Object.keys(i).length>0&&Object.assign(this.We,i)}mount(){const t=["selective-ui-option-view"],i=e.O(7),s="option_"+i;this.config.isMultiple&&t.push("multiple"),this.config.hasImage&&t.push("has-image","image-"+this.config.imagePosition);const h={bs:{tag:{node:"input",type:this.config.isMultiple?"checkbox":"radio",classList:"allow-choice",id:s}},...this.config.hasImage&&{Os:{tag:{node:"img",classList:"option-image",style:{width:this.config.imageWidth,height:this.config.imageHeight,borderRadius:this.config.imageBorderRadius}}}},Qe:{tag:{node:"label",htmlFor:s,classList:["align-vertical-"+this.config.labelValign,"align-horizontal-"+this.config.labelHalign]},$:{xs:{tag:{node:"div"}}}}};this.view=e.F({Ye:{tag:{node:"div",id:`seui-${i}-option`,classList:t,role:"option",ariaSelected:"false",tabIndex:"-1"},$:h}}),this.parent.appendChild(this.view.view),this.qe=!0,super.mount()}Je(t,i,s){const e=this.view;if(!e||!e.view)return;const h=e.view,n=e.tags?.bs,o=e.tags?.Qe;switch(t){case"isMultiple":{const t=!!i;h.classList.toggle("multiple",t),n&&n.type!==(t?"checkbox":"radio")&&(n.type=t?"checkbox":"radio");break}case"hasImage":{const t=!!i;if(h.classList.toggle("has-image",t),t)h.classList.add("image-"+this.config.imagePosition),this.Xe();else{h.className=h.className.replace(/image-(top|right|bottom|left)/g,"").trim();const t=e.tags?.Os;t?.remove(),e.tags.Os=null}break}case"imagePosition":this.config.hasImage&&(h.className=h.className.replace(/image-(top|right|bottom|left)/g,"").trim(),h.classList.add("image-"+i));break;case"imageWidth":case"imageHeight":case"imageBorderRadius":{const s=e.tags?.Os;s&&(s.style["imageWidth"===t?"width":"imageHeight"===t?"height":"borderRadius"]=i+"");break}case"labelValign":case"labelHalign":o&&(o.className=`align-vertical-${this.config.labelValign} align-horizontal-`+this.config.labelHalign)}}Xe(){const t=this.view;if(!t||!t.view)return;if(t.tags?.Os)return;const i=t.view,s=t.tags?.Qe,e=document.createElement("img");e.className="option-image",e.style.width=this.config.imageWidth,e.style.height=this.config.imageHeight,e.style.borderRadius=this.config.imageBorderRadius,s?.parentElement?i.insertBefore(e,s):i.appendChild(e),t.tags.Os=e}}class P extends H{constructor(t=[]){super(t),this.isMultiple=!1,this.Ze=[],this.th=-1,this.ih=null,this.groups=[],this.sh=[],this.eh()}init(){e.tt.on("sche_vis_"+this.ke,()=>{const t=this.sh.filter(t=>t.visible).length,i=this.sh.length;this.Ze.forEach(s=>{s({hh:t,nh:i,oi:t>0,isEmpty:0===i})}),e.tt.run("sche_vis_proxy_"+this.ke)},{et:10}),super.init(),this.mount()}eh(){this.sh=[],this.groups=[],this.items.forEach(t=>{t instanceof y?(this.groups.push(t),this.sh.push(...t.items)):t instanceof w&&this.sh.push(t)})}De(t,i){return i instanceof y?new C(t):new L(t)}Re(t,i,s){t.position=s,t instanceof y?this.oh(t,i,s):t instanceof w&&this.rh(t,i,s),t.Ht=!0}oh(t,i,s){super.Re(t,i,s),t.view=i;const e=i.view.tags.Be;e.textContent=t.label,t.Ht||(e.style.cursor="pointer",e.addEventListener("click",()=>{t.ss()}),t.ts((t,i,s)=>{i.items.forEach(t=>{const i=t.view?.fs?.();i&&(i.style.display=s?"none":"")}),this.ah(i,s)}));const h=i.Ge();t.items.forEach((t,i)=>{let s=t.view;t.Ht&&s||(s=new L(h)),this.rh(t,s,i),t.Ht=!0}),i.Zi(t.collapsed),i.hs()}rh(t,i,s){if(i.isMultiple=this.isMultiple,i.hasImage=t.hasImage,i.Ke={imageWidth:t.options.imageWidth,imageHeight:t.options.imageHeight,imageBorderRadius:t.options.imageBorderRadius,imagePosition:t.options.imagePosition,labelValign:t.options.labelValign,labelHalign:t.options.labelHalign},t.Ht||super.Re(t,i,s),t.view=i,t.hasImage){const s=i.view.tags.Os;s&&(s.src!==t.ps&&(s.src=t.ps),s.alt!==t.text&&(s.alt=t.text))}i.view.tags.xs.innerHTML=t.text,t.Ht||(i.view.tags.Ye.addEventListener("click",async i=>{i.stopPropagation(),i.preventDefault(),this.Rs||(this.isMultiple?(await this._s("select"),t.selected=!t.selected):!0!==t.selected&&(await this._s("select"),this.ih&&(this.ih.selected=!1),t.selected=!0))}),i.view.tags.Ye.title=t.textContent,i.view.tags.Ye.addEventListener("mouseenter",()=>{this.Rs||this.uh(this.sh.indexOf(t),!1)}),t.ws(()=>{this.Bs("selected")}),t.vs((i,s,e)=>{e&&(this.ih=t),this.Bs("selected_internal")}),t.ui((t,i)=>{i.group?.hs(),this.dh()})),t.selected&&(this.ih=t,t.gs=!0)}async _e(t){await this._s("items",t),this.items=t,this.eh(),await this.Bs("items",t),this.update()}async $s(t){await this._e(t)}ks(t){this.items=t,this.eh(),this.update()}destroy(){this.is(o.DESTROYED)||(e.tt.clear("sche_vis_"+this.ke),this.groups.forEach(t=>{t.destroy()}),this.Ze=[],this.th=-1,this.ih=null,this.groups=[],this.sh=[],super.destroy())}ph(){return this.sh.filter(t=>t.selected)}gh(){return this.sh.find(t=>t.selected)}si(t){this.isMultiple&&this.sh.forEach(i=>{i.selected=t})}ui(t){this.Ze.push(t)}dh(){e.tt.run("sche_vis_"+this.ke)}ri(){const t=this.sh.filter(t=>t.visible).length,i=this.sh.length;return{hh:t,nh:i,oi:t>0,isEmpty:0===i}}fh(){this.uh(0)}navigate(t,i=!0){const s=this.sh.filter(t=>t.visible);if(0===s.length)return;let e=s.findIndex(t=>t===this.sh[this.th]);-1===e&&(e=-1);let h=e+t;h>=s.length&&(h=0),h<0&&(h=s.length-1);const n=this.sh.indexOf(s[h]);this.uh(n,i)}mh(){if(this.th>-1&&this.sh[this.th]){const t=this.sh[this.th];if(t.visible){const i=t.view?.fs?.();i&&i.click()}}}uh(t,i=!0){let s=0;if("number"==typeof t)s=t;else if(t instanceof w){const i=this.sh.indexOf(t);s=i>-1?i:0}else s=0;this.th>-1&&this.sh[this.th]&&(this.sh[this.th].ys=!1);for(let t=s;t<this.sh.length;t++){const s=this.sh[t];if(s?.visible){if(s.ys=!0,this.th=t,i){const i=s.view?.fs?.();i?i.scrollIntoView({block:"center",behavior:"smooth"}):this.Dt?.bh?.(t,{scrollIntoView:!0})}return void this.yh(t,s.view?.fs?.()?.id)}}}yh(t,i){}ah(t,i){}}class I extends r{constructor(t=0){super(),this.wh=[],this.xh=0,this.initialize(t)}initialize(t){this.init(),this.reset(t)}reset(t){this.xh=t,this.wh=Array(t+1).fill(0)}add(t,i){for(let s=t;s<=this.xh;s+=s&-s)this.wh[s]+=i}Oh(t){let i=0;for(let s=t;s>0;s-=s&-s)i+=this.wh[s];return i}Mh(t,i){return i<t?0:this.Oh(i)-this.Oh(t-1)}Ah(t){this.reset(t.length),t.forEach((t,i)=>this.add(i+1,t))}Sh(t){let i=0,s=1;for(;s<<1<=this.xh;)s<<=1;let e=0;for(let h=s;0!==h;h>>=1){const s=i+h;s<=this.xh&&e+this.wh[s]<=t&&(i=s,e+=this.wh[s])}return i}}class E extends x{constructor(t=null){super(t),this.Hh={Zt:void 0,Ut:36,Gt:8,Wt:!0,Th:!0},this.Ch=[],this.Lh=new I(0),this.Ph=new Map,this.Ih=!1,this.start=0,this.end=-1,this.Eh=null,this.Fh=null,this.updating=!1,this.jh=!1,this.$h=0,this.Vh=!1,this.kh=!1,this.Rh=0,this.Dh=0,this.zh=0,this._h=0}configure(t){this.Hh={...this.Hh,...t}}Vs(t){if(this.ii&&this.dispose(),super.Vs(t),t.Dt=this,!this.Us)return;this.Us.replaceChildren();const i=e.j({Nh:{tag:{node:"div",classList:"selective-ui-virtual-pad-top"}},Bh:{tag:{node:"div",classList:"selective-ui-virtual-items"}},Uh:{tag:{node:"div",classList:"selective-ui-virtual-pad-bottom"}}},this.Us);if(this.Nh=i.Nh,this.Bh=i.Bh,this.Uh=i.Uh,this.Zt=this.Hh.Zt??this.Us.closest(".selective-ui-popup")??this.Us.parentElement,!this.Zt)throw Error("VirtualRecyclerView: scrollEl not found");this.Gh=this.Wh.bind(this),this.Zt.addEventListener("scroll",this.Gh,{passive:!0}),this.refresh(!1),this.qh(),t?.ui?.(()=>this.Jh())}suspend(){this.Vh=!0,this.Kh(),this.Zt&&this.Gh&&this.Zt.removeEventListener("scroll",this.Gh),this.Qh&&(this.Qh.disconnect(),this.kh=!0)}resume(){this.Vh=!1,this.Zt&&this.Gh&&this.Zt.addEventListener("scroll",this.Gh,{passive:!0}),this.kh&&(this.qh(),this.kh=!1),this.Yh()}refresh(t){if(!this.ii||!this.Us)return;t||this.Jh();const i=this.ii.ze();if(this.$h=i,0===i)return this.Xh(),void this.update();this.Ch.length=i,this.Ih||(this.Zh(),this.Ih=!0),this.tn(i),this.Yh(),this.update()}bh(t,i){this.sn(t,t),i?.scrollIntoView&&this.en(t)}en(t){if((this.ii?.ze?.()??0)<=0)return;const i=this.hn(t),s=this.nn()+i,e=Math.max(0,this.Zt.scrollHeight-this.Zt.clientHeight);this.Zt.scrollTop=Math.min(Math.max(0,s),e)}dispose(){this.Kh(),this.Zt&&this.Gh&&this.Zt.removeEventListener("scroll",this.Gh),this.Qh?.disconnect(),this.Ph.forEach(t=>t.remove()),this.Ph.clear()}destroy(){this.is(o.DESTROYED)||(this.Xh(),this.dispose(),this.Nh.remove(),this.Bh.remove(),this.Uh.remove(),this.Nh=null,this.Bh=null,this.Uh=null,super.destroy())}Jh(){if(!this.ii)return;const t=this.ii.ze();t<=0||(this.suspend(),this.Xh(),this.rn(),this.ln(t),this.tn(t),this.start=0,this.end=-1,this.resume())}Kh(){null!=this.Eh&&(cancelAnimationFrame(this.Eh),this.Eh=null),null!=this.Fh&&(cancelAnimationFrame(this.Fh),this.Fh=null)}Xh(){this.Ph.forEach(t=>t.remove()),this.Ph.clear(),this.Ch=[],this.Lh.reset(0),this.Nh.style.height="0px",this.Uh.style.height="0px",this.Ih=!1,this.zh=0,this._h=0}Zh(){this.an(0);const t=this.Ph.get(0);if(!t)return;const i=this.cn(t);if(isNaN(i)||(this.Hh.Ut=i),!this.Hh.Wt){t.remove(),this.Ph.delete(0);const i=this.ii.items[0];i&&(i.Ht=!1,i.view=null)}}un(t){const i=this.ii?.items?.[t];return i?.visible??!0}dn(t,i){for(let s=Math.max(0,t);s<i;s++)if(this.un(s))return s;return-1}ln(t){this.zh=0,this._h=0;for(let i=0;i<t;i++){if(!this.un(i))continue;const t=this.Ch[i];null!=t&&(this.zh+=t,this._h++)}}nn(){const t=this.Us.getBoundingClientRect(),i=this.Zt.getBoundingClientRect();return Math.max(0,t.top-i.top+this.Zt.scrollTop)}pn(){const t=performance.now();if(t-this.Rh<16)return this.Dh;const i=this.Zt.querySelector(".selective-ui-option-handle:not(.hide)");return this.Dh=i?.offsetHeight??0,this.Rh=t,this.Dh}Yh(){null!=this.Eh||this.Vh||(this.Eh=requestAnimationFrame(()=>{this.Eh=null,this.gn()}))}cn(t){const i=t.getBoundingClientRect(),s=getComputedStyle(t);return Math.max(1,i.height+(parseFloat(s.marginTop)||0)+(parseFloat(s.marginBottom)||0))}fn(){return this.Hh.Th&&this._h>0?Math.max(1,this.zh/this._h):this.Hh.Ut}tn(t){const i=this.fn(),s=Array.from({length:t},(t,s)=>this.un(s)?this.Ch[s]??i:0);this.Lh.Ah(s)}mn(t,i){if(!this.un(t))return!1;const s=this.fn(),e=this.Ch[t]??s;if(Math.abs(i-e)<=E.bn)return!1;const h=this.Ch[t];return null==h?(this.zh+=i,this._h++):this.zh+=i-h,this.Ch[t]=i,this.Lh.add(t+1,i-e),!0}yn(t,i){const s=this.Lh.Sh(Math.max(0,t)),e=Math.min(i-1,s),h=this.dn(e,i);return-1===h?Math.max(0,e):h}wn(t,i){i.setAttribute(E.vn,t+"");const s=this.Ph.get(t-1);if(s?.parentElement===this.Bh)return void s.after(i);const e=this.Ph.get(t+1);if(e?.parentElement===this.Bh)return void this.Bh.insertBefore(i,e);const h=Array.from(this.Bh.children);for(const s of h){const e=s.getAttribute(E.vn);if(e&&+e>t)return void this.Bh.insertBefore(i,s)}this.Bh.appendChild(i)}xn(t,i){if(i.parentElement!==this.Bh)return void this.wn(t,i);i.setAttribute(E.vn,t+"");const s=i.previousElementSibling,e=i.nextElementSibling;(s&&+s.getAttribute(E.vn)>t||e&&+e.getAttribute(E.vn)<t)&&(i.remove(),this.wn(t,i))}qh(){this.Qh||(this.Qh=new ResizeObserver(()=>{this.jh||this.Vh||!this.ii||null!=this.Fh||(this.Fh=requestAnimationFrame(()=>{this.Fh=null,this.On()}))}),this.Qh.observe(this.Bh))}On(){if(!this.ii)return;const t=this.ii.ze();if(t<=0)return;let i=!1;for(let t=this.start;t<=this.end;t++){if(!this.un(t))continue;const s=this.ii.items[t],e=s?.view?.fs?.();if(!e)continue;const h=this.cn(e);this.mn(t,h)&&(i=!0)}i&&(this.Hh.Th&&this.tn(t),this.Yh())}Wh(){this.Yh()}gn(){if(!this.updating&&!this.Vh){this.updating=!0;try{if(!this.ii)return;const t=this.ii.ze();if(t<=0)return;this.$h!==t&&(this.$h=t,this.Ch.length=t,this.tn(t));const i=this.nn(),s=Math.max(0,this.Zt.scrollTop-i),e=this.pn(),h=Math.max(0,this.Zt.clientHeight-e),n=this.yn(s,t),o=this.hn(n),r=i+o-this.Zt.scrollTop,l=this.yn(s,t);if(-1===l)return void this.Xh();const a=this.fn(),c=this.Hh.Gt*a;let u=this.dn(Math.min(t-1,this.Lh.Sh(Math.max(0,s-c))),t)??l,d=Math.min(t-1,this.Lh.Sh(s+h+c));if(u===this.start&&d===this.end)return;this.start=u,this.end=d,this.jh=!0;try{this.sn(this.start,this.end),this.Mn(this.start,this.end),this.Hh.Wt&&this.On();const i=this.hn(this.start),s=this.An(this.start,this.end),e=this.Sn(t),h=Math.max(0,e-i-s);this.Nh.style.height=i+"px",this.Uh.style.height=h+"px"}finally{this.jh=!1}const p=this.hn(n),g=this.nn()+p-r,f=Math.max(0,this.Zt.scrollHeight-this.Zt.clientHeight),m=Math.min(Math.max(0,g),f),b=Math.abs(p-o)>1,y=Math.abs(this.Zt.scrollTop-m);b&&y>.5&&y<100&&(this.Zt.scrollTop=m)}finally{this.updating=!1}}}sn(t,i){for(let s=t;s<=i;s++)this.an(s)}an(t){if(!this.un(t)){const i=this.Ph.get(t);return i?.parentElement===this.Bh&&i.remove(),void this.Ph.delete(t)}const i=this.ii.items[t];if(!i)return;const s=this.Ph.get(t);if(s)return void(i?.view?(this.xn(t,s),this.ii.Re(i,i.view,t)):(s.remove(),this.Ph.delete(t)));if(i.Ht)i.view&&this.ii.Re(i,i.view,t);else{const s=this.ii.De(this.Bh,i);i.view=s,this.ii.Re(i,s,t),i.Ht=!0}const e=i.view?.fs?.();e&&(this.xn(t,e),this.Ph.set(t,e))}Mn(t,i){this.Ph.forEach((s,e)=>{(e<t||e>i)&&(s.parentElement===this.Bh&&s.remove(),this.Ph.delete(e))})}rn(){this.Ph.forEach((t,i)=>{this.un(i)||(t.parentElement===this.Bh&&t.remove(),this.Ph.delete(i))})}hn(t){return this.Lh.Oh(t)}An(t,i){return this.Lh.Mh(t+1,i+1)}Sn(t){return this.Lh.Oh(t)}}E.bn=.5,E.vn="data-vindex";class F extends r{constructor(t=null,i=null){super(),this.container={},this.oldValue=null,this.node=null,this.options=null,this.Hn=null,this.isOpen=!1,this.Tn=!1,this.Cn=!1,this.fe=null,t&&i&&this.initialize(t,i)}get isDisabled(){return!!this.options?.disabled}set isDisabled(t){this.options&&this.node&&(this.options.disabled=t,this.node.classList.toggle("disabled",t),this.node.setAttribute("aria-disabled",t+""),this.container.tags?.Ai?.setAttribute("aria-disabled",t+""))}get Ln(){return!!this.options?.readonly}set Ln(t){this.options&&this.node&&(this.options.readonly=t,this.node.classList.toggle("readonly",t))}get isVisible(){return!!this.options?.visible}set isVisible(t){this.options&&this.node&&(this.options.visible=t,this.node.classList.toggle("invisible",!t))}initialize(t,i){const s=e._(t);this.options=s.options,this.fe=i,this.init(t)}init(i){if(this.state!==o.NEW)return;if(!i||!this.options)return;const s=this.options,h=new l(s),n=new a,r=new f(s),effector=t(),c=new v(s),u=new O(s),d=new M(i,c,this),p=new A(i),m=new S(i);h.node&&(h.node.id=(s.Pn??"")+"");const b=e.j({In:{tag:{node:"div",classList:"selective-ui-MAIN"},$:{Ai:{tag:{node:"div",classList:"selective-ui-view",tabIndex:0,onkeydown:t=>{"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.En()?.open())}},$:{Fn:{tag:h.node},jn:{tag:n.node},Ri:{tag:r.node}}}}}},null);this.container=b,this.node=b.view,b.$n=d,b.placeholder=h,b.Vn=n,b.kn=r,b.effector=effector,b.targetElement=i,b.Rn=u,b.Dn=p,b.zn=m,c.Cs(P),c.Ps(s.virtualScroll?E:x),c.js(e.Y(i)),c.onUpdated=()=>{b.re?.li?.()},this.Hn=c,b.re=new g(i,s,c),b.re.mi(effector),b.re.Si(d,s),b.re.fi("selected",()=>{this.En()?.change(null,!0)}),b.re.fi("selected_internal",()=>{this.En()?.change(null,!1)}),b.re.pi("select",()=>{this.oldValue=this.En()?.value??""}),u.Ys(b.tags.Ai),u.Zs(c),this._n(i,b,s,d,r),this.Nn(p,m,i,c),this.isDisabled=e.k(s.disabled),this.Ln=e.k(s.readonly),super.init()}mount(){if(this.state!==o.INITIALIZED)return;if(!this.node||!this.container.targetElement)return;const t=this.container.targetElement,i=this.container;t.parentNode?.insertBefore(this.node,t),this.node.insertBefore(t,i.tags.Ai),i.tags.Ai.addEventListener("mousedown",t=>{t.stopPropagation(),t.preventDefault()}),n.ct(t,i.tags.Ai),t.classList.add("init"),this.En()?.change(null,!1),super.mount()}update(){this.state===o.MOUNTED&&(this.container.re?.li?.(),super.update())}_n(t,i,s,h,n){const o=i.re.Ft;let r=null;const l=(t,n)=>{n||""!==t?(""!==t&&(this.Cn=!0),h.search(t).then(t=>{clearTimeout(r),e.tt.clear("sche_vis_proxy_"+o.ke),e.tt.on("sche_vis_proxy_"+o.ke,()=>{i.re?.li?.(),t?.Se&&(r=setTimeout(()=>{o.fh(),i.re?.li?.()},s.animationtime??0))},{et:10})}).catch(t=>{console.error("Search error:",t)})):h.clear()};let a=null;n.ji=(t,e)=>{h.Ae(t)&&(a&&clearTimeout(a),h.ue()?(i.re?.hi?.(),a=setTimeout(()=>{l(t,e)},s.delaysearchtime??0)):a=setTimeout(()=>{l(t,e)},10))},h.setPopup(i.re),n.$i=t=>{o.navigate(t)},n.Vi=()=>{o.mh()},n.ki=()=>{this.En()?.close(),i.tags.Ai.focus()},o.yh=(t,i)=>{i&&n.zi(i)},o.ah=()=>{i.re?.li?.()},s.ajax&&h.ve(s.ajax)}Nn(t,i,s,h){t.connect(),t.It=t=>{h.update(e.Y(t)),this.En()?.refreshMask()},i.connect(),i.It=t=>{e.k(t.disabled)!==this.isDisabled&&(this.isDisabled=e.k(t.disabled)),e.k(t.readonly)!==this.Ln&&(this.Ln=e.k(t.readonly)),e.k(t.visible)!==this.isVisible&&(this.isVisible=e.k(t.visible??"1"))}}Bn(){const t=this.container??{},{Dn:i,zn:s}=t;i?.disconnect&&i.disconnect(),s?.disconnect&&s.disconnect()}destroy(){if(this.is(o.DESTROYED))return;this.Bn();const t=this.container;t.$n.destroy(),t.Vn.destroy(),t.re.destroy(),t.Rn.destroy(),t.placeholder.destroy(),t.kn.destroy(),this.node?.remove(),this.container={},this.node=null,this.options=null,this.Hn=null,this.fe=null,this.oldValue=null,this.isOpen=!1,this.Tn=!1,this.Cn=!1,super.destroy()}En(){const t=this.container,i=this,s=()=>this.fe.find(t.targetElement),n=e._(t.targetElement);if(!n)return null;const r=n.options,l={get targetElement(){return t.targetElement},get placeholder(){return t.placeholder.get()},set placeholder(i){t.placeholder?.set(i),t.kn?.Di(i)},get oldValue(){return i.oldValue},set value(t){this.setValue(null,t,!0)},get value(){const t=this.valueArray,i=t.length;return i>1?t:0===i?"":t[0]},get valueArray(){const t=[];return i.Un().forEach(i=>{i.selected&&t.push(i.value)}),t},get valueString(){return this.valueArray.join(r.customDelimiter)},get valueOptions(){const t=[];return i.Un(!0).forEach(i=>{t.push(i)}),t},get mask(){const t=[];return i.Un(!0).forEach(i=>{t.push(i.text)}),t},get valueText(){const t=[];i.Un(!0).forEach(i=>{t.push(i.text)});const s=t.length;return s>1?t:0===s?"":t[0]},get isOpen(){return i.isOpen},getParent:()=>t.view.parentElement,valueDataset(t,s=null,e=!1){var h=[];if(i.Un(!0).forEach(t=>{h.push(s?t.dataset[s]:t.dataset)}),!e){if(0==h.length)return"";if(1==h.length)return h[0]}return h},selectAll(t,e=!0){if(!(r.multiple&&r.maxSelected>0&&i.Un().length>r.maxSelected)&&!this.disabled&&!this.readonly&&r.multiple){if(e){if(h.ot([s()],...r.on.beforeChange).isCancel)return;i.oldValue=this.value}i.Un().forEach(t=>{t.gs=!0}),this.change(!1,e)}},deSelectAll(t,e=!0){if(!this.disabled&&!this.readonly&&r.multiple){if(e){if(h.ot([s()],...r.on.beforeChange).isCancel)return;i.oldValue=this.value}i.Un().forEach(t=>{t.gs=!1}),this.change(!1,e)}},setValue(e=null,n,o=!0,l=!1){if(Array.isArray(n)||(n=[n]),0===(n=n.filter(t=>""!==t&&null!=t)).length)return i.Un().forEach(t=>t.gs=!1),void this.change(!1,o);if(r.multiple&&r.maxSelected>0&&n.length>r.maxSelected)console.warn(`Cannot select more than ${r.maxSelected} items`);else if(l||!this.disabled&&!this.readonly){if(t.$n?.ue?.()){const{we:s}=t.$n.be(n);if(s.length>0)return void(async()=>{r.loadingfield&&t.re?.hi?.();try{t.$n.xe();const e=await t.$n.de(s);e.Pi&&e.items.length>0?(e.items.forEach(t=>{s.includes(t.value)&&(t.selected=!0)}),t.$n.Te?.(e.items,!0,!0),setTimeout(()=>{i.Un().forEach(t=>{t.gs=n.some(i=>i==t.value)}),this.change(!1,!1)},100)):s.length>0&&console.warn(`Could not load ${s.length} values:`,s)}catch(t){console.error("Error loading missing values:",t)}finally{r.loadingfield&&t.re?.ai?.()}})()}if(o){if(h.ot([s()],...r.on.beforeChange).isCancel)return;i.oldValue=this.value}i.Un().forEach(t=>{t.gs=n.some(i=>i==t.value)}),!r.multiple&&n.length>0&&(t.targetElement.value=n[0]),this.change(!1,o)}},open(){if(i.isOpen)return;const e=i.fe?.find?.();if(e&&!e.isEmpty&&e.close().isCancel)return;if(this.disabled)return;if(h.ot([s()],...r.on.beforeShow).isCancel)return;i.isOpen=!0,t.Vn.bt(!0);const n=t.re.Ft,o=n.gh();o?n.uh(o,!1):n.fh(),i.Tn&&!i.Cn||!r?.ajax?t.re.open(null,!0):(t.$n.xe(),t.re.hi(),i.Tn=!0,i.Cn=!1,setTimeout(()=>{t.re&&t.$n&&t.$n.search("").then(()=>t.re?.li?.()).catch(t=>console.error("Initial ajax load error:",t))},r.animationtime),t.re.open(null,!1)),t.kn.show();const l=t.tags.Ai;l.setAttribute("aria-expanded","true"),l.setAttribute("aria-controls",r.Qt),l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-labelledby",r.Pn),r.multiple&&l.setAttribute("aria-multiselectable","true"),h.ot([s()],...r.on.show)},close(){i.isOpen&&(h.ot([s()],...r.on.beforeClose).isCancel||(i.isOpen=!1,t.Vn.bt(!1),t.re.close(()=>{t.kn.clear(!1)}),t.kn.hide(),t.tags.Ai.setAttribute("aria-expanded","false"),h.ot([s()],...r.on.close)))},toggle(){i.isOpen?this.close():this.open()},change(e=null,n=!0){if(n){if(r.multiple&&r.maxSelected>0&&this.valueArray.length>r.maxSelected&&this.setValue(null,this.oldValue,!1,!0),this.disabled||this.readonly)return void this.setValue(null,this.oldValue,!1,!0);if(h.ot([s(),this.value],...r.on.beforeChange).isCancel)return void this.setValue(null,this.oldValue,!1)}this.refreshMask(),t.Rn.te(this.valueOptions),n&&(t.targetElement&&h.rt(t.targetElement,"change"),h.ot([s(),this.value],...r.on.change),i.options?.autoclose&&this.close()),i.is(o.MOUNTED)&&i.update()},refreshMask(){let s=r.placeholder;!r.multiple&&i.Un().length>0&&(s=this.mask[0]),s??(s=r.placeholder),t.placeholder.set(s,!1),t.kn.Di(s)},on(t,i,s){r.on[i]||(r.on[i]=[]),r.on[i].push(s)},ajax(i,s){t.$n.ve(s)},loadAjax:()=>new Promise((e,h)=>{t.re.hi(),t.$n.xe(),i.Tn=!0,i.Cn=!1,t.re&&t.$n?t.$n.search("").then(()=>{t.re?.li?.(),e(s())}).catch(t=>{console.error("Initial ajax load error:",t),h(t)}):e(s())})};return this.Gn(l,"disabled","isDisabled"),this.Gn(l,"readonly","isReadOnly"),this.Gn(l,"visible","isVisible"),l}Gn(t,i,s){const e=this;Object.defineProperty(t,i,{get:()=>e[s],set(t){e[s]=!!t,e.container?.targetElement?.dataset&&(e.container.targetElement.dataset[i]=!!t+"")},enumerable:!0,configurable:!0})}Un(t=null){if(!this.Hn)return[];const{Ds:i}=this.Hn.ti(),s=[];for(const t of i)t instanceof w?s.push(t):t instanceof y&&Array.isArray(t.items)&&t.items.length&&s.push(...t.items);return"boolean"==typeof t?s.filter(i=>i.selected===t):s}}class j{constructor(){this.isActive=!1,this.Fe=null,this.actions=[]}Wn(t){this.actions.push(t)}qn(){this.actions=[]}connect(t){if(this.isActive)return;this.isActive=!0;const i=t.toUpperCase(),s=t.toLowerCase();this.Fe=new MutationObserver(t=>{for(const e of t)e.addedNodes.forEach(t=>{if(1!==t.nodeType)return;const e=t;e.tagName===i&&this.Jn(e),e.querySelectorAll(s).forEach(t=>this.Jn(t))})}),this.Fe.observe(document.body,{childList:!0,subtree:!0})}disconnect(){this.isActive&&(this.isActive=!1,this.Fe?.disconnect(),this.Fe=null)}Jn(t){this.actions.forEach(i=>i(t))}}const $=new class extends r{constructor(){super(),this.Kn=new Map,this.init()}init(){this.is(o.NEW)&&(this.Kn=new Map,super.init())}bind(t,i){this.is(o.NEW)&&this.init();const s=e.R(e.W(),i);s.on=s.on??{},s.on.load=s.on.load??[],this.Kn.set(t,s);const n=e.O();e.tt.on(n,()=>{h.ot([this.find(t)],...s.on.load),e.tt.clear(n),s.on.load=[]});const r=e.M(t);let l=!1;r.forEach(t=>{(async()=>{"SELECT"===t.tagName&&(e.B(t),this.Qn(t,s)&&(l=!0,e.tt.run(n)))})()}),e.t().includes(t)||e.t().push(t),this.is(o.INITIALIZED)&&l&&this.mount(),this.is(o.MOUNTED)&&this.update()}mount(){this.state===o.INITIALIZED&&super.mount()}update(){this.state===o.MOUNTED&&super.update()}find(t="*"){const i={isEmpty:!0};if("*"===t&&""===(t=e.t().join(", ")))return i;const s=e.M(t);if(0===s.length)return i;const h=e._(s[0]);if(!h||!h.action)return i;const n={};for(const t in h.action)n[t]=this.Yn(t,h.action);const o={isEmpty:!1};for(const t in n){const i=n[t];switch(i.type){case"get-set":this.Xn(o,i.name,s);break;case"func":this.Zn(o,i.name,s)}}return o}i(){this.io||(this.io=new j,this.io.Wn(t=>{this.Kn.forEach((i,s)=>{try{t.matches(s)&&(this.Qn(t,i),this.is(o.MOUNTED)&&this.update())}catch(t){console.warn("Invalid selector: "+s,t)}})})),this.io.connect("select")}destroy(t=null){null===t?this.so():"string"==typeof t?this.eo(t):t instanceof HTMLSelectElement&&this.ho(t),null!==t&&this.is(o.MOUNTED)&&this.update()}so(){this.state!==o.DESTROYED&&(e.t().forEach(t=>this.eo(t)),this.Kn.clear(),e.t().length=0,this.io?.disconnect(),super.destroy())}eo(t){e.M(t).forEach(t=>{"SELECT"===t.tagName&&this.ho(t)}),this.Kn.delete(t);const i=e.t(),s=i.indexOf(t);s>-1&&i.splice(s,1)}ho(t){const i=e._(t);if(!i)return;const s=i.self;e.G(t,i);const h=!!this.io;h&&this.io?.disconnect();try{i.self?.Bn?.()}catch(t){}const n=i.container?.element??t.parentElement;t.style.display="",t.style.visibility="",t.disabled=!1,delete t.dataset.no,n&&n.parentNode?n.parentNode.replaceChild(t,n):t.appendChild(t),e.D(t),h&&this.Kn.size>0&&this.io?.connect("select"),s?.destroy?.()}rebind(t,i){this.eo(t),this.bind(t,i),this.is(o.MOUNTED)&&this.update()}Qn(t,i){if(e._(t)||e.U(t))return!1;const s=e.O(8),h=e.V(t,i);h.oo=s,h.Qt=`seui-${s}-optionlist`,h.Pn=`seui-${s}-placeholder`;const n={options:h};e.N(t,n);const o=new F(t,this);return o.on("onMount",()=>{o.container.view&&o.container.view.addEventListener("mouseup",()=>{n.action?.toggle?.()})}),o.mount(),n.container=o.container,n.action=o.En(),n.self=o,!0}Yn(t,i){const s=Object.getOwnPropertyDescriptor(i,t);let e="variable";return s?.get||s?.set&&"function"!=typeof i[t]?e="get-set":"function"==typeof i[t]&&(e="func"),{type:e,name:t}}Xn(t,i,s){Object.defineProperty(t,i,{get(){const t=e._(s[0]);return t.action?.[i]},set(t){s.forEach(s=>{const h=e._(s);h?.action&&(h.action[i]=t)})},enumerable:!0,configurable:!0})}Zn(t,i,s){t[i]=(...n)=>{let o=null;for(let t=0;t<s.length;t++){const r=e._(s[t]);if(!r?.action)continue;const l=h.nt();if(o??(o=r.action[i](l.ht,...n)),!l.token.isContinue)break}return o??t}}},version="1.2.4",V="SelectiveUI";let k=!1;"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i());export{bind,destroy,effector,find,V as name,rebind,version};
1
+ /*! Selective UI v1.2.6 | MIT License */
2
+ function t(t){return new f(t??null)}function bind(t,s={}){j.bind(t,s)}function find(t){return j.find(t)}function destroy(t=null){j.destroy(t)}function rebind(t,s={}){j.rebind(t,s)}function effector(s){return t(s)}function registerPlugin(t){j.registerPlugin(t)}function unregisterPlugin(t){j.unregisterPlugin(t)}function init(){$||($=!0,document.addEventListener("mousedown",()=>{const t=i.t();if(t.length>0){const s=j.find(t.join(", "));s.isEmpty||s.close()}}),j.i())}class s{constructor(){this.h={accessoryVisible:!0,virtualScroll:!0,accessoryStyle:"top",multiple:!1,minWidth:"50px",width:"0px",offsetWidth:null,minHeight:"30px",height:"30px",panelHeight:"220px",panelMinHeight:"100px",disabled:!1,readonly:!1,selectall:!0,keepSelected:!0,placeholder:"Select value",altMask:"",autoclose:!1,autoscroll:!0,autofocus:!0,searchable:!0,loadingfield:!0,visible:!0,skipError:!1,customDelimiter:",",textLoading:"Processing...",textNoData:"No data available",textNotFound:"Not found",textSelectAll:"Select all",textDeselectAll:"Deselect all",textAccessoryDeselect:"Deselect: ",animationtime:200,delaysearchtime:200,allowHtml:!1,maxSelected:0,labelHalign:"left",labelValign:"center",imageMode:!1,imageWidth:"60px",imageHeight:"60px",imageBorderRadius:"4px",imagePosition:"right",ajax:null,on:{load:[],beforeShow:[],show:[],beforeChange:[],change:[],beforeClose:[],close:[]}},this.o=new Map,this.l=new Map,this.u=[]}}class i{static get p(){return this.m||(this.m=new s),this.m}static v(t){if(null===t||"object"!=typeof t)return t;const s=Array.isArray(t)?[]:{};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=this.v(t[i]));return s}static M(t=6){let s="";for(let i=0;i<t;i++)s+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return s}static O(t){if(!t)return[];if("string"==typeof t){const s=document.querySelectorAll(t);return Array.from(s)}return t instanceof HTMLElement?[t]:t instanceof NodeList||Array.isArray(t)?Array.from(t):[]}static A(t={}){return this.H(document.createElement(t.node??"div"),t,!0)}static H(t=document.documentElement,s=null,i=!1){const e={...s??{}},h=i?t:t.cloneNode(!0),n=e.classList;return"string"==typeof n?h.classList.add(n):Array.isArray(n)&&h.classList.add(...n),delete e.classList,["style","dataset"].forEach(t=>{const s=e[t];s&&"object"==typeof s&&Object.assign(h[t],s),delete e[t]}),e.role&&(h.setAttribute("role",e.role+""),delete e.role),e.ariaLive&&(h.setAttribute("aria-live",e.ariaLive+""),delete e.ariaLive),e.S&&(h.setAttribute("aria-labelledby",e.S+""),delete e.S),e.T&&(h.setAttribute("aria-controls",e.T+""),delete e.T),e.C&&(h.setAttribute("aria-haspopup",e.C+""),delete e.C),e.P&&(h.setAttribute("aria-multiselectable",e.P+""),delete e.P),e.L&&(h.setAttribute("aria-autocomplete",e.L+""),delete e.L),e.event&&"object"==typeof e.event&&(Object.entries(e.event).forEach(([t,s])=>{h.addEventListener(t,s)}),delete e.event),Object.entries(e).forEach(([t,s])=>{null===s?h.removeAttribute(t):h[t]=s}),h}static I(t,s=null,i=!1,e=!1,h={}){let n=null;for(const o in t){const r=t[o],l=r?.tag?.tagName?r.tag:this.A(r.tag);h[o]=l,r?.F&&this.I(r.F,l,!1,!1,h),s?i?s.prepend(l):s.append(l):e||n||(n=l)}return e||(h.id=this.M(7),s||(h={tags:h,view:n})),h}static j(t,s){const i=this.v(s);for(const s in i){const e=t[s];e?i[s]="boolean"==typeof i[s]?this.V(e):e:void 0!==t?.dataset?.[s]&&(i[s]="boolean"==typeof i[s]?this.V(t.dataset[s]):t.dataset[s])}return i}static $(...t){if(0===t.length)return{};if(1===t.length)return this.v(t[0]);const s=this.v(t[0]);for(let i=1;i<t.length;i++){const e=t[i];for(const t in e)if("on"===t){const i=e[t];for(const e in i)s[t][e].push(i[e])}else s[t]=e[t]}return s}static V(t){if("boolean"==typeof t)return t;if("string"!=typeof t)return!!t;switch(t.trim().toLowerCase()){case"true":case"1":case"yes":case"on":return!0;default:return!1}}static k(t){return this.p.o.delete(t)}static R(t){return this.p.o.get(t)}static D(t,s){this.p.o.set(t,s)}static _(t){return this.p.l.delete(t)}static B(t){return this.p.l.get(t)}static N(t,s){this.p.l.set(t,s)}static U(){return this.p.h}static t(){return this.p.u}static G(t){if(null==t)return"";let s=(t+"").replace(/<`/g,"<").replace(/`>/g,">").replace(/\<\`/g,"<").replace(/\`\>/g,">").trim();const i=globalThis?.document;if(!i||"function"!=typeof i.createElement)return s=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<iframe\b[^>]*>[\s\S]*?<\/iframe>/gi,"").replace(/<(object|embed|link)\b[^>]*>[\s\S]*?<\/\1>/gi,""),s=s.replace(/\son[a-z]+\s*=\s*(['"]).*?\1/gi,""),s=s.replace(/\s([a-z-:]+)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi,""),s;const e=i.createElement("div");return e.innerHTML=s,e.querySelectorAll("script, style, iframe, object, embed, link").forEach(t=>t.remove()),e.querySelectorAll("*").forEach(t=>{for(const s in t.attributes){const i=t.attributes[s],e=i.name??"",h=i.value??"";if(/^on/i.test(e))return void t.removeAttribute(e);/^(href|src|xlink:href)$/i.test(e)&&/^javascript:/i.test(h)&&t.removeAttribute(e)}}),(e.innerHTML??"").trim()}static W(t){const s=document.createElement("DIV");s.innerHTML=t;const i=s.textContent??s.innerText??"";return s.remove(),i.trim()}static q(t){return null==t?"":(t+"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/đ/g,"d").replace(/Đ/g,"d")}static K(t){const s=[];return Array.from(t.children).forEach(t=>{if("OPTGROUP"===t.tagName){const i=t;s.push(i),Array.from(i.children).forEach(t=>{t.__parentGroup=i,s.push(t)})}else"OPTION"===t.tagName&&s.push(t)}),s}static Y(){const t=navigator.userAgent;return/iP(hone|ad|od)/.test(t)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1}static J(t){const s=(t+"").trim();if(s.endsWith("px"))return s;if(s.endsWith("vh"))return window.innerHeight*parseFloat(s)/100+"px";if(s.endsWith("vw"))return window.innerWidth*parseFloat(s)/100+"px";const i=parseFloat(getComputedStyle(document.documentElement).fontSize);if(s.endsWith("rem"))return i*parseFloat(s)+"px";const e=this.A({node:"div",style:{height:s,opacity:"0"}});document.body.appendChild(e);const h=e.offsetHeight+"px";return e.remove(),h}}i.m=null,i.X=new class{constructor(){this.Z=new Map,this.tt=new Map}on(t,s,i={}){const e=i.st??50,h=i.once??!1;this.Z.has(t)||this.Z.set(t,[]),this.Z.get(t).push({it:s,timeout:e,once:h})}off(t){const s=this.tt.get(t);if(s){for(const t of s.values())clearTimeout(t);s.clear(),this.tt.delete(t)}this.Z.delete(t)}run(t,...s){const i=this.Z.get(t);if(!i||0===i.length)return Promise.resolve();this.tt.has(t)||this.tt.set(t,new Map);const e=this.tt.get(t),h=[];for(let t=0;t<i.length;t++){const n=i[t];if(!n)continue;const o=e.get(t);o&&clearTimeout(o);const r=new Promise(h=>{const o=setTimeout(async()=>{try{const t=n.it(s.length>0?s:null);t instanceof Promise&&await t}catch{}finally{if(n.once){i[t]=void 0;const s=e.get(t);s&&clearTimeout(s),e.delete(t)}h()}},n.timeout);e.set(t,o)});h.push(r)}return Promise.all(h).then(()=>{})}clear(t){if(void 0===t)for(const t of Array.from(this.Z.keys()))this.off(t);else this.off(t)}};class e{static et(){const t={isContinue:!0,isCancel:!1};return{token:{get isContinue(){return t.isContinue},get isCancel(){return t.isCancel}},it:{stopPropagation(){t.isContinue=!1},cancel(){t.isCancel=!0,t.isContinue=!1}}}}static ht(t,...s){const{token:i,it:e}=this.et();for(let h=0;h<s.length;h++){const n=s[h];if("function"==typeof n&&(t&&Array.isArray(t)?n(e,...t):n(e),i.isCancel||!i.isContinue))break}return i}static nt(t,s,i={bubbles:!0,cancelable:!0}){const e=new Event(s,i);return t.dispatchEvent(e),e}static ot(t,...s){if(Array.isArray(t))for(const i of t)"function"==typeof i&&i(...s)}}class h{static rt(t,s){const e=i.R(t);if(!e?.options)return;const h=e.options,n=h.minWidth,o=h.minHeight,r=Number.parseInt(h.width,10),l=Number.parseInt(h.height,10);let a=t.offsetWidth+"px",u=t.offsetHeight+"px";const c=getComputedStyle(t);"0px"===a&&"auto"!==c.width&&(a=c.width),"0px"===u&&"auto"!==c.height&&(u=c.height),r>0&&(a=h.width),l>0&&(u=h.height),Object.assign(s.style,{width:a,height:u,minWidth:n,minHeight:o})}}var n;(t=>{t.NEW="new",t.INITIALIZED="initialized",t.MOUNTED="mounted",t.UPDATED="updated",t.DESTROYED="destroyed"})(n||(n={}));class o{constructor(){this.state=n.NEW,this.lt=new Map,this.lt.set("onInit",new Set),this.lt.set("onMount",new Set),this.lt.set("onUpdate",new Set),this.lt.set("onDestroy",new Set)}on(t,s){return this.lt.get(t).add(s),this}off(t,s){return this.lt.get(t).delete(s),this}emit(t,s){const i={state:this.state,ut:s};for(const s of this.lt.get(t))try{s(i)}catch(s){this.ct(s,t)}}ct(t,s){console.error(`[Lifecycle:${s}]`,t)}init(){if(this.state!==n.NEW)return;const t=this.state;this.state=n.INITIALIZED,this.emit("onInit",t)}mount(){if(this.state!==n.INITIALIZED)return;const t=this.state;this.state=n.MOUNTED,this.emit("onMount",t)}update(){if(this.state!==n.MOUNTED&&this.state!==n.UPDATED)return;const t=this.state;this.state=n.UPDATED,this.emit("onUpdate",t)}destroy(){if(this.state===n.DESTROYED)return;const t=this.state;this.state=n.DESTROYED,this.emit("onDestroy",t),this.dt()}getState(){return this.state}is(t){return this.state===t}dt(){for(const t of this.lt.values())t.clear()}}class r extends o{constructor(t){super(),this.node=null,this.options=null,t&&this.initialize(t)}initialize(t){this.node=i.A({node:"div",classList:"seui-placeholder",innerHTML:t.placeholder}),this.options=t,this.init()}get(){return this.options?.placeholder??""}set(t,s=!0){if(!this.node||!this.options)return;s&&(this.options.placeholder=t);const e=i.G(t);this.node.innerHTML=this.options.allowHtml?e:i.W(e)}destroy(){this.is(n.DESTROYED)||(this.node?.remove(),this.node=null,this.options=null,super.destroy())}}class l extends o{constructor(){super(),this.init()}init(){this.node=i.A({node:"div",classList:"seui-directive",role:"button",ariaLabel:"Toggle dropdown"}),super.init(),this.mount()}gt(t){this.node.classList.toggle("drop-down",!!t)}destroy(){this.is(n.DESTROYED)||(this.node.remove(),this.node=null,super.destroy())}}class a extends o{constructor(t=null){super(),this.ft=null,this.node=null,this.options=null,this.bt=[],this.yt=[],t&&this.initialize(t)}initialize(t){this.ft=i.I({wt:{tag:{node:"div",classList:["seui-option-handle","hide"]},F:{vt:{tag:{node:"a",classList:"seui-option-handle-item",textContent:t.textSelectAll,onclick:()=>{e.ot(this.bt)}}},xt:{tag:{node:"a",classList:"seui-option-handle-item",textContent:t.textDeselectAll,onclick:()=>{e.ot(this.yt)}}}}}}),this.node=this.ft.view,this.options=t,this.init()}available(){return!!this.options&&i.V(this.options.multiple)&&i.V(this.options.selectall)}update(){this.node&&(this.available()?this.show():this.hide()),super.update()}show(){this.node&&this.node.classList.remove("hide")}hide(){this.node&&this.node.classList.add("hide")}Mt(t=null){"function"==typeof t&&this.bt.push(t)}Ot(t=null){"function"==typeof t&&this.yt.push(t)}destroy(){this.is(n.DESTROYED)||(this.node.remove(),this.options=null,this.bt=null,this.yt=null,this.node=null,super.destroy())}}class u extends o{constructor(t=null){super(),this.node=null,this.options=null,t&&this.initialize(t)}initialize(t){this.options=t,this.node=i.A({node:"div",classList:["seui-empty-state","hide"],role:"status",ariaLive:"polite"}),this.init()}show(t="nodata"){this.node&&this.options&&(this.node.textContent="notfound"===t?this.options.textNotFound:this.options.textNoData,this.node.classList.remove("hide"))}hide(){this.node&&this.node.classList.add("hide")}get isVisible(){return!!this.node&&!this.node.classList.contains("hide")}destroy(){this.is(n.DESTROYED)||(this.options=null,this.node?.remove(),this.node=null,super.destroy())}}class c extends o{constructor(t=null){super(),this.node=null,this.options=null,t&&this.initialize(t)}initialize(t){this.options=t,this.node=i.A({node:"div",classList:["seui-loading-state","hide"],textContent:t.textLoading,role:"status",ariaLive:"polite"}),this.init()}show(t){this.node&&this.options&&(this.node.textContent=this.options.textLoading,this.node.classList.toggle("small",!!t),this.node.classList.remove("hide"))}hide(){this.node&&this.node.classList.add("hide")}get isVisible(){return!!this.node&&!this.node.classList.contains("hide")}destroy(){this.is(n.DESTROYED)||(this.options=null,this.node?.remove(),this.node=null,super.destroy())}}class d{constructor(){this.At=!1,this.element=null,this.Ht=null,this.St=null,this.At=!0,this.Tt=this.Ct.bind(this)}Pt(t){}Ct(){const t=this.element;if(!t||"function"!=typeof t.getBoundingClientRect)return void this.Pt({width:0,height:0,top:0,left:0,padding:{top:0,right:0,bottom:0,left:0},border:{top:0,right:0,bottom:0,left:0},margin:{top:0,right:0,bottom:0,left:0}});const s=t.getBoundingClientRect(),i="undefined"!=typeof window&&"function"==typeof window.getComputedStyle?window.getComputedStyle(t):null;this.Pt({width:s?.width??0,height:s?.height??0,top:s?.top??0,left:s?.left??0,padding:{top:parseFloat(i?.paddingTop??"0"),right:parseFloat(i?.paddingRight??"0"),bottom:parseFloat(i?.paddingBottom??"0"),left:parseFloat(i?.paddingLeft??"0")},border:{top:parseFloat(i?.borderTopWidth??"0"),right:parseFloat(i?.borderRightWidth??"0"),bottom:parseFloat(i?.borderBottomWidth??"0"),left:parseFloat(i?.borderLeftWidth??"0")},margin:{top:parseFloat(i?.marginTop??"0"),right:parseFloat(i?.marginRight??"0"),bottom:parseFloat(i?.marginBottom??"0"),left:parseFloat(i?.marginLeft??"0")}})}nt(){this.Ct()}connect(t){if(!(t instanceof HTMLElement))throw Error("Invalid element");this.element=t,this.Ht=new ResizeObserver(this.Tt),this.Ht.observe(t),this.St=new MutationObserver(this.Tt),this.St.observe(t,{attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("scroll",this.Tt,!0),window.addEventListener("resize",this.Tt),window.visualViewport&&(window.visualViewport.addEventListener("resize",this.Tt),window.visualViewport.addEventListener("scroll",this.Tt))}disconnect(){this.Ht?.disconnect(),this.St?.disconnect(),this.Pt=()=>{},window.removeEventListener("scroll",this.Tt,!0),window.removeEventListener("resize",this.Tt),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.Tt),window.visualViewport.removeEventListener("scroll",this.Tt)),this.Ht=null,this.St=null,this.element=null}}class p extends o{constructor(t=null,s=null,i=null){super(),this.options=null,this.Lt=!1,this.It=null,this.node=null,this.Ft=null,this.Et=null,this.parent=null,this.jt=null,this.Vt=null,this.$t=null,this.kt=null,this.Rt=null,this.Dt=null,this.zt=null,this._t={Bt:36,Nt:8,Ut:!0},this.Gt=i,t&&s&&this.initialize(t,s)}initialize(t,s){if(!this.Gt)throw Error("Popup requires a ModelManager instance.");this.jt=new a(s),this.Vt=new u(s),this.$t=new c(s);const e=i.I({Wt:{tag:{node:"div",classList:"seui-popup",style:{maxHeight:s.panelHeight}},F:{wt:{tag:this.jt.node},qt:{tag:{id:s.Kt,node:"div",classList:"seui-options-container",role:"listbox"}},Qt:{tag:this.$t.node},Yt:{tag:this.Vt.node}}}},null);this.node=e.view,this.Rt=e.tags.qt,this.parent=i.R(t),this.options=s,this.init(),this.Gt.load(this.Rt,{isMultiple:s.multiple},s.virtualScroll?{Jt:this.node,Bt:this._t.Bt,Nt:this._t.Nt,Ut:this._t.Ut}:{});const h=this.Gt.Xt();this.It=h.Zt,this.kt=h.kt,this.jt.Mt(()=>{h.Zt.ts(!0)}),this.jt.Ot(()=>{h.Zt.ts(!1)}),this.ss(),this.mount()}async es(){this.options&&this.$t&&this.jt&&this.It&&this.Gt&&(this.zt&&clearTimeout(this.zt),this.Gt.hs(!0),!1!==i.V(this.options.loadingfield)&&(this.Vt.hide(),this.$t.show(this.It.rs().ns),this.ls()))}async us(){this.options&&this.$t&&this.It&&this.Gt&&(this.zt&&clearTimeout(this.zt),this.zt=setTimeout(()=>{this.Gt?.hs(!1),this.$t?.hide();const t=this.It?.rs();this.cs(t??void 0),this.ls()},this.options.animationtime))}ss(){this.It&&(this.It.ds(t=>{this.cs(t)}),this.It.ps("items",()=>{const t=this.It.rs();this.cs(t),this.ls()}))}cs(t){if(!(this.It&&this.Vt&&this.jt&&this.Rt))return;const s=t??this.It.rs();s.isEmpty?(this.Vt.show("nodata"),this.Rt.classList.add("hide"),this.jt.hide()):s.ns?(this.Vt.hide(),this.Rt.classList.remove("hide"),this.jt.update()):(this.Vt.show("notfound"),this.Rt.classList.add("hide"),this.jt.hide())}gs(t,s){this.It?.fs(t,s)}bs(t,s){this.It?.ps(t,s)}ys(t){this.Ft=t}open(t=null,s){if(!(this.node&&this.options&&this.jt&&this.parent&&this.Ft))return;this.Lt||(document.body.appendChild(this.node),this.Lt=!0,this.Et=new d,this.Ft.ws(this.node),this.node.addEventListener("mousedown",t=>{t.stopPropagation(),t.preventDefault()})),this.jt.update(),s&&this.cs();const i=this.vs(),{position:e,top:h,maxHeight:n,xs:o}=this.Ms(i);this.Ft.expand({duration:this.options.animationtime,display:"flex",width:i.width,left:i.left,top:h,maxHeight:n,xs:o,position:e,Os:()=>{if(!this.Et||!this.parent)return;this.Et.Pt=()=>{const t=this.vs();this.As(t)},this.Et.connect(this.parent.container.tags.Hs),t?.();const s=this.kt;s?.resume?.()}})}close(t=null){if(!(this.Lt&&this.options&&this.Et&&this.Ft))return;const s=this.kt;s?.suspend?.(),this.Et.disconnect(),this.Ft.collapse({duration:this.options.animationtime,Os:t??void 0})}ls(){this.Lt&&this.Et?.nt()}Ss(t,s){this.node&&(this.Dt=async()=>{const s=t.Ts();if(!s.Cs)return;const i=this.node;if(i.scrollHeight-i.scrollTop-i.clientHeight<100&&!s.Ps&&s.hasMore){const s=await t.Ls();!s.Is&&s.message&&console.log("Load more:",s.message)}},this.node.addEventListener("scroll",this.Dt))}destroy(){if(!this.is(n.DESTROYED)){if(clearTimeout(this.zt),this.zt=null,this.node&&this.Dt&&(this.node.removeEventListener("scroll",this.Dt),this.Dt=null),this.Vt.destroy(),this.$t.destroy(),this.jt.destroy(),this.Et?.disconnect?.(),this.Ft?.ws?.(null),this.Gt?.hs?.(!1),this.kt?.clear?.(),this.node?.remove?.(),this.node)try{const t=i.H(this.node);this.node.replaceWith(t),t.remove()}catch(t){this.node.remove()}this.node=null,this.Rt=null,this.Gt=null,this.jt=null,this.Vt=null,this.$t=null,this.parent=null,this.options=null,this.Lt=!1,this.Ft=null,this.Et=null,this.kt=null,this.It=null,super.destroy()}}vs(){const t=this.parent.container.tags.Hs,s=t.getBoundingClientRect(),i=window.getComputedStyle(t);return{width:s.width,height:s.height,top:s.top,left:s.left,padding:{top:parseFloat(i.paddingTop),right:parseFloat(i.paddingRight),bottom:parseFloat(i.paddingBottom),left:parseFloat(i.paddingLeft)},border:{top:parseFloat(i.borderTopWidth),right:parseFloat(i.borderRightWidth),bottom:parseFloat(i.borderBottomWidth),left:parseFloat(i.borderLeftWidth)}}}Ms(t){const s=window.visualViewport,e=i.Y(),h=s?.height??window.innerHeight,n=this.Ft.Fs("flex").scrollHeight,o=parseFloat(this.options?.panelHeight??"220")||220,r=parseFloat(this.options?.panelMinHeight??"100")||100,l=h-(t.top+t.height)-3,a=t.top-3;let u="bottom",c=o,d=Math.min(n,c);const p=l-15;(d>=r?p>=r:p>=d)?(u="bottom",c=Math.min(l-15,o)):a>=Math.max(d,r)?(u="top",c=Math.min(a-15,o)):l>=a?(u="bottom",c=Math.max(l-15,r)):(u="top",c=Math.max(a-15,r)),d=Math.min(n,c);const g=s&&e?s.offsetTop:0;return{position:u,top:"bottom"===u?t.top+t.height+3+g:t.top-d-3+g,maxHeight:c,xs:d,Es:n}}As(t){if(!this.options||!this.Ft)return;const{position:s,top:i,maxHeight:e,xs:h}=this.Ms(t);this.Ft.resize({duration:this.options.animationtime,width:t.width,left:t.left,top:i,maxHeight:e,xs:h,position:s,animate:!0})}}class g extends o{constructor(t=null){super(),this.ft=null,this.node=null,this.js=null,this.Vs=null,this.options=null,this.$s=null,this.ks=null,this.Rs=null,this.options=t,t&&this.initialize(t)}initialize(t){this.ft=i.I({Ds:{tag:{node:"div",classList:["seui-searchbox","hide"]},F:{js:{tag:{id:i.M(),node:"input",type:"search",classList:["seui-searchbox-input"],placeholder:t.placeholder,role:"searchbox",T:t.Kt,L:"list"}}}}}),this.node=this.ft.view,this.js=this.ft.tags.js;let s=!1;const e=this.ft.tags.js;e.addEventListener("mousedown",t=>{t.stopPropagation()}),e.addEventListener("mouseup",t=>{t.stopPropagation()}),e.addEventListener("keydown",t=>{s=!1,"ArrowDown"===t.key||"Tab"===t.key?(t.preventDefault(),t.stopPropagation(),s=!0,this.$s?.(1)):"ArrowUp"===t.key?(t.preventDefault(),t.stopPropagation(),s=!0,this.$s?.(-1)):"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),s=!0,this.ks?.()):"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),s=!0,this.Rs?.()),t.stopPropagation()}),e.addEventListener("input",()=>{s||this.Vs?.(e.value,!0)}),this.init()}show(){this.node&&this.js&&this.options&&(this.node.classList.remove("hide"),this.js.readOnly=!this.options.searchable,this.options.searchable&&requestAnimationFrame(()=>{this.js?.focus()}))}hide(){this.node&&this.node.classList.add("hide")}clear(t=!0){this.ft&&(this.ft.tags.js.value="",this.Vs?.("",t))}zs(t){this.js&&(this.js.placeholder=i.W(t))}_s(t){this.js&&this.js.setAttribute("aria-activedescendant",t)}destroy(){this.is(n.DESTROYED)||(this.node?.remove(),this.ft=null,this.node=null,this.js=null,this.Vs=null,this.options=null,this.$s=null,this.ks=null,this.Rs=null,super.destroy())}}class f{constructor(t=null){this.Bs=null,this.Ns=null,this.Us=!1,t&&this.ws(t)}ws(t){if("string"==typeof t){const s=document.querySelector(t);return void(s instanceof HTMLElement&&(this.element=s))}this.element=t}cancel(){return this.Bs&&(clearTimeout(this.Bs),this.Bs=null),this.Ns&&(clearTimeout(this.Ns),this.Ns=null),this.Us=!1,this}Fs(t="flex"){if(!this.element)return{width:0,height:0,scrollHeight:0};const s={display:this.element.style.display,visibility:this.element.style.visibility,position:this.element.style.position,height:this.element.style.height,width:this.element.style.width};Object.assign(this.element.style,{display:t,visibility:"hidden",position:"fixed",height:"fit-content",width:"fit-content"});const i=window.getComputedStyle(this.element),e=parseFloat(i.borderTopWidth),h=parseFloat(i.borderBottomWidth),n=this.element.scrollHeight+e+h,o=this.element.getBoundingClientRect(),r={width:o.width,height:o.height+e+h,scrollHeight:n};return Object.assign(this.element.style,s),r}expand(t){if(!this.element)return this;this.cancel(),this.Us=!0;const{duration:s=200,display:i="flex",width:e,left:h,top:n,maxHeight:o,xs:r,position:l="bottom",Os:a}=t;return Object.assign(this.element.style,{display:i,width:e+"px",left:h+"px",top:("bottom"===l?n:n+r)+"px",maxHeight:o+"px",height:"0px",opacity:"0",overflow:"hidden",transition:"none"}),this.element.classList.toggle("position-top","top"===l),this.element.classList.toggle("position-bottom","bottom"===l),requestAnimationFrame(()=>{Object.assign(this.element.style,{transition:`top ${s}ms, height ${s}ms, opacity ${s}ms`,top:n+"px",height:r+"px",opacity:"1",overflow:r>=o?"auto":"hidden"}),this.Bs=setTimeout(()=>{this.element.style.transition="none",this.Us=!1,a?.()},s)}),this}collapse(t){if(!this.element)return this;this.cancel(),this.Us=!0;const{duration:s=200,Os:i}=t,e=this.element.offsetHeight,h=this.element.offsetTop,n=this.element.classList.contains("position-top")?"top":"bottom",o=this.element.scrollHeight-this.element.offsetHeight>0,r="top"===n?h+e:h;return requestAnimationFrame(()=>{Object.assign(this.element.style,{transition:`height ${s}ms, top ${s}ms, opacity ${s}ms`,height:"0px",top:r+"px",opacity:"0",overflow:o?"auto":"hidden"}),this.Bs=setTimeout(()=>{Object.assign(this.element.style,{display:"none",transition:"none"}),this.Us=!1,i?.()},s)}),this}showSwipeWidth(t){if(!this.element)return this;this.cancel(),this.Us=!0;const{duration:s=200,display:i="block",Os:e}=t;Object.assign(this.element.style,{transition:"none",display:i,width:"fit-content"});const h=this.Fs(i).width;return Object.assign(this.element.style,{width:"0px"}),requestAnimationFrame(()=>{Object.assign(this.element.style,{transition:`width ${s}ms`,width:h+"px",overflow:"hidden"})}),this.Bs=setTimeout(()=>{Object.assign(this.element.style,{width:"",overflow:"",transition:""}),this.Us=!1,e?.()},s),this}hideSwipeWidth(t){if(!this.element)return this;this.cancel(),this.Us=!0;const{duration:s=200,Os:i}=t,e=this.Fs().width;return Object.assign(this.element.style,{transition:"none",width:e+"px"}),requestAnimationFrame(()=>{Object.assign(this.element.style,{transition:`width ${s}ms`,width:"0px",overflow:"hidden"})}),this.Bs=setTimeout(()=>{Object.assign(this.element.style,{width:"",overflow:"",transition:"",display:""}),this.Us=!1,i?.()},s),this}resize(t){if(!this.element)return this;this.cancel();const{duration:s=200,width:i,left:e,top:h,maxHeight:n,xs:o,position:r="bottom",animate:l=!0,Os:a}=t,u=(this.element.classList.contains("position-top")?"top":"bottom")!==r,c=this.element.scrollHeight>n;return this.element.classList.toggle("position-top","top"===r),this.element.classList.toggle("position-bottom","bottom"===r),u&&(this.element.style.transition=`top ${s}ms ease-out, height ${s}ms ease-out, max-height ${s}ms ease-out;`),requestAnimationFrame(()=>{const t={width:i+"px",left:e+"px",top:h+"px",maxHeight:n+"px",height:o+"px",overflowY:c?"auto":"hidden"},r=Math.abs(this.element.offsetHeight-o);l&&(u||r>5)?t.transition=`height ${s}ms, top ${s}ms`:this.Ns=setTimeout(()=>{this.element?.style&&(this.element.style.transition=null)},s),Object.assign(this.element.style,t),l&&(u||r>1)?this.Ns=setTimeout(()=>{this.element.style.transition=null,u&&delete this.element.style.transition,a?.()},s):(u&&delete this.element.style.transition,a?.())}),this}get Gs(){return this.Us}}class m extends o{get value(){return this.targetElement?.getAttribute("value")??null}constructor(t,s=null,i=null){super(),this.targetElement=null,this.view=null,this.position=-1,this.At=!1,this.Ws=!1,this.options=t,this.targetElement=s,this.view=i,this.init()}qs(t){this.targetElement=t,this.update()}destroy(){this.is(n.DESTROYED)||(this.targetElement=null,this.view?.destroy(),this.view=null,this.Ws=!0,super.destroy())}}class b extends m{constructor(t,s){super(t,s??null,null),this.label="",this.items=[],this.collapsed=!1,this.Ks=[],this.label=this.targetElement.label}init(){this.collapsed=i.V(this.targetElement.dataset?.collapsed),super.init(),this.mount()}get value(){return this.items.map(t=>t.value)}get Qs(){return this.items.filter(t=>t.selected)}get Ys(){return this.items.filter(t=>t.visible)}get Js(){return this.Ys.length>0}qs(t){this.label=t.label,this.view?.Xs(this.label),this.update()}update(){this.view&&(this.view.Xs(this.label),this.view.Zs(this.collapsed)),super.update()}destroy(){this.is(n.DESTROYED)||(this.items.forEach(t=>{t.destroy()}),this.items=[],super.destroy())}ti(t){this.Ks.push(t)}si(){this.collapsed=!this.collapsed,this.view?.Zs(this.collapsed),e.ht([this,this.collapsed],...this.Ks)}ii(t){this.items.push(t),t.group=this}removeItem(t){const s=this.items.indexOf(t);s>-1&&(this.items.splice(s,1),t.group=null)}ei(){this.view?.ei()}}class y extends m{constructor(t,s=null,i=null){super(t,s,i),this.hi=[],this.ni=[],this.oi=[],this.ri=!0,this.li=!1,this.group=null}init(){this.ai=i.q(this.textContent.toLowerCase()),super.init(),this.mount()}get ui(){return this.dataset?.imgsrc||this.dataset?.image||""}get hasImage(){return!!this.ui}get value(){return this.targetElement?.value??""}get selected(){return!!this.targetElement?.selected}set selected(t){this.ci=t,e.ht([this,t],...this.hi)}get visible(){return this.ri}set visible(t){if(this.ri===t)return;this.ri=t;const s=this.view?.di?.();s&&s.classList.toggle("hide",!t),e.ht([this,t],...this.oi)}get ci(){return this.selected}set ci(t){const s=this.view?.view?.tags?.pi,i=this.view?.di?.();s&&(s.checked=t),i&&this.targetElement&&(i.classList.toggle("checked",!!t),i.setAttribute("aria-selected",t?"true":"false"),this.targetElement.toggleAttribute("selected",!!t)),this.targetElement&&(this.targetElement.selected=t),e.ht([this,t],...this.ni)}get text(){const t=i.G(this.dataset?.mask??this.targetElement?.text??"");return this.options.allowHtml?t:i.W(t)}get textContent(){return this.options.allowHtml?i.W(this.text).trim():this.text.trim()}get dataset(){return this.targetElement?.dataset??{}}get gi(){return this.li}set gi(t){const s=!!t,i=this.view?.di?.();this.li!==s&&(this.li=s),i&&i.classList.toggle("highlight",s)}fi(t){this.hi.push(t)}mi(t){this.ni.push(t)}ds(t){this.oi.push(t)}update(){if(this.ai=i.q(this.textContent.toLowerCase()),!this.view)return void super.update();const t=this.view.view.tags.bi;t&&(this.options.allowHtml?t.innerHTML=this.text:t.textContent=this.textContent);const s=this.view.view.tags.yi;s&&this.hasImage&&(s.src!=this.ui&&(s.src=this.ui),s.alt!=this.text&&(s.alt=this.text)),this.targetElement&&(this.ci=this.targetElement.selected),super.update()}destroy(){this.is(n.DESTROYED)||(this.hi=[],this.ni=[],this.oi=[],this.group=null,this.ai=null,super.destroy())}}class w extends o{constructor(t){super(),this.wi=[],this.xi=null,this.Mi=null,this.options=null,this.Oi=0,this.options=t,this.init()}Ai(t){this.Hi=t}Si(t){this.Ti=t}Ci(t){this.is(n.INITIALIZED)&&this.mount(),this.wi=[];let s=null;return t.forEach(t=>{if("OPTGROUP"===t.tagName)s=new b(this.options,t),this.wi.push(s);else if("OPTION"===t.tagName){const i=new y(this.options,t),e=t.__parentGroup;e&&s&&e===s.targetElement?(s.ii(i),i.group=s):(this.wi.push(i),s=null)}}),this.wi}async replace(t){this.Ci(t),this.xi&&await this.xi.Pi(this.wi),this.refresh(!1)}notify(){this.xi&&this.refresh(!1)}load(t,s={},i={}){this.xi=new this.Hi(this.wi),Object.assign(this.xi,s),this.Mi=new this.Ti(t),Object.assign(this.Mi,i),this.Mi.Li(this.xi)}Ii(t){const s=this.wi,i=[],e=new Map,h=new Map;s.forEach(t=>{t instanceof b?e.set(t.label,t):t instanceof y&&h.set(`${t.value}::${t.textContent}`,t)});let n=null,o=0;t.forEach(t=>{if("OPTGROUP"===t.tagName){const s=t,h=e.get(s.label);h?(h.label!==s.label&&h.qs(s),h.position=o,h.items=[],n=h,i.push(h),e.delete(s.label)):(n=new b(this.options,s),n.position=o,i.push(n)),o++}else if("OPTION"===t.tagName){const s=t,e=`${s.value}::${s.text}`,r=h.get(e);if(r)r.qs(s),r.position=o,s.__parentGroup&&n?(n.ii(r),r.group=n):(r.group=null,i.push(r)),h.delete(e);else{const t=new y(this.options,s);t.position=o,s.__parentGroup&&n?(n.ii(t),t.group=n):i.push(t)}o++}});let r=!0;0==this.Oi&&(r=!1),this.Oi=o,e.forEach(t=>{r=!1,t.destroy()}),h.forEach(t=>{r=!1,t.destroy()}),this.wi=i,this.xi&&this.xi.Fi(this.wi),this.refresh(r)}hs(t){this.xi&&(this.xi.Ei=t)}refresh(t){this.Mi&&(this.Mi.refresh(t),this.update())}destroy(){this.is(n.DESTROYED)||(this.xi.destroy(),this.Mi.destroy(),this.wi=[],this.Hi=null,this.xi=null,this.Ti=null,this.Mi=null,this.options=null,this.Oi=0,super.destroy())}Xt(){return{ji:this.wi,Zt:this.xi,kt:this.Mi}}Vi(t){return this.xi?.$i(t)}ki(t){return this.xi?.Ri(t)}}class v extends o{constructor(t=null){super(),this.Di=null,this.Zt=null,this.Di=t,this.init()}Li(t){this.Zt=t,t.fs("items",()=>{this.clear()}),t.ps("items",()=>{this.zi()}),t.mount(),this.mount(),this.zi()}clear(){this.Di&&this.Di.replaceChildren()}zi(){this.Zt&&this.Di&&(this.Zt._i(this.Di),this.update())}refresh(t){this.zi()}destroy(){this.is(n.DESTROYED)||(this.Di=null,this.Zt=null,super.destroy())}}class x extends o{constructor(t=null){super(),this.ft=null,this.node=null,this.options=null,this.Bi=null,this.Ni=null,this.Gt=null,this.Ui=[],t&&this.initialize(t)}initialize(t){this.options=t,this.init()}init(){this.state===n.NEW&&(this.ft=i.I({Gi:{tag:{node:"div",classList:["seui-accessorybox","hide"],onmouseup:t=>{t.stopPropagation()}}}}),this.node=this.ft.view,super.init())}Wi(t){this.Bi=t,this.Ni=t.parentElement,this.qi(),this.mount()}mount(){this.is(n.INITIALIZED)&&super.mount()}qi(){this.Ni&&this.node&&this.Bi&&this.options&&this.Ni.insertBefore(this.node,"top"===this.options.accessoryStyle?this.Bi:this.Bi.nextSibling)}Ki(t){this.Gt=t}Qi(t){this.node&&this.options&&(this.node.replaceChildren(),t.length>0&&this.options.multiple?t.forEach(t=>{i.I({Yi:{tag:{node:"div",classList:["accessory-item"]},F:{Ji:{tag:{node:"span",classList:["accessory-item-button"],role:"button",ariaLabel:`${this.options.textAccessoryDeselect}${t.textContent}`,title:`${this.options.textAccessoryDeselect}${t.textContent}`,onclick:async s=>{s.preventDefault(),await(this.Gt?.Vi?.("select")),t.selected=!1}}},Xi:{tag:{node:"span",classList:["accessory-item-content"],innerHTML:t.text}}}}},this.node)}):t=[],this.Ui=t,this.Zi(),this.update(),e.nt(window,"resize"))}update(){this.state===n.MOUNTED&&super.update()}Zi(){this.options?.accessoryVisible&&this.Ui.length>0&&this.options.multiple?this.show():this.hide()}show(){this.node?.classList.remove("hide")}hide(){this.node?.classList.add("hide")}destroy(){this.state!==n.DESTROYED&&(this.node?.remove(),this.ft=null,this.node=null,this.options=null,this.Bi=null,this.Ni=null,this.Gt=null,this.Ui=[],super.destroy())}}class M extends o{constructor(t,s,i){super(),this.te=null,this.se=null,this.ie=null,this.ee=null,this.he={currentPage:0,totalPages:1,hasMore:!1,Ps:!1,ne:"",Cs:!1},this.initialize(t,s,i)}initialize(t,s,i){this.select=t,this.Gt=s,this.ee=i,this.init()}oe(){return!!this.te}async re(t){if(!this.te)return{Is:!1,items:[],message:"Ajax not configured"};const s=Array.isArray(t)?t:[t];if(0===s.length)return{Is:!0,items:[]};try{const t=this.te;let i,e;if(i="function"==typeof t.le?t.le(s):{values:s.join(","),ae:"1",..."function"==typeof t.data?t.data.bind(this.ee.ue.find(this.ee.container.targetElement))("",0):t.data??{}},"POST"===(t.method??"GET")){const s=new URLSearchParams;Object.keys(i).forEach(t=>s.append(t,i[t]+"")),e=await fetch(t.url,{method:"POST",body:s,headers:{"Content-Type":"application/x-www-form-urlencoded"}})}else{const s=""+new URLSearchParams(i);e=await fetch(`${t.url}?${s}`)}if(!e.ok)throw Error("HTTP error! status: "+e.status);const h=await e.json(),n=this.ce(h);return this.update(),{Is:!0,items:n.items}}catch(t){return console.error("Load by values error:",t),{Is:!1,message:t?.message,items:[]}}}de(t){const s=Array.from(this.select.options).map(t=>t.value);return{pe:t.filter(t=>s.includes(t)),ge:t.filter(t=>!s.includes(t))}}fe(t){this.te=t}setPopup(t){this.ie=t}Ts(){return{...this.he}}me(){this.he={currentPage:0,totalPages:1,hasMore:!1,Ps:!1,ne:"",Cs:this.he.Cs}}clear(){this.he.ne="";const{ji:t}=this.Gt.Xt(),s=[];for(const i of t)i instanceof y?s.push(i):i instanceof b&&Array.isArray(i.items)&&s.push(...i.items);s.forEach(t=>{t.visible=!0})}async search(t,s=!1){return this.te?this.be(t,s):this.ye(t)}async Ls(){return this.te?this.he.Ps?{Is:!1,message:"Already loading"}:this.he.Cs?this.he.hasMore?(this.he.currentPage++,this.be(this.he.ne,!0)):{Is:!1,message:"No more data"}:{Is:!1,message:"Pagination not enabled"}:{Is:!1,message:"Ajax not enabled"}}async ye(t){this.we(t)&&(this.he.ne=t);const s=((t??"")+"").toLowerCase(),e=i.q(s),{ji:h}=this.Gt.Xt(),n=[];for(const t of h)t instanceof y?n.push(t):t instanceof b&&Array.isArray(t.items)&&n.push(...t.items);let o=!1;return n.forEach(t=>{const i=""===s||t.ai.includes(e);t.visible=i,i&&(o=!0)}),this.update(),{Is:!0,ve:o,isEmpty:0===n.length}}we(t){return t!==this.he.ne}async be(t,s=!1){const i=this.te;this.we(t)&&(this.me(),this.he.ne=t,s=!1),this.he.Ps=!0,this.ie?.es(),this.se?.abort(),this.se=new AbortController;const e=this.he.currentPage,h=Array.from(this.select.selectedOptions).map(t=>t.value).join(",");let n;"function"==typeof i.data?(n=i.data.bind(this.ee.ue.find(this.ee.container.targetElement))(t,e),n&&void 0===n.selectedValue&&(n.selectedValue=h)):n={search:t,page:e,selectedValue:h,...i.data??{}};try{let t;if("POST"===(i.method??"GET")){const s=new URLSearchParams;Object.keys(n).forEach(t=>s.append(t,n[t]+"")),t=await fetch(i.url,{method:"POST",body:s,headers:{"Content-Type":"application/x-www-form-urlencoded"},signal:this.se.signal})}else{const s=""+new URLSearchParams(n);t=await fetch(`${i.url}?${s}`,{signal:this.se.signal})}const e=await t.json(),h=this.ce(e);return h.xe?(this.he.Cs=!0,this.he.currentPage=h.page,this.he.totalPages=h.totalPages,this.he.hasMore=h.hasMore):this.he.Cs=!1,this.Me(h.items,!!i.keepSelected,s),this.he.Ps=!1,this.ie?.us(),this.update(),{Is:!0,ve:h.items.length>0,isEmpty:0===h.items.length,xe:h.xe,hasMore:h.hasMore,currentPage:h.page,totalPages:h.totalPages}}catch(t){return this.he.Ps=!1,this.ie?.us(),"AbortError"===t?.name?{Is:!1,message:"Request aborted"}:(console.error("Ajax search error:",t),{Is:!1,message:t?.message})}}ce(t){let s=[],i=!1,e=0,h=1,n=!1;return t.object&&Array.isArray(t.object)?(s=t.object,void 0!==t.page&&(i=!0,e=parseInt(t.page??0,10),h=parseInt(t.totalPages??t.total_page??1,10),n=e<h-1)):t.data&&Array.isArray(t.data)?(s=t.data,void 0!==t.page&&(i=!0,e=parseInt(t.page??0,10),h=parseInt(t.totalPages??t.total_page??1,10),n=t.hasMore??e<h-1)):Array.isArray(t)?s=t:t.items&&Array.isArray(t.items)&&(s=t.items,t.pagination&&(i=!0,e=parseInt(t.pagination.page??0,10),h=parseInt(t.pagination.totalPages??t.pagination.total_page??1,10),n=t.pagination.hasMore??e<h-1)),{items:s.map(t=>{if(t instanceof HTMLOptionElement||t instanceof HTMLOptGroupElement)return t;if("optgroup"===t.type||t.Oe||t.group||t.label)return{type:"optgroup",label:t.label??t.name??t.title??"",data:t.data??{},options:(t.options??t.items??[]).map(t=>({value:t.value??t.id??t.key??"",text:t.text??t.label??t.name??t.title??"",selected:t.selected??!1,data:t.data??(t.imgsrc?{imgsrc:t.imgsrc}:{})}))};const s=t.data??{};return t?.imgsrc&&(s.imgsrc=t.imgsrc),{type:"option",value:t.value??t.id??t.key??"",text:t.text??t.label??t.name??t.title??"",selected:t.selected??!1,data:s}}),xe:i,page:e,totalPages:h,hasMore:n}}Me(t,s,i=!1){const e=this.select;let h=[];s&&(h=Array.from(e.selectedOptions).map(t=>t.value)),i||(e.innerHTML=""),t.forEach(t=>{if("option"!==t.type&&t.type||""!==t.value||""!==t.text)if(t instanceof HTMLOptionElement||t instanceof HTMLOptGroupElement)e.appendChild(t);else if("optgroup"===t.type){const i=document.createElement("optgroup");i.label=t.label,t.data&&Object.keys(t.data).forEach(s=>{i.dataset[s]=t.data[s]+""}),Array.isArray(t.options)&&t.options.forEach(t=>{const e=document.createElement("option");e.value=t.value,e.text=t.text,t.data&&Object.keys(t.data).forEach(s=>{e.dataset[s]=t.data[s]+""}),(t.selected||s&&h.includes(e.value))&&(e.selected=!0),i.appendChild(e)}),e.appendChild(i)}else{const i=document.createElement("option");i.value=t.value,i.text=t.text,t.data&&Object.keys(t.data).forEach(s=>{i.dataset[s]=t.data[s]+""}),(t.selected||s&&h.includes(i.value))&&(i.selected=!0),e.appendChild(i)}})}destroy(){this.is(n.DESTROYED)||(this.select=null,this.Gt=null,this.te=null,this.se=null,this.ie=null,this.ee=null,super.destroy())}}class O{constructor(t){this.Ae=null,this.He=50,this.select=t,this.Se=new MutationObserver(()=>{clearTimeout(this.Ae),this.Ae=setTimeout(()=>{this.Te()},this.He)})}Te(){this.Pt(this.select)}connect(){this.Se.observe(this.select,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["selected","value","disabled"]})}Pt(t){}disconnect(){this.Ae&&clearTimeout(this.Ae),this.Ae=null,this.Se.disconnect()}}class A{constructor(t){this.Ae=null,this.element=t,this.Se=new MutationObserver(t=>{let s=!1;for(const i of t)if("attributes"===i.type&&i.attributeName?.startsWith("data-")){s=!0;break}s&&(this.Ae&&clearTimeout(this.Ae),this.Ae=setTimeout(()=>{this.Pt({...this.element.dataset})},50))}),t.addEventListener("dataset:changed",()=>{this.Pt({...this.element.dataset})})}connect(){this.Se.observe(this.element,{attributes:!0,attributeOldValue:!0})}Pt(t){}disconnect(){this.Ae&&clearTimeout(this.Ae),this.Ae=null,this.Se.disconnect()}}class H extends o{constructor(t=[]){super(),this.items=[],this.Ce=i.M(12),this.Ei=!1,this.items=t,this.init()}Pe(t,s,i){const e=s;t.At?e?.update?.():e?.mount?.()}fs(t,s){i.X.on(`${t}ing_${this.Ce}`,s,{st:0})}ps(t,s){i.X.on(`${t}_${this.Ce}`,s,{st:0})}Ri(t,...s){return i.X.run(`${t}_${this.Ce}`,...s)}$i(t,...s){return i.X.run(`${t}ing_${this.Ce}`,...s)}Le(t,s){return null}Ie(){return this.items.length}async Fe(t){await this.$i("items",t),this.items=t,await this.Ri("items",t),this.update()}async Pi(t){await this.Fe(t)}_i(t){for(let s=0;s<this.Ie();s++){const i=this.items[s];let e=i.view;i.At||(e=this.Le(t,i),i.view=e),this.Pe(i,e,s),i.At=!0}}Fi(t){}destroy(){this.is(n.DESTROYED)||(this.kt=null,this.items.forEach(t=>{t?.destroy?.()}),this.items=[])}}class S extends o{constructor(t){super(),this.parent=null,this.view=null,this.parent=t,this.init()}di(){if(!this.view?.view)throw Error("View is not mounted. Did you forget to set this.view?");return this.view.view}destroy(){this.is(n.DESTROYED)||(this.di()?.remove?.(),this.parent=null,this.view=null,super.destroy())}}class T extends S{constructor(){super(...arguments),this.view=null}mount(){const t=i.M(7);this.view=i.I({Ee:{tag:{node:"div",classList:["seui-group"],role:"group",S:`seui-${t}-header`,id:`seui-${t}-group`},F:{je:{tag:{node:"div",classList:["seui-group-header"],role:"presentation",id:`seui-${t}-header`}},Ve:{tag:{node:"div",classList:["seui-group-items"],role:"group"}}}}}),this.parent.appendChild(this.view.view),super.mount()}update(){this.Xs(),super.update()}Xs(t=null){this.view&&null!==t&&(this.view.tags.je.textContent=t)}$e(){if(!this.view)throw Error("GroupView has not been rendered.");return this.view.tags.Ve}ei(){if(!this.view)return;const t=Array.from(this.view.tags.Ve.children).filter(t=>!t.classList.contains("hide"));this.view.view.classList.toggle("hide",0===t.length)}Zs(t){this.view&&(this.view.view.classList.toggle("collapsed",t),this.view.tags.je.setAttribute("aria-expanded",t?"false":"true"))}}class C extends S{constructor(t){super(t),this.view=null,this.config=null,this.ke=null,this.Re=!1,this.initialize()}initialize(){const t=this;this.config={isMultiple:!1,hasImage:!1,imagePosition:"right",imageWidth:"60px",imageHeight:"60px",imageBorderRadius:"4px",labelValign:"center",labelHalign:"left"},this.ke=new Proxy(this.config,{set(s,i,e){if("string"!=typeof i)return!0;const h=i,n=s[h];return n!==e&&(s[h]=e,t.Re&&t.De(h,e,n)),!0}}),this.init()}get isMultiple(){return this.config.isMultiple}set isMultiple(t){this.ke.isMultiple=!!t}get hasImage(){return this.config.hasImage}set hasImage(t){this.ke.hasImage=!!t}get ze(){return this.ke}set ze(t){if(!t||!this.ke||!this.config)return;const s={};void 0!==t.imageWidth&&t.imageWidth!==this.config.imageWidth&&(s.imageWidth=t.imageWidth),void 0!==t.imageHeight&&t.imageHeight!==this.config.imageHeight&&(s.imageHeight=t.imageHeight),void 0!==t.imageBorderRadius&&t.imageBorderRadius!==this.config.imageBorderRadius&&(s.imageBorderRadius=t.imageBorderRadius),void 0!==t.imagePosition&&t.imagePosition!==this.config.imagePosition&&(s.imagePosition=t.imagePosition),void 0!==t.labelValign&&t.labelValign!==this.config.labelValign&&(s.labelValign=t.labelValign),void 0!==t.labelHalign&&t.labelHalign!==this.config.labelHalign&&(s.labelHalign=t.labelHalign),Object.keys(s).length>0&&Object.assign(this.ke,s)}mount(){const t=["seui-option-view"],s=i.M(7),e="option_"+s;this.config.isMultiple&&t.push("multiple"),this.config.hasImage&&t.push("has-image","image-"+this.config.imagePosition);const h={pi:{tag:{node:"input",type:this.config.isMultiple?"checkbox":"radio",classList:"allow-choice",id:e}},...this.config.hasImage&&{yi:{tag:{node:"img",classList:"option-image",style:{width:this.config.imageWidth,height:this.config.imageHeight,borderRadius:this.config.imageBorderRadius}}}},_e:{tag:{node:"label",htmlFor:e,classList:["align-vertical-"+this.config.labelValign,"align-horizontal-"+this.config.labelHalign]},F:{bi:{tag:{node:"div"}}}}};this.view=i.I({Be:{tag:{node:"div",id:`seui-${s}-option`,classList:t,role:"option",ariaSelected:"false",tabIndex:"-1"},F:h}}),this.parent.appendChild(this.view.view),this.Re=!0,super.mount()}De(t,s,i){const e=this.view;if(!e||!e.view)return;const h=e.view,n=e.tags?.pi,o=e.tags?._e;switch(t){case"isMultiple":{const t=!!s;h.classList.toggle("multiple",t),n&&n.type!==(t?"checkbox":"radio")&&(n.type=t?"checkbox":"radio");break}case"hasImage":{const t=!!s;if(h.classList.toggle("has-image",t),t)h.classList.add("image-"+this.config.imagePosition),this.Ne();else{h.className=h.className.replace(/image-(top|right|bottom|left)/g,"").trim();const t=e.tags?.yi;t?.remove(),e.tags.yi=null}break}case"imagePosition":this.config.hasImage&&(h.className=h.className.replace(/image-(top|right|bottom|left)/g,"").trim(),h.classList.add("image-"+s));break;case"imageWidth":case"imageHeight":case"imageBorderRadius":{const i=e.tags?.yi;i&&(i.style["imageWidth"===t?"width":"imageHeight"===t?"height":"borderRadius"]=s+"");break}case"labelValign":case"labelHalign":o&&(o.className=`align-vertical-${this.config.labelValign} align-horizontal-`+this.config.labelHalign)}}Ne(){const t=this.view;if(!t||!t.view)return;if(t.tags?.yi)return;const s=t.view,i=t.tags?._e,e=document.createElement("img");e.className="option-image",e.style.width=this.config.imageWidth,e.style.height=this.config.imageHeight,e.style.borderRadius=this.config.imageBorderRadius,i?.parentElement?s.insertBefore(e,i):s.appendChild(e),t.tags.yi=e}}class P extends H{constructor(t=[]){super(t),this.isMultiple=!1,this.Ue=[],this.Ge=-1,this.We=null,this.groups=[],this.qe=[],this.Ke()}init(){i.X.on("sche_vis_"+this.Ce,()=>{const t=this.qe.filter(t=>t.visible).length,s=this.qe.length;this.Ue.forEach(i=>{i({Qe:t,Ye:s,ns:t>0,isEmpty:0===s})}),i.X.run("sche_vis_proxy_"+this.Ce)},{st:10}),super.init(),this.mount()}Ke(){this.qe=[],this.groups=[],this.items.forEach(t=>{t instanceof b?(this.groups.push(t),this.qe.push(...t.items)):t instanceof y&&this.qe.push(t)})}Le(t,s){return s instanceof b?new T(t):new C(t)}Pe(t,s,i){t.position=i,t instanceof b?this.Je(t,s,i):t instanceof y&&this.Xe(t,s,i),t.At=!0}Je(t,s,i){super.Pe(t,s,i),t.view=s;const e=s.view.tags.je;e.textContent=t.label,t.At||(e.style.cursor="pointer",e.addEventListener("click",()=>{t.si()}),t.ti((t,s,i)=>{s.items.forEach(t=>{const s=t.view?.di?.();s&&(s.style.display=i?"none":"")}),this.Ze(s,i)}));const h=s.$e();t.items.forEach((t,s)=>{let i=t.view;t.At&&i||(i=new C(h)),this.Xe(t,i,s),t.At=!0}),s.Zs(t.collapsed),s.ei()}Xe(t,s,i){if(s.isMultiple=this.isMultiple,s.hasImage=t.hasImage,s.ze={imageWidth:t.options.imageWidth,imageHeight:t.options.imageHeight,imageBorderRadius:t.options.imageBorderRadius,imagePosition:t.options.imagePosition,labelValign:t.options.labelValign,labelHalign:t.options.labelHalign},t.At||super.Pe(t,s,i),t.view=s,t.hasImage){const i=s.view.tags.yi;i&&(i.src!==t.ui&&(i.src=t.ui),i.alt!==t.text&&(i.alt=t.text))}s.view.tags.bi.innerHTML=t.text,t.At||(s.view.tags.Be.addEventListener("click",async s=>{s.stopPropagation(),s.preventDefault(),this.Ei||(this.isMultiple?(await this.$i("select"),t.selected=!t.selected):!0!==t.selected&&(await this.$i("select"),this.We&&(this.We.selected=!1),t.selected=!0))}),s.view.tags.Be.title=t.textContent,s.view.tags.Be.addEventListener("mouseenter",()=>{this.Ei||this.th(this.qe.indexOf(t),!1)}),t.fi(()=>{this.Ri("selected")}),t.mi((s,i,e)=>{e&&(this.We=t),this.Ri("selected_internal")}),t.ds((t,s)=>{s.group?.ei(),this.sh()})),t.selected&&(this.We=t,t.ci=!0)}async Fe(t){await this.$i("items",t),this.items=t,this.Ke(),await this.Ri("items",t),this.update()}async Pi(t){await this.Fe(t)}Fi(t){this.items=t,this.Ke(),this.update()}destroy(){this.is(n.DESTROYED)||(i.X.clear("sche_vis_"+this.Ce),this.groups.forEach(t=>{t.destroy()}),this.Ue=[],this.Ge=-1,this.We=null,this.groups=[],this.qe=[],super.destroy())}ih(){return this.qe.filter(t=>t.selected)}eh(){return this.qe.find(t=>t.selected)}ts(t){this.isMultiple&&this.qe.forEach(s=>{s.selected=t})}ds(t){this.Ue.push(t)}sh(){i.X.run("sche_vis_"+this.Ce)}rs(){const t=this.qe.filter(t=>t.visible).length,s=this.qe.length;return{Qe:t,Ye:s,ns:t>0,isEmpty:0===s}}hh(){this.th(0)}navigate(t,s=!0){const i=this.qe.filter(t=>t.visible);if(0===i.length)return;let e=i.findIndex(t=>t===this.qe[this.Ge]);-1===e&&(e=-1);let h=e+t;h>=i.length&&(h=0),h<0&&(h=i.length-1);const n=this.qe.indexOf(i[h]);this.th(n,s)}nh(){if(this.Ge>-1&&this.qe[this.Ge]){const t=this.qe[this.Ge];if(t.visible){const s=t.view?.di?.();s&&s.click()}}}th(t,s=!0){let i=0;if("number"==typeof t)i=t;else if(t instanceof y){const s=this.qe.indexOf(t);i=s>-1?s:0}else i=0;this.Ge>-1&&this.qe[this.Ge]&&(this.qe[this.Ge].gi=!1);for(let t=i;t<this.qe.length;t++){const i=this.qe[t];if(i?.visible){if(i.gi=!0,this.Ge=t,s){const s=i.view?.di?.();s?s.scrollIntoView({block:"center",behavior:"smooth"}):this.kt?.oh?.(t,{scrollIntoView:!0})}return void this.rh(t,i.view?.di?.()?.id)}}}rh(t,s){}Ze(t,s){}}class L extends o{constructor(t=0){super(),this.ah=[],this.uh=0,this.initialize(t)}initialize(t){this.init(),this.reset(t)}reset(t){this.uh=t,this.ah=Array(t+1).fill(0)}add(t,s){for(let i=t;i<=this.uh;i+=i&-i)this.ah[i]+=s}dh(t){let s=0;for(let i=t;i>0;i-=i&-i)s+=this.ah[i];return s}ph(t,s){return s<t?0:this.dh(s)-this.dh(t-1)}gh(t){this.reset(t.length),t.forEach((t,s)=>this.add(s+1,t))}fh(t){let s=0,i=1;for(;i<<1<=this.uh;)i<<=1;let e=0;for(let h=i;0!==h;h>>=1){const i=s+h;i<=this.uh&&e+this.ah[i]<=t&&(s=i,e+=this.ah[i])}return s}}class I extends v{constructor(t=null){super(t),this.mh={Jt:void 0,Bt:36,Nt:8,Ut:!0,bh:!0},this.yh=[],this.wh=new L(0),this.xh=new Map,this.Mh=!1,this.start=0,this.end=-1,this.Oh=null,this.Ah=null,this.updating=!1,this.Hh=!1,this.Sh=0,this.Th=!1,this.Ch=!1,this.Ph=0,this.Lh=0,this.Ih=0,this.Fh=0}configure(t){this.mh={...this.mh,...t}}Li(t){if(this.Zt&&this.dispose(),super.Li(t),t.kt=this,!this.Di)return;this.Di.replaceChildren();const s=i.I({Eh:{tag:{node:"div",classList:"seui-virtual-pad-top"}},jh:{tag:{node:"div",classList:"seui-virtual-items"}},Vh:{tag:{node:"div",classList:"seui-virtual-pad-bottom"}}},this.Di);if(this.Eh=s.Eh,this.jh=s.jh,this.Vh=s.Vh,this.Jt=this.mh.Jt??this.Di.closest(".seui-popup")??this.Di.parentElement,!this.Jt)throw Error("VirtualRecyclerView: scrollEl not found");this.$h=this.kh.bind(this),this.Jt.addEventListener("scroll",this.$h,{passive:!0}),this.refresh(!1),this.Rh(),t?.ds?.(()=>this.Dh())}suspend(){this.Th=!0,this.zh(),this.Jt&&this.$h&&this.Jt.removeEventListener("scroll",this.$h),this._h&&(this._h.disconnect(),this.Ch=!0)}resume(){this.Th=!1,this.Jt&&this.$h&&this.Jt.addEventListener("scroll",this.$h,{passive:!0}),this.Ch&&(this.Rh(),this.Ch=!1),this.Bh()}refresh(t){if(!this.Zt||!this.Di)return;t||this.Dh();const s=this.Zt.Ie();if(this.Sh=s,0===s)return this.Nh(),void this.update();this.yh.length=s,this.Mh||(this.Uh(),this.Mh=!0),this.Gh(s),this.Bh(),this.update()}oh(t,s){this.Wh(t,t),s?.scrollIntoView&&this.qh(t)}qh(t){if((this.Zt?.Ie?.()??0)<=0)return;const s=this.Kh(t),i=this.Qh()+s,e=Math.max(0,this.Jt.scrollHeight-this.Jt.clientHeight);this.Jt.scrollTop=Math.min(Math.max(0,i),e)}dispose(){this.zh(),this.Jt&&this.$h&&this.Jt.removeEventListener("scroll",this.$h),this._h?.disconnect(),this.xh.forEach(t=>t.remove()),this.xh.clear()}destroy(){this.is(n.DESTROYED)||(this.Nh(),this.dispose(),this.Eh.remove(),this.jh.remove(),this.Vh.remove(),this.Eh=null,this.jh=null,this.Vh=null,super.destroy())}Dh(){if(!this.Zt)return;const t=this.Zt.Ie();t<=0||(this.suspend(),this.Nh(),this.Yh(),this.Jh(t),this.Gh(t),this.start=0,this.end=-1,this.resume())}zh(){null!=this.Oh&&(cancelAnimationFrame(this.Oh),this.Oh=null),null!=this.Ah&&(cancelAnimationFrame(this.Ah),this.Ah=null)}Nh(){this.xh.forEach(t=>t.remove()),this.xh.clear(),this.yh=[],this.wh.reset(0),this.Eh.style.height="0px",this.Vh.style.height="0px",this.Mh=!1,this.Ih=0,this.Fh=0}Uh(){this.Xh(0);const t=this.xh.get(0);if(!t)return;const s=this.Zh(t);if(isNaN(s)||(this.mh.Bt=s),!this.mh.Ut){t.remove(),this.xh.delete(0);const s=this.Zt.items[0];s&&(s.At=!1,s.view=null)}}tn(t){const s=this.Zt?.items?.[t];return s?.visible??!0}sn(t,s){for(let i=Math.max(0,t);i<s;i++)if(this.tn(i))return i;return-1}Jh(t){this.Ih=0,this.Fh=0;for(let s=0;s<t;s++){if(!this.tn(s))continue;const t=this.yh[s];null!=t&&(this.Ih+=t,this.Fh++)}}Qh(){const t=this.Di.getBoundingClientRect(),s=this.Jt.getBoundingClientRect();return Math.max(0,t.top-s.top+this.Jt.scrollTop)}en(){const t=performance.now();if(t-this.Ph<16)return this.Lh;const s=this.Jt.querySelector(".seui-option-handle:not(.hide)");return this.Lh=s?.offsetHeight??0,this.Ph=t,this.Lh}Bh(){null!=this.Oh||this.Th||(this.Oh=requestAnimationFrame(()=>{this.Oh=null,this.hn()}))}Zh(t){const s=t.getBoundingClientRect(),i=getComputedStyle(t);return Math.max(1,s.height+(parseFloat(i.marginTop)||0)+(parseFloat(i.marginBottom)||0))}nn(){return this.mh.bh&&this.Fh>0?Math.max(1,this.Ih/this.Fh):this.mh.Bt}Gh(t){const s=this.nn(),i=Array.from({length:t},(t,i)=>this.tn(i)?this.yh[i]??s:0);this.wh.gh(i)}rn(t,s){if(!this.tn(t))return!1;const i=this.nn(),e=this.yh[t]??i;if(Math.abs(s-e)<=I.ln)return!1;const h=this.yh[t];return null==h?(this.Ih+=s,this.Fh++):this.Ih+=s-h,this.yh[t]=s,this.wh.add(t+1,s-e),!0}an(t,s){const i=this.wh.fh(Math.max(0,t)),e=Math.min(s-1,i),h=this.sn(e,s);return-1===h?Math.max(0,e):h}un(t,s){s.setAttribute(I.cn,t+"");const i=this.xh.get(t-1);if(i?.parentElement===this.jh)return void i.after(s);const e=this.xh.get(t+1);if(e?.parentElement===this.jh)return void this.jh.insertBefore(s,e);const h=Array.from(this.jh.children);for(const i of h){const e=i.getAttribute(I.cn);if(e&&+e>t)return void this.jh.insertBefore(s,i)}this.jh.appendChild(s)}dn(t,s){if(s.parentElement!==this.jh)return void this.un(t,s);s.setAttribute(I.cn,t+"");const i=s.previousElementSibling,e=s.nextElementSibling;(i&&+i.getAttribute(I.cn)>t||e&&+e.getAttribute(I.cn)<t)&&(s.remove(),this.un(t,s))}Rh(){this._h||(this._h=new ResizeObserver(()=>{this.Hh||this.Th||!this.Zt||null!=this.Ah||(this.Ah=requestAnimationFrame(()=>{this.Ah=null,this.pn()}))}),this._h.observe(this.jh))}pn(){if(!this.Zt)return;const t=this.Zt.Ie();if(t<=0)return;let s=!1;for(let t=this.start;t<=this.end;t++){if(!this.tn(t))continue;const i=this.Zt.items[t],e=i?.view?.di?.();if(!e)continue;const h=this.Zh(e);this.rn(t,h)&&(s=!0)}s&&(this.mh.bh&&this.Gh(t),this.Bh())}kh(){this.Bh()}hn(){if(!this.updating&&!this.Th){this.updating=!0;try{if(!this.Zt)return;const t=this.Zt.Ie();if(t<=0)return;this.Sh!==t&&(this.Sh=t,this.yh.length=t,this.Gh(t));const s=this.Qh(),i=Math.max(0,this.Jt.scrollTop-s),e=this.en(),h=Math.max(0,this.Jt.clientHeight-e),n=this.an(i,t),o=this.Kh(n),r=s+o-this.Jt.scrollTop,l=this.an(i,t);if(-1===l)return void this.Nh();const a=this.nn(),u=this.mh.Nt*a;let c=this.sn(Math.min(t-1,this.wh.fh(Math.max(0,i-u))),t)??l,d=Math.min(t-1,this.wh.fh(i+h+u));if(c===this.start&&d===this.end)return;this.start=c,this.end=d,this.Hh=!0;try{this.Wh(this.start,this.end),this.gn(this.start,this.end),this.mh.Ut&&this.pn();const s=this.Kh(this.start),i=this.fn(this.start,this.end),e=this.mn(t),h=Math.max(0,e-s-i);this.Eh.style.height=s+"px",this.Vh.style.height=h+"px"}finally{this.Hh=!1}const p=this.Kh(n),g=this.Qh()+p-r,f=Math.max(0,this.Jt.scrollHeight-this.Jt.clientHeight),m=Math.min(Math.max(0,g),f),b=Math.abs(p-o)>1,y=Math.abs(this.Jt.scrollTop-m);b&&y>.5&&y<100&&(this.Jt.scrollTop=m)}finally{this.updating=!1}}}Wh(t,s){for(let i=t;i<=s;i++)this.Xh(i)}Xh(t){if(!this.tn(t)){const s=this.xh.get(t);return s?.parentElement===this.jh&&s.remove(),void this.xh.delete(t)}const s=this.Zt.items[t];if(!s)return;const i=this.xh.get(t);if(i)return void(s?.view?(this.dn(t,i),this.Zt.Pe(s,s.view,t)):(i.remove(),this.xh.delete(t)));if(s.At)s.view&&this.Zt.Pe(s,s.view,t);else{const i=this.Zt.Le(this.jh,s);s.view=i,this.Zt.Pe(s,i,t),s.At=!0}const e=s.view?.di?.();e&&(this.dn(t,e),this.xh.set(t,e))}gn(t,s){this.xh.forEach((i,e)=>{(e<t||e>s)&&(i.parentElement===this.jh&&i.remove(),this.xh.delete(e))})}Yh(){this.xh.forEach((t,s)=>{this.tn(s)||(t.parentElement===this.jh&&t.remove(),this.xh.delete(s))})}Kh(t){return this.wh.dh(t)}fn(t,s){return this.wh.ph(t+1,s+1)}mn(t){return this.wh.dh(t)}}I.ln=.5,I.cn="data-vindex";class F extends o{constructor(t,s){super(),this.container={},this.oldValue=null,this.node=null,this.options=null,this.bn=null,this.isOpen=!1,this.yn=!1,this.wn=!1,this.vn=!1,this.ue=null,this.plugins=[],this.xn=null,t&&s&&this.initialize(t,s)}get isDisabled(){return!!this.options?.disabled}set isDisabled(t){this.options&&this.node&&(this.options.disabled=t,this.node.classList.toggle("disabled",t),this.node.setAttribute("aria-disabled",t+""),this.container.tags?.Hs?.setAttribute("aria-disabled",t+""))}get Mn(){return!!this.options?.readonly}set Mn(t){this.options&&this.node&&(this.options.readonly=t,this.node.classList.toggle("readonly",t))}get isVisible(){return!!this.options?.visible}set isVisible(t){this.options&&this.node&&(this.options.visible=t,this.node.classList.toggle("invisible",!t))}initialize(t,s){const e=i.R(t);this.options=e.options,this.ue=s,this.init(t)}init(s){if(this.state!==n.NEW)return;if(!s||!this.options)return;const e=this.options,h=new r(e),o=new l,a=new g(e),effector=t(),u=new w(e),c=new x(e),d=new M(s,u,this),f=new O(s),m=new A(s);h.node&&(h.node.id=(e.On??"")+"");const b=i.I({An:{tag:{node:"div",classList:"seui-MAIN"},F:{Hs:{tag:{node:"div",classList:"seui-view",tabIndex:0,onkeydown:t=>{"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.Hn()?.open())}},F:{Sn:{tag:h.node},Tn:{tag:o.node},Ds:{tag:a.node}}}}}},null);if(this.container=b,this.node=b.view,b.Cn=d,b.placeholder=h,b.Pn=o,b.Ln=a,b.effector=effector,b.targetElement=s,b.In=c,b.Fn=f,b.En=m,u.Ai(P),u.Si(e.virtualScroll?I:v),u.Ci(i.K(s)),u.on("onUpdate",()=>{b.ie?.ls?.()}),this.bn=u,b.ie=new p(s,e,u),b.ie.ys(effector),b.ie.Ss(d,e),b.ie.bs("selected",()=>{this.Hn()?.change(null,!0)}),b.ie.bs("selected_internal",()=>{this.Hn()?.change(null,!1)}),b.ie.gs("select",()=>{this.oldValue=this.Hn()?.value??""}),c.Wi(b.tags.Hs),c.Ki(u),this.jn(s,b,e,d,a),this.Vn(f,m,s,u),this.plugins=this.ue?.$n?.()??[],this.plugins.length){const t=u.Xt(),s={ee:this,options:e,Zt:t.Zt,kn:t.kt,Rn:b.tags,actions:this.Hn()};this.xn=s,this.Dn("init",t=>t.init?.(s))}this.isDisabled=i.V(e.disabled),this.Mn=i.V(e.readonly),super.init()}mount(){if(this.state!==n.INITIALIZED)return;if(!this.node||!this.container.targetElement)return;const t=this.container.targetElement,s=this.container;t.parentNode?.insertBefore(this.node,t),this.node.insertBefore(t,s.tags.Hs),s.tags.Hs.addEventListener("mousedown",t=>{t.stopPropagation(),t.preventDefault()}),h.rt(t,s.tags.Hs),t.classList.add("init"),this.Hn()?.change(null,!1),super.mount()}update(){this.state===n.MOUNTED&&(this.container.ie?.ls?.(),super.update())}jn(t,s,e,h,n){const o=s.ie.It;let r=null;const l=(t,n)=>{n||""!==t?(""!==t&&(this.wn=!0),h.search(t).then(t=>{clearTimeout(r),i.X.clear("sche_vis_proxy_"+o.Ce),i.X.on("sche_vis_proxy_"+o.Ce,()=>{s.ie?.ls?.(),t?.ve&&(r=setTimeout(()=>{o.hh(),s.ie?.ls?.()},e.animationtime??0))},{st:10})}).catch(t=>{console.error("Search error:",t)})):h.clear()};let a=null;n.Vs=(t,i)=>{h.we(t)&&(a&&clearTimeout(a),h.oe()?(s.ie?.es?.(),a=setTimeout(()=>{l(t,i)},e.delaysearchtime??0)):a=setTimeout(()=>{l(t,i)},10))},h.setPopup(s.ie),n.$s=t=>{o.navigate(t)},n.ks=()=>{o.nh()},n.Rs=()=>{this.Hn()?.close(),s.tags.Hs.focus()},o.rh=(t,s)=>{s&&n._s(s)},o.Ze=()=>{s.ie?.ls?.()},e.ajax&&(null==e.ajax?.keepSelected&&(e.ajax.keepSelected=e.keepSelected),h.fe(e.ajax))}Vn(t,s,e,h){t.connect(),t.Pt=t=>{h.Ii(i.K(t)),this.Hn()?.refreshMask()},s.connect(),s.Pt=t=>{i.V(t.disabled)!==this.isDisabled&&(this.isDisabled=i.V(t.disabled)),i.V(t.readonly)!==this.Mn&&(this.Mn=i.V(t.readonly)),i.V(t.visible)!==this.isVisible&&(this.isVisible=i.V(t.visible??"1"))}}zn(){if(this.vn)return;const t=this.container??{},{Fn:s,En:i}=t;this.plugins.length&&this.Dn("destroy",t=>t.destroy?.()),this.plugins=[],this.xn=null,s?.disconnect&&s.disconnect(),i?.disconnect&&i.disconnect(),this.vn=!0}destroy(){if(this.is(n.DESTROYED))return;this.zn();const t=this.container;t.Cn.destroy(),t.Pn.destroy(),t.ie.destroy(),t.In.destroy(),t.placeholder.destroy(),t.Ln.destroy(),this.bn.destroy(),this.node?.remove(),this.container={},this.node=null,this.options=null,this.bn=null,this.ue=null,this.oldValue=null,this.isOpen=!1,this.yn=!1,this.wn=!1,super.destroy()}Hn(){const t=this.container,s=this,h=()=>this.ue.find(t.targetElement),o=i.R(t.targetElement);if(!o)return null;const r=o.options,l={get targetElement(){return t.targetElement},get placeholder(){return t.placeholder.get()},set placeholder(s){t.placeholder?.set(s),t.Ln?.zs(s)},get oldValue(){return s.oldValue},set value(t){this.setValue(null,t,!0)},get value(){const t=this.valueArray,s=t.length;return s>1?t:0===s?"":t[0]},get valueArray(){const t=[];return s._n().forEach(s=>{s.selected&&t.push(s.value)}),t},get valueString(){return this.valueArray.join(r.customDelimiter)},get valueOptions(){const t=[];return s._n(!0).forEach(s=>{t.push(s)}),t},get mask(){const t=[];return s._n(!0).forEach(s=>{t.push(s.text)}),t},get valueText(){const t=[];s._n(!0).forEach(s=>{t.push(s.text)});const i=t.length;return i>1?t:0===i?"":t[0]},get isOpen(){return s.isOpen},getParent:()=>t.view.parentElement,valueDataset(t,i=null,e=!1){var h=[];if(s._n(!0).forEach(t=>{h.push(i?t.dataset[i]:t.dataset)}),!e){if(0==h.length)return"";if(1==h.length)return h[0]}return h},selectAll(t,i=!0){if(!(r.multiple&&r.maxSelected>0&&s._n().length>r.maxSelected)&&!this.disabled&&!this.readonly&&r.multiple){if(i){if(e.ht([h()],...r.on.beforeChange).isCancel)return;s.oldValue=this.value}s._n().forEach(t=>{t.ci=!0}),this.change(!1,i)}},deSelectAll(t,i=!0){if(!this.disabled&&!this.readonly&&r.multiple){if(i){if(e.ht([h()],...r.on.beforeChange).isCancel)return;s.oldValue=this.value}s._n().forEach(t=>{t.ci=!1}),this.change(!1,i)}},setValue(i=null,n,o=!0,l=!1){if(Array.isArray(n)||(n=[n]),0===(n=n.filter(t=>""!==t&&null!=t)).length)return s._n().forEach(t=>t.ci=!1),void this.change(!1,o);if(r.multiple&&r.maxSelected>0&&n.length>r.maxSelected)console.warn(`Cannot select more than ${r.maxSelected} items`);else if(l||!this.disabled&&!this.readonly){if(t.Cn?.oe?.()){const{ge:i}=t.Cn.de(n);if(i.length>0)return void(async()=>{r.loadingfield&&t.ie?.es?.();try{t.Cn.me();const e=await t.Cn.re(i);e.Is&&e.items.length>0?(e.items.forEach(t=>{i.includes(t.value)&&(t.selected=!0)}),t.Cn.Me?.(e.items,!0,!0),setTimeout(()=>{s._n().forEach(t=>{t.ci=n.some(s=>s==t.value)}),this.change(!1,!1)},100)):i.length>0&&console.warn(`Could not load ${i.length} values:`,i)}catch(t){console.error("Error loading missing values:",t)}finally{r.loadingfield&&t.ie?.us?.()}})()}if(o){if(e.ht([h()],...r.on.beforeChange).isCancel)return;s.oldValue=this.value}s._n().forEach(t=>{t.ci=n.some(s=>s==t.value)}),!r.multiple&&n.length>0&&(t.targetElement.value=n[0]),this.change(!1,o)}},open(){if(s.isOpen)return;const i=s.ue?.find?.();if(i&&!i.isEmpty&&i.close().isCancel)return;if(this.disabled)return;if(e.ht([h()],...r.on.beforeShow).isCancel)return;s.isOpen=!0,t.Pn.gt(!0);const n=t.ie.It,o=n.eh();o?n.th(o,!1):n.hh(),s.yn&&!s.wn||!r?.ajax?t.ie.open(null,!0):(t.Cn.me(),t.ie.es(),s.yn=!0,s.wn=!1,setTimeout(()=>{t.ie&&t.Cn&&t.Cn.search("").then(()=>t.ie?.ls?.()).catch(t=>console.error("Initial ajax load error:",t))},r.animationtime),t.ie.open(null,!1)),t.Ln.show();const l=t.tags.Hs;l.setAttribute("aria-expanded","true"),l.setAttribute("aria-controls",r.Kt),l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-labelledby",r.On),r.multiple&&l.setAttribute("aria-multiselectable","true"),e.ht([h()],...r.on.show),s.xn&&s.Dn("onOpen",t=>t.Bn?.(s.xn))},close(){s.isOpen&&(e.ht([h()],...r.on.beforeClose).isCancel||(s.isOpen=!1,t.Pn.gt(!1),t.ie.close(()=>{t.Ln.clear(!1)}),t.Ln.hide(),t.tags.Hs.setAttribute("aria-expanded","false"),e.ht([h()],...r.on.close),s.xn&&s.Dn("onClose",t=>t.Nn?.(s.xn))))},toggle(){s.isOpen?this.close():this.open()},change(i=null,o=!0){if(o){if(r.multiple&&r.maxSelected>0&&this.valueArray.length>r.maxSelected&&this.setValue(null,this.oldValue,!1,!0),this.disabled||this.readonly)return void this.setValue(null,this.oldValue,!1,!0);if(e.ht([h(),this.value],...r.on.beforeChange).isCancel)return void this.setValue(null,this.oldValue,!1)}if(this.refreshMask(),t.In.Qi(this.valueOptions),o&&(t.targetElement&&e.nt(t.targetElement,"change"),e.ht([h(),this.value],...r.on.change),s.options?.autoclose&&this.close()),s.is(n.MOUNTED)&&s.update(),s.xn&&s.bn){const t=s.bn.Xt();s.Dn("onChange",i=>i.Un?.(this.value,t.ji,t.Zt,s.xn))}},refreshMask(){let i=r.placeholder;!r.multiple&&s._n().length>0&&(i=this.mask[0]),i??(i=r.placeholder),t.placeholder.set(i,!1),t.Ln.zs(i)},on(t,s,i){r.on[s]||(r.on[s]=[]),r.on[s].push(i)},ajax(i,e){null==e.keepSelected&&(e.keepSelected=s.options.keepSelected),t.Cn.fe(e)},loadAjax:()=>new Promise((i,e)=>{t.ie.es(),t.Cn.me(),s.yn=!0,s.wn=!1,t.ie&&t.Cn?t.Cn.search("").then(()=>{t.ie?.ls?.(),i(h())}).catch(t=>{console.error("Initial ajax load error:",t),e(t)}):i(h())})};return this.Gn(l,"disabled","isDisabled"),this.Gn(l,"readonly","isReadOnly"),this.Gn(l,"visible","isVisible"),l}Gn(t,s,i){const e=this;Object.defineProperty(t,s,{get:()=>e[i],set(t){e[i]=!!t,e.container?.targetElement?.dataset&&(e.container.targetElement.dataset[s]=!!t+"")},enumerable:!0,configurable:!0})}_n(t=null){if(!this.bn)return[];const{ji:s}=this.bn.Xt(),i=[];for(const t of s)t instanceof y?i.push(t):t instanceof b&&Array.isArray(t.items)&&t.items.length&&i.push(...t.items);return"boolean"==typeof t?i.filter(s=>s.selected===t):i}Dn(t,s){this.plugins.length&&this.plugins.forEach(i=>{try{s(i)}catch(s){console.error(`Plugin "${i.id}" ${t} error:`,s)}})}}class E{constructor(){this.isActive=!1,this.Se=null,this.actions=[]}Wn(t){this.actions.push(t)}qn(){this.actions=[]}connect(t){if(this.isActive)return;this.isActive=!0;const s=t.toUpperCase(),i=t.toLowerCase();this.Se=new MutationObserver(t=>{for(const e of t)e.addedNodes.forEach(t=>{if(1!==t.nodeType)return;const e=t;e.tagName===s&&this.Kn(e),e.querySelectorAll(i).forEach(t=>this.Kn(t))})}),this.Se.observe(document.body,{childList:!0,subtree:!0})}disconnect(){this.isActive&&(this.isActive=!1,this.Se?.disconnect(),this.Se=null)}Kn(t){this.actions.forEach(s=>s(t))}}const j=new class extends o{constructor(){super(),this.Qn=new Map,this.plugins=new Map,this.init()}init(){this.is(n.NEW)&&(this.Qn=new Map,this.plugins=new Map,super.init())}bind(t,s){this.is(n.NEW)&&this.init();const h=i.$(i.U(),s);h.on=h.on??{},h.on.load=h.on.load??[],this.Qn.set(t,h);const o=i.M();i.X.on(o,()=>{e.ht([this.find(t)],...h.on.load),i.X.clear(o),h.on.load=[]});const r=i.O(t);let l=!1;r.forEach(t=>{(async()=>{"SELECT"===t.tagName&&(i._(t),this.Yn(t,h)&&(l=!0,i.X.run(o)))})()}),i.t().includes(t)||i.t().push(t),this.is(n.INITIALIZED)&&l&&this.mount(),this.is(n.MOUNTED)&&this.update()}mount(){this.state===n.INITIALIZED&&super.mount()}update(){this.state===n.MOUNTED&&super.update()}find(t="*"){const s={isEmpty:!0};if("*"===t&&""===(t=i.t().join(", ")))return s;const e=i.O(t);if(0===e.length)return s;const h=i.R(e[0]);if(!h||!h.action)return s;const n={};for(const t in h.action)n[t]=this.Jn(t,h.action);const o={isEmpty:!1};for(const t in n){const s=n[t];switch(s.type){case"get-set":this.Xn(o,s.name,e);break;case"func":this.Zn(o,s.name,e)}}return o}$n(){return Array.from(this.plugins.values())}i(){this.so||(this.so=new E,this.so.Wn(t=>{this.Qn.forEach((s,i)=>{try{t.matches(i)&&(this.Yn(t,s),this.is(n.MOUNTED)&&this.update())}catch(t){console.warn("Invalid selector: "+i,t)}})})),this.so.connect("select")}destroy(t=null){null===t?this.io():"string"==typeof t?this.eo(t):t instanceof HTMLSelectElement&&this.ho(t),null!==t&&this.is(n.MOUNTED)&&this.update()}registerPlugin(t){t?.id&&this.plugins.set(t.id,t)}unregisterPlugin(t){t&&this.plugins.delete(t)}no(t){if(t)return this.plugins.get(t)}io(){this.state!==n.DESTROYED&&(i.t().forEach(t=>this.eo(t)),this.Qn.clear(),i.t().length=0,this.plugins.forEach(t=>{t.destroy?.(),t.oo?.()}),this.plugins.clear(),this.so?.disconnect(),this.plugins.clear(),super.destroy())}eo(t){i.O(t).forEach(t=>{"SELECT"===t.tagName&&this.ho(t)}),this.Qn.delete(t);const s=i.t(),e=s.indexOf(t);e>-1&&s.splice(e,1)}ho(t){const s=i.R(t);if(!s)return;const e=s.self;i.N(t,s);const h=!!this.so;h&&this.so?.disconnect(),s.self?.zn?.();const n=s.container?.element??t.parentElement;t.style.display="",t.style.visibility="",t.disabled=!1,delete t.dataset.ro,n&&n.parentNode?n.parentNode.replaceChild(t,n):t.appendChild(t),i.k(t),h&&this.Qn.size>0&&this.so?.connect("select"),e?.destroy?.()}rebind(t,s){this.eo(t),this.bind(t,s),this.is(n.MOUNTED)&&this.update()}Yn(t,s){if(i.R(t)||i.B(t))return!1;const e=i.M(8),h=i.j(t,s);h.lo=e,h.Kt=`seui-${e}-optionlist`,h.On=`seui-${e}-placeholder`;const n={options:h};i.D(t,n);const o=new F(t,this);return o.on("onMount",()=>{o.container.view&&o.container.view.addEventListener("mouseup",()=>{n.action?.toggle?.()})}),o.mount(),n.container=o.container,n.action=o.Hn(),n.self=o,!0}Jn(t,s){const i=Object.getOwnPropertyDescriptor(s,t);let e="variable";return i?.get||i?.set&&"function"!=typeof s[t]?e="get-set":"function"==typeof s[t]&&(e="func"),{type:e,name:t}}Xn(t,s,e){Object.defineProperty(t,s,{get(){const t=i.R(e[0]);return t.action?.[s]},set(t){e.forEach(e=>{const h=i.R(e);h?.action&&(h.action[s]=t)})},enumerable:!0,configurable:!0})}Zn(t,s,h){t[s]=(...n)=>{let o=null;for(let t=0;t<h.length;t++){const r=i.R(h[t]);if(!r?.action)continue;const l=e.et();if(o??(o=r.action[s](l.it,...n)),!l.token.isContinue)break}return o??t}}},version="1.2.6",V="SelectiveUI";let $=!1;"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",init):init());export{bind,destroy,effector,find,V as name,rebind,registerPlugin,unregisterPlugin,version};
Binary file
@@ -1 +1 @@
1
- :root{--seui-transparent-color:#0000;--seui-view-text-color:#121212;--seui-view-ro-text-color:#a3a3a3;--seui-view-text-style:Arial,Helvetica,sans-serif;--seui-view-text-size:13px;--seui-view-mobile-text-size:16px;--seui-view-background-color:#fff;--seui-view-ro-background-color:#00000029;--seui-view-optgroup-background-color:#a3c6e9;--seui-view-border-color:#a3a3a3;--seui-view-ro-border-color:#bdbdbd;--seui-view-border-size:1px;--seui-view-border-style:solid;--seui-view-border-radius:5px;--seui-directive-color:#000;--seui-directive-ro-color:#a3a3a3;--seui-option-crtl-text-color:#307ecc;--seui-option-crtl-text-color-hover:red;--seui-option-crtl-background-color:#f3f3f3;--seui-option-crtl-border-color:#ccc;--seui-option-crtl-text-size:13px;--seui-option-padding:5px;--seui-option-border-radius:5px;--seui-accessory-max-width:100%;--seui-accessory-max-height:50px;--seui-accessory-padding:2px 0;--seui-accessory-item-border-color:#a3a3a3;--seui-accessory-item-border-style:solid;--seui-accessory-item-border-width:1px;--seui-accessory-item-border-radius:3px;--seui-accessory-item-background:#f7f7f9;--seui-accessory-item-font-size:11px;--seui-accessory-item-padding:2px;--seui-accessory-item-gap:3px;--seui-accessory-item-button-color:#757575;--seui-accessory-item-button-width:16px;--seui-accessory-item-button-height:16px;--seui-accessory-item-button-border-color:#a3a3a3;--seui-accessory-item-button-border-style:solid;--seui-accessory-item-button-border-width:1px;--seui-accessory-item-button-border-radius:2px;--seui-accessory-item-content-color:#307ecc;--seui-accessory-item-content-font-size:11px;--seui-accessory-item-content-padding:0 4px 0 2px;--seui-popup-background-color:#fbfbfb;--seui-popup-border-color:#a3a3a3;--seui-popup-border-style:solid;--seui-popup-border-width:1px;--seui-popup-border-radius:6px;--seui-chkbox-background-color:#fff;--seui-chkbox-border-color:#8f9194;--seui-chkbox-hover-background-color:#dbdbdb;--seui-chkbox-hover-border-color:#b7b7b7;--seui-chkbox-checked-background-color:#9dcff8;--seui-chkbox-checked-border-color:#9dcff8;--seui-chkbox-checked-hover-background-color:#9dcff8;--seui-chkbox-checked-hover-border-color:#007eff;--seui-chkbox-checked-color:#0075ff;--seui-empty-state-color:#999;--seui-empty-state-background:#f9f9f9;--seui-empty-state-padding:10px 5px}.selective-ui-MAIN{display:inline-block;max-width:min-content}.selective-ui-MAIN,.selective-ui-MAIN *{box-sizing:border-box;line-height:normal;margin:0;padding:0;touch-action:manipulation}.selective-ui-MAIN>select.init{display:none}.selective-ui-MAIN>.selective-ui-view{align-items:center;background-color:var(--seui-view-background-color);border:var(--seui-view-border-style) var(--seui-view-border-size) var(--seui-view-border-color);border-radius:var(--seui-view-border-radius);display:flex;flex-direction:row;height:100%;position:relative;width:100%}.selective-ui-MAIN.invisible{display:none}.selective-ui-MAIN.disabled{--seui-view-background-color:var(--seui-view-ro-background-color);--seui-view-border-color:var(--seui-view-ro-border-color);--seui-view-text-color:var(--seui-view-ro-text-color);--seui-directive-color:var(--seui-directive-ro-color)}.selective-ui-MAIN .hide{display:none}@supports (-webkit-touch-callout:none){:root{--seui-view-text-size:var(--seui-view-mobile-text-size)}}.selective-ui-placeholder{align-items:center;color:var(--seui-view-text-color);display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size)!important;height:calc(100% - 10px);margin-left:10px;max-width:calc(100% - 30px);overflow:hidden;pointer-events:none;text-overflow:ellipsis;white-space:nowrap}.selective-ui-directive{border-left:4px solid #0000;border-right:4px solid #0000;border-top:4px solid var(--seui-directive-color);content:" ";display:inline-block;height:0;pointer-events:none;position:absolute;right:10px;top:50%;transform:translateY(-50%) rotate(0deg);transition:all .2s linear;vertical-align:middle;width:0;z-index:1}.selective-ui-directive.drop-down{transform:translateY(-50%) rotate(180deg)}.selective-ui-empty-state{align-items:center;background-color:var(--seui-empty-state-background,#0000);border-radius:var(--seui-option-border-radius);bottom:0;color:var(--seui-empty-state-color,#999);display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size);justify-content:center;min-height:60px;padding:var(--seui-empty-state-padding,20px);position:sticky;text-align:center}.selective-ui-empty-state.small{justify-content:flex-start;min-height:30px;text-align:left}.selective-ui-empty-state.hide{display:none}.selective-ui-loading-state{align-items:center;background-color:var(--seui-empty-state-background,#0000);border-radius:var(--seui-option-border-radius);bottom:0;color:var(--seui-empty-state-color,#999);display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size);justify-content:center;min-height:60px;padding:var(--seui-empty-state-padding,20px);position:sticky;text-align:center}.selective-ui-loading-state.small{justify-content:flex-start;min-height:30px;text-align:left}.selective-ui-loading-state.hide{display:none}.selective-ui-group{display:flex;flex-direction:column;gap:2px}.selective-ui-group.hide{display:none}.selective-ui-group-header{align-items:center;background-color:var(--seui-view-optgroup-background-color);border-radius:var(--seui-option-border-radius);color:var(--seui-view-text-color);cursor:pointer;display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size);font-weight:600;gap:8px;padding:8px 12px;-webkit-user-select:none;user-select:none;z-index:1}.selective-ui-group-header:before{border-bottom:5px solid #0000;border-left:7px solid;border-top:5px solid #0000;content:"";display:inline-block;height:0;transform:rotate(90deg);transition:transform .2s ease;width:0}.selective-ui-group.collapsed .selective-ui-group-header:before{transform:rotate(0deg)}.selective-ui-group-items{display:flex;flex-direction:column;gap:2px;padding-left:16px}.selective-ui-group.collapsed .selective-ui-group-items{display:none}.selective-ui-group-items .selective-ui-option-view{border-left:2px solid #e0e0e0;margin-left:4px;padding-left:12px}.selective-ui-popup,.selective-ui-popup *{box-sizing:border-box;line-height:normal}.selective-ui-popup{background-color:var(--seui-popup-background-color);border-color:var(--seui-popup-border-color);border-radius:var(--seui-popup-border-radius);border-style:var(--seui-popup-border-style);border-width:var(--seui-popup-border-width);display:none;flex-direction:column;gap:2px;height:0;overflow:hidden;padding:2px;position:fixed;transition:none;z-index:9999}.selective-ui-options-container{-webkit-overflow-scrolling:touch;display:flex;flex-direction:column;touch-action:pan-y;width:100%}.selective-ui-options-container.hide{display:none}.selective-ui-options-container .selective-ui-virtual-items{display:flex;flex-direction:column;gap:2px;width:100%}.selective-ui-searchbox{align-items:center;background-color:var(--seui-view-background-color);border-radius:5px;display:flex;flex-direction:row;height:100%;position:absolute;width:calc(100% - 30px);z-index:2}.selective-ui-searchbox-input{background:var(--seui-transparent-color);border:0;color:var(--seui-view-text-color);font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size)!important;height:calc(100% - 10px);margin-left:10px;outline:none!important;overflow:hidden;padding:0!important;text-indent:0;text-overflow:ellipsis;white-space:nowrap;width:100%}.selective-ui-option-handle{align-items:center;background-color:var(--seui-option-crtl-background-color);border:1px solid var(--seui-option-crtl-border-color);border-radius:var(--seui-option-border-radius);display:flex;flex-direction:row;font-family:var(--seui-view-text-style);font-size:var(--seui-option-crtl-text-size);justify-content:space-between;padding:var(--seui-option-padding);position:sticky;top:0;width:unset;z-index:2}.selective-ui-option-handle.hide{display:none}.selective-ui-option-handle-item{color:var(--seui-option-crtl-text-color);cursor:pointer;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.selective-ui-option-handle-item:hover{color:var(--seui-option-crtl-text-color-hover)}.selective-ui-option-view{align-items:center!important;background-color:var(--seui-transparent-color);border:1px solid var(--seui-transparent-color);border-radius:4px;display:flex;flex-direction:row;gap:7px;line-height:normal;padding:5px;position:relative;transition:all .18s;width:auto}.selective-ui-option-view.checked{background-color:var(--seui-chkbox-checked-background-color);border-color:var(--seui-chkbox-checked-border-color)}.selective-ui-option-view>input{display:none}.selective-ui-option-view>label{align-items:center;color:var(--seui-view-text-color);display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size);gap:7px;height:100%;width:100%}.selective-ui-option-view.multiple>label:before{background:var(--seui-chkbox-background-color);border:1px solid var(--seui-chkbox-border-color);border-radius:.2em;content:"";display:block;height:17px;min-height:17px;min-width:17px;transition:all .2s,background .2s ease-in-out;width:17px}.selective-ui-option-view.multiple.checked>label:before{background:var(--seui-chkbox-checked-color) url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNyIgaGVpZ2h0PSIxNyIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xNjggMTIuMzhhMSAxIDAgMCAxLTEuNDE1IDBMMi43NDUgOC4zNjZhMSAxIDAgMCAxIDAtMS40MTNsLjQyLS40MmExIDEgMCAwIDEgMS40MTUgMEw2Ljc1MyA4LjcxYTEgMSAwIDAgMCAxLjQxNSAwbDQuMDgyLTQuMDlhMSAxIDAgMCAxIDEuNDE1IDBsLjQyLjQyYTEgMSAwIDAgMSAwIDEuNDEzeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+) 50% 40% no-repeat;border:1px solid var(--seui-chkbox-checked-color);color:var(--seui-view-background-color)}.selective-ui-option-view>label>div{display:flex;height:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.selective-ui-option-view>label.align-horizontal-left>div{justify-content:flex-start}.selective-ui-option-view>label.align-horizontal-center>div{justify-content:center}.selective-ui-option-view>label.align-horizontal-right>div{justify-content:flex-end}.selective-ui-option-view>label.align-vertical-left>div{align-items:flex-start}.selective-ui-option-view>label.align-vertical-center>div{align-items:center}.selective-ui-option-view>label.align-vertical-right>div{align-items:flex-end}.selective-ui-option-view.hide{display:none}.selective-ui-option-view.highlight{background-color:var(--seui-chkbox-hover-background-color);border-color:var(--seui-chkbox-hover-border-color)}.selective-ui-option-view.highlight.checked{background-color:var(--seui-chkbox-checked-hover-background-color);border-color:var(--seui-chkbox-checked-hover-border-color)}.selective-ui-option-view.has-image{gap:10px}.selective-ui-option-view.has-image.image-top{align-items:center;flex-direction:column;text-align:center}.selective-ui-option-view.has-image.image-right{flex-direction:row-reverse}.selective-ui-option-view.has-image.image-bottom{flex-direction:column-reverse}.selective-ui-option-view .option-image{flex-shrink:0;object-fit:cover}.selective-ui-option-view.multiple.has-image>label:before{display:none;order:-1}.selective-ui-accessorybox{display:flex;flex-direction:row;flex-wrap:wrap;gap:2px;max-height:var(--seui-accessory-max-height);max-width:var(--seui-accessory-max-width);overflow-y:scroll;padding:var(--seui-accessory-padding)}.accessory-item{align-items:center;background:var(--seui-accessory-item-background);border-color:var(--seui-accessory-item-border-color);border-radius:var(--seui-accessory-item-border-radius);border-style:var(--seui-accessory-item-border-style);border-width:var(--seui-accessory-item-border-width);display:flex;font-size:var(--seui-accessory-item-font-size);gap:var(--seui-accessory-item-gap);overflow:hidden;padding:var(--seui-accessory-item-padding)}.accessory-item>.accessory-item-button{border-color:var(--seui-accessory-item-button-border-color);border-radius:var(--seui-accessory-item-button-border-radius);border-style:var(--seui-accessory-item-button-border-style);border-width:var(--seui-accessory-item-button-border-width);color:var(--seui-accessory-item-button-color);cursor:pointer;font-weight:700;height:var(--seui-accessory-item-button-height);min-height:var(--seui-accessory-item-button-height);min-width:var(--seui-accessory-item-button-width);position:relative;width:var(--seui-accessory-item-button-width)}.accessory-item>.accessory-item-button:after{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cg fill='%234c4c4c' transform='rotate(45 8 8)'%3E%3Crect width='7.762' height='1.411' x='4.119' y='7.294' rx='1'/%3E%3Crect width='11' height='2' x='.206' y='4.706' rx='1' transform='rotate(90 4.026 8) scale(.70565)'/%3E%3C/g%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;content:"";display:block;height:100%;position:absolute;width:100%}.accessory-item>.accessory-item-content{color:var(--seui-accessory-item-content-color);font-size:var(--seui-accessory-item-content-font-size);overflow:hidden;padding:var(--seui-accessory-item-content-padding);text-overflow:ellipsis;white-space:nowrap}
1
+ :root{--seui-transparent-color:#0000;--seui-view-text-color:#121212;--seui-view-ro-text-color:#a3a3a3;--seui-view-text-style:Arial,Helvetica,sans-serif;--seui-view-text-size:13px;--seui-view-mobile-text-size:16px;--seui-view-background-color:#fff;--seui-view-ro-background-color:#00000029;--seui-view-optgroup-background-color:#a3c6e9;--seui-view-border-color:#a3a3a3;--seui-view-ro-border-color:#bdbdbd;--seui-view-border-size:1px;--seui-view-border-style:solid;--seui-view-border-radius:5px;--seui-directive-color:#000;--seui-directive-ro-color:#a3a3a3;--seui-option-crtl-text-color:#307ecc;--seui-option-crtl-text-color-hover:red;--seui-option-crtl-background-color:#f3f3f3;--seui-option-crtl-border-color:#ccc;--seui-option-crtl-text-size:13px;--seui-option-padding:5px;--seui-option-border-radius:5px;--seui-accessory-max-width:100%;--seui-accessory-max-height:50px;--seui-accessory-padding:2px 0;--seui-accessory-item-border-color:#a3a3a3;--seui-accessory-item-border-style:solid;--seui-accessory-item-border-width:1px;--seui-accessory-item-border-radius:3px;--seui-accessory-item-background:#f7f7f9;--seui-accessory-item-font-size:11px;--seui-accessory-item-padding:2px;--seui-accessory-item-gap:3px;--seui-accessory-item-button-color:#757575;--seui-accessory-item-button-width:16px;--seui-accessory-item-button-height:16px;--seui-accessory-item-button-border-color:#a3a3a3;--seui-accessory-item-button-border-style:solid;--seui-accessory-item-button-border-width:1px;--seui-accessory-item-button-border-radius:2px;--seui-accessory-item-content-color:#307ecc;--seui-accessory-item-content-font-size:11px;--seui-accessory-item-content-padding:0 4px 0 2px;--seui-popup-background-color:#fbfbfb;--seui-popup-border-color:#a3a3a3;--seui-popup-border-style:solid;--seui-popup-border-width:1px;--seui-popup-border-radius:6px;--seui-chkbox-background-color:#fff;--seui-chkbox-border-color:#8f9194;--seui-chkbox-hover-background-color:#dbdbdb;--seui-chkbox-hover-border-color:#b7b7b7;--seui-chkbox-checked-background-color:#9dcff8;--seui-chkbox-checked-border-color:#9dcff8;--seui-chkbox-checked-hover-background-color:#9dcff8;--seui-chkbox-checked-hover-border-color:#007eff;--seui-chkbox-checked-color:#0075ff;--seui-empty-state-color:#999;--seui-empty-state-background:#f9f9f9;--seui-empty-state-padding:10px 5px}.seui-MAIN{display:inline-block;max-width:-webkit-min-content;max-width:min-content}.seui-MAIN,.seui-MAIN *{box-sizing:border-box;line-height:normal;margin:0;padding:0;touch-action:manipulation}.seui-MAIN>select.init{display:none}.seui-MAIN>.seui-view{align-items:center;background-color:var(--seui-view-background-color);border:var(--seui-view-border-style) var(--seui-view-border-size) var(--seui-view-border-color);border-radius:var(--seui-view-border-radius);display:flex;flex-direction:row;height:100%;position:relative;width:100%}.seui-MAIN.invisible{display:none}.seui-MAIN.disabled{--seui-view-background-color:var(--seui-view-ro-background-color);--seui-view-border-color:var(--seui-view-ro-border-color);--seui-view-text-color:var(--seui-view-ro-text-color);--seui-directive-color:var(--seui-directive-ro-color)}.seui-MAIN .hide{display:none}@supports (-webkit-touch-callout:none){:root{--seui-view-text-size:var(--seui-view-mobile-text-size)}}.seui-placeholder{align-items:center;color:var(--seui-view-text-color);display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size)!important;height:calc(100% - 10px);margin-left:10px;max-width:calc(100% - 30px);overflow:hidden;pointer-events:none;text-overflow:ellipsis;white-space:nowrap}.seui-directive{border-left:4px solid #0000;border-right:4px solid #0000;border-top:4px solid var(--seui-directive-color);content:" ";display:inline-block;height:0;pointer-events:none;position:absolute;right:10px;top:50%;transform:translateY(-50%) rotate(0deg);transition:all .2s linear;vertical-align:middle;width:0;z-index:1}.seui-directive.drop-down{transform:translateY(-50%) rotate(180deg)}.seui-empty-state{align-items:center;background-color:var(--seui-empty-state-background,#0000);border-radius:var(--seui-option-border-radius);bottom:0;color:var(--seui-empty-state-color,#999);display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size);justify-content:center;min-height:60px;padding:var(--seui-empty-state-padding,20px);position:-webkit-sticky;position:sticky;text-align:center}.seui-empty-state.small{justify-content:flex-start;min-height:30px;text-align:left}.seui-empty-state.hide{display:none}.seui-loading-state{align-items:center;background-color:var(--seui-empty-state-background,#0000);border-radius:var(--seui-option-border-radius);bottom:0;color:var(--seui-empty-state-color,#999);display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size);justify-content:center;min-height:60px;padding:var(--seui-empty-state-padding,20px);position:-webkit-sticky;position:sticky;text-align:center}.seui-loading-state.small{justify-content:flex-start;min-height:30px;text-align:left}.seui-loading-state.hide{display:none}.seui-group{display:flex;flex-direction:column;gap:2px}.seui-group.hide{display:none}.seui-group-header{align-items:center;background-color:var(--seui-view-optgroup-background-color);border-radius:var(--seui-option-border-radius);color:var(--seui-view-text-color);cursor:pointer;display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size);font-weight:600;gap:8px;padding:8px 12px;-webkit-user-select:none;user-select:none;z-index:1}.seui-group-header:before{border-bottom:5px solid #0000;border-left:7px solid;border-top:5px solid #0000;content:"";display:inline-block;height:0;transform:rotate(90deg);transition:transform .2s ease;width:0}.seui-group.collapsed .seui-group-header:before{transform:rotate(0deg)}.seui-group-items{display:flex;flex-direction:column;gap:2px;padding-left:16px}.seui-group.collapsed .seui-group-items{display:none}.seui-group-items .seui-option-view{border-left:2px solid #e0e0e0;margin-left:4px;padding-left:12px}.seui-popup,.seui-popup *{box-sizing:border-box;line-height:normal}.seui-popup{background-color:var(--seui-popup-background-color);border-color:var(--seui-popup-border-color);border-radius:var(--seui-popup-border-radius);border-style:var(--seui-popup-border-style);border-width:var(--seui-popup-border-width);display:none;flex-direction:column;gap:2px;height:0;overflow:hidden;padding:2px;position:fixed;transition:none;z-index:9999}.seui-options-container{-webkit-overflow-scrolling:touch;display:flex;flex-direction:column;touch-action:pan-y;width:100%}.seui-options-container.hide{display:none}.seui-options-container .seui-virtual-items{display:flex;flex-direction:column;gap:2px;width:100%}.seui-searchbox{align-items:center;background-color:var(--seui-view-background-color);border-radius:5px;display:flex;flex-direction:row;height:100%;position:absolute;width:calc(100% - 30px);z-index:2}.seui-searchbox-input{background:var(--seui-transparent-color);border:0;color:var(--seui-view-text-color);font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size)!important;height:calc(100% - 10px);margin-left:10px;outline:none!important;overflow:hidden;padding:0!important;text-indent:0;text-overflow:ellipsis;white-space:nowrap;width:100%}.seui-option-handle{align-items:center;background-color:var(--seui-option-crtl-background-color);border:1px solid var(--seui-option-crtl-border-color);border-radius:var(--seui-option-border-radius);display:flex;flex-direction:row;font-family:var(--seui-view-text-style);font-size:var(--seui-option-crtl-text-size);justify-content:space-between;padding:var(--seui-option-padding);position:-webkit-sticky;position:sticky;top:0;width:unset;z-index:2}.seui-option-handle.hide{display:none}.seui-option-handle-item{color:var(--seui-option-crtl-text-color);cursor:pointer;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.seui-option-handle-item:hover{color:var(--seui-option-crtl-text-color-hover)}.seui-option-view{align-items:center!important;background-color:var(--seui-transparent-color);border:1px solid var(--seui-transparent-color);border-radius:4px;display:flex;flex-direction:row;gap:7px;line-height:normal;padding:5px;position:relative;transition:all .18s;width:auto}.seui-option-view.checked{background-color:var(--seui-chkbox-checked-background-color);border-color:var(--seui-chkbox-checked-border-color)}.seui-option-view>input{display:none}.seui-option-view>label{align-items:center;color:var(--seui-view-text-color);display:flex;font-family:var(--seui-view-text-style);font-size:var(--seui-view-text-size);gap:7px;height:100%;width:100%}.seui-option-view.multiple>label:before{background:var(--seui-chkbox-background-color);border:1px solid var(--seui-chkbox-border-color);border-radius:.2em;content:"";display:block;height:17px;min-height:17px;min-width:17px;transition:all .2s,background .2s ease-in-out;width:17px}.seui-option-view.multiple.checked>label:before{background:var(--seui-chkbox-checked-color) url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNyIgaGVpZ2h0PSIxNyIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xNjggMTIuMzhhMSAxIDAgMCAxLTEuNDE1IDBMMi43NDUgOC4zNjZhMSAxIDAgMCAxIDAtMS40MTNsLjQyLS40MmExIDEgMCAwIDEgMS40MTUgMEw2Ljc1MyA4LjcxYTEgMSAwIDAgMCAxLjQxNSAwbDQuMDgyLTQuMDlhMSAxIDAgMCAxIDEuNDE1IDBsLjQyLjQyYTEgMSAwIDAgMSAwIDEuNDEzeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+) 50% 40% no-repeat;border:1px solid var(--seui-chkbox-checked-color);color:var(--seui-view-background-color)}.seui-option-view>label>div{display:flex;height:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.seui-option-view>label.align-horizontal-left>div{justify-content:flex-start}.seui-option-view>label.align-horizontal-center>div{justify-content:center}.seui-option-view>label.align-horizontal-right>div{justify-content:flex-end}.seui-option-view>label.align-vertical-left>div{align-items:flex-start}.seui-option-view>label.align-vertical-center>div{align-items:center}.seui-option-view>label.align-vertical-right>div{align-items:flex-end}.seui-option-view.hide{display:none}.seui-option-view.highlight{background-color:var(--seui-chkbox-hover-background-color);border-color:var(--seui-chkbox-hover-border-color)}.seui-option-view.highlight.checked{background-color:var(--seui-chkbox-checked-hover-background-color);border-color:var(--seui-chkbox-checked-hover-border-color)}.seui-option-view.has-image{gap:10px}.seui-option-view.has-image.image-top{align-items:center;flex-direction:column;text-align:center}.seui-option-view.has-image.image-right{flex-direction:row-reverse}.seui-option-view.has-image.image-bottom{flex-direction:column-reverse}.seui-option-view .option-image{flex-shrink:0;object-fit:cover}.seui-option-view.multiple.has-image>label:before{display:none;order:-1}.seui-accessorybox{display:flex;flex-direction:row;flex-wrap:wrap;gap:2px;max-height:var(--seui-accessory-max-height);max-width:var(--seui-accessory-max-width);overflow-y:scroll;padding:var(--seui-accessory-padding)}.accessory-item{align-items:center;background:var(--seui-accessory-item-background);border-color:var(--seui-accessory-item-border-color);border-radius:var(--seui-accessory-item-border-radius);border-style:var(--seui-accessory-item-border-style);border-width:var(--seui-accessory-item-border-width);display:flex;font-size:var(--seui-accessory-item-font-size);gap:var(--seui-accessory-item-gap);overflow:hidden;padding:var(--seui-accessory-item-padding)}.accessory-item>.accessory-item-button{border-color:var(--seui-accessory-item-button-border-color);border-radius:var(--seui-accessory-item-button-border-radius);border-style:var(--seui-accessory-item-button-border-style);border-width:var(--seui-accessory-item-button-border-width);color:var(--seui-accessory-item-button-color);cursor:pointer;font-weight:700;height:var(--seui-accessory-item-button-height);min-height:var(--seui-accessory-item-button-height);min-width:var(--seui-accessory-item-button-width);position:relative;width:var(--seui-accessory-item-button-width)}.accessory-item>.accessory-item-button:after{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cg fill='%234c4c4c' transform='rotate(45 8 8)'%3E%3Crect width='7.762' height='1.411' x='4.119' y='7.294' rx='1'/%3E%3Crect width='11' height='2' x='.206' y='4.706' rx='1' transform='rotate(90 4.026 8) scale(.70565)'/%3E%3C/g%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;content:"";display:block;height:100%;position:absolute;width:100%}.accessory-item>.accessory-item-content{color:var(--seui-accessory-item-content-color);font-size:var(--seui-accessory-item-content-font-size);overflow:hidden;padding:var(--seui-accessory-item-content-padding);text-overflow:ellipsis;white-space:nowrap}
Binary file