@base-framework/base 3.0.2 → 3.0.4

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/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # Base Framework
2
2
 
3
- **Last Updated**: December 4, 2023
4
- **Version**: 2.6.0
3
+ **Version**: 3.0.4
5
4
 
6
5
  ## Framework Overview
7
6
 
8
- Our goal with Base is to solve many client-side rendering issues. Base focuses on reusability, scalability, polymorphism, and performance.
7
+ Our goal with Base is to solve many client-side rendering issues. Base focuses on reusability, scalability, and performance.
9
8
 
10
9
  Base has a core that supports adding and removing events, custom events, data-tracking, element class and attribute modifying, object and type utils, etc.
11
10
 
@@ -15,24 +14,40 @@ The framework is modular and has additional modules to help with ajax, HTML, lay
15
14
 
16
15
  Base framework uses components to render an application. Base creates and renders components using native JavaScript. Layouts are scaffolded using JavaScript object literals. Because the layouts are rendered client-side using native JavaScript, the framework does not require a compiling or build process.
17
16
 
18
- [Learn about layouts](#)
19
-
20
17
  ## Components and Atoms
21
18
 
22
19
  Components are encapsulated layouts that contain the presentation and functionality. They are reusable and extensible, helping to reduce redundant code through abstract types.
23
20
 
21
+ ```javascript
22
+ import { Component } from '@base-framework/base';
23
+
24
+ /**
25
+ * Page
26
+ *
27
+ * This will create a page component.
28
+ *
29
+ * @class Page
30
+ * @extends {Component}
31
+ */
32
+ export class Page extends Component
33
+ {
34
+ render()
35
+ {
36
+ return {
37
+ class: 'page'
38
+ };
39
+ }
40
+ }
41
+ ```
42
+
24
43
  Components have lifecycle methods for actions during creation, setup, and destruction.
25
44
 
26
45
  Atoms are the building blocks for reusable layouts, allowing common design patterns and elements to be shared between multiple components and other atoms.
27
46
 
28
- [Learn about components](#)
29
-
30
47
  ## Element Directives
31
48
 
32
49
  Elements created by Base have access to custom directives, enabling more functionalities than standard HTML elements. These include caching, adding states, binding and watching data, re-rendering contents, declarative routing and switching, array mapping and binding, event listeners, and more.
33
50
 
34
- [Learn about directives](#)
35
-
36
51
  ## Data Binding, Watching, and Linking
37
52
 
38
53
  Base supports "bindables" for creating and using data, supporting both shallow and deep nested data. Bindables can be one-way or two-way bindings.
@@ -42,8 +57,6 @@ Types of bindables include:
42
57
  - **SimpleData**: A shallow data object.
43
58
  - **Models**: Child of Data, with default attributes and server resource connectivity.
44
59
 
45
- [Learn about data binding](#)
46
-
47
60
  ## Performance
48
61
 
49
62
  Components are static by default, rendering only once per instance. They become dynamic when bound to bindable data sources, allowing for content re-rendering, value changes, function calls, and class additions on data change.
@@ -102,7 +115,7 @@ export class Page extends Component
102
115
  }
103
116
  ```
104
117
 
105
- User the builder to create a new instance of the component:
118
+ Use the builder to create a new instance of the component:
106
119
 
107
120
  ```javascript
108
121
  import { Builder } from '@base-framework/base';
@@ -159,7 +172,7 @@ Base Framework is licensed under the MIT License. See the LICENSE file for detai
159
172
 
160
173
  For questions, suggestions, or issues, contact us:
161
174
 
162
- Email:
163
- GitHub Issues: github.com/chrisdurfee/base/issues
164
- Community Chat: Discord coming soon
165
- Follow us on Social Media:
175
+ - Email:
176
+ - GitHub Issues: github.com/chrisdurfee/base/issues
177
+ - Community Chat: Discord coming soon
178
+ - Follow us on Social Media:
package/dist/base.js CHANGED
@@ -1,2 +1,2 @@
1
- var be=Object.defineProperty;var Se=(s,t,e)=>t in s?be(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var L=(s,t,e)=>(Se(s,typeof t!="symbol"?t+"":t,e),e);var C=class{static toArray(t){return Array.prototype.slice.call(t)}static inArray(t,e,r){return!t||typeof t!="object"?-1:t.indexOf(e,r)}};var u=class{static getType(t){let e=typeof t;return e!=="object"?e:this.isArray(t)?"array":e}static isUndefined(t){return typeof t>"u"}static isObject(t){return t&&typeof t=="object"&&this.isArray(t)===!1}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var m={create(s){return Object.create(s)},extendObject(s,t){if(typeof s>"u"||typeof t>"u")return!1;for(var e in s)Object.prototype.hasOwnProperty.call(s,e)&&typeof t[e]>"u"&&(t[e]=s[e]);return t},clone(s){return s?JSON.parse(JSON.stringify(s)):{}},getClassObject(s){return typeof s=="function"?s.prototype:s},extendClass(s,t){let e=this.getClassObject(s),r=this.getClassObject(t);if(typeof e!="object"||typeof r!="object")return!1;let n=Object.create(e);for(var i in r)n[i]=r[i];return n},isEmpty(s){if(u.isObject(s)===!1)return!0;for(var t in s)if(Object.prototype.hasOwnProperty.call(s,t))return!1;return!0}};var $={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||!1},remove(s){delete this.types[s]}};var Z=class{constructor(){this.types={}}add(t,e){(this.types[t]||(this.types[t]=[])).push(e)}get(t){return this.types[t]||!1}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){let e=this.types;if(!e)return;let r=e[t];if(!r.length)return;let n,i=$.get(t);for(var o=0,a=r.length;o<a;o++)n=r[o],n&&(r[o]=null,this.removeByCallBack(i,n));delete e[r]}remove(t){if(t)this.removeType(t);else{let r=this.types;for(var e in r)if(Object.prototype.hasOwnProperty.call(r,e)){if(t=r[e],!t)continue;this.removeType(e)}delete this.types}}};var l=class{static addType(t,e){$.add(t,e)}static removeType(t){$.remove(t)}static getTrackingId(t){return t.trackingId||(t.trackingId="dt"+this.trackingCount++)}static add(t,e,r){let n=this.getTrackingId(t);this.find(n).add(e,r)}static get(t,e){let r=t.trackingId,n=this.trackers[r];return n?e?n.get(e):n:!1}static find(t){let e=this.trackers;return e[t]||(e[t]=new Z)}static isEmpty(t){if(!t||typeof t!="object")return!0;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}static remove(t,e){let r=t.trackingId;if(!r)return!0;let n=this.trackers[r];if(!n)return!1;e?(n.remove(e),this.isEmpty(n.types)&&delete this.trackers[r]):(n.remove(),delete this.trackers[r])}};L(l,"trackers",{}),L(l,"trackingCount",0);var St=s=>{let t=0;for(var e in s)!Object.prototype.hasOwnProperty.call(s,e)||(t++,typeof s[e]=="object"&&(t+=St(s[e])));return t},Lt=(s,t)=>{let e=!1;if(typeof s!="object"||typeof t!="object")return e;for(var r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||!Object.prototype.hasOwnProperty.call(t,r))break;let n=s[r],i=t[r];if(typeof n!=typeof i)break;if(typeof n=="object"){if(e=Lt(n,i),e!==!0)break}else if(n===i)e=!0;else break}return e},we=(s,t)=>{let e=St(s),r=St(t);return e!==r?!1:Lt(s,t)},_t=(s,t)=>{let e=typeof s;return e!==typeof t?!1:e==="object"?we(s,t):s===t};var d={getEvents(s){return u.isObject(s)===!1?!1:l.get(s,"events")},create(s,t,e,r=!1,n=!1,i=null){return n=n===!0,{event:s,obj:t,fn:e,capture:r,swapped:n,originalFn:i}},on(s,t,e,r){if(Array.isArray(s)){let o;for(var n=0,i=s.length;n<i;n++)o=s[n],this.add(o,t,e,r)}else this.add(s,t,e,r);return this},off(s,t,e,r){if(Array.isArray(s))for(var n,i=0,o=s.length;i<o;i++)n=s[i],this.remove(n,t,e,r);else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,n=!1,i=null){if(u.isObject(t)===!1)return this;let o=this.create(s,t,e,r,n,i);return l.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let n=this.getEvent(s,t,e,r);return n===!1?this:(typeof n=="object"&&this.removeEvent(n),this)},removeEvent(s){return typeof s=="object"&&s.obj.removeEventListener(s.event,s.fn,s.capture),this},getEvent(s,t,e,r){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(s,t,e,r);return this.search(i,n)},search(s,t){let e,r=this.isSwappable(s.event);for(var n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==s.event||e.obj!==s.obj)&&(e.fn===s.fn||r===!0&&e.originalFn===s.fn))return e;return!1},removeEvents(s){return u.isObject(s)===!1?this:(l.remove(s,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(s){this.swap.push(s)},isSwappable(s){return C.inArray(this.swap,s)>-1}};l.addType("events",s=>{d.removeEvent(s)});var Ht={events:d,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let n=this.events;if(Array.isArray(s)){let a;for(var i=0,o=s.length;i<o;i++)a=s[i],n.add(a,t,e,r)}else n.add(s,t,e,r);return this},off(s,t,e,r){let n=this.events;if(Array.isArray(s))for(var i,o=0,a=s.length;o<a;o++)i=s[o],n.remove(i,t,e,r);else n.remove(s,t,e,r);return this},removeListener(s,t,e,r){return this.events.remove(s,t,e,r),this},_createEvent(s,t,e,r){let n;return t==="HTMLEvents"?n=new Event(s):t==="MouseEvents"?n=new MouseEvent(s,e):n=new CustomEvent(s,r),n},createEvent(s,t,e,r){if(u.isObject(t)===!1)return!1;let n={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};u.isObject(e)&&(n=Object.assign(n,e));let i=this._getEventType(s);return this._createEvent(s,i,n,r)},_getEventType(s){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,r="CustomEvent";for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&(e=t[n],s.match(e))){r=n;break}return r},trigger(s,t,e){if(u.isObject(t)===!1)return this;let r=typeof s=="string"?this.createEvent(s,t,null,e):s;return t.dispatchEvent(r),this},mouseWheelEventType:null,getWheelEventType(){let s=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=s())},onMouseWheel(s,t,e,r){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof s=="function"&&s(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,r,!0,s),this},offMouseWheel(s,t,e){typeof t>"u"&&(t=window);let r=this.getWheelEventType();return this.off(r,t,s,e),this},preventDefault(s){return typeof s.preventDefault=="function"?s.preventDefault():s.returnValue=!1,this},stopPropagation(s){return typeof s.stopPropagation=="function"?s.stopPropagation():s.cancelBubble=!0,this}};var K=class{constructor(){this.version="3.0.0",this.errors=[],this.dataTracker=l}augment(t){if(!t||typeof t!="object")return this;let e=this.constructor.prototype;for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,n){return(t[e]=r).apply(t,C.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(u.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof r<"u"?r:""}createCallBack(t,e,r,n){return typeof e!="function"?!1:(r=r||[],function(...i){return n===!0&&(r=r.concat(i)),e.apply(t,r)})}bind(t,e){return e.bind(t)}};K.prototype.extend=function(){return K.prototype}();var S=new K;S.augment({...m,...Ht,...u,equals:_t});var x=class{static parseQueryString(t,e){typeof t!="string"&&(t=window.location.search);let r={},n=/([^?=&]+)(=([^&]*))?/g;return t.replace(n,function(i,o,a,c){r[o]=e!==!1?decodeURIComponent(c):c}),r}static camelCase(t){if(typeof t!="string")return!1;let e=/(-|\s|_)+\w{1}/g;return t.replace(e,r=>r[1].toUpperCase())}static uncamelCase(t,e){if(typeof t!="string")return!1;e=e||"-";let r=/([A-Z]{1,})/g;return t.replace(r,n=>e+n.toLowerCase()).toLowerCase()}};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};S.augment({xhrSettings:It,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=m.extendClass(S.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=It}});var tt=(...s)=>new wt(s).xhr,wt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR();if(e===!1)return!1;let{method:r,url:n,async:i}=this.settings;e.open(r,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=S.xhrSettings.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")}setupParams(t,e){let r=typeof t;if(!e)return!(t instanceof FormData)&&r==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(r==="string")return n!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(n==="string"&&(e=x.parseQueryString(e,!1)),t instanceof FormData)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.append(i,e[i]);else r==="object"&&(t=m.clone(t),t=Object.assign(e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,r=t.params;return r?r=this.setupParams(r,e):e&&(r=this.setupParams(e)),r}getXhrSettings(t){let e=this.settings=Object.create(S.xhrSettings);if(t.length>=2&&typeof t[0]!="object")for(var r=0,n=t.length;r<n;r++){var i=t[r];switch(r){case 0:e.url=i;break;case 1:e.params=i;break;case 2:e.completed=i,e.failed=i;break;case 3:e.responseType=i||"json";break;case 4:e.method=i?i.toUpperCase():"POST";break;case 5:e.async=typeof i<"u"?i:!0;break}}else e=this.settings=m.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){let t=this.settings;if(!t&&typeof t.headers!="object")return;let e=t.headers;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.xhr.setRequestHeader(r,e[r])}update(t,e){let r=this.xhr,n=()=>{d.removeEvents(r.upload),d.removeEvents(r)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":if(typeof i.completed=="function"){let a=this.getResponseData();i.completed(a,this.xhr)}n();break;case"error":typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break;case"progress":typeof i.progress=="function"&&i.progress(t);break;case"abort":typeof i.aborted=="function"&&i.aborted(!1,this.xhr),n();break}}getResponseData(){let t=this.xhr,e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr,r=this.update.bind(this);d.on(["load","error","abort"],e,r),d.on("progress",e.upload,r)}};var p=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?C.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 r=document.querySelectorAll(t);return r?r.length===1?r[0]:C.toArray(r):!1}static html(t,e){return u.isObject(t)===!1?!1:u.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return u.isObject(t)===!1||u.isUndefined(e)?this:(e=x.uncamelCase(e),t.style[e]=r,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=x.uncamelCase(e);let r=t.style[e];if(r!=="")return r;let n=null,i=t.currentStyle;if(i&&(n=i[e]))r=n;else{let o=window.getComputedStyle(t,null);o&&(r=o[e])}return r}static css(t,e,r){return typeof r<"u"?(this.setCss(t,e,r),this):this.getCss(t,e)}static removeAttr(t,e){return u.isObject(t)&&t.removeAttribute(e),this}static setAttr(t,e,r){t.setAttribute(e,r)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,r){return u.isObject(t)===!1?!1:typeof r<"u"?(this.setAttr(t,e,r),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=x.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,r){e=this.removeDataPrefix(e),e=x.camelCase(e),t.dataset[e]=r}static getData(t,e){return e=x.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,r){return u.isObject(t)===!1?!1:typeof r<"u"?(this.setData(t,e,r),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?!1:t.querySelectorAll(e)}static show(t){if(u.isObject(t)===!1)return this;let e=this.data(t,"style-display"),r=typeof e=="string"?e:"";return this.css(t,"display",r),this}static hide(t){if(u.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 u.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return u.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return u.isObject(t)?t.offsetWidth:!1}static getHeight(t){return u.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,r=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,r=t.scrollTop;break;case"object":e=t.scrollLeft,r=t.scrollTop;break}return u.isObject(t)===!1?!1:{left:e-(t.clientLeft||0),top:r-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,r=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||r.clientWidth||n.clientWidth,o=t.innerHeight||r.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,r=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let r={x:0,y:0};if(u.isObject(t)===!1)return r;let n=0;for(;t&&(e===0||n<e);)n++,r.x+=t.offsetLeft+t.clientLeft,r.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return r}static addClass(t,e){if(u.isObject(t)===!1||e==="")return this;if(typeof e=="string"){let i=e.split(" ");for(var r=0,n=i.length;r<n;r++)t.classList.add(e)}return this}static removeClass(t,e){return u.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return u.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return u.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var et=class{constructor(){this.connections={}}add(t,e,r){let n=this.find(t);return n[e]=r}get(t,e){let r=this.connections[t];return r&&r[e]||!1}find(t){let e=this.connections;return e[t]||(e[t]={})}remove(t,e){let r=this.connections[t];if(!r)return!1;let n;if(e)n=r[e],n&&(n.unsubscribe(),delete r[e]),m.isEmpty(r)&&delete this.connections[t];else{for(var i in r)!Object.prototype.hasOwnProperty.call(r,i)||(n=r[i],n&&n.unsubscribe());delete this.connections[t]}}};var N=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var rt=class extends N{constructor(t){super(),this.data=t}subscribe(t,e){this.msg=t,this.token=this.data.on(t,e)}unsubscribe(){this.data.off(this.msg,this.token)}};var j=class{unsubscribe(){}};var st=class extends j{constructor(){super(),this.source=null}addSource(t){return this.source=new rt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var W=class extends N{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.off(this.msg,this.token)}callBack(){}};var nt=class extends W{constructor(t,e,r){super(r),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}};var ke=(s,t,e)=>{p.setAttr(s,t,e)},Ce=(s,t,e)=>{s.checked=s.value==e},Ae=(s,t,e)=>{e=e==1,Ut(s,t,e)},Ut=(s,t,e)=>{s[t]=e},Te=(s,t)=>p.getAttr(s,t),Oe=(s,t)=>s[t],it=class extends W{constructor(t,e,r,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof r=="string"?this.setupFilter(r):r}addSetMethod(t,e){if(e.substring(4,1)==="-"){this.setValue=ke,this.getValue=Te;return}this.getValue=Oe;let r=t.type;if(r)switch(r){case"checkbox":this.setValue=Ae;return;case"radio":this.setValue=Ce;return}this.setValue=Ut}getAttrBind(t){if(t)return t;let e="textContent",r=this.element;if(!r||typeof r!="object")return e;let n=r.tagName.toLowerCase();if(n==="input"||n==="textarea"||n==="select"){let i=r.type;if(!i)return e="value",e;switch(i){case"checkbox":e="checked";break;case"file":e="files";break;default:e="value"}}return e}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return r=>t.replace(e,r)}set(t){let e=this.element;!e||typeof e!="object"||(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t))}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){e!==this.element&&this.set(t)}};var ot=class extends j{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new it(t,e,r,this.pubSub)}addData(t,e){return this.data=new nt(t,e,this.pubSub)}unsubscribeSource(t){t&&t.unsubscribe()}unsubscribe(){this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null}};var Mt=-1,_=class{constructor(){this.callBacks={},this.lastToken=-1}get(t){let e=this.callBacks;return e[t]||(e[t]=[])}reset(){this.callBacks={},this.lastToken=-1,Mt=-1}on(t,e){let r=++Mt;return this.get(t).push({token:r,callBack:e}),r}off(t,e){let r=this.callBacks[t];if(!r)return;let n=r.length;for(var i=0;i<n;i++){var o=r[i];if(o.token===e){r.splice(i,1);break}}}remove(t){let e=this.callBacks;e[t]&&delete e[t]}publish(t){let e=this.callBacks[t]||!1;if(e===!1)return;let r=Array.prototype.slice.call(arguments,1),n=e.length;for(var i=0;i<n;i++){var o=e[i];!o||o.callBack.apply(this,r)}}};var kt=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=[20,37,38,39,40],this.connections=new et,this.pubSub=new _,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null;if(r.indexOf(":")!==-1){let f=r.split(":");f.length>1&&(i=f[1],o=f[0])}let a=this.setupConnection(t,e,i,o,n),c=a.element,h=e.get(i);return typeof h<"u"?c.set(h):(h=c.get(),h!==""&&a.data.set(h)),this}setupConnection(t,e,r,n,i){let o=this.getBindId(t),a=new ot(this.pubSub);a.addData(e,r).subscribe(o);let h=e.getDataId(),f=h+":"+r;return a.addElement(t,n,i).subscribe(f),this.addConnection(o,"bind",a),a}addConnection(t,e,r){this.connections.add(t,e,r)}setBindId(t){let e="db-"+this.idCount++;return t.dataset&&(t.dataset[this.attr]=e),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,r,n){if(u.isObject(t)===!1)return;let i=new st;i.addSource(e).subscribe(r,n);let a=this.getBindId(t),c=e.getDataId()+":"+r;this.addConnection(a,c,i);let h=e.get(r);typeof h<"u"&&n(h)}unwatch(t,e,r){if(u.isObject(t)===!1)return;let n=t[this.attr];if(n){let i=e.getDataId()+":"+r;this.connections.remove(n,i)}}publish(t,e,r){return this.pubSub.publish(t,e,r),this}isDataBound(t){if(!t)return!1;let e=t[this.attr];return e||!1}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.indexOf(t.keyCode)!==-1}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,r=this.isDataBound(e);if(r){let n=this.connections.get(r,"bind");if(n){let i=n.element.get();this.pubSub.publish(r,i,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){d.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){d.off(["change","paste","input"],document,this.changeHandler,!1)}},g=new kt;var Nt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,E={isWatching(s){return Array.isArray(s)?typeof s[0]!="string"?!1:!!this.hasParams(s[0]):this.hasParams(s)},hasParams(s){return!s||u.isString(s)===!1?!1:s.indexOf("[[")!==-1},_getWatcherProps(s){let t=/\[\[(.*?)(\[\d+\])?\]\]/g,e=s.match(t);if(e){t=/(\[\[|\]\])/g;for(var r=0,n=e.length;r<n;r++)e[r]=e[r].replace(t,"")}return e},updateAttr(s,t,e){t==="text"||t==="textContent"?s.textContent=e:t==="innerHTML"?s.innerHTML=e:t.substring(4,1)==="-"?p.setAttr(s,t,e):s[t]=e},_getWatcherCallBack(s,t,e,r,n){return()=>{let i=0,o=e.replace(Nt,function(){let a=n?t[i]:t;i++;let c=a.get(arguments[2]);return typeof c<"u"?c:""});this.updateAttr(s,r,o)}},getParentData(s){return s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null},getValue(s,t){typeof s=="string"&&(s={value:s});let e=s.value;return Array.isArray(e)===!1?[e,this.getParentData(t)]:(e.length<2&&e.push(this.getParentData(t)),e)},getPropValues(s,t,e){let r=[];for(var n=0,i=t.length;n<i;n++){var o=e?s[n]:s,a=o.get(t[n]);a=typeof a<"u"?a:"",r.push(a)}return r},getCallBack(s,t,e,r,n){let i,o=s.callBack;if(typeof o=="function"){let a=r.match(Nt),c=a&&a.length>1;i=(h,f)=>{h=c!==!0?h:this.getPropValues(e,a,n),o(h,t,f)}}else{let a=s.attr||"textContent";i=this._getWatcherCallBack(t,e,r,a,n)}return i},addDataWatcher(s,t,e){let r=this.getValue(t,e),n=r[1];if(!n)return;let i=r[0],o=Array.isArray(n),a=this.getCallBack(t,s,n,i,o),c=this._getWatcherProps(i);for(var h=0,f=c.length;h<f;h++){var k=o?n[h]:n;this.addWatcher(s,k,c[h],a)}},setup(s,t,e){if(!!t){if(Array.isArray(t)){let r=[t[0],t[1]],n=t[2];typeof n=="function"?t={value:r,callBack:n}:t={attr:n,value:[t[0],t[1]]}}this.addDataWatcher(s,t,e)}},addWatcher(s,t,e,r){g.watch(s,t,e,r)}};var De=s=>typeof s!="string"?s:jt(s),jt=s=>[{tag:"text",textContent:s}],Pe=s=>{if(!s)return{props:{},children:[]};let t=s[0];return typeof t=="string"?{props:{},children:jt(t)}:Array.isArray(t)?E.isWatching(t)===!1?{props:{},children:t}:{props:{watch:t},children:[]}:{props:t||{},children:De(s[1])}},Ee=s=>(...t)=>{let{props:e,children:r}=Pe(t);return s(e,r)};var at=s=>{let t={};if(!s||typeof s!="object")return t;s=m.clone(s);for(var e in s)if(!!Object.prototype.hasOwnProperty.call(s,e)){var r=s[e];typeof r!="function"&&(t[e]=r,delete s[e])}return t};function Wt(s,t){return s===""?(s=t,isNaN(s)?s:`[${t}]`):isNaN(t)?`${s}.${t}`:`${s}[${t}]`}function Vt(s,t="",e=""){return{get(r,n,i){if(t===""&&n in r)return r[n];let o=r[e]||r,a=Reflect.get(o,n,i);if(!u.isObject(a))return a;let c=Wt(t,n);return new Proxy(a,Vt(s,c,e))},set(r,n,i,o){if(t===""&&n in r)return r[n]=i,!0;let a=r[e]||r,c=Wt(t,n);return s.set(c,i),Reflect.set(a,n,i,o)}}}var Ft=(s,t="stage")=>new Proxy(s,Vt(s,"",t));var Be=0,H=class{constructor(t){this.dirty=!1,this.links={},this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new _;let e=at(t);return this.set(e),Ft(this)}setup(){this.stage={}}_init(){let t=++Be;this._dataNumber=t,this._id="dt-"+t,this._dataId=this._id+":"}getDataId(){return this._id}remove(){}on(t,e){let r=t+":change";return this.eventSub.on(r,e)}off(t,e){let r=t+":change";this.eventSub.off(r,e)}_setAttr(t,e,r=this){let n=this.stage[t];if(e===n)return!1;this.stage[t]=e,this._publish(t,e,r,n)}set(...t){if(typeof t[0]!="object")return this._setAttr(...t),this;let[e,r,n]=t;for(var i in e)if(!!Object.prototype.hasOwnProperty.call(e,i)){var o=e[i];typeof o!="function"&&this._setAttr(i,o,r,n)}return this}getModelData(){return this.stage}_deleteAttr(t,e){delete t[e]}toggle(t){if(!(typeof t>"u"))return this.set(t,!this.get(t)),this}increment(t){if(typeof t>"u")return;let e=this.get(t);return this.set(t,++e),this}decrement(t){if(typeof t>"u")return;let e=this.get(t);return this.set(t,--e),this}concat(t,e){if(typeof t>"u")return;let r=this.get(t);return this.set(t,r+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t){return this.key=t,this}resume(t){let e=this.key;if(!e)return this;let r,n=localStorage.getItem(e);return n===null?t&&(r=t):r=JSON.parse(n),r?(this.set(r),this):this}store(){let t=this.key;if(!t)return!1;let e=this.get();if(!e)return!1;let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}delete(t){if(typeof t<"u"){this._deleteAttr(this.stage,t);return}this.setup()}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let n=[];for(var i in e)!Object.prototype.hasOwnProperty.call(e,i)||n.push(this.remoteLink(t,i));return n}remoteLink(t,e,r){let n=r||e,i=t.get(e);typeof i<"u"&&this.get(e)!==i&&this.set(e,i);let o=t.on(e,(c,h)=>{if(h===this)return!1;this.set(n,c,t)});this.addLink(o,t);let a=this.on(n,(c,h)=>{if(h===t)return!1;t.set(e,c,this)});return t.addLink(a,this),o}addLink(t,e){this.links[t]=e}unlink(t){if(t){this.removeLink(t);return}let e=this.links;if(e.length){for(var r=0,n=e.length;r<n;r++)this.removeLink(e[r],!1);this.links=[]}}removeLink(t,e){let r=this.links[t];r&&r.off(t),e!==!1&&delete this.links[t]}};H.prototype.isData=!0;var A={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},getSegments(s){let t=this.deepDataPattern;return s.match(t)}};var T=class extends H{setup(){this.attributes={},this.stage={}}_updateAttr(t,e,r){if(!A.hasDeepData(e)){t[e]=r;return}let n,i=A.getSegments(e),o=i.length,a=o-1;for(var c=0;c<o;c++){if(n=i[c],c===a){t[n]=r;break}t[n]===void 0&&(t[n]=isNaN(n)?{}:[]),t=t[n]}}_setAttr(t,e,r,n){typeof e!="object"&&e===this.get(t)||(!r&&n!==!0?this._updateAttr(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),this._updateAttr(this.stage,t,e),r=r||this,this._publish(t,e,r))}linkAttr(t,e){let r=t.get(e);if(!!r)for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&this.link(t,e+"."+n,n)}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let n=new e(r);return n.linkAttr(this,t),n}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.push(e),this.set(t,r),this}unshift(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.unshift(e),this.set(t,r),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.shift();return this.set(t,e),r}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r){this.publish(t,e,r)}publishDeep(t,e,r){if(!A.hasDeepData(t)){this.publish(t,e,r);return}let n,i=A.getSegments(t),o=i.length,a=o-1,c="",h=this.stage;for(var f=0;f<o;f++){n=i[f],h=h[n],f>0?isNaN(n)&&(c+="."+n):c=n;var k;if(f===a)k=e;else{var P=i[f+1];if(isNaN(P)===!1){c+="["+P+"]";continue}var R={};R[P]=h[P],k=R}this.publish(c,k,r)}}publish(t,e,r){if(t=t||"",this._publishAttr(t,e,r),!e||typeof e!="object")return;let n,i;if(Array.isArray(e)){let c=e.length;for(var o=0;o<c;o++)i=e[o],n=t+"["+o+"]",this._checkPublish(n,i,r)}else for(var a in e)!Object.prototype.hasOwnProperty.call(e,a)||(i=e[a],n=t+"."+a,this._checkPublish(n,i,r))}_checkPublish(t,e,r){!e||typeof e!="object"?this._publishAttr(t,e,r):this.publish(t,e,r)}_publishAttr(t,e,r){g.publish(this._dataId+t,e,r);let n=t+":change";this.eventSub.publish(n,e,r)}mergeStage(){this.attributes=m.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e){A.hasDeepData(e)||delete t[e];let r=A.getSegments(e),n=r.length,i=n-1;for(var o=0;o<n;o++){var a=r[o],c=t[a];if(c===void 0)break;if(o===i){if(Array.isArray(t)){t.splice(a,1);break}delete t[a];break}t=c}}_getAttr(t,e){if(!A.hasDeepData(e))return t[e];let r=A.getSegments(e),n=r.length,i=n-1;for(var o=0;o<n;o++){var a=r[o],c=t[a];if(c===void 0)break;if(t=c,o===i)return t}}};var Re=(s,t)=>{if(typeof s!="string"&&(s=String(s)),t){let r=/(\n|\r\n)/g;s=s.replace(r,"\\n")}let e=/\t/g;return s.replace(e,"\\t")},Jt=(s,t)=>{if(typeof s!="string")return s;s=Re(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},Ct=(s,t)=>{let e=typeof s;if(e==="undefined")return s;if(e!=="object")return s=Jt(s),s;let r;for(var n in s)!Object.prototype.hasOwnProperty.call(s,n)||(r=s[n],r!==null&&(s[n]=typeof r=="string"?Ct(r,t):Jt(r,t)));return s};function zt(s){return typeof s<"u"&&s.length>0?JSON.parse(s):!1}function At(s){return typeof s<"u"?JSON.stringify(s):!1}var G=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?m.clone(t):t,n=Ct(r,e);return At(n)}static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};L(G,"json",{encode:At,decode:zt});var ct=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 r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=x.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=x.parseQueryString(e,!1)),this._isFormData(t))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.append(r,e[r]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let r=this.model.get("id"),n="op=get&id="+r,i=this.model;return this._get("",n,t,e,o=>{if(o){let a=this.getObject(o);a&&i.set(a)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+G.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return!1;let r="op=setup&"+this.setupObjectData();return this._put("",r,t,e)}add(t,e){if(!this.isValid())return!1;let r="op=add&"+this.setupObjectData();return this._post("",r,t,e)}update(t,e){if(!this.isValid())return!1;let r="op=update&"+this.setupObjectData();return this._patch("",r,t,e)}delete(t,e){let r=this.model.get("id"),n="op=delete&id="+r;return this._delete("",n,t,e)}all(t,e,r,n,i){i=i||"",r=isNaN(r)?0:r,n=isNaN(n)?50:n;let o="op=all&option="+i+"&start="+r+"&stop="+n;return this._get("",o,t,e)}getUrl(t){let e=this.url;return t?t[0]==="?"?e+t:e+="/"+t:e}setupRequest(t,e,r,n,i){let o={url:this.getUrl(t),method:e,params:r,completed:(c,h)=>{typeof i=="function"&&i(c),this.getResponse(c,n,h)}};return this._isFormData(r)&&(o.headers={}),tt(o)}_isFormData(t){return t instanceof FormData}request(t,e,r,n){return this._request("","POST",t,e,r,n)}_get(t,e,r,n,i){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i)}_post(t,e,r,n,i){return this._request(t,"POST",e,r,n,i)}_put(t,e,r,n,i){return this._request(t,"PUT",e,r,n,i)}_patch(t,e,r,n,i){return this._request(t,"PATCH",e,r,n,i)}_delete(t,e,r,n,i){return this._request(t,"DELETE",e,r,n,i)}_request(t,e,r,n,i,o){return r=this.setupParams(r),r=this.addParams(r,n),this.setupRequest(t,e,r,i,o)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return!1;let e=this;class r extends e{constructor(i){super(i)}}return Object.assign(r.prototype,t),r}};var Le=s=>{let t={};if(!s||typeof s!="object")return t;let e=s.defaults;if(!e)return t;for(var r in e)if(!!Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];typeof n!="function"&&(t[r]=n)}return delete s.defaults,t},_e=s=>{if(!s||typeof s.xhr!="object")return{};let t=s.xhr,e=Object.assign({},t);return delete s.xhr,e},He=0,V=class extends T{xhr=null;constructor(t){let e=super(t);return this.initialize(),e}initialize(){}static extend(t={}){let e=this,r=_e(t),n=this.prototype.service.extend(r),i=Le(t);class o extends e{constructor(c){let h=at(c);h=Object.assign({},i,h),super(h),this.xhr=new n(this)}dataTypeId="bm"+He++}return Object.assign(o.prototype,t),o.prototype.service=n,o}};V.prototype.service=ct;var O=class extends H{_publish(t,e,r,n){let i=t+":change";this.eventSub.publish(i,e,r),r=r||this,g.publish(this._dataId+t,e,r)}};var ht=class extends O{constructor(t){super(),this.id=t}addAction(t,e){typeof e<"u"&&this.set(t,e)}getState(t){return this.get(t)}removeAction(t,e){if(e){this.off(t,e);return}let r=this.stage;typeof r[t]<"u"&&delete r[t]}};var b=class{static restore(t,e){this.targets[t]=e}static getTarget(t){let e=this.targets;return e[t]||(e[t]=new ht(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,r){let n=this.getTarget(t);return e&&n.addAction(e,r),n}static addAction(t,e,r){return this.add(t,e,r)}static removeAction(t,e,r){this.off(t,e,r)}static on(t,e,r){let n=this.getTarget(t);return e?n.on(e,r):!1}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let n=this.targets,i=n[t];if(!!i){if(e){i.off(e,r);return}delete n[t]}}static set(t,e,r){this.getTarget(t).set(e,r)}};L(b,"targets",{});var ut=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(e<1)return!1;let r;for(var n=0;n<e;n++)r=t[n],this.on(...r)}on(t,e,r,n){d.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){d.off(t,e,r,n);let i,o=this.events;for(var a=0,c=o.length;a<c;a++)if(i=o[a],i.event===t&&i.obj===e){o.splice(a,1);break}}set(){let t,e=this.events;for(var r=0,n=e.length;r<n;r++)t=e[r],d.on(t.event,t.obj,t.callBack,t.capture)}unset(){let t,e=this.events;for(var r=0,n=e.length;r<n;r++)t=e[r],d.off(t.event,t.obj,t.callBack,t.capture)}reset(){this.unset(),this.events=[]}};var ft=class{constructor(t,e){this.remoteStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,n){return{action:t,state:e,callBack:r,targetId:n,token:null}}convertStates(t){let e=[];for(var r in t)if(!!Object.prototype.hasOwnProperty.call(t,r)){if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}var n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){let r;for(var n=0,i=t.length;n<i;n++)if(r=t[n],!!r){for(var o in r)if(!(!Object.prototype.hasOwnProperty.call(r,o)||o==="id")){var a=null,c=r[o],h=c!==null?c:void 0;h&&typeof h=="object"&&(a=h.callBack,h=h.state),e.push(this.createState(o,h,a,r.id))}}}removeRemoteStates(){let t=this.remoteStates;t&&this.removeActions(t)}removeActions(t){if(!(t.length<1))for(var e=0,r=t.length;e<r;e++){var n=t[e];b.remove(n.targetId,n.action,n.token)}}restore(t){b.restore();let e=this.remoteStates;if(!!e)for(var r=0,n=e.length;r<n;r++){var i=e[r];i.token=this.bindRemoteState(t,i.action,i.targetId)}}bindRemoteState(t,e,r){let n=b.getTarget(r);return t.link(n,e)}addStatesToTarget(t,e){let r=this.remoteStates;for(var n=0,i=e.length;n<i;n++){var o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}r.length<1&&(this.remoteStates=null)}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&t.on(n,o),r}};var Ie={class:"className",text:"textContent",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",celpadding:"cellPadding",useMap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Q=s=>Ie[s]||s,Tt=s=>typeof s=="string"&&s.substring(0,2)==="on"?s.substring(2):s,y=class{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(r,i):this.append(r,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return!1;let r=e.type;typeof r<"u"&&p.setAttr(t,"type",r);for(var n in e)if(!(!Object.prototype.hasOwnProperty.call(e,n)||n==="type")){var i=e[n];n==="innerHTML"?t.innerHTML=i:n.indexOf("-")!==-1?p.setAttr(t,n,i):this.addAttr(t,n,i)}}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,r){if(r===""||!e)return;if(typeof r==="function")e=Tt(e),d.add(e,t,r);else{let i=Q(e);t[i]=r}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let r=document.createTextNode(t);return e&&this.append(e,r),r}static createComment(t,e){let r=document.createComment(t);return e&&this.append(e,r),r}static setupSelectOptions(t,e,r){if(!t||typeof t!="object"||!e||!e.length)return!1;for(var n=0,i=e.length;n<i;n++){var o=e[n],a=t.options[n]=new Option(o.label,o.value);r!==null&&a.value==r&&(a.selected=!0)}}static removeElementData(t){let e=t.childNodes;if(e){let o=e.length-1;for(var r=o;r>=0;r--){var n=e[r];!n||this.removeElementData(n)}}l.remove(t),t.bindId&&g.unbind(t)}static removeElement(t){let e;return!t||!(e=t.parentNode)?this:(this.removeElementData(t),e.removeChild(t),this)}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(typeof t!="object")return this;let e=t.childNodes;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.removeElementData(e[r]);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,r){let n=r||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var Ue=s=>typeof s!="string"?s:qt(s),qt=s=>[{tag:"text",textContent:s}],Xt=s=>{if(!s)return{props:{},children:[]};let t=s[0];return typeof t=="string"?{props:{},children:qt(t)}:Array.isArray(t)?{props:{},children:t}:{props:t||{},children:Ue(s[1])}};l.addType("components",s=>{if(!s)return;let t=s.component;t&&t.rendered===!0&&t.prepareDestroy()});var Me=0,I=class{constructor(...t){this.isUnit=!0,this.init();let{props:e,children:r}=Xt(t);this.setupProps(e),this.children??=r,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Me++}setupProps(t){if(!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}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 r=e[0];!r||(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context=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.persist?this._layout||(this._layout=this.render()):this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){l.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 r=[];if(!t||t.length<1)return r;for(var n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return y.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.container=t,this.initialize()}remove(){this.prepareDestroy(),this.removeContext();let t=this.panel||this.id;y.removeElement(t)}prepareDestroy(){this.rendered=!1,this.beforeDestroy()}beforeDestroy(){}destroy(){this.remove()}};var B=class extends I{constructor(...t){super(...t),this.isComponent=!0,this.stateTargetId=null}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=b.getTarget(e)}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateHelper.restore(t);return}let e=this.setupStates();m.isEmpty(e)||(this.setupStateTarget(),this.stateHelper=new ft(this.state,e))}removeStates(){if(!this.state)return!1;this.stateHelper.removeRemoteStates(),b.remove()}setupEventHelper(){this.events||(this.events=new ut)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();if(t.length<1)return!1;this.setupEventHelper(),this.events.addEvents(t)}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.rendered=!1,this.beforeDestroy(),this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist===!1&&this.data.unlink()}};var Ne={created:"onCreated",state:"setupStates",events:"setupEevents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"},je=s=>typeof s==="function"?s:function(){return s},We=s=>{let t={};if(!s)return t;for(var e in s){if(!Object.prototype.hasOwnProperty.call(s,e))continue;let r=s[e],n=Ne[e];if(n){t[n]=je(r);continue}t[e]=r}return t},Ve=s=>{class t extends B{}return Object.assign(t.prototype,s),t},$t=s=>{class t extends I{}return Object.assign(t.prototype,s),t},U=function(s){if(!s)return null;let t;switch(typeof s){case"object":return s.render?(t=We(s),Ve(t)):(t={render(){return s}},$t(t));case"function":return t={render:s},$t(t)}};var Kt=(s,t)=>({name:s,callBack:t});var F={keys:[],items:{},add(s,t){return this.keys.push(s),this.items[s]=Kt(s,t),this},get(s){return this.items[s]||null},all(){return this.keys}};var Ot=(s,t)=>({attr:s,directive:t});var J=(s,t)=>({key:s,value:t});var Gt=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var lt=class{static getTag(t){let e="div",r=t.tag;return typeof r<"u"&&(e=r),e}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(J("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){r={attr:Q(e),value:r},t.push(Ot(J(e,r),F.get("watch")))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(J("type",n))}}static parse(t,e){let r=[],n=[],i=this.getTag(t);this.setButtonType(i,t,r),this.setupChildren(t);let o=[];var a,c;for(var h in t){if(!Object.prototype.hasOwnProperty.call(t,h)||h==="tag"||(a=t[h],a==null))continue;if((c=F.get(h))!==null){n.push(Ot(J(h,a),c));continue}let f=typeof a;if(f==="object"){if(h==="children"){o=o.concat(a);continue}if(E.isWatching(a)){this.setTextAsWatcher(n,h,a);continue}o.push(a);continue}if(f==="function"){let P=a;a=function(R){P.call(this,R,e)}}if(E.isWatching(a)){this.setTextAsWatcher(n,h,a);continue}this.setElementContent(h,a,r,o)||r.push(J(h,a))}return Gt(i,r,n,o)}};var D=class extends y{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e,n),r.appendChild(i),i}static addAttributes(t,e,r){let n;if(!(!e||(n=e.length)<1))for(var i=0;i<n;i++){var o=e[i],a=o.key,c=o.value;if(a==="innerHTML"){t.innerHTML=c;continue}if(a.substr(4,1)==="-"){p.setAttr(t,a,c);continue}this.addAttr(t,a,c,r)}}static addAttr(t,e,r,n){if(r===""||!e)return!1;if(typeof r==="function")e=Tt(e),d.add(e,t,function(o){r.call(this,o,n)});else{let o=Q(e);t[o]=r}}static addContent(t,e){!e||(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var z=class{createNode(t,e,r){}};var dt=class extends z{createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return D.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return D.createComment(o,e)}return D.create(n,t.attr,e,r)}};var pt=class extends z{createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:""}else if(n==="comment"){let i=t.attr[0],o=i?i.value:""}}};var mt=class{static browserIsSupported(){return window}static setup(){return this.browserIsSupported()?new dt:new pt}};var Fe=mt.setup(),v=class{static render(t,e,r){if(!t)return;let n,i;switch(typeof t){case"object":if(t.isUnit===!0)return this.createComponent(t,e,r),t;default:return n=U(t),i=new n,this.createComponent(i,e,r),i}}static build(t,e,r){let n=D.createDocFragment();if(Array.isArray(t))for(var i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}static rebuild(t,e,r){return D.removeAll(e),this.build(t,e,r)}static buildElement(t,e,r){if(!!t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}static createElement(t,e,r){let n=lt.parse(t,r),i=this.createNode(n,e,r);this.cache(i,t.cache,r);let o=n.children;if(o.length>0){let f;for(var a=0,c=o.length;a<c;a++)f=o[a],f!==null&&this.buildElement(f,i,r)}let h=n.directives;h&&h.length&&this.setDirectives(i,h,r)}static setDirectives(t,e,r){for(var n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],r)}static handleDirective(t,e,r){e.directive.callBack(t,e.attr.value,r)}static cache(t,e,r){r&&e&&(r[e]=t)}static createComponent(t,e,r){let n=t;n.parent=r,r&&r.persist===!0&&n.persist!==!1&&(n.persist=!0),n.cache&&r&&(r[n.cache]=n),n.setup(e);let i=n.prepareLayout();this.build(i,n.container,n),n.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(n)}static createNode(t,e,r){return Fe.createNode(t,e,r)}};S.augment({buildLayout(s,t,e){v.build(s,t,e)}});var Pt=[],Je=s=>Pt.indexOf(s)!==-1,ze=s=>({tag:"script",src:s.src,async:!1,load(t){Pt.push(s.src);let e=s.load;e&&e()}}),qe=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){Pt.push(s.src);let e=s.load;e&&e()}}),Dt=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=qe({load:r,src:t}):e=ze({load:r,src:t}),v.build(e,document.head)}addFiles(t){if(!!t)for(var e=0,r=t.length;e<r;e++){var n=t[e];Je(n)||this.add(n)}}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)}},Xe=(s,t)=>{import(s).then(e=>{t&&t(e)})},$e=s=>s?typeof s?.prototype?.constructor=="function":!1,Ke=(s,t,e)=>{let r=v.build(s,null,e),n=r.firstChild;return t.after(r),n},Ge=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),Qe=U({render(){return Ge({onCreated:s=>{if(!!this.src){if(this.depends){new Dt(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},getLayout(s){let t=s.default;if(!t)return null;let e=this.callBack;return e?t=e(t):$e(t)?(t=new t,t.route=this.route,this.persist&&(t.persist=!0)):t=t(),this.layout=t},loadAndRender(s){Xe(this.src,t=>{this.loaded=!0;let e=this.layout||this.getLayout(t);this.layoutRoot=Ke(e,s,this.parent)})},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},beforeDestroy(){!this.layoutRoot||y.removeElement(this.layoutRoot)}}),Et=s=>new Qe(s);var Qt=(s,t,e)=>{!t||t&&p.setAttr(s,"role",t)},Ye=s=>(t,e)=>{let r=e?"true":"false";p.setAttr(t,s,r)},Yt=(s,t,e)=>{if(!t)return;let r=t.role;r&&(p.setAttr(s,"role",r),t.role=null);for(var n in t)if(!(!Object.prototype.hasOwnProperty.call(t,n)||t[n]===null)){var i=t[n],o="aria-"+n;Array.isArray(i)?(i.push(Ye(o)),(void 0).onSet(s,i,e)):p.setAttr(s,o,i)}};l.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var Bt=s=>s?s.getContext():null,Zt=(s,t,e)=>{if(typeof t!="function")return;let r=Bt(e),n=t(r);!n||((void 0)._addElementAttrs(s,n,e),(void 0).addElementDirectives(s,n,e))},te=(s,t,e)=>{if(typeof t!="function")return;let r=Bt(e);t(r)},ee=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=Bt(e),n=t(r);!n||e.addContextBranch(n[0],n[1])};var re=(s,t,e)=>{!t||!e||(e[t]=s)},se=(s,t,e)=>{if(!t||!e)return!1;t(e,s)},ne=(s,t,e)=>{if(!t||!e)return!1;t(e.data,s)},ie=(s,t,e)=>{if(!t||!e)return!1;t(e.state,s)},oe=(s,t,e)=>{if(!t||!e)return!1;if(e.stateHelper){let r=e.state,n=t(r);e.stateHelper.addStates(n)}};var M=s=>s.data?s.data:s.context&&s.context.data?s.context.data:null;var ae=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=M(e),!r)return!1;n=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=M(e);if(o)t.unshift(o);else return!1}[r,n,i]=t}g.bind(s,r,n,i)};var ce=(s,t,e)=>{let r,n,i,o;if(t.length<3){let c=M(e);if(!c)return;r=c,n=t[0],i=t[1],o=t[2]}else r=t[0],n=t[1],i=t[2],o=t[3];let a=o!==!1;g.watch(s,r,n,c=>{if(y.removeAll(s),!c||c.length<1)return;let h=[];for(var f=0,k=c.length;f<k;f++){var P=a?r.scope(n+"["+f+"]"):null,R=i(c[f],f,P);R!==null&&h.push(R)}return(void 0).build(h,s,e)})};var he=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(var o=0,a=r.length;o<a;o++){var c=r[o];if(!!c){var h=n(c,o);h!==null&&i.push(h)}}return v.build(i,s,e)};var ue=(s,t,e)=>{t(s)};l.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele)});var fe=(s,t,e)=>{Ze(s,t)},Ze=(s,t)=>{l.add(s,"destroyed",{ele:s,callBack:t})};var Y=(s,t,e,r)=>{let n,i,o;if(Array.isArray(e[0])){for(var a=0,c=e.length;a<c;a++){var h=e[a];!h||Y(s,t,h,r)}return}if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return!1;switch(typeof i){case"object":o=f=>{rr(s,i,f)};break;case"function":o=f=>{tr(s,i,n,f,r)};break}g.watch(s,t,n,o)},tr=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(n&&i&&i.isUnit===!0&&n.persist===!0&&n.state){let o=e+":"+r,a=n.state,c=a.get(o);typeof c<"u"&&(i=c),a.set(o,i)}er(i,s,n);break;case"string":y.addHtml(s,i);break}},er=(s,t,e)=>{v.rebuild(s,t,e)},rr=(s,t,e)=>{for(var r in t)!Object.prototype.hasOwnProperty.call(t,r)||!r||(t[r]===e?p.addClass(s,r):p.removeClass(s,r))};var le=(s,t,e)=>{let r=M(e);Y(s,r,t,e)};var de=(s,t,e)=>{Y(s,e.state,t,e)};var pe=(s,t,e)=>{if(!t)return!1;if(Array.isArray(t)&&typeof t[0]!="string")for(var r=0,n=t.length;r<n;r++)E.setup(s,t[r],e);else E.setup(s,t,e)};var sr=0,q=class{constructor(t){this.router=t,this.locationId="base-app-router-"+sr++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}};var gt=class extends q{addEvent(){return d.on("popstate",window,this.callBack),this}removeEvent(){return d.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)}createState(t,e){let r={location:this.locationId,uri:t};return e&&typeof e=="object"&&(r=Object.assign(r,e)),r}addState(t,e,r=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return this;let o=this.createState(t,e);return n[r===!1?"pushState":"replaceState"](o,null,t),this}};var yt=class extends q{addEvent(){return d.on("hashchange",window,this.callBack),this}removeEvent(){return d.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,r){return window.location.hash=t,this}};var X=class{static browserIsSupported(){return"history"in window&&"pushState"in window.history}static setup(t){return X.browserIsSupported()?new gt(t).setup():new yt(t).setup()}};var vt=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.setupTemplate()}focus(t){this.setup===!1&&this.create(),this.update(t)}setupTemplate(){let t=this.template;if(typeof t=="string"&&(t=this.template=window[t],!t))return;let e=typeof t;if(e==="function")this.component=new this.template({route:this.route,persist:this.persist,parent:this.parent});else if(e==="object"){this.template.isUnit||(this.template=U(this.template));let r=this.component=this.template,n=r.persist!==!1;r.route=this.route,r.persist=n,r.parent=this.parent,this.persist=n}this.hasTemplate=!0}create(){if(!this.hasTemplate)return!1;this.setup=!0;let t=this.component;(!this.persist||!t)&&(t=this.component=this.template),v.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return!1;this.setup=!1;let t=this.component;if(!t)return!1;typeof t.destroy=="function"&&t.destroy(),this.persist===!1&&(this.component=null)}update(t){let e=this.component;if(!e)return!1;typeof e.update=="function"&&e.update(t)}};var nr=s=>{let t="";if(s){let e=/\//g;t=s.replace(e,"/");let r=/(\/):[^/(]*?\?/g;t=t.replace(r,a=>{let c=/\//g;return a.replace(c,"(?:$|/)")});let n=/(:[^/?&($]+)/g,i=/(\?\/+\*?)/g;t=t.replace(i,"?/*"),t=t.replace(n,a=>a.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)");let o=/(\*)/g;t=t.replace(o,".*")}return t+=s[s.length-1]==="*"?"":"$",t},ir=s=>{if(!s.length)return null;let t={};for(var e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},or=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);if(n===null)return t;for(var i=0,o=n.length;i<o;i++){var a=n[i];a&&(a=a.replace(":",""),t.push(a))}return t},ar=0,xt=class extends O{constructor(t,e){let r=t.baseUri,n=or(r),i=ir(n),o=super(i);return this.uri=r,this.paramKeys=n,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setupRoute(t){this.id=t.id||"bs-rte-"+ar++,this.path=null,this.referralPath=null;let e=nr(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title}setTitle(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?(typeof e=="string"&&(e={src:e}),Et(e)):null}setupComponentHelper(t){let e=this.getLayout(t);if(e){let{container:r,persist:n=!1,parent:i}=t,o={component:e,container:r,persist:n,parent:i};this.controller=new vt(this,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 r=this.controller;r&&r.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];!i||this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);!e||e.scrollIntoView(!0)}match(t){let e=!1,r=t.match(this.uriQuery);return r===null?(this.resetParams(),e):(r&&typeof r=="object"&&(r.shift(),e=r,this.setParams(r)),e)}resetParams(){this.stage={}}setParams(t){if(!t||typeof t!="object")return;let e=this.paramKeys;if(!e)return;let r={};for(var n=0,i=e.length;n<i;n++){var o=e[n];typeof o<"u"&&(r[o]=t[n])}this.set(r)}getParams(){return this.stage}};var cr=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},hr=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r],i=new RegExp(":"+r,"gi");s=s.replace(i,n)}return s},me=(s,t,e)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=hr(t,s),t=cr(t),e!==""&&(t+=" - "+e),t);var ge={removeSlashes(s){return typeof s=="string"&&(s.substring(0,1)==="/"&&(s=s.substring(1)),s.substring(-1)==="/"&&(s=s.substring(0,s.length-1))),s}};var bt=class extends B{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",className:this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),children:this.children,watch:r}}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact!==!1,n=w.data,i=[];return t&&typeof t=="object"&&i.push({attr:"href",value:t}),e&&typeof e=="object"&&i.push({attr:"text",value:e}),i.push({value:["[[path]]",n],callBack:(o,a)=>{let c=a.pathname+a.hash,h=r?o===c:new RegExp("^"+a.pathname+"($|#|/|\\.).*").test(o);this.update(a,h)}}),i}setupStates(){return{selected:!1}}update(t,e){this.state.set("selected",e)}};l.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&w.removeRoute(t)});l.addType("switch",s=>{if(!s)return!1;let t=s.id;w.removeSwitch(t)});var Rt=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.history=null,this.callBackLink=null,this.location=window.location,this.routes=[],this.switches={},this.switchCount=0,this.data=new T({path:""})}setupHistory(){this.history=X.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new xt(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.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()+ge.removeSlashes(t)}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(var n=0;n<r;n++){var i=e[n];if(i.uri===t)return i}return!1}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(var n=0;n<r;n++){var i=e[n];if(i.id===t)return i}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(var n=0,i=t.length;n<i;n++){var o=this.createRoute(t[n]);r.push(o)}return this.checkGroup(r,this.getPath()),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);for(var i=0,o=t.length;i<o;i++){var a=t[i].component.route;a.resume(e),n.push(a)}return this.checkGroup(n,this.getPath()),r}getSwitchGroup(t){return this.switches[t]=[]}removeSwitch(t){let e=this.switches;e[t]&&delete e[t]}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e!==!1&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.set("path",this.getPath()),this.callBackLink=this.checkLink.bind(this),d.on("click",document,this.callBackLink);let r=this.getEndPoint();return this.navigate(r,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){let e=t.parentNode;for(;e!==null;){if(e.nodeName.toLowerCase()==="a")return e;e=e.parentNode}return!1}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target||t.srcElement;if(e.nodeName.toLowerCase()!=="a"&&(e=this.getParentLink(e),e===!1)||e.target==="_blank"||p.data(e,"cancel-route"))return!0;let r=e.getAttribute("href");if(typeof r<"u"){let n=this.baseURI,i=n!=="/"?r.replace(n,""):r;return this.navigate(i),t.preventDefault(),t.stopPropagation(),!1}}reset(){return this.routes=[],this.switches=[],this.switchCount=0,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.activate(),this}updatePath(){let t=this.getPath();this.data.set("path",t)}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=me(t,e,this.title)}checkActiveRoutes(t){this.lastPath=this.path,t=t||this.getPath(),this.path=t;let e=this.routes,r=e.length,n;for(var i=0;i<r;i++)n=e[i],!(typeof n>"u")&&this.checkRoute(n,t);this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(var r in e)if(!!Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];this.checkGroup(n,t)}}checkGroup(t,e){let r=!1,n,i,o,a,c=!1;for(var h=0,f=t.length;h<f;h++)if(n=t[h],!(typeof n>"u")){if(h===0&&(i=n),!o&&n.get("active")&&(o=n),r!==!1){c&&n.deactivate();continue}r=n.match(e),r!==!1&&(a=n,n.controller&&(this.select(n),c=!0))}if(a===void 0){this.select(i),o&&i!==o&&o.deactivate();return}o?c&&a!==o&&o.deactivate():i&&c===!1&&this.select(i)}checkRoute(t,e){let r=this.check(t,e);return r!==!1?this.select(t):t.deactivate(),r}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t){if(!t)return!1;t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t)}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){d.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}},w=new Rt;var ve=(s,t,e)=>{if(!t)return!1;if(Array.isArray(t))for(var r=0,n=t.length;r<n;r++)ye(s,t[r],e);else ye(s,t,e)},ye=(s,t,e)=>{t.container=s,t.parent=e;let r=w.add(t);ur(s,r)},ur=(s,t)=>{l.add(s,"routes",{route:t})};var xe=(s,t,e)=>{let r=t[0];for(var n=0,i=t.length;n<i;n++)r=t[n],r.container=s,r.parent=e;let o=w.addSwitch(t);fr(s,o)},fr=(s,t)=>{l.add(s,"switch",{id:t})};F.add("cache",re).add("onCreated",ue).add("onDestroyed",fe).add("bind",ae).add("onSet",le).add("onState",de).add("watch",pe).add("useParent",se).add("useData",ne).add("useState",ie).add("addState",oe).add("map",he).add("for",ce).add("useContext",te).add("addContext",ee).add("context",Zt).add("role",Qt).add("aria",Yt).add("route",ve).add("switch",xe);S.augment({Ajax:tt,Html:y,dataBinder:g,Data:T,SimpleData:O,Model:V,State:b,Builder:v,router:w,Component:B});export{tt as Ajax,Ee as Atom,v as Builder,B as Component,T as Data,l as DataTracker,F as Directives,y as Html,Et as Import,U as Jot,V as Model,bt as NavLink,O as SimpleData,b as State,I as Unit,S as base,g as dataBinder,w as router};
1
+ var xe=Object.defineProperty;var ke=(s,t,e)=>t in s?xe(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var L=(s,t,e)=>(ke(s,typeof t!="symbol"?t+"":t,e),e);var k=class{static toArray(t){return Array.prototype.slice.call(t)}static inArray(t,e,r){return!t||typeof t!="object"?-1:t.indexOf(e,r)}};var u=class{static getType(t){let e=typeof t;return e!=="object"?e:this.isArray(t)?"array":e}static isUndefined(t){return typeof t>"u"}static isObject(t){return t&&typeof t=="object"&&this.isArray(t)===!1}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var m={create(s){return Object.create(s)},extendObject(s,t){if(typeof s>"u"||typeof t>"u")return!1;for(var e in s)Object.prototype.hasOwnProperty.call(s,e)&&typeof t[e]>"u"&&(t[e]=s[e]);return t},clone(s){return s?JSON.parse(JSON.stringify(s)):{}},getClassObject(s){return typeof s=="function"?s.prototype:s},extendClass(s,t){let e=this.getClassObject(s),r=this.getClassObject(t);if(typeof e!="object"||typeof r!="object")return!1;let n=Object.create(e);for(var i in r)n[i]=r[i];return n},isEmpty(s){if(u.isObject(s)===!1)return!0;for(var t in s)if(Object.prototype.hasOwnProperty.call(s,t))return!1;return!0}};var X={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||!1},remove(s){delete this.types[s]}};var Z=class{constructor(){this.types={}}add(t,e){(this.types[t]||(this.types[t]=[])).push(e)}get(t){return this.types[t]||!1}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){let e=this.types;if(!e)return;let r=e[t];if(!r.length)return;let n,i=X.get(t);for(var o=0,a=r.length;o<a;o++)n=r[o],n&&(r[o]=null,this.removeByCallBack(i,n));delete e[r]}remove(t){if(t)this.removeType(t);else{let r=this.types;for(var e in r)if(Object.prototype.hasOwnProperty.call(r,e)){if(t=r[e],!t)continue;this.removeType(e)}delete this.types}}};var l=class{static addType(t,e){X.add(t,e)}static removeType(t){X.remove(t)}static getTrackingId(t){return t.trackingId||(t.trackingId="dt"+this.trackingCount++)}static add(t,e,r){let n=this.getTrackingId(t);this.find(n).add(e,r)}static get(t,e){let r=t.trackingId,n=this.trackers[r];return n?e?n.get(e):n:!1}static find(t){let e=this.trackers;return e[t]||(e[t]=new Z)}static isEmpty(t){if(!t||typeof t!="object")return!0;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}static remove(t,e){let r=t.trackingId;if(!r)return!0;let n=this.trackers[r];if(!n)return!1;e?(n.remove(e),this.isEmpty(n.types)&&delete this.trackers[r]):(n.remove(),delete this.trackers[r])}};L(l,"trackers",{}),L(l,"trackingCount",0);var kt=s=>{let t=0;for(var e in s)!Object.prototype.hasOwnProperty.call(s,e)||(t++,typeof s[e]=="object"&&(t+=kt(s[e])));return t},Lt=(s,t)=>{let e=!1;if(typeof s!="object"||typeof t!="object")return e;for(var r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||!Object.prototype.hasOwnProperty.call(t,r))break;let n=s[r],i=t[r];if(typeof n!=typeof i)break;if(typeof n=="object"){if(e=Lt(n,i),e!==!0)break}else if(n===i)e=!0;else break}return e},we=(s,t)=>{let e=kt(s),r=kt(t);return e!==r?!1:Lt(s,t)},Rt=(s,t)=>{let e=typeof s;return e!==typeof t?!1:e==="object"?we(s,t):s===t};var p={getEvents(s){return u.isObject(s)===!1?!1:l.get(s,"events")},create(s,t,e,r=!1,n=!1,i=null){return n=n===!0,{event:s,obj:t,fn:e,capture:r,swapped:n,originalFn:i}},on(s,t,e,r){if(Array.isArray(s)){let o;for(var n=0,i=s.length;n<i;n++)o=s[n],this.add(o,t,e,r)}else this.add(s,t,e,r);return this},off(s,t,e,r){if(Array.isArray(s))for(var n,i=0,o=s.length;i<o;i++)n=s[i],this.remove(n,t,e,r);else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,n=!1,i=null){if(u.isObject(t)===!1)return this;let o=this.create(s,t,e,r,n,i);return l.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let n=this.getEvent(s,t,e,r);return n===!1?this:(typeof n=="object"&&this.removeEvent(n),this)},removeEvent(s){return typeof s=="object"&&s.obj.removeEventListener(s.event,s.fn,s.capture),this},getEvent(s,t,e,r){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(s,t,e,r);return this.search(i,n)},search(s,t){let e,r=this.isSwappable(s.event);for(var n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==s.event||e.obj!==s.obj)&&(e.fn===s.fn||r===!0&&e.originalFn===s.fn))return e;return!1},removeEvents(s){return u.isObject(s)===!1?this:(l.remove(s,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(s){this.swap.push(s)},isSwappable(s){return k.inArray(this.swap,s)>-1}};l.addType("events",s=>{p.removeEvent(s)});var Ht={events:p,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let n=this.events;if(Array.isArray(s)){let a;for(var i=0,o=s.length;i<o;i++)a=s[i],n.add(a,t,e,r)}else n.add(s,t,e,r);return this},off(s,t,e,r){let n=this.events;if(Array.isArray(s))for(var i,o=0,a=s.length;o<a;o++)i=s[o],n.remove(i,t,e,r);else n.remove(s,t,e,r);return this},removeListener(s,t,e,r){return this.events.remove(s,t,e,r),this},_createEvent(s,t,e,r){let n;return t==="HTMLEvents"?n=new Event(s):t==="MouseEvents"?n=new MouseEvent(s,e):n=new CustomEvent(s,r),n},createEvent(s,t,e,r){if(u.isObject(t)===!1)return!1;let n={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};u.isObject(e)&&(n=Object.assign(n,e));let i=this._getEventType(s);return this._createEvent(s,i,n,r)},_getEventType(s){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,r="CustomEvent";for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&(e=t[n],s.match(e))){r=n;break}return r},trigger(s,t,e){if(u.isObject(t)===!1)return this;let r=typeof s=="string"?this.createEvent(s,t,null,e):s;return t.dispatchEvent(r),this},mouseWheelEventType:null,getWheelEventType(){let s=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=s())},onMouseWheel(s,t,e,r){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof s=="function"&&s(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,r,!0,s),this},offMouseWheel(s,t,e){typeof t>"u"&&(t=window);let r=this.getWheelEventType();return this.off(r,t,s,e),this},preventDefault(s){return typeof s.preventDefault=="function"?s.preventDefault():s.returnValue=!1,this},stopPropagation(s){return typeof s.stopPropagation=="function"?s.stopPropagation():s.cancelBubble=!0,this}};var $=class{constructor(){this.version="3.0.4",this.errors=[],this.dataTracker=l}augment(t){if(!t||typeof t!="object")return this;let e=this.constructor.prototype;for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,n){return(t[e]=r).apply(t,k.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(u.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof r<"u"?r:""}createCallBack(t,e,r,n){return typeof e!="function"?!1:(r=r||[],function(...i){return n===!0&&(r=r.concat(i)),e.apply(t,r)})}bind(t,e){return e.bind(t)}};$.prototype.extend=function(){return $.prototype}();var w=new $;w.augment({...m,...Ht,...u,equals:Rt});var b=class{static parseQueryString(t,e){typeof t!="string"&&(t=window.location.search);let r={},n=/([^?=&]+)(=([^&]*))?/g;return t.replace(n,function(i,o,a,c){r[o]=e!==!1?decodeURIComponent(c):c}),r}static camelCase(t){if(typeof t!="string")return!1;let e=/(-|\s|_)+\w{1}/g;return t.replace(e,r=>r[1].toUpperCase())}static uncamelCase(t,e){if(typeof t!="string")return!1;e=e||"-";let r=/([A-Z]{1,})/g;return t.replace(r,n=>e+n.toLowerCase()).toLowerCase()}};var _t={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};w.augment({xhrSettings:_t,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=m.extendClass(w.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=_t}});var tt=(...s)=>new wt(s).xhr,wt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR();if(e===!1)return!1;let{method:r,url:n,async:i}=this.settings;e.open(r,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=w.xhrSettings.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")}setupParams(t,e){let r=typeof t;if(!e)return!(t instanceof FormData)&&r==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(r==="string")return n!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(n==="string"&&(e=b.parseQueryString(e,!1)),t instanceof FormData)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.append(i,e[i]);else r==="object"&&(t=m.clone(t),t=Object.assign(e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,r=t.params;return r?r=this.setupParams(r,e):e&&(r=this.setupParams(e)),r}getXhrSettings(t){let e=this.settings=Object.create(w.xhrSettings);if(t.length>=2&&typeof t[0]!="object")for(var r=0,n=t.length;r<n;r++){var i=t[r];switch(r){case 0:e.url=i;break;case 1:e.params=i;break;case 2:e.completed=i,e.failed=i;break;case 3:e.responseType=i||"json";break;case 4:e.method=i?i.toUpperCase():"POST";break;case 5:e.async=typeof i<"u"?i:!0;break}}else e=this.settings=m.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){let t=this.settings;if(!t&&typeof t.headers!="object")return;let e=t.headers;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.xhr.setRequestHeader(r,e[r])}update(t,e){let r=this.xhr,n=()=>{p.removeEvents(r.upload),p.removeEvents(r)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":if(typeof i.completed=="function"){let a=this.getResponseData();i.completed(a,this.xhr)}n();break;case"error":typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break;case"progress":typeof i.progress=="function"&&i.progress(t);break;case"abort":typeof i.aborted=="function"&&i.aborted(!1,this.xhr),n();break}}getResponseData(){let t=this.xhr,e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr,r=this.update.bind(this);p.on(["load","error","abort"],e,r),p.on("progress",e.upload,r)}};var d=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?k.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 r=document.querySelectorAll(t);return r?r.length===1?r[0]:k.toArray(r):!1}static html(t,e){return u.isObject(t)===!1?!1:u.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return u.isObject(t)===!1||u.isUndefined(e)?this:(e=b.uncamelCase(e),t.style[e]=r,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=b.uncamelCase(e);let r=t.style[e];if(r!=="")return r;let n=null,i=t.currentStyle;if(i&&(n=i[e]))r=n;else{let o=window.getComputedStyle(t,null);o&&(r=o[e])}return r}static css(t,e,r){return typeof r<"u"?(this.setCss(t,e,r),this):this.getCss(t,e)}static removeAttr(t,e){return u.isObject(t)&&t.removeAttribute(e),this}static setAttr(t,e,r){t.setAttribute(e,r)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,r){return u.isObject(t)===!1?!1:typeof r<"u"?(this.setAttr(t,e,r),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=b.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,r){e=this.removeDataPrefix(e),e=b.camelCase(e),t.dataset[e]=r}static getData(t,e){return e=b.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,r){return u.isObject(t)===!1?!1:typeof r<"u"?(this.setData(t,e,r),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?!1:t.querySelectorAll(e)}static show(t){if(u.isObject(t)===!1)return this;let e=this.data(t,"style-display"),r=typeof e=="string"?e:"";return this.css(t,"display",r),this}static hide(t){if(u.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 u.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return u.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return u.isObject(t)?t.offsetWidth:!1}static getHeight(t){return u.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,r=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,r=t.scrollTop;break;case"object":e=t.scrollLeft,r=t.scrollTop;break}return u.isObject(t)===!1?!1:{left:e-(t.clientLeft||0),top:r-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,r=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||r.clientWidth||n.clientWidth,o=t.innerHeight||r.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,r=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let r={x:0,y:0};if(u.isObject(t)===!1)return r;let n=0;for(;t&&(e===0||n<e);)n++,r.x+=t.offsetLeft+t.clientLeft,r.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return r}static addClass(t,e){if(u.isObject(t)===!1||e==="")return this;if(typeof e=="string"){let i=e.split(" ");for(var r=0,n=i.length;r<n;r++)t.classList.add(e)}return this}static removeClass(t,e){return u.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return u.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return u.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var et=class{constructor(){this.connections={}}add(t,e,r){let n=this.find(t);return n[e]=r}get(t,e){let r=this.connections[t];return r&&r[e]||!1}find(t){let e=this.connections;return e[t]||(e[t]={})}remove(t,e){let r=this.connections[t];if(!r)return!1;let n;if(e)n=r[e],n&&(n.unsubscribe(),delete r[e]),m.isEmpty(r)&&delete this.connections[t];else{for(var i in r)!Object.prototype.hasOwnProperty.call(r,i)||(n=r[i],n&&n.unsubscribe());delete this.connections[t]}}};var U=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var rt=class extends U{constructor(t){super(),this.data=t}subscribe(t,e){this.msg=t,this.token=this.data.on(t,e)}unsubscribe(){this.data.off(this.msg,this.token)}};var j=class{unsubscribe(){}};var st=class extends j{constructor(){super(),this.source=null}addSource(t){return this.source=new rt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var W=class extends U{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.off(this.msg,this.token)}callBack(){}};var nt=class extends W{constructor(t,e,r){super(r),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}};var Se=(s,t,e)=>{d.setAttr(s,t,e)},De=(s,t,e)=>{s.checked=s.value==e},Te=(s,t,e)=>{e=e==1,Nt(s,t,e)},Nt=(s,t,e)=>{s[t]=e},Ae=(s,t)=>d.getAttr(s,t),Ce=(s,t)=>s[t],it=class extends W{constructor(t,e,r,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof r=="string"?this.setupFilter(r):r}addSetMethod(t,e){if(e.substring(4,1)==="-"){this.setValue=Se,this.getValue=Ae;return}this.getValue=Ce;let r=t.type;if(r)switch(r){case"checkbox":this.setValue=Te;return;case"radio":this.setValue=De;return}this.setValue=Nt}getAttrBind(t){if(t)return t;let e="textContent",r=this.element;if(!r||typeof r!="object")return e;let n=r.tagName.toLowerCase();if(n==="input"||n==="textarea"||n==="select"){let i=r.type;if(!i)return e="value",e;switch(i){case"checkbox":e="checked";break;case"file":e="files";break;default:e="value"}}return e}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return r=>t.replace(e,r)}set(t){let e=this.element;!e||typeof e!="object"||(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t))}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){e!==this.element&&this.set(t)}};var ot=class extends j{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new it(t,e,r,this.pubSub)}addData(t,e){return this.data=new nt(t,e,this.pubSub)}unsubscribeSource(t){t&&t.unsubscribe()}unsubscribe(){this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null}};var It=-1,R=class{constructor(){this.callBacks={},this.lastToken=-1}get(t){let e=this.callBacks;return e[t]||(e[t]=[])}reset(){this.callBacks={},this.lastToken=-1,It=-1}on(t,e){let r=++It;return this.get(t).push({token:r,callBack:e}),r}off(t,e){let r=this.callBacks[t];if(!r)return;let n=r.length;for(var i=0;i<n;i++){var o=r[i];if(o.token===e){r.splice(i,1);break}}}remove(t){let e=this.callBacks;e[t]&&delete e[t]}publish(t){let e=this.callBacks[t]||!1;if(e===!1)return;let r=Array.prototype.slice.call(arguments,1),n=e.length;for(var i=0;i<n;i++){var o=e[i];!o||o.callBack.apply(this,r)}}};var St=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=[20,37,38,39,40],this.connections=new et,this.pubSub=new R,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null;if(r.indexOf(":")!==-1){let f=r.split(":");f.length>1&&(i=f[1],o=f[0])}let a=this.setupConnection(t,e,i,o,n),c=a.element,h=e.get(i);return typeof h<"u"?c.set(h):(h=c.get(),h!==""&&a.data.set(h)),this}setupConnection(t,e,r,n,i){let o=this.getBindId(t),a=new ot(this.pubSub);a.addData(e,r).subscribe(o);let h=e.getDataId(),f=h+":"+r;return a.addElement(t,n,i).subscribe(f),this.addConnection(o,"bind",a),a}addConnection(t,e,r){this.connections.add(t,e,r)}setBindId(t){let e="db-"+this.idCount++;return t.dataset&&(t.dataset[this.attr]=e),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,r,n){if(u.isObject(t)===!1)return;let i=new st;i.addSource(e).subscribe(r,n);let a=this.getBindId(t),c=e.getDataId()+":"+r;this.addConnection(a,c,i);let h=e.get(r);typeof h<"u"&&n(h)}unwatch(t,e,r){if(u.isObject(t)===!1)return;let n=t[this.attr];if(n){let i=e.getDataId()+":"+r;this.connections.remove(n,i)}}publish(t,e,r){return this.pubSub.publish(t,e,r),this}isDataBound(t){if(!t)return!1;let e=t[this.attr];return e||!1}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.indexOf(t.keyCode)!==-1}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,r=this.isDataBound(e);if(r){let n=this.connections.get(r,"bind");if(n){let i=n.element.get();this.pubSub.publish(r,i,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){p.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){p.off(["change","paste","input"],document,this.changeHandler,!1)}},g=new St;var Ut=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,E={isWatching(s){return Array.isArray(s)?typeof s[0]!="string"?!1:!!this.hasParams(s[0]):this.hasParams(s)},hasParams(s){return!s||u.isString(s)===!1?!1:s.indexOf("[[")!==-1},_getWatcherProps(s){let t=/\[\[(.*?)(\[\d+\])?\]\]/g,e=s.match(t);if(e){t=/(\[\[|\]\])/g;for(var r=0,n=e.length;r<n;r++)e[r]=e[r].replace(t,"")}return e},updateAttr(s,t,e){t==="text"||t==="textContent"?s.textContent=e:t==="innerHTML"?s.innerHTML=e:t.substring(4,1)==="-"?d.setAttr(s,t,e):s[t]=e},_getWatcherCallBack(s,t,e,r,n){return()=>{let i=0,o=e.replace(Ut,function(){let a=n?t[i]:t;i++;let c=a.get(arguments[2]);return typeof c<"u"?c:""});this.updateAttr(s,r,o)}},getParentData(s){return s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null},getValue(s,t){typeof s=="string"&&(s={value:s});let e=s.value;return Array.isArray(e)===!1?[e,this.getParentData(t)]:(e.length<2&&e.push(this.getParentData(t)),e)},getPropValues(s,t,e){let r=[];for(var n=0,i=t.length;n<i;n++){var o=e?s[n]:s,a=o.get(t[n]);a=typeof a<"u"?a:"",r.push(a)}return r},getCallBack(s,t,e,r,n){let i,o=s.callBack;if(typeof o=="function"){let a=r.match(Ut),c=a&&a.length>1;i=(h,f)=>{h=c!==!0?h:this.getPropValues(e,a,n),o(h,t,f)}}else{let a=s.attr||"textContent";i=this._getWatcherCallBack(t,e,r,a,n)}return i},addDataWatcher(s,t,e){let r=this.getValue(t,e),n=r[1];if(!n)return;let i=r[0],o=Array.isArray(n),a=this.getCallBack(t,s,n,i,o),c=this._getWatcherProps(i);for(var h=0,f=c.length;h<f;h++){var D=o?n[h]:n;this.addWatcher(s,D,c[h],a)}},setup(s,t,e){if(!!t){if(Array.isArray(t)){let r=[t[0],t[1]],n=t[2];typeof n=="function"?t={value:r,callBack:n}:t={attr:n,value:[t[0],t[1]]}}this.addDataWatcher(s,t,e)}},addWatcher(s,t,e,r){g.watch(s,t,e,r)}};var Oe=s=>typeof s!="string"?s:jt(s),jt=s=>[{tag:"text",textContent:s}],Pe=s=>{if(!s)return{props:{},children:[]};let t=s[0];return typeof t=="string"?{props:{},children:jt(t)}:Array.isArray(t)?E.isWatching(t)===!1?{props:{},children:t}:{props:{watch:t},children:[]}:{props:t||{},children:Oe(s[1])}},Ee=s=>(...t)=>{let{props:e,children:r}=Pe(t);return s(e,r)};var at=s=>{let t={};if(!s||typeof s!="object")return t;s=m.clone(s);for(var e in s)if(!!Object.prototype.hasOwnProperty.call(s,e)){var r=s[e];typeof r!="function"&&(t[e]=r,delete s[e])}return t};function Wt(s,t){return s===""?(s=t,isNaN(s)?s:`[${t}]`):isNaN(t)?`${s}.${t}`:`${s}[${t}]`}function Ft(s,t="",e=""){return{get(r,n,i){if(t===""&&n in r)return r[n];let o=r[e]||r,a=Reflect.get(o,n,i);if(!u.isObject(a))return a;let c=Wt(t,n);return new Proxy(a,Ft(s,c,e))},set(r,n,i,o){if(t===""&&n in r)return r[n]=i,!0;let a=r[e]||r,c=Wt(t,n);return s.set(c,i),Reflect.set(a,n,i,o)}}}var Jt=(s,t="stage")=>new Proxy(s,Ft(s,"",t));var Be=0,H=class{constructor(t){this.dirty=!1,this.links={},this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new R;let e=at(t);return this.set(e),Jt(this)}setup(){this.stage={}}_init(){let t=++Be;this._dataNumber=t,this._id="dt-"+t,this._dataId=this._id+":"}getDataId(){return this._id}remove(){}on(t,e){let r=t+":change";return this.eventSub.on(r,e)}off(t,e){let r=t+":change";this.eventSub.off(r,e)}_setAttr(t,e,r=this){let n=this.stage[t];if(e===n)return!1;this.stage[t]=e,this._publish(t,e,r,n)}set(...t){if(typeof t[0]!="object")return this._setAttr(...t),this;let[e,r,n]=t;for(var i in e)if(!!Object.prototype.hasOwnProperty.call(e,i)){var o=e[i];typeof o!="function"&&this._setAttr(i,o,r,n)}return this}getModelData(){return this.stage}_deleteAttr(t,e){delete t[e]}toggle(t){if(!(typeof t>"u"))return this.set(t,!this.get(t)),this}increment(t){if(typeof t>"u")return;let e=this.get(t);return this.set(t,++e),this}decrement(t){if(typeof t>"u")return;let e=this.get(t);return this.set(t,--e),this}concat(t,e){if(typeof t>"u")return;let r=this.get(t);return this.set(t,r+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t){return this.key=t,this}resume(t){let e=this.key;if(!e)return this;let r,n=localStorage.getItem(e);return n===null?t&&(r=t):r=JSON.parse(n),r?(this.set(r),this):this}store(){let t=this.key;if(!t)return!1;let e=this.get();if(!e)return!1;let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}delete(t){if(typeof t<"u"){this._deleteAttr(this.stage,t);return}this.setup()}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let n=[];for(var i in e)!Object.prototype.hasOwnProperty.call(e,i)||n.push(this.remoteLink(t,i));return n}remoteLink(t,e,r){let n=r||e,i=t.get(e);typeof i<"u"&&this.get(e)!==i&&this.set(e,i);let o=t.on(e,(c,h)=>{if(h===this)return!1;this.set(n,c,t)});this.addLink(o,t);let a=this.on(n,(c,h)=>{if(h===t)return!1;t.set(e,c,this)});return t.addLink(a,this),o}addLink(t,e){this.links[t]=e}unlink(t){if(t){this.removeLink(t);return}let e=this.links;if(e.length){for(var r=0,n=e.length;r<n;r++)this.removeLink(e[r],!1);this.links=[]}}removeLink(t,e){let r=this.links[t];r&&r.off(t),e!==!1&&delete this.links[t]}};H.prototype.isData=!0;var T={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},getSegments(s){let t=this.deepDataPattern;return s.match(t)}};var A=class extends H{setup(){this.attributes={},this.stage={}}_updateAttr(t,e,r){if(!T.hasDeepData(e)){t[e]=r;return}let n,i=T.getSegments(e),o=i.length,a=o-1;for(var c=0;c<o;c++){if(n=i[c],c===a){t[n]=r;break}t[n]===void 0&&(t[n]=isNaN(n)?{}:[]),t=t[n]}}_setAttr(t,e,r,n){typeof e!="object"&&e===this.get(t)||(!r&&n!==!0?this._updateAttr(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),this._updateAttr(this.stage,t,e),r=r||this,this._publish(t,e,r))}linkAttr(t,e){let r=t.get(e);if(!!r)for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&this.link(t,e+"."+n,n)}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let n=new e(r);return n.linkAttr(this,t),n}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.push(e),this.set(t,r),this}unshift(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.unshift(e),this.set(t,r),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.shift();return this.set(t,e),r}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r){this.publish(t,e,r)}publishDeep(t,e,r){if(!T.hasDeepData(t)){this.publish(t,e,r);return}let n,i=T.getSegments(t),o=i.length,a=o-1,c="",h=this.stage;for(var f=0;f<o;f++){n=i[f],h=h[n],f>0?isNaN(n)&&(c+="."+n):c=n;var D;if(f===a)D=e;else{var P=i[f+1];if(isNaN(P)===!1){c+="["+P+"]";continue}var M={};M[P]=h[P],D=M}this.publish(c,D,r)}}publish(t,e,r){if(t=t||"",this._publishAttr(t,e,r),!e||typeof e!="object")return;let n,i;if(Array.isArray(e)){let c=e.length;for(var o=0;o<c;o++)i=e[o],n=t+"["+o+"]",this._checkPublish(n,i,r)}else for(var a in e)!Object.prototype.hasOwnProperty.call(e,a)||(i=e[a],n=t+"."+a,this._checkPublish(n,i,r))}_checkPublish(t,e,r){!e||typeof e!="object"?this._publishAttr(t,e,r):this.publish(t,e,r)}_publishAttr(t,e,r){g.publish(this._dataId+t,e,r);let n=t+":change";this.eventSub.publish(n,e,r)}mergeStage(){this.attributes=m.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e){T.hasDeepData(e)||delete t[e];let r=T.getSegments(e),n=r.length,i=n-1;for(var o=0;o<n;o++){var a=r[o],c=t[a];if(c===void 0)break;if(o===i){if(Array.isArray(t)){t.splice(a,1);break}delete t[a];break}t=c}}_getAttr(t,e){if(!T.hasDeepData(e))return t[e];let r=T.getSegments(e),n=r.length,i=n-1;for(var o=0;o<n;o++){var a=r[o],c=t[a];if(c===void 0)break;if(t=c,o===i)return t}}};var Me=(s,t)=>{if(typeof s!="string"&&(s=String(s)),t){let r=/(\n|\r\n)/g;s=s.replace(r,"\\n")}let e=/\t/g;return s.replace(e,"\\t")},Vt=(s,t)=>{if(typeof s!="string")return s;s=Me(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},Dt=(s,t)=>{let e=typeof s;if(e==="undefined")return s;if(e!=="object")return s=Vt(s),s;let r;for(var n in s)!Object.prototype.hasOwnProperty.call(s,n)||(r=s[n],r!==null&&(s[n]=typeof r=="string"?Dt(r,t):Vt(r,t)));return s};function Yt(s){return typeof s<"u"&&s.length>0?JSON.parse(s):!1}function Tt(s){return typeof s<"u"?JSON.stringify(s):!1}var K=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?m.clone(t):t,n=Dt(r,e);return Tt(n)}static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};L(K,"json",{encode:Tt,decode:Yt});var ct=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 r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=b.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=b.parseQueryString(e,!1)),this._isFormData(t))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.append(r,e[r]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let r=this.model.get("id"),n="op=get&id="+r,i=this.model;return this._get("",n,t,e,o=>{if(o){let a=this.getObject(o);a&&i.set(a)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+K.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return!1;let r="op=setup&"+this.setupObjectData();return this._put("",r,t,e)}add(t,e){if(!this.isValid())return!1;let r="op=add&"+this.setupObjectData();return this._post("",r,t,e)}update(t,e){if(!this.isValid())return!1;let r="op=update&"+this.setupObjectData();return this._patch("",r,t,e)}delete(t,e){let r=this.model.get("id"),n="op=delete&id="+r;return this._delete("",n,t,e)}all(t,e,r,n,i){i=i||"",r=isNaN(r)?0:r,n=isNaN(n)?50:n;let o="op=all&option="+i+"&start="+r+"&stop="+n;return this._get("",o,t,e)}getUrl(t){let e=this.url;return t?t[0]==="?"?e+t:e+="/"+t:e}setupRequest(t,e,r,n,i){let o={url:this.getUrl(t),method:e,params:r,completed:(c,h)=>{typeof i=="function"&&i(c),this.getResponse(c,n,h)}};return this._isFormData(r)&&(o.headers={}),tt(o)}_isFormData(t){return t instanceof FormData}request(t,e,r,n){return this._request("","POST",t,e,r,n)}_get(t,e,r,n,i){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i)}_post(t,e,r,n,i){return this._request(t,"POST",e,r,n,i)}_put(t,e,r,n,i){return this._request(t,"PUT",e,r,n,i)}_patch(t,e,r,n,i){return this._request(t,"PATCH",e,r,n,i)}_delete(t,e,r,n,i){return this._request(t,"DELETE",e,r,n,i)}_request(t,e,r,n,i,o){return r=this.setupParams(r),r=this.addParams(r,n),this.setupRequest(t,e,r,i,o)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return!1;let e=this;class r extends e{constructor(i){super(i)}}return Object.assign(r.prototype,t),r}};var Le=s=>{let t={};if(!s||typeof s!="object")return t;let e=s.defaults;if(!e)return t;for(var r in e)if(!!Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];typeof n!="function"&&(t[r]=n)}return delete s.defaults,t},Re=s=>{if(!s||typeof s.xhr!="object")return{};let t=s.xhr,e=Object.assign({},t);return delete s.xhr,e},He=0,F=class extends A{xhr=null;constructor(t){let e=super(t);return this.initialize(),e}initialize(){}static extend(t={}){let e=this,r=Re(t),n=this.prototype.service.extend(r),i=Le(t);class o extends e{constructor(c){let h=at(c);h=Object.assign({},i,h),super(h),this.xhr=new n(this)}dataTypeId="bm"+He++}return Object.assign(o.prototype,t),o.prototype.service=n,o}};F.prototype.service=ct;var C=class extends H{_publish(t,e,r,n){let i=t+":change";this.eventSub.publish(i,e,r),r=r||this,g.publish(this._dataId+t,e,r)}};var ht=class extends C{constructor(t){super(),this.id=t}addAction(t,e){typeof e<"u"&&this.set(t,e)}getState(t){return this.get(t)}removeAction(t,e){if(e){this.off(t,e);return}let r=this.stage;typeof r[t]<"u"&&delete r[t]}};var x=class{static restore(t,e){this.targets[t]=e}static getTarget(t){let e=this.targets;return e[t]||(e[t]=new ht(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,r){let n=this.getTarget(t);return e&&n.addAction(e,r),n}static addAction(t,e,r){return this.add(t,e,r)}static removeAction(t,e,r){this.off(t,e,r)}static on(t,e,r){let n=this.getTarget(t);return e?n.on(e,r):!1}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let n=this.targets,i=n[t];if(!!i){if(e){i.off(e,r);return}delete n[t]}}static set(t,e,r){this.getTarget(t).set(e,r)}};L(x,"targets",{});var ut=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(e<1)return!1;let r;for(var n=0;n<e;n++)r=t[n],this.on(...r)}on(t,e,r,n){p.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){p.off(t,e,r,n);let i,o=this.events;for(var a=0,c=o.length;a<c;a++)if(i=o[a],i.event===t&&i.obj===e){o.splice(a,1);break}}set(){let t,e=this.events;for(var r=0,n=e.length;r<n;r++)t=e[r],p.on(t.event,t.obj,t.callBack,t.capture)}unset(){let t,e=this.events;for(var r=0,n=e.length;r<n;r++)t=e[r],p.off(t.event,t.obj,t.callBack,t.capture)}reset(){this.unset(),this.events=[]}};var ft=class{constructor(t,e){this.remoteStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,n){return{action:t,state:e,callBack:r,targetId:n,token:null}}convertStates(t){let e=[];for(var r in t)if(!!Object.prototype.hasOwnProperty.call(t,r)){if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}var n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){let r;for(var n=0,i=t.length;n<i;n++)if(r=t[n],!!r){for(var o in r)if(!(!Object.prototype.hasOwnProperty.call(r,o)||o==="id")){var a=null,c=r[o],h=c!==null?c:void 0;h&&typeof h=="object"&&(a=h.callBack,h=h.state),e.push(this.createState(o,h,a,r.id))}}}removeRemoteStates(){let t=this.remoteStates;t&&this.removeActions(t)}removeActions(t){if(!(t.length<1))for(var e=0,r=t.length;e<r;e++){var n=t[e];x.remove(n.targetId,n.action,n.token)}}restore(t){x.restore();let e=this.remoteStates;if(!!e)for(var r=0,n=e.length;r<n;r++){var i=e[r];i.token=this.bindRemoteState(t,i.action,i.targetId)}}bindRemoteState(t,e,r){let n=x.getTarget(r);return t.link(n,e)}addStatesToTarget(t,e){let r=this.remoteStates;for(var n=0,i=e.length;n<i;n++){var o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}r.length<1&&(this.remoteStates=null)}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&t.on(n,o),r}};var _e={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"},G=s=>_e[s]||s,At=s=>typeof s=="string"&&s.substring(0,2)==="on"?s.substring(2):s,v=class{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(r,i):this.append(r,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return!1;let r=e.type;typeof r<"u"&&d.setAttr(t,"type",r);for(var n in e)if(!(!Object.prototype.hasOwnProperty.call(e,n)||n==="type")){var i=e[n];n==="innerHTML"?t.innerHTML=i:n.indexOf("-")!==-1?d.setAttr(t,n,i):this.addAttr(t,n,i)}}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,r){if(r===""||!e)return;if(typeof r==="function")e=At(e),p.add(e,t,r);else{let i=G(e);t[i]=r}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let r=document.createTextNode(t);return e&&this.append(e,r),r}static createComment(t,e){let r=document.createComment(t);return e&&this.append(e,r),r}static setupSelectOptions(t,e,r){if(!t||typeof t!="object"||!e||!e.length)return!1;for(var n=0,i=e.length;n<i;n++){var o=e[n],a=t.options[n]=new Option(o.label,o.value);r!==null&&a.value==r&&(a.selected=!0)}}static removeElementData(t){let e=t.childNodes;if(e){let o=e.length-1;for(var r=o;r>=0;r--){var n=e[r];!n||this.removeElementData(n)}}l.remove(t),t.bindId&&g.unbind(t)}static removeElement(t){let e;return!t||!(e=t.parentNode)?this:(this.removeElementData(t),e.removeChild(t),this)}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(typeof t!="object")return this;let e=t.childNodes;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.removeElementData(e[r]);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,r){let n=r||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var Ne=s=>typeof s!="string"?s:qt(s),qt=s=>[{tag:"text",textContent:s}],zt=s=>{if(!s)return{props:{},children:[]};let t=s[0];return typeof t=="string"?{props:{},children:qt(t)}:Array.isArray(t)?{props:{},children:t}:{props:t||{},children:Ne(s[1])}};l.addType("components",s=>{if(!s)return;let t=s.component;t&&t.rendered===!0&&t.prepareDestroy()});var Ie=0,_=class{constructor(...t){this.isUnit=!0,this.init();let{props:e,children:r}=zt(t);this.setupProps(e),this.children??=r,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Ie++}setupProps(t){if(!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}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 r=e[0];!r||(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context=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.persist?this._layout||(this._layout=this.render()):this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){l.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 r=[];if(!t||t.length<1)return r;for(var n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return v.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.container=t,this.initialize()}remove(){this.prepareDestroy(),this.removeContext();let t=this.panel||this.id;v.removeElement(t)}prepareDestroy(){this.rendered=!1,this.beforeDestroy()}beforeDestroy(){}destroy(){this.remove()}};var B=class extends _{constructor(...t){super(...t),this.isComponent=!0,this.stateTargetId=null}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=x.getTarget(e)}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateHelper.restore(t);return}let e=this.setupStates();m.isEmpty(e)||(this.setupStateTarget(),this.stateHelper=new ft(this.state,e))}removeStates(){if(!this.state)return!1;this.stateHelper.removeRemoteStates(),x.remove()}setupEventHelper(){this.events||(this.events=new ut)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();if(t.length<1)return!1;this.setupEventHelper(),this.events.addEvents(t)}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.rendered=!1,this.beforeDestroy(),this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist===!1&&this.data.unlink()}};var Ue={created:"onCreated",state:"setupStates",events:"setupEevents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"},je=s=>typeof s==="function"?s:function(){return s},We=s=>{let t={};if(!s)return t;for(var e in s){if(!Object.prototype.hasOwnProperty.call(s,e))continue;let r=s[e],n=Ue[e];if(n){t[n]=je(r);continue}t[e]=r}return t},Fe=s=>{class t extends B{}return Object.assign(t.prototype,s),t},Xt=s=>{class t extends _{}return Object.assign(t.prototype,s),t},N=function(s){if(!s)return null;let t;switch(typeof s){case"object":return s.render?(t=We(s),Fe(t)):(t={render(){return s}},Xt(t));case"function":return t={render:s},Xt(t)}};var Je={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(s=new Date().getDay(),t=!1){let e=this.dayNames;if(s>e.length)return!1;let r=e[s];return t?r.substring(0,3):r},convertJsMonth(s){return this.padNumber(s+1)},convertDate(s,t){s=s?s.replace(/\s/,"T"):"";let e=new Date(s),r=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+r},padNumber(s){return s<=9?"0"+s:String(s)},createDate(s){return s?(typeof s=="string"&&s.indexOf("-")>-1&&(s=s.replace(/\s/,"T"),s=s.indexOf(":")>-1?s:s+"T00:00:00"),new Date(s)):new Date},format(s,t){let e=this.createDate(t);switch(s){case"sql":t=e.getFullYear()+"-"+this.convertJsMonth(e.getMonth())+"-"+this.padNumber(e.getDate());break;default:t=this.convertJsMonth(e.getMonth())+"/"+this.padNumber(e.getDate())+"/"+e.getFullYear();break}return t},formatTime(s,t){let e=this.createDate(s);if(t===24)return this.padNumber(e.getHours())+":"+this.padNumber(e.getMinutes())+":"+this.padNumber(e.getSeconds());let r=e.getHours(),n="AM";return r>=12&&(n="PM"),r>12&&(r=r-12),r+":"+this.padNumber(e.getMinutes())+" "+n},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){let e=this.monthNames;if(s>e.length)return!1;let r=e[s];return r?t?r.substring(0,3):r:!1},getMonthLength(s,t){let e=new Date;return s=typeof s<"u"?s:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[s]},getMonthsLength(s=new Date().getFullYear()){return this.leapYear(s)===!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]},getDiffFromNow(s,t){s=s.replace(/\s/,"T"),s=new Date(s);let e=new Date;return t===!0&&e.setHours(0,0,0,0),e.getTime()-s.getTime()},getAge(s){let t=this.getDiffFromNow(s),e="",r="";switch(!0){case t<864e5:e="1 day";break;case t<6048e5:r=this.toDays(t),e=r+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:r=this.toDays(t);var n=Math.floor(r/7);e=n+" weeks";break;case t<5184e6:e="1 month";break;case t<31104e6:var i=this.toMonths(t);e=i+" months";break;default:var o=this.toYears(t);e=o}return e},getTimeFrame(s){let t=this.getDiffFromNow(s);return this.convertToEstimate(t)},convertToEstimate(s){let t="",e,r,n,i,o,a,c;if(s<=0)switch(!0){case s<-63072e6:n=this.toYears(Math.abs(s)),t="in "+n+" years";break;case s<-31536e6:t="in a year";break;case s<-5184e6:i=this.toMonths(Math.abs(s)),t="in "+i+" months";break;case s<-2592e6:t="in a month";break;case s<-12096e5:e=this.toDays(Math.abs(s)),r=Math.floor(e/7),t="in "+r+" weeks";break;case s<-6048e5:t="in a week";break;case s<-1728e5:e=this.toDays(Math.abs(s)),t="in "+e+" days";break;case s<-864e5:t="tomorrow";break;case s<-72e5:o=this.toHours(Math.abs(s)),t="in "+o+" hours";break;case s<=-36e5:t="in an hour";break;case s<-12e4:a=this.toMinutes(Math.abs(s)),t="in "+a+" minutes";break;case s<-6e4:t="in a minute";break;case s<-2e3:c=this.toSeconds(Math.abs(s)),t="in "+c+" seconds";break;case s<-1:t="in 1 second";break;default:t="now"}else switch(!0){case s<1e3:t="1 second ago";break;case s<6e4:c=this.toSeconds(s),t=c+" seconds ago";break;case s<12e4:t="1 minute ago";break;case s<36e5:a=this.toMinutes(s),t=a+" minutes ago";break;case s<72e5:t="1 hour ago";break;case s<864e5:o=this.toHours(s),t=o+" hours ago";break;case s<1728e5:t="yesterday";break;case s<6048e5:e=this.toDays(s),t=e+" days ago";break;case s<12096e5:t="a week ago";break;case s<2592e6:e=this.toDays(s),r=Math.floor(e/7),t=r+" weeks ago";break;case s<5184e6:t="a month ago";break;case s<31536e6:i=this.toMonths(s),t=i+" months ago";break;case s<63072e6:t="a year ago";break;default:n=this.toYears(s),t=n+" years ago"}return t},toYears(s){return typeof s!="number"?!1:Math.floor(s/31558464e3)},toMonths(s){return typeof s=="number"?Math.floor(s/2592e6):!1},toDays(s){return typeof s!="number"?!1:Math.floor(s/864e5*1)},toHours(s){return typeof s!="number"?!1:Math.floor(s%864e5/36e5*1)},toMinutes(s){return typeof s!="number"?!1:Math.floor(s%864e5%36e5/6e4*1)},toSeconds(s){return typeof s!="number"?!1:Math.floor(s%864e5%36e5%6e4/1e3*1)},getDifference(s,t){let e=new Date(s),r=new Date(t),n=r.getTime()-e.getTime();return{years:this.toYears(n),days:this.toDays(n),hours:this.toHours(n),minutes:this.toMinutes(n),seconds:this.toSeconds(n)}}};var $t=(s,t)=>({name:s,callBack:t});var J={keys:[],items:{},add(s,t){return this.keys.push(s),this.items[s]=$t(s,t),this},get(s){return this.items[s]||null},all(){return this.keys}};var Ct=(s,t)=>({attr:s,directive:t});var V=(s,t)=>({key:s,value:t});var Kt=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var lt=class{static getTag(t){let e="div",r=t.tag;return typeof r<"u"&&(e=r),e}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(V("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){r={attr:G(e),value:r},t.push(Ct(V(e,r),J.get("watch")))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(V("type",n))}}static parse(t,e){let r=[],n=[],i=this.getTag(t);this.setButtonType(i,t,r),this.setupChildren(t);let o=[];var a,c;for(var h in t){if(!Object.prototype.hasOwnProperty.call(t,h)||h==="tag"||(a=t[h],a==null))continue;if((c=J.get(h))!==null){n.push(Ct(V(h,a),c));continue}let f=typeof a;if(f==="object"){if(h==="children"){o=o.concat(a);continue}if(E.isWatching(a)){this.setTextAsWatcher(n,h,a);continue}o.push(a);continue}if(f==="function"){let P=a;a=function(M){P.call(this,M,e)}}if(E.isWatching(a)){this.setTextAsWatcher(n,h,a);continue}this.setElementContent(h,a,r,o)||r.push(V(h,a))}return Kt(i,r,n,o)}};var O=class extends v{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e,n),r.appendChild(i),i}static addAttributes(t,e,r){let n;if(!(!e||(n=e.length)<1))for(var i=0;i<n;i++){var o=e[i],a=o.key,c=o.value;if(a==="innerHTML"){t.innerHTML=c;continue}if(a.substr(4,1)==="-"){d.setAttr(t,a,c);continue}this.addAttr(t,a,c,r)}}static addAttr(t,e,r,n){if(r===""||!e)return!1;if(typeof r==="function")e=At(e),p.add(e,t,function(o){r.call(this,o,n)});else{let o=G(e);t[o]=r}}static addContent(t,e){!e||(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var Y=class{createNode(t,e,r){}};var pt=class extends Y{createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return O.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return O.createComment(o,e)}return O.create(n,t.attr,e,r)}};var dt=class extends Y{createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:""}else if(n==="comment"){let i=t.attr[0],o=i?i.value:""}}};var mt=class{static browserIsSupported(){return window}static setup(){return this.browserIsSupported()?new pt:new dt}};var Ve=mt.setup(),y=class{static render(t,e,r){if(!t)return;let n,i;switch(typeof t){case"object":if(t.isUnit===!0)return this.createComponent(t,e,r),t;default:return n=N(t),i=new n,this.createComponent(i,e,r),i}}static build(t,e,r){let n=O.createDocFragment();if(Array.isArray(t))for(var i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}static rebuild(t,e,r){return O.removeAll(e),this.build(t,e,r)}static buildElement(t,e,r){if(!!t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}static createElement(t,e,r){let n=lt.parse(t,r),i=this.createNode(n,e,r);this.cache(i,t.cache,r);let o=n.children;if(o.length>0){let f;for(var a=0,c=o.length;a<c;a++)f=o[a],f!==null&&this.buildElement(f,i,r)}let h=n.directives;h&&h.length&&this.setDirectives(i,h,r)}static setDirectives(t,e,r){for(var n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],r)}static handleDirective(t,e,r){e.directive.callBack(t,e.attr.value,r)}static cache(t,e,r){r&&e&&(r[e]=t)}static createComponent(t,e,r){let n=t;n.parent=r,r&&r.persist===!0&&n.persist!==!1&&(n.persist=!0),n.cache&&r&&(r[n.cache]=n),n.setup(e);let i=n.prepareLayout();this.build(i,n.container,n),n.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(n)}static createNode(t,e,r){return Ve.createNode(t,e,r)}};w.augment({buildLayout(s,t,e){y.build(s,t,e)}});var Pt=[],Ye=s=>Pt.indexOf(s)!==-1,qe=s=>({tag:"script",src:s.src,async:!1,load(t){Pt.push(s.src);let e=s.load;e&&e()}}),ze=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){Pt.push(s.src);let e=s.load;e&&e()}}),Ot=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=ze({load:r,src:t}):e=qe({load:r,src:t}),y.build(e,document.head)}addFiles(t){if(!!t)for(var e=0,r=t.length;e<r;e++){var n=t[e];Ye(n)||this.add(n)}}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)}},Xe=(s,t)=>{import(s).then(e=>{t&&t(e)})},$e=s=>s?typeof s?.prototype?.constructor=="function":!1,Ke=(s,t,e)=>{let r=y.build(s,null,e),n=r.firstChild;return t.after(r),n},Ge=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),Qe=N({render(){return Ge({onCreated:s=>{if(!!this.src){if(this.depends){new Ot(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},getLayout(s){let t=s.default;if(!t)return null;let e=this.callBack;return e?t=e(t):$e(t)?(t=new t,t.route=this.route,this.persist&&(t.persist=!0)):t=t(),this.layout=t},loadAndRender(s){Xe(this.src,t=>{this.loaded=!0;let e=this.layout||this.getLayout(t);this.layoutRoot=Ke(e,s,this.parent)})},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},beforeDestroy(){!this.layoutRoot||v.removeElement(this.layoutRoot)}}),Et=s=>new Qe(s);var Gt=(s,t,e)=>{!t||t&&d.setAttr(s,"role",t)},Ze=s=>(t,e)=>{let r=e?"true":"false";d.setAttr(t,s,r)},Qt=(s,t,e)=>{if(!t)return;let r=t.role;r&&(d.setAttr(s,"role",r),t.role=null);for(var n in t)if(!(!Object.prototype.hasOwnProperty.call(t,n)||t[n]===null)){var i=t[n],o="aria-"+n;Array.isArray(i)?(i.push(Ze(o)),(void 0).onSet(s,i,e)):d.setAttr(s,o,i)}};l.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var Bt=s=>s?s.getContext():null,Zt=(s,t,e)=>{if(typeof t!="function")return;let r=Bt(e),n=t(r);!n||((void 0)._addElementAttrs(s,n,e),(void 0).addElementDirectives(s,n,e))},te=(s,t,e)=>{if(typeof t!="function")return;let r=Bt(e);t(r)},ee=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=Bt(e),n=t(r);!n||e.addContextBranch(n[0],n[1])};var re=(s,t,e)=>{!t||!e||(e[t]=s)},se=(s,t,e)=>{if(!t||!e)return!1;t(e,s)},ne=(s,t,e)=>{if(!t||!e)return!1;t(e.data,s)},ie=(s,t,e)=>{if(!t||!e)return!1;t(e.state,s)},oe=(s,t,e)=>{if(!t||!e)return!1;if(e.stateHelper){let r=e.state,n=t(r);e.stateHelper.addStates(n)}};var I=s=>s.data?s.data:s.context&&s.context.data?s.context.data:null;var ae=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=I(e),!r)return!1;n=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=I(e);if(o)t.unshift(o);else return!1}[r,n,i]=t}g.bind(s,r,n,i)};var ce=(s,t,e)=>{let r,n,i,o;if(t.length<3){let c=I(e);if(!c)return;r=c,n=t[0],i=t[1],o=t[2]}else r=t[0],n=t[1],i=t[2],o=t[3];let a=o!==!1;g.watch(s,r,n,c=>{if(v.removeAll(s),!c||c.length<1)return;let h=[];for(var f=0,D=c.length;f<D;f++){var P=a?r.scope(n+"["+f+"]"):null,M=i(c[f],f,P);M!==null&&h.push(M)}return y.build(h,s,e)})};var he=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(var o=0,a=r.length;o<a;o++){var c=r[o];if(!!c){var h=n(c,o);h!==null&&i.push(h)}}return y.build(i,s,e)};var ue=(s,t,e)=>{t(s)};l.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele)});var fe=(s,t,e)=>{tr(s,t)},tr=(s,t)=>{l.add(s,"destroyed",{ele:s,callBack:t})};var Q=(s,t,e,r)=>{let n,i,o;if(Array.isArray(e[0])){for(var a=0,c=e.length;a<c;a++){var h=e[a];!h||Q(s,t,h,r)}return}if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return!1;switch(typeof i){case"object":o=f=>{sr(s,i,f)};break;case"function":o=f=>{er(s,i,n,f,r)};break}g.watch(s,t,n,o)},er=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(n&&i&&i.isUnit===!0&&n.persist===!0&&n.state){let o=e+":"+r,a=n.state,c=a.get(o);typeof c<"u"&&(i=c),a.set(o,i)}rr(i,s,n);break;case"string":v.addHtml(s,i);break}},rr=(s,t,e)=>{y.rebuild(s,t,e)},sr=(s,t,e)=>{for(var r in t)!Object.prototype.hasOwnProperty.call(t,r)||!r||(t[r]===e?d.addClass(s,r):d.removeClass(s,r))};var le=(s,t,e)=>{let r=I(e);Q(s,r,t,e)};var pe=(s,t,e)=>{Q(s,e.state,t,e)};var de=(s,t,e)=>{if(!t)return!1;if(Array.isArray(t)&&typeof t[0]!="string")for(var r=0,n=t.length;r<n;r++)E.setup(s,t[r],e);else E.setup(s,t,e)};var nr=0,q=class{constructor(t){this.router=t,this.locationId="base-app-router-"+nr++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}};var gt=class extends q{addEvent(){return p.on("popstate",window,this.callBack),this}removeEvent(){return p.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)}createState(t,e){let r={location:this.locationId,uri:t};return e&&typeof e=="object"&&(r=Object.assign(r,e)),r}addState(t,e,r=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return this;let o=this.createState(t,e);return n[r===!1?"pushState":"replaceState"](o,null,t),this}};var yt=class extends q{addEvent(){return p.on("hashchange",window,this.callBack),this}removeEvent(){return p.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,r){return window.location.hash=t,this}};var z=class{static browserIsSupported(){return"history"in window&&"pushState"in window.history}static setup(t){return z.browserIsSupported()?new gt(t).setup():new yt(t).setup()}};var vt=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.setupTemplate()}focus(t){this.setup===!1&&this.create(),this.update(t)}setupTemplate(){let t=this.template;if(typeof t=="string"&&(t=this.template=window[t],!t))return;let e=typeof t;if(e==="function")this.component=new this.template({route:this.route,persist:this.persist,parent:this.parent});else if(e==="object"){this.template.isUnit||(this.template=N(this.template));let r=this.component=this.template,n=r.persist!==!1;r.route=this.route,r.persist=n,r.parent=this.parent,this.persist=n}this.hasTemplate=!0}create(){if(!this.hasTemplate)return!1;this.setup=!0;let t=this.component;(!this.persist||!t)&&(t=this.component=this.template),y.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return!1;this.setup=!1;let t=this.component;if(!t)return!1;typeof t.destroy=="function"&&t.destroy(),this.persist===!1&&(this.component=null)}update(t){let e=this.component;if(!e)return!1;typeof e.update=="function"&&e.update(t)}};var ir=s=>{let t="";if(s){let e=/\//g;t=s.replace(e,"/");let r=/(\/):[^/(]*?\?/g;t=t.replace(r,a=>{let c=/\//g;return a.replace(c,"(?:$|/)")});let n=/(:[^/?&($]+)/g,i=/(\?\/+\*?)/g;t=t.replace(i,"?/*"),t=t.replace(n,a=>a.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)");let o=/(\*)/g;t=t.replace(o,".*")}return t+=s[s.length-1]==="*"?"":"$",t},or=s=>{if(!s.length)return null;let t={};for(var e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},ar=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);if(n===null)return t;for(var i=0,o=n.length;i<o;i++){var a=n[i];a&&(a=a.replace(":",""),t.push(a))}return t},cr=0,bt=class extends C{constructor(t,e){let r=t.baseUri,n=ar(r),i=or(n),o=super(i);return this.uri=r,this.paramKeys=n,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setupRoute(t){this.id=t.id||"bs-rte-"+cr++,this.path=null,this.referralPath=null;let e=ir(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title}setTitle(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?(typeof e=="string"&&(e={src:e}),Et(e)):null}setupComponentHelper(t){let e=this.getLayout(t);if(e){let{container:r,persist:n=!1,parent:i}=t,o={component:e,container:r,persist:n,parent:i};this.controller=new vt(this,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 r=this.controller;r&&r.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];!i||this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);!e||e.scrollIntoView(!0)}match(t){let e=!1,r=t.match(this.uriQuery);return r===null?(this.resetParams(),e):(r&&typeof r=="object"&&(r.shift(),e=r,this.setParams(r)),e)}resetParams(){this.stage={}}setParams(t){if(!t||typeof t!="object")return;let e=this.paramKeys;if(!e)return;let r={};for(var n=0,i=e.length;n<i;n++){var o=e[n];typeof o<"u"&&(r[o]=t[n])}this.set(r)}getParams(){return this.stage}};var hr=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},ur=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r],i=new RegExp(":"+r,"gi");s=s.replace(i,n)}return s},me=(s,t,e)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=ur(t,s),t=hr(t),e!==""&&(t+=" - "+e),t);var ge={removeSlashes(s){return typeof s=="string"&&(s.substring(0,1)==="/"&&(s=s.substring(1)),s.substring(-1)==="/"&&(s=s.substring(0,s.length-1))),s}};var xt=class extends B{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,watch:r}}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact!==!1,n=S.data,i=[];return t&&typeof t=="object"&&i.push({attr:"href",value:t}),e&&typeof e=="object"&&i.push({attr:"text",value:e}),i.push({value:["[[path]]",n],callBack:(o,a)=>{let c=a.pathname+a.hash,h=r?o===c:new RegExp("^"+a.pathname+"($|#|/|\\.).*").test(o);this.update(a,h)}}),i}setupStates(){return{selected:!1}}update(t,e){this.state.set("selected",e)}};l.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&S.removeRoute(t)});l.addType("switch",s=>{if(!s)return!1;let t=s.id;S.removeSwitch(t)});var Mt=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.history=null,this.callBackLink=null,this.location=window.location,this.routes=[],this.switches={},this.switchCount=0,this.data=new A({path:""})}setupHistory(){this.history=z.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new bt(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.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()+ge.removeSlashes(t)}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(var n=0;n<r;n++){var i=e[n];if(i.uri===t)return i}return!1}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(var n=0;n<r;n++){var i=e[n];if(i.id===t)return i}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(var n=0,i=t.length;n<i;n++){var o=this.createRoute(t[n]);r.push(o)}return this.checkGroup(r,this.getPath()),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);for(var i=0,o=t.length;i<o;i++){var a=t[i].component.route;a.resume(e),n.push(a)}return this.checkGroup(n,this.getPath()),r}getSwitchGroup(t){return this.switches[t]=[]}removeSwitch(t){let e=this.switches;e[t]&&delete e[t]}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e!==!1&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.set("path",this.getPath()),this.callBackLink=this.checkLink.bind(this),p.on("click",document,this.callBackLink);let r=this.getEndPoint();return this.navigate(r,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){let e=t.parentNode;for(;e!==null;){if(e.nodeName.toLowerCase()==="a")return e;e=e.parentNode}return!1}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target||t.srcElement;if(e.nodeName.toLowerCase()!=="a"&&(e=this.getParentLink(e),e===!1)||e.target==="_blank"||d.data(e,"cancel-route"))return!0;let r=e.getAttribute("href");if(typeof r<"u"){let n=this.baseURI,i=n!=="/"?r.replace(n,""):r;return this.navigate(i),t.preventDefault(),t.stopPropagation(),!1}}reset(){return this.routes=[],this.switches=[],this.switchCount=0,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.activate(),this}updatePath(){let t=this.getPath();this.data.set("path",t)}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=me(t,e,this.title)}checkActiveRoutes(t){this.lastPath=this.path,t=t||this.getPath(),this.path=t;let e=this.routes,r=e.length,n;for(var i=0;i<r;i++)n=e[i],!(typeof n>"u")&&this.checkRoute(n,t);this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(var r in e)if(!!Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];this.checkGroup(n,t)}}checkGroup(t,e){let r=!1,n,i,o,a,c=!1;for(var h=0,f=t.length;h<f;h++)if(n=t[h],!(typeof n>"u")){if(h===0&&(i=n),!o&&n.get("active")&&(o=n),r!==!1){c&&n.deactivate();continue}r=n.match(e),r!==!1&&(a=n,n.controller&&(this.select(n),c=!0))}if(a===void 0){this.select(i),o&&i!==o&&o.deactivate();return}o?c&&a!==o&&o.deactivate():i&&c===!1&&this.select(i)}checkRoute(t,e){let r=this.check(t,e);return r!==!1?this.select(t):t.deactivate(),r}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t){if(!t)return!1;t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t)}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){p.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}},S=new Mt;var ve=(s,t,e)=>{if(!t)return!1;if(Array.isArray(t))for(var r=0,n=t.length;r<n;r++)ye(s,t[r],e);else ye(s,t,e)},ye=(s,t,e)=>{t.container=s,t.parent=e;let r=S.add(t);fr(s,r)},fr=(s,t)=>{l.add(s,"routes",{route:t})};var be=(s,t,e)=>{let r=t[0];for(var n=0,i=t.length;n<i;n++)r=t[n],r.container=s,r.parent=e;let o=S.addSwitch(t);lr(s,o)},lr=(s,t)=>{l.add(s,"switch",{id:t})};J.add("cache",re).add("onCreated",ue).add("onDestroyed",fe).add("bind",ae).add("onSet",le).add("onState",pe).add("watch",de).add("useParent",se).add("useData",ne).add("useState",ie).add("addState",oe).add("map",he).add("for",ce).add("useContext",te).add("addContext",ee).add("context",Zt).add("role",Gt).add("aria",Qt).add("route",ve).add("switch",be);w.augment({Ajax:tt,Html:v,dataBinder:g,Data:A,SimpleData:C,Model:F,State:x,Builder:y,router:S,Component:B});export{tt as Ajax,k as Arrays,Ee as Atom,y as Builder,B as Component,A as Data,l as DataTracker,Je as DateTime,J as Directives,d as Dom,v as Html,Et as Import,N as Jot,F as Model,xt as NavLink,m as Objects,C as SimpleData,x as State,b as Strings,u as Types,_ as Unit,w as base,g as dataBinder,S as router};
2
2
  //# sourceMappingURL=base.js.map