@base-framework/base 3.0.18 → 3.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.js +1 -1
- package/dist/base.js.map +4 -4
- package/package.json +1 -1
package/dist/base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var we=Object.defineProperty;var Se=(s,t,e)=>t in s?we(s,t,{enumerable:true,configurable:true,writable:true,value:e}):s[t]=e;var B=(s,t,e)=>{Se(s,typeof t!=="symbol"?t+"":t,e);return e};var O=class{static toArray(t){return Array.prototype.slice.call(t)}static inArray(t,e,r){if(!t||typeof t!=="object"){return-1}return t.indexOf(e,r)}};var u=class{static getType(t){const e=typeof t;if(e!=="object"){return e}return this.isArray(t)?"array":e}static isUndefined(t){return typeof t==="undefined"}static isObject(t){return t&&typeof t==="object"&&this.isArray(t)===false}static isFunction(t){return typeof t==="function"}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==="undefined"||typeof t==="undefined"){return false}for(var e in s){if(this.hasOwnProp(s,e)&&typeof t[e]==="undefined"){t[e]=s[e]}}return t},clone(s){if(!s){return{}}return JSON.parse(JSON.stringify(s))},getClassObject(s){return typeof s==="function"?s.prototype:s},extendClass(s,t){const e=this.getClassObject(s),r=this.getClassObject(t);if(typeof e!=="object"||typeof r!=="object"){return false}const n=Object.create(e);for(var i in r){n[i]=r[i]}return n},hasOwnProp(s,t){return Object.prototype.hasOwnProperty.call(s,t)},isPlainObject(s){return Object.prototype.toString.call(s)==="[object Object]"},isEmpty(s){if(u.isObject(s)===false){return true}for(var t in s){if(this.hasOwnProp(s,t)){return false}}return true}};var $={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||false},remove(s){delete this.types[s]}};var Z=class{constructor(){this.types=new Map}add(t,e){if(!this.types.has(t)){this.types.set(t,[])}this.types.get(t).push(e)}get(t){return this.types.get(t)||false}removeByCallBack(t,e){if(typeof t==="function"){t(e)}}removeType(t){if(!this.types.has(t)){return}const e=this.types.get(t);if(!e.length){return}let r,n=$.get(t);for(var i=0,o=e.length;i<o;i++){r=e[i];if(!r){continue}e[i]=null;this.removeByCallBack(n,r)}this.types.delete(t)}remove(t){if(t){this.removeType(t);return}this.types.forEach((e,r)=>{if(!r){return}this.removeType(r)});this.types.clear()}};var f=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){const n=this.getTrackingId(t),i=this.find(n);i.add(e,r)}static get(t,e){const r=t.trackingId;const n=this.trackers.get(r);if(!n){return false}return e?n.get(e):n}static find(t){if(!this.trackers.has(t)){this.trackers.set(t,new Z)}return this.trackers.get(t)}static isEmpty(t){if(!t||typeof t!=="object"){return true}return t.size===0}static remove(t,e){const r=t.trackingId;if(!r||!this.trackers.has(r)){return true}const n=this.trackers.get(r);if(e){n.remove(e);if(this.isEmpty(n.types)){this.trackers.delete(r)}}else{n.remove();this.trackers.delete(r)}}};B(f,"trackers",new Map);B(f,"trackingCount",0);var wt=s=>{let t=0;for(let e of Object.entries(s)){t++;if(typeof s[e]==="object"){t+=wt(s[e])}}return t};var Rt=(s,t)=>{let e=false;if(typeof s!=="object"||typeof t!=="object"){return e}for(let[r,n]of Object.entries(s)){if(!m.hasOwnProp(t,r)){break}const i=t[r];if(typeof n!==typeof i){break}if(typeof n==="object"){e=Rt(n,i);if(e!==true){break}}else{if(n===i){e=true}else{break}}}return e};var De=(s,t)=>{const e=wt(s),r=wt(t);if(e!==r){return false}return Rt(s,t)};var Nt=(s,t)=>{const e=typeof s,r=typeof t;if(e!==r){return false}if(e==="object"){return De(s,t)}return s===t};var l={getEvents(s){if(u.isObject(s)===false){return false}return f.get(s,"events")},create(s,t,e,r=false,n=false,i=null){n=n===true;return{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)){var n;for(var 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=false,n=false,i=null){if(u.isObject(t)===false){return this}const o=this.create(s,t,e,r,n,i);f.add(t,"events",o);t.addEventListener(s,e,r);return this},remove(s,t,e,r=false){const n=this.getEvent(s,t,e,r);if(n===false){return this}if(typeof n==="object"){this.removeEvent(n)}return this},removeEvent(s){if(typeof s==="object"){const t=s.obj;t.removeEventListener(s.event,s.fn,s.capture)}return this},getEvent(s,t,e,r){if(typeof t!=="object"){return false}const n=this.getEvents(t);if(!n||n.length<1){return false}const 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++){e=t[n];if(e.event!==s.event||e.obj!==s.obj){continue}if(e.fn===s.fn||r===true&&e.originalFn===s.fn){return e}}return false},removeEvents(s){if(u.isObject(s)===false){return this}f.remove(s,"events");return this},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(s){this.swap.push(s)},isSwappable(s){return this.swap.includes(s)}};f.addType("events",s=>{l.removeEvent(s)});var _t={events:l,addListener(s,t,e,r){this.events.add(s,t,e,r);return this},on(s,t,e,r){const n=this.events;if(Array.isArray(s)){s.forEach(i=>{n.add(i,t,e,r)})}else{n.add(s,t,e,r)}return this},off(s,t,e,r){const n=this.events;if(Array.isArray(s)){s.forEach(i=>{n.remove(i,t,e,r)})}else{n.remove(s,t,e,r)}return this},removeListener(s,t,e,r){this.events.remove(s,t,e,r);return this},_createEvent(s,t,e,r){let n;if(t==="HTMLEvents"){n=new Event(s)}else if(t==="MouseEvents"){n=new MouseEvent(s,e)}else{n=new CustomEvent(s,r)}return n},createEvent(s,t,e,r){if(u.isObject(t)===false){return false}let n={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,bubbles:true,cancelable:true,relatedTarget:null};if(u.isObject(e)){n=Object.assign(n,e)}const i=this._getEventType(s);return this._createEvent(s,i,n,r)},_getEventType(s){const t={"HTMLEvents":/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,"MouseEvents":/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/};let e="CustomEvent";for(const[r,n]of Object.entries(t)){if(s.match(n)){e=r;break}}return e},trigger(s,t,e){if(u.isObject(t)===false){return this}const r=typeof s==="string"?this.createEvent(s,t,null,e):s;t.dispatchEvent(r);return this},mouseWheelEventType:null,getWheelEventType(){const s=()=>{let t="wheel";if("onmousewheel"in self){t="mousewheel"}else if("DOMMouseScroll"in self){t="DOMMouseScroll"}return t};return this.mouseWheelEventType||(this.mouseWheelEventType=s())},onMouseWheel(s,t,e,r){if(typeof t==="undefined"){t=window}const n=o=>{const a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));if(typeof s==="function"){s(a,o)}if(e===true){o.preventDefault()}};const i=this.getWheelEventType();this.events.add(i,t,n,r,true,s);return this},offMouseWheel(s,t,e){if(typeof t==="undefined"){t=window}const r=this.getWheelEventType();this.off(r,t,s,e);return this},preventDefault(s){if(typeof s.preventDefault==="function"){s.preventDefault()}else{s.returnValue=false}return this},stopPropagation(s){if(typeof s.stopPropagation==="function"){s.stopPropagation()}else{s.cancelBubble=true}return this}};var K=class{constructor(){this.version="3.0.10";this.errors=[];this.dataTracker=f}augment(t){if(!u.isObject(t)){return this}Object.entries(t).forEach(([e,r])=>{this.constructor.prototype[e]=r});return this}override(t,e,r,n){return(t[e]=r).apply(t,O.toArray(n))}getLastError(){const t=this.errors;return t.length?t.pop():false}addError(t){this.errors.push(t)}getProperty(t,e,r){if(u.isObject(t)===false){return""}const n=t[e];if(typeof n!=="undefined"){return n}return typeof r!=="undefined"?r:""}createCallBack(t,e,r=[],n=false){if(typeof e!=="function"){return false}return(...i)=>{if(n===true){r=r.concat(i)}return 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,..._t,...u,equals:Nt});var x=class{static parseQueryString(t,e){if(typeof t!=="string"){t=window.location.search}const r={},n=/([^?=&]+)(=([^&]*))?/g;t.replace(n,function(i,o,a,c){r[o]=e!==false?decodeURIComponent(c):c});return r}static camelCase(t){if(typeof t!=="string"){return false}const e=/(-|\s|_)+\w{1}/g;return t.replace(e,r=>{return r[1].toUpperCase()})}static uncamelCase(t,e="-"){if(typeof t!=="string"){return false}const r=/([A-Z]{1,})/g;return t.replace(r,n=>{return 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:true,crossDomain:false,withCredentials:false,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){if(typeof s==="object"){this.xhrSettings=m.extendClass(S.xhrSettings,s)}},resetAjaxSettings(){this.xhrSettings=It}});var tt=(...s)=>{const t=new St(s);return t.xhr};var St=class{constructor(t){this.settings=null;this.xhr=null;this.setup(t)}setup(t){this.getXhrSettings(t);const e=this.xhr=this.createXHR();if(e===false){return false}const{method:r,url:n,async:i}=this.settings;e.open(r,n,i);this.setupHeaders();this.addXhrEvents();this.beforeSend();e.send(this.getParams())}beforeSend(){const t=S.xhrSettings.beforeSend;if(t.length<1){return}const e=this.xhr;const r=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];if(o){o(e,r)}}}objectToString(t){const e=[];for(var r in t){if(Object.prototype.hasOwnProperty.call(t,r)){e.push(r+"="+encodeURIComponent(t[r]))}}return e.join("&")}setupParams(t,e){const r=typeof t;if(!e){if(t instanceof FormData===false&&r==="object"){t=this.objectToString(t)}return t}const n=typeof e;if(r==="string"){if(n!=="string"){e=this.objectToString(e)}const o=t===""?"?":"&";t+=o+e;return t}if(n==="string"){e=x.parseQueryString(e,false)}if(t instanceof FormData){for(var i in e){if(Object.prototype.hasOwnProperty.call(e,i)){t.append(i,e[i])}}}else if(r==="object"){t=m.clone(t);t=Object.assign(e,t);t=this.objectToString(t)}return t}getParams(){const t=this.settings;const e=t.fixedParams;let r=t.params;if(r){r=this.setupParams(r,e)}else if(e){r=this.setupParams(e)}return 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!=="undefined"?i:true;break}}}else{e=this.settings=m.extendClass(this.settings,t[0]);if(typeof e.completed==="function"){if(typeof e.failed!=="function"){e.failed=e.completed}if(typeof e.aborted!=="function"){e.aborted=e.failed}}}}createXHR(){const t=this.settings,e=new XMLHttpRequest;e.responseType=t.responseType;if(t.withCredentials===true){e.withCredentials=true}return e}setupHeaders(){const t=this.settings;if(!t&&typeof t.headers!=="object"){return}let e=t.headers;for(var r in e){if(Object.prototype.hasOwnProperty.call(e,r)){this.xhr.setRequestHeader(r,e[r])}}}update(t,e){const r=this.xhr;const n=()=>{l.removeEvents(r.upload);l.removeEvents(r)};const i=this.settings;if(!i){return false}const o=e||t.type;switch(o){case"load":if(typeof i.completed==="function"){let a=this.getResponseData();i.completed(a,this.xhr)}n();break;case"error":if(typeof i.failed==="function"){i.failed(false,this.xhr)}n();break;case"progress":if(typeof i.progress==="function"){i.progress(t)}break;case"abort":if(typeof i.aborted==="function"){i.aborted(false,this.xhr)}n();break}}getResponseData(){const t=this.xhr;const e=t.responseType;if(!e||e==="text"){return t.responseText}return t.response}addXhrEvents(){const t=this.settings;if(!t){return}const e=this.xhr,r=this.update.bind(this);l.on(["load","error","abort"],e,r);l.on("progress",e.upload,r)}};var d=class{static getById(t){if(typeof t!=="string"){return false}const e=document.getElementById(t);return e||false}static getByName(t){if(typeof t!=="string"){return false}const e=document.getElementsByName(t);return e?O.toArray(e):false}static getBySelector(t,e){if(typeof t!=="string"){return false}e=e||false;if(e===true){const n=document.querySelector(t);return n||false}const r=document.querySelectorAll(t);if(!r){return false}return r.length===1?r[0]:O.toArray(r)}static html(t,e){if(u.isObject(t)===false){return false}if(u.isUndefined(e)===false){t.innerHTML=e;return this}return t.innerHTML}static setCss(t,e,r){if(u.isObject(t)===false||u.isUndefined(e)){return this}e=x.uncamelCase(e);t.style[e]=r;return this}static getCss(t,e){if(!t||typeof e==="undefined"){return false}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{const o=window.getComputedStyle(t,null);if(o){r=o[e]}}return r}static css(t,e,r){if(typeof r!=="undefined"){this.setCss(t,e,r);return this}return this.getCss(t,e)}static removeAttr(t,e){if(u.isObject(t)){t.removeAttribute(e)}return this}static setAttr(t,e,r){t.setAttribute(e,r)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,r){if(u.isObject(t)===false){return false}if(typeof r!=="undefined"){this.setAttr(t,e,r);return this}return this.getAttr(t,e)}static _checkDataPrefix(t){if(typeof t!=="string"){return t}t=x.uncamelCase(t);if(t.substring(0,5)!=="data-"){t="data-"+t}return t}static removeDataPrefix(t){if(typeof t==="string"&&t.substring(0,5)==="data-"){t=t.substring(5)}return t}static setData(t,e,r){e=this.removeDataPrefix(e);e=x.camelCase(e);t.dataset[e]=r}static getData(t,e){e=x.camelCase(this.removeDataPrefix(e));return t.dataset[e]}static data(t,e,r){if(u.isObject(t)===false){return false}if(typeof r!=="undefined"){this.setData(t,e,r);return this}return this.getData(t,e)}static find(t,e){if(!t||typeof e!=="string"){return false}return t.querySelectorAll(e)}static show(t){if(u.isObject(t)===false){return this}const e=this.data(t,"style-display"),r=typeof e==="string"?e:"";this.css(t,"display",r);return this}static hide(t){if(u.isObject(t)===false){return this}const e=this.css(t,"display");if(e!=="none"&&e){this.data(t,"style-display",e)}this.css(t,"display","none");return this}static toggle(t){if(u.isObject(t)===false){return this}const e=this.css(t,"display");if(e!=="none"){this.hide(t)}else{this.show(t)}return this}static getSize(t){if(u.isObject(t)===false){return false}return{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return u.isObject(t)?t.offsetWidth:false}static getHeight(t){return u.isObject(t)?t.offsetHeight:false}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}if(u.isObject(t)===false){return false}return{left:e-(t.clientLeft||0),top:r-(t.clientTop||0)}}static getScrollTop(t){const e=this.getScrollPosition(t);return e.top}static getScrollLeft(t){const e=this.getScrollPosition(t);return e.left}static getWindowSize(){const 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(){const t=document,e=t.body,r=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight),i=Math.max(e.scrollWidth,e.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth);return{width:i,height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){const r={x:0,y:0};if(u.isObject(t)===false){return r}let n=0;while(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)===false||e===""){return this}if(typeof e==="string"){const i=e.split(" ");for(var r=0,n=i.length;r<n;r++){t.classList.add(e)}}return this}static removeClass(t,e){if(u.isObject(t)===false||e===""){return this}if(typeof e==="undefined"){t.className=""}else{t.classList.remove(e)}return this}static hasClass(t,e){if(u.isObject(t)===false||e===""){return false}return t.classList.contains(e)}static toggleClass(t,e){if(u.isObject(t)===false){return this}t.classList.toggle(e);return this}};var et=class{constructor(){this.connections=new Map}add(t,e,r){const n=this.find(t);n.set(e,r);return r}get(t,e){const r=this.connections.get(t);if(r){return r.get(e)||false}return false}find(t){const e=this.connections.get(t);if(e){return e}const r=new Map;this.connections.set(t,r);return r}remove(t,e){const r=this.connections.get(t);if(!r){return}let n;if(e){n=r.get(e);if(n){n.unsubscribe();r.delete(e)}if(r.size===0){this.connections.delete(t)}}else{for(let i of r){n=r.get(i);if(n){n.unsubscribe()}}this.connections.delete(t)}}};var I=class{constructor(){this.msg=null;this.token=null}setToken(t){this.token=t}};var rt=class extends I{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 U=class{unsubscribe(){}};var st=class extends U{constructor(){super();this.source=null}addSource(t){return this.source=new rt(t)}unsubscribe(){this.source.unsubscribe();this.source=null}};var W=class extends I{constructor(t){super();this.pubSub=t}subscribe(t){this.msg=t;const 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){if(this.data!==e){this.data.set(this.prop,t,e)}}};var Ae=(s,t,e)=>{d.setAttr(s,t,e)};var Ce=(s,t,e)=>{s.checked=s.value==e};var Te=(s,t,e)=>{e=e==1;Ut(s,t,e)};var Ut=(s,t,e)=>{s[t]=e};var Ee=(s,t)=>{return d.getAttr(s,t)};var Oe=(s,t)=>{return s[t]};var 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=Ae;this.getValue=Ee;return this}this.getValue=Oe;const r=t.type;if(r){switch(r){case"checkbox":this.setValue=Te;return;case"radio":this.setValue=Ce;return}}this.setValue=Ut;return this}getAttrBind(t){if(t){return t}let e="textContent";const r=this.element;if(!r||typeof r!=="object"){return e}const n=r.tagName.toLowerCase();if(n==="input"||n==="textarea"||n==="select"){const i=r.type;if(!i){e="value";return e}switch(i){case"checkbox":e="checked";break;case"file":e="files";break;default:e="value"}}return e}setupFilter(t){const e=/(\[\[[^\]]+\]\])/;return r=>{return t.replace(e,r)}}set(t){const e=this.element;if(!e||typeof e!=="object"){return this}if(this.filter){t=this.filter(t)}this.setValue(e,this.attr,t);return this}get(){const t=this.element;if(!t||typeof t!=="object"){return""}return this.getValue(t,this.attr)}callBack(t,e){if(e!==this.element){this.set(t)}return this}};var ot=class extends U{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){if(t){t.unsubscribe()}return this}unsubscribe(){this.unsubscribeSource(this.element);this.unsubscribeSource(this.data);this.element=null;this.data=null;return this}};var Wt=-1;var L=class{constructor(){this.callBacks=new Map;this.lastToken=-1}get(t){if(!this.callBacks.has(t)){this.callBacks.set(t,[])}return this.callBacks.get(t)}reset(){this.callBacks.clear();this.lastToken=-1;Wt=-1}on(t,e){const r=++Wt;this.get(t).push({token:r,callBack:e});return r}off(t,e){const r=this.callBacks.get(t);if(!r){return}const n=r.findIndex(i=>i.token===e);if(n!==-1){r.splice(n,1)}}remove(t){this.callBacks.delete(t)}publish(t,...e){const r=this.callBacks.get(t);if(!r){return}for(const{callBack:n}of r){if(!n){continue}n.apply(this,e)}}};var Dt=class{constructor(){this.version="1.0.1";this.attr="bindId";this.blockedKeys=[20,37,38,39,40];this.connections=new et;this.pubSub=new L;this.idCount=0;this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null;if(r.indexOf(":")!==-1){const p=r.split(":");if(p.length>1){i=p[1];o=p[0]}}const a=this.setupConnection(t,e,i,o,n);const c=a.element;let h=e.get(i);if(typeof h!=="undefined"){c.set(h)}else{h=c.get();if(h!==""){a.data.set(h)}}return this}setupConnection(t,e,r,n,i){const o=this.getBindId(t),a=new ot(this.pubSub),c=a.addData(e,r);c.subscribe(o);const h=e.getDataId();const p=`${h}:${r}`;const v=a.addElement(t,n,i);v.subscribe(p);this.addConnection(o,"bind",a);return a}addConnection(t,e,r){this.connections.add(t,e,r);return this}setBindId(t){const e="db-"+this.idCount++;if(t.dataset){t.dataset[this.attr]=e}t[this.attr]=e;return e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){const e=t[this.attr];if(e){this.connections.remove(e)}return this}watch(t,e,r,n){if(u.isObject(t)===false){return this}const i=new st;const o=i.addSource(e);o.subscribe(r,n);const a=this.getBindId(t),c=e.getDataId()+":"+r;this.addConnection(a,c,i);const h=e.get(r);if(typeof h!=="undefined"){n(h)}return this}unwatch(t,e,r){if(u.isObject(t)===false){return this}const n=t[this.attr];if(n){const i=e.getDataId()+":"+r;this.connections.remove(n,i)}return this}publish(t,e,r){this.pubSub.publish(t,e,r);return this}isDataBound(t){if(!t){return false}const e=t[this.attr];return e?e:false}isBlocked(t){if(t.type!=="keyup"){return false}return this.blockedKeys.indexOf(t.keyCode)!==-1}bindHandler(t){if(this.isBlocked(t)){return true}const e=t.target||t.srcElement,r=this.isDataBound(e);if(r){const n=this.connections.get(r,"bind");if(n){const i=n.element.get();this.pubSub.publish(r,i,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this);this.addEvents()}addEvents(){l.on(["change","paste","input"],document,this.changeHandler,false)}removeEvents(){l.off(["change","paste","input"],document,this.changeHandler,false)}};var y=new Dt;var jt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g;var P={isWatching(s){if(Array.isArray(s)){return typeof s[0]==="string"&&this.hasParams(s[0])}return this.hasParams(s)},hasParams(s){return u.isString(s)&&s.includes("[[")},_getWatcherProps(s){let t=/\[\[(.*?)(\[\d+\])?\]\]/g;const e=s.match(t);if(e===null){return null}t=/(\[\[|\]\])/g;return e.map(r=>r.replace(t,""))},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"innerHTML":s.innerHTML=e;break;default:if(t.substring(4,1)==="-"){d.setAttr(s,t,e);break}s[t]=e;break}},_getWatcherCallBack(s,t,e,r,n){return()=>{let i=0,o=e.replace(jt,function(){const a=n?t[i]:t;i++;const c=a.get(arguments[2]);return typeof c!=="undefined"?c:""});this.updateAttr(s,r,o)}},getParentData(s){if(s.data){return s.data}if(s.context&&s.context.data){return s.context.data}if(s.state){return s.state}return null},getValue(s,t){if(typeof s==="string"){s={value:s}}const e=s.value;if(Array.isArray(e)===false){return[e,this.getParentData(t)]}if(e.length<2){e.push(this.getParentData(t))}return e},getPropValues(s,t,e){const r=[];for(var n=0,i=t.length;n<i;n++){var o=e?s[n]:s;var a=o.get(t[n]);a=typeof a!=="undefined"?a:"";r.push(a)}return r},getCallBack(s,t,e,r,n){let i,o=s.callBack;if(typeof o==="function"){const a=r.match(jt);const c=a&&a.length>1;i=(h,p)=>{h=c!==true?h:this.getPropValues(e,a,n);o(h,t,p)}}else{const a=s.attr||"textContent";i=this._getWatcherCallBack(t,e,r,a,n)}return i},addDataWatcher(s,t,e){const r=this.getValue(t,e),n=r[1];if(!n){return}const i=r[0],o=Array.isArray(n);const a=this.getCallBack(t,s,n,i,o),c=this._getWatcherProps(i);for(var h=0,p=c.length;h<p;h++){var v=o?n[h]:n;this.addWatcher(s,v,c[h],a)}},setup(s,t,e){if(!t){return}if(Array.isArray(t)){const r=[t[0],t[1]];const n=t[2];if(typeof n==="function"){t={value:r,callBack:n}}else{t={attr:n,value:[t[0],t[1]]}}}this.addDataWatcher(s,t,e)},addWatcher(s,t,e,r){y.watch(s,t,e,r)}};var Pe=s=>{if(typeof s!=="string"){return s}return Ft(s)};var Ft=s=>{return[{tag:"text",textContent:s}]};var Me=s=>{if(!s){return{props:{},children:[]}}const t=s[0];if(typeof t==="string"){return{props:{},children:Ft(t)}}if(Array.isArray(t)){if(P.isWatching(t)===false){return{props:{},children:t}}return{props:{watch:t},children:[]}}return{props:t||{},children:Pe(s[1])}};var Be=s=>{return(...t)=>{const{props:e,children:r}=Me(t);return s(e,r)}};var at=s=>{const t={};if(!u.isObject(s)){return t}const e=m.clone(s);Object.keys(e).forEach(r=>{const n=e[r];if(typeof n!=="function"){t[r]=n}});return t};function Vt(s,t){const e=isNaN(Number(t))?t:`[${t}]`;return s===""?e:`${s}.${e}`}function Jt(s,t="",e=""){return{get(r,n,i){if(t===""&&n in r){return r[n]}const o=r[e]||r;const a=o[n];if(typeof a==="function"){return a.bind(o)}if(!u.isObject(a)||m.isPlainObject(a)===false){return a}const c=Vt(t,n);return new Proxy(a,Jt(s,c,e))},set(r,n,i,o){if(t===""&&n in r){r[n]=i;return true}const a=r[e]||r;const c=Vt(t,n);s.set(c,i);a[n]=i;return true}}}var zt=(s,t="stage")=>new Proxy(s,Jt(s,"",t));var Le=0;var H=class{constructor(t){this.dirty=false;this.links={};this._init();this.setup();this.dataTypeId="bd";this.eventSub=new L;const e=at(t);this.set(e);return zt(this)}setup(){this.stage={}}_init(){const t=++Le;this._dataNumber=t;this._id="dt-"+t;this._dataId=this._id+":"}getDataId(){return this._id}remove(){}on(t,e){const r=t+":change";const n=this.eventSub.on(r,e);return n}off(t,e){const r=t+":change";this.eventSub.off(r,e)}_setAttr(t,e,r=this){const n=this.stage[t];if(e===n){return false}this.stage[t]=e;this._publish(t,e,r,n)}set(...t){if(typeof t[0]!=="object"){this._setAttr(...t);return this}const[e,r,n]=t;Object.entries(e).forEach(([i,o])=>{if(typeof o==="function"){return}this._setAttr(i,o,r,n)});return this}getModelData(){return this.stage}_deleteAttr(t,e){delete t[e]}toggle(t){if(typeof t==="undefined"){return}this.set(t,!this.get(t));return this}increment(t){if(typeof t==="undefined"){return}let e=this.get(t);this.set(t,++e);return this}decrement(t){if(typeof t==="undefined"){return}let e=this.get(t);this.set(t,--e);return this}concat(t,e){if(typeof t==="undefined"){return}let r=this.get(t);this.set(t,r+e);return this}ifNull(t,e){if(this.get(t)===null){this.set(t,e)}return this}setKey(t){this.key=t;return this}resume(t){const e=this.key;if(!e){return this}let r;const n=localStorage.getItem(e);if(n===null){if(t){r=t}}else{r=JSON.parse(n)}if(!r){return this}this.set(r);return this}store(){const t=this.key;if(!t){return false}const e=this.get();if(!e){return false}const r=JSON.stringify(e);localStorage.setItem(t,r);return true}delete(t){if(typeof t!=="undefined"){this._deleteAttr(this.stage,t);return}this.setup()}_getAttr(t,e){return t[e]}get(t){if(typeof t!=="undefined"){return this._getAttr(this.stage,t)}return this.getModelData()}link(t,e,r){if(arguments.length===1&&t.isData===true){e=t.get()}if(typeof e!=="object"){return this.remoteLink(t,e,r)}const n=[];Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))});return n}remoteLink(t,e,r){const n=r||e;const i=t.get(e);if(typeof i!=="undefined"&&this.get(e)!==i){this.set(e,i)}const o=t.on(e,(c,h)=>{if(h===this){return false}this.set(n,c,t)});this.addLink(o,t);const a=this.on(n,(c,h)=>{if(h===t){return false}t.set(e,c,this)});t.addLink(a,this);return o}addLink(t,e){this.links[t]=e}unlink(t){if(t){this.removeLink(t);return}const e=this.links;if(e.length<1){return}e.forEach(r=>{this.removeLink(r,false)});this.links=[]}removeLink(t,e){const r=this.links[t];if(r){r.off(t)}if(e===false){return}delete this.links[t]}};H.prototype.isData=true;var A={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},getSegments(s){const t=this.deepDataPattern;return s.match(t)}};var C=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++){n=i[c];if(c===a){t[n]=r;break}if(t[n]===void 0){t[n]=isNaN(n)?{}:[]}t=t[n]}}_setAttr(t,e,r,n){if(typeof e!=="object"&&e===this.get(t)){return}if(!r&&n!==true){this._updateAttr(this.attributes,t,e)}else{if(this.dirty===false){this.dirty=true}}this._updateAttr(this.stage,t,e);r=r||this;this._publish(t,e,r)}linkAttr(t,e){const r=t.get(e);if(!r){return}for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){this.link(t,e+"."+n,n)}}}scope(t,e){const r=this.get(t);if(!r){return false}e=e||this.constructor;const n=new e(r);n.linkAttr(this,t);return n}splice(t,e){this.delete(t+"["+e+"]");this.refresh(t);return this}push(t,e){let r=this.get(t);if(Array.isArray(r)===false){r=[]}r.push(e);this.set(t,r);return this}unshift(t,e){let r=this.get(t);if(Array.isArray(r)===false){r=[]}r.unshift(e);this.set(t,r);return this}shift(t){let e=this.get(t);if(Array.isArray(e)===false){return null}const r=e.shift();this.set(t,e);return r}pop(t){let e=this.get(t);if(Array.isArray(e)===false){return null}const r=e.pop();this.set(t,e);return r}refresh(t){this.set(t,this.get(t));return 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;let c="",h=this.stage;for(var p=0;p<o;p++){n=i[p];h=h[n];if(p>0){if(isNaN(n)){c+="."+n}}else{c=n}var v;if(p===a){v=e}else{var E=i[p+1];if(isNaN(E)===false){c+="["+E+"]";continue}var q={};q[E]=h[E];v=q}this.publish(c,v,r)}}publish(t,e,r){t=t||"";this._publishAttr(t,e,r);if(!e||typeof e!=="object"){return}let n,i;if(Array.isArray(e)){const 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){if(!Object.prototype.hasOwnProperty.call(e,a)){continue}i=e[a];n=t+"."+a;this._checkPublish(n,i,r)}}}_checkPublish(t,e,r){if(!e||typeof e!=="object"){this._publishAttr(t,e,r)}else{this.publish(t,e,r)}}_publishAttr(t,e,r){y.publish(this._dataId+t,e,r);const n=t+":change";this.eventSub.publish(n,e,r)}mergeStage(){this.attributes=m.clone(this.stage);this.dirty=false}getModelData(){this.mergeStage();return this.attributes}revert(){this.set(this.attributes);this.dirty=false}_deleteAttr(t,e){if(!A.hasDeepData(e)){delete t[e]}const r=A.getSegments(e),n=r.length,i=n-1;for(var o=0;o<n;o++){var a=r[o];var 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]}const r=A.getSegments(e),n=r.length,i=n-1;for(var o=0;o<n;o++){var a=r[o];var c=t[a];if(c===void 0){break}t=c;if(o===i){return t}}return void 0}};var He={"\n":"\\n","\r":"\\n"," ":"\\t"};var Re=(s,t)=>{if(typeof s!=="string"){s=String(s)}const e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>He[r])};var Yt=(s,t)=>{if(typeof s!=="string"){return s}s=Re(s,t);s=encodeURIComponent(s);const e=/%22/g;return s.replace(e,'"')};var At=(s,t)=>{const e=typeof s;if(e==="undefined"){return s}if(e!=="object"){s=Yt(s);return s}Object.entries(s).forEach(([r,n])=>{if(n===null){return}s[r]=typeof n==="string"?At(n,t):Yt(n,t)});return s};function qt(s){return typeof s!=="undefined"&&s.length>0?JSON.parse(s):false}function Ct(s){return typeof s!=="undefined"?JSON.stringify(s):false}var X=class{static prepareJsonUrl(t,e=false){const r=typeof t==="object"?m.clone(t):t,n=At(r,e);return Ct(n)}static xmlParse(t){if(typeof t==="undefined"){return false}const e=new DOMParser;return e.parseFromString(t,"text/xml")}};B(X,"json",{encode:Ct,decode:qt});var ct=class{constructor(t){this.model=t;this.objectType=this.objectType||"item";this.url="";this.validateCallBack=null;this.init()}init(){const t=this.model;if(t&&t.url){this.url=t.url}}isValid(){const t=this.validate();if(t!==false){const e=this.validateCallBack;if(typeof e==="function"){e(t)}}return t}validate(){return true}getDefaultParams(){return""}setupParams(t){const e=this.getDefaultParams();t=this.addParams(t,e);return t}objectToString(t){const e=[];for(var r in t){if(Object.prototype.hasOwnProperty.call(t,r)){e.push(r+"="+t[r])}}return e.join("&")}addParams(t,e){t=t||{};if(typeof t==="string"){t=x.parseQueryString(t,false)}if(!e){return!this._isFormData(t)?this.objectToString(t):t}if(typeof e==="string"){e=x.parseQueryString(e,false)}if(this._isFormData(t)){for(var r in e){if(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){const r=this.model.get("id"),n="op=get&id="+r;const i=this.model;return this._get("",n,t,e,o=>{if(o){const a=this.getObject(o);if(a){i.set(a)}}})}getObject(t){const e=t[this.objectType]||t;return e||false}setupObjectData(){const t=this.model.get();return this.objectType+"="+X.prepareJsonUrl(t)}setup(t,e){if(!this.isValid()){return false}let r="op=setup&"+this.setupObjectData();return this._put("",r,t,e)}add(t,e){if(!this.isValid()){return false}let r="op=add&"+this.setupObjectData();return this._post("",r,t,e)}update(t,e){if(!this.isValid()){return false}let r="op=update&"+this.setupObjectData();return this._patch("",r,t,e)}delete(t,e){const 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)?r:0;n=!isNaN(n)?n:50;let o="op=all&option="+i+"&start="+r+"&stop="+n;return this._get("",o,t,e)}getUrl(t){let e=this.url;if(!t){return e}if(t[0]==="?"){return e+t}return e+="/"+t}setupRequest(t,e,r,n,i){const o={url:this.getUrl(t),method:e,params:r,completed:(c,h)=>{if(typeof i==="function"){i(c)}this.getResponse(c,n,h)}};const a=this._isFormData(r);if(a){o.headers={}}return 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){e=this.setupParams(e);e=this.addParams(e,r);t=t||"";if(e){t+="?"+e}return 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){r=this.setupParams(r);r=this.addParams(r,n);return this.setupRequest(t,e,r,i,o)}getResponse(t,e,r){if(typeof e==="function"){e(t,r)}}static extend(t){if(!t){return false}const e=this;class r extends e{constructor(i){super(i)}}Object.assign(r.prototype,t);return r}};var Ne=s=>{const t={};if(!u.isObject(s)||!s.defaults){return t}const{defaults:e}=s;Object.keys(e).forEach(r=>{const n=e[r];if(typeof n!=="function"){t[r]=n}});delete s.defaults;return t};var _e=s=>{if(!s||typeof s.xhr!=="object"){return{}}const t={...s.xhr};delete s.xhr;return t};var Ie=0;var j=class extends C{xhr=null;constructor(t){const e=super(t);this.initialize();return e}initialize(){}static extend(t={}){const e=this,r=_e(t),n=this.prototype.service.extend(r);const i=Ne(t);class o extends e{constructor(c){const h={...i,...at(c)};super(h);this.xhr=new n(this)}dataTypeId=`bm${Ie++}`}Object.assign(o.prototype,t);o.prototype.service=n;return o}};j.prototype.service=ct;var T=class extends H{_publish(t,e,r,n){const i=t+":change";this.eventSub.publish(i,e,r);r=r||this;y.publish(this._dataId+t,e,r)}};var ht=class extends T{constructor(t){super();this.id=t}addAction(t,e){if(typeof e!=="undefined"){this.set(t,e)}}getState(t){return this.get(t)}removeAction(t,e){if(e){this.off(t,e);return}const r=this.stage;if(typeof r[t]!=="undefined"){delete r[t]}}};var k=class{static restore(t,e){this.targets.set(t,e)}static getTarget(t){if(!this.targets.has(t)){this.targets.set(t,new ht(t))}return this.targets.get(t)}static getActionState(t,e){const r=this.getTarget(t);return r.get(e)}static add(t,e,r){const n=this.getTarget(t);if(e){n.addAction(e,r)}return 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){const n=this.getTarget(t);if(e){return n.on(e,r)}return false}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){const n=this.targets,i=n.get(t);if(!i){return}if(e){i.off(e,r);return}this.targets.delete(t)}static set(t,e,r){const n=this.getTarget(t);n.set(e,r)}};B(k,"targets",new Map);var ut=class{constructor(){this.events=[]}addEvents(t){const e=t.length;if(e<1){return false}t.forEach(r=>{this.on(...r)})}on(t,e,r,n){l.on(t,e,r,n);this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){l.off(t,e,r,n);let i,o=this.events;for(var a=0,c=o.length;a<c;a++){i=o[a];if(i.event===t&&i.obj===e){o.splice(a,1);break}}}set(){this.events.forEach(t=>{l.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{l.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset();this.events=[]}};var ft=class{constructor(t,e){this.remoteStates=[];const r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){const 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){const e=[];for(var r in t){if(!Object.prototype.hasOwnProperty.call(t,r)){continue}if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}var n=null,i=null,o=t[r];if(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++){r=t[n];if(!r){continue}for(var o in r){if(!Object.prototype.hasOwnProperty.call(r,o)||o==="id"){continue}var a=null,c=r[o],h=c!==null?c:void 0;if(h&&typeof h==="object"){a=h.callBack;h=h.state}e.push(this.createState(o,h,a,r.id))}}}removeRemoteStates(){const t=this.remoteStates;if(t){this.removeActions(t)}}removeActions(t){if(t.length<1){return}for(var e=0,r=t.length;e<r;e++){var n=t[e];k.remove(n.targetId,n.action,n.token)}}restore(t){k.restore();const e=this.remoteStates;if(!e){return}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){const n=k.getTarget(r);return t.link(n,e)}addStatesToTarget(t,e){const r=this.remoteStates;for(var n=0,i=e.length;n<i;n++){var o=e[n],a=this.addAction(t,o);if(o.targetId){o.token=a;r.push(o)}}if(r.length<1){this.remoteStates=null}}addAction(t,e){let r,n=e.action;const i=e.targetId;if(i){r=this.bindRemoteState(t,n,i)}if(typeof e.state!=="undefined"){t.addAction(n,e.state)}const o=e.callBack;if(typeof o==="function"){t.on(n,o)}return r}};var Ue={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"};var G=s=>{return Ue[s]||s};var Tt=s=>{if(typeof s==="string"&&s.substring(0,2)==="on"){return s.substring(2)}return s};var b=class{static create(t,e,r,n){const i=document.createElement(t);this.addAttributes(i,e);if(n===true){this.prepend(r,i)}else{this.append(r,i)}return i}static addAttributes(t,e){if(!e||typeof e!=="object"){return false}const r=e.type;if(typeof r!=="undefined"){d.setAttr(t,"type",r)}for(const[n,i]of Object.entries(e)){if(n==="innerHTML"){t.innerHTML=i}else if(n.indexOf("-")!==-1){d.setAttr(t,n,i)}else{this.addAttr(t,n,i)}}}static addHtml(t,e){if(typeof e==="undefined"||e===""){return this}const r=/(?:<[a-z][\s\S]*>)/i;if(r.test(e)){t.innerHTML=e}else{t.textContent=e}return this}static addAttr(t,e,r){if(r===""||!e){return}const n=typeof r;if(n==="function"){e=Tt(e);l.add(e,t,r)}else{const i=G(e);t[i]=r}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){const r=document.createTextNode(t);if(e){this.append(e,r)}return r}static createComment(t,e){const r=document.createComment(t);if(e){this.append(e,r)}return r}static setupSelectOptions(t,e,r){if(!u.isObject(t)){return false}if(!u.isArray(e)){return false}e.forEach(n=>{const i=new Option(n.label,n.value);t.options.add(i);if(r!==null&&i.value==r){i.selected=true}})}static removeElementData(t){const e=t.childNodes;if(e){const o=e.length-1;for(var r=o;r>=0;r--){var n=e[r];if(!n){continue}this.removeElementData(n)}}f.remove(t);const i=t.bindId;if(i){y.unbind(t)}}static removeElement(t){let e;if(!t||!(e=t.parentNode)){return this}this.removeElementData(t);e.removeChild(t);return this}static removeChild(t){this.removeElement(t);return this}static removeAll(t){if(!u.isObject(t)){return this}const e=t.childNodes;for(var r in e){if(Object.prototype.hasOwnProperty.call(e,r)){this.removeElementData(e[r])}}t.innerHTML="";return this}static changeParent(t,e){e.appendChild(t);return this}static append(t,e){t.appendChild(e);return this}static prepend(t,e,r){const n=r||t.firstChild;t.insertBefore(e,n);return this}static clone(t,e=false){if(!u.isObject(t)){return false}return t.cloneNode(e)}};var We=s=>{if(typeof s!=="string"){return s}return $t(s)};var $t=s=>{return[{tag:"text",textContent:s}]};var Kt=s=>{if(!s){return{props:{},children:[]}}const t=s[0];if(typeof t==="string"){return{props:{},children:$t(t)}}if(Array.isArray(t)){return{props:{},children:t}}return{props:t||{},children:We(s[1])}};f.addType("components",s=>{if(!s){return}const t=s.component;if(t&&t.rendered===true){t.prepareDestroy()}});var je=0;var R=class{constructor(...t){this.isUnit=true;this.init();const{props:e,children:r}=Kt(t);this.setupProps(e);this.children??=r;this.onCreated();this.rendered=false;this.container=null}init(){this.id="cp-"+je++}setupProps(t){if(!t||typeof t!=="object"){return}for(var e in t){if(Object.prototype.hasOwnProperty.call(t,e)){this[e]=t[e]}}}getParentContext(){if(!this.parent){return null}return this.parent.getContext()}setupContext(){const t=this.getParentContext();const e=this.setContext(t);if(e){this.context=e;return}this.context=t;this.setupAddingContext()}setupAddingContext(){const t=this.context;const e=this.addContext(t);if(!e){return}const r=e[0];if(!r){return}this.addingContext=true;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(){if(!this.addingContext){return}this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){if(!t){return}delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){if(!t){return t}if(!t.id){t.id=this.getId()}t.cache="panel";return t}_createLayout(){if(this.persist){return this._layout||(this._layout=this.render())}return this.render()}prepareLayout(){const t=this._createLayout();return this._cacheRoot(t)}afterBuild(){f.add(this.panel,"components",{component:this});this.rendered=true;this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return!t?null:e||t}map(t,e){const r=[];if(!t||t.length<1){return r}for(var n=0,i=t.length;n<i;n++){const o=e(t[n],n);r.push(o)}return r}removeAll(t){return b.removeAll(t)}getId(t){let e=this.id;if(typeof t==="string"){e+="-"+t}return e}initialize(){this.setupContext();this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.container=t;this.initialize()}remove(){this.prepareDestroy();this.removeContext();const t=this.panel||this.id;b.removeElement(t)}prepareDestroy(){this.rendered=false;this.beforeDestroy()}beforeDestroy(){}destroy(){this.remove()}};var M=class extends R{constructor(...t){super(...t);this.isComponent=true;this.stateTargetId=null}initialize(){this.setupContext();this.addStates();this.beforeSetup()}afterLayout(){this.addEvents();this.afterSetup()}setupStateTarget(t){const e=t||this.stateTargetId||this.id;this.state=k.getTarget(e)}setupStates(){return{}}addStates(){const t=this.state;if(t){this.stateHelper.restore(t);return}const e=this.setupStates();if(m.isEmpty(e)){return}this.setupStateTarget();this.stateHelper=new ft(this.state,e)}removeStates(){const t=this.state;if(!t){return false}this.stateHelper.removeRemoteStates();k.remove()}setupEventHelper(){if(!this.events){this.events=new ut}}setupEvents(){return[]}addEvents(){const t=this.setupEvents();if(t.length<1){return false}this.setupEventHelper();this.events.addEvents(t)}removeEvents(){const t=this.events;if(t){t.reset()}}prepareDestroy(){this.rendered=false;this.beforeDestroy();this.removeEvents();this.removeStates();this.removeContext();if(this.data&&this.persist===false){this.data.unlink()}}};var Fe={created:"onCreated",state:"setupStates",events:"setupEevents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var Ve=s=>{const t=typeof s;return t==="function"?s:function(){return s}};var Je=s=>{const t={};if(!s){return t}for(var e in s){if(!Object.prototype.hasOwnProperty.call(s,e)){continue}const r=s[e];const n=Fe[e];if(n){t[n]=Ve(r);continue}t[e]=r}return t};var ze=s=>{class t extends M{}Object.assign(t.prototype,s);return t};var Xt=s=>{class t extends R{}Object.assign(t.prototype,s);return t};var N=function(s){if(!s){return null}let t;switch(typeof s){case"object":if(s.render){t=Je(s);return ze(t)}t={render(){return s}};return Xt(t);case"function":t={render:s};return Xt(t)}};var Ye={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=false){const e=this.dayNames;if(s>e.length){return false}const 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"):"";const e=new Date(s),r=t===true?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),true)+" "+this.padNumber(e.getDate())+r},padNumber(s){return s<=9?"0"+s:String(s)},createDate(s){if(!s){return new Date}if(typeof s==="string"&&s.indexOf("-")>-1){s=s.replace(/\s/,"T");s=s.indexOf(":")>-1?s:s+"T00:00:00"}return new Date(s)},format(s,t){const 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){const 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";if(r>=12){n="PM"}if(r>12){r=r-12}return r+":"+this.padNumber(e.getMinutes())+" "+n},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=false){const e=this.monthNames;if(s>e.length){return false}const r=e[s];if(!r){return false}return t?r.substring(0,3):r},getMonthLength(s,t){const e=new Date;s=typeof s!=="undefined"?s:e.getMonth();t=typeof t!=="undefined"?t:e.getFullYear();const r=this.getMonthsLength(t);return r[s]},getMonthsLength(s=new Date().getFullYear()){const t=this.leapYear(s);const e=t===true?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31];return e},getDiffFromNow(s,t){s=s.replace(/\s/,"T");s=new Date(s);const e=new Date;if(t===true){e.setHours(0,0,0,0)}let r=e.getTime()-s.getTime();return r},getAge(s){const t=this.getDiffFromNow(s);let e="",r="";switch(true){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){const t=this.getDiffFromNow(s);return this.convertToEstimate(t)},convertToEstimate(s){let t="";let e,r,n,i,o,a,c;if(s<=0){switch(true){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(true){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){if(typeof s!=="number"){return false}return Math.floor(s/(1e3*60*60*24*365.26))},toMonths(s){if(typeof s==="number"){return Math.floor(s/(1e3*60*60*24*30))}return false},toDays(s){if(typeof s!=="number"){return false}return Math.floor(s/(60*60*1e3*24)*1)},toHours(s){if(typeof s!=="number"){return false}return Math.floor(s%(60*60*1e3*24)/(60*60*1e3)*1)},toMinutes(s){if(typeof s!=="number"){return false}return Math.floor(s%(60*60*1e3*24)%(60*60*1e3)/(60*1e3)*1)},toSeconds(s){if(typeof s!=="number"){return false}return Math.floor(s%(60*60*1e3*24)%(60*60*1e3)%(60*1e3)/1e3*1)},getDifference(s,t){const 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 Gt=(s,t)=>{return{name:s,callBack:t}};var F={keys:[],items:{},add(s,t){this.keys.push(s);this.items[s]=Gt(s,t);return this},get(s){return this.items[s]||null},all(){return this.keys}};var Et=(s,t)=>{return{attr:s,directive:t}};var V=(s,t)=>{return{key:s,value:t}};var Qt=(s,t,e,r)=>{return{tag:s,attr:t,directives:e,children:r}};var J=class{static getTag(t){return t.tag||"div"}static setupChildren(t){if(t.nest){t.children=t.nest;delete t.nest}}static setElementContent(t,e,r,n){if(t==="text"){n.push({tag:"text",textContent:e});return true}if(t==="html"||t==="innerHTML"){r.push(V("innerHTML",e));return true}return false}static setTextAsWatcher(t,e,r){r={attr:G(e),value:r};t.push(Et(V(e,r),F.get("watch")))}static setButtonType(t,e,r){if(t==="button"){const n=e.type||"button";r.push(V("type",n))}}static parse(t,e){const 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(!m.hasOwnProp(t,h)||h==="tag"){continue}a=t[h];if(a===void 0||a===null){continue}if((c=F.get(h))!==null){n.push(Et(V(h,a),c));continue}const p=typeof a;if(p==="object"){if(h==="children"){o=o.concat(a);continue}if(P.isWatching(a)){this.setTextAsWatcher(n,h,a);continue}o.push(a);continue}if(p==="function"){const v=a;a=function(E){v.call(this,E,e)}}if(P.isWatching(a)){this.setTextAsWatcher(n,h,a);continue}if(this.setElementContent(h,a,r,o)){continue}r.push(V(h,a))}return Qt(i,r,n,o)}};var w=class extends b{static create(t,e,r,n){const i=document.createElement(t);this.addAttributes(i,e,n);r.appendChild(i);return i}static addAttributes(t,e,r){if(!e||e.length<1){return}e.forEach(n=>{const{key:i,value:o}=n;if(i==="innerHTML"){t.innerHTML=o;return}if(i.substr(4,1)==="-"){d.setAttr(t,i,o);return}this.addAttr(t,i,o,r)})}static addAttr(t,e,r,n){if(r===""||!e){return false}const i=typeof r;if(i==="function"){e=Tt(e);l.add(e,t,function(o){r.call(this,o,n)})}else{const o=G(e);t[o]=r}}static addContent(t,e){if(!e){return}if(e.textContent!==null){t.textContent=e.textContent}else if(e.innerHTML){t.innerHTML=e.innerHTML}}static append(t,e){t.appendChild(e)}};var z=class{createNode(t,e,r){}};var lt=class extends z{createNode(t,e,r){const n=t.tag;if(n==="text"){const i=t.attr[0];const o=i?i.value:"";return w.createText(o,e)}else if(n==="comment"){const i=t.attr[0];const o=i?i.value:"";return w.createComment(o,e)}return w.create(n,t.attr,e,r)}};var pt=class extends z{createNode(t,e,r){const n=t.tag;if(n==="text"){const i=t.attr[0];const o=i?i.value:""}else if(n==="comment"){const i=t.attr[0];const o=i?i.value:""}}};var dt=class{static browserIsSupported(){return window}static setup(){if(this.browserIsSupported()){return new lt}return new pt}};var qe=dt.setup();var g=class{static render(t,e,r){if(!t){return null}if(typeof t==="object"&&t.isUnit===true){this.createComponent(t,e,r);return t}const n=N(t);const i=new n;this.createComponent(i,e,r);return i}static build(t,e,r){const n=w.createDocFragment();const i=Array.isArray(t)?t:[t];i.forEach(o=>this.buildElement(o,n,r));if(e&&typeof e==="object"){e.appendChild(n)}return n}static rebuild(t,e,r){w.removeAll(e);return this.build(t,e,r)}static buildElement(t,e,r){if(!t){return}if(t.isUnit===true){this.createComponent(t,e,r);return}this.createElement(t,e,r)}static createElement(t,e,r){const n=J.parse(t,r),i=this.createNode(n,e,r);this.cache(i,t.cache,r);n.children.forEach(a=>{if(a!==null){this.buildElement(a,i,r)}});const o=n.directives;if(o&&o.length){this.setDirectives(i,o,r)}}static setDirectives(t,e,r){e.forEach(n=>{this.handleDirective(t,n,r)})}static handleDirective(t,e,r){e.directive.callBack(t,e.attr.value,r)}static cache(t,e,r){if(r&&e){r[e]=t}}static createComponent(t,e,r){const n=t;n.parent=r;if(r&&r.persist===true&&n.persist!==false){n.persist=true}if(n.cache&&r){r[n.cache]=n}n.setup(e);const i=n.prepareLayout();this.build(i,n.container,n);n.afterBuild();if(t.component&&typeof t.onCreated==="function"){t.onCreated(n)}}static createNode(t,e,r){return qe.createNode(t,e,r)}};S.augment({buildLayout(s,t,e){g.build(s,t,e)}});var Pt=[];var $e=s=>Pt.indexOf(s)!==-1;var Ke=s=>({tag:"script",src:s.src,async:false,load(t){Pt.push(s.src);const e=s.load;if(e){e()}}});var Xe=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){Pt.push(s.src);const e=s.load;if(e){e()}}});var Ot=class{constructor(t){this.percent=0;this.loaded=0;this.total=0;this.callBack=t||null}add(t){this.total++;let e;const r=this.update.bind(this);if(t.indexOf(".css")!==-1){e=Xe({load:r,src:t})}else{e=Ke({load:r,src:t})}g.build(e,document.head)}addFiles(t){if(!t){return}t.forEach(e=>{if(!$e(e)){this.add(e)}})}update(){const t=this.updateProgress();if(t<100){return}const e=this.callBack;if(e){e()}}updateProgress(){++this.loaded;return this.percent=Math.floor(this.loaded/this.total*100)}};var Ge=(s,t)=>{import(s).then(e=>{if(t){t(e)}})};var Qe=s=>{if(!s){return false}return typeof s?.prototype?.constructor==="function"};var Ze=(s,t,e)=>{const r=g.build(s,null,e);const n=r.firstChild;t.after(r);return n};var tr=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated});var er=N({render(){return tr({onCreated:s=>{const t=this.src;if(!t){return}if(this.depends){const e=new Ot(()=>{this.loadAndRender(s)});e.addFiles(this.depends);return}this.loadAndRender(s)}})},getLayout(s){let t=s.default;if(!t){return null}const e=this.callBack;if(e){t=e(t)}else{if(Qe(t)){t=new t;t.route=this.route;if(this.persist){t.persist=true}}else{t=t()}}return this.layout=t},loadAndRender(s){Ge(this.src,t=>{this.loaded=true;const e=this.layout||this.getLayout(t);this.layoutRoot=Ze(e,s,this.parent)})},shouldUpdate(s){if(this.updateLayout===true){return true}return this.updateLayout=s&&s.isUnit&&typeof s.update==="function"},updateModuleLayout(s){const t=this.layout;if(this.shouldUpdate(t)){t.update(s)}},update(s){if(this.loaded===true){this.updateModuleLayout(s)}},beforeDestroy(){if(!this.layoutRoot){return}b.removeElement(this.layoutRoot)}});var Mt=s=>{return new er(s)};var Q=(s,t,e,r)=>{let n,i,o;if(Array.isArray(e[0])){e.forEach(a=>{if(!a){return}Q(s,t,a,r)});return}if(e.length<3){[n,i]=e}else{[t,n,i]=e}if(!t||!n){return false}switch(typeof i){case"object":o=a=>{nr(s,i,a)};break;case"function":o=a=>{rr(s,i,n,a,r)};break}y.watch(s,t,n,o)};var rr=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(n&&i&&i.isUnit===true&&n.persist===true&&n.state){let o=e+":"+r,a=n.state,c=a.get(o);if(typeof c!=="undefined"){i=c}a.set(o,i)}sr(i,s,n);break;case"string":b.addHtml(s,i);break}};var sr=(s,t,e)=>{g.rebuild(s,t,e)};var nr=(s,t,e)=>{for(const[r,n]of Object.entries(t)){if(!r){continue}if(n===e){d.addClass(s,r)}else{d.removeClass(s,r)}}};var _=s=>{if(s.data){return s.data}if(s.context&&s.context.data){return s.context.data}return null};var mt=(s,t,e)=>{const r=_(e);Q(s,r,t,e)};var Zt=(s,t,e)=>{if(!t){return}if(t){d.setAttr(s,"role",t)}};var ir=s=>{return(t,e)=>{const r=e?"true":"false";d.setAttr(t,s,r)}};var te=(s,t,e)=>{if(!t){return}const r=t.role;if(r){d.setAttr(s,"role",r);t.role=null}Object.entries(t).forEach(([n,i])=>{if(i===null){return}const o=`aria-${n}`;if(Array.isArray(i)){i.push(ir(o));mt(s,i,e)}else{d.setAttr(s,o,i)}})};f.addType("context",s=>{if(!s){return false}s.parent.removeContextBranch(s.branch)});var Bt=s=>{return!s?null:s.getContext()};var ee=(s,t,e)=>{if(typeof t!=="function"){return}const r=Bt(e);const n=t(r);if(!n){return}const i=J.parse(n,e);w.addAttributes(s,i.attr,e);g.setDirectives(s,i.directives,e)};var re=(s,t,e)=>{if(typeof t!=="function"){return}const r=Bt(e);t(r)};var se=(s,t,e)=>{if(typeof t!=="function"||!e){return}const r=Bt(e);const n=t(r);if(!n){return}e.addContextBranch(n[0],n[1])};var ne=(s,t,e)=>{};var ie=(s,t,e)=>{if(!t||!e){return false}t(e,s)};var oe=(s,t,e)=>{if(!t||!e){return false}t(e.data,s)};var ae=(s,t,e)=>{if(!t||!e){return false}t(e.state,s)};var ce=(s,t,e)=>{if(!t||!e){return false}if(e.stateHelper){const r=e.state;const n=t(r);e.stateHelper.addStates(n)}};var he=(s,t,e)=>{let r,n,i;if(typeof t==="string"){r=_(e);n=t}else if(Array.isArray(t)){if(typeof t[0]!=="object"){const o=_(e);t.unshift(o)}[r,n,i]=t}y.bind(s,r,n,i)};var ue=(s,t,e)=>{let r,n,i,o;if(t.length<3){const c=_(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]}const a=o!==false;y.watch(s,r,n,c=>{b.removeAll(s);if(!c||c.length<1){return}const h=[];c.forEach((p,v)=>{const E=a?r.scope(n+"["+v+"]"):null;const q=p(c[v],v,E);if(q===null){return}h.push(q)});return g.build(h,s,e)})};var fe=(s,t,e)=>{const r=t[0];if(!r||r.length<1){return}const n=t[1];const i=[];r.forEach((o,a)=>{if(!o){return}const c=n(o,a);if(c===null){return}i.push(c)});return g.build(i,s,e)};var le=(s,t,e)=>{t(s)};f.addType("destroyed",s=>{if(!s){return false}s.callBack(s.ele)});var pe=(s,t,e)=>{or(s,t)};var or=(s,t)=>{f.add(s,"destroyed",{ele:s,callBack:t})};var de=(s,t,e)=>{Q(s,e.state,t,e)};var me=(s,t,e)=>{if(!t){return false}if(Array.isArray(t)&&typeof t[0]!=="string"){for(var r=0,n=t.length;r<n;r++){P.setup(s,t[r],e)}}else{P.setup(s,t,e)}};var ar=0;var Y=class{constructor(t){this.router=t;this.locationId="base-app-router-"+ar++;this.callBack=this.check.bind(this)}setup(){this.addEvent();return this}};var gt=class extends Y{addEvent(){l.on("popstate",window,this.callBack);return this}removeEvent(){l.off("popstate",window,this.callBack);return this}check(t){const e=t.state;if(!e||e.location!==this.locationId){return false}t.preventDefault();t.stopPropagation();this.router.checkActiveRoutes(e.uri)}createState(t,e={}){return{location:this.locationId,...e,uri:t}}addState(t,e,r=false){const n=window.history,i=n.state;if(i&&i.uri===t){return this}const o=this.createState(t,e);const a=r===false?"pushState":"replaceState";n[a](o,null,t);return this}};var yt=class extends Y{addEvent(){l.on("hashchange",window,this.callBack);return this}removeEvent(){l.off("hashchange",window,this.callBack);return this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,r){window.location.hash=t;return this}};var bt=class{static browserIsSupported(){return"history"in window&&"pushState"in window.history}static setup(t){if(this.browserIsSupported()){return new gt(t).setup()}return new yt(t).setup()}};var xt=class{constructor(t,e){this.route=t;this.template=e.component;this.component=null;this.hasTemplate=false;this.setup=false;this.container=e.container;this.persist=e.persist;this.parent=e.parent;this.setupTemplate()}focus(t){if(this.setup===false){this.create()}this.update(t)}setupTemplate(){let t=this.template;if(typeof t==="string"){t=this.template=window[t];if(!t){return}}const e=typeof t;if(e==="function"){this.initializeComponent()}else if(e==="object"){this.initializeTemplateObject()}this.hasTemplate=true}initializeComponent(){this.component=new this.template({route:this.route,persist:this.persist,parent:this.parent})}initializeTemplateObject(){if(!this.template.isUnit){this.template=N(this.template)}const t=this.template;this.persist=t.persist!==false;Object.assign(t,{route:this.route,persist:this.persist,parent:this.parent});this.component=t}create(){if(!this.hasTemplate){return false}this.setup=true;let t=this.component;if(!this.persist||!t){t=this.component=this.template}g.render(t,this.container,this.parent)}remove(){if(this.setup!==true){return false}this.setup=false;const t=this.component;if(!t){return false}if(typeof t.destroy==="function"){t.destroy()}if(this.persist===false){this.component=null}}update(t){const e=this.component;if(!e){return false}if(typeof e.update==="function"){e.update(t)}}};var ge=s=>{if(!s.length){return null}const t={};s.forEach(e=>{t[e]=null});return t};var ye=s=>{const t=[];if(!s){return t}const e=/[*?]/g;s=s.replace(e,"");const r=/:(.[^./?&($]+)\?*/g,n=s.match(r);if(n===null){return t}n.forEach(i=>{if(i){i=i.replace(":","");t.push(i)}});return t};var cr=s=>s.replace(/\//g,"/");var hr=s=>{return s.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)"))};var ur=s=>{s=s.replace(/(\?\/+\*?)/g,"?/*");return s.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")};var fr=s=>s.replace(/(\*)/g,".*");var lr=(s,t)=>s+=t[t.length-1]==="*"?"":"$";var be=s=>{if(!s){return""}let t=cr(s);t=hr(t);t=ur(t);t=fr(t);t=lr(t,s);return t};var pr=0;var vt=class extends T{uriQuery=null;controller=null;paramKeys=null;titleCallBack=null;path=null;referralPath=null;params=null;callBack=null;title=null;constructor(t,e){const r=t.baseUri;const n=ye(r);const i=ge(n);const o=super(i);this.uri=r;this.paramKeys=n;this.titleCallBack=e;this.setupRoute(t);this.set("active",false);return o}setupRoute(t){this.id=t.id||"bs-rte-"+pr++;this.path=null;this.referralPath=null;let e=be(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",false);const t=this.controller;if(t){t.remove()}}getLayout(t){if(t.component){return t.component}let e=t.import;if(!e){return null}if(typeof e==="string"){e={src:e}}return Mt(e)}setupComponentHelper(t){const e=this.getLayout(t);if(!e){return}const{container:r,persist:n=false,parent:i}=t;const o={component:e,container:r,persist:n,parent:i};this.controller=new xt(this,o)}resume(t){const e=this.controller;if(e){e.container=t}}setPath(t,e){this.path=t;this.referralPath=e}select(){this.set("active",true);const t=this.stage,e=this.callBack;if(typeof e==="function"){e(t)}const r=this.controller;if(r){r.focus(t)}const n=this.path;if(!n){return}const i=n.split("#")[1];if(!i){return}this.scrollToId(i)}scrollToId(t){if(!t){return}const e=document.getElementById(t);if(!e){return}e.scrollIntoView(true)}match(t){let e=false;const r=t.match(this.uriQuery);if(r===null){this.resetParams();return e}if(!Array.isArray(r)){return e}r.shift();e=r;this.setParams(r);return e}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t)){return}const e=this.paramKeys;if(!e){return}const r={};e.forEach((n,i)=>{if(typeof n!=="undefined"){r[n]=t[i]}});this.set(r)}getParams(){return this.stage}};var dr=s=>{const t=/\w\S*/;return s.replace(t,e=>{return e.charAt(0).toUpperCase()+e.substring(1).toLowerCase()})};var mr=(s,t)=>{if(s.indexOf(":")===-1){return s}const e=t.stage;for(const[r,n]of Object.entries(e)){const i=new RegExp(":"+r,"gi");s=s.replace(i,n)}return s};var xe=(s,t,e)=>{if(!t){return t}if(typeof t==="function"){t=t(s.stage)}t=mr(t,s);t=dr(t);if(e!==""){t+=" - "+e}return t};var ve={removeSlashes(s){if(typeof s!=="string"){return""}if(s.substring(0,1)==="/"){s=s.substring(1)}if(s.substring(-1)==="/"){s=s.substring(0,s.length-1)}return s}};var kt=class extends M{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){const t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:true}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,watch:r}}getString(t){const e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){const r=this.exact!==false,n=D.data;const i=[];if(t&&typeof t==="object"){i.push({attr:"href",value:t})}if(e&&typeof e==="object"){i.push({attr:"text",value:e})}i.push({value:["[[path]]",n],callBack:(o,a)=>{const c=a.pathname+a.hash;const h=r?o===c:new RegExp("^"+a.pathname+"($|#|/|\\.).*").test(o);this.update(h)}});return i}setupStates(){return{selected:false}}update(t){this.state.set("selected",t)}};f.addType("routes",s=>{if(!s){return false}const t=s.route;if(t){D.removeRoute(t)}});f.addType("switch",s=>{if(!s){return false}const t=s.id;D.removeSwitch(t)});var Lt=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 C({path:""})}setupHistory(){this.history=bt.setup(this)}createRoute(t){const e=t.uri||"*";t.baseUri=this.createURI(e);return new vt(t,this.updateTitle.bind(this))}add(t){if(typeof t!=="object"){const r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}const e=this.createRoute(t);this.addRoute(e);return 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||"";if(t[t.length-1]!=="/"){t+="/"}this.basePath=t}return this.basePath}createURI(t){const e=this.getBasePath();return e+ve.removeSlashes(t)}getRoute(t){const 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 false}getRouteById(t){const 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 false}removeRoute(t){const e=this.routes,r=e.indexOf(t);if(r>-1){e.splice(r,1)}}addSwitch(t){const e=this.switchCount++;const r=this.getSwitchGroup(e);t.forEach(n=>{const i=this.createRoute(n);r.push(i)});this.checkGroup(r,this.getPath());return e}resumeSwitch(t,e){const r=this.switchCount++;const n=this.getSwitchGroup(r);t.forEach(i=>{const o=i.component.route;o.resume(e);n.push(o)});this.checkGroup(n,this.getPath());return r}getSwitchGroup(t){return this.switches[t]=[]}removeSwitch(t){const e=this.switches;if(e[t]){delete e[t]}}remove(t){t=this.createURI(t);const e=this.getRoute(t);if(e!==false){this.removeRoute(e)}return this}setup(t,e){this.baseURI=t||"/";this.updateBaseTag(this.baseURI);this.title=typeof e!=="undefined"?e:"";this.setupHistory();this.data.path=this.getPath();this.callBackLink=this.checkLink.bind(this);l.on("click",document,this.callBackLink);const r=this.getEndPoint();this.navigate(r,null,true);return this}updateBaseTag(t){const e=document.getElementsByTagName("base");if(e.length){e[0].href=t}}getParentLink(t){let e=t.parentNode;while(e!==null){if(e.nodeName.toLowerCase()==="a"){return e}e=e.parentNode}return false}checkLink(t){if(t.ctrlKey===true){return true}let e=t.target||t.srcElement;if(e.nodeName.toLowerCase()!=="a"){e=this.getParentLink(e);if(e===false){return true}}if(e.target==="_blank"||d.data(e,"cancel-route")){return true}const r=e.getAttribute("href");if(typeof r!=="undefined"){const n=this.baseURI,i=n!=="/"?r.replace(n,""):r;this.navigate(i);t.preventDefault();t.stopPropagation();return false}}reset(){this.routes=[];this.switches=[];this.switchCount=0;return this}activate(){this.checkActiveRoutes();return this}navigate(t,e,r){t=this.createURI(t);this.history.addState(t,e,r);this.activate();return this}updatePath(){const t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title){return this}const e=t.title;document.title=xe(t,e,this.title)}checkActiveRoutes(t){this.lastPath=this.path;t=t||this.getPath();this.path=t;const e=this.routes,r=e.length;let n;for(var i=0;i<r;i++){n=e[i];if(typeof n==="undefined"){continue}this.checkRoute(n,t)}this.checkSwitches(t);this.updatePath()}checkSwitches(t){const e=this.switches;for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r)){continue}var n=e[r];this.checkGroup(n,t)}}checkGroup(t,e){let r=false,n,i,o,a,c=false;for(var h=0,p=t.length;h<p;h++){n=t[h];if(typeof n==="undefined"){continue}if(h===0){i=n}if(!o&&n.get("active")){o=n}if(r!==false){if(c){n.deactivate()}continue}r=n.match(e);if(r!==false){a=n;if(n.controller){this.select(n);c=true}}}if(a===void 0){this.select(i);if(o&&i!==o){o.deactivate()}return}if(o){if(c&&a!==o){o.deactivate()}}else if(i&&c===false){this.select(i)}}checkRoute(t,e){const r=this.check(t,e);if(r!==false){this.select(t)}else{t.deactivate()}return r}check(t,e){if(!t){return false}e=e||this.getPath();return t.match(e)!==false}select(t){if(!t){return}t.setPath(this.path,this.lastPath);t.select();this.updateTitle(t)}getEndPoint(){const t=this.getPath();return t.replace(this.baseURI,"")||"/"}destroy(){l.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;if(this.history.type==="hash"){return t.hash.replace("#","")}return e+t.search+t.hash}};var D=new Lt;var Ht=(s,t,e)=>{if(!t){return false}if(Array.isArray(t)){t.forEach(r=>{Ht(s,r,e)})}else{gr(s,t,e)}};var gr=(s,t,e)=>{t.container=s;t.parent=e;let r=D.add(t);yr(s,r)};var yr=(s,t)=>{f.add(s,"routes",{route:t})};var ke=(s,t,e)=>{let r=t[0];t.forEach(i=>{i.container=s;i.parent=e});const n=D.addSwitch(t);br(s,n)};var br=(s,t)=>{f.add(s,"switch",{id:t})};F.add("cache",ne).add("onCreated",le).add("onDestroyed",pe).add("bind",he).add("onSet",mt).add("onState",de).add("watch",me).add("useParent",ie).add("useData",oe).add("useState",ae).add("addState",ce).add("map",fe).add("for",ue).add("useContext",re).add("addContext",se).add("context",ee).add("role",Zt).add("aria",te).add("route",Ht).add("switch",ke);S.augment({Ajax:tt,Html:b,dataBinder:y,Data:C,SimpleData:T,Model:j,State:k,Builder:g,router:D,Component:M});export{tt as Ajax,O as Arrays,Be as Atom,g as Builder,M as Component,C as Data,f as DataTracker,Ye as DateTime,F as Directives,d as Dom,b as Html,Mt as Import,N as Jot,j as Model,kt as NavLink,m as Objects,T as SimpleData,k as State,x as Strings,u as Types,R as Unit,S as base,y as dataBinder,D as router};
|
|
1
|
+
var ve=Object.defineProperty;var ke=(s,t,e)=>t in s?ve(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var B=(s,t,e)=>(ke(s,typeof t!="symbol"?t+"":t,e),e);var O=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 isFunction(t){return typeof t=="function"}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)this.hasOwnProp(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},hasOwnProp(s,t){return Object.prototype.hasOwnProperty.call(s,t)},isPlainObject(s){return Object.prototype.toString.call(s)==="[object Object]"},isEmpty(s){if(u.isObject(s)===!1)return!0;for(var t in s)if(this.hasOwnProp(s,t))return!1;return!0}};var q={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=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let r,n=q.get(t);for(var i=0,o=e.length;i<o;i++)r=e[i],r&&(e[i]=null,this.removeByCallBack(n,r));this.types.delete(t)}remove(t){if(t){this.removeType(t);return}this.types.forEach((e,r)=>{!r||this.removeType(r)}),this.types.clear()}};var f=class{static addType(t,e){q.add(t,e)}static removeType(t){q.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.get(r);return n?e?n.get(e):n:!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new Z),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let r=t.trackingId;if(!r||!this.trackers.has(r))return;let n=this.trackers.get(r);e?(n.remove(e),this.isEmpty(n.types)&&this.trackers.delete(r)):(n.remove(),this.trackers.delete(r))}};B(f,"trackers",new Map),B(f,"trackingCount",0);var wt=s=>{let t=0;for(let e of Object.entries(s))t++,typeof s[e]=="object"&&(t+=wt(s[e]));return t},Ht=(s,t)=>{let e=!1;if(typeof s!="object"||typeof t!="object")return e;for(let[r,n]of Object.entries(s)){if(!m.hasOwnProp(t,r))break;let i=t[r];if(typeof n!=typeof i)break;if(typeof n=="object"){if(e=Ht(n,i),e!==!0)break}else if(n===i)e=!0;else break}return e},we=(s,t)=>{let e=wt(s),r=wt(t);return e!==r?!1:Ht(s,t)},Rt=(s,t)=>{let e=typeof s;return e!==typeof t?!1:e==="object"?we(s,t):s===t};var l={getEvents(s){return u.isObject(s)===!1?!1:f.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 f.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:(f.remove(s,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(s){this.swap.push(s)},isSwappable(s){return this.swap.includes(s)}};f.addType("events",s=>{l.removeEvent(s)});var Nt={events:l,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let n=this.events;return Array.isArray(s)?s.forEach(i=>{n.add(i,t,e,r)}):n.add(s,t,e,r),this},off(s,t,e,r){let n=this.events;return Array.isArray(s)?s.forEach(i=>{n.remove(i,t,e,r)}):n.remove(s,t,e,r),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="CustomEvent";for(let[r,n]of Object.entries(t))if(s.match(n)){e=r;break}return e},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 X=class{constructor(){this.version="3.0.10",this.errors=[],this.dataTracker=f}augment(t){return u.isObject(t)?(Object.entries(t).forEach(([e,r])=>{this.constructor.prototype[e]=r}),this):this}override(t,e,r,n){return(t[e]=r).apply(t,O.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=!1){return typeof e!="function"?!1:(...i)=>(n===!0&&(r=r.concat(i)),e.apply(t,r))}bind(t,e){return e.bind(t)}};X.prototype.extend=function(){return X.prototype}();var S=new X;S.augment({...m,...Nt,...u,equals:Rt});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;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};S.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(S.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=_t}});var tt=(...s)=>new St(s).xhr,St=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=()=>{l.removeEvents(r.upload),l.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);l.on(["load","error","abort"],e,r),l.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?O.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]:O.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]))return n;let o=window.getComputedStyle(t,null);return o?o[e]:r}static css(t,e,r){return typeof r<"u"?(this.setCss(t,e,r),this):this.getCss(t,e)}static removeAttr(t,e){return 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=new Map}add(t,e,r){return this.find(t).set(e,r),r}get(t,e){let r=this.connections.get(t);return r&&r.get(e)||!1}find(t){let e=this.connections.get(t);if(e)return e;let r=new Map;return this.connections.set(t,r),r}remove(t,e){let r=this.connections.get(t);if(!r)return;let n;if(e)n=r.get(e),n&&(n.unsubscribe(),r.delete(e)),r.size===0&&this.connections.delete(t);else{for(let i of r)n=r.get(i),n&&n.unsubscribe();this.connections.delete(t)}}};var I=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var rt=class extends I{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 U=class{unsubscribe(){}};var st=class extends U{constructor(){super(),this.source=null}addSource(t){return this.source=new rt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var W=class extends I{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,It(s,t,e)},It=(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)==="-")return this.setValue=Se,this.getValue=Ae,this;this.getValue=Ce;let r=t.type;if(r)switch(r){case"checkbox":this.setValue=Te;return;case"radio":this.setValue=De;return}return this.setValue=It,this}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;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}};var ot=class extends U{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){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}};var Ut=-1,L=class{constructor(){this.callBacks=new Map,this.lastToken=-1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,[]),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.lastToken=-1,Ut=-1}on(t,e){let r=++Ut;return this.get(t).push({token:r,callBack:e}),r}off(t,e){let r=this.callBacks.get(t);if(!r)return;let n=r.findIndex(i=>i.token===e);n!==-1&&r.splice(n,1)}remove(t){this.callBacks.delete(t)}publish(t,...e){let r=this.callBacks.get(t);if(!!r)for(let{callBack:n}of r)!n||n.apply(this,e)}};var Dt=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=[20,37,38,39,40],this.connections=new et,this.pubSub=new L,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null;if(r.indexOf(":")!==-1){let p=r.split(":");p.length>1&&(i=p[1],o=p[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 p=`${e.getDataId()}:${r}`;return a.addElement(t,n,i).subscribe(p),this.addConnection(o,"bind",a),a}addConnection(t,e,r){return this.connections.add(t,e,r),this}setBindId(t){let e="db-"+this.idCount++;return t.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 this;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);return typeof h<"u"&&n(h),this}unwatch(t,e,r){if(u.isObject(t)===!1)return this;let n=t[this.attr];if(n){let i=e.getDataId()+":"+r;this.connections.remove(n,i)}return this}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(){l.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){l.off(["change","paste","input"],document,this.changeHandler,!1)}},y=new Dt;var Wt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,P={isWatching(s){return Array.isArray(s)?typeof s[0]=="string"&&this.hasParams(s[0]):this.hasParams(s)},hasParams(s){return u.isString(s)&&s.includes("[[")},_getWatcherProps(s){let t=/\[\[(.*?)(\[\d+\])?\]\]/g,e=s.match(t);return e===null?null:(t=/(\[\[|\]\])/g,e.map(r=>r.replace(t,"")))},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"innerHTML":s.innerHTML=e;break;default:if(t.substring(4,1)==="-"){d.setAttr(s,t,e);break}s[t]=e;break}},_getWatcherCallBack(s,t,e,r,n){return()=>{let i=0,o=e.replace(Wt,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(Wt),c=a&&a.length>1;i=(h,p)=>{h=c!==!0?h:this.getPropValues(e,a,n),o(h,t,p)}}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,p=c.length;h<p;h++){var v=o?n[h]:n;this.addWatcher(s,v,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){y.watch(s,t,e,r)}};var Ee=s=>typeof s!="string"?s:jt(s),jt=s=>[{tag:"text",textContent:s}],Oe=s=>{if(!s)return{props:{},children:[]};let t=s[0];return typeof t=="string"?{props:{},children:jt(t)}:Array.isArray(t)?P.isWatching(t)===!1?{props:{},children:t}:{props:{watch:t},children:[]}:{props:t||{},children:Ee(s[1])}},Pe=s=>(...t)=>{let{props:e,children:r}=Oe(t);return s(e,r)};var at=s=>{let t={};if(!u.isObject(s))return t;let e=m.clone(s);return Object.keys(e).forEach(r=>{let n=e[r];typeof n!="function"&&(t[r]=n)}),t};function Ft(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=Ft(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=Ft(t,n);return s.set(c,i),Reflect.set(a,n,i,o)}}}var Jt=(s,t="stage")=>new Proxy(s,Vt(s,"",t));var Me=0,H=class{constructor(t){this.dirty=!1,this.links={},this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new L;let e=at(t);return this.set(e),Jt(this)}setup(){this.stage={}}_init(){let t=++Me;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;return Object.entries(e).forEach(([i,o])=>{typeof o!="function"&&this._setAttr(i,o,r,n)}),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=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,r){let n=r||e,i=t.get(e);typeof i<"u"&&this.get(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;e.length<1||(e.forEach(r=>{this.removeLink(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 p=0;p<o;p++){n=i[p],h=h[n],p>0?isNaN(n)&&(c+="."+n):c=n;var v;if(p===a)v=e;else{var E=i[p+1];if(isNaN(E)===!1){c+="["+E+"]";continue}var $={};$[E]=h[E],v=$}this.publish(c,v,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){y.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 Be={"\n":"\\n","\r":"\\n"," ":"\\t"},Le=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>Be[r])},Yt=(s,t)=>{if(typeof s!="string")return s;s=Le(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},Tt=(s,t)=>{let e=typeof s;return e==="undefined"?s:e!=="object"?(s=Yt(s),s):(Object.entries(s).forEach(([r,n])=>{n!==null&&(s[r]=typeof n=="string"?Tt(n,t):Yt(n,t))}),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 K=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?m.clone(t):t,n=Tt(r,e);return At(n)}static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};B(K,"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+"="+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+"="+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 He=s=>{let t={};if(!u.isObject(s)||!s.defaults)return t;let{defaults:e}=s;return Object.keys(e).forEach(r=>{let n=e[r];typeof n!="function"&&(t[r]=n)}),delete s.defaults,t},Re=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},Ne=0,j=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=He(t);class o extends e{constructor(c){let h={...i,...at(c)};super(h),this.xhr=new n(this)}dataTypeId=`bm${Ne++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};j.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,y.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 k=class{static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new ht(t)),this.targets.get(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.get(t);if(!!i){if(e){i.off(e,r);return}this.targets.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};B(k,"targets",new Map);var ut=class{constructor(){this.events=[]}addEvents(t){if(t.length<1)return!1;t.forEach(r=>{this.on(...r)})}on(t,e,r,n){l.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){l.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(){this.events.forEach(t=>{l.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{l.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];k.remove(n.targetId,n.action,n.token)}}restore(t){k.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=k.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,Ct=s=>typeof s=="string"&&s.substring(0,2)==="on"?s.substring(2):s,b=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(let[n,i]of Object.entries(e))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=Ct(e),l.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(!u.isObject(t)||!u.isArray(e))return!1;e.forEach(n=>{let i=new Option(n.label,n.value);t.options.add(i),r!==null&&i.value==r&&(i.selected=!0)})}static removeElementData(t){let e=t.childNodes;if(e){let o=e.length-1;for(var r=o;r>=0;r--){var n=e[r];!n||this.removeElementData(n)}}f.remove(t),t.bindId&&y.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(!u.isObject(t))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 u.isObject(t)?t.cloneNode(e):!1}};var Ie=s=>typeof s!="string"?s:$t(s),$t=s=>[{tag:"text",textContent:s}],qt=s=>{if(!s)return{props:{},children:[]};let t=s[0];return typeof t=="string"?{props:{},children:$t(t)}:Array.isArray(t)?{props:{},children:t}:{props:t||{},children:Ie(s[1])}};f.addType("components",s=>{if(!s)return;let t=s.component;t&&t.rendered===!0&&t.prepareDestroy()});var Ue=0,R=class{constructor(...t){this.isUnit=!0,this.init();let{props:e,children:r}=qt(t);this.setupProps(e),this.children??=r,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Ue++}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(){f.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 b.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;b.removeElement(t)}prepareDestroy(){this.rendered=!1,this.beforeDestroy()}beforeDestroy(){}destroy(){this.remove()}};var M=class extends R{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=k.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(),k.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 We={created:"onCreated",state:"setupStates",events:"setupEevents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"},je=s=>typeof s==="function"?s:function(){return s},Fe=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=We[e];if(n){t[n]=je(r);continue}t[e]=r}return t},Ve=s=>{class t extends M{}return Object.assign(t.prototype,s),t},Xt=s=>{class t extends R{}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=Fe(s),Ve(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 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 Et=(s,t)=>({attr:s,directive:t});var V=(s,t)=>({key:s,value:t});var Gt=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var J=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(V("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){r={attr:G(e),value:r},t.push(Et(V(e,r),F.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(!m.hasOwnProp(t,h)||h==="tag"||(a=t[h],a==null))continue;if((c=F.get(h))!==null){n.push(Et(V(h,a),c));continue}let p=typeof a;if(p==="object"){if(h==="children"){o=o.concat(a);continue}if(P.isWatching(a)){this.setTextAsWatcher(n,h,a);continue}o.push(a);continue}if(p==="function"){let v=a;a=function(E){v.call(this,E,e)}}if(P.isWatching(a)){this.setTextAsWatcher(n,h,a);continue}this.setElementContent(h,a,r,o)||r.push(V(h,a))}return Gt(i,r,n,o)}};var w=class extends b{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){!e||e.length<1||e.forEach(n=>{let{key:i,value:o}=n;if(i==="innerHTML"){t.innerHTML=o;return}if(i.substr(4,1)==="-"){d.setAttr(t,i,o);return}this.addAttr(t,i,o,r)})}static addAttr(t,e,r,n){if(r===""||!e)return!1;if(typeof r==="function")e=Ct(e),l.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 lt=class extends Y{createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return w.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return w.createComment(o,e)}return w.create(n,t.attr,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:""}else if(n==="comment"){let i=t.attr[0],o=i?i.value:""}}};var dt=class{static browserIsSupported(){return window}static setup(){return this.browserIsSupported()?new lt:new pt}};var Ye=dt.setup(),g=class{static render(t,e,r){if(!t)return null;if(typeof t=="object"&&t.isUnit===!0)return this.createComponent(t,e,r),t;let n=N(t),i=new n;return this.createComponent(i,e,r),i}static build(t,e,r){let n=w.createDocFragment();return(Array.isArray(t)?t:[t]).forEach(o=>this.buildElement(o,n,r)),e&&typeof e=="object"&&e.appendChild(n),n}static rebuild(t,e,r){return w.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=J.parse(t,r),i=this.createNode(n,e,r);this.cache(i,t.cache,r),n.children.forEach(a=>{a!==null&&this.buildElement(a,i,r)});let o=n.directives;o&&o.length&&this.setDirectives(i,o,r)}static setDirectives(t,e,r){e.forEach(n=>{this.handleDirective(t,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 Ye.createNode(t,e,r)}};S.augment({buildLayout(s,t,e){g.build(s,t,e)}});var Pt=[],ze=s=>Pt.indexOf(s)!==-1,$e=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()}}),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=qe({load:r,src:t}):e=$e({load:r,src:t}),g.build(e,document.head)}addFiles(t){!t||t.forEach(e=>{ze(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}},Xe=(s,t)=>{import(s).then(e=>{t&&t(e)})},Ke=s=>s?typeof s?.prototype?.constructor=="function":!1,Ge=(s,t,e)=>{let r=g.build(s,null,e),n=r.firstChild;return t.after(r),n},Qe=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),Ze=N({render(){return Qe({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):Ke(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=Ge(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||b.removeElement(this.layoutRoot)}}),Mt=s=>new Ze(s);var Q=(s,t,e,r)=>{let n,i,o;if(Array.isArray(e[0])){e.forEach(a=>{!a||Q(s,t,a,r)});return}if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return!1;switch(typeof i){case"object":o=a=>{rr(s,i,a)};break;case"function":o=a=>{tr(s,i,n,a,r)};break}y.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":b.addHtml(s,i);break}},er=(s,t,e)=>{g.rebuild(s,t,e)},rr=(s,t,e)=>{for(let[r,n]of Object.entries(t))!r||(n===e?d.addClass(s,r):d.removeClass(s,r))};var _=s=>s.data?s.data:s.context&&s.context.data?s.context.data:null;var mt=(s,t,e)=>{let r=_(e);Q(s,r,t,e)};var Qt=(s,t,e)=>{!t||t&&d.setAttr(s,"role",t)},sr=s=>(t,e)=>{let r=e?"true":"false";d.setAttr(t,s,r)},Zt=(s,t,e)=>{if(!t)return;let r=t.role;r&&(d.setAttr(s,"role",r),t.role=null),Object.entries(t).forEach(([n,i])=>{if(i===null)return;let o=`aria-${n}`;Array.isArray(i)?(i.push(sr(o)),mt(s,i,e)):d.setAttr(s,o,i)})};f.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var Bt=s=>s?s.getContext():null,te=(s,t,e)=>{if(typeof t!="function")return;let r=Bt(e),n=t(r);if(!n)return;let i=J.parse(n,e);w.addAttributes(s,i.attr,e),g.setDirectives(s,i.directives,e)},ee=(s,t,e)=>{if(typeof t!="function")return;let r=Bt(e);t(r)},re=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=Bt(e),n=t(r);!n||e.addContextBranch(n[0],n[1])};var se=(s,t,e)=>{},ne=(s,t,e)=>{if(!t||!e)return!1;t(e,s)},ie=(s,t,e)=>{if(!t||!e)return!1;t(e.data,s)},oe=(s,t,e)=>{if(!t||!e)return!1;t(e.state,s)},ae=(s,t,e)=>{if(!t||!e)return!1;if(e.stateHelper){let r=e.state,n=t(r);e.stateHelper.addStates(n)}};var ce=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=_(e),!r)return;n=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=_(e);if(o)t.unshift(o);else return!1}[r,n,i]=t}y.bind(s,r,n,i)};var he=(s,t,e)=>{let r,n,i,o;if(t.length<3){let c=_(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;y.watch(s,r,n,c=>{if(b.removeAll(s),!c||c.length<1)return;let h=[];return c.forEach((p,v)=>{let E=a?r.scope(n+"["+v+"]"):null,$=p(c[v],v,E);$!==null&&h.push($)}),g.build(h,s,e)})};var ue=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];r.forEach((o,a)=>{if(!o)return;let c=n(o,a);c!==null&&i.push(c)}),g.build(i,s,e)};var fe=(s,t,e)=>{t(s)};f.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele)});var le=(s,t,e)=>{nr(s,t)},nr=(s,t)=>{f.add(s,"destroyed",{ele:s,callBack:t})};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++)P.setup(s,t[r],e);else P.setup(s,t,e)};var ir=0,z=class{constructor(t){this.router=t,this.locationId="base-app-router-"+ir++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}};var gt=class extends z{addEvent(){return l.on("popstate",window,this.callBack),this}removeEvent(){return l.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={}){return{location:this.locationId,...e,uri:t}}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 z{addEvent(){return l.on("hashchange",window,this.callBack),this}removeEvent(){return l.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,r){return window.location.hash=t,this}};var bt=class{static browserIsSupported(){return"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new gt(t).setup():new yt(t).setup()}};var xt=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),g.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 or=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},ar=s=>{if(!s.length)return null;let t={};for(var e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},cr=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},hr=0,vt=class extends C{constructor(t,e){let r=t.baseUri,n=cr(r),i=ar(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-"+hr++,this.path=null,this.referralPath=null;let e=or(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}),Mt(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 xt(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 ur=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},fr=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let[r,n]of Object.entries(e)){let 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=fr(t,s),t=ur(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 kt=class extends M{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=D.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(h)}}),i}setupStates(){return{selected:!1}}update(t){this.state.set("selected",t)}};f.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&D.removeRoute(t)});f.addType("switch",s=>{if(!s)return!1;let t=s.id;D.removeSwitch(t)});var Lt=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=bt.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new vt(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),l.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,p=t.length;h<p;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(){l.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}},D=new Lt;var be=(s,t,e)=>{if(!t)return!1;Array.isArray(t)?t.forEach(r=>{ye(s,r,e)}):ye(s,t,e)},ye=(s,t,e)=>{t.container=s,t.parent=e;let r=D.add(t);lr(s,r)},lr=(s,t)=>{f.add(s,"routes",{route:t})};var xe=(s,t,e)=>{let r=t[0];t.forEach(i=>{i.container=s,i.parent=e});let n=D.addSwitch(t);pr(s,n)},pr=(s,t)=>{f.add(s,"switch",{id:t})};F.add("cache",se).add("onCreated",fe).add("onDestroyed",le).add("bind",ce).add("onSet",mt).add("onState",pe).add("watch",de).add("useParent",ne).add("useData",ie).add("useState",oe).add("addState",ae).add("map",ue).add("for",he).add("useContext",ee).add("addContext",re).add("context",te).add("role",Qt).add("aria",Zt).add("route",be).add("switch",xe);S.augment({Ajax:tt,Html:b,dataBinder:y,Data:A,SimpleData:C,Model:j,State:k,Builder:g,router:D,Component:M});export{tt as Ajax,O as Arrays,Pe as Atom,g as Builder,M as Component,A as Data,f as DataTracker,Je as DateTime,F as Directives,d as Dom,b as Html,Mt as Import,N as Jot,j as Model,kt as NavLink,m as Objects,C as SimpleData,k as State,x as Strings,u as Types,R as Unit,S as base,y as dataBinder,D as router};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|