@base-framework/base 3.7.17 → 3.7.18
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
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var R=class{static toArray(t){return Array.from(t)}static inArray(t,e,s){return Array.isArray(t)?t.indexOf(e,s):-1}};var h=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 ps=Object.prototype.toString,pt=Object.prototype.hasOwnProperty,b={create(r){return Object.create(r||null)},extendObject(r,t){if(!h.isObject(r)||!h.isObject(t))return!1;for(let e in r)pt.call(r,e)&&!pt.call(t,e)&&(t[e]=r[e]);return t},clone(r){if(!r||!h.isObject(r))return{};try{return structuredClone(r)}catch{return JSON.parse(JSON.stringify(r))}},getClassObject(r){return typeof r=="function"?r.prototype:r},extendClass(r,t){let e=this.getClassObject(r),s=this.getClassObject(t);if(typeof e!="object"||typeof s!="object")return!1;let i=Object.create(e);for(var n in s)i[n]=s[n];return i},hasOwnProp(r,t){return pt.call(r,t)},isPlainObject(r){return!!r&&ps.call(r)==="[object Object]"},isEmpty(r){if(!h.isObject(r))return!0;for(let t in r)if(pt.call(r,t))return!1;return!0}};var st={types:{},add(r,t){this.types[r]=t},get(r){return this.types[r]||!1},remove(r){delete this.types[r]}};var dt=class{constructor(){this.types=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let s,i=st.get(t);if(i){for(var n=0,o=e.length;n<o;n++)s=e[n],s&&(e[n]=null,this.removeByCallBack(i,s));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}this.types.forEach((e,s)=>{s&&this.removeType(s)}),this.types.clear()}};var j=new WeakMap,m=class{static trackers=new Map;static trackingCount=0;static addType(t,e){st.add(t,e)}static removeType(t){st.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=j.get(t);return e||(e=`dt${this.trackingCount++}`,j.set(t,e)),e}static add(t,e,s){let i=this.getTrackingId(t);this.find(i).add(e,s)}static get(t,e){let s=j.get(t),i=this.trackers.get(s);return i?e?i.get(e):i:!1}static has(t,e){let s=this.getTrackingId(t);if(!s)return!1;let i=this.trackers.get(s);return i&&e?i.has(e):!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new dt),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=j.get(t);if(!s||!this.trackers.has(s))return;let i=this.trackers.get(s);if(!e){i.remove(),this.trackers.delete(s),j.delete(t);return}i.remove(e),this.isEmpty(i.types)&&(this.trackers.delete(s),j.delete(t))}};var Yt=r=>{let t=0;for(let[e,s]of Object.entries(r))t++,typeof r[e]=="object"&&(t+=Yt(r[e]));return t},ue=(r,t)=>{let e=!1;if(typeof r!="object"||typeof t!="object")return e;for(let[s,i]of Object.entries(r)){if(!b.hasOwnProp(t,s))break;let n=t[s];if(typeof i!=typeof n)break;if(typeof i=="object"){if(e=ue(i,n),e!==!0)break}else if(i===n)e=!0;else break}return e},ds=(r,t)=>{let e=Yt(r),s=Yt(t);return e!==s?!1:ue(r,t)},he=(r,t)=>{let e=typeof r;return e!==typeof t?!1:e==="object"?ds(r,t):r===t};var f={getEvents(r){return h.isObject(r)===!1?[]:m.get(r,"events")},create(r,t,e,s=!1,i=!1,n=null){return i=i===!0,{event:r,obj:t,fn:e,capture:s,swapped:i,originalFn:n}},on(r,t,e,s){return Array.isArray(r)?r.forEach(i=>this.add(i,t,e,s)):this.add(r,t,e,s),this},off(r,t,e,s){if(Array.isArray(r)){var i;r.forEach(n=>this.remove(n,t,e,s))}else this.remove(r,t,e,s);return this},add(r,t,e,s=!1,i=!1,n=null){if(h.isObject(t)===!1)return this;let o=this.create(r,t,e,s,i,n);return m.add(t,"events",o),t.addEventListener(r,e,s),this},remove(r,t,e,s=!1){let i=this.getEvent(r,t,e,s);return i===!1?this:(typeof i=="object"&&this.removeEvent(i),this)},removeEvent(r){return typeof r=="object"&&r.obj.removeEventListener(r.event,r.fn,r.capture),this},getEvent(r,t,e,s){if(typeof t!="object")return!1;let i=this.getEvents(t);if(!i||i.length<1)return!1;let n=this.create(r,t,e,s);return this.search(n,i)},search(r,t){let e,s=this.isSwappable(r.event);for(var i=0,n=t.length;i<n;i++)if(e=t[i],!(e.event!==r.event||e.obj!==r.obj)&&(e.fn===r.fn||s===!0&&e.originalFn===r.fn))return e;return!1},removeEvents(r){return h.isObject(r)===!1?this:(m.remove(r,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(r){this.swap.push(r)},isSwappable(r){return this.swap.includes(r)}};m.addType("events",r=>{f.removeEvent(r)});var Qt={events:f,addListener(r,t,e,s){return this.events.add(r,t,e,s),this},on(r,t,e,s){let i=this.events;return Array.isArray(r)?r.forEach(n=>{i.add(n,t,e,s)}):i.add(r,t,e,s),this},off(r,t,e,s){let i=this.events;return Array.isArray(r)?r.forEach(n=>{i.remove(n,t,e,s)}):i.remove(r,t,e,s),this},removeListener(r,t,e,s){return this.events.remove(r,t,e,s),this},_createEvent(r,t,e,s){let i;switch(t){case"HTMLEvents":i=new Event(r,e);break;case"MouseEvents":i=new MouseEvent(r,e);break;default:i=new CustomEvent(r,s);break}return i},createEvent(r,t,e,s){if(h.isObject(t)===!1)return!1;let i={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};h.isObject(e)&&(i=Object.assign(i,e));let n=this._getEventType(r);return this._createEvent(r,n,i,s)},_getEventType(r){let t={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},e="CustomEvent";for(let[s,i]of Object.entries(t))if(r.match(i)){e=s;break}return e},trigger(r,t,e){if(h.isObject(t)===!1)return this;let s=typeof r=="string"?this.createEvent(r,t,null,e):r;return t.dispatchEvent(s),this},mouseWheelEventType:null,getWheelEventType(){let r=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=r())},onMouseWheel(r,t,e,s=!1){typeof t>"u"&&(t=window);let i=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof r=="function"&&r(a,o),e===!0&&o.preventDefault()},n=this.getWheelEventType();return this.events.add(n,t,i,s,!0,r),this},offMouseWheel(r,t,e=!1){typeof t>"u"&&(t=window);let s=this.getWheelEventType();return this.off(s,t,r,e),this},preventDefault(r){return typeof r.preventDefault=="function"?r.preventDefault():r.returnValue=!1,this},stopPropagation(r){return typeof r.stopPropagation=="function"?r.stopPropagation():r.cancelBubble=!0,this}};var rt=class{constructor(){this.errors=[],this.dataTracker=m}augment(t){if(!h.isObject(t))return this;let e=this.constructor.prototype;for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return this}override(t,e,s,i){return(t[e]=s).apply(t,R.toArray(i))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,s){if(h.isObject(t)===!1)return"";let i=t[e];return typeof i<"u"?i:typeof s<"u"?s:""}createCallBack(t,e,s=[],i=!1){return typeof e!="function"?!1:(...n)=>(i===!0&&(s=s.concat(n)),e.apply(t,s))}bind(t,e){return e.bind(t)}};rt.prototype.extend=(function(){return rt.prototype})();var D=new rt;D.augment({...b,...Qt,...h,equals:he});var it={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 le=()=>{D.augment({xhrSettings:it,addFixedParams(r){this.xhrSettings.fixedParams=r},beforeSend(r){this.xhrSettings.beforeSend.push(r)},ajaxSettings(r){typeof r=="object"&&(this.xhrSettings=b.extendClass(D.xhrSettings,r))},resetAjaxSettings(){this.xhrSettings=it}})};var v=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,s=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let i={},n=/([^?=&]+)(=([^&]*))?/g;return t.replace(n,function(o,a,c,u){i[a]=e!==!1?decodeURIComponent(u):u}),i}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let s=/([A-Z]{1,})/g;return t.replace(s,i=>e+i.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())}};var mt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:s,url:i,async:n}=this.settings;e.open(s,i,n),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=it.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var i=0,n=t.length;i<n;i++){var o=t[i];o&&o(e,s)}}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+encodeURIComponent(t[s]));return e.join("&")}setupParams(t,e=null){let s=typeof t;if(!e)return!(t instanceof FormData)&&s==="object"&&(t=this.objectToString(t)),t;let i=typeof e;if(s==="string")return i!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(i==="string"&&(e=v.parseQueryString(e,!1)),t instanceof FormData)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.append(n,e[n]);else s==="object"&&(t=b.clone(t),t=Object.assign(e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,s=t.params;return s?s=this.setupParams(s,e):e&&(s=this.setupParams(e)),s}getXhrSettings(t){let e=this.settings={...D.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var s=0,i=t.length;s<i;s++){var n=t[s];switch(s){case 0:e.url=n;break;case 1:e.params=n;break;case 2:e.completed=n,e.failed=n;break;case 3:e.responseType=n||"json";break;case 4:e.method=n?n.toUpperCase():"POST";break;case 5:e.async=typeof n<"u"?n:!0;break}}else e=this.settings=b.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 s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.xhr?.setRequestHeader(s,e[s])}update(t,e){let s=this.xhr,i=()=>{f.removeEvents(s?.upload),f.removeEvents(s)},n=this.settings;if(!n)return!1;switch(e||t.type){case"load":if(typeof n.completed=="function"){let a=this.getResponseData();n.completed(a,this.xhr)}i();break;case"error":typeof n.failed=="function"&&n.failed(!1,this.xhr),i();break;case"progress":typeof n.progress=="function"&&n.progress(t);break;case"abort":typeof n.aborted=="function"&&n.aborted(!1,this.xhr),i();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 s=this.update.bind(this);f.on(["load","error","abort"],e,s),f.on("progress",e.upload,s)}};le();var gt=(...r)=>new mt(r).xhr;var ms=r=>typeof r!="string"?r:fe(r),fe=r=>[{tag:"text",textContent:r}],yt=()=>({props:{},children:[]}),bt=r=>({props:{},children:fe(r)}),xt=r=>({props:{},children:r}),St=r=>({props:r[0]||{},children:ms(r[1])});var vt=class{constructor(){this.connections=new Map}add(t,e,s){let i=this.getOrCreate(t),n=i.get(e);return n?Array.isArray(n)?n.push(s):i.set(e,[n,s]):i.set(e,s),s}get(t,e){let s=this.connections.get(t)?.get(e);return s?Array.isArray(s)?s[s.length-1]||!1:s:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let s=this.connections.get(t);if(s)if(e)this.unsubscribe(s.get(e)),s.delete(e),s.size===0&&this.connections.delete(t);else{for(let i of s.values())this.unsubscribe(i);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,s=t.length;e<s;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var $=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var kt=class extends ${constructor(t){super(),this.data=t}subscribe(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',t,this.data);return}this.msg=t,this.token=this.data.on(t,e)}unsubscribe(){this.data&&this.msg&&this.token&&this.data.off(this.msg,this.token),this.data=null,this.msg=null,this.token=null}};var V=class{unsubscribe(){}};var Ct=class extends V{constructor(){super(),this.source=null}addSource(t){return this.source=new kt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var z=class extends ${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 wt=class extends z{constructor(t,e,s){super(s),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 y=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?R.toArray(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:R.toArray(s):!1}static html(t,e){return h.isObject(t)===!1?!1:h.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return h.isObject(t)===!1||h.isUndefined(e)?this:(e=v.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=v.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let i=null,n=t.currentStyle;if(n&&(i=n[e]))return i;let o=window.getComputedStyle(t,null);return o?o[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return h.isObject(t)&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return h.isObject(t)===!1?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=v.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,s){e=this.removeDataPrefix(e),e=v.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=v.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return h.isObject(t)===!1?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(h.isObject(t)===!1)return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(h.isObject(t)===!1)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 h.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return h.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return h.isObject(t)?t.offsetWidth:!1}static getHeight(t){return h.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return h.isObject(t)===!1?!1:{left:e-(t.clientLeft||0),top:s-(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,s=e.documentElement,i=e.getElementsByTagName("body")[0],n=t.innerWidth||s.clientWidth||i.clientWidth,o=t.innerHeight||s.clientHeight||i.clientHeight;return{width:n,height:o}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(h.isObject(t)===!1)return s;let i=0;for(;t&&(e===0||i<e);)i++,s.x+=t.offsetLeft+t.clientLeft,s.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return s}static addClass(t,e){if(h.isObject(t)===!1||e==="")return this;if(typeof e=="string"){let n=e.split(" ");for(var s=0,i=n.length;s<i;s++)t.classList.add(e)}return this}static removeClass(t,e){return h.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return h.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return h.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var Tt=r=>{let t="textContent";if(!r||typeof r!="object")return t;let e=r.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let s=r.type;if(!s)return t="value",t;switch(s){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var gs=(r,t,e)=>{y.setAttr(r,t,e)},ys=(r,t,e)=>{r.checked=r.value==e},bs=(r,t,e)=>{e=e==1,pe(r,t,e)},pe=(r,t,e)=>{r[t]=e},xs=(r,t)=>y.getAttr(r,t),Ss=(r,t)=>r[t],At=class extends z{constructor(t,e,s,i){super(i),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=gs,this.getValue=xs,this;this.getValue=Ss;let s=t.type;if(s)switch(s){case"checkbox":this.setValue=bs;return;case"radio":this.setValue=ys;return}return this.setValue=pe,this}getAttrBind(t){return t||Tt(this.element)}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return s=>t.replace(e,s)}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 Dt=class extends V{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new At(t,e,s,this.pubSub)}addData(t,e){return this.data=new wt(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 de=-1,q=class{constructor(){this.callBacks=new Map,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=[]}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,de=-1}on(t,e){let s=(++de).toString();return this.get(t).set(s,e),s}off(t,e){let s=this.callBacks.get(t);s&&(e=String(e),s.delete(e),s.size===0&&this.callBacks.delete(t))}remove(t){this.callBacks.delete(t)}publish(t,...e){if(!this.batchingEnabled){this.publishImmediate(t,...e);return}this.updateQueue.set(t,e),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.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.updateQueue.clear(),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,s]of t)this.publishImmediate(e,...s)}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())}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}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 s=e.length;for(let i=0;i<s;i++)e[i]()}})}flushSync(){this.flush()}publishImmediate(t,...e){let s=this.callBacks.get(t);if(s){for(let i of s.values())if(i)try{i.apply(this,e)}catch(n){console.error('[DataPubSub] Subscriber error for "'+t+'":',n)}}}};var Xt=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new vt,this.pubSub=new q,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,i){let n=s,o=null,a=s.indexOf(":");a!==-1&&(o=s.substring(0,a),n=s.substring(a+1));let c=o??"",u=this.setupConnection(t,e,n,c,i),l=u.element,p=e.get(n);return typeof p<"u"?l.set(p):(p=l.get(),p!==""&&u.data.set(p)),this}setupConnection(t,e,s,i,n){let o=this.getBindId(t),a=new Dt(this.pubSub);a.addData(e,s).subscribe(o);let l=`${e.getDataId()}:${s}`;return a.addElement(t,i,n).subscribe(l),this.addConnection(o,"bind",a),a}addConnection(t,e,s){return this.connections.add(t,e,s),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){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,i){if(h.isObject(t)===!1)return this;let n=new Ct,o=e.get(s),a=!0,c=d=>{a&&(a=!1,d===o)||i(d)};n.addSource(e).subscribe(s,c);let l=this.getBindId(t),p=e.getDataId()+":"+s;return this.addConnection(l,p,n),i(o),this}unwatch(t,e,s){if(h.isObject(t)===!1)return this;let i=t[this.attr];if(i){let n=e.getDataId()+":"+s;this.connections.remove(i,n)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}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,s=this.isDataBound(e);if(s!==null){let i=this.connections.get(s,"bind");if(i){let n=i.element.get();this.pubSub.publish(s,n,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&f.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&f.off(["change","paste","input"],document,this.changeHandler,!1)}},S=new Xt;var E=r=>r.data?r.data:r.context&&r.context.data?r.context.data:r.state?r.state:null;var vs={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"},nt=r=>vs[r]||r,ot=r=>typeof r=="string"&&r.substring(0,2)==="on"?r.substring(2):r,A=class{static create(t,e,s,i){let n=document.createElement(t);return this.addAttributes(n,e),i===!0?this.prepend(s,n):this.append(s,n),n}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;typeof s<"u"&&y.setAttr(t,"type",s);for(let[i,n]of Object.entries(e))i==="innerHTML"?t.innerHTML=n:i.indexOf("-")!==-1?y.setAttr(t,i,n):this.addAttr(t,i,n)}static addHtml(t,e){return typeof e>"u"||e===""?this:(/(?:<[a-z][\s\S]*>)/i.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(s===""||!e)return;if(typeof s==="function")e=ot(e),s.originalCallback?f.add(e,t,s,!1,!0,s.originalCallback):f.add(e,t,s);else{let n=nt(e);t[n]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!h.isObject(t)||!h.isArray(e))return!1;e.forEach(i=>{let n=new Option(i.label,i.value);t.options.add(n),s!==null&&n.value==s&&(n.selected=!0)})}static removeElementData(t){m.remove(t);let e=t.childNodes;if(e&&e.length>0){let i=Array.from(e);for(let n=i.length-1;n>=0;n--)this.removeElementData(i[n])}t.bindId&&S.unbind(t)}static removeElement(t){if(!t)return this;let e=m.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(!h.isObject(t))return this;let e=Array.from(t.childNodes);for(let s=0,i=e.length;s<i;s++)this.removeElementData(e[s]);return t.innerHTML="",this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let i=s||t.firstChild;return t.insertBefore(e,i),this}static clone(t,e=!1){return h.isObject(t)?t.cloneNode(e):!1}};var C=class extends A{static create(t,e,s,i){let n=document.createElement(t);return this.addAttributes(n,e,i),s.appendChild(n),n}static addAttributes(t,e,s){if(!(!e||e.length<1))for(let i=0,n=e.length;i<n;i++){let o=e[i];this.addAttr(t,o.key,o.value,s)}}static addAttr(t,e,s,i){if(s===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s==="function"){if(e=ot(e),s.originalCallback)f.add(e,t,s,!1,!0,s.originalCallback);else{let a=s,c=function(u){a.call(this,u,i)};f.add(e,t,c,!1,!0,a)}return}if(e.substring(4,5)==="-"){y.setAttr(t,e,s);return}let o=nt(e);t[o]=s}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 Gt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,me=new Map,w={isWatching(r){return Array.isArray(r)?typeof r[0]=="string"&&this.hasParams(r[0]):this.hasParams(r)},hasParams(r){return h.isString(r)&&r.includes("[[")},_getWatcherProps(r){let t=me.get(r);if(t!==void 0)return t;let e=r.match(Gt),s=e?e.map(i=>i.slice(2,-2)):null;return me.set(r,s),s},updateAttr(r,t,e){switch(t){case"text":case"textContent":r.textContent=e;break;case"disabled":r.disabled=!e;break;case"checked":r.checked=!!e;break;case"required":r.required=!!e;break;case"src":if(r.tagName==="IMG"){r.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}r.src=e;break;default:C.addAttr(r,t,e);break}},replaceParams(r,t,e=!1){let s=0;return r.replace(Gt,function(i,n,o){let a=e?t[s]:t;s++;let c=a.get(o);return typeof c<"u"&&c!==null?c:""})},_getWatcherCallBack(r,t,e,s,i){return()=>{let n=this.replaceParams(e,t,i);this.updateAttr(r,s,n)}},getValue(r,t){let e=r.value;return Array.isArray(e)===!1?[e,E(t)]:(e.length<2&&e.push(E(t)),e)},getPropValues(r,t,e){let s=[];for(let i=0,n=t.length;i<n;i++){let a=(e?r[i]:r).get(t[i])??"";s.push(a)}return s},getCallBack(r,t,e,s,i,n){let o=r.attr||"textContent",a=r.callBack;if(typeof a=="function"){let c=n||s.match(Gt)||[],u=c.length>1;return(l,p)=>{l=u!==!0?l:this.getPropValues(e,c,i);let d=a(l,t,p);typeof d<"u"&&this.updateAttr(t,o,d)}}return this._getWatcherCallBack(t,e,s,o,i)},addDataWatcher(r,t,e){let s=this.getValue(t,e),i=s[1]??e?.data??e?.context?.data??e?.state??null;if(!i)return;let n=s[0],o=Array.isArray(i),a=this._getWatcherProps(n),c=this.getCallBack(t,r,i,n,o,a);if(o)for(let u=0,l=a.length;u<l;u++)this.addWatcher(r,i[u],a[u],c);else for(let u=0,l=a.length;u<l;u++)this.addWatcher(r,i,a[u],c)},getWatcherSettings(r,t=null){if(typeof r=="string")return{attr:t,value:r};if(Array.isArray(r)){let e=r[r.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let s=r[1]&&typeof r[1]=="object"?[r[0],r[1]]:[r[0]];return typeof e=="function"?{attr:t,value:s,callBack:e}:{attr:e||"textContent",value:s}}return r},setup(r,t,e){t&&this.addDataWatcher(r,this.getWatcherSettings(t),e)},addWatcher(r,t,e,s){S.watch(r,t,e,s)}};var ks=r=>({props:{watch:r},children:[]}),Cs=r=>{if(!r)return yt();let t=r[0],e=typeof t;if(e==="string"||e==="number")return bt(t);if(Array.isArray(t))return w.isWatching(t)===!1?xt(t):ks(t);let s=r[1]??r[0]??[];return s&&Array.isArray(s)&&w.isWatching(s)===!0&&(r[0]=Array.isArray(r[0])?{}:r[0],r[0].watch=s,r[1]=[]),St(r)},ws=r=>(...t)=>{let{props:e,children:s}=Cs(t);return r(e,s)};var ge=new WeakMap,ye=new WeakMap;function Ts(r,t,e,s){let i=ge.get(r);i||(i=new Map,ge.set(r,i));let n=i.get(e);if(n)return n;let o=new Proxy(r,xe(t,e,s));return i.set(e,o),o}function be(r,t){let e=isNaN(Number(t)),s=e?t:`[${t}]`;return r===""?s:e?`${r}.${s}`:`${r}${s}`}function xe(r,t="",e=""){return{get(s,i,n){let o=s[i];if(t===""&&i in s){if(typeof o=="function"){let c=ye.get(s);c||(c=new Map,ye.set(s,c));let u=c.get(i);if(u)return u;let l=o.bind(s);return c.set(i,l),l}return o}if(o=(s[e]||s)[i],o!==null&&typeof o=="object"){let c=be(t,i);return Ts(o,r,c,e)}return o},set(s,i,n,o){if(t===""&&i in s)return s[i]=n,!0;let a=be(t,i);return r.set(a,n),!0}}}var Et=(r,t="stage")=>new Proxy(r,xe(r,"",t));var at=class{static resume(t,e){if(!t)return null;let s,i=localStorage.getItem(t);return i===null?e&&(s=e):s=JSON.parse(i),s}static store(t,e){if(!t||!e)return!1;let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Pt=(r={})=>{let t={};if(!h.isObject(r))return t;let e=Object.keys(r);for(let s=0,i=e.length;s<i;s++){let n=e[s],o=r[n];typeof o!="function"&&(t[n]=o)}return t};var As=0,Se=new Map,H={CHANGE:"change",DELETE:"delete"},Kt=(r,t)=>{let e=Se.get(r);return e||(e={change:`${r}:change`,delete:`${r}:delete`},Se.set(r,e)),t==="change"?e.change:e.delete},M=class{constructor(t={}){this.dirty=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new q;let e=Pt(t);return this.set(e),Et(this)}setup(){this.stage={}}_init(){let t=++As;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(){}on(t,e){let s=Kt(t,H.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=Kt(t,H.CHANGE);this.eventSub.off(s,e)}_setAttr(t,e,s=this,i=!1){let n=this.stage[t];e!==n&&(this.stage[t]=e,this._publish(t,e,s,H.CHANGE))}publishLocalEvent(t,e,s,i){let n=Kt(t,i);this.eventSub.publish(n,e,s)}_publish(t,e,s,i){this.publishLocalEvent(t,e,s,i),s=s||this,S.publish(this._dataId+t,e,s)}set(...t){if(typeof t[0]!="object")return this._setAttr(...t),this;let[e,s,i]=t,n=Object.keys(e);for(let o=0;o<n.length;o++){let a=n[o],c=e[a];typeof c!="function"&&this._setAttr(a,c,s,i)}return this}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,H.DELETE)}toggle(t){if(!(typeof t>"u"))return this.set(t,!this.get(t)),this}increment(t,e=null){if(typeof t>"u")return;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s+e),this}decrement(t,e=null){if(typeof t>"u")return;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s-e),this}concat(t,e){if(typeof t>"u")return;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t){return this.key=t,this}resume(t){let e=at.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return at.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,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let i=[];return Object.entries(e).forEach(([n])=>{i.push(this.remoteLink(t,n))}),i}remoteLink(t,e,s){let i=s||e,n=t.get(e);typeof n<"u"&&this.get(e)!==n&&this.set(e,n);let o=t.on(e,(c,u)=>{if(u===this)return!1;this.set(i,c,t)});this.addLink(o,t);let a=this.on(i,(c,u)=>{if(u===t)return!1;t.set(e,c,this)});return t.addLink(a,this),o}addLink(t,e){this.links.set(t,e)}unlink(t){if(t){this.removeLink(t);return}let e=this.links;b.isEmpty(e)||(e.forEach((s,i)=>{this.removeLink(i,!1)}),this.links=new Map)}removeLink(t,e=!0){let s=this.links.get(t);s&&s.off(t),e!==!1&&this.links.delete(t)}};M.prototype.isData=!0;var Zt=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t}get(t){return this.cache.get(t)}set(t,e){if(this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.maxSize){let s=this.cache.keys().next().value;this.cache.delete(s)}}clear(){this.cache.clear()}},P={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new Zt(1e3),hasDeepData(r){return r.indexOf(".")!==-1||r.indexOf("[")!==-1},getSegments(r){let t=this.segmentCache.get(r);if(t!==void 0)return t;let e=this.deepDataPattern;return t=r.match(e),this.segmentCache.set(r,t),t}};var L=class{static set(t,e,s){if(!P.hasDeepData(e)){t[e]=s;return}let i,n=P.getSegments(e);if(!n)return;let o=n.length,a=o-1;for(let c=0;c<o;c++){let u=n[c];if(c===a){t[u]=s;break}t[u]===void 0&&(t[u]=isNaN(u)?{}:[]),t=t[u]}}static delete(t,e){if(!P.hasDeepData(e)){delete t[e];return}let s=P.getSegments(e);if(!s)return;let i=s.length,n=i-1;for(let o=0;o<i;o++){let a=s[o],c=t[a];if(c===void 0)break;if(o===n){if(Array.isArray(t)){t.splice(Number(a),1);break}delete t[a];break}t=c}}static get(t,e){if(!P.hasDeepData(e))return t[e]??void 0;let s=P.getSegments(e);if(!s)return;let i=s.length,n=i-1;for(let o=0;o<i;o++){let a=s[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===n)return t}}};var ve=new Set,ct=class{static MAX_DEPTH=50;static publishDeep(t,e,s,i){if(!P.hasDeepData(e)){this.publish(e,s,i);return}let n,o=P.getSegments(e);if(!o)return;let a=o.length,c=a-1,u="";for(let l=0;l<a;l++){let p=o[l];t=t[p],l>0?isNaN(p)&&(u+="."+p):u=p;let d;if(l===c)d=s;else{let x=o[l+1];if(isNaN(x)===!1){u+="["+x+"]";continue}let T={};T[x]=t[x],d=T}this.publish(u,d,i)}}static publish(t,e,s,i=null,n=0){if(t=t||"",s(t,e),!(!e||typeof e!="object"||(i===null&&(ve.clear(),i=ve),!i))){if(i.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(n>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}i.add(e),Array.isArray(e)?this.publishArray(t,e,s,i,n):this.publishObject(t,e,s,i,n)}}static publishArray(t,e,s,i,n){let o=e.length;for(let a=0;a<o;a++){let c=e[a],u=t+"["+a+"]";this._checkPublish(u,c,s,i,n)}}static publishObject(t,e,s,i,n){let o=Object.keys(e);for(let a=0,c=o.length;a<c;a++){let u=o[a],l=e[u],p=t+"."+u;this._checkPublish(p,l,s,i,n)}}static _checkPublish(t,e,s,i,n){if(!e||typeof e!="object"){s(t,e);return}this.publish(t,e,s,i,n+1)}};var B=class extends M{setup(){this.attributes={},this.stage={}}_setAttr(t,e,s,i){typeof e!="object"&&e===this.get(t)||(!s&&i!==!0?L.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),L.set(this.stage,t,e),s=s||this,this._publish(t,e,s,H.CHANGE))}linkAttr(t,e){let s=t.get(e);if(!s)return;let i=Object.keys(s);for(let n=0,o=i.length;n<o;n++){let a=i[n];this.link(t,e+"."+a,a)}}scope(t,e){let s=this.get(t);if(!s)return!1;e=e||this.constructor;let i=new e(s);return i.linkAttr(this,t),i}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.push(e),this.set(t,s),this}concat(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s=s.concat(e),this.set(t,s),this}unshift(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.unshift(e),this.set(t,s),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.shift();return this.set(t,e),s}getIndex(t,e,s){let i=this.get(t);return Array.isArray(i)===!1?-1:typeof i[0]!="object"?i.indexOf(e):i.findIndex(o=>o[e]===s)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.pop();return this.set(t,e),s}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,s,i){let n=(o,a)=>this._publishAttr(o,a,s,i);ct.publish(t,e,n)}_publishAttr(t,e,s,i){let n=this._dataId+t;S.publish(n,e,s),this.publishLocalEvent(t,e,s,i)}mergeStage(){this.attributes=b.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,s=this){L.delete(t,e);let i=(n,o)=>this.publishLocalEvent(n,o,s,H.DELETE);ct.publish(e,e,i)}_getAttr(t,e){return L.get(t,e)}};var Ds={"\n":"\\n","\r":"\\n"," ":"\\t"},Es=(r,t)=>{typeof r!="string"&&(r=String(r));let e=t?/[\n\r\t]/g:/\t/g;return r.replace(e,s=>Ds[s])},ke=(r,t)=>{if(typeof r!="string")return r;r=Es(r,t),r=encodeURIComponent(r);let e=/%22/g;return r.replace(e,'"')},te=(r,t)=>{let e=typeof r;return e==="undefined"?r:e!=="object"?(r=ke(r),r):(Object.entries(r).forEach(([s,i])=>{i!==null&&(r[s]=typeof i=="string"?te(i,t):ke(i,t))}),r)};function Ce(r){return typeof r<"u"&&r.length>0?JSON.parse(r):!1}function ee(r){return typeof r<"u"?JSON.stringify(r):null}var ut=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?b.clone(t):t,i=te(s,e);return ee(i)}static json={encode:ee,decode:Ce};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Ot=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=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 s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=v.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=v.parseQueryString(e,!1)),this._isFormData(t))for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),i="id="+s,n=s?`/${s}`:"",o=this.model;return this._get(n,i,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+"="+ut.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._put(n,s,t,e)}add(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._post(n,s,t,e)}update(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._patch(n,s,t,e)}delete(t,e){let s=this.model.get("id"),i=typeof s<"u"?"id="+s:this.setupObjectData(),n=s!=null?`/${s}`:"";return this._delete(n,i,t,e)}all(t,e,s,i,n=null,o=null){let a=this.model.get();s=isNaN(s)?0:s,i=isNaN(i)?50:i;let c=a.search||"",u=a.filter||"";typeof u=="object"&&(u=JSON.stringify(u));let l=a.dates||"";typeof l=="object"&&(l=JSON.stringify(l));let p=a.orderBy||"";typeof p=="object"&&(p=JSON.stringify(p));let d=a.groupBy||"";Array.isArray(d)&&(d=JSON.stringify(d));let x="&filter="+u+"&offset="+s+"&limit="+i+"&dates="+l+"&orderBy="+p+"&groupBy="+d+"&search="+c+"&lastCursor="+(typeof n<"u"&&n!==null?n:"")+"&since="+(typeof o<"u"&&o!==null?o:"");return this._get("",x,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let s=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(s)}setupRequest(t,e,s,i,n){let o={url:this.getUrl(t),method:e,params:s,completed:(c,u)=>{typeof n=="function"&&n(c),this.getResponse(c,i,u)}};return this._isFormData(s)&&(o.headers={}),gt(o)}setupEventSource(t,e,s,i,n=!0){let o=null,a=null,c=!1,u=!1,l=()=>{a&&(clearTimeout(a),a=null)},p=()=>{if(c||!n||u)return;l(),a=setTimeout(()=>{a=null,d()},3e3)},d=()=>{if(c||u)return;if(o){try{o.close()}catch{}o=null}u=!0;let x=this.getUrl(t),T=e?"?"+e:"";o=new EventSource(x+T,{withCredentials:!0}),o.onopen=()=>{u=!1,l(),i&&i()},o.onerror=()=>{u=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,p())},o.onmessage=et=>{try{let ft=JSON.parse(et.data);s&&s(ft)}catch{}}};return d(),{get source(){return o},close:()=>{if(c=!0,u=!1,l(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return w.isWatching(t)&&(t=w.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,s,i){return this._request("","POST",t,e,s,i)}_get(t,e,s,i,n){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",i,n)}_post(t,e,s,i,n){return this._request(t,"POST",e,s,i,n)}_put(t,e,s,i,n){return this._request(t,"PUT",e,s,i,n)}_patch(t,e,s,i,n){return this._request(t,"PATCH",e,s,i,n)}_delete(t,e,s,i,n){return this._request(t,"DELETE",e,s,i,n)}_request(t,e,s,i,n,o){return s=this.setupParams(s),s=this.addParams(s,i),this.setupRequest(t,e,s,n,o)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return!1;let e=this;class s extends e{constructor(n){super(n)}}return Object.assign(s.prototype,t),s}};var Ps=r=>{let t={};if(!h.isObject(r)||!r.defaults)return t;let{defaults:e}=r;return Object.keys(e).forEach(s=>{let i=e[s];typeof i!="function"&&(t[s]=i)}),delete r.defaults,t},Os=r=>{if(!r||typeof r.xhr!="object")return{};let t={...r.xhr};return delete r.xhr,t},Ms=0,J=class extends B{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,s=Os(t),i=e.prototype.service.extend(s),n=Ps(t);class o extends e{constructor(c){let u={...n,...Pt(c)};super(u),this.xhr=new i(this)}dataTypeId=`bm${Ms++}`}return Object.assign(o.prototype,t),o.prototype.service=i,o}};J.prototype.service=Ot;var _=class extends M{};var Y=class extends _{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 s=this.stage;return typeof s[t]<"u"&&delete s[t],this}};var Mt=class extends Y{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var I=class{static targets=new Map;static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new Mt(t)),this.targets.get(t)}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let i=this.getTarget(t);return e&&i.addAction(e,s),i}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){s&&this.off(t,e,s)}static on(t,e,s){let i=this.getTarget(t);return e?i.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let i=this.targets,n=i.get(t);if(n){if(e){n.off(e,s);return}this.targets.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};var Bt=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(s=>{this.on(...s)})}on(t,e,s,i){f.on(t,e,s,i),this.events.push({event:t,obj:e,callBack:s,capture:i})}off(t,e,s,i){f.off(t,e,s,i);let n,o=this.events;for(var a=0,c=o.length;a<c;a++)if(n=o[a],n.event===t&&n.obj===e){o.splice(a,1);break}}set(){this.events.forEach(t=>{f.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{f.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset(),this.events=[]}};var It=class{constructor(t,e){this.remoteStates=[];let s=this.convertStates(e);this.addStatesToTarget(t,s)}addStates(t,e){let s=this.convertStates(e);this.addStatesToTarget(t,s)}createState(t,e,s,i){return{action:t,state:e,callBack:s,targetId:i,token:null}}convertStates(t){let e=[];for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;if(s==="remotes"){this.setupRemoteStates(t[s],e);continue}let i=null,n=null,o=t[s];o&&typeof o=="object"&&(n=o.callBack,i=o.id||o.targetId,o=o.state),e.push(this.createState(s,o,n,i))}return e}setupRemoteStates(t,e){for(let s=0,i=t.length;s<i;s++){let n=t[s];if(n)for(let o in n){if(!Object.prototype.hasOwnProperty.call(n,o)||o==="id")continue;let a=null,c=n[o],u=c!==null?c:void 0;u&&typeof u=="object"&&(a=u.callBack,u=u.state),e.push(this.createState(o,u,a,n.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeActions(t,e){if(!(e.length<1))for(let s=0,i=e.length;s<i;s++){let n=e[s];n.token&&this.unbindRemoteState(t,n.token),n.targetId&&I.remove(n.targetId,n.action,n.token)}}restore(t){I.restore(t.id,t);let e=this.remoteStates;if(e)for(let s=0,i=e.length;s<i;s++){let n=e[s];n.token=this.bindRemoteState(t,n.action,n.targetId)}}bindRemoteState(t,e,s){let i=I.getTarget(s);return t.link(i,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let s=this.remoteStates;for(let i=0,n=e.length;i<n;i++){let o=e[i],a=this.addAction(t,o);o.targetId&&(o.token=a,s.push(o))}}addAction(t,e){let s,i=e.action,n=e.targetId;n&&(s=this.bindRemoteState(t,i,n)),typeof e.state<"u"&&t.addAction(i,e.state);let o=e.callBack;return typeof o=="function"&&t.on(i,o),s||null}};var we=r=>{if(!r)return yt();let t=r[0],e=typeof t;return e==="string"||e==="number"?bt(t):Array.isArray(t)?xt(t):St(r)};m.addType("components",r=>{if(!r)return;let t=r.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Bs=0,ht=class{constructor(...t){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.cached=[],this.init();let{props:e,children:s}=we(t);this.setupProps(e),this.children=s||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Bs++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=this.persistedCount++,s="pc"+e,n=Object.keys(this.persistedChildren)[e],o=this.persistedChildren[n];return o&&t.unitType===o.unitType&&(s=n,t.resumeScope(o)),t.persistToken=s,this.persistedChildren[s]=t,s}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){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 s=e[0];s&&(this.addingContext=!0,this.contextBranchName=s,this.addContextBranch(s,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(){m.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let s=[];if(!t||t.length<1)return s;for(var i=0,n=t.length;i<n;i++){let o=e(t[i],i);s.push(o)}return s}removeAll(t){return A.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),String(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(),this.removeContext();let t=this.panel;t&&A.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null,this.cached.forEach(t=>{this[t]=null}),this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy(),this.data&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var k=class extends ht{constructor(...t){super(...t),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){this.data=t.data,this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,this.id=t.id}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=I.getTarget(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper.restore(t);return}let e=this.setupStates();b.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new It(this.state,t))}addState(t){!this.stateHelper||this.stateResumed==!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;t&&(this.stateHelper.removeRemoteStates(t),t.remove(),this.stateResumed=!1)}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Bt)}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,this.beforeDestroy(),this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&this.data.unlink()}};var Rt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var Is=(r,t)=>typeof r!="function"&&t==="setupStates"?()=>r:r,se=(r,t)=>(r&&Object.entries(r).forEach(([e,s])=>{let i=Rt[e]||e;t[i]=Is(s,i)}),t),Rs=r=>se(r,{}),Ns=0,Te=(r,t)=>{class e extends r{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Ns++,e},U=(r,t=k)=>{r||(r={});let e,s=typeof r;return s==="object"&&r.render?(e=Rs(r),Te(t,e)):(e={render:s==="function"?r:()=>r},Te(t,e))};var Hs=(r,t)=>(Object.entries(r).forEach(([e,s])=>{let i=Rt[e]||e;t.prototype[i]=s}),t),Ls=0,_s=r=>{let t=class extends r{};return t.prototype._classId="pod"+Ls++,t},Us=(r,t=k)=>{if(!r)return null;let e=_s(t),s={},i=r(s);return Hs(s,e),e.prototype.render=i,e};var Ws={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(r=new Date().getDay(),t=!1){let e=this.dayNames;if(r>e.length)return null;let s=e[r];return t?s.substring(0,3):s},convertJsMonth(r){return this.padNumber(r+1)},convertDate(r,t=!1){r=r?r.replace(/\s/,"T"):"";let e=new Date(r),s=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+s},padNumber(r){return r<=9?"0"+r:String(r)},createDate(r){return r?(typeof r=="string"&&r.indexOf("-")>-1&&(r=r.replace(/\s/,"T"),r=r.indexOf(":")>-1?r:r+"T00:00:00"),new Date(r)):new Date},format(r,t){let e=this.createDate(t);return this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),r)},formatTime(r,t){let e=this.createDate(r),s=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),s)},getMeridian(r){return r=Number(r),r>=12?"PM":"AM"},convert24To12(r){return r=Number(r),r>12&&(r=r-12),r},convert12To24(r,t){return r=Number(r),t.toLowerCase()==="pm"&&(r=r+12),r},renderDate(r,t,e,s="sql"){return t=Number(t),e=Number(e),s==="sql"?`${r}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${r}`},renderTime(r,t,e=0,s="sql"){if(s==="sql")return`${this.padNumber(r)}:${this.padNumber(t)}:${this.padNumber(e)}`;let i=this.getMeridian(r);return r=this.convert24To12(r),`${r}:${this.padNumber(t)} ${i}`},leapYear(r){return r%400===0||r%100!==0&&r%4===0},getMonthName(r=new Date().getMonth(),t=!1){let e=this.monthNames;if(r>e.length)return"";let s=e[r];return s?t?s.substring(0,3):s:""},getMonthLength(r,t){let e=new Date;return r=typeof r<"u"?r:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[r]},getMonthsLength(r=new Date().getFullYear()){return this.leapYear(r)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(r,t="America/Denver"){let e=new Date(r);if(Number.isNaN(e.getMonth())===!0){let n=/[- :]/,o=r.split(n);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let s=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),i=e.getTime()-s.getTime();return new Date(e.getTime()+i)},getLocalTime(r,t=!1,e=!1,s="America/Denver"){if(!r)return"";let i=this.getLocalDate(r,s),n=i.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(i.getFullYear(),n,i.getDate(),o)+" "),a+this.renderTime(i.getHours(),i.getMinutes(),i.getSeconds(),o)},getDiffFromNow(r,t=!1){r=r.replace(/\s/,"T");let e=new Date(r),s=new Date;return t===!0&&s.setHours(0,0,0,0),s.getTime()-e.getTime()},getAge(r){let t=this.getDiffFromNow(r),e,s;switch(!0){case t<864e5:e="1 day";break;case t<6048e5:s=this.toDays(t),e=s+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:s=this.toDays(t);var i=Math.floor(s/7);e=i+" weeks";break;case t<5184e6:e="1 month";break;case t<31104e6:var n=this.toMonths(t);e=n+" months";break;default:var o=this.toYears(t);e=o}return String(e)},getTimeFrame(r){let t=this.getDiffFromNow(r);return this.convertToEstimate(t)},convertToEstimate(r){let t="",e,s,i,n,o,a,c;if(r<=0)switch(!0){case r<-63072e6:i=this.toYears(Math.abs(r)),t="in "+i+" years";break;case r<-31536e6:t="in a year";break;case r<-5184e6:n=this.toMonths(Math.abs(r)),t="in "+n+" months";break;case r<-2592e6:t="in a month";break;case r<-12096e5:e=this.toDays(Math.abs(r)),s=Math.floor(e/7),t="in "+s+" weeks";break;case r<-6048e5:t="in a week";break;case r<-1728e5:e=this.toDays(Math.abs(r)),t="in "+e+" days";break;case r<-864e5:t="tomorrow";break;case r<-72e5:o=this.toHours(Math.abs(r)),t="in "+o+" hours";break;case r<=-36e5:t="in an hour";break;case r<-12e4:a=this.toMinutes(Math.abs(r)),t="in "+a+" minutes";break;case r<-6e4:t="in a minute";break;case r<-2e3:c=this.toSeconds(Math.abs(r)),t="in "+c+" seconds";break;case r<-1:t="in 1 second";break;default:t="now"}else switch(!0){case r<1e3:t="1 second ago";break;case r<6e4:c=this.toSeconds(r),t=c+" seconds ago";break;case r<12e4:t="1 minute ago";break;case r<36e5:a=this.toMinutes(r),t=a+" minutes ago";break;case r<72e5:t="1 hour ago";break;case r<864e5:o=this.toHours(r),t=o+" hours ago";break;case r<1728e5:t="yesterday";break;case r<6048e5:e=this.toDays(r),t=e+" days ago";break;case r<12096e5:t="a week ago";break;case r<2592e6:e=this.toDays(r),s=Math.floor(e/7),t=s+" weeks ago";break;case r<5184e6:t="a month ago";break;case r<31536e6:n=this.toMonths(r),t=n+" months ago";break;case r<63072e6:t="a year ago";break;default:i=this.toYears(r),t=i+" years ago"}return t},toYears(r){return typeof r!="number"?0:Math.floor(r/31558464e3)},toMonths(r){return typeof r=="number"?Math.floor(r/2592e6):0},toDays(r){return typeof r!="number"?0:Math.floor(r/864e5*1)},toHours(r){return typeof r!="number"?0:Math.floor(r%864e5/36e5*1)},toMinutes(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5/6e4*1)},toSeconds(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5%6e4/1e3*1)},getDifference(r,t){let e=new Date(r),s=new Date(t),i=s.getTime()-e.getTime();return{years:this.toYears(i),days:this.toDays(i),hours:this.toHours(i),minutes:this.toMinutes(i),seconds:this.toSeconds(i)}}};var Ae=(r,t)=>({name:r,callBack:t});var Q={keys:[],items:{},add(r,t){return this.keys.push(r),this.items[r]=Ae(r,t),this},get(r){return this.items[r]||null},all(){return this.keys}};var re=(r,t)=>({attr:r,directive:t});var W=(r,t)=>({key:r,value:t});var De=(r,t,e,s)=>({tag:r,attr:t,directives:e,children:s});var N=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,s,i){return t==="text"?(i.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(s.push(W("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,s){t.push(re(W(e,w.getWatcherSettings(s,nt(e))),Q.get("watch")))}static setButtonType(t,e,s){if(t==="button"){let i=e.type||"button";s.push(W("type",i))}}static parse(t,e){let s=[],i=[],n=this.getTag(t);this.setButtonType(n,t,s),this.setupChildren(t);let o=[],a,c,u=Object.keys(t);for(let l=0,p=u.length;l<p;l++){let d=u[l];if(d==="tag"||(a=t[d],a==null))continue;if(d==="children"){if(Array.isArray(a))for(let T=0;T<a.length;T++)o.push(a[T]);else o.push(a);continue}if((c=Q.get(d))!==null){i.push(re(W(d,a),c));continue}let x=typeof a;if(x==="object"){if(w.isWatching(a)){this.setTextAsWatcher(i,d,a);continue}o.push(a);continue}if(x==="function"){let T=a,et=function(ft){T.call(this,ft,e)};et.originalCallback=T,s.push(W(d,et));continue}if(w.isWatching(a)){this.setTextAsWatcher(i,d,a);continue}this.setElementContent(d,a,s,o)||s.push(W(d,a))}return De(n,s,i,o)}};var X=class{build(t,e,s){}setupComponent(t,e,s){let i=s?.getChildScope();t.parent=i,i&&i.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&i&&(i[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),s=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),s}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t),t}setDirectives(t,e,s){}removeNode(t){}removeAll(t){}};var Nt=class extends X{build(t,e,s){let i=C.createDocFragment();if(Array.isArray(t))for(let n=0,o=t.length;n<o;n++)this.buildElement(t[n],i,s);else this.buildElement(t,i,s);return e&&typeof e=="object"&&e.appendChild(i),i}buildElement(t,e,s){if(t){if(t.isUnit===!0){this.createComponent(t,e,s);return}this.createElement(t,e,s)}}createElement(t,e,s){let i=s?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,i);return}let n=N.parse(t,i),o=this.createNode(n,e,i);this.cache(o,t.cache,s);let a=n.children;for(let u=0,l=a.length;u<l;u++){let p=a[u];p!==null&&this.buildElement(p,o,s)}let c=n.directives;c&&c.length&&this.setDirectives(o,c,i)}createTempComponent(t,e,s){let i={cache:t.cache,setData:()=>t.data,...se(t.methods||{},{}),render(){return{...t,data:null,state:null}}};t.state&&(i.setupStateTarget=function(o){this.state=t.state});let n=new k(i);this.createComponent(n,e,s)}setDirectives(t,e,s){for(let i=0,n=e.length;i<n;i++)this.handleDirective(t,e[i],s)}handleDirective(t,e,s){e.directive.callBack(t,e.attr.value,s)}cache(t,e,s){s&&e&&s.cacheEle(t,e)}createNode(t,e,s){let i=t.tag;if(i==="text"){let n=t.attr[0],o=n?n.value:"";return C.createText(o,e)}else if(i==="comment"){let n=t.attr[0],o=n?n.value:"";return C.createComment(o,e)}return C.create(i,t.attr,e,s)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var Fs=["area","base","br","col","embed","hr","img","input","link","meta","source"],G=class{static create(t,e=[],s=""){let i=this.getInnerContent(e);i+=this.getInnerHtml(e);let n=this.createAttributes(e);return Fs.includes(t)?`<${t} ${n} />`:`<${t} ${n}>`+i+s+`</${t}>`}static getInnerContent(t){let e="";return t.forEach(({key:s,value:i},n)=>{if(s!=="text"&&s!=="textContent")return"";t.splice(n,1),e+=i}),e}static getInnerHtml(t){let e="";return t.forEach(({key:s,value:i},n)=>{if(s!=="html"&&s!=="innerHTML")return"";t.splice(n,1),e+=i}),e}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:s,value:i}=e;return typeof i=="function"&&(s="on"+ot(s)),`${s}="${i}"`}).join(" ")}static createText(t){return t}static createComment(t){return`<!-- ${t} -->`}};var Ht=class extends X{build(t,e,s){return(Array.isArray(t)?t:[t]).map(n=>this.buildElement(n,s)).join("")}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let s=N.parse(t,e),i=s.children.map(n=>n!==null?this.buildElement(n,e):"").join("");return this.createNode(s,i)}createNode(t,e){let s=t.tag;if(s==="text"){let i=t.attr[0],n=i?i.value:"";return G.createText(n)}else if(s==="comment"){let i=t.attr[0],n=i?i.value:"";return G.createComment(n)}return G.create(s,t.attr,e)}removeAll(t){}};var Lt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Nt:new Ht}};var F=Lt.setup(),js=r=>typeof r=="object"&&r.isUnit===!0,$s=r=>{let t=U(r);return t?new t:null},g=class{static render(t,e,s){return!t||(js(t)||(t=$s(t)),!t)?null:F.createComponent(t,e,s)}static build(t,e,s){return F.build(t,e,s)}static rebuild(t,e,s){return F.removeAll(e),this.build(t,e,s)}static setDirectives(t,e,s){F.setDirectives(t,e,s)}static createNode(t,e,s){return F.createNode(t,e,s)}static removeNode(t){F.removeNode(t)}static removeAll(t){F.removeAll(t)}};D.augment({buildLayout(r,t,e){g.build(r,t,e)}});var ie=[],Vs=r=>ie.indexOf(r)!==-1,zs=r=>({tag:"script",src:r.src,async:!1,load(t){ie.push(r.src);let e=r.load;e&&e()}}),qs=r=>({tag:"link",rel:"stylesheet",type:"text/css",href:r.src,load(t){ie.push(r.src);let e=r.load;e&&e()}}),_t=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,s=this.update.bind(this);t.indexOf(".css")!==-1?e=qs({load:s,src:t}):e=zs({load:s,src:t}),g.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Vs(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 Js=r=>r?typeof r?.prototype?.constructor=="function":!1,K=class{static process(t,e){let s=t.default;return s?e.callback?e.callback(s):(Js(s)?s=new s:s=s(),s.isUnit===!0&&(s.route=e.route,e.persist&&(s.persist=!0)),s):null}static render(t,e,s){let i=g.build(t,null,s),n=i.firstChild||t?.panel;return e.after(i),n}};var Ut=class{static load(t,e,s){return t.then(i=>(e&&e(i),i)).catch(i=>{console.error("Error loading module:",i),s&&s(i)})}};var Ys=r=>({tag:"comment",textContent:"import placeholder",onCreated:r.onCreated}),Wt=new Map,Qs=r=>{if(Wt.has(r)){let s=Wt.get(r);return s&&typeof s.then!="function"?Promise.resolve(s):s}let t=typeof r,e;if(t==="string")e=import(r);else if(t==="function")e=r();else return r;return e.then(s=>{Wt.set(r,s)}),Wt.set(r,e),e},Ee=U({declareProps(){this.loaded=!1,this.generation=0},render(){return Ys({onCreated:r=>{if(this.src){if(this.layout){this.layoutRoot=K.render(this.layout,this.panel,this.parent);return}if(this.depends){new _t(()=>{this.loadAndRender(r)}).addFiles(this.depends);return}this.loadAndRender(r)}}})},loadAndRender(r){let t=this.generation;Ut.load(Qs(this.src),e=>{if(t!==this.generation)return;this.loaded=!0;let s=this.layout||K.process(e,{callback:this.callback,route:this.route,persist:this.persist});this.layout=s,this.layoutRoot=K.render(s,r,this.parent)},e=>{t===this.generation&&(this.loaded=!1)})},shouldUpdate(r){return this.updateLayout===!0?!0:this.updateLayout=r&&r.isUnit&&typeof r.update=="function"},updateModuleLayout(r){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(r)},update(r){this.loaded===!0&&this.updateModuleLayout(r)},destroy(){this.generation++,this.layoutRoot&&(g.removeNode(this.layoutRoot),this.persist!==!0&&(this.layoutRoot=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var ne=r=>{let t=typeof r;return(t==="string"||t==="function"||r instanceof Promise)&&(r={src:r}),new Ee(r)};var Pe=(r,t,e=null)=>{if(!r)return;let s=null,i=!1,n=()=>{i||(i=!0,s&&(clearTimeout(s),s=null),f.off("animationend",r,o),r&&y.removeClass(r,t),e&&e())},o=a=>{a.target===r&&n()};f.on("animationend",r,o),requestAnimationFrame(()=>{if(!r){n();return}y.addClass(r,t);try{let a=window.getComputedStyle(r),c=parseFloat(a.animationDuration)*1e3||1e3,u=parseFloat(a.animationDelay)*1e3||0;s=setTimeout(n,c+u+100)}catch{s=setTimeout(n,1e3)}})},Oe=(r,t,e)=>{Pe(r,t)},Me=(r,t,e)=>{let s=()=>{r&&r.remove&&r.remove()};Xs(r,()=>Pe(r,t,s),e)};m.addType("manual-destroy",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Xs=(r,t,e)=>{m.add(r,"manual-destroy",{ele:r,callBack:t,parent:e})};var lt=(r,t,e,s)=>{if(Array.isArray(e[0])){e.forEach(i=>{i&<(r,t,i,s)});return}Gs(r,t,e,s)},Gs=(r,t,e,s)=>{let i,n;if(e.length<3?[i,n]=e:[t,i,n]=e,!t||!i)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.',r,t);return}let o=Ks(r,i,n,s);S.watch(r,t,i,o)},Ks=(r,t,e,s)=>typeof e=="object"?i=>{er(r,e,i)}:i=>{Zs(r,e,t,i,s)},Zs=(r,t,e,s,i)=>{let n=t(s,r,i);switch(typeof n){case"object":tr(n,r,i);break;case"string":let o=Tt(r);if(o!=="textContent"){y.setAttr(r,o,n);break}A.addHtml(r,n);break}},tr=(r,t,e)=>{g.rebuild(r,t,e)},er=(r,t,e)=>{for(let[s,i]of Object.entries(t))s&&(i===e?y.addClass(r,s):y.removeClass(r,s))};var Z=(r,t,e)=>{let s=E(e);lt(r,s,t,e)};var Be=(r,t,e)=>{t&&t&&y.setAttr(r,"role",t)},sr=r=>(t,e)=>{let s=t?"true":"false";y.setAttr(e,r,s)},Ie=(r,t,e)=>{if(!t)return;let s=t.role;s&&(y.setAttr(r,"role",s),t.role=null),Object.entries(t).forEach(([i,n])=>{if(n===null)return;let o=`aria-${i}`;if(Array.isArray(n)){let a=[...n];a.push(sr(o)),Z(r,a,e)}else y.setAttr(r,o,n)})};var Re=(r,t,e)=>{if(!t)return;let s=N.parse(t,e);C.addAttributes(r,s.attr,e),g.setDirectives(r,s.directives,e)};m.addType("context",r=>{if(!r)return!1;r.parent.removeContextBranch(r.branch)});var oe=r=>r?r.getContext():null,Ne=(r,t,e)=>{if(typeof t!="function")return;let s=oe(e),i=t(s);Re(r,i,e)},He=(r,t,e)=>{if(typeof t!="function")return;let s=oe(e);t(s)},Le=(r,t,e)=>{if(typeof t!="function"||!e)return;let s=oe(e),i=t(s);i&&e.addContextBranch(i[0],i[1])};var _e=(r,t,e)=>{};var Ue=(r,t,e)=>{if(!e)return;let s=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",r),console.log("Data: ",t),console.log("Layout: ",s),console.log("parent: ",e)};var We=(r,t,e)=>{},Fe=(r,t,e)=>{if(!t||!e)return;let s=t(e,r);s&&g.build(s,r,e)},je=(r,t,e)=>{if(!t||!e)return;let s=e.getId(t);r.id=s},$e=(r,t,e)=>{if(!t||!e)return;let s=t(e.data,r);s&&g.build(s,r,e)},Ve=(r,t,e)=>{if(!t||!e)return;let s=t(e.state,r);s&&g.build(s,r,e)},ze=(r,t,e)=>{if(!t||!e)return;let s=e.state,i=t(s);if(!e.state){e.setStateHelper(i);return}e.addState(i)},qe=(r,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let s=t[2];t[2]=i=>{s(i,e)}}e.events.on(...t)}};var Je=(r,t,e)=>{let s,i,n;if(typeof t=="string"){if(s=E(e),!s)return;i=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=E(e);if(!o)return;t.unshift(o)}[s,i,n]=t}S.bind(r,s,i,n)};var Ft=(r,t,e)=>{lt(r,e.state,t,e)};var Ye=r=>(t,e)=>{let[s,i,n="active"]=r,o=t===i?n:"";y.setData(e,s,o)},Qe=(r,t,e)=>{if(!t)return;let s=[...t],i=s.pop();s.push(Ye(i)),Z(r,s,e)},Xe=(r,t,e)=>{if(!t)return;let s=[...t],i=s.pop();s.push(Ye(i)),Ft(r,s,e)};var Ge=(r,t,e)=>{let s,i,n,o;if(t.length<3){let c=E(e);if(!c)return;s=c,[i,n,o]=t}else[s,i,n,o]=t;let a=o!==!1;S.watch(r,s,i,c=>{if(g.removeAll(r),!c||c.length<1)return;let u=[];for(let l=0,p=c.length;l<p;l++){let d=a?s.scope(`${i}[${l}]`):null,x=n(c[l],l,d,u);x!==null&&u.push(x)}return g.build(u,r,e)})};var Ke=(r,t,e)=>{let s=t[0];if(!s||s.length<1)return;let i=t[1],n=[];for(let o=0,a=s.length;o<a;o++){let c=s[o];if(!c)continue;let u=i(c,o);u!==null&&n.push(u)}g.build(n,r,e)};var Ze=(r,t,e)=>{t(r,e)};m.addType("destroyed",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var ts=(r,t,e)=>{rr(r,t,e)},rr=(r,t,e)=>{m.add(r,"destroyed",{ele:r,callBack:t,parent:e})};var es=(r,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(var s=0,i=t.length;s<i;s++)w.setup(r,t[s],e);else w.setup(r,t,e)};var ir=0,tt=class{constructor(t){this.router=t,this.locationId="base-app-router-"+ir++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var jt=class extends tt{addEvent(){return f.on("popstate",window,this.callBack),this}removeEvent(){return f.off("popstate",window,this.callBack),this}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let s=e.scrollPosition;s&&this.scrollTo(s)}createState(t,e={}){let s=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:s,uri:t}}addState(t,e,s=!1){let i=window.history,n=i.state;if(n&&n.uri===t)return this;let o=this.createState(t,e);return i[s===!1?"pushState":"replaceState"](o,null,t),this}};var $t=class extends tt{addEvent(){return f.on("hashchange",window,this.callBack),this}removeEvent(){return f.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,s){return window.location.hash=t,this}};var Vt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new jt(t).setup():new $t(t).setup()}};var ae=class extends k{getChildScope(){return this.parent}},ss=r=>U(r,ae);var zt=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}focus(t){this.setup===!1&&(this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create()),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){this.template=this.template(),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(ss(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;g.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var rs=r=>{if(!r.length)return null;let t={};return r.forEach(e=>{t[e]=null}),t},is=r=>{let t=[];if(!r)return t;let e=/[*?]/g;r=r.replace(e,"");let s=/:(.[^./?&($]+)\?*/g,i=r.match(s);return i===null||i.forEach(n=>{n&&(n=n.replace(":",""),t.push(n))}),t};var nr=r=>r.replace(/\//g,"/"),or=r=>r.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)")),ar=r=>(r=r.replace(/(\?\/+\*?)/g,"?/*"),r.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),cr=r=>r.replace(/(\*)/g,".*"),ur=(r,t)=>r+=t[t.length-1]==="*"?"":"$",ns=r=>{if(!r)return"";let t=nr(r);return t=or(t),t=ar(t),t=cr(t),t=ur(t,r),t};var hr=0,qt=class extends M{constructor(t,e){let s=t.baseUri,i=is(s),n=rs(i),o=super(n);return this.uri=s,this.paramKeys=i,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setup(){this.stage={},this.id=null,this.uri=null,this.uriQuery=null,this.controller=null,this.paramKeys=[],this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1}setupRoute(t){this.id=t.id||"bs-rte-"+hr++,this.path=null,this.referralPath=null;let e=ns(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?ne(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:i,parent:n}=t,o={component:e,container:s,persist:i,parent:n},a=Et(this);this.controller=new zt(a,o)}resume(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 s=this.controller;s&&s.focus(t);let i=this.path;if(!i)return;let n=i.split("#")[1];n&&this.scrollToId(n)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,s=t.match(this.uriQuery);return s===null?(this.resetParams(),e):(Array.isArray(s)&&(s.shift(),e=s,this.setParams(s)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let s={};e.forEach((i,n)=>{typeof i<"u"&&(s[i]=t[n])}),this.set(s)}getParams(){return this.stage}};var lr=r=>{let t=/\w\S*/;return r.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},fr=(r,t)=>{if(r.indexOf(":")===-1)return r;let e=t.stage;for(let[s,i]of Object.entries(e)){let n=new RegExp(":"+s,"gi");r=r.replace(n,i)}return r},pr=(r,t)=>t&&(typeof t=="function"&&(t=t(r.stage)),t=fr(t,r),lr(t)),dr=(r,t)=>(t!==""&&(r+=" - "+t),r),os=(r,t,e)=>t&&(t=pr(r,t),dr(t,e));var as={removeSlashes(r){return typeof r!="string"?"":(r.substring(0,1)==="/"&&(r=r.substring(1)),r.substring(-1)==="/"&&(r=r.substring(0,r.length-1)),r)}};var cs=(r,t)=>({attr:r,value:t}),mr=(r,t)=>new RegExp("^"+r+"($|#|/|\\.).*").test(t),Jt=class extends k{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,s=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,watch:s}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let s=this.exact===!0,i=O.data,n=[];return t&&typeof t=="object"&&n.push(cs("href",t)),e&&typeof e=="object"&&n.push(cs("text",e)),n.push({value:["[[path]]",i],callBack:(o,a)=>{if(typeof a.pathname>"u")return;let c=a.pathname+a.hash,u=s?o===c:mr(a.pathname,o);this.update(u)}}),n}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var gr=()=>typeof window<"u"?window.location:{},ce=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.history=null,this.callBackLink=null,this.location=gr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new B({path:""})}setupHistory(){this.history=Vt.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new qt(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[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.resume(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){return this.getBasePath()+as.removeSlashes(t)}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(let i=0;i<s;i++){let n=e[i];if(n.uri===t)return n}return null}getRouteById(t){let e=this.routes,s=e.length;if(s>0)for(let i=0;i<s;i++){let n=e[i];if(n.id===t)return n}return!1}removeRoute(t){let e=this.routes,s=e.indexOf(t);s>-1&&e.splice(s,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null)}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);return t.forEach(i=>{if(!i)return;let n=this.createRoute(i);s.push(n)}),this.checkGroup(s,this.getPath()),e}resumeSwitch(t,e){let s=this.switchCount++,i=this.getSwitchGroup(s);return t.forEach(n=>{let o=n.component.route;o.resume(e),i.push(o)}),this.checkGroup(i,this.getPath()),s}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let s=[];return this.switches.set(t,s),s}removeSwitch(t){this.switches.delete(t)}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),f.on("click",document,this.callBackLink);let s=this.getEndPoint();return this.navigate(s,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.ctrlKey===!0)return!0;let e=t.target.closest("a");if(!e||e.target==="_blank"||e.dataset.cancelRoute)return!0;let s=e.getAttribute("href");if(s!==null){let i=this.baseURI,n=i!=="/"?s.replace(i,""):s;return this.navigate(n),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,s=t.length;e<s;e++){let i=t[e];i&&typeof i.deactivate=="function"&&i.deactivate()}return this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=os(t,e,this.title)}checkActiveRoutes(t){if(this.lastPath=this.path,t=t||this.getPath(),this.path=t,this.lastMatchedRoute&&this.check(this.lastMatchedRoute,t))this.select(this.lastMatchedRoute);else{let e=this.routes,s=e.length;for(let i=0;i<s;i++){let n=e[i];typeof n>"u"||this.checkRoute(n,t)}}this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(let s of e.values())this.checkGroup(s,t)}checkGroup(t,e){if(!t.length)return;let s=t.find(o=>o.get("active"));s&&s.match(e)===!1&&s.deactivate();let i;for(let o of t){if(typeof o>"u")continue;if(i){o.deactivate();continue}o.match(e)!==!1&&i===void 0&&o.controller&&(i=o,this.select(o))}let n=t[0];i||this.select(n)}checkRoute(t,e){let s=this.check(t,e);return s!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),t.preventScroll!==!0&&this.checkToScroll())}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),s=this.cleanPath(this.lastPath).split("/"),i=t.split("/");if(s.length!==i.length)return!0;let n=s[s.length-1],o=i[i.length-1];return n!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&f.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},O=new ce;m.addType("routes",r=>{if(!r)return!1;let t=r.route;t&&O.removeRoute(t)});var hs=(r,t,e)=>{t&&(Array.isArray(t)?t.forEach(s=>{s&&us(r,s,e)}):us(r,t,e))},us=(r,t,e)=>{t.container=r,t.parent=e;let s=O.add(t);yr(r,s)},yr=(r,t)=>{m.add(r,"routes",{route:t})};var ls=(r,t,e)=>{};m.addType("switch",r=>{if(!r)return!1;let t=r.id;O.removeSwitch(t)});var fs=(r,t,e)=>{let s=t[0];t.forEach(n=>{n&&(n.container=r,n.parent=e)});let i=O.addSwitch(t);br(r,i)},br=(r,t)=>{m.add(r,"switch",{id:t})};Q.add("cache",We).add("onCreated",Ze).add("onDestroyed",ts).add("bind",Je).add("data",_e).add("state",ls).add("onSet",Z).add("onState",Ft).add("animateIn",Oe).add("animateOut",Me).add("watch",es).add("useParent",Fe).add("useData",$e).add("useState",Ve).add("getId",je).add("addState",ze).add("addEvent",qe).add("map",Ke).add("for",Ge).add("useContext",He).add("addContext",Le).add("context",Ne).add("role",Be).add("aria",Ie).add("route",hs).add("debug",Ue).add("dataSet",Qe).add("dataStateSet",Xe).add("switch",fs);D.augment({Ajax:gt,Html:A,dataBinder:S,Data:B,SimpleData:_,Model:J,State:Y,Builder:g,router:O,Component:k});export{gt as Ajax,R as Arrays,ws as Atom,g as Builder,k as Component,B as Data,m as DataTracker,Ws as DateTime,Q as Directives,y as Dom,ut as Encode,Qt as Events,A as Html,ne as Import,U as Jot,J as Model,Jt as NavLink,b as Objects,Us as Pod,_ as SimpleData,Y as State,I as Store,v as Strings,h as Types,ht as Unit,D as base,S as dataBinder,O as router};
|
|
1
|
+
var R=class{static toArray(t){return Array.from(t)}static inArray(t,e,s){return Array.isArray(t)?t.indexOf(e,s):-1}};var h=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 ps=Object.prototype.toString,pt=Object.prototype.hasOwnProperty,b={create(r){return Object.create(r||null)},extendObject(r,t){if(!h.isObject(r)||!h.isObject(t))return!1;for(let e in r)pt.call(r,e)&&!pt.call(t,e)&&(t[e]=r[e]);return t},clone(r){if(!r||!h.isObject(r))return{};try{return structuredClone(r)}catch{return JSON.parse(JSON.stringify(r))}},getClassObject(r){return typeof r=="function"?r.prototype:r},extendClass(r,t){let e=this.getClassObject(r),s=this.getClassObject(t);if(typeof e!="object"||typeof s!="object")return!1;let i=Object.create(e);for(var n in s)i[n]=s[n];return i},hasOwnProp(r,t){return pt.call(r,t)},isPlainObject(r){return!!r&&ps.call(r)==="[object Object]"},isEmpty(r){if(!h.isObject(r))return!0;for(let t in r)if(pt.call(r,t))return!1;return!0}};var st={types:{},add(r,t){this.types[r]=t},get(r){return this.types[r]||!1},remove(r){delete this.types[r]}};var dt=class{constructor(){this.types=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let s,i=st.get(t);if(i){for(var n=0,o=e.length;n<o;n++)s=e[n],s&&(e[n]=null,this.removeByCallBack(i,s));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}this.types.forEach((e,s)=>{s&&this.removeType(s)}),this.types.clear()}};var j=new WeakMap,m=class{static trackers=new Map;static trackingCount=0;static addType(t,e){st.add(t,e)}static removeType(t){st.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=j.get(t);return e||(e=`dt${this.trackingCount++}`,j.set(t,e)),e}static add(t,e,s){let i=this.getTrackingId(t);this.find(i).add(e,s)}static get(t,e){let s=j.get(t),i=this.trackers.get(s);return i?e?i.get(e):i:!1}static has(t,e){let s=this.getTrackingId(t);if(!s)return!1;let i=this.trackers.get(s);return i&&e?i.has(e):!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new dt),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=j.get(t);if(!s||!this.trackers.has(s))return;let i=this.trackers.get(s);if(!e){i.remove(),this.trackers.delete(s),j.delete(t);return}i.remove(e),this.isEmpty(i.types)&&(this.trackers.delete(s),j.delete(t))}};var Yt=r=>{let t=0;for(let[e,s]of Object.entries(r))t++,typeof r[e]=="object"&&(t+=Yt(r[e]));return t},ue=(r,t)=>{let e=!1;if(typeof r!="object"||typeof t!="object")return e;for(let[s,i]of Object.entries(r)){if(!b.hasOwnProp(t,s))break;let n=t[s];if(typeof i!=typeof n)break;if(typeof i=="object"){if(e=ue(i,n),e!==!0)break}else if(i===n)e=!0;else break}return e},ds=(r,t)=>{let e=Yt(r),s=Yt(t);return e!==s?!1:ue(r,t)},he=(r,t)=>{let e=typeof r;return e!==typeof t?!1:e==="object"?ds(r,t):r===t};var f={getEvents(r){return h.isObject(r)===!1?[]:m.get(r,"events")},create(r,t,e,s=!1,i=!1,n=null){return i=i===!0,{event:r,obj:t,fn:e,capture:s,swapped:i,originalFn:n}},on(r,t,e,s){return Array.isArray(r)?r.forEach(i=>this.add(i,t,e,s)):this.add(r,t,e,s),this},off(r,t,e,s){if(Array.isArray(r)){var i;r.forEach(n=>this.remove(n,t,e,s))}else this.remove(r,t,e,s);return this},add(r,t,e,s=!1,i=!1,n=null){if(h.isObject(t)===!1)return this;let o=this.create(r,t,e,s,i,n);return m.add(t,"events",o),t.addEventListener(r,e,s),this},remove(r,t,e,s=!1){let i=this.getEvent(r,t,e,s);return i===!1?this:(typeof i=="object"&&this.removeEvent(i),this)},removeEvent(r){return typeof r=="object"&&r.obj.removeEventListener(r.event,r.fn,r.capture),this},getEvent(r,t,e,s){if(typeof t!="object")return!1;let i=this.getEvents(t);if(!i||i.length<1)return!1;let n=this.create(r,t,e,s);return this.search(n,i)},search(r,t){let e,s=this.isSwappable(r.event);for(var i=0,n=t.length;i<n;i++)if(e=t[i],!(e.event!==r.event||e.obj!==r.obj)&&(e.fn===r.fn||s===!0&&e.originalFn===r.fn))return e;return!1},removeEvents(r){return h.isObject(r)===!1?this:(m.remove(r,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(r){this.swap.push(r)},isSwappable(r){return this.swap.includes(r)}};m.addType("events",r=>{f.removeEvent(r)});var Qt={events:f,addListener(r,t,e,s){return this.events.add(r,t,e,s),this},on(r,t,e,s){let i=this.events;return Array.isArray(r)?r.forEach(n=>{i.add(n,t,e,s)}):i.add(r,t,e,s),this},off(r,t,e,s){let i=this.events;return Array.isArray(r)?r.forEach(n=>{i.remove(n,t,e,s)}):i.remove(r,t,e,s),this},removeListener(r,t,e,s){return this.events.remove(r,t,e,s),this},_createEvent(r,t,e,s){let i;switch(t){case"HTMLEvents":i=new Event(r,e);break;case"MouseEvents":i=new MouseEvent(r,e);break;default:i=new CustomEvent(r,s);break}return i},createEvent(r,t,e,s){if(h.isObject(t)===!1)return!1;let i={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};h.isObject(e)&&(i=Object.assign(i,e));let n=this._getEventType(r);return this._createEvent(r,n,i,s)},_getEventType(r){let t={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},e="CustomEvent";for(let[s,i]of Object.entries(t))if(r.match(i)){e=s;break}return e},trigger(r,t,e){if(h.isObject(t)===!1)return this;let s=typeof r=="string"?this.createEvent(r,t,null,e):r;return t.dispatchEvent(s),this},mouseWheelEventType:null,getWheelEventType(){let r=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=r())},onMouseWheel(r,t,e,s=!1){typeof t>"u"&&(t=window);let i=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof r=="function"&&r(a,o),e===!0&&o.preventDefault()},n=this.getWheelEventType();return this.events.add(n,t,i,s,!0,r),this},offMouseWheel(r,t,e=!1){typeof t>"u"&&(t=window);let s=this.getWheelEventType();return this.off(s,t,r,e),this},preventDefault(r){return typeof r.preventDefault=="function"?r.preventDefault():r.returnValue=!1,this},stopPropagation(r){return typeof r.stopPropagation=="function"?r.stopPropagation():r.cancelBubble=!0,this}};var rt=class{constructor(){this.errors=[],this.dataTracker=m}augment(t){if(!h.isObject(t))return this;let e=this.constructor.prototype;for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return this}override(t,e,s,i){return(t[e]=s).apply(t,R.toArray(i))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,s){if(h.isObject(t)===!1)return"";let i=t[e];return typeof i<"u"?i:typeof s<"u"?s:""}createCallBack(t,e,s=[],i=!1){return typeof e!="function"?!1:(...n)=>(i===!0&&(s=s.concat(n)),e.apply(t,s))}bind(t,e){return e.bind(t)}};rt.prototype.extend=(function(){return rt.prototype})();var D=new rt;D.augment({...b,...Qt,...h,equals:he});var it={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 le=()=>{D.augment({xhrSettings:it,addFixedParams(r){this.xhrSettings.fixedParams=r},beforeSend(r){this.xhrSettings.beforeSend.push(r)},ajaxSettings(r){typeof r=="object"&&(this.xhrSettings=b.extendClass(D.xhrSettings,r))},resetAjaxSettings(){this.xhrSettings=it}})};var v=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,s=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let i={},n=/([^?=&]+)(=([^&]*))?/g;return t.replace(n,function(o,a,c,u){i[a]=e!==!1?decodeURIComponent(u):u}),i}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let s=/([A-Z]{1,})/g;return t.replace(s,i=>e+i.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())}};var mt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:s,url:i,async:n}=this.settings;e.open(s,i,n),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=it.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var i=0,n=t.length;i<n;i++){var o=t[i];o&&o(e,s)}}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+encodeURIComponent(t[s]));return e.join("&")}setupParams(t,e=null){let s=typeof t;if(!e)return!(t instanceof FormData)&&s==="object"&&(t=this.objectToString(t)),t;let i=typeof e;if(s==="string")return i!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(i==="string"&&(e=v.parseQueryString(e,!1)),t instanceof FormData)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.append(n,e[n]);else s==="object"&&(t=b.clone(t),t=Object.assign(e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,s=t.params;return s?s=this.setupParams(s,e):e&&(s=this.setupParams(e)),s}getXhrSettings(t){let e=this.settings={...D.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var s=0,i=t.length;s<i;s++){var n=t[s];switch(s){case 0:e.url=n;break;case 1:e.params=n;break;case 2:e.completed=n,e.failed=n;break;case 3:e.responseType=n||"json";break;case 4:e.method=n?n.toUpperCase():"POST";break;case 5:e.async=typeof n<"u"?n:!0;break}}else e=this.settings=b.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 s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.xhr?.setRequestHeader(s,e[s])}update(t,e){let s=this.xhr,i=()=>{f.removeEvents(s?.upload),f.removeEvents(s)},n=this.settings;if(!n)return!1;switch(e||t.type){case"load":if(typeof n.completed=="function"){let a=this.getResponseData();n.completed(a,this.xhr)}i();break;case"error":typeof n.failed=="function"&&n.failed(!1,this.xhr),i();break;case"progress":typeof n.progress=="function"&&n.progress(t);break;case"abort":typeof n.aborted=="function"&&n.aborted(!1,this.xhr),i();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 s=this.update.bind(this);f.on(["load","error","abort"],e,s),f.on("progress",e.upload,s)}};le();var gt=(...r)=>new mt(r).xhr;var ms=r=>typeof r!="string"?r:fe(r),fe=r=>[{tag:"text",textContent:r}],yt=()=>({props:{},children:[]}),bt=r=>({props:{},children:fe(r)}),xt=r=>({props:{},children:r}),St=r=>({props:r[0]||{},children:ms(r[1])});var vt=class{constructor(){this.connections=new Map}add(t,e,s){let i=this.getOrCreate(t),n=i.get(e);return n?Array.isArray(n)?n.push(s):i.set(e,[n,s]):i.set(e,s),s}get(t,e){let s=this.connections.get(t)?.get(e);return s?Array.isArray(s)?s[s.length-1]||!1:s:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let s=this.connections.get(t);if(s)if(e)this.unsubscribe(s.get(e)),s.delete(e),s.size===0&&this.connections.delete(t);else{for(let i of s.values())this.unsubscribe(i);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,s=t.length;e<s;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var $=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var kt=class extends ${constructor(t){super(),this.data=t}subscribe(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',t,this.data);return}this.msg=t,this.token=this.data.on(t,e)}unsubscribe(){this.data&&this.msg&&this.token&&this.data.off(this.msg,this.token),this.data=null,this.msg=null,this.token=null}};var V=class{unsubscribe(){}};var Ct=class extends V{constructor(){super(),this.source=null}addSource(t){return this.source=new kt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var z=class extends ${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 wt=class extends z{constructor(t,e,s){super(s),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 y=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?R.toArray(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:R.toArray(s):!1}static html(t,e){return h.isObject(t)===!1?!1:h.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return h.isObject(t)===!1||h.isUndefined(e)?this:(e=v.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=v.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let i=null,n=t.currentStyle;if(n&&(i=n[e]))return i;let o=window.getComputedStyle(t,null);return o?o[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return h.isObject(t)&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return h.isObject(t)===!1?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=v.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,s){e=this.removeDataPrefix(e),e=v.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=v.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return h.isObject(t)===!1?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(h.isObject(t)===!1)return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(h.isObject(t)===!1)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 h.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return h.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return h.isObject(t)?t.offsetWidth:!1}static getHeight(t){return h.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return h.isObject(t)===!1?!1:{left:e-(t.clientLeft||0),top:s-(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,s=e.documentElement,i=e.getElementsByTagName("body")[0],n=t.innerWidth||s.clientWidth||i.clientWidth,o=t.innerHeight||s.clientHeight||i.clientHeight;return{width:n,height:o}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(h.isObject(t)===!1)return s;let i=0;for(;t&&(e===0||i<e);)i++,s.x+=t.offsetLeft+t.clientLeft,s.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return s}static addClass(t,e){if(h.isObject(t)===!1||e==="")return this;if(typeof e=="string"){let n=e.split(" ");for(var s=0,i=n.length;s<i;s++)t.classList.add(e)}return this}static removeClass(t,e){return h.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return h.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return h.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var Tt=r=>{let t="textContent";if(!r||typeof r!="object")return t;let e=r.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let s=r.type;if(!s)return t="value",t;switch(s){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var gs=(r,t,e)=>{y.setAttr(r,t,e)},ys=(r,t,e)=>{r.checked=r.value==e},bs=(r,t,e)=>{e=e==1,pe(r,t,e)},pe=(r,t,e)=>{r[t]=e},xs=(r,t)=>y.getAttr(r,t),Ss=(r,t)=>r[t],At=class extends z{constructor(t,e,s,i){super(i),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=gs,this.getValue=xs,this;this.getValue=Ss;let s=t.type;if(s)switch(s){case"checkbox":this.setValue=bs;return;case"radio":this.setValue=ys;return}return this.setValue=pe,this}getAttrBind(t){return t||Tt(this.element)}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return s=>t.replace(e,s)}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 Dt=class extends V{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new At(t,e,s,this.pubSub)}addData(t,e){return this.data=new wt(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 de=-1,q=class{constructor(){this.callBacks=new Map,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=[]}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,de=-1}on(t,e){let s=(++de).toString();return this.get(t).set(s,e),s}off(t,e){let s=this.callBacks.get(t);s&&(e=String(e),s.delete(e),s.size===0&&this.callBacks.delete(t))}remove(t){this.callBacks.delete(t)}publish(t,...e){if(!this.batchingEnabled){this.publishImmediate(t,...e);return}this.updateQueue.set(t,e),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.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.updateQueue.clear(),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,s]of t)this.publishImmediate(e,...s)}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())}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}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 s=e.length;for(let i=0;i<s;i++)e[i]()}})}flushSync(){this.flush()}publishImmediate(t,...e){let s=this.callBacks.get(t);if(s){for(let i of s.values())if(i)try{i.apply(this,e)}catch(n){console.error('[DataPubSub] Subscriber error for "'+t+'":',n)}}}};var Xt=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new vt,this.pubSub=new q,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,i){let n=s,o=null,a=s.indexOf(":");a!==-1&&(o=s.substring(0,a),n=s.substring(a+1));let c=o??"",u=this.setupConnection(t,e,n,c,i),l=u.element,p=e.get(n);return typeof p<"u"?l.set(p):(p=l.get(),p!==""&&u.data.set(p)),this}setupConnection(t,e,s,i,n){let o=this.getBindId(t),a=new Dt(this.pubSub);a.addData(e,s).subscribe(o);let l=`${e.getDataId()}:${s}`;return a.addElement(t,i,n).subscribe(l),this.addConnection(o,"bind",a),a}addConnection(t,e,s){return this.connections.add(t,e,s),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){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,i){if(h.isObject(t)===!1)return this;let n=new Ct,o=e.get(s),a=!0,c=d=>{a&&(a=!1,d===o)||i(d)};n.addSource(e).subscribe(s,c);let l=this.getBindId(t),p=e.getDataId()+":"+s;return this.addConnection(l,p,n),i(o),this}unwatch(t,e,s){if(h.isObject(t)===!1)return this;let i=t[this.attr];if(i){let n=e.getDataId()+":"+s;this.connections.remove(i,n)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}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,s=this.isDataBound(e);if(s!==null){let i=this.connections.get(s,"bind");if(i){let n=i.element.get();this.pubSub.publish(s,n,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&f.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&f.off(["change","paste","input"],document,this.changeHandler,!1)}},S=new Xt;var E=r=>r.data?r.data:r.context&&r.context.data?r.context.data:r.state?r.state:null;var vs={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"},nt=r=>vs[r]||r,ot=r=>typeof r=="string"&&r.substring(0,2)==="on"?r.substring(2):r,A=class{static create(t,e,s,i){let n=document.createElement(t);return this.addAttributes(n,e),i===!0?this.prepend(s,n):this.append(s,n),n}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;typeof s<"u"&&y.setAttr(t,"type",s);for(let[i,n]of Object.entries(e))i==="innerHTML"?t.innerHTML=n:i.indexOf("-")!==-1?y.setAttr(t,i,n):this.addAttr(t,i,n)}static addHtml(t,e){return typeof e>"u"||e===""?this:(/(?:<[a-z][\s\S]*>)/i.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(s===""||!e)return;if(typeof s==="function")e=ot(e),s.originalCallback?f.add(e,t,s,!1,!0,s.originalCallback):f.add(e,t,s);else{let n=nt(e);t[n]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!h.isObject(t)||!h.isArray(e))return!1;e.forEach(i=>{let n=new Option(i.label,i.value);t.options.add(n),s!==null&&n.value==s&&(n.selected=!0)})}static removeElementData(t){m.remove(t);let e=t.childNodes;if(e&&e.length>0){let i=Array.from(e);for(let n=i.length-1;n>=0;n--)this.removeElementData(i[n])}t.bindId&&S.unbind(t)}static removeElement(t){if(!t)return this;let e=m.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(!h.isObject(t))return this;let e=Array.from(t.childNodes);for(let s=0,i=e.length;s<i;s++)this.removeElementData(e[s]);return t.innerHTML="",this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let i=s||t.firstChild;return t.insertBefore(e,i),this}static clone(t,e=!1){return h.isObject(t)?t.cloneNode(e):!1}};var C=class extends A{static create(t,e,s,i){let n=document.createElement(t);return this.addAttributes(n,e,i),s.appendChild(n),n}static addAttributes(t,e,s){if(!(!e||e.length<1))for(let i=0,n=e.length;i<n;i++){let o=e[i];this.addAttr(t,o.key,o.value,s)}}static addAttr(t,e,s,i){if(s===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s==="function"){if(e=ot(e),s.originalCallback)f.add(e,t,s,!1,!0,s.originalCallback);else{let a=s,c=function(u){a.call(this,u,i)};f.add(e,t,c,!1,!0,a)}return}if(e.substring(4,5)==="-"){y.setAttr(t,e,s);return}let o=nt(e);t[o]=s}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 Gt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,me=new Map,w={isWatching(r){return Array.isArray(r)?typeof r[0]=="string"&&this.hasParams(r[0]):this.hasParams(r)},hasParams(r){return h.isString(r)&&r.includes("[[")},_getWatcherProps(r){let t=me.get(r);if(t!==void 0)return t;let e=r.match(Gt),s=e?e.map(i=>i.slice(2,-2)):null;return me.set(r,s),s},updateAttr(r,t,e){switch(t){case"text":case"textContent":r.textContent=e;break;case"disabled":r.disabled=!e;break;case"checked":r.checked=!!e;break;case"required":r.required=!!e;break;case"src":if(r.tagName==="IMG"){r.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}r.src=e;break;default:C.addAttr(r,t,e);break}},replaceParams(r,t,e=!1){let s=0;return r.replace(Gt,function(i,n,o){let a=e?t[s]:t;s++;let c=a.get(o);return typeof c<"u"&&c!==null?c:""})},_getWatcherCallBack(r,t,e,s,i){return()=>{let n=this.replaceParams(e,t,i);this.updateAttr(r,s,n)}},getValue(r,t){let e=r.value;return Array.isArray(e)===!1?[e,E(t)]:(e.length<2&&e.push(E(t)),e)},getPropValues(r,t,e){let s=[];for(let i=0,n=t.length;i<n;i++){let a=(e?r[i]:r).get(t[i])??"";s.push(a)}return s},getCallBack(r,t,e,s,i,n){let o=r.attr||"textContent",a=r.callBack;if(typeof a=="function"){let c=n||s.match(Gt)||[],u=c.length>1;return(l,p)=>{l=u!==!0?l:this.getPropValues(e,c,i);let d=a(l,t,p);typeof d<"u"&&this.updateAttr(t,o,d)}}return this._getWatcherCallBack(t,e,s,o,i)},addDataWatcher(r,t,e){let s=this.getValue(t,e),i=s[1]??e?.data??e?.context?.data??e?.state??null;if(!i)return;let n=s[0],o=Array.isArray(i),a=this._getWatcherProps(n),c=this.getCallBack(t,r,i,n,o,a);if(o)for(let u=0,l=a.length;u<l;u++)this.addWatcher(r,i[u],a[u],c);else for(let u=0,l=a.length;u<l;u++)this.addWatcher(r,i,a[u],c)},getWatcherSettings(r,t=null){if(typeof r=="string")return{attr:t,value:r};if(Array.isArray(r)){let e=r[r.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let s=r[1]&&typeof r[1]=="object"?[r[0],r[1]]:[r[0]];return typeof e=="function"?{attr:t,value:s,callBack:e}:{attr:e||"textContent",value:s}}return r},setup(r,t,e){t&&this.addDataWatcher(r,this.getWatcherSettings(t),e)},addWatcher(r,t,e,s){S.watch(r,t,e,s)}};var ks=r=>({props:{watch:r},children:[]}),Cs=r=>{if(!r)return yt();let t=r[0],e=typeof t;if(e==="string"||e==="number")return bt(t);if(Array.isArray(t))return w.isWatching(t)===!1?xt(t):ks(t);let s=r[1]??r[0]??[];return s&&Array.isArray(s)&&w.isWatching(s)===!0&&(r[0]=Array.isArray(r[0])?{}:r[0],r[0].watch=s,r[1]=[]),St(r)},ws=r=>(...t)=>{let{props:e,children:s}=Cs(t);return r(e,s)};var ge=new WeakMap,ye=new WeakMap;function Ts(r,t,e,s){let i=ge.get(r);i||(i=new Map,ge.set(r,i));let n=i.get(e);if(n)return n;let o=new Proxy(r,xe(t,e,s));return i.set(e,o),o}function be(r,t){let e=isNaN(Number(t)),s=e?t:`[${t}]`;return r===""?s:e?`${r}.${s}`:`${r}${s}`}function xe(r,t="",e=""){return{get(s,i,n){let o=s[i];if(t===""&&i in s){if(typeof o=="function"){let c=ye.get(s);c||(c=new Map,ye.set(s,c));let u=c.get(i);if(u)return u;let l=o.bind(s);return c.set(i,l),l}return o}if(o=(s[e]||s)[i],o!==null&&typeof o=="object"){let c=be(t,i);return Ts(o,r,c,e)}return o},set(s,i,n,o){if(t===""&&i in s)return s[i]=n,!0;let a=be(t,i);return r.set(a,n),!0}}}var Et=(r,t="stage")=>new Proxy(r,xe(r,"",t));var at=class{static resume(t,e){if(!t)return null;let s,i=localStorage.getItem(t);return i===null?e&&(s=e):s=JSON.parse(i),s}static store(t,e){if(!t||!e)return!1;let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Pt=(r={})=>{let t={};if(!h.isObject(r))return t;let e=Object.keys(r);for(let s=0,i=e.length;s<i;s++){let n=e[s],o=r[n];typeof o!="function"&&(t[n]=o)}return t};var As=0,Se=new Map,H={CHANGE:"change",DELETE:"delete"},Kt=(r,t)=>{let e=Se.get(r);return e||(e={change:`${r}:change`,delete:`${r}:delete`},Se.set(r,e)),t==="change"?e.change:e.delete},M=class{constructor(t={}){this.dirty=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new q;let e=Pt(t);return this.set(e),Et(this)}setup(){this.stage={}}_init(){let t=++As;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(){}on(t,e){let s=Kt(t,H.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=Kt(t,H.CHANGE);this.eventSub.off(s,e)}_setAttr(t,e,s=this,i=!1){let n=this.stage[t];e!==n&&(this.stage[t]=e,this._publish(t,e,s,H.CHANGE))}publishLocalEvent(t,e,s,i){let n=Kt(t,i);this.eventSub.publish(n,e,s)}_publish(t,e,s,i){this.publishLocalEvent(t,e,s,i),s=s||this,S.publish(this._dataId+t,e,s)}set(...t){if(typeof t[0]!="object")return this._setAttr(...t),this;let[e,s,i]=t,n=Object.keys(e);for(let o=0;o<n.length;o++){let a=n[o],c=e[a];typeof c!="function"&&this._setAttr(a,c,s,i)}return this}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,H.DELETE)}toggle(t){if(!(typeof t>"u"))return this.set(t,!this.get(t)),this}increment(t,e=null){if(typeof t>"u")return;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s+e),this}decrement(t,e=null){if(typeof t>"u")return;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s-e),this}concat(t,e){if(typeof t>"u")return;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t){return this.key=t,this}resume(t){let e=at.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return at.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,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let i=[];return Object.entries(e).forEach(([n])=>{i.push(this.remoteLink(t,n))}),i}remoteLink(t,e,s){let i=s||e,n=t.get(e);typeof n<"u"&&this.get(e)!==n&&this.set(e,n);let o=t.on(e,(c,u)=>{if(u===this)return!1;this.set(i,c,t)});this.addLink(o,t);let a=this.on(i,(c,u)=>{if(u===t)return!1;t.set(e,c,this)});return t.addLink(a,this),o}addLink(t,e){this.links.set(t,e)}unlink(t){if(t){this.removeLink(t);return}let e=this.links;b.isEmpty(e)||(e.forEach((s,i)=>{this.removeLink(i,!1)}),this.links=new Map)}removeLink(t,e=!0){let s=this.links.get(t);s&&s.off(t),e!==!1&&this.links.delete(t)}};M.prototype.isData=!0;var Zt=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t}get(t){return this.cache.get(t)}set(t,e){if(this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.maxSize){let s=this.cache.keys().next().value;this.cache.delete(s)}}clear(){this.cache.clear()}},P={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new Zt(1e3),hasDeepData(r){return r.indexOf(".")!==-1||r.indexOf("[")!==-1},getSegments(r){let t=this.segmentCache.get(r);if(t!==void 0)return t;let e=this.deepDataPattern;return t=r.match(e),this.segmentCache.set(r,t),t}};var L=class{static set(t,e,s){if(!P.hasDeepData(e)){t[e]=s;return}let i,n=P.getSegments(e);if(!n)return;let o=n.length,a=o-1;for(let c=0;c<o;c++){let u=n[c];if(c===a){t[u]=s;break}t[u]===void 0&&(t[u]=isNaN(u)?{}:[]),t=t[u]}}static delete(t,e){if(!P.hasDeepData(e)){delete t[e];return}let s=P.getSegments(e);if(!s)return;let i=s.length,n=i-1;for(let o=0;o<i;o++){let a=s[o],c=t[a];if(c===void 0)break;if(o===n){if(Array.isArray(t)){t.splice(Number(a),1);break}delete t[a];break}t=c}}static get(t,e){if(!P.hasDeepData(e))return t[e]??void 0;let s=P.getSegments(e);if(!s)return;let i=s.length,n=i-1;for(let o=0;o<i;o++){let a=s[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===n)return t}}};var ve=new Set,ct=class{static MAX_DEPTH=50;static publishDeep(t,e,s,i){if(!P.hasDeepData(e)){this.publish(e,s,i);return}let n,o=P.getSegments(e);if(!o)return;let a=o.length,c=a-1,u="";for(let l=0;l<a;l++){let p=o[l];t=t[p],l>0?isNaN(p)&&(u+="."+p):u=p;let d;if(l===c)d=s;else{let x=o[l+1];if(isNaN(x)===!1){u+="["+x+"]";continue}let T={};T[x]=t[x],d=T}this.publish(u,d,i)}}static publish(t,e,s,i=null,n=0){if(t=t||"",s(t,e),!(!e||typeof e!="object"||(i===null&&(ve.clear(),i=ve),!i))){if(i.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(n>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}i.add(e),Array.isArray(e)?this.publishArray(t,e,s,i,n):this.publishObject(t,e,s,i,n)}}static publishArray(t,e,s,i,n){let o=e.length;for(let a=0;a<o;a++){let c=e[a],u=t+"["+a+"]";this._checkPublish(u,c,s,i,n)}}static publishObject(t,e,s,i,n){let o=Object.keys(e);for(let a=0,c=o.length;a<c;a++){let u=o[a],l=e[u],p=t+"."+u;this._checkPublish(p,l,s,i,n)}}static _checkPublish(t,e,s,i,n){if(!e||typeof e!="object"){s(t,e);return}this.publish(t,e,s,i,n+1)}};var B=class extends M{setup(){this.attributes={},this.stage={}}_setAttr(t,e,s,i){typeof e!="object"&&e===this.get(t)||(!s&&i!==!0?L.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),L.set(this.stage,t,e),s=s||this,this._publish(t,e,s,H.CHANGE))}linkAttr(t,e){let s=t.get(e);if(!s)return;let i=Object.keys(s);for(let n=0,o=i.length;n<o;n++){let a=i[n];this.link(t,e+"."+a,a)}}scope(t,e){let s=this.get(t);if(!s)return!1;e=e||this.constructor;let i=new e(s);return i.linkAttr(this,t),i}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.push(e),this.set(t,s),this}concat(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s=s.concat(e),this.set(t,s),this}unshift(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.unshift(e),this.set(t,s),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.shift();return this.set(t,e),s}getIndex(t,e,s){let i=this.get(t);return Array.isArray(i)===!1?-1:typeof i[0]!="object"?i.indexOf(e):i.findIndex(o=>o[e]===s)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.pop();return this.set(t,e),s}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,s,i){let n=(o,a)=>this._publishAttr(o,a,s,i);ct.publish(t,e,n)}_publishAttr(t,e,s,i){let n=this._dataId+t;S.publish(n,e,s),this.publishLocalEvent(t,e,s,i)}mergeStage(){this.attributes=b.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,s=this){L.delete(t,e);let i=(n,o)=>this.publishLocalEvent(n,o,s,H.DELETE);ct.publish(e,e,i)}_getAttr(t,e){return L.get(t,e)}};var Ds={"\n":"\\n","\r":"\\n"," ":"\\t"},Es=(r,t)=>{typeof r!="string"&&(r=String(r));let e=t?/[\n\r\t]/g:/\t/g;return r.replace(e,s=>Ds[s])},ke=(r,t)=>{if(typeof r!="string")return r;r=Es(r,t),r=encodeURIComponent(r);let e=/%22/g;return r.replace(e,'"')},te=(r,t)=>{let e=typeof r;return e==="undefined"?r:e!=="object"?(r=ke(r),r):(Object.entries(r).forEach(([s,i])=>{i!==null&&(r[s]=typeof i=="string"?te(i,t):ke(i,t))}),r)};function Ce(r){return typeof r<"u"&&r.length>0?JSON.parse(r):!1}function ee(r){return typeof r<"u"?JSON.stringify(r):null}var ut=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?b.clone(t):t,i=te(s,e);return ee(i)}static json={encode:ee,decode:Ce};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Ot=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=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 s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=v.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=v.parseQueryString(e,!1)),this._isFormData(t))for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),i="id="+s,n=s?`/${s}`:"",o=this.model;return this._get(n,i,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+"="+ut.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._put(n,s,t,e)}add(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._post(n,s,t,e)}update(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._patch(n,s,t,e)}delete(t,e){let s=this.model.get("id"),i=typeof s<"u"?"id="+s:this.setupObjectData(),n=s!=null?`/${s}`:"";return this._delete(n,i,t,e)}all(t,e,s,i,n=null,o=null){let a=this.model.get();s=isNaN(s)?0:s,i=isNaN(i)?50:i;let c=a.search||"",u=a.filter||"";typeof u=="object"&&(u=JSON.stringify(u));let l=a.dates||"";typeof l=="object"&&(l=JSON.stringify(l));let p=a.orderBy||"";typeof p=="object"&&(p=JSON.stringify(p));let d=a.groupBy||"";Array.isArray(d)&&(d=JSON.stringify(d));let x="&filter="+u+"&offset="+s+"&limit="+i+"&dates="+l+"&orderBy="+p+"&groupBy="+d+"&search="+c+"&lastCursor="+(typeof n<"u"&&n!==null?n:"")+"&since="+(typeof o<"u"&&o!==null?o:"");return this._get("",x,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let s=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(s)}setupRequest(t,e,s,i,n){let o={url:this.getUrl(t),method:e,params:s,completed:(c,u)=>{typeof n=="function"&&n(c),this.getResponse(c,i,u)}};return this._isFormData(s)&&(o.headers={}),gt(o)}setupEventSource(t,e,s,i,n=!0){let o=null,a=null,c=!1,u=!1,l=()=>{a&&(clearTimeout(a),a=null)},p=()=>{if(c||!n||u)return;l(),a=setTimeout(()=>{a=null,d()},3e3)},d=()=>{if(c||u)return;if(o){try{o.close()}catch{}o=null}u=!0;let x=this.getUrl(t),T=e?"?"+e:"";o=new EventSource(x+T,{withCredentials:!0}),o.onopen=()=>{u=!1,l(),i&&i()},o.onerror=()=>{u=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,p())},o.onmessage=et=>{try{let ft=JSON.parse(et.data);s&&s(ft)}catch{}}};return d(),{get source(){return o},close:()=>{if(c=!0,u=!1,l(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return w.isWatching(t)&&(t=w.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,s,i){return this._request("","POST",t,e,s,i)}_get(t,e,s,i,n){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",i,n)}_post(t,e,s,i,n){return this._request(t,"POST",e,s,i,n)}_put(t,e,s,i,n){return this._request(t,"PUT",e,s,i,n)}_patch(t,e,s,i,n){return this._request(t,"PATCH",e,s,i,n)}_delete(t,e,s,i,n){return this._request(t,"DELETE",e,s,i,n)}_request(t,e,s,i,n,o){return s=this.setupParams(s),s=this.addParams(s,i),this.setupRequest(t,e,s,n,o)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return!1;let e=this;class s extends e{constructor(n){super(n)}}return Object.assign(s.prototype,t),s}};var Ps=r=>{let t={};if(!h.isObject(r)||!r.defaults)return t;let{defaults:e}=r;return Object.keys(e).forEach(s=>{let i=e[s];typeof i!="function"&&(t[s]=i)}),delete r.defaults,t},Os=r=>{if(!r||typeof r.xhr!="object")return{};let t={...r.xhr};return delete r.xhr,t},Ms=0,J=class extends B{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,s=Os(t),i=e.prototype.service.extend(s),n=Ps(t);class o extends e{constructor(c){let u={...n,...Pt(c)};super(u),this.xhr=new i(this)}dataTypeId=`bm${Ms++}`}return Object.assign(o.prototype,t),o.prototype.service=i,o}};J.prototype.service=Ot;var _=class extends M{};var Y=class extends _{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 s=this.stage;return typeof s[t]<"u"&&delete s[t],this}};var Mt=class extends Y{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var I=class{static targets=new Map;static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new Mt(t)),this.targets.get(t)}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let i=this.getTarget(t);return e&&i.addAction(e,s),i}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){s&&this.off(t,e,s)}static on(t,e,s){let i=this.getTarget(t);return e?i.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let i=this.targets,n=i.get(t);if(n){if(e){n.off(e,s);return}this.targets.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};var Bt=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(s=>{this.on(...s)})}on(t,e,s,i){f.on(t,e,s,i),this.events.push({event:t,obj:e,callBack:s,capture:i})}off(t,e,s,i){f.off(t,e,s,i);let n,o=this.events;for(var a=0,c=o.length;a<c;a++)if(n=o[a],n.event===t&&n.obj===e){o.splice(a,1);break}}set(){this.events.forEach(t=>{f.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{f.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset(),this.events=[]}};var It=class{constructor(t,e){this.remoteStates=[];let s=this.convertStates(e);this.addStatesToTarget(t,s)}addStates(t,e){let s=this.convertStates(e);this.addStatesToTarget(t,s)}createState(t,e,s,i){return{action:t,state:e,callBack:s,targetId:i,token:null}}convertStates(t){let e=[];for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;if(s==="remotes"){this.setupRemoteStates(t[s],e);continue}let i=null,n=null,o=t[s];o&&typeof o=="object"&&(n=o.callBack,i=o.id||o.targetId,o=o.state),e.push(this.createState(s,o,n,i))}return e}setupRemoteStates(t,e){for(let s=0,i=t.length;s<i;s++){let n=t[s];if(n)for(let o in n){if(!Object.prototype.hasOwnProperty.call(n,o)||o==="id")continue;let a=null,c=n[o],u=c!==null?c:void 0;u&&typeof u=="object"&&(a=u.callBack,u=u.state),e.push(this.createState(o,u,a,n.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeActions(t,e){if(!(e.length<1))for(let s=0,i=e.length;s<i;s++){let n=e[s];n.token&&this.unbindRemoteState(t,n.token),n.targetId&&I.remove(n.targetId,n.action,n.token)}}restore(t){I.restore(t.id,t);let e=this.remoteStates;if(e)for(let s=0,i=e.length;s<i;s++){let n=e[s];n.token=this.bindRemoteState(t,n.action,n.targetId)}}bindRemoteState(t,e,s){let i=I.getTarget(s);return t.link(i,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let s=this.remoteStates;for(let i=0,n=e.length;i<n;i++){let o=e[i],a=this.addAction(t,o);o.targetId&&(o.token=a,s.push(o))}}addAction(t,e){let s,i=e.action,n=e.targetId;n&&(s=this.bindRemoteState(t,i,n)),typeof e.state<"u"&&t.addAction(i,e.state);let o=e.callBack;return typeof o=="function"&&t.on(i,o),s||null}};var we=r=>{if(!r)return yt();let t=r[0],e=typeof t;return e==="string"||e==="number"?bt(t):Array.isArray(t)?xt(t):St(r)};m.addType("components",r=>{if(!r)return;let t=r.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Bs=0,ht=class{constructor(...t){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.cached=[],this.init();let{props:e,children:s}=we(t);this.setupProps(e),this.children=s||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Bs++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=this.persistedCount++,s="pc"+e,n=Object.keys(this.persistedChildren)[e],o=this.persistedChildren[n];return o&&t.unitType===o.unitType&&(s=n,t.resumeScope(o)),t.persistToken=s,this.persistedChildren[s]=t,s}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){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 s=e[0];s&&(this.addingContext=!0,this.contextBranchName=s,this.addContextBranch(s,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(){m.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let s=[];if(!t||t.length<1)return s;for(var i=0,n=t.length;i<n;i++){let o=e(t[i],i);s.push(o)}return s}removeAll(t){return A.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),String(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(),this.removeContext();let t=this.panel;t&&A.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null,this.cached.forEach(t=>{this[t]=null}),this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy(),this.data&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var k=class extends ht{constructor(...t){super(...t),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){this.data=t.data,this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,this.id=t.id}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=I.getTarget(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper.restore(t);return}let e=this.setupStates();b.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new It(this.state,t))}addState(t){!this.stateHelper||this.stateResumed==!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;t&&(this.stateHelper.removeRemoteStates(t),t.remove(),this.stateResumed=!1)}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Bt)}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,this.beforeDestroy(),this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&this.data.unlink()}};var Rt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var Is=(r,t)=>typeof r!="function"&&t==="setupStates"?()=>r:r,se=(r,t)=>(r&&Object.entries(r).forEach(([e,s])=>{let i=Rt[e]||e;t[i]=Is(s,i)}),t),Rs=r=>se(r,{}),Ns=0,Te=(r,t)=>{class e extends r{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Ns++,e},U=(r,t=k)=>{r||(r={});let e,s=typeof r;return s==="object"&&r.render?(e=Rs(r),Te(t,e)):(e={render:s==="function"?r:()=>r},Te(t,e))};var Hs=(r,t)=>(Object.entries(r).forEach(([e,s])=>{let i=Rt[e]||e;t.prototype[i]=s}),t),Ls=0,_s=r=>{let t=class extends r{};return t.prototype._classId="pod"+Ls++,t},Us=(r,t=k)=>{if(!r)return null;let e=_s(t),s={},i=r(s);return Hs(s,e),e.prototype.render=i,e};var Ws={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(r=new Date().getDay(),t=!1){let e=this.dayNames;if(r>e.length)return null;let s=e[r];return t?s.substring(0,3):s},convertJsMonth(r){return this.padNumber(r+1)},convertDate(r,t=!1){r=r?r.replace(/\s/,"T"):"";let e=new Date(r),s=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+s},padNumber(r){return r<=9?"0"+r:String(r)},createDate(r){return r?(typeof r=="string"&&r.indexOf("-")>-1&&(r=r.replace(/\s/,"T"),r=r.indexOf(":")>-1?r:r+"T00:00:00"),new Date(r)):new Date},format(r,t){let e=this.createDate(t);return this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),r)},formatTime(r,t){let e=this.createDate(r),s=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),s)},getMeridian(r){return r=Number(r),r>=12?"PM":"AM"},convert24To12(r){return r=Number(r),r>12&&(r=r-12),r},convert12To24(r,t){return r=Number(r),t.toLowerCase()==="pm"&&(r=r+12),r},renderDate(r,t,e,s="sql"){return t=Number(t),e=Number(e),s==="sql"?`${r}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${r}`},renderTime(r,t,e=0,s="sql"){if(s==="sql")return`${this.padNumber(r)}:${this.padNumber(t)}:${this.padNumber(e)}`;let i=this.getMeridian(r);return r=this.convert24To12(r),`${r}:${this.padNumber(t)} ${i}`},leapYear(r){return r%400===0||r%100!==0&&r%4===0},getMonthName(r=new Date().getMonth(),t=!1){let e=this.monthNames;if(r>e.length)return"";let s=e[r];return s?t?s.substring(0,3):s:""},getMonthLength(r,t){let e=new Date;return r=typeof r<"u"?r:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[r]},getMonthsLength(r=new Date().getFullYear()){return this.leapYear(r)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(r,t="America/Denver"){let e=new Date(r);if(Number.isNaN(e.getMonth())===!0){let n=/[- :]/,o=r.split(n);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let s=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),i=e.getTime()-s.getTime();return new Date(e.getTime()+i)},getLocalTime(r,t=!1,e=!1,s="America/Denver"){if(!r)return"";let i=this.getLocalDate(r,s),n=i.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(i.getFullYear(),n,i.getDate(),o)+" "),a+this.renderTime(i.getHours(),i.getMinutes(),i.getSeconds(),o)},getDiffFromNow(r,t=!1){r=r.replace(/\s/,"T");let e=new Date(r),s=new Date;return t===!0&&s.setHours(0,0,0,0),s.getTime()-e.getTime()},getAge(r){let t=this.getDiffFromNow(r),e,s;switch(!0){case t<864e5:e="1 day";break;case t<6048e5:s=this.toDays(t),e=s+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:s=this.toDays(t);var i=Math.floor(s/7);e=i+" weeks";break;case t<5184e6:e="1 month";break;case t<31104e6:var n=this.toMonths(t);e=n+" months";break;default:var o=this.toYears(t);e=o}return String(e)},getTimeFrame(r){let t=this.getDiffFromNow(r);return this.convertToEstimate(t)},convertToEstimate(r){let t="",e,s,i,n,o,a,c;if(r<=0)switch(!0){case r<-63072e6:i=this.toYears(Math.abs(r)),t="in "+i+" years";break;case r<-31536e6:t="in a year";break;case r<-5184e6:n=this.toMonths(Math.abs(r)),t="in "+n+" months";break;case r<-2592e6:t="in a month";break;case r<-12096e5:e=this.toDays(Math.abs(r)),s=Math.floor(e/7),t="in "+s+" weeks";break;case r<-6048e5:t="in a week";break;case r<-1728e5:e=this.toDays(Math.abs(r)),t="in "+e+" days";break;case r<-864e5:t="tomorrow";break;case r<-72e5:o=this.toHours(Math.abs(r)),t="in "+o+" hours";break;case r<=-36e5:t="in an hour";break;case r<-12e4:a=this.toMinutes(Math.abs(r)),t="in "+a+" minutes";break;case r<-6e4:t="in a minute";break;case r<-2e3:c=this.toSeconds(Math.abs(r)),t="in "+c+" seconds";break;case r<-1:t="in 1 second";break;default:t="now"}else switch(!0){case r<1e3:t="1 second ago";break;case r<6e4:c=this.toSeconds(r),t=c+" seconds ago";break;case r<12e4:t="1 minute ago";break;case r<36e5:a=this.toMinutes(r),t=a+" minutes ago";break;case r<72e5:t="1 hour ago";break;case r<864e5:o=this.toHours(r),t=o+" hours ago";break;case r<1728e5:t="yesterday";break;case r<6048e5:e=this.toDays(r),t=e+" days ago";break;case r<12096e5:t="a week ago";break;case r<2592e6:e=this.toDays(r),s=Math.floor(e/7),t=s+" weeks ago";break;case r<5184e6:t="a month ago";break;case r<31536e6:n=this.toMonths(r),t=n+" months ago";break;case r<63072e6:t="a year ago";break;default:i=this.toYears(r),t=i+" years ago"}return t},toYears(r){return typeof r!="number"?0:Math.floor(r/31558464e3)},toMonths(r){return typeof r=="number"?Math.floor(r/2592e6):0},toDays(r){return typeof r!="number"?0:Math.floor(r/864e5*1)},toHours(r){return typeof r!="number"?0:Math.floor(r%864e5/36e5*1)},toMinutes(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5/6e4*1)},toSeconds(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5%6e4/1e3*1)},getDifference(r,t){let e=new Date(r),s=new Date(t),i=s.getTime()-e.getTime();return{years:this.toYears(i),days:this.toDays(i),hours:this.toHours(i),minutes:this.toMinutes(i),seconds:this.toSeconds(i)}}};var Ae=(r,t)=>({name:r,callBack:t});var Q={keys:[],items:{},add(r,t){return this.keys.push(r),this.items[r]=Ae(r,t),this},get(r){return this.items[r]||null},all(){return this.keys}};var re=(r,t)=>({attr:r,directive:t});var W=(r,t)=>({key:r,value:t});var De=(r,t,e,s)=>({tag:r,attr:t,directives:e,children:s});var N=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,s,i){return t==="text"?(i.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(s.push(W("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,s){t.push(re(W(e,w.getWatcherSettings(s,nt(e))),Q.get("watch")))}static setButtonType(t,e,s){if(t==="button"){let i=e.type||"button";s.push(W("type",i))}}static parse(t,e){let s=[],i=[],n=this.getTag(t);this.setButtonType(n,t,s),this.setupChildren(t);let o=[],a,c,u=Object.keys(t);for(let l=0,p=u.length;l<p;l++){let d=u[l];if(d==="tag"||(a=t[d],a==null))continue;if(d==="children"){if(Array.isArray(a))for(let T=0;T<a.length;T++)o.push(a[T]);else o.push(a);continue}if((c=Q.get(d))!==null){i.push(re(W(d,a),c));continue}let x=typeof a;if(x==="object"){if(w.isWatching(a)){this.setTextAsWatcher(i,d,a);continue}o.push(a);continue}if(x==="function"){let T=a,et=function(ft){T.call(this,ft,e)};et.originalCallback=T,s.push(W(d,et));continue}if(w.isWatching(a)){this.setTextAsWatcher(i,d,a);continue}this.setElementContent(d,a,s,o)||s.push(W(d,a))}return De(n,s,i,o)}};var X=class{build(t,e,s){}setupComponent(t,e,s){let i=s?.getChildScope();t.parent=i,i&&i.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&i&&(i[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),s=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),s}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t),t}setDirectives(t,e,s){}removeNode(t){}removeAll(t){}};var Nt=class extends X{build(t,e,s){let i=C.createDocFragment();if(Array.isArray(t))for(let n=0,o=t.length;n<o;n++)this.buildElement(t[n],i,s);else this.buildElement(t,i,s);return e&&typeof e=="object"&&e.appendChild(i),i}buildElement(t,e,s){if(t){if(t.isUnit===!0){this.createComponent(t,e,s);return}this.createElement(t,e,s)}}createElement(t,e,s){let i=s?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,i);return}let n=N.parse(t,i),o=this.createNode(n,e,i);this.cache(o,t.cache,s);let a=n.children;for(let u=0,l=a.length;u<l;u++){let p=a[u];p!==null&&this.buildElement(p,o,s)}let c=n.directives;c&&c.length&&this.setDirectives(o,c,i)}createTempComponent(t,e,s){let i={cache:t.cache,setData:()=>t.data,...se(t.methods||{},{}),render(){return{...t,data:null,state:null}}};t.state&&(i.setupStateTarget=function(o){this.state=t.state});let n=new k(i);this.createComponent(n,e,s)}setDirectives(t,e,s){for(let i=0,n=e.length;i<n;i++)this.handleDirective(t,e[i],s)}handleDirective(t,e,s){e.directive.callBack(t,e.attr.value,s)}cache(t,e,s){s&&e&&s.cacheEle(t,e)}createNode(t,e,s){let i=t.tag;if(i==="text"){let n=t.attr[0],o=n?n.value:"";return C.createText(o,e)}else if(i==="comment"){let n=t.attr[0],o=n?n.value:"";return C.createComment(o,e)}return C.create(i,t.attr,e,s)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var Fs=["area","base","br","col","embed","hr","img","input","link","meta","source"],G=class{static create(t,e=[],s=""){let i=this.getInnerContent(e);i+=this.getInnerHtml(e);let n=this.createAttributes(e);return Fs.includes(t)?`<${t} ${n} />`:`<${t} ${n}>`+i+s+`</${t}>`}static getInnerContent(t){let e="";return t.forEach(({key:s,value:i},n)=>{if(s!=="text"&&s!=="textContent")return"";t.splice(n,1),e+=i}),e}static getInnerHtml(t){let e="";return t.forEach(({key:s,value:i},n)=>{if(s!=="html"&&s!=="innerHTML")return"";t.splice(n,1),e+=i}),e}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:s,value:i}=e;return typeof i=="function"&&(s="on"+ot(s)),`${s}="${i}"`}).join(" ")}static createText(t){return t}static createComment(t){return`<!-- ${t} -->`}};var Ht=class extends X{build(t,e,s){return(Array.isArray(t)?t:[t]).map(n=>this.buildElement(n,s)).join("")}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let s=N.parse(t,e),i=s.children.map(n=>n!==null?this.buildElement(n,e):"").join("");return this.createNode(s,i)}createNode(t,e){let s=t.tag;if(s==="text"){let i=t.attr[0],n=i?i.value:"";return G.createText(n)}else if(s==="comment"){let i=t.attr[0],n=i?i.value:"";return G.createComment(n)}return G.create(s,t.attr,e)}removeAll(t){}};var Lt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Nt:new Ht}};var F=Lt.setup(),js=r=>typeof r=="object"&&r.isUnit===!0,$s=r=>{let t=U(r);return t?new t:null},g=class{static render(t,e,s){return!t||(js(t)||(t=$s(t)),!t)?null:F.createComponent(t,e,s)}static build(t,e,s){return F.build(t,e,s)}static rebuild(t,e,s){return F.removeAll(e),this.build(t,e,s)}static setDirectives(t,e,s){F.setDirectives(t,e,s)}static createNode(t,e,s){return F.createNode(t,e,s)}static removeNode(t){F.removeNode(t)}static removeAll(t){F.removeAll(t)}};D.augment({buildLayout(r,t,e){g.build(r,t,e)}});var ie=[],Vs=r=>ie.indexOf(r)!==-1,zs=r=>({tag:"script",src:r.src,async:!1,load(t){ie.push(r.src);let e=r.load;e&&e()}}),qs=r=>({tag:"link",rel:"stylesheet",type:"text/css",href:r.src,load(t){ie.push(r.src);let e=r.load;e&&e()}}),_t=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,s=this.update.bind(this);t.indexOf(".css")!==-1?e=qs({load:s,src:t}):e=zs({load:s,src:t}),g.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Vs(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 Js=r=>r?typeof r?.prototype?.constructor=="function":!1,K=class{static process(t,e){let s=t.default;return s?e.callback?e.callback(s):(Js(s)?s=new s:s=s(),s.isUnit===!0&&(s.route=e.route,e.persist&&(s.persist=!0)),s):null}static render(t,e,s){let i=g.build(t,null,s),n=i.firstChild||t?.panel;return e.after(i),n}};var Ut=class{static load(t,e,s){return t.then(i=>(e&&e(i),i)).catch(i=>{console.error("Error loading module:",i),s&&s(i)})}};var Ys=r=>({tag:"comment",textContent:"import placeholder",onCreated:r.onCreated}),Wt=new Map,Qs=r=>{if(Wt.has(r)){let s=Wt.get(r);return s&&typeof s.then!="function"?Promise.resolve(s):s}let t=typeof r,e;if(t==="string")e=import(r);else if(t==="function")e=r();else return r;return e.then(s=>{Wt.set(r,s)}),Wt.set(r,e),e},Ee=U({declareProps(){this.loaded=!1,this.generation=0},render(){return Ys({onCreated:r=>{if(this.src){if(this.layout){this.layoutRoot=K.render(this.layout,this.panel,this.parent);return}if(this.depends){new _t(()=>{this.loadAndRender(r)}).addFiles(this.depends);return}this.loadAndRender(r)}}})},loadAndRender(r){let t=this.generation;Ut.load(Qs(this.src),e=>{if(t!==this.generation)return;this.loaded=!0;let s=this.layout||K.process(e,{callback:this.callback,route:this.route,persist:this.persist});this.layout=s,this.layoutRoot=K.render(s,r,this.parent)},e=>{t===this.generation&&(this.loaded=!1)})},shouldUpdate(r){return this.updateLayout===!0?!0:this.updateLayout=r&&r.isUnit&&typeof r.update=="function"},updateModuleLayout(r){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(r)},update(r){this.loaded===!0&&this.updateModuleLayout(r)},destroy(){this.generation++,this.layoutRoot&&(g.removeNode(this.layoutRoot),this.persist!==!0&&(this.layoutRoot=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var ne=r=>{let t=typeof r;return(t==="string"||t==="function"||r instanceof Promise)&&(r={src:r}),new Ee(r)};var Pe=(r,t,e=null)=>{if(!r)return;let s=null,i=!1,n=()=>{i||(i=!0,s&&(clearTimeout(s),s=null),f.off("animationend",r,o),r&&y.removeClass(r,t),e&&e())},o=a=>{a.target===r&&n()};f.on("animationend",r,o),requestAnimationFrame(()=>{if(!r){n();return}y.addClass(r,t);try{let a=window.getComputedStyle(r),c=parseFloat(a.animationDuration)*1e3||1e3,u=parseFloat(a.animationDelay)*1e3||0;s=setTimeout(n,c+u+100)}catch{s=setTimeout(n,1e3)}})},Oe=(r,t,e)=>{Pe(r,t)},Me=(r,t,e)=>{let s=()=>{r&&r.remove&&r.remove()};Xs(r,()=>Pe(r,t,s),e)};m.addType("manual-destroy",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Xs=(r,t,e)=>{m.add(r,"manual-destroy",{ele:r,callBack:t,parent:e})};var lt=(r,t,e,s)=>{if(Array.isArray(e[0])){e.forEach(i=>{i&<(r,t,i,s)});return}Gs(r,t,e,s)},Gs=(r,t,e,s)=>{let i,n;if(e.length<3?[i,n]=e:[t,i,n]=e,!t||!i)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.',r,t);return}let o=Ks(r,i,n,s);S.watch(r,t,i,o)},Ks=(r,t,e,s)=>typeof e=="object"?i=>{er(r,e,i)}:i=>{Zs(r,e,t,i,s)},Zs=(r,t,e,s,i)=>{let n=t(s,r,i);switch(typeof n){case"object":tr(n,r,i);break;case"string":let o=Tt(r);if(o!=="textContent"){y.setAttr(r,o,n);break}A.addHtml(r,n);break}},tr=(r,t,e)=>{g.rebuild(r,t,e)},er=(r,t,e)=>{for(let[s,i]of Object.entries(t))s&&(i===e?y.addClass(r,s):y.removeClass(r,s))};var Z=(r,t,e)=>{let s=E(e);lt(r,s,t,e)};var Be=(r,t,e)=>{t&&t&&y.setAttr(r,"role",t)},sr=r=>(t,e)=>{let s=t?"true":"false";y.setAttr(e,r,s)},Ie=(r,t,e)=>{if(!t)return;let s=t.role;s&&(y.setAttr(r,"role",s),t.role=null),Object.entries(t).forEach(([i,n])=>{if(n===null)return;let o=`aria-${i}`;if(Array.isArray(n)){let a=[...n];a.push(sr(o)),Z(r,a,e)}else y.setAttr(r,o,n)})};var Re=(r,t,e)=>{if(!t)return;let s=N.parse(t,e);C.addAttributes(r,s.attr,e),g.setDirectives(r,s.directives,e)};m.addType("context",r=>{if(!r)return!1;r.parent.removeContextBranch(r.branch)});var oe=r=>r?r.getContext():null,Ne=(r,t,e)=>{if(typeof t!="function")return;let s=oe(e),i=t(s);Re(r,i,e)},He=(r,t,e)=>{if(typeof t!="function")return;let s=oe(e);t(s)},Le=(r,t,e)=>{if(typeof t!="function"||!e)return;let s=oe(e),i=t(s);i&&e.addContextBranch(i[0],i[1])};var _e=(r,t,e)=>{};var Ue=(r,t,e)=>{if(!e)return;let s=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",r),console.log("Data: ",t),console.log("Layout: ",s),console.log("parent: ",e)};var We=(r,t,e)=>{},Fe=(r,t,e)=>{if(!t||!e)return;let s=t(e,r);s&&g.build(s,r,e)},je=(r,t,e)=>{if(!t||!e)return;let s=e.getId(t);r.id=s},$e=(r,t,e)=>{if(!t||!e)return;let s=t(e.data,r);s&&g.build(s,r,e)},Ve=(r,t,e)=>{if(!t||!e)return;let s=t(e.state,r);s&&g.build(s,r,e)},ze=(r,t,e)=>{if(!t||!e)return;let s=e.state,i=t(s);if(!e.state){e.setStateHelper(i);return}e.addState(i)},qe=(r,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let s=t[2];t[2]=i=>{s(i,e)}}e.events.on(...t)}};var Je=(r,t,e)=>{let s,i,n;if(typeof t=="string"){if(s=E(e),!s)return;i=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=E(e);if(!o)return;t.unshift(o)}[s,i,n]=t}S.bind(r,s,i,n)};var Ft=(r,t,e)=>{lt(r,e.state,t,e)};var Ye=r=>(t,e)=>{let[s,i,n="active"]=r,o=t===i?n:"";y.setData(e,s,o)},Qe=(r,t,e)=>{if(!t)return;let s=[...t],i=s.pop();s.push(Ye(i)),Z(r,s,e)},Xe=(r,t,e)=>{if(!t)return;let s=[...t],i=s.pop();s.push(Ye(i)),Ft(r,s,e)};var Ge=(r,t,e)=>{let s,i,n,o;if(t.length<3){let c=E(e);if(!c)return;s=c,[i,n,o]=t}else[s,i,n,o]=t;let a=o!==!1;S.watch(r,s,i,c=>{if(g.removeAll(r),!c||c.length<1)return;let u=[];for(let l=0,p=c.length;l<p;l++){let d=a?s.scope(`${i}[${l}]`):null,x=n(c[l],l,d,u);x!==null&&u.push(x)}return g.build(u,r,e)})};var Ke=(r,t,e)=>{let s=t[0];if(!s||s.length<1)return;let i=t[1],n=[];for(let o=0,a=s.length;o<a;o++){let c=s[o];if(!c)continue;let u=i(c,o);u!==null&&n.push(u)}g.build(n,r,e)};var Ze=(r,t,e)=>{t(r,e)};m.addType("destroyed",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var ts=(r,t,e)=>{rr(r,t,e)},rr=(r,t,e)=>{m.add(r,"destroyed",{ele:r,callBack:t,parent:e})};var es=(r,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(var s=0,i=t.length;s<i;s++)w.setup(r,t[s],e);else w.setup(r,t,e)};var ir=0,tt=class{constructor(t){this.router=t,this.locationId="base-app-router-"+ir++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var jt=class extends tt{addEvent(){return f.on("popstate",window,this.callBack),this}removeEvent(){return f.off("popstate",window,this.callBack),this}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let s=e.scrollPosition;s&&this.scrollTo(s)}createState(t,e={}){let s=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:s,uri:t}}addState(t,e,s=!1){let i=window.history,n=i.state;if(n&&n.uri===t)return this;let o=this.createState(t,e);return i[s===!1?"pushState":"replaceState"](o,null,t),this}};var $t=class extends tt{addEvent(){return f.on("hashchange",window,this.callBack),this}removeEvent(){return f.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,s){return window.location.hash=t,this}};var Vt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new jt(t).setup():new $t(t).setup()}};var ae=class extends k{getChildScope(){return this.parent}},ss=r=>U(r,ae);var zt=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}focus(t){this.setup===!1&&(this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create()),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){this.template=this.template(),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(ss(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;g.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var rs=r=>{if(!r.length)return null;let t={};return r.forEach(e=>{t[e]=null}),t},is=r=>{let t=[];if(!r)return t;let e=/[*?]/g;r=r.replace(e,"");let s=/:(.[^./?&($]+)\?*/g,i=r.match(s);return i===null||i.forEach(n=>{n&&(n=n.replace(":",""),t.push(n))}),t};var nr=r=>r.replace(/\//g,"/"),or=r=>r.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)")),ar=r=>(r=r.replace(/(\?\/+\*?)/g,"?/*"),r.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),cr=r=>r.replace(/(\*)/g,".*"),ur=(r,t)=>r+=t[t.length-1]==="*"?"":"$",ns=r=>{if(!r)return"";let t=nr(r);return t=or(t),t=ar(t),t=cr(t),t=ur(t,r),t};var hr=0,qt=class extends M{constructor(t,e){let s=t.baseUri,i=is(s),n=rs(i),o=super(n);return this.uri=s,this.paramKeys=i,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setup(){this.stage={},this.routeId=null,this.uri=null,this.uriQuery=null,this.controller=null,this.paramKeys=[],this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1}setupRoute(t){this.routeId=t.id||"bs-rte-"+hr++,this.path=null,this.referralPath=null;let e=ns(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?ne(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:i,parent:n}=t,o={component:e,container:s,persist:i,parent:n},a=Et(this);this.controller=new zt(a,o)}resume(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 s=this.controller;s&&s.focus(t);let i=this.path;if(!i)return;let n=i.split("#")[1];n&&this.scrollToId(n)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,s=t.match(this.uriQuery);return s===null?(this.resetParams(),e):(Array.isArray(s)&&(s.shift(),e=s,this.setParams(s)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let s={};e.forEach((i,n)=>{typeof i<"u"&&(s[i]=t[n])}),this.set(s)}getParams(){return this.stage}};var lr=r=>{let t=/\w\S*/;return r.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},fr=(r,t)=>{if(r.indexOf(":")===-1)return r;let e=t.stage;for(let[s,i]of Object.entries(e)){let n=new RegExp(":"+s,"gi");r=r.replace(n,i)}return r},pr=(r,t)=>t&&(typeof t=="function"&&(t=t(r.stage)),t=fr(t,r),lr(t)),dr=(r,t)=>(t!==""&&(r+=" - "+t),r),os=(r,t,e)=>t&&(t=pr(r,t),dr(t,e));var as={removeSlashes(r){return typeof r!="string"?"":(r.substring(0,1)==="/"&&(r=r.substring(1)),r.substring(-1)==="/"&&(r=r.substring(0,r.length-1)),r)}};var cs=(r,t)=>({attr:r,value:t}),mr=(r,t)=>new RegExp("^"+r+"($|#|/|\\.).*").test(t),Jt=class extends k{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,s=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,watch:s}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let s=this.exact===!0,i=O.data,n=[];return t&&typeof t=="object"&&n.push(cs("href",t)),e&&typeof e=="object"&&n.push(cs("text",e)),n.push({value:["[[path]]",i],callBack:(o,a)=>{if(typeof a.pathname>"u")return;let c=a.pathname+a.hash,u=s?o===c:mr(a.pathname,o);this.update(u)}}),n}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var gr=()=>typeof window<"u"?window.location:{},ce=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.history=null,this.callBackLink=null,this.location=gr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new B({path:""})}setupHistory(){this.history=Vt.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new qt(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[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.resume(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){return this.getBasePath()+as.removeSlashes(t)}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(let i=0;i<s;i++){let n=e[i];if(n.uri===t)return n}return null}getRouteById(t){let e=this.routes,s=e.length;if(s>0)for(let i=0;i<s;i++){let n=e[i];if(n.routeId===t)return n}return!1}removeRoute(t){let e=this.routes,s=e.indexOf(t);s>-1&&e.splice(s,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null)}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);return t.forEach(i=>{if(!i)return;let n=this.createRoute(i);s.push(n)}),this.checkGroup(s,this.getPath()),e}resumeSwitch(t,e){let s=this.switchCount++,i=this.getSwitchGroup(s);return t.forEach(n=>{let o=n.component.route;o.resume(e),i.push(o)}),this.checkGroup(i,this.getPath()),s}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let s=[];return this.switches.set(t,s),s}removeSwitch(t){this.switches.delete(t)}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),f.on("click",document,this.callBackLink);let s=this.getEndPoint();return this.navigate(s,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.ctrlKey===!0)return!0;let e=t.target.closest("a");if(!e||e.target==="_blank"||e.dataset.cancelRoute)return!0;let s=e.getAttribute("href");if(s!==null){let i=this.baseURI,n=i!=="/"?s.replace(i,""):s;return this.navigate(n),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,s=t.length;e<s;e++){let i=t[e];i&&typeof i.deactivate=="function"&&i.deactivate()}return this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=os(t,e,this.title)}checkActiveRoutes(t){if(this.lastPath=this.path,t=t||this.getPath(),this.path=t,this.lastMatchedRoute&&this.check(this.lastMatchedRoute,t))this.select(this.lastMatchedRoute);else{let e=this.routes,s=e.length;for(let i=0;i<s;i++){let n=e[i];typeof n>"u"||this.checkRoute(n,t)}}this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(let s of e.values())this.checkGroup(s,t)}checkGroup(t,e){if(!t.length)return;let s=t.find(o=>o.get("active"));s&&s.match(e)===!1&&s.deactivate();let i;for(let o of t){if(typeof o>"u")continue;if(i){o.deactivate();continue}o.match(e)!==!1&&i===void 0&&o.controller&&(i=o,this.select(o))}let n=t[0];i||this.select(n)}checkRoute(t,e){let s=this.check(t,e);return s!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),t.preventScroll!==!0&&this.checkToScroll())}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),s=this.cleanPath(this.lastPath).split("/"),i=t.split("/");if(s.length!==i.length)return!0;let n=s[s.length-1],o=i[i.length-1];return n!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&f.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},O=new ce;m.addType("routes",r=>{if(!r)return!1;let t=r.route;t&&O.removeRoute(t)});var hs=(r,t,e)=>{t&&(Array.isArray(t)?t.forEach(s=>{s&&us(r,s,e)}):us(r,t,e))},us=(r,t,e)=>{t.container=r,t.parent=e;let s=O.add(t);yr(r,s)},yr=(r,t)=>{m.add(r,"routes",{route:t})};var ls=(r,t,e)=>{};m.addType("switch",r=>{if(!r)return!1;let t=r.id;O.removeSwitch(t)});var fs=(r,t,e)=>{let s=t[0];t.forEach(n=>{n&&(n.container=r,n.parent=e)});let i=O.addSwitch(t);br(r,i)},br=(r,t)=>{m.add(r,"switch",{id:t})};Q.add("cache",We).add("onCreated",Ze).add("onDestroyed",ts).add("bind",Je).add("data",_e).add("state",ls).add("onSet",Z).add("onState",Ft).add("animateIn",Oe).add("animateOut",Me).add("watch",es).add("useParent",Fe).add("useData",$e).add("useState",Ve).add("getId",je).add("addState",ze).add("addEvent",qe).add("map",Ke).add("for",Ge).add("useContext",He).add("addContext",Le).add("context",Ne).add("role",Be).add("aria",Ie).add("route",hs).add("debug",Ue).add("dataSet",Qe).add("dataStateSet",Xe).add("switch",fs);D.augment({Ajax:gt,Html:A,dataBinder:S,Data:B,SimpleData:_,Model:J,State:Y,Builder:g,router:O,Component:k});export{gt as Ajax,R as Arrays,ws as Atom,g as Builder,k as Component,B as Data,m as DataTracker,Ws as DateTime,Q as Directives,y as Dom,ut as Encode,Qt as Events,A as Html,ne as Import,U as Jot,J as Model,Jt as NavLink,b as Objects,Us as Pod,_ as SimpleData,Y as State,I as Store,v as Strings,h as Types,ht as Unit,D as base,S as dataBinder,O as router};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|