@base-framework/base 3.9.29 → 3.9.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.js +1 -1
- package/dist/chunks/chunk-Q6JWDJYV.js +2 -0
- package/dist/modules/component.js +1 -1
- package/dist/modules/router.js +1 -1
- package/dist/types/modules/router/routes/component-helper.d.ts +6 -0
- package/dist/types/modules/router/routes/element-scroll.d.ts +2 -0
- package/package.json +1 -1
package/dist/base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var at=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var fs=Object.prototype.toString,wt=Object.prototype.hasOwnProperty,v={create(s){return Object.create(s||null)},extendObject(s,t){if(!s||typeof s!="object"||!t||typeof t!="object")return!1;for(let e in s)wt.call(s,e)&&!wt.call(t,e)&&(t[e]=s[e]);return t},clone(s){if(!s||typeof s!="object")return{};try{return structuredClone(s)}catch{return JSON.parse(JSON.stringify(s))}},getClassObject(s){return typeof s=="function"?s.prototype:s},extendClass(s,t){let e=this.getClassObject(s),r=this.getClassObject(t);if(typeof e!="object"||typeof r!="object")return!1;let n=Object.create(e);for(let i in r)n[i]=r[i];return n},hasOwnProp(s,t){return wt.call(s,t)},isPlainObject(s){return!!s&&fs.call(s)==="[object Object]"},isEmpty(s){if(!s||typeof s!="object"||Array.isArray(s))return!0;if(s instanceof Map||s instanceof Set)return s.size===0;for(let t in s)if(wt.call(s,t))return!1;return!0}};var w=class{static getType(t){let e=typeof t;return e!=="object"?e:Array.isArray(t)?"array":"object"}static isUndefined(t){return typeof t>"u"}static isObject(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var ct={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||!1},remove(s){delete this.types[s]}};var Ct=class{constructor(){this.types=new Map}add(t,e){let r=this.types.get(t);r||(r=[],this.types.set(t,r)),r.push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeType(t){let e=this.types.get(t);if(!e)return;if(!e.length){this.types.delete(t);return}let r,n=ct.get(t);if(n){for(let i=0,o=e.length;i<o;i++)r=e[i],r&&(e[i]=null,typeof n=="function"&&n(r));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}let e=this.types.keys();for(let r of e)r&&this.removeType(r);this.types.clear()}};var V=new WeakMap,Fe=new WeakMap,At=s=>!!s&&(typeof s=="object"||typeof s=="function"),p=class{static trackingCount=0;static addType(t,e){ct.add(t,e)}static removeType(t){ct.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=Fe.get(t);return e||(e="dt"+this.trackingCount++,Fe.set(t,e)),e}static add(t,e,r){At(t)&&this.find(t).add(e,r)}static get(t,e){let r=At(t)?V.get(t):void 0;return r?e?r.get(e):r:!1}static has(t,e){let r=At(t)?V.get(t):void 0;return r&&e?r.has(e):!1}static find(t){let e=V.get(t);return e||(e=new Ct,V.set(t,e)),e}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let r=At(t)?V.get(t):void 0;if(r){if(!e){r.remove(),V.delete(t);return}r.remove(e),this.isEmpty(r.types)&&V.delete(t)}}};var d={getEvents(s){return typeof s!="object"||s===null?[]:p.get(s,"events")},create(s,t,e,r=!1,n=!1,i=null){return{event:s,obj:t,fn:e,capture:r,swapped:n,originalFn:i}},on(s,t,e,r){if(Array.isArray(s))for(let n=0,i=s.length;n<i;n++)this.add(s[n],t,e,r);else this.add(s,t,e,r);return this},off(s,t,e,r){if(Array.isArray(s))for(let n=0,i=s.length;n<i;n++)this.remove(s[n],t,e,r);else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,n=!1,i=null){if(typeof t!="object"||t===null)return this;let o=this.create(s,t,e,r,n,i);return p.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let n=this.getEvent(s,t,e,r);if(n===!1)return this;if(typeof n=="object"){this.removeEvent(n);let i=this.getEvents(t);if(i){let o=i.indexOf(n);o>-1&&i.splice(o,1),i.length===0&&p.remove(t,"events")}}return this},removeEvent(s){return typeof s=="object"&&s.obj.removeEventListener(s.event,s.fn,s.capture),this},getEvent(s,t,e,r){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(s,t,e,r);return this.search(i,n)},search(s,t){let e,r=this.isSwappable(s.event);for(let n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==s.event||e.obj!==s.obj)&&(e.fn===s.fn||r===!0&&e.originalFn===s.fn))return e;return!1},removeEvents(s){return typeof s!="object"||s===null?this:(p.remove(s,"events"),this)},swap:new Set(["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"]),addSwapped(s){this.swap.add(s)},isSwappable(s){return this.swap.has(s)}};p.addType("events",s=>{d.removeEvent(s)});var ze={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},qe=Object.keys(ze),ds={events:d,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let n=this.events;if(Array.isArray(s))for(let i=0,o=s.length;i<o;i++)n.add(s[i],t,e,r);else n.add(s,t,e,r);return this},off(s,t,e,r){let n=this.events;if(Array.isArray(s))for(let i=0,o=s.length;i<o;i++)n.remove(s[i],t,e,r);else n.remove(s,t,e,r);return this},removeListener(s,t,e,r){return this.events.remove(s,t,e,r),this},_createEvent(s,t,e,r){let n;switch(t){case"HTMLEvents":n=new Event(s,e);break;case"MouseEvents":n=new MouseEvent(s,e);break;default:n=new CustomEvent(s,r);break}return n},createEvent(s,t,e,r){if(typeof t!="object"||t===null)return!1;let n={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};typeof e=="object"&&e!==null&&(n=Object.assign(n,e));let i=this._getEventType(s);return this._createEvent(s,i,n,r)},_getEventType(s){for(let t=0,e=qe.length;t<e;t++){let r=qe[t];if(ze[r].test(s))return r}return"CustomEvent"},trigger(s,t,e){if(typeof t!="object"||t===null)return this;let r=typeof s=="string"?this.createEvent(s,t,null,e):s;return t.dispatchEvent(r),this},mouseWheelEventType:null,getWheelEventType(){let s=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=s())},onMouseWheel(s,t,e,r=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof s=="function"&&s(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,r,!0,s),this},offMouseWheel(s,t,e=!1){typeof t>"u"&&(t=window);let r=this.getWheelEventType();return this.off(r,t,s,e),this},preventDefault(s){return typeof s.preventDefault=="function"?s.preventDefault():s.returnValue=!1,this},stopPropagation(s){return typeof s.stopPropagation=="function"?s.stopPropagation():s.cancelBubble=!0,this}};var lt=class{constructor(){this.errors=[],this.dataTracker=p}augment(t){if(!w.isObject(t))return this;let e=this.constructor.prototype;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,n){return(t[e]=r).apply(t,at.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(w.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof r<"u"?r:""}createCallBack(t,e,r=[],n=!1){return typeof e!="function"?!1:(...i)=>(n===!0&&(r=r.concat(i)),e.apply(t,r))}bind(t,e){return e.bind(t)}};lt.prototype.extend=(function(){return lt.prototype})();var U=new lt;var ut={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};var Ge=()=>{U.augment({xhrSettings:ut,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=v.extendClass(U.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=ut}})};var C=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,r=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let n={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(o,a,c,l){let u=l===void 0?"":l;if(e!==!1)try{n[a]=decodeURIComponent(u)}catch{n[a]=u}else n[a]=u}),n}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,r=>r[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let r=/([A-Z]{1,})/g;return t.replace(r,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,r=>r.charAt(0).toUpperCase()+r.substring(1).toLowerCase())}};var Tt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:r,url:n,async:i}=this.settings;e.open(r,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=ut.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}setupParams(t,e=null){let r=typeof t;if(!e)return!(t instanceof FormData)&&r==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(r==="string")return n!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(n==="string"&&(e=C.parseQueryString(e,!1)),t instanceof FormData)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.append(i,e[i]);else r==="object"&&(t=Object.assign({},e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,r=t.params;return r?r=this.setupParams(r,e):e&&(r=this.setupParams(e)),r}getXhrSettings(t){let e=this.settings={...U.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var r=0,n=t.length;r<n;r++){var i=t[r];switch(r){case 0:e.url=i;break;case 1:e.params=i;break;case 2:e.completed=i,e.failed=i;break;case 3:e.responseType=i||"json";break;case 4:e.method=i?i.toUpperCase():"POST";break;case 5:e.async=typeof i<"u"?i:!0;break}}else e=this.settings=v.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){let t=this.settings;if(!t||typeof t.headers!="object")return;let e=t.headers;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.xhr?.setRequestHeader(r,e[r])}update(t,e){let r=this.xhr,n=()=>{d.removeEvents(r?.upload),d.removeEvents(r)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":{if((r?.status??0)>=400){typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break}if(typeof i.completed=="function"){let c=this.getResponseData();i.completed(c,this.xhr)}n();break}case"error":typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break;case"progress":typeof i.progress=="function"&&i.progress(t);break;case"abort":typeof i.aborted=="function"&&i.aborted(!1,this.xhr),n();break}}getResponseData(){let t=this.xhr;if(!t)return null;let e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr;if(!e)return;let r=this.update.bind(this);d.on(["load","error","abort"],e,r),d.on("progress",e.upload,r)}};Ge();var ht=(...s)=>new Tt(s).xhr;var ps=(s,t)=>{if(s===t)return!1;try{return JSON.stringify(s)!==JSON.stringify(t)}catch{return!0}},he=class{constructor({max:t=100,ttl:e=3e4}={}){this.entries=new Map,this.max=t,this.defaultTtl=e}get size(){return this.entries.size}setMax(t){this.max=Math.max(1,Number(t)||1),this.evict()}getEntry(t){let e=this.entries.get(t);return e?(this.entries.delete(t),this.entries.set(t,e),e):null}createEntry(t){let e={value:void 0,meta:null,time:0,ttl:this.defaultTtl,hasValue:!1,promise:null};return this.entries.delete(t),this.entries.set(t,e),this.evict(),e}evict(){let t=Math.max(1,this.max);for(;this.entries.size>t;){let e=this.entries.keys().next().value;this.entries.delete(e)}}isFresh(t){return!!t&&t.hasValue&&Date.now()-t.time<t.ttl}has(t){return this.isFresh(this.entries.get(t)||null)}get(t){let e=this.getEntry(t);return this.isFresh(e)?e.value:void 0}set(t,e,r,n=null){let i=this.getEntry(t)||this.createEntry(t);i.value=e,i.meta=n,i.time=Date.now(),i.ttl=typeof r=="number"?r:this.defaultTtl,i.hasValue=!0}invalidate(t){if(Array.isArray(t))return t.reduce((n,i)=>n+this.invalidate(i),0);let e=null;if(typeof t=="string"?e=n=>n.startsWith(t):t instanceof RegExp?e=n=>t.test(n):typeof t=="function"&&(e=t),!e)return 0;let r=0;for(let[n,i]of Array.from(this.entries))e(n,i)&&(this.entries.delete(n),r++);return r}clear(){this.entries.clear()}fetch(t,e,r,n){let i,o=e.promise=new Promise(l=>i=l),a=!1,c=(l,u,h)=>{a||(a=!0,i({ok:l===!0,value:u,meta:h}))};o.then(l=>{if(e.promise===o&&(e.promise=null),this.entries.get(t)===e){if(l.ok){e.value=l.value,e.meta=l.meta,e.time=Date.now(),e.ttl=n,e.hasValue=!0;return}e.hasValue||this.entries.delete(t)}});try{return r(c)}catch(l){return c(!1,void 0,l),null}}resolve(t,e,r,n){r=r||{};let i=typeof r.ttl=="number"?r.ttl:this.defaultTtl,o=this.getEntry(t);if(o&&o.hasValue){if(this.isFresh(o)){let{value:c,meta:l}=o;return queueMicrotask(()=>n(c,l,!0)),null}if(r.swr===!0){let{value:c,meta:l}=o;queueMicrotask(()=>n(c,l,!0));let u=o.promise?null:this.fetch(t,o,e,i);return o.promise.then(h=>{h.ok&&ps(c,h.value)&&n(h.value,h.meta,!0)}),u}}if(o&&o.promise)return o.promise.then(c=>n(c.value,c.meta,c.ok)),null;o=o||this.createEntry(t);let a=this.fetch(t,o,e,i);return o.promise.then(c=>n(c.value,c.meta,c.ok)),a}load(t,e,r={}){return new Promise((n,i)=>{let o=!0,a=c=>{Promise.resolve().then(e).then(l=>c(!0,l,null),l=>c(!1,void 0,l))};this.resolve(t,a,r,(c,l,u)=>{if(o)return o=!1,u?n(c):i(l);typeof r.onUpdate=="function"&&r.onUpdate(c)})})}},Pt=new he;var ms=s=>{let t=typeof s;return t!=="string"&&t!=="number"?s:Ke(s)},Ke=s=>[{tag:"text",textContent:s}],Ve=()=>({props:{},children:[]}),Qe=s=>({props:{},children:Ke(s)}),$e=s=>({props:{},children:s}),je=s=>({props:s[0]||{},children:ms(s[1])});var A=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t,this.evictCount=t>=8?t>>3:1}get(t){let e=this.cache.get(t);if(e!==void 0)return e.used=!0,e.value}has(t){return this.cache.has(t)}set(t,e){let r=this.cache,n=r.get(t);if(n!==void 0){n.value=e,n.used=!0;return}r.set(t,{value:e,used:!1}),r.size>this.maxSize&&this.evict()}evict(){let t=this.cache,e=this.maxSize-this.evictCount+1;for(let r=0;r<2&&t.size>e;r++){let n=t.keys(),i=t.size;for(;i-- >0&&t.size>e;){let o=n.next().value,a=t.get(o);if(a!==void 0&&a.used){a.used=!1;continue}t.delete(o)}}}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}};var fe=new WeakMap,de=new WeakMap;function Et(s){if(!s||typeof s!="object")return s;let t=de.get(s);return t!==void 0?t:s}var Ye=new WeakMap;function gs(s,t,e,r){let n=fe.get(s);n||(n=new Map,fe.set(s,n));let i=n.get(e);if(i)return i;let o=new Proxy(s,Xe(t,e,r));return n.set(e,o),de.set(o,s),o}function ys(s){s&&typeof s=="object"&&fe.delete(s)}function Je(s,t){let e=t.charCodeAt(0),r=e>=48&&e<=57;return s===""?r?"["+t+"]":t:r?s+"["+t+"]":s+"."+t}function Xe(s,t="",e=""){return{get(r,n,i){let o=r[n];if(t===""&&n in r){if(typeof o=="function"){let c=Ye.get(r);c||(c=new Map,Ye.set(r,c));let l=c.get(n);if(l)return l;let u=o.bind(r);return c.set(n,u),u}return o}if(o=(r[e]||r)[n],o!==null&&typeof o=="object"){let c=Je(t,n);return gs(o,s,c,e)}return o},set(r,n,i,o){if(t===""&&n in r)return r[n]=i,!0;let c=(r[e]||r)[n],l=Je(t,n);return s.set(l,i),c!==i&&c!==null&&typeof c=="object"&&ys(c),!0}}}var Mt=(s,t="stage")=>{let e=new Proxy(s,Xe(s,"",t));return de.set(e,s),e};var Dt=class{constructor(){this.connections=new Map}add(t,e,r){let n=this.getOrCreate(t),i=n.get(e);return i?Array.isArray(i)?i.push(r):n.set(e,[i,r]):n.set(e,r),r}get(t,e){let r=this.connections.get(t)?.get(e);return r?Array.isArray(r)?r[r.length-1]||!1:r:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let r=this.connections.get(t);if(r)if(e)this.unsubscribe(r.get(e)),r.delete(e),r.size===0&&this.connections.delete(t);else{for(let n of r.values())this.unsubscribe(n);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,r=t.length;e<r;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var _t=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var X=class extends _t{constructor(t){super(),this.pubSub=t}subscribe(t){this.msg=t;let e=this.callBack.bind(this);this.token=this.pubSub.on(t,e)}unsubscribe(){this.pubSub&&this.msg&&this.token&&this.pubSub.off(this.msg,this.token),this.pubSub=null,this.msg=null,this.token=null}callBack(){}};var Rt=class extends X{constructor(t,e,r){super(r),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}unsubscribe(){super.unsubscribe(),this.data=null,this.prop=null}};var Z=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?Array.from(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let r=document.querySelectorAll(t);return r?r.length===1?r[0]:Array.from(r):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return!t||typeof t!="object"||typeof e>"u"?this:(e=C.uncamelCase(e),t.style[e]=r,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=C.uncamelCase(e);let r=t.style[e];if(r!=="")return r;let n=null,i=t.currentStyle;if(i&&(n=i[e]))return n;let o=window.getComputedStyle(t,null);return o?o[e]:r}static css(t,e,r){return typeof r<"u"?(this.setCss(t,e,r),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,r){t.setAttribute(e,r)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,r){return!t||typeof t!="object"?!1:typeof r<"u"?(this.setAttr(t,e,r),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=C.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,r){e=this.removeDataPrefix(e),e=C.camelCase(e),t.dataset[e]=r}static getData(t,e){return e=C.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,r){return!t||typeof t!="object"?!1:typeof r<"u"?(this.setData(t,e,r),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(!t||typeof t!="object")return this;let e=this.data(t,"style-display"),r=typeof e=="string"?e:"";return this.css(t,"display",r),this}static hide(t){if(!t||typeof t!="object")return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return!t||typeof t!="object"?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return!t||typeof t!="object"?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return typeof t=="object"&&t!==null?t.offsetWidth:!1}static getHeight(t){return typeof t=="object"&&t!==null?t.offsetHeight:!1}static getScrollPosition(t){let e=0,r=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,r=t.scrollTop;break;case"object":e=t.scrollLeft,r=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:r-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,r=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||r.clientWidth||n.clientWidth,o=t.innerHeight||r.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,r=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let r={x:0,y:0};if(!t||typeof t!="object")return r;let n=0;for(;t&&(e===0||n<e);)n++,r.x+=t.offsetLeft+t.clientLeft,r.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return r}static addClass(t,e){if(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let r=e.split(" ");for(let n=0,i=r.length;n<i;n++)t.classList.add(r[n])}return this}static removeClass(t,e){return!t||typeof t!="object"||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return!t||typeof t!="object"||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return!t||typeof t!="object"?this:(t.classList.toggle(e),this)}};var It=s=>{let t="textContent";if(!s||typeof s!="object")return t;let e=s.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let r=s.type;if(!r)return t="value",t;switch(r){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var xs=(s,t,e)=>{Z.setAttr(s,t,e)},Ss=(s,t,e)=>{s.checked=s.value==e},bs=(s,t,e)=>{e=e==1,Ze(s,t,e)},Ze=(s,t,e)=>{s[t]=e},ks=(s,t)=>Z.getAttr(s,t),vs=(s,t)=>s[t],Ot=class extends X{constructor(t,e,r,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof r=="string"?this.setupFilter(r):r}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=xs,this.getValue=ks,this;this.getValue=vs;let r=t.type;if(r)switch(r){case"checkbox":return this.setValue=bs,this;case"radio":return this.setValue=Ss,this}return this.setValue=Ze,this}getAttrBind(t){return t||It(this.element)}setupFilter(t){let e=/\[\[[^\]]+\]\]/;return r=>t.replace(e,()=>r)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}unsubscribe(){super.unsubscribe(),this.element={},this.attr="",this.filter=null,this.setValue=null,this.getValue=null}};var Lt=class{unsubscribe(){}};var Nt=class extends Lt{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new Ot(t,e,r,this.pubSub)}addData(t,e){return this.data=new Rt(t,e,this.pubSub)}unsubscribeSource(t){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}};var ws=0,Bt=s=>{for(let t=0,e=s.length;t<e;t++){let r=s.charCodeAt(t);if(r===46||r===58||r===91)return s.substring(0,t)}return s},W=class{constructor(t=!1,e=!1){this.callBacks=new Map,this.prefixIndex=t?new Map:null,this.rootIndex=e?new Map:null,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[],this.deliveringMessage=null,this.reentrantMessages=null,this.suppressQueue=!1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.prefixIndex?.clear(),this.rootIndex?.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.reentrantMessages=null}on(t,e){let r=++ws,n=this.callBacks.get(t);return n||(n=new Map,this.callBacks.set(t,n),this.prefixIndex&&this._indexMessage(t),this.rootIndex&&this._indexRoot(t)),n.set(r,e),r}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let r=t.substring(0,e+1),n=this.prefixIndex.get(r);n||(n=new Set,this.prefixIndex.set(r,n)),n.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let r=t.substring(0,e+1),n=this.prefixIndex.get(r);n&&(n.delete(t),n.size===0&&this.prefixIndex.delete(r))}_indexRoot(t){let e=Bt(t),r=this.rootIndex.get(e);r||(r=new Set,this.rootIndex.set(e,r)),r.add(t)}_unindexRoot(t){let e=Bt(t),r=this.rootIndex.get(e);r&&(r.delete(t),r.size===0&&this.rootIndex.delete(e))}getRootMessages(t){return this.rootIndex?this.rootIndex.get(t)||null:this.callBacks.keys()}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let r=this.callBacks.get(t);r&&(r.delete(e),r.size===0&&(this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t),this.rootIndex&&this._unindexRoot(t)))}remove(t){this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t),this.rootIndex&&this._unindexRoot(t)}publish(t,e,r){if(!this.batchingEnabled){this.publishImmediate(t,e,r);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??=new Set).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,r]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()))}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0,this.reentrantMessages=null),this.isFlushing=!0,this.flushScheduled=!1,this.flushIterations++,this.flushIterations>this.maxFlushIterations){console.error("[DataPubSub] Infinite loop detected! Flush iterations exceeded",this.maxFlushIterations,"- Breaking to prevent memory exhaustion."),console.error("[DataPubSub] Queue size:",this.updateQueue.size),console.error("[DataPubSub] Queued messages:",Array.from(this.updateQueue.keys())),this._breakCascade(),this.flushScheduled=!1,this.isFlushing=!1,this._resolveFlushComplete(),this.flushIterations=0;return}this.debugMode&&console.log("[DataPubSub] Flushing",this.updateQueue.size,"updates (iteration",this.flushIterations+")");let t=this.updateQueue;this.updateQueue=new Map;try{for(let[e,r]of t)this.publishImmediate(e,r[0],r[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_breakCascade(){let t=this.updateQueue;this.updateQueue=new Map;let e=this.reentrantMessages;this.suppressQueue=!0;try{for(let[r,n]of t)e&&e.has(r)||this.publishImmediate(r,n[0],n[1])}finally{this.suppressQueue=!1,this.reentrantMessages=null,this.updateQueue.clear()}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let r=0;r<e;r++)t[r]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let r=0;r<e;r++)t[r]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let r=e.length;for(let n=0;n<r;n++)e[n]()}})}flushSync(){this.flush()}publishImmediate(t,e,r){let n=this.callBacks.get(t);if(!n)return;let i=this.deliveringMessage;this.deliveringMessage=t;for(let o of n.values())if(o)try{o(e,r)}catch(a){console.error('[DataPubSub] Subscriber error for "'+t+'":',a)}this.deliveringMessage=i}};var D=new WeakMap,tr=(s,t)=>{let e=D.get(s);e?Array.isArray(e)?e.push(t):D.set(s,[e,t]):D.set(s,t)},pe=s=>{let t=s.data;if(!t)return;let e=s.subs;if(e)for(let r=0,n=e.length;r<n;r++)t.off(e[r].msg,e[r].token);else s.token&&t.off(s.prop,s.token);s.data=null},me=s=>Et(s)||s,ge=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new Dt,this.pubSub=new W(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null,a=r.indexOf(":");a!==-1&&(o=r.substring(0,a),i=r.substring(a+1));let c=o??"",l=this.setupConnection(t,e,i,c,n),u=l.element,h=e.get(i);return typeof h<"u"?u.set(h):(h=u.get(),h!==""&&l.data.set(h)),this}setupConnection(t,e,r,n,i){let o=this.getBindId(t),a=new Nt(this.pubSub);a.addData(e,r).subscribe(o);let u=`${e.getDataId()}:${r}`;return a.addElement(t,n,i).subscribe(u),this.addConnection(o,"bind",a),a}addConnection(t,e,r){return this.connections.add(t,e,r),this}setBindId(t){let e="db-"+this.idCount++;return t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){if(!t)return this;let e=D.get(t);if(e)if(D.delete(t),Array.isArray(e))for(let n=0,i=e.length;n<i;n++)pe(e[n]);else pe(e);let r=t[this.attr];return r&&this.connections.remove(r),this}hasWatchers(t){return!!t&&D.has(t)}isBound(t){return!!t&&(!!t[this.attr]||D.has(t))}watch(t,e,r,n){if(w.isObject(t)===!1)return this;let i=me(e);if(!i||typeof i.on!="function")return console.warn('DataBinder.watch: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',r,e),i&&typeof i.get=="function"&&n(i.get(r)),this;let o=i.get(r),a=!0,c=u=>{a&&(a=!1,u===o&&(u===null||typeof u!="object"))||n(u)},l=i.on(r,c);return tr(t,{data:i,prop:r,token:l}),n(o),this}watchMany(t,e,r,n){if(w.isObject(t)===!1)return this;let i=r?r.length:0;if(i===0)return this;if(i===1)return this.watch(t,e,r[0],n);let o=me(e);if(!o||typeof o.on!="function")return console.warn('DataBinder.watchMany: data source has no "on" method.',e),this;let a=new Array(i),c=new Array(i);for(let g=0;g<i;g++)a[g]=o.get(r[g]),c[g]=!0;let l=!1,u,h={data:o,prop:r,subs:null},f=()=>{l=!1,h.data!==null&&n(u)},m=g=>{u=g,!l&&(l=!0,typeof o.onFlush=="function"?o.onFlush(f):queueMicrotask(f))},S=new Array(i);for(let g=0;g<i;g++){let bt=g,kt=a[g];S[g]=vt=>{c[bt]&&(c[bt]=!1,vt===kt&&(vt===null||typeof vt!="object"))||m(vt)}}let b=new Array(i);for(let g=0;g<i;g++)b[g]={msg:r[g],token:o.on(r[g],S[g])};return h.subs=b,tr(t,h),n(a[0]),this}unwatch(t,e,r){if(w.isObject(t)===!1)return this;let n=D.get(t);if(!n)return this;let i=me(e),o=Array.isArray(n)?n:[n],a=[];for(let c=0,l=o.length;c<l;c++){let u=o[c],h=Array.isArray(u.prop)?u.prop.join(","):u.prop;if(u.data===i&&h===r){pe(u);continue}a.push(u)}return a.length===0?D.delete(t):D.set(t,a.length===1?a[0]:a),this}publish(t,e,r){return this.pubSub.publish(t,e,r),this}getPrefixMessages(t){return this.pubSub.getPrefixMessages(t)}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.has(t.keyCode)}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,r=this.isDataBound(e);if(r!==null){let n=this.connections.get(r,"bind");if(n){let i=n.element.get();this.pubSub.publish(r,i,e)}}}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&d.on(["change","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&d.off(["change","input"],document,this.changeHandler,!1)}},x=new ge;var Cs=new Map([["class","className"],["text","textContent"],["for","htmlFor"],["readonly","readOnly"],["maxlength","maxLength"],["cellspacing","cellSpacing"],["rowspan","rowSpan"],["colspan","colSpan"],["tabindex","tabIndex"],["celpadding","cellPadding"],["useMap","useMap"],["frameborder","frameBorder"],["contenteditable","contentEditable"]]),Q=s=>Cs.get(s)||s,ye=s=>typeof s=="string"&&s.charCodeAt(0)===111&&s.charCodeAt(1)===110?s.substring(2):s,As=/(?:<[a-z][\s\S]*>)/i,_=class{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(r,i):this.append(r,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let r=e.type;r!==void 0&&t.setAttribute("type",r);let n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=e[a];a==="innerHTML"?t.innerHTML=c:a.indexOf("-")!==-1?t.setAttribute(a,c):this.addAttr(t,a,c)}}static addHtml(t,e){return typeof e>"u"||e===""?this:(As.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,r){if(r===""||!e)return;if(typeof r==="function")e=ye(e),r.originalCallback?d.add(e,t,r,!1,!0,r.originalCallback):d.add(e,t,r);else{let i=Q(e);t[i]=r}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let r=document.createTextNode(t);return e&&this.append(e,r),r}static createComment(t,e){let r=document.createComment(t);return e&&this.append(e,r),r}static setupSelectOptions(t,e,r){if(!t||typeof t!="object"||!Array.isArray(e))return!1;e.forEach(n=>{let i=new Option(n.label,n.value);t.options.add(i),r!==null&&i.value==r&&(i.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let r=e.pop(),n=r.childNodes;if(n&&n.length>0)for(let i=n.length-1;i>=0;i--){let o=n[i];(o.nodeType!==3||x.isBound(o))&&e.push(o)}p.remove(r),x.isBound(r)&&x.unbind(r)}}static removeElement(t){if(!t)return this;let e=p.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!t||typeof t!="object")return this;let e=Array.from(t.childNodes);for(let i=0,o=e.length;i<o;i++)this.removeElementData(e[i]);let r=t.childNodes;if(r.length>0&&e.length>0){let i=new Set(e);for(let o=0,a=r.length;o<a;o++)i.has(r[o])||this.removeElementData(r[o])}if(typeof t.replaceChildren=="function")return t.replaceChildren(),this;let n;for(;n=t.firstChild;)t.removeChild(n);return this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,r){let n=r||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var R=s=>s?s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null:null;var T=class extends _{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e,n),r.appendChild(i),i}static addAttributes(t,e,r){if(!(!e||e.length<1))for(let n=0,i=e.length;n<i;n++){let o=e[n];this.addAttr(t,o.key,o.value,r)}}static addAttr(t,e,r,n){if(r===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){if(e=ye(e),r.originalCallback)d.add(e,t,r,!1,!0,r.originalCallback);else{let a=r,c=function(l){a.call(this,l,n)};d.add(e,t,c,!1,!0,a)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,r);return}let o=Q(e);t[o]=r}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var er=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,rr=new A(1e3),Ts=new Set(["disabled","checked","required","selected","hidden","readonly","readOnly","multiple","open","autofocus","inert"]),Ps=s=>typeof s=="string"?s!==""&&s!=="false":!!s,Es=(s,t)=>{if(t.charCodeAt(4)===45){s.removeAttribute(t);return}let e=Q(t);if(e in s){s[e]="";return}s.removeAttribute(t)},E={isWatching(s){if(Array.isArray(s)){let t=s[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(s)},hasParams(s){return typeof s=="string"&&s.includes("[[")},_getWatcherProps(s){let t=rr.get(s);if(t!==void 0)return t;let e=s.match(er),r=e?e.map(n=>n.slice(2,-2)):null;return rr.set(s,r),r},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"disabled":case"checked":case"required":case"selected":case"hidden":case"readonly":case"readOnly":case"multiple":case"open":case"autofocus":case"inert":s[t==="readonly"?"readOnly":t]=Ps(e);break;case"src":if(s.tagName==="IMG"){s.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}s.src=e;break;default:if(e===""&&t){Es(s,t);break}T.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace(er,function(n,i,o){let a=e?t[r]:t;r++;let c=a.get(o);return c??""})},_getWatcherCallBack(s,t,e,r,n){let i=this._getWatcherProps(e);if(i&&i.length===1&&e.length===i[0].length+4){let o=i[0],a=n?t[0]:t;return Ts.has(r)?()=>{this.updateAttr(s,r,a.get(o))}:()=>{let c=a.get(o);this.updateAttr(s,r,c!=null?String(c):"")}}return()=>{let o=this.replaceParams(e,t,n);this.updateAttr(s,r,o)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,R(t)]:e.length<2?[e[0],R(t)]:e},getPropValues(s,t,e){let r=[];for(let n=0,i=t.length;n<i;n++){let a=(e?s[n]:s).get(t[n])??"";r.push(a)}return r},getCallBack(s,t,e,r,n,i){let o=s.attr||"textContent",a=s.callBack;if(typeof a=="function"){let c=i||this._getWatcherProps(r)||[],l=c.length>1;return(u,h)=>{u=l!==!0?u:this.getPropValues(e,c,n);let f=a(u,t,h);typeof f<"u"&&this.updateAttr(t,o,f)}}return this._getWatcherCallBack(t,e,r,o,n)},addDataWatcher(s,t,e){let r=this.getValue(t,e),n=r[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=r[0],o=Array.isArray(n),a=this._getWatcherProps(i);if(!a)return;let c=this.getCallBack(t,s,n,i,o,a);if(!o)a.length>1?x.watchMany(s,n,a,c):this.addWatcher(s,n,a[0],c);else for(let l=0,u=a.length;l<u;l++)this.addWatcher(s,n[l],a[l],c)},getWatcherSettings(s,t=null){if(typeof s=="string")return{attr:t,value:s};if(Array.isArray(s)){let e=s[s.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let r=s[1]&&typeof s[1]=="object"?[s[0],s[1]]:[s[0]];return typeof e=="function"?{attr:t,value:r,callBack:e}:{attr:e||"textContent",value:r}}return s},setup(s,t,e){t&&this.addDataWatcher(s,this.getWatcherSettings(t),e)},addWatcher(s,t,e,r){x.watch(s,t,e,r)}};var Ms=s=>({props:{watch:s},children:[]}),Ds=s=>{if(s.length===0)return Ve();let t=s[0],e=typeof t;if(e==="string"||e==="number")return Qe(t);if(Array.isArray(t))return E.isWatching(t)?Ms(t):$e(t);let r=s[1]??s[0]??[];if(r&&Array.isArray(r)&&E.isWatching(r)){let n=s[0]&&!Array.isArray(s[0])?s[0]:{};s[0]={...n,watch:r},s[1]=[]}return je(s)},_s=s=>(...t)=>{let{props:e,children:r}=Ds(t);return s(e,r)};var ft=class{static resume(t,e){if(!t)return null;let r=localStorage.getItem(t);if(r===null)return e!==void 0?e:void 0;try{let n=JSON.parse(r);return n===null&&e!==void 0?e:n}catch(n){return console.warn('[LocalData] Failed to parse stored value for key "'+t+'". Removing corrupted entry.',n),localStorage.removeItem(t),e!==void 0?e:void 0}}static store(t,e){if(!t||!e)return!1;try{let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}catch(r){return console.error('[LocalData] Failed to store data for key "'+t+'".',r),!1}}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Ht=(s={})=>{let t={};if(!w.isObject(s))return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i];typeof o!="function"&&(t[i]=o)}return t};var Rs=0,sr=new A(8e3),F={CHANGE:"change",DELETE:"delete"},xe=(s,t)=>{let e=sr.get(s);return e||(e={change:`${s}:change`,delete:`${s}:delete`},sr.set(s,e)),t==="change"?e.change:e.delete},I=class s{constructor(t={}){this.dirty=!1,this._retainState=!1,this._refreshState=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=this.createEventSub();let e=Ht(t);this._initAttributes(e);let r=Mt(this);return this._proxy=r,r}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}createEventSub(){return new W}_canSilentInit(){let t=s.prototype;return this.set===t.set&&this._setAttr===t._setAttr&&this._publish===t._publish}_initAttributes(t){if(this._canSilentInit()===!1){this.set(t);return}let e=this.stage,r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n],a=t[o];a!==void 0&&(e[o]=a)}}_init(){let t=++Rs;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){this.unlink(),this.eventSub.reset()}on(t,e){let r=xe(t,F.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=xe(t,F.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,r,F.CHANGE))}publishLocalEvent(t,e,r,n){let i=xe(t,n);this.eventSub.publish(i,e,r)}_publish(t,e,r,n){this.publishLocalEvent(t,e,r,n),x.getPrefixMessages(this._dataId)!==null&&(r=r||this,x.publish(this._dataId+t,e,r))}set(t,e,r){if(typeof t!="object")return this._setAttr(t,e,r),this;let n=Object.keys(t);for(let i=0;i<n.length;i++){let o=n[i],a=t[o];typeof a!="function"&&this._setAttr(o,a,e,r)}return this}_silentSet(t){let e=this.stage,r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];e[o]=t[o]}}getModelData(){return this.stage}_deleteAttr(t,e,r=this){delete t[e],this.publishLocalEvent(e,null,r,F.DELETE)}toggle(t){return typeof t>"u"?this:(this.set(t,!this.get(t)),this)}increment(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let r=this.get(t);return this.set(t,r+e),this}decrement(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let r=this.get(t);return this.set(t,r-e),this}concat(t,e){if(typeof t>"u")return this;let r=this.get(t);return this.set(t,r+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t,e){return this.key=e!=null?t+":v"+e:t,this}resume(t){let e=ft.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return ft.store(String(this.key),t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,r){let n=r||e,i=t.get(e);typeof i<"u"&&this.get(n)!==i&&this.set(n,i);let o=t.on(e,(c,l)=>{if(l===this)return!1;this.set(n,c,t)}),a=this.on(n,(c,l)=>{if(l===t)return!1;t.set(e,c,this)});return this.addLink(o,t,e,a),t.addLink(a,this,n,o),o}addLink(t,e,r,n){this.links.set(t,{data:e,attr:r,pair:n})}unlink(t){if(t){this.removeLink(t);return}let e=this.links;e.size!==0&&(e.forEach((r,n)=>{this.removeLink(n,!1)}),e.clear())}removeLink(t,e=!0){let r=this.links.get(t);if(r){let n=r.data;r.attr&&n.off(r.attr,t);let i=r.pair,o=i&&n.links;if(o){let a=o.get(i);a&&(o.delete(i),a.attr&&this.off(a.attr,i))}}e!==!1&&this.links.delete(t)}};I.prototype.isData=!0;var nr=new Set(["__proto__","prototype","constructor"]),Is=s=>{let t=[],e=s.length,r=0;for(let n=0;n<e;n++){let i=s.charCodeAt(n);i!==46&&i!==91&&i!==93||(n>r&&t.push(s.substring(r,n)),r=n+1)}return e>r&&t.push(s.substring(r)),t.length>0?t:null},k={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new A(5e3),hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},isSafeAttr(s){return!nr.has(s)},getSegments(s){let t=this.segmentCache.get(s);if(t!==void 0)return t;if(t=Is(s),t){for(let e=0,r=t.length;e<r;e++)if(nr.has(t[e])){console.warn("[Data] Blocked unsafe path segment in: "+s),t=null;break}}return this.segmentCache.set(s,t),t}};var N=class{static set(t,e,r){if(!k.hasDeepData(e)){if(!k.isSafeAttr(e))return;t[e]=r;return}let n,i=k.getSegments(e);if(!i)return;let o=i.length,a=o-1;for(let c=0;c<o;c++){let l=i[c];if(c===a){t[l]=r;break}if(t[l]===void 0){let u=l.charCodeAt(0);t[l]=u<48||u>57?{}:[]}t=t[l]}}static delete(t,e){if(!k.hasDeepData(e)){if(!k.isSafeAttr(e))return;delete t[e];return}let r=k.getSegments(e);if(!r)return;let n=r.length,i=n-1;for(let o=0;o<n;o++){let a=r[o],c=t[a];if(c===void 0)break;if(o===i){if(Array.isArray(t)){let l=Number(a);Number.isInteger(l)&&l>=0&&l<t.length&&t.splice(l,1);break}delete t[a];break}t=c}}static get(t,e){if(!k.hasDeepData(e))return t[e]??void 0;let r=k.getSegments(e);if(!r)return;let n=r.length,i=n-1;for(let o=0;o<n;o++){let a=r[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var ir=new Set,Ut=class{static MAX_DEPTH=50;static publishDeep(t,e,r,n){if(!k.hasDeepData(e)){this.publish(e,r,n);return}let i,o=k.getSegments(e);if(!o)return;let a=o.length,c=a-1,l="";for(let u=0;u<a;u++){let h=o[u];t=t[h];let f=h.charCodeAt(0);u>0?(f<48||f>57)&&(l+="."+h):l=h;let m;if(u===c)m=r;else{let S=o[u+1],b=S.charCodeAt(0);if(b>=48&&b<=57){l+="["+S+"]";continue}let g={};g[S]=t[S],m=g}this.publish(l,m,n)}}static publish(t,e,r,n=null,i=0){if(t=t||"",r(t,e),!(!e||typeof e!="object"||(e=Et(e),n===null&&(ir.clear(),n=ir),!n))){if(n.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(i>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}n.add(e),Array.isArray(e)?this.publishArray(t,e,r,n,i):this.publishObject(t,e,r,n,i)}}static publishArray(t,e,r,n,i){let o=e.length;for(let a=0;a<o;a++){let c=e[a],l=t+"["+a+"]";this._checkPublish(l,c,r,n,i)}}static publishObject(t,e,r,n,i){let o=Object.keys(e);for(let a=0,c=o.length;a<c;a++){let l=o[a],u=e[l],h=t+"."+l;this._checkPublish(h,u,r,n,i)}}static _checkPublish(t,e,r,n,i){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r,n,i+1)}};var q=class s extends I{setup(){this.attributes={},this.stage={}}createEventSub(){return new W(!1,!0)}_canSilentInit(){let t=s.prototype;return this.set===I.prototype.set&&this._setAttr===t._setAttr&&this._publish===t._publish}_initAttributes(t){if(this._canSilentInit()===!1){this.set(t);return}let e=this.stage,r=this.attributes,n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];if(c!==void 0){if(k.hasDeepData(a)){N.set(r,a,c),N.set(e,a,c);continue}k.isSafeAttr(a)&&(r[a]=c,e[a]=c)}}}_setAttr(t,e,r,n){if(typeof e!="object"&&e===this.get(t))return;!r&&n!==!0?N.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),N.set(this.stage,t,e);let i=this._upstream,o=r;r=r||this,this._publish(t,e,r,F.CHANGE),i&&o!==i.data&&i.keys.has(t)&&i.data.set(i.prefix+t,e,this)}_silentSet(t){let e=this.stage,r=this.attributes,n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];e[a]=c,r[a]=c}}linkAttr(t,e){let r=t.get(e);if(!r)return;let n=Object.keys(r);for(let i=0,o=n.length;i<o;i++){let a=n[i];this.link(t,e+"."+a,a)}}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let n=new e(r);return typeof n.linkScope=="function"?n.linkScope(this,t):n.linkAttr(this,t),n}linkScope(t,e){let r=t.get(e);if(!r)return;let n=e+".",i=new Set(Object.keys(r));for(let o of i){let a=n+o,c=t.on(a,(l,u)=>{if(u===this)return!1;this.set(o,l,t)});this.addLink(c,t,a,null)}this._upstream={data:t,prefix:n,keys:i}}unlink(t){t||(this._upstream=null),super.unlink(t)}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.push(e),this.set(t,r),this}concat(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r=r.concat(e),this.set(t,r),this}unshift(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.unshift(e),this.set(t,r),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.shift();return this.set(t,e),r}getIndex(t,e,r){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===r)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r,n){if(this._publishAttr(t,e,r,n),!e||typeof e!="object")return;let i=t.length,o=n===F.CHANGE?":change":":"+n,a=o.length,c=i+a,l=this.eventSub.getRootMessages(Bt(t))||[];for(let h of l){if(h.length<=c||!h.endsWith(o)||!h.startsWith(t))continue;let f=h.charCodeAt(i);if(f!==46&&f!==91)continue;let m=h.slice(0,h.length-a);this._publishAttr(m,this.get(m),r,n)}let u=x.getPrefixMessages(this._dataId);if(u){let h=this._dataId.length;for(let f of u){if(f.length-h<=i||!f.startsWith(t,h))continue;let S=f.charCodeAt(h+i);if(S!==46&&S!==91)continue;let b=f.slice(h);x.publish(f,this.get(b),r)}}}_publishAttr(t,e,r,n){x.getPrefixMessages(this._dataId)!==null&&x.publish(this._dataId+t,e,r),this.publishLocalEvent(t,e,r,n)}mergeStage(){this.attributes=v.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,r=this){N.delete(t,e),this._delCommitter=r;let n=this._deleteCb||(this._deleteCb=i=>this._publishAttr(i,null,this._delCommitter,F.DELETE));Ut.publish(e,null,n)}_getAttr(t,e){return N.get(t,e)}};var Os={"\n":"\\n","\r":"\\n"," ":"\\t"},Ls=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>Os[r])},or=(s,t)=>{if(typeof s!="string")return s;s=Ls(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},Se=(s,t)=>{let e=typeof s;if(e==="undefined")return s;if(e!=="object")return s=or(s),s;let r=Array.isArray(s)?[...s]:{...s};return Object.keys(r).forEach(n=>{let i=r[n];i!==null&&(r[n]=typeof i=="string"?Se(i,t):or(i,t))}),r};function ar(s){if(typeof s>"u"||s.length<1)return!1;try{return JSON.parse(s)}catch(t){return console.warn("[Encode] Failed to parse JSON.",t),!1}}function be(s){return typeof s<"u"?JSON.stringify(s):null}var dt=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?v.clone(t):t,n=Se(r,e);return be(n)}static json={encode:be,decode:ar};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Wt=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.requestOptions=null,this.init()}init(){let t=this.model;t&&t.url&&(this.url=t.url)}isValid(){let t=this.validate();if(t!==!1){let e=this.validateCallBack;typeof e=="function"&&e(t)}return t}validate(){return!0}getDefaultParams(){return""}setupParams(t){let e=this.getDefaultParams();return t=this.addParams(t,e),t}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+t[r]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=C.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=C.parseQueryString(e,!1)),this._isFormData(t))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.append(r,e[r]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let r=this.model.get("id"),n="id="+r,i=r?`/${r}`:"",o=this.model;return this._get(i,n,t,e,a=>{if(a){let c=this.getObject(a);c&&o.set(c)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+dt.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._put(i,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._post(i,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._patch(i,r,t,e)}delete(t,e){let r=this.model.get("id"),n=typeof r<"u"?"id="+r:this.setupObjectData(),i=r!=null?`/${r}`:"";return this._delete(i,n,t,e)}getAllParams(t,e,r,n){let i=this.model.get();t=isNaN(Number(t))?0:t,e=isNaN(Number(e))?50:e;let o=i.search||"",a=f=>{try{return JSON.stringify(f)}catch(m){return console.error("[ModelService] Failed to serialize request param.",m),""}},c=i.filter||"";typeof c=="object"&&(c=a(c));let l=i.dates||"";typeof l=="object"&&(l=a(l));let u=i.orderBy||"";typeof u=="object"&&(u=a(u));let h=i.groupBy||"";return Array.isArray(h)&&(h=a(h)),"&filter="+encodeURIComponent(c)+"&offset="+t+"&limit="+e+"&dates="+encodeURIComponent(l)+"&orderBy="+encodeURIComponent(u)+"&groupBy="+encodeURIComponent(h)+"&search="+encodeURIComponent(o)+"&lastCursor="+(typeof r<"u"&&r!==null?encodeURIComponent(r):"")+"&since="+(typeof n<"u"&&n!==null?encodeURIComponent(n):"")}all(t,e,r,n,i=null,o=null){let a=this.getAllParams(r,n,i,o);return this._get("",a,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let r=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(r)}withOptions(t){return Object.create(this,{requestOptions:{value:t||null,writable:!0}})}withCache(t=!0){return this.withOptions({...this.requestOptions,cache:t})}setupRequest(t,e,r,n,i,o){o=o||this.requestOptions||null;let a=(h,f)=>{typeof i=="function"&&i(h),this.getResponse(h,n,f)},c={url:this.getUrl(t),method:e,params:r,completed:a},l=this._isFormData(r);if(l&&(c.headers={}),!o)return ht(c);o.invalidate&&(c.completed=(h,f)=>{h!==!1&&h!=null&&Pt.invalidate(o.invalidate),a(h,f)});let u=o.cache;return!u||!this.isCacheableMethod(e)||l?ht(c):this.cachedRequest(c,u===!0?{}:u)}isCacheableMethod(t){let e=String(t||"").toUpperCase();return e==="GET"||e==="HEAD"}getCacheKey(t){let e=t.params||"";if(typeof e=="object")try{e=JSON.stringify(e)}catch{e=""}return t.method.toUpperCase()+" "+t.url+(e?" "+e:"")}cachedRequest(t,e){let r=e.key||this.getCacheKey(t),n=t.completed,i=o=>ht({...t,completed:(a,c)=>o(a!=null,a,c),failed:(a,c)=>o(!1,!1,c),aborted:(a,c)=>o(!1,!1,c)});return Pt.resolve(r,i,{ttl:e.ttl,swr:e.swr},(o,a)=>n(o,a))}setupEventSource(t,e,r,n,i=!0){let o=null,a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0)},h=()=>{if(c||!i||l)return;u(),a=setTimeout(()=>{a=void 0,f()},3e3)},f=()=>{if(c||l)return;if(o){try{o.close()}catch{}o=null}l=!0;let m=this.getUrl(t),S=e?"?"+e:"";o=new EventSource(m+S,{withCredentials:!0}),o.onopen=()=>{l=!1,u(),n&&n()},o.onerror=()=>{l=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,h())},o.onmessage=b=>{try{let g=JSON.parse(b.data);r&&r(g)}catch{}}};return f(),{get source(){return o},close:()=>{if(c=!0,l=!1,u(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return E.isWatching(t)&&(t=E.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,r,n,i){return this._request("","POST",t,e,r,n,i)}_get(t,e,r,n,i,o){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i,o)}_post(t,e,r,n,i,o){return this._request(t,"POST",e,r,n,i,o)}_put(t,e,r,n,i,o){return this._request(t,"PUT",e,r,n,i,o)}_patch(t,e,r,n,i,o){return this._request(t,"PATCH",e,r,n,i,o)}_delete(t,e,r,n,i,o){return this._request(t,"DELETE",e,r,n,i,o)}_request(t,e,r,n,i,o,a){return r=this.setupParams(r),r=this.addParams(r,n),this.setupRequest(t,e,r,i,o,a)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return{};let e=this;class r extends e{constructor(i){super(i)}}return Object.assign(r.prototype,t),r}};var Ns=s=>{let t={};if(!w.isObject(s)||!s.defaults)return t;let{defaults:e}=s;return Object.keys(e).forEach(r=>{let n=e[r];typeof n!="function"&&(t[r]=n)}),delete s.defaults,t},Bs=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},Hs=0,pt=class extends q{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,r=Bs(t),n=e.prototype.service.extend(r),i=Ns(t);class o extends e{constructor(c){let l={...i,...Ht(c)};super(l),this.xhr=new n(this)}dataTypeId=`bm${Hs++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};pt.prototype.service=Wt;var tt=class extends I{};var mt=class extends tt{setup(){this.stage={}}addAction(t,e){return typeof e<"u"&&this.set(t,e),this}getState(t){return this.get(t)}removeAction(t,e){if(e)return this.off(t,e),this;let r=this.stage;return typeof r[t]<"u"&&delete r[t],this}};var Ft=class extends mt{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var O=class{static targets=new Map;static ownerCounts=new Map;static restore(t,e){this.targets.set(t,e),this.addOwner(t)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new Ft(t)),this.targets.get(t)}static attach(t){let e=this.getTarget(t);return this.addOwner(t),e}static addOwner(t){this.ownerCounts.set(t,(this.ownerCounts.get(t)||0)+1)}static detach(t){let e=this.ownerCounts.get(t);if(e===void 0)return;if(e>1){this.ownerCounts.set(t,e-1);return}this.ownerCounts.delete(t);let r=this.targets.get(t);r&&(r.remove(),this.targets.delete(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,r){let n=this.getTarget(t);return e&&n.addAction(e,r),n}static addAction(t,e,r){return this.add(t,e,r)}static removeAction(t,e,r){if(r){this.off(t,e,r);return}let n=this.getTarget(t);n&&e&&n.removeAction(e)}static on(t,e,r){let n=this.getTarget(t);return e?n.on(e,r):null}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,r);return}this.targets.delete(t),this.ownerCounts.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};var ke=Symbol("unknown"),ve=s=>{if(!s||typeof s!="object")return null;let t={};for(let e in s){if(!Object.prototype.hasOwnProperty.call(s,e))continue;let r=s[e];if(r===null||typeof r!="object"){t[e]=r;continue}try{t[e]=JSON.stringify(r)}catch{t[e]=ke}}return t},Us=(s,t)=>{let e=new Set([...Object.keys(s),...Object.keys(t)]);for(let r of e){let n=s[r],i=t[r];if(!(n===ke||i===ke)&&n!==i&&!(n!==n&&i!==i))return!1}return!0},we=(s,t)=>{!s||!t||Object.defineProperty(s,"_initialStage",{value:t,configurable:!0,writable:!0,enumerable:!1})},et=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let n=r.data.stage,i=e.data.stage,o=null;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let c=n[a];c!==i[a]&&(o===null&&(o={}),o[a]=c)}o!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(o):e.data.set(o))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}this._releaseLinks(e,r);let n=ve(r.stage);we(r,n);let i=e?e._initialStage:null,o=!!(i&&n&&!Us(i,n));if(e&&e.stage&&(!o||e._retainState||r._retainState)){let a=e._retainState||r._retainState,c=!a&&(e._refreshState||r._refreshState),l=this._buildExternalUpdates(e.stage,r.stage,a,c);v.isEmpty(l)||r._silentSet(l)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,n){let i={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(n){Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);continue}let a=t[o];!r&&a==null||a!==e[o]&&(i[o]=a)}return i}static _resumeOwned(t,e){let r=t.data;if(!r){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(r,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let n=e._refreshState||t.data._refreshState,i=this._buildOwnedUpdates(e.stage,t.data.stage,n);v.isEmpty(i)||t.data._silentSet(i)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(r){Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);continue}let o=t[i];o!=null&&o!==e[i]&&(n[i]=o)}return n}};var qt=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let n=t[r];this.on(n[0],n[1],n[2],n[3])}}on(t,e,r,n){d.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){d.off(t,e,r,n);let i,o=this.events;for(let a=0,c=o.length;a<c;a++)if(i=o[a],i.event===t&&i.obj===e&&i.callBack===r&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];d.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];d.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var zt=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,n){return{action:t,state:e,callBack:r,targetId:n,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){for(let r=0,n=t.length;r<n;r++){let i=t[r];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,c=i[o],l=c!==null?c:void 0;l&&typeof l=="object"&&(a=l.callBack,l=l.state),e.push(this.createState(o,l,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,n=e.length;r<n;r++){let i=e[r];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,n=e.length;r<n;r++){let i=e[r];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&O.remove(i.targetId,i.action,i.token)}}restore(t){O.restore(t.id,t);let e=this.callBackStates;if(e)for(let n=0,i=e.length;n<i;n++){let o=e[n];o.callBackToken=t.on(o.action,o.callBack)}let r=this.remoteStates;if(r)for(let n=0,i=r.length;n<i;n++){let o=r[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,r){let n=O.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&(e.callBackToken=t.on(n,o),this.callBackStates.push(e)),r||null}};var M=[],Gt=0,Ce=!1,Ws=typeof queueMicrotask=="function"?queueMicrotask:s=>Promise.resolve().then(s),Fs=s=>{let t=s.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||s.container||null},qs=s=>{s._mountPending=!1;try{s.afterMount()}catch(t){console.error("Error in afterMount:",t)}},cr=()=>{Ce=!1;let s=M;if(s.length===0)return;M=[];let t=[];for(let e=0,r=s.length;e<r;e++){let n=s[e];if(n.rendered!==!0||n._mountPending!==!0){n._mountPending=!1;continue}let i=Fs(n);if(i&&i.isConnected===!0){qs(n);continue}t.push(n)}t.length&&(M=M.length?t.concat(M):t),M.length&&Gt===0&&M.length!==t.length&&Ae()},Ae=()=>{Ce||(Ce=!0,Ws(cr))},L={add(s){s._mountPending!==!0&&(s._mountPending=!0,M.push(s))},enter(){Gt++},leave(){--Gt>0||(Gt=0,M.length&&Ae())},schedule(){M.length&&Ae()},flush(){cr()},get size(){return M.length}};p.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var zs=0,gt=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+zs++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,n;r!=null&&e!=null?n="pk:"+r+":"+e:r!=null?n="pk:"+r:e!=null?n="pk:"+e:n="pc"+this.persistedCount++;let i=this.persistedChildren[n];return i&&t.unitType===i.unitType&&t.resumeScope(i),t.persistToken=n,this.persistedChildren[n]=t,n}removePersistedChild(t,e){if(!this.rendered)return;let r=t?this.persistedChildren[t]:null;r&&(e&&r!==e||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){p.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&L.add(this)}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return _.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&_.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,r=t.length;e<r;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var P=class extends gt{constructor(t,e,r){super(t,e,r),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t,this._externalData&&!t._initialStage&&we(t,ve(t.stage)))}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){et.resume(this,t)}_refreshData(){et.refresh(this)}_refreshContextData(){et.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=O.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();v.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new zt(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),O.detach(String(t.id)),this.stateResumed=!1}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new qt)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}};var Kt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Vt=(s,t)=>typeof s!="function"&&t==="setupStates"?()=>s:s;var Te=(s,t)=>{if(!s)return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=Kt[i]||i;t[a]=Vt(o,a)}return t},Gs=s=>Te(s,{}),Ks=0,lr=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Ks++,e},$=(s,t=P)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=Gs(s),lr(t,e)):(e={render:r==="function"?s:()=>s},lr(t,e))};var Vs=(s,t)=>{let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=Kt[i]||i;t.prototype[a]=Vt(o,a)}return t},Qs=0,$s=s=>{let t=class extends s{};return t.prototype._classId="pod"+Qs++,t},js=(s,t=P)=>{if(!s)return null;let e=$s(t),r={},n=s(r);return Vs(r,e),e.prototype.render=n,e};var ur=new Map,j=()=>typeof Intl<"u"&&typeof Intl.DateTimeFormat=="function",Y=(s,t,e)=>{let r=ur.get(s);return r||(r=new Intl.DateTimeFormat(t,e),ur.set(s,r)),r},yt=s=>s instanceof Date&&!Number.isNaN(s.getTime()),Ys=/(?:Z|[+-]\d{2}:?\d{2})$/i,Js=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3})\d*)?)?)?$/,Xs=s=>{if(typeof s=="string"){let e=Js.exec(s.trim());if(e){let r=e[7]?Number((e[7]+"00").substring(0,3)):0;return[Number(e[1]),Number(e[2]),Number(e[3]),Number(e[4]||0),Number(e[5]||0),Number(e[6]||0),r]}}let t=new Date(s);return yt(t)?[t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]:null},hr=(s,t)=>{let e=Y("zone|"+t,"en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),r={year:0,month:1,day:1,hour:0,minute:0,second:0},n=e.formatToParts(s);for(let c=0,l=n.length;c<l;c++){let u=n[c];u.type in r&&(r[u.type]=Number(u.value))}let i=r.hour===24?0:r.hour,o=Date.UTC(r.year,r.month-1,r.day,i,r.minute,r.second),a=s-(s%1e3+1e3)%1e3;return o-a},Zs=[31,28,31,30,31,30,31,31,30,31,30,31],tn={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(s=new Date().getDay(),t=!1){if(j()){let n=new Date(2004,0,4+s),i=t?"short":"long";return Y("weekday|"+i,void 0,{weekday:i}).format(n)}let e=this.dayNames;if(s<0||s>=e.length)return null;let r=e[s];return t?r.substring(0,3):r},convertJsMonth(s){return this.padNumber(s+1)},convertDate(s,t=!1){if(!s)return"";let e=this.createDate(s);if(!yt(e))return"";if(j()){let n={weekday:"long",month:"short",day:"2-digit"};return t&&(n.year="numeric"),Y("convert|"+(t?1:0),void 0,n).format(e)}let r=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+r},padNumber(s){return s<=9?"0"+s:String(s)},createDate(s){return s?(typeof s=="string"&&s.indexOf("-")>-1&&(s=s.replace(/\s/,"T"),s=s.indexOf(":")>-1?s:s+"T00:00:00"),new Date(s)):new Date},format(s,t){let e=this.createDate(t);return yt(e)?s!=="sql"&&j()?Y("date",void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(e):this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),s):""},formatTime(s,t){let e=this.createDate(s);if(!yt(e))return"";if(t!==24&&j())return Y("time",void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(e);let r=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),r)},getMeridian(s){return s=Number(s),s>=12?"PM":"AM"},convert24To12(s){return s=Number(s),s%12||12},convert12To24(s,t){return s=Number(s)%12,String(t||"").toLowerCase()==="pm"&&(s=s+12),s},renderDate(s,t,e,r="sql"){return t=Number(t),e=Number(e),r==="sql"?`${s}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${s}`},renderTime(s,t,e=0,r="sql"){if(r==="sql")return`${this.padNumber(s)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(s);return s=this.convert24To12(s),`${s}:${this.padNumber(t)} ${n}`},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){if(j()){let n=new Date(2e3,s,1),i=t?"short":"long";return Y("month|"+i,void 0,{month:i}).format(n)}let e=this.monthNames;if(s<0||s>=e.length)return"";let r=e[s];return r?t?r.substring(0,3):r:""},getMonthLength(s,t){let e=new Date;return s=typeof s<"u"?s:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[s]},getMonthsLength(s=new Date().getFullYear()){let t=Zs.slice();return this.leapYear(s)===!0&&(t[1]=29),t},getLocalDate(s,t="America/Denver"){if(typeof s=="string"&&s.indexOf("-")>-1&&Ys.test(s.trim()))return new Date(s.trim());let e=Xs(s);if(!e)return new Date(NaN);let[r,n,i,o,a,c,l]=e;if(!j())return new Date(r,n-1,i,o,a,c,l);let u=Date.UTC(r,n-1,i,o,a,c,l);try{let h=hr(u,t),f=u-h,m=hr(f,t);return m!==h&&(f=u-m),new Date(f)}catch{return new Date(r,n-1,i,o,a,c,l)}},getLocalTime(s,t=!1,e=!1,r="America/Denver"){if(!s)return"";let n=this.getLocalDate(s,r);if(!yt(n))return"";if(!t&&j()){let c={hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0};return e===!1&&(c.year="numeric",c.month="2-digit",c.day="2-digit"),Y("local|"+(e?1:0),void 0,c).format(n)}let i=n.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(n.getFullYear(),i,n.getDate(),o)+" "),a+this.renderTime(n.getHours(),n.getMinutes(),n.getSeconds(),o)},getDiffFromNow(s,t=!1){let e=this.createDate(s),r=new Date;return t===!0&&r.setHours(0,0,0,0),r.getTime()-e.getTime()},getAge(s){let t=this.getDiffFromNow(s),e=(r,n)=>r+" "+n+(r===1?"":"s");return t<864e5?"1 day":t<6048e5?e(this.toDays(t),"day"):t<12096e5?"1 week":t<2592e6?e(Math.floor(this.toDays(t)/7),"week"):t<5184e6?"1 month":t<31104e6?e(this.toMonths(t),"month"):e(Math.max(1,this.toYears(t)),"year")},getTimeFrame(s){let t=this.getDiffFromNow(s);return this.convertToEstimate(t)},convertToEstimate(s){let t="",e,r,n,i,o,a,c;if(s<=0)switch(!0){case s<-63072e6:n=this.toYears(Math.abs(s)),t="in "+n+"y";break;case s<-31536e6:t="in 1y";break;case s<-5184e6:i=this.toMonths(Math.abs(s)),t="in "+i+"mo";break;case s<-2592e6:t="in 1mo";break;case s<-12096e5:e=this.toDays(Math.abs(s)),r=Math.floor(e/7),t="in "+r+"w";break;case s<-6048e5:t="in 1w";break;case s<-1728e5:e=this.toDays(Math.abs(s)),t="in "+e+"d";break;case s<-864e5:t="tomorrow";break;case s<-72e5:o=this.toHours(Math.abs(s)),t="in "+o+"h";break;case s<=-36e5:t="in 1h";break;case s<-12e4:a=this.toMinutes(Math.abs(s)),t="in "+a+"m";break;case s<-6e4:t="in 1m";break;case s<-2e3:c=this.toSeconds(Math.abs(s)),t="in "+c+"s";break;case s<-1:t="in 1s";break;default:t="now"}else switch(!0){case s<1e3:t="1s ago";break;case s<6e4:c=this.toSeconds(s),t=c+"s ago";break;case s<12e4:t="1m ago";break;case s<36e5:a=this.toMinutes(s),t=a+"m ago";break;case s<72e5:t="1h ago";break;case s<864e5:o=this.toHours(s),t=o+"h ago";break;case s<1728e5:t="yesterday";break;case s<6048e5:e=this.toDays(s),t=e+"d ago";break;case s<12096e5:t="1w ago";break;case s<2592e6:e=this.toDays(s),r=Math.floor(e/7),t=r+"w ago";break;case s<5184e6:t="1mo ago";break;case s<31536e6:i=this.toMonths(s),t=i+"mo ago";break;case s<63072e6:t="1y ago";break;default:n=this.toYears(s),t=n+"y ago"}return t},toYears(s){return typeof s!="number"?0:Math.floor(s/(1e3*60*60*24*365.26))},toMonths(s){return typeof s=="number"?Math.floor(s/(1e3*60*60*24*30)):0},toDays(s){return typeof s!="number"?0:Math.floor(s/(3600*1e3*24))},toHours(s){return typeof s!="number"?0:Math.floor(s%(3600*1e3*24)/(3600*1e3))},toMinutes(s){return typeof s!="number"?0:Math.floor(s%(3600*1e3)/(60*1e3))},toSeconds(s){return typeof s!="number"?0:Math.floor(s%(60*1e3)/1e3)},getDifference(s,t){let e=this.createDate(s),r=this.createDate(t),n=r.getTime()-e.getTime();return{years:this.toYears(n),days:this.toDays(n),hours:this.toHours(n),minutes:this.toMinutes(n),seconds:this.toSeconds(n)}}};var rt={items:new Map,add(s,t){return this.items.set(s,t),this},get(s){return this.items.get(s)??null}};var Pe=(s,t)=>({attr:s,directive:t});var B=(s,t)=>({key:s,value:t});var fr=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var dr=null,en=()=>dr||(dr=rt.get("watch")),z=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(B("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(Pe(B(e,E.getWatcherSettings(r,Q(e))),en()))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(B("type",n))}}static parse(t,e){let r=[],n=[],i=t.tag||"div";i==="button"&&r.push(B("type",t.type||"button"));let o=[],a,c;for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l)||l==="tag"||(a=t[l],a==null))continue;if(l==="children"||l==="nest"){if(Array.isArray(a))for(let h=0;h<a.length;h++)o.push(a[h]);else o.push(a);continue}if((c=rt.get(l))!==null){n.push(Pe(B(l,a),c));continue}let u=typeof a;if(u==="object"){if(E.isWatching(a)){this.setTextAsWatcher(n,l,a);continue}o.push(a);continue}if(u==="function"){let h=a,f=function(m){h.call(this,m,e)};f.originalCallback=h,r.push(B(l,f));continue}if(u==="string"&&a.includes("[[")){this.setTextAsWatcher(n,l,a);continue}if(l==="text"){o.push({tag:"text",textContent:a});continue}if(l==="html"||l==="innerHTML"){r.push(B("innerHTML",a));continue}r.push(B(l,a))}return fr(i,r,n,o)}};var st=class{build(t,e,r){}setupComponent(t,e,r){let n=r?.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var rn=s=>{for(let e in s)if(e!=="tag"&&e!=="textContent")return!1;let t=s.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},Qt=class extends st{build(t,e,r){let n=T.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&rn(t)){let l=t.textContent;T.createText(l??"",e);return}let n=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=z.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,r);let a=i.children;for(let l=0,u=a.length;l<u;l++){let h=a[l];h!==null&&this.buildElement(h,o,r)}let c=i.directives;c.length&&this.setDirectives(o,c,n)}createTempComponent(t,e,r){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...Te(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new P(n);this.createComponent(i,e,r)}setDirectives(t,e,r){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return T.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return T.createComment(o,e)}return T.create(n,t.attr,e,r)}removeNode(t){T.removeElement(t)}removeAll(t){T.removeAll(t)}};var sn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),nn=/[&<>"]/,Ee=s=>{let t=typeof s=="string"?s:String(s);return nn.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},nt=class{static create(t,e=[],r=""){let n="",i="";for(let o=0,a=e.length;o<a;o++){let c=e[o],l=c.key,u=c.value;if(l==="text"||l==="textContent"){n+=Ee(u);continue}if(l==="html"||l==="innerHTML"){n+=u;continue}if(typeof u=="function")continue;let h=l+'="'+Ee(u)+'"';i?i+=" "+h:i=h}return sn.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+r+"</"+t+">"}static createText(t){return Ee(t)}static createComment(t){return"<!-- "+t+" -->"}};var $t=class extends st{build(t,e,r){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],r);return n}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=z.parse(t,e),n=r.children,i="";for(let o=0,a=n.length;o<a;o++){let c=n[o];c!==null&&(i+=this.buildElement(c,e))}return this.createNode(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return nt.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return nt.createComment(i)}return nt.create(r,t.attr,e)}removeAll(t){}};var jt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Qt:new $t}};var J=jt.setup(),on=s=>typeof s=="object"&&s.isUnit===!0,pr=new WeakMap,an=s=>{let t=pr.get(s);if(!t){if(t=$(s),!t)return null;pr.set(s,t)}return new t},y=class{static render(t,e,r){if(!t||(on(t)||(t=an(t)),!t))return null;L.enter();try{return J.createComponent(t,e,r)}finally{L.leave()}}static build(t,e,r){L.enter();try{return J.build(t,e,r)}finally{L.leave()}}static rebuild(t,e,r){return J.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){J.setDirectives(t,e,r)}static createNode(t,e,r){return J.createNode(t,e,r)}static removeNode(t){J.removeNode(t)}static removeAll(t){J.removeAll(t)}};U.augment({buildLayout(s,t,e){y.build(s,t,e)}});var Me=[],cn=s=>Me.indexOf(s)!==-1,ln=s=>({tag:"script",src:s.src,async:!1,load(t){Me.push(s.src);let e=s.load;e&&e()}}),un=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){Me.push(s.src);let e=s.load;e&&e()}}),Yt=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=un({load:r,src:t}):e=ln({load:r,src:t}),y.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{cn(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var hn=s=>s?typeof s?.prototype?.constructor=="function":!1,G=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(hn(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){return this.renderNodes(t,e,r)[0]||null}static renderNodes(t,e,r){let n=y.build(t,null,r),i=Array.from(n.childNodes);return i.length===0&&t?.panel&&i.push(t.panel),e.after(n),i}};var Jt=class{static load(t,e,r){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),r&&r(n)})}};var fn=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),K=new A(100),mr=s=>{if(K.has(s)){let r=K.get(s);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof s,e;if(t==="string")e=import(s);else if(t==="function")e=s();else return s;return e.then(r=>{K.set(s,r)}).catch(()=>{K.delete(s)}),K.set(s,e),e},gr=s=>{if(!K.has(s))return null;let t=K.get(s);return t&&typeof t.then=="function"?null:t||null},_e=s=>{let t=typeof s;if(t!=="string"&&t!=="function")return null;if(gr(s))return Promise.resolve(K.get(s));let e;try{e=mr(s)}catch{return null}return e.catch(()=>null)},De=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&y.removeNode(r)}},yr=$({declareProps(){this.loaded=!1,this.errorRoot=null,this.loadingRoots=null,this.generation=0},render(){return fn({onCreated:s=>{if(this.src){if(this.layout){this.setLayoutRoots(G.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){this.renderLoading(s),new Yt(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){let t=this.generation,e=gr(this.src);if(e){this.renderModule(s,e);return}this.renderLoading(s),Jt.load(mr(this.src),r=>{t===this.generation&&this.renderModule(s,r)},r=>{t===this.generation&&(this.loaded=!1,this.removeLoadingLayout(),this.renderError(s,r))})},renderLoading(s){let t=this.loading;if(!t||this.loadingRoots)return;let e=typeof t=="function"?t():t;e&&(this.loadingRoots=G.renderNodes(e,s,this.parent))},removeLoadingLayout(){let s=this.loadingRoots;return s?(this.loadingRoots=null,De(s),!0):!1},renderError(s,t){let e=()=>this.retry(s),r=this.fallback,n=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};if(!n)return;let i=G.renderNodes(n,s,this.parent);this.errorRoots=i,this.errorRoot=i[0]||null},setLayoutRoots(s){this.layoutRoots=s,this.layoutRoot=s[0]||null},retry(s){this.removeErrorLayout(),this.loadAndRender(s)},removeErrorLayout(){this.errorRoot&&(De(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(s,t){this.loaded=!0;let e=this.layout||G.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(G.renderNodes(e,s,this.parent)),this.removeLoadingLayout()&&typeof this.onReplaceLoading=="function"&&this.onReplaceLoading(this.layoutRoots,e),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},destroy(){this.generation++,this.removeErrorLayout(),this.removeLoadingLayout(),this.layoutRoot&&(De(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Re=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new yr(s)};var xr=(s,t,e=null)=>{if(!s)return;let r=null,n=!1,i=()=>{n||(n=!0,r&&(clearTimeout(r),r=null),d.off("animationend",s,o),s&&s.classList.remove(t),e&&e())},o=c=>{c.target===s&&i()};d.on("animationend",s,o),s.classList.add(t);let a=()=>{if(!n)try{let c=window.getComputedStyle(s),l=parseFloat(c.animationDuration)*1e3||1e3,u=parseFloat(c.animationDelay)*1e3||0;r=setTimeout(i,l+u+100)}catch{r=setTimeout(i,1e3)}};if(typeof requestAnimationFrame>"u"){r=setTimeout(i,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},Sr=(s,t,e)=>{xr(s,t)},br=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};dn(s,()=>xr(s,t,r),e)};p.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var dn=(s,t,e)=>{p.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var xt=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&xt(s,t,n,r)});return}pn(s,t,e,r)},pn=(s,t,e,r)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',s,t);return}let o=mn(s,n,i,r);x.watch(s,t,n,o)},mn=(s,t,e,r)=>typeof e=="object"?n=>{xn(s,e,n)}:n=>{yn(s,e,t,n,r)},kr=new WeakSet,gn=(s,t,e)=>{!s||!s.isUnit&&!s.isComponent||kr.has(e)||kr.add(e)},yn=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(i===null)break;gn(i,e,s),y.rebuild(i,s,n);break;case"string":let o=It(s);if(o!=="textContent"){s.setAttribute(o,i);break}_.addHtml(s,i);break}},xn=(s,t,e)=>{let r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];o&&(t[o]===e?s.classList.add(o):s.classList.remove(o))}};var it=(s,t,e)=>{let r=R(e);xt(s,r,t,e)};var vr=(s,t,e)=>{t&&s.setAttribute("role",t)},Sn=s=>(t,e)=>{let r=t?"true":"false";e.setAttribute(s,r)},wr=(s,t,e)=>{if(!t)return;let r=t.role;r&&(s.setAttribute("role",r),t.role=null);let n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];if(c===null)continue;let l="aria-"+a;if(Array.isArray(c)){let u=c.slice();u.push(Sn(l)),it(s,u,e)}else s.setAttribute(l,c)}};var Cr=(s,t,e)=>{if(!t)return;let r=z.parse(t,e);T.addAttributes(s,r.attr,e),y.setDirectives(s,r.directives,e)};p.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var Ie=s=>s?s.getContext():null,Ar=(s,t,e)=>{if(typeof t!="function")return;let r=Ie(e),n=t(r);Cr(s,n,e)},Tr=(s,t,e)=>{if(typeof t!="function")return;let r=Ie(e);t(r)},Pr=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=Ie(e),n=t(r);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),bn(s,i,e))},bn=(s,t,e)=>{p.add(s,"context",{branch:t,parent:e})};var Er=(s,t,e)=>{};var Mr=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var Dr=(s,t,e)=>{},_r=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&y.build(r,s,e)},Rr=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Ir=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&y.build(r,s,e)},Or=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&y.build(r,s,e)},Lr=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},Nr=(s,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let r=t[2];if(r){let n=r;r=i=>{n(i,e)}}e.events.on(t[0],t[1],r,t[3])};var Br=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=R(e),!r)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=R(e);if(!o)return;r=o,n=t[0],i=t[1]}else[r,n,i]=t;x.bind(s,r,n,i)};var Xt=(s,t,e)=>{xt(s,e.state,t,e)};var Hr=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";e.dataset[r]=o},Ur=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(Hr(n)),it(s,i,e)},Wr=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(Hr(n)),Xt(s,i,e)};var Fr=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&r.remove()}s.length=0};p.addType("forScopes",s=>{if(!s)return!1;Fr(s.scopes)});var qr=(s,t,e)=>{let r,n,i,o;if(typeof t[0]=="string"||t.length<3){let u=R(e);if(!u)return;r=u,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1,c=n+"[",l=a?{scopes:[]}:null;l&&p.add(s,"forScopes",l),x.watch(s,r,n,u=>{if(y.removeAll(s),l&&Fr(l.scopes),!u||u.length<1)return;let h=[];for(let f=0,m=u.length;f<m;f++){let S=a?r.scope(c+f+"]"):null;S&&l&&l.scopes.push(S);let b=i(u[f],f,S,h);b!==null&&h.push(b)}return y.build(h,s,e)})};var zr=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(let o=0,a=r.length;o<a;o++){let c=r[o];if(!c)continue;let l=n(c,o);l!==null&&i.push(l)}y.build(i,s,e)};var Gr=(s,t,e)=>{t(s,e)};p.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Kr=(s,t,e)=>{kn(s,t,e)},kn=(s,t,e)=>{p.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var Vr=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,n=t.length;r<n;r++)E.setup(s,t[r],e);else E.setup(s,t,e)};var vn=0,ot=class{constructor(t){this.router=t,this.locationId="base-app-router-"+vn++,this.callBack=this.check.bind(this)}setup(){return this.trackScroll(),this.addEvent(),this}check(t){}getScrollPosition(){let t=this.scrollPosition;return t?{x:t.x,y:t.y}:{x:window.scrollX,y:window.scrollY}}trackScroll(){typeof window>"u"||this.scrollHandler||(this.scrollPosition={x:window.scrollX,y:window.scrollY},this.scrollHandler=()=>{this.scrollPosition={x:window.scrollX,y:window.scrollY}},window.addEventListener("scroll",this.scrollHandler,{passive:!0}))}untrackScroll(){this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollPosition=null)}scrollTo(t){window.scrollTo(t.x,t.y),this.scrollHandler&&(this.scrollPosition={x:t.x,y:t.y})}addEvent(){return this}};var wn=0,Cn=()=>Date.now().toString(36)+"-"+(wn++).toString(36)+"-"+Math.random().toString(36).substring(2,8),$r=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Qr=()=>{$r&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let s=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(s,t)}))},Zt=class extends ot{constructor(t){super(t),this.currentKey=null,this.positions=new A(200)}saveCurrentPosition(){let t=this.getScrollPosition(),e=this.currentKey;return e&&this.positions.set(e,t),t}addEvent(){d.on("popstate",window,this.callBack);let t=window.history;return t&&"scrollRestoration"in t&&(this.previousScrollRestoration=t.scrollRestoration,t.scrollRestoration="manual"),$r&&(this.pageShowCallBack=this.onPageShow.bind(this),d.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){d.off("popstate",window,this.callBack),this.untrackScroll();let t=window.history;return this.previousScrollRestoration&&t&&"scrollRestoration"in t&&(t.scrollRestoration=this.previousScrollRestoration,this.previousScrollRestoration=null),this.pageShowCallBack&&d.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&Qr()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.saveCurrentPosition();let r=e.key||null;this.currentKey=r;let n=r&&this.positions.get(r)||e.scrollPosition,i=this.router;i.checkActiveRoutes(e.uri,!!n),n&&(typeof i.restoreScrollPosition=="function"?i.restoreScrollPosition(n):this.scrollTo(n)),Qr()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:Cn(),scrollPosition:r,uri:t}}addState(t,e,r=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return i.key&&i.location===this.locationId&&(this.currentKey=i.key),this;!r&&i&&i.location===this.locationId&&(i.scrollPosition=this.saveCurrentPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return r||(o.scrollPosition={x:0,y:0}),n[r===!1?"pushState":"replaceState"](o,null,t),this.currentKey=o.key,this.positions.set(o.key,o.scrollPosition),this}};var te={removeSlashes(s){return typeof s!="string"?"":(s[0]==="/"&&(s=s.substring(1)),s[s.length-1]==="/"&&(s=s.substring(0,s.length-1)),s)},getHashUri(s){if(typeof s!="string")return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)}};var ee=class extends ot{addEvent(){return d.on("hashchange",window,this.callBack),this}removeEvent(){return d.off("hashchange",window,this.callBack),this.untrackScroll(),this}check(t){this.router.checkActiveRoutes(te.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var re=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Zt(t).setup():new ee(t).setup()}};var Oe=5,An=200,se=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new A(An),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMode(){let t=this.owner;return t!==null&&t.keepAliveMode==="hide"?"hide":"detach"}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:Oe}get size(){return this.pages.size}add(t){let e=this.pages;e.delete(t),e.add(t),this.trim()}delete(t){this.pages.delete(t)}trim(){let t=this.pages,e=this.getMax();for(;t.size>e;){let r=t.values().next().value;t.delete(r),r.evict()}}clear(){let t=Array.from(this.pages);this.pages.clear();for(let e=0,r=t.length;e<r;e++)t[e].evict()}saveScroll(t,e){if(e){this.scrollMemory.set(t,e);return}this.scrollMemory.has(t)&&this.scrollMemory.delete(t)}getScroll(t){return this.scrollMemory.get(t)||null}};var Le=class extends P{getChildScope(){return this.parent}},jr=s=>$(s,Le);var ne="data-scroll-key",Tn="["+ne+"]",Pn="[data-route-dormant]",Yr=s=>typeof s.closest=="function"&&s.closest(Pn)!==null,Be=new WeakMap,Ne=!1,En=()=>Ne?!0:typeof document>"u"||typeof document.addEventListener!="function"?!1:(document.addEventListener("scroll",s=>{let t=s.target;t&&t.nodeType===1&&t.hasAttribute(ne)&&Be.set(t,[t.scrollTop||0,t.scrollLeft||0])},{capture:!0,passive:!0}),Ne=!0,!0);En();var Jr=(s,t)=>{for(let e=0,r=s.length;e<r;e++){let n=s[e];if(!n||n.nodeType!==1||Yr(n))continue;let i=n.getAttribute(ne);i!==null&&t(n,i);let o=n.querySelectorAll(Tn);for(let a=0,c=o.length;a<c;a++){let l=o[a];Yr(l)||t(l,l.getAttribute(ne))}}},He=s=>{let t=null,e=Ne;return Jr(s,(r,n)=>{let i=0,o=0;if(e){let a=Be.get(r);a&&(i=a[0],o=a[1])}else i=r.scrollTop||0,o=r.scrollLeft||0;i===0&&o===0||(t=t||{},t[n]=[i,o])}),t},ie=(s,t)=>{if(!t)return!0;let e={},r=0;for(let n in t)e[n]=!0,r++;return Jr(s,(n,i)=>{let o=t[i];if(!o)return;let a=o[0],c=o[1];n.scrollTop=a,n.scrollLeft=c;let l=n.scrollTop||0,u=n.scrollLeft||0;Be.set(n,[l,u]),Math.abs(l-a)<1&&Math.abs(u-c)<1&&e[i]&&(e[i]=!1,r--)}),r<=0};var Mn=s=>{for(let t=0;t<s.length;t++){let e=s[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let n=[];for(let i=0,o=r.length;i<o;i++){let a=r[i];a&&s.indexOf(a)===-1&&n.indexOf(a)===-1&&n.push(a)}s.splice(t+1,0,...n)}},St="data-route-dormant",oe=[["content-visibility","hidden"],["position","absolute"],["top","0"],["left","0"],["width","100%"],["opacity","0"],["clip-path","inset(50%)"]],Dn=s=>{let t=s.style,e=[];for(let n=0,i=oe.length;n<i;n++){let[o,a]=oe[n];e.push([o,t.getPropertyValue(o),t.getPropertyPriority(o)]),t.setProperty(o,a,"important")}let r=s.ownerDocument&&s.ownerDocument.activeElement;return r&&r!==s.ownerDocument.body&&s.contains(r)&&typeof r.blur=="function"&&r.blur(),s.setAttribute(St,""),s.inert=!0,e},_n=(s,t)=>{let e=s.style,r=t||[];for(let n=0,i=oe.length;n<i;n++){let o=oe[n][0],a=r.find(c=>c[0]===o);a&&a[1]?e.setProperty(o,a[1],a[2]||""):e.removeProperty(o)}s.removeAttribute(St),s.inert=!1},Rn="iframe, embed, object",In="video, audio",Zr=(s,t)=>{let e=[];for(let r=0,n=s.length;r<n;r++){let i=s[r];if(!i||i.nodeType!==1)continue;i.matches(t)&&e.push(i);let o=i.querySelectorAll(t);for(let a=0,c=o.length;a<c;a++)e.push(o[a])}return e},On=s=>{let t=Zr(s,In);for(let e=0,r=t.length;e<r;e++){let n=t[e];n.paused===!1&&typeof n.pause=="function"&&n.pause()}},Ln=s=>/^class[\s{]/.test(Function.prototype.toString.call(s)),Nn=1500,Xr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Bn=s=>{let t=s.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},Ue=(s,t,e)=>{if(!(!s||typeof s[t]!="function"))try{s[t](...e)}catch(r){console.error("Error in "+t+":",r)}},ae=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.keepAlive=typeof e.keepAlive=="boolean"?e.keepAlive:null,this.keepAliveMode=e.keepAliveMode==="hide"||e.keepAliveMode==="detach"?e.keepAliveMode:null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.capturedScroll=null,this.pageCache=e.pageCache||null,this.detachedNodes=null,this.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let r=t.layout;if(r&&r.isUnit===!0&&typeof r.keepAlive=="boolean")return r.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}getKeepAliveMode(t){if(this.keepAliveMode!==null)return this.keepAliveMode;if(t=t||this.component,t){let r=t.keepAliveMode;if(r==="hide"||r==="detach")return r;let n=t.layout;if(n&&n.isUnit===!0&&(n.keepAliveMode==="hide"||n.keepAliveMode==="detach"))return n.keepAliveMode}let e=this.pageCache;return e!==null&&typeof e.getMode=="function"?e.getMode():"detach"}isDetached(){return this.detachedNodes!==null}captureScroll(){let t=this.component;if(this.setup!==!0||!t||t.rendered!==!0){this.capturedScroll=null;return}this.capturedScroll={value:He(this.getRootNodes(t))}}releaseCapturedScroll(){this.capturedScroll=null}takeScroll(t){let e=this.capturedScroll;return this.capturedScroll=null,e?e.value:He(this.getRootNodes(t))}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=Ln(t)?new t:t(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(jr(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;y.render(t,this.container,this.parent)}afterCreate(t){let e=this.component;!e||this.pageCache===null||(e.loaded===!1&&e.src&&(e.onModuleRender=()=>this.onModuleRender(e)),this.isKeepAlive(e)&&this.callPageHook("onActivate",[t,{restored:!1}]),this.pageCache.historyNavigation===!0&&this.restoreHistoryScroll())}onModuleRender(t){if(this.setup!==!0||this.component!==t)return;let e=t.layout;e&&e.isUnit===!0&&this.isKeepAlive(t)&&Ue(e,"onActivate",[this.params,{restored:!1}])}getScrollKey(){let t=this.route||{};return(t.routeId||"")+"|"+(t.path||"")}getPagePath(){let e=(this.route||{}).path||"",r=e.indexOf("#");return r>-1?e.substring(0,r):e}getRootNodes(t){let e=[],r=Bn(t);r&&e.push(r);let n=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),i=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),o=t.loadingRoots||null,a=[n,i,o];for(let c=0;c<3;c++){let l=a[c];if(l)for(let u=0,h=l.length;u<h;u++){let f=l[u];f&&e.indexOf(f)===-1&&e.push(f)}}return Mn(e),e}callPageHook(t,e){let r=this.component;if(!r)return;Ue(r,t,e);let n=r.layout;n&&n!==r&&n.isUnit===!0&&Ue(n,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,n=()=>ie(this.getRootNodes(r),t);if(n()||typeof requestAnimationFrame>"u")return;let i=Xr(),o=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||n()||Xr()-i>Nn||requestAnimationFrame(o)};requestAnimationFrame(o)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null;let e=this.component;if(!t||!e)return;if(typeof requestAnimationFrame>"u"){ie(this.getRootNodes(e),t);return}let r=++this.scrollToken;requestAnimationFrame(()=>{r!==this.scrollToken||this.setup!==!0||this.component!==e||ie(this.getRootNodes(e),t)})}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=this.takeScroll(t);return this.savedScroll=r,this.pageCache.saveScroll(this.getScrollKey(),r),this.getKeepAliveMode(t)==="hide"&&t.loaded!==!1&&Zr(e,Rn).length===0?(On(e),this.hideInPlace(e)):this.removeNodes(e),this.detachedNodes=e,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}removeNodes(t){let e=new WeakMap;for(let r=0,n=t.length;r<n;r++){let i=t[r],o=i.parentNode;o&&(e.set(i,o),o.removeChild(i))}this.detachedParents=e,this.hiddenInPlace=!1,this.hiddenStyles=null}hideInPlace(t){let e=new WeakMap;for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&i.nodeType===1&&e.set(i,Dn(i))}this.detachedParents=null,this.hiddenInPlace=!0,this.hiddenStyles=e}showInPlace(t,e){let r=this.hiddenStyles;for(let n=0,i=t.length;n<i;n++){let o=t[n];o.nodeType===1&&o.hasAttribute(St)&&_n(o,r?r.get(o):void 0),o.isConnected||e.appendChild(o)}}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.hiddenInPlace;this.hiddenInPlace=!1;let n=this.component,i=this.container;if(!n||n.rendered!==!0||!i||typeof i.appendChild!="function")return this.savedScroll=null,this.hiddenStyles=null,this.releaseComponent(),!1;if(r)return this.showInPlace(this.getRootNodes(n),i),this.hiddenStyles=null,this.setup=!0,L.schedule(),!0;let o=this.getRootNodes(n);for(let a=0,c=o.length;a<c;a++){let l=o[a],u=e?e.get(l):null;(u&&u.isConnected?u:i).appendChild(l)}return this.setup=!0,L.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.detachedParents=null,this.savedScroll=null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.releaseComponent()}releaseComponent(){let t=this.component;this.component=null,t&&typeof t.destroy=="function"&&t.destroy()}remove(t){if(this.setup!==!0){t===!0&&this.evict();return}this.setup=!1,this.scrollToken++;let e=this.component;if(!e)return;let r=this.pageCache;if(t!==!0&&r!==null){if(this.isKeepAlive(e)&&this.detach(e))return;r.saveScroll(this.getScrollKey(),this.takeScroll(e))}this.capturedScroll=null,this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var ts=s=>{if(!s.length)return null;let t={};for(let e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},es=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);if(n===null)return t;for(let i=0,o=n.length;i<o;i++){let a=n[i];a&&t.push(a.replace(":",""))}return t};var Hn=/(\/):[^/(]*?\?/g,Un=/\//g,Wn=/(\?\/+\*?)/g,Fn=/(:[^/?&($]+)/g,qn=/(\*)/g,zn=s=>s.replace(Hn,t=>t.replace(Un,"(?:$|/)")),Gn=s=>(s=s.replace(Wn,"?/*"),s.replace(Fn,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Kn=s=>s.replace(qn,".*"),Vn=(s,t)=>s+=t[t.length-1]==="*"?"":"$",rs=s=>{if(!s)return"";let t=s;return t=zn(t),t=Gn(t),t=Kn(t),t=Vn(t,s),t};var Qn=0,ss=(s,t="")=>{let e=s||"",r=typeof t=="string"&&t?t:e,n=null,i=[],o=r.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),r=r.replace(o[0],""),e=e.replace(o[0],""));let a=r.indexOf("?");if(a>-1){let u=r.substring(a+1);if(u.indexOf("=")>-1){let h=u.split("&");for(let m=0,S=h.length;m<S;m++){let b=h[m];if(!b)continue;let[g,bt=""]=b.split("="),kt=(g||"").trim();kt&&i.push({key:kt,value:(bt||"").trim()})}r=r.substring(0,a);let f=e.indexOf("?");f>-1&&(e=e.substring(0,f))}}let c=n!==null||i.length>0;return c&&!r&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:c}},ns=s=>{if(!s)return"";let t=s.indexOf("?"),e=s.indexOf("#"),r=s.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),s.substring(0,r).replace(/\/\.(?:\/|$)/g,"/")},$n=s=>{if(!s)return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)},jn=s=>{if(!s)return"";let t=s.indexOf("?");if(t===-1)return"";let e=s.indexOf("#",t);return e===-1?s.substring(t+1):s.substring(t+1,e)},ce=class extends I{constructor(t,e,r=null){let n=t.baseUri,o=ss(n,t.rawUri).uriPath,a=es(o),c=ts(a),l=super(c);return this.uri=n,this.matchUri=o,this.paramKeys=a,this.titleCallBack=e,this.pageCache=r,this.setupRoute(t),this.set("active",!1),l}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null,this.pageCache=null,this.importSrc=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+Qn++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=ss(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=rs(this.matchUri);this.uriQuery=new RegExp("^"+r),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(t){this.set("active",!1);let e=this.controller;e&&e.remove(t===!0)}captureScroll(){let t=this.controller;t&&this.get("active")&&t.captureScroll()}releaseCapturedScroll(){let t=this.controller;t&&t.releaseCapturedScroll()}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return e?e.isConnected===!1?!0:typeof e.closest=="function"&&e.closest("["+St+"]")!==null:!1}getLayout(t){if(t.component)return t.component;let e=t.import;if(!e)return null;let r=e&&typeof e=="object"&&!(e instanceof Promise)?e.src:e;return this.importSrc=typeof r=="string"||typeof r=="function"?r:null,Re(e)}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i,keepAlive:o,keepAliveMode:a}=t,c={component:e,container:r,persist:n,parent:i,keepAlive:o,keepAliveMode:a,pageCache:this.pageCache},l=Mt(this);this.controller=new ae(l,c)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let r=this.controller;r&&r.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];i&&this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=ns(t),n=this.uriQuery||/$^/,i=r.match(n);return i===null?(this.resetParams(),e):Array.isArray(i)?this.matchConditions(t)?(this.setParams(i,1),e=i,e):(this.resetParams(),!1):e}matches(t){return(this.uriQuery||/$^/).test(ns(t))&&this.matchConditions(t)}prefetch(){let t=this.importSrc;return t?_e(t):null}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&$n(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=jn(t);if(!r)return!1;let n=new URLSearchParams(r);for(let i=0,o=e.length;i<o;i++){let a=e[i];if(!n.has(a.key)||n.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let r=this.paramKeys;if(!r)return;let n={};for(let i=0,o=r.length;i<o;i++){let a=r[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var Yn=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},Jn=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Xn=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=new RegExp(":"+Jn(r),"gi");s=s.replace(n,()=>e[r])}return s},Zn=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=Xn(t,s),Yn(t)),ti=(s,t)=>(t!==""&&(s+=" - "+t),s),is=(s,t,e)=>t&&(t=Zn(s,t),ti(t,e));var os=(s,t)=>({attr:s,value:t}),ei=(s,t)=>{if(!t.startsWith(s))return!1;let e=t[s.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},le=class extends P{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,n=H.data,i=[];t&&typeof t=="object"&&i.push(os("href",t)),e&&typeof e=="object"&&i.push(os("text",e));let o=null,a="",c="";return i.push({value:["[[path]]",n],callBack:(l,u)=>{if(typeof u.pathname>"u")return;let h=u.getAttribute("href");if(h!==o){o=h;let m=u.pathname+u.search+u.hash;a=m,c=u.hash||u.search?m:u.pathname}let f=r?l===a:ei(c,l);this.update(f)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var ri=()=>typeof window<"u"?window.location:{},si=s=>{if(!s)return"";let t=s.indexOf("#");return t>-1?s.substring(t+1):""},ni=1500,ue=["wheel","touchstart","keydown","pointerdown"],as=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),We=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=Oe,this.keepAliveMode="detach",this.pageCache=new se(this),this.history=null,this.callBackLink=null,this.location=ri(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new q({path:""})}setupHistory(){this.history=re.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new ce(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;typeof r=="number"&&r>=0&&(this.keepAliveMax=r);let n=e?e.mode:void 0;return(n==="hide"||n==="detach")&&(this.keepAliveMode=n),this.pageCache.trim(),this}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),r=te.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.routeId===t)return i}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate(!0)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);for(let i=0,o=t.length;i<o;i++){let c=t[i].component.route;c.resumeRoute(e),n.push(c)}return this.checkGroupForRegistration(r,n),r}checkGroupForRegistration(t,e){let r=this.scrollIntent,n=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=n;let i=this.scrollIntent;i&&i.type==="target"&&i.groupId!==null&&i.groupId!==void 0&&(this.activeScrollGroups.add(i.groupId),this.lastScrollGroup=i.groupId),this.scrollIntent=r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){this.activeScrollGroups.delete(t),this.lastScrollGroup===t&&(this.lastScrollGroup=null);let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,n=e.length;r<n;r++){let i=e[r];i&&typeof i.deactivate=="function"&&i.deactivate(!0)}}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),d.on("click",document,this.callBackLink);let r=this.getEndPoint();return this.navigate(r,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.defaultPrevented===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0||t.altKey===!0||typeof t.button=="number"&&t.button!==0)return!0;let e=t.target&&t.target.closest?t.target.closest("a"):null;if(!e||e.dataset.cancelRoute||e.hasAttribute("download"))return!0;let r=e.getAttribute("target");if(r&&r!=="_self")return!0;let n=e.getAttribute("href");if(n===null)return!0;let i=this.getLinkPath(n);if(i===null)return!0;let o=e.dataset.replace==="true";return this.navigate(i,null,o),t.preventDefault(),t.stopPropagation(),!1}getLinkPath(t){let e=t;if(e.substring(0,2)==="//"||/^[a-z][a-z0-9+.-]*:/i.test(e)){let n=this.location;if(!n||!n.origin||typeof URL>"u")return null;let i;try{i=new URL(e,n.href)}catch{return null}if(i.origin!==n.origin)return null;e=i.pathname+i.search+i.hash}let r=this.baseURI;return r!=="/"&&e.indexOf(r)===0&&(e=e.substring(r.length)),e}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let n=t[e];n&&typeof n.deactivate=="function"&&n.deactivate(!0)}return this.pageCache.clear(),this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.updatePath(),this.activate(),this}prefetch(t){if(typeof t!="string"||!t)return Promise.resolve([]);let e=this.getLinkPath(t);if(e===null)return Promise.resolve([]);let r=this.createURI(e),n=[],i=a=>{if(!a||!a.controller||typeof a.matches!="function"||!a.matches(r))return!1;let c=a.prefetch();return c&&n.push(c),!0},o=this.routes;for(let a=0,c=o.length;a<c;a++)i(o[a]);for(let a of this.switches.values())for(let c=0,l=a.length;c<l&&!i(a[c]);c++);return Promise.all(n)}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=is(t,e,this.title),this}checkActiveRoutes(t,e){t=t||this.getPath(),t!==this.path&&(this.lastPath=this.path),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollGroupsReady=new Set(this.activeScrollGroups),this.scrollWaitToken++;let r=this.pageCache;r.historyNavigation=e===!0;let n=this.captureActiveScroll(),i=this.routes;for(let o=0,a=i.length;o<a;o++){let c=i[o];typeof c>"u"||r.size>0&&c.isDormant()||this.checkRoute(c,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,this.releaseCapturedScroll(n),e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}captureActiveScroll(){let t=[],e=n=>{!n||!n.controller||!n.get("active")||n.isDormant()||(n.captureScroll(),t.push(n))},r=this.routes;for(let n=0,i=r.length;n<i;n++)e(r[n]);for(let n of this.switches.values())for(let i=0,o=n.length;i<o;i++)e(n[i]);return t}releaseCapturedScroll(t){for(let e=0,r=t.length;e<r;e++)t[e].releaseCapturedScroll()}checkSwitches(t,e){let r=this.switches;for(let[n,i]of r.entries())e===!0&&this.pageCache.size>0&&i.length&&i[0].isDormant()||(this.currentGroupId=n,this.checkGroup(i,t));this.currentGroupId=null}checkGroup(t,e){let r=t.length;if(!r)return;let n=null;for(let a=0;a<r;a++)if(t[a].get("active")){n=t[a];break}let i=!1;n&&(i=n.match(e)!==!1);let o;for(let a=0;a<r;a++){let c=t[a];if(typeof c>"u")continue;(c===n?i:c.match(e))!==!1&&o===void 0&&c.controller&&(o=c)}if(!o){n&&n!==t[0]&&n.deactivate(),this.select(t[0],!0);return}this.select(o),n&&n!==o&&n.deactivate();for(let a=0;a<r;a++){let c=t[a];c&&c!==o&&c!==n&&c.deactivate()}}checkRoute(t,e){let r=this.check(t,e);return r!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),r}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){if(!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e===!0))return;let r=this.scrollIntent;if(r&&r.type==="hash")return;let n=si(this.path);if(n){this.scrollIntent={type:"hash",hash:n};return}t.scrollTo?(this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId},this.currentGroupId!==null&&this.currentGroupId!==void 0&&this.activeScrollGroups.add(this.currentGroupId)):t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.scrollGroupsReady.has(t.groupId);if(this.lastScrollGroup=e?t.groupId:null,r){this.scrollToTarget(t.selector,t.groupId);return}typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let r=t.x||0,n=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(r,n)){window.scrollTo(r,n);return}let i=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},o={capture:!0,passive:!0};for(let l=0,u=ue.length;l<u;l++)window.addEventListener(ue[l],i,o);this.cancelScrollWait=()=>{for(let l=0,u=ue.length;l<u;l++)window.removeEventListener(ue[l],i,o)};let a=as(),c=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,n)||as()-a>=ni){this.clearScrollWait(),window.scrollTo(r,n);return}requestAnimationFrame(c)};requestAnimationFrame(c)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){if(e<=0&&t<=0)return!0;let r=document.documentElement;return r?e>0&&e>(r.scrollHeight||0)-(window.innerHeight||0)+1?!1:t<=0||t<=(r.scrollWidth||0)-(window.innerWidth||0)+1:!0}scrollToHash(t){if(!t||typeof document>"u")return;let e=()=>{let c=document.getElementById(t);if(c)return c;try{return document.getElementById(decodeURIComponent(t))}catch{return null}},r=e();if(r){r.scrollIntoView(!0);return}if(typeof requestAnimationFrame>"u")return;let n=++this.scrollWaitToken,i=30,o=0,a=()=>{if(n!==this.scrollWaitToken)return;let c=e();if(c){c.scrollIntoView(!0);return}++o<i&&requestAnimationFrame(a)};requestAnimationFrame(a)}findScrollTarget(t,e){if(typeof document>"u")return null;let r=this.findScopedScrollTarget(t,e);if(r)return r;let n=document.querySelectorAll(t);for(let i=0,o=n.length;i<o;i++){let a=n[i];if(a&&a.isConnected!==!1)return a}return null}findScopedScrollTarget(t,e){if(e==null||!this.switches)return null;let r=this.switches.get(e),n=r&&r[0],i=n&&n.controller&&n.controller.container;if(!i||i.nodeType!==1)return null;let o=i;for(let a=0;a<8;a++){let c=o.parentElement;if(!c||c===document.body||c===document.documentElement)break;let l=c.querySelector(t);if(l)return l;o=c}return null}readScrollTarget(t){let e=window.getComputedStyle(t),r=e.position==="sticky",n=r&&parseFloat(e.top)||0,i=(t.offsetWidth||0)>0||(t.offsetHeight||0)>0,o;if(r){let a=t.style.position;t.style.position="static",o=t.getBoundingClientRect().top+window.scrollY,t.style.position=a}else o=t.getBoundingClientRect().top+window.scrollY;return{sized:i,targetScroll:o-n}}scrollToTarget(t,e){if(typeof t!="string"||typeof document>"u")return;let r=l=>{window.scrollY>l&&window.scrollTo(0,Math.max(0,l))};if(typeof requestAnimationFrame>"u"){let l=this.findScrollTarget(t,e);if(l){let u=this.readScrollTarget(l);u.sized&&r(u.targetScroll)}return}let n=++this.scrollWaitToken,i=30,o=0,a=null,c=()=>{if(n!==this.scrollWaitToken)return;let l=this.findScrollTarget(t,e);if(l){let u=this.readScrollTarget(l);if(u.sized){if(a!==null&&Math.abs(a-u.targetScroll)<1){r(u.targetScroll);return}a=u.targetScroll}}if(++o<i){requestAnimationFrame(c);return}a!==null&&r(a)};requestAnimationFrame(c)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&d.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent(),this.clearScrollWait(),this.pageCache.clear()}getPath(){let t=this.location,e=this.history;return e&&e.type==="hash"?t.hash.replace("#",""):t.pathname+t.search+t.hash}},H=new We;p.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&H.removeRoute(t)});var ls=(s,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&cs(s,i,e)}else cs(s,t,e)},cs=(s,t,e)=>{t.container=s,t.parent=e;let r=H.add(t);ii(s,r)},ii=(s,t)=>{p.add(s,"routes",{route:t})};var us=(s,t,e)=>{};p.addType("switch",s=>{if(!s)return!1;let t=s.id;H.removeSwitch(t)});var hs=(s,t,e)=>{let r=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=s,a.parent=e)}let n=H.addSwitch(t);oi(s,n)},oi=(s,t)=>{p.add(s,"switch",{id:t})};rt.add("cache",Dr).add("onCreated",Gr).add("onDestroyed",Kr).add("bind",Br).add("data",Er).add("state",us).add("onSet",it).add("onState",Xt).add("animateIn",Sr).add("animateOut",br).add("watch",Vr).add("useParent",_r).add("useData",Ir).add("useState",Or).add("getId",Rr).add("addState",Lr).add("addEvent",Nr).add("map",zr).add("for",qr).add("useContext",Tr).add("addContext",Pr).add("context",Ar).add("role",vr).add("aria",wr).add("route",ls).add("debug",Mr).add("dataSet",Ur).add("dataStateSet",Wr).add("switch",hs);export{ht as Ajax,at as Arrays,_s as Atom,y as Builder,P as Component,q as Data,p as DataTracker,tn as DateTime,rt as Directives,Z as Dom,dt as Encode,ds as Events,_ as Html,Re as Import,$ as Jot,pt as Model,le as NavLink,v as Objects,js as Pod,Pt as ResourceCache,tt as SimpleData,mt as State,O as Store,C as Strings,w as Types,gt as Unit,U as base,x as dataBinder,_e as preloadImport,H as router};
|
|
1
|
+
var ct=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var ys=Object.prototype.toString,Ct=Object.prototype.hasOwnProperty,k={create(s){return Object.create(s||null)},extendObject(s,t){if(!s||typeof s!="object"||!t||typeof t!="object")return!1;for(let e in s)Ct.call(s,e)&&!Ct.call(t,e)&&(t[e]=s[e]);return t},clone(s){if(!s||typeof s!="object")return{};try{return structuredClone(s)}catch{return JSON.parse(JSON.stringify(s))}},getClassObject(s){return typeof s=="function"?s.prototype:s},extendClass(s,t){let e=this.getClassObject(s),r=this.getClassObject(t);if(typeof e!="object"||typeof r!="object")return!1;let n=Object.create(e);for(let i in r)n[i]=r[i];return n},hasOwnProp(s,t){return Ct.call(s,t)},isPlainObject(s){return!!s&&ys.call(s)==="[object Object]"},isEmpty(s){if(!s||typeof s!="object"||Array.isArray(s))return!0;if(s instanceof Map||s instanceof Set)return s.size===0;for(let t in s)if(Ct.call(s,t))return!1;return!0}};var w=class{static getType(t){let e=typeof t;return e!=="object"?e:Array.isArray(t)?"array":"object"}static isUndefined(t){return typeof t>"u"}static isObject(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var lt={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||!1},remove(s){delete this.types[s]}};var At=class{constructor(){this.types=new Map}add(t,e){let r=this.types.get(t);r||(r=[],this.types.set(t,r)),r.push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeType(t){let e=this.types.get(t);if(!e)return;if(!e.length){this.types.delete(t);return}let r,n=lt.get(t);if(n){for(let i=0,o=e.length;i<o;i++)r=e[i],r&&(e[i]=null,typeof n=="function"&&n(r));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}let e=this.types.keys();for(let r of e)r&&this.removeType(r);this.types.clear()}};var V=new WeakMap,Ge=new WeakMap,Tt=s=>!!s&&(typeof s=="object"||typeof s=="function"),p=class{static trackingCount=0;static addType(t,e){lt.add(t,e)}static removeType(t){lt.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=Ge.get(t);return e||(e="dt"+this.trackingCount++,Ge.set(t,e)),e}static add(t,e,r){Tt(t)&&this.find(t).add(e,r)}static get(t,e){let r=Tt(t)?V.get(t):void 0;return r?e?r.get(e):r:!1}static has(t,e){let r=Tt(t)?V.get(t):void 0;return r&&e?r.has(e):!1}static find(t){let e=V.get(t);return e||(e=new At,V.set(t,e)),e}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let r=Tt(t)?V.get(t):void 0;if(r){if(!e){r.remove(),V.delete(t);return}r.remove(e),this.isEmpty(r.types)&&V.delete(t)}}};var d={getEvents(s){return typeof s!="object"||s===null?[]:p.get(s,"events")},create(s,t,e,r=!1,n=!1,i=null){return{event:s,obj:t,fn:e,capture:r,swapped:n,originalFn:i}},on(s,t,e,r){if(Array.isArray(s))for(let n=0,i=s.length;n<i;n++)this.add(s[n],t,e,r);else this.add(s,t,e,r);return this},off(s,t,e,r){if(Array.isArray(s))for(let n=0,i=s.length;n<i;n++)this.remove(s[n],t,e,r);else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,n=!1,i=null){if(typeof t!="object"||t===null)return this;let o=this.create(s,t,e,r,n,i);return p.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let n=this.getEvent(s,t,e,r);if(n===!1)return this;if(typeof n=="object"){this.removeEvent(n);let i=this.getEvents(t);if(i){let o=i.indexOf(n);o>-1&&i.splice(o,1),i.length===0&&p.remove(t,"events")}}return this},removeEvent(s){return typeof s=="object"&&s.obj.removeEventListener(s.event,s.fn,s.capture),this},getEvent(s,t,e,r){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(s,t,e,r);return this.search(i,n)},search(s,t){let e,r=this.isSwappable(s.event);for(let n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==s.event||e.obj!==s.obj)&&(e.fn===s.fn||r===!0&&e.originalFn===s.fn))return e;return!1},removeEvents(s){return typeof s!="object"||s===null?this:(p.remove(s,"events"),this)},swap:new Set(["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"]),addSwapped(s){this.swap.add(s)},isSwappable(s){return this.swap.has(s)}};p.addType("events",s=>{d.removeEvent(s)});var Ve={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},Ke=Object.keys(Ve),xs={events:d,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let n=this.events;if(Array.isArray(s))for(let i=0,o=s.length;i<o;i++)n.add(s[i],t,e,r);else n.add(s,t,e,r);return this},off(s,t,e,r){let n=this.events;if(Array.isArray(s))for(let i=0,o=s.length;i<o;i++)n.remove(s[i],t,e,r);else n.remove(s,t,e,r);return this},removeListener(s,t,e,r){return this.events.remove(s,t,e,r),this},_createEvent(s,t,e,r){let n;switch(t){case"HTMLEvents":n=new Event(s,e);break;case"MouseEvents":n=new MouseEvent(s,e);break;default:n=new CustomEvent(s,r);break}return n},createEvent(s,t,e,r){if(typeof t!="object"||t===null)return!1;let n={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};typeof e=="object"&&e!==null&&(n=Object.assign(n,e));let i=this._getEventType(s);return this._createEvent(s,i,n,r)},_getEventType(s){for(let t=0,e=Ke.length;t<e;t++){let r=Ke[t];if(Ve[r].test(s))return r}return"CustomEvent"},trigger(s,t,e){if(typeof t!="object"||t===null)return this;let r=typeof s=="string"?this.createEvent(s,t,null,e):s;return t.dispatchEvent(r),this},mouseWheelEventType:null,getWheelEventType(){let s=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=s())},onMouseWheel(s,t,e,r=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof s=="function"&&s(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,r,!0,s),this},offMouseWheel(s,t,e=!1){typeof t>"u"&&(t=window);let r=this.getWheelEventType();return this.off(r,t,s,e),this},preventDefault(s){return typeof s.preventDefault=="function"?s.preventDefault():s.returnValue=!1,this},stopPropagation(s){return typeof s.stopPropagation=="function"?s.stopPropagation():s.cancelBubble=!0,this}};var ut=class{constructor(){this.errors=[],this.dataTracker=p}augment(t){if(!w.isObject(t))return this;let e=this.constructor.prototype;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,n){return(t[e]=r).apply(t,ct.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(w.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof r<"u"?r:""}createCallBack(t,e,r=[],n=!1){return typeof e!="function"?!1:(...i)=>(n===!0&&(r=r.concat(i)),e.apply(t,r))}bind(t,e){return e.bind(t)}};ut.prototype.extend=(function(){return ut.prototype})();var U=new ut;var ht={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};var Qe=()=>{U.augment({xhrSettings:ht,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=k.extendClass(U.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=ht}})};var C=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,r=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let n={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(o,a,c,l){let u=l===void 0?"":l;if(e!==!1)try{n[a]=decodeURIComponent(u)}catch{n[a]=u}else n[a]=u}),n}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,r=>r[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let r=/([A-Z]{1,})/g;return t.replace(r,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,r=>r.charAt(0).toUpperCase()+r.substring(1).toLowerCase())}};var Et=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:r,url:n,async:i}=this.settings;e.open(r,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=ht.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}setupParams(t,e=null){let r=typeof t;if(!e)return!(t instanceof FormData)&&r==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(r==="string")return n!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(n==="string"&&(e=C.parseQueryString(e,!1)),t instanceof FormData)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.append(i,e[i]);else r==="object"&&(t=Object.assign({},e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,r=t.params;return r?r=this.setupParams(r,e):e&&(r=this.setupParams(e)),r}getXhrSettings(t){let e=this.settings={...U.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var r=0,n=t.length;r<n;r++){var i=t[r];switch(r){case 0:e.url=i;break;case 1:e.params=i;break;case 2:e.completed=i,e.failed=i;break;case 3:e.responseType=i||"json";break;case 4:e.method=i?i.toUpperCase():"POST";break;case 5:e.async=typeof i<"u"?i:!0;break}}else e=this.settings=k.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){let t=this.settings;if(!t||typeof t.headers!="object")return;let e=t.headers;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.xhr?.setRequestHeader(r,e[r])}update(t,e){let r=this.xhr,n=()=>{d.removeEvents(r?.upload),d.removeEvents(r)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":{if((r?.status??0)>=400){typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break}if(typeof i.completed=="function"){let c=this.getResponseData();i.completed(c,this.xhr)}n();break}case"error":typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break;case"progress":typeof i.progress=="function"&&i.progress(t);break;case"abort":typeof i.aborted=="function"&&i.aborted(!1,this.xhr),n();break}}getResponseData(){let t=this.xhr;if(!t)return null;let e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr;if(!e)return;let r=this.update.bind(this);d.on(["load","error","abort"],e,r),d.on("progress",e.upload,r)}};Qe();var ft=(...s)=>new Et(s).xhr;var Ss=(s,t)=>{if(s===t)return!1;try{return JSON.stringify(s)!==JSON.stringify(t)}catch{return!0}},he=class{constructor({max:t=100,ttl:e=3e4}={}){this.entries=new Map,this.max=t,this.defaultTtl=e}get size(){return this.entries.size}setMax(t){this.max=Math.max(1,Number(t)||1),this.evict()}getEntry(t){let e=this.entries.get(t);return e?(this.entries.delete(t),this.entries.set(t,e),e):null}createEntry(t){let e={value:void 0,meta:null,time:0,ttl:this.defaultTtl,hasValue:!1,promise:null};return this.entries.delete(t),this.entries.set(t,e),this.evict(),e}evict(){let t=Math.max(1,this.max);for(;this.entries.size>t;){let e=this.entries.keys().next().value;this.entries.delete(e)}}isFresh(t){return!!t&&t.hasValue&&Date.now()-t.time<t.ttl}has(t){return this.isFresh(this.entries.get(t)||null)}get(t){let e=this.getEntry(t);return this.isFresh(e)?e.value:void 0}set(t,e,r,n=null){let i=this.getEntry(t)||this.createEntry(t);i.value=e,i.meta=n,i.time=Date.now(),i.ttl=typeof r=="number"?r:this.defaultTtl,i.hasValue=!0}invalidate(t){if(Array.isArray(t))return t.reduce((n,i)=>n+this.invalidate(i),0);let e=null;if(typeof t=="string"?e=n=>n.startsWith(t):t instanceof RegExp?e=n=>t.test(n):typeof t=="function"&&(e=t),!e)return 0;let r=0;for(let[n,i]of Array.from(this.entries))e(n,i)&&(this.entries.delete(n),r++);return r}clear(){this.entries.clear()}fetch(t,e,r,n){let i,o=e.promise=new Promise(l=>i=l),a=!1,c=(l,u,h)=>{a||(a=!0,i({ok:l===!0,value:u,meta:h}))};o.then(l=>{if(e.promise===o&&(e.promise=null),this.entries.get(t)===e){if(l.ok){e.value=l.value,e.meta=l.meta,e.time=Date.now(),e.ttl=n,e.hasValue=!0;return}e.hasValue||this.entries.delete(t)}});try{return r(c)}catch(l){return c(!1,void 0,l),null}}resolve(t,e,r,n){r=r||{};let i=typeof r.ttl=="number"?r.ttl:this.defaultTtl,o=this.getEntry(t);if(o&&o.hasValue){if(this.isFresh(o)){let{value:c,meta:l}=o;return queueMicrotask(()=>n(c,l,!0)),null}if(r.swr===!0){let{value:c,meta:l}=o;queueMicrotask(()=>n(c,l,!0));let u=o.promise?null:this.fetch(t,o,e,i);return o.promise.then(h=>{h.ok&&Ss(c,h.value)&&n(h.value,h.meta,!0)}),u}}if(o&&o.promise)return o.promise.then(c=>n(c.value,c.meta,c.ok)),null;o=o||this.createEntry(t);let a=this.fetch(t,o,e,i);return o.promise.then(c=>n(c.value,c.meta,c.ok)),a}load(t,e,r={}){return new Promise((n,i)=>{let o=!0,a=c=>{Promise.resolve().then(e).then(l=>c(!0,l,null),l=>c(!1,void 0,l))};this.resolve(t,a,r,(c,l,u)=>{if(o)return o=!1,u?n(c):i(l);typeof r.onUpdate=="function"&&r.onUpdate(c)})})}},Pt=new he;var bs=s=>{let t=typeof s;return t!=="string"&&t!=="number"?s:$e(s)},$e=s=>[{tag:"text",textContent:s}],je=()=>({props:{},children:[]}),Ye=s=>({props:{},children:$e(s)}),Je=s=>({props:{},children:s}),Xe=s=>({props:s[0]||{},children:bs(s[1])});var A=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t,this.evictCount=t>=8?t>>3:1}get(t){let e=this.cache.get(t);if(e!==void 0)return e.used=!0,e.value}has(t){return this.cache.has(t)}set(t,e){let r=this.cache,n=r.get(t);if(n!==void 0){n.value=e,n.used=!0;return}r.set(t,{value:e,used:!1}),r.size>this.maxSize&&this.evict()}evict(){let t=this.cache,e=this.maxSize-this.evictCount+1;for(let r=0;r<2&&t.size>e;r++){let n=t.keys(),i=t.size;for(;i-- >0&&t.size>e;){let o=n.next().value,a=t.get(o);if(a!==void 0&&a.used){a.used=!1;continue}t.delete(o)}}}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}};var fe=new WeakMap,de=new WeakMap;function Mt(s){if(!s||typeof s!="object")return s;let t=de.get(s);return t!==void 0?t:s}var Ze=new WeakMap;function vs(s,t,e,r){let n=fe.get(s);n||(n=new Map,fe.set(s,n));let i=n.get(e);if(i)return i;let o=new Proxy(s,er(t,e,r));return n.set(e,o),de.set(o,s),o}function ks(s){s&&typeof s=="object"&&fe.delete(s)}function tr(s,t){let e=t.charCodeAt(0),r=e>=48&&e<=57;return s===""?r?"["+t+"]":t:r?s+"["+t+"]":s+"."+t}function er(s,t="",e=""){return{get(r,n,i){let o=r[n];if(t===""&&n in r){if(typeof o=="function"){let c=Ze.get(r);c||(c=new Map,Ze.set(r,c));let l=c.get(n);if(l)return l;let u=o.bind(r);return c.set(n,u),u}return o}if(o=(r[e]||r)[n],o!==null&&typeof o=="object"){let c=tr(t,n);return vs(o,s,c,e)}return o},set(r,n,i,o){if(t===""&&n in r)return r[n]=i,!0;let c=(r[e]||r)[n],l=tr(t,n);return s.set(l,i),c!==i&&c!==null&&typeof c=="object"&&ks(c),!0}}}var Dt=(s,t="stage")=>{let e=new Proxy(s,er(s,"",t));return de.set(e,s),e};var _t=class{constructor(){this.connections=new Map}add(t,e,r){let n=this.getOrCreate(t),i=n.get(e);return i?Array.isArray(i)?i.push(r):n.set(e,[i,r]):n.set(e,r),r}get(t,e){let r=this.connections.get(t)?.get(e);return r?Array.isArray(r)?r[r.length-1]||!1:r:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let r=this.connections.get(t);if(r)if(e)this.unsubscribe(r.get(e)),r.delete(e),r.size===0&&this.connections.delete(t);else{for(let n of r.values())this.unsubscribe(n);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,r=t.length;e<r;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var Rt=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var Z=class extends Rt{constructor(t){super(),this.pubSub=t}subscribe(t){this.msg=t;let e=this.callBack.bind(this);this.token=this.pubSub.on(t,e)}unsubscribe(){this.pubSub&&this.msg&&this.token&&this.pubSub.off(this.msg,this.token),this.pubSub=null,this.msg=null,this.token=null}callBack(){}};var It=class extends Z{constructor(t,e,r){super(r),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}unsubscribe(){super.unsubscribe(),this.data=null,this.prop=null}};var tt=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?Array.from(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let r=document.querySelectorAll(t);return r?r.length===1?r[0]:Array.from(r):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return!t||typeof t!="object"||typeof e>"u"?this:(e=C.uncamelCase(e),t.style[e]=r,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=C.uncamelCase(e);let r=t.style[e];if(r!=="")return r;let n=null,i=t.currentStyle;if(i&&(n=i[e]))return n;let o=window.getComputedStyle(t,null);return o?o[e]:r}static css(t,e,r){return typeof r<"u"?(this.setCss(t,e,r),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,r){t.setAttribute(e,r)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,r){return!t||typeof t!="object"?!1:typeof r<"u"?(this.setAttr(t,e,r),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=C.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,r){e=this.removeDataPrefix(e),e=C.camelCase(e),t.dataset[e]=r}static getData(t,e){return e=C.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,r){return!t||typeof t!="object"?!1:typeof r<"u"?(this.setData(t,e,r),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(!t||typeof t!="object")return this;let e=this.data(t,"style-display"),r=typeof e=="string"?e:"";return this.css(t,"display",r),this}static hide(t){if(!t||typeof t!="object")return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return!t||typeof t!="object"?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return!t||typeof t!="object"?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return typeof t=="object"&&t!==null?t.offsetWidth:!1}static getHeight(t){return typeof t=="object"&&t!==null?t.offsetHeight:!1}static getScrollPosition(t){let e=0,r=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,r=t.scrollTop;break;case"object":e=t.scrollLeft,r=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:r-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,r=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||r.clientWidth||n.clientWidth,o=t.innerHeight||r.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,r=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let r={x:0,y:0};if(!t||typeof t!="object")return r;let n=0;for(;t&&(e===0||n<e);)n++,r.x+=t.offsetLeft+t.clientLeft,r.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return r}static addClass(t,e){if(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let r=e.split(" ");for(let n=0,i=r.length;n<i;n++)t.classList.add(r[n])}return this}static removeClass(t,e){return!t||typeof t!="object"||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return!t||typeof t!="object"||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return!t||typeof t!="object"?this:(t.classList.toggle(e),this)}};var Ot=s=>{let t="textContent";if(!s||typeof s!="object")return t;let e=s.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let r=s.type;if(!r)return t="value",t;switch(r){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var ws=(s,t,e)=>{tt.setAttr(s,t,e)},Cs=(s,t,e)=>{s.checked=s.value==e},As=(s,t,e)=>{e=e==1,rr(s,t,e)},rr=(s,t,e)=>{s[t]=e},Ts=(s,t)=>tt.getAttr(s,t),Es=(s,t)=>s[t],Lt=class extends Z{constructor(t,e,r,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof r=="string"?this.setupFilter(r):r}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=ws,this.getValue=Ts,this;this.getValue=Es;let r=t.type;if(r)switch(r){case"checkbox":return this.setValue=As,this;case"radio":return this.setValue=Cs,this}return this.setValue=rr,this}getAttrBind(t){return t||Ot(this.element)}setupFilter(t){let e=/\[\[[^\]]+\]\]/;return r=>t.replace(e,()=>r)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}unsubscribe(){super.unsubscribe(),this.element={},this.attr="",this.filter=null,this.setValue=null,this.getValue=null}};var Nt=class{unsubscribe(){}};var Bt=class extends Nt{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new Lt(t,e,r,this.pubSub)}addData(t,e){return this.data=new It(t,e,this.pubSub)}unsubscribeSource(t){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}};var Ps=0,Ht=s=>{for(let t=0,e=s.length;t<e;t++){let r=s.charCodeAt(t);if(r===46||r===58||r===91)return s.substring(0,t)}return s},W=class{constructor(t=!1,e=!1){this.callBacks=new Map,this.prefixIndex=t?new Map:null,this.rootIndex=e?new Map:null,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[],this.deliveringMessage=null,this.reentrantMessages=null,this.suppressQueue=!1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.prefixIndex?.clear(),this.rootIndex?.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.reentrantMessages=null}on(t,e){let r=++Ps,n=this.callBacks.get(t);return n||(n=new Map,this.callBacks.set(t,n),this.prefixIndex&&this._indexMessage(t),this.rootIndex&&this._indexRoot(t)),n.set(r,e),r}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let r=t.substring(0,e+1),n=this.prefixIndex.get(r);n||(n=new Set,this.prefixIndex.set(r,n)),n.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let r=t.substring(0,e+1),n=this.prefixIndex.get(r);n&&(n.delete(t),n.size===0&&this.prefixIndex.delete(r))}_indexRoot(t){let e=Ht(t),r=this.rootIndex.get(e);r||(r=new Set,this.rootIndex.set(e,r)),r.add(t)}_unindexRoot(t){let e=Ht(t),r=this.rootIndex.get(e);r&&(r.delete(t),r.size===0&&this.rootIndex.delete(e))}getRootMessages(t){return this.rootIndex?this.rootIndex.get(t)||null:this.callBacks.keys()}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let r=this.callBacks.get(t);r&&(r.delete(e),r.size===0&&(this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t),this.rootIndex&&this._unindexRoot(t)))}remove(t){this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t),this.rootIndex&&this._unindexRoot(t)}publish(t,e,r){if(!this.batchingEnabled){this.publishImmediate(t,e,r);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??=new Set).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,r]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()))}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0,this.reentrantMessages=null),this.isFlushing=!0,this.flushScheduled=!1,this.flushIterations++,this.flushIterations>this.maxFlushIterations){console.error("[DataPubSub] Infinite loop detected! Flush iterations exceeded",this.maxFlushIterations,"- Breaking to prevent memory exhaustion."),console.error("[DataPubSub] Queue size:",this.updateQueue.size),console.error("[DataPubSub] Queued messages:",Array.from(this.updateQueue.keys())),this._breakCascade(),this.flushScheduled=!1,this.isFlushing=!1,this._resolveFlushComplete(),this.flushIterations=0;return}this.debugMode&&console.log("[DataPubSub] Flushing",this.updateQueue.size,"updates (iteration",this.flushIterations+")");let t=this.updateQueue;this.updateQueue=new Map;try{for(let[e,r]of t)this.publishImmediate(e,r[0],r[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_breakCascade(){let t=this.updateQueue;this.updateQueue=new Map;let e=this.reentrantMessages;this.suppressQueue=!0;try{for(let[r,n]of t)e&&e.has(r)||this.publishImmediate(r,n[0],n[1])}finally{this.suppressQueue=!1,this.reentrantMessages=null,this.updateQueue.clear()}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let r=0;r<e;r++)t[r]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let r=0;r<e;r++)t[r]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let r=e.length;for(let n=0;n<r;n++)e[n]()}})}flushSync(){this.flush()}publishImmediate(t,e,r){let n=this.callBacks.get(t);if(!n)return;let i=this.deliveringMessage;this.deliveringMessage=t;for(let o of n.values())if(o)try{o(e,r)}catch(a){console.error('[DataPubSub] Subscriber error for "'+t+'":',a)}this.deliveringMessage=i}};var D=new WeakMap,sr=(s,t)=>{let e=D.get(s);e?Array.isArray(e)?e.push(t):D.set(s,[e,t]):D.set(s,t)},pe=s=>{let t=s.data;if(!t)return;let e=s.subs;if(e)for(let r=0,n=e.length;r<n;r++)t.off(e[r].msg,e[r].token);else s.token&&t.off(s.prop,s.token);s.data=null},me=s=>Mt(s)||s,ge=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new _t,this.pubSub=new W(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null,a=r.indexOf(":");a!==-1&&(o=r.substring(0,a),i=r.substring(a+1));let c=o??"",l=this.setupConnection(t,e,i,c,n),u=l.element,h=e.get(i);return typeof h<"u"?u.set(h):(h=u.get(),h!==""&&l.data.set(h)),this}setupConnection(t,e,r,n,i){let o=this.getBindId(t),a=new Bt(this.pubSub);a.addData(e,r).subscribe(o);let u=`${e.getDataId()}:${r}`;return a.addElement(t,n,i).subscribe(u),this.addConnection(o,"bind",a),a}addConnection(t,e,r){return this.connections.add(t,e,r),this}setBindId(t){let e="db-"+this.idCount++;return t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){if(!t)return this;let e=D.get(t);if(e)if(D.delete(t),Array.isArray(e))for(let n=0,i=e.length;n<i;n++)pe(e[n]);else pe(e);let r=t[this.attr];return r&&this.connections.remove(r),this}hasWatchers(t){return!!t&&D.has(t)}isBound(t){return!!t&&(!!t[this.attr]||D.has(t))}watch(t,e,r,n){if(w.isObject(t)===!1)return this;let i=me(e);if(!i||typeof i.on!="function")return console.warn('DataBinder.watch: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',r,e),i&&typeof i.get=="function"&&n(i.get(r)),this;let o=i.get(r),a=!0,c=u=>{a&&(a=!1,u===o&&(u===null||typeof u!="object"))||n(u)},l=i.on(r,c);return sr(t,{data:i,prop:r,token:l}),n(o),this}watchMany(t,e,r,n){if(w.isObject(t)===!1)return this;let i=r?r.length:0;if(i===0)return this;if(i===1)return this.watch(t,e,r[0],n);let o=me(e);if(!o||typeof o.on!="function")return console.warn('DataBinder.watchMany: data source has no "on" method.',e),this;let a=new Array(i),c=new Array(i);for(let g=0;g<i;g++)a[g]=o.get(r[g]),c[g]=!0;let l=!1,u,h={data:o,prop:r,subs:null},f=()=>{l=!1,h.data!==null&&n(u)},m=g=>{u=g,!l&&(l=!0,typeof o.onFlush=="function"?o.onFlush(f):queueMicrotask(f))},S=new Array(i);for(let g=0;g<i;g++){let vt=g,kt=a[g];S[g]=wt=>{c[vt]&&(c[vt]=!1,wt===kt&&(wt===null||typeof wt!="object"))||m(wt)}}let b=new Array(i);for(let g=0;g<i;g++)b[g]={msg:r[g],token:o.on(r[g],S[g])};return h.subs=b,sr(t,h),n(a[0]),this}unwatch(t,e,r){if(w.isObject(t)===!1)return this;let n=D.get(t);if(!n)return this;let i=me(e),o=Array.isArray(n)?n:[n],a=[];for(let c=0,l=o.length;c<l;c++){let u=o[c],h=Array.isArray(u.prop)?u.prop.join(","):u.prop;if(u.data===i&&h===r){pe(u);continue}a.push(u)}return a.length===0?D.delete(t):D.set(t,a.length===1?a[0]:a),this}publish(t,e,r){return this.pubSub.publish(t,e,r),this}getPrefixMessages(t){return this.pubSub.getPrefixMessages(t)}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.has(t.keyCode)}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,r=this.isDataBound(e);if(r!==null){let n=this.connections.get(r,"bind");if(n){let i=n.element.get();this.pubSub.publish(r,i,e)}}}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&d.on(["change","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&d.off(["change","input"],document,this.changeHandler,!1)}},x=new ge;var Ms=new Map([["class","className"],["text","textContent"],["for","htmlFor"],["readonly","readOnly"],["maxlength","maxLength"],["cellspacing","cellSpacing"],["rowspan","rowSpan"],["colspan","colSpan"],["tabindex","tabIndex"],["celpadding","cellPadding"],["useMap","useMap"],["frameborder","frameBorder"],["contenteditable","contentEditable"]]),Q=s=>Ms.get(s)||s,ye=s=>typeof s=="string"&&s.charCodeAt(0)===111&&s.charCodeAt(1)===110?s.substring(2):s,Ds=/(?:<[a-z][\s\S]*>)/i,_=class{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(r,i):this.append(r,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let r=e.type;r!==void 0&&t.setAttribute("type",r);let n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=e[a];a==="innerHTML"?t.innerHTML=c:a.indexOf("-")!==-1?t.setAttribute(a,c):this.addAttr(t,a,c)}}static addHtml(t,e){return typeof e>"u"||e===""?this:(Ds.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,r){if(r===""||!e)return;if(typeof r==="function")e=ye(e),r.originalCallback?d.add(e,t,r,!1,!0,r.originalCallback):d.add(e,t,r);else{let i=Q(e);t[i]=r}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let r=document.createTextNode(t);return e&&this.append(e,r),r}static createComment(t,e){let r=document.createComment(t);return e&&this.append(e,r),r}static setupSelectOptions(t,e,r){if(!t||typeof t!="object"||!Array.isArray(e))return!1;e.forEach(n=>{let i=new Option(n.label,n.value);t.options.add(i),r!==null&&i.value==r&&(i.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let r=e.pop(),n=r.childNodes;if(n&&n.length>0)for(let i=n.length-1;i>=0;i--){let o=n[i];(o.nodeType!==3||x.isBound(o))&&e.push(o)}p.remove(r),x.isBound(r)&&x.unbind(r)}}static removeElement(t){if(!t)return this;let e=p.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!t||typeof t!="object")return this;let e=Array.from(t.childNodes);for(let i=0,o=e.length;i<o;i++)this.removeElementData(e[i]);let r=t.childNodes;if(r.length>0&&e.length>0){let i=new Set(e);for(let o=0,a=r.length;o<a;o++)i.has(r[o])||this.removeElementData(r[o])}if(typeof t.replaceChildren=="function")return t.replaceChildren(),this;let n;for(;n=t.firstChild;)t.removeChild(n);return this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,r){let n=r||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var R=s=>s?s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null:null;var T=class extends _{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e,n),r.appendChild(i),i}static addAttributes(t,e,r){if(!(!e||e.length<1))for(let n=0,i=e.length;n<i;n++){let o=e[n];this.addAttr(t,o.key,o.value,r)}}static addAttr(t,e,r,n){if(r===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){if(e=ye(e),r.originalCallback)d.add(e,t,r,!1,!0,r.originalCallback);else{let a=r,c=function(l){a.call(this,l,n)};d.add(e,t,c,!1,!0,a)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,r);return}let o=Q(e);t[o]=r}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var nr=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,ir=new A(1e3),_s=new Set(["disabled","checked","required","selected","hidden","readonly","readOnly","multiple","open","autofocus","inert"]),Rs=s=>typeof s=="string"?s!==""&&s!=="false":!!s,Is=(s,t)=>{if(t.charCodeAt(4)===45){s.removeAttribute(t);return}let e=Q(t);if(e in s){s[e]="";return}s.removeAttribute(t)},P={isWatching(s){if(Array.isArray(s)){let t=s[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(s)},hasParams(s){return typeof s=="string"&&s.includes("[[")},_getWatcherProps(s){let t=ir.get(s);if(t!==void 0)return t;let e=s.match(nr),r=e?e.map(n=>n.slice(2,-2)):null;return ir.set(s,r),r},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"disabled":case"checked":case"required":case"selected":case"hidden":case"readonly":case"readOnly":case"multiple":case"open":case"autofocus":case"inert":s[t==="readonly"?"readOnly":t]=Rs(e);break;case"src":if(s.tagName==="IMG"){s.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}s.src=e;break;default:if(e===""&&t){Is(s,t);break}T.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace(nr,function(n,i,o){let a=e?t[r]:t;r++;let c=a.get(o);return c??""})},_getWatcherCallBack(s,t,e,r,n){let i=this._getWatcherProps(e);if(i&&i.length===1&&e.length===i[0].length+4){let o=i[0],a=n?t[0]:t;return _s.has(r)?()=>{this.updateAttr(s,r,a.get(o))}:()=>{let c=a.get(o);this.updateAttr(s,r,c!=null?String(c):"")}}return()=>{let o=this.replaceParams(e,t,n);this.updateAttr(s,r,o)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,R(t)]:e.length<2?[e[0],R(t)]:e},getPropValues(s,t,e){let r=[];for(let n=0,i=t.length;n<i;n++){let a=(e?s[n]:s).get(t[n])??"";r.push(a)}return r},getCallBack(s,t,e,r,n,i){let o=s.attr||"textContent",a=s.callBack;if(typeof a=="function"){let c=i||this._getWatcherProps(r)||[],l=c.length>1;return(u,h)=>{u=l!==!0?u:this.getPropValues(e,c,n);let f=a(u,t,h);typeof f<"u"&&this.updateAttr(t,o,f)}}return this._getWatcherCallBack(t,e,r,o,n)},addDataWatcher(s,t,e){let r=this.getValue(t,e),n=r[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=r[0],o=Array.isArray(n),a=this._getWatcherProps(i);if(!a)return;let c=this.getCallBack(t,s,n,i,o,a);if(!o)a.length>1?x.watchMany(s,n,a,c):this.addWatcher(s,n,a[0],c);else for(let l=0,u=a.length;l<u;l++)this.addWatcher(s,n[l],a[l],c)},getWatcherSettings(s,t=null){if(typeof s=="string")return{attr:t,value:s};if(Array.isArray(s)){let e=s[s.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let r=s[1]&&typeof s[1]=="object"?[s[0],s[1]]:[s[0]];return typeof e=="function"?{attr:t,value:r,callBack:e}:{attr:e||"textContent",value:r}}return s},setup(s,t,e){t&&this.addDataWatcher(s,this.getWatcherSettings(t),e)},addWatcher(s,t,e,r){x.watch(s,t,e,r)}};var Os=s=>({props:{watch:s},children:[]}),Ls=s=>{if(s.length===0)return je();let t=s[0],e=typeof t;if(e==="string"||e==="number")return Ye(t);if(Array.isArray(t))return P.isWatching(t)?Os(t):Je(t);let r=s[1]??s[0]??[];if(r&&Array.isArray(r)&&P.isWatching(r)){let n=s[0]&&!Array.isArray(s[0])?s[0]:{};s[0]={...n,watch:r},s[1]=[]}return Xe(s)},Ns=s=>(...t)=>{let{props:e,children:r}=Ls(t);return s(e,r)};var dt=class{static resume(t,e){if(!t)return null;let r=localStorage.getItem(t);if(r===null)return e!==void 0?e:void 0;try{let n=JSON.parse(r);return n===null&&e!==void 0?e:n}catch(n){return console.warn('[LocalData] Failed to parse stored value for key "'+t+'". Removing corrupted entry.',n),localStorage.removeItem(t),e!==void 0?e:void 0}}static store(t,e){if(!t||!e)return!1;try{let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}catch(r){return console.error('[LocalData] Failed to store data for key "'+t+'".',r),!1}}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Ut=(s={})=>{let t={};if(!w.isObject(s))return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i];typeof o!="function"&&(t[i]=o)}return t};var Bs=0,or=new A(8e3),F={CHANGE:"change",DELETE:"delete"},xe=(s,t)=>{let e=or.get(s);return e||(e={change:`${s}:change`,delete:`${s}:delete`},or.set(s,e)),t==="change"?e.change:e.delete},I=class s{constructor(t={}){this.dirty=!1,this._retainState=!1,this._refreshState=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=this.createEventSub();let e=Ut(t);this._initAttributes(e);let r=Dt(this);return this._proxy=r,r}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}createEventSub(){return new W}_canSilentInit(){let t=s.prototype;return this.set===t.set&&this._setAttr===t._setAttr&&this._publish===t._publish}_initAttributes(t){if(this._canSilentInit()===!1){this.set(t);return}let e=this.stage,r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n],a=t[o];a!==void 0&&(e[o]=a)}}_init(){let t=++Bs;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){this.unlink(),this.eventSub.reset()}on(t,e){let r=xe(t,F.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=xe(t,F.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,r,F.CHANGE))}publishLocalEvent(t,e,r,n){let i=xe(t,n);this.eventSub.publish(i,e,r)}_publish(t,e,r,n){this.publishLocalEvent(t,e,r,n),x.getPrefixMessages(this._dataId)!==null&&(r=r||this,x.publish(this._dataId+t,e,r))}set(t,e,r){if(typeof t!="object")return this._setAttr(t,e,r),this;let n=Object.keys(t);for(let i=0;i<n.length;i++){let o=n[i],a=t[o];typeof a!="function"&&this._setAttr(o,a,e,r)}return this}_silentSet(t){let e=this.stage,r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];e[o]=t[o]}}getModelData(){return this.stage}_deleteAttr(t,e,r=this){delete t[e],this.publishLocalEvent(e,null,r,F.DELETE)}toggle(t){return typeof t>"u"?this:(this.set(t,!this.get(t)),this)}increment(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let r=this.get(t);return this.set(t,r+e),this}decrement(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let r=this.get(t);return this.set(t,r-e),this}concat(t,e){if(typeof t>"u")return this;let r=this.get(t);return this.set(t,r+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t,e){return this.key=e!=null?t+":v"+e:t,this}resume(t){let e=dt.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return dt.store(String(this.key),t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,r){let n=r||e,i=t.get(e);typeof i<"u"&&this.get(n)!==i&&this.set(n,i);let o=t.on(e,(c,l)=>{if(l===this)return!1;this.set(n,c,t)}),a=this.on(n,(c,l)=>{if(l===t)return!1;t.set(e,c,this)});return this.addLink(o,t,e,a),t.addLink(a,this,n,o),o}addLink(t,e,r,n){this.links.set(t,{data:e,attr:r,pair:n})}unlink(t){if(t){this.removeLink(t);return}let e=this.links;e.size!==0&&(e.forEach((r,n)=>{this.removeLink(n,!1)}),e.clear())}removeLink(t,e=!0){let r=this.links.get(t);if(r){let n=r.data;r.attr&&n.off(r.attr,t);let i=r.pair,o=i&&n.links;if(o){let a=o.get(i);a&&(o.delete(i),a.attr&&this.off(a.attr,i))}}e!==!1&&this.links.delete(t)}};I.prototype.isData=!0;var ar=new Set(["__proto__","prototype","constructor"]),Hs=s=>{let t=[],e=s.length,r=0;for(let n=0;n<e;n++){let i=s.charCodeAt(n);i!==46&&i!==91&&i!==93||(n>r&&t.push(s.substring(r,n)),r=n+1)}return e>r&&t.push(s.substring(r)),t.length>0?t:null},v={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new A(5e3),hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},isSafeAttr(s){return!ar.has(s)},getSegments(s){let t=this.segmentCache.get(s);if(t!==void 0)return t;if(t=Hs(s),t){for(let e=0,r=t.length;e<r;e++)if(ar.has(t[e])){console.warn("[Data] Blocked unsafe path segment in: "+s),t=null;break}}return this.segmentCache.set(s,t),t}};var N=class{static set(t,e,r){if(!v.hasDeepData(e)){if(!v.isSafeAttr(e))return;t[e]=r;return}let n,i=v.getSegments(e);if(!i)return;let o=i.length,a=o-1;for(let c=0;c<o;c++){let l=i[c];if(c===a){t[l]=r;break}if(t[l]===void 0){let u=l.charCodeAt(0);t[l]=u<48||u>57?{}:[]}t=t[l]}}static delete(t,e){if(!v.hasDeepData(e)){if(!v.isSafeAttr(e))return;delete t[e];return}let r=v.getSegments(e);if(!r)return;let n=r.length,i=n-1;for(let o=0;o<n;o++){let a=r[o],c=t[a];if(c===void 0)break;if(o===i){if(Array.isArray(t)){let l=Number(a);Number.isInteger(l)&&l>=0&&l<t.length&&t.splice(l,1);break}delete t[a];break}t=c}}static get(t,e){if(!v.hasDeepData(e))return t[e]??void 0;let r=v.getSegments(e);if(!r)return;let n=r.length,i=n-1;for(let o=0;o<n;o++){let a=r[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var cr=new Set,Wt=class{static MAX_DEPTH=50;static publishDeep(t,e,r,n){if(!v.hasDeepData(e)){this.publish(e,r,n);return}let i,o=v.getSegments(e);if(!o)return;let a=o.length,c=a-1,l="";for(let u=0;u<a;u++){let h=o[u];t=t[h];let f=h.charCodeAt(0);u>0?(f<48||f>57)&&(l+="."+h):l=h;let m;if(u===c)m=r;else{let S=o[u+1],b=S.charCodeAt(0);if(b>=48&&b<=57){l+="["+S+"]";continue}let g={};g[S]=t[S],m=g}this.publish(l,m,n)}}static publish(t,e,r,n=null,i=0){if(t=t||"",r(t,e),!(!e||typeof e!="object"||(e=Mt(e),n===null&&(cr.clear(),n=cr),!n))){if(n.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(i>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}n.add(e),Array.isArray(e)?this.publishArray(t,e,r,n,i):this.publishObject(t,e,r,n,i)}}static publishArray(t,e,r,n,i){let o=e.length;for(let a=0;a<o;a++){let c=e[a],l=t+"["+a+"]";this._checkPublish(l,c,r,n,i)}}static publishObject(t,e,r,n,i){let o=Object.keys(e);for(let a=0,c=o.length;a<c;a++){let l=o[a],u=e[l],h=t+"."+l;this._checkPublish(h,u,r,n,i)}}static _checkPublish(t,e,r,n,i){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r,n,i+1)}};var q=class s extends I{setup(){this.attributes={},this.stage={}}createEventSub(){return new W(!1,!0)}_canSilentInit(){let t=s.prototype;return this.set===I.prototype.set&&this._setAttr===t._setAttr&&this._publish===t._publish}_initAttributes(t){if(this._canSilentInit()===!1){this.set(t);return}let e=this.stage,r=this.attributes,n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];if(c!==void 0){if(v.hasDeepData(a)){N.set(r,a,c),N.set(e,a,c);continue}v.isSafeAttr(a)&&(r[a]=c,e[a]=c)}}}_setAttr(t,e,r,n){if(typeof e!="object"&&e===this.get(t))return;!r&&n!==!0?N.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),N.set(this.stage,t,e);let i=this._upstream,o=r;r=r||this,this._publish(t,e,r,F.CHANGE),i&&o!==i.data&&i.keys.has(t)&&i.data.set(i.prefix+t,e,this)}_silentSet(t){let e=this.stage,r=this.attributes,n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];e[a]=c,r[a]=c}}linkAttr(t,e){let r=t.get(e);if(!r)return;let n=Object.keys(r);for(let i=0,o=n.length;i<o;i++){let a=n[i];this.link(t,e+"."+a,a)}}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let n=new e(r);return typeof n.linkScope=="function"?n.linkScope(this,t):n.linkAttr(this,t),n}linkScope(t,e){let r=t.get(e);if(!r)return;let n=e+".",i=new Set(Object.keys(r));for(let o of i){let a=n+o,c=t.on(a,(l,u)=>{if(u===this)return!1;this.set(o,l,t)});this.addLink(c,t,a,null)}this._upstream={data:t,prefix:n,keys:i}}unlink(t){t||(this._upstream=null),super.unlink(t)}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.push(e),this.set(t,r),this}concat(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r=r.concat(e),this.set(t,r),this}unshift(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.unshift(e),this.set(t,r),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.shift();return this.set(t,e),r}getIndex(t,e,r){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===r)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r,n){if(this._publishAttr(t,e,r,n),!e||typeof e!="object")return;let i=t.length,o=n===F.CHANGE?":change":":"+n,a=o.length,c=i+a,l=this.eventSub.getRootMessages(Ht(t))||[];for(let h of l){if(h.length<=c||!h.endsWith(o)||!h.startsWith(t))continue;let f=h.charCodeAt(i);if(f!==46&&f!==91)continue;let m=h.slice(0,h.length-a);this._publishAttr(m,this.get(m),r,n)}let u=x.getPrefixMessages(this._dataId);if(u){let h=this._dataId.length;for(let f of u){if(f.length-h<=i||!f.startsWith(t,h))continue;let S=f.charCodeAt(h+i);if(S!==46&&S!==91)continue;let b=f.slice(h);x.publish(f,this.get(b),r)}}}_publishAttr(t,e,r,n){x.getPrefixMessages(this._dataId)!==null&&x.publish(this._dataId+t,e,r),this.publishLocalEvent(t,e,r,n)}mergeStage(){this.attributes=k.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,r=this){N.delete(t,e),this._delCommitter=r;let n=this._deleteCb||(this._deleteCb=i=>this._publishAttr(i,null,this._delCommitter,F.DELETE));Wt.publish(e,null,n)}_getAttr(t,e){return N.get(t,e)}};var Us={"\n":"\\n","\r":"\\n"," ":"\\t"},Ws=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>Us[r])},lr=(s,t)=>{if(typeof s!="string")return s;s=Ws(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},Se=(s,t)=>{let e=typeof s;if(e==="undefined")return s;if(e!=="object")return s=lr(s),s;let r=Array.isArray(s)?[...s]:{...s};return Object.keys(r).forEach(n=>{let i=r[n];i!==null&&(r[n]=typeof i=="string"?Se(i,t):lr(i,t))}),r};function ur(s){if(typeof s>"u"||s.length<1)return!1;try{return JSON.parse(s)}catch(t){return console.warn("[Encode] Failed to parse JSON.",t),!1}}function be(s){return typeof s<"u"?JSON.stringify(s):null}var pt=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?k.clone(t):t,n=Se(r,e);return be(n)}static json={encode:be,decode:ur};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Ft=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.requestOptions=null,this.init()}init(){let t=this.model;t&&t.url&&(this.url=t.url)}isValid(){let t=this.validate();if(t!==!1){let e=this.validateCallBack;typeof e=="function"&&e(t)}return t}validate(){return!0}getDefaultParams(){return""}setupParams(t){let e=this.getDefaultParams();return t=this.addParams(t,e),t}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+t[r]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=C.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=C.parseQueryString(e,!1)),this._isFormData(t))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.append(r,e[r]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let r=this.model.get("id"),n="id="+r,i=r?`/${r}`:"",o=this.model;return this._get(i,n,t,e,a=>{if(a){let c=this.getObject(a);c&&o.set(c)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+pt.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._put(i,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._post(i,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._patch(i,r,t,e)}delete(t,e){let r=this.model.get("id"),n=typeof r<"u"?"id="+r:this.setupObjectData(),i=r!=null?`/${r}`:"";return this._delete(i,n,t,e)}getAllParams(t,e,r,n){let i=this.model.get();t=isNaN(Number(t))?0:t,e=isNaN(Number(e))?50:e;let o=i.search||"",a=f=>{try{return JSON.stringify(f)}catch(m){return console.error("[ModelService] Failed to serialize request param.",m),""}},c=i.filter||"";typeof c=="object"&&(c=a(c));let l=i.dates||"";typeof l=="object"&&(l=a(l));let u=i.orderBy||"";typeof u=="object"&&(u=a(u));let h=i.groupBy||"";return Array.isArray(h)&&(h=a(h)),"&filter="+encodeURIComponent(c)+"&offset="+t+"&limit="+e+"&dates="+encodeURIComponent(l)+"&orderBy="+encodeURIComponent(u)+"&groupBy="+encodeURIComponent(h)+"&search="+encodeURIComponent(o)+"&lastCursor="+(typeof r<"u"&&r!==null?encodeURIComponent(r):"")+"&since="+(typeof n<"u"&&n!==null?encodeURIComponent(n):"")}all(t,e,r,n,i=null,o=null){let a=this.getAllParams(r,n,i,o);return this._get("",a,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let r=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(r)}withOptions(t){return Object.create(this,{requestOptions:{value:t||null,writable:!0}})}withCache(t=!0){return this.withOptions({...this.requestOptions,cache:t})}setupRequest(t,e,r,n,i,o){o=o||this.requestOptions||null;let a=(h,f)=>{typeof i=="function"&&i(h),this.getResponse(h,n,f)},c={url:this.getUrl(t),method:e,params:r,completed:a},l=this._isFormData(r);if(l&&(c.headers={}),!o)return ft(c);o.invalidate&&(c.completed=(h,f)=>{h!==!1&&h!=null&&Pt.invalidate(o.invalidate),a(h,f)});let u=o.cache;return!u||!this.isCacheableMethod(e)||l?ft(c):this.cachedRequest(c,u===!0?{}:u)}isCacheableMethod(t){let e=String(t||"").toUpperCase();return e==="GET"||e==="HEAD"}getCacheKey(t){let e=t.params||"";if(typeof e=="object")try{e=JSON.stringify(e)}catch{e=""}return t.method.toUpperCase()+" "+t.url+(e?" "+e:"")}cachedRequest(t,e){let r=e.key||this.getCacheKey(t),n=t.completed,i=o=>ft({...t,completed:(a,c)=>o(a!=null,a,c),failed:(a,c)=>o(!1,!1,c),aborted:(a,c)=>o(!1,!1,c)});return Pt.resolve(r,i,{ttl:e.ttl,swr:e.swr},(o,a)=>n(o,a))}setupEventSource(t,e,r,n,i=!0){let o=null,a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0)},h=()=>{if(c||!i||l)return;u(),a=setTimeout(()=>{a=void 0,f()},3e3)},f=()=>{if(c||l)return;if(o){try{o.close()}catch{}o=null}l=!0;let m=this.getUrl(t),S=e?"?"+e:"";o=new EventSource(m+S,{withCredentials:!0}),o.onopen=()=>{l=!1,u(),n&&n()},o.onerror=()=>{l=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,h())},o.onmessage=b=>{try{let g=JSON.parse(b.data);r&&r(g)}catch{}}};return f(),{get source(){return o},close:()=>{if(c=!0,l=!1,u(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return P.isWatching(t)&&(t=P.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,r,n,i){return this._request("","POST",t,e,r,n,i)}_get(t,e,r,n,i,o){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i,o)}_post(t,e,r,n,i,o){return this._request(t,"POST",e,r,n,i,o)}_put(t,e,r,n,i,o){return this._request(t,"PUT",e,r,n,i,o)}_patch(t,e,r,n,i,o){return this._request(t,"PATCH",e,r,n,i,o)}_delete(t,e,r,n,i,o){return this._request(t,"DELETE",e,r,n,i,o)}_request(t,e,r,n,i,o,a){return r=this.setupParams(r),r=this.addParams(r,n),this.setupRequest(t,e,r,i,o,a)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return{};let e=this;class r extends e{constructor(i){super(i)}}return Object.assign(r.prototype,t),r}};var Fs=s=>{let t={};if(!w.isObject(s)||!s.defaults)return t;let{defaults:e}=s;return Object.keys(e).forEach(r=>{let n=e[r];typeof n!="function"&&(t[r]=n)}),delete s.defaults,t},qs=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},zs=0,mt=class extends q{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,r=qs(t),n=e.prototype.service.extend(r),i=Fs(t);class o extends e{constructor(c){let l={...i,...Ut(c)};super(l),this.xhr=new n(this)}dataTypeId=`bm${zs++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};mt.prototype.service=Ft;var et=class extends I{};var gt=class extends et{setup(){this.stage={}}addAction(t,e){return typeof e<"u"&&this.set(t,e),this}getState(t){return this.get(t)}removeAction(t,e){if(e)return this.off(t,e),this;let r=this.stage;return typeof r[t]<"u"&&delete r[t],this}};var qt=class extends gt{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var O=class{static targets=new Map;static ownerCounts=new Map;static restore(t,e){this.targets.set(t,e),this.addOwner(t)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new qt(t)),this.targets.get(t)}static attach(t){let e=this.getTarget(t);return this.addOwner(t),e}static addOwner(t){this.ownerCounts.set(t,(this.ownerCounts.get(t)||0)+1)}static detach(t){let e=this.ownerCounts.get(t);if(e===void 0)return;if(e>1){this.ownerCounts.set(t,e-1);return}this.ownerCounts.delete(t);let r=this.targets.get(t);r&&(r.remove(),this.targets.delete(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,r){let n=this.getTarget(t);return e&&n.addAction(e,r),n}static addAction(t,e,r){return this.add(t,e,r)}static removeAction(t,e,r){if(r){this.off(t,e,r);return}let n=this.getTarget(t);n&&e&&n.removeAction(e)}static on(t,e,r){let n=this.getTarget(t);return e?n.on(e,r):null}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,r);return}this.targets.delete(t),this.ownerCounts.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};var ve=Symbol("unknown"),ke=s=>{if(!s||typeof s!="object")return null;let t={};for(let e in s){if(!Object.prototype.hasOwnProperty.call(s,e))continue;let r=s[e];if(r===null||typeof r!="object"){t[e]=r;continue}try{t[e]=JSON.stringify(r)}catch{t[e]=ve}}return t},Gs=(s,t)=>{let e=new Set([...Object.keys(s),...Object.keys(t)]);for(let r of e){let n=s[r],i=t[r];if(!(n===ve||i===ve)&&n!==i&&!(n!==n&&i!==i))return!1}return!0},we=(s,t)=>{!s||!t||Object.defineProperty(s,"_initialStage",{value:t,configurable:!0,writable:!0,enumerable:!1})},rt=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let n=r.data.stage,i=e.data.stage,o=null;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let c=n[a];c!==i[a]&&(o===null&&(o={}),o[a]=c)}o!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(o):e.data.set(o))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}this._releaseLinks(e,r);let n=ke(r.stage);we(r,n);let i=e?e._initialStage:null,o=!!(i&&n&&!Gs(i,n));if(e&&e.stage&&(!o||e._retainState||r._retainState)){let a=e._retainState||r._retainState,c=!a&&(e._refreshState||r._refreshState),l=this._buildExternalUpdates(e.stage,r.stage,a,c);k.isEmpty(l)||r._silentSet(l)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,n){let i={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(n){Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);continue}let a=t[o];!r&&a==null||a!==e[o]&&(i[o]=a)}return i}static _resumeOwned(t,e){let r=t.data;if(!r){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(r,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let n=e._refreshState||t.data._refreshState,i=this._buildOwnedUpdates(e.stage,t.data.stage,n);k.isEmpty(i)||t.data._silentSet(i)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(r){Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);continue}let o=t[i];o!=null&&o!==e[i]&&(n[i]=o)}return n}};var zt=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let n=t[r];this.on(n[0],n[1],n[2],n[3])}}on(t,e,r,n){d.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){d.off(t,e,r,n);let i,o=this.events;for(let a=0,c=o.length;a<c;a++)if(i=o[a],i.event===t&&i.obj===e&&i.callBack===r&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];d.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];d.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var Gt=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,n){return{action:t,state:e,callBack:r,targetId:n,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){for(let r=0,n=t.length;r<n;r++){let i=t[r];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,c=i[o],l=c!==null?c:void 0;l&&typeof l=="object"&&(a=l.callBack,l=l.state),e.push(this.createState(o,l,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,n=e.length;r<n;r++){let i=e[r];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,n=e.length;r<n;r++){let i=e[r];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&O.remove(i.targetId,i.action,i.token)}}restore(t){O.restore(t.id,t);let e=this.callBackStates;if(e)for(let n=0,i=e.length;n<i;n++){let o=e[n];o.callBackToken=t.on(o.action,o.callBack)}let r=this.remoteStates;if(r)for(let n=0,i=r.length;n<i;n++){let o=r[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,r){let n=O.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&(e.callBackToken=t.on(n,o),this.callBackStates.push(e)),r||null}};var M=[],Kt=0,Ce=!1,Ks=typeof queueMicrotask=="function"?queueMicrotask:s=>Promise.resolve().then(s),Vs=s=>{let t=s.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||s.container||null},Qs=s=>{s._mountPending=!1;try{s.afterMount()}catch(t){console.error("Error in afterMount:",t)}},hr=()=>{Ce=!1;let s=M;if(s.length===0)return;M=[];let t=[];for(let e=0,r=s.length;e<r;e++){let n=s[e];if(n.rendered!==!0||n._mountPending!==!0){n._mountPending=!1;continue}let i=Vs(n);if(i&&i.isConnected===!0){Qs(n);continue}t.push(n)}t.length&&(M=M.length?t.concat(M):t),M.length&&Kt===0&&M.length!==t.length&&Ae()},Ae=()=>{Ce||(Ce=!0,Ks(hr))},L={add(s){s._mountPending!==!0&&(s._mountPending=!0,M.push(s))},enter(){Kt++},leave(){--Kt>0||(Kt=0,M.length&&Ae())},schedule(){M.length&&Ae()},flush(){hr()},get size(){return M.length}};p.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var $s=0,yt=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+$s++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,n;r!=null&&e!=null?n="pk:"+r+":"+e:r!=null?n="pk:"+r:e!=null?n="pk:"+e:n="pc"+this.persistedCount++;let i=this.persistedChildren[n];return i&&t.unitType===i.unitType&&t.resumeScope(i),t.persistToken=n,this.persistedChildren[n]=t,n}removePersistedChild(t,e){if(!this.rendered)return;let r=t?this.persistedChildren[t]:null;r&&(e&&r!==e||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){p.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&L.add(this)}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return _.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&_.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,r=t.length;e<r;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var E=class extends yt{constructor(t,e,r){super(t,e,r),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t,this._externalData&&!t._initialStage&&we(t,ke(t.stage)))}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){rt.resume(this,t)}_refreshData(){rt.refresh(this)}_refreshContextData(){rt.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=O.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();k.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Gt(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),O.detach(String(t.id)),this.stateResumed=!1}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new zt)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}};var Vt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Qt=(s,t)=>typeof s!="function"&&t==="setupStates"?()=>s:s;var Te=(s,t)=>{if(!s)return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=Vt[i]||i;t[a]=Qt(o,a)}return t},js=s=>Te(s,{}),Ys=0,fr=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Ys++,e},$=(s,t=E)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=js(s),fr(t,e)):(e={render:r==="function"?s:()=>s},fr(t,e))};var Js=(s,t)=>{let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=Vt[i]||i;t.prototype[a]=Qt(o,a)}return t},Xs=0,Zs=s=>{let t=class extends s{};return t.prototype._classId="pod"+Xs++,t},tn=(s,t=E)=>{if(!s)return null;let e=Zs(t),r={},n=s(r);return Js(r,e),e.prototype.render=n,e};var dr=new Map,j=()=>typeof Intl<"u"&&typeof Intl.DateTimeFormat=="function",Y=(s,t,e)=>{let r=dr.get(s);return r||(r=new Intl.DateTimeFormat(t,e),dr.set(s,r)),r},xt=s=>s instanceof Date&&!Number.isNaN(s.getTime()),en=/(?:Z|[+-]\d{2}:?\d{2})$/i,rn=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3})\d*)?)?)?$/,sn=s=>{if(typeof s=="string"){let e=rn.exec(s.trim());if(e){let r=e[7]?Number((e[7]+"00").substring(0,3)):0;return[Number(e[1]),Number(e[2]),Number(e[3]),Number(e[4]||0),Number(e[5]||0),Number(e[6]||0),r]}}let t=new Date(s);return xt(t)?[t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]:null},pr=(s,t)=>{let e=Y("zone|"+t,"en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),r={year:0,month:1,day:1,hour:0,minute:0,second:0},n=e.formatToParts(s);for(let c=0,l=n.length;c<l;c++){let u=n[c];u.type in r&&(r[u.type]=Number(u.value))}let i=r.hour===24?0:r.hour,o=Date.UTC(r.year,r.month-1,r.day,i,r.minute,r.second),a=s-(s%1e3+1e3)%1e3;return o-a},nn=[31,28,31,30,31,30,31,31,30,31,30,31],on={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(s=new Date().getDay(),t=!1){if(j()){let n=new Date(2004,0,4+s),i=t?"short":"long";return Y("weekday|"+i,void 0,{weekday:i}).format(n)}let e=this.dayNames;if(s<0||s>=e.length)return null;let r=e[s];return t?r.substring(0,3):r},convertJsMonth(s){return this.padNumber(s+1)},convertDate(s,t=!1){if(!s)return"";let e=this.createDate(s);if(!xt(e))return"";if(j()){let n={weekday:"long",month:"short",day:"2-digit"};return t&&(n.year="numeric"),Y("convert|"+(t?1:0),void 0,n).format(e)}let r=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+r},padNumber(s){return s<=9?"0"+s:String(s)},createDate(s){return s?(typeof s=="string"&&s.indexOf("-")>-1&&(s=s.replace(/\s/,"T"),s=s.indexOf(":")>-1?s:s+"T00:00:00"),new Date(s)):new Date},format(s,t){let e=this.createDate(t);return xt(e)?s!=="sql"&&j()?Y("date",void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(e):this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),s):""},formatTime(s,t){let e=this.createDate(s);if(!xt(e))return"";if(t!==24&&j())return Y("time",void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(e);let r=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),r)},getMeridian(s){return s=Number(s),s>=12?"PM":"AM"},convert24To12(s){return s=Number(s),s%12||12},convert12To24(s,t){return s=Number(s)%12,String(t||"").toLowerCase()==="pm"&&(s=s+12),s},renderDate(s,t,e,r="sql"){return t=Number(t),e=Number(e),r==="sql"?`${s}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${s}`},renderTime(s,t,e=0,r="sql"){if(r==="sql")return`${this.padNumber(s)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(s);return s=this.convert24To12(s),`${s}:${this.padNumber(t)} ${n}`},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){if(j()){let n=new Date(2e3,s,1),i=t?"short":"long";return Y("month|"+i,void 0,{month:i}).format(n)}let e=this.monthNames;if(s<0||s>=e.length)return"";let r=e[s];return r?t?r.substring(0,3):r:""},getMonthLength(s,t){let e=new Date;return s=typeof s<"u"?s:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[s]},getMonthsLength(s=new Date().getFullYear()){let t=nn.slice();return this.leapYear(s)===!0&&(t[1]=29),t},getLocalDate(s,t="America/Denver"){if(typeof s=="string"&&s.indexOf("-")>-1&&en.test(s.trim()))return new Date(s.trim());let e=sn(s);if(!e)return new Date(NaN);let[r,n,i,o,a,c,l]=e;if(!j())return new Date(r,n-1,i,o,a,c,l);let u=Date.UTC(r,n-1,i,o,a,c,l);try{let h=pr(u,t),f=u-h,m=pr(f,t);return m!==h&&(f=u-m),new Date(f)}catch{return new Date(r,n-1,i,o,a,c,l)}},getLocalTime(s,t=!1,e=!1,r="America/Denver"){if(!s)return"";let n=this.getLocalDate(s,r);if(!xt(n))return"";if(!t&&j()){let c={hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0};return e===!1&&(c.year="numeric",c.month="2-digit",c.day="2-digit"),Y("local|"+(e?1:0),void 0,c).format(n)}let i=n.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(n.getFullYear(),i,n.getDate(),o)+" "),a+this.renderTime(n.getHours(),n.getMinutes(),n.getSeconds(),o)},getDiffFromNow(s,t=!1){let e=this.createDate(s),r=new Date;return t===!0&&r.setHours(0,0,0,0),r.getTime()-e.getTime()},getAge(s){let t=this.getDiffFromNow(s),e=(r,n)=>r+" "+n+(r===1?"":"s");return t<864e5?"1 day":t<6048e5?e(this.toDays(t),"day"):t<12096e5?"1 week":t<2592e6?e(Math.floor(this.toDays(t)/7),"week"):t<5184e6?"1 month":t<31104e6?e(this.toMonths(t),"month"):e(Math.max(1,this.toYears(t)),"year")},getTimeFrame(s){let t=this.getDiffFromNow(s);return this.convertToEstimate(t)},convertToEstimate(s){let t="",e,r,n,i,o,a,c;if(s<=0)switch(!0){case s<-63072e6:n=this.toYears(Math.abs(s)),t="in "+n+"y";break;case s<-31536e6:t="in 1y";break;case s<-5184e6:i=this.toMonths(Math.abs(s)),t="in "+i+"mo";break;case s<-2592e6:t="in 1mo";break;case s<-12096e5:e=this.toDays(Math.abs(s)),r=Math.floor(e/7),t="in "+r+"w";break;case s<-6048e5:t="in 1w";break;case s<-1728e5:e=this.toDays(Math.abs(s)),t="in "+e+"d";break;case s<-864e5:t="tomorrow";break;case s<-72e5:o=this.toHours(Math.abs(s)),t="in "+o+"h";break;case s<=-36e5:t="in 1h";break;case s<-12e4:a=this.toMinutes(Math.abs(s)),t="in "+a+"m";break;case s<-6e4:t="in 1m";break;case s<-2e3:c=this.toSeconds(Math.abs(s)),t="in "+c+"s";break;case s<-1:t="in 1s";break;default:t="now"}else switch(!0){case s<1e3:t="1s ago";break;case s<6e4:c=this.toSeconds(s),t=c+"s ago";break;case s<12e4:t="1m ago";break;case s<36e5:a=this.toMinutes(s),t=a+"m ago";break;case s<72e5:t="1h ago";break;case s<864e5:o=this.toHours(s),t=o+"h ago";break;case s<1728e5:t="yesterday";break;case s<6048e5:e=this.toDays(s),t=e+"d ago";break;case s<12096e5:t="1w ago";break;case s<2592e6:e=this.toDays(s),r=Math.floor(e/7),t=r+"w ago";break;case s<5184e6:t="1mo ago";break;case s<31536e6:i=this.toMonths(s),t=i+"mo ago";break;case s<63072e6:t="1y ago";break;default:n=this.toYears(s),t=n+"y ago"}return t},toYears(s){return typeof s!="number"?0:Math.floor(s/(1e3*60*60*24*365.26))},toMonths(s){return typeof s=="number"?Math.floor(s/(1e3*60*60*24*30)):0},toDays(s){return typeof s!="number"?0:Math.floor(s/(3600*1e3*24))},toHours(s){return typeof s!="number"?0:Math.floor(s%(3600*1e3*24)/(3600*1e3))},toMinutes(s){return typeof s!="number"?0:Math.floor(s%(3600*1e3)/(60*1e3))},toSeconds(s){return typeof s!="number"?0:Math.floor(s%(60*1e3)/1e3)},getDifference(s,t){let e=this.createDate(s),r=this.createDate(t),n=r.getTime()-e.getTime();return{years:this.toYears(n),days:this.toDays(n),hours:this.toHours(n),minutes:this.toMinutes(n),seconds:this.toSeconds(n)}}};var st={items:new Map,add(s,t){return this.items.set(s,t),this},get(s){return this.items.get(s)??null}};var Ee=(s,t)=>({attr:s,directive:t});var B=(s,t)=>({key:s,value:t});var mr=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var gr=null,an=()=>gr||(gr=st.get("watch")),z=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(B("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(Ee(B(e,P.getWatcherSettings(r,Q(e))),an()))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(B("type",n))}}static parse(t,e){let r=[],n=[],i=t.tag||"div";i==="button"&&r.push(B("type",t.type||"button"));let o=[],a,c;for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l)||l==="tag"||(a=t[l],a==null))continue;if(l==="children"||l==="nest"){if(Array.isArray(a))for(let h=0;h<a.length;h++)o.push(a[h]);else o.push(a);continue}if((c=st.get(l))!==null){n.push(Ee(B(l,a),c));continue}let u=typeof a;if(u==="object"){if(P.isWatching(a)){this.setTextAsWatcher(n,l,a);continue}o.push(a);continue}if(u==="function"){let h=a,f=function(m){h.call(this,m,e)};f.originalCallback=h,r.push(B(l,f));continue}if(u==="string"&&a.includes("[[")){this.setTextAsWatcher(n,l,a);continue}if(l==="text"){o.push({tag:"text",textContent:a});continue}if(l==="html"||l==="innerHTML"){r.push(B("innerHTML",a));continue}r.push(B(l,a))}return mr(i,r,n,o)}};var nt=class{build(t,e,r){}setupComponent(t,e,r){let n=r?.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var cn=s=>{for(let e in s)if(e!=="tag"&&e!=="textContent")return!1;let t=s.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},$t=class extends nt{build(t,e,r){let n=T.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&cn(t)){let l=t.textContent;T.createText(l??"",e);return}let n=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=z.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,r);let a=i.children;for(let l=0,u=a.length;l<u;l++){let h=a[l];h!==null&&this.buildElement(h,o,r)}let c=i.directives;c.length&&this.setDirectives(o,c,n)}createTempComponent(t,e,r){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...Te(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new E(n);this.createComponent(i,e,r)}setDirectives(t,e,r){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return T.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return T.createComment(o,e)}return T.create(n,t.attr,e,r)}removeNode(t){T.removeElement(t)}removeAll(t){T.removeAll(t)}};var ln=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),un=/[&<>"]/,Pe=s=>{let t=typeof s=="string"?s:String(s);return un.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},it=class{static create(t,e=[],r=""){let n="",i="";for(let o=0,a=e.length;o<a;o++){let c=e[o],l=c.key,u=c.value;if(l==="text"||l==="textContent"){n+=Pe(u);continue}if(l==="html"||l==="innerHTML"){n+=u;continue}if(typeof u=="function")continue;let h=l+'="'+Pe(u)+'"';i?i+=" "+h:i=h}return ln.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+r+"</"+t+">"}static createText(t){return Pe(t)}static createComment(t){return"<!-- "+t+" -->"}};var jt=class extends nt{build(t,e,r){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],r);return n}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=z.parse(t,e),n=r.children,i="";for(let o=0,a=n.length;o<a;o++){let c=n[o];c!==null&&(i+=this.buildElement(c,e))}return this.createNode(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return it.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return it.createComment(i)}return it.create(r,t.attr,e)}removeAll(t){}};var Yt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new $t:new jt}};var J=Yt.setup(),hn=s=>typeof s=="object"&&s.isUnit===!0,yr=new WeakMap,fn=s=>{let t=yr.get(s);if(!t){if(t=$(s),!t)return null;yr.set(s,t)}return new t},y=class{static render(t,e,r){if(!t||(hn(t)||(t=fn(t)),!t))return null;L.enter();try{return J.createComponent(t,e,r)}finally{L.leave()}}static build(t,e,r){L.enter();try{return J.build(t,e,r)}finally{L.leave()}}static rebuild(t,e,r){return J.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){J.setDirectives(t,e,r)}static createNode(t,e,r){return J.createNode(t,e,r)}static removeNode(t){J.removeNode(t)}static removeAll(t){J.removeAll(t)}};U.augment({buildLayout(s,t,e){y.build(s,t,e)}});var Me=[],dn=s=>Me.indexOf(s)!==-1,pn=s=>({tag:"script",src:s.src,async:!1,load(t){Me.push(s.src);let e=s.load;e&&e()}}),mn=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){Me.push(s.src);let e=s.load;e&&e()}}),Jt=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=mn({load:r,src:t}):e=pn({load:r,src:t}),y.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{dn(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var gn=s=>s?typeof s?.prototype?.constructor=="function":!1,G=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(gn(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){return this.renderNodes(t,e,r)[0]||null}static renderNodes(t,e,r){let n=y.build(t,null,r),i=Array.from(n.childNodes);return i.length===0&&t?.panel&&i.push(t.panel),e.after(n),i}};var Xt=class{static load(t,e,r){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),r&&r(n)})}};var yn=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),K=new A(100),xr=s=>{if(K.has(s)){let r=K.get(s);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof s,e;if(t==="string")e=import(s);else if(t==="function")e=s();else return s;return e.then(r=>{K.set(s,r)}).catch(()=>{K.delete(s)}),K.set(s,e),e},Sr=s=>{if(!K.has(s))return null;let t=K.get(s);return t&&typeof t.then=="function"?null:t||null},_e=s=>{let t=typeof s;if(t!=="string"&&t!=="function")return null;if(Sr(s))return Promise.resolve(K.get(s));let e;try{e=xr(s)}catch{return null}return e.catch(()=>null)},De=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&y.removeNode(r)}},br=$({declareProps(){this.loaded=!1,this.errorRoot=null,this.loadingRoots=null,this.generation=0},render(){return yn({onCreated:s=>{if(this.src){if(this.layout){this.setLayoutRoots(G.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){this.renderLoading(s),new Jt(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){let t=this.generation,e=Sr(this.src);if(e){this.renderModule(s,e);return}this.renderLoading(s),Xt.load(xr(this.src),r=>{t===this.generation&&this.renderModule(s,r)},r=>{t===this.generation&&(this.loaded=!1,this.removeLoadingLayout(),this.renderError(s,r))})},renderLoading(s){let t=this.loading;if(!t||this.loadingRoots)return;let e=typeof t=="function"?t():t;e&&(this.loadingRoots=G.renderNodes(e,s,this.parent))},removeLoadingLayout(){let s=this.loadingRoots;return s?(this.loadingRoots=null,De(s),!0):!1},renderError(s,t){let e=()=>this.retry(s),r=this.fallback,n=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};if(!n)return;let i=G.renderNodes(n,s,this.parent);this.errorRoots=i,this.errorRoot=i[0]||null},setLayoutRoots(s){this.layoutRoots=s,this.layoutRoot=s[0]||null},retry(s){this.removeErrorLayout(),this.loadAndRender(s)},removeErrorLayout(){this.errorRoot&&(De(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(s,t){this.loaded=!0;let e=this.layout||G.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(G.renderNodes(e,s,this.parent)),this.removeLoadingLayout()&&typeof this.onReplaceLoading=="function"&&this.onReplaceLoading(this.layoutRoots,e),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},destroy(){this.generation++,this.removeErrorLayout(),this.removeLoadingLayout(),this.layoutRoot&&(De(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Re=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new br(s)};var vr=(s,t,e=null)=>{if(!s)return;let r=null,n=!1,i=()=>{n||(n=!0,r&&(clearTimeout(r),r=null),d.off("animationend",s,o),s&&s.classList.remove(t),e&&e())},o=c=>{c.target===s&&i()};d.on("animationend",s,o),s.classList.add(t);let a=()=>{if(!n)try{let c=window.getComputedStyle(s),l=parseFloat(c.animationDuration)*1e3||1e3,u=parseFloat(c.animationDelay)*1e3||0;r=setTimeout(i,l+u+100)}catch{r=setTimeout(i,1e3)}};if(typeof requestAnimationFrame>"u"){r=setTimeout(i,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},kr=(s,t,e)=>{vr(s,t)},wr=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};xn(s,()=>vr(s,t,r),e)};p.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var xn=(s,t,e)=>{p.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var St=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&St(s,t,n,r)});return}Sn(s,t,e,r)},Sn=(s,t,e,r)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',s,t);return}let o=bn(s,n,i,r);x.watch(s,t,n,o)},bn=(s,t,e,r)=>typeof e=="object"?n=>{wn(s,e,n)}:n=>{kn(s,e,t,n,r)},Cr=new WeakSet,vn=(s,t,e)=>{!s||!s.isUnit&&!s.isComponent||Cr.has(e)||Cr.add(e)},kn=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(i===null)break;vn(i,e,s),y.rebuild(i,s,n);break;case"string":let o=Ot(s);if(o!=="textContent"){s.setAttribute(o,i);break}_.addHtml(s,i);break}},wn=(s,t,e)=>{let r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];o&&(t[o]===e?s.classList.add(o):s.classList.remove(o))}};var ot=(s,t,e)=>{let r=R(e);St(s,r,t,e)};var Ar=(s,t,e)=>{t&&s.setAttribute("role",t)},Cn=s=>(t,e)=>{let r=t?"true":"false";e.setAttribute(s,r)},Tr=(s,t,e)=>{if(!t)return;let r=t.role;r&&(s.setAttribute("role",r),t.role=null);let n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];if(c===null)continue;let l="aria-"+a;if(Array.isArray(c)){let u=c.slice();u.push(Cn(l)),ot(s,u,e)}else s.setAttribute(l,c)}};var Er=(s,t,e)=>{if(!t)return;let r=z.parse(t,e);T.addAttributes(s,r.attr,e),y.setDirectives(s,r.directives,e)};p.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var Ie=s=>s?s.getContext():null,Pr=(s,t,e)=>{if(typeof t!="function")return;let r=Ie(e),n=t(r);Er(s,n,e)},Mr=(s,t,e)=>{if(typeof t!="function")return;let r=Ie(e);t(r)},Dr=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=Ie(e),n=t(r);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),An(s,i,e))},An=(s,t,e)=>{p.add(s,"context",{branch:t,parent:e})};var _r=(s,t,e)=>{};var Rr=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var Ir=(s,t,e)=>{},Or=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&y.build(r,s,e)},Lr=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Nr=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&y.build(r,s,e)},Br=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&y.build(r,s,e)},Hr=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},Ur=(s,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let r=t[2];if(r){let n=r;r=i=>{n(i,e)}}e.events.on(t[0],t[1],r,t[3])};var Wr=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=R(e),!r)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=R(e);if(!o)return;r=o,n=t[0],i=t[1]}else[r,n,i]=t;x.bind(s,r,n,i)};var Zt=(s,t,e)=>{St(s,e.state,t,e)};var Fr=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";e.dataset[r]=o},qr=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(Fr(n)),ot(s,i,e)},zr=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(Fr(n)),Zt(s,i,e)};var Gr=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&r.remove()}s.length=0};p.addType("forScopes",s=>{if(!s)return!1;Gr(s.scopes)});var Kr=(s,t,e)=>{let r,n,i,o;if(typeof t[0]=="string"||t.length<3){let u=R(e);if(!u)return;r=u,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1,c=n+"[",l=a?{scopes:[]}:null;l&&p.add(s,"forScopes",l),x.watch(s,r,n,u=>{if(y.removeAll(s),l&&Gr(l.scopes),!u||u.length<1)return;let h=[];for(let f=0,m=u.length;f<m;f++){let S=a?r.scope(c+f+"]"):null;S&&l&&l.scopes.push(S);let b=i(u[f],f,S,h);b!==null&&h.push(b)}return y.build(h,s,e)})};var Vr=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(let o=0,a=r.length;o<a;o++){let c=r[o];if(!c)continue;let l=n(c,o);l!==null&&i.push(l)}y.build(i,s,e)};var Qr=(s,t,e)=>{t(s,e)};p.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var $r=(s,t,e)=>{Tn(s,t,e)},Tn=(s,t,e)=>{p.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var jr=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,n=t.length;r<n;r++)P.setup(s,t[r],e);else P.setup(s,t,e)};var En=0,at=class{constructor(t){this.router=t,this.locationId="base-app-router-"+En++,this.callBack=this.check.bind(this)}setup(){return this.trackScroll(),this.addEvent(),this}check(t){}getScrollPosition(){let t=this.scrollPosition;return t?{x:t.x,y:t.y}:{x:window.scrollX,y:window.scrollY}}trackScroll(){typeof window>"u"||this.scrollHandler||(this.scrollPosition={x:window.scrollX,y:window.scrollY},this.scrollHandler=()=>{this.scrollPosition={x:window.scrollX,y:window.scrollY}},window.addEventListener("scroll",this.scrollHandler,{passive:!0}))}untrackScroll(){this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollPosition=null)}scrollTo(t){window.scrollTo(t.x,t.y),this.scrollHandler&&(this.scrollPosition={x:t.x,y:t.y})}addEvent(){return this}};var Pn=0,Mn=()=>Date.now().toString(36)+"-"+(Pn++).toString(36)+"-"+Math.random().toString(36).substring(2,8),Jr=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Yr=()=>{Jr&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let s=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(s,t)}))},te=class extends at{constructor(t){super(t),this.currentKey=null,this.positions=new A(200)}saveCurrentPosition(){let t=this.getScrollPosition(),e=this.currentKey;return e&&this.positions.set(e,t),t}addEvent(){d.on("popstate",window,this.callBack);let t=window.history;return t&&"scrollRestoration"in t&&(this.previousScrollRestoration=t.scrollRestoration,t.scrollRestoration="manual"),Jr&&(this.pageShowCallBack=this.onPageShow.bind(this),d.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){d.off("popstate",window,this.callBack),this.untrackScroll();let t=window.history;return this.previousScrollRestoration&&t&&"scrollRestoration"in t&&(t.scrollRestoration=this.previousScrollRestoration,this.previousScrollRestoration=null),this.pageShowCallBack&&d.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&Yr()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.saveCurrentPosition();let r=e.key||null;this.currentKey=r;let n=r&&this.positions.get(r)||e.scrollPosition,i=this.router;i.checkActiveRoutes(e.uri,!!n),n&&(typeof i.restoreScrollPosition=="function"?i.restoreScrollPosition(n):this.scrollTo(n)),Yr()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:Mn(),scrollPosition:r,uri:t}}addState(t,e,r=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return i.key&&i.location===this.locationId&&(this.currentKey=i.key),this;!r&&i&&i.location===this.locationId&&(i.scrollPosition=this.saveCurrentPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return r||(o.scrollPosition={x:0,y:0}),n[r===!1?"pushState":"replaceState"](o,null,t),this.currentKey=o.key,this.positions.set(o.key,o.scrollPosition),this}};var ee={removeSlashes(s){return typeof s!="string"?"":(s[0]==="/"&&(s=s.substring(1)),s[s.length-1]==="/"&&(s=s.substring(0,s.length-1)),s)},getHashUri(s){if(typeof s!="string")return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)}};var re=class extends at{addEvent(){return d.on("hashchange",window,this.callBack),this}removeEvent(){return d.off("hashchange",window,this.callBack),this.untrackScroll(),this}check(t){this.router.checkActiveRoutes(ee.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var se=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new te(t).setup():new re(t).setup()}};var Oe=5,Dn=200,ne=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new A(Dn),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMode(){let t=this.owner;return t!==null&&t.keepAliveMode==="hide"?"hide":"detach"}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:Oe}get size(){return this.pages.size}add(t){let e=this.pages;e.delete(t),e.add(t),this.trim()}delete(t){this.pages.delete(t)}trim(){let t=this.pages,e=this.getMax();for(;t.size>e;){let r=t.values().next().value;t.delete(r),r.evict()}}clear(){let t=Array.from(this.pages);this.pages.clear();for(let e=0,r=t.length;e<r;e++)t[e].evict()}saveScroll(t,e){if(e){this.scrollMemory.set(t,e);return}this.scrollMemory.has(t)&&this.scrollMemory.delete(t)}getScroll(t){return this.scrollMemory.get(t)||null}};var Le=class extends E{getChildScope(){return this.parent}},Xr=s=>$(s,Le);var ie="data-scroll-key",_n="["+ie+"]",Rn="[data-route-dormant]",Zr=s=>typeof s.closest=="function"&&s.closest(Rn)!==null,He=new WeakMap,X=typeof WeakRef=="function"?new Set:null,Ne=new WeakMap,Ue=(s,t,e)=>{if(He.set(s,[t,e]),!X)return;let r=Ne.get(s);if(t===0&&e===0){r&&(X.delete(r),Ne.delete(s));return}if(!r){let n=new WeakRef(s);Ne.set(s,n),X.add(n)}},Be=!1,In=()=>Be?!0:typeof document>"u"||typeof document.addEventListener!="function"?!1:(document.addEventListener("scroll",s=>{let t=s.target;t&&t.nodeType===1&&Ue(t,t.scrollTop||0,t.scrollLeft||0)},{capture:!0,passive:!0}),Be=!0,!0);In();var ts=(s,t)=>{for(let e=0,r=s.length;e<r;e++){let n=s[e];if(!n||n.nodeType!==1||Zr(n))continue;let i=n.getAttribute(ie);i!==null&&t(n,i);let o=n.querySelectorAll(_n);for(let a=0,c=o.length;a<c;a++){let l=o[a];Zr(l)||t(l,l.getAttribute(ie))}}},We=s=>{let t=null,e=Be;return ts(s,(r,n)=>{let i=0,o=0;if(e){let a=He.get(r);a&&(i=a[0],o=a[1])}else i=r.scrollTop||0,o=r.scrollLeft||0;i===0&&o===0||(t=t||{},t[n]=[i,o])}),t},Fe=(s,t)=>{if(!t)return!0;let e={},r=0;for(let n in t)e[n]=!0,r++;return ts(s,(n,i)=>{let o=t[i];if(!o)return;let a=o[0],c=o[1];n.scrollTop=a,n.scrollLeft=c;let l=n.scrollTop||0,u=n.scrollLeft||0;Ue(n,l,u),Math.abs(l-a)<1&&Math.abs(u-c)<1&&e[i]&&(e[i]=!1,r--)}),r<=0},es=s=>{if(!X||X.size===0)return null;let t=null;for(let e of X){let r=e.deref();if(!r){X.delete(e);continue}if(!r.isConnected||r.hasAttribute(ie))continue;let n=!1;for(let o=0,a=s.length;o<a;o++){let c=s[o];if(c&&c.nodeType===1&&c.contains(r)){n=!0;break}}if(!n)continue;let i=He.get(r);i&&(t=t||[],t.push([r,i[0],i[1]]))}return t},rs=s=>{if(s)for(let t=0,e=s.length;t<e;t++){let[r,n,i]=s[t];r.isConnected&&(r.scrollTop=n,r.scrollLeft=i,Ue(r,r.scrollTop||0,r.scrollLeft||0))}};var On=s=>{for(let t=0;t<s.length;t++){let e=s[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let n=[];for(let i=0,o=r.length;i<o;i++){let a=r[i];a&&s.indexOf(a)===-1&&n.indexOf(a)===-1&&n.push(a)}s.splice(t+1,0,...n)}},bt="data-route-dormant",oe=[["content-visibility","hidden"],["position","absolute"],["top","0"],["left","0"],["width","100%"],["opacity","0"],["clip-path","inset(50%)"]],Ln=s=>{let t=s.style,e=[];for(let n=0,i=oe.length;n<i;n++){let[o,a]=oe[n];e.push([o,t.getPropertyValue(o),t.getPropertyPriority(o)]),t.setProperty(o,a,"important")}let r=s.ownerDocument&&s.ownerDocument.activeElement;return r&&r!==s.ownerDocument.body&&s.contains(r)&&typeof r.blur=="function"&&r.blur(),s.setAttribute(bt,""),s.inert=!0,e},Nn=(s,t)=>{let e=s.style,r=t||[];for(let n=0,i=oe.length;n<i;n++){let o=oe[n][0],a=r.find(c=>c[0]===o);a&&a[1]?e.setProperty(o,a[1],a[2]||""):e.removeProperty(o)}s.removeAttribute(bt),s.inert=!1},Bn="iframe, embed, object",Hn="video, audio",ns=(s,t)=>{let e=[];for(let r=0,n=s.length;r<n;r++){let i=s[r];if(!i||i.nodeType!==1)continue;i.matches(t)&&e.push(i);let o=i.querySelectorAll(t);for(let a=0,c=o.length;a<c;a++)e.push(o[a])}return e},Un=s=>{let t=ns(s,Hn);for(let e=0,r=t.length;e<r;e++){let n=t[e];n.paused===!1&&typeof n.pause=="function"&&n.pause()}},Wn=s=>/^class[\s{]/.test(Function.prototype.toString.call(s)),Fn=1500,ss=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),qn=s=>{let t=s.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},qe=(s,t,e)=>{if(!(!s||typeof s[t]!="function"))try{s[t](...e)}catch(r){console.error("Error in "+t+":",r)}},ae=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.keepAlive=typeof e.keepAlive=="boolean"?e.keepAlive:null,this.keepAliveMode=e.keepAliveMode==="hide"||e.keepAliveMode==="detach"?e.keepAliveMode:null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.capturedScroll=null,this.pageCache=e.pageCache||null,this.detachedNodes=null,this.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.savedElements=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let r=t.layout;if(r&&r.isUnit===!0&&typeof r.keepAlive=="boolean")return r.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}getKeepAliveMode(t){if(this.keepAliveMode!==null)return this.keepAliveMode;if(t=t||this.component,t){let r=t.keepAliveMode;if(r==="hide"||r==="detach")return r;let n=t.layout;if(n&&n.isUnit===!0&&(n.keepAliveMode==="hide"||n.keepAliveMode==="detach"))return n.keepAliveMode}let e=this.pageCache;return e!==null&&typeof e.getMode=="function"?e.getMode():"detach"}isDetached(){return this.detachedNodes!==null}captureScroll(){let t=this.component;if(this.setup!==!0||!t||t.rendered!==!0){this.capturedScroll=null;return}this.capturedScroll={value:We(this.getRootNodes(t))}}releaseCapturedScroll(){this.capturedScroll=null}takeScroll(t){let e=this.capturedScroll;return this.capturedScroll=null,e?e.value:We(this.getRootNodes(t))}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=Wn(t)?new t:t(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Xr(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;y.render(t,this.container,this.parent)}afterCreate(t){let e=this.component;!e||this.pageCache===null||(e.loaded===!1&&e.src&&(e.onModuleRender=()=>this.onModuleRender(e)),this.isKeepAlive(e)&&this.callPageHook("onActivate",[t,{restored:!1}]),this.pageCache.historyNavigation===!0&&this.restoreHistoryScroll())}onModuleRender(t){if(this.setup!==!0||this.component!==t)return;let e=t.layout;e&&e.isUnit===!0&&this.isKeepAlive(t)&&qe(e,"onActivate",[this.params,{restored:!1}])}getScrollKey(){let t=this.route||{};return(t.routeId||"")+"|"+(t.path||"")}getPagePath(){let e=(this.route||{}).path||"",r=e.indexOf("#");return r>-1?e.substring(0,r):e}getRootNodes(t){let e=[],r=qn(t);r&&e.push(r);let n=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),i=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),o=t.loadingRoots||null,a=[n,i,o];for(let c=0;c<3;c++){let l=a[c];if(l)for(let u=0,h=l.length;u<h;u++){let f=l[u];f&&e.indexOf(f)===-1&&e.push(f)}}return On(e),e}callPageHook(t,e){let r=this.component;if(!r)return;qe(r,t,e);let n=r.layout;n&&n!==r&&n.isUnit===!0&&qe(n,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,n=()=>Fe(this.getRootNodes(r),t);if(n()||typeof requestAnimationFrame>"u")return;let i=ss(),o=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||n()||ss()-i>Fn||requestAnimationFrame(o)};requestAnimationFrame(o)}restoreDetachedScroll(){let t=this.savedScroll,e=this.savedElements;this.savedScroll=null,this.savedElements=null;let r=this.component;if(!t&&!e||!r)return;let n=()=>{t&&Fe(this.getRootNodes(r),t),rs(e)};if(typeof requestAnimationFrame>"u"){n();return}let i=++this.scrollToken;requestAnimationFrame(()=>{i!==this.scrollToken||this.setup!==!0||this.component!==r||n()})}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=this.takeScroll(t);return this.savedScroll=r,this.savedElements=es(e),this.pageCache.saveScroll(this.getScrollKey(),r),this.getKeepAliveMode(t)==="hide"&&t.loaded!==!1&&ns(e,Bn).length===0?(Un(e),this.hideInPlace(e)):this.removeNodes(e),this.detachedNodes=e,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}removeNodes(t){let e=new WeakMap;for(let r=0,n=t.length;r<n;r++){let i=t[r],o=i.parentNode;o&&(e.set(i,o),o.removeChild(i))}this.detachedParents=e,this.hiddenInPlace=!1,this.hiddenStyles=null}hideInPlace(t){let e=new WeakMap;for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&i.nodeType===1&&e.set(i,Ln(i))}this.detachedParents=null,this.hiddenInPlace=!0,this.hiddenStyles=e}showInPlace(t,e){let r=this.hiddenStyles;for(let n=0,i=t.length;n<i;n++){let o=t[n];o.nodeType===1&&o.hasAttribute(bt)&&Nn(o,r?r.get(o):void 0),o.isConnected||e.appendChild(o)}}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.hiddenInPlace;this.hiddenInPlace=!1;let n=this.component,i=this.container;if(!n||n.rendered!==!0||!i||typeof i.appendChild!="function")return this.savedScroll=null,this.savedElements=null,this.hiddenStyles=null,this.releaseComponent(),!1;if(r)return this.showInPlace(this.getRootNodes(n),i),this.hiddenStyles=null,this.setup=!0,L.schedule(),!0;let o=this.getRootNodes(n);for(let a=0,c=o.length;a<c;a++){let l=o[a],u=e?e.get(l):null;(u&&u.isConnected?u:i).appendChild(l)}return this.setup=!0,L.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.detachedParents=null,this.savedScroll=null,this.savedElements=null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.releaseComponent()}releaseComponent(){let t=this.component;this.component=null,t&&typeof t.destroy=="function"&&t.destroy()}remove(t){if(this.setup!==!0){t===!0&&this.evict();return}this.setup=!1,this.scrollToken++;let e=this.component;if(!e)return;let r=this.pageCache;if(t!==!0&&r!==null){if(this.isKeepAlive(e)&&this.detach(e))return;r.saveScroll(this.getScrollKey(),this.takeScroll(e))}this.capturedScroll=null,this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var is=s=>{if(!s.length)return null;let t={};for(let e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},os=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);if(n===null)return t;for(let i=0,o=n.length;i<o;i++){let a=n[i];a&&t.push(a.replace(":",""))}return t};var zn=/(\/):[^/(]*?\?/g,Gn=/\//g,Kn=/(\?\/+\*?)/g,Vn=/(:[^/?&($]+)/g,Qn=/(\*)/g,$n=s=>s.replace(zn,t=>t.replace(Gn,"(?:$|/)")),jn=s=>(s=s.replace(Kn,"?/*"),s.replace(Vn,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Yn=s=>s.replace(Qn,".*"),Jn=(s,t)=>s+=t[t.length-1]==="*"?"":"$",as=s=>{if(!s)return"";let t=s;return t=$n(t),t=jn(t),t=Yn(t),t=Jn(t,s),t};var Xn=0,cs=(s,t="")=>{let e=s||"",r=typeof t=="string"&&t?t:e,n=null,i=[],o=r.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),r=r.replace(o[0],""),e=e.replace(o[0],""));let a=r.indexOf("?");if(a>-1){let u=r.substring(a+1);if(u.indexOf("=")>-1){let h=u.split("&");for(let m=0,S=h.length;m<S;m++){let b=h[m];if(!b)continue;let[g,vt=""]=b.split("="),kt=(g||"").trim();kt&&i.push({key:kt,value:(vt||"").trim()})}r=r.substring(0,a);let f=e.indexOf("?");f>-1&&(e=e.substring(0,f))}}let c=n!==null||i.length>0;return c&&!r&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:c}},ls=s=>{if(!s)return"";let t=s.indexOf("?"),e=s.indexOf("#"),r=s.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),s.substring(0,r).replace(/\/\.(?:\/|$)/g,"/")},Zn=s=>{if(!s)return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)},ti=s=>{if(!s)return"";let t=s.indexOf("?");if(t===-1)return"";let e=s.indexOf("#",t);return e===-1?s.substring(t+1):s.substring(t+1,e)},ce=class extends I{constructor(t,e,r=null){let n=t.baseUri,o=cs(n,t.rawUri).uriPath,a=os(o),c=is(a),l=super(c);return this.uri=n,this.matchUri=o,this.paramKeys=a,this.titleCallBack=e,this.pageCache=r,this.setupRoute(t),this.set("active",!1),l}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null,this.pageCache=null,this.importSrc=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+Xn++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=cs(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=as(this.matchUri);this.uriQuery=new RegExp("^"+r),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(t){this.set("active",!1);let e=this.controller;e&&e.remove(t===!0)}captureScroll(){let t=this.controller;t&&this.get("active")&&t.captureScroll()}releaseCapturedScroll(){let t=this.controller;t&&t.releaseCapturedScroll()}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return e?e.isConnected===!1?!0:typeof e.closest=="function"&&e.closest("["+bt+"]")!==null:!1}getLayout(t){if(t.component)return t.component;let e=t.import;if(!e)return null;let r=e&&typeof e=="object"&&!(e instanceof Promise)?e.src:e;return this.importSrc=typeof r=="string"||typeof r=="function"?r:null,Re(e)}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i,keepAlive:o,keepAliveMode:a}=t,c={component:e,container:r,persist:n,parent:i,keepAlive:o,keepAliveMode:a,pageCache:this.pageCache},l=Dt(this);this.controller=new ae(l,c)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let r=this.controller;r&&r.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];i&&this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=ls(t),n=this.uriQuery||/$^/,i=r.match(n);return i===null?(this.resetParams(),e):Array.isArray(i)?this.matchConditions(t)?(this.setParams(i,1),e=i,e):(this.resetParams(),!1):e}matches(t){return(this.uriQuery||/$^/).test(ls(t))&&this.matchConditions(t)}prefetch(){let t=this.importSrc;return t?_e(t):null}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&Zn(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=ti(t);if(!r)return!1;let n=new URLSearchParams(r);for(let i=0,o=e.length;i<o;i++){let a=e[i];if(!n.has(a.key)||n.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let r=this.paramKeys;if(!r)return;let n={};for(let i=0,o=r.length;i<o;i++){let a=r[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var ei=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},ri=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),si=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=new RegExp(":"+ri(r),"gi");s=s.replace(n,()=>e[r])}return s},ni=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=si(t,s),ei(t)),ii=(s,t)=>(t!==""&&(s+=" - "+t),s),us=(s,t,e)=>t&&(t=ni(s,t),ii(t,e));var hs=(s,t)=>({attr:s,value:t}),oi=(s,t)=>{if(!t.startsWith(s))return!1;let e=t[s.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},le=class extends E{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,n=H.data,i=[];t&&typeof t=="object"&&i.push(hs("href",t)),e&&typeof e=="object"&&i.push(hs("text",e));let o=null,a="",c="";return i.push({value:["[[path]]",n],callBack:(l,u)=>{if(typeof u.pathname>"u")return;let h=u.getAttribute("href");if(h!==o){o=h;let m=u.pathname+u.search+u.hash;a=m,c=u.hash||u.search?m:u.pathname}let f=r?l===a:oi(c,l);this.update(f)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var ai=()=>typeof window<"u"?window.location:{},ci=s=>{if(!s)return"";let t=s.indexOf("#");return t>-1?s.substring(t+1):""},li=1500,ue=["wheel","touchstart","keydown","pointerdown"],fs=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),ze=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=Oe,this.keepAliveMode="detach",this.pageCache=new ne(this),this.history=null,this.callBackLink=null,this.location=ai(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new q({path:""})}setupHistory(){this.history=se.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new ce(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;typeof r=="number"&&r>=0&&(this.keepAliveMax=r);let n=e?e.mode:void 0;return(n==="hide"||n==="detach")&&(this.keepAliveMode=n),this.pageCache.trim(),this}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),r=ee.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.routeId===t)return i}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate(!0)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);for(let i=0,o=t.length;i<o;i++){let c=t[i].component.route;c.resumeRoute(e),n.push(c)}return this.checkGroupForRegistration(r,n),r}checkGroupForRegistration(t,e){let r=this.scrollIntent,n=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=n;let i=this.scrollIntent;i&&i.type==="target"&&i.groupId!==null&&i.groupId!==void 0&&(this.activeScrollGroups.add(i.groupId),this.lastScrollGroup=i.groupId),this.scrollIntent=r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){this.activeScrollGroups.delete(t),this.lastScrollGroup===t&&(this.lastScrollGroup=null);let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,n=e.length;r<n;r++){let i=e[r];i&&typeof i.deactivate=="function"&&i.deactivate(!0)}}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),d.on("click",document,this.callBackLink);let r=this.getEndPoint();return this.navigate(r,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.defaultPrevented===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0||t.altKey===!0||typeof t.button=="number"&&t.button!==0)return!0;let e=t.target&&t.target.closest?t.target.closest("a"):null;if(!e||e.dataset.cancelRoute||e.hasAttribute("download"))return!0;let r=e.getAttribute("target");if(r&&r!=="_self")return!0;let n=e.getAttribute("href");if(n===null)return!0;let i=this.getLinkPath(n);if(i===null)return!0;let o=e.dataset.replace==="true";return this.navigate(i,null,o),t.preventDefault(),t.stopPropagation(),!1}getLinkPath(t){let e=t;if(e.substring(0,2)==="//"||/^[a-z][a-z0-9+.-]*:/i.test(e)){let n=this.location;if(!n||!n.origin||typeof URL>"u")return null;let i;try{i=new URL(e,n.href)}catch{return null}if(i.origin!==n.origin)return null;e=i.pathname+i.search+i.hash}let r=this.baseURI;return r!=="/"&&e.indexOf(r)===0&&(e=e.substring(r.length)),e}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let n=t[e];n&&typeof n.deactivate=="function"&&n.deactivate(!0)}return this.pageCache.clear(),this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.updatePath(),this.activate(),this}prefetch(t){if(typeof t!="string"||!t)return Promise.resolve([]);let e=this.getLinkPath(t);if(e===null)return Promise.resolve([]);let r=this.createURI(e),n=[],i=a=>{if(!a||!a.controller||typeof a.matches!="function"||!a.matches(r))return!1;let c=a.prefetch();return c&&n.push(c),!0},o=this.routes;for(let a=0,c=o.length;a<c;a++)i(o[a]);for(let a of this.switches.values())for(let c=0,l=a.length;c<l&&!i(a[c]);c++);return Promise.all(n)}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=us(t,e,this.title),this}checkActiveRoutes(t,e){t=t||this.getPath(),t!==this.path&&(this.lastPath=this.path),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollGroupsReady=new Set(this.activeScrollGroups),this.scrollWaitToken++;let r=this.pageCache;r.historyNavigation=e===!0;let n=this.captureActiveScroll(),i=this.routes;for(let o=0,a=i.length;o<a;o++){let c=i[o];typeof c>"u"||r.size>0&&c.isDormant()||this.checkRoute(c,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,this.releaseCapturedScroll(n),e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}captureActiveScroll(){let t=[],e=n=>{!n||!n.controller||!n.get("active")||n.isDormant()||(n.captureScroll(),t.push(n))},r=this.routes;for(let n=0,i=r.length;n<i;n++)e(r[n]);for(let n of this.switches.values())for(let i=0,o=n.length;i<o;i++)e(n[i]);return t}releaseCapturedScroll(t){for(let e=0,r=t.length;e<r;e++)t[e].releaseCapturedScroll()}checkSwitches(t,e){let r=this.switches;for(let[n,i]of r.entries())e===!0&&this.pageCache.size>0&&i.length&&i[0].isDormant()||(this.currentGroupId=n,this.checkGroup(i,t));this.currentGroupId=null}checkGroup(t,e){let r=t.length;if(!r)return;let n=null;for(let a=0;a<r;a++)if(t[a].get("active")){n=t[a];break}let i=!1;n&&(i=n.match(e)!==!1);let o;for(let a=0;a<r;a++){let c=t[a];if(typeof c>"u")continue;(c===n?i:c.match(e))!==!1&&o===void 0&&c.controller&&(o=c)}if(!o){n&&n!==t[0]&&n.deactivate(),this.select(t[0],!0);return}this.select(o),n&&n!==o&&n.deactivate();for(let a=0;a<r;a++){let c=t[a];c&&c!==o&&c!==n&&c.deactivate()}}checkRoute(t,e){let r=this.check(t,e);return r!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),r}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){if(!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e===!0))return;let r=this.scrollIntent;if(r&&r.type==="hash")return;let n=ci(this.path);if(n){this.scrollIntent={type:"hash",hash:n};return}t.scrollTo?(this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId},this.currentGroupId!==null&&this.currentGroupId!==void 0&&this.activeScrollGroups.add(this.currentGroupId)):t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.scrollGroupsReady.has(t.groupId);if(this.lastScrollGroup=e?t.groupId:null,r){this.scrollToTarget(t.selector,t.groupId);return}typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let r=t.x||0,n=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(r,n)){window.scrollTo(r,n);return}let i=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},o={capture:!0,passive:!0};for(let l=0,u=ue.length;l<u;l++)window.addEventListener(ue[l],i,o);this.cancelScrollWait=()=>{for(let l=0,u=ue.length;l<u;l++)window.removeEventListener(ue[l],i,o)};let a=fs(),c=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,n)||fs()-a>=li){this.clearScrollWait(),window.scrollTo(r,n);return}requestAnimationFrame(c)};requestAnimationFrame(c)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){if(e<=0&&t<=0)return!0;let r=document.documentElement;return r?e>0&&e>(r.scrollHeight||0)-(window.innerHeight||0)+1?!1:t<=0||t<=(r.scrollWidth||0)-(window.innerWidth||0)+1:!0}scrollToHash(t){if(!t||typeof document>"u")return;let e=()=>{let c=document.getElementById(t);if(c)return c;try{return document.getElementById(decodeURIComponent(t))}catch{return null}},r=e();if(r){r.scrollIntoView(!0);return}if(typeof requestAnimationFrame>"u")return;let n=++this.scrollWaitToken,i=30,o=0,a=()=>{if(n!==this.scrollWaitToken)return;let c=e();if(c){c.scrollIntoView(!0);return}++o<i&&requestAnimationFrame(a)};requestAnimationFrame(a)}findScrollTarget(t,e){if(typeof document>"u")return null;let r=this.findScopedScrollTarget(t,e);if(r)return r;let n=document.querySelectorAll(t);for(let i=0,o=n.length;i<o;i++){let a=n[i];if(a&&a.isConnected!==!1)return a}return null}findScopedScrollTarget(t,e){if(e==null||!this.switches)return null;let r=this.switches.get(e),n=r&&r[0],i=n&&n.controller&&n.controller.container;if(!i||i.nodeType!==1)return null;let o=i;for(let a=0;a<8;a++){let c=o.parentElement;if(!c||c===document.body||c===document.documentElement)break;let l=c.querySelector(t);if(l)return l;o=c}return null}readScrollTarget(t){let e=window.getComputedStyle(t),r=e.position==="sticky",n=r&&parseFloat(e.top)||0,i=(t.offsetWidth||0)>0||(t.offsetHeight||0)>0,o;if(r){let a=t.style.position;t.style.position="static",o=t.getBoundingClientRect().top+window.scrollY,t.style.position=a}else o=t.getBoundingClientRect().top+window.scrollY;return{sized:i,targetScroll:o-n}}scrollToTarget(t,e){if(typeof t!="string"||typeof document>"u")return;let r=l=>{window.scrollY>l&&window.scrollTo(0,Math.max(0,l))};if(typeof requestAnimationFrame>"u"){let l=this.findScrollTarget(t,e);if(l){let u=this.readScrollTarget(l);u.sized&&r(u.targetScroll)}return}let n=++this.scrollWaitToken,i=30,o=0,a=null,c=()=>{if(n!==this.scrollWaitToken)return;let l=this.findScrollTarget(t,e);if(l){let u=this.readScrollTarget(l);if(u.sized){if(a!==null&&Math.abs(a-u.targetScroll)<1){r(u.targetScroll);return}a=u.targetScroll}}if(++o<i){requestAnimationFrame(c);return}a!==null&&r(a)};requestAnimationFrame(c)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&d.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent(),this.clearScrollWait(),this.pageCache.clear()}getPath(){let t=this.location,e=this.history;return e&&e.type==="hash"?t.hash.replace("#",""):t.pathname+t.search+t.hash}},H=new ze;p.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&H.removeRoute(t)});var ps=(s,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&ds(s,i,e)}else ds(s,t,e)},ds=(s,t,e)=>{t.container=s,t.parent=e;let r=H.add(t);ui(s,r)},ui=(s,t)=>{p.add(s,"routes",{route:t})};var ms=(s,t,e)=>{};p.addType("switch",s=>{if(!s)return!1;let t=s.id;H.removeSwitch(t)});var gs=(s,t,e)=>{let r=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=s,a.parent=e)}let n=H.addSwitch(t);hi(s,n)},hi=(s,t)=>{p.add(s,"switch",{id:t})};st.add("cache",Ir).add("onCreated",Qr).add("onDestroyed",$r).add("bind",Wr).add("data",_r).add("state",ms).add("onSet",ot).add("onState",Zt).add("animateIn",kr).add("animateOut",wr).add("watch",jr).add("useParent",Or).add("useData",Nr).add("useState",Br).add("getId",Lr).add("addState",Hr).add("addEvent",Ur).add("map",Vr).add("for",Kr).add("useContext",Mr).add("addContext",Dr).add("context",Pr).add("role",Ar).add("aria",Tr).add("route",ps).add("debug",Rr).add("dataSet",qr).add("dataStateSet",zr).add("switch",gs);export{ft as Ajax,ct as Arrays,Ns as Atom,y as Builder,E as Component,q as Data,p as DataTracker,on as DateTime,st as Directives,tt as Dom,pt as Encode,xs as Events,_ as Html,Re as Import,$ as Jot,mt as Model,le as NavLink,k as Objects,tn as Pod,Pt as ResourceCache,et as SimpleData,gt as State,O as Store,C as Strings,w as Types,yt as Unit,U as base,x as dataBinder,_e as preloadImport,H as router};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as A}from"./chunk-EBXFAKPV.js";import{a as L,b as Nt,c as Wt,d as R,e as S,f as _}from"./chunk-76NP53O5.js";import{a as q,b as Dt}from"./chunk-6N533MOU.js";import{b as Bt,c as Ht,f as I,g as Ut,i as F}from"./chunk-6EAE4I3C.js";import{b as f,c as p}from"./chunk-ZUB7I6Z4.js";var G={items:new Map,add(n,t){return this.items.set(n,t),this},get(n){return this.items.get(n)??null}};var g=[],j=0,dt=!1,Je=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n),Xe=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||n.container||null},Ze=n=>{n._mountPending=!1;try{n.afterMount()}catch(t){console.error("Error in afterMount:",t)}},qt=()=>{dt=!1;let n=g;if(n.length===0)return;g=[];let t=[];for(let e=0,r=n.length;e<r;e++){let s=n[e];if(s.rendered!==!0||s._mountPending!==!0){s._mountPending=!1;continue}let o=Xe(s);if(o&&o.isConnected===!0){Ze(s);continue}t.push(s)}t.length&&(g=g.length?t.concat(g):t),g.length&&j===0&&g.length!==t.length&&ft()},ft=()=>{dt||(dt=!0,Je(qt))},v={add(n){n._mountPending!==!0&&(n._mountPending=!0,g.push(n))},enter(){j++},leave(){--j>0||(j=0,g.length&&ft())},schedule(){g.length&&ft()},flush(){qt()},get size(){return g.length}};f.addType("components",n=>{if(!n)return;let t=n.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var tr=0,Q=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let s,o;if(t==null)s={},o=[];else{let i=typeof t;i==="string"||i==="number"?(s={},o=[{tag:"text",textContent:t}]):Array.isArray(t)?(s={},o=t):(s=t||{},o=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(s),this.children=o||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+tr++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,s;r!=null&&e!=null?s="pk:"+r+":"+e:r!=null?s="pk:"+r:e!=null?s="pk:"+e:s="pc"+this.persistedCount++;let o=this.persistedChildren[s];return o&&t.unitType===o.unitType&&t.resumeScope(o),t.persistToken=s,this.persistedChildren[s]=t,s}removePersistedChild(t,e){if(!this.rendered)return;let r=t?this.persistedChildren[t]:null;r&&(e&&r!==e||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){f.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&v.add(this)}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let s=0,o=t.length;s<o;s++){let i=e(t[s],s);r.push(i)}return r}removeAll(t){return F.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&F.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,r=t.length;e<r;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var pt=Symbol("unknown"),mt=n=>{if(!n||typeof n!="object")return null;let t={};for(let e in n){if(!Object.prototype.hasOwnProperty.call(n,e))continue;let r=n[e];if(r===null||typeof r!="object"){t[e]=r;continue}try{t[e]=JSON.stringify(r)}catch{t[e]=pt}}return t},er=(n,t)=>{let e=new Set([...Object.keys(n),...Object.keys(t)]);for(let r of e){let s=n[r],o=t[r];if(!(s===pt||o===pt)&&s!==o&&!(s!==s&&o!==o))return!1}return!0},gt=(n,t)=>{!n||!t||Object.defineProperty(n,"_initialStage",{value:t,configurable:!0,writable:!0,enumerable:!1})},M=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let s=r.data.stage,o=e.data.stage,i=null;for(let l in s){if(!Object.prototype.hasOwnProperty.call(s,l))continue;let a=s[l];a!==o[l]&&(i===null&&(i={}),i[l]=a)}i!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(i):e.data.set(i))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}this._releaseLinks(e,r);let s=mt(r.stage);gt(r,s);let o=e?e._initialStage:null,i=!!(o&&s&&!er(o,s));if(e&&e.stage&&(!i||e._retainState||r._retainState)){let l=e._retainState||r._retainState,a=!l&&(e._refreshState||r._refreshState),c=this._buildExternalUpdates(e.stage,r.stage,l,a);q.isEmpty(c)||r._silentSet(c)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,s){let o={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(s){Object.prototype.hasOwnProperty.call(e,i)||(o[i]=t[i]);continue}let l=t[i];!r&&l==null||l!==e[i]&&(o[i]=l)}return o}static _resumeOwned(t,e){let r=t.data;if(!r){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(r,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let s=e._refreshState||t.data._refreshState,o=this._buildOwnedUpdates(e.stage,t.data.stage,s);q.isEmpty(o)||t.data._silentSet(o)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let s={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(r){Object.prototype.hasOwnProperty.call(e,o)||(s[o]=t[o]);continue}let i=t[o];i!=null&&i!==e[o]&&(s[o]=i)}return s}};var Y=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let s=t[r];this.on(s[0],s[1],s[2],s[3])}}on(t,e,r,s){p.on(t,e,r,s),this.events.push({event:t,obj:e,callBack:r,capture:s})}off(t,e,r,s){p.off(t,e,r,s);let o,i=this.events;for(let l=0,a=i.length;l<a;l++)if(o=i[l],o.event===t&&o.obj===e&&o.callBack===r&&o.capture===s){i.splice(l,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let s=t[e];p.on(s.event,s.obj,s.callBack,s.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let s=t[e];p.off(s.event,s.obj,s.callBack,s.capture)}}reset(){this.unset(),this.events=[]}};var V=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,s){return{action:t,state:e,callBack:r,targetId:s,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let s=null,o=null,i=t[r];i&&typeof i=="object"&&(o=i.callBack,s=i.id||i.targetId,i=i.state),e.push(this.createState(r,i,o,s))}return e}setupRemoteStates(t,e){for(let r=0,s=t.length;r<s;r++){let o=t[r];if(o)for(let i in o){if(!Object.prototype.hasOwnProperty.call(o,i)||i==="id")continue;let l=null,a=o[i],c=a!==null?a:void 0;c&&typeof c=="object"&&(l=c.callBack,c=c.state),e.push(this.createState(i,c,l,o.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,s=e.length;r<s;r++){let o=e[r];o.callBackToken&&(t.off(o.action,o.callBackToken),o.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,s=e.length;r<s;r++){let o=e[r];o.token&&this.unbindRemoteState(t,o.token),o.targetId&&A.remove(o.targetId,o.action,o.token)}}restore(t){A.restore(t.id,t);let e=this.callBackStates;if(e)for(let s=0,o=e.length;s<o;s++){let i=e[s];i.callBackToken=t.on(i.action,i.callBack)}let r=this.remoteStates;if(r)for(let s=0,o=r.length;s<o;s++){let i=r[s];i.token=this.bindRemoteState(t,i.action,i.targetId)}}bindRemoteState(t,e,r){let s=A.getTarget(r);return t.link(s,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let s=0,o=e.length;s<o;s++){let i=e[s],l=this.addAction(t,i);i.targetId&&(i.token=l,r.push(i))}}addAction(t,e){let r,s=e.action,o=e.targetId;o&&(r=this.bindRemoteState(t,s,o)),typeof e.state<"u"&&t.addAction(s,e.state);let i=e.callBack;return typeof i=="function"&&(e.callBackToken=t.on(s,i),this.callBackStates.push(e)),r||null}};var x=class extends Q{constructor(t,e,r){super(t,e,r),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t,this._externalData&&!t._initialStage&>(t,mt(t.stage)))}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){M.resume(this,t)}_refreshData(){M.refresh(this)}_refreshContextData(){M.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=A.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();q.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new V(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),A.detach(String(t.id)),this.stateResumed=!1}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Y)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}};var Ft={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Gt=(n,t)=>typeof n!="function"&&t==="setupStates"?()=>n:n;var yt=(n,t)=>{if(!n)return t;let e=Object.keys(n);for(let r=0,s=e.length;r<s;r++){let o=e[r],i=n[o],l=Ft[o]||o;t[l]=Gt(i,l)}return t},rr=n=>yt(n,{}),nr=0,Kt=(n,t)=>{class e extends n{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+nr++,e},O=(n,t=x)=>{n||(n={});let e,r=typeof n;return r==="object"&&n.render?(e=rr(n),Kt(t,e)):(e={render:r==="function"?n:()=>n},Kt(t,e))};var St=(n,t)=>({attr:n,directive:t});var k=(n,t)=>({key:n,value:t});var zt=(n,t,e,r)=>({tag:n,attr:t,directives:e,children:r});var jt=null,sr=()=>jt||(jt=G.get("watch")),w=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,s){return t==="text"?(s.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(k("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(St(k(e,_.getWatcherSettings(r,Ut(e))),sr()))}static setButtonType(t,e,r){if(t==="button"){let s=e.type||"button";r.push(k("type",s))}}static parse(t,e){let r=[],s=[],o=t.tag||"div";o==="button"&&r.push(k("type",t.type||"button"));let i=[],l,a;for(let c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||c==="tag"||(l=t[c],l==null))continue;if(c==="children"||c==="nest"){if(Array.isArray(l))for(let h=0;h<l.length;h++)i.push(l[h]);else i.push(l);continue}if((a=G.get(c))!==null){s.push(St(k(c,l),a));continue}let u=typeof l;if(u==="object"){if(_.isWatching(l)){this.setTextAsWatcher(s,c,l);continue}i.push(l);continue}if(u==="function"){let h=l,m=function(y){h.call(this,y,e)};m.originalCallback=h,r.push(k(c,m));continue}if(u==="string"&&l.includes("[[")){this.setTextAsWatcher(s,c,l);continue}if(c==="text"){i.push({tag:"text",textContent:l});continue}if(c==="html"||c==="innerHTML"){r.push(k("innerHTML",l));continue}r.push(k(c,l))}return zt(o,r,s,i)}};var D=class{build(t,e,r){}setupComponent(t,e,r){let s=r?.getChildScope();t.parent=s,s&&s.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&s&&(s[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var or=n=>{for(let e in n)if(e!=="tag"&&e!=="textContent")return!1;let t=n.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},$=class extends D{build(t,e,r){let s=S.createDocFragment();if(Array.isArray(t))for(let o=0,i=t.length;o<i;o++)this.buildElement(t[o],s,r);else this.buildElement(t,s,r);return e&&typeof e=="object"&&e.appendChild(s),s}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&or(t)){let c=t.textContent;S.createText(c??"",e);return}let s=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,s);return}let o=w.parse(t,s),i=this.createNode(o,e,s);this.cache(i,t.cache,r);let l=o.children;for(let c=0,u=l.length;c<u;c++){let h=l[c];h!==null&&this.buildElement(h,i,r)}let a=o.directives;a.length&&this.setDirectives(i,a,s)}createTempComponent(t,e,r){let s={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...yt(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(s.setupStateTarget=function(i){this.state=t.state});let o=new x(s);this.createComponent(o,e,r)}setDirectives(t,e,r){for(let s=0,o=e.length;s<o;s++)this.handleDirective(t,e[s],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let s=t.tag;if(s==="text"){let o=t.attr[0],i=o?o.value:"";return S.createText(i,e)}else if(s==="comment"){let o=t.attr[0],i=o?o.value:"";return S.createComment(i,e)}return S.create(s,t.attr,e,r)}removeNode(t){S.removeElement(t)}removeAll(t){S.removeAll(t)}};var ir=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),lr=/[&<>"]/,vt=n=>{let t=typeof n=="string"?n:String(n);return lr.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},B=class{static create(t,e=[],r=""){let s="",o="";for(let i=0,l=e.length;i<l;i++){let a=e[i],c=a.key,u=a.value;if(c==="text"||c==="textContent"){s+=vt(u);continue}if(c==="html"||c==="innerHTML"){s+=u;continue}if(typeof u=="function")continue;let h=c+'="'+vt(u)+'"';o?o+=" "+h:o=h}return ir.has(t)?"<"+t+" "+o+" />":"<"+t+" "+o+">"+s+r+"</"+t+">"}static createText(t){return vt(t)}static createComment(t){return"<!-- "+t+" -->"}};var J=class extends D{build(t,e,r){if(Array.isArray(t)){let s="";for(let o=0,i=t.length;o<i;o++)s+=this.buildElement(t[o],r);return s}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=w.parse(t,e),s=r.children,o="";for(let i=0,l=s.length;i<l;i++){let a=s[i];a!==null&&(o+=this.buildElement(a,e))}return this.createNode(r,o)}createNode(t,e){let r=t.tag;if(r==="text"){let s=t.attr[0],o=s?s.value:"";return B.createText(o)}else if(r==="comment"){let s=t.attr[0],o=s?s.value:"";return B.createComment(o)}return B.create(r,t.attr,e)}removeAll(t){}};var X=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new $:new J}};var b=X.setup(),ar=n=>typeof n=="object"&&n.isUnit===!0,Qt=new WeakMap,cr=n=>{let t=Qt.get(n);if(!t){if(t=O(n),!t)return null;Qt.set(n,t)}return new t},d=class{static render(t,e,r){if(!t||(ar(t)||(t=cr(t)),!t))return null;v.enter();try{return b.createComponent(t,e,r)}finally{v.leave()}}static build(t,e,r){v.enter();try{return b.build(t,e,r)}finally{v.leave()}}static rebuild(t,e,r){return b.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){b.setDirectives(t,e,r)}static createNode(t,e,r){return b.createNode(t,e,r)}static removeNode(t){b.removeNode(t)}static removeAll(t){b.removeAll(t)}};Dt.augment({buildLayout(n,t,e){d.build(n,t,e)}});var xt=[],ur=n=>xt.indexOf(n)!==-1,hr=n=>({tag:"script",src:n.src,async:!1,load(t){xt.push(n.src);let e=n.load;e&&e()}}),dr=n=>({tag:"link",rel:"stylesheet",type:"text/css",href:n.src,load(t){xt.push(n.src);let e=n.load;e&&e()}}),Z=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=dr({load:r,src:t}):e=hr({load:r,src:t}),d.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{ur(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var fr=n=>n?typeof n?.prototype?.constructor=="function":!1,C=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(fr(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){return this.renderNodes(t,e,r)[0]||null}static renderNodes(t,e,r){let s=d.build(t,null,r),o=Array.from(s.childNodes);return o.length===0&&t?.panel&&o.push(t.panel),e.after(s),o}};var tt=class{static load(t,e,r){return t.then(s=>(e&&e(s),s)).catch(s=>{console.error("Error loading module:",s),r&&r(s)})}};var pr=n=>({tag:"comment",textContent:"import placeholder",onCreated:n.onCreated}),T=new L(100),Yt=n=>{if(T.has(n)){let r=T.get(n);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof n,e;if(t==="string")e=import(n);else if(t==="function")e=n();else return n;return e.then(r=>{T.set(n,r)}).catch(()=>{T.delete(n)}),T.set(n,e),e},Vt=n=>{if(!T.has(n))return null;let t=T.get(n);return t&&typeof t.then=="function"?null:t||null},$t=n=>{let t=typeof n;if(t!=="string"&&t!=="function")return null;if(Vt(n))return Promise.resolve(T.get(n));let e;try{e=Yt(n)}catch{return null}return e.catch(()=>null)},kt=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&d.removeNode(r)}},Jt=O({declareProps(){this.loaded=!1,this.errorRoot=null,this.loadingRoots=null,this.generation=0},render(){return pr({onCreated:n=>{if(this.src){if(this.layout){this.setLayoutRoots(C.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){this.renderLoading(n),new Z(()=>{this.loadAndRender(n)}).addFiles(this.depends);return}this.loadAndRender(n)}}})},loadAndRender(n){let t=this.generation,e=Vt(this.src);if(e){this.renderModule(n,e);return}this.renderLoading(n),tt.load(Yt(this.src),r=>{t===this.generation&&this.renderModule(n,r)},r=>{t===this.generation&&(this.loaded=!1,this.removeLoadingLayout(),this.renderError(n,r))})},renderLoading(n){let t=this.loading;if(!t||this.loadingRoots)return;let e=typeof t=="function"?t():t;e&&(this.loadingRoots=C.renderNodes(e,n,this.parent))},removeLoadingLayout(){let n=this.loadingRoots;return n?(this.loadingRoots=null,kt(n),!0):!1},renderError(n,t){let e=()=>this.retry(n),r=this.fallback,s=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};if(!s)return;let o=C.renderNodes(s,n,this.parent);this.errorRoots=o,this.errorRoot=o[0]||null},setLayoutRoots(n){this.layoutRoots=n,this.layoutRoot=n[0]||null},retry(n){this.removeErrorLayout(),this.loadAndRender(n)},removeErrorLayout(){this.errorRoot&&(kt(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(n,t){this.loaded=!0;let e=this.layout||C.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(C.renderNodes(e,n,this.parent)),this.removeLoadingLayout()&&typeof this.onReplaceLoading=="function"&&this.onReplaceLoading(this.layoutRoots,e),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(n){return this.updateLayout===!0?!0:this.updateLayout=n&&n.isUnit&&typeof n.update=="function"},updateModuleLayout(n){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(n)},update(n){this.loaded===!0&&this.updateModuleLayout(n)},destroy(){this.generation++,this.removeErrorLayout(),this.removeLoadingLayout(),this.layoutRoot&&(kt(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Xt=n=>{let t=typeof n;return(t==="string"||t==="function"||n instanceof Promise)&&(n={src:n}),new Jt(n)};var mr=0,H=class{constructor(t){this.router=t,this.locationId="base-app-router-"+mr++,this.callBack=this.check.bind(this)}setup(){return this.trackScroll(),this.addEvent(),this}check(t){}getScrollPosition(){let t=this.scrollPosition;return t?{x:t.x,y:t.y}:{x:window.scrollX,y:window.scrollY}}trackScroll(){typeof window>"u"||this.scrollHandler||(this.scrollPosition={x:window.scrollX,y:window.scrollY},this.scrollHandler=()=>{this.scrollPosition={x:window.scrollX,y:window.scrollY}},window.addEventListener("scroll",this.scrollHandler,{passive:!0}))}untrackScroll(){this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollPosition=null)}scrollTo(t){window.scrollTo(t.x,t.y),this.scrollHandler&&(this.scrollPosition={x:t.x,y:t.y})}addEvent(){return this}};var gr=0,yr=()=>Date.now().toString(36)+"-"+(gr++).toString(36)+"-"+Math.random().toString(36).substring(2,8),te=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Zt=()=>{te&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let n=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(n,t)}))},et=class extends H{constructor(t){super(t),this.currentKey=null,this.positions=new L(200)}saveCurrentPosition(){let t=this.getScrollPosition(),e=this.currentKey;return e&&this.positions.set(e,t),t}addEvent(){p.on("popstate",window,this.callBack);let t=window.history;return t&&"scrollRestoration"in t&&(this.previousScrollRestoration=t.scrollRestoration,t.scrollRestoration="manual"),te&&(this.pageShowCallBack=this.onPageShow.bind(this),p.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){p.off("popstate",window,this.callBack),this.untrackScroll();let t=window.history;return this.previousScrollRestoration&&t&&"scrollRestoration"in t&&(t.scrollRestoration=this.previousScrollRestoration,this.previousScrollRestoration=null),this.pageShowCallBack&&p.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&Zt()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.saveCurrentPosition();let r=e.key||null;this.currentKey=r;let s=r&&this.positions.get(r)||e.scrollPosition,o=this.router;o.checkActiveRoutes(e.uri,!!s),s&&(typeof o.restoreScrollPosition=="function"?o.restoreScrollPosition(s):this.scrollTo(s)),Zt()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:yr(),scrollPosition:r,uri:t}}addState(t,e,r=!1){let s=window.history,o=s.state;if(o&&o.uri===t)return o.key&&o.location===this.locationId&&(this.currentKey=o.key),this;!r&&o&&o.location===this.locationId&&(o.scrollPosition=this.saveCurrentPosition(),s.replaceState(o,"",window.location.href));let i=this.createState(t,e);return r||(i.scrollPosition={x:0,y:0}),s[r===!1?"pushState":"replaceState"](i,null,t),this.currentKey=i.key,this.positions.set(i.key,i.scrollPosition),this}};var rt={removeSlashes(n){return typeof n!="string"?"":(n[0]==="/"&&(n=n.substring(1)),n[n.length-1]==="/"&&(n=n.substring(0,n.length-1)),n)},getHashUri(n){if(typeof n!="string")return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)}};var nt=class extends H{addEvent(){return p.on("hashchange",window,this.callBack),this}removeEvent(){return p.off("hashchange",window,this.callBack),this.untrackScroll(),this}check(t){this.router.checkActiveRoutes(rt.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var st=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new et(t).setup():new nt(t).setup()}};var wt=5,Sr=200,ot=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new L(Sr),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMode(){let t=this.owner;return t!==null&&t.keepAliveMode==="hide"?"hide":"detach"}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:wt}get size(){return this.pages.size}add(t){let e=this.pages;e.delete(t),e.add(t),this.trim()}delete(t){this.pages.delete(t)}trim(){let t=this.pages,e=this.getMax();for(;t.size>e;){let r=t.values().next().value;t.delete(r),r.evict()}}clear(){let t=Array.from(this.pages);this.pages.clear();for(let e=0,r=t.length;e<r;e++)t[e].evict()}saveScroll(t,e){if(e){this.scrollMemory.set(t,e);return}this.scrollMemory.has(t)&&this.scrollMemory.delete(t)}getScroll(t){return this.scrollMemory.get(t)||null}};var Ct=class extends x{getChildScope(){return this.parent}},ee=n=>O(n,Ct);var it="data-scroll-key",vr="["+it+"]",xr="[data-route-dormant]",re=n=>typeof n.closest=="function"&&n.closest(xr)!==null,Rt=new WeakMap,E=typeof WeakRef=="function"?new Set:null,Tt=new WeakMap,At=(n,t,e)=>{if(Rt.set(n,[t,e]),!E)return;let r=Tt.get(n);if(t===0&&e===0){r&&(E.delete(r),Tt.delete(n));return}if(!r){let s=new WeakRef(n);Tt.set(n,s),E.add(s)}},Pt=!1,kr=()=>Pt?!0:typeof document>"u"||typeof document.addEventListener!="function"?!1:(document.addEventListener("scroll",n=>{let t=n.target;t&&t.nodeType===1&&At(t,t.scrollTop||0,t.scrollLeft||0)},{capture:!0,passive:!0}),Pt=!0,!0);kr();var ne=(n,t)=>{for(let e=0,r=n.length;e<r;e++){let s=n[e];if(!s||s.nodeType!==1||re(s))continue;let o=s.getAttribute(it);o!==null&&t(s,o);let i=s.querySelectorAll(vr);for(let l=0,a=i.length;l<a;l++){let c=i[l];re(c)||t(c,c.getAttribute(it))}}},bt=n=>{let t=null,e=Pt;return ne(n,(r,s)=>{let o=0,i=0;if(e){let l=Rt.get(r);l&&(o=l[0],i=l[1])}else o=r.scrollTop||0,i=r.scrollLeft||0;o===0&&i===0||(t=t||{},t[s]=[o,i])}),t},Et=(n,t)=>{if(!t)return!0;let e={},r=0;for(let s in t)e[s]=!0,r++;return ne(n,(s,o)=>{let i=t[o];if(!i)return;let l=i[0],a=i[1];s.scrollTop=l,s.scrollLeft=a;let c=s.scrollTop||0,u=s.scrollLeft||0;At(s,c,u),Math.abs(c-l)<1&&Math.abs(u-a)<1&&e[o]&&(e[o]=!1,r--)}),r<=0},se=n=>{if(!E||E.size===0)return null;let t=null;for(let e of E){let r=e.deref();if(!r){E.delete(e);continue}if(!r.isConnected||r.hasAttribute(it))continue;let s=!1;for(let i=0,l=n.length;i<l;i++){let a=n[i];if(a&&a.nodeType===1&&a.contains(r)){s=!0;break}}if(!s)continue;let o=Rt.get(r);o&&(t=t||[],t.push([r,o[0],o[1]]))}return t},oe=n=>{if(n)for(let t=0,e=n.length;t<e;t++){let[r,s,o]=n[t];r.isConnected&&(r.scrollTop=s,r.scrollLeft=o,At(r,r.scrollTop||0,r.scrollLeft||0))}};var wr=n=>{for(let t=0;t<n.length;t++){let e=n[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let s=[];for(let o=0,i=r.length;o<i;o++){let l=r[o];l&&n.indexOf(l)===-1&&s.indexOf(l)===-1&&s.push(l)}n.splice(t+1,0,...s)}},K="data-route-dormant",lt=[["content-visibility","hidden"],["position","absolute"],["top","0"],["left","0"],["width","100%"],["opacity","0"],["clip-path","inset(50%)"]],Cr=n=>{let t=n.style,e=[];for(let s=0,o=lt.length;s<o;s++){let[i,l]=lt[s];e.push([i,t.getPropertyValue(i),t.getPropertyPriority(i)]),t.setProperty(i,l,"important")}let r=n.ownerDocument&&n.ownerDocument.activeElement;return r&&r!==n.ownerDocument.body&&n.contains(r)&&typeof r.blur=="function"&&r.blur(),n.setAttribute(K,""),n.inert=!0,e},Tr=(n,t)=>{let e=n.style,r=t||[];for(let s=0,o=lt.length;s<o;s++){let i=lt[s][0],l=r.find(a=>a[0]===i);l&&l[1]?e.setProperty(i,l[1],l[2]||""):e.removeProperty(i)}n.removeAttribute(K),n.inert=!1},Pr="iframe, embed, object",Rr="video, audio",le=(n,t)=>{let e=[];for(let r=0,s=n.length;r<s;r++){let o=n[r];if(!o||o.nodeType!==1)continue;o.matches(t)&&e.push(o);let i=o.querySelectorAll(t);for(let l=0,a=i.length;l<a;l++)e.push(i[l])}return e},Ar=n=>{let t=le(n,Rr);for(let e=0,r=t.length;e<r;e++){let s=t[e];s.paused===!1&&typeof s.pause=="function"&&s.pause()}},br=n=>/^class[\s{]/.test(Function.prototype.toString.call(n)),Er=1500,ie=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Ir=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},It=(n,t,e)=>{if(!(!n||typeof n[t]!="function"))try{n[t](...e)}catch(r){console.error("Error in "+t+":",r)}},at=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.keepAlive=typeof e.keepAlive=="boolean"?e.keepAlive:null,this.keepAliveMode=e.keepAliveMode==="hide"||e.keepAliveMode==="detach"?e.keepAliveMode:null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.capturedScroll=null,this.pageCache=e.pageCache||null,this.detachedNodes=null,this.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.savedElements=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let r=t.layout;if(r&&r.isUnit===!0&&typeof r.keepAlive=="boolean")return r.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}getKeepAliveMode(t){if(this.keepAliveMode!==null)return this.keepAliveMode;if(t=t||this.component,t){let r=t.keepAliveMode;if(r==="hide"||r==="detach")return r;let s=t.layout;if(s&&s.isUnit===!0&&(s.keepAliveMode==="hide"||s.keepAliveMode==="detach"))return s.keepAliveMode}let e=this.pageCache;return e!==null&&typeof e.getMode=="function"?e.getMode():"detach"}isDetached(){return this.detachedNodes!==null}captureScroll(){let t=this.component;if(this.setup!==!0||!t||t.rendered!==!0){this.capturedScroll=null;return}this.capturedScroll={value:bt(this.getRootNodes(t))}}releaseCapturedScroll(){this.capturedScroll=null}takeScroll(t){let e=this.capturedScroll;return this.capturedScroll=null,e?e.value:bt(this.getRootNodes(t))}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=br(t)?new t:t(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(ee(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;d.render(t,this.container,this.parent)}afterCreate(t){let e=this.component;!e||this.pageCache===null||(e.loaded===!1&&e.src&&(e.onModuleRender=()=>this.onModuleRender(e)),this.isKeepAlive(e)&&this.callPageHook("onActivate",[t,{restored:!1}]),this.pageCache.historyNavigation===!0&&this.restoreHistoryScroll())}onModuleRender(t){if(this.setup!==!0||this.component!==t)return;let e=t.layout;e&&e.isUnit===!0&&this.isKeepAlive(t)&&It(e,"onActivate",[this.params,{restored:!1}])}getScrollKey(){let t=this.route||{};return(t.routeId||"")+"|"+(t.path||"")}getPagePath(){let e=(this.route||{}).path||"",r=e.indexOf("#");return r>-1?e.substring(0,r):e}getRootNodes(t){let e=[],r=Ir(t);r&&e.push(r);let s=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),o=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),i=t.loadingRoots||null,l=[s,o,i];for(let a=0;a<3;a++){let c=l[a];if(c)for(let u=0,h=c.length;u<h;u++){let m=c[u];m&&e.indexOf(m)===-1&&e.push(m)}}return wr(e),e}callPageHook(t,e){let r=this.component;if(!r)return;It(r,t,e);let s=r.layout;s&&s!==r&&s.isUnit===!0&&It(s,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,s=()=>Et(this.getRootNodes(r),t);if(s()||typeof requestAnimationFrame>"u")return;let o=ie(),i=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||s()||ie()-o>Er||requestAnimationFrame(i)};requestAnimationFrame(i)}restoreDetachedScroll(){let t=this.savedScroll,e=this.savedElements;this.savedScroll=null,this.savedElements=null;let r=this.component;if(!t&&!e||!r)return;let s=()=>{t&&Et(this.getRootNodes(r),t),oe(e)};if(typeof requestAnimationFrame>"u"){s();return}let o=++this.scrollToken;requestAnimationFrame(()=>{o!==this.scrollToken||this.setup!==!0||this.component!==r||s()})}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=this.takeScroll(t);return this.savedScroll=r,this.savedElements=se(e),this.pageCache.saveScroll(this.getScrollKey(),r),this.getKeepAliveMode(t)==="hide"&&t.loaded!==!1&&le(e,Pr).length===0?(Ar(e),this.hideInPlace(e)):this.removeNodes(e),this.detachedNodes=e,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}removeNodes(t){let e=new WeakMap;for(let r=0,s=t.length;r<s;r++){let o=t[r],i=o.parentNode;i&&(e.set(o,i),i.removeChild(o))}this.detachedParents=e,this.hiddenInPlace=!1,this.hiddenStyles=null}hideInPlace(t){let e=new WeakMap;for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&o.nodeType===1&&e.set(o,Cr(o))}this.detachedParents=null,this.hiddenInPlace=!0,this.hiddenStyles=e}showInPlace(t,e){let r=this.hiddenStyles;for(let s=0,o=t.length;s<o;s++){let i=t[s];i.nodeType===1&&i.hasAttribute(K)&&Tr(i,r?r.get(i):void 0),i.isConnected||e.appendChild(i)}}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.hiddenInPlace;this.hiddenInPlace=!1;let s=this.component,o=this.container;if(!s||s.rendered!==!0||!o||typeof o.appendChild!="function")return this.savedScroll=null,this.savedElements=null,this.hiddenStyles=null,this.releaseComponent(),!1;if(r)return this.showInPlace(this.getRootNodes(s),o),this.hiddenStyles=null,this.setup=!0,v.schedule(),!0;let i=this.getRootNodes(s);for(let l=0,a=i.length;l<a;l++){let c=i[l],u=e?e.get(c):null;(u&&u.isConnected?u:o).appendChild(c)}return this.setup=!0,v.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.detachedParents=null,this.savedScroll=null,this.savedElements=null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.releaseComponent()}releaseComponent(){let t=this.component;this.component=null,t&&typeof t.destroy=="function"&&t.destroy()}remove(t){if(this.setup!==!0){t===!0&&this.evict();return}this.setup=!1,this.scrollToken++;let e=this.component;if(!e)return;let r=this.pageCache;if(t!==!0&&r!==null){if(this.isKeepAlive(e)&&this.detach(e))return;r.saveScroll(this.getScrollKey(),this.takeScroll(e))}this.capturedScroll=null,this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var ae=n=>{if(!n.length)return null;let t={};for(let e=0,r=n.length;e<r;e++)t[n[e]]=null;return t},ce=n=>{let t=[];if(!n)return t;let e=/[*?]/g;n=n.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,s=n.match(r);if(s===null)return t;for(let o=0,i=s.length;o<i;o++){let l=s[o];l&&t.push(l.replace(":",""))}return t};var Lr=/(\/):[^/(]*?\?/g,_r=/\//g,Mr=/(\?\/+\*?)/g,Or=/(:[^/?&($]+)/g,Dr=/(\*)/g,Br=n=>n.replace(Lr,t=>t.replace(_r,"(?:$|/)")),Hr=n=>(n=n.replace(Mr,"?/*"),n.replace(Or,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Ur=n=>n.replace(Dr,".*"),Nr=(n,t)=>n+=t[t.length-1]==="*"?"":"$",ue=n=>{if(!n)return"";let t=n;return t=Br(t),t=Hr(t),t=Ur(t),t=Nr(t,n),t};var Wr=0,he=(n,t="")=>{let e=n||"",r=typeof t=="string"&&t?t:e,s=null,o=[],i=r.match(/#\{([^}]+)\}/);i&&i[1]&&(s=i[1].trim(),r=r.replace(i[0],""),e=e.replace(i[0],""));let l=r.indexOf("?");if(l>-1){let u=r.substring(l+1);if(u.indexOf("=")>-1){let h=u.split("&");for(let y=0,N=h.length;y<N;y++){let W=h[y];if(!W)continue;let[Ve,$e=""]=W.split("="),Ot=(Ve||"").trim();Ot&&o.push({key:Ot,value:($e||"").trim()})}r=r.substring(0,l);let m=e.indexOf("?");m>-1&&(e=e.substring(0,m))}}let a=s!==null||o.length>0;return a&&!r&&(e="*"),{uriPath:e,requiredHash:s,requiredQuery:o,hasConditions:a}},de=n=>{if(!n)return"";let t=n.indexOf("?"),e=n.indexOf("#"),r=n.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),n.substring(0,r).replace(/\/\.(?:\/|$)/g,"/")},qr=n=>{if(!n)return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)},Fr=n=>{if(!n)return"";let t=n.indexOf("?");if(t===-1)return"";let e=n.indexOf("#",t);return e===-1?n.substring(t+1):n.substring(t+1,e)},ct=class extends Nt{constructor(t,e,r=null){let s=t.baseUri,i=he(s,t.rawUri).uriPath,l=ce(i),a=ae(l),c=super(a);return this.uri=s,this.matchUri=i,this.paramKeys=l,this.titleCallBack=e,this.pageCache=r,this.setupRoute(t),this.set("active",!1),c}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null,this.pageCache=null,this.importSrc=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+Wr++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=he(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=ue(this.matchUri);this.uriQuery=new RegExp("^"+r),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(t){this.set("active",!1);let e=this.controller;e&&e.remove(t===!0)}captureScroll(){let t=this.controller;t&&this.get("active")&&t.captureScroll()}releaseCapturedScroll(){let t=this.controller;t&&t.releaseCapturedScroll()}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return e?e.isConnected===!1?!0:typeof e.closest=="function"&&e.closest("["+K+"]")!==null:!1}getLayout(t){if(t.component)return t.component;let e=t.import;if(!e)return null;let r=e&&typeof e=="object"&&!(e instanceof Promise)?e.src:e;return this.importSrc=typeof r=="string"||typeof r=="function"?r:null,Xt(e)}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:s,parent:o,keepAlive:i,keepAliveMode:l}=t,a={component:e,container:r,persist:s,parent:o,keepAlive:i,keepAliveMode:l,pageCache:this.pageCache},c=Bt(this);this.controller=new at(c,a)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let r=this.controller;r&&r.focus(t);let s=this.path;if(!s)return;let o=s.split("#")[1];o&&this.scrollToId(o)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=de(t),s=this.uriQuery||/$^/,o=r.match(s);return o===null?(this.resetParams(),e):Array.isArray(o)?this.matchConditions(t)?(this.setParams(o,1),e=o,e):(this.resetParams(),!1):e}matches(t){return(this.uriQuery||/$^/).test(de(t))&&this.matchConditions(t)}prefetch(){let t=this.importSrc;return t?$t(t):null}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&qr(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=Fr(t);if(!r)return!1;let s=new URLSearchParams(r);for(let o=0,i=e.length;o<i;o++){let l=e[o];if(!s.has(l.key)||s.get(l.key)!==l.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let r=this.paramKeys;if(!r)return;let s={};for(let o=0,i=r.length;o<i;o++){let l=r[o];typeof l<"u"&&(s[l]=t[o+e])}this.set(s)}getParams(){return this.stage}};var Gr=n=>{let t=/\w\S*/;return n.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},Kr=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),zr=(n,t)=>{if(n.indexOf(":")===-1)return n;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let s=new RegExp(":"+Kr(r),"gi");n=n.replace(s,()=>e[r])}return n},jr=(n,t)=>t&&(typeof t=="function"&&(t=t(n.stage)),t=zr(t,n),Gr(t)),Qr=(n,t)=>(t!==""&&(n+=" - "+t),n),fe=(n,t,e)=>t&&(t=jr(n,t),Qr(t,e));var Yr=()=>typeof window<"u"?window.location:{},Vr=n=>{if(!n)return"";let t=n.indexOf("#");return t>-1?n.substring(t+1):""},$r=1500,ut=["wheel","touchstart","keydown","pointerdown"],pe=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Lt=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=wt,this.keepAliveMode="detach",this.pageCache=new ot(this),this.history=null,this.callBackLink=null,this.location=Yr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new Wt({path:""})}setupHistory(){this.history=st.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new ct(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;typeof r=="number"&&r>=0&&(this.keepAliveMax=r);let s=e?e.mode:void 0;return(s==="hide"||s==="detach")&&(this.keepAliveMode=s),this.pageCache.trim(),this}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),r=rt.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let s=0;s<r;s++){let o=e[s];if(o.uri===t)return o}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let s=0;s<r;s++){let o=e[s];if(o.routeId===t)return o}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate(!0)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i)continue;let l=this.createRoute(i);r.push(l)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,s=this.getSwitchGroup(r);for(let o=0,i=t.length;o<i;o++){let a=t[o].component.route;a.resumeRoute(e),s.push(a)}return this.checkGroupForRegistration(r,s),r}checkGroupForRegistration(t,e){let r=this.scrollIntent,s=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=s;let o=this.scrollIntent;o&&o.type==="target"&&o.groupId!==null&&o.groupId!==void 0&&(this.activeScrollGroups.add(o.groupId),this.lastScrollGroup=o.groupId),this.scrollIntent=r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){this.activeScrollGroups.delete(t),this.lastScrollGroup===t&&(this.lastScrollGroup=null);let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,s=e.length;r<s;r++){let o=e[r];o&&typeof o.deactivate=="function"&&o.deactivate(!0)}}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),p.on("click",document,this.callBackLink);let r=this.getEndPoint();return this.navigate(r,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.defaultPrevented===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0||t.altKey===!0||typeof t.button=="number"&&t.button!==0)return!0;let e=t.target&&t.target.closest?t.target.closest("a"):null;if(!e||e.dataset.cancelRoute||e.hasAttribute("download"))return!0;let r=e.getAttribute("target");if(r&&r!=="_self")return!0;let s=e.getAttribute("href");if(s===null)return!0;let o=this.getLinkPath(s);if(o===null)return!0;let i=e.dataset.replace==="true";return this.navigate(o,null,i),t.preventDefault(),t.stopPropagation(),!1}getLinkPath(t){let e=t;if(e.substring(0,2)==="//"||/^[a-z][a-z0-9+.-]*:/i.test(e)){let s=this.location;if(!s||!s.origin||typeof URL>"u")return null;let o;try{o=new URL(e,s.href)}catch{return null}if(o.origin!==s.origin)return null;e=o.pathname+o.search+o.hash}let r=this.baseURI;return r!=="/"&&e.indexOf(r)===0&&(e=e.substring(r.length)),e}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let s=t[e];s&&typeof s.deactivate=="function"&&s.deactivate(!0)}return this.pageCache.clear(),this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.updatePath(),this.activate(),this}prefetch(t){if(typeof t!="string"||!t)return Promise.resolve([]);let e=this.getLinkPath(t);if(e===null)return Promise.resolve([]);let r=this.createURI(e),s=[],o=l=>{if(!l||!l.controller||typeof l.matches!="function"||!l.matches(r))return!1;let a=l.prefetch();return a&&s.push(a),!0},i=this.routes;for(let l=0,a=i.length;l<a;l++)o(i[l]);for(let l of this.switches.values())for(let a=0,c=l.length;a<c&&!o(l[a]);a++);return Promise.all(s)}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=fe(t,e,this.title),this}checkActiveRoutes(t,e){t=t||this.getPath(),t!==this.path&&(this.lastPath=this.path),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollGroupsReady=new Set(this.activeScrollGroups),this.scrollWaitToken++;let r=this.pageCache;r.historyNavigation=e===!0;let s=this.captureActiveScroll(),o=this.routes;for(let i=0,l=o.length;i<l;i++){let a=o[i];typeof a>"u"||r.size>0&&a.isDormant()||this.checkRoute(a,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,this.releaseCapturedScroll(s),e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}captureActiveScroll(){let t=[],e=s=>{!s||!s.controller||!s.get("active")||s.isDormant()||(s.captureScroll(),t.push(s))},r=this.routes;for(let s=0,o=r.length;s<o;s++)e(r[s]);for(let s of this.switches.values())for(let o=0,i=s.length;o<i;o++)e(s[o]);return t}releaseCapturedScroll(t){for(let e=0,r=t.length;e<r;e++)t[e].releaseCapturedScroll()}checkSwitches(t,e){let r=this.switches;for(let[s,o]of r.entries())e===!0&&this.pageCache.size>0&&o.length&&o[0].isDormant()||(this.currentGroupId=s,this.checkGroup(o,t));this.currentGroupId=null}checkGroup(t,e){let r=t.length;if(!r)return;let s=null;for(let l=0;l<r;l++)if(t[l].get("active")){s=t[l];break}let o=!1;s&&(o=s.match(e)!==!1);let i;for(let l=0;l<r;l++){let a=t[l];if(typeof a>"u")continue;(a===s?o:a.match(e))!==!1&&i===void 0&&a.controller&&(i=a)}if(!i){s&&s!==t[0]&&s.deactivate(),this.select(t[0],!0);return}this.select(i),s&&s!==i&&s.deactivate();for(let l=0;l<r;l++){let a=t[l];a&&a!==i&&a!==s&&a.deactivate()}}checkRoute(t,e){let r=this.check(t,e);return r!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),r}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){if(!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e===!0))return;let r=this.scrollIntent;if(r&&r.type==="hash")return;let s=Vr(this.path);if(s){this.scrollIntent={type:"hash",hash:s};return}t.scrollTo?(this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId},this.currentGroupId!==null&&this.currentGroupId!==void 0&&this.activeScrollGroups.add(this.currentGroupId)):t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.scrollGroupsReady.has(t.groupId);if(this.lastScrollGroup=e?t.groupId:null,r){this.scrollToTarget(t.selector,t.groupId);return}typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let r=t.x||0,s=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(r,s)){window.scrollTo(r,s);return}let o=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},i={capture:!0,passive:!0};for(let c=0,u=ut.length;c<u;c++)window.addEventListener(ut[c],o,i);this.cancelScrollWait=()=>{for(let c=0,u=ut.length;c<u;c++)window.removeEventListener(ut[c],o,i)};let l=pe(),a=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,s)||pe()-l>=$r){this.clearScrollWait(),window.scrollTo(r,s);return}requestAnimationFrame(a)};requestAnimationFrame(a)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){if(e<=0&&t<=0)return!0;let r=document.documentElement;return r?e>0&&e>(r.scrollHeight||0)-(window.innerHeight||0)+1?!1:t<=0||t<=(r.scrollWidth||0)-(window.innerWidth||0)+1:!0}scrollToHash(t){if(!t||typeof document>"u")return;let e=()=>{let a=document.getElementById(t);if(a)return a;try{return document.getElementById(decodeURIComponent(t))}catch{return null}},r=e();if(r){r.scrollIntoView(!0);return}if(typeof requestAnimationFrame>"u")return;let s=++this.scrollWaitToken,o=30,i=0,l=()=>{if(s!==this.scrollWaitToken)return;let a=e();if(a){a.scrollIntoView(!0);return}++i<o&&requestAnimationFrame(l)};requestAnimationFrame(l)}findScrollTarget(t,e){if(typeof document>"u")return null;let r=this.findScopedScrollTarget(t,e);if(r)return r;let s=document.querySelectorAll(t);for(let o=0,i=s.length;o<i;o++){let l=s[o];if(l&&l.isConnected!==!1)return l}return null}findScopedScrollTarget(t,e){if(e==null||!this.switches)return null;let r=this.switches.get(e),s=r&&r[0],o=s&&s.controller&&s.controller.container;if(!o||o.nodeType!==1)return null;let i=o;for(let l=0;l<8;l++){let a=i.parentElement;if(!a||a===document.body||a===document.documentElement)break;let c=a.querySelector(t);if(c)return c;i=a}return null}readScrollTarget(t){let e=window.getComputedStyle(t),r=e.position==="sticky",s=r&&parseFloat(e.top)||0,o=(t.offsetWidth||0)>0||(t.offsetHeight||0)>0,i;if(r){let l=t.style.position;t.style.position="static",i=t.getBoundingClientRect().top+window.scrollY,t.style.position=l}else i=t.getBoundingClientRect().top+window.scrollY;return{sized:o,targetScroll:i-s}}scrollToTarget(t,e){if(typeof t!="string"||typeof document>"u")return;let r=c=>{window.scrollY>c&&window.scrollTo(0,Math.max(0,c))};if(typeof requestAnimationFrame>"u"){let c=this.findScrollTarget(t,e);if(c){let u=this.readScrollTarget(c);u.sized&&r(u.targetScroll)}return}let s=++this.scrollWaitToken,o=30,i=0,l=null,a=()=>{if(s!==this.scrollWaitToken)return;let c=this.findScrollTarget(t,e);if(c){let u=this.readScrollTarget(c);if(u.sized){if(l!==null&&Math.abs(l-u.targetScroll)<1){r(u.targetScroll);return}l=u.targetScroll}}if(++i<o){requestAnimationFrame(a);return}l!==null&&r(l)};requestAnimationFrame(a)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),s=t.split("/");if(r.length!==s.length)return!0;let o=r[r.length-1],i=s[s.length-1];return o!==i}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&p.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent(),this.clearScrollWait(),this.pageCache.clear()}getPath(){let t=this.location,e=this.history;return e&&e.type==="hash"?t.hash.replace("#",""):t.pathname+t.search+t.hash}},P=new Lt;var me=(n,t)=>({attr:n,value:t}),Jr=(n,t)=>{if(!t.startsWith(n))return!1;let e=t[n.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},_t=class extends x{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,s=P.data,o=[];t&&typeof t=="object"&&o.push(me("href",t)),e&&typeof e=="object"&&o.push(me("text",e));let i=null,l="",a="";return o.push({value:["[[path]]",s],callBack:(c,u)=>{if(typeof u.pathname>"u")return;let h=u.getAttribute("href");if(h!==i){i=h;let y=u.pathname+u.search+u.hash;l=y,a=u.hash||u.search?y:u.pathname}let m=r?c===l:Jr(a,c);this.update(m)}}),o}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var ge=(n,t,e=null)=>{if(!n)return;let r=null,s=!1,o=()=>{s||(s=!0,r&&(clearTimeout(r),r=null),p.off("animationend",n,i),n&&n.classList.remove(t),e&&e())},i=a=>{a.target===n&&o()};p.on("animationend",n,i),n.classList.add(t);let l=()=>{if(!s)try{let a=window.getComputedStyle(n),c=parseFloat(a.animationDuration)*1e3||1e3,u=parseFloat(a.animationDelay)*1e3||0;r=setTimeout(o,c+u+100)}catch{r=setTimeout(o,1e3)}};if(typeof requestAnimationFrame>"u"){r=setTimeout(o,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(l))},ye=(n,t,e)=>{ge(n,t)},Se=(n,t,e)=>{let r=()=>{n&&n.remove&&n.remove()};Xr(n,()=>ge(n,t,r),e)};f.addType("manual-destroy",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Xr=(n,t,e)=>{f.add(n,"manual-destroy",{ele:n,callBack:t,parent:e})};var z=(n,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(s=>{s&&z(n,t,s,r)});return}Zr(n,t,e,r)},Zr=(n,t,e,r)=>{let s,o;if(e.length<3?[s,o]=e:[t,s,o]=e,!t||!s)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',n,t);return}let i=tn(n,s,o,r);I.watch(n,t,s,i)},tn=(n,t,e,r)=>typeof e=="object"?s=>{nn(n,e,s)}:s=>{rn(n,e,t,s,r)},ve=new WeakSet,en=(n,t,e)=>{!n||!n.isUnit&&!n.isComponent||ve.has(e)||ve.add(e)},rn=(n,t,e,r,s)=>{let o=t(r,n,s);switch(typeof o){case"object":if(o===null)break;en(o,e,n),d.rebuild(o,n,s);break;case"string":let i=Ht(n);if(i!=="textContent"){n.setAttribute(i,o);break}F.addHtml(n,o);break}},nn=(n,t,e)=>{let r=Object.keys(t);for(let s=0,o=r.length;s<o;s++){let i=r[s];i&&(t[i]===e?n.classList.add(i):n.classList.remove(i))}};var U=(n,t,e)=>{let r=R(e);z(n,r,t,e)};var xe=(n,t,e)=>{t&&n.setAttribute("role",t)},sn=n=>(t,e)=>{let r=t?"true":"false";e.setAttribute(n,r)},ke=(n,t,e)=>{if(!t)return;let r=t.role;r&&(n.setAttribute("role",r),t.role=null);let s=Object.keys(t);for(let o=0,i=s.length;o<i;o++){let l=s[o],a=t[l];if(a===null)continue;let c="aria-"+l;if(Array.isArray(a)){let u=a.slice();u.push(sn(c)),U(n,u,e)}else n.setAttribute(c,a)}};var we=(n,t,e)=>{if(!t)return;let r=w.parse(t,e);S.addAttributes(n,r.attr,e),d.setDirectives(n,r.directives,e)};f.addType("context",n=>{if(!n)return!1;n.parent.removeContextBranch(n.branch)});var Mt=n=>n?n.getContext():null,Ce=(n,t,e)=>{if(typeof t!="function")return;let r=Mt(e),s=t(r);we(n,s,e)},Te=(n,t,e)=>{if(typeof t!="function")return;let r=Mt(e);t(r)},Pe=(n,t,e)=>{if(typeof t!="function"||!e)return;let r=Mt(e),s=t(r);if(!s)return;let o=s[0];o&&(e.addContextBranch(o,s[1]),on(n,o,e))},on=(n,t,e)=>{f.add(n,"context",{branch:t,parent:e})};var Re=(n,t,e)=>{};var Ae=(n,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",n),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var be=(n,t,e)=>{},Ee=(n,t,e)=>{if(!t||!e)return;let r=t(e,n);r&&d.build(r,n,e)},Ie=(n,t,e)=>{if(!t||!e)return;let r=e.getId(t);n.id=r},Le=(n,t,e)=>{if(!t||!e)return;let r=t(e.data,n);r&&d.build(r,n,e)},_e=(n,t,e)=>{if(!t||!e)return;let r=t(e.state,n);r&&d.build(r,n,e)},Me=(n,t,e)=>{if(!t||!e)return;let r=e.state,s=t(r);if(!e.state){e.setStateHelper(s);return}e.addState(s)},Oe=(n,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let r=t[2];if(r){let s=r;r=o=>{s(o,e)}}e.events.on(t[0],t[1],r,t[3])};var De=(n,t,e)=>{let r,s,o;if(typeof t=="string"){if(r=R(e),!r)return;s=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let i=R(e);if(!i)return;r=i,s=t[0],o=t[1]}else[r,s,o]=t;I.bind(n,r,s,o)};var ht=(n,t,e)=>{z(n,e.state,t,e)};var Be=n=>(t,e)=>{let[r,s,o="active"]=n,i=t===s?o:"";e.dataset[r]=i},He=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Be(s)),U(n,o,e)},Ue=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Be(s)),ht(n,o,e)};var Ne=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&r.remove()}n.length=0};f.addType("forScopes",n=>{if(!n)return!1;Ne(n.scopes)});var We=(n,t,e)=>{let r,s,o,i;if(typeof t[0]=="string"||t.length<3){let u=R(e);if(!u)return;r=u,[s,o,i]=t}else[r,s,o,i]=t;let l=i!==!1,a=s+"[",c=l?{scopes:[]}:null;c&&f.add(n,"forScopes",c),I.watch(n,r,s,u=>{if(d.removeAll(n),c&&Ne(c.scopes),!u||u.length<1)return;let h=[];for(let m=0,y=u.length;m<y;m++){let N=l?r.scope(a+m+"]"):null;N&&c&&c.scopes.push(N);let W=o(u[m],m,N,h);W!==null&&h.push(W)}return d.build(h,n,e)})};var qe=(n,t,e)=>{let r=t[0];if(!r||r.length<1)return;let s=t[1],o=[];for(let i=0,l=r.length;i<l;i++){let a=r[i];if(!a)continue;let c=s(a,i);c!==null&&o.push(c)}d.build(o,n,e)};var Fe=(n,t,e)=>{t(n,e)};f.addType("destroyed",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Ge=(n,t,e)=>{ln(n,t,e)},ln=(n,t,e)=>{f.add(n,"destroyed",{ele:n,callBack:t,parent:e})};var Ke=(n,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,s=t.length;r<s;r++)_.setup(n,t[r],e);else _.setup(n,t,e)};f.addType("routes",n=>{if(!n)return!1;let t=n.route;t&&P.removeRoute(t)});var je=(n,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&ze(n,o,e)}else ze(n,t,e)},ze=(n,t,e)=>{t.container=n,t.parent=e;let r=P.add(t);an(n,r)},an=(n,t)=>{f.add(n,"routes",{route:t})};var Qe=(n,t,e)=>{};f.addType("switch",n=>{if(!n)return!1;let t=n.id;P.removeSwitch(t)});var Ye=(n,t,e)=>{let r=t[0];for(let o=0,i=t.length;o<i;o++){let l=t[o];l&&(l.container=n,l.parent=e)}let s=P.addSwitch(t);cn(n,s)},cn=(n,t)=>{f.add(n,"switch",{id:t})};G.add("cache",be).add("onCreated",Fe).add("onDestroyed",Ge).add("bind",De).add("data",Re).add("state",Qe).add("onSet",U).add("onState",ht).add("animateIn",ye).add("animateOut",Se).add("watch",Ke).add("useParent",Ee).add("useData",Le).add("useState",_e).add("getId",Ie).add("addState",Me).add("addEvent",Oe).add("map",qe).add("for",We).add("useContext",Te).add("addContext",Pe).add("context",Ce).add("role",xe).add("aria",ke).add("route",je).add("debug",Ae).add("dataSet",He).add("dataStateSet",Ue).add("switch",Ye);export{G as a,Q as b,x as c,Ft as d,Gt as e,O as f,d as g,Xt as h,_t as i,Lt as j,P as k};
|
|
2
|
+
//# sourceMappingURL=chunk-Q6JWDJYV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b as A,c,d as f,e as m,f as P,g as C,h as S}from"../chunks/chunk-
|
|
1
|
+
import{a,b as A,c,d as f,e as m,f as P,g as C,h as S}from"../chunks/chunk-Q6JWDJYV.js";import"../chunks/chunk-EBXFAKPV.js";import{f as s}from"../chunks/chunk-76NP53O5.js";import"../chunks/chunk-6N533MOU.js";import"../chunks/chunk-6EAE4I3C.js";import"../chunks/chunk-ZUB7I6Z4.js";var b=r=>{let t=typeof r;return t!=="string"&&t!=="number"?r:d(r)},d=r=>[{tag:"text",textContent:r}],l=()=>({props:{},children:[]}),h=r=>({props:{},children:d(r)}),u=r=>({props:{},children:r}),y=r=>({props:r[0]||{},children:b(r[1])});var D=r=>({props:{watch:r},children:[]}),O=r=>{if(r.length===0)return l();let t=r[0],e=typeof t;if(e==="string"||e==="number")return h(t);if(Array.isArray(t))return s.isWatching(t)?D(t):u(t);let o=r[1]??r[0]??[];if(o&&Array.isArray(o)&&s.isWatching(o)){let n=r[0]&&!Array.isArray(r[0])?r[0]:{};r[0]={...n,watch:o},r[1]=[]}return y(r)},H=r=>(...t)=>{let{props:e,children:o}=O(t);return r(e,o)};var T=(r,t)=>{let e=Object.keys(r);for(let o=0,n=e.length;o<n;o++){let p=e[o],x=r[p],i=f[p]||p;t.prototype[i]=m(x,i)}return t},W=0,j=r=>{let t=class extends r{};return t.prototype._classId="pod"+W++,t},I=(r,t=c)=>{if(!r)return null;let e=j(t),o={},n=r(o);return T(o,e),e.prototype.render=n,e};export{H as Atom,C as Builder,c as Component,a as Directives,S as Import,P as Jot,I as Pod,A as Unit};
|
|
2
2
|
//# sourceMappingURL=component.js.map
|
package/dist/modules/router.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as r,j as o,k as t}from"../chunks/chunk-
|
|
1
|
+
import{i as r,j as o,k as t}from"../chunks/chunk-Q6JWDJYV.js";import"../chunks/chunk-EBXFAKPV.js";import"../chunks/chunk-76NP53O5.js";import"../chunks/chunk-6N533MOU.js";import"../chunks/chunk-6EAE4I3C.js";import"../chunks/chunk-ZUB7I6Z4.js";export{r as NavLink,o as Router,t as router};
|
|
2
2
|
//# sourceMappingURL=router.js.map
|
|
@@ -115,6 +115,12 @@ export class ComponentHelper {
|
|
|
115
115
|
* @type {object|null} savedScroll
|
|
116
116
|
*/
|
|
117
117
|
savedScroll: object | null;
|
|
118
|
+
/**
|
|
119
|
+
* Inner scrollers without a key, saved when the page is put away.
|
|
120
|
+
*
|
|
121
|
+
* @type {Array<Array<any>>|null} savedElements
|
|
122
|
+
*/
|
|
123
|
+
savedElements: Array<Array<any>> | null;
|
|
118
124
|
/**
|
|
119
125
|
* The last params the page was focused with.
|
|
120
126
|
*
|
|
@@ -16,3 +16,5 @@
|
|
|
16
16
|
export const SCROLL_KEY_ATTR: string;
|
|
17
17
|
export function saveElementScroll(nodes: Array<object>): object | null;
|
|
18
18
|
export function restoreElementScroll(nodes: Array<object>, saved: object | null): boolean;
|
|
19
|
+
export function saveScrolledElements(nodes: Array<object>): Array<Array<any>> | null;
|
|
20
|
+
export function restoreScrolledElements(saved: Array<Array<any>> | null): void;
|