@zeyos/zx 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +598 -0
- package/README.md +288 -0
- package/dist/zx-compat.esm.js +16880 -0
- package/dist/zx-compat.esm.min.js +1 -0
- package/dist/zx-compat.global.js +23068 -0
- package/dist/zx-compat.global.min.js +3 -0
- package/dist/zx-zeyos.esm.js +11581 -0
- package/dist/zx-zeyos.esm.min.js +1 -0
- package/dist/zx.css +4946 -0
- package/dist/zx.esm.js +19934 -0
- package/dist/zx.esm.min.js +3 -0
- package/dist/zx.global.js +19958 -0
- package/dist/zx.global.min.js +3 -0
- package/dist/zx.min.css +1 -0
- package/docs/api.json +5248 -0
- package/docs/llms.md +1315 -0
- package/docs/llms.txt +45 -0
- package/package.json +74 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(()=>{var Ua=Object.defineProperty;var Wa=(i,t)=>{for(var e in t)Ua(i,e,{get:t[e],enumerable:!0})};var Nr={};Wa(Nr,{Breadcrumb:()=>ks,CheckButton:()=>st,Checklist:()=>U,Component:()=>p,ContextMenu:()=>Ms,CopyInput:()=>_s,DataFilter:()=>he,DatePicker:()=>Q,DateRangeBox:()=>Zt,DateRangePicker:()=>Qt,DateTimeBox:()=>ts,Datebox:()=>V,Dialog:()=>lt,Dropdown:()=>ht,Field:()=>x,FieldUpload:()=>vt,Fieldset:()=>gt,Finder:()=>Fs,Form:()=>ue,Groupbox:()=>ct,Http:()=>et,InlineLoading:()=>fs,MasterPanel:()=>ne,MenuButton:()=>W,Message:()=>_t,Modal:()=>ee,MonthPicker:()=>yt,MultiValueEditor:()=>wt,NavigationBar:()=>oe,NumberField:()=>St,Pagination:()=>Ns,Panel:()=>re,Permission:()=>le,ProgressBar:()=>ds,Rating:()=>Jt,Search:()=>kt,Select:()=>I,Slider:()=>Xt,SplitView:()=>ws,Stepper:()=>zs,Tabbox:()=>Ct,Table:()=>pt,TagPicker:()=>te,TimePicker:()=>X,Timebox:()=>J,Toggle:()=>P,Toolbar:()=>bs,Tooltip:()=>ae,TreeView:()=>Os,ValueList:()=>zt,addDays:()=>A,addMonths:()=>dt,aspect:()=>$o,badge:()=>Fo,badgeGroup:()=>Lo,breakpointOf:()=>es,breakpoints:()=>ss,button:()=>K,buttonGroup:()=>hs,clamp:()=>B,clampDate:()=>$e,clampRange:()=>Gt,clampSize:()=>Tt,configureIcons:()=>ve,copyButton:()=>ms,copyToClipboard:()=>os,debounce:()=>qr,deepMerge:()=>Ht,defaultDateRangePresets:()=>er,defineElements:()=>Mo,describe:()=>ca,downloadBlob:()=>wo,emptyState:()=>Vo,escapeRegExp:()=>qt,faFamilies:()=>Ki,faIconClasses:()=>ye,faNames:()=>Yi,faStyles:()=>Ke,focusTrap:()=>Un,formatCurrency:()=>po,formatDate:()=>w,formatFileSize:()=>_o,formatNumber:()=>ke,formatPercent:()=>mo,formatRangeText:()=>ir,formatRelativeTime:()=>go,getIconConfig:()=>We,getLanguage:()=>G,getWeekStart:()=>Kt,grid:()=>qo,groupBy:()=>Kr,h:()=>a,highlightMatch:()=>Gr,htmlEscape:()=>je,icon:()=>_,iconNames:()=>xn,icons:()=>Yt,isElement:()=>E,isSameDay:()=>M,isTruncated:()=>pr,joinTime:()=>or,kitUrl:()=>xe,loadFontAwesome:()=>bn,loadFontAwesomeKit:()=>Ue,matchBreakpoint:()=>no,normalizeRange:()=>Lt,onBreakpoint:()=>oo,paginationRange:()=>yr,parseDate:()=>j,parseIconSpec:()=>Ye,parseNumber:()=>we,parseRangeText:()=>Xe,parseResult:()=>is,position:()=>q,printf:()=>F,rangeNights:()=>Wt,rangeStateOf:()=>tr,registerFieldAdapters:()=>ba,registerIcons:()=>yn,resolveElement:()=>R,resolveSize:()=>Nt,rovingTabindex:()=>At,setLanguage:()=>Jr,setTranslator:()=>Zr,skeleton:()=>ps,skeletonTable:()=>jo,skeletonText:()=>Bo,snapNumber:()=>Se,snapSize:()=>_r,sortBy:()=>Yr,spinner:()=>us,splitTime:()=>nr,stack:()=>Ho,stepPrecision:()=>rr,storage:()=>ns,throttle:()=>$r,toArray:()=>_e,toCsv:()=>vo,tooltip:()=>la,translate:()=>Y,truncate:()=>Uo,typeahead:()=>Z,uid:()=>b,uniqueBy:()=>Ur,useBuiltinIcons:()=>gn,useFontAwesome:()=>Gi,zeyosService:()=>Rt});function qr(i,t){let e=null;return function(...r){let n=this;e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,i.apply(n,r)},t)}}function $r(i,t,{leading:e=!0,trailing:s=!0}={}){let r=Math.max(0,Number(t)||0),n=null,o=0,l=null,c=null,h=()=>{n=null,o=e?Date.now():0;let u=l,d=c;l=null,c=null,u!==null&&i.apply(d,u)};return function(...d){let m=Date.now();o===0&&!e&&(o=m);let f=r-(m-o);if(f<=0||f>r){n!==null&&(clearTimeout(n),n=null),o=m,l=null,c=null,i.apply(this,d);return}s&&(l=d,c=this,n===null&&(n=setTimeout(h,f)))}}var Br=0;function b(i="zx"){return Br+=1,`${i}-${Date.now().toString(36)}-${Br.toString(36)}`}function Ht(i,t){let e=me(i)?Wr(i):{};if(!me(t))return Be(t);for(let[s,r]of Object.entries(t))me(r)&&me(e[s])?e[s]=Ht(e[s],r):e[s]=Be(r);return e}function E(i){return!!(i&&typeof i=="object"&&i.nodeType===1)}function B(i,t,e){return Math.min(e,Math.max(t,i))}function _e(i){return i==null?[]:Array.isArray(i)?i.slice():typeof i!="string"&&typeof i[Symbol.iterator]=="function"||typeof i!="string"&&typeof i.length=="number"?Array.from(i):[i]}function Kr(i,t){let e=Pe(t),s=new Map;for(let r of _e(i)){let n=String(e(r)),o=s.get(n);o===void 0?s.set(n,[r]):o.push(r)}return Object.fromEntries(s)}function Yr(i,...t){let e=_e(i),s=t.map(Ga);return s.length===0?e:e.sort((r,n)=>{for(let o of s){let l=o(r,n);if(l!==0)return l}return 0})}function Ur(i,t){let e=t==null?n=>n:Pe(t),s=new Set,r=[];for(let n of _e(i)){let o=e(n);s.has(o)||(s.add(o),r.push(n))}return r}function qt(i){return String(i).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pe(i){if(typeof i=="function")return i;let t=String(i);return e=>e?.[t]}function Ga(i){let t,e=1;if(typeof i=="function")t=i;else if(i!==null&&typeof i=="object")t=Pe(i.key),String(i.dir).toLowerCase()==="desc"&&(e=-1);else{let s=String(i);s.startsWith("-")?(e=-1,s=s.slice(1)):s.startsWith("+")&&(s=s.slice(1)),t=Pe(s)}return(s,r)=>{let n=t(s),o=t(r),l=jr(n),c=jr(o);return l||c?l&&c?0:l?1:-1:e*Qa(n,o)}}function jr(i){return i==null||typeof i=="number"&&Number.isNaN(i)}function Qa(i,t){return i instanceof Date||t instanceof Date?Ri(Hr(i)-Hr(t)):typeof i=="boolean"||typeof t=="boolean"?Ri(Number(i)-Number(t)):typeof i=="number"&&typeof t=="number"?Ri(i-t):String(i).localeCompare(String(t),void 0,{numeric:!0})}function Hr(i){if(i instanceof Date)return i.getTime();let t=Number(i);return Number.isFinite(t)?t:0}function Ri(i){return Number.isNaN(i)?0:i<0?-1:i>0?1:0}function me(i){if(i===null||typeof i!="object")return!1;let t=Object.getPrototypeOf(i);return t===Object.prototype||t===null}function Wr(i){let t={};for(let[e,s]of Object.entries(i))t[e]=Be(s);return t}function Be(i){return me(i)?Wr(i):Array.isArray(i)?i.map(Be):i}var ge=null;function a(i,t,...e){let s=document.createElement(i),r=t;Za(r)||(e.unshift(r),r={});for(let[n,o]of Object.entries(r))Ja(s,n,o);return tl(s,e),s}a.scope=function(t,e){let s=ge;ge=t;try{return e()}finally{ge=s}};a.raw=function(t){let e=document.createElement("template");return e.innerHTML=String(t),e.content};function k(i){return{children:Array.from(i.childNodes),attributes:Array.from(i.attributes,t=>[t.name,t.value])}}function C(i,t){if(t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}}function je(i){return String(i).replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}function Gr(i,t,e={}){let{className:s="zx-mark"}=e,r=i==null?"":String(i),n=t==null?"":String(t).trim(),o=document.createDocumentFragment();if(n===""||r==="")return o.append(document.createTextNode(r)),o;let l=new RegExp(qt(n),"gi"),c=0;for(let h of r.matchAll(l)){h.index>c&&o.append(document.createTextNode(r.slice(c,h.index)));let u=document.createElement("mark");s&&(u.className=String(s)),u.append(document.createTextNode(h[0])),o.append(u),c=h.index+h[0].length}return c<r.length&&o.append(document.createTextNode(r.slice(c))),o}function R(i){if(i==null)return null;if(E(i))return i;if(typeof i=="string")return document.querySelector(i);if(typeof i.toElement=="function"){let t=i.toElement();return E(t)?t:null}return null}function Za(i){return i===null||typeof i!="object"||Array.isArray(i)||typeof i.nodeType=="number"?!1:typeof i.toElement!="function"}function Ja(i,t,e){if(t==="ref"){ge&&typeof e=="string"&&(ge[e]=i);return}if(t==="class"){i.className=Array.isArray(e)?e.flat(1/0).filter(Boolean).join(" "):String(e??"");return}if(t==="style"){if(typeof e=="string")i.style.cssText=e;else if(e&&typeof e=="object")for(let[r,n]of Object.entries(e))r.startsWith("--")||r.includes("-")?i.style.setProperty(r,String(n)):i.style[r]=n;return}if(t==="dataset"&&e&&typeof e=="object"){for(let[r,n]of Object.entries(e))n==null?delete i.dataset[r]:i.dataset[r]=String(n);return}if(/^on[a-z]/.test(t)&&typeof e=="function"){i.addEventListener(t.slice(2),e);return}if(e==null)return;let s=Xa(t);if(s!==null)i.setAttribute(s,String(e));else if(t in i)try{i[t]=e}catch{i.setAttribute(t,String(e))}else typeof e=="boolean"?e?i.setAttribute(t,""):i.removeAttribute(t):i.setAttribute(t,String(e))}function Xa(i){return i.startsWith("aria-")?i:/^aria[A-Z]/.test(i)?"aria-"+i.slice(4).toLowerCase():null}function tl(i,t){for(let e of t.flat(1/0))if(e!=null){if(typeof e=="string"||typeof e=="number")i.append(document.createTextNode(String(e)));else if(e&&typeof e=="object"&&typeof e.nodeType=="number")i.append(e);else if(typeof e=="object"&&typeof e.toElement=="function"){let s=e.toElement();s&&i.append(s)}}}var Pi=null,Qr="en";function Zr(i){if(i!==null&&typeof i!="function")throw new TypeError("Translator must be a function or null");Pi=i}function Jr(i){Qr=String(i||"en")}function G(){return Qr}function Y(i,t){let e=Pi?Pi(i):i;return F(e==null?i:String(e),t)}function F(i,t){if(t==null)return String(i);let e=Array.isArray(t)?t:typeof t=="object"?null:[t],s=String(i).replace(/%(\d+)/g,(n,o)=>{let l=Number(o)-1,c;return e?c=e[l]:Object.prototype.hasOwnProperty.call(t,o)&&(c=t[o]),c==null?n:String(c)}),r=0;return s=s.replace(/%([A-Za-z_][\w.-]*)%/g,(n,o)=>{if(!e&&Object.prototype.hasOwnProperty.call(t,o)){let l=t[o];return l==null?n:String(l)}if(e&&r<e.length){let l=e[r];return r+=1,l==null?n:String(l)}return n}),s}var He=new WeakMap,p=class extends EventTarget{static defaults={};el;refs;options;#t=new AbortController;#e=!1;#s=!1;#i=!1;constructor(t,e={}){super(),this.#e=t===null;let s=R(t);if(t!==null&&!s)throw new TypeError("Component target could not be resolved");this.el=s,this.refs={};let r=el(this.constructor,e),n=[];for(let[c,h]of Object.entries(r))/^on[a-z]/.test(c)&&typeof h=="function"&&(n.push([c.slice(2),h]),delete r[c]);r.msg&&typeof r.msg=="object"&&Object.freeze(r.msg),this.options=Object.freeze(r);for(let[c,h]of n)this.on(c,h);let o;try{o=a.scope(this.refs,()=>this.render())}catch(c){throw this.#t.abort(),c}if(this.#e){let c=E(o)?o:this.el;if(!E(c))throw this.#t.abort(),new TypeError("render() must return an Element (or assign this.el) when target is null");this.el=c}if(!E(this.el))throw this.#t.abort(),new TypeError("Component requires a root Element");let l=this.constructor.cssName;if(typeof l=="string"&&l){let c=`zx-${l}`;this.#i=!this.el.classList.contains(c),this.el.classList.add(c)}He.set(this.el,this)}render(){return this.el??null}on(t,e){return this.addEventListener(t,e,{signal:this.#t.signal}),this}off(t,e){return this.removeEventListener(t,e),this}once(t,e){return this.addEventListener(t,e,{once:!0,signal:this.#t.signal}),this}addEvent(t,e){return this.on(t,e)}emit(t,e={}){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("Event detail must be an object");let s=Xr(t,e,{cancelable:!0});return this.dispatchEvent(s),this.el&&this.el.dispatchEvent(Xr(`zx-${t}`,e,{bubbles:!0,composed:!0,cancelable:!0})),s}listen(t,e,s,r={}){let n=typeof r=="boolean"?{capture:r}:{...r};return t.addEventListener(e,s,{...n,signal:this.#t.signal}),this}toElement(){return this.el}msg(t,...e){let s=this.options.msg,r=this.options.lang??this.options.language??G(),n=s?.[r]?.[t];if(n!=null)return F(String(n),e);let o=s?.[t];return o!=null?F(String(o),e):Y(t,e)}destroy(){if(this.#s)return;this.#s=!0,this.#t.abort(),He.get(this.el)===this&&He.delete(this.el);let t=this.constructor.cssName;this.#i&&typeof t=="string"&&this.el&&this.el.classList.remove(`zx-${t}`),this.#e&&this.el&&this.el.remove()}static from(t){return He.get(t)??null}};function el(i,t){let e=[],s=i;for(;s&&s!==Function.prototype;)Object.prototype.hasOwnProperty.call(s,"defaults")&&e.unshift(s.defaults),s=Object.getPrototypeOf(s);let r={},n={},o=!1;for(let l of e)!l||typeof l!="object"||(Object.assign(r,l),l.msg&&typeof l.msg=="object"&&(o=!0,n=Ht(n,l.msg)));return Object.assign(r,t&&typeof t=="object"?t:{}),t?.msg&&typeof t.msg=="object"&&(o=!0,n=Ht(n,t.msg)),o&&(r.msg=n),r}function Xr(i,t,e){if(typeof CustomEvent=="function")return new CustomEvent(i,{...e,detail:t});let s=new Event(i,e);return Object.defineProperty(s,"detail",{configurable:!0,enumerable:!0,value:t}),s}var x=class i extends p{static cssName="field";static defaults={id:null,type:"text",label:"",description:"",value:void 0,placeholder:"",required:!1,disabled:!1,options:null,layout:"stack",props:{},msg:{"field.int":"Enter a whole number.","field.float":"Enter a valid number.","field.unknown":"Unknown field type: %1"}};static#t=new Map;static register(t,e){let s=String(t).trim().toLowerCase();if(!s)throw new TypeError("Field adapter type must not be empty");if(typeof e!="function")throw new TypeError("Field adapter must be a function");return i.#t.set(s,e),this}static has(t){return i.#t.has(String(t).trim().toLowerCase())}render(){let t=this.el??a("div");this.el=t;let e=String(this.options.type||"text").toLowerCase(),s=this.options.layout==="inline"?"inline":"stack";this._ownedComponents=new Set,this._ownedNodes=[],this._rootAttributes=nl(t,["data-layout","data-field-type","data-disabled","data-state"]),t.dataset.layout=s,t.dataset.fieldType=e,this.controlId=this.options.id?String(this.options.id):b("zx-field");let r=`${this.controlId}-label`,n=`${this.controlId}-description`,o=`${this.controlId}-highlight`,l=a("label",{class:"zx-field__label",id:r,htmlFor:this.controlId},String(this.options.label??""),this.options.required?a("span",{class:"zx-field__required",ariaHidden:"true"}," *"):null),c=a("div",{class:"zx-field__control"}),h=a("div",{class:"zx-field__description",id:n},String(this.options.description??"")),u=a("div",{class:"zx-field__highlight",id:o,ariaLive:"polite",hidden:!0}),d=a("div",{class:"zx-field__body"},c,h,u);this._ownedNodes.push(l,d),t.append(l,d);let m=i.#t.get(e);if(m)try{this.adapter=il(m(this,this.options))}catch(g){let y=g instanceof Error?g.message:String(g);console.warn(`[zx.Field] Adapter "${e}" failed: ${y}`),this.adapter=en(y,this.controlId)}else{let g=this.msg("field.unknown",e);console.warn(`[zx.Field] ${g}`),this.adapter=en(g,this.controlId)}let f=this.adapter.el;return f.id||(f.id=this.controlId),l.htmlFor=f.id,rl(f)||f.setAttribute("aria-labelledby",r),this._baseDescribedBy=f.getAttribute("aria-describedby")??"",c.append(f),this._descriptionId=String(this.options.description??"")?n:"",this._highlightId=o,this._highlight=u,this._syncDescription(),this.initialValue=sl(e,this.options.value),this.adapter.set(this.initialValue,{silent:!0}),this.setDisabled(!!this.options.disabled),this.listen(f,"change",()=>{this.emit("change",{value:this.getValue()})}),t}getValue(){return this.adapter.get()}setValue(t,{silent:e=!1}={}){return this.adapter.set(t,{silent:e}),e||this.emit("change",{value:this.getValue()}),this}focus(){return this.adapter.focus(),this}reset(){return this.setValue(this.initialValue,{silent:!0}),this.clearHighlight(),this}setDisabled(t){let e=!!t;return this.adapter.setDisabled(e),this.el.dataset.disabled=String(e),this}setHighlight(t,e="danger"){if(!t)return this.clearHighlight();let s=["danger","warning","success"].includes(e)?e:"danger";return this.el.dataset.state=s,this._highlight.textContent=String(t??""),this._highlight.hidden=!t,s==="danger"&&t?(this._highlight.setAttribute("role","alert"),this.adapter.el.setAttribute("aria-invalid","true"),this.emit("invalid",{message:String(t)})):(this._highlight.removeAttribute("role"),this.adapter.el.removeAttribute("aria-invalid")),this._syncDescription(!!t),this}clearHighlight(){return delete this.el.dataset.state,this._highlight.textContent="",this._highlight.hidden=!0,this._highlight.removeAttribute("role"),this.adapter.el.removeAttribute("aria-invalid"),this._syncDescription(!1),this}getInput(){return this.adapter.el}own(t){if(!(t instanceof p))throw new TypeError("Field.own() requires a Component");return this._ownedComponents.add(t),t}_syncDescription(t=!1){let e=[this._baseDescribedBy,this._descriptionId,t?this._highlightId:""].flatMap(s=>s.split(/\s+/)).filter(Boolean);e.length?this.adapter.el.setAttribute("aria-describedby",[...new Set(e)].join(" ")):this.adapter.el.removeAttribute("aria-describedby")}destroy(){this.adapter?.destroy?.();for(let t of this._ownedComponents??[])t.destroy();this._ownedComponents?.clear();for(let t of this._ownedNodes??[])t.remove();ol(this.el,this._rootAttributes??new Map),super.destroy()}};function Bi(i){if(typeof i=="number")return Number.isInteger(i)?{valid:!0,value:i}:{valid:!1,value:String(i)};let t=String(i??"").trim();if(t==="")return{valid:!0,value:""};let e=rn(t);return e!==null&&Number.isInteger(e)?{valid:!0,value:e}:{valid:!1,value:t}}function ji(i){if(typeof i=="number")return Number.isFinite(i)?{valid:!0,value:i}:{valid:!1,value:String(i)};let t=String(i??"").trim();if(t==="")return{valid:!0,value:""};let e=rn(t);return e!==null?{valid:!0,value:e}:{valid:!1,value:t}}function rn(i){let t=i.replace(/[\s\u00a0]/g,"");if(!/^[+-]?[\d.,]+$/.test(t))return null;let e=/^[+-]/.test(t)?t[0]:"",s=e?t.slice(1):t;if(!/\d/.test(s))return null;let r=[...s.matchAll(/\./g)].map(c=>c.index),n=[...s.matchAll(/,/g)].map(c=>c.index),o;if(r.length&&n.length){let c=r.at(-1)>n.at(-1)?".":",",h=c==="."?",":".",u=s.lastIndexOf(c),d=s.slice(0,u),m=s.slice(u+1);if(!/^\d+$/.test(m)||!tn(d,h))return null;o=d.split(h).join("")+"."+m}else if(n.length>1||r.length>1){let c=n.length?",":".";if(!tn(s,c))return null;o=s.split(c).join("")}else n.length===1?o=s.replace(",","."):o=s;if(!/^(?:\d+(?:\.\d+)?|\.\d+)$/.test(o))return null;let l=Number(e+o);return Number.isFinite(l)?l:null}function tn(i,t){let e=i.split(t);return e.length>0&&/^\d{1,3}$/.test(e[0])&&e.slice(1).every(s=>/^\d{3}$/.test(s))}function sl(i,t){return t!==void 0?t:i==="checkbox"?!1:""}function il(i){if(!i||typeof i!="object")throw new TypeError("Adapter must return an object");if(!(i.el&&i.el.nodeType===1))throw new TypeError("Adapter must provide an Element");for(let t of["get","set","focus","setDisabled"])if(typeof i[t]!="function")throw new TypeError(`Adapter is missing ${t}()`);return i}function en(i,t){let e=a("div",{class:"zx-field__error-control",id:t,role:"alert",tabIndex:-1},i);return{el:e,get:()=>null,set:()=>{},focus:()=>e.focus(),setDisabled:()=>{}}}function rl(i){return["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"].includes(i.tagName)}function nl(i,t){return new Map(t.map(e=>[e,i.getAttribute(e)]))}function ol(i,t){for(let[e,s]of t)s===null?i.removeAttribute(e):i.setAttribute(e,s)}function be(i,t){let e={...i.props??{}};for(let s of Object.keys(e))(/^on[a-z]/i.test(s)||s==="content")&&delete e[s];return{...e,...t}}function qe(i,t){return(e,s)=>{let r=a(i,be(s,{type:i==="input"?t:void 0,placeholder:s.placeholder,required:s.required,disabled:s.disabled}));return Hi(r)}}function Hi(i){return{el:i,get:()=>i.value,set:t=>{i.value=t==null?"":String(t)},focus:()=>i.focus(),setDisabled:t=>{i.disabled=t}}}function nn(i){return(t,e)=>{let s=i==="int"?Bi:ji,r=a("input",be(e,{type:"text",inputMode:i==="int"?"numeric":"decimal",placeholder:e.placeholder,required:e.required,disabled:e.disabled}));return t.listen(r,"blur",()=>{let n=s(r.value);if(!n.valid){t.setHighlight(t.msg(`field.${i}`),"danger");return}n.value!==""&&(r.value=String(n.value)),t.clearHighlight()}),{...Hi(r),get:()=>s(r.value).value}}}var al=(i,t)=>{let e=a("input",be(t,{type:"checkbox",required:t.required,disabled:t.disabled}));return{el:e,get:()=>e.checked,set:s=>{e.checked=!!s},focus:()=>e.focus(),setDisabled:s=>{e.disabled=s}}},ll=(i,t)=>{let e=a("select",be(t,{required:t.required,disabled:t.disabled}));for(let[s,r]of on(t.options))e.append(a("option",{value:s},r));return Hi(e)},cl=(i,t)=>{let e=a("div",{class:"zx-field__option-list",role:"radiogroup"}),s=t.id?String(t.id):b("zx-option-list"),r=on(t.options).map(([n,o],l)=>{let c=a("input",{type:"radio",name:s,value:n,required:!!t.required&&l===0,disabled:t.disabled});return e.append(a("label",{class:"zx-field__option"},c,a("span",{},o))),c});return{el:e,get:()=>r.find(n=>n.checked)?.value??"",set:n=>{for(let o of r)o.checked=String(n??"")===o.value},focus:()=>(r.find(n=>n.checked)??r[0])?.focus(),setDisabled:n=>{for(let o of r)o.disabled=n;e.setAttribute("aria-disabled",String(n))}}},hl=(i,t)=>{let e=a("div",be(t,{class:"zx-field__static"})),s=null;return{el:e,get:()=>e.textContent,set:n=>{sn(s),s=null,n&&typeof n=="object"&&typeof n.nodeType=="number"?(s={node:n,parent:n.parentNode,next:n.nextSibling},e.replaceChildren(n)):e.textContent=n==null?"":String(n)},focus:()=>{},setDisabled:n=>{e.setAttribute("aria-disabled",String(n))},destroy:()=>sn(s)}};function sn(i){i&&(i.parent?i.parent.insertBefore(i.node,i.next?.parentNode===i.parent?i.next:null):i.node.remove())}var ul=(i,t)=>{if(typeof t.adapter!="function")throw new TypeError("Custom fields require options.adapter");return t.adapter(i,t)};function on(i){return Array.isArray(i)?i.map(t=>[String(t),String(t)]):i&&typeof i=="object"?Object.entries(i).map(([t,e])=>[t,String(e)]):[]}x.register("text",qe("input","text"));x.register("password",qe("input","password"));x.register("textarea",qe("textarea","text"));x.register("checkbox",al);x.register("int",nn("int"));x.register("float",nn("float"));x.register("select",ll);x.register("optionlist",cl);x.register("hidden",qe("input","hidden"));x.register("html",hl);x.register("custom",ul);function It(i,t,e){let s=an(t).split(/\s+/).filter(Boolean);return s.length===0?i.slice():i.filter(r=>{let n=dl(r,e).map(an);return s.every(o=>n.some(l=>l.includes(o)))})}function dl(i,t){return i===null||typeof i!="object"?[i]:!Array.isArray(t)||t.length===0?[i]:t.map(e=>typeof e=="function"?e(i):i[e])}function an(i){return String(i??"").normalize("NFD").replace(/\p{M}+/gu,"").toLocaleLowerCase()}var U=class extends p{static cssName="checklist";static defaults={items:[],valueKey:"ID",labelKey:"name",checkedKey:"on",search:!0,height:280,defaultChecked:!1,load:null};render(){this._items=[],this._visibleItems=[],this._checked=new Set,this._query="",this._loadSequence=0,this._createdRoot=!1,this._active=!0,this._originalChildren=[],this._originalAttributes=new Map,this._createdRoot=this.el===null;let t=this.el??a("div");this.el=t,this._createdRoot||(this._originalChildren=Array.from(t.childNodes));for(let o of["role","aria-labelledby","data-state"])this._originalAttributes.set(o,t.getAttribute(o));let e=b("zx-checklist-label"),s=a("div",{class:"zx-checklist__label",id:e},this._message("checklist.label","Checklist")),r=a("input",{ref:"search",class:"zx-checklist__search",type:"search",autocomplete:"off",placeholder:this._message("checklist.search","Search"),ariaLabel:this._message("checklist.search","Search checklist"),hidden:!this.options.search}),n=a("div",{ref:"list",class:"zx-checklist__list"});return n.style.maxBlockSize=`${Math.max(0,Number(this.options.height)||0)}px`,t.replaceChildren(s,r,n),t.setAttribute("role","group"),t.setAttribute("aria-labelledby",e),this.listen(r,"input",()=>this.search(r.value)),this.listen(n,"change",o=>{let l=o.target;if(!l?.matches?.('input[type="checkbox"][data-index]'))return;let c=this._visibleItems[Number(l.dataset.index)];if(c===void 0)return;let h=this._itemValue(c);l.checked?this._checked.add(h):this._checked.delete(h),this.emit("change",{values:this.getValues()})}),this._replaceItems(this.options.items),typeof this.options.load=="function"&&queueMicrotask(()=>{this._active&&this.reload().catch(()=>{})}),t}setItems(t){return this._replaceItems(t),this}getValues(){return this._items.map(t=>this._itemValue(t)).filter(t=>this._checked.has(t))}setValues(t){let e=new Set(t==null?[]:Array.from(t)),s=new Set(this._items.map(r=>this._itemValue(r)).filter(r=>e.has(r)));return this._replaceChecked(s),this}checkAll(){return this._replaceChecked(new Set(this._items.map(t=>this._itemValue(t)))),this}uncheckAll(){return this._replaceChecked(new Set),this}search(t){this._query=String(t??"");let e=this.refs.search;return e.value!==this._query&&(e.value=this._query),this._visibleItems=It(this._items,this._query,[this.options.labelKey]),this._renderItems(),this}async reload(){if(!this._active||typeof this.options.load!="function")return this;let t=++this._loadSequence;this.el.setAttribute("data-state","loading"),this.refs.list.setAttribute("aria-busy","true");try{let e=await this.options.load();if(t!==this._loadSequence)return this;this._replaceItems(e),this.emit("loaded",{items:this._items.slice()})}finally{t===this._loadSequence&&(this.el.removeAttribute("data-state"),this.refs.list.setAttribute("aria-busy","false"))}return this}destroy(){this._active=!1,this._loadSequence+=1;let t=this.el;if(!this._createdRoot&&t){t.replaceChildren(...this._originalChildren);for(let[e,s]of this._originalAttributes)s===null?t.removeAttribute(e):t.setAttribute(e,s)}super.destroy()}_replaceItems(t){this._items=Array.isArray(t)?t.slice():[],this._checked=new Set(this._items.filter(e=>!!this._initialChecked(e)).map(e=>this._itemValue(e))),this._visibleItems=It(this._items,this._query,[this.options.labelKey]),this._renderItems()}_renderItems(){if(!this.refs.list)return;let t=this._visibleItems.map((e,s)=>{let r=b("zx-checklist-item"),n=a("input",{type:"checkbox",id:r,checked:this._checked.has(this._itemValue(e)),dataset:{index:s}});return a("label",{class:"zx-checklist__item",for:r},n,a("span",{},this._itemLabel(e)))});t.length===0&&t.push(a("div",{class:"zx-checklist__empty",role:"status"},this._message("checklist.empty","No matches"))),this.refs.list.replaceChildren(...t)}_replaceChecked(t){fl(this._checked,t)||(this._checked=t,this._renderItems(),this.emit("change",{values:this.getValues()}))}_itemValue(t){return this._read(t,this.options.valueKey)}_itemLabel(t){return String(this._read(t,this.options.labelKey)??"")}_initialChecked(t){let e;return typeof this.options.checkedKey=="function"?e=this.options.checkedKey(t):t!==null&&typeof t=="object"&&(e=t[this.options.checkedKey]),e??this.options.defaultChecked}_read(t,e){return typeof e=="function"?e(t):t===null||typeof t!="object"?t:t[e]}_message(t,e){let s=this.msg(t);return s===t?e:s}};function fl(i,t){return i.size===t.size&&Array.from(i).every(e=>t.has(e))}function ln(){x.register("checklist",(i,t)=>{let e=i.own(new U(null,{...t.props??{}})),s=!1,r=!1,n=()=>{e.el.setAttribute("aria-disabled",String(s));for(let o of e.el.querySelectorAll("input, button, select, textarea"))o.disabled=s};return i.listen(e.el,"change",o=>o.stopImmediatePropagation()),e.on("change",o=>{r||i.emit("change",{value:o.detail.values})}),e.on("loaded",n),{el:e.el,get:()=>e.getValues(),set:o=>{r=!0;try{e.setValues(Array.isArray(o)?o:[])}finally{r=!1}n()},focus:()=>{(e.el.querySelector(".zx-checklist__search:not([hidden]):not([disabled])")??e.el.querySelector('input[type="checkbox"]:not([disabled])'))?.focus()},setDisabled:o=>{s=!!o,n()}}})}var cn=["January","February","March","April","May","June","July","August","September","October","November","December"],hn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],fn=/%[demYyHMSaAbBs]/g;function w(i,t){return!(i instanceof Date)||Number.isNaN(i.getTime())?"":String(t).replace(fn,e=>{switch(e){case"%d":return $t(i.getDate());case"%e":return String(i.getDate());case"%m":return $t(i.getMonth()+1);case"%Y":return String(i.getFullYear()).padStart(4,"0");case"%y":return $t(i.getFullYear()%100);case"%H":return $t(i.getHours());case"%M":return $t(i.getMinutes());case"%S":return $t(i.getSeconds());case"%a":return un("weekday",i.getDay(),hn[i.getDay()]);case"%A":return qi("weekday",i.getDay(),hn[i.getDay()]);case"%b":return un("month",i.getMonth(),cn[i.getMonth()]);case"%B":return qi("month",i.getMonth(),cn[i.getMonth()]);case"%s":return String(Math.floor(i.getTime()/1e3));default:return e}})}function j(i,t){let e=[],s="^",r=0;for(let g of String(t).matchAll(fn)){s+=dn(String(t).slice(r,g.index));let y=g[0],z=pl(y);if(z===null)return null;s+=`(${z})`,e.push(y),r=g.index+y.length}s+=dn(String(t).slice(r))+"$";let n=new RegExp(s).exec(String(i));if(!n)return null;let o=Object.create(null);if(e.forEach((g,y)=>{o[g]=Number(n[y+1])}),o["%s"]!==void 0){let g=o["%s"]*1e3,y=new Date(g);return Number.isNaN(y.getTime())?null:y}let l=o["%Y"]??ml(o["%y"])??1970,c=(o["%m"]??1)-1,h=o["%d"]??o["%e"]??1,u=o["%H"]??0,d=o["%M"]??0,m=o["%S"]??0,f=new Date(0);return f.setHours(0,0,0,0),f.setFullYear(l,c,h),f.setHours(u,d,m,0),Number.isNaN(f.getTime())||o["%Y"]!==void 0&&f.getFullYear()!==o["%Y"]||o["%y"]!==void 0&&f.getFullYear()%100!==o["%y"]||o["%m"]!==void 0&&f.getMonth()!==c||o["%d"]!==void 0&&f.getDate()!==h||o["%e"]!==void 0&&f.getDate()!==h||o["%H"]!==void 0&&f.getHours()!==u||o["%M"]!==void 0&&f.getMinutes()!==d||o["%S"]!==void 0&&f.getSeconds()!==m?null:f}function $e(i,t,e){let s=i.getTime(),r=t instanceof Date?t.getTime():-1/0,n=e instanceof Date?e.getTime():1/0;return new Date(Math.min(n,Math.max(r,s)))}function M(i,t){return i.getFullYear()===t.getFullYear()&&i.getMonth()===t.getMonth()&&i.getDate()===t.getDate()}function A(i,t){let e=new Date(i.getTime());return e.setDate(e.getDate()+t),e}function dt(i,t){let e=new Date(i.getTime()),s=e.getDate();e.setDate(1),e.setMonth(e.getMonth()+t);let r=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return e.setDate(Math.min(s,r)),e}function Kt(i=G()){if(!i||i.toLowerCase()==="en")return 1;try{let t=new Intl.Locale(i),e=t.getWeekInfo?.()??t.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 1}function $t(i){return String(i).padStart(2,"0")}function qi(i,t,e){let s=`date.${i}.${t}`,r=Y(s);return r===s?e:r}function un(i,t,e){let s=`date.${i}.short.${t}`,r=Y(s);return r!==s?r:qi(i,t,e).slice(0,3)}function pl(i){return{"%d":"\\d{1,2}","%e":"\\d{1,2}","%m":"\\d{1,2}","%Y":"\\d{4}","%y":"\\d{2}","%H":"\\d{1,2}","%M":"\\d{1,2}","%S":"\\d{1,2}","%s":"-?\\d+"}[i]??null}function ml(i){if(i!==void 0)return i>=69?1900+i:2e3+i}function dn(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ke=Object.freeze({solid:"fa-solid",regular:"fa-regular",light:"fa-light",thin:"fa-thin",duotone:"fa-duotone",brands:"fa-brands",kit:"fa-kit"}),Ki=Object.freeze({classic:"",sharp:"fa-sharp","sharp-duotone":"fa-sharp-duotone"}),pn=Object.freeze({fa:null,fas:"solid",far:"regular",fal:"light",fat:"thin",fad:"duotone",fab:"brands",fak:"kit",solid:"solid",regular:"regular",light:"light",thin:"thin",duotone:"duotone",brands:"brands",kit:"kit",custom:"kit"}),Yi=Object.freeze({x:"xmark",search:"magnifying-glass",calendar:"calendar-days",reload:"arrows-rotate",dots:"ellipsis",info:"circle-info",warning:"triangle-exclamation",error:"circle-exclamation",success:"circle-check",drag:"grip-vertical"}),$i=new Map;function Ye(i){let t=String(i).trim();if(/\s/.test(t)||t.startsWith("fa-"))return{provider:"fa",name:"",style:null,classes:t.split(/\s+/).filter(Boolean)};let e=t.indexOf(":");if(e>0){let s=t.slice(0,e).toLowerCase(),r=t.slice(e+1);if(s==="builtin"||s==="zx")return{provider:"builtin",name:r,style:null,classes:null};if(Object.hasOwn(pn,s))return{provider:"fa",name:r,style:pn[s],classes:null}}return{provider:null,name:t,style:null,classes:null}}function ye(i,t={}){let{style:e="solid",family:s="classic",fixedWidth:r=!1,translate:n=!0}=t,o=String(i).replace(/^fa-/,""),l=n?Yi[o]??o:o,c=[],h=Ki[s];return h&&c.push(h),c.push(Ke[e]??Ke.solid,`fa-${l}`),r&&c.push("fa-fw"),c}function xe(i){let t=String(i).trim();if(/^(https?:)?\/\//.test(t)||t.startsWith("/")||t.endsWith(".js"))return t;if(!/^[a-z0-9]+$/.test(t))throw new RangeError(`Invalid Font Awesome kit token: ${i}`);return`https://kit.fontawesome.com/${t}.js`}function Ue(i){let t=xe(i),e=$i.get(t);if(e)return e;let s=new Promise((r,n)=>{let o=new URL(t,document.baseURI).href,l=[...document.scripts].find(h=>h.src===o);if(l&&globalThis.FontAwesomeKitConfig){r();return}let c=l??document.createElement("script");c.addEventListener("load",()=>r(),{once:!0}),c.addEventListener("error",()=>{$i.delete(t),n(new Error(`Font Awesome kit failed to load: ${t}`))},{once:!0}),!l&&(c.src=t,c.async=!0,c.crossOrigin="anonymous",document.head.append(c))});return $i.set(t,s),s}var mn="http://www.w3.org/2000/svg",Yt=Object.freeze({"chevron-down":["0 0 512 512","M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"],"chevron-up":["0 0 512 512","M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"],"chevron-left":["0 0 320 512","M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"],"chevron-right":["0 0 320 512","M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"],check:["0 0 448 512","M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"],x:["0 0 384 512","M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"],plus:["0 0 448 512","M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z"],minus:["0 0 448 512","M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z"],search:["0 0 512 512","M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"],calendar:["0 0 448 512","M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3 32 32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-32 32-32zM0 192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192z"],clock:["0 0 512 512","M256 0a256 256 0 1 1 0 512A256 256 0 1 1 256 0zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"],trash:["0 0 448 512","M135.2 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8c-12.1 0-23.2 6.8-28.6 17.7zM416 128H32L53.2 467c1.6 25.3 22.6 45 47.9 45H346.9c25.3 0 46.3-19.7 47.9-45L416 128z"],gear:["0 0 512 512","M481.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z"],eye:["0 0 576 512","M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM144 256a144 144 0 1 1 288 0 144 144 0 1 1-288 0zm144-64c0 35.3-28.7 64-64 64c-7.1 0-13.9-1.2-20.3-3.3c-5.5-1.8-11.9 1.6-11.7 7.4c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3z"],lock:["0 0 448 512","M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z"],reload:["0 0 512 512","M386.3 160H336c-17.7 0-32 14.3-32 32s14.3 32 32 32H464c17.7 0 32-14.3 32-32V64c0-17.7-14.3-32-32-32s-32 14.3-32 32v51.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0s-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3s163.8-62.5 226.3 0L386.3 160z"],list:["0 0 512 512","M40 48C26.7 48 16 58.7 16 72v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V72c0-13.3-10.7-24-24-24H40zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zM16 232v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V232c0-13.3-10.7-24-24-24H40c-13.3 0-24 10.7-24 24zM40 368c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24H88c13.3 0 24-10.7 24-24V392c0-13.3-10.7-24-24-24H40z"],filter:["0 0 512 512","M3.9 54.9C10.5 40.9 24.5 32 40 32H472c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9V448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6V320.9L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z"],dots:["0 0 448 512","M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1-112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"],info:["0 0 512 512","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"],warning:["0 0 512 512","M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0-64 0 32 32 0 1 0 64 0z"],error:["0 0 512 512","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1-64 0z"],success:["0 0 512 512","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"],upload:["0 0 512 512","M288 109.3V352c0 17.7-14.3 32-32 32s-32-14.3-32-32V109.3l-73.4 73.4c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l128-128c12.5-12.5 32.8-12.5 45.3 0l128 128c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L288 109.3zM64 352H192c0 35.3 28.7 64 64 64s64-28.7 64-64H448c35.3 0 64 28.7 64 64v32c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V416c0-35.3 28.7-64 64-64z"],drag:["0 0 320 512","M40 352l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zm192 0l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 176l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zm192 0l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40zM40 0L88 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40L40 128C17.9 128 0 110.1 0 88L0 40C0 17.9 17.9 0 40 0zM232 0l48 0c22.1 0 40 17.9 40 40l0 48c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-48c0-22.1 17.9-40 40-40z"],star:["0 0 576 512","M287.9 0c9.2 0 17.6 5.2 21.6 13.5l68.6 141.3 153.2 22.6c9 1.3 16.5 7.6 19.3 16.3s.5 18.1-5.9 24.5L433.6 328.4l26.2 155.6c1.5 9-2.2 18.1-9.7 23.5s-17.3 6-25.3 1.7l-137-73.2L151 509.1c-8.1 4.3-17.9 3.7-25.3-1.7s-11.2-14.5-9.7-23.5l26.2-155.6L31.1 218.2c-6.5-6.4-8.7-15.9-5.9-24.5s10.3-14.9 19.3-16.3l153.2-22.6L266.3 13.5C270.4 5.2 278.7 0 287.9 0z"],heart:["0 0 512 512","M47.6 300.4L228.3 469.1c7.5 7 17.4 10.9 27.7 10.9s20.2-3.9 27.7-10.9L464.4 300.4c30.4-28.3 47.6-68 47.6-109.5v-5.8c0-69.9-50.5-129.5-119.4-141C347 36.5 300.6 51.4 268 84L256 96 244 84c-32.6-32.6-79-47.5-124.6-39.9C50.5 55.6 0 115.2 0 185.1v5.8c0 41.5 17.2 81.2 47.6 109.5z"],tag:["0 0 448 512","M0 80V229.5c0 17 6.7 33.3 18.7 45.3l176 176c25 25 65.5 25 90.5 0L418.7 317.3c25-25 25-65.5 0-90.5l-176-176c-12-12-28.3-18.7-45.3-18.7H48C21.5 32 0 53.5 0 80zm112 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"],folder:["0 0 512 512","M64 480H448c35.3 0 64-28.7 64-64V160c0-35.3-28.7-64-64-64H298.5c-17 0-33.3-6.7-45.3-18.7L226.7 50.7c-12-12-28.3-18.7-45.3-18.7H64C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64z"],"folder-open":["0 0 576 512","M88.7 223.8L0 375.8V96C0 60.7 28.7 32 64 32H181.5c17 0 33.3 6.7 45.3 18.7l26.5 26.5c12 12 28.3 18.7 45.3 18.7H416c35.3 0 64 28.7 64 64v32H144c-22.8 0-43.8 12.1-55.3 31.8zm27.6 16.1C122.1 230 132.6 224 144 224H544c11.5 0 22 6.1 27.7 16.1s5.7 22.2-.1 32.1l-112 192C453.9 474 443.4 480 432 480H32c-11.5 0-22-6.1-27.7-16.1s-5.7-22.2 .1-32.1l112-192z"],file:["0 0 384 512","M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128z"],copy:["0 0 448 512","M208 0L332.1 0c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9L448 336c0 26.5-21.5 48-48 48l-192 0c-26.5 0-48-21.5-48-48l0-288c0-26.5 21.5-48 48-48zM48 128l80 0 0 64-64 0 0 256 192 0 0-32 64 0 0 48c0 26.5-21.5 48-48 48L48 512c-26.5 0-48-21.5-48-48L0 176c0-26.5 21.5-48 48-48z"],square:["0 0 448 512","M384 80c8.8 0 16 7.2 16 16V416c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V96c0-8.8 7.2-16 16-16H384zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"],code:["0 0 640 512","M392.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm80.6 120.1c-12.5 12.5-12.5 32.8 0 45.3L562.7 256l-89.4 89.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l112-112c12.5-12.5 12.5-32.8 0-45.3l-112-112c-12.5-12.5-32.8-12.5-45.3 0zm-306.7 0c-12.5-12.5-32.8-12.5-45.3 0l-112 112c-12.5 12.5-12.5 32.8 0 45.3l112 112c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256l89.4-89.4c12.5-12.5 12.5-32.8 0-45.3z"],book:["0 0 448 512","M96 0C43 0 0 43 0 96V416c0 53 43 96 96 96H384h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V384c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32H384 96zm0 384H352v64H96c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16zm16 48H336c8.8 0 16 7.2 16 16s-7.2 16-16 16H144c-8.8 0-16-7.2-16-16s7.2-16 16-16z"]}),_l=Object.freeze({settings:"gear",clear:"x",checked:"check",question:"info",range:"filter",fields:"list"}),Wi=Object.create(null),ft={provider:"builtin",style:"solid",family:"classic",fixedWidth:!1,kit:null};function We(){return{...ft}}function ve(i={}){for(let t of["provider","style","family","fixedWidth","kit"])i[t]!==void 0&&(ft[t]=i[t]);return We()}function Gi(i={}){return ve({...i,provider:"fontawesome"})}function gn(){return ve({provider:"builtin"})}async function bn(i){let t=typeof i=="string"?{kit:i}:{...i},{kit:e,activate:s=!0,...r}=t;if(!e)throw new TypeError("loadFontAwesome() needs a kit token or URL");return ve({...r,kit:xe(e)}),await Ue(e),s?Gi():We()}function yn(i){for(let[t,e]of Object.entries(i)){if(!Array.isArray(e)||e.length!==2)throw new TypeError(`Icon "${t}" must be a [viewBox, path] pair`);Wi[t]=[String(e[0]),String(e[1])]}}function xn(){return[...new Set([...Object.keys(Yt),...Object.keys(Wi)])].sort()}function _(i,t={}){let e=Ye(i);if(e.classes)return Ui(e.classes,t);let s=_l[e.name]??e.name;return e.provider==="builtin"?_n(s,t):e.provider==="fa"?Ui(ye(s,{style:e.style??t.style??ft.style,family:t.family??ft.family,fixedWidth:t.fixedWidth??ft.fixedWidth}),t):ft.provider==="fontawesome"?Ui(ye(s,{style:t.style??ft.style,family:t.family??ft.family,fixedWidth:t.fixedWidth??ft.fixedWidth}),t):_n(s,t)}function _n(i,t){let e=Wi[i]??Yt[i];if(!e)throw new RangeError(`Unknown icon: ${i}`);let[s,r]=e,{size:n=16}=t,o=document.createElementNS(mn,"svg"),l=document.createElementNS(mn,"path");return o.setAttribute("class",wn("zx-icon",t.class)),o.setAttribute("viewBox",s),o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.setAttribute("fill","currentColor"),o.setAttribute("focusable","false"),vn(o,t.label??null),l.setAttribute("d",r),o.append(l),o}function Ui(i,t){let{size:e=16}=t,s=document.createElement("i");return s.className=wn("zx-icon",...i,t.class),s.style.fontSize=typeof e=="number"?`${e}px`:String(e),vn(s,t.label??null),s}function vn(i,t){if(t===null){i.setAttribute("aria-hidden","true");return}i.setAttribute("role","img"),i.setAttribute("aria-label",t)}function wn(...i){return i.flat().filter(Boolean).join(" ")}var gl=5,X=class extends p{static cssName="time-picker";static defaults={value:null,seconds:!1,step:5,clock:!0};render(){let t=this.el??a("div");this.el=t;let e=Sn(this.options.value);this._value=e,this._display=e??{h:0,m:0,s:0},this._inputs=[],this._clockOpen=!1,this._clockUnit="h",this._clock=null;let s=a("div",{class:"zx-time-picker__segments",role:"group",ariaLabel:"Time"});if(this._content=s,this._addSpin(s,"h","Hour",23),s.append(a("span",{class:"zx-time-picker__separator",ariaHidden:"true"},":")),this._addSpin(s,"m","Minute",59),this.options.seconds&&(s.append(a("span",{class:"zx-time-picker__separator",ariaHidden:"true"},":")),this._addSpin(s,"s","Second",59)),t.append(s),this.options.clock){let r=b("zx-time-picker-clock");s.append(a("button",{ref:"clockToggle",class:"zx-icon-btn zx-time-picker__clock-toggle",type:"button",ariaLabel:"Pick the time on a clock",ariaExpanded:"false",ariaControls:r},_("clock",{size:15}))),this._clock=this._buildClock(r),t.append(this._clock),this.listen(this.refs.clockToggle,"click",()=>this.toggleClock())}return this._writeInputs(),t}get(){return this._value?{...this._value}:null}set(t,{silent:e=!1}={}){let s=Sn(t);return this._value=s,this._display=s??{h:0,m:0,s:0},this._writeInputs(),!e&&s&&this.emit("change",{time:{...s}}),this}openClock(t="h"){return this._clock?(this._clockOpen=!0,this._clockUnit=t==="m"?"m":"h",this._syncClock(),this):this}closeClock(){return this._clock?(this._clockOpen=!1,this._syncClock(),this):this}toggleClock(){return this._clockOpen?this.closeClock():this.openClock("h")}destroy(){this._content?.remove(),this._clock?.remove(),this._clock=null,super.destroy()}_addSpin(t,e,s,r){let n=a("input",{class:"zx-time-picker__spin",type:"text",role:"spinbutton",inputMode:"numeric",maxLength:2,autocomplete:"off",ariaLabel:s,ariaValueMin:"0",ariaValueMax:String(r),dataset:{segment:e}});this._inputs.push(n),t.append(n),this.listen(n,"focus",()=>n.select()),this.listen(n,"keydown",o=>this._onKeydown(o,e,r)),this.listen(n,"input",()=>this._onInput(n,e,r)),this.listen(n,"blur",()=>this._commitFromInputs())}_onKeydown(t,e,s){if(t.key!=="ArrowUp"&&t.key!=="ArrowDown")return;t.preventDefault();let r=t.key==="ArrowUp"?1:-1,n=e==="m"?vl(this.options.step):1,o=Ut(t.currentTarget.value,0,s),l=s+1,c=(o+r*n+l*n)%l;t.currentTarget.value=Ot(c),this._commitFromInputs()}_onInput(t,e,s){if(t.value=t.value.replace(/\D/g,"").slice(0,2),t.value.length<2)return;t.value=Ot(Ut(t.value,0,s)),this._commitFromInputs();let r=this._inputs.indexOf(t);this._inputs[r+1]?.focus()}_commitFromInputs(){let t={h:0,m:0,s:0};for(let s of this._inputs){let r=s.dataset.segment,n=r==="h"?23:59;t[r]=Ut(s.value,0,n)}let e=!this._value||!wl(this._value,t);this._value=t,this._display=t,this._writeInputs(),e&&this.emit("change",{time:{...t}})}_writeInputs(){for(let t of this._inputs){let e=t.dataset.segment;t.value=Ot(this._display[e]),t.setAttribute("aria-valuenow",String(this._display[e])),t.setAttribute("aria-valuetext",t.value)}this._syncClock()}_buildClock(t){let e=a("div",{class:"zx-time-picker__clock",id:t,hidden:!0},a("div",{class:"zx-time-picker__clock-head"},a("button",{ref:"headHour",class:"zx-time-picker__clock-unit",type:"button",ariaLabel:"Select the hour",dataset:{unit:"h"}}),a("span",{class:"zx-time-picker__clock-colon",ariaHidden:"true"},":"),a("button",{ref:"headMinute",class:"zx-time-picker__clock-unit",type:"button",ariaLabel:"Select the minutes",dataset:{unit:"m"}})),a("div",{ref:"dial",class:"zx-time-picker__dial",role:"radiogroup"},a("span",{ref:"hand",class:"zx-time-picker__hand",ariaHidden:"true"}),a("span",{class:"zx-time-picker__pivot",ariaHidden:"true"})));return this.listen(this.refs.headHour,"click",()=>this.openClock("h")),this.listen(this.refs.headMinute,"click",()=>this.openClock("m")),this.listen(this.refs.dial,"click",s=>{let r=s.target.closest?.(".zx-time-picker__mark");r&&this._pick(Number(r.dataset.value))}),this.listen(this.refs.dial,"keydown",s=>this._onDialKeydown(s)),e}_pick(t){let e={...this._display,[this._clockUnit]:t},s=this._clockUnit==="h";this.set(e),s&&this.openClock("m")}_onDialKeydown(t){let e=[...this.refs.dial.querySelectorAll(".zx-time-picker__mark")],s=t.target.closest?.(".zx-time-picker__mark"),r=e.indexOf(s);if(r<0)return;let n={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[t.key],o=null;n!==void 0?o=(r+n+e.length)%e.length:t.key==="Home"?o=0:t.key==="End"&&(o=e.length-1),o!==null&&(t.preventDefault(),this._pick(Number(e[o].dataset.value)),this.refs.dial.querySelector(`[data-value="${e[o].dataset.value}"]`)?.focus())}_syncClock(){if(!this._clock)return;let t=this._clockUnit==="h";if(this._clock.hidden=!this._clockOpen,this.refs.clockToggle.setAttribute("aria-expanded",String(this._clockOpen)),this.refs.headHour.textContent=Ot(this._display.h),this.refs.headMinute.textContent=Ot(this._display.m),this.refs.headHour.setAttribute("aria-pressed",String(t)),this.refs.headMinute.setAttribute("aria-pressed",String(!t)),this.refs.dial.setAttribute("aria-label",t?"Hour":"Minutes"),!this._clockOpen)return;let e=t?this._display.h:this._display.m,s=t?bl():yl(),r=this.refs.dial.querySelectorAll(".zx-time-picker__mark");if(r.length!==s.length||this.refs.dial.dataset.unit!==this._clockUnit){for(let l of r)l.remove();this.refs.dial.dataset.unit=this._clockUnit,this.refs.dial.append(...s.map(l=>this._buildMark(l,e)))}else s.forEach((l,c)=>this._syncMark(r[c],l,e));let n=t&&!xl(e)?"inner":"outer",o=t?e%12*30:e*6;this.refs.hand.dataset.ring=n,this.refs.hand.style.setProperty("--zx-clock-angle",`${o}deg`)}_buildMark(t,e){let s=a("button",{class:"zx-time-picker__mark",type:"button",role:"radio",dataset:{value:String(t.value),ring:t.ring}},t.label);return s.style.setProperty("--zx-clock-angle",`${t.angle}deg`),this._syncMark(s,t,e),s}_syncMark(t,e,s){let r=e.value===s;t.setAttribute("aria-checked",String(r)),t.tabIndex=r?0:-1}};function bl(){let i=[];for(let t=1;t<=12;t+=1)i.push({value:t,label:String(t),angle:t%12*30,ring:"outer"});for(let t=0;t<12;t+=1){let e=t===0?0:12+t;i.push({value:e,label:Ot(e),angle:t*30,ring:"inner"})}return i}function yl(){let i=[];for(let t=0;t<60;t+=gl)i.push({value:t,label:Ot(t),angle:t*6,ring:"outer"});return i}function xl(i){return i>=1&&i<=12}function Sn(i){return i instanceof Date&&!Number.isNaN(i.getTime())?{h:i.getHours(),m:i.getMinutes(),s:i.getSeconds()}:!i||typeof i!="object"?null:{h:Ut(i.h,0,23),m:Ut(i.m,0,59),s:Ut(i.s,0,59)}}function Ut(i,t,e){let s=Number.parseInt(String(i??""),10);return Number.isFinite(s)?Math.max(t,Math.min(e,s)):t}function vl(i){let t=Math.round(Number(i));return Number.isFinite(t)&&t>0&&t<=59?t:5}function Ot(i){return String(i).padStart(2,"0")}function wl(i,t){return i.h===t.h&&i.m===t.m&&i.s===t.s}var Q=class extends p{static cssName="date-picker";static defaults={value:null,min:null,max:null,weekStart:1,showWeekNumbers:!1,time:!1};render(){let t=this.el??a("div");this._min=tt(Ge(this.options.min)),this._max=tt(Ge(this.options.max)),this._value=this._normalizeValue(Ge(this.options.value)),this._focused=tt(this._value)??this._clampFocus(tt(new Date)),this._viewYear=this._focused.getFullYear(),this._viewMonth=this._focused.getMonth(),this._weekStart=Sl(this.options.weekStart),this._quickOpen=!1,this._timePicker=null;let e=a("div",{class:"zx-date-picker__surface"},a("div",{class:"zx-date-picker__header"},a("button",{ref:"previous",class:"zx-date-picker__nav",type:"button",ariaLabel:"Previous month"},_("chevron-left")),a("button",{ref:"heading",class:"zx-date-picker__heading",type:"button",ariaExpanded:"false","aria-haspopup":"grid"}),a("button",{ref:"next",class:"zx-date-picker__nav",type:"button",ariaLabel:"Next month"},_("chevron-right"))),a("div",{ref:"quickPanel",class:"zx-date-picker__quick",hidden:!0},a("div",{class:"zx-date-picker__quick-header"},a("button",{ref:"quickPrevious",class:"zx-date-picker__nav",type:"button",ariaLabel:"Previous year"},_("chevron-left")),a("span",{ref:"quickYear",class:"zx-date-picker__quick-year",ariaLive:"polite"}),a("button",{ref:"quickNext",class:"zx-date-picker__nav",type:"button",ariaLabel:"Next year"},_("chevron-right"))),a("div",{ref:"quickGrid",class:"zx-date-picker__quick-grid",role:"grid"})),a("table",{ref:"grid",class:"zx-date-picker__grid",role:"grid",ariaLabel:"Calendar"},a("thead",{ref:"weekdays"}),a("tbody",{ref:"days"})));return this._content=e,t.append(e),this.listen(this.refs.previous,"click",()=>this._pageMonth(-1)),this.listen(this.refs.next,"click",()=>this._pageMonth(1)),this.listen(this.refs.heading,"click",()=>this._toggleQuickPick()),this.listen(this.refs.quickPrevious,"click",()=>this._stepQuickYear(-1)),this.listen(this.refs.quickNext,"click",()=>this._stepQuickYear(1)),this.listen(this.refs.quickGrid,"click",s=>this._onQuickClick(s)),this.listen(this.refs.quickGrid,"keydown",s=>this._onQuickKeydown(s)),this.listen(this.refs.days,"click",s=>this._onDayClick(s)),this.listen(this.refs.days,"keydown",s=>this._onDayKeydown(s)),this._renderWeekdays(),this._renderCalendar(),this.options.time&&(this._timePicker=new X(null,{value:this._value,seconds:!1}),this._timePicker.on("change",s=>{let r=s.detail.time,n=this._value??this._focused,o=new Date(n.getTime());o.setHours(r.h,r.m,r.s,0),this.set(o)}),e.append(this._timePicker.el)),t}get(){return Qi(this._value)}set(t,{silent:e=!1}={}){let s=this._normalizeValue(Ge(t));return this._value=s,s&&(this._focused=tt(s),this._viewYear=s.getFullYear(),this._viewMonth=s.getMonth()),this._timePicker?.set(s,{silent:!0}),this._renderCalendar(),e||this.emit("change",{date:Qi(this._value)}),this}focus(){return this._closeQuickPick(),this._buttonForDate(this._focused)?.focus(),this}destroy(){this._timePicker?.destroy(),this._timePicker=null,this._content?.remove(),super.destroy()}_normalizeValue(t){if(!t)return null;let e=new Date(t.getTime()),s=tt(e);return this._min&&s<this._min&&An(e,this._min),this._max&&s>this._max&&An(e,this._max),e}_clampFocus(t){return this._min&&t<this._min?new Date(this._min.getTime()):this._max&&t>this._max?new Date(this._max.getTime()):t}_renderWeekdays(){let t=a("tr");this.options.showWeekNumbers&&t.append(a("th",{class:"zx-date-picker__week-heading",scope:"col",ariaLabel:"Week number"},"#"));let e=new Date(2023,0,1);for(let s=0;s<7;s+=1){let r=A(e,(this._weekStart+s)%7);t.append(a("th",{scope:"col",ariaLabel:w(r,"%A")},w(r,"%a")))}this.refs.weekdays.replaceChildren(t)}_renderCalendar(){if(!this.refs?.days)return;let t=new Date(this._viewYear,this._viewMonth,1),e=(t.getDay()-this._weekStart+7)%7,s=A(t,-e);this.refs.heading.textContent=w(t,"%B %Y"),this.refs.heading.setAttribute("aria-label",`Choose month and year, ${w(t,"%B %Y")}`);let r=[];for(let n=0;n<6;n+=1){let o=A(s,n*7),l=a("tr");this.options.showWeekNumbers&&l.append(a("th",{class:"zx-date-picker__week",scope:"row",ariaLabel:`Week ${zn(o)}`},String(zn(o))));for(let c=0;c<7;c+=1){let h=A(o,c),u=!!(this._value&&M(h,this._value)),d=!this._inRange(h),m=a("button",{class:"zx-date-picker__day",type:"button",role:"gridcell",tabindex:M(h,this._focused)?0:-1,ariaSelected:String(u),ariaDisabled:String(d),ariaCurrent:M(h,new Date)?"date":null,ariaLabel:`${w(h,"%e")} ${w(h,"%B %Y")}`,dataset:{date:w(h,"%Y-%m-%d"),otherMonth:h.getMonth()===this._viewMonth?null:"true"}},w(h,"%e"));l.append(a("td",{role:"presentation"},m))}r.push(l)}this.refs.days.replaceChildren(...r),this._quickOpen&&this._renderQuickPick()}_onDayClick(t){let e=t.target?.closest?.("[data-date]");if(!e||!this.refs.days.contains(e))return;let s=j(e.dataset.date,"%Y-%m-%d");s&&this._inRange(s)&&this._selectDate(s)}_onDayKeydown(t){let e=t.target?.closest?.("[data-date]");if(!e||!this.refs.days.contains(e))return;let s=j(e.dataset.date,"%Y-%m-%d");if(!s)return;let r=null;if(t.key==="ArrowLeft")r=A(s,-1);else if(t.key==="ArrowRight")r=A(s,1);else if(t.key==="ArrowUp")r=A(s,-7);else if(t.key==="ArrowDown")r=A(s,7);else if(t.key==="PageUp")r=dt(s,t.shiftKey?-12:-1);else if(t.key==="PageDown")r=dt(s,t.shiftKey?12:1);else if(t.key==="Home")r=A(s,-((s.getDay()-this._weekStart+7)%7));else if(t.key==="End")r=A(s,6-(s.getDay()-this._weekStart+7)%7);else if(t.key==="Enter"||t.key===" "){t.preventDefault(),this._inRange(s)&&this._selectDate(s);return}r&&(t.preventDefault(),this._moveFocus(r))}_moveFocus(t){let e=t.getFullYear()!==this._viewYear||t.getMonth()!==this._viewMonth;this._focused=tt(t),this._viewYear=t.getFullYear(),this._viewMonth=t.getMonth(),this._renderCalendar(),e&&this._emitMonthChange(),this._buttonForDate(t)?.focus()}_selectDate(t){let e=new Date(t.getTime()),s=this._timePicker?.get();s?e.setHours(s.h,s.m,s.s,0):this._value&&e.setHours(this._value.getHours(),this._value.getMinutes(),this._value.getSeconds(),this._value.getMilliseconds());let r=e.getFullYear()!==this._viewYear||e.getMonth()!==this._viewMonth;this._value=e,this._focused=tt(e),this._viewYear=e.getFullYear(),this._viewMonth=e.getMonth(),this._timePicker?.set(e,{silent:!0}),this._renderCalendar(),r&&this._emitMonthChange(),this.emit("change",{date:Qi(e)})}_pageMonth(t){this._closeQuickPick();let e=dt(this._focused,t);this._focused=tt(e),this._viewYear=e.getFullYear(),this._viewMonth=e.getMonth(),this._renderCalendar(),this._emitMonthChange()}_emitMonthChange(){this.emit("monthchange",{year:this._viewYear,month:this._viewMonth})}_toggleQuickPick(){if(this._quickOpen){this._closeQuickPick(),this.refs.heading.focus();return}this._quickOpen=!0,this.refs.quickPanel.hidden=!1,this.refs.heading.setAttribute("aria-expanded","true"),this._renderQuickPick(),this.refs.quickGrid.querySelector('[tabindex="0"]')?.focus()}_closeQuickPick(){this._quickOpen&&(this._quickOpen=!1,this.refs.quickPanel.hidden=!0,this.refs.heading.setAttribute("aria-expanded","false"))}_renderQuickPick(){this.refs.quickYear.textContent=String(this._viewYear);let t=[];for(let e=0;e<12;e+=1){let s=new Date(this._viewYear,e,1);t.push(a("button",{class:"zx-date-picker__quick-month",type:"button",role:"gridcell",tabindex:e===this._viewMonth?0:-1,ariaSelected:String(e===this._viewMonth),dataset:{month:e}},w(s,"%b")))}this.refs.quickGrid.replaceChildren(...t)}_stepQuickYear(t){this._viewYear+=t,this._renderQuickPick(),this._emitMonthChange(),this.refs.quickGrid.querySelector('[tabindex="0"]')?.focus()}_onQuickClick(t){let e=t.target?.closest?.("[data-month]");!e||!this.refs.quickGrid.contains(e)||this._chooseQuickMonth(Number(e.dataset.month))}_onQuickKeydown(t){let e=t.target?.closest?.("[data-month]");if(!e||!this.refs.quickGrid.contains(e))return;let s=Number(e.dataset.month),r=null;if(t.key==="ArrowLeft")r=s-1;else if(t.key==="ArrowRight")r=s+1;else if(t.key==="ArrowUp")r=s-3;else if(t.key==="ArrowDown")r=s+3;else if(t.key==="Home")r=0;else if(t.key==="End")r=11;else if(t.key==="Enter"||t.key===" "){t.preventDefault(),this._chooseQuickMonth(s);return}else if(t.key==="Escape"){t.preventDefault(),this._closeQuickPick(),this.refs.heading.focus();return}if(r===null)return;t.preventDefault(),r=Math.max(0,Math.min(11,r));let n=this.refs.quickGrid.querySelectorAll("[data-month]");for(let o of n)o.tabIndex=Number(o.dataset.month)===r?0:-1;n[r]?.focus()}_chooseQuickMonth(t){let e=new Date(this._viewYear,t,Math.min(this._focused.getDate(),new Date(this._viewYear,t+1,0).getDate()));this._focused=tt(e),this._viewMonth=t,this._closeQuickPick(),this._renderCalendar(),this._emitMonthChange(),this.focus()}_inRange(t){let e=tt(t);return!(this._min&&e<this._min)&&!(this._max&&e>this._max)}_buttonForDate(t){return this.refs.days.querySelector(`[data-date="${w(t,"%Y-%m-%d")}"]`)}};function Ge(i){return i instanceof Date&&!Number.isNaN(i.getTime())?new Date(i.getTime()):null}function tt(i){return i?new Date(i.getFullYear(),i.getMonth(),i.getDate()):null}function Qi(i){return i?new Date(i.getTime()):null}function An(i,t){i.setFullYear(t.getFullYear(),t.getMonth(),t.getDate())}function Sl(i){let t=Number(i);return Number.isInteger(t)&&t>=0&&t<=6?t:Kt()}function zn(i){let t=new Date(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),e=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-e);let s=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-s.getTime())/864e5+1)/7)}var yt=class extends Q{static cssName="month-picker";static defaults={value:null,min:null,max:null};render(){let t=this.el??a("div");this._min=Ze(Qe(this.options.min)),this._max=Ze(Qe(this.options.max)),this._value=this._normalizeMonth(Qe(this.options.value));let e=this._value??Ze(new Date);this._year=e.getFullYear(),this._focusedMonth=e.getMonth();let s=a("div",{class:"zx-month-picker__surface"},a("div",{class:"zx-month-picker__header"},a("button",{ref:"previousYear",class:"zx-month-picker__nav",type:"button",ariaLabel:"Previous year"},_("chevron-left")),a("span",{ref:"year",class:"zx-month-picker__year",ariaLive:"polite"}),a("button",{ref:"nextYear",class:"zx-month-picker__nav",type:"button",ariaLabel:"Next year"},_("chevron-right"))),a("div",{ref:"grid",class:"zx-month-picker__grid",role:"grid",ariaLabel:"Choose month"}));return this._content=s,t.append(s),this.listen(this.refs.previousYear,"click",()=>this._stepYear(-1)),this.listen(this.refs.nextYear,"click",()=>this._stepYear(1)),this.listen(this.refs.grid,"click",r=>this._onMonthClick(r)),this.listen(this.refs.grid,"keydown",r=>this._onMonthKeydown(r)),this._renderMonths(),t}get(){return this._value?new Date(this._value.getTime()):null}set(t,{silent:e=!1}={}){return this._value=this._normalizeMonth(Qe(t)),this._value&&(this._year=this._value.getFullYear(),this._focusedMonth=this._value.getMonth()),this._renderMonths(),e||this.emit("change",{date:this.get()}),this}focus(){return this._button(this._focusedMonth)?.focus(),this}destroy(){this._content?.remove(),super.destroy()}_normalizeMonth(t){if(!t)return null;let e=Ze(t);return this._min&&e<this._min&&(e=new Date(this._min.getTime())),this._max&&e>this._max&&(e=new Date(this._max.getTime())),e}_renderMonths(){if(!this.refs?.grid)return;this.refs.year.textContent=String(this._year);let t=[];for(let e=0;e<12;e+=1){let s=new Date(this._year,e,1),r=!!(this._value&&Al(s,this._value));t.push(a("button",{class:"zx-month-picker__month",type:"button",role:"gridcell",tabindex:e===this._focusedMonth?0:-1,ariaSelected:String(r),ariaDisabled:String(!this._inRange(s)),ariaLabel:w(s,"%B %Y"),dataset:{month:e}},w(s,"%b")))}this.refs.grid.replaceChildren(...t)}_stepYear(t){this._year+=t,this._renderMonths()}_onMonthClick(t){let e=t.target?.closest?.("[data-month]");!e||!this.refs.grid.contains(e)||this._selectMonth(Number(e.dataset.month))}_onMonthKeydown(t){let e=t.target?.closest?.("[data-month]");if(!e||!this.refs.grid.contains(e))return;let s=Number(e.dataset.month),r=null;if(t.key==="ArrowLeft")r=-1;else if(t.key==="ArrowRight")r=1;else if(t.key==="ArrowUp")r=-3;else if(t.key==="ArrowDown")r=3;else if(t.key==="Home")r=-(s%3);else if(t.key==="End")r=2-s%3;else if(t.key==="PageUp"){t.preventDefault(),this._stepYear(-1),this.focus();return}else if(t.key==="PageDown"){t.preventDefault(),this._stepYear(1),this.focus();return}else if(t.key==="Enter"||t.key===" "){t.preventDefault(),this._selectMonth(s);return}if(r===null)return;t.preventDefault();let n=this._year*12+s+r;this._year=Math.floor(n/12),this._focusedMonth=(n%12+12)%12,this._renderMonths(),this.focus()}_selectMonth(t){let e=new Date(this._year,t,1);this._inRange(e)&&(this._focusedMonth=t,this._value=e,this._renderMonths(),this.emit("change",{date:this.get()}))}_inRange(t){return!(this._min&&t<this._min)&&!(this._max&&t>this._max)}_button(t){return this.refs.grid.querySelector(`[data-month="${t}"]`)}};function Qe(i){return i instanceof Date&&!Number.isNaN(i.getTime())?new Date(i.getTime()):null}function Ze(i){return i?new Date(i.getFullYear(),i.getMonth(),1):null}function Al(i,t){return i.getFullYear()===t.getFullYear()&&i.getMonth()===t.getMonth()}function kn(){x.register("month",(i,t)=>{let e=i.own(new yt(null,{...t.props??{},value:t.value})),s=!1,r=()=>{e.el.setAttribute("aria-disabled",String(s));for(let n of e.el.querySelectorAll("button"))n.disabled=s};return i.listen(e.el,"change",n=>n.stopImmediatePropagation()),e.on("change",n=>i.emit("change",{value:n.detail.date})),{el:e.el,get:()=>e.get(),set:n=>{e.set(n instanceof Date?n:null,{silent:!0}),r()},focus:()=>e.focus(),setDisabled:n=>{s=!!n,r()}}})}var zl=new Set(["bottom-start","bottom-end","top-start","top-end","bottom","top"]);function q(i,t,e={}){if(!(i instanceof Element)||!(t instanceof HTMLElement))throw new TypeError("position() requires an Element anchor and HTMLElement floating element");let s=zl.has(e.placement)?e.placement:"bottom-start",r=Number(e.offset??4),n=e.flip??!0,o=e.matchWidth??!1,l=i.getAttribute("style"),c=t.getAttribute("style"),h=t.getAttribute("popover"),u=!1,d=null,m=()=>{},f=()=>{};if(t.setAttribute("popover","manual"),typeof CSS<"u"&&CSS.supports?.("anchor-name: --zx-a")){let y=`--${b("zx-a")}`;i.style.setProperty("anchor-name",y),t.style.position="fixed",t.style.inset="auto",t.style.margin="0",t.style.setProperty("position-anchor",y),t.style.setProperty("position-area",Cn(s)),t.style.setProperty("inset-area",Cn(s)),t.style.setProperty("position-try-fallbacks",n?"flip-block, flip-inline, flip-block flip-inline":"none"),t.style.setProperty(s.startsWith("top")?"margin-block-end":"margin-block-start",`${r}px`),m=()=>{o&&(t.style.minWidth=`${i.getBoundingClientRect().width}px`)},typeof ResizeObserver=="function"&&(d=new ResizeObserver(m),d.observe(i))}else t.style.position="fixed",t.style.inset="auto",t.style.margin="0",m=()=>kl(i,t,{placement:s,offset:r,flip:n,matchWidth:o}),window.addEventListener("scroll",m,{capture:!0,passive:!0}),window.addEventListener("resize",m,{passive:!0}),typeof ResizeObserver=="function"&&(d=new ResizeObserver(m),d.observe(i)),f=()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)};return Cl(t),m(),{update(){u||m()},destroy(){u||(u=!0,d?.disconnect(),f(),Tl(t),Zi(i,"style",l),Zi(t,"style",c),Zi(t,"popover",h))}}}function Cn(i){return{"bottom-start":"block-end span-inline-end","bottom-end":"block-end span-inline-start","top-start":"block-start span-inline-end","top-end":"block-start span-inline-start",bottom:"block-end",top:"block-start"}[i]}function kl(i,t,{placement:e,offset:s,flip:r,matchWidth:n}){let o=i.getBoundingClientRect();n&&(t.style.minWidth=`${o.width}px`);let l=t.getBoundingClientRect(),c=document.documentElement.clientWidth||window.innerWidth,h=document.documentElement.clientHeight||window.innerHeight,u=e,d=e.startsWith("bottom"),m=o.bottom+s,f=o.top-s-l.height;r&&(d&&m+l.height>h&&f>=0?u=e.replace("bottom","top"):!d&&f<0&&m+l.height<=h&&(u=e.replace("top","bottom")));let g;u.endsWith("-end")?g=o.right-l.width:u.endsWith("-start")?g=o.left:g=o.left+(o.width-l.width)/2;let y=u.startsWith("bottom")?m:f;t.style.left=`${Math.round(B(g,0,Math.max(0,c-l.width)))}px`,t.style.top=`${Math.round(B(y,0,Math.max(0,h-l.height)))}px`}function Cl(i){if(typeof i.showPopover=="function")try{i.showPopover()}catch{}}function Tl(i){if(typeof i.hidePopover=="function")try{i.hidePopover()}catch{}}function Zi(i,t,e){e===null?i.removeAttribute(t):i.setAttribute(t,e)}var Nl=6,In=864e5;function Lt(i,t){let e=$(Ft(i)),s=$(Ft(t));return e&&s&&e.getTime()>s.getTime()?{start:s,end:e}:{start:e,end:s}}function Wt(i,t){let e=Lt(i,t);return!e.start||!e.end?0:Math.round((En(e.end)-En(e.start))/In)}function tr(i,t,e){let s=$(Ft(i));if(!s)return null;let r=Lt(t,e);return!r.start&&!r.end?null:r.end?r.start?s.getTime()<r.start.getTime()||s.getTime()>r.end.getTime()?null:M(s,r.start)?"start":M(s,r.end)?"end":"middle":M(s,r.end)?"end":null:M(s,r.start)?"start":null}function Gt(i,t={}){let e=$(Ft(t.min)),s=$(Ft(t.max)),r=Je(t.minNights)??0,n=Je(t.maxNights),{start:o,end:l}=Lt(i?.start,i?.end);return o&&(o=Xi(o,e,s)),l&&(l=Xi(l,e,s)),!o||!l?{start:o,end:l}:(n!==null&&Wt(o,l)>n&&(l=A(o,n)),r>0&&Wt(o,l)<r&&(l=A(o,r),s&&l.getTime()>s.getTime()&&(l=new Date(s.getTime()),o=A(l,-r),e&&o.getTime()<e.getTime()))?{start:null,end:null}:{start:o,end:l})}var Qt=class extends p{static cssName="date-range-picker";static defaults={start:null,end:null,min:null,max:null,months:2,weekStart:1,showWeekNumbers:!1,minNights:0,maxNights:null,presets:[],disabled:!1};render(){let t=this.el??a("div");this.el=t,this._rootAttributes=Fl(t,["role","aria-label","aria-disabled","data-months","data-presets"]),this._min=$(Ft(this.options.min)),this._max=$(Ft(this.options.max)),this._minNights=Je(this.options.minNights)??0,this._maxNights=Je(this.options.maxNights),this._weekStart=Ml(this.options.weekStart),this._monthCount=Il(this.options.months),this._presets=Dl(this.options.presets),this._disabled=!!this.options.disabled,this._hover=null,this._dayCells=[];let e=Gt({start:this.options.start,end:this.options.end},this._bounds());this._start=e.start,this._end=e.end,this._picking=!!(e.start&&!e.end),this._remember(),this._focused=xt(this._start)??this._clampFocus($(new Date)),this._viewYear=this._focused.getFullYear(),this._viewMonth=this._focused.getMonth(),t.setAttribute("role","group"),t.setAttribute("aria-label",D("daterange.label","Date range")),t.dataset.months=String(this._monthCount),this._presets.length&&(t.dataset.presets="true");let s=a("div",{class:"zx-date-range-picker__surface"},this._presets.length?a("div",{ref:"presets",class:"zx-date-range-picker__presets",role:"group",ariaLabel:D("daterange.presets","Date range presets")},this._presets.map(n=>a("button",{class:"zx-date-range-picker__preset",type:"button",dataset:{preset:n.name}},n.label))):null,a("div",{ref:"calendars",class:"zx-date-range-picker__calendars"})),r=a("div",{ref:"status",class:"zx-date-range-picker__status",role:"status",ariaLive:"polite"});return this._nodes=[s,r],t.append(s,r),this.refs.presets&&this.listen(this.refs.presets,"click",n=>this._onPresetClick(n)),this.listen(this.refs.calendars,"click",n=>this._onCalendarClick(n)),this.listen(this.refs.calendars,"keydown",n=>this._onDayKeydown(n)),this.listen(this.refs.calendars,"mouseover",n=>this._onDayHover(n)),this.listen(this.refs.calendars,"mouseleave",()=>this._setHover(null)),this._renderCalendars(),this._announce(),t}get(){return{start:xt(this._start),end:xt(this._end)}}set(t={},{silent:e=!1}={}){let s=Gt({start:t?.start??null,end:t?.end??null},this._bounds());return this._start=s.start,this._end=s.end,this._picking=!!(s.start&&!s.end),this._remember(),this._hover=null,s.start?(this._focused=xt(s.start),this._setView(s.start)):this._paint(),this._announce(),e||this.emit("change",this.get()),this}clear({silent:t=!1}={}){return this.set({start:null,end:null},{silent:t})}focus(){return this._buttonForDate(this._focused)?.focus(),this}enable(){return this._disabled=!1,this._paint(),this._syncDisabled(),this}disable(){return this._disabled=!0,this._hover=null,this._paint(),this._syncDisabled(),this}destroy(){for(let t of this._nodes??[])t.remove();this._nodes=[],this._dayCells=[],Ll(this.el,this._rootAttributes??new Map),super.destroy()}_bounds(){return{min:this._min,max:this._max,minNights:this._minNights,maxNights:this._maxNights}}_selectable(t){let e=$(t);if(!e||this._min&&e.getTime()<this._min.getTime()||this._max&&e.getTime()>this._max.getTime())return!1;if(!this._picking||!this._start||e.getTime()<=this._start.getTime())return!0;let s=Wt(this._start,e);return!(s<this._minNights||this._maxNights!==null&&s>this._maxNights)}_choose(t){let e=$(t);if(this._disabled||!e||!this._selectable(e))return;this._picking&&this._start&&e.getTime()>this._start.getTime()?(this._end=e,this._picking=!1,this._remember()):(this._start=e,this._end=null,this._picking=!0),this._focused=e,this._hover=null,this._paint(),this._announce(),this.emit("select",this.get()),this._picking||this.emit("change",this.get())}_remember(){let t=!!(this._start&&this._end);this._committedStart=t?xt(this._start):null,this._committedEnd=t?xt(this._end):null}_abandon(){return this._picking?(this._start=xt(this._committedStart),this._end=xt(this._committedEnd),this._picking=!1,this._hover=null,this._paint(),this._announce(),this.emit("select",this.get()),!0):!1}_clampFocus(t){return Xi(t,this._min,this._max)}_visibleMonthCount(){let t=this.refs.calendars?.children??[],e=0;for(let s of t)s.getClientRects().length>0&&(e+=1);return e||this._monthCount}_setView(t){let e=t.getFullYear()!==this._viewYear||t.getMonth()!==this._viewMonth;if(this._viewYear=t.getFullYear(),this._viewMonth=t.getMonth(),!e){this._paint();return}this._renderCalendars(),this._emitMonthChange()}_ensureVisible(t){let e=this._visibleMonthCount(),s=Dn(t)-(this._viewYear*12+this._viewMonth);if(s>=0&&s<e)return!1;let r=s<0?s:s-(e-1),n=new Date(this._viewYear,this._viewMonth+r,1);return this._viewYear=n.getFullYear(),this._viewMonth=n.getMonth(),!0}_pageView(t){if(this._disabled)return;let e=new Date(this._viewYear,this._viewMonth+t,1);this._viewYear=e.getFullYear(),this._viewMonth=e.getMonth(),this._focused=this._focusInView(this._focused),this._renderCalendars(),this._emitMonthChange()}_focusInView(t){let e=this._visibleMonthCount(),s=Dn(t)-(this._viewYear*12+this._viewMonth);if(s>=0&&s<e)return t;let r=new Date(this._viewYear,this._viewMonth+1,0).getDate();return new Date(this._viewYear,this._viewMonth,Math.min(t.getDate(),r))}_moveFocus(t){let e=$(t);this._focused=e,this._ensureVisible(e)?(this._renderCalendars(),this._emitMonthChange()):this._paint(),this._buttonForDate(e)?.focus()}_emitMonthChange(){this.emit("monthchange",{year:this._viewYear,month:this._viewMonth})}_onPresetClick(t){let e=t.target?.closest?.("[data-preset]");if(!e||this._disabled)return;let s=this._presets.find(n=>n.name===e.dataset.preset);if(!s)return;let r=s.range();this.set({start:r?.start??null,end:r?.end??null},{silent:!0}),this.emit("select",this.get()),this.emit("change",this.get())}_onCalendarClick(t){let e=t.target,s=e?.closest?.("[data-nav]");if(s){this._pageView(s.dataset.nav==="next"?1:-1);return}let r=this._cellFor(e);r&&this._choose(r.date)}_onDayHover(t){let e=this._cellFor(t.target);this._setHover(e?e.date:null)}_setHover(t){if(this._disabled||!this._picking)return;let e=t?$(t):null;!e&&!this._hover||e&&this._hover&&M(e,this._hover)||(this._hover=e,this._paint())}_onDayKeydown(t){let e=this._cellFor(t.target);if(!e)return;let s=e.date,r=null;if(t.key==="ArrowLeft")r=A(s,-1);else if(t.key==="ArrowRight")r=A(s,1);else if(t.key==="ArrowUp")r=A(s,-7);else if(t.key==="ArrowDown")r=A(s,7);else if(t.key==="PageUp")r=dt(s,t.shiftKey?-12:-1);else if(t.key==="PageDown")r=dt(s,t.shiftKey?12:1);else if(t.key==="Home")r=A(s,-((s.getDay()-this._weekStart+7)%7));else if(t.key==="End")r=A(s,6-(s.getDay()-this._weekStart+7)%7);else if(t.key==="Enter"||t.key===" "){t.preventDefault(),this._choose(s);return}else if(t.key==="Escape"){if(!this._abandon())return;t.preventDefault(),t.stopPropagation();return}!r||this._disabled||(t.preventDefault(),this._moveFocus(r))}_renderCalendars(){if(!this.refs?.calendars)return;this._dayCells=[];let t=[];for(let e=0;e<this._monthCount;e+=1)t.push(this._renderMonth(new Date(this._viewYear,this._viewMonth+e,1)));this.refs.calendars.replaceChildren(...t),this._paint(),this._syncDisabled()}_renderMonth(t){let e=w(t,"%B %Y"),s=(t.getDay()-this._weekStart+7)%7,r=A(t,-s),n=[];for(let o=0;o<Nl;o+=1){let l=A(r,o*7),c=a("tr"),h=Ol(l,t);this.options.showWeekNumbers&&c.append(a("th",{class:"zx-date-range-picker__week",scope:"row",ariaLabel:h?D("daterange.week","Week %1",[Mn(l)]):null},h?String(Mn(l)):""));for(let u=0;u<7;u+=1){let d=A(l,u),m=a("td",{role:"presentation"});if(d.getMonth()===t.getMonth()&&d.getFullYear()===t.getFullYear()){let f=a("button",{class:"zx-date-range-picker__day",type:"button",role:"gridcell",tabindex:-1,dataset:{date:w(d,"%Y-%m-%d")}},w(d,"%e"));m.append(f),this._dayCells.push({date:d,cell:m,button:f})}c.append(m)}n.push(c)}return a("div",{class:"zx-date-range-picker__month"},a("div",{class:"zx-date-range-picker__header"},a("button",{class:"zx-date-range-picker__nav",type:"button",dataset:{nav:"previous"},ariaLabel:D("daterange.previousMonth","Previous month")},_("chevron-left")),a("div",{class:"zx-date-range-picker__caption",ariaHidden:"true"},e),a("button",{class:"zx-date-range-picker__nav",type:"button",dataset:{nav:"next"},ariaLabel:D("daterange.nextMonth","Next month")},_("chevron-right"))),a("table",{class:"zx-date-range-picker__grid",role:"grid",ariaLabel:e},a("thead",{},this._weekdayRow()),a("tbody",{},...n)))}_weekdayRow(){let t=a("tr");this.options.showWeekNumbers&&t.append(a("th",{class:"zx-date-range-picker__week-heading",scope:"col",ariaLabel:D("daterange.weekNumber","Week number")},"#"));let e=new Date(2023,0,1);for(let s=0;s<7;s+=1){let r=A(e,(this._weekStart+s)%7);t.append(a("th",{scope:"col",ariaLabel:w(r,"%A")},w(r,"%a")))}return t}_paint(){let t=new Date,e=null;for(let s of this._dayCells)M(s.date,this._focused)&&(e=s);e||(e=this._dayCells[0]??null);for(let s of this._dayCells){let{date:r,cell:n,button:o}=s,l=this._dayState(r);Ji(n,"range",l.range),Ji(n,"rangeEdge",l.edge),Ji(o,"range",l.range),o.tabIndex=s===e?0:-1,o.setAttribute("aria-selected",String(l.range!==null&&l.range!=="preview")),o.setAttribute("aria-disabled",String(!this._selectable(r))),o.setAttribute("aria-label",this._dayLabel(r,l.range)),M(r,t)?o.setAttribute("aria-current","date"):o.removeAttribute("aria-current")}}_dayState(t){if(this._start&&this._end){let s=tr(t,this._start,this._end);if(!s)return{range:null,edge:null};let r=M(this._start,this._end);return s==="start"?{range:s,edge:r?"both":"start"}:s==="end"?{range:s,edge:r?"both":"end"}:{range:s,edge:null}}if(!this._start)return{range:null,edge:null};let e=this._previewEnd();return M(t,this._start)?{range:"start",edge:e?"start":"both"}:e?t.getTime()>this._start.getTime()&&t.getTime()<=e.getTime()?{range:"preview",edge:M(t,e)?"end":null}:{range:null,edge:null}:{range:null,edge:null}}_previewEnd(){if(!this._picking||!this._start||this._disabled)return null;let t=this._hover??this._focused;if(!t)return null;let e=$(t);return e.getTime()<=this._start.getTime()?null:this._selectable(e)?e:null}_dayLabel(t,e){let s=w(t,"%A, %e %B %Y");return e==="start"?`${s}, ${D("daterange.day.start","range start")}`:e==="end"?`${s}, ${D("daterange.day.end","range end")}`:e==="middle"?`${s}, ${D("daterange.day.middle","in selected range")}`:s}_syncDisabled(){this.el.setAttribute("aria-disabled",String(this._disabled));for(let t of this.el.querySelectorAll("button"))t.disabled=this._disabled}_announce(){this.refs?.status&&(this.refs.status.textContent=this._selectionLabel())}_selectionLabel(){if(!this._start)return D("daterange.status.empty","No date range selected");if(!this._end)return D("daterange.status.start","%1 selected, choose an end date",[w(this._start,"%e %B %Y")]);let t=Wt(this._start,this._end),e=t===1?D("daterange.night","1 night"):D("daterange.nights","%1 nights",[t]);return`${El(this._start,this._end)}, ${e}`}_cellFor(t){let e=t?.closest?.("[data-date]");return e?this._dayCells.find(s=>s.button===e)??null:null}_buttonForDate(t){return this._dayCells.find(e=>M(e.date,t))?.button??null}};function er(){return[{name:"today",label:D("daterange.preset.today","Today"),range:()=>Tn(at())},{name:"yesterday",label:D("daterange.preset.yesterday","Yesterday"),range:()=>Tn(A(at(),-1))},{name:"last7",label:D("daterange.preset.last7","Last 7 days"),range:()=>({start:A(at(),-6),end:at()})},{name:"last30",label:D("daterange.preset.last30","Last 30 days"),range:()=>({start:A(at(),-29),end:at()})},{name:"thisMonth",label:D("daterange.preset.thisMonth","This month"),range:()=>Nn(at(),0)},{name:"lastMonth",label:D("daterange.preset.lastMonth","Last month"),range:()=>Nn(at(),-1)},{name:"thisQuarter",label:D("daterange.preset.thisQuarter","This quarter"),range:()=>{let i=at(),t=Math.floor(i.getMonth()/3)*3;return{start:new Date(i.getFullYear(),t,1),end:new Date(i.getFullYear(),t+3,0)}}},{name:"thisYear",label:D("daterange.preset.thisYear","This year"),range:()=>{let i=at();return{start:new Date(i.getFullYear(),0,1),end:new Date(i.getFullYear(),11,31)}}}]}function D(i,t,e){let s=Y(i);return F(s===i?t:s,e)}function El(i,t){if(M(i,t))return w(i,"%e %B %Y");let e=w(t,"%e %B %Y");return i.getFullYear()!==t.getFullYear()?`${w(i,"%e %B %Y")} \u2013 ${e}`:i.getMonth()!==t.getMonth()?`${w(i,"%e %B")} \u2013 ${e}`:`${w(i,"%e")} \u2013 ${e}`}function Dl(i){return i===!0?er():Array.isArray(i)?i.filter(t=>t&&typeof t.range=="function").map((t,e)=>({name:String(t.name??`preset-${e}`),label:String(t.label??t.name??""),range:t.range})):[]}function at(){return $(new Date)}function Tn(i){return{start:i,end:new Date(i.getTime())}}function Nn(i,t){return{start:new Date(i.getFullYear(),i.getMonth()+t,1),end:new Date(i.getFullYear(),i.getMonth()+t+1,0)}}function Ft(i){return i instanceof Date&&!Number.isNaN(i.getTime())?new Date(i.getTime()):null}function $(i){return!i||Number.isNaN(i.getTime())?null:new Date(i.getFullYear(),i.getMonth(),i.getDate())}function xt(i){return i?new Date(i.getTime()):null}function Xi(i,t,e){return t&&i.getTime()<t.getTime()?new Date(t.getTime()):e&&i.getTime()>e.getTime()?new Date(e.getTime()):new Date(i.getTime())}function En(i){return Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())}function Dn(i){return i.getFullYear()*12+i.getMonth()}function Je(i){if(i==null||i==="")return null;let t=Number(i);return Number.isFinite(t)?Math.max(0,Math.trunc(t)):null}function Ml(i){let t=Number(i);return Number.isInteger(t)&&t>=0&&t<=6?t:Kt()}function Il(i){let t=Number(i);return Number.isInteger(t)&&t>=1&&t<=4?t:2}function Ol(i,t){for(let e=0;e<7;e+=1){let s=A(i,e);if(s.getMonth()===t.getMonth()&&s.getFullYear()===t.getFullYear())return!0}return!1}function Mn(i){let t=new Date(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),e=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-e);let s=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-s.getTime())/In+1)/7)}function Ji(i,t,e){e==null?delete i.dataset[t]:i.dataset[t]=e}function Fl(i,t){return new Map(t.map(e=>[e,i.getAttribute(e)]))}function Ll(i,t){for(let[e,s]of t)s===null?i.removeAttribute(e):i.setAttribute(e,s)}var Vl={"%d":"DD","%e":"D","%m":"MM","%Y":"YYYY","%y":"YY"};function Xe(i,t,e){let s=String(i??"").trim();if(s==="")return{start:null,end:null};let r=String(e??" \u2013 "),n=r.trim(),o=n!==""&&String(t).includes(n)&&/^\s|\s$/.test(r),l=o?"\\s+":"\\s*",c=o?"(?:\\s+|$)":"\\s*",h=n===""?[s]:s.split(new RegExp(`${l}${qt(n)}${c}`));if(h.length>2)return null;let u=j(h[0].trim(),t);if(!u)return null;if(h.length===1)return{start:u,end:new Date(u.getTime())};if(h[1].trim()==="")return{start:u,end:null};let d=j(h[1].trim(),t);return d?Lt(u,d):null}function ir(i,t,e){let s=i?.start??null,r=i?.end??null;return!s&&!r?"":r?s?`${w(s,t)}${e}${w(r,t)}`:w(r,t):w(s,t)}var Zt=class extends p{static cssName="date-range-box";static defaults={start:null,end:null,format:"%d.%m.%Y",separator:" \u2013 ",placeholder:null,clearable:!0,min:null,max:null,months:2,weekStart:1,showWeekNumbers:!1,minNights:0,maxNights:null,presets:[],disabled:!1};render(){let t=this.el??a("div");this.el=t,this._originalState=t.getAttribute("data-state"),this._originalAriaDisabled=t.getAttribute("aria-disabled"),this._format=String(this.options.format||"%d.%m.%Y"),this._separator=String(this.options.separator??" \u2013 "),this._disabled=!!this.options.disabled,this._open=!1,this._position=null,this._range=this._coerce({start:this.options.start,end:this.options.end});let e=b("zx-date-range-box-popover"),s=a("div",{class:"zx-date-range-box__content"},a("div",{ref:"control",class:"zx-date-range-box__control"},a("input",{ref:"input",class:"zx-date-range-box__input",type:"text",autocomplete:"off",placeholder:this.options.placeholder??this._placeholder(),"aria-haspopup":"grid",ariaControls:e,ariaExpanded:"false"}),a("button",{ref:"clear",class:"zx-icon-btn zx-date-range-box__clear",type:"button",ariaLabel:On("daterange.clear","Clear date range")},_("x",{size:13})),a("button",{ref:"toggle",class:"zx-date-range-box__toggle",type:"button",ariaLabel:On("daterange.choose","Choose date range"),"aria-haspopup":"grid",ariaControls:e,ariaExpanded:"false"},_("calendar"))),a("div",{ref:"popover",id:e,class:"zx-date-range-box__popover",popover:"manual",dataset:{state:"closed"}}));return this._content=s,t.append(s),this._picker=new Qt(null,{start:this._range.start,end:this._range.end,min:this.options.min,max:this.options.max,months:this.options.months,weekStart:this.options.weekStart,showWeekNumbers:this.options.showWeekNumbers,minNights:this.options.minNights,maxNights:this.options.maxNights,presets:this.options.presets}),this.refs.popover.append(this._picker.el),this._picker.on("select",r=>{this._range={start:r.detail.start,end:r.detail.end},this._setValid(),this._syncDisplay()}),this._picker.on("change",r=>{this._apply({start:r.detail.start,end:r.detail.end},{push:!1}),r.detail.start&&r.detail.end&&this._close(!0)}),this.listen(this.refs.input,"blur",()=>{this._open||this._commitText()}),this.listen(this.refs.input,"keydown",r=>this._onInputKeydown(r)),this.listen(this.refs.toggle,"click",()=>this._open?this.close():this.open()),this.listen(this.refs.toggle,"keydown",r=>{r.key==="ArrowDown"&&(r.preventDefault(),this.open())}),this.listen(this.refs.clear,"click",()=>{this.clear(),this.focus()}),this.listen(document,"keydown",r=>{!this._open||r.key!=="Escape"||(r.preventDefault(),this._close(!0))}),this.listen(document,"pointerdown",r=>{this._open&&!t.contains(r.target)&&this.close()}),this._syncDisplay(),this._syncDisabled(),t}get(t="date"){return t==="seconds"?{start:this._range.start?Math.floor(this._range.start.getTime()/1e3):null,end:this._range.end?Math.floor(this._range.end.getTime()/1e3):null}:{start:this._range.start?new Date(this._range.start.getTime()):null,end:this._range.end?new Date(this._range.end.getTime()):null}}set(t,{silent:e=!1}={}){return this._apply(this._coerce(t),{silent:e}),this}clear({silent:t=!1}={}){return this.set({start:null,end:null},{silent:t})}open(){return this._disabled||this._open?this:(this._picker.set(this._range,{silent:!0}),this._open=!0,this.refs.popover.dataset.state="open",this.refs.input.setAttribute("aria-expanded","true"),this.refs.toggle.setAttribute("aria-expanded","true"),this._position=q(this.refs.control,this.refs.popover,{placement:"bottom-start",flip:!0}),this._picker.focus(),this.emit("open"),this)}close(){return this._close(!1),this}enable(){return this._disabled=!1,this._syncDisabled(),this}disable(){return this._disabled=!0,this.close(),this._syncDisabled(),this}focus(){return this.refs.input.focus(),this}destroy(){this._position?.destroy(),this._position=null,this._open=!1,this._picker?.destroy(),this._picker=null,this._content?.remove(),sr(this.el,"data-state",this._originalState),sr(this.el,"aria-disabled",this._originalAriaDisabled),super.destroy()}_apply(t,{silent:e=!1,push:s=!0}={}){this._range=t,s&&this._picker?.set(this._range,{silent:!0}),this._setValid(),this._syncDisplay(),e||this.emit("change",this.get())}_onInputKeydown(t){t.key==="ArrowDown"?(t.preventDefault(),this.open()):t.key==="Enter"?(t.preventDefault(),this._commitText()):t.key==="Escape"&&this._open&&(t.preventDefault(),this._close(!0))}_commitText(){if(this._disabled)return;let t=this.refs.input.value.trim();if(t===""){this.set({start:null,end:null});return}let e=Xe(t,this._format,this._separator);if(!e){this.el.dataset.state="invalid",this.refs.input.setAttribute("aria-invalid","true"),this.emit("invalid",{text:t});return}this._apply(this._clamp(e))}_coerce(t){return t==null?{start:null,end:null}:typeof t=="string"?this._clamp(Xe(t,this._format,this._separator)??{start:null,end:null}):Array.isArray(t)?this._clamp({start:this._toDate(t[0]),end:this._toDate(t[1])}):typeof t!="object"?{start:null,end:null}:this._clamp({start:this._toDate(t.start),end:this._toDate(t.end)})}_toDate(t){return t instanceof Date?Number.isNaN(t.getTime())?null:new Date(t.getTime()):typeof t=="number"&&Number.isFinite(t)?new Date(t*1e3):typeof t=="string"&&t.trim()!==""?j(t.trim(),this._format):null}_clamp(t){return Gt(t,{min:this.options.min,max:this.options.max,minNights:this.options.minNights,maxNights:this.options.maxNights})}_placeholder(){let t=this._format.replace(/%[demYy]/g,e=>Vl[e]??e);return`${t}${this._separator}${t}`}_syncDisplay(){this.refs.input.value=ir(this._range,this._format,this._separator),this.refs.clear.hidden=!this.options.clearable||!(this._range.start||this._range.end)}_syncDisabled(){this.refs.input.disabled=this._disabled,this.refs.toggle.disabled=this._disabled,this.refs.clear.disabled=this._disabled,this.el.setAttribute("aria-disabled",String(this._disabled)),this._disabled?this._picker?.disable():this._picker?.enable()}_setValid(){this.el.dataset.state==="invalid"&&sr(this.el,"data-state",this._originalState),this.refs.input.removeAttribute("aria-invalid")}_close(t){this._open&&(this._position?.destroy(),this._position=null,this._open=!1,this.refs.popover.dataset.state="closed",this.refs.input.setAttribute("aria-expanded","false"),this.refs.toggle.setAttribute("aria-expanded","false"),t&&this.focus(),this.emit("close"))}};function On(i,t,e){let s=Y(i);return F(s===i?t:s,e)}function sr(i,t,e){e===null?i.removeAttribute(t):i.setAttribute(t,e)}function Fn(){x.register("daterange",(i,t)=>{let e=i.own(new Zt(null,{...t.props??{},disabled:!!t.disabled,start:t.value?.start??null,end:t.value?.end??null}));return i.listen(e.el,"change",s=>s.stopImmediatePropagation()),e.on("change",s=>i.emit("change",{value:{start:s.detail.start,end:s.detail.end}})),{el:e.el,get:()=>e.get(),set:s=>e.set(s,{silent:!0}),focus:()=>e.focus(),setDisabled:s=>s?e.disable():e.enable()}})}var V=class extends p{static cssName="datebox";static defaults={value:null,format:"%d.%m.%Y",time:!1,min:null,max:null,placeholder:null,clearable:!0,disabled:!1};render(){let t=this.el??a("div");this.el=t,this._originalState=t.getAttribute("data-state"),this._originalAriaDisabled=t.getAttribute("aria-disabled"),this._format=Rl(this.options.format,this.options.time),this._disabled=!!this.options.disabled,this._open=!1,this._position=null,this._min=Ln(this.options.min),this._max=Ln(this.options.max),this._value=this._normalizeValue(this.options.value);let e=b("zx-datebox-popover"),s=a("div",{class:"zx-datebox__content"},a("div",{ref:"control",class:"zx-datebox__control"},a("input",{ref:"input",class:"zx-datebox__input",type:"text",autocomplete:"off",placeholder:this.options.placeholder??Pl(this._format),"aria-haspopup":"grid",ariaControls:e,ariaExpanded:"false"}),a("button",{ref:"clear",class:"zx-icon-btn zx-datebox__clear",type:"button",ariaLabel:"Clear date"},_("x",{size:13})),a("button",{ref:"toggle",class:"zx-datebox__toggle",type:"button",ariaLabel:"Choose date","aria-haspopup":"grid",ariaControls:e,ariaExpanded:"false"},_("calendar"))),a("div",{ref:"popover",id:e,class:"zx-datebox__popover",popover:"manual",dataset:{state:"closed"}}));return this._content=s,t.append(s),this._picker=new Q(null,{value:this._value,min:this._min,max:this._max,time:!!this.options.time}),this.refs.popover.append(this._picker.el),this._picker.on("change",r=>{this.set(r.detail.date),this.options.time||this._close(!0)}),this.listen(this.refs.input,"blur",()=>this._commitText()),this.listen(this.refs.input,"keydown",r=>this._onInputKeydown(r)),this.listen(this.refs.toggle,"click",()=>this._open?this.close():this.open()),this.listen(this.refs.toggle,"keydown",r=>{r.key==="ArrowDown"&&(r.preventDefault(),this.open())}),this.listen(this.refs.clear,"click",()=>{this.set(null),this.focus()}),this.listen(document,"keydown",r=>{!this._open||r.key!=="Escape"||(r.preventDefault(),this._close(!0))}),this.listen(document,"pointerdown",r=>{this._open&&!t.contains(r.target)&&this.close()}),this._syncDisplay(),this._syncDisabled(),t}get(t="date"){return this._value?t==="seconds"?Math.floor(this._value.getTime()/1e3):new Date(this._value.getTime()):null}set(t,{silent:e=!1}={}){return this._value=this._normalizeValue(t),this._picker?.set(this._value,{silent:!0}),this._setValid(),this._syncDisplay(),e||this.emit("change",{date:this._copyValue()}),this}open(){return this._disabled||this._open?this:(this._picker.set(this._value,{silent:!0}),this._open=!0,this.refs.popover.dataset.state="open",this.refs.input.setAttribute("aria-expanded","true"),this.refs.toggle.setAttribute("aria-expanded","true"),this._position=q(this.refs.control,this.refs.popover,{placement:"bottom-start",flip:!0}),this._picker.focus(),this.emit("open"),this)}close(){return this._close(!1),this}enable(){return this._disabled=!1,this._syncDisabled(),this}disable(){return this._disabled=!0,this.close(),this._syncDisabled(),this}focus(){return this.refs.input.focus(),this}destroy(){this._position?.destroy(),this._position=null,this._open=!1,this._picker?.destroy(),this._picker=null,this._content?.remove(),this._originalState===null?this.el.removeAttribute("data-state"):this.el.setAttribute("data-state",this._originalState),this._originalAriaDisabled===null?this.el.removeAttribute("aria-disabled"):this.el.setAttribute("aria-disabled",this._originalAriaDisabled),super.destroy()}_onInputKeydown(t){t.key==="ArrowDown"?(t.preventDefault(),this.open()):t.key==="Enter"?(t.preventDefault(),this._commitText()):t.key==="Escape"&&this._open&&(t.preventDefault(),this._close(!0))}_commitText(){if(this._disabled)return;let t=this.refs.input.value.trim();if(t===""){this.set(null);return}let e=j(t,this._format);if(!e){this.el.dataset.state="invalid",this.refs.input.setAttribute("aria-invalid","true"),this.emit("invalid",{text:t});return}this.set(e)}_normalizeValue(t){let e=null;return t instanceof Date&&!Number.isNaN(t.getTime())?e=new Date(t.getTime()):typeof t=="number"&&Number.isFinite(t)?e=new Date(t*1e3):typeof t=="string"&&(e=j(t,this._format)),!e||Number.isNaN(e.getTime())?null:$e(e,this._min,this._max)}_syncDisplay(){this.refs.input.value=this._value?w(this._value,this._format):"",this.refs.clear.hidden=!this.options.clearable||!this._value}_syncDisabled(){this.refs.input.disabled=this._disabled,this.refs.toggle.disabled=this._disabled,this.refs.clear.disabled=this._disabled,this.el.setAttribute("aria-disabled",String(this._disabled))}_setValid(){this.el.dataset.state==="invalid"&&(this._originalState===null?this.el.removeAttribute("data-state"):this.el.setAttribute("data-state",this._originalState)),this.refs.input.removeAttribute("aria-invalid")}_close(t){this._open&&(this._position?.destroy(),this._position=null,this._open=!1,this.refs.popover.dataset.state="closed",this.refs.input.setAttribute("aria-expanded","false"),this.refs.toggle.setAttribute("aria-expanded","false"),t&&this.focus(),this.emit("close"))}_copyValue(){return this._value?new Date(this._value.getTime()):null}},ts=function(t,e={}){return new V(t,{...e,time:!0})};function Ln(i){return i instanceof Date&&!Number.isNaN(i.getTime())?new Date(i.getTime()):null}function Rl(i,t){let e=String(i||"%d.%m.%Y");return t&&!/%[HM]/.test(e)?`${e} %H:%M`:e}function Pl(i){return i.replace(/%[demYyHMS]/g,t=>({"%d":"DD","%e":"D","%m":"MM","%Y":"YYYY","%y":"YY","%H":"HH","%M":"MM","%S":"SS"})[t]??t)}function Rn(){Vn("date",i=>new V(null,i)),Vn("datetime",i=>ts(null,i))}function Vn(i,t){x.register(i,(e,s)=>{let r=e.own(t({...s.props??{},value:s.value}));return e.listen(r.el,"change",n=>n.stopImmediatePropagation()),r.on("change",n=>e.emit("change",{value:n.detail.date})),{el:r.el,get:()=>r.get(),set:n=>r.set(n,{silent:!0}),focus:()=>r.focus(),setDisabled:n=>n?r.disable():r.enable()}})}var vt=class extends p{static cssName="field-upload";static defaults={url:"",paramName:"upload",params:{},headers:{},multiple:!1,accept:null,maxSize:null,autoUpload:!0,preview:!0,http:null};render(){let t=this.el??a("div");this.el=t,this._ownedNodes=[],this._files=[],this._disabled=!1,this._running=!1,this._runId=0,this._xhr=null,this._transportController=null,this._previewUrl=null,this._initialState=t.getAttribute("data-state"),this._initialDisabled=t.getAttribute("data-disabled");let e=b("zx-upload");return this._input=a("input",{class:"zx-field-upload__input",id:e,type:"file",multiple:!!this.options.multiple,accept:this.options.accept??void 0,tabIndex:-1}),this._dropzone=a("button",{class:"zx-field-upload__dropzone",type:"button",ariaControls:e,ariaLabel:this.options.multiple?"Choose files or drop them here":"Choose a file or drop it here"},a("span",{class:"zx-field-upload__prompt"},this.options.multiple?"Drop files here or choose files":"Drop a file here or choose a file"),a("span",{class:"zx-field-upload__hint"},Bl(this.options))),this._preview=a("div",{class:"zx-field-upload__preview"}),this._progress=a("progress",{class:"zx-field-upload__progress",max:100,value:0,ariaLabel:"Upload progress"}),this._progressText=a("span",{class:"zx-field-upload__progress-text"},"0%"),this._abort=a("button",{class:"zx-btn zx-field-upload__abort",type:"button"},"Abort"),this._progressWrap=a("div",{class:"zx-field-upload__progress-wrap",hidden:!0},this._progress,this._progressText,this._abort),this._status=a("div",{class:"zx-field-upload__status",role:"status",ariaLive:"polite"}),this._ownedNodes.push(this._input,this._dropzone,this._preview,this._progressWrap,this._status),t.append(...this._ownedNodes),this.listen(this._dropzone,"click",()=>{!this._disabled&&!this._running&&this._input.click()}),this.listen(this._input,"change",()=>this._selectFiles(this._input.files)),this.listen(this._dropzone,"dragenter",s=>this._handleDragOver(s)),this.listen(this._dropzone,"dragover",s=>this._handleDragOver(s)),this.listen(this._dropzone,"dragleave",s=>{(!(s.relatedTarget instanceof Node)||!this._dropzone.contains(s.relatedTarget))&&this._setState("idle")}),this.listen(this._dropzone,"drop",s=>{s.preventDefault(),!(this._disabled||this._running)&&(this._setState("idle"),this._selectFiles(s.dataTransfer?.files??[]))}),this.listen(this._abort,"click",()=>this.abort()),this.setDisabled(!1),t}async upload(t=null){if(t!==null&&!this._setFiles(t)||this._disabled||this._running||this._files.length===0)return null;this._running=!0,this._runId+=1;let e=this._runId;this._setState("uploading"),this._progressWrap.hidden=!1,this._abort.hidden=!1,this._setProgress(0),this._status.textContent="Uploading\u2026";try{let s=this.options.http?await this._uploadInjected():await this._uploadXhr();return e!==this._runId?null:(this._running=!1,this._xhr=null,this._transportController=null,this._abort.hidden=!0,this._setProgress(100),this._setState("success"),this._status.textContent="Upload complete.",this.emit("success",{response:s}),s)}catch(s){if(e!==this._runId)return null;let r=s instanceof Error?s:new Error(String(s));return r.name==="AbortError"?(this._finishAbort(),null):(this._running=!1,this._xhr=null,this._transportController=null,this._abort.hidden=!0,this._setState("error"),this._status.textContent=r.message,this.emit("error",{error:r}),null)}}abort(){return this._running?(this._xhr?.abort(),this._transportController?.abort(),this._finishAbort(),this):this}clear(){return this._running&&this.abort(),this._files=[],this._input.value="",this._revokePreview(),this._preview.replaceChildren(),this._progress.value=0,this._progressText.textContent="0%",this._progressWrap.hidden=!0,this._status.textContent="",this._setState("idle"),this}setDisabled(t){return this._disabled=!!t,this._input.disabled=this._disabled,this._dropzone.disabled=this._disabled,this.el.dataset.disabled=String(this._disabled),this}_selectFiles(t){this._setFiles(t)&&(this._input.value="",this.options.autoUpload&&this.upload())}_setFiles(t){if(this._disabled||this._running)return!1;let e=Array.from(t??[]),s=this.options.multiple?e:e.slice(0,1);if(s.length===0)return!1;let r=s.find(o=>!Hl(o,this.options.accept));if(r)return this._selectionError(new Error(`${r.name} is not an accepted file type.`)),!1;let n=this.options.maxSize==null?null:s.find(o=>o.size>Number(this.options.maxSize));return n?(this._selectionError(new Error(`${n.name} exceeds the maximum file size.`)),!1):(this._files=s,this._renderPreview(),this._status.textContent=s.map(o=>o.name).join(", "),this._setState("selected"),this.emit("select",{files:this._files.slice()}),!0)}_handleDragOver(t){t.preventDefault(),!this._disabled&&!this._running&&this._setState("dragover")}_uploadInjected(){let t=this.options.http;this._transportController=new AbortController;let e={files:this._files.slice(),paramName:String(this.options.paramName),params:{...this.options.params},headers:{...this.options.headers},signal:this._transportController.signal,onProgress:s=>this._setProgress(s)};return typeof t.upload=="function"?t.upload(String(this.options.url),e):typeof t.request=="function"?t.request(String(this.options.url),{method:"POST",data:e.params,files:e.files,headers:e.headers,signal:e.signal,onProgress:e.onProgress,paramName:e.paramName}):Promise.reject(new TypeError("Injected upload transport requires upload() or request()"))}_uploadXhr(){return typeof XMLHttpRequest!="function"?Promise.reject(new Error("XMLHttpRequest is not available")):new Promise((t,e)=>{let s=new XMLHttpRequest;this._xhr=s,s.open("POST",String(this.options.url));for(let[r,n]of Object.entries(this.options.headers??{}))s.setRequestHeader(r,String(n));this.listen(s.upload,"progress",r=>{r.lengthComputable&&this._setProgress(r.loaded/r.total*100)}),this.listen(s,"load",()=>{if(s.status<200||s.status>=300){e(new Error(`Upload failed with HTTP ${s.status}`));return}t($l(s.responseText))}),this.listen(s,"error",()=>e(new Error("Upload request failed"))),this.listen(s,"abort",()=>e(Kl())),s.send(ql(this._files,String(this.options.paramName),this.options.params))})}_setProgress(t){let e=Math.max(0,Math.min(100,Number(t)||0));this._progress.value=e,this._progressText.textContent=`${Math.round(e)}%`,this.emit("progress",{percent:e})}_finishAbort(){this._running&&(this._runId+=1,this._running=!1,this._xhr=null,this._transportController=null,this._abort.hidden=!0,this._setState("idle"),this._status.textContent="Upload aborted.",this.emit("abort",{}))}_selectionError(t){this._setState("error"),this._status.textContent=t.message,this.emit("error",{error:t})}_renderPreview(){this._revokePreview(),this._preview.replaceChildren();let t=this._files[0];!this.options.preview||!t?.type?.startsWith("image/")||typeof URL>"u"||typeof URL.createObjectURL!="function"||(this._previewUrl=URL.createObjectURL(t),this._preview.append(a("img",{class:"zx-field-upload__image",src:this._previewUrl,alt:`Preview of ${t.name}`})))}_revokePreview(){this._previewUrl&&typeof URL<"u"&&typeof URL.revokeObjectURL=="function"&&URL.revokeObjectURL(this._previewUrl),this._previewUrl=null}_setState(t){t==="idle"?this.el.removeAttribute("data-state"):this.el.dataset.state=t}destroy(){this._running&&this.abort(),this._revokePreview();for(let t of this._ownedNodes??[])t.remove();this._initialState===null?this.el.removeAttribute("data-state"):this.el.setAttribute("data-state",this._initialState),this._initialDisabled===null?this.el.removeAttribute("data-disabled"):this.el.setAttribute("data-disabled",this._initialDisabled),super.destroy()}};function Bl(i){let t=[];return i.accept&&t.push(String(i.accept)),i.maxSize!=null&&t.push(`up to ${jl(Number(i.maxSize))}`),t.join(" \xB7 ")||"Choose from this device"}function jl(i){return i<1024?`${i} B`:i<1024*1024?`${Math.round(i/1024)} KB`:`${Math.round(i/(1024*1024))} MB`}function Hl(i,t){if(!t)return!0;let e=String(i.type??"").toLowerCase();return String(t).split(",").map(s=>s.trim().toLowerCase()).filter(Boolean).some(s=>s.startsWith(".")?i.name.toLowerCase().endsWith(s):s.endsWith("/*")?e.startsWith(s.slice(0,-1)):e===s)}function ql(i,t,e){let s=new FormData;for(let r of i)s.append(t,r);for(let[r,n]of Object.entries(e??{}))Pn(s,r,n);return s}function Pn(i,t,e){if(e==null)return;if(Array.isArray(e)){for(let r of e)Pn(i,t,r);return}typeof Blob=="function"&&e instanceof Blob?i.append(t,e):i.append(t,typeof e=="object"?JSON.stringify(e):String(e))}function $l(i){if(!i)return null;try{return JSON.parse(i)}catch{return i}}function Kl(){if(typeof DOMException=="function")return new DOMException("Upload aborted","AbortError");let i=new Error("Upload aborted");return i.name="AbortError",i}function Bn(){x.register("upload",(i,t)=>{let e=i.own(new vt(null,{...t.props??{}}));return i.listen(e.el,"change",s=>s.stopImmediatePropagation()),e.on("select",()=>i.emit("change",{value:null})),{el:e.el,get:()=>null,set:()=>e.clear(),focus:()=>e.el.querySelector(".zx-field-upload__dropzone")?.focus(),setDisabled:s=>e.setDisabled(s)}})}var wt=class extends p{static cssName="multi-value-editor";static defaults={values:[],options:null,addLabel:"Add value"};render(){let t=this.el??a("div");return this._values=Array.isArray(this.options.values)?this.options.values.map(String):[],this._ownedNodes=[],this._rows=a("div",{class:"zx-multi-value-editor__rows"}),this._add=a("button",{class:"zx-btn zx-multi-value-editor__add",type:"button",dataset:{action:"add"}},String(this.options.addLabel??"Add value")),this._ownedNodes.push(this._rows,this._add),t.append(this._rows,this._add),this.listen(t,"click",e=>this._handleClick(e)),this.listen(this._rows,"change",e=>this._handleChange(e)),this._renderRows(),t}getValues(){return this._values.slice()}setValues(t,{silent:e=!1}={}){return this._values=Array.isArray(t)?t.map(String):[],this._renderRows(),e||this.emit("change",{values:this.getValues()}),this}_renderRows(t=-1){let e=jn(this.options.options),s=this.options.options!==null,r=this._values.map((n,o)=>{let l=s?a("select",{class:"zx-multi-value-editor__value",ariaLabel:`Value ${o+1}`,dataset:{index:o}},e.map(([c,h])=>a("option",{value:c,selected:c===n},h))):a("input",{class:"zx-multi-value-editor__value",type:"text",value:n,ariaLabel:`Value ${o+1}`,dataset:{index:o}});return a("div",{class:"zx-multi-value-editor__row",dataset:{row:o}},l,a("div",{class:"zx-multi-value-editor__controls"},a("button",{class:"zx-btn",type:"button",disabled:o===0,ariaLabel:`Move value ${o+1} up`,dataset:{action:"up",index:o}},"\u2191"),a("button",{class:"zx-btn",type:"button",disabled:o===this._values.length-1,ariaLabel:`Move value ${o+1} down`,dataset:{action:"down",index:o}},"\u2193"),a("button",{class:"zx-btn",type:"button",ariaLabel:`Remove value ${o+1}`,dataset:{action:"remove",index:o}},"\xD7")))});this._rows.replaceChildren(...r),t>=0&&r[t]?.querySelector(".zx-multi-value-editor__value")?.focus()}_handleClick(t){let e=t.target instanceof Element?t.target.closest("[data-action]"):null;if(!e||!this.el.contains(e))return;let s=e.dataset.action,r=Number(e.dataset.index);if(s==="add"){let n=jn(this.options.options);this._values.push(this.options.options===null?"":n[0]?.[0]??""),this._renderRows(this._values.length-1),this._emitChange()}else if(s==="remove"&&Number.isInteger(r))this._values.splice(r,1),this._renderRows(Math.min(r,this._values.length-1)),this._emitChange();else if((s==="up"||s==="down")&&Number.isInteger(r)){let n=r+(s==="up"?-1:1);if(n<0||n>=this._values.length)return;[this._values[r],this._values[n]]=[this._values[n],this._values[r]],this._renderRows(n),this._emitChange()}}_handleChange(t){let e=t.target instanceof Element?t.target.closest("[data-index]"):null;if(!e)return;let s=Number(e.dataset.index);!Number.isInteger(s)||s<0||s>=this._values.length||(this._values[s]=e.value,this._emitChange())}_emitChange(){this.emit("change",{values:this.getValues()})}destroy(){for(let t of this._ownedNodes??[])t.remove();super.destroy()}};function jn(i){return Array.isArray(i)?i.map(t=>[String(t),String(t)]):i&&typeof i=="object"?Object.entries(i).map(([t,e])=>[t,String(e)]):[]}function Hn(){x.register("multivalueeditor",(i,t)=>{let e=i.own(new wt(null,{...t.props??{},values:Array.isArray(t.value)?t.value:[]})),s=new WeakMap,r=!1,n=()=>{e.el.setAttribute("aria-disabled",String(r));for(let o of e.el.querySelectorAll("input, button, select, textarea"))r?(s.has(o)||s.set(o,!!o.disabled),o.disabled=!0):s.has(o)&&(o.disabled=s.get(o),s.delete(o))};return i.listen(e.el,"change",o=>o.stopImmediatePropagation()),e.on("change",o=>i.emit("change",{value:o.detail.values})),{el:e.el,get:()=>e.getValues(),set:o=>{e.setValues(Array.isArray(o)?o:[],{silent:!0}),n()},focus:()=>e.el.querySelector(".zx-multi-value-editor__value:not([disabled]), button:not([disabled])")?.focus(),setDisabled:o=>{r=!!o,n()}}})}var St=class extends p{static cssName="number-field";static defaults={value:null,min:null,max:null,step:1,largeStep:10,precision:null,wrap:!1,placeholder:"",label:null,unit:null,disabled:!1,readonly:!1,required:!1,name:null,group:!1,locale:null};render(){this._value=null,this._disabled=!1,this._readonly=!1,this._editing=!1,this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("div");this.el=t;let e=Yl(this.options.step);this._step=e,this._precision=this.options.precision===null?Ul(e):Math.max(0,Math.trunc(Number(this.options.precision)||0));let s=this._stepButton("down","minus"),r=this._stepButton("up","plus"),n=a("input",{ref:"input",class:"zx-number-field__input",type:"text",role:"spinbutton",inputMode:this._precision>0?"decimal":"numeric",autocomplete:"off",spellcheck:!1,placeholder:String(this.options.placeholder??""),ariaLabel:this.options.label??void 0,name:this.options.name??void 0,required:!!this.options.required}),o=[s,n];return this.options.unit!==null&&o.push(a("span",{ref:"unit",class:"zx-number-field__unit",ariaHidden:"true"},String(this.options.unit))),o.push(r),t.replaceChildren(...o),this._disabled=!!this.options.disabled,this._readonly=!!this.options.readonly,this.listen(n,"input",()=>this._onInput()),this.listen(n,"keydown",l=>this._onKeydown(l)),this.listen(n,"focus",()=>{this._editing=!0,this._syncInput()}),this.listen(n,"blur",()=>{this._commit(),this._editing=!1,this._syncInput()}),this.listen(s,"click",()=>this._stepBy(-1)),this.listen(r,"click",()=>this._stepBy(1)),this.listen(n,"wheel",l=>{document.activeElement!==n||this._disabled||this._readonly||(l.preventDefault(),this._stepBy(l.deltaY<0?1:-1))},{passive:!1}),this.set(this.options.value,{silent:!0}),this._syncDisabled(),t}get value(){return this._value}set value(t){this.set(t)}get(){return this._value}set(t,{silent:e=!1}={}){let s=this._coerce(t),r=s!==this._value;return this._value=s,this._syncInput(),r&&!e&&this.emit("change",{value:this._value}),this}stepUp(t=1){return this._stepBy(t)}stepDown(t=1){return this._stepBy(-t)}reset({silent:t=!1}={}){return this.set(this.options.value,{silent:t})}focus(){return this.refs.input.focus(),this}getInput(){return this.refs.input}enable(){return this._disabled=!1,this._syncDisabled(),this}disable(){return this._disabled=!0,this._syncDisabled(),this}setReadonly(t){return this._readonly=!!t,this._syncDisabled(),this}setRange(t,e){return this._min=t==null?null:Number(t),this._max=e==null?null:Number(e),this.set(this._value,{silent:!0})}_stepButton(t,e){return a("button",{ref:t,class:"zx-number-field__step",type:"button",tabIndex:-1,ariaHidden:"true",dataset:{step:t}},_(e,{size:13}))}get _rangeMin(){return this._min!==void 0?this._min:this.options.min===null||this.options.min===void 0?null:Number(this.options.min)}get _rangeMax(){return this._max!==void 0?this._max:this.options.max===null||this.options.max===void 0?null:Number(this.options.max)}_coerce(t){let e=we(t,this.options.group?this._separators():null);return e===null?null:Se(e,{min:this._rangeMin,max:this._rangeMax,step:this._step,precision:this._precision})}_stepBy(t){if(this._disabled||this._readonly)return this;let e=this._rangeMin,s=this._rangeMax,n=we(this.refs.input.value)??this._value,o=n===null?e??0:n,l=n===null&&t>0&&e!==null?e-this._step*t:o,c=qn(l+this._step*t,this._precision);return this.options.wrap&&e!==null&&s!==null&&(c>s?c=e:c<e&&(c=s)),this.set(c),this}_separators(){if(this._localeSeparators)return this._localeSeparators;let t=new Intl.NumberFormat(this.options.locale??void 0,{minimumFractionDigits:1}).formatToParts(1234.5);return this._localeSeparators={group:t.find(e=>e.type==="group")?.value??",",decimal:t.find(e=>e.type==="decimal")?.value??"."},this._localeSeparators}_onInput(){let t=we(this.refs.input.value,this.options.group?this._separators():null);this._syncAria(t),this.emit("input",{value:t})}_onKeydown(t){if(this._disabled||this._readonly)return;let e=Math.max(1,Math.trunc(Number(this.options.largeStep)||1)),r={ArrowUp:()=>this._stepBy(1),ArrowDown:()=>this._stepBy(-1),PageUp:()=>this._stepBy(e),PageDown:()=>this._stepBy(-e),Home:()=>this._rangeMin===null?null:this.set(this._rangeMin),End:()=>this._rangeMax===null?null:this.set(this._rangeMax),Enter:()=>this._commit()}[t.key];r&&(t.key==="Home"&&this._rangeMin===null||t.key==="End"&&this._rangeMax===null||(t.preventDefault(),r()))}_commit(){this.set(this.refs.input.value)}_syncInput(){let t=this.refs.input,e=this._value===null?"":this._format(this._value,this._editing);t.value!==e&&(t.value=e),this._syncAria(this._value)}_syncAria(t){let e=this.refs.input,s=this._rangeMin,r=this._rangeMax;if(s===null?e.removeAttribute("aria-valuemin"):e.setAttribute("aria-valuemin",String(s)),r===null?e.removeAttribute("aria-valuemax"):e.setAttribute("aria-valuemax",String(r)),t===null)e.removeAttribute("aria-valuenow"),e.setAttribute("aria-valuetext",this._message("numberField.empty","Empty"));else{e.setAttribute("aria-valuenow",String(t));let n=this.options.unit===null?"":` ${this.options.unit}`;e.setAttribute("aria-valuetext",`${this._format(t,!1)}${n}`)}this.el.toggleAttribute("data-empty",t===null)}_format(t,e){return this.options.group?new Intl.NumberFormat(this.options.locale??void 0,{minimumFractionDigits:this._precision,maximumFractionDigits:this._precision,useGrouping:!e}).format(t):t.toFixed(this._precision)}_message(t,e){let s=this.msg(t);return s===t?e:s}_syncDisabled(){let t=this.refs.input;t.disabled=this._disabled,t.readOnly=this._readonly,this.refs.up.disabled=this._disabled||this._readonly,this.refs.down.disabled=this._disabled||this._readonly,this.el.toggleAttribute("data-disabled",this._disabled),this.el.toggleAttribute("data-readonly",this._readonly),this._disabled?this.el.setAttribute("aria-disabled","true"):this.el.removeAttribute("aria-disabled")}destroy(){let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}};function we(i,t=null){if(typeof i=="number")return Number.isFinite(i)?i:null;if(i==null)return null;let e=String(i).trim();if(e==="")return null;let s;if(t)s=e.split(t.group).join("").replace(t.decimal,".").replace(/[^\d.\-+eE]/g,"");else{let n=e.replace(/[^\d,.\-+eE]/g,""),o=n.lastIndexOf(","),l=n.lastIndexOf(".");s=n,o>=0&&o>l?s=n.replace(/\./g,"").replace(",","."):o>=0&&(s=n.replace(/,/g,""))}if(!/\d/.test(s))return null;let r=Number(s);return Number.isFinite(r)?r:null}function Se(i,{min:t,max:e,step:s,precision:r}){let n=i;if(s>0){let o=t??0;n=o+Math.round((i-o)/s)*s}return n=qn(n,r),t!==null&&n<t?t:e!==null&&n>e?e:n}function Yl(i){let t=Number(i);return Number.isFinite(t)&&t>0?t:1}function Ul(i){let t=String(i),e=t.match(/e-(\d+)/i);if(e)return Number(e[1]);let s=t.split(".")[1];return s?s.length:0}function qn(i,t){return Number.isFinite(i)?Number(i.toFixed(Math.min(15,Math.max(0,t)))):i}function $n(){x.register("number",(i,t)=>{let e=i.own(new St(null,{label:t.label?String(t.label):void 0,placeholder:t.placeholder,required:t.required,...t.props??{}})),s=!1;return i.listen(e.el,"change",r=>r.stopImmediatePropagation()),e.on("change",r=>{s||i.emit("change",{value:r.detail.value})}),{el:e.el,get:()=>e.get(),set:r=>{s=!0;try{e.set(r===""||r===null||r===void 0?null:r,{silent:!0})}finally{s=!1}},focus:()=>e.focus(),setDisabled:r=>r?e.disable():e.enable()}})}var Jt=class extends p{static cssName="rating";static defaults={value:0,max:5,allowHalf:!1,clearable:!0,readonly:!1,disabled:!1,label:"Rating",icon:"star",labels:null,showValue:!1,count:null,size:"md"};render(){this._value=0,this._preview=null,this._disabled=!1,this._readonly=!1,this._radios=[],this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("div");this.el=t,this._max=Math.max(1,Math.trunc(Number(this.options.max)||5)),this._step=this.options.allowHalf?.5:1,this._disabled=!!this.options.disabled,this._readonly=!!this.options.readonly,this._name=b("zx-rating");let e=a("div",{ref:"symbols",class:"zx-rating__symbols",role:"radiogroup",ariaLabel:String(this.options.label??"Rating")});for(let s=1;s<=this._max;s+=1){let r=a("span",{class:"zx-rating__symbol"},a("span",{class:"zx-rating__glyph",ariaHidden:"true"},_(this.options.icon,{size:Ae[this.options.size]??Ae.md})),a("span",{class:"zx-rating__glyph",dataset:{part:"on"},ariaHidden:"true"},_(this.options.icon,{size:Ae[this.options.size]??Ae.md})));this.options.allowHalf?r.append(this._radio(s-.5,"half"),this._radio(s,"full")):r.append(this._radio(s,"full")),e.append(r)}return t.replaceChildren(e,a("span",{ref:"readout",class:"zx-rating__readout"})),t.dataset.size=Ae[this.options.size]?this.options.size:"md",this.listen(e,"keydown",s=>this._onKeydown(s)),this.listen(e,"pointerleave",()=>this._setPreview(null)),this.set(this.options.value,{silent:!0}),this._syncDisabled(),t}get value(){return this._value}set value(t){this.set(t)}get(){return this._value}set(t,{silent:e=!1}={}){let s=this._clamp(t),r=s!==this._value;return this._value=s,this._preview=null,this._sync(),r&&!e&&this.emit("change",{value:this._value}),this}clear({silent:t=!1}={}){return this.set(0,{silent:t})}reset({silent:t=!1}={}){return this.set(this.options.value,{silent:t})}setCount(t){return this._count=t,this._syncReadout(),this}focus(){return(this._radios.find(e=>e.tabIndex===0)??this._radios[0])?.focus(),this}enable(){return this._disabled=!1,this._syncDisabled(),this}disable(){return this._disabled=!0,this._syncDisabled(),this}setReadonly(t){return this._readonly=!!t,this._syncDisabled(),this}_radio(t,e){let s=a("button",{class:"zx-rating__radio",type:"button",role:"radio",tabIndex:-1,ariaChecked:"false",ariaLabel:this._stepLabel(t),dataset:{value:String(t),part:e}});return this.listen(s,"click",r=>{this._choose(t,r.detail>0)}),this.listen(s,"pointerenter",()=>this._setPreview(t)),this.listen(s,"focus",()=>this._setPreview(t)),this.listen(s,"blur",()=>this._setPreview(null)),this._radios.push(s),s}_stepLabel(t){let e=this.options.labels;if(Array.isArray(e)){let s=Math.round(t/this._step)-1;if(e[s]!=null)return String(e[s])}return this._message("rating.value","%1 of %2",[t,this._max])}_message(t,e,s){let r=this.msg(t,...s);return r===t?F(e,s):r}_choose(t,e){this._disabled||this._readonly||(e&&this.options.clearable&&t===this._value?this.set(0):this.set(t))}_onKeydown(t){if(this._disabled||this._readonly)return;let e=["ArrowRight","ArrowDown"],s=["ArrowLeft","ArrowUp"];if(e.includes(t.key))t.preventDefault(),this.set(this._value>=this._max?this._step:(this._value||0)+this._step);else if(s.includes(t.key))t.preventDefault(),this.set(this._value<=this._step?this._max:this._value-this._step);else if(t.key==="Home")t.preventDefault(),this.set(this._step);else if(t.key==="End")t.preventDefault(),this.set(this._max);else if((t.key==="Delete"||t.key==="Backspace")&&this.options.clearable)t.preventDefault(),this.set(0);else return;this.focus()}_setPreview(t){let e=this._disabled||this._readonly?null:t;e!==this._preview&&(this._preview=e,this._paint(),this.emit("hover",{value:this._preview}))}_clamp(t){let e=Number(t);if(!Number.isFinite(e)||e<=0)return 0;let s=Math.round(e/this._step)*this._step;return Math.min(this._max,Math.max(0,s))}_sync(){for(let e of this._radios){let s=Number(e.dataset.value);e.setAttribute("aria-checked",String(s===this._value))}let t=this._radios.find(e=>e.getAttribute("aria-checked")==="true");for(let e of this._radios)e.tabIndex=-1;(t??this._radios[0]).tabIndex=0,this._paint(),this._syncReadout()}_paint(){let t=this._preview??this._value;this.refs.symbols.querySelectorAll(".zx-rating__symbol").forEach((s,r)=>{let n=Math.min(1,Math.max(0,t-r));s.style.setProperty("--zx-rating-fill",`${n*100}%`),s.toggleAttribute("data-preview",this._preview!==null)}),this.el.dataset.value=String(t)}_syncReadout(){let t=this.refs.readout;if(!t)return;let e=this._count===void 0?this.options.count:this._count,s=[];this.options.showValue&&s.push(Wl(this._value,this._step)),e!=null&&s.push(this._message("rating.count","%1 ratings",[e])),t.textContent=s.join(" \xB7 ")}_syncDisabled(){let t=this._disabled||this._readonly;for(let e of this._radios)e.disabled=this._disabled;this.refs.symbols.setAttribute("aria-readonly",String(this._readonly)),this.el.toggleAttribute("data-disabled",this._disabled),this.el.toggleAttribute("data-readonly",this._readonly),this.el.toggleAttribute("data-inert",t),this._disabled?this.el.setAttribute("aria-disabled","true"):this.el.removeAttribute("aria-disabled")}destroy(){let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}},Ae={sm:14,md:18,lg:24};function Wl(i,t){return t<1?i.toFixed(1):String(i)}function Kn(){x.register("rating",(i,t)=>{let e=i.own(new Jt(null,{label:t.label?String(t.label):void 0,...t.props??{}})),s=!1;return e.on("change",r=>{s||i.emit("change",{value:r.detail.value})}),{el:e.el,get:()=>e.get()||null,set:r=>{s=!0;try{e.set(Number(r)||0,{silent:!0})}finally{s=!1}},focus:()=>e.focus(),setDisabled:r=>r?e.disable():e.enable()}})}var Gl=["a[href]","area[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","iframe","object","embed",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(",");function Un(i){let t=!1,e=null;function s(r){if(r.key!=="Tab")return;let n=Yn(i);if(n.length===0){r.preventDefault();return}let o=n[0],l=n[n.length-1];r.shiftKey&&(document.activeElement===o||!i.contains(document.activeElement))?(r.preventDefault(),l.focus()):!r.shiftKey&&(document.activeElement===l||!i.contains(document.activeElement))&&(r.preventDefault(),o.focus())}return{activate(){t||(t=!0,e=document.activeElement,document.addEventListener("keydown",s),Yn(i)[0]?.focus())},deactivate(){t&&(t=!1,document.removeEventListener("keydown",s),e?.isConnected&&typeof e.focus=="function"&&e.focus(),e=null)}}}function At(i,t,{orientation:e="vertical",wrap:s=!0}={}){let r=new AbortController,n=new Map,o=!1;function l(){return Array.from(i.querySelectorAll(t)).filter(f=>(c(f),Wn(f)))}function c(f){n.has(f)||n.set(f,f.getAttribute("tabindex"))}function h(f=null){let g=l(),y=f&&g.includes(f)?f:g.find(z=>z.tabIndex===0)??g[0];for(let z of g){let T=z===y?0:-1;z.tabIndex!==T&&(z.tabIndex=T)}}function u(f){let g=l(),y=f.target?.closest?.(t),z=g.indexOf(y);if(z<0)return;let T=e==="horizontal"?"ArrowLeft":"ArrowUp",Vi=e==="horizontal"?"ArrowRight":"ArrowDown",H=null;f.key==="Home"?H=0:f.key==="End"?H=g.length-1:f.key===T?H=z-1:f.key===Vi&&(H=z+1),!(H===null||g.length===0)&&(s?H=(H+g.length)%g.length:H=Math.max(0,Math.min(g.length-1,H)),f.preventDefault(),h(g[H]),g[H].focus())}function d(f){let g=f.target?.closest?.(t);g&&i.contains(g)&&h(g)}i.addEventListener("keydown",u,{signal:r.signal}),i.addEventListener("focusin",d,{signal:r.signal});let m=typeof MutationObserver=="function"?new MutationObserver(()=>h()):null;return m?.observe(i,{childList:!0,subtree:!0,attributes:!0}),h(),{focusFirst(){let f=l()[0];f&&(h(f),f.focus())},focusLast(){let f=l(),g=f[f.length-1];g&&(h(g),g.focus())},destroy(){if(!o){o=!0,r.abort(),m?.disconnect();for(let[f,g]of n)g===null?f.removeAttribute("tabindex"):f.setAttribute("tabindex",g);n.clear()}}}}function Z(i,t){let e="",s=null;return function(n){let o=typeof n=="string"?n:n.key;if(typeof n!="string"&&(n.ctrlKey||n.metaKey||n.altKey)||!o||o.length!==1||/\s/.test(o))return;s!==null&&clearTimeout(s),e+=o.toLocaleLowerCase(),e.split("").every(h=>h===e[0])&&(e=e[0]),s=setTimeout(()=>{e="",s=null},500);let l=i(),c=l.findIndex(h=>Ql(h).startsWith(e));c>=0&&t(l[c],c)}}function Yn(i){return Array.from(i.querySelectorAll(Gl)).filter(t=>Wn(t)&&t.getClientRects().length>0)}function Wn(i){return!(!(i instanceof HTMLElement)||i.hidden||i.getAttribute("aria-hidden")==="true"||i.matches(":disabled"))}function Ql(i){if(typeof i=="string"||typeof i=="number")return String(i).trim().toLocaleLowerCase();if(i&&typeof i=="object"&&"textContent"in i)return String(i.textContent??"").trim().toLocaleLowerCase();if(i&&typeof i=="object"){let t=i.label??i.text??i.value;if(t!=null)return String(t).trim().toLocaleLowerCase()}return String(i??"").trim().toLocaleLowerCase()}var Zl=["priority.lowest","priority.low","priority.normal","priority.high","priority.highest"],Jl=["Lowest","Low","Normal","High","Highest"],I=class i extends p{static cssName="select";static defaults={items:[],valueKey:"ID",labelKey:"name",renderItem:null,renderValue:null,value:null,disabled:!1,placeholder:"",clearable:!1,filter:!1,searchKeys:null,minQuery:0,debounce:200,listHeight:280,groupKey:null};render(){this._items=[],this._visibleItems=[],this._selected=null,this._optionEntries=[],this._activeIndex=-1,this._open=!1,this._disabled=!1,this._loading=!1,this._requestSequence=0,this._queryTimer=null,this._position=null,this._createdRoot=!1,this._root=null,this._originalChildren=[],this._originalAttributes=new Map,this._createdRoot=this.el===null;let t=this.el??a("div");this.el=t,this._root=t,this._createdRoot||(this._originalChildren=Array.from(t.childNodes)),this._rememberAttribute(t,"data-state"),this._rememberAttribute(t,"data-loading"),this._rememberAttribute(t,"aria-disabled");let e=b("zx-select-list"),s=a("input",{ref:"input",class:"zx-select__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:!1,ariaExpanded:"false",ariaControls:e,ariaAutocomplete:this.options.filter?"list":"none",placeholder:String(this.options.placeholder??""),readOnly:!this.options.filter}),r=a("button",{ref:"clear",class:"zx-icon-btn zx-select__clear",type:"button",tabIndex:-1,ariaLabel:this._message("select.clear","Clear selection"),hidden:!0},_("x",{size:13})),n=a("span",{ref:"loading",class:"zx-select__loading",role:"status",ariaLabel:this._message("select.loading","Loading"),hidden:!0}),o=a("button",{ref:"toggle",class:"zx-select__toggle",type:"button",tabIndex:-1,ariaLabel:this._message("select.toggle","Toggle options")},_("chevron-down",{size:16})),l=a("div",{ref:"control",class:"zx-select__control"},s,r,n,o),c=a("div",{ref:"list",class:"zx-select__list",id:e,role:"listbox"});c.style.maxBlockSize=`${Math.max(0,Number(this.options.listHeight)||0)}px`;let h=a("div",{ref:"panel",class:"zx-select__panel",popover:"manual"},c);return t.replaceChildren(l,h),this._items=Array.isArray(this.options.items)?this.options.items.slice():[],this._visibleItems=this._items.slice(),this._disabled=!!this.options.disabled,this._handleTypeahead=Z(()=>this._optionEntries.filter(u=>!u.clear).map(u=>u.element),(u,d)=>{this._open||this.open(),this._setActive(this._itemEntryIndex(d))}),this.listen(s,"click",()=>this.open()),this.listen(s,"input",()=>this._onInput()),this.listen(s,"keydown",u=>this._onKeydown(u)),this.listen(o,"click",()=>{this.focus(),this._open?this.close():this.open()}),this.listen(r,"click",()=>{this.set(null),this.focus()}),this.listen(h,"pointerdown",u=>u.preventDefault()),this.listen(h,"click",u=>this._onOptionClick(u)),this.listen(document,"pointerdown",u=>{this._open&&!t.contains(u.target)&&this.close()},{capture:!0}),this._renderOptions(),this.set(this.options.value,{silent:!0}),this._syncDisabled(),t}get value(){return this._selected===null?null:this._itemValue(this._selected)}set value(t){this.set(t)}get selected(){return this._selected}set(t,{silent:e=!1}={}){let s=this.value,r=t==null?null:this._findItem(t);this._selected=r,this._syncInputValue(),this._renderOptions();let n=this.value;return!e&&!Object.is(s,n)&&this.emit("change",{value:n,item:r}),this}setItems(t){let e=this.value;return this._items=Array.isArray(t)?t.slice():[],this._visibleItems=this._items.slice(),this._selected=e==null?null:this._items.find(s=>Object.is(this._itemValue(s),e))??null,this._syncInputValue(),this._renderOptions(),this._position?.update(),this}reset({silent:t=!1}={}){return this.set(this.options.value,{silent:t}),this}open(){return this._disabled||this._open?this:(this._open=!0,this.el.setAttribute("data-state","open"),this.refs.input.setAttribute("aria-expanded","true"),this._renderOptions(),this._position=q(this.refs.control,this.refs.panel,{placement:"bottom-start",flip:!0,matchWidth:!0}),this._setActive(this._selectedEntryIndex()),this._activeIndex<0&&this._optionEntries.length>0&&this._setActive(0),this.options.filter&&this._selected!==null&&this.refs.input.select(),typeof this.options.filter=="function"&&this._scheduleAsyncQuery(""),this.emit("open",{}),this)}close(){return this._open?(this._open=!1,this._cancelQuery(),this._setLoading(!1),this._position?.destroy(),this._position=null,this.el.setAttribute("data-state","closed"),this.refs.input.setAttribute("aria-expanded","false"),this.refs.input.removeAttribute("aria-activedescendant"),this._activeIndex=-1,this._visibleItems=this._items.slice(),this._syncInputValue(),this.emit("close",{}),this):this}enable(){return this._disabled=!1,this._syncDisabled(),this}disable(){return this.close(),this._disabled=!0,this._syncDisabled(),this}focus(){return this.refs.input.focus(),this}static priority(t,e={}){let s=e.value??null,r=new i(t,{...e,value:null,items:[],renderItem(n){return a("span",{class:"zx-select__priority"},a("span",{class:"zx-select__priority-icon",dataset:{level:n.level},ariaHidden:"true"}),a("span",{},String(n.name)))}});return r.setItems(Zl.map((n,o)=>({ID:o,name:r._message(n,Jl[o]),level:o}))),r.set(s,{silent:!0}),r}destroy(){this._cancelQuery(),this._position?.destroy(),this._position=null;let t=this.el;if(!this._createdRoot&&t){t.replaceChildren(...this._originalChildren);for(let[e,s]of this._originalAttributes)s===null?t.removeAttribute(e):t.setAttribute(e,s)}super.destroy()}_onKeydown(t){if(!this._disabled){if(t.key==="ArrowDown"){t.preventDefault(),this._open?this._moveActive(1):this.open();return}if(t.key==="ArrowUp"){t.preventDefault(),this._open?this._moveActive(-1):(this.open(),this._setActive(this._optionEntries.length-1));return}if(t.key==="Home"&&this._open){t.preventDefault(),this._setActive(0);return}if(t.key==="End"&&this._open){t.preventDefault(),this._setActive(this._optionEntries.length-1);return}if(t.key==="Enter"&&this._open){t.preventDefault(),this._chooseEntry(this._optionEntries[this._activeIndex]);return}if(t.key==="Escape"&&this._open){t.preventDefault(),this.close();return}if(t.key==="Tab"&&this._open){this.close();return}!this.options.filter&&Xl(t)&&this._handleTypeahead(t)}}_onInput(){if(!this.options.filter)return;let t=this.refs.input.value;if(this._open||this.open(),this.options.filter==="local"){let e=this.options.searchKeys??[this.options.labelKey];this._visibleItems=It(this._items,t,e),this._renderOptions(),this._setActive(this._optionEntries.length>0?0:-1),this._position?.update()}else typeof this.options.filter=="function"&&this._scheduleAsyncQuery(t)}_onOptionClick(t){let e=t.target?.closest?.('[role="option"]');!e||!this.refs.panel.contains(e)||this._chooseEntry(this._optionEntries[Number(e.getAttribute("data-index"))])}_chooseEntry(t){t&&(this.set(t.clear?null:t.item),this.close(),this.focus())}_moveActive(t){let e=this._optionEntries.length;e!==0&&this._setActive((this._activeIndex+t+e)%e)}_setActive(t){this._activeIndex=t>=0&&t<this._optionEntries.length?t:-1,this._optionEntries.forEach((s,r)=>{r===this._activeIndex?s.element.setAttribute("data-active","true"):s.element.removeAttribute("data-active")});let e=this._optionEntries[this._activeIndex]?.element;e?(this.refs.input.setAttribute("aria-activedescendant",e.id),e.scrollIntoView?.({block:"nearest"})):this.refs.input.removeAttribute("aria-activedescendant")}_renderOptions(){let t=this.refs.list;if(!t)return;t.replaceChildren(),this._optionEntries=[];let e=Symbol("initial-group");this.options.clearable&&this._appendOption(null,!0,this.options.placeholder||this._message("select.none","No selection"));for(let s of this._visibleItems){if(this.options.groupKey){let r=this._read(s,this.options.groupKey);Object.is(r,e)||(t.append(a("div",{class:"zx-select__group",role:"presentation"},String(r??""))),e=r)}this._appendOption(s,!1)}this._visibleItems.length===0&&!this._loading&&t.append(a("div",{class:"zx-select__empty",role:"status"},this._message("select.empty","No matches"))),this._setActive(-1)}_appendOption(t,e,s){let r=e?this._selected===null:this._selected!==null&&Object.is(this._itemValue(t),this.value),n=this._optionEntries.length,o=e?String(s??""):this._renderItem(t),l=a("div",{class:"zx-select__option",id:b("zx-select-option"),role:"option",ariaSelected:String(r),dataset:{index:n}},a("span",{class:"zx-select__option-content"},o));r&&l.append(_("check",{size:15})),this.refs.list.append(l),this._optionEntries.push({item:t,clear:e,element:l})}_renderItem(t){if(typeof this.options.renderItem=="function"){let e=this.options.renderItem(t);return e&&typeof e=="object"&&"nodeType"in e?e:String(e??"")}return this._itemLabel(t)}_scheduleAsyncQuery(t){this._queryTimer!==null&&clearTimeout(this._queryTimer),this._requestSequence+=1;let e=this._requestSequence;if(t.length<Math.max(0,Number(this.options.minQuery)||0)){this._setLoading(!1),this._visibleItems=[],this._renderOptions();return}this._setLoading(!0),this._renderOptions(),this._position?.update();let s=Math.max(0,Number(this.options.debounce)||0);this._queryTimer=setTimeout(()=>{this._queryTimer=null,this._runAsyncQuery(t,e)},s)}async _runAsyncQuery(t,e){if(!(e!==this._requestSequence||typeof this.options.filter!="function")){this.emit("query",{query:t});try{let s=await this.options.filter(t);if(e!==this._requestSequence||!this._open)return;this._items=Array.isArray(s)?s.slice():[],this._visibleItems=this._items.slice(),this._setLoading(!1),this._renderOptions(),this._setActive(this._optionEntries.length>0?0:-1),this._position?.update(),this.emit("loaded",{items:this._items.slice()})}catch{if(e!==this._requestSequence||!this._open)return;this._items=[],this._visibleItems=[],this._setLoading(!1),this._renderOptions(),this._position?.update()}}}_cancelQuery(){this._queryTimer!==null&&clearTimeout(this._queryTimer),this._queryTimer=null,this._requestSequence+=1}_setLoading(t){this._loading=t,this.refs.loading.hidden=!t,this.refs.input.setAttribute("aria-busy",String(t)),this.refs.list.setAttribute("aria-busy",String(t)),t?this._root?.setAttribute("data-loading","true"):this._root?.removeAttribute("data-loading")}_syncInputValue(){if(!this.refs.input)return;let t=this.refs.input;t.value=this._selected===null?"":typeof this.options.renderValue=="function"?String(this.options.renderValue(this._selected)??""):this._itemLabel(this._selected),this.refs.clear.hidden=!this.options.clearable||this._selected===null}_syncDisabled(){let t=this.refs.input,e=this.refs.clear,s=this.refs.toggle;t.disabled=this._disabled,e.disabled=this._disabled,s.disabled=this._disabled,this._root?.setAttribute("aria-disabled",String(this._disabled))}_findItem(t){let e=this._items.find(r=>r===t);if(e!==void 0)return e;let s=t!==null&&typeof t=="object"?this._itemValue(t):t;return this._items.find(r=>Object.is(this._itemValue(r),s))??null}_itemValue(t){return this._read(t,this.options.valueKey)}_itemLabel(t){let e=this._read(t,this.options.labelKey);return String(e??"")}_read(t,e){return typeof e=="function"?e(t):t===null||typeof t!="object"?t:t[e]}_selectedEntryIndex(){return this._selected===null?this.options.clearable?0:-1:this._optionEntries.findIndex(t=>!t.clear&&Object.is(this._itemValue(t.item),this.value))}_itemEntryIndex(t){return t+(this.options.clearable?1:0)}_rememberAttribute(t,e){this._originalAttributes.set(e,t.getAttribute(e))}_message(t,e){let s=this.msg(t);return s===t?e:s}};function Xl(i){return i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey}function Gn(){x.register("zxselect",(i,t)=>{let e=i.own(new I(null,{...t.props??{},value:t.value}));return i.listen(e.el,"change",s=>s.stopImmediatePropagation()),e.on("change",s=>i.emit("change",{value:s.detail.value})),{el:e.el,get:()=>e.value,set:s=>e.set(s,{silent:!0}),focus:()=>e.focus(),setDisabled:s=>s?e.disable():e.enable()}})}var Xt=class extends p{static cssName="slider";static defaults={value:0,min:0,max:100,step:1,label:"",hideLabel:!1,showValue:!0,showBounds:!1,showInput:!1,unit:"",marks:null,disabled:!1,readonly:!1,size:"md",formatValue:null};render(){this._value=0,this._readonly=!!this.options.readonly,this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("div");this.el=t,this._min=Number(this.options.min)||0,this._max=Number(this.options.max),(!Number.isFinite(this._max)||this._max<=this._min)&&(this._max=this._min+100),this._step=Math.abs(Number(this.options.step))||1,this._id=b("zx-slider");let e=a("input",{ref:"input",class:"zx-slider__input",type:"range",id:this._id,min:String(this._min),max:String(this._max),step:String(this._step),disabled:!!this.options.disabled}),s=a("div",{class:"zx-slider__track"},e,this._marks()),r=a("div",{class:"zx-slider__control"});return this.options.showBounds&&r.append(a("span",{class:"zx-slider__bound",ariaHidden:"true"},this._format(this._min))),r.append(s),this.options.showBounds&&r.append(a("span",{class:"zx-slider__bound",ariaHidden:"true"},this._format(this._max))),this.options.showInput&&r.append(this._numberBox()),t.replaceChildren(a("div",{class:"zx-slider__head"},a("label",{ref:"label",class:"zx-slider__label",for:this._id},String(this.options.label??"")),a("span",{ref:"output",class:"zx-slider__value",ariaHidden:"true"})),r),t.dataset.size=this.options.size==="sm"?"sm":"md",t.toggleAttribute("data-hide-label",!!this.options.hideLabel),this.listen(e,"input",()=>this._onInput()),this.listen(e,"change",()=>this._onCommit()),this.listen(e,"keydown",n=>{this._readonly&&tc.has(n.key)&&n.preventDefault()}),this.set(this.options.value,{silent:!0}),this._syncState(),t}get value(){return this._value}set value(t){this.set(t)}get(){return this._value}set(t,{silent:e=!1}={}){let s=this._snap(t),r=s!==this._value;return this._value=s,this._paint(),r&&!e&&this.emit("change",{value:s}),this}setRange(t,e,s){let r=Number(t),n=Number(e);if(!Number.isFinite(r)||!Number.isFinite(n)||n<=r)throw new RangeError("Slider range requires min < max");this._min=r,this._max=n,s!==void 0&&(this._step=Math.abs(Number(s))||1);let{input:o}=this.refs;o.min=String(this._min),o.max=String(this._max),o.step=String(this._step);for(let[l,c]of[...this.el.querySelectorAll(".zx-slider__bound")].entries())c.textContent=this._format(l===0?this._min:this._max);return this.set(this._value,{silent:!0})}focus(){return this.refs.input.focus(),this}enable(){return this.refs.input.disabled=!1,this.refs.number&&(this.refs.number.disabled=!1),this._syncState(),this}disable(){return this.refs.input.disabled=!0,this.refs.number&&(this.refs.number.disabled=!0),this._syncState(),this}setReadonly(t){return this._readonly=!!t,this.refs.number&&(this.refs.number.readOnly=this._readonly),this._syncState(),this}setLabel(t){return this.refs.label.textContent=String(t??""),this}_numberBox(){let t=a("input",{ref:"number",class:"zx-slider__number",type:"number",min:String(this._min),max:String(this._max),step:String(this._step),disabled:!!this.options.disabled,readOnly:this._readonly,ariaLabel:String(this.options.label??"Value")});return this.listen(t,"input",()=>{if(this._readonly)return;let e=Number(t.value);t.value===""||!Number.isFinite(e)||(this._value=this._snap(e),this.refs.input.value=String(this._value),this._paintTrack(),this.emit("input",{value:this._value}))}),this.listen(t,"change",()=>{if(this._readonly){t.value=String(this._value);return}this.set(t.value===""?this._min:Number(t.value))}),t}_marks(){let t=this.options.marks;if(!Array.isArray(t)||t.length===0)return null;let e=a("div",{class:"zx-slider__marks",ariaHidden:"true"});for(let s of t){let r=typeof s=="number"?s:Number(s?.value);if(!Number.isFinite(r))continue;let n=typeof s=="number"?this._format(r):String(s.label??this._format(r));e.append(a("span",{class:"zx-slider__mark",style:{"--zx-slider-mark":`${this._ratio(r)*100}%`}},n))}return e}_onInput(){if(this._readonly){this.refs.input.value=String(this._value);return}this._value=this._snap(this.refs.input.value),this._paintTrack(),this.refs.number&&(this.refs.number.value=String(this._value)),this.emit("input",{value:this._value})}_onCommit(){if(this._readonly){this.refs.input.value=String(this._value);return}this.emit("change",{value:this._value})}_paint(){this.refs.input.value=String(this._value),this.refs.number&&(this.refs.number.value=String(this._value)),this._paintTrack()}_paintTrack(){this.el.style.setProperty("--zx-slider-fill",`${this._ratio(this._value)*100}%`);let{output:t}=this.refs;t.textContent=this.options.showValue?this._format(this._value):""}_syncState(){let t=this.refs.input.disabled;this.el.toggleAttribute("data-disabled",t),this.el.toggleAttribute("data-readonly",this._readonly),this.refs.input.setAttribute("aria-readonly",String(this._readonly))}_snap(t){let e=Number(t);return Number.isFinite(e)?Se(e,{min:this._min,max:this._max,step:this._step,precision:rr(this._step)}):this._min}_ratio(t){return B((t-this._min)/(this._max-this._min),0,1)}_format(t){let e=this.options.formatValue;return typeof e=="function"?String(e(t)):`${ec(t)}${this.options.unit??""}`}destroy(){let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}},tc=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"]);function rr(i){let t=String(i),e=/e-(\d+)$/i.exec(t);return e?Number(e[1]):(t.split(".")[1]??"").length}function ec(i){return String(Number(i.toFixed(6)))}function Qn(){x.register("slider",(i,t)=>{let e=i.own(new Xt(null,{label:t.label?String(t.label):void 0,hideLabel:!0,disabled:!!t.disabled,...t.props??{}})),s=!1;return e.on("change",r=>{s||i.emit("change",{value:r.detail.value})}),{el:e.el,get:()=>e.get(),set:r=>{s=!0;try{e.set(Number(r)||0,{silent:!0})}finally{s=!1}},focus:()=>e.focus(),setDisabled:r=>r?e.disable():e.enable()}})}var te=class extends p{static cssName="tag-picker";static defaults={items:[],values:[],valueKey:"ID",labelKey:"name",searchKeys:null,filter:"local",minQuery:0,debounce:200,allowCreate:!1,max:null,closeOnSelect:!1,placeholder:"",listHeight:260,disabled:!1,readonly:!1,renderItem:null,renderTag:null};render(){this._items=[],this._selected=[],this._visible=[],this._entries=[],this._activeIndex=-1,this._open=!1,this._disabled=!1,this._readonly=!1,this._loading=!1,this._requestSequence=0,this._queryTimer=null,this._position=null,this._activeId=null,this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("div");this.el=t;let e=b("zx-tag-picker-list"),s=a("span",{ref:"tags",class:"zx-tag-picker__tags"}),r=a("input",{ref:"input",class:"zx-tag-picker__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:!1,ariaExpanded:"false",ariaControls:e,ariaAutocomplete:"list",ariaLabel:this._message("tagPicker.input","Add a value"),placeholder:String(this.options.placeholder??"")}),n=a("button",{ref:"toggle",class:"zx-tag-picker__toggle",type:"button",tabIndex:-1,ariaLabel:this._message("tagPicker.toggle","Toggle options")},_("chevron-down",{size:15})),o=a("div",{ref:"control",class:"zx-tag-picker__control"},s,r,n),l=a("div",{ref:"list",class:"zx-tag-picker__list",id:e,role:"listbox",ariaMultiSelectable:"true"});l.style.maxBlockSize=`${Math.max(0,Number(this.options.listHeight)||0)}px`;let c=a("div",{ref:"panel",class:"zx-tag-picker__panel",popover:"manual"},l);return t.replaceChildren(o,c),this._items=Array.isArray(this.options.items)?this.options.items.slice():[],this._visible=this._items.slice(),this._disabled=!!this.options.disabled,this._readonly=!!this.options.readonly,this.listen(o,"pointerdown",h=>{let u=h.target;u.closest(".zx-tag-picker__remove")||u.closest(".zx-tag-picker__toggle")||(h.target!==r&&(h.preventDefault(),this.focus()),this._open||this.open())}),this.listen(s,"click",h=>{let u=h.target.closest(".zx-tag-picker__remove");if(!u||this._disabled||this._readonly)return;h.stopPropagation();let d=[...s.children].indexOf(u.closest(".zx-tag-picker__tag")),m=this._selected[d];m!==void 0&&(this.removeValue(this._valueOf(m)),this.focus())}),this.listen(r,"input",()=>this._onInput()),this.listen(r,"keydown",h=>this._onKeydown(h)),this.listen(r,"blur",()=>this.el.removeAttribute("data-focus")),this.listen(r,"focus",()=>this.el.setAttribute("data-focus","")),this.listen(n,"click",()=>{this.focus(),this._open?this.close():this.open()}),this.listen(c,"pointerdown",h=>h.preventDefault()),this.listen(c,"click",h=>this._onOptionClick(h)),this.listen(document,"pointerdown",h=>{this._open&&!t.contains(h.target)&&this.close()},{capture:!0}),this.setValues(this.options.values,{silent:!0}),this._syncDisabled(),t}get values(){return this.getValues()}set values(t){this.setValues(t)}getValues(){return this._selected.map(t=>this._valueOf(t))}getItems(){return this._selected.slice()}setValues(t,{silent:e=!1}={}){let s=Array.isArray(t)?t:[],r=this.options.max===null||this.options.max===void 0?1/0:Number(this.options.max),n=[];for(let l of s){if(n.length>=r)break;let c=this._resolve(l);c!==null&&!n.some(h=>this._sameValue(h,c))&&n.push(c)}let o=!sc(n,this._selected,l=>this._valueOf(l));return this._selected=n,this._renderTags(),this._renderOptions(),o&&!e&&this._emitChange(),this}addValue(t,{silent:e=!1}={}){if(this.isFull())return this;let s=this._resolve(t);return s===null?this:this._selected.some(r=>this._sameValue(r,s))?this:(this._selected.push(s),this._renderTags(),this._renderOptions(),e||(this.emit("add",{value:this._valueOf(s),item:s}),this._emitChange()),this)}removeValue(t,{silent:e=!1}={}){let s=this._valueOf(this._resolve(t)??t),r=this._selected.findIndex(o=>Object.is(this._valueOf(o),s));if(r<0)return this;let[n]=this._selected.splice(r,1);return this._renderTags(),this._renderOptions(),e||(this.emit("remove",{value:this._valueOf(n),item:n}),this._emitChange()),this}clear({silent:t=!1}={}){return this.setValues([],{silent:t})}reset({silent:t=!1}={}){return this.setValues(this.options.values,{silent:t})}setItems(t){return this._cancelQuery(),this._items=Array.isArray(t)?t.slice():[],typeof this.options.filter=="function"?this._visible=this._items.slice():this._applyLocalFilter(this.refs.input.value),this._renderOptions(),this._position?.update(),this}isFull(){let t=this.options.max;return t!=null&&this._selected.length>=Number(t)}open(){return this._disabled||this._readonly||this._open?this:(this._open=!0,this.el.setAttribute("data-state","open"),this.refs.input.setAttribute("aria-expanded","true"),this._renderOptions(),this._position=q(this.refs.control,this.refs.panel,{placement:"bottom-start",flip:!0,matchWidth:!0}),this._setActive(this._entries.length>0?0:-1),typeof this.options.filter=="function"&&this._scheduleAsyncQuery(this.refs.input.value),this.emit("open",{}),this)}close(){return this._open?(this._open=!1,this._cancelQuery(),this._position?.destroy(),this._position=null,this.el.setAttribute("data-state","closed"),this.refs.input.setAttribute("aria-expanded","false"),this.refs.input.removeAttribute("aria-activedescendant"),this._activeIndex=-1,this._activeId=null,this.refs.input.value="",this._syncInputWidth(),this._applyLocalFilter(""),this.emit("close",{}),this):this}focus(){return this.refs.input.focus(),this}enable(){return this._disabled=!1,this._renderTags(),this._syncDisabled(),this}disable(){return this.close(),this._disabled=!0,this._renderTags(),this._syncDisabled(),this}setReadonly(t){return t&&this.close(),this._readonly=!!t,this._renderTags(),this._syncDisabled(),this}destroy(){this._cancelQuery(),this._position?.destroy(),this._position=null;let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}_renderTags(){let t=this._selected.map(e=>{let s=this._labelOf(e),r=this.options.renderTag?this.options.renderTag(e):s,n=a("span",{class:"zx-tag-picker__tag"},a("span",{class:"zx-tag-picker__tag-label"},r));return!this._readonly&&!this._disabled&&n.append(a("button",{class:"zx-icon-btn zx-tag-picker__remove",type:"button",ariaLabel:this._message("tagPicker.remove","Remove %1",[s])},_("x",{size:11}))),n});this.refs.tags.replaceChildren(...t),this.el.toggleAttribute("data-empty",this._selected.length===0),this._syncPlaceholder()}_renderOptions(){let t=this.refs.list;this._entries=[];let e=[];for(let n of this._visible){let o=this._valueOf(n),l=this._isSelected(o),c=a("div",{class:"zx-tag-picker__option",id:b("zx-tag-picker-option"),role:"option",ariaSelected:String(l)},a("span",{class:"zx-tag-picker__check",ariaHidden:"true"},l?_("check",{size:13}):null),a("span",{class:"zx-tag-picker__option-label"},this.options.renderItem?this.options.renderItem(n):this._labelOf(n)));!l&&this.isFull()&&c.setAttribute("aria-disabled","true"),this._entries.push({item:n,element:c,create:!1}),e.push(c)}let s=this.refs.input.value.trim();if(this._canCreate(s)){let n=a("div",{class:"zx-tag-picker__option",id:b("zx-tag-picker-option"),role:"option",ariaSelected:"false",dataset:{create:"true"}},a("span",{class:"zx-tag-picker__check",ariaHidden:"true"},_("plus",{size:13})),a("span",{class:"zx-tag-picker__option-label"},this._message("tagPicker.create","Create \u201C%1\u201D",[s])));this._entries.push({item:null,element:n,create:!0}),e.push(n)}e.length===0&&e.push(a("div",{class:"zx-tag-picker__empty"},this._loading?this._message("tagPicker.loading","Loading\u2026"):this._message("tagPicker.empty","No matches"))),t.replaceChildren(...e);let r=this._entries.findIndex(n=>this._entryId(n)===this._activeId);this._setActive(r>=0?r:this._entries.length>0?0:-1)}_entryId(t){return t.create?"\0create":String(this._valueOf(t.item))}_syncPlaceholder(){let t=this.refs.input;t.placeholder=this._selected.length===0?String(this.options.placeholder??""):""}_onInput(){let t=this.refs.input.value;this._syncInputWidth(),this._open||this.open(),typeof this.options.filter=="function"?this._scheduleAsyncQuery(t):this._applyLocalFilter(t),this._renderOptions(),this._setActive(this._entries.length>0?0:-1),this._position?.update()}_onKeydown(t){if(this._disabled||this._readonly)return;let e=this.refs.input;switch(t.key){case"ArrowDown":t.preventDefault(),this._open?this._move(1):this.open();return;case"ArrowUp":t.preventDefault(),this._open&&this._move(-1);return;case"Home":this._open&&e.value===""&&(t.preventDefault(),this._setActive(0));return;case"End":this._open&&e.value===""&&(t.preventDefault(),this._setActive(this._entries.length-1));return;case"Enter":{if(!this._open||this._activeIndex<0)return;t.preventDefault(),this._commitEntry(this._entries[this._activeIndex]);return}case"Escape":this._open&&(t.preventDefault(),this.close());return;case"Backspace":e.value===""&&this._selected.length>0&&(t.preventDefault(),this.removeValue(this._valueOf(this._selected[this._selected.length-1])));return;case"Tab":this._open&&this.close();return;default:}}_onOptionClick(t){let e=t.target.closest(".zx-tag-picker__option");if(!e)return;let s=this._entries.find(r=>r.element===e);s&&this._commitEntry(s)}_commitEntry(t){if(!t)return;let e=this.refs.input;if(t.create){let s=e.value.trim(),r=this._createItem(s);this._items=this._items.concat([r]),this.addValue(r),this.emit("create",{value:this._valueOf(r),item:r})}else{let s=this._valueOf(t.item);if(this._isSelected(s))this.removeValue(s);else if(!this.isFull())this.addValue(t.item);else return}e.value="",this._syncInputWidth(),this._applyLocalFilter(""),this._renderOptions(),this.options.closeOnSelect?this.close():(this._setActive(this._entries.length>0?0:-1),this._position?.update()),this.focus()}_move(t){if(this._entries.length===0)return;let e=this._activeIndex<0?t>0?0:this._entries.length-1:Math.min(this._entries.length-1,Math.max(0,this._activeIndex+t));this._setActive(e)}_setActive(t){this._activeIndex=t,this._activeId=this._entries[t]?this._entryId(this._entries[t]):null;for(let[e,s]of this._entries.entries()){let r=e===t;s.element.toggleAttribute("data-active",r),r&&(this.refs.input.setAttribute("aria-activedescendant",s.element.id),s.element.scrollIntoView({block:"nearest"}))}t<0&&this.refs.input.removeAttribute("aria-activedescendant")}_applyLocalFilter(t){if(typeof this.options.filter=="function")return;let e=this.options.searchKeys??[this.options.labelKey];this._visible=It(this._items,t,e)}_scheduleAsyncQuery(t){this._cancelQuery();let e=String(t??"");if(e.length<Number(this.options.minQuery??0)){this._visible=[],this._renderOptions();return}this._visible=[],this._setLoading(!0),this._renderOptions();let s=Math.max(0,Number(this.options.debounce)||0);this._queryTimer=setTimeout(()=>{this._queryTimer=null,this._runQuery(e)},s)}async _runQuery(t){let e=this._requestSequence+1;this._requestSequence=e,this._setLoading(!0),this.emit("query",{query:t});try{let s=await this.options.filter(t);if(e!==this._requestSequence)return;this._items=Array.isArray(s)?s.slice():[],this._visible=this._items.slice()}catch(s){if(e!==this._requestSequence)return;this._visible=[],this.emit("error",{error:s})}finally{e===this._requestSequence&&(this._setLoading(!1),this._renderOptions(),this._setActive(this._entries.length>0?0:-1),this._position?.update())}}_cancelQuery(){this._queryTimer!==null&&(clearTimeout(this._queryTimer),this._queryTimer=null),this._requestSequence+=1,this._setLoading(!1)}_setLoading(t){this._loading=t,this.el.toggleAttribute("data-loading",t)}_isSelected(t){return this._selected.some(e=>Object.is(this._valueOf(e),t))}_canCreate(t){if(!this.options.allowCreate||t===""||this.isFull())return!1;let e=s=>s.some(r=>Zn(this._labelOf(r))===Zn(t));return!e(this._items)&&!e(this._selected)}_createItem(t,e=t){return typeof this.options.valueKey!="string"||typeof this.options.labelKey!="string"?t:{[this.options.valueKey]:e,[this.options.labelKey]:t,created:!0}}_resolve(t){if(t==null)return null;let e=this._valueOf(t),s=this._items.find(n=>Object.is(this._valueOf(n),e));if(s!==void 0)return s;let r=this._selected.find(n=>Object.is(this._valueOf(n),e));return r!==void 0?r:typeof t=="object"?t:this._createItem(String(t),t)}_sameValue(t,e){return Object.is(this._valueOf(t),this._valueOf(e))}_valueOf(t){let e=this.options.valueKey;return typeof e=="function"?e(t):t!==null&&typeof t=="object"?t[e]:t}_labelOf(t){let e=this.options.labelKey;return String(typeof e=="function"?e(t):t!==null&&typeof t=="object"?t[e]??"":t??"")}_emitChange(){this.emit("change",{values:this.getValues(),items:this.getItems()})}_syncInputWidth(){let t=this.refs.input,e=t.value.length;t.style.inlineSize=e===0?"":`${Math.min(40,e+1)}ch`}_syncDisabled(){let t=this.refs.input;t.disabled=this._disabled,t.readOnly=this._readonly,this.refs.toggle.disabled=this._disabled||this._readonly,this.el.toggleAttribute("data-disabled",this._disabled),this.el.toggleAttribute("data-readonly",this._readonly),this._disabled?this.el.setAttribute("aria-disabled","true"):this.el.removeAttribute("aria-disabled")}_message(t,e,s=[]){let r=this.msg(t,...s);return r!==t?r:s.reduce((n,o,l)=>n.replaceAll(`%${l+1}`,String(o)),e)}};function Zn(i){return String(i??"").trim().toLocaleLowerCase()}function sc(i,t,e){return i.length!==t.length?!1:i.every((s,r)=>Object.is(e(s),e(t[r])))}function Jn(){x.register("tagpicker",(i,t)=>{let e=i.own(new te(null,{placeholder:t.placeholder,...t.props??{}})),s=!1;return i.listen(e.el,"change",r=>r.stopImmediatePropagation()),e.on("change",r=>{s||i.emit("change",{value:r.detail.values})}),{el:e.el,get:()=>e.getValues(),set:r=>{s=!0;try{e.setValues(Array.isArray(r)?r:[],{silent:!0})}finally{s=!1}},focus:()=>e.focus(),setDisabled:r=>r?e.disable():e.enable()}})}function nr(i,t="minutes"){let e=Math.round(Math.abs(Xn(Vt(i),t)));return{hours:Math.floor(e/3600),minutes:Math.floor(e/60)%60,seconds:e%60,negative:Vt(i)<0}}function or(i,t="minutes"){ze(t);let e=Math.abs(Math.trunc(Vt(i?.hours))),s=Math.abs(Math.trunc(Vt(i?.minutes))),r=Math.abs(Math.trunc(Vt(i?.seconds))),n=i?.negative?-1:1;return to(n*(e*3600+s*60+r),t)}var J=class extends p{static cssName="timebox";static defaults={value:0,unit:"minutes",seconds:!1,signed:!1,disabled:!1};render(){ze(this.options.unit);let t=this.el??a("div");this.el=t,this._originalAriaDisabled=t.getAttribute("aria-disabled"),this._disabled=!!this.options.disabled,this._parts={hours:0,minutes:0,seconds:0,negative:!1},this._inputs=[];let e=a("div",{class:"zx-timebox__content",role:"group",ariaLabel:this.options.seconds?"Duration in hours, minutes, and seconds":"Duration in hours and minutes"});return this._content=e,this.options.signed&&(e.append(a("button",{ref:"sign",class:"zx-timebox__sign",type:"button",ariaLabel:"Toggle duration sign",ariaPressed:"false"},"+")),this.listen(this.refs.sign,"click",()=>{this._disabled||(this._parts.negative=!this._parts.negative,this._writeParts(),this._emitChange())})),this._addSegment(e,"hours","Hours",!1),e.append(a("span",{class:"zx-timebox__separator",ariaHidden:"true"},":")),this._addSegment(e,"minutes","Minutes",!0),this.options.seconds&&(e.append(a("span",{class:"zx-timebox__separator",ariaHidden:"true"},":")),this._addSegment(e,"seconds","Seconds",!0)),t.append(e),this.set(this.options.value,this.options.unit,{silent:!0}),this._syncDisabled(),t}get(t=this.options.unit){return or(this._readParts(),t)}set(t,e=this.options.unit,s={}){e&&typeof e=="object"&&(s=e,e=this.options.unit),ze(e);let r=Vt(t);return!this.options.signed&&r<0&&(r=0),this.options.seconds||(r=to(Math.round(Xn(r,e)/60)*60,e)),this._parts=nr(r,e),this.options.signed||(this._parts.negative=!1),this._writeParts(),s.silent||this._emitChange(),this}enable(){return this._disabled=!1,this._syncDisabled(),this}disable(){return this._disabled=!0,this._syncDisabled(),this}destroy(){this._content?.remove(),this._originalAriaDisabled===null?this.el.removeAttribute("aria-disabled"):this.el.setAttribute("aria-disabled",this._originalAriaDisabled),super.destroy()}_addSegment(t,e,s,r){let n=a("input",{class:"zx-timebox__segment",type:"text",inputMode:"numeric",autocomplete:"off",ariaLabel:s,maxLength:r?2:null,dataset:{segment:e,bounded:String(r)}});this._inputs.push(n),t.append(n),this.listen(n,"focus",()=>n.select()),this.listen(n,"input",()=>{e==="hours"&&this.options.signed&&n.value.trim().startsWith("-")&&(this._parts.negative=!0);let o=n.value.replace(/\D/g,"");n.value=r?o.slice(0,2):o}),this.listen(n,"change",()=>this._commitSegments()),this.listen(n,"keydown",o=>{o.key==="Enter"&&(o.preventDefault(),this._commitSegments(),n.select())})}_readParts(){let t={...this._parts};for(let e of this._inputs){let s=e.dataset.segment,r=e.dataset.bounded==="true"?59:Number.MAX_SAFE_INTEGER;t[s]=Math.max(0,Math.min(r,Math.trunc(Vt(e.value))))}return t}_commitSegments(){this._parts=this._readParts(),this._writeParts(),this._emitChange()}_writeParts(){for(let t of this._inputs){let e=t.dataset.segment;t.value=e==="hours"?String(this._parts[e]):ic(this._parts[e])}this.refs.sign&&(this.refs.sign.textContent=this._parts.negative?"-":"+",this.refs.sign.setAttribute("aria-pressed",String(this._parts.negative)),this.refs.sign.dataset.state=this._parts.negative?"negative":"positive")}_syncDisabled(){for(let t of this._inputs)t.disabled=this._disabled;this.refs.sign&&(this.refs.sign.disabled=this._disabled),this.el.setAttribute("aria-disabled",String(this._disabled))}_emitChange(){this.emit("change",{value:this.get(this.options.unit)})}};function Vt(i){let t=Number(i);return Number.isFinite(t)?t:0}function Xn(i,t){return ze(t),t==="hours"?i*3600:t==="minutes"?i*60:i}function to(i,t){return ze(t),t==="hours"?i/3600:t==="minutes"?i/60:i}function ze(i){if(i!=="hours"&&i!=="minutes"&&i!=="seconds")throw new RangeError(`Unknown time unit: ${i}`)}function ic(i){return String(i).padStart(2,"0")}function eo(){x.register("time",(i,t)=>{let e=i.own(new J(null,{...t.props??{},value:t.value}));return i.listen(e.el,"change",s=>s.stopImmediatePropagation()),e.on("change",s=>i.emit("change",{value:s.detail.value})),{el:e.el,get:()=>e.get(),set:s=>e.set(Number(s)||0,{silent:!0}),focus:()=>e.el.querySelector("input:not([disabled]), button:not([disabled])")?.focus(),setDisabled:s=>s?e.disable():e.enable()}})}var P=class extends p{static cssName="toggle";static defaults={checked:!1,value:!0,label:null,disabled:!1};render(){let t=!this.el,e=this.el??a("button");if(this.el=e,e.localName!=="button")throw new TypeError("Toggle target must be a button element");this._createdRoot=t,this._original=t?null:rc(e),this._checked=!!this.options.checked,this._disabled=!!this.options.disabled,e.type="button",e.setAttribute("role","switch");let s=[a("span",{class:"zx-toggle__track",ariaHidden:"true"},a("span",{class:"zx-toggle__thumb"}))];return this.options.label!==null&&s.push(a("span",{class:"zx-toggle__label"},String(this.options.label))),e.replaceChildren(...s),this._sync(),this.listen(e,"click",()=>this.toggle()),e}get(){return this._checked}set(t,{silent:e=!1}={}){let s=!!t;return s===this._checked?this:(this._checked=s,this._sync(),e||this.emit("change",{checked:this._checked,value:this.getValue()}),this)}toggle(){return this.set(!this._checked)}getValue(){return this._checked?this.options.value:!1}enable(){return this._disabled=!1,this.el.removeAttribute("disabled"),this}disable(){return this._disabled=!0,this.el.setAttribute("disabled",""),this}destroy(){this._cleaned||(this._cleaned=!0,super.destroy(),!this._createdRoot&&this._original&&nc(this.el,this._original))}_sync(){this.el.setAttribute("aria-checked",String(this._checked)),this.el.toggleAttribute("disabled",this._disabled)}};function rc(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function nc(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}function so(){x.register("toggle",(i,t)=>{let e=i.own(new P(null,{...t.props??{},checked:!!t.value}));return i.listen(e.el,"change",s=>s.stopImmediatePropagation()),e.on("change",s=>i.emit("change",{value:s.detail.value})),{el:e.el,get:()=>e.getValue(),set:s=>e.set(!!s,{silent:!0}),focus:()=>e.el.focus(),setDisabled:s=>s?e.disable():e.enable()}})}var zt=class extends p{static cssName="value-list";static defaults={values:[],placeholder:"",deletable:!0,sortable:!0,unique:!0,validate:null};render(){let t=this.el??a("div");this._ownedNodes=[],this._disabled=!1,this._dragIndex=-1,this._initialState=t.getAttribute("data-state"),this._initialDisabled=t.getAttribute("data-disabled"),this._values=io(this.options.values,!!this.options.unique);let e=b("zx-value-list-instructions");return this._list=a("ul",{class:"zx-value-list__list",role:"listbox",ariaLabel:"Values",ariaOrientation:"horizontal"}),this._input=a("input",{class:"zx-value-list__input",type:"text",placeholder:String(this.options.placeholder??""),ariaLabel:"Add value",ariaDescribedby:e}),this._status=a("div",{class:"zx-value-list__status",role:"status",ariaLive:"polite"}),this._instructions=a("span",{class:"zx-value-list__instructions",id:e},"Press Enter to add. Focus a value and press Ctrl plus Left or Right to reorder."),this._ownedNodes.push(this._list,this._input,this._status,this._instructions),t.append(this._list,this._input,this._status,this._instructions),this.listen(this._input,"keydown",s=>this._handleInputKeydown(s)),this.listen(this._list,"keydown",s=>this._handleChipKeydown(s)),this.listen(this._list,"click",s=>this._handleChipClick(s)),this.listen(this._list,"dragstart",s=>this._handleDragStart(s)),this.listen(this._list,"dragover",s=>{this._dragIndex>=0&&!this._disabled&&s.preventDefault()}),this.listen(this._list,"drop",s=>this._handleDrop(s)),this.listen(this._list,"dragend",()=>this._finishDrag()),this.listen(t,"click",s=>{s.target===t&&!this._disabled&&this.focus()}),this._renderChips(),t}getValues(){return this._values.slice()}setValues(t,{silent:e=!1}={}){return this._values=io(t,!!this.options.unique),this._renderChips(),e||this.emit("change",{values:this.getValues()}),this}addValue(t){if(this._disabled)return!1;let e=String(t??"").trim();if(!e)return!1;if(this.options.unique&&this._values.includes(e))return this._showError("This value already exists."),!1;if(typeof this.options.validate=="function"){let s=this.options.validate(e);if(s!==!0)return this._showError(typeof s=="string"?s:"This value is not valid."),!1}return this._status.textContent="",this._input.removeAttribute("aria-invalid"),this._values.push(e),this._renderChips(),this.emit("add",{value:e}),this.emit("change",{values:this.getValues()}),!0}removeValue(t){if(this._disabled||!this.options.deletable)return!1;let e=this._values.indexOf(String(t));return e<0?!1:(this._removeAt(e),!0)}focus(){return this._input.focus(),this}enable(){return this._disabled=!1,this._input.disabled=!1,this.el.dataset.disabled="false",this._renderChips(),this}disable(){return this._disabled=!0,this._input.disabled=!0,this.el.dataset.disabled="true",this._renderChips(),this}_renderChips(t=-1){let e=this._values.map((s,r)=>a("li",{class:"zx-value-list__chip",role:"option",tabIndex:this._disabled?-1:0,draggable:!!this.options.sortable&&!this._disabled,ariaSelected:"false",ariaDisabled:String(this._disabled),ariaLabel:this.options.deletable?`${s}. Press Delete to remove.`:s,dataset:{index:r}},a("span",{class:"zx-value-list__value"},s),this.options.deletable?a("span",{class:"zx-value-list__remove",dataset:{remove:""},ariaHidden:"true"},"\xD7"):null));this._list.replaceChildren(...e),t>=0&&e[Math.min(t,e.length-1)]?.focus()}_handleInputKeydown(t){this._disabled||(t.key==="Enter"?(t.preventDefault(),this.addValue(this._input.value)&&(this._input.value="")):t.key==="Backspace"&&this._input.value===""&&this._values.length&&this.options.deletable&&(t.preventDefault(),this._removeAt(this._values.length-1)))}_handleChipKeydown(t){if(this._disabled)return;let e=t.target instanceof Element?t.target.closest("[data-index]"):null;if(!e)return;let s=Number(e.dataset.index);if((t.key==="Delete"||t.key==="Backspace")&&this.options.deletable){t.preventDefault(),this._removeAt(s,Math.min(s,this._values.length-2));return}let r=t.key==="ArrowLeft"?-1:t.key==="ArrowRight"?1:0,n=t.key==="ArrowUp"?-1:t.key==="ArrowDown"?1:0,o=r||n;if(!o)return;t.preventDefault();let l=Math.max(0,Math.min(this._values.length-1,s+o));t.ctrlKey&&r&&this.options.sortable?this._move(s,l,!0):this._list.querySelector(`[data-index="${l}"]`)?.focus()}_handleChipClick(t){let e=t.target instanceof Element?t.target:null,s=e?.closest("[data-index]");!s||this._disabled||(e.closest("[data-remove]")&&this.options.deletable?this._removeAt(Number(s.dataset.index)):s.focus())}_handleDragStart(t){if(this._disabled||!this.options.sortable)return;let e=t.target instanceof Element?t.target.closest("[data-index]"):null;e&&(this._dragIndex=Number(e.dataset.index),this.el.dataset.state="dragging",t.dataTransfer?.setData("text/plain",String(this._dragIndex)),t.dataTransfer&&(t.dataTransfer.effectAllowed="move"))}_handleDrop(t){if(this._dragIndex<0||this._disabled)return;t.preventDefault();let e=t.target instanceof Element?t.target.closest("[data-index]"):null,s=e?Number(e.dataset.index):this._values.length-1;this._move(this._dragIndex,s,!0),this._finishDrag()}_finishDrag(){this._dragIndex=-1,this._initialState===null?this.el.removeAttribute("data-state"):this.el.setAttribute("data-state",this._initialState)}_move(t,e,s){if(t===e||t<0||e<0||t>=this._values.length||e>=this._values.length)return;let[r]=this._values.splice(t,1);this._values.splice(e,0,r),this._renderChips(s?e:-1),this.emit("change",{values:this.getValues()})}_removeAt(t,e=-1){let[s]=this._values.splice(t,1);s!==void 0&&(this._renderChips(e),e<0&&this._values.length===0&&this._input.focus(),this.emit("remove",{value:s}),this.emit("change",{values:this.getValues()}))}_showError(t){this._status.textContent=t,this._input.setAttribute("aria-invalid","true")}destroy(){for(let t of this._ownedNodes??[])t.remove();this._initialState===null?this.el.removeAttribute("data-state"):this.el.setAttribute("data-state",this._initialState),this._initialDisabled===null?this.el.removeAttribute("data-disabled"):this.el.setAttribute("data-disabled",this._initialDisabled),super.destroy()}};function io(i,t){if(!Array.isArray(i))return[];let e=i.map(s=>String(s));return t?[...new Set(e)]:e}function ro(){x.register("valuelist",(i,t)=>{let e=i.own(new zt(null,{...t.props??{},values:Array.isArray(t.value)?t.value:[]}));return i.listen(e.el,"change",s=>s.stopImmediatePropagation()),e.on("change",s=>i.emit("change",{value:s.detail.values})),{el:e.el,get:()=>e.getValues(),set:s=>e.setValues(Array.isArray(s)?s:[],{silent:!0}),focus:()=>e.focus(),setDisabled:s=>s?e.disable():e.enable()}})}var ss=Object.freeze({sm:480,md:768,lg:1024,xl:1280}),oc=["xl","lg","md","sm"];function es(i){let t=Number(i);if(!Number.isFinite(t))return"xs";for(let e of oc)if(t>=ss[e])return e;return"xs"}function no(i,t){if(i==="xs")return!0;let e=ss[i];if(e===void 0)throw new RangeError(`Unknown breakpoint "${i}"`);return Number(t)>=e}function oo(i,t={}){if(typeof i!="function")throw new TypeError("onBreakpoint requires a handler");let e=t.target??globalThis,s=e instanceof Element?e:null,r="xs",n=!1,o=null,l=()=>s?s.getBoundingClientRect().width:Number(globalThis.innerWidth)||0,c=()=>{if(n)return;let h=l(),u=es(h);u!==r&&(r=u,i(r,h))};return r=es(l()),i(r,l()),s&&typeof ResizeObserver=="function"?(o=new ResizeObserver(c),o.observe(s)):globalThis.addEventListener?.("resize",c,{passive:!0}),{current:()=>r,destroy:()=>{n||(n=!0,o?.disconnect(),globalThis.removeEventListener?.("resize",c))}}}var et=class{base;headers;onError;timeout;constructor({base:t="",headers:e={},onError:s=null,timeout:r=3e4}={}){this.base=String(t),this.headers=Object.freeze({...e}),this.onError=s,this.timeout=Number(r)}async request(t,e={}){let{method:s="GET",data:r=null,files:n=null,query:o=null,headers:l={}}=e,c=new AbortController,h=this.timeout>0?setTimeout(()=>c.abort(),this.timeout):null,u=new Headers(this.headers);for(let[f,g]of Object.entries(l))u.set(f,g);u.set("Accept",u.get("Accept")??"application/json");let d;n!==null?(d=lc(r,n),u.delete("Content-Type")):r!==null&&s.toUpperCase()!=="GET"&&s.toUpperCase()!=="HEAD"&&(d=JSON.stringify(r),u.set("Content-Type",u.get("Content-Type")??"application/json"));let m=ac(this.base+t,o);try{let f=await fetch(m,{method:s.toUpperCase(),headers:u,body:d,signal:c.signal}),g=await f.text(),y=null;if(g!=="")try{y=JSON.parse(g)}catch(z){let T=new Error("Invalid JSON response",{cause:z});throw T.response=f,T}if(!f.ok){try{is(y)}catch(T){throw T.response=f,T}let z=new Error(`HTTP ${f.status} ${f.statusText}`.trim());throw z.response=f,z}return is(y)}catch(f){let g=f instanceof Error?f:new Error(String(f));if(this.onError)try{this.onError(g,{path:t,options:e})}catch{}throw g}finally{h!==null&&clearTimeout(h)}}get(t,e=null){return this.request(t,{method:"GET",query:e})}post(t,e=null){return this.request(t,{method:"POST",data:e})}put(t,e=null){return this.request(t,{method:"PUT",data:e})}delete(t,e=null){return this.request(t,{method:"DELETE",data:e})}};function Rt(i,t="",e={}){let{apiBase:s="../remotecall/",...r}=e,n=`${s}${i}${t?`:${t}`:""}/`;return new et({...r,base:n})}function is(i){if(i&&typeof i=="object"){if(Object.prototype.hasOwnProperty.call(i,"error")&&i.error!=null){let t=typeof i.error=="string"?i.error:JSON.stringify(i.error);throw new Error(t||"Server error")}if(Object.prototype.hasOwnProperty.call(i,"result"))return i.result}return i}function ac(i,t){if(t==null)return i;let e;if(typeof t=="string")e=t.replace(/^\?/,"");else if(t instanceof URLSearchParams)e=t.toString();else{let s=new URLSearchParams;for(let[r,n]of Object.entries(t))ao(s,r,n);e=s.toString()}return e?i+(i.includes("?")?"&":"?")+e:i}function ao(i,t,e){if(e!=null)if(Array.isArray(e))for(let s of e)ao(i,t,s);else i.append(t,typeof e=="object"?JSON.stringify(e):String(e))}function lc(i,t){let e=new FormData;if(i&&typeof i=="object"&&!Array.isArray(i))for(let[r,n]of Object.entries(i))lo(e,r,n);else i!=null&&e.append("data",typeof i=="string"?i:JSON.stringify(i));let s=cc(t)||Array.isArray(t)?Array.from(t):[t];for(let r of s)e.append("files",r);return e}function lo(i,t,e){if(e!=null)if(Array.isArray(e))for(let s of e)lo(i,t,s);else{let s=typeof Blob=="function"&&e instanceof Blob;i.append(t,typeof e=="object"&&!s?JSON.stringify(e):e)}}function cc(i){return typeof FileList=="function"&&i instanceof FileList}var hc=0,uc=20,dc=3,fc=["B","KiB","MiB","GiB","TiB","PiB","EiB"],pc=["B","kB","MB","GB","TB","PB","EB"],ar=[{unit:"second",ms:1e3,limit:45},{unit:"minute",ms:6e4,limit:45},{unit:"hour",ms:36e5,limit:22},{unit:"day",ms:864e5,limit:6},{unit:"week",ms:6048e5,limit:4},{unit:"month",ms:26298e5,limit:11},{unit:"year",ms:315576e5,limit:1/0}],co=new Map,ho=new Map;function ke(i,t={}){let e=rs(i);if(e===null)return"";let{locale:s=G(),decimals:r,minDecimals:n,maxDecimals:o,group:l=!0}=t;return lr(s,cr({decimals:r,minDecimals:n,maxDecimals:o,group:l}),e)}function po(i,t,e={}){let s=rs(i);if(s===null)return"";let{locale:r=G(),decimals:n}=e,o=gc(t);if(o===null)return ke(s,{locale:r,decimals:n});let l=cr({decimals:n,group:!0});return lr(r,{...l,style:"currency",currency:o},s)}function mo(i,t={}){let e=rs(i);if(e===null)return"";let{locale:s=G(),decimals:r=0}=t;return lr(s,{...cr({decimals:r,group:!0}),style:"percent"},e)}function _o(i,t={}){let e=rs(i);if(e===null)return"";let{locale:s=G(),decimals:r=1,standard:n="iec"}=t;if(e===0)return`${ke(0,{locale:s,decimals:0})} B`;let o=n==="si"?pc:fc,l=n==="si"?1e3:1024,c=Math.abs(e),h=Math.min(o.length-1,Math.max(0,Math.floor(Math.log(c)/Math.log(l)))),u=c/l**h;bc(u,h===0?0:r)>=l&&h<o.length-1&&(h+=1,u=c/l**h);let d=e<0?-u:u;return`${ke(d,{locale:s,minDecimals:0,maxDecimals:h===0?0:r})} ${o[h]}`}function go(i,t={}){let e=fo(i);if(e===null)return"";let{now:s=new Date,locale:r=G(),numeric:n="auto"}=t,o=fo(s);if(o===null)return"";let l=e.getTime()-o.getTime(),c=ar.find(({ms:u,limit:d})=>Math.abs(l)/u<d)??ar[ar.length-1],h=Math.round(l/c.ms);return _c(r,n).format(h,c.unit)}function lr(i,t,e){let s=`${i}\0${JSON.stringify(t)}`,r=co.get(s);return r===void 0&&(r=mc(i,t),co.set(s,r)),r.format(e)}function mc(i,t){try{return new Intl.NumberFormat(i,t)}catch{try{return new Intl.NumberFormat(void 0,t)}catch{return new Intl.NumberFormat}}}function _c(i,t){let e=`${i}\0${t}`,s=ho.get(e);if(s===void 0){try{s=new Intl.RelativeTimeFormat(i,{numeric:t})}catch{s=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"})}ho.set(e,s)}return s}function cr({decimals:i,minDecimals:t,maxDecimals:e,group:s=!0}){let r={useGrouping:s!==!1},n=uo(t??i),o=uo(e??i);return n!==null&&(r.minimumFractionDigits=n),o!==null?(r.maximumFractionDigits=o,n!==null&&n>o&&(r.minimumFractionDigits=o)):n!==null&&(r.maximumFractionDigits=Math.max(n,dc)),r}function uo(i){if(i==null)return null;let t=Number(i);return Number.isFinite(t)?Math.min(uc,Math.max(hc,Math.round(t))):null}function rs(i){if(i==null||i==="")return null;let t=typeof i=="number"?i:Number(i);return Number.isFinite(t)?t:null}function gc(i){if(typeof i!="string")return null;let t=i.trim().toUpperCase();return/^[A-Z]{3}$/.test(t)?t:null}function fo(i){if(i instanceof Date)return Number.isNaN(i.getTime())?null:i;if(typeof i=="number")return Number.isFinite(i)?new Date(i*1e3):null;if(typeof i=="string"){let t=i.trim();if(t==="")return null;let e=/^-?\d+$/.test(t)?new Date(Number(t)*1e3):new Date(t);return Number.isNaN(e.getTime())?null:e}return null}function bc(i,t){let e=10**t;return Math.round(i*e)/e}var bo="zx:__probe__";function ns(i,t={}){let{area:e="local"}=t,s=`zx:${String(i??"")}:`,r=new Map,n=yc(e),o=u=>{if(n!==null)try{return n.getItem(u)}catch{n=null}return r.has(u)?r.get(u):null},l=(u,d)=>{if(n!==null)try{n.setItem(u,d);return}catch{n=null}r.set(u,d)},c=u=>{if(n!==null)try{n.removeItem(u)}catch{n=null}r.delete(u)},h=()=>{if(n!==null)try{let u=[];for(let d=0;d<n.length;d+=1){let m=n.key(d);typeof m=="string"&&m.startsWith(s)&&u.push(m)}return u}catch{n=null}return[...r.keys()].filter(u=>u.startsWith(s))};return{get(u,d){let m=o(s+u);if(m==null)return d;try{return JSON.parse(m)}catch{return d}},set(u,d){let m;try{m=JSON.stringify(d)}catch{m=void 0}m===void 0?c(s+u):l(s+u,m)},remove(u){c(s+u)},keys(){return h().map(u=>u.slice(s.length))},clear(){for(let u of h())c(u)}}}function yc(i){let t=i==="session"?"sessionStorage":"localStorage";try{let e=globalThis[t];return!e||typeof e.getItem!="function"?null:(e.setItem(bo,"1"),e.removeItem(bo),e)}catch{return null}}var xc=["=","+","-","@"];function vo(i,t,e={}){let{delimiter:s=",",header:r=!0,newline:n=`\r
|
|
2
|
+
`}=e,o=wc(t),l=[];r&&l.push(o.map(c=>xo(c.label,s,yo(c.label))).join(s));for(let c of i??[]){let h=o.map(u=>{let d=typeof u.value=="function"?u.value(c):Sc(c,u.id);return xo(Ac(d),s,yo(d))});l.push(h.join(s))}return l.join(n)}function wo(i,t,e={}){let{type:s="text/plain;charset=utf-8"}=e,r=zc(t,s),n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download=String(i??"download"),o.rel="noopener",o.style.display="none",document.body.append(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}async function os(i){let t=String(i??"");if(globalThis.navigator?.clipboard?.writeText)try{return await navigator.clipboard.writeText(t),!0}catch{}return vc(t)}function vc(i){if(typeof document>"u"||!document.body)return!1;let t=document.activeElement,e=document.createElement("textarea");e.value=i,e.setAttribute("readonly",""),e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;inset-block-start:-1000px;opacity:0;pointer-events:none",document.body.append(e);let s=!1;try{e.select(),e.setSelectionRange(0,i.length),s=document.execCommand?.("copy")===!0}catch{s=!1}finally{e.remove(),t instanceof HTMLElement&&t.focus({preventScroll:!0})}return s}function wc(i){return(i??[]).map(t=>{if(typeof t=="string")return{id:t,label:t};let e=String(t?.id??"");return{id:e,label:String(t?.label??e),value:t?.value}})}function Sc(i,t){return i?.[t]}function Ac(i){if(i==null)return"";if(i instanceof Date)return Number.isNaN(i.getTime())?"":i.toISOString();if(typeof i=="number")return Number.isFinite(i)?String(i):"";if(typeof i=="boolean")return i?"true":"false";if(typeof i=="object")try{return JSON.stringify(i)}catch{return String(i)}return String(i)}function yo(i){return typeof i!="string"?!1:xc.includes(i.charAt(0))}function xo(i,t,e=!1){let s=e?` ${i}`:i;return s.includes(t)||s.includes('"')||s.includes(`
|
|
3
|
+
`)||s.includes("\r")?`"${s.replaceAll('"','""')}"`:s}function zc(i,t){if(typeof Blob=="function"&&i instanceof Blob)return i;let e=typeof i=="string"&&/^text\/csv\b/i.test(t)?["\uFEFF",i]:[i];return new Blob(e,{type:t})}var st=class extends p{static cssName="check-button";static defaults={label:"",checked:!1,icon:!0,disabled:!1};render(){let t=!this.el,e=this.el??a("button");if(this.el=e,e.localName!=="button")throw new TypeError("CheckButton target must be a button element");this._createdRoot=t,this._original=t?null:kc(e),this._checked=!!this.options.checked,this._disabled=!!this.options.disabled,this._labels=So(this.options.label),e.type="button";let s=[];return this.options.icon&&s.push(a("span",{class:"zx-check-button__icon",ariaHidden:"true"},a("span",{class:"zx-check-button__off"},_("square",{size:15})),a("span",{class:"zx-check-button__on"},_("check",{size:15})))),s.push(a("span",{class:"zx-check-button__label",ref:"label"})),e.replaceChildren(...s),this._sync(),this.listen(e,"click",()=>this.toggle()),e}get(){return this._checked}set(t,{silent:e=!1}={}){let s=!!t;return s===this._checked?this:(this._checked=s,this._sync(),e||this.emit("change",{checked:this._checked}),this)}toggle(){return this.set(!this._checked)}setLabel(t){return this._labels=So(t),this._sync(),this}enable(){return this._disabled=!1,this.el.removeAttribute("disabled"),this}disable(){return this._disabled=!0,this.el.setAttribute("disabled",""),this}destroy(){this._cleaned||(this._cleaned=!0,super.destroy(),!this._createdRoot&&this._original&&Cc(this.el,this._original))}_sync(){this.el.setAttribute("aria-pressed",String(this._checked)),this.el.toggleAttribute("disabled",this._disabled),this.refs.label.textContent=this._checked?this._labels.on:this._labels.off}};function So(i){return Array.isArray(i)?{on:String(i[0]??""),off:String(i[1]??"")}:{on:String(i??""),off:String(i??"")}}function kc(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function Cc(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}var ee=class extends p{static cssName="modal";static defaults={content:null,width:"auto",closable:!0,lightDismiss:!1,destroyOnClose:!1};#t;#e=!1;#s=!1;constructor(t=null,e={}){super(null,e),this.#i(this.options.width),Ao(this.refs.content,this.options.content),this.listen(this.el,"cancel",s=>{let r=this.emit("cancel");(!this.options.closable||r.defaultPrevented)&&s.preventDefault()}),this.listen(this.el,"close",()=>{this.el.dataset.state="closed",delete this.el.dataset.zxOverlayOrder;let s=this.#e?this.#t:this.el.returnValue||void 0;this.#t=void 0,this.#e=!1,this.emit("close",{result:s}),this.options.destroyOnClose&&!this.#s&&this.destroy()}),this.listen(this.el,"click",s=>{!this.options.lightDismiss||s.target!==this.el||!Tc(this.el,s)||this.close()})}render(){let t=a("dialog",{class:"zx-modal"},a("div",{class:"zx-modal__content",ref:"content"}));return t.dataset.state="closed",document.body.append(t),t}open(){if(this.isOpen())return this;this.el.dataset.zxOverlayOrder=String(Nc()),this.el.returnValue="";try{this.el.showModal()}catch(t){throw delete this.el.dataset.zxOverlayOrder,t}return this.el.dataset.state="open",this.emit("open"),this}close(t){return this.isOpen()?(this.#t=t,this.#e=!0,this.el.close(typeof t=="string"?t:""),this):this}setContent(t){return Ao(this.refs.content,t),this}isOpen(){return this.el.open}destroy(){this.#s||(this.#s=!0,this.isOpen()&&this.el.close(),super.destroy())}#i(t){typeof t=="number"&&Number.isFinite(t)?this.el.style.inlineSize=`${Math.max(0,t)}px`:this.el.style.inlineSize=String(t??"auto")}};function Ao(i,t){if(i.replaceChildren(),t!=null)if(typeof t=="string"||typeof t=="number")i.append(document.createTextNode(String(t)));else if(typeof t.toElement=="function"){let e=t.toElement();e&&i.append(e)}else typeof t.nodeType=="number"&&i.append(t)}function Tc(i,t){let e=i.getBoundingClientRect();return t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom}function Nc(){let i=Array.from(document.querySelectorAll("[data-zx-overlay-order]"),t=>Number(t.getAttribute("data-zx-overlay-order"))||0);return Math.max(0,...i)+1}var Ec=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(","),lt=class i extends ee{static cssName="dialog";static defaults={title:"",size:"md",buttons:[],closable:!0};#t=new Map;#e=null;#s=[];#i="";#r=null;constructor(t=null,e={}){super(null,e),this.#a(this.options.size),this.#i=String(this.options.title??""),this.#o(this.#i),this.#s=as(this.options.buttons),this.#l(this.#s),this.refs.close.hidden=!this.options.closable,this.listen(this.refs.close,"click",()=>this.close()),this.listen(this.refs.footer,"click",s=>{let r=s.target.closest?.("[data-dialog-button]");if(!r||!this.refs.footer.contains(r))return;let n=this.#n[Number(r.dataset.dialogButton)];n&&this.#h(n)}),this.on("close",()=>this.#c())}#n=[];render(){let t=b("zx-dialog-title"),e=a("dialog",{class:"zx-modal zx-dialog",ariaLabelledby:t},a("header",{class:"zx-dialog__header"},a("h2",{class:"zx-dialog__title",id:t,ref:"title"}),a("button",{class:"zx-btn zx-dialog__close",ref:"close",type:"button","data-kind":"ghost",ariaLabel:"Close",title:"Close"},"\xD7")),a("div",{class:"zx-modal__content zx-dialog__body",ref:"content"}),a("footer",{class:"zx-dialog__footer",ref:"footer"}));return e.dataset.state="closed",document.body.append(e),e}open(){return this.isOpen()?this:(this.#r=document.activeElement instanceof Element?document.activeElement:null,super.open(),queueMicrotask(()=>{if(!this.isOpen())return;let e=this.el.querySelector("[autofocus]:not([disabled])")??this.el.querySelector(Ec);e instanceof HTMLElement&&e.focus()}),this)}setTitle(t){return this.#i=String(t??""),this.#o(this.#i),this}setContent(t){return this.#t.clear(),this.#e=null,Dc(this.refs.content,t),this}setButtons(t){return this.#s=as(t),this.#l(this.#s),this}addView(t,e){let s=String(t);this.#t.get(s)?.content.remove();let n=a("section",{class:"zx-dialog__view",hidden:!0,ariaHidden:"true"});zo(n,e?.content??null);let o={key:s,content:n,buttons:e&&Object.hasOwn(e,"buttons")?as(e.buttons??[]):null,title:e&&Object.hasOwn(e,"title")?String(e.title??""):null};return this.#t.set(s,o),this.#t.size===1||this.#e?.key===s?this.showView(s):this.refs.content.append(n),o}showView(t){let e=this.#t.get(String(t));if(!e)throw new RangeError(`Unknown dialog view: ${t}`);this.#e||this.refs.content.replaceChildren();for(let s of this.#t.values()){s.content.isConnected||this.refs.content.append(s.content);let r=s===e;s.content.hidden=!r,s.content.setAttribute("aria-hidden",String(!r))}return this.#e=e,this.#o(e.title??this.#i),this.#l(e.buttons??this.#s),e}getView(t){return this.#t.get(String(t))??null}static alert({title:t="",message:e="",okLabel:s="OK"}={}){return new Promise(r=>{let n=!1,o=()=>{n||(n=!0,l.close(),r())},l=new i(null,{title:t,content:e,buttons:[{label:s,kind:"primary",action:o,autofocus:!0}]});l.once("close",()=>{n||(n=!0,r()),l.destroy()}),l.open()})}static confirm({title:t="",message:e="",okLabel:s="OK",cancelLabel:r="Cancel",danger:n=!1}={}){return new Promise(o=>{let l=!1,c=u=>{l||(l=!0,h.close(u),o(u))},h=new i(null,{title:t,content:e,buttons:[{label:r,action:()=>c(!1)},{label:s,kind:n?"danger":"primary",action:()=>c(!0),autofocus:!0}]});h.once("close",()=>{l||(l=!0,o(!1)),h.destroy()}),h.open()})}static prompt({title:t="",message:e="",value:s="",placeholder:r=""}={}){return new Promise(n=>{let o=!1,l=a("input",{class:"zx-dialog__prompt-input",value:String(s),placeholder:String(r),autofocus:!0,ariaLabel:String(t||"Prompt value")}),c=a("div",{class:"zx-dialog__prompt"},a("div",{class:"zx-dialog__prompt-message"},e),l),h=d=>{o||(o=!0,u.close(d),n(d))},u=new i(null,{title:t,content:c,buttons:[{label:"Cancel",action:()=>h(null)},{label:"OK",kind:"primary",action:()=>h(l.value)}]});u.listen(l,"keydown",d=>{d.key==="Enter"&&(d.preventDefault(),h(l.value))}),u.once("close",()=>{o||(o=!0,n(null)),u.destroy()}),u.open()})}#a(t){let e={sm:400,md:600,lg:840},s=typeof t=="number"&&Number.isFinite(t)?t:e[t]??e.md;this.el.style.inlineSize=`${Math.max(0,s)}px`}#o(t){this.refs.title.textContent=t}#l(t){this.#n=as(t),this.refs.footer.replaceChildren(),this.refs.footer.hidden=this.#n.length===0,this.#n.forEach((e,s)=>{this.refs.footer.append(a("button",{class:"zx-btn",type:"button","data-kind":e.kind??"default","data-size":"md","data-dialog-button":String(s),autofocus:!!e.autofocus},a("span",{class:"zx-btn__label"},e.label)))})}#h(t){let e=t.action??"close";e==="close"?this.close():e==="cancel"?this.emit("cancel").defaultPrevented||this.close():typeof e=="function"&&e(this)}#c(){this.#r?.isConnected&&typeof this.#r.focus=="function"&&this.#r.focus(),this.#r=null}};function as(i){return Array.isArray(i)?i.map(t=>({...t,label:String(t.label??"")})):[]}function Dc(i,t){i.replaceChildren(),zo(i,t)}function zo(i,t){if(t!=null)if(typeof t=="string"||typeof t=="number")i.append(document.createTextNode(String(t)));else if(typeof t.toElement=="function"){let e=t.toElement();e&&i.append(e)}else typeof t.nodeType=="number"&&i.append(t)}var ct=class extends p{static cssName="groupbox";static defaults={title:"",open:!0};constructor(t,e={}){let s=t,r=null;if(t!==null){let n=R(t);if(n&&n.localName!=="details"){let o=document.createElement("details"),l=Array.from(n.childNodes),c=n.parentNode,h=n.nextSibling;c&&c.insertBefore(o,n),o.append(...l),n.remove(),r={original:n,details:o,children:l,parent:c,next:h},s=o}}try{super(s,e)}catch(n){throw r&&ko(r),n}this._adoption=r}render(){let t=!this.el,e=this.el??a("details");if(e.localName!=="details")throw new TypeError("Groupbox requires a details element");this._createdRoot=t,this._original=t?null:Mc(e);let s=Array.from(e.childNodes).filter(o=>!(o.nodeType===1&&o.localName==="summary")),r=a("summary",{class:"zx-groupbox__summary",ref:"summary"},a("span",{class:"zx-groupbox__chevron",ariaHidden:"true"},_("chevron-right",{size:16})),a("span",{class:"zx-groupbox__title",ref:"title"},String(this.options.title))),n=a("div",{class:"zx-groupbox__content",ref:"content"},s);return e.replaceChildren(r,n),e.open=!!this.options.open,this._lastOpen=e.open,this.listen(e,"toggle",()=>{let o=e.open;o!==this._lastOpen&&(this._lastOpen=o,this.emit(o?"open":"close"))}),e}open(){return this.el.setAttribute("open",""),this}close(){return this.el.removeAttribute("open"),this}toggle(){return this.isOpen()?this.close():this.open()}isOpen(){return this.el.open}setTitle(t){return this.refs.title.textContent=String(t),this}setContent(t){let e=t instanceof p?t.toElement():t;if(this.refs.content.replaceChildren(),typeof e=="string")this.refs.content.append(document.createTextNode(e));else if(e&&typeof e.nodeType=="number")this.refs.content.append(e);else throw new TypeError("Groupbox content must be a string, Node, or Component");return this}destroy(){this._cleaned||(this._cleaned=!0,super.destroy(),this._adoption?ko(this._adoption):!this._createdRoot&&this._original&&Ic(this.el,this._original))}};function Mc(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function Ic(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}function ko(i){if(i.original.replaceChildren(...i.children),i.details.parentNode)i.details.replaceWith(i.original);else if(i.parent){let t=i.next?.parentNode===i.parent?i.next:null;i.parent.insertBefore(i.original,t)}}var kt=class extends p{static cssName="search";static defaults={placeholder:"",value:"",clearable:!0,debounce:250};render(){let t=!this.el,e=this.el??a("form");this._createdRoot=t,this._original=t?null:Oc(e),this._inputTimer=null,e.setAttribute("role","search");let s=a("input",{class:"zx-search__input",ref:"input",type:"search",placeholder:String(this.options.placeholder),value:String(this.options.value),ariaLabel:String(this.options.placeholder||"Search")}),r=this.options.clearable?a("button",{class:"zx-search__clear",ref:"clear",type:"button",ariaLabel:"Clear search",title:"Clear search"},_("x",{size:15})):null,n=a("button",{class:"zx-search__submit",ref:"submit",type:e.localName==="form"?"submit":"button",ariaLabel:"Submit search",title:"Search"},_("search",{size:16}));return e.replaceChildren(...[s,r,n].filter(Boolean)),this._syncClear(),this.listen(s,"input",()=>{this._syncClear(),this._scheduleInput()}),e.localName==="form"?this.listen(e,"submit",o=>{o.preventDefault(),this.emit("submit",{value:this.get()})}):(this.listen(s,"keydown",o=>{o.key==="Enter"&&(o.preventDefault(),this.emit("submit",{value:this.get()}))}),this.listen(n,"click",()=>this.emit("submit",{value:this.get()}))),r&&this.listen(r,"click",()=>this.clear()),e}get(){return this.refs.input.value}set(t,{silent:e=!1}={}){return this._inputTimer!==null&&(clearTimeout(this._inputTimer),this._inputTimer=null),this.refs.input.value=String(t),this._syncClear(),e||this._scheduleInput(),this}focus(){return this.refs.input.focus(),this}clear(){return this.set(""),this.emit("clear"),this.focus(),this}destroy(){this._cleaned||(this._cleaned=!0,this._inputTimer!==null&&clearTimeout(this._inputTimer),super.destroy(),!this._createdRoot&&this._original&&Fc(this.el,this._original))}_scheduleInput(){this._inputTimer!==null&&clearTimeout(this._inputTimer);let t=Math.max(0,Number(this.options.debounce)||0);this._inputTimer=setTimeout(()=>{this._inputTimer=null,this.emit("input",{value:this.get()})},t)}_syncClear(){this.refs.clear&&(this.refs.clear.hidden=this.get()==="")}};function Oc(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function Fc(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}var Lc=new Set(["divided","bracket","line","segmented"]),Ct=class extends p{static cssName="tabbox";static defaults={tabs:[],active:null,variant:"divided",keepAlive:!0};constructor(t,e={}){super(t,e)}render(){let t=!this.el,e=this.el??a("section");if(this.el=e,this._createdRoot=t,this._original=t?null:Rc(e),this._cleaned=!1,this._tabs=[],this._active=null,this._keepAlive=!!this.options.keepAlive,this._initializing=!0,!Lc.has(this.options.variant))throw new RangeError(`Unknown tabbox variant: ${this.options.variant}`);e.dataset.variant=this.options.variant;let s=a("div",{class:"zx-tabbox__tablist",ref:"tablist",role:"tablist",ariaOrientation:"horizontal"}),r=a("div",{class:"zx-tabbox__panels",ref:"panels"});if(e.replaceChildren(s,r),!Array.isArray(this.options.tabs))throw new TypeError("Tabbox tabs must be an array");for(let l of this.options.tabs)this.addTab(l);this._initializing=!1;let n=this.options.active===null?null:this._find(this.options.active),o=n&&!n.definition.disabled?n:this._enabledTabs()[0];return o&&this._applyActive(o),this.listen(s,"click",l=>{let c=l.target.closest?.('[role="tab"]');if(!c||!s.contains(c))return;let h=this._recordForTab(c);!h||h.definition.disabled||(this._setFocused(h),this.openTab(h.definition.name))}),this.listen(s,"keydown",l=>this._onKeydown(l)),e}addTab(t,e={}){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError("Tab definition must be an object");if(typeof t.name!="string"||t.name==="")throw new TypeError("Tab name must be a non-empty string");if(this._find(t.name))throw new RangeError(`Tab already exists: ${t.name}`);if(!Vc(t.content))throw new TypeError("Tab content must be a Node, Component, or function");let s={name:t.name,title:String(t.title??""),content:t.content,icon:t.icon?String(t.icon):null,closable:!!t.closable,disabled:!!t.disabled},r=b("zx-tab"),n=b("zx-tabpanel"),o=a("span",{class:"zx-tabbox__title"},s.title),l=a("span",{class:"zx-tabbox__badge",hidden:!0}),c=[];s.icon&&c.push(a("span",{class:"zx-tabbox__icon",ariaHidden:"true"},_(s.icon,{size:16}))),c.push(o,l),s.closable&&c.push(a("span",{class:"zx-tabbox__close",ariaHidden:"true"},_("x",{size:14})));let h=a("button",{class:"zx-tabbox__tab",type:"button",id:r,role:"tab",tabindex:"-1",ariaControls:n,ariaSelected:"false",ariaDisabled:s.disabled?"true":null,dataset:{closable:s.closable?"true":null}},c),u=a("div",{class:"zx-tabbox__panel",id:n,role:"tabpanel",tabindex:"0",ariaLabelledby:r,hidden:!0}),d={definition:s,tab:h,title:o,badge:l,panel:u,built:!1},m=Number.isFinite(e.index)?Math.trunc(e.index):this._tabs.length,f=Math.max(0,Math.min(this._tabs.length,m)),g=this._tabs[f]??null;return this._tabs.splice(f,0,d),this.refs.tablist.insertBefore(h,g?.tab??null),this._keepAlive&&this.refs.panels.insertBefore(u,g?.panel??null),!this._initializing&&!this._active&&!s.disabled&&this._applyActive(d),this}removeTab(t){return this._removeTab(t,!1),this}openTab(t){let e=this._find(t);if(!e||e.definition.disabled||e===this._active)return this;let s=this._active?.definition.name??null;return this.emit("change",{name:e.definition.name,previous:s}).defaultPrevented?this:(this._applyActive(e),this)}show(t){return this.openTab(t)}getActive(){return this._active?.definition.name??null}setTitle(t,e){let s=this._require(t);return s.definition.title=String(e??""),s.title.textContent=s.definition.title,this}setBadge(t,e){let s=this._require(t);return s.badge.textContent=e===null?"":String(e),s.badge.hidden=e===null,this}enableTab(t){let e=this._require(t);return e.definition.disabled?(e.definition.disabled=!1,e.tab.removeAttribute("aria-disabled"),this._active||this._applyActive(e),this):this}disableTab(t){let e=this._require(t);if(e.definition.disabled)return this;if(e===this._active){let s=this._enabledTabs().find(r=>r!==e)??null;if(s){if(this.openTab(s.definition.name),this._active===e)return this}else e.tab.setAttribute("aria-selected","false"),e.tab.tabIndex=-1,e.panel.hidden=!0,this._keepAlive||e.panel.remove(),this._active=null}return e.definition.disabled=!0,e.tab.setAttribute("aria-disabled","true"),e.tab.tabIndex=-1,this}destroy(){this._cleaned||(this._cleaned=!0,super.destroy(),!this._createdRoot&&this._original&&Pc(this.el,this._original))}_onKeydown(t){let e=t.target.closest?.('[role="tab"]');if(!e||!this.refs.tablist.contains(e))return;let s=this._recordForTab(e);if(!s)return;let r=this._enabledTabs();if(t.key==="ArrowLeft"||t.key==="ArrowRight"){t.preventDefault();let n=t.key==="ArrowRight"?1:-1,o=r.indexOf(s),l=r[(o+n+r.length)%r.length];l&&this._setFocused(l);return}if(t.key==="Home"||t.key==="End"){t.preventDefault();let n=t.key==="Home"?r[0]:r[r.length-1];n&&this._setFocused(n);return}if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.openTab(s.definition.name);return}if(t.key==="Delete"&&s.definition.closable){t.preventDefault();let n=this._tabs.indexOf(s);if(!this._removeTab(s.definition.name,!0))return;let o=this._tabs[Math.min(n,this._tabs.length-1)]??this._tabs[n-1],l=o&&!o.definition.disabled?o:this._active;l&&this._setFocused(l)}}_removeTab(t,e){let s=this._find(t);if(!s)return!1;let r=this._tabs.indexOf(s),o=this._tabs.filter(c=>c!==s).filter(c=>!c.definition.disabled),l=o.find(c=>this._tabs.indexOf(c)>r)??o.at(-1)??null;return s===this._active&&l&&this.emit("change",{name:l.definition.name,previous:s.definition.name}).defaultPrevented?!1:(this._tabs.splice(r,1),s.tab.remove(),s.panel.remove(),s===this._active&&(this._active=null,l&&this._applyActive(l)),e&&this.emit("close",{name:s.definition.name}),!0)}_applyActive(t){this._ensureContent(t);let e=this._active;e&&e!==t&&(e.tab.setAttribute("aria-selected","false"),e.panel.hidden=!0,this._keepAlive||e.panel.remove()),this._active=t,t.tab.setAttribute("aria-selected","true"),t.panel.hidden=!1,t.panel.parentNode!==this.refs.panels&&this.refs.panels.append(t.panel),this._setFocused(t,!1)}_ensureContent(t){if(t.built)return;let e=typeof t.definition.content=="function"?t.definition.content():t.definition.content,s=e instanceof p?e.toElement():e;if(!s||typeof s.nodeType!="number")throw new TypeError(`Tab content factory for ${t.definition.name} must return a Node or Component`);t.panel.append(s),t.built=!0}_setFocused(t,e=!0){for(let s of this._tabs)s.tab.tabIndex=s===t?0:-1;e&&t.tab.focus()}_enabledTabs(){return this._tabs.filter(t=>!t.definition.disabled)}_find(t){return this._tabs.find(e=>e.definition.name===t)??null}_require(t){let e=this._find(t);if(!e)throw new RangeError(`Unknown tab: ${t}`);return e}_recordForTab(t){return this._tabs.find(e=>e.tab===t)??null}};function Vc(i){return typeof i=="function"||i instanceof p?!0:!!(i&&typeof i=="object"&&typeof i.nodeType=="number")}function Rc(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function Pc(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}function Bc(i,t){return String(i).localeCompare(String(t))}function jc(i,t){return i-t}function Hc(i,t){return i.getTime()-t.getTime()}function qc(i,t,e="asc"){let s=i==null,r=t==null;if(s||r)return s&&r?0:s?1:-1;let n;return i instanceof Date&&t instanceof Date?n=Hc(i,t):typeof i=="number"&&typeof t=="number"?n=jc(i,t):n=Bc(i,t),e==="desc"?-n:n}function $c(i,t="asc"){return(e,s)=>qc(i(e),i(s),t)}function Co(i,t,e="asc"){let s=$c(t,e);return i.map((r,n)=>({row:r,index:n})).sort((r,n)=>s(r.row,n.row)||r.index-n.index).map(({row:r})=>r)}var Kc=new Set(["text","number","select","date","checkbox","textarea"]),Yc='input, textarea, select, button, [tabindex]:not([tabindex="-1"])',pt=class extends p{static cssName="table";static defaults={columns:[],data:[],rowId:"ID",sort:null,sortMode:"local",selectable:!1,stickyHeader:!0,height:null,emptyText:null,rowClass:null,zebra:!0,editMode:!1};constructor(t,e={}){super(t,e)}render(){let t=this.el??a("div");return this._originalChildren=this.el?Array.from(this.el.childNodes):null,this._columns=Array.isArray(this.options.columns)?this.options.columns.map(e=>({...e})):[],this._data=Array.isArray(this.options.data)?[...this.options.data]:[],this._selected=new Set,this._selectionAnchorId=null,this._sort=th(this.options.sort,this._columns),this._rowMeta=new WeakMap,this._rowElements=new Map,this._restored=!1,this._editMode=Jc(this.options.editMode),this._edit=null,this._editMessage=null,this._rovingKey=null,this._rovingCell=null,this._rovingMatched=!1,this._sort&&this.options.sortMode==="local"&&this._sortData(),this._table=a("table",{class:"zx-table__table"}),this._colgroup=a("colgroup",{class:"zx-table__columns"}),this._thead=a("thead",{class:"zx-table__head"}),this._tbody=a("tbody",{class:"zx-table__body"}),this._table.append(this._colgroup,this._thead,this._tbody),this._scroll=a("div",{class:"zx-table__scroll",dataset:{stickyHeader:String(!!this.options.stickyHeader),zebra:String(!!this.options.zebra)}},this._table),this.options.height!=null&&(this._scroll.style.blockSize=typeof this.options.height=="number"?`${this.options.height}px`:String(this.options.height)),this._editMode===!1?t.replaceChildren(this._scroll):(t.dataset.editMode=this._editMode,this._editMessage=a("div",{class:"zx-table__message",id:b("zx-table-message"),role:"status",ariaLive:"polite"}),t.replaceChildren(this._scroll,this._editMessage)),this._renderColumns(),this._renderHeader(),this._renderBody(),this.listen(this._tbody,"click",e=>this._handleBodyClick(e)),this.listen(this._tbody,"dblclick",e=>this._handleBodyDoubleClick(e)),this._editMode!==!1&&(this.listen(this._tbody,"keydown",e=>this._handleEditKeydown(e)),this.listen(this._tbody,"focusin",e=>this._handleEditFocusIn(e)),this.listen(document,"pointerdown",e=>this._handleDocumentPointerDown(e),{capture:!0})),t}setLoading(t=!0){return t?this.el.dataset.loading="true":delete this.el.dataset.loading,this.el.setAttribute("aria-busy",String(!!t)),this}setData(t){this.setLoading(!1),No(t),this._data=[...t],this._sort&&this.options.sortMode==="local"&&this._sortData();let e=this._pruneSelection();return this._renderBody(),e&&this._emitSelectionChange(),this._emitDataChange(),this}addData(t){return No(t),this._data.push(...t),this._sort&&this.options.sortMode==="local"&&this._sortData(),this._renderBody(),this._emitDataChange(),this}updateRow(t,e){let s=this._data.findIndex(n=>Object.is(this._idFor(n),t));if(s<0)return this;let r=this._selected.delete(t);return this._data[s]=e,r&&this._selected.add(this._idFor(e)),this._sort&&this.options.sortMode==="local"&&this._sortData(),this._renderBody(),r&&!Object.is(t,this._idFor(e))&&this._emitSelectionChange(),this._emitDataChange(),this}removeRow(t){let e=this._data.findIndex(r=>Object.is(this._idFor(r),t));if(e<0)return this;this._data.splice(e,1);let s=this._selected.delete(t);return Object.is(this._selectionAnchorId,t)&&(this._selectionAnchorId=null),this._renderBody(),s&&this._emitSelectionChange(),this._emitDataChange(),this}getRow(t){return this._data.find(e=>Object.is(this._idFor(e),t))??null}getData(){return[...this._data]}empty(){let t=this._selected.size>0;return this._data=[],this._selected.clear(),this._selectionAnchorId=null,this._renderBody(),t&&this._emitSelectionChange(),this._emitDataChange(),this}setSort(t,e,s={}){if(this._abortEdit({focus:!1}),!this._columns.find(o=>o.id===t))throw new RangeError(`Unknown table column: ${t}`);let n=e??(this._sort?.id===t&&this._sort.dir==="asc"?"desc":"asc");if(n!=="asc"&&n!=="desc")throw new TypeError('Table sort direction must be "asc" or "desc"');return this._sort={id:t,dir:n},this.options.sortMode==="local"&&(this._sortData(),this._renderBody()),this._syncSortHeader(),s.silent||this.emit("sort",{id:t,dir:n}),this}getSelection(){return this._data.filter(t=>this._selected.has(this._idFor(t)))}setSelection(t){if(!Array.isArray(t))throw new TypeError("Table selection must be an array of row ids");let e=new Set(this._data.map(r=>this._idFor(r))),s=new Set;if(this.options.selectable!==!1){for(let r of t)if(e.has(r)&&s.add(r),this.options.selectable==="single"&&s.size>0)break}return sh(this._selected,s)?this:(this._selected=s,this._syncSelection(),this._emitSelectionChange(),this)}clearSelection(){return this._selected.size===0?this:(this._selected.clear(),this._selectionAnchorId=null,this._syncSelection(),this._emitSelectionChange(),this)}startEdit(t,e){if(this._editMode===!1)return this;let s=this._columns.find(u=>u.id===e);if(!s)return this;let r=this._data.find(u=>Object.is(this._idFor(u),t));if(r===void 0||Ce(s,r)===!1)return this;if(this._edit){if(Object.is(this._edit.id,t)&&this._edit.cells.has(e))return this._edit.columnId=e,this._focusEditor(e),this;if(this.commitEdit(),this._edit)return this}let n=this._data.findIndex(u=>Object.is(this._idFor(u),t));if(n<0)return this;let o=this._data[n],l=this._rowElements.get(t)?.[0];if(!l)return this;let c=this._editMode==="row"?this._columns.filter(u=>Ce(u,o)!==!1):[s],h=new Map;for(let u of c){let d=To(l,u.id);if(!d)continue;let m=this._createEditor(d,u,o,n);m&&h.set(u.id,m)}return h.size===0?this:(this._edit={id:t,columnId:e,row:o,cells:h,tr:l},l.dataset.editing="true",this.emit("editstart",{row:o,id:t,column:s,columnId:e,value:o?.[e]}),this._focusEditor(e),this)}commitEdit(){let t=this._edit;if(!t)return this;let e=this.getRow(t.id)??t.row,s={};for(let[d,m]of t.cells)s[d]=m.read();let r=this._columns.filter(d=>t.cells.has(d.id)),n=Zc(s,r,e,this._msgOr("table.invalid","Invalid value"));if(n)return this._markInvalid(n.columnId,n.message),t.columnId=n.columnId,this.emit("editinvalid",{row:e,id:t.id,column:this._columns.find(d=>d.id===n.columnId)??null,columnId:n.columnId,value:s[n.columnId],message:n.message}),this._focusEditor(n.columnId),this;this._clearInvalid();let o=Qc(e,s),l=t.columnId;if(this.emit("editcommit",{row:e,id:t.id,column:this._columns.find(d=>d.id===l)??null,columnId:l,value:s[l],previous:e?.[l],changes:o}).defaultPrevented)return this;let h=this._editHasFocus(),u={...e,...o};return this._teardownEdit(),Object.keys(o).length>0&&this.updateRow(t.id,u),h&&this._focusCell(this._idFor(u),l),this}cancelEdit(){return this._abortEdit({focus:!0}),this}isEditing(){return this._edit!==null}getEditing(){return this._edit?{id:this._edit.id,columnId:this._edit.columnId}:null}destroy(){this._teardownEdit(),this.el&&delete this.el.dataset.editMode,!this._restored&&this._originalChildren&&(this.el.replaceChildren(...this._originalChildren),this._restored=!0),super.destroy()}_renderColumns(){let t=document.createDocumentFragment();this.options.selectable==="multi"&&t.append(a("col",{class:"zx-table__selection-column"}));let e=this._columns.map(r=>eh(r.width)),s=e.reduce((r,n)=>r+n,0);this._table.dataset.layout=s>0?"fixed":"auto",this._columns.forEach((r,n)=>{let o=a("col");e[n]>0?o.style.width=`${e[n]/s*100}%`:r.width&&r.width!=="auto"&&(o.style.width=String(r.width)),t.append(o)}),this._colgroup.replaceChildren(t)}_renderHeader(){let t=a("tr",{class:"zx-table__header-row"});if(this.options.selectable==="multi"){this._selectAll=a("input",{class:"zx-table__checkbox zx-table__select-all",type:"checkbox",ariaLabel:"Select all rows"});let e=a("th",{class:"zx-table__selection-header",scope:"col"},this._selectAll);t.append(e),this.listen(this._selectAll,"click",()=>{if(this._selectAll.checked)for(let s of this._data)this._selected.add(this._idFor(s));else this._selected.clear();this._selectionAnchorId=null,this._syncSelection(),this._emitSelectionChange()})}else this._selectAll=null;this._headers=new Map;for(let e of this._columns){let s=a("th",{scope:"col"});if(e.align&&(s.dataset.align=e.align),e.headerTitle&&(s.title=e.headerTitle),e.sortable){let r=a("button",{class:"zx-table__sort-button",type:"button"},a("span",{class:"zx-table__header-label"},e.label));this.listen(r,"click",()=>{let n=this._sort?.id===e.id&&this._sort.dir==="asc"?"desc":"asc";this.setSort(e.id,n)}),s.append(r)}else s.append(a("span",{class:"zx-table__header-label"},e.label));this._headers.set(e.id,s),t.append(s)}this._thead.replaceChildren(t),this._syncSortHeader()}_renderBody(){this._abortEdit({focus:!1});let t=document.createDocumentFragment();if(this._rowMeta=new WeakMap,this._rowElements=new Map,this._rovingCell=null,this._rovingMatched=!1,this._data.length===0){let e=this.options.emptyText==null?this.msg("table.empty"):String(this.options.emptyText);t.append(a("tr",{class:"zx-table__empty-row"},a("td",{class:"zx-table__empty",colspan:this._columns.length+(this.options.selectable==="multi"?1:0)},e)))}else this._data.forEach((e,s)=>t.append(this._createRow(e,s)));this._tbody.replaceChildren(t),this._syncSelectAll()}_createRow(t,e){let s=this._idFor(t),r=a("tr",{dataset:{row:""}}),n=typeof this.options.rowClass=="function"?this.options.rowClass(t):"";n&&r.classList.add(...String(n).split(/\s+/).filter(Boolean)),this.options.selectable!==!1&&r.setAttribute("aria-selected",String(this._selected.has(s))),this._rowMeta.set(r,{row:t,id:s,index:e});let o=this._rowElements.get(s)??[];if(o.push(r),this._rowElements.set(s,o),this.options.selectable==="multi"){let l=a("input",{class:"zx-table__checkbox zx-table__row-checkbox",type:"checkbox",checked:this._selected.has(s),ariaLabel:`Select row ${e+1}`});r.append(a("td",{class:"zx-table__selection-cell"},l))}return this._columns.forEach(l=>{let c=a("td");l.align&&(c.dataset.align=l.align),this._editMode!==!1&&(c.dataset.column=l.id,Ce(l,t)!==!1&&(c.dataset.editable="true",c.tabIndex=-1,this._offerRovingCell(c,s,l.id))),this._renderCellContent(c,l,t,e),r.append(c)}),r}_renderCellContent(t,e,s,r){let n=typeof e.render=="function"?e.render(s,r):s?.[e.id];n&&typeof n=="object"&&typeof n.nodeType=="number"?t.replaceChildren(n):n!=null?t.replaceChildren(document.createTextNode(String(n))):t.replaceChildren()}_handleBodyClick(t){let e=t.target?.nodeType===1?t.target:t.target?.parentElement;if(this._edit&&ls(e))return;let s=e?.closest("tr[data-row]");if(!s||!this._tbody.contains(s))return;let r=this._rowMeta.get(s);if(!r)return;this._edit&&this.commitEdit();let n=e.closest(".zx-table__row-checkbox");if(n&&this.options.selectable==="multi"){this._toggleMultiSelection(r,n.checked,t.shiftKey);return}this.emit("rowclick",{...r,event:t}),this.options.selectable==="single"&&!this._selected.has(r.id)&&(this._selected=new Set([r.id]),this._selectionAnchorId=r.id,this._syncSelection(),this._emitSelectionChange())}_handleBodyDoubleClick(t){let e=t.target?.nodeType===1?t.target:t.target?.parentElement;if(e?.closest(".zx-table__row-checkbox")||this._edit&&ls(e))return;let s=e?.closest("tr[data-row]");if(!s||!this._tbody.contains(s))return;let r=this._rowMeta.get(s);if(r){if(this._editMode!==!1){let n=e?.closest('td[data-editable="true"]');if(n&&this._tbody.contains(n)){this.startEdit(r.id,String(n.dataset.column));return}}this.emit("rowdblclick",{...r,event:t})}}_createEditor(t,e,s,r){let n=Ce(e,s);if(n===!1)return null;let o=s?.[e.id],l=e.editorProps&&typeof e.editorProps=="object"?e.editorProps:{},c=a("span",{class:"zx-table__cell-shadow",ariaHidden:"true"});c.append(...t.childNodes);let h=a("div",{class:"zx-table__editor",dataset:{editor:n}});t.replaceChildren(c,h),t.dataset.editing="true";let u={column:e,type:n,td:t,host:h,control:null,component:null,read:()=>o,destroy(){this.component?.destroy(),this.host.remove()}};if(n==="custom"){u.custom=o,u.read=()=>Pt(e,u.custom,s);let f={value:o,row:s,column:e,commit:y=>{u.custom=y,this.commitEdit()},cancel:()=>this.cancelEdit()},g=e.editor(s,f);return g&&typeof g.toElement=="function"?(typeof g.destroy=="function"&&(u.component=g),h.append(g.toElement())):g&&h.append(g),u.control=h.querySelector(Yc)??h,u}if(n==="number"){let f=new St(null,{...l,value:o??null});return h.append(f.el),u.component=f,u.control=f.getInput(),u.read=()=>(f.set(f.getInput().value,{silent:!0}),Pt(e,f.get(),s)),u}if(n==="select"){let f=Uc(e.options,s),g=f.find(z=>Object.is(z.value,o))??f.find(z=>String(z.value)===String(o??"")),y=new I(null,{...l,items:f,valueKey:"value",labelKey:"label",value:g?g.value:null});return h.append(y.el),u.component=y,u.control=y.refs.input,u.read=()=>Pt(e,y.value,s),u}if(n==="date"){let f=new V(null,{...l,value:o??null});h.append(f.el),u.component=f;let g=f.refs.input;return u.control=g,u.read=()=>{let y=String(g.value??"").trim(),z=f.get();return y===""?Pt(e,null,s):(f.set(y,{silent:!0}),f.get()===null&&f.set(z,{silent:!0}),Pt(e,f.get(),s))},u}if(n==="checkbox"){let f=new P(null,{...l,checked:!!o});return h.append(f.el),u.component=f,u.control=f.el,u.read=()=>Pt(e,f.get(),s),u}let d=n==="textarea",m=a(d?"textarea":"input",{...l,class:d?"zx-table__editor-input zx-table__editor-textarea":"zx-table__editor-input",...d?{}:{type:"text"},ariaLabel:l.ariaLabel??`${e.label} row ${r+1}`,value:Wc(e,o,s)});return h.append(m),u.control=m,u.read=()=>Pt(e,m.value,s),u}_focusEditor(t){let e=this._edit?.cells.get(t),s=e?.control;!s||typeof s.focus!="function"||(s.focus(),e.type==="text"&&typeof s.select=="function"&&s.select())}_focusCell(t,e){let s=this._rowElements.get(t)?.[0];(s?To(s,e):null)?.focus()}_teardownEdit(){let t=this._edit;if(!t)return;this._edit=null;let e=this._data.findIndex(r=>Object.is(this._idFor(r),t.id)),s=e<0?t.row:this._data[e];for(let r of t.cells.values())r.destroy(),delete r.td.dataset.editing,delete r.td.dataset.invalid,this._renderCellContent(r.td,r.column,s,e<0?0:e);t.cells.clear(),delete t.tr.dataset.editing,this._clearInvalid()}_abortEdit({focus:t=!0}={}){let e=this._edit;if(!e)return;let s=t&&this._editHasFocus(),r=this.getRow(e.id)??e.row,n=this._columns.find(o=>o.id===e.columnId)??null;this._teardownEdit(),s&&this._focusCell(e.id,e.columnId),this.emit("editcancel",{row:r,id:e.id,column:n,columnId:e.columnId})}_editHasFocus(){let t=document.activeElement;return!!(t&&this.el?.contains(t))}_markInvalid(t,e){this._clearInvalid();let s=this._edit?.cells.get(t);s&&(s.td.dataset.invalid="true",s.control?.setAttribute("aria-invalid","true"),this._editMessage&&(s.control?.setAttribute("aria-describedby",this._editMessage.id),this._editMessage.textContent=e))}_clearInvalid(){if(this._edit)for(let t of this._edit.cells.values())delete t.td.dataset.invalid,t.control?.removeAttribute("aria-invalid"),t.control?.removeAttribute("aria-describedby");this._editMessage&&(this._editMessage.textContent="")}_handleEditKeydown(t){let e=t.target?.nodeType===1?t.target:t.target?.parentElement;if(!e)return;if(this._edit&&ls(e)){if(Xc(e))return;if(t.key==="Escape"){if(t.defaultPrevented)return;t.preventDefault(),this.cancelEdit();return}if(t.key==="Enter"){if(e.localName==="textarea"&&t.shiftKey)return;t.preventDefault(),this.commitEdit();return}t.key==="Tab"&&this._moveEdit(t);return}if(t.key!=="Enter"&&t.key!=="F2")return;let s=e.closest('td[data-editable="true"]');if(!s||!this._tbody.contains(s))return;let r=this._rowMeta.get(s.parentElement);r&&(t.preventDefault(),this.startEdit(r.id,String(s.dataset.column)))}_moveEdit(t){let e=this._edit;if(!e)return;let s=t.shiftKey?-1:1,r=this._data.findIndex(o=>Object.is(this._idFor(o),e.id)),n=this._nextEditableCell(r,e.columnId,s);if(n&&Object.is(n.id,e.id)&&e.cells.has(n.columnId)){t.preventDefault(),e.columnId=n.columnId,this._focusEditor(n.columnId);return}if(!n){this.commitEdit(),this._edit&&t.preventDefault();return}t.preventDefault(),this.commitEdit(),this._edit||this.startEdit(n.id,n.columnId)}_nextEditableCell(t,e,s){let r=this._columns.length;if(t<0||r===0)return null;let n=t,o=this._columns.findIndex(c=>c.id===e),l=this._data.length*r+r;for(let c=0;c<l;c+=1){if(o+=s,o>=r?(n+=1,o=0):o<0&&(n-=1,o=r-1),n<0||n>=this._data.length)return null;let h=this._data[n],u=this._columns[o];if(Ce(u,h)!==!1)return{id:this._idFor(h),columnId:u.id,index:n}}return null}_handleEditFocusIn(t){let s=(t.target?.nodeType===1?t.target:null)?.closest('td[data-editable="true"]');if(!s||!this._tbody.contains(s))return;let r=this._rowMeta.get(s.parentElement);r&&this._setRovingCell(s,r.id,String(s.dataset.column))}_handleDocumentPointerDown(t){if(!this._edit)return;let e=t.target?.nodeType===1?t.target:t.target?.parentElement;e&&ls(e)||e&&this._tbody.contains(e)||this.commitEdit()}_offerRovingCell(t,e,s){if(this._rovingMatched)return;let r=this._rovingKey!==null&&Object.is(this._rovingKey.id,e)&&this._rovingKey.columnId===s;!r&&this._rovingCell||(r&&this._rovingCell&&(this._rovingCell.tabIndex=-1),t.tabIndex=0,this._rovingCell=t,this._rovingMatched=r)}_setRovingCell(t,e,s){this._rovingCell&&this._rovingCell!==t&&(this._rovingCell.tabIndex=-1),t.tabIndex=0,this._rovingCell=t,this._rovingMatched=!0,this._rovingKey={id:e,columnId:s}}_msgOr(t,e){let s=this.msg(t);return s===t?e:s}_toggleMultiSelection(t,e,s){let r=this._data.findIndex(n=>Object.is(this._idFor(n),this._selectionAnchorId));if(s&&r>=0){let n=Math.min(r,t.index),o=Math.max(r,t.index);for(let l=n;l<=o;l+=1){let c=this._idFor(this._data[l]);e?this._selected.add(c):this._selected.delete(c)}}else e?this._selected.add(t.id):this._selected.delete(t.id);this._selectionAnchorId=t.id,this._syncSelection(),this._emitSelectionChange()}_syncSelection(){for(let[t,e]of this._rowElements){let s=this._selected.has(t);for(let r of e){r.setAttribute("aria-selected",String(s));let n=r.querySelector(".zx-table__row-checkbox");n&&(n.checked=s)}}this._syncSelectAll()}_syncSelectAll(){if(!this._selectAll)return;let t=this._data.reduce((e,s)=>e+Number(this._selected.has(this._idFor(s))),0);this._selectAll.disabled=this._data.length===0,this._selectAll.checked=this._data.length>0&&t===this._data.length,this._selectAll.indeterminate=t>0&&t<this._data.length}_syncSortHeader(){if(this._headers)for(let[t,e]of this._headers)this._sort?.id===t?e.setAttribute("aria-sort",this._sort.dir==="asc"?"ascending":"descending"):e.removeAttribute("aria-sort")}_sortData(){if(!this._sort)return;let t=this._columns.find(s=>s.id===this._sort.id);if(!t)return;let e=typeof t.sortValue=="function"?t.sortValue:s=>s?.[t.id];this._data=Co(this._data,e,this._sort.dir)}_pruneSelection(){let t=new Set(this._data.map(s=>this._idFor(s))),e=this._selected.size;for(let s of this._selected)t.has(s)||this._selected.delete(s);return t.has(this._selectionAnchorId)||(this._selectionAnchorId=null),e!==this._selected.size}_idFor(t){return typeof this.options.rowId=="function"?this.options.rowId(t):t?.[this.options.rowId]}_emitSelectionChange(){let t=this.getSelection();this.emit("selectionchange",{rows:t,ids:t.map(e=>this._idFor(e))})}_emitDataChange(){this.emit("datachange",{rows:this.getData()})}};function Ce(i,t){if(!i||typeof i!="object")return!1;if(typeof i.editor=="function")return typeof i.editable=="function"&&i.editable(t)===!1?!1:"custom";let e=typeof i.editable=="function"?i.editable(t):i.editable;return e===!0?"text":typeof e=="string"&&Kc.has(e)?e:!1}function Uc(i,t){let e=typeof i=="function"?i(t):i;return Array.isArray(e)?e.map(s=>s!==null&&typeof s=="object"?{value:s.value,label:String(s.label??s.value??"")}:{value:s,label:String(s??"")}):e!==null&&typeof e=="object"?Object.entries(e).map(([s,r])=>({value:s,label:String(r??"")})):[]}function Wc(i,t,e){if(typeof i?.format=="function"){let s=i.format(t,e);return s==null?"":String(s)}return t==null?"":String(t)}function Pt(i,t,e){return typeof i?.parse=="function"?i.parse(t,e):t}function Gc(i,t){return Object.is(i,t)?!0:i instanceof Date&&t instanceof Date?i.getTime()===t.getTime():!1}function Qc(i,t){let e={};for(let[s,r]of Object.entries(t??{}))Gc(i?.[s],r)||(e[s]=r);return e}function Zc(i,t,e,s="Invalid value"){for(let r of t??[]){if(typeof r?.validate!="function"||!Object.prototype.hasOwnProperty.call(i??{},r.id))continue;let n=r.validate(i[r.id],e);if(typeof n=="string")return{columnId:r.id,message:n};if(n===!1)return{columnId:r.id,message:s}}return null}function Jc(i){return i==="cell"||i==="row"?i:i===!0?"cell":!1}function ls(i){return!!i?.closest?.(".zx-table__editor")}function Xc(i){return i.closest("[popover]")?!0:i.getAttribute?.("aria-expanded")==="true"}function To(i,t){for(let e of i.cells)if(e.dataset.column===t)return e;return null}function th(i,t){return!i||typeof i!="object"||!t.some(e=>e.id===i.id)?null:{id:i.id,dir:i.dir==="desc"?"desc":"asc"}}function eh(i){if(typeof i!="string")return 0;let t=/^(\d*\.?\d+)fr$/.exec(i.trim());return t?Math.max(0,Number(t[1])):0}function No(i){if(!Array.isArray(i))throw new TypeError("Table data must be an array")}function sh(i,t){return i.size===t.size&&[...i].every(e=>t.has(e))}var it=Symbol("invalid attribute");function se(i,t="string",e=console.warn){if(Eo(t),t==="boolean")return i!==null;if(i!==null){if(t==="string")return i;if(t==="number"){let s=Number(i);return Number.isFinite(s)?s:(e(`Ignoring invalid number attribute: ${JSON.stringify(i)}`),it)}try{return JSON.parse(i)}catch{return e(`Ignoring invalid JSON attribute: ${JSON.stringify(i)}`),it}}}function hr(i,t="string",e=console.warn){if(Eo(t),t==="boolean")return i?"":null;if(i==null)return null;if(t==="number"){let s=Number(i);return Number.isFinite(s)?String(s):(e(`Ignoring invalid number property: ${String(i)}`),it)}if(t==="json"){try{let s=JSON.stringify(i);if(s!==void 0)return s}catch{}return e("Ignoring property that cannot be serialized as JSON"),it}return String(i)}function Eo(i){if(!["string","number","boolean","json"].includes(String(i)))throw new TypeError(`Unknown reflected attribute type: ${String(i)}`)}var ih=Object.freeze(["change","input","submit","clear","open","close","cancel","invalid","query","loaded","rowclick","rowdblclick","sort","selectionchange","datachange"]),rh=rt({checked:N({always:!0,set:(i,t)=>i.set(t,{silent:!0}),get:i=>i.get()}),value:S({default:!0}),label:S({default:null,rebuild:!0}),disabled:N({always:!0,set:Te})}),nh=rt({checked:N({always:!0,set:(i,t)=>i.set(t,{silent:!0}),get:i=>i.get()}),value:S({option:null,default:"on"}),label:S({default:"",set:(i,t)=>i.setLabel(t)}),icon:N({rebuild:!0}),disabled:N({always:!0,set:Te})}),oh=rt({items:mt({default:[],set:(i,t)=>i.setItems(t)}),value:S({default:null,set:(i,t)=>i.set(t,{silent:!0}),get:i=>i.value}),"value-key":S({property:"valueKey",default:"ID",rebuild:!0}),"label-key":S({property:"labelKey",default:"name",rebuild:!0}),placeholder:S({default:"",set:(i,t)=>{i.refs.input.placeholder=t}}),clearable:N({default:!1,rebuild:!0}),filter:S({default:!1,normalize:yh,rebuild:!0}),"search-keys":mt({property:"searchKeys",default:null,rebuild:!0}),"min-query":ie({property:"minQuery",default:0,rebuild:!0}),debounce:ie({default:200,rebuild:!0}),"list-height":ie({property:"listHeight",default:280,rebuild:!0}),disabled:N({always:!0,set:Te}),required:N({option:null,always:!0}),name:S({option:null,default:""})}),ah=rt({items:mt({default:[],set:(i,t)=>i.setItems(t)}),value:mt({option:null,default:[],set:(i,t)=>i.setValues(t),get:i=>i.getValues()}),"value-key":S({property:"valueKey",default:"ID",rebuild:!0}),"label-key":S({property:"labelKey",default:"name",rebuild:!0}),"checked-key":S({property:"checkedKey",default:"on",rebuild:!0}),search:N({rebuild:!0}),height:ie({default:280,rebuild:!0}),"default-checked":N({property:"defaultChecked",default:!1,rebuild:!0}),disabled:N({option:null,always:!0,set:bh}),name:S({option:null,default:""})}),lh=rt({format:S({default:"%d.%m.%Y",rebuild:!0}),time:N({always:!0,rebuild:!0}),value:S({option:null,default:null,normalize:Sh,set:(i,t)=>i.set(t,{silent:!0}),get:(i,t)=>dr(i.get(),!!t.time),serialize:Ah}),placeholder:S({default:null,rebuild:!0}),clearable:N({rebuild:!0}),disabled:N({always:!0,set:Te}),required:N({option:null,always:!0}),name:S({option:null,default:""})}),ch=rt({value:ie({default:0,set:(i,t)=>i.set(t,{silent:!0}),get:i=>i.get()}),unit:S({default:"minutes",rebuild:!0}),seconds:N({always:!0,rebuild:!0}),signed:N({always:!0,rebuild:!0}),disabled:N({always:!0,set:Te}),name:S({option:null,default:""})}),hh=rt({value:S({default:"",set:(i,t)=>i.set(t,{silent:!0}),get:i=>i.get()}),placeholder:S({default:"",set:(i,t)=>{i.refs.input.placeholder=t}}),clearable:N({rebuild:!0}),debounce:ie({default:250,rebuild:!0})}),uh=rt({title:S({default:"",set:(i,t)=>i.setTitle(t)}),open:N({default:!1,always:!0,set:(i,t)=>t?i.open():i.close(),get:i=>i.isOpen()})}),dh=rt({tabs:mt({default:[],normalize:vh,rebuild:!0}),active:S({default:null,set:(i,t)=>{t!==null&&i.openTab(t)},get:i=>i.getActive()}),variant:S({default:"divided",rebuild:!0}),"keep-alive":N({property:"keepAlive",rebuild:!0})}),fh=rt({columns:mt({default:[],rebuild:!0}),data:mt({default:[],set:(i,t)=>i.setData(t),get:i=>i.getData()}),"row-id":S({property:"rowId",default:"ID",rebuild:!0}),sort:mt({default:null,rebuild:!0}),"sort-mode":S({property:"sortMode",default:"local",rebuild:!0}),selectable:S({default:!1,normalize:xh,rebuild:!0}),"sticky-header":N({property:"stickyHeader",rebuild:!0}),height:S({default:null,normalize:Oo,rebuild:!0}),"empty-text":S({property:"emptyText",default:null,rebuild:!0}),zebra:N({rebuild:!0})}),ph=rt({title:S({default:"",set:(i,t)=>i.setTitle(t)}),size:S({default:"md",normalize:Oo,rebuild:!0}),buttons:mt({default:[],set:(i,t)=>i.setButtons(t)}),closable:N({rebuild:!0}),open:N({option:null,default:!1,always:!0,set:(i,t)=>t?i.open():i.close(),get:i=>i.isOpen()})}),mh=Object.freeze([["toggle",P,{formAssociated:!0,attrs:rh}],["check-button",st,{formAssociated:!0,attrs:nh}],["select",I,{formAssociated:!0,attrs:oh}],["checklist",U,{formAssociated:!0,attrs:ah}],["datebox",V,{formAssociated:!0,attrs:lh}],["timebox",J,{formAssociated:!0,attrs:ch}],["search",kt,{formAssociated:!1,attrs:hh}],["groupbox",ct,{formAssociated:!1,attrs:uh}],["tabbox",Ct,{formAssociated:!1,attrs:dh}],["table",pt,{formAssociated:!1,attrs:fh}],["dialog",lt,{formAssociated:!1,attrs:ph}]]);function _h(i,{formAssociated:t=!1,attrs:e={}}={}){let s=Io(e),r=Object.freeze(Object.keys(s)),n=i===ct||i===lt;class o extends HTMLElement{static formAssociated=!!t;static get observedAttributes(){return r}constructor(){super(),this._component=null,this._bridgeAbort=null,this._reflecting=new Set,this._propertyValues=new Map,this._defaults=null,this._contentNodes=null,this._disabledByForm=!1,this._applying=!1,this._internals=t&&typeof this.attachInternals=="function"?this.attachInternals():null}connectedCallback(){this._component||(this._upgradeProperties(s),n&&this._contentNodes===null&&(this._contentNodes=Array.from(this.childNodes)),t&&this._defaults===null&&this._captureDefaults(s),this._createComponent(i,s,n))}disconnectedCallback(){this._destroyComponent()}attributeChangedCallback(c,h,u){if(this._reflecting.has(c))return;let d=s[c];if(!d)return;let m=se(u,d.type);if(m===it)return;this._propertyValues.delete(d.property);let f=m===void 0?cs(d.default):m;this._applyValue(c,d,f)}formDisabledCallback(c){this._disabledByForm=!!c,this._syncEffectiveDisabled(s),this._syncFormState(i)}formResetCallback(){if(!this._defaults)return;let c=ur(i);!c||!this._defaults.has(c)||this._applyControlValue(s,c,cs(this._defaults.get(c)))}formStateRestoreCallback(c,h){if(typeof c!="string")return;let u=kh(i,c);if(u===it)return;let d=ur(i);d&&this._applyControlValue(s,d,u)}get component(){return this._component}get form(){return this._internals?.form??null}get labels(){return this._internals?.labels??null}get validity(){return this._internals?.validity??null}get validationMessage(){return this._internals?.validationMessage??""}get willValidate(){return this._internals?.willValidate??!1}checkValidity(){return this._internals?.checkValidity()??!0}reportValidity(){return this._internals?.reportValidity()??!0}_upgradeProperties(c){for(let h of Object.values(c)){let u=h.property;if(!Object.prototype.hasOwnProperty.call(this,u))continue;let d=this[u];delete this[u],this[u]=d}}_captureDefaults(c){this._defaults=new Map;let h=ur(i);if(h){let u=Object.values(c).find(d=>d.property===h);u&&this._defaults.set(h,cs(this._readProperty(u)))}}_createComponent(c,h,u){let d={};for(let[g,y]of Object.entries(h)){if(!(this._propertyValues.has(y.property)||this.hasAttribute(g)||y.always)||y.option===null)continue;let T=this._currentValue(g,y);T===it||T===void 0||(d[y.option]=Do(y,T,this))}let m=null;u&&(m=document.createDocumentFragment(),m.append(...this._contentNodes),d.content=m);let f=new c(null,d);this._component=f,i===ct&&m&&f.setContent(m),this.append(f.el),this._bridgeEvents(f,i);for(let[g,y]of Object.entries(h)){if(y.option!==null||!y.set||!(this._propertyValues.has(y.property)||this.hasAttribute(g)||y.always))continue;let T=this._currentValue(g,y);T!==it&&T!==void 0&&this._applyValue(g,y,T,!0)}this._syncEffectiveDisabled(h),this._syncFormState(i)}_bridgeEvents(c,h){this._bridgeAbort?.abort(),this._bridgeAbort=new AbortController;for(let u of ih)c.on(u,d=>{if(this._applying)return;this._syncFormState(h);let m=new CustomEvent(`zx-${u}`,{detail:d.detail??{},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(m),m.defaultPrevented&&d.preventDefault()}),c.el.addEventListener(`zx-${u}`,d=>d.stopPropagation(),{signal:this._bridgeAbort.signal})}_destroyComponent(){this._bridgeAbort?.abort(),this._bridgeAbort=null,this._component&&(this._component.destroy(),this._component=null)}_rebuildComponent(c,h=n){this._component&&(h&&this._contentNodes&&document.createDocumentFragment().append(...this._contentNodes),this._destroyComponent(),this._createComponent(i,c,h))}_applyValue(c,h,u,d=!1){if(this._component){if(h.rebuild&&!d){this._rebuildComponent(s);return}if(!h.set){this._syncFormState(i);return}this._applying=!0;try{h.set(this._component,Do(h,u,this),this)}finally{this._applying=!1}c!=="disabled"&&this._syncEffectiveDisabled(s),this._syncFormState(i)}}_syncEffectiveDisabled(c){if(!(!this._component||!c.disabled?.set)){this._applying=!0;try{c.disabled.set(this._component,this.hasAttribute("disabled")||this._disabledByForm,this)}finally{this._applying=!1}}}_syncFormState(c){if(!this._internals||!this._component)return;let{formValue:h,state:u,empty:d}=zh(c,this._component,this);if(this._internals.setFormValue(h,u),(c===I||c===V)&&this.hasAttribute("required")&&d){let m=c===V?"Please enter a date.":"Please select a value.";this._internals.setValidity({valueMissing:!0},m,this._component.refs.input)}else this._internals.setValidity({})}_applyControlValue(c,h,u){let d=Object.entries(c).find(([,m])=>m.property===h);d&&this._applyValue(d[0],d[1],u)}_currentValue(c,h){if(this._propertyValues.has(h.property))return this._propertyValues.get(h.property);let u=se(this.getAttribute(c),h.type);return u===void 0?h.default:u}_readProperty(c){if(this._component&&c.get)return c.get(this._component,this);if(this._propertyValues.has(c.property))return this._propertyValues.get(c.property);let h=se(this.getAttribute(c.attribute),c.type);return h===it||h===void 0?cs(c.default):h}_writeProperty(c,h){this._propertyValues.set(c.property,h);let u=c.serialize?c.serialize(h,this):hr(h,c.type);if(u!==it){this._reflecting.add(c.attribute);try{u===null?this.removeAttribute(c.attribute):this.setAttribute(c.attribute,u)}finally{this._reflecting.delete(c.attribute)}}this._applyValue(c.attribute,c,h)}}for(let l of Object.values(s))Object.prototype.hasOwnProperty.call(o.prototype,l.property)||Object.defineProperty(o.prototype,l.property,{configurable:!0,enumerable:!0,get(){return this._readProperty(l)},set(c){this._writeProperty(l,c)}});return o}function Mo(i="zx"){if(typeof customElements>"u")throw new Error("Custom elements are not available in this environment");let t=String(i).trim();for(let[e,s,r]of mh){let n=`${t}-${e}`;customElements.get(n)||customElements.define(n,_h(s,r))}}function Io(i){let t={};for(let[e,s]of Object.entries(i)){let r=typeof s=="string"?{type:s}:{...s},n=r.property??gh(e);t[e]=Object.freeze({type:r.type??"string",option:Object.prototype.hasOwnProperty.call(r,"option")?r.option:n,property:n,default:r.default,always:!!r.always,rebuild:!!r.rebuild,normalize:r.normalize,serialize:r.serialize,set:r.set,get:r.get,attribute:e})}return Object.freeze(t)}function rt(i){return Io(i)}function S(i={}){return{type:"string",...i}}function ie(i={}){return{type:"number",...i}}function N(i={}){return{type:"boolean",default:!1,always:!0,...i}}function mt(i={}){return{type:"json",...i}}function gh(i){return i.replace(/-([a-z])/g,(t,e)=>e.toUpperCase())}function Do(i,t,e){return i.normalize?i.normalize(t,e):t}function Te(i,t){t?i.disable():i.enable()}function bh(i,t){i.el.setAttribute("aria-disabled",String(t)),i.refs.search&&(i.refs.search.disabled=t);for(let e of i.refs.list?.querySelectorAll("input")??[])e.disabled=t}function yh(i){return i===""||i==="true"?"local":i==="false"?!1:i}function xh(i){return i===""||i==="true"?"single":i==="false"?!1:i}function Oo(i){if(typeof i!="string"||i.trim()==="")return i;let t=Number(i);return Number.isFinite(t)?t:i}function vh(i){return Array.isArray(i)?i.map(t=>!t||typeof t!="object"||wh(t.content)||typeof t.content=="function"?t:{...t,content:document.createTextNode(String(t.content??""))}):i}function wh(i){return!!(i&&typeof i=="object"&&typeof i.nodeType=="number")}function Sh(i){return typeof i!="string"?i:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(i)?j(i,"%Y-%m-%dT%H:%M"):/^\d{4}-\d{2}-\d{2}$/.test(i)?j(i,"%Y-%m-%d"):i}function Ah(i,t){return i instanceof Date?dr(i,!!t.time):hr(i,"string")}function dr(i,t){return!(i instanceof Date)||Number.isNaN(i.getTime())?"":w(i,t?"%Y-%m-%dT%H:%M":"%Y-%m-%d")}function ur(i){return i===P||i===st?"checked":[I,U,V,J].includes(i)?"value":null}function zh(i,t,e){if(i===P||i===st){let r=t.get(),n=i===P?!0:"on";return e._propertyValues.has("value")?n=e._propertyValues.get("value"):e.hasAttribute("value")&&(n=e.getAttribute("value")),{formValue:r?String(n):null,state:String(r),empty:!r}}if(i===I){let r=t.value;return{formValue:r===null?null:String(r),state:JSON.stringify(r),empty:r===null||r===""}}if(i===U){let r=JSON.stringify(t.getValues());return{formValue:r,state:r,empty:r==="[]"}}if(i===V){let r=dr(t.get(),!!e.time);return{formValue:r||null,state:r,empty:r===""}}let s=String(t.get());return{formValue:s,state:s,empty:!1}}function kh(i,t){return i===P||i===st?t==="true":i===I||i===U?se(t,"json"):i===J?se(t,"number"):t}function cs(i){return Array.isArray(i)?i.slice():i instanceof Date?new Date(i.getTime()):i}var Ch=Object.freeze({label:"",icon:null,kind:"default",size:"md",disabled:!1});function K(i={}){let t={...Ch,...i},e=a("button",{class:"zx-btn",type:"button",disabled:!!t.disabled,title:t.title,dataset:{kind:Th(t.kind),size:Nh(t.size)}});return t.icon&&e.append(_(t.icon,{size:16})),t.label!==""&&e.append(a("span",{class:"zx-btn__label"},String(t.label))),!t.label&&t.title&&e.setAttribute("aria-label",t.title),typeof t.onclick=="function"&&(e.onclick=t.onclick),e}function hs(i){let t=a("div",{class:"zx-btn-group",role:"group"});return t.append(...i),t}function Th(i){return["primary","danger","ghost"].includes(String(i))?i:"default"}function Nh(i){return i==="sm"?"sm":"md"}var Eh=Object.freeze(["neutral","accent","success","warning","danger","info"]),Dh=Object.freeze(["soft","solid","outline"]),Mh=Object.freeze({label:"",icon:null,kind:"neutral",variant:"soft",size:"md",dot:!1});function Fo(i={}){let t={...Mh,...i},e=a("span",{class:"zx-badge",title:t.title,dataset:{kind:Ih(t.kind),variant:Oh(t.variant),size:Fh(t.size)}});return t.dot?e.append(a("span",{class:"zx-badge__dot",ariaHidden:"true"})):t.icon&&e.append(_(t.icon,{size:12,class:"zx-badge__icon"})),t.label!==""&&t.label!=null?e.append(a("span",{class:"zx-badge__label"},String(t.label))):t.title&&(e.setAttribute("role","img"),e.setAttribute("aria-label",t.title)),e}function Lo(i){let t=a("span",{class:"zx-badge-group"});return t.append(...i),t}function Ih(i){return Eh.includes(i)?i:"neutral"}function Oh(i){return Dh.includes(i)?i:"soft"}function Fh(i){return i==="sm"?"sm":"md"}var Lh=Object.freeze({md:40,sm:28}),Vh=Object.freeze({icon:"folder-open",title:"",description:"",actions:[],size:"md",align:"center"});function Vo(i={}){let t={...Vh,...i},e=Ph(t.size),s=a("div",{class:"zx-empty-state",dataset:{size:e,align:Bh(t.align)}});t.icon&&s.append(a("div",{class:"zx-empty-state__icon",ariaHidden:"true"},_(t.icon,{size:Lh[e]}))),t.title&&s.append(a("p",{class:"zx-empty-state__title"},String(t.title))),t.description&&s.append(a("p",{class:"zx-empty-state__description"},String(t.description)));let r=Rh(t.actions);return r.length>0&&s.append(a("div",{class:"zx-empty-state__actions"},r)),s}function Rh(i){if(!Array.isArray(i))throw new TypeError("emptyState actions must be an array");return i.map(t=>{if(E(t))return t;if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError("emptyState actions must be Elements or button descriptors");return K(t)})}function Ph(i){return i==="sm"?"sm":"md"}function Bh(i){return i==="start"?"start":"center"}var jh=Object.freeze({size:"md",label:"",showLabel:!1,kind:"accent"}),Hh=Object.freeze({sm:!0,md:!0,lg:!0});function us(i={}){let t={...jh,...i},e=String(t.label??""),s=a("span",{class:"zx-spinner",dataset:{size:Hh[t.size]?t.size:"md",kind:t.kind==="current"?"current":"accent"}},a("span",{class:"zx-spinner__ring",ariaHidden:"true"}));return e?(s.setAttribute("role","status"),s.append(a("span",{class:"zx-spinner__label",dataset:{visible:t.showLabel?"true":null}},e))):s.setAttribute("aria-hidden","true"),s}var ds=class extends p{static cssName="progress-bar";static defaults={value:0,max:100,label:"",helperText:"",status:"active",indeterminate:!1,size:"md",hideLabel:!1,showValue:!0,formatValue:null};render(){this._value=0,this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("div");this.el=t,this._max=Math.max(1,Number(this.options.max)||100),this._status=Ro(this.options.status),this._indeterminate=!!this.options.indeterminate,this._labelId=b("zx-progress-label");let e=a("div",{ref:"head",class:"zx-progress-bar__head"},a("span",{ref:"label",class:"zx-progress-bar__label",id:this._labelId},String(this.options.label??"")),a("span",{ref:"value",class:"zx-progress-bar__value"})),s=a("div",{ref:"track",class:"zx-progress-bar__track",role:"progressbar",ariaValuemin:"0",ariaValuemax:String(this._max),ariaLabelledby:this._labelId},a("div",{ref:"fill",class:"zx-progress-bar__fill"}));return t.replaceChildren(e,s,a("p",{ref:"helper",class:"zx-progress-bar__helper"},String(this.options.helperText??""))),t.dataset.size=this.options.size==="sm"?"sm":"md",t.toggleAttribute("data-hide-label",!!this.options.hideLabel),this.set(this.options.value,{silent:!0}),t}get value(){return this._value}set value(t){this.set(t)}get(){return this._value}set(t,{silent:e=!1}={}){let s=Number(t),r=B(Number.isFinite(s)?s:0,0,this._max),n=r!==this._value,o=n&&r>=this._max;return this._value=r,this._sync(),!e&&n&&this.emit("change",{value:r,percent:this.percent()}),!e&&o&&this.emit("complete",{value:r}),this}percent(){return this._value/this._max*100}setMax(t){return this._max=Math.max(1,Number(t)||1),this.refs.track.setAttribute("aria-valuemax",String(this._max)),this.set(this._value,{silent:!0})}setStatus(t,e){return this._status=Ro(t),e!==void 0&&this.setHelperText(e),this._sync(),this}setLabel(t){return this.refs.label.textContent=String(t??""),this}setHelperText(t){return this.refs.helper.textContent=String(t??""),this}setIndeterminate(t=!0){return this._indeterminate=!!t,this._sync(),this}_sync(){let{track:t,fill:e,value:s}=this.refs;if(this.el.dataset.status=this._status,this.el.toggleAttribute("data-indeterminate",this._indeterminate),this._indeterminate){t.removeAttribute("aria-valuenow"),t.removeAttribute("aria-valuetext"),e.style.removeProperty("--zx-progress-fill"),s.textContent="";return}let r=this._format();t.setAttribute("aria-valuenow",String(this._value)),t.setAttribute("aria-valuetext",r),e.style.setProperty("--zx-progress-fill",`${this.percent()}%`),s.replaceChildren(...this._readout(r))}_format(){let t=this.options.formatValue;return typeof t=="function"?String(t(this._value,this._max)):`${Math.round(this.percent())}%`}_readout(t){if(!this.options.showValue)return[];let e=[];return this._status!=="active"&&e.push(_(this._status==="success"?"success":"error",{size:14})),e.push(a("span",{class:"zx-progress-bar__percent"},t)),e}destroy(){let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}};function Ro(i){return i==="success"||i==="error"?i:"active"}var qh=new Set(["inactive","active","success","error"]),fs=class extends p{static cssName="inline-loading";static defaults={status:"active",description:"",size:"sm",live:!0};render(){this._status="inactive",this._description="",this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("span");return this.el=t,t.replaceChildren(a("span",{ref:"indicator",class:"zx-inline-loading__indicator"}),a("span",{ref:"description",class:"zx-inline-loading__description"})),t.dataset.size=this.options.size==="md"?"md":"sm",this.options.live!==!1&&(t.setAttribute("role","status"),t.setAttribute("aria-live","polite")),this.set(this.options.status,this.options.description,{silent:!0}),t}get(){return this._status}getDescription(){return this._description}set(t,e,{silent:s=!1}={}){let r=qh.has(t)?t:"inactive";e!==void 0&&(this._description=String(e??""));let n=r!==this._status;return this._status=r,this._sync(),n&&!s&&this.emit("statuschange",{status:this._status,description:this._description}),this}setDescription(t){return this._description=String(t??""),this.refs.description.textContent=this._description,this}_sync(){this.el.dataset.status=this._status,this.refs.description.textContent=this._description,this.refs.indicator.replaceChildren(...this._indicator())}_indicator(){let t=this.el.dataset.size==="md"?18:16;return this._status==="active"?[us({size:"sm",kind:"current"})]:this._status==="success"?[_("success",{size:t})]:this._status==="error"?[_("error",{size:t})]:[]}destroy(){let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}};function ps(i={}){let t={width:"100%",height:"1rem",radius:"sm",...i};return a("span",{class:"zx-skeleton",ariaHidden:"true",dataset:{radius:$h.has(t.radius)?t.radius:"sm"},style:{"inline-size":fr(t.width),"block-size":fr(t.height)}})}function Bo(i={}){let t={lines:3,width:"100%",heading:!1,lastLineWidth:"60%",...i},e=B(Math.trunc(Number(t.lines)||0),1,20),s=a("div",{class:"zx-skeleton-text",ariaHidden:"true",style:{"inline-size":fr(t.width)}});for(let r=0;r<e;r+=1){let n=t.heading&&r===0,o=r===e-1&&e>1;s.append(ps({width:o?t.lastLineWidth:"100%",height:n?"1.5rem":"0.75rem"}))}return s}function jo(i={}){let t={rows:5,columns:4,header:!0,...i},e=B(Math.trunc(Number(t.rows)||0),1,50),s=B(Math.trunc(Number(t.columns)||0),1,20),r=a("div",{class:"zx-skeleton-table",ariaHidden:"true",style:{"--zx-skeleton-columns":String(s)}});t.header!==!1&&r.append(Po(s,"header"));for(let n=0;n<e;n+=1)r.append(Po(s,"body"));return r}var $h=new Set(["sm","md","full"]);function Po(i,t){let e=a("div",{class:"zx-skeleton-table__row",dataset:{kind:t}});for(let s=0;s<i;s+=1)e.append(a("span",{class:"zx-skeleton-table__cell"},ps({width:Kh(s,i),height:"0.75rem"})));return e}function Kh(i,t){return i===t-1?"55%":i%2===0?"80%":"65%"}function fr(i){return typeof i=="number"?`${i}px`:String(i??"")}function Ho(i={},...t){return a("div",{class:["zx-stack",i.class??""],dataset:{direction:i.direction==="row"?"row":null,align:Ko.has(i.align)?i.align:null,justify:Yh.has(i.justify)?i.justify:null,wrap:i.wrap?"true":null,inline:i.inline?"true":null},style:Yo("--zx-stack-gap",i.gap)},t)}function qo(i={},...t){let e=Number(i.columns),s={...Yo("--zx-grid-gap",i.gap),"--zx-grid-min":Wh(i.min??"16rem")};return Number.isFinite(e)&&e>=1&&(s["--zx-grid-columns"]=String(Math.trunc(e))),a("div",{class:["zx-grid",i.class??""],dataset:{columns:Number.isFinite(e)&&e>=1?"true":null,align:Ko.has(i.align)?i.align:null},style:s},t)}function $o(i={},...t){return a("div",{class:["zx-aspect",i.class??""],style:{"--zx-aspect-ratio":String(i.ratio??"16 / 9"),"--zx-aspect-fit":Uh.has(i.fit)?i.fit:"cover"}},t)}var Ko=new Set(["start","center","end","stretch","baseline"]),Yh=new Set(["start","center","end","between","around"]),Uh=new Set(["cover","contain","fill"]);function Yo(i,t){if(t==null||t==="")return{};let e=Number(t);return Number.isInteger(e)&&e>=1&&e<=8?{[i]:`var(--zx-space-${e})`}:{[i]:String(t)}}function Wh(i){return typeof i=="number"?`${i}px`:String(i)}function Uo(i,t={}){let e=R(i);if(!e)throw new TypeError("truncate() target could not be resolved");let s=B(Math.trunc(Number(t.lines)||1),1,10),r=t.title!==!1,n=e.classList.contains("zx-truncate"),o=e.getAttribute("title"),l=!1,c=null;e.classList.add("zx-truncate"),s>1&&(e.dataset.lines=String(s),e.style.setProperty("--zx-truncate-lines",String(s)));let h=()=>(l=pr(e),r&&(l?e.setAttribute("title",e.textContent?.trim()??""):o===null?e.removeAttribute("title"):e.setAttribute("title",o)),l);return h(),typeof ResizeObserver=="function"&&(c=new ResizeObserver(h),c.observe(e)),{update:h,isTruncated:()=>l,destroy:()=>{c?.disconnect(),c=null,n||e.classList.remove("zx-truncate"),delete e.dataset.lines,e.style.removeProperty("--zx-truncate-lines"),r&&(o===null?e.removeAttribute("title"):e.setAttribute("title",o))}}}function pr(i){return i.scrollWidth-i.clientWidth>1||i.scrollHeight-i.clientHeight>1}var Gh=Object.freeze({text:"",label:"",title:"Copy",feedback:"Copied",feedbackDuration:2e3,size:"md",kind:"ghost"});function ms(i={}){let t={...Gh,...i},e=!t.label,s=a("button",{class:["zx-copy-button",e?"zx-icon-btn":"zx-btn"],type:"button",dataset:{size:t.size==="sm"?"sm":"md",kind:e?null:t.kind},title:e?String(t.title):null,ariaLabel:e?String(t.title):null}),r=a("span",{class:"zx-copy-button__icon",ariaHidden:"true"},_("copy",{size:t.size==="sm"?12:14})),n=a("span",{class:"zx-copy-button__status",role:"status"});s.append(r),e||s.append(a("span",{class:"zx-copy-button__label"},String(t.label))),s.append(n);let o=0;return s.addEventListener("click",async()=>{let l=typeof t.text=="function"?String(t.text()):String(t.text??""),c=await os(l);t.oncopy?.(l,c),c&&(clearTimeout(o),s.dataset.copied="true",r.replaceChildren(_("check",{size:t.size==="sm"?12:14})),n.textContent=String(t.feedback),o=setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,r.replaceChildren(_("copy",{size:t.size==="sm"?12:14})),n.textContent="")},Math.max(0,Number(t.feedbackDuration)||0)))}),s}var _s=class extends p{static cssName="copy-input";static defaults={value:"",label:"",hideLabel:!1,feedback:"Copied",buttonTitle:"Copy",size:"md"};render(){this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("div");this.el=t;let e=b("zx-copy-input"),s=a("input",{ref:"input",class:"zx-copy-input__field",type:"text",id:e,readOnly:!0,value:String(this.options.value??"")}),r=ms({text:()=>this.get(),title:String(this.options.buttonTitle),feedback:String(this.options.feedback),size:this.options.size==="sm"?"sm":"md",oncopy:(n,o)=>this.emit("copy",{value:n,copied:o})});return t.replaceChildren(a("label",{ref:"label",class:"zx-copy-input__label",for:e},String(this.options.label??"")),a("div",{class:"zx-copy-input__box"},s,r)),t.dataset.size=this.options.size==="sm"?"sm":"md",t.toggleAttribute("data-hide-label",!!this.options.hideLabel),this.listen(s,"focus",()=>s.select()),t}get(){return this.refs.input.value}set(t){return this.refs.input.value=String(t??""),this}focus(){return this.refs.input.focus(),this.refs.input.select(),this}destroy(){let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}};var Go=Symbol("zxDropdownPointerDismiss"),Qo=Symbol("zxDropdownEscapeDismiss"),ht=class extends p{static cssName="dropdown";static defaults={content:null,placement:"bottom-start",offset:4,matchWidth:!1,openOn:"click",closeOnSelect:!1};#t;#e=null;#s=new Map;#i=!1;constructor(t,e={}){let s=R(t);if(!s)throw new TypeError("Dropdown anchor could not be resolved");super(null,e),this.#t=s,this.#r("aria-expanded"),this.#r("aria-controls"),this.#t.setAttribute("aria-expanded","false"),this.#t.setAttribute("aria-controls",this.el.id),this.setContent(this.options.content),this.options.openOn==="click"&&this.listen(this.#t,"click",()=>this.toggle()),this.listen(this.el,"click",()=>{this.options.closeOnSelect&&this.close()})}render(){let t=a("div",{id:b("zx-dropdown"),popover:"manual"});return t.dataset.state="closed",document.body.append(t),t}open(){return this.isOpen()||this.#i?this:(this.#e=q(this.#t,this.el,{placement:this.options.placement,offset:Number(this.options.offset),matchWidth:!!this.options.matchWidth}),this.el.dataset.state="open",this.el.dataset.zxOverlayOrder=String(Zh()),this.#t.setAttribute("aria-expanded","true"),Jh(),this.emit("open"),this)}close(){return this.isOpen()?(this.#e?.destroy(),this.#e=null,this.el.dataset.state="closed",delete this.el.dataset.zxOverlayOrder,this.#t.setAttribute("aria-expanded","false"),this.emit("close"),Xh(),this):this}toggle(){return this.isOpen()?this.close():this.open()}isOpen(){return this.#e!==null}setContent(t){return Qh(this.el,t),this.#e?.update(),this}getPanel(){return this.el}destroy(){if(!this.#i){this.#i=!0,this.close();for(let[t,e]of this.#s)tu(this.#t,t,e);super.destroy()}}[Go](t){if(!this.isOpen())return;let e=t.composedPath();e.includes(this.el)||e.includes(this.#t)||this.close()}[Qo](t){if(t.key!=="Escape"||!this.isOpen())return;t.preventDefault();let e=this.el.contains(document.activeElement);this.close(),e&&this.#t instanceof HTMLElement&&this.#t.focus()}#r(t){this.#s.set(t,this.#t.getAttribute(t))}},Ne=class extends p{constructor(){super(null),this.listen(document,"pointerdown",t=>{let e=Wo();e instanceof ht&&e[Go](t)}),this.listen(document,"keydown",t=>{if(t.key!=="Escape")return;let e=Wo();e instanceof ht&&e[Qo](t)})}render(){let t=a("span",{hidden:!0,"data-zx-dropdown-dismiss-manager":""});return document.body.append(t),t}};function Qh(i,t){if(i.replaceChildren(),t!=null)if(typeof t=="string"||typeof t=="number")i.append(document.createTextNode(String(t)));else if(typeof t.toElement=="function"){let e=t.toElement();e&&i.append(e)}else typeof t.nodeType=="number"&&i.append(t)}function Wo(){let i=null,t=-1;for(let e of document.querySelectorAll("[data-zx-overlay-order]")){let s=Number(e.getAttribute("data-zx-overlay-order"))||0;s>t&&(t=s,i=e)}return i?p.from(i):null}function Zh(){let i=Array.from(document.querySelectorAll("[data-zx-overlay-order]"),t=>Number(t.getAttribute("data-zx-overlay-order"))||0);return Math.max(0,...i)+1}function Jh(){let i=document.querySelector("[data-zx-dropdown-dismiss-manager]"),t=i?p.from(i):null;return t instanceof Ne?t:new Ne}function Xh(){if(document.querySelector('.zx-dropdown[data-state="open"]'))return;let i=document.querySelector("[data-zx-dropdown-dismiss-manager]"),t=i?p.from(i):null;t instanceof Ne&&t.destroy()}function tu(i,t,e){e===null?i.removeAttribute(t):i.setAttribute(t,e)}var gs='[role="menuitem"]',W=class extends p{static cssName="menu-button";static defaults={label:"",icon:null,kind:"default",items:[],placement:"bottom-start"};#t;#e;#s;#i;#r=[];#n=null;#a=!1;#o=!1;constructor(t=null,e={}){let s=t===null?null:R(t);if(t!==null&&(!s||s.tagName!=="BUTTON"))throw new TypeError("MenuButton target must resolve to a button");let r=s?{attributes:Array.from(s.attributes,o=>[o.name,o.value]),children:Array.from(s.childNodes)}:null,n=Object.hasOwn(e,"label");super(t,e),this.#a=s===null,this.#n=r,this.el.classList.add("zx-btn"),this.el.setAttribute("type","button"),this.el.setAttribute("data-kind",String(this.options.kind)),this.el.setAttribute("data-size","md"),this.#t=new ht(this.el,{openOn:"manual",placement:this.options.placement,content:null}),this.#e=this.#t.getPanel(),this.#e.classList.add("zx-menu-button__menu"),this.#e.setAttribute("role","menu"),this.el.setAttribute("aria-haspopup","menu"),s&&n&&this.setLabel(this.options.label),this.setItems(this.options.items),this.#s=At(this.#e,gs),this.#i=Z(()=>this.#u(),o=>o.focus()),this.#t.on("open",()=>this.emit("open")),this.#t.on("close",()=>this.emit("close")),this.listen(this.el,"click",()=>{this.isOpen()?this.close():(this.open(),this.#s.focusFirst())}),this.listen(this.el,"keydown",o=>this.#l(o)),this.listen(this.#e,"click",o=>{let l=o.target.closest?.(gs);l&&this.#e.contains(l)&&this.#c(l)}),this.listen(this.#e,"keydown",o=>this.#h(o))}render(){return this.el?this.el:a("button",{class:"zx-btn",type:"button","data-kind":this.options.kind,"data-size":"md"},Zo(this.options.label,this.options.icon))}setItems(t){return this.#r=Array.isArray(t)?t.slice():[],this.#e.replaceChildren(),this.#r.forEach((e,s)=>{if(e==="-"){this.#e.append(a("div",{class:"zx-menu-button__separator",role:"separator"}));return}let r=[];e.icon&&r.push(a("span",{class:"zx-menu-button__icon"},_(e.icon))),r.push(a("span",{class:"zx-menu-button__label"},e.label)),this.#e.append(a("button",{class:"zx-menu-button__item",type:"button",role:"menuitem",tabindex:"-1","data-menu-item":String(s),"data-danger":e.danger?"true":null,ariaDisabled:e.disabled?"true":null},r))}),this}open(){return this.#t.open(),this}close(){return this.#t.close(),this}isOpen(){return this.#t.isOpen()}setLabel(t){return this.el.replaceChildren(...Zo(t,this.options.icon)),this}destroy(){if(!this.#o&&(this.#o=!0,this.#s.destroy(),this.#t.destroy(),super.destroy(),!this.#a&&this.#n)){for(let t of Array.from(this.el.attributes))this.el.removeAttribute(t.name);for(let[t,e]of this.#n.attributes)this.el.setAttribute(t,e);this.el.replaceChildren(...this.#n.children)}}#l(t){["ArrowDown","ArrowUp","Enter"," "].includes(t.key)&&(t.preventDefault(),this.open(),t.key==="ArrowUp"?this.#s.focusLast():this.#s.focusFirst())}#h(t){if(t.key==="Escape"){t.preventDefault(),this.close(),this.el.focus();return}if(t.key==="Tab"){this.close();return}if(t.key==="Enter"||t.key===" "){let e=t.target.closest?.(gs);if(!e||!this.#e.contains(e))return;t.preventDefault(),this.#c(e);return}this.#i(t)}#c(t){let e=Number(t.getAttribute("data-menu-item")),s=this.#r[e];if(!(!s||s==="-"||s.disabled)){this.emit("select",{value:s.value,item:s});try{s.onselect?.(s.value,s,this)}finally{this.close()}}}#u(){return Array.from(this.#e.querySelectorAll(gs))}};function Zo(i,t){let e=[];return t&&e.push(a("span",{class:"zx-btn__icon"},_(t))),e.push(a("span",{class:"zx-btn__label"},String(i??""))),e}var eu=["button","a[href]","input","select","textarea","[tabindex]"],su=eu.flatMap(i=>[`.zx-toolbar > ${i}`,`.zx-toolbar > [role="group"] > ${i}`]).join(","),bs=class extends p{static cssName="toolbar";static defaults={items:[],align:"start",label:"Toolbar",overflow:!0,overflowLabel:"More",dense:!1};#t;#e=null;#s=null;#i=!1;#r=-1;#n=-1;#a=0;#o=!1;constructor(t=null,e={}){if(super(t,e),this.options.overflow){this.#e=new W(null,{icon:"dots",label:"",kind:"ghost",placement:"bottom-end"});let s=this.#e.toElement();s.classList.add("zx-toolbar__overflow"),s.setAttribute("aria-label",String(this.options.overflowLabel)),s.setAttribute("title",String(this.options.overflowLabel)),this.options.dense&&s.setAttribute("data-size","sm"),s.hidden=!0}this.#t=At(this.el,su,{orientation:"horizontal"}),this.listen(this.el,"click",s=>this.#h(s)),this.setItems(this._initialItems),this.#e&&typeof ResizeObserver=="function"&&(this.#s=new ResizeObserver(()=>this.#u()),this.#s.observe(this.el))}render(){this._records=[],this._named=new Map,this._createdRoot=!this.el;let t=this.el??a("div");this.el=t,this._snapshot=this._createdRoot?null:k(t);let e=this.options.items;return this._initialItems=Array.isArray(e)&&e.length===0?Array.from(t.children):e,t.setAttribute("role","toolbar"),t.setAttribute("aria-label",String(this.options.label)),t.dataset.align=ru(this.options.align),t.dataset.overflow=this.options.overflow?"true":"false",this.options.dense&&(t.dataset.dense="true"),t}setItems(t){for(let s of this._records)s.type==="element"&&(s.element.hidden=s.userHidden);this._records=iu(t).map(s=>this.#l(s)),this._named=new Map;for(let s of this._records)s.name!==null&&!this._named.has(s.name)&&this._named.set(s.name,s);let e=this._records.map(s=>s.element);if(this.#e){this.#e.setItems([]);let s=this.#e.toElement();s.hidden=!0,e.push(s)}return this.el.replaceChildren(...e),this.#r=-1,this.#n=-1,this.#d(),this}getItem(t){return this._named.get(String(t))?.element??null}enable(t){return this.#c(t,!1)}disable(t){return this.#c(t,!0)}setActive(t,e=!0){let s=this._named.get(String(t));return s&&s.element.setAttribute("aria-pressed",e?"true":"false"),this}destroy(){if(!this.#o){this.#o=!0,this.#s?.disconnect(),this.#s=null,this.#a!==0&&cancelAnimationFrame(this.#a),this.#a=0,this.#t.destroy(),this.#e?.destroy(),this.#e=null;for(let t of this._records)t.type==="element"&&(t.element.hidden=t.userHidden);super.destroy(),this._createdRoot||C(this.el,this._snapshot)}}#l(t){if(t.type==="separator")return{type:"separator",element:a("span",{class:"zx-toolbar__separator",role:"separator",ariaOrientation:"vertical",dataset:{separator:"true"}}),name:null,label:"",icon:null,onclick:null,userHidden:!1};if(t.type==="element"){let l=t.element;return{type:"element",element:l,name:l.dataset?.name??null,label:Xo(l),icon:null,onclick:null,userHidden:!!l.hidden}}let{name:e=null,active:s,onclick:r,...n}=t.descriptor,o=K({size:this.options.dense?"sm":"md",...n});return s!==void 0&&o.setAttribute("aria-pressed",s?"true":"false"),e!==null&&(o.dataset.name=String(e)),{type:"descriptor",element:o,name:e===null?null:String(e),label:String(n.label??n.title??""),icon:n.icon??null,onclick:typeof r=="function"?r:null,userHidden:!1}}#h(t){let e=t.target;if(!e)return;let s=this._records.find(r=>r.type==="descriptor"&&r.element.contains(e));s&&(this.emit("action",{name:s.name,item:s.element}),s.onclick?.(t))}#c(t,e){let s=this._named.get(String(t));if(!s)return this;let r=s.element;return"disabled"in r?r.disabled=e:e?r.setAttribute("aria-disabled","true"):r.removeAttribute("aria-disabled"),this.#f(),this}#u(){if(!(this.#a!==0||this.#o)){if(typeof requestAnimationFrame!="function"){this.#d();return}this.#a=requestAnimationFrame(()=>{this.#a=0,this.#d()})}}#d(){if(this.#i||this.#o||!this.#e)return;let t=this.el;if(typeof getComputedStyle!="function"||!t.isConnected)return;let e=getComputedStyle(t),s=parseFloat(e.columnGap)||0,r=(parseFloat(e.paddingInlineStart)||0)+(parseFloat(e.paddingInlineEnd)||0),n=t.clientWidth-r,o=t.clientHeight;if(!(!(n>0)||n===this.#r&&o===this.#n)){this.#i=!0;try{let l=this.#e.toElement(),c=this._records.filter(g=>!g.userHidden);for(let g of c)g.element.hidden=!1;l.hidden=!1;let h=c.map(g=>g.element.getBoundingClientRect().width),u=h.reduce((g,y)=>g+y,0)+s*Math.max(0,h.length-1),d=l.getBoundingClientRect().width,m=[];if(u>n){let g=n-d-s,y=0,z=!1;for(c.forEach((T,Vi)=>{let H=y+h[Vi]+(y>0?s:0);if(!z&&H<=g){y=H;return}z=!0,T.element.hidden=!0,m.push(T)});c.length>m.length;){let T=c[c.length-m.length-1];if(T.type!=="separator")break;T.element.hidden=!0,m.unshift(T)}}let f=Jo(m);this.#e.setItems(f),l.hidden=f.length===0,this.#r=n,this.#n=t.clientHeight}finally{this.#i=!1}}}#f(){if(!this.#e)return;let t=this._records.filter(e=>!e.userHidden&&e.element.hidden);this.#e.setItems(Jo(t))}};function iu(i){if(i!=null&&!Array.isArray(i))throw new TypeError("Toolbar items must be an array");let t=[];for(let e of i??[])if(e!=null){if(e==="-"){t.length>0&&t[t.length-1].type!=="separator"&&t.push({type:"separator"});continue}if(E(e)){t.push({type:"element",element:e});continue}if(typeof e!="object"||Array.isArray(e))throw new TypeError('Toolbar items must be Elements, item descriptors, or "-"');t.push({type:"descriptor",descriptor:{...e}})}for(;t.length>0&&t[t.length-1].type==="separator";)t.pop();return t}function Jo(i){let t=[];for(let e of i){if(e.type==="separator"){t.length>0&&t[t.length-1]!=="-"&&t.push("-");continue}let s=e.element;t.push({label:e.label||Xo(s)||"\u2026",icon:e.icon??void 0,value:e.name,disabled:!!s.disabled||s.getAttribute("aria-disabled")==="true",onselect:()=>s.click()})}for(;t.length>0&&t[t.length-1]==="-";)t.pop();return t}function Xo(i){return(i.getAttribute("aria-label")??i.getAttribute("title")??i.textContent??"").trim()}function ru(i){return["end","between"].includes(i)?i:"start"}var re=class extends p{static cssName="panel";static defaults={title:"",content:null,open:!0,collapsible:!0,buttons:[],footer:null,footerButtons:[]};constructor(t,e={}){super(t,e)}render(){let t=!this.el,e=this.el??a("section");this.el=e,this._createdRoot=t,this._original=t?null:nu(e),this._cleaned=!1,this._open=!!this.options.open,this._collapsible=!!this.options.collapsible,this._hasFooterContent=!1;let s=t?[]:Array.from(e.childNodes),r=b("zx-panel-body"),n=a("span",{class:"zx-panel__title",ref:"title"}),o=[];this._collapsible&&o.push(a("span",{class:"zx-panel__chevron",ariaHidden:"true"},_("chevron-right",{size:16}))),o.push(n);let l=this._collapsible?a("button",{class:"zx-panel__toggle",ref:"toggle",type:"button",ariaControls:r,ariaExpanded:String(this._open)},o):a("div",{class:"zx-panel__toggle",ref:"toggle"},o),c=a("div",{class:"zx-panel__header",ref:"header"},l,a("div",{class:"zx-panel__buttons",ref:"buttons",role:"group",ariaLabel:"Panel actions"})),h=a("div",{class:"zx-panel__content",ref:"content"}),u=a("div",{class:"zx-panel__body",ref:"body",id:r},h),d=a("div",{class:"zx-panel__footer",ref:"footer",hidden:!0},a("div",{class:"zx-panel__footer-content",ref:"footerContent"}),a("div",{class:"zx-panel__footer-buttons",ref:"footerButtons",role:"group",ariaLabel:"Panel footer actions"}));return e.replaceChildren(c,u,d),this.setTitle(this.options.title),this.options.content!==null?this.setContent(this.options.content):h.append(...s),this.setButtons(this.options.buttons),this.setFooter(this.options.footer),this.setFooterButtons(this.options.footerButtons),this._syncOpenState(),this._collapsible&&this.listen(l,"click",()=>this.toggle()),e}setTitle(t){return this.refs.title.textContent=String(t??""),this}setContent(t){return ta(this.refs.content,t,"Panel content"),this}setButtons(t){return this.refs.buttons.replaceChildren(...this._buildButtons(t,"Panel buttons")),this}setFooter(t){return ta(this.refs.footerContent,t,"Panel footer"),this._hasFooterContent=t!==null,this._syncFooter(),this}setFooterButtons(t){return this.refs.footerButtons.replaceChildren(...this._buildButtons(t,"Panel footer buttons")),this._syncFooter(),this}open(){return this._open?this:(this._open=!0,this._syncOpenState(),this.emit("open"),this)}close(){return this._open?(this._open=!1,this._syncOpenState(),this.emit("close"),this):this}toggle(){return this.isOpen()?this.close():this.open()}isOpen(){return this._open}destroy(){this._cleaned||(this._cleaned=!0,super.destroy(),!this._createdRoot&&this._original&&ou(this.el,this._original))}_syncOpenState(){this.el.setAttribute("data-state",this._open?"open":"closed"),this.refs.body.hidden=!this._open,this._collapsible&&this.refs.toggle.setAttribute("aria-expanded",String(this._open))}_syncFooter(){this.refs.footer.hidden=!this._hasFooterContent&&this.refs.footerButtons.childElementCount===0}_buildButtons(t,e){if(!Array.isArray(t))throw new TypeError(`${e} must be an array`);return t.map(s=>{if(E(s))return s;if(!s||typeof s!="object"||Array.isArray(s))throw new TypeError(`${e} must be Elements or button descriptors`);let r={...s},n=r.onclick;delete r.onclick;let o=K(r);return typeof n=="function"&&this.listen(o,"click",n),o})}};function nu(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function ou(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}function ta(i,t,e){if(i.replaceChildren(),t===null)return;if(typeof t=="string"){i.append(document.createTextNode(t));return}let s=t instanceof p?t.toElement():t;if(s&&typeof s.nodeType=="number"){i.append(s);return}throw new TypeError(`${e} must be a string, Node, Component, or null`)}var au=Object.freeze(["default","settings","accounts","billing","calendar","campaigns","clocking","collection","contacts","contracts","enhancements","inventory","links","mailinglists","messages","notes","opportunities","pricelists","procurement","projects","tasks","tickets","pwd","system","usermgmt","usersettings","users","groups"]),ne=class extends p{static cssName="master-panel";static defaults={title:"",content:null,buttons:[],module:null,footer:null};constructor(t,e={}){super(t,e)}render(){let t=!this.el,e=this.el??a("section");this.el=e,this._createdRoot=t,this._original=t?null:lu(e),this._cleaned=!1;let s=t?[]:Array.from(e.childNodes),r=a("header",{class:"zx-master-panel__header"},a("h1",{class:"zx-master-panel__title",ref:"title"}),a("div",{class:"zx-master-panel__buttons",ref:"buttons",role:"group",ariaLabel:"Panel actions"})),n=a("div",{class:"zx-master-panel__content",ref:"content"}),o=a("footer",{class:"zx-master-panel__footer",ref:"footer",hidden:!0});e.replaceChildren(r,n,o);let l=hu(this.options.module);return e.dataset.module=l,e.style.setProperty("--zx-master-panel-accent",`var(--zx-module-${l})`),this.setTitle(this.options.title),this.options.content!==null?this.setContent(this.options.content):n.append(...s),this.setButtons(this.options.buttons),this.setFooter(this.options.footer),e}setTitle(t){return this.refs.title.textContent=String(t??""),this}setContent(t){return ea(this.refs.content,t,"MasterPanel content"),this}setButtons(t){if(!Array.isArray(t))throw new TypeError("MasterPanel buttons must be an array");let e=t.map(s=>{if(E(s))return s;if(!s||typeof s!="object"||Array.isArray(s))throw new TypeError("MasterPanel buttons must be Elements or button descriptors");let r={...s},n=r.onclick;delete r.onclick;let o=K(r);return typeof n=="function"&&this.listen(o,"click",n),o});return this.refs.buttons.replaceChildren(...e),this}setFooter(t){return ea(this.refs.footer,t,"MasterPanel footer"),this.refs.footer.hidden=t===null,this}destroy(){this._cleaned||(this._cleaned=!0,super.destroy(),!this._createdRoot&&this._original&&cu(this.el,this._original))}};function lu(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function cu(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}function ea(i,t,e){if(i.replaceChildren(),t===null)return;if(typeof t=="string"){i.append(document.createTextNode(t));return}let s=t instanceof p?t.toElement():t;if(s&&typeof s.nodeType=="number"){i.append(s);return}throw new TypeError(`${e} must be a string, Node, Component, or null`)}function hu(i){let t=String(i??"default").toLowerCase();return au.includes(t)?t:"default"}var uu=16,du=64,fu="split-view",ws=class extends p{static cssName="split-view";static defaults={orientation:"horizontal",start:null,end:null,size:"38%",min:160,max:null,collapsible:!1,collapsed:!1,snap:0,storageKey:null,disabled:!1,label:"Resize panes"};#t=null;#e=null;constructor(t=null,e={}){super(t,e);let s=this.options.storageKey;if(s!=null&&s!==""){this.#e=ns(fu);let o=this.#e.get(String(s));typeof o=="number"&&Number.isFinite(o)&&o>=0&&this.setSize(o)}let r=this.options.collapsed;r==="start"||r==="end"?this.#n(r,!1):r===!0&&this.options.collapsible&&this.#n(this.options.collapsible==="end"?"end":"start",!1);let n=this.refs.divider;this.listen(n,"pointerdown",o=>this.#a(o)),this.listen(n,"pointermove",o=>this.#o(o)),this.listen(n,"pointerup",o=>this.#c(o)),this.listen(n,"pointercancel",o=>this.#c(o)),this.listen(n,"keydown",o=>this.#d(o)),this.listen(n,"dblclick",()=>this.#f()),typeof ResizeObserver=="function"&&(this.#t=new ResizeObserver(()=>this.#_()),this.#t.observe(this.el)),this.#r()}render(){let t=this.options;this._orientation=t.orientation==="vertical"?"vertical":"horizontal";let e=Nt(t.size,Number.NaN);this._size=Number.isFinite(e)?Math.max(0,e):null,this._collapsed=null,this._disabled=!!t.disabled,this._destroyed=!1,this._dragging=!1,this._frame=0,this._pointerId=null,this._startClient=0,this._startSize=0,this._pointerClient=0,this._moved=!1,this._lastTotal=-1,this._createdRoot=!this.el;let s=this.el??a("div");this.el=s,this._snapshot=this._createdRoot?null:k(s);let r=this._createdRoot||t.start!=null||t.end!=null?[]:Array.from(s.children),n=b("zx-split-start"),o=a("div",{class:"zx-split-view__pane",id:n,ref:"start",dataset:{pane:"start"}}),l=a("div",{class:"zx-split-view__divider",ref:"divider",role:"separator",tabindex:this._disabled?-1:0,ariaOrientation:this._orientation==="vertical"?"horizontal":"vertical",ariaLabel:String(t.label??"Resize panes"),ariaControls:n}),c=a("div",{class:"zx-split-view__pane",ref:"end",dataset:{pane:"end"}});return s.replaceChildren(o,l,c),s.dataset.orientation=this._orientation,this._disabled&&l.setAttribute("aria-disabled","true"),s.style.setProperty("--zx-split-size",ys(t.size)),t.start!=null?xs(o,t.start,"SplitView start"):r[0]&&o.append(r[0]),t.end!=null?xs(c,t.end,"SplitView end"):r[1]&&c.append(...r.slice(1)),s}setSize(t){let{total:e,divider:s,min:r,max:n}=this.#s(),o=Nt(t,e>0?e:Number.NaN);return Number.isFinite(o)?(this.#i(Tt({size:o,min:r,max:n,total:e,divider:s})),this):(this._size=null,this.el.style.setProperty("--zx-split-size",ys(t)),this.#r(),this)}getSize(){if(this._collapsed==="start")return 0;let{total:t,divider:e}=this.#s();if(this._collapsed==="end")return Math.max(0,t-e);if(this._size!==null)return this._size;let s=sa(this.refs.start,this._orientation);if(s>0)return s;let r=Nt(this.options.size,t);return Number.isFinite(r)?Math.max(0,r):0}getRatio(){let{total:t}=this.#s();return t>0?this.getSize()/t:0}setStart(t){return xs(this.refs.start,t,"SplitView start"),this}setEnd(t){return xs(this.refs.end,t,"SplitView end"),this}collapse(t){let e=this.options.collapsible==="end"?"end":"start";return this.#n(t==="end"?"end":t==="start"?"start":e,!0)}expand(){return this._collapsed===null?this:(this._collapsed=null,delete this.el.dataset.collapsed,this.#r(),this.emit("expand"),this)}isCollapsed(){return this._collapsed??!1}enable(){return this._disabled=!1,this.refs.divider.removeAttribute("aria-disabled"),this.refs.divider.setAttribute("tabindex","0"),this}disable(){return this._disabled=!0,this.#c(null),this.refs.divider.setAttribute("aria-disabled","true"),this.refs.divider.setAttribute("tabindex","-1"),this}isDisabled(){return this._disabled}destroy(){this._destroyed||(this._destroyed=!0,this._frame!==0&&(cancelAnimationFrame(this._frame),this._frame=0),this.#u(),this.#t?.disconnect(),this.#t=null,super.destroy(),!this._createdRoot&&this._snapshot&&C(this.el,this._snapshot))}#s(){let t=this.el,e=this._orientation==="vertical"?t.clientHeight:t.clientWidth,s=this.options.max==null?null:Number(this.options.max);return{total:Number.isFinite(e)&&e>0?e:0,divider:sa(this.refs.divider,this._orientation),min:Math.max(0,Number(this.options.min)||0),max:Number.isFinite(s)?s:null}}#i(t){this._size=t,this.el.style.setProperty("--zx-split-size",`${t}px`),this.#r()}#r(){let{total:t,divider:e,min:s,max:r}=this.#s(),n=vs({min:s,max:r,total:t,divider:e}),o=this.refs.divider;o.setAttribute("aria-valuemin",String(Math.round(n.min))),o.setAttribute("aria-valuemax",String(Math.round(n.max))),o.setAttribute("aria-valuenow",String(Math.round(this.getSize())))}#n(t,e){return this._collapsed===t?this:(this._collapsed=t,this.el.dataset.collapsed=t,this.#r(),e&&this.emit("collapse",{pane:t}),this)}#a(t){if(!(this._disabled||this._dragging||t.button!==0)){this._dragging=!0,this._pointerId=t.pointerId,this._startClient=mr(t,this._orientation),this._pointerClient=this._startClient,this._startSize=this.getSize(),this._moved=!1,this.el.dataset.dragging="true";try{this.refs.divider.setPointerCapture(t.pointerId)}catch{}}}#o(t){!this._dragging||t.pointerId!==this._pointerId||(this._pointerClient=mr(t,this._orientation),this._pointerClient!==this._startClient&&(this._moved=!0),this._frame===0&&(this._frame=requestAnimationFrame(()=>{this._frame=0,this.#l(!1)})))}#l(t){if(!this._dragging||this._destroyed)return;let{total:e,divider:s,min:r,max:n}=this.#s();if(e<=0)return;this._collapsed!==null&&this.expand();let o=Tt({size:this._startSize+(this._pointerClient-this._startClient),min:r,max:n,total:e,divider:s});t&&(o=Tt({size:_r(o,this.#h(e,s),Number(this.options.snap)),min:r,max:n,total:e,divider:s})),o!==this._size&&(this.#i(o),this.emit("resize",{size:o,ratio:o/e}))}#h(t,e){let{min:s,max:r}=this.#s(),n=vs({min:s,max:r,total:t,divider:e}),o=[n.min,n.max],l=Nt(this.options.size,t);return Number.isFinite(l)&&o.unshift(l),o}#c(t){if(!this._dragging||t&&t.pointerId!==this._pointerId)return;this._frame!==0&&(cancelAnimationFrame(this._frame),this._frame=0),t&&(this._pointerClient=mr(t,this._orientation));let e=this._moved;e&&this.#l(!0),this._dragging=!1,this._moved=!1,this.#u(),delete this.el.dataset.dragging,e&&(this.#p(),this.#m())}#u(){let t=this._pointerId;if(this._pointerId=null,t!==null)try{this.refs.divider.releasePointerCapture(t)}catch{}}#d(t){if(this._disabled)return;let e=t.key;if(e==="Enter"||e===" "){if(!this.options.collapsible)return;t.preventDefault(),this._collapsed===null?this.collapse(this.options.collapsible):this.expand();return}let s=this._orientation==="horizontal",r=s?"ArrowLeft":"ArrowUp",n=s?"ArrowRight":"ArrowDown";if(e!==r&&e!==n&&e!=="Home"&&e!=="End")return;t.preventDefault(),this._collapsed!==null&&this.expand();let{total:o,divider:l,min:c,max:h}=this.#s();if(o<=0)return;let u=vs({min:c,max:h,total:o,divider:l}),d=t.shiftKey?du:uu,m=u.min;e==="End"?m=u.max:e!=="Home"&&(m=this.getSize()+(e===n?d:-d));let f=Tt({size:m,min:c,max:h,total:o,divider:l});f!==this._size&&(this.#i(f),this.emit("resize",{size:f,ratio:f/o}),this.#p(),this.#m())}#f(){if(this._disabled)return;this._collapsed!==null&&this.expand();let t=Nt(this.options.size,Number.NaN);Number.isFinite(t)?this.setSize(t):(this._size=null,this.el.style.setProperty("--zx-split-size",ys(this.options.size)),this._lastTotal=-1,this.#_());let{total:e}=this.#s(),s=this.getSize();this.emit("resize",{size:s,ratio:e>0?s/e:0}),this.#p(),this.#m()}#_(){if(this._destroyed||this._dragging)return;let{total:t,divider:e,min:s,max:r}=this.#s();if(t<=0||t===this._lastTotal)return;if(this._lastTotal=t,this._size===null){let o=Nt(this.options.size,t);if(Number.isFinite(o)){let l=Tt({size:o,min:s,max:r,total:t,divider:e});this.el.style.setProperty("--zx-split-size",Math.abs(l-o)>.5?`${l}px`:ys(this.options.size))}this.#r();return}let n=Tt({size:this._size,min:s,max:r,total:t,divider:e});if(n===this._size){this.#r();return}this.#i(n),this.emit("resize",{size:n,ratio:n/t})}#p(){let t=this.options.storageKey;!this.#e||t==null||t===""||(this._size===null?this.#e.remove(String(t)):this.#e.set(String(t),Math.round(this._size)))}#m(){let{total:t}=this.#s(),e=this.getSize();this.emit("resizeend",{size:e,ratio:t>0?e/t:0})}};function Tt({size:i,min:t=0,max:e=null,total:s=0,divider:r=0}){let n=Number(i),o=vs({min:t,max:e,total:s,divider:r});return Math.max(0,(Number(s)||0)-Math.max(0,Number(r)||0))>0?Number.isFinite(n)?Math.min(o.max,Math.max(o.min,n)):o.min:Number.isFinite(n)?Math.max(0,n):o.min}function Nt(i,t){if(typeof i=="number")return Number.isFinite(i)?i:Number.NaN;if(typeof i!="string")return Number.NaN;let e=/^([+-]?(?:\d+\.?\d*|\.\d+))(px|%)?$/i.exec(i.trim());if(!e)return Number.NaN;let s=Number(e[1]);if(!Number.isFinite(s))return Number.NaN;if((e[2]??"").toLowerCase()!=="%")return s;let r=Number(t);return Number.isFinite(r)?s/100*r:Number.NaN}function _r(i,t,e){let s=Number(i),r=Number(e);if(!Number.isFinite(s)||!Number.isFinite(r)||r<=0)return s;let n=Array.isArray(t)?t:t==null?[]:[t],o=s,l=Number.POSITIVE_INFINITY;for(let c of n){let h=Number(c);if(!Number.isFinite(h))continue;let u=Math.abs(h-s);u<=r&&u<l&&(l=u,o=h)}return o}function vs({min:i=0,max:t=null,total:e=0,divider:s=0}){let r=Math.max(0,(Number(e)||0)-Math.max(0,Number(s)||0)),n=t==null||!Number.isFinite(Number(t))?r:Math.min(r,Math.max(0,Number(t)));return{min:Math.min(Math.max(0,Number(i)||0),n),max:n}}function sa(i,t){let e=i.getBoundingClientRect(),s=t==="vertical"?e.height:e.width;return Number.isFinite(s)&&s>0?s:0}function mr(i,t){return t==="vertical"?i.clientY:i.clientX}function ys(i){return typeof i=="number"&&Number.isFinite(i)?`${i}px`:String(i)}function xs(i,t,e){if(i.replaceChildren(),t==null)return;if(typeof t=="string"||typeof t=="number"){i.append(document.createTextNode(String(t)));return}let s=t instanceof p?t.toElement():t;if(s&&typeof s.nodeType=="number"){i.append(s);return}throw new TypeError(`${e} must be a string, Node, Component, or null`)}var oe=class extends p{static cssName="navigation-bar";static defaults={title:"",items:[],active:null,actions:[]};constructor(t,e={}){super(t,e),this._overflow=new W(this.refs.moreTrigger,{label:"More",icon:"dots",kind:"ghost",items:[],placement:"bottom-end"}),this._overflow.on("select",s=>{let r=this._find(String(s.detail.value));!r||r.definition.disabled||(this.setActive(r.definition.name),r.definition.onselect?.(r.definition.name,r.definition,this),r.definition.href&&globalThis.location?.assign(r.definition.href))}),this._syncOverflow()}render(){let t=!this.el,e=this.el??a("section");this.el=e,this._createdRoot=t,this._original=t?null:mu(e),this._cleaned=!1,this._items=[],this._activeName=null,this._tabMode=!1,this._overflow=null;let s=a("header",{class:"zx-navigation-bar__bar"},a("div",{class:"zx-navigation-bar__brand",ref:"title"}),a("nav",{class:"zx-navigation-bar__navigation",ariaLabel:"Primary navigation"},a("div",{class:"zx-navigation-bar__items",ref:"items"}),a("div",{class:"zx-navigation-bar__more",ref:"more"},a("button",{class:"zx-navigation-bar__more-trigger",ref:"moreTrigger"}))),a("div",{class:"zx-navigation-bar__actions",ref:"actions",role:"group",ariaLabel:"Application actions"})),r=a("div",{class:"zx-navigation-bar__panels",ref:"panels",hidden:!0});return e.replaceChildren(s,r),this.setTitle(this.options.title),this.setItems(this.options.items),this.setActions(this.options.actions),this.listen(this.refs.items,"keydown",n=>this._onTabKeydown(n)),e}setTitle(t){return this.refs.title.textContent=String(t??""),this}setItems(t){if(!Array.isArray(t))throw new TypeError("NavigationBar items must be an array");let e=this._activeName,s=new Set,r=t.map(h=>{if(!h||typeof h!="object"||Array.isArray(h))throw new TypeError("Navigation item must be an object");if(typeof h.name!="string"||h.name==="")throw new TypeError("Navigation item name must be a non-empty string");if(s.has(h.name))throw new RangeError(`Navigation item already exists: ${h.name}`);if(s.add(h.name),Object.hasOwn(h,"content")&&!pu(h.content))throw new TypeError(`Navigation panel content for ${h.name} is invalid`);let u={name:h.name,title:String(h.title??""),badge:h.badge==null?null:String(h.badge),href:h.href==null?void 0:String(h.href),disabled:!!h.disabled,onselect:typeof h.onselect=="function"?h.onselect:void 0};return Object.hasOwn(h,"content")&&(u.content=h.content),u}),n=r.some(h=>Object.hasOwn(h,"content"));if(n&&r.some(h=>!Object.hasOwn(h,"content")))throw new TypeError("NavigationBar panel items must all define content");this._items=[],this._activeName=null,this._tabMode=n,this.refs.items.replaceChildren(),this.refs.panels.replaceChildren(),this.refs.panels.hidden=!this._tabMode,this._tabMode?(this.refs.items.setAttribute("role","tablist"),this.refs.items.setAttribute("aria-orientation","horizontal")):(this.refs.items.removeAttribute("role"),this.refs.items.removeAttribute("aria-orientation"));for(let h of r)this._appendItem(h);let o=e??this.options.active,l=o===null?null:this._find(o),c=l&&!l.definition.disabled?l:this._enabledItems()[0];return c&&this._applyActive(c),this._syncOverflow(),this}setActive(t){let e=this._find(t);return!e||e.definition.disabled||t===this._activeName?this:(this._applyActive(e),this.emit("change",{name:e.definition.name}),this)}setBadge(t,e){let s=this._require(t);return s.definition.badge=e===null?null:String(e),s.badge.textContent=s.definition.badge??"",s.badge.hidden=s.definition.badge===null,this._syncOverflow(),this}setActions(t){if(!Array.isArray(t))throw new TypeError("NavigationBar actions must be an array");let e=t.map(s=>{if(E(s))return s;if(!s||typeof s!="object"||Array.isArray(s))throw new TypeError("NavigationBar actions must be Elements or button descriptors");let r={...s},n=r.onclick;delete r.onclick;let o=K(r);return typeof n=="function"&&this.listen(o,"click",n),o});return this.refs.actions.replaceChildren(...e),this}destroy(){this._cleaned||(this._cleaned=!0,this._overflow?.destroy(),super.destroy(),!this._createdRoot&&this._original&&_u(this.el,this._original))}_appendItem(t){let e=b("zx-navigation-item"),s=b("zx-navigation-panel"),r=a("span",{class:"zx-navigation-bar__badge",hidden:t.badge===null},t.badge??""),n={class:"zx-navigation-bar__item",id:e,ariaDisabled:t.disabled?"true":null},o;this._tabMode?o=a("button",{...n,type:"button",role:"tab",tabindex:"-1",ariaControls:s,ariaSelected:"false"},a("span",{class:"zx-navigation-bar__label"},t.title),r):t.href?o=a("a",{...n,href:t.href},a("span",{class:"zx-navigation-bar__label"},t.title),r):o=a("button",{...n,type:"button"},a("span",{class:"zx-navigation-bar__label"},t.title),r);let l=null;this._tabMode&&(l=a("div",{class:"zx-navigation-bar__panel",id:s,role:"tabpanel",tabindex:"0",ariaLabelledby:e,hidden:!0}),this.refs.panels.append(l));let c={definition:t,item:o,badge:r,panel:l,built:!1};this._items.push(c),this.refs.items.append(o),this.listen(o,"click",h=>{if(c.definition.disabled){h.preventDefault();return}this.setActive(c.definition.name),c.definition.onselect?.(c.definition.name,c.definition,this)})}_applyActive(t){this._tabMode&&this._ensurePanel(t);for(let e of this._items){let s=e===t;this._tabMode?(e.item.setAttribute("aria-selected",String(s)),e.item.tabIndex=s?0:-1,e.panel&&(e.panel.hidden=!s)):s?e.item.setAttribute("aria-current","page"):e.item.removeAttribute("aria-current")}this._activeName=t.definition.name}_ensurePanel(t){if(!t.panel||t.built)return;let e=t.definition.content,s=typeof e=="function"?e():e,r=s instanceof p?s.toElement():s;if(!r||typeof r.nodeType!="number")throw new TypeError(`Navigation panel factory for ${t.definition.name} must return a Node or Component`);t.panel.append(r),t.built=!0}_onTabKeydown(t){if(!this._tabMode)return;let e=t.target.closest?.('[role="tab"]');if(!e||!this.refs.items.contains(e))return;let s=this._items.find(n=>n.item===e);if(!s)return;let r=this._enabledItems();if(t.key==="ArrowLeft"||t.key==="ArrowRight"){t.preventDefault();let n=t.key==="ArrowRight"?1:-1,o=r.indexOf(s),l=r[(o+n+r.length)%r.length];l&&this._focusTab(l);return}if(t.key==="Home"||t.key==="End"){t.preventDefault();let n=t.key==="Home"?r[0]:r[r.length-1];n&&this._focusTab(n);return}(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.setActive(s.definition.name))}_syncOverflow(){this._overflow&&(this.refs.more.dataset.empty=this._items.length===0?"true":"false",this._overflow.setItems(this._items.map(t=>({label:t.definition.badge===null?t.definition.title:`${t.definition.title} (${t.definition.badge})`,value:t.definition.name,disabled:t.definition.disabled}))))}_focusTab(t){for(let e of this._items)e.item.tabIndex=e===t?0:-1;t.item.focus()}_enabledItems(){return this._items.filter(t=>!t.definition.disabled)}_find(t){return this._items.find(e=>e.definition.name===t)??null}_require(t){let e=this._find(t);if(!e)throw new RangeError(`Unknown navigation item: ${t}`);return e}};function pu(i){return typeof i=="function"||i instanceof p?!0:!!(i&&typeof i=="object"&&typeof i.nodeType=="number")}function mu(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function _u(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}function ra(i){if(!Array.isArray(i))throw new TypeError("Stepper steps must be an array");let t=new Set;return i.map(e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError("Step definition must be an object");if(typeof e.name!="string"||e.name==="")throw new TypeError("Step name must be a non-empty string");if(t.has(e.name))throw new RangeError(`Step already exists: ${e.name}`);return t.add(e.name),{name:e.name,title:String(e.title??""),description:e.description==null?null:String(e.description),optional:!!e.optional,disabled:!!e.disabled}})}function Ss(i,t){return t===null?-1:i.findIndex(e=>e.name===t)}function As(i,t,e){let s=e<0?-1:1,r=t<0?s>0?0:i.length-1:t+s;for(;r>=0&&r<i.length;){if(!i[r].disabled)return r;r+=s}return-1}function na(i,t,e){return t<0||e<=t?[]:i.slice(t,e).map(s=>s.name)}function oa(i,t,e={}){let{activeIndex:s=-1,completed:r,errored:n}=e;return ia(n,i.name)?"error":t===s?"active":ia(r,i.name)?"complete":"upcoming"}function ia(i,t){return i?i instanceof Set?i.has(t):i.includes(t):!1}var gu=new Set(["horizontal","vertical"]),bu=new Set(["completed","all",!1]),zs=class extends p{static cssName="stepper";static defaults={steps:[],active:null,orientation:"horizontal",clickable:"completed",showNumbers:!0,counter:!1};constructor(t,e={}){super(t,e)}render(){if(this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el),this._destroyed=!1,this._steps=[],this._records=[],this._activeIndex=-1,this._completed=new Set,this._errored=new Set,!gu.has(this.options.orientation))throw new RangeError(`Unknown stepper orientation: ${this.options.orientation}`);if(!bu.has(this.options.clickable))throw new RangeError(`Unknown stepper clickable mode: ${this.options.clickable}`);let t=this.el??a("div");this.el=t,t.dataset.orientation=this.options.orientation;let e=a("p",{class:"zx-stepper__counter",ref:"counter",ariaLive:"polite",hidden:!0}),s=a("ol",{class:"zx-stepper__list",ref:"list"});return t.replaceChildren(...this.options.counter?[e,s]:[s]),this.setSteps(this.options.steps),this.listen(s,"click",r=>{let n=r.target.closest?.(".zx-stepper__control");if(!n||!s.contains(n)||n.tagName!=="BUTTON")return;let o=n.dataset.step;typeof o=="string"&&this.goTo(o)}),t}setSteps(t){let e=this.getActive(),s=ra(t),r=new Set(s.map(l=>l.name));this._steps=s,this._completed=new Set([...this._completed].filter(l=>r.has(l))),this._errored=new Set([...this._errored].filter(l=>r.has(l)));let n=e??(this.options.active===null?null:String(this.options.active)),o=n===null?-1:Ss(s,n);return o>=0&&s[o].disabled&&(o=-1),o<0&&(o=As(s,-1,1)),this._activeIndex=o,this._records=s.map(l=>this._createRecord(l)),this.refs.list.replaceChildren(...this._records.map(l=>l.item)),this._sync(),this}goTo(t){let e=Ss(this._steps,t);if(e<0)throw new RangeError(`Unknown step: ${t}`);return this._activate(e)}next(){return this._activate(As(this._steps,this._activeIndex,1))}previous(){return this._activate(As(this._steps,this._activeIndex,-1))}getActive(){return this._activeIndex<0?null:this._steps[this._activeIndex].name}getIndex(){return this._activeIndex}complete(t){return this._require(t),this._completed.add(t),this._sync(),this}uncomplete(t){return this._require(t),this._completed.delete(t),this._sync(),this}setError(t,e=!0){return this._require(t),e?this._errored.add(t):this._errored.delete(t),this._sync(),this}setDisabled(t,e=!0){return this._require(t).disabled=!!e,this._sync(),this}getState(){return{active:this.getActive(),index:this._activeIndex,completed:this._steps.filter(t=>this._completed.has(t.name)).map(t=>t.name),errored:this._steps.filter(t=>this._errored.has(t.name)).map(t=>t.name)}}destroy(){if(this._destroyed)return;this._destroyed=!0;let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}_activate(t){if(t<0||t>=this._steps.length||t===this._activeIndex)return this;let e=this._steps[t];if(e.disabled)return this;let s=this._activeIndex;if(this.emit("change",{name:e.name,previous:s<0?null:this._steps[s].name,index:t}).defaultPrevented)return this;for(let n of na(this._steps,s,t))this._completed.add(n);return this._activeIndex=t,this._sync(),this}_createRecord(t){let e=a("span",{class:"zx-stepper__marker",ariaHidden:"true"}),s=a("span",{class:"zx-stepper__status"}),r=[a("span",{class:"zx-stepper__title"},t.title)];t.description&&r.push(a("span",{class:"zx-stepper__description"},t.description)),t.optional&&r.push(a("span",{class:"zx-stepper__optional"},this._message("stepper.optional","Optional")));let n=[e,a("span",{class:"zx-stepper__text"},r),s],o=this.options.clickable===!1?a("span",{class:"zx-stepper__control"},n):a("button",{class:"zx-stepper__control",type:"button",dataset:{step:t.name}},n);return{step:t,item:a("li",{class:"zx-stepper__step"},o),control:o,marker:e,status:s}}_sync(){this._records.forEach((t,e)=>{let s=this._stateFor(t.step,e);t.item.dataset.state=s,e===this._activeIndex?t.item.setAttribute("aria-current","step"):t.item.removeAttribute("aria-current"),t.item.toggleAttribute("data-disabled",t.step.disabled),t.marker.replaceChildren(...this._markerContent(s,e)),t.status.textContent=this._statusText(s),t.control.tagName==="BUTTON"&&(t.control.disabled=!this._isClickable(t.step))}),this._syncCounter()}_stateFor(t,e){return oa(t,e,{activeIndex:this._activeIndex,completed:this._completed,errored:this._errored})}_markerContent(t,e){return t==="complete"?[_("check",{size:12})]:t==="error"?[_("warning",{size:12})]:this.options.showNumbers?[String(e+1)]:[]}_statusText(t){return t==="complete"?this._message("stepper.completed","Completed"):t==="error"?this._message("stepper.error","Error"):t==="active"?this._message("stepper.current","Current step"):""}_isClickable(t){return t.disabled?!1:this.options.clickable==="all"?!0:this.options.clickable==="completed"?this._completed.has(t.name):!1}_syncCounter(){if(!this.options.counter)return;let t=this.refs.counter;t.hidden=this._activeIndex<0,t.textContent=this._activeIndex<0?"":this._message("stepper.counter","Step %1 of %2",this._activeIndex+1,this._steps.length)}_require(t){let e=Ss(this._steps,t);if(e<0)throw new RangeError(`Unknown step: ${t}`);return this._steps[e]}_message(t,e,...s){let r=this.msg(t,...s);return r===t?F(e,s):r}};var yu=new Set(["chevron","slash"]),ks=class extends p{static cssName="breadcrumb";static defaults={items:[],maxVisible:0,separator:"chevron",rootIcon:null};constructor(t,e={}){super(t,e)}render(){if(this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el),this._destroyed=!1,this._items=[],this._overflow=null,!yu.has(this.options.separator))throw new RangeError(`Unknown breadcrumb separator: ${this.options.separator}`);let t=this.el??a("nav");this.el=t,t.tagName!=="NAV"&&t.setAttribute("role","navigation"),t.setAttribute("aria-label",this._message("breadcrumb.label","Breadcrumb"));let e=a("ol",{class:"zx-breadcrumb__list",ref:"list"});return t.replaceChildren(e),this.setItems(this.options.items),this.listen(e,"click",s=>{let r=s.target.closest?.("[data-crumb]");!r||!e.contains(r)||this._select(r.dataset.crumb)}),t}setItems(t){if(!Array.isArray(t))throw new TypeError("Breadcrumb items must be an array");let e=new Set;return this._items=t.map(s=>{if(!s||typeof s!="object"||Array.isArray(s))throw new TypeError("Breadcrumb item must be an object");if(typeof s.name!="string"||s.name==="")throw new TypeError("Breadcrumb item name must be a non-empty string");if(e.has(s.name))throw new RangeError(`Breadcrumb item already exists: ${s.name}`);return e.add(s.name),{name:s.name,label:String(s.label??""),icon:s.icon?String(s.icon):null,href:s.href==null?null:String(s.href)}}),this._build(),this}getItems(){return this._items.map(t=>({...t}))}push(t){return this.setItems([...this._items,t])}pop(){if(this._items.length===0)return null;let t=this._items[this._items.length-1];return this.setItems(this._items.slice(0,-1)),t}truncateTo(t){let e=this._items.findIndex(s=>s.name===t);if(e<0)throw new RangeError(`Unknown breadcrumb item: ${t}`);return this.setItems(this._items.slice(0,e+1))}destroy(){if(this._destroyed)return;this._destroyed=!0,this._overflow?.destroy(),this._overflow=null;let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}_build(){let{head:t,hidden:e,tail:s}=this._split(),r=this._items[this._items.length-1]??null,n=[];for(let o of t)n.push(this._renderItem(o,o===r));e.length>0&&n.push(this._renderOverflow(e));for(let o of s)n.push(this._renderItem(o,o===r));this.refs.list.replaceChildren(...n.map((o,l)=>a("li",{class:"zx-breadcrumb__item"},l===0?o:[this._renderSeparator(),o]))),e.length===0&&this._overflow?.toElement().remove()}_split(){let t=this._items,e=Math.trunc(Number(this.options.maxVisible)||0);if(e<=0||t.length<=e)return{head:t,hidden:[],tail:[]};let s=Math.max(2,e);if(t.length<=s)return{head:t,hidden:[],tail:[]};let r=s-1;return{head:t.slice(0,1),hidden:t.slice(1,t.length-r),tail:t.slice(t.length-r)}}_renderItem(t,e){let s=[],r=t.icon??(t===this._items[0]?this.options.rootIcon:null);return r&&s.push(a("span",{class:"zx-breadcrumb__icon",ariaHidden:"true"},_(String(r),{size:13}))),s.push(a("span",{class:"zx-breadcrumb__label"},t.label)),e?a("span",{class:"zx-breadcrumb__current",ariaCurrent:"page"},s):t.href!==null?a("a",{class:"zx-breadcrumb__link",href:t.href,dataset:{crumb:t.name}},s):a("button",{class:"zx-breadcrumb__link",type:"button",dataset:{crumb:t.name}},s)}_renderOverflow(t){if(!this._overflow){this._overflow=new W(null,{label:"",icon:"dots",kind:"ghost",placement:"bottom-start"});let e=this._overflow.toElement();e.classList.add("zx-breadcrumb__more"),e.setAttribute("aria-label",this._message("breadcrumb.more","Show hidden levels")),this._overflow.on("select",s=>this._select(String(s.detail.value)))}return this._overflow.setItems(t.map(e=>({label:e.label,value:e.name,icon:e.icon??void 0}))),this._overflow.toElement()}_renderSeparator(){return a("span",{class:"zx-breadcrumb__separator",ariaHidden:"true"},this.options.separator==="slash"?"/":_("chevron-right",{size:11}))}_select(t){let e=this._items.findIndex(s=>s.name===t);e<0||this.emit("select",{name:this._items[e].name,item:{...this._items[e]},index:e})}_message(t,e,...s){let r=this.msg(t,...s);return r===t?F(e,s):r}};var Ts="\u2026",xu=new Set(["pages","loadmore"]);function yr({page:i=1,pages:t=1,siblings:e=1,boundaries:s=1}={}){let r=Bt(t);if(r<=0)return[];let n=br(Bt(i)||1,1,r),o=Math.max(0,Bt(e)),l=Math.max(0,Bt(s)),c=l*2+o*2+3;if(r<=c)return Cs(1,r);let h=Cs(1,Math.min(l,r)),u=Cs(Math.max(r-l+1,l+1),r),d=Math.max(Math.min(n-o,r-l-o*2-1),l+2),m=Math.min(Math.max(n+o,l+o*2+2),u.length>0?u[0]-2:r-1);return[...h,...d>l+2?[Ts]:l+1<r-l?[l+1]:[],...Cs(d,m),...m<r-l-1?[Ts]:r-l>l?[r-l]:[],...u]}var Ns=class extends p{static cssName="pagination";static defaults={page:1,pageSize:25,total:0,pageSizes:[25,50,100],siblings:1,boundaries:1,showPageSize:!0,showSummary:!0,mode:"pages",disabled:!1};constructor(t,e={}){super(t,e)}render(){if(this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el),this._destroyed=!1,this._pageSize=gr(this.options.pageSize,25),this._total=Math.max(0,Bt(this.options.total)),this._page=Math.max(1,Bt(this.options.page)||1),this._disabled=!!this.options.disabled,this._sizeKey="",this._pageSizes=(Array.isArray(this.options.pageSizes)?this.options.pageSizes:[]).map(s=>gr(s,0)).filter(s=>s>0),!xu.has(this.options.mode))throw new RangeError(`Unknown pagination mode: ${this.options.mode}`);this._page=br(this._page,1,this._pageCount());let t=this.el??a("nav");this.el=t,t.tagName!=="NAV"&&t.setAttribute("role","navigation"),t.setAttribute("aria-label",this._message("pagination.label","Pagination")),t.dataset.mode=this.options.mode;let e=[];return this.options.showSummary&&e.push(a("span",{class:"zx-pagination__summary",ref:"summary",ariaLive:"polite"})),e.push(a("span",{class:"zx-pagination__spacer"})),this.options.showPageSize&&e.push(this._renderPageSize()),e.push(this.options.mode==="pages"?this._renderPages():this._renderLoadMore()),t.replaceChildren(...e),this._sync(),this._wire(),t}setPage(t){return this.setState({page:t})}setTotal(t){return this.setState({total:t},{silent:!0})}setPageSize(t){return this.setState({pageSize:t,page:1})}setState(t={},{silent:e=!1}={}){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError("Pagination state must be an object");let s=this._page,r=this._pageSize;if(Object.hasOwn(t,"total")&&(this._total=Math.max(0,Bt(t.total))),Object.hasOwn(t,"pageSize")&&(this._pageSize=gr(t.pageSize,this._pageSize)),Object.hasOwn(t,"page")){let n=Math.trunc(Number(t.page));Number.isFinite(n)&&(this._page=n)}return this._page=br(this._page,1,this._pageCount()),this._sync(),!e&&(this._page!==s||this._pageSize!==r)&&this.emit("change",this.getState()),this}getState(){let t=this._pageCount();return{page:this._page,pageSize:this._pageSize,total:this._total,pages:t,offset:(this._page-1)*this._pageSize}}enable(){return this._disabled=!1,this._sync(),this}disable(){return this._disabled=!0,this._sync(),this}destroy(){if(this._destroyed)return;this._destroyed=!0;let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}_pageCount(){return this._total<=0?1:Math.ceil(this._total/this._pageSize)}_renderPageSize(){let t=this._message("pagination.pageSize","Rows per page");return a("label",{class:"zx-pagination__size"},a("span",{class:"zx-pagination__size-label"},t),a("select",{class:"zx-pagination__select",ref:"select",ariaLabel:t}))}_renderPages(){return a("div",{class:"zx-pagination__controls"},this._navButton("prev","chevron-left",this._message("pagination.previous","Previous page")),a("div",{class:"zx-pagination__pages",ref:"pages"}),this._navButton("next","chevron-right",this._message("pagination.next","Next page")))}_navButton(t,e,s){return a("button",{class:"zx-btn zx-pagination__nav",type:"button",ref:t,ariaLabel:s,dataset:{kind:"default",size:"sm"}},_(e,{size:14}))}_renderLoadMore(){return a("button",{class:"zx-btn zx-pagination__more",type:"button",ref:"more",dataset:{kind:"default",size:"md"}},a("span",{class:"zx-btn__label"},this._message("pagination.loadMore","Load more")))}_wire(){if(this.refs.select&&this.listen(this.refs.select,"change",()=>{this.setPageSize(Number(this.refs.select.value))}),this.options.mode==="pages"){this.listen(this.refs.prev,"click",()=>this.setPage(this._page-1)),this.listen(this.refs.next,"click",()=>this.setPage(this._page+1)),this.listen(this.refs.pages,"click",t=>{let e=t.target.closest?.("[data-page]");!e||!this.refs.pages.contains(e)||this.setPage(Number(e.dataset.page))});return}this.listen(this.refs.more,"click",()=>this.setPage(this._page+1))}_sync(){let t=this._pageCount();if(this.el.dataset.disabled=this._disabled?"true":"false",this.refs.summary&&(this.refs.summary.textContent=this._summary()),this.refs.select&&this._syncPageSize(),this.options.mode==="pages"){this.refs.prev.disabled=this._disabled||this._page<=1,this.refs.next.disabled=this._disabled||this._page>=t,this._syncPages(t);return}this.refs.more.disabled=this._disabled||this._page>=t}_summary(){if(this._total<=0)return this._message("pagination.empty","0 of 0");let t=(this._page-1)*this._pageSize,e=Math.min(t+this._pageSize,this._total);return this.options.mode==="loadmore"?this._message("pagination.loaded","%1 of %2",Ee(e),Ee(this._total)):this._message("pagination.summary","%1\u2013%2 of %3",Ee(t+1),Ee(e),Ee(this._total))}_syncPageSize(){let t=this.refs.select,e=[...new Set([...this._pageSizes,this._pageSize])].sort((r,n)=>r-n),s=e.join(",");s!==this._sizeKey&&(this._sizeKey=s,t.replaceChildren(...e.map(r=>a("option",{value:String(r)},String(r))))),t.value=String(this._pageSize),t.disabled=this._disabled}_syncPages(t){let e=this.refs.pages,s=this.el.ownerDocument?.activeElement??null,r=s&&e.contains(s)?s.dataset.page??null:null,n=yr({page:this._page,pages:t,siblings:this.options.siblings,boundaries:this.options.boundaries});if(e.replaceChildren(...n.map(l=>l===Ts?a("span",{class:"zx-pagination__ellipsis",ariaHidden:"true"},Ts):a("button",{class:"zx-btn zx-pagination__page",type:"button",disabled:this._disabled,ariaCurrent:l===this._page?"page":null,ariaLabel:this._message("pagination.page","Page %1",l),dataset:{kind:"default",size:"sm",page:String(l)}},String(l)))),r===null)return;let o=e.querySelector(`[data-page="${r}"]`);o&&!o.disabled&&o.focus()}_message(t,e,...s){let r=this.msg(t,...s);return r===t?F(e,s):r}};function Bt(i){let t=Math.trunc(Number(i));return Number.isFinite(t)&&t>0?t:0}function gr(i,t){let e=Math.trunc(Number(i));return Number.isFinite(e)&&e>0?e:t}function br(i,t,e){return Math.min(Math.max(i,t),e)}function Cs(i,t){return t<i?[]:Array.from({length:t-i+1},(e,s)=>i+s)}function Ee(i){return i.toLocaleString()}var vr=class{#t;#e=[];#s=[];#i;constructor(t=5,e=()=>{}){if(!Number.isInteger(t)||t<1)throw new RangeError("Queue limit must be positive");if(typeof e!="function")throw new TypeError("Activation callback must be a function");this.#t=t,this.#i=e}enqueue(t){return this.#e.length<this.#t?(this.#e.push(t),this.#i(t),"active"):(this.#s.push(t),"pending")}remove(t){let e=this.#s.indexOf(t);if(e!==-1)return this.#s.splice(e,1),"pending";let s=this.#e.indexOf(t);if(s===-1)return null;if(this.#e.splice(s,1),this.#s.length>0){let r=this.#s.shift();this.#e.push(r),this.#i(r)}return"active"}isActive(t){return this.#e.includes(t)}clear(){let t={active:this.#e.slice(),pending:this.#s.slice()};return this.#e.length=0,this.#s.length=0,t}get activeCount(){return this.#e.length}get pendingCount(){return this.#s.length}},_t=class i extends p{static cssName="message";static defaults={kind:"info",timeout:4e3,closable:!0,maxVisible:5};static#t=null;render(){let t=!this.el,e=this.el??a("div");return this._createdRoot=t,this._original=t?null:Cu(e),this._entries=new Set,this._queue=new vr(Su(this.options.maxVisible),s=>{this._activate(s)}),e.replaceChildren(),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e}show(t,e={}){let s={kind:vu(e.kind??this.options.kind),timeout:wu(e.timeout??this.options.timeout),closable:e.closable??!!this.options.closable},r=this._createEntry(t,s);return this._entries.add(r),this._queue.enqueue(r),{close:()=>this._close(r)}}static info(t,e={}){return this.show(t,{...e,kind:"info"})}static success(t,e={}){return this.show(t,{...e,kind:"success"})}static warning(t,e={}){return this.show(t,{...e,kind:"warning"})}static error(t,e={}){return this.show(t,{...e,kind:"error"})}static show(t,e={}){return this.#e().show(t,e)}static progress(t){return this.#e()._progress(t)}destroy(){if(!this._cleaned){this._cleaned=!0;for(let t of this._entries)xr(t),t.node.remove();this._queue.clear(),this._entries.clear(),super.destroy(),!this._createdRoot&&this._original&&Tu(this.el,this._original)}}_progress(t){let e={pct:0,text:String(t)},s=this._createEntry(e.text,{kind:"info",timeout:0,closable:!1},e);this._entries.add(s),this._queue.enqueue(s);let r=!1;return{update:(n,o)=>{r||s.closed||(e.pct=zu(n),o!==void 0&&(e.text=String(o)),Es(s,e))},done:()=>{r||s.closed||(r=!0,e.pct=100,Es(s,e),s.remaining=600,this._queue.isActive(s)&&this._schedule(s))},fail:n=>{r||s.closed||(r=!0,n!==void 0&&(e.text=String(n)),s.kind="error",s.node.dataset.kind="error",s.node.setAttribute("role","alert"),s.iconHost.replaceChildren(_("error",{size:18})),Es(s,e),s.remaining=4e3,this._queue.isActive(s)&&this._schedule(s))}}}_createEntry(t,e,s=null){let r=a("span",{class:"zx-message__icon",ariaHidden:"true"},_(e.kind,{size:18})),n=a("div",{class:"zx-message__content"});Au(t)?n.append(t):n.append(document.createTextNode(String(t)));let o=a("div",{class:"zx-message__toast",role:e.kind==="error"?"alert":"status",dataset:{kind:e.kind,state:"queued"}},r,n),l={node:o,content:n,iconHost:r,kind:e.kind,timeout:e.timeout,remaining:e.timeout,startedAt:0,timer:null,exitTimer:null,closed:!1,progressBar:null,progressFill:null};if(s){o.dataset.progress="";let c=a("span",{class:"zx-message__progress-fill"}),h=a("div",{class:"zx-message__progress",role:"progressbar",ariaValueMin:"0",ariaValueMax:"100",ariaValueNow:"0",ariaLabel:s.text},c);n.append(h),l.progressBar=h,l.progressFill=c,Es(l,s)}if(e.closable){let c=a("button",{class:"zx-icon-btn zx-message__close",type:"button",ariaLabel:"Close message",title:"Close"},_("x",{size:14}));o.append(c),this.listen(c,"click",()=>this._close(l))}return this.listen(o,"mouseenter",()=>this._pause(l)),this.listen(o,"mouseleave",()=>this._resume(l)),l}_activate(t){t.closed||(t.node.dataset.state="open",this.el.append(t.node),this._schedule(t))}_schedule(t){t.closed||t.remaining<=0||(t.startedAt=Date.now(),t.timer=setTimeout(()=>this._close(t),t.remaining))}_pause(t){t.closed||t.timer===null||(clearTimeout(t.timer),t.timer=null,t.remaining=Math.max(0,t.remaining-(Date.now()-t.startedAt)))}_resume(t){if(!(t.closed||t.timer!==null)){if(t.remaining<=0){this._close(t);return}this._schedule(t)}}_close(t){if(t.closed)return;if(t.closed=!0,xr(t),!this._queue.isActive(t)){this._queue.remove(t),t.node.remove(),this._entries.delete(t);return}if(t.node.dataset.state="closing",!ku()){this._finish(t);return}let e=s=>{s.target===t.node&&this._finish(t)};this.listen(t.node,"animationend",e,{once:!0}),t.exitTimer=setTimeout(()=>this._finish(t),260)}_finish(t){this._entries.has(t)&&(xr(t),t.node.remove(),this._entries.delete(t),this._queue.remove(t))}static#e(){if(this.#t)return this.#t;let t=a("div",{class:"zx-message-region",popover:"manual",role:"status",ariaLive:"polite"});return document.body.append(t),this.#t=new i(t),typeof t.showPopover=="function"&&t.showPopover(),this.#t}};function vu(i){return i==="danger"?"error":["success","warning","error"].includes(String(i))?i:"info"}function wu(i){let t=Number(i);return Number.isFinite(t)?Math.max(0,t):4e3}function Su(i){let t=Number(i);return Number.isInteger(t)&&t>0?t:5}function Au(i){return!!(i&&typeof i=="object"&&typeof i.nodeType=="number")}function zu(i){let t=Number(i);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}function Es(i,t){i.content.firstChild.textContent=t.text,i.progressBar?.setAttribute("aria-valuenow",String(t.pct)),i.progressBar?.setAttribute("aria-label",t.text),i.progressFill&&(i.progressFill.style.inlineSize=`${t.pct}%`)}function xr(i){i.timer!==null&&clearTimeout(i.timer),i.exitTimer!==null&&clearTimeout(i.exitTimer),i.timer=null,i.exitTimer=null}function ku(){return typeof matchMedia!="function"||matchMedia("(prefers-reduced-motion: no-preference)").matches}function Cu(i){return{attributes:Array.from(i.attributes,t=>[t.name,t.value]),children:Array.from(i.childNodes)}}function Tu(i,t){for(let e of Array.from(i.attributes))i.removeAttribute(e.name);for(let[e,s]of t.attributes)i.setAttribute(e,s);i.replaceChildren(...t.children)}var Nu=new Set(["top","bottom","top-start","top-end","bottom-start","bottom-end"]),Eu=new Set(["hover","focus","both","manual"]),ae=class extends p{static cssName="tooltip";static defaults={content:"",placement:"top",offset:6,delay:400,hideDelay:80,maxWidth:260,trigger:"both",disabled:!1};#t;#e;#s=null;#i=null;#r=0;#n=0;#a=!1;#o=!1;#l=!1;constructor(t,e={}){let s=R(t);if(!s)throw new TypeError("Tooltip anchor could not be resolved");super(null,e),this.#t=s,this.#e=this.options.content,this.#o=!!this.options.disabled,this.#i=s.getAttribute("aria-describedby"),this.el.style.setProperty("--zx-tooltip-max-inline-size",Iu(this.options.maxWidth));let r=Eu.has(this.options.trigger)?this.options.trigger:"both";r!=="manual"&&((r==="hover"||r==="both")&&(this.listen(this.#t,"pointerenter",n=>{n.pointerType!=="touch"&&this.#h(Number(this.options.delay))}),this.listen(this.#t,"pointerleave",()=>this.#c(Number(this.options.hideDelay)))),(r==="focus"||r==="both")&&(this.listen(this.#t,"focusin",()=>{this.#a||!Ou(this.#t)||this.#h(0)}),this.listen(this.#t,"focusout",()=>this.#c(Number(this.options.hideDelay)))),this.listen(document,"keydown",n=>{n.key!=="Escape"||!this.isOpen()||(n.preventDefault(),this.hide())}),this.listen(document,"pointerdown",()=>{this.#a=!0,this.#u(),this.hide()},{capture:!0}),this.listen(document,"pointerup",()=>{this.#a=!1},{capture:!0}),this.listen(document,"pointercancel",()=>{this.#a=!1},{capture:!0}),this.listen(document,"focusin",n=>{!this.isOpen()||n.composedPath().includes(this.#t)||this.hide()}))}render(){let t=a("div",{id:b("zx-tooltip"),role:"tooltip",popover:"manual"});return t.dataset.state="closed",document.body.append(t),t}show(){if(this.#l||this.#o||this.isOpen())return this;this.#u();let t=aa(this.#e);return t===null?this:(this.el.replaceChildren(t),this.#s=q(this.#t,this.el,{placement:Nu.has(this.options.placement)?this.options.placement:"top",offset:Number(this.options.offset),flip:!0}),this.el.dataset.state="open",this.#t.setAttribute("aria-describedby",Mu(this.#i,this.el.id)),this.emit("open"),this)}hide(){return this.#u(),this.isOpen()?(this.#s?.destroy(),this.#s=null,this.el.dataset.state="closed",this.el.replaceChildren(),this.#d(),this.emit("close"),this):this}toggle(){return this.isOpen()?this.hide():this.show()}isOpen(){return this.#s!==null}setContent(t){if(this.#e=t,!this.isOpen())return this;let e=aa(t);return e===null?this.hide():(this.el.replaceChildren(e),this.#s?.update(),this)}enable(){return this.#o=!1,this}disable(){return this.#o=!0,this.hide()}isDisabled(){return this.#o}getAnchor(){return this.#t}destroy(){this.#l||(this.#l=!0,this.hide(),this.#d(),super.destroy())}#h(t){if(this.#u(),this.#l||this.#o||this.isOpen())return;let e=Number.isFinite(t)?Math.max(0,t):0;if(e===0){this.show();return}this.#r=setTimeout(()=>{this.#r=0,this.show()},e)}#c(t){if(this.#u(),!this.isOpen())return;let e=Number.isFinite(t)?Math.max(0,t):0;if(e===0){this.hide();return}this.#n=setTimeout(()=>{this.#n=0,this.hide()},e)}#u(){this.#r!==0&&clearTimeout(this.#r),this.#n!==0&&clearTimeout(this.#n),this.#r=0,this.#n=0}#d(){this.#i===null?this.#t.removeAttribute("aria-describedby"):this.#t.setAttribute("aria-describedby",this.#i)}};function la(i,t=""){return new ae(i,Du(t)?t:{content:t})}function ca(i,t){return new ae(i,{content:String(t??"")})}function Du(i){return i===null||typeof i!="object"||Array.isArray(i)||typeof i.nodeType=="number"?!1:typeof i.toElement!="function"}function aa(i){let t=typeof i=="function"?i():i;if(t==null)return null;if(typeof t=="object"&&typeof t.nodeType=="number")return t;if(typeof t=="object"&&typeof t.toElement=="function")return t.toElement();let e=String(t);return e===""?null:document.createTextNode(e)}function Mu(i,t){let e=String(i??"").split(/\s+/).filter(Boolean);return e.includes(t)||e.push(t),e.join(" ")}function Iu(i){return typeof i=="number"&&Number.isFinite(i)?`${i}px`:String(i)}function Ou(i){try{return i.matches(":focus-visible")}catch{return!0}}var Ds='[role="menuitem"]',Ms=class extends p{static defaults={items:[],selector:null};#t;#e;#s;#i;#r;#n=[];#a=null;#o=null;#l=!1;constructor(t,e={}){let s=R(t);if(!s)throw new TypeError("ContextMenu target could not be resolved");super(null,e),this.#t=s,document.body.append(this.el),this.#e=new ht(this.el,{openOn:"manual",placement:"bottom-start"}),this.#s=this.#e.getPanel(),this.#s.classList.add("zx-context-menu"),this.#s.setAttribute("role","menu"),Array.isArray(this.options.items)&&this.setItems(this.options.items),this.#i=At(this.#s,Ds),this.#r=Z(()=>this.#m(),r=>r.focus()),this.#e.on("close",()=>{this.#a=null;let r=this.#o;this.#o=null,r instanceof HTMLElement&&r.isConnected&&r.focus(),this.emit("close")}),this.listen(this.#t,"contextmenu",r=>this.#u(r)),this.listen(this.#t,"keydown",r=>this.#d(r)),this.listen(this.#s,"click",r=>{let n=r.target.closest?.(Ds);n&&this.#s.contains(n)&&this.#p(n)}),this.listen(this.#s,"keydown",r=>this.#_(r))}render(){return a("span",{class:"zx-context-menu__anchor",ariaHidden:"true"})}setItems(t){return this.#n=Array.isArray(t)?t.slice():[],this.#s.replaceChildren(),this.#n.forEach((e,s)=>{if(e==="-"){this.#s.append(a("div",{class:"zx-context-menu__separator",role:"separator"}));return}let r=[];e.icon&&r.push(a("span",{class:"zx-context-menu__icon"},_(e.icon))),r.push(a("span",{class:"zx-context-menu__label"},String(e.label??""))),this.#s.append(a("button",{class:"zx-context-menu__item",type:"button",role:"menuitem",tabindex:"-1","data-menu-item":String(s),"data-danger":e.danger?"true":null,ariaDisabled:e.disabled?"true":null},r))}),this}openAt(t,e,s=null){return this.#h(s)?(this.#c(t,e,s),this):this}openAtElement(t){let e=t.getBoundingClientRect();return this.openAt(e.left,e.bottom,t)}close(){return this.#e.close(),this}isOpen(){return this.#e.isOpen()}getContext(){return this.#a}destroy(){this.#l||(this.#l=!0,this.#i.destroy(),this.#e.destroy(),super.destroy())}#h(t){let e=this.options.items;if(typeof e=="function"){let s=e(t);if(!Array.isArray(s)||s.length===0)return!1;this.setItems(s)}return this.#n.length>0}#c(t,e,s){let r=this.el;r.style.left=`${t}px`,r.style.top=`${e}px`,this.#a=s,this.#o=document.activeElement,this.#e.open(),this.#i.focusFirst(),this.emit("open",{context:s})}#u(t){let e=t,s=this.#f(e.target);!s||!this.#h(s)||(t.preventDefault(),this.#c(e.clientX,e.clientY,s))}#d(t){let e=t;if(e.key!=="ContextMenu"&&!(e.key==="F10"&&e.shiftKey))return;let s=this.#f(e.target);if(!s||!this.#h(s))return;t.preventDefault();let r=s.getBoundingClientRect();this.#c(r.left,r.bottom,s)}#f(t){if(!this.options.selector)return this.#t;let e=t?.closest?.(String(this.options.selector));return e&&this.#t.contains(e)?e:null}#_(t){let e=t;if(e.key==="Escape"||e.key==="Tab"){t.preventDefault(),this.close();return}if(e.key==="Enter"||e.key===" "){let s=e.target.closest?.(Ds);if(!s||!this.#s.contains(s))return;t.preventDefault(),this.#p(s);return}this.#r(e)}#p(t){let e=Number(t.getAttribute("data-menu-item")),s=this.#n[e];if(!s||s==="-"||s.disabled)return;let r=this.#a;this.emit("select",{value:s.value,item:s,context:r});try{s.onselect?.(s.value,s,this)}finally{this.close()}}#m(){return Array.from(this.#s.querySelectorAll(Ds))}};var le=class extends p{static cssName="permission";static defaults={value:!0,groups:[],groupsValueKey:"ID",groupsLabelKey:"name"};render(){this._mode="public",this._groupValue=null,this._groupSelect=null,this._createdRoot=!1,this._originalChildren=[],this._root=null,this._originalState=null,this._createdRoot=this.el===null;let t=this.el??a("div");this.el=t,this._root=t,this._createdRoot||(this._originalChildren=Array.from(t.childNodes),this._originalState=t.getAttribute("data-state"));let e=b("zx-permission"),s=a("div",{class:"zx-permission__choices",role:"radiogroup",ariaLabel:this._message("permission.label","Permission")}),r=this._choice(e,"private",this._message("permission.private","Private")),n=this._choice(e,"public",this._message("permission.public","Public")),o=this._choice(e,"group",this._message("permission.group","Group")),l=a("div",{ref:"groupHost",class:"zx-permission__groups"});s.append(r.label,n.label,o.label,l),t.replaceChildren(s),this.refs.private=r.input,this.refs.public=n.input,this.refs.group=o.input,this._groupSelect=new I(l,{items:Array.isArray(this.options.groups)?this.options.groups:[],valueKey:this.options.groupsValueKey,labelKey:this.options.groupsLabelKey,placeholder:this._message("permission.group","Group")}),this._groupSelect.refs.input.setAttribute("aria-label",this._message("permission.group","Group"));for(let c of[r.input,n.input,o.input])this.listen(c,"change",()=>{c.checked&&(c.value==="group"?this._selectGroupMode():this.set(c.value))});return this.listen(l,"zx-change",c=>{if(c.stopPropagation(),this._mode!=="group")return;let h=this.get();this._groupValue=c.detail.value;let u=this.get();Object.is(h,u)||this.emit("change",{value:u})}),this.set(this.options.value,{silent:!0}),t}get(){return this._mode==="private"?"private":this._mode==="public"?"public":this._groupValue}set(t,{silent:e=!1}={}){let s=this.get();t===!0||t==="public"?this._mode="public":t===!1||t==="private"?this._mode="private":(this._mode="group",this._groupValue=t,this._groupSelect?.set(t,{silent:!0})),this._sync();let r=this.get();return!e&&!Object.is(s,r)&&this.emit("change",{value:r}),this}destroy(){this._groupSelect?.destroy(),this._groupSelect=null,!this._createdRoot&&this.el&&(this.el.replaceChildren(...this._originalChildren),this._originalState===null?this.el.removeAttribute("data-state"):this.el.setAttribute("data-state",this._originalState)),super.destroy()}_selectGroupMode(){let t=this.get();if(this._mode="group",this._groupValue==null){let s=Array.isArray(this.options.groups)?this.options.groups[0]:null;this._groupValue=s==null?null:Fu(s,this.options.groupsValueKey)}this._groupSelect?.set(this._groupValue,{silent:!0}),this._sync();let e=this.get();Object.is(t,e)||this.emit("change",{value:e})}_sync(){this.refs.private.checked=this._mode==="private",this.refs.public.checked=this._mode==="public",this.refs.group.checked=this._mode==="group",this._mode==="group"?this._groupSelect?.enable():this._groupSelect?.disable(),this._root?.setAttribute("data-state",this._mode)}_choice(t,e,s){let r=a("input",{type:"radio",name:t,value:e});return{label:a("label",{class:"zx-permission__choice"},r,a("span",{},s)),input:r}}_message(t,e){let s=this.msg(t);return s===t?e:s}};function Fu(i,t){return typeof t=="function"?t(i):i===null||typeof i!="object"?i:i[t]}function Is({valueKey:i="ID",labelKey:t="name",childrenKey:e="children"}={}){return{value:s=>typeof i=="function"?i(s):s?.[i],label:s=>String((typeof t=="function"?t(s):s?.[t])??""),children:s=>{let r=s?.[e];return Array.isArray(r)?r:null}}}function O(i,t){if(i?.hasChildren===!0)return!0;let e=t.children(i);return Array.isArray(e)&&e.length>0}function ce(i,t,e,{level:s=1,parent:r=null}={}){i.forEach((n,o)=>{e(n,{level:s,parent:r,index:o,siblings:i});let l=t.children(n);l&&ce(l,t,e,{level:s+1,parent:n})})}function ha(i,t,e){let s=null;return ce(i,e,r=>{s===null&&Object.is(e.value(r),t)&&(s=r)}),s}function De(i,t,e){for(let s of i){if(Object.is(e.value(s),t))return[s];let r=e.children(s);if(!r)continue;let n=De(r,t,e);if(n.length>0)return[s,...n]}return[]}function ua(i,t){let e=[],s=t.children(i);return s&&ce(s,t,r=>e.push(r)),e}function da(i,t,e){let s=[],r=(n,o,l)=>{n.forEach((c,h)=>{let u=t.value(c);if(s.push({node:c,id:u,level:o,parent:l,posinset:h+1,setsize:n.length}),!e.has(u))return;let d=t.children(c);d&&d.length>0&&r(d,o+1,c)})};return r(i,1,null),s}function wr(i,t,e,s){let r=[];for(let n of i){let o=t.children(n)??[],l=wr(o,t,e,s);(e(n)||l.length>0)&&r.push(l.length>0||o.length>0?{...n,[s]:l}:n)}return r}var Os=class extends p{static cssName="tree";static defaults={items:[],valueKey:"ID",labelKey:"name",childrenKey:"children",expanded:[],selection:"single",selected:[],checkboxes:!1,checked:[],icons:!0,renderLabel:null,load:null,filter:"",label:"Tree",emptyText:"Nothing to show",height:null};render(){this._items=[],this._rows=[],this._expanded=new Set,this._selected=new Set,this._checked=new Set,this._loading=new Map,this._focusId=null,this._filter="",this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("div");this.el=t,this._readers=Is(this.options),this._childrenKey=this.options.childrenKey??"children",t.setAttribute("role","tree"),t.setAttribute("aria-label",String(this.options.label??"Tree")),t.tabIndex=0,this.options.selection==="multi"&&t.setAttribute("aria-multiselectable","true"),this.options.height!==null&&(t.style.blockSize=typeof this.options.height=="number"?`${this.options.height}px`:String(this.options.height),t.style.overflowY="auto"),this._items=Sr(this.options.items);for(let s of Me(this.options.expanded))this._expanded.add(s);for(let s of Me(this.options.selected))this._selected.add(s);let[e]=this._selected;if(e!==void 0){this._focusId=e;for(let s of this.getPath(e).slice(0,-1))this._expanded.add(this._readers.value(s))}for(let s of Me(this.options.checked))this._applyCheck(s,!0,{silent:!0});return this._handleTypeahead=Z(()=>this._rotatedRows().map(s=>this._readers.label(s.node)),(s,r)=>this._focusNodeId(this._rotatedRows()[r]?.id)),this.listen(t,"keydown",s=>this._onKeydown(s)),this.listen(t,"click",s=>this._onClick(s)),this.listen(t,"dblclick",s=>this._onDoubleClick(s)),this.listen(t,"focus",()=>{this._rows.length>0&&!this._rowElement(this._focusId)&&this._focusRow(0)}),String(this.options.filter??"")!==""?this.setFilter(this.options.filter):this._renderRows(),t}setItems(t){return this._items=Sr(t),this._renderRows(),this}getItems(){return this._items}getNode(t){return ha(this._items,t,this._readers)}getPath(t){return De(this._items,t,this._readers)}setFilter(t){if(this._filter=String(t??""),this._filter!=="")for(let e of this._visibleItems())ce([e],this._readers,s=>this._expanded.add(this._readers.value(s)));return this._renderRows(),this}async expand(t){let e=this.getNode(t);if(!e||!O(e,this._readers))return this;let s=this._readers.children(e),r=!!this.options.load&&(!s||s.length===0);return this._expanded.has(t)&&!r?this:await this._ensureChildren(e,t)?(this._expanded.add(t),this._renderRows(),this.emit("expand",{node:e,id:t}),this):this}collapse(t){if(!this._expanded.delete(t))return this;let e=this.getNode(t);return this._renderRows(),e&&this.emit("collapse",{node:e,id:t}),this}async toggle(t){return this._expanded.has(t)?this.collapse(t):this.expand(t)}expandAll(){return ce(this._items,this._readers,t=>{O(t,this._readers)&&this._expanded.add(this._readers.value(t))}),this._renderRows(),this}collapseAll(){return this._expanded.clear(),this._renderRows(),this}reveal(t){let e=this.getPath(t);for(let s of e.slice(0,-1))this._expanded.add(this._readers.value(s));return this._renderRows(),this}select(t,{silent:e=!1,additive:s=!1}={}){if(this.options.selection===!1)return this;let r=this.getNode(t);return r?(this.options.selection==="multi"&&s?this._selected.has(t)?this._selected.delete(t):this._selected.add(t):(this._selected.clear(),this._selected.add(t)),this._syncRows(),e||this.emit("select",{node:r,id:t,ids:this.getSelection()}),this):this}getSelection(){return[...this._selected]}setSelection(t,{silent:e=!0}={}){let s=Me(t);if(this._selected=new Set(this.options.selection==="multi"?s:s.slice(0,1)),this._syncRows(),!e){let[r]=this._selected;this.emit("select",{node:this.getNode(r)??null,id:r,ids:this.getSelection()})}return this}clearSelection(){return this._selected.clear(),this._syncRows(),this}getChecked({leavesOnly:t=!1}={}){return t?[...this._checked].filter(e=>{let s=this.getNode(e);return s!==null&&!O(s,this._readers)}):[...this._checked]}setChecked(t,{silent:e=!0}={}){this._checked.clear();for(let s of Me(t))this._applyCheck(s,!0,{silent:!0});return this._syncRows(),e||this.emit("check",{ids:this.getChecked(),node:null}),this}check(t,e,{silent:s=!1}={}){let r=this._applyCheck(t,e,{silent:!0});return this._syncRows(),!s&&r&&this.emit("check",{ids:this.getChecked(),node:r}),this}focusNode(t){this.reveal(t);let e=this._rows.findIndex(s=>Object.is(s.id,t));return e>=0&&this._focusRow(e),this}_visibleItems(){if(this._filter==="")return this._items;let t=this._filter.trim().toLocaleLowerCase();return t===""?this._items:wr(this._items,this._readers,e=>this._readers.label(e).toLocaleLowerCase().includes(t),this._childrenKey)}_renderRows(){let t=this._visibleItems();if(this._rows=da(t,this._readers,this._expanded),this._rows.length===0){this.el.replaceChildren(a("div",{class:"zx-tree__empty"},this._message("tree.empty",this.options.emptyText)));return}this.el.replaceChildren(...this._rows.map(e=>this._renderRow(e))),this._syncRows()}_renderRow(t){let e=O(t.node,this._readers),s=e&&this._expanded.has(t.id),r=a("div",{class:"zx-tree__row",role:"treeitem",id:b("zx-tree-item"),tabIndex:-1,ariaLevel:String(t.level),ariaSetSize:String(t.setsize),ariaPosInSet:String(t.posinset),dataset:{level:String(t.level)}});r.style.setProperty("--zx-tree-level",String(t.level-1));let n=a("span",{class:"zx-tree__twisty",ariaHidden:"true"},e?_("chevron-right",{size:12}):null);if(n.dataset.action="twisty",r.append(n),this.options.checkboxes){let l=a("input",{class:"zx-tree__checkbox",type:"checkbox",tabIndex:-1,ariaHidden:"true"});l.dataset.action="checkbox",r.append(l)}this.options.icons&&r.append(a("span",{class:"zx-tree__icon",ariaHidden:"true"},_(e?s?"folder-open":"folder":"file",{size:14})));let o=this.options.renderLabel?this.options.renderLabel(t.node):this._readers.label(t.node);return r.append(a("span",{class:"zx-tree__label"},o)),t.node.badge!=null&&r.append(a("span",{class:"zx-tree__badge"},String(t.node.badge))),r}_syncRows(){let t=this.el.querySelectorAll(".zx-tree__row"),e=this._rows.findIndex(s=>Object.is(s.id,this._focusId));e<0&&(e=0),t.forEach((s,r)=>{let n=this._rows[r];if(!n)return;let o=O(n.node,this._readers),l=o&&this._expanded.has(n.id);o?s.setAttribute("aria-expanded",String(l)):s.removeAttribute("aria-expanded"),this.options.selection!==!1&&s.setAttribute("aria-selected",String(this._selected.has(n.id))),s.toggleAttribute("data-branch",o),s.toggleAttribute("data-loading",this._loading.has(n.id)),s.tabIndex=r===e?0:-1;let c=s.querySelector(".zx-tree__checkbox");if(c){let u=this._checkState(this.getNode(n.id)??n.node);c.checked=u==="checked",c.indeterminate=u==="partial",s.setAttribute("aria-checked",u==="partial"?"mixed":String(c.checked))}let h=s.querySelector(".zx-tree__icon");h&&this.options.icons&&h.replaceChildren(_(o?l?"folder-open":"folder":"file",{size:14}))}),this._focusId=this._rows[e]?.id??null,this.el.tabIndex=this._rows.length===0?0:-1}_onClick(t){let e=t.target.closest(".zx-tree__row");if(!e)return;let s=this._rowIndex(e);if(s<0)return;let r=this._rows[s];this._focusRow(s);let n=t.target.closest("[data-action]");if(n?.dataset.action==="twisty"){O(r.node,this._readers)&&this.toggle(r.id).then(()=>this._focusNodeId(r.id));return}let o=this.getNode(r.id)??r.node;if(n?.dataset.action==="checkbox"){this.check(r.id,this._checkState(o)!=="checked");return}if(this.options.checkboxes&&this.options.selection===!1){this.check(r.id,this._checkState(o)!=="checked");return}this.select(r.id,{additive:t.ctrlKey||t.metaKey})}_onDoubleClick(t){let e=t.target.closest(".zx-tree__row");if(!e)return;let s=this._rows[this._rowIndex(e)];s&&(O(s.node,this._readers)?this.toggle(s.id).then(()=>this._focusNodeId(s.id)):this.emit("activate",{node:s.node,id:s.id}))}_onKeydown(t){let e=this._rows.findIndex(o=>Object.is(o.id,this._focusId));if(e<0||this._rows.length===0)return;let s=this._rows[e],r=O(s.node,this._readers),n=r&&this._expanded.has(s.id);switch(t.key){case"ArrowDown":t.preventDefault(),this._focusRow(Math.min(this._rows.length-1,e+1));return;case"ArrowUp":t.preventDefault(),this._focusRow(Math.max(0,e-1));return;case"ArrowRight":t.preventDefault(),r&&!n?this.expand(s.id).then(()=>this._focusNodeId(s.id)):n&&this._focusRow(Math.min(this._rows.length-1,e+1));return;case"ArrowLeft":{t.preventDefault(),n?(this.collapse(s.id),this._focusNodeId(s.id)):s.parent&&this._focusNodeId(this._readers.value(s.parent));return}case"Home":t.preventDefault(),this._focusRow(0);return;case"End":t.preventDefault(),this._focusRow(this._rows.length-1);return;case"Enter":t.preventDefault(),this.options.selection!==!1&&this.select(s.id),this.emit("activate",{node:s.node,id:s.id});return;case" ":t.preventDefault(),this.options.checkboxes?this.check(s.id,this._checkState(this.getNode(s.id)??s.node)!=="checked"):this.options.selection!==!1&&this.select(s.id,{additive:this.options.selection==="multi"});return;case"*":t.preventDefault(),this._expandSiblings(s);return;default:this._handleTypeahead(t)}}_expandSiblings(t){let e=t.parent?this._readers.children(t.parent)??[]:this._visibleItems(),s=this._focusId;for(let r of e)O(r,this._readers)&&this._expanded.add(this._readers.value(r));this._renderRows(),this._focusNodeId(s)}async _ensureChildren(t,e){let s=this._readers.children(t);if(!this.options.load||s&&s.length>0)return!0;if(this._loading.has(e))return await this._loading.get(e),Array.isArray(this._readers.children(t));let r=(async()=>{try{let o=await this.options.load(t);return t[this._childrenKey]=Array.isArray(o)?o:[],t[this._childrenKey].length===0&&(t.hasChildren=!1),!0}catch(o){return this.emit("error",{error:o,node:t,id:e}),!1}finally{this._loading.delete(e)}})();this._loading.set(e,r),this._syncRows();let n=await r;return this._syncRows(),n}_applyCheck(t,e,{silent:s}){let r=this.getNode(t);if(!r)return null;let n=[t,...ua(r,this._readers).map(o=>this._readers.value(o))];for(let o of n)e?this._checked.add(o):this._checked.delete(o);return s||this._syncRows(),r}_checkState(t){let e=this._readers.children(t);if(!e||e.length===0)return this._checked.has(this._readers.value(t))?"checked":"unchecked";let s=e.map(r=>this._checkState(r));return s.every(r=>r==="checked")?"checked":s.every(r=>r==="unchecked")?"unchecked":"partial"}_rotatedRows(){let t=this._rows.findIndex(e=>Object.is(e.id,this._focusId));return t<0?this._rows:[...this._rows.slice(t+1),...this._rows.slice(0,t+1)]}_rowIndex(t){return[...this.el.querySelectorAll(".zx-tree__row")].indexOf(t)}_rowElement(t){let e=this._rows.findIndex(s=>Object.is(s.id,t));return e<0?null:this.el.querySelectorAll(".zx-tree__row")[e]??null}_focusRow(t){let e=this._rows[t];if(!e)return;this._focusId=e.id,this._syncRows();let s=this._rowElement(e.id);s?.focus(),s?.scrollIntoView({block:"nearest"})}_focusNodeId(t){if(t===void 0)return;let e=this._rows.findIndex(s=>Object.is(s.id,t));e>=0&&this._focusRow(e)}_message(t,e){let s=this.msg(t);return s===t?e:s}destroy(){let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}};function Sr(i){return Array.isArray(i)?i.map(t=>{if(t===null||typeof t!="object")return t;let e={...t};for(let[s,r]of Object.entries(e))Array.isArray(r)&&(e[s]=Sr(r));return e}):[]}function Me(i){return Array.isArray(i)?i:[]}var Fs=class extends p{static cssName="finder";static defaults={items:[],valueKey:"ID",labelKey:"name",childrenKey:"children",path:[],load:null,preview:null,rootLabel:"",columnWidth:220,height:320,icons:!0,renderItem:null,emptyText:"Empty"};render(){this._items=[],this._path=[],this._columns=[],this._activeColumn=0,this._loading=new Map,this._pathSequence=0,this._createdRoot=this.el===null,this._snapshot=this._createdRoot?null:k(this.el);let t=this.el??a("div");return this.el=t,this._readers=Is(this.options),this._childrenKey=this.options.childrenKey??"children",t.style.setProperty("--zx-finder-column",`${Number(this.options.columnWidth)||220}px`),this.options.height!==null&&(t.style.blockSize=typeof this.options.height=="number"?`${this.options.height}px`:String(this.options.height)),this._items=Array.isArray(this.options.items)?this.options.items.slice():[],this._handleTypeahead=Z(()=>this._columnNodes(this._activeColumn).map(e=>this._readers.label(e)),(e,s)=>this._selectAt(this._activeColumn,s,{focus:!0})),this.listen(t,"click",e=>this._onClick(e)),this.listen(t,"dblclick",e=>this._onDoubleClick(e)),this.listen(t,"keydown",e=>this._onKeydown(e)),this._render({}),this.setPath(this.options.path,{silent:!0}),t}getPath(){return this._path.slice()}getNodes(){let t=this._items,e=[];for(let s of this._path){let r=t.find(n=>Object.is(this._readers.value(n),s));if(!r)break;e.push(r),t=this._readers.children(r)??[]}return e}getSelection(){let t=this.getNodes();return t.length>0?t[t.length-1]:null}async setPath(t,{silent:e=!1,focus:s=!1}={}){let r=this._pathSequence+1;this._pathSequence=r;let n=Array.isArray(t)?t.slice():[],o=[],l=this._items;for(let c of n){let h=l.find(u=>Object.is(this._readers.value(u),c));if(!h||(o.push(c),!O(h,this._readers)))break;if(await this._ensureChildren(h),r!==this._pathSequence)return this;l=this._readers.children(h)??[]}return this._path=o,this._activeColumn=Math.max(0,o.length-1),this._render({focus:s}),e||this._emitChange(),this}async reveal(t,{silent:e=!1}={}){let s=De(this._items,t,this._readers);return s.length===0?this:this.setPath(s.map(r=>this._readers.value(r)),{silent:e})}setItems(t){return this._items=Array.isArray(t)?t.slice():[],this._path=[],this._render({}),this}focus(){return(this._activeRow(this._activeColumn)??this._rowAt(this._activeColumn,0))?.focus(),this}_render({focus:t=!1}){let e=this.getNodes(),s=[{nodes:this._items,selectedId:this._path[0],owner:null}];e.forEach((l,c)=>{if(!O(l,this._readers))return;let h=this._readers.children(l)??[];s.push({nodes:h,selectedId:this._path[c+1],owner:l})}),this._columns=s,this._activeColumn=Math.min(this._activeColumn,s.length-1);let r=s.map((l,c)=>this._renderColumn(l,c)),n=e[e.length-1]??null;if(this.options.preview&&n&&!O(n,this._readers)){let l=this.options.preview(n);l&&r.push(a("div",{class:"zx-finder__preview"},l))}this.el.replaceChildren(...r),this._syncTabStop(),this.el.lastElementChild?.scrollIntoView({block:"nearest",inline:"nearest"}),t&&this.focus()}_renderColumn(t,e){let s=t.owner?this._readers.label(t.owner):String(this.options.rootLabel||this._message("finder.root","Root")),r=a("div",{class:"zx-finder__list",role:"listbox",ariaLabel:s,dataset:{column:String(e)}});if(t.nodes.length===0){let n=t.owner!==null&&this._loading.has(this._readers.value(t.owner));r.append(a("div",{class:"zx-finder__empty"},n?this._message("finder.loading","Loading\u2026"):this._message("finder.empty",this.options.emptyText)))}for(let n of t.nodes){let o=this._readers.value(n),l=O(n,this._readers),c=t.selectedId!==void 0&&Object.is(o,t.selectedId),h=a("div",{class:"zx-finder__row",id:b("zx-finder-row"),role:"option",tabIndex:-1,ariaSelected:String(c)});this.options.icons&&h.append(a("span",{class:"zx-finder__icon",ariaHidden:"true"},_(l?"folder":"file",{size:14}))),h.append(a("span",{class:"zx-finder__label"},this.options.renderItem?this.options.renderItem(n):this._readers.label(n))),l&&h.append(a("span",{class:"zx-finder__chevron",ariaHidden:"true"},_("chevron-right",{size:11}))),h.toggleAttribute("data-branch",l),r.append(h)}return a("div",{class:"zx-finder__column"},r)}_syncTabStop(){let t=this.el.querySelectorAll(".zx-finder__row");t.forEach(s=>{s.tabIndex=-1});let e=this._activeRow(this._activeColumn)??this._rowAt(this._activeColumn,0)??t[0];e&&(e.tabIndex=0)}_onClick(t){let e=t.target.closest(".zx-finder__row");if(!e)return;let{column:s,index:r}=this._locate(e);s<0||this._selectAt(s,r,{focus:!0})}_onDoubleClick(t){let e=t.target.closest(".zx-finder__row");if(!e)return;let{column:s,index:r}=this._locate(e),n=this._columnNodes(s)[r];n&&(O(n,this._readers)?this._enter(s,r):this.emit("activate",{node:n,id:this._readers.value(n)}))}_onKeydown(t){if(t.target.closest(".zx-finder__preview"))return;let e=this._activeColumn,s=this._columnNodes(e);if(s.length===0&&!["ArrowLeft"].includes(t.key))return;let r=Math.max(0,s.findIndex(n=>Object.is(this._readers.value(n),this._columns[e]?.selectedId)));switch(t.key){case"ArrowDown":t.preventDefault(),this._selectAt(e,Math.min(s.length-1,r+1),{focus:!0});return;case"ArrowUp":t.preventDefault(),this._selectAt(e,Math.max(0,r-1),{focus:!0});return;case"Home":t.preventDefault(),this._selectAt(e,0,{focus:!0});return;case"End":t.preventDefault(),this._selectAt(e,s.length-1,{focus:!0});return;case"ArrowRight":{t.preventDefault();let n=s[r];if(!n||!O(n,this._readers))return;this._enter(e,r);return}case"ArrowLeft":if(t.preventDefault(),e===0)return;this._path=this._path.slice(0,e),this._activeColumn=e-1,this._render({focus:!0}),this._emitChange();return;case"Enter":{t.preventDefault();let n=s[r];if(!n)return;O(n,this._readers)?this._enter(e,r):this.emit("activate",{node:n,id:this._readers.value(n)});return}default:this._handleTypeahead(t)}}async _selectAt(t,e,{focus:s=!1}={}){let r=this._columnNodes(t)[e];if(!r)return;let n=this._readers.value(r);if(this._path.length===t+1&&Object.is(this._path[t],n)){this._activeColumn=t,this._syncTabStop(),s&&this.focus();return}this._path=[...this._path.slice(0,t),n],this._activeColumn=t,O(r,this._readers)&&await this._ensureChildren(r),this._render({focus:s}),this._emitChange()}async _enter(t,e){if(await this._selectAt(t,e),this._columnNodes(t+1).length===0){this._activeColumn=t,this._syncTabStop(),this.focus();return}this._activeColumn=t+1,this._path.length<=t+1?await this._selectAt(t+1,0,{focus:!0}):(this._syncTabStop(),this.focus())}async _ensureChildren(t){let e=this._readers.children(t);if(!this.options.load||e&&e.length>0)return;let s=this._readers.value(t),r=this._loading.get(s);if(r)return r;let n=(async()=>{try{let o=await this.options.load(t);t[this._childrenKey]=Array.isArray(o)?o:[],t[this._childrenKey].length===0&&(t.hasChildren=!1)}catch(o){t[this._childrenKey]=[],this.emit("error",{error:o,node:t,id:s})}finally{this._loading.delete(s)}})();return this._loading.set(s,n),n}_columnNodes(t){return this._columns[t]?.nodes??[]}_locate(t){let e=t.closest(".zx-finder__list");return e?{column:Number(e.dataset.column),index:[...e.querySelectorAll(".zx-finder__row")].indexOf(t)}:{column:-1,index:-1}}_rowAt(t,e){return this.el.querySelector(`.zx-finder__list[data-column="${t}"]`)?.querySelectorAll(".zx-finder__row")[e]??null}_activeRow(t){return this.el.querySelector(`.zx-finder__list[data-column="${t}"]`)?.querySelector('[aria-selected="true"]')??null}_emitChange(){let t=this.getNodes();this.emit("change",{path:this.getPath(),nodes:t,node:t.length>0?t[t.length-1]:null})}_message(t,e){let s=this.msg(t);return s===t?e:s}destroy(){this._pathSequence+=1;let t=this.el;super.destroy(),!this._createdRoot&&t&&C(t,this._snapshot)}};function fa(i){return String(i??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLocaleLowerCase()}function Lu(i,t){let e=fa(t).trim().split(/\s+/).filter(Boolean);if(e.length===0)return!0;let s=fa(i.flat(1/0).join(" "));return e.every(r=>s.includes(r))}function zr(i){return i!=null&&!(typeof i=="string"&&i.trim()==="")}function pa(i,t){if(typeof t.get=="function")return Ar(t.get(i));let e=t.fields??t.field??t.id;return(Array.isArray(e)?e:[e]).flatMap(r=>Ar(typeof r=="function"?r(i):r==null?void 0:i?.[r]))}function ma(i,t){let e=[],s=new Map;for(let r of i)for(let n of pa(r,t)){let o=_a(n);o.value==null||o.value===""||s.has(o.value)||(s.set(o.value,!0),e.push(o))}return e}function jt(i,t,e){return i.filter(s=>t.every(r=>{let n=e?.[r.id];if(!zr(n))return!0;if(r.type==="custom")return typeof r.predicate!="function"||!!r.predicate(s,n);let o=pa(s,r);return r.type==="text"?Lu(o,n):r.type==="select"?o.some(l=>Vu(_a(l).value,n)):!0}))}function Ar(i){return Array.isArray(i)?i.flat(1/0):[i]}function _a(i){if(i&&typeof i=="object"&&!(i instanceof Date)){if(Object.prototype.hasOwnProperty.call(i,"value"))return{value:i.value,label:String(i.label??i.value??"")};if(Object.prototype.hasOwnProperty.call(i,"field"))return{value:i.field,label:String(i.label??i.field??"")}}return{value:i,label:String(i??"")}}function Vu(i,t){return Object.is(i,t)?!0:i==null||t==null?!1:String(i)===String(t)}var he=class extends p{static cssName="data-filter";static defaults={filters:[],data:[],autoApply:!0,clearLabel:null};constructor(t,e={}){super(t,e)}render(){let t=this.el??a("div");this._originalChildren=this.el?Array.from(this.el.childNodes):null,this._filters=Array.isArray(this.options.filters)?this.options.filters.map(s=>({...s})):[],this._data=Array.isArray(this.options.data)?[...this.options.data]:[],this._state={},this._entries=new Map,this._customOrigins=new Map,this._restored=!1;let e=new Set;for(let s of this._filters){if(kr(s),e.has(s.id))throw new RangeError(`Duplicate filter id: ${s.id}`);e.add(s.id),s.type==="custom"&&!this._customOrigins.has(s.element)&&this._customOrigins.set(s.element,{parent:s.element.parentNode,nextSibling:s.element.nextSibling}),this._state[s.id]=s.type==="custom"?Cr(s.element):""}this._filtered=jt(this._data,this._filters,this._state),this._controls=a("div",{class:"zx-data-filter__controls"}),this._badge=a("span",{class:"zx-data-filter__badge",ariaLive:"polite",hidden:!0},"0"),this._clearButton=a("button",{class:"zx-data-filter__clear",type:"button",hidden:!0},this.options.clearLabel==null?this.msg("dataFilter.clear"):String(this.options.clearLabel)),t.replaceChildren(this._controls,this._badge,this._clearButton),this.listen(this._clearButton,"click",()=>this.clear());for(let s of this._filters)this._appendFilter(s);return this._syncActiveState(),t}setData(t){Bu(t),this._data=[...t];for(let e of this._filters){if(e.type!=="select")continue;let s=this._entries.get(e.id);s&&this._populateSelect(e,s)}return this._syncActiveState(),this.options.autoApply?this.apply():this._filtered=jt(this._data,this._filters,this._state),this}apply(){this._filtered=jt(this._data,this._filters,this._state);let t=[...this._filtered];return this.emit("filter",{rows:t,state:this.getState()}),t}clear(){for(let t of this._filters)this._state[t.id]="";return this._syncControls(),this._syncActiveState(),this.apply(),this}getState(){return{...this._state}}setState(t){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError("DataFilter state must be an object");for(let e of this._filters)this._state[e.id]=Object.prototype.hasOwnProperty.call(t,e.id)?t[e.id]:"";return this._syncControls(),this._syncActiveState(),this.options.autoApply?this.apply():this._filtered=jt(this._data,this._filters,this._state),this}addFilter(t){kr(t);let e={...t};return this._filters.push(e),this._state[e.id]=e.type==="custom"?Cr(e.element):"",this._appendFilter(e),this._filtered=jt(this._data,this._filters,this._state),this._syncActiveState(),this}destroy(){this._restored||(this._originalChildren&&this.el.replaceChildren(...this._originalChildren),ju(this._customOrigins),this._restored=!0),super.destroy()}_appendFilter(t){if(kr(t),this._entries.has(t.id))throw new RangeError(`Duplicate filter id: ${t.id}`);let e,s={element:null,options:[]};if(t.type==="select")e=a("select",{ariaLabel:t.label}),s.element=e,this._populateSelect(t,s),this.listen(e,"change",()=>{let n=Number(e.value)-1;this._state[t.id]=n>=0?s.options[n]?.value??"":"",this._controlChanged()});else if(t.type==="text")e=a("input",{type:"search",placeholder:t.placeholder??"",ariaLabel:t.label,autocomplete:"off"}),s.element=e,this.listen(e,"input",()=>{this._state[t.id]=e.value,this._controlChanged()});else{e=t.element,this._customOrigins.has(e)||this._customOrigins.set(e,{parent:e.parentNode,nextSibling:e.nextSibling}),s.element=e;let n=e.matches?.('input:not([type="checkbox"]):not([type="radio"]), textarea')?"input":"change";this.listen(e,n,()=>{this._state[t.id]=Cr(e),this._controlChanged()})}this._entries.set(t.id,s);let r=a("label",{class:"zx-data-filter__field"},a("span",{class:"zx-data-filter__label"},t.label),e);this._controls.append(r)}_populateSelect(t,e){let s=this._state[t.id];e.options=Array.isArray(t.options)?t.options.map(Ru):ma(this._data,t);let r=a("option",{value:""},t.emptyLabel??this.msg("dataFilter.all")),n=document.createDocumentFragment();n.append(r),e.options.forEach((l,c)=>{n.append(a("option",{value:String(c+1)},l.label))}),e.element.replaceChildren(n);let o=e.options.findIndex(l=>ga(l.value,s));e.element.value=o>=0?String(o+1):"",o<0&&(this._state[t.id]="")}_controlChanged(){this._syncActiveState(),this.options.autoApply?this.apply():this._filtered=jt(this._data,this._filters,this._state)}_syncControls(){for(let t of this._filters){let e=this._entries.get(t.id);if(!e)continue;let s=this._state[t.id];if(t.type==="select"){let r=e.options.findIndex(n=>ga(n.value,s));e.element.value=r>=0?String(r+1):"",r<0&&(this._state[t.id]="")}else Pu(e.element,s)}}_syncActiveState(){let t=this._filters.reduce((e,s)=>e+Number(zr(this._state[s.id])),0);this._badge.textContent=String(t),this._badge.hidden=t===0,this._clearButton.hidden=t===0}};function kr(i){if(!i||typeof i!="object")throw new TypeError("Filter definition must be an object");if(!["select","text","custom"].includes(i.type))throw new TypeError(`Unknown filter type: ${i.type}`);if(typeof i.id!="string"||!i.id)throw new TypeError("Filter definition requires an id");if(i.type==="custom"){if(!i.element||i.element.nodeType!==1)throw new TypeError("Custom filter requires an Element");if(typeof i.predicate!="function")throw new TypeError("Custom filter requires a predicate")}}function Ru(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"value")?{value:i.value,label:String(i.label??i.value??"")}:{value:i,label:String(i??"")}}function Cr(i){return"checked"in i&&["checkbox","radio"].includes(i.type)?i.checked:"value"in i?i.value:i.getAttribute("data-value")??""}function Pu(i,t){"checked"in i&&["checkbox","radio"].includes(i.type)?i.checked=!!t:"value"in i?i.value=t==null?"":String(t):t==null||t===""?i.removeAttribute("data-value"):i.setAttribute("data-value",String(t))}function ga(i,t){return Object.is(i,t)?!0:i==null||t==null?!1:String(i)===String(t)}function Bu(i){if(!Array.isArray(i))throw new TypeError("DataFilter data must be an array")}function ju(i){let t=[...i];for(let e=t.length;t.length>0&&e>=0;e-=1){let s=0;for(let r=t.length-1;r>=0;r-=1){let[n,o]=t[r];if(!o.parent)n.remove();else{if(o.nextSibling&&o.nextSibling.parentNode!==o.parent)continue;o.parent.insertBefore(n,o.nextSibling)}t.splice(r,1),s+=1}if(s===0)break}for(let[e,s]of t)s.parent?s.parent.append(e):e.remove()}var gt=class extends p{static cssName="fieldset";static defaults={title:"",columns:1,fields:{}};render(){let t=this.el??a("fieldset");this._fields=new Map,this._ownedFields=new Set,this._origins=new Map,this._fieldIdAttributes=new Map,this._ownedNodes=[],this._columnAttribute=t.getAttribute("data-columns");let e=[1,2,3].includes(Number(this.options.columns))?Number(this.options.columns):1;if(t.dataset.columns=String(e),this.options.title){let r=a("legend",{class:"zx-fieldset__legend"},String(this.options.title));this._ownedNodes.push(r),t.append(r)}this._grid=a("div",{class:"zx-fieldset__grid"}),this._ownedNodes.push(this._grid),t.append(this._grid);let s=this.options.fields&&typeof this.options.fields=="object"?this.options.fields:{};for(let[r,n]of Object.entries(s))this.addField(r,n);return t}addField(t,e){let s=String(t);if(this._fields.has(s))throw new Error(`Field "${s}" already exists`);let r,n=!1;if(e instanceof x)r=e;else if(E(e)||e instanceof p){let o=e;r=new x(null,{id:s,type:"custom",label:s,value:qu(o),disabled:$u(o),adapter:()=>Hu(o)}),n=!0}else{let o=e&&typeof e=="object"?e:{};r=new x(null,{...o,id:o.id??s}),n=!0}return n?this._ownedFields.add(r):this._origins.set(r,{parent:r.el.parentNode,next:r.el.nextSibling}),this._fields.set(s,r),this._fieldIdAttributes.set(r,r.el.getAttribute("data-field-id")),r.el.dataset.fieldId=s,this._grid.append(r.el),r}getField(t){return this._fields.get(String(t))??null}hasField(t){return this._fields.has(String(t))}getFields(){return Object.fromEntries(this._fields)}getValues(){let t={};for(let[e,s]of this._fields)t[e]=s.getValue();return t}setValues(t,{silent:e=!1}={}){if(!t||typeof t!="object")return this;for(let[s,r]of Object.entries(t))this._fields.get(s)?.setValue(r,{silent:e});return this}getValue(t){return this._fields.get(String(t))?.getValue()??null}setValue(t,e){return this._fields.get(String(t))?.setValue(e),this}reset(){for(let t of this._fields.values())t.reset();return this}clear(){for(let t of[...this._fields.values()])this._releaseField(t);return this._fields.clear(),this}focus(t){return this._fields.get(String(t))?.focus(),this}setHighlights(t={},e="danger"){let s=0;for(let[r,n]of this._fields){let o=t?.[r];o?(n.setHighlight(String(o),e),s+=1):n.clearHighlight()}return s}clearHighlights(){for(let t of this._fields.values())t.clearHighlight();return this}_releaseField(t){let e=this._fieldIdAttributes.get(t);if(e==null?t.el.removeAttribute("data-field-id"):t.el.setAttribute("data-field-id",e),this._fieldIdAttributes.delete(t),this._ownedFields.has(t)){t.destroy(),this._ownedFields.delete(t);return}let s=this._origins.get(t);s?.parent?s.parent.insertBefore(t.el,s.next?.parentNode===s.parent?s.next:null):t.el.remove(),this._origins.delete(t)}destroy(){this.clear();for(let t of this._ownedNodes??[])t.remove();this._columnAttribute===null?this.el.removeAttribute("data-columns"):this.el.setAttribute("data-columns",this._columnAttribute),super.destroy()}};function Hu(i){let t=E(i)?i:i.toElement(),e=t.parentNode,s=t.nextSibling,r=new Map(["id","aria-labelledby","aria-describedby","aria-disabled","aria-invalid"].map(l=>[l,t.getAttribute(l)])),n="disabled"in t?t.disabled:void 0,o="value"in t?t.value:void 0;return{el:t,get:()=>typeof i.getValue=="function"?i.getValue():typeof i.getValues=="function"?i.getValues():"value"in t?t.value:null,set:(l,c)=>{typeof i.setValue=="function"?i.setValue(l,c):typeof i.setValues=="function"&&l&&typeof l=="object"?i.setValues(l,c):"value"in t&&(t.value=l??"")},focus:()=>{typeof i.focus=="function"?i.focus():typeof t.focus=="function"&&t.focus()},setDisabled:l=>{typeof i.setDisabled=="function"?i.setDisabled(l):"disabled"in t?t.disabled=l:t.setAttribute("aria-disabled",String(l))},destroy:()=>{for(let[l,c]of r)c===null?t.removeAttribute(l):t.setAttribute(l,c);n!==void 0&&(t.disabled=n),o!==void 0&&(t.value=o),e?e.insertBefore(t,s?.parentNode===e?s:null):t.remove()}}}function qu(i){let t=E(i)?i:i.toElement();return typeof i.getValue=="function"?i.getValue():typeof i.getValues=="function"?i.getValues():"value"in t?t.value:null}function $u(i){let t=E(i)?i:i.toElement();return"disabled"in t?!!t.disabled:t.getAttribute("aria-disabled")==="true"}var ue=class extends p{static cssName="form";static defaults={fieldsets:[],actions:[],novalidate:!0,msg:{"form.required":"This field is required.","form.int":"Enter a whole number.","form.float":"Enter a valid number."}};render(){let t=this.el??a("form");this._fieldsets=[],this._ownedFieldsets=new Set,this._origins=new Map,this._ownedNodes=[],this._novalidateAttribute=t.getAttribute("novalidate"),t.toggleAttribute("novalidate",!!this.options.novalidate),this._body=a("div",{class:"zx-form__body"}),this._actions=a("div",{class:"zx-form__actions"}),this._ownedNodes.push(this._body,this._actions),t.append(this._body,this._actions),this.listen(t,"submit",s=>{s.preventDefault(),this.submit()}),this.listen(t,"reset",s=>{s.preventDefault(),this.reset()}),this.listen(this._actions,"click",s=>this._handleAction(s));let e=Array.isArray(this.options.fieldsets)?this.options.fieldsets:[];for(let s of e)this.addFieldset(s);return this.setActions(Array.isArray(this.options.actions)?this.options.actions:[]),t}addFieldset(t){let e=!(t instanceof gt),s=e?new gt(null,t??{}):t;return this._fieldsets.includes(s)||(e?this._ownedFieldsets.add(s):this._origins.set(s,{parent:s.el.parentNode,next:s.el.nextSibling}),this._fieldsets.push(s),this._body.append(s.el),this.listen(s.el,"zx-change",r=>{let n=r.target,o=n instanceof Element?n.dataset.fieldId:null;o&&this.emit("change",{id:o,value:s.getValue(o)})})),s}setActions(t){return this._actionDescriptors=Array.isArray(t)?t.map(e=>({...e})):[],this._actions.replaceChildren(...this._actionDescriptors.map((e,s)=>{let r=String(e.label??e.id??"Action");return a("button",{class:"zx-btn",type:["submit","reset"].includes(e.type)?e.type:"button",disabled:!!e.disabled,title:e.title,ariaLabel:!r&&e.title?e.title:void 0,dataset:{actionIndex:s,kind:["primary","danger","ghost"].includes(e.kind)?e.kind:"default",size:e.size==="sm"?"sm":"md"}},e.icon?_(e.icon,{size:16}):null,r?a("span",{class:"zx-btn__label"},r):null)})),this._actions.hidden=this._actionDescriptors.length===0,this}getValues(){return Object.assign({},...this._fieldsets.map(t=>t.getValues()))}setValues(t,{silent:e=!1}={}){for(let s of this._fieldsets)s.setValues(t,{silent:e});return this}getField(t){for(let e of this._fieldsets){let s=e.getField(t);if(s)return s}return null}setValue(t,e){return this.getField(t)?.setValue(e),this}getValue(t){return this.getField(t)?.getValue()??null}reset(){for(let t of this._fieldsets)t.reset().clearHighlights();return this}setHighlights(t,e="danger"){return this._fieldsets.reduce((s,r)=>s+r.setHighlights(t,e),0)}clearHighlights(){for(let t of this._fieldsets)t.clearHighlights();return this}submit(){let t={},e=null;for(let r of this._fieldsets)for(let[n,o]of Object.entries(r.getFields())){let l=o.getValue(),c="";if(o.options.required&&Tr(l))c=this.msg("form.required");else if(!Tr(l)&&o.options.type==="int"){let h=Bi(l);h.valid?o.setValue(h.value,{silent:!0}):c=this.msg("form.int")}else if(!Tr(l)&&o.options.type==="float"){let h=ji(l);h.valid?o.setValue(h.value,{silent:!0}):c=this.msg("form.float")}c?(t[n]=c,o.setHighlight(c,"danger"),e??=o):o.clearHighlight()}return Object.keys(t).length?(this.emit("invalid",{errors:t}),e?.focus(),!1):!this.emit("submit",{values:this.getValues()}).defaultPrevented}_handleAction(t){let e=t.target instanceof Element?t.target.closest("[data-action-index]"):null;if(!e||!this._actions.contains(e))return;let s=this._actionDescriptors[Number(e.dataset.actionIndex)],r=s?.onClick??s?.onclick??s?.handler;typeof r=="function"&&r(t,this)}destroy(){for(let t of this._fieldsets??[])if(this._ownedFieldsets.has(t))t.destroy();else{let e=this._origins.get(t);e?.parent?e.parent.insertBefore(t.el,e.next?.parentNode===e.parent?e.next:null):t.el.remove()}this._fieldsets=[];for(let t of this._ownedNodes??[])t.remove();this._novalidateAttribute===null?this.el.removeAttribute("novalidate"):this.el.setAttribute("novalidate",this._novalidateAttribute),super.destroy()}};function Tr(i){return i==null||i===""||i===!1||Array.isArray(i)&&i.length===0}function ba(){Gn(),ln(),Rn(),kn(),Fn(),eo(),ro(),Hn(),Bn(),so(),$n(),Kn(),Jn(),Qn()}ba();var Ie=new WeakMap;function Et(i=globalThis){let t=i?.Element?.prototype;t&&(typeof t.store!="function"&&Object.defineProperty(t,"store",{configurable:!0,writable:!0,value:function(s,r){let n=Ie.get(this);return n||(n=new Map,Ie.set(this,n)),n.set(s,r),this}}),typeof t.retrieve!="function"&&Object.defineProperty(t,"retrieve",{configurable:!0,writable:!0,value:function(s,r=null){let n=Ie.get(this);return n?.has(s)?n.get(s):(arguments.length>1&&(n||(n=new Map,Ie.set(this,n)),n.set(s,r)),r)}}),typeof t.eliminate!="function"&&Object.defineProperty(t,"eliminate",{configurable:!0,writable:!0,value:function(s){return Ie.get(this)?.delete(s),this}}))}function bt(i){if(i&&typeof i=="object"&&typeof i.toElement=="function")return i.toElement()??!1;if(i&&typeof i=="object"&&typeof i.nodeType=="number")return i;if(typeof i=="string"||typeof i=="number")return document.createTextNode(String(i));if(!i||typeof i!="object"||Array.isArray(i))return!1;let t=i,e={},s=[],r=new Set(["tag","html","styles","classes","child","children","_adopt","events"]);for(let[o,l]of Object.entries(t))r.has(o)||(/^on[A-Z]/.test(o)&&typeof l=="function"?s.push([o.slice(2).toLowerCase(),l]):o==="class"?e.class=l:o==="text"?e.textContent=l==null?"":String(l):e[o]=l);if(t.styles&&typeof t.styles=="object"&&(e.style=t.styles),t.classes!=null){let o=Array.isArray(t.classes)?t.classes:[t.classes];e.class=[e.class,...o].flat().filter(Boolean)}let n=a(String(t.tag??"div"),e);for(let[o,l]of s)n.addEventListener(o,l);if(t.events&&typeof t.events=="object")for(let[o,l]of Object.entries(t.events))typeof l=="function"&&n.addEventListener(o,l);if(t.html!=null&&n.append(a.raw(String(t.html))),Er(n,t._adopt),Er(n,t.child),Array.isArray(t.children))for(let o of t.children)Er(n,o);else if(t.children&&typeof t.children=="object"){let o=[];for(let[l,c]of Object.entries(t.children)){let h=bt(c);h&&(n.append(h),n[`_${l}`]=h.retrieve?.("com")??h,o.push(l))}n.store?.("children",o)}return n}function ya(i=globalThis){Et(i),i.__=bt;let t=i.String?.prototype;t&&typeof t.htmlSpecialChars!="function"&&Object.defineProperty(t,"htmlSpecialChars",{configurable:!0,writable:!0,value:function(){return je(String(this))}});let e=i.Array?.prototype;return e&&typeof e.findBy!="function"&&Object.defineProperty(e,"findBy",{configurable:!0,writable:!0,value:function(r,n){let o=typeof r=="string"?l=>l?.[r]===n:r;if(typeof o!="function")return null;for(let l=this.length-1;l>=0;l-=1)if(o(this[l])===!0)return this[l];return null}}),i._===void 0&&(i._=(s,r)=>Y(String(s),r)),i}function Er(i,t){if(t==null)return;let e=Array.isArray(t)?t:[t];for(let s of e){let r=bt(s);r&&i.append(r)}}var v=class{static legacyName="gx.ui.Container";constructor(t={},e={}){Ku(this.constructor),this.gx=this.constructor.legacyName,this.options={...e,...t&&typeof t=="object"?t:{}},this._events=new Map,this._mappedListeners=[],this._domAbort=new AbortController,this._zx=null,this._ui={},this._display=this._ui,this._uiMap={},this._optionSetters={},this._destroyed=!1;for(let[s,r]of Object.entries(this.options))/^on[A-Z]/.test(s)&&typeof r=="function"&&this.addEvent(s,r)}addEvent(t,e){if(typeof e!="function")return this;let s=Dr(t),r=this._events.get(s)??new Set;return r.add(e),this._events.set(s,r),this}removeEvent(t,e){let s=Dr(t);if(e===void 0)this._events.delete(s);else{let r=this._events.get(s);r?.delete(e),r?.size===0&&this._events.delete(s)}return this}fireEvent(t,e=[]){let s=Array.isArray(e)?e:[e],r=[...this._events.get(Dr(t))??[]];for(let n of r)n.apply(this,s);return this}setOptions(t){if(!t||typeof t!="object")return this;for(let[e,s]of Object.entries(t))this.setOption(e,s);return this}setOption(t,e){let s=String(t);if(this.options[s]=e,/^on[A-Z]/.test(s)&&typeof e=="function")return this.addEvent(s,e),this;let r=this._optionSetters[s];return typeof r=="function"?r.call(this,e):typeof r=="string"&&typeof this[r]=="function"?this[r](e):Yu(this.constructor,s),this}toElement(){return this._zx?.toElement?.()??this._zx?.el??null}display(t="root"){let e=t||"root";if(e==="root")return this.toElement();let s=this._uiMap[e];return typeof s=="function"?s.call(this)??this.toElement():typeof s=="string"?this._zx?.refs?.[s]??this.toElement():s?.nodeType===1?s:this._ui[e]??this.toElement()}getCoordinates(){let t=this.toElement()?.getBoundingClientRect?.();return t?{width:t.width,height:t.height,top:t.top,left:t.left}:{width:0,height:0,top:0,left:0}}setStyle(t,e){let s=this.toElement();return s?(String(t).startsWith("--")||String(t).includes("-")?s.style.setProperty(String(t),String(e)):s.style[t]=e,this):this}setCoordinates(t={}){for(let e of["width","height","top","right","bottom","left"]){if(t[e]==null)continue;let s=typeof t[e]=="number"?`${t[e]}px`:t[e];this.setStyle(e,s)}return this}destroy(){if(this._destroyed)return;this._destroyed=!0,this._domAbort.abort();let t=this.toElement();t?.retrieve?.("com")===this&&t.eliminate("com");for(let[e,s]of this._mappedListeners)this._zx?.off?.(e,s);this._mappedListeners.length=0,this._events.clear(),this._zx?.destroy?.()}_attach(t,e={}){this._zx=t,this._uiMap={...e.ui??{}},this._optionSetters={...e.setters??{}};let s=this.toElement();if(s){Et(globalThis),s.store?.("com",this),this._ui.root=s;for(let r of Object.keys(this._uiMap))this._ui[r]=this.display(r)}for(let[r,n]of Object.entries(e.events??{})){let o=typeof n=="string"?{type:n}:n,l=c=>{let h=c.detail??{};if(o.filter&&!o.filter.call(this,h,c))return;let u=o.args?o.args.call(this,h,c):[];this.fireEvent(r,u)};t.on?.(o.type,l),this._mappedListeners.push([o.type,l])}return this}_listen(t,e,s,r={}){return t.addEventListener(e,s,{...r,signal:this._domAbort.signal}),this}_mirrorAct(t,e){t?.classList.toggle("act",!!e)}};function Ku(i){Object.hasOwn(i,"_compatWarned")&&i._compatWarned||(Object.defineProperty(i,"_compatWarned",{configurable:!0,value:!0,writable:!0}),console.warn(`${i.legacyName} is running on the Zx compat layer \u2014 migrate to ${Uu(i.legacyName)}`))}function Yu(i,t){Object.hasOwn(i,"_compatOptionWarnings")||Object.defineProperty(i,"_compatOptionWarnings",{configurable:!0,value:new Set}),!i._compatOptionWarnings.has(t)&&(i._compatOptionWarnings.add(t),console.warn(`${i.legacyName}.setOption("${t}") cannot update the wrapped Zx component dynamically`))}function Uu(i){return`zx.${i.split(".").at(-1)}`}function Dr(i){let t=String(i??"");return(/^on[A-Z]/.test(t)?t.slice(2):t).toLowerCase()}function ut(i){return i==null?null:typeof i=="string"?document.querySelector(i):i?.nodeType===1?i:null}function L(i){return i==null||typeof i=="string"||typeof i=="number"||i?.nodeType||typeof i?.toElement=="function"||typeof i=="function"?i:bt(i)||String(i)}function Mr(i){let t=String(i??"").toLowerCase().replace(/^s_msg_32_/,"").replace(/^icon-/,"");return t.includes("error")||t.includes("danger")||t.includes("remove")?"error":t.includes("success")||t.includes("ok")||t.includes("check")?"success":t.includes("warn")?"warning":"info"}function Oe(i,t,e){Object.hasOwn(i,"_compatWarned")||(Object.defineProperty(i,"_compatWarned",{value:!0}),console.warn(`${t} is running on the Zx compat layer \u2014 migrate to zx.${e}`))}function xa(i,t,e){let s=`_compatMethod_${t}`;Object.hasOwn(i,s)||(Object.defineProperty(i,s,{value:!0}),console.warn(`${i.legacyName}.${t} has no direct Zx equivalent; use ${e}`))}function Fe(i){return i==null?"":String(typeof i=="string"||typeof i=="number"?i:i.label??i.title??i.text??i.name??i.value??"")}var Ls=class extends v{static legacyName="gx.zeyos.Toggle";constructor(t,e={}){super(e,{on:!1,value:!0});let{target:s,host:r}=Ks(t),n=new P(s,{checked:!!e.on,value:e.value??!0,label:e.label??null,disabled:!!e.disabled});r&&r.append(n.toElement()),this._attach(n,{events:{check:{type:"change",filter:o=>o.checked,args:()=>[this]},uncheck:{type:"change",filter:o=>!o.checked,args:()=>[this]},change:{type:"change",args:o=>[o.checked]}},setters:{on:o=>o?this.setChecked():this.setUnchecked(),value:o=>{n.options.value=o}}}),n.on("change",()=>this._syncAct()),this._syncAct()}getState(){return this._zx.get()}getValue(){return this._zx.getValue()}toggle(){return this._zx.toggle(),this._syncAct(),this}setChecked(t=!1){return this._zx.set(!0,{silent:!!t}),this._syncAct(),this}setUnchecked(t=!1){return this._zx.set(!1,{silent:!!t}),this._syncAct(),this}_syncAct(){this._mirrorAct(this.toElement(),this.getState())}},Vs=class extends v{static legacyName="gx.zeyos.Msgbox";constructor(t={}){super(t,{closable:!0,content:!1});let e=new _t(null,{timeout:0,closable:t.closable!==!1,maxVisible:1});document.body.append(e.toElement()),this._handle=null,this._content=t.content||"",this._attach(e,{ui:{frame:"root",content:"root",img:"root"}})}setContent(t){return this._content=L(t),this}show(t,e="info"){return t!=null&&this.setContent(t),this._handle?.close(),this._handle=this._zx.show(this._content,{kind:Mr(e),timeout:0,closable:this.options.closable!==!1}),this._mirrorAct(this.toElement(),!0),this}hide(){return this._handle?.close(),this._handle=null,this._mirrorAct(this.toElement(),!1),this}},Rs=class extends v{static legacyName="gx.bootstrap.Message";constructor(t,e={}){super(e,{duration:3e3});let s=new _t(ut(t),{timeout:Number(e.duration)||0,closable:!0,maxVisible:e.maxVisible??5});ut(t)||document.body.append(s.toElement()),this._handles=new Map,this._progress=null,this._progressValue=0,this._attach(s,{ui:{windows:"root",status:"root"}})}addMessage(t,e="info",s=!0,r=!1,n=!0){let o=document.createElement("span");o.hidden=!0;let l=this._zx.show(L(t),{kind:Mr(e),closable:s!==!1,timeout:n===!1?0:Number(this.options.duration)||0});return this._handles.set(o,l),o}closeMessage(t){return this._handles.get(t)?.close(),this._handles.delete(t),this}clear(){for(let t of this._handles.values())t.close();return this._handles.clear(),this}showStatus(t,e="",s=!1){return this._progress||(this._progress=_t.progress(String(e))),this._progressValue=Number(t)||0,this._progress.update(this._progressValue,String(e)),this}incProgress(t,e){return this.setProgress(this._progressValue+(Number(t)||0),e)}setProgress(t,e,s){return this._progress||(this._progress=_t.progress(String(e??""))),this._progressValue=Number(t)||0,this._progress.update(this._progressValue,e==null?void 0:String(e)),this}hideStatus(){return this._progress?.done(),this._progress=null,this._progressValue=0,this}},Ps=class extends v{constructor(t={}){super(t,{width:600,closable:!0,content:null});let e=new lt(null,{title:String(t.title??""),size:Wu(t.width),closable:t.closable!==!1,lightDismiss:!!(t.overlayDismiss??t.clickable),content:L(t.content)});this._attach(e,{events:{show:{type:"open",args:()=>[this]},hide:{type:"close",args:s=>[s.result,this]},open:{type:"open",args:()=>[this]}},ui:{modal:"root",aside:"content",body:"content",content:"content",title:"title",footer:"footer",cross:"close"},setters:{content:"setContent",title:"setTitle",open:s=>s?this.show():this.hide()}}),this.isOpen=!1,t.footer&&e.setButtons(Aa(t.footer)),t.open&&this.show()}show(t){return this.isOpen=!0,this._showArgument=t,this._zx.open(),this}hide(t){return this.isOpen=!1,this._zx.close(t),this}setContent(t){return this._zx.setContent(L(t)),this}setTitle(t){return this._zx.setTitle(t),this}getContent(){return this._zx.refs.content}setPosition(t,e){return xa(this.constructor,"setPosition","CSS dialog positioning"),this}},Bs=class extends Ps{static legacyName="gx.zeyos.Popup"},de=class extends Ps{static legacyName="gx.bootstrap.Popup"},Ir=Object.freeze({});function Or(i,t,e={}){Oe(Or,"gx.bootstrap.PopupAlert","Dialog.alert");let s=typeof e=="string"?{type:e}:e;return new Promise(r=>{let n=new de({...s,title:i,content:t,width:s.width??400});n._zx.setButtons([{label:s.okLabel??"Ok",kind:"primary",autofocus:!0,action:()=>{typeof s.onOk=="function"&&s.onOk()===!1||(n.hide(),r())}}]),n._zx.once("close",()=>n.destroy()),n.show()})}function Fr(i,t,e={}){Oe(Fr,"gx.bootstrap.PopupConfirm","Dialog.confirm");let s=typeof e=="string"?{type:e}:e;return new Promise(r=>{let n=new de({...s,title:i,content:t,width:s.width??400,closable:!1});n._zx.setButtons([{label:s.cancelLabel??"Cancel",action:()=>{n.hide(),r(Ir)}},{label:s.okLabel??"Ok",kind:"primary",action:()=>{typeof s.onOk=="function"&&s.onOk()===!1||(n.hide(),r())}}]),n._zx.once("close",()=>n.destroy()),n.show()})}var js=class extends v{static legacyName="gx.zeyos.Dialog";constructor(t,e={}){super(e,{title:"",height:400});let s=new lt(null,{title:String(e.title??""),content:null});this._frames={},this._current=null,this._attach(s,{ui:{title:"title",content:"content",footer:"footer"},setters:{title:"setTitle"}})}setTitle(t){return this._zx.setTitle(Fe(t)),this}addFrame(t,e,s){let r=Aa(e?.footer),n=this._zx.addView(String(t),{title:e?.title==null?void 0:Fe(e.title),content:L(e?.content),buttons:r});return this._frames[t]={title:e?.title??null,content:n.content,footer:r,view:n},(!this._current&&s!==!1||s===!0)&&this.openFrame(t),this}openFrame(t){return this._zx.showView(String(t)),this._current=this._frames[t],this._current}getFrame(t){return this._frames[t]??null}addSubmitFrame(t,e,s,r){return this.addFrame(t,{title:this.options.title,content:va(e),footer:{close:{label:"Close",click:()=>this._zx.close()},ok:{label:"OK",primary:!0,click:()=>s?.()}}},r),e}addFormFrame(t,e,s,r){let n={},o=document.createElement("div");for(let[l,c]of Object.entries(e??{})){let h=document.createElement("p");h.textContent=c?.[0]==null?"":String(c[0]),o.append(h);let u=c?.[1],d=L(u);d?.nodeType?o.append(d):d?.toElement?.()&&o.append(d.toElement()),n[l]=u}return this.addSubmitFrame(t,o,s,r),n}addSuccessFrame(t,e,s,r){let n=va(e);if(s){let o=document.createElement("a");o.href=s,o.textContent="Open",n.append(o)}return this.addFrame(t,{title:this.options.title,content:n},r)}getFormValues(t){let e={};for(let[s,r]of Object.entries(t??{}))r?.value!=null?e[s]=r.value:typeof r?.getValue=="function"?e[s]=r.getValue():typeof r?.getValues=="function"?e[s]=r.getValues():typeof r?.getId=="function"?e[s]=r.getId():typeof r?.get=="function"&&(e[s]=r.get());return e}},Hs=class extends v{static legacyName="gx.zeyos.Dropdown";constructor(t,e={}){super(e,{items:{},label:"",resettable:!1,compact:!1,upside:!1});let{target:s,host:r}=Ks(t);this._items=wa(e.items,e.resettable,e.emptyCaption),this._selected=null;let n=new W(s,{label:String(e.label??""),items:this._items,placement:e.upside?"top-start":"bottom-start"});r&&r.append(n.toElement()),this._attach(n,{events:{change:{type:"select",args:o=>(this._selected=o.value==null?null:o.item,n.setLabel(o.value==null?String(e.label??""):String(o.item.label)),[o.value,o.item.label,this])}},ui:{frame:"root",button:"root",section:()=>document.querySelector(`[aria-labelledby="${n.el.id}"]`)},setters:{items:"setItems"}})}setItems(t){return this._items=wa(t,this.options.resettable,this.options.emptyCaption),this._zx.setItems(this._items),this}selectItem(t,e){let s=this._items.find(r=>r!=="-"&&r.value==t);return this._selected=s??{value:t,label:e??String(t)},this._zx.setLabel(e??this._selected.label),this.fireEvent("change",[t,e??this._selected.label,this]),this._zx.close(),this}reset(){return this._selected=null,this._zx.setLabel(String(this.options.label??"")),this.fireEvent("change",[null,this.options.emptyCaption,this]),this._zx.close(),this}getSelected(){return this._selected?{value:this._selected.value,label:this._selected.label}:null}getValue(){return this._selected?.value??""}show(){return this._zx.open(),this}close(){return this._zx.close(),this}toggle(){return this._zx.isOpen()?this._zx.close():this._zx.open(),this}},qs=class extends v{static legacyName="gx.bootstrap.MenuButton";constructor(t,e={}){super(e,{entries:[],label:"",orientation:"left",direction:"down"});let{target:s,host:r}=Ks(t);this._entries=[];let n=new W(s,{label:String(e.label??""),items:[],kind:Sa(e.style),placement:`${e.direction==="up"?"top":"bottom"}-${e.orientation==="right"?"end":"start"}`});r&&r.append(n.toElement()),this._attach(n,{events:{change:{type:"select",args:o=>[o.value,o.item,this]}},ui:{button:"root",frame:"root",menu:"root"}});for(let o of e.entries??[])this.add(o)}add(t,e){if(!t)return this._entries.push("-"),this._zx.setItems(this._entries),null;let s={label:String(t),icon:e,value:this._entries.length};return this._entries.push(s),this._zx.setItems(this._entries),this.toElement()}divider(){return this.add(!1),this}toggle(){return this._zx.isOpen()?this._zx.close():this._zx.open(),this}open(){return this._zx.open(),this}close(){return this._zx.close(),this}setLabel(t){return this._zx.setLabel(t),this}setStyle(t){return this.toElement().setAttribute("data-kind",Sa(t)),this}},$s=class extends v{static legacyName="gx.bootstrap.CheckButton";constructor(t,e={}){super(e,{label:"",value:!1});let{target:s,host:r}=Ks(t),n=new st(s,{label:e.label,checked:!!e.value,disabled:!!e.disabled});r&&r.append(n.toElement()),this._attach(n,{events:{change:{type:"change",args:o=>[o.checked]},check:{type:"change",filter:o=>o.checked,args:()=>[]},uncheck:{type:"change",filter:o=>!o.checked,args:()=>[]}},ui:{button:"root",indicator:"root",group:"root"},setters:{value:"set",disabled:"setDisabled",label:"setLabel"}})}get(){return this._zx.get()}toggle(t=!1){return this._zx.set(!this.get(),{silent:!!t}),!1}check(t=!1){return this._zx.set(!0,{silent:!!t}),this}uncheck(t=!1){return this._zx.set(!1,{silent:!!t}),this}set(t){return t?this.check():this.uncheck()}setDisabled(t){return t?this._zx.disable():this._zx.enable(),this}setLabel(t){return this._zx.setLabel(t),this}};function Ks(i){let t=ut(i);return t?.localName==="button"?{target:t,host:null}:{target:null,host:t}}function Wu(i){if(typeof i=="number"&&Number.isFinite(i))return i;let t=Number.parseFloat(String(i??""));return Number.isFinite(t)?t:"md"}function Aa(i){return i?(Array.isArray(i)?i:i?.nodeType?[i]:Object.values(i)).map(e=>e?.nodeType?{label:e.textContent??"",action:()=>e.click?.()}:{label:String(e?.label??""),kind:e?.primary?"primary":"default",action:()=>e?.click?.()}):[]}function va(i){let t=document.createElement("div"),e=Array.isArray(i)?i:[i];for(let s of e){let r=L(s);r?.nodeType?t.append(r):r!=null&&t.append(document.createTextNode(String(r)))}return t}function wa(i={},t=!1,e=null){let s=[];t&&s.push({label:String(e??"Empty"),value:null});for(let[r,n]of Object.entries(i??{})){let o=n&&typeof n=="object"?n:null;s.push({label:String(o?.text??o?.label??n),value:r,onselect:typeof o?.onClick=="function"?o.onClick:void 0})}return s}function Sa(i){let t=String(i??"").toLowerCase();return t.includes("danger")||t.includes("error")?"danger":t.includes("primary")||t.includes("success")?"primary":t.includes("link")||t.includes("ghost")?"ghost":"default"}var Gu=Object.freeze({data:"items",elementIndex:"valueKey",elementLabel:"labelKey",elementSelect:"renderValue",allowEmpty:"clearable",resetable:"clearable",searchfields:"searchKeys",height:"listHeight"}),Qu=Object.freeze({data:"items",listValue:"valueKey",listFormat:"labelKey",listActive:"checkedKey",defaultState:"defaultChecked"}),Gx=Object.freeze({cols:"columns"}),Qx=Object.freeze({horizontal:"layout",default:"value"}),Zu=Object.freeze({string:"text",integer:"int",gxselect:"zxselect",date:"date",month:"month",time:"time",optionlist:"optionlist",html:"html",multivalueeditor:"multivalueeditor",checklist:"checklist"});function za(i,t){let e={};if(!i||typeof i!="object")return e;for(let[s,r]of Object.entries(i))/^on[A-Z]/.test(s)||(e[t[s]??s]=r);return e}function Ys(i={}){let t=za(i,Gu);return Object.hasOwn(i,"data")&&(t.items=Array.isArray(i.data)?i.data.slice():[]),(Object.hasOwn(i,"allowEmpty")||Object.hasOwn(i,"resetable"))&&(t.clearable=!!(i.allowEmpty||i.resetable)),i.msg&&typeof i.msg=="object"&&i.msg.noSelection!=null&&(t.placeholder=String(i.msg.noSelection)),Object.hasOwn(i,"height")&&(t.listHeight=Ta(i.height,280)),delete t.elementDefault,delete t.parseDefault,delete t.queryParam,delete t.requestData,delete t.requestHeader,delete t.url,delete t.method,delete t.entity,delete t.limit,t}function Us(i={}){let t=za(i,Qu);return typeof i.getItemValue=="function"&&(t.valueKey=i.getItemValue),Object.hasOwn(i,"height")&&(t.height=Ta(i.height,280)),delete t.url,delete t.method,delete t.requestData,delete t.decodeResponse,delete t.width,delete t.onClick,t}function Ws(i){if(typeof i=="string")return i.replaceAll(" "," ");let t=Array.isArray(i)?i:["d",".","M",".","y"],e={d:"%d",m:"%m",M:"%m",y:"%Y",h:"%H",i:"%M",s:"%S"};return t.map(s=>e[s]??String(s).replaceAll(" "," ")).join("")}function Ju(i,t){if(typeof t=="string")return t;if(typeof t!="number"||!Number.isFinite(t))return null;let e=i[Math.trunc(t)-1];return e?.name==null?null:String(e.name)}function ka(i={}){let t=Array.isArray(i.frames)?i.frames:[];return{tabs:t.map(e=>({name:String(e.name??""),title:String(e.title??""),content:e.content,closable:!!e.closable,disabled:!!e.disabled})),active:Ju(t,i.show??1),height:i.height??null}}function Lr(i={},t=ed){let e=Array.isArray(i.cols)?i.cols:[],s=typeof i.structure=="function"?i.structure:c=>e.map(h=>c?.[h.id]),r=new WeakMap,n=(c,h)=>{if(c&&typeof c=="object"){let m=r.get(c);if(m?.index===h)return m.cells}let u=s(c,h),d=Array.isArray(u)?u:Array.isArray(u?.row)?u.row:[];return c&&typeof c=="object"&&r.set(c,{index:h,cells:d}),d},o=e.map((c,h)=>({id:String(c.id??h),label:String(c.label??""),width:c.width??"auto",align:Xu(c.align??c["text-align"]),sortable:c.filter!=null||c.filterable!==!1,render:(u,d)=>t(n(u,d)[h])})),l=e.find(c=>c.filter!=null);return{columns:o,data:Array.isArray(i.data)?i.data.slice():[],sort:l?{id:String(l.id),dir:td(l.mode??l.filter)}:null,sortMode:"server",selectable:i.selectable===!0?"single":["single","multi"].includes(i.selectable)?i.selectable:!1,height:i.height??null,stickyHeader:i.scroll!==!1,rowId:typeof i.rowId=="function"||typeof i.rowId=="string"?i.rowId:sd}}function Ca(i={}){let t=Zu[String(i.type??"text").toLowerCase()]??String(i.type??"text").toLowerCase(),e={id:i.id??null,type:t,label:i.label??"",description:i.description??"",value:Object.hasOwn(i,"value")?i.value:i.default,placeholder:i.placeholder??"",required:!!i.required,disabled:!!i.disabled,options:i.options??null,layout:i.horizontal===!1?"stack":i.horizontal?"inline":"stack",props:{}};return t==="html"&&(e.value=i.content??e.value),e}var Dt=Object.freeze({select:(i,t)=>[i.item??null,t],noselect:(i,t)=>[null,t],tableClick:i=>[i.row,i.event?.target?.closest?.("tr")??null,i.event],tableFilter:(i,t)=>[t?._legacyColumn?.(i.id)??{id:i.id},i.dir],tabChange:i=>[i.name]});function Ta(i,t){let e=typeof i=="string"?Number.parseFloat(i):Number(i);return Number.isFinite(e)?Math.max(0,e):t}function Xu(i){let t=String(i??"start");return["center","end","left","right"].includes(t)?t:"start"}function td(i){return i==="desc"?"desc":"asc"}function ed(i){return i&&typeof i=="object"&&!Array.isArray(i)&&Object.hasOwn(i,"label")?i.label:i}function sd(i){return i?.ID??i?.id??i}var Gs=class extends v{static legacyName="gx.zeyos.Checklist";constructor(t,e={}){super(e,{data:[],listValue:"ID",listFormat:"name",listActive:"on"});let s=Us(e);s.items=Array.isArray(e.data)?e.data:Array.isArray(e.items)?e.items:[],s.load=e.url?()=>this._load(e.url,e.requestData):null;let r=new U(t,s);this._http=null,this._attach(r,{events:{complete:{type:"loaded",args:n=>[n.items]},change:{type:"change",args:n=>[n.values]}},ui:{frame:"root",table:"list",tbody:"list",search:"search"},setters:{data:"setData"}})}getValues(t){let e=this._zx.getValues();return t==null?e:e.map(s=>s?.[t]).filter(s=>s!=null)}setValues(t){return this._zx.setValues(t??[]),t}reset(){return this._zx.uncheckAll(),this}search(t){return this._zx.search(t),this}setData(t){return this._zx.setItems(Array.isArray(t)?t:[]),this}async load(t=this.options.url,e=this.options.requestData){let s=await this._load(t,e);return this._zx.setItems(s),this.fireEvent("complete",[s]),this}async loadFromURL(t,e,s){let r=await this.load(t,e);return s?.(this),r}async _load(t,e){this._http??=new et({headers:this.options.requestHeader??{}});try{let s=String(this.options.method??"GET").toUpperCase(),r=await this._http.request(String(t??""),s==="GET"?{method:s,query:e??{}}:{method:s,data:e??{}});return typeof this.options.decodeResponse=="function"&&(r=this.options.decodeResponse(r)),Array.isArray(r)?r:[]}catch(s){throw this.fireEvent("failure",[s]),s}}},Qs=class extends Gs{static legacyName="gx.zeyos.Checklist"},Zs=class extends Gs{static legacyName="gx.bootstrap.Checklist"},Js=class extends v{static legacyName="gx.zeyos.Permission";constructor(t,e={}){super(e,{value:!0,groups:[]});let s=new le(t,{value:e.value??!0,groups:e.groups??e.data??[],groupsValueKey:e.groupsValueKey??e.elementIndex??"ID",groupsLabelKey:e.groupsLabelKey??e.elementLabel??"name"});this._attach(s,{events:{change:{type:"change",args:r=>[r.value]}},setters:{value:"set"}})}get(){return this._zx.get()}set(t,e=!1){return this._zx.set(t,{silent:e}),this}},Xs=class extends v{static legacyName="gx.zeyos.Table";constructor(t,e={}){super(e,{cols:[],data:[]});let s={...e};typeof e.structure=="function"&&(s.structure=(o,l)=>e.structure(o,l,this));let r=Lr(s,Na),n=new pt(t,r);this._cols=Array.isArray(e.cols)?e.cols.map(o=>({...o})):[],this._filter=r.sort?this._legacyColumn(r.sort.id):null,this._filter&&(this._filter.mode=r.sort.dir),this._attach(n,{events:{click:{type:"rowclick",args:o=>Dt.tableClick(o)},dblclick:{type:"rowdblclick",args:o=>Dt.tableClick(o)},filter:{type:"sort",args:o=>{let l=this._legacyColumn(o.id);return l.mode=o.dir,this._filter=l,[l,o.dir]}},complete:{type:"datachange",args:o=>[o.rows]}},ui:{table:()=>n._table,tbody:()=>n._tbody,thead:()=>n._thead,tableDiv:()=>n._scroll},setters:{data:"setData",height:"setHeight"}})}setData(t){return this._zx.setData(Array.isArray(t)?t:[]),this}addData(t){return this._zx.addData(Array.isArray(t)?t:[t]),this}empty(){return this._zx.empty(),this}setSort(t,e,s=!1){let r=String(typeof t=="object"?t.id:t);return this._zx.setSort(r,e,{silent:!!s}),this._filter=this._legacyColumn(r),this._filter.mode=this._zx._sort?.dir??e??"asc",this}getFilter(){return this._filter??!1}getData(){return this._zx.getData()}setHeight(t){let e=typeof t=="number"?`${t}px`:String(t);return this._zx._scroll.style.blockSize=e,this}_legacyColumn(t){return this._cols.find(e=>String(e.id)===String(t))??{id:t}}},ti=class extends Xs{static legacyName="gx.zeyos.Table"},ei=class extends Xs{static legacyName="gx.bootstrap.Table"},si=class extends v{static legacyName="gx.ui.SimpleTable";constructor(t,e={}){t&&typeof t=="object"&&!t.nodeType&&!Array.isArray(t)&&(e=t,t=null),super(e,{cols:[],data:[]});let s={...e,rowId:n=>n};typeof e.structure=="function"&&(s.structure=(n,o)=>e.structure(n,o,this));let r=new pt(t,Lr(s,Na));this._attach(r,{events:{click:{type:"rowclick",args:n=>[n.row,n.index]}},ui:{table:()=>r._table,tbody:()=>r._tbody,thead:()=>r._thead}})}setData(t){return this._zx.setData(Array.isArray(t)?t:[]),this}addData(t){return this._zx.addData(Array.isArray(t)?t:[t]),this}createRow(t,e=this._zx.getData().length){let s=this._zx.getData();return s.splice(Math.max(0,e),0,t),this._zx.setData(s),this.display("tbody")?.querySelectorAll?.("tr[data-row]")?.[e]??null}addRow(t,e){return this.createRow(t,e)}updateRow(t,e){let s=this._zx.getData();return e>=0&&e<s.length&&(s[e]=t),this._zx.setData(s),this.display("tbody")?.querySelectorAll?.("tr[data-row]")?.[e]??null}removeRow(t){let e=this._zx.getData();return e.splice(t,1),this._zx.setData(e),this}getRows(){return this._zx.getData()}empty(){return this._zx.empty(),this}},ii=class extends v{static legacyName="gx.bootstrap.DataFilter";constructor(t,e={}){super(e);let s=new he(t,{data:[],filters:[],autoApply:!0});this.origin=[],this.filtered=[],this.filter=[],this._attach(s,{events:{filtered:{type:"filter",args:r=>(this.filtered=r.rows,[r.rows])}},ui:{clear:()=>s._controls,clearBtn:()=>s._clearButton}})}addSelectFilter(t,e,s,r,n){let o={type:"select",id:String(t),label:String(e),fields:Array.isArray(s)?s:[s]};return this.filter.push({identifier:t,fields:o.fields,method:n??this.selectFilter,type:"Select"}),this._zx.addFilter(o),this}addFulltextFilter(t,e,s,r,n){let o={type:"text",id:String(t),label:String(s??""),placeholder:String(s??""),fields:Array.isArray(e)?e:[e]};return this.filter.push({identifier:t,fields:o.fields,method:n??this.fulltextFilter,type:"Fulltext"}),this._zx.addFilter(o),this}addCustomElement(t){return this.toElement().insertBefore(t,this._zx._controls),this}initData(t){return this.origin=Array.isArray(t)?t:[],this._zx.setData(this.origin),this}doFilter(){return this.filtered=this._zx.apply(),this.filtered}clearFilter(){return this._zx.clear(),this}getFilter(t){return this.filter.find(e=>e.identifier==t)??null}fulltextFilter(t,e){return new RegExp(String(t),"i").test(String(e??""))}selectFilter(t,e){return t==e}};function Na(i){if(i?.nodeType||!i||typeof i!="object"||Array.isArray(i))return i;let t=document.createElement("span"),e=i.label;e?.nodeType?t.append(e):e!=null&&t.append(document.createTextNode(String(e))),i.className&&t.classList.add(...String(i.className).split(/\s+/).filter(Boolean));for(let[s,r]of Object.entries(i))["label","className","styles"].includes(s)||/^on/i.test(s)||r==null||["title","colspan","rowspan"].includes(s.toLowerCase())&&t.setAttribute(s,String(r));return t}var ri=class extends v{static legacyName="gx.zeyos.Datebox";constructor(t,e={}){super(e,{timestamp:0,unit:"milliseconds",format:["d",".","M",".","y"," ","h",":","i"]});let s=e.timestamp==null||Number(e.timestamp)===0?new Date:fe(e.timestamp,e.unit??"milliseconds"),r=Ws(e.format),n=new V(t,{value:s,format:r,time:/%[HMS]/.test(r),disabled:!!e.disabled});this._attach(n,{events:{update:{type:"change",args:()=>[this.get()]}},ui:{input:"input",fieldset:"control"},setters:{timestamp:"set",disabled:o=>o?this.disable():this.enable()}})}set(t,e=this.options.unit??"milliseconds"){return this._zx.set(fe(t,e)),this}get(t=this.options.unit??"milliseconds"){let e=this._zx.get("date");return e?t==="date"?e:t==="seconds"?e.getTime()/1e3:e.getTime():null}enable(){return this._zx.enable(),this}disable(){return this._zx.disable(),this}},Le=class extends v{static legacyName="gx.zeyos.DatePicker";static Picker=Q;constructor(t,e={}){super(e,{date:!1,format:"%a %d.%m.%Y %H:%M",return_format:"%s"});let s=fe(e.date||new Date,e.unit??"milliseconds"),r=this.constructor.Picker,n=new r(t,id(s,e,r));this._date=s,this._attach(n,{events:{select:{type:"change",args:o=>(this._date=o.date?new Date(o.date.getTime()):this._dateFromTime(o.time),[this._date])}},ui:{input:"root"},setters:{date:"set"}})}set(t){let e=fe(t,"milliseconds");return this._date=e,this.constructor.Picker===X?this._zx.set(e):this._zx.set(e),this}get(t=this.options.return_format){let e=this._readDate();return e?t==null?e:t==="%s"||t==="seconds"?Math.floor(e.getTime()/1e3):t==="date"?e:w(e,String(t)):null}getSeconds(){let t=this._readDate();return t?t.getTime()/1e3:null}setReadOnly(t){return this.toElement().setAttribute("aria-disabled",String(!!t)),this}setFormat(t,e){return this.options.format=t,this.options.timePicker=e,this}_readDate(){if(this.constructor.Picker===X){let t=this._zx.get();return t?this._dateFromTime(t):this._date}return this._zx.get()}_dateFromTime(t){let e=this._date?new Date(this._date.getTime()):new Date;return t&&e.setHours(Number(t.h)||0,Number(t.m)||0,Number(t.s)||0,0),e}},ni=class extends Le{static legacyName="gx.zeyos.DatePicker";static Picker=Q},oi=class extends Le{static legacyName="gx.zeyos.MonthPicker";static Picker=yt},ai=class extends Le{static legacyName="gx.zeyos.TimePicker";static Picker=X},Ve=class extends v{static legacyName="gx.ui.Timebox";constructor(t,e={}){super(e,{time:0,unit:"minutes",seconds:!0,prefix:!1,disabled:!1});let s=new J(t,{value:Number(e.time)||0,unit:Vr(e.unit),seconds:e.seconds!==!1,signed:!!e.prefix,disabled:!!(e.disabled||e.readonly)});this._attach(s,{events:{change:{type:"change",args:r=>[r.value]}},ui:{prefix:"sign"},setters:{time:"set",disabled:r=>r?this.disable():this.enable()}})}set(t,e=this.options.unit){return this._zx.set(t??0,Vr(e)),this}get(t=this.options.unit,e=0){let s=this._zx.get(Vr(t)),r=10**(Number(e)||0);return Math.round(s*r)/r}update(){return this.set(this.get())}enable(){return this.options.disabled=!1,this._zx.enable(),this.fireEvent("disabled",[!1]),this}disable(){return this.options.disabled=!0,this._zx.disable(),this.fireEvent("disabled",[!0]),this}disabled(){return!!this.options.disabled}setPrefix(t){let e=Math.abs(this.get());return this.set(t?e:-e),this}},li=class extends Ve{static legacyName="gx.ui.Timebox"},ci=class extends Ve{static legacyName="gx.zeyos.Timebox"},hi=class extends Ve{static legacyName="gx.bootstrap.Timebox"};function fe(i,t){if(i==null)return null;if(i instanceof Date)return new Date(i.getTime());if(typeof i=="number"||/^-?\d+(?:\.\d+)?$/.test(String(i))){let s=Number(i);return new Date(t==="seconds"?s*1e3:s)}let e=new Date(String(i));return Number.isNaN(e.getTime())?null:e}function id(i,t,e){return e===X?{value:i,seconds:/%S/.test(t.format??"")}:{value:i,min:fe(t.min??null,"milliseconds"),max:fe(t.max??null,"milliseconds"),time:e===Q&&t.timePicker!==!1,showWeekNumbers:!!t.weeknumbers}}function Vr(i){return["seconds","minutes","hours"].includes(String(i))?String(i):"minutes"}var Ea=Object.freeze({list:"list",plus:"plus",clock:"clock",range:"filter",reload:"reload",clear:"x",settings:"gear",eye:"eye",trash:"trash",fields:"list",search:"search",lock:"lock",checked:"check",question:"info"}),Da=Object.freeze({Icon(i){ui();let t=Ea[i]??(Yt[i]?i:null);if(!t)throw new RangeError(`Unsupported legacy icon: ${i}`);return _(t)},Button(i,t="",e,s={}){ui();let r=K({label:String(i??""),icon:e?Ea[e]??e:null,kind:rd(t),disabled:!!s.disabled,title:s.title,onclick:s.onclick??s.onClick});for(let n of["id","name","value"])s[n]!=null&&r.setAttribute(n,String(s[n]));return r},ButtonsGroup(i){return ui(),hs(Array.isArray(i)?i:[])}});function ui(){Oe(ui,"gx.zeyos.Factory","button/icon")}function rd(i){let t=String(i??"").toLowerCase();return t==="dark"||t==="em"?"primary":t.includes("danger")||t.includes("error")?"danger":t.includes("ghost")||t.includes("link")?"ghost":"default"}var di=class extends v{static legacyName="gx.bootstrap.Form";constructor(t,e={}){super(e,{fields:{},horizontal:["col-md-3","col-md-9"],columns:!1});let s=new ue(t,{fieldsets:[],actions:Ma(e.actions)});this._fieldsets=[],this._attach(s,{events:{submit:{type:"submit",args:r=>[r.values,this]},change:{type:"change",args:r=>[r.id,r.value,this]},invalid:{type:"invalid",args:r=>[r.errors,this]}},ui:{body:()=>s._body,actions:()=>s._actions}}),e.fields&&typeof e.fields=="object"&&this.addFieldset({fields:e.fields,title:e.title,horizontal:e.horizontal,columns:e.columns})}addFieldset(t){let e=t instanceof pe?t:new pe(null,{horizontal:this.options.horizontal,columns:this.options.columns,...t});return this._fieldsets.push(e),this._zx.addFieldset(e._zx),e}addActions(t){let e=Ma(t);if(e.length)this._zx.setActions(e);else{let s=Array.isArray(t)?t:[t];for(let r of s){let n=L(r);n?.nodeType===1&&this._zx._actions.prepend(n)}this._zx._actions.hidden=!1}return this}getValue(t){return this.getField(t)?.getValue()??null}getValues(){return Object.assign({},...this._fieldsets.map(t=>t.getValues()))}getField(t){for(let e of this._fieldsets){let s=e.getField(t);if(s)return s}return null}getFieldsets(){return this._fieldsets.slice()}setValue(t,e){return this.getField(t)?.setValue(e),this}setValues(t){for(let e of this._fieldsets)e.setValues(t);return this}setHighlights(t={},e="error"){return this._fieldsets.reduce((s,r)=>s+r.setHighlights(t,e),0)}setHintHighlights(t={},e="error"){return this.setHighlights(t,e)}reset(){for(let t of this._fieldsets)t.reset().setHighlights();return this}},pe=class extends v{static legacyName="gx.bootstrap.Fieldset";constructor(t,e={}){super(e,{fields:{},title:null,columns:1});let s=Number(e.columns)||1,r=new gt(t,{title:e.title??"",columns:Math.max(1,Math.min(3,s)),fields:{}});this._fields={},this._attach(r,{ui:{columns:()=>r._grid}}),e.fields&&typeof e.fields=="object"&&this.addFields(e.fields)}addFields(t){for(let[e,s]of Object.entries(t??{}))this.addFieldItem(e,s);return this}addFieldItem(t,e){if(this.hasField(t))throw new Error(`Field "${t}" already exists.`);let s=e;return e instanceof nt||(e?.type!=null?s=new nt({...e,id:t}):e?.field!=null?s=new nt({...e,id:t,type:e.type??"custom"}):e?.nodeType||e?._zx?s=new nt({id:t,label:t,type:"custom",field:e}):s=new nt({...e??{},id:t})),this._fields[t]=s,this._zx.addField(t,s instanceof nt?s._zx:s?._zx??s),s}addField(t,e,s={}){return this.addFieldItem(t,new nt({...s,id:t,type:e}))}clear(){return this._zx.clear(),this._fields={},this}hasField(t){return Object.hasOwn(this._fields,t)}getField(t){return this._fields[t]??null}getFields(){return{...this._fields}}getValue(t){return this._fields[t]?.getValue?.()??null}getValues(){let t={};for(let[e,s]of Object.entries(this._fields))e.startsWith("__")||(t[e]=s.getValue?.());return t}setValue(t,e){return this._fields[t]?.setValue?.(e),this}setValues(t){for(let[e,s]of Object.entries(t??{}))this.setValue(e,s);return this}reset(){for(let t of Object.values(this._fields))t.reset?.();return this}focus(t){return this._fields[t]?.focus?.(),this}setHighlights(t={},e="error"){let s=0;for(let[r,n]of Object.entries(this._fields)){let o=t?.[r];o&&typeof o=="object"?(n.setHighlight(o.label,o.type??e),s+=1):o?(n.setHighlight(o,e),s+=1):n.setHighlight()}return s}setHintHighlights(t={},e="error"){return this.setHighlights(t,e)}},nt=class extends v{static legacyName="gx.bootstrap.Field";constructor(t={}){super(t,{label:"",type:"text",description:"",default:null});let e=nd(t),s=new x(null,e);this._type=e.type,this._attach(s,{events:{setValue:{type:"change",args:r=>[r.value]},change:{type:"change",args:r=>[r.value]}},ui:{label:()=>s.el.querySelector(".zx-field__label"),field:()=>s.getInput(),controlwrapper:()=>s.el.querySelector(".zx-field__control"),highlight:()=>s.el.querySelector(".zx-field__highlight"),description:()=>s.el.querySelector(".zx-field__description"),hint:()=>s.el.querySelector(".zx-field__control")},setters:{value:"setValue",default:"setValue",disabled:"setDisabled"}})}setLabel(t){let e=this.display("label");return e&&(e.textContent=Fe(t)),this}setHelp(t){let e=this.display("description");return e&&(e.textContent=String(t??"")),this}getValue(){return this._zx.getValue()}setValue(t){return this._zx.setValue(t),this}setDisabled(t){return this._zx.setDisabled(t),this}setHighlight(t,e="warning"){return t?this._zx.setHighlight(String(t),ad(e)):this._zx.clearHighlight(),this}setHintHighlight(t,e="warning"){return this.setHighlight(t,e)}reset(){return this._zx.reset(),this}focus(){return this._zx.focus(),this}},fi=class extends v{static legacyName="gx.bootstrap.ValueList";constructor(t,e={}){super(e,{deletable:!0});let s=new zt(t,{values:e.values??e.default??[],deletable:e.deletable!==!1});this._attach(s,{events:{change:{type:"change",args:r=>[r.values]},click:{type:"add",args:r=>[r.value]}},ui:{textbox:()=>s._input,list:()=>s._list}})}addValue(t){return this._zx.addValue(t)}getValues(){return this._zx.getValues()}setValues(t){return this._zx.setValues(t??[]),this}enable(){return this._zx.enable(),this}disable(){return this._zx.disable(),this}focus(){return this._zx.focus(),this}},pi=class extends v{static legacyName="gx.bootstrap.MultiValueEditor";constructor(t,e={}){super(e,{options:!1,default:!1});let s=Ia(e.default||e.values||e.options),r=new wt(t,{values:s,options:null});this._attach(r,{events:{change:{type:"change",args:n=>[JSON.stringify(n.values)]}},ui:{optionsbox:()=>r._rows,btnAdd:()=>r._add}})}getValue(){return JSON.stringify(this._zx.getValues())}setValue(t){return this._zx.setValues(Ia(t)),this}},mi=class extends v{static legacyName="gx.bootstrap.FieldUpload";constructor(t={}){super(t,{inputname:"upload",uploadurl:"./index.php",params:{},imageurl:""});let e=new vt(null,{url:t.uploadurl??t.url??"./index.php",paramName:t.inputname??t.paramName??"upload",params:t.params??{},accept:t.accept??null,multiple:!!t.multiple,autoUpload:t.autoUpload!==!1,http:t.http??null});this._value=null,this._attach(e,{events:{success:{type:"success",args:s=>(this._handleResponse(s.response),[s.response])},failure:{type:"error",args:s=>(t.showError?.(this,s.error),[s.error])},progress:{type:"progress",args:s=>[s.percent]}},ui:{select:()=>e._input,placeholder:()=>e._preview,progress:()=>e._progress}}),t.default&&this.setValue(t.default),t.disabled&&this.setDisabled(!0)}setValue(t){return this._value=t,this.setImage(t),this}getValue(){return null}setImage(t){if(this._zx._preview.replaceChildren(),t){let e=document.createElement("img");e.src=String(this.options.imageurl??"")+String(t),e.alt="",this._zx._preview.append(e)}return this}setDisabled(t){return this._zx.setDisabled(t),this}reset(){return this._zx.clear(),this}_handleResponse(t){typeof this.options.parseResponse=="function"&&this.options.parseResponse(this,t,e=>{e!=null&&this.setValue(e)})}};function nd(i){let t=Ca(i),e=i.options&&typeof i.options=="object"&&!Array.isArray(i.options)?i.options:{};if(i.field!=null||typeof i.type!="string"&&i.type!=null){let s=i.field??i.type,r=typeof s=="function"?new s(null,Object.keys(e).length?e:i):s;return t.type="custom",t.adapter=()=>od(r),t}if(t.type==="zxselect")t.props=Ys({...e,...i}),t.props.items=Array.isArray(i.data)?i.data:e.data??[],t.props.valueKey=i.elementIndex??e.elementIndex??"ID",t.props.labelKey=i.elementLabel??e.elementLabel??"name";else if(t.type==="checklist")t.props=Us(Object.keys(e).length?e:i),t.props.items=e.data??i.data??[];else if(t.type==="date"||t.type==="datetime"){let s=Object.keys(e).length?e:i;t.props={format:Ws(s.format??"%d.%m.%Y"),time:t.type==="datetime"},t.value=Oa(t.value??s.date)}else if(t.type==="month")t.props={...e},t.value=Oa(t.value??e.date??i.date);else if(t.type==="time"){let s=Object.keys(e).length?e:i;t.props={unit:s.unit??"minutes",seconds:s.seconds!==!1,signed:!!s.prefix},t.value=t.value??s.time??0}else t.type==="html"&&(t.value=L(i.content??t.value));return t}function od(i){let t=i?._zx?.toElement?.()??i?.toElement?.()??i;if(!t?.nodeType)throw new TypeError("Custom legacy field must provide a DOM element");return{el:t,get:()=>i?.getValue?.()??i?.getValues?.()??i?.get?.()??("value"in t?t.value:null),set:e=>{typeof i?.setValue=="function"?i.setValue(e):typeof i?.setValues=="function"?i.setValues(e):typeof i?.set=="function"?i.set(e):"value"in t&&(t.value=e==null?"":String(e))},focus:()=>i?.focus?.()??t.focus?.(),setDisabled:e=>{typeof i?.setDisabled=="function"?i.setDisabled(e):e?i?.disable?.():i?.enable?.(),"disabled"in t&&(t.disabled=e)}}}function Ma(i){return(Array.isArray(i)?i:i&&typeof i=="object"&&!i.nodeType?Object.values(i):[]).filter(e=>e&&typeof e=="object"&&!e.nodeType&&!e.tag).map((e,s)=>({id:e.id??String(s),label:e.label??e.text??"",icon:e.icon??null,kind:ld(e.kind??e.type??(e.primary?"primary":"default")),type:e.submit?"submit":e.type==="reset"?"reset":"button",onClick:e.onClick??e.onclick??e.click}))}function ad(i){let t=String(i??"").toLowerCase();return t==="error"||t==="danger"?"danger":t==="success"||t==="primary"?"success":t==="warning"?"warning":"default"}function ld(i){let t=String(i??"").toLowerCase();return t==="error"||t==="danger"?"danger":t==="primary"||t==="success"?"primary":t==="ghost"||t==="link"?"ghost":"default"}function Ia(i){if(Array.isArray(i))return i;if(!i)return[];try{let t=JSON.parse(String(i));return Array.isArray(t)?t:[]}catch{return[]}}function Oa(i){if(i instanceof Date||i==null)return i;if(typeof i=="number")return new Date(i*(Math.abs(i)<1e12?1e3:1));let t=new Date(String(i));return Number.isNaN(t.getTime())?null:t}var _i=class extends v{static legacyName="gx.zeyos.Client";constructor(t={}){super(t,{url:"./remotecall.php"}),this._http=new et({base:String(t.url??"./remotecall.php"),headers:t.headers??{},timeout:t.timeout??3e4})}post(t,e,s,r){return this.request(e,"POST",s,r,t)}get(t,e,s,r){return this.request(e,"GET",s,r,t)}async request(t,e="GET",s,r,n=""){cd(this,s),this.fireEvent("request");try{let o=String(e).toUpperCase(),l=await this._http.request(String(n??""),o==="GET"?{method:o,query:t}:{method:o,data:t});if(r&&hd(l)!==r)throw new TypeError(`Invalid server response: expected ${r}`);return typeof s=="function"&&s.call(this,l),this.fireEvent("success",[l]),l}catch(o){throw this.fireEvent("failure",[o]),o}finally{this.fireEvent("complete")}}},gi=class extends v{static legacyName="gx.zeyos.Request";constructor(t={}){super(t,{service:!1,accesskey:!1}),this._files=null,this.setService(t.service??"",t.accesskey??""),typeof t.showError=="function"&&(this.showError=t.showError)}setService(t,e=""){return this.options.service=t,this.options.accesskey=e,this.baseUrl=`${this.options.apiBase??"../remotecall/"}${t}${e?`:${e}`:""}/`,this._http=Rt(String(t),String(e),{apiBase:this.options.apiBase??"../remotecall/",headers:this.options.headers??{},timeout:this.options.timeout??3e4}),this}async send(t,e,s,r="GET"){this.fireEvent("request");try{let n=String(r??"GET").toUpperCase(),o={method:n};n==="GET"?o.query=e:o.data=e,this._files&&(o.files=this._files);let l=await this._http.request(String(t??""),o);return this._files=null,this.fireEvent("success",[l]),s?.call(this,l,"200 OK"),l}catch(n){this._files=null;let o=n instanceof Error?n:new Error(String(n));throw this.fireEvent("failure",[o]),this.fireEvent("error",[o.message,o.response??null,o.response?.headers??null]),this.fireEvent("exception",[o,null]),this.showError?.(o.message),o}finally{this.fireEvent("complete")}}post(t,e,s){return this.send(t,e,s,"POST")}get(t,e,s){return this.send(t,e,s,"GET")}put(t,e,s){return this.send(t,e,s,"PUT")}delete(t,e,s){return this.send(t,e,s,"DELETE")}upload(t,e,s,r){return this._files=ud(s),this.send(t,e,r,"POST")}openLink(t){return window.open(this.baseUrl+String(t??""),"_blank")}showError(t){console.error(t)}};function cd(i,t){if(!(!t||typeof t!="object"))for(let[e,s]of Object.entries(t))i.addEvent(e,s)}function hd(i){return Array.isArray(i)?"array":i===null?"null":typeof i=="object"?"object":typeof i}function ud(i){return(i==null?[]:Array.from(i)).flatMap(e=>typeof File<"u"&&e instanceof File?[e]:e?.files?Array.from(e.files):[])}var bi=class extends v{static legacyName="gx.zeyos.Groupbox";constructor(t,e={}){super(e,{title:"",open:!0});let s=new ct(ut(t),{title:String(e.title??""),open:e.open!==!1});this._attach(s,{events:{open:{type:"open",args:()=>[this]},close:{type:"close",args:()=>[this]}},ui:{title:"summary",inner:"content"},setters:{title:"setTitle",open:r=>r?this.open():this.close()}}),Object.hasOwn(e,"content")&&s.setContent(L(e.content)),this._syncAct()}toggle(){return this._zx.toggle(),this._syncAct(),this}open(){return this._zx.open(),this._syncAct(),this}close(){return this._zx.close(),this._syncAct(),this}isOpen(){return this._zx.isOpen()}setTitle(t){return this._zx.setTitle(t),this}_syncAct(){this._mirrorAct(this.display("title"),this.isOpen())}},yi=class extends v{static legacyName="gx.zeyos.Panel";constructor(t,e="",s=null,r=!0){super({title:e,content:s,open:r});let n=new re(ut(t),{title:String(e??""),content:L(s),open:r!==!1});this._attach(n,{events:{open:"open",close:"close"},ui:{title:"toggle",header:"header",inner:"content",content:"content"},setters:{title:"setTitle",content:"setContent",open:o=>o?this.open():this.close()}})}toggle(){return this._zx.toggle(),this}open(){return this._zx.open(),this}close(){return this._zx.close(),this}isOpen(){return this._zx.isOpen()}setContent(t){return this._zx.setContent(L(t)),this}setTitle(t){return this._zx.setTitle(t),this}},xi=class extends v{static legacyName="gx.zeyos.MasterPanel";constructor(t,e="",s=null,r=[]){super({title:e,content:s,buttons:r});let n=new ne(ut(t),{title:String(e??""),content:L(s),buttons:zi(r)});this._attach(n,{ui:{title:"title",inner:"content",content:"content",buttons:"buttons"},setters:{title:"setTitle",content:"setContent",buttons:o=>n.setButtons(zi(o))}})}setContent(t){return this._zx.setContent(L(t)),this}setTitle(t){return this._zx.setTitle(t),this}},Re=class extends v{static legacyName="gx.zeyos.Tabbox";constructor(t,e={}){super(e,{frames:[],show:1});let s=ka(e),r=new Ct(ut(t),{tabs:s.tabs.map(Ai),active:s.active});this._attach(r,{events:{change:{type:"change",args:n=>Dt.tabChange(n)},close:{type:"close",args:n=>[n.name]}},ui:{tablist:"tablist",content:"panels",div:"tablist"},setters:{show:"openTab",height:n=>this.setStyle("height",n)}}),s.height!=null&&this.setStyle("height",s.height),r.on("change",()=>queueMicrotask(()=>this._syncAct())),this._syncAct()}addTab(t,e,s){let r=typeof t=="object"?t:{name:t,title:e,content:s};return this._zx.addTab(Ai(r)),this._syncAct(),this}closeTab(t){return this._zx.removeTab(String(t)),this._syncAct(),this}openTab(t){let e=typeof t=="number"?this._zx._tabs?.[t-1]?.definition.name:String(t);return e&&this._zx.openTab(e),this._syncAct(),this}setTabTitle(t,e){return this._zx.setTitle(String(t),e),this}setHighlight(t,e,s){return this._zx.setBadge(String(t),e==null||e===""?null:String(e)),this}getActive(){return this._zx.getActive()}_syncAct(){for(let t of this.display("tablist")?.querySelectorAll?.('[role="tab"]')??[])this._mirrorAct(t,t.getAttribute("aria-selected")==="true")}},vi=class extends Re{static legacyName="gx.bootstrap.Tabbox"},wi=class extends v{static legacyName="gx.bootstrap.NavigationBar";constructor(t,e={}){super(e,{frames:[],title:"",buttons:[]});let s=Array.isArray(e.frames)?e.frames:[];this._frames=s.map(o=>({...o}));let r=typeof e.show=="number"?s[e.show-1]?.name:e.show,n=new oe(ut(t),{title:String(e.title??""),items:s.map(Ai),active:r==null?null:String(r),actions:zi(e.buttons??[])});this._attach(n,{events:{change:{type:"change",args:o=>[o.name]}},ui:{title:"title",tablist:"items",content:"panels",buttons:"actions"},setters:{title:"setTitle"}}),n.on("change",()=>queueMicrotask(()=>this._syncAct())),this._syncAct()}addTab(t,e,s){let r=typeof t=="object"?{...t}:{name:t,title:e,content:s};return this._frames.push(r),this._rebuild(),this}closeTab(t){return this._frames=this._frames.filter(e=>String(e.name)!==String(t)),this._rebuild(),this}openTab(t){return this._zx.setActive(String(t)),this._syncAct(),this}setTitle(t){return this._zx.setTitle(typeof t=="string"?t:t?.textContent??""),this}setTabTitle(t,e){let s=this._frames.find(r=>String(r.name)===String(t));return s&&(s.title=e),this._rebuild(),this}setNavigationButtons(t){return this._zx.setActions(zi(t)),this}setHighlight(t,e,s){return this._zx.setBadge(String(t),e==null||e===""?null:String(e)),this}_rebuild(){let t=this._zx._activeName;this._zx.setItems(this._frames.map(Ai)),t&&this._frames.some(e=>String(e.name)===String(t))&&this._zx.setActive(t),this._syncAct()}_syncAct(){for(let t of this.display("tablist")?.querySelectorAll?.('[role="tab"]')??[])this._mirrorAct(t,t.getAttribute("aria-selected")==="true")}},Si=class extends v{static legacyName="gx.zeyos.Search";constructor(t={}){super(t);let e=new kt(null,{placeholder:t.placeholder??"",debounce:t.debounce??0});this._attach(e,{events:{input:{type:"input",args:(s,r)=>[this,e.refs.input,r]}},ui:{input:"input",submit:"submit",button:"submit"}}),this._listen(e.refs.input,"keydown",s=>{s.key==="Enter"&&this.fireEvent("keypress",[this,e.refs.input,s])}),this._listen(e.refs.submit,"click",s=>this.fireEvent("click",[this,e.refs.input,s]))}get(){return this._zx.get()}set(t){return this._zx.set(t),this}};function Ai(i){let t=L(i.content);return(typeof t=="string"||typeof t=="number"||t==null)&&(t=document.createTextNode(t==null?"":String(t))),{name:String(i.name??""),title:String(i.title??""),content:t,closable:!!i.closable,disabled:!!i.disabled}}function zi(i){return(Array.isArray(i)?i:[i]).filter(Boolean).map(t=>t?.toElement?.()??t).filter(t=>t?.nodeType===1)}var ot=class extends v{static legacyName="gx.zeyos.Select";static filterMode=!1;constructor(t,e={}){super(e,{data:[],elementIndex:"ID",elementLabel:"name",elementSelect:"name",value:null});let s=Ys(e);s.items=dd(e),s.valueKey=fd(e.elementIndex??"ID"),s.labelKey=pd(e.elementLabel??"name"),s.renderItem=typeof e.elementLabel=="function"?e.elementLabel:null,s.renderValue=md(e.elementSelect??e.elementLabel??"name"),s.value=e.value??null,s.filter=this.constructor.filterMode==="local"?"local":["async","rest"].includes(this.constructor.filterMode)?n=>this._load(n):!1,s.debounce=e.debounce??200;let r=this.constructor.filterMode==="priority"?I.priority(t,s):new I(t,s);this._attach(r,{events:{select:{type:"change",filter:n=>n.item!=null,args:n=>Dt.select(n,this)},noselect:{type:"change",filter:n=>n.item==null,args:n=>Dt.noselect(n,this)},show:{type:"open",args:()=>[this]},hide:{type:"close",args:()=>[this]},requestSuccess:{type:"loaded",args:n=>[n.items]}},ui:{fieldset:"control",textbox:"input",dropdown:"list",icon:"toggle"},setters:{data:"setData",value:"setId",disabled:n=>n?this.disable():this.enable()}}),this._http=null,this.data=s.items}set(t,e=!1){return this._zx.set(t,{silent:!!e}),this}setId(t,e=!1){let s=this.data?.find(r=>Fi(r,this.options.elementIndex??"ID")==t);return this._zx.set(s??t,{silent:!!e}),this}getId(t){return t==null?this._zx.value:Fi(t,this.options.elementIndex??"ID")}getValue(){return this._zx.value}getSelected(){return this._zx.selected}setData(t){return this.data=Array.isArray(t)?t.slice():[],this._zx.setItems(this.data),this}getRows(){return Array.from(this.display("dropdown")?.querySelectorAll?.('[role="option"]')??[])}reset(t=!1){return this._zx.set(null,{silent:!!t}),this}enable(){return this._zx.enable(),this}disable(){return this._zx.disable(),this}show(){return this._zx.open(),this}hide(){return this._zx.close(),this}isOpen(){return this.toElement().getAttribute("data-state")==="open"}search(){return this._zx.open(),this}showLoader(){return this}hideLoader(){return this}async _load(t){try{let e=this.constructor.filterMode==="rest"?await this._loadRest(t):await this._loadUrl(t),s=Array.isArray(e)?e:[];return this.data=s,s}catch(e){throw this.fireEvent("requestFailure",[e]),e}}_loadUrl(t){this._http??=new et({headers:this.options.requestHeader??{}});let e={...this.options.requestData??{}},s=typeof this.options.queryParam=="function"?this.options.queryParam(t,e):{...e,[this.options.queryParam??"query"]:t},r=String(this.options.method??"GET").toUpperCase();return this._http.request(String(this.options.url??"./"),r==="GET"?{method:r,query:s}:{method:r,data:s})}_loadRest(t){return this._http??=Rt(String(this.options.entity??""),String(this.options.accesskey??""),{apiBase:this.options.apiBase??"../remotecall/"}),this._http.get("",{...this.options.requestData??{},search:t,limit:this.options.limit??50})}},ki=class extends ot{static legacyName="gx.zeyos.Select"},Ci=class extends ot{static legacyName="gx.zeyos.SelectFilter";static filterMode="local"},Ti=class extends ot{static legacyName="gx.zeyos.SelectDyn";static filterMode="async"},Ni=class extends ot{static legacyName="gx.zeyos.SelectPrio";static filterMode="priority"},Ei=class extends ot{static legacyName="gx.bootstrap.Select"},Di=class extends ot{static legacyName="gx.bootstrap.SelectFilter";static filterMode="local"},Mi=class extends ot{static legacyName="gx.bootstrap.SelectDyn";static filterMode="async"},Ii=class extends ot{static legacyName="gx.bootstrap.SelectDynREST";static filterMode="rest";async setEntityId(t){let e=this.data?.find(s=>Object.is(Fi(s,this.options.elementIndex??"ID"),t));if(e){this.set(e);return}if(!(t==null||t===""))try{this._http??=Rt(String(this.options.entity??""),String(this.options.accesskey??""),{apiBase:this.options.apiBase??"../remotecall/"});let s=await this._http.get(String(t));s&&this.set(s)}catch(s){throw this.fireEvent("requestFailure",[s]),s}}},Oi=class extends ot{static legacyName="gx.bootstrap.SelectPrio";static filterMode="priority"};function dd(i){let t=Array.isArray(i.data)?i.data.slice():[];return i.elementDefault==null?t:[i.elementDefault,...t]}function fd(i){return typeof i=="function"?i:String(i)}function pd(i){return typeof i!="function"?String(i):t=>Fa(i(t))}function md(i){return t=>Fa(Fi(t,i))}function Fi(i,t){return typeof t=="function"?t(i):i?.[t]}function Fa(i){return i?.nodeType?i.textContent??"":String(i??"")}function Mt(i,t){return class{constructor(){throw new Error(`${i} is not emulated by Zx; migrate to ${t}`)}}}var La=Mt("gx.core.Settings","plain option objects"),Va=Mt("gx.ui.Container","zx.Component"),Ra=Mt("gx.ui.Collapse","CSS transitions"),Pa=Mt("gx.ui.Blend","CSS transitions"),Ba=Mt("gx.ui.Hud","zx.Dialog"),ja=Mt("gx.ui.Toggling","zx.Toggle"),Ha=Mt("gx.ui.HGroup","CSS layout"),qa=Mt("gx.ui.Templates","native template elements");var $a=Object.freeze({initValue:_d,initNum:gd,formatTime:bd,getMinutes:yd,formatNum:xd,getNumber:vd,printf:wd,parseResult:Sd,Parse:bt,isArray:Array.isArray,isObject:i=>i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(typeof Node<"u"&&i instanceof Node)&&!(i instanceof Date),isFunction:i=>typeof i=="function",isString:i=>typeof i=="string",isNumber:i=>typeof i=="number"&&Number.isFinite(i),isElement:i=>typeof Element<"u"&&i instanceof Element,isNode:i=>typeof Node<"u"&&i instanceof Node,Console:(i,t)=>{typeof console>"u"||(t instanceof Error?console.error(i,t.stack):console.log(`${i}: ${t}`))}});function _d(i,t,e){return i?.[t]==null?e:i[t]}function gd(i){return typeof i=="number"?i:typeof i=="string"?Number.parseFloat(i):0}function bd(i){let t=i;if(typeof t=="string"){if(/^[0-9]+:[0-9]{2}$/.test(t))return t;if(/^[0-9]+:[0-9]{2,}$/.test(t))return t.replace(/[^0-9]/g,"").replace(/([0-9]{2})$/,":$1");t=Number.parseInt(t.replace(/[^0-9]/g,""),10)}if(t==null||Number.isNaN(Number(t)))return"0:00";let e=Number(t),s=e<0?"-":"";return e=Math.abs(e),`${s}${Math.floor(e/60)}:${Ad(e%60)}`}function yd(i){let t=String(i??"").replace(/[^0-9:]/,"").split(":");return t.length===1?Number.parseInt(t[0],10):Number.parseInt(t[0],10)*60+Number.parseInt(t[1],10)}function xd(i,t=".",e=",",s=2){let r=i;typeof r=="string"&&(r=Number.parseFloat(r.replace(new RegExp(`[^0-9${Ka(t)}]`),"").replace(t,"."))),Number.isNaN(Number(r))&&(r=0);let n=typeof s=="number"?s:2,o=Math.round(Number(r)*10**n).toString();for(let c=o.length;c<=n;c+=1)o=`0${o}`;let l=o.length-n;n>0&&(o=`${o.slice(0,l)}${t}${o.slice(l)}`);for(let c=l-3;c>0;c-=3)o=`${o.slice(0,c)}${e}${o.slice(c)}`;return o}function vd(i,t="."){return Number.parseFloat(String(i??"").replace(new RegExp(`[^0-9${Ka(t)}]`),"").replace(t,"."))}function wd(i,t=[]){let e=Array.isArray(t)?t:[t],s=0;return String(i??"").replace(/%arg%/g,r=>s<e.length?String(e[s++]):r)}function Sd(i){let t=typeof i=="string"?JSON.parse(i):i;if(!t||typeof t!="object")throw new Error("Invalid server response");if(t.error)throw new Error(String(t.error.message??t.error));if(!Object.hasOwn(t,"result")||t.result==null)throw new Error("Undefined result");return t.result}function Ad(i){return String(i).padStart(2,"0")}function Ka(i){return String(i).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var zd=Object.freeze({installGlobals:ya,installElementStorage:Et,parse:bt,GxWrapper:v}),Li={core:{Settings:La},ui:{Container:Va,SimpleTable:si,Timebox:li,Collapse:Ra,Blend:Pa,Hud:Ba,Toggling:ja,HGroup:Ha,Templates:qa},util:$a,zeyos:{Toggle:Ls,Msgbox:Vs,Popup:Bs,Dialog:js,Dropdown:Hs,Select:ki,SelectFilter:Ci,SelectDyn:Ti,SelectPrio:Ni,Checklist:Qs,Permission:Js,Table:ti,Tabbox:Re,Panel:yi,MasterPanel:xi,Groupbox:bi,Search:Si,Datebox:ri,DatePicker:ni,TimePicker:ai,MonthPicker:oi,Timebox:ci,Client:_i,Request:gi,Factory:Da},bootstrap:{Message:Rs,Popup:de,PopupAlert:Or,PopupConfirm:Fr,PopupConfirmCanceled:Ir,MenuButton:qs,CheckButton:$s,Select:Ei,SelectFilter:Di,SelectDyn:Mi,SelectDynREST:Ii,SelectPrio:Oi,Checklist:Zs,Table:ei,Tabbox:vi,NavigationBar:wi,Timebox:hi,Form:di,Fieldset:pe,Field:nt,ValueList:fi,MultiValueEditor:pi,FieldUpload:mi,DataFilter:ii},compat:zd};function Rr(i=globalThis){return Et(i),i.gx=Li,Li}Li.install=Rr;var Ya=Li;var Pr=typeof window>"u"?globalThis:window;Et(Pr);Rr(Pr);Pr.zx=Nr;var Kv=Ya;})();
|