@base-framework/base 3.0.496 → 3.0.498

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,16 @@ The framework is modular and has additional modules to help with ajax, HTML, lay
10
10
 
11
11
  You can learn more about how to use Base in the wiki documentation. [Base Wiki](https://github.com/chrisdurfee/base/wiki)
12
12
 
13
+ ## AI Quickstart
14
+ - For contributors using GitHub Copilot, start with `.github/copilot-instructions.md` (concise in-repo rules) and `copilot.md` (detailed guide).
15
+ - Key patterns Copilot should follow here:
16
+ - Author layouts as JS objects: `{ tag:'div', class:'name', children:[...] }` (`nest` is shorthand). Use `text` for text nodes; `html|innerHTML` for raw HTML.
17
+ - Events on elements receive `(event, parentComponent)`: `{ click(e, parent) { parent.doThing(); } }`.
18
+ - Watchers: embed `[[path]]` in strings or arrays (auto-converted to `watch` directive). Example: `{ class: 'counter-[[count]]' }` or `{ value: ['[[path]]', data] }`.
19
+ - Components extend `Component`, implement `render()`, declare state in `setupStates()` and data in `setData()`; render via `Builder.render(...)`.
20
+ - Directives live in `modules/layout/directives/core/default-directives.js` (e.g., `bind`, `watch`, `map`, `for`, `route`, `switch`, `useData`, `useState`, `onCreated`, `onDestroyed`).
21
+ - Routing: `router.data.path` is reactive; navigate with `router.navigate(uri, data?, replace?)`; `NavLink` watches `router.data.path`.
22
+
13
23
  ## Base Converter
14
24
 
15
25
  There is a GPT created with ChatGPT that can convert code from other frameworks to Base. The GPT is new so it still has some issues but it is a good start. [Base Converter](https://chatgpt.com/g/g-uNL6KKeCo-base-converter/)
package/copilot.md ADDED
@@ -0,0 +1,97 @@
1
+ # Copilot Guide for Base
2
+
3
+ This guide helps AI agents (and humans) work effectively with the Base framework when this repo is open in the editor.
4
+
5
+ ## Core concepts
6
+ - Layouts are plain JS objects parsed into DOM (browser) or HTML strings (server). See: `modules/layout/element/parser.js`, `modules/layout/render/*`.
7
+ - Public API: `src/base.js` re-exports `Builder`, `Component`, `Atom`, `Data`, `SimpleData`, `Model`, `Import`, `NavLink`, `router`, `Html`, `Directives`, etc.
8
+ - Units and Components: `Unit` provides lifecycle/context; `Component` adds state/events. See: `modules/component/{unit.js,component.js}`.
9
+ - Data types: `Data` (deep), `SimpleData` (shallow), `Model` (server-backed). See: `modules/data/types/**`.
10
+
11
+ ## Atoms (from wiki)
12
+ - Create atoms with `Atom((props, children) => layout)`. Optional args supported:
13
+ - `Div({class:'text'})`, `Div('text')`, `Div([Header()])`, `Div({class:'x'}, ['child'])`.
14
+ - Events receive `(event, parentComponent)` directly in the layout: `{ click(e, parent) { /*...*/ } }`.
15
+ - Prefer composition (nest atoms via children) over inheritance.
16
+
17
+ ## Layout authoring
18
+ - Shape: `{ tag:'div', class:'name', children:[...] }`; `nest` → `children`; `text` makes a text node; `html|innerHTML` sets raw HTML; default button type is `button`.
19
+ - Watchers: use `[[path]]` inside strings or arrays. Examples:
20
+ - Single: `{ class: 'counter-[[count]]' }`
21
+ - Specific data: `{ value: ['[[path]]', data] }`
22
+ - Multi-source + callback: `{ class: ['[[a]] [[b]]', [dataA, dataB], ([a,b]) => `${a}-${b}`] }`
23
+ - Directives: mapped in `modules/layout/directives/core/default-directives.js` (e.g., `bind`, `watch`, `map`, `for`, `route`, `switch`, `useData`, `useState`, `onCreated`, `onDestroyed`, `cache`).
24
+
25
+ ### Directives cookbook
26
+ - bind
27
+ - Text input: `{ tag:'input', type:'text', bind:'form.name' }`
28
+ - Checkbox: `{ tag:'input', type:'checkbox', bind:'form.accepted' }`
29
+ - Select with options: `{ tag:'select', bind:'form.color', children:[{ map: ['[[colors]]', data, (c)=>({ tag:'option', value:c, text:c })] }] }`
30
+ - map (lists)
31
+ - `{ tag:'ul', children:[{ map: ['[[items]]', data, (item,i)=>({ tag:'li', text:item.name })] }] }`
32
+ - for (range/iterables)
33
+ - `{ for: [0, 5, (i)=>({ tag:'span', text:i })] }`
34
+ - watch
35
+ - `{ class: 'status-[[status]]' }` or `{ text: ['[[user.name]]', data] }`
36
+ - Lifecycle
37
+ - `{ onCreated:(el,p)=>{/* setup */}, onDestroyed:(el,p)=>{/* cleanup */} }`
38
+ - Cache/persist
39
+ - Parent `persist:true` keeps children components alive across re-renders; opt-out per child with `persist:false`.
40
+
41
+ ## Components
42
+ - Extend `Component`; implement `render()`; `Unit._cacheRoot` auto-caches root as `panel`. Use `this.getId('child')` for stable ids.
43
+ - State: override `setupStates()` with primitives or `{ state, callBack }`; use `this.state.increment('count')`, `toggle`, etc.
44
+ - Data: override `setData()` and set `this.data = new Data({...})` (or `SimpleData`/`Model`). Deep nested updates are supported.
45
+ - Lifecycle: `onCreated`, `beforeSetup`, `afterSetup`, `afterLayout`, `beforeDestroy`.
46
+ - Persistence: Parent `persist: true` retains child component state across re-renders (child can opt-out with `persist: false`).
47
+
48
+ ### Patterns
49
+ - Stateless helpers: wrap inline layout with Jot; `Builder.render` auto-wraps non-Units.
50
+ - Stable ids: use `this.getId('x')` for elements you need to re-select after updates.
51
+ - Child communication: pass data via props and use `useData` to bind; avoid global mutation.
52
+
53
+ ## Rendering & routing
54
+ - Render anything: `Builder.render(x, container, parent?)`; non-Unit inputs are wrapped with `Jot` automatically.
55
+ - Router: `router.data.path` is reactive; `router.navigate(uri, data?, replace?)` to change routes.
56
+ - `NavLink` tracks active path using `[value: ['[[path]]', router.data]]`.
57
+ - `route` renders all matching routes; `switch` renders the first match. Both support lazy imports (`import` or `() => import(...)`).
58
+
59
+ ### Router examples
60
+ - Basic navigate: `router.navigate('/users/123')`
61
+ - With data payload: `router.navigate('/search', { q: 'term' })`
62
+ - Declarative routes via directives:
63
+ - `{ switch: [
64
+ ['/users/:id', () => import('./components/user.js')],
65
+ ['/', Home]
66
+ ] }`
67
+ - NavLink: prefer `NavLink` for links that need active state.
68
+
69
+ ## Data patterns (from wiki)
70
+ - Mutations: `data.set('a.b', v)`, `data.push('arr', v)`, `data.splice('arr', i)`, `data.refresh('key')`, `data.revert()`.
71
+ - Linking: `data.link(otherData, 'prop')` or `data.link(otherData)` to sync.
72
+ - Local storage: `data.setKey('KEY'); data.resume(defaults); data.store()`.
73
+
74
+ ### Forms and lists
75
+ - Forms: bind inputs with `bind` to `this.data` paths; use `Model` when server-backed persistence is needed.
76
+ - Lists: `map` over `[[items]]` and keep keys stable via `this.getId` on child components.
77
+
78
+ ## Tips for extending
79
+ - New directive: `Directives.add('name', (ele, attrValue, parent) => { /* apply behavior */ })` and reference in layout as `{ name: value }`.
80
+ - Prefer atoms/components returning layout objects; avoid direct DOM ops—use `Builder`, `Html`, and directives.
81
+ - Wrap quick stateless bits with Jot; `Builder.render` auto-wraps non-Units.
82
+
83
+ ### Import/Jot
84
+ - Import: lazy-load a component or layout: `{ import: () => import('./components/big.js') }` or in routes as shown above.
85
+ - Jot: `Jot(layoutOrFn)` for tiny pieces without full component ceremony.
86
+
87
+ ## Build/types
88
+ - `npm run build` → `dist/` via esbuild (bundle, ESM, sourcemap, minify) and TypeScript declarations in `dist/types`.
89
+ - Consumers import from package root; types at `dist/types/base.d.ts`.
90
+
91
+ ## Best practices and pitfalls
92
+ - Keep layouts pure; avoid mutating layout objects after render—use data/state to trigger updates.
93
+ - Prefer `useData`/`useState` directives for local bindings inside layouts rather than manual re-selects.
94
+ - When binding arrays/objects, prefer `Data` (deep) over `SimpleData` (shallow) to ensure watchers fire on nested changes.
95
+ - Use `persist:true` thoughtfully; leaking long-lived components can retain listeners.
96
+
97
+ See also: `documents/base.wiki/*` for deeper explanations and examples (Atoms, Components, Layout, Directives, Data, Router, Migration).
package/dist/base.js CHANGED
@@ -1,2 +1,2 @@
1
- var B=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var h=class{static getType(t){let e=typeof t;return e!=="object"?e:Array.isArray(t)?"array":"object"}static isUndefined(t){return typeof t>"u"}static isObject(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var g={create(s){return Object.create(s||null)},extendObject(s,t){return!h.isObject(s)||!h.isObject(t)?!1:(Object.keys(s).forEach(e=>{this.hasOwnProp(t,e)||(t[e]=s[e])}),t)},clone(s){return!s||!h.isObject(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!!s&&Object.prototype.toString.call(s)==="[object Object]"},isEmpty(s){return h.isObject(s)?Object.keys(s).length===0:!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 ct=class{constructor(){this.types=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let r,n=Q.get(t);if(n){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 l=class{static trackers=new Map;static trackingCount=0;static addType(t,e){Q.add(t,e)}static removeType(t){Q.remove(t)}static getTrackingId(t){return t?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 has(t,e){let r=this.getTrackingId(t);if(!r)return!1;let n=this.trackers.get(r);return n&&e?n.has(e):!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new ct),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);if(!e){n.remove(),this.trackers.delete(r);return}n.remove(e),this.isEmpty(n.types)&&this.trackers.delete(r)}};var Wt=s=>{let t=0;for(let[e,r]of Object.entries(s))t++,typeof s[e]=="object"&&(t+=Wt(s[e]));return t},te=(s,t)=>{let e=!1;if(typeof s!="object"||typeof t!="object")return e;for(let[r,n]of Object.entries(s)){if(!g.hasOwnProp(t,r))break;let i=t[r];if(typeof n!=typeof i)break;if(typeof n=="object"){if(e=te(n,i),e!==!0)break}else if(n===i)e=!0;else break}return e},Ke=(s,t)=>{let e=Wt(s),r=Wt(t);return e!==r?!1:te(s,t)},ee=(s,t)=>{let e=typeof s;return e!==typeof t?!1:e==="object"?Ke(s,t):s===t};var f={getEvents(s){return h.isObject(s)===!1?[]:l.get(s,"events")},create(s,t,e,r=!1,n=!1,i=null){return n=n===!0,{event:s,obj:t,fn:e,capture:r,swapped:n,originalFn:i}},on(s,t,e,r){return Array.isArray(s)?s.forEach(n=>this.add(n,t,e,r)):this.add(s,t,e,r),this},off(s,t,e,r){if(Array.isArray(s)){var n;s.forEach(i=>this.remove(i,t,e,r))}else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,n=!1,i=null){if(h.isObject(t)===!1)return this;let o=this.create(s,t,e,r,n,i);return l.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let n=this.getEvent(s,t,e,r);return n===!1?this:(typeof n=="object"&&this.removeEvent(n),this)},removeEvent(s){return typeof s=="object"&&s.obj.removeEventListener(s.event,s.fn,s.capture),this},getEvent(s,t,e,r){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(s,t,e,r);return this.search(i,n)},search(s,t){let e,r=this.isSwappable(s.event);for(var n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==s.event||e.obj!==s.obj)&&(e.fn===s.fn||r===!0&&e.originalFn===s.fn))return e;return!1},removeEvents(s){return h.isObject(s)===!1?this:(l.remove(s,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(s){this.swap.push(s)},isSwappable(s){return this.swap.includes(s)}};l.addType("events",s=>{f.removeEvent(s)});var $t={events:f,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;switch(t){case"HTMLEvents":n=new Event(s,e);break;case"MouseEvents":n=new MouseEvent(s,e);break;default:n=new CustomEvent(s,r);break}return n},createEvent(s,t,e,r){if(h.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};h.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(h.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=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof s=="function"&&s(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,r,!0,s),this},offMouseWheel(s,t,e=!1){typeof t>"u"&&(t=window);let r=this.getWheelEventType();return this.off(r,t,s,e),this},preventDefault(s){return typeof s.preventDefault=="function"?s.preventDefault():s.returnValue=!1,this},stopPropagation(s){return typeof s.stopPropagation=="function"?s.stopPropagation():s.cancelBubble=!0,this}};var Z=class{constructor(){this.errors=[],this.dataTracker=l}augment(t){if(!h.isObject(t))return this;let e=this.constructor.prototype;for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,n){return(t[e]=r).apply(t,B.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(h.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)}};Z.prototype.extend=function(){return Z.prototype}();var A=new Z;A.augment({...g,...$t,...h,equals:ee});var tt={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};var re=()=>{A.augment({xhrSettings:tt,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=g.extendClass(A.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=tt}})};var x=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,r=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let n={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(o,a,c,u){n[a]=e!==!1?decodeURIComponent(u):u}),n}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,r=>r[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let r=/([A-Z]{1,})/g;return t.replace(r,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,r=>r.charAt(0).toUpperCase()+r.substring(1).toLowerCase())}};var ut=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:r,url:n,async:i}=this.settings;e.open(r,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=tt.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=g.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={...A.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=g.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=()=>{f.removeEvents(r.upload),f.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);f.on(["load","error","abort"],e,r),f.on("progress",e.upload,r)}};re();var ht=(...s)=>new ut(s).xhr;var Qe=s=>typeof s!="string"?s:se(s),se=s=>[{tag:"text",textContent:s}],ft=()=>({props:{},children:[]}),lt=s=>({props:{},children:se(s)}),dt=s=>({props:{},children:s}),pt=s=>({props:s[0]||{},children:Qe(s[1])});var mt=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{let i=r.values();for(let o of i)o&&o.unsubscribe();this.connections.delete(t)}}};var j=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var gt=class extends j{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 yt=class extends U{constructor(){super(),this.source=null}addSource(t){return this.source=new gt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var W=class extends j{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 bt=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 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?B.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]:B.toArray(r):!1}static html(t,e){return h.isObject(t)===!1?!1:h.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return h.isObject(t)===!1||h.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 h.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 h.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 h.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"?[]:t.querySelectorAll(e)}static show(t){if(h.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(h.isObject(t)===!1)return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return h.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return h.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return h.isObject(t)?t.offsetWidth:!1}static getHeight(t){return h.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,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 h.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(h.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(h.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 h.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return h.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return h.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var xt=s=>{let t="textContent";if(!s||typeof s!="object")return t;let e=s.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let r=s.type;if(!r)return t="value",t;switch(r){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var Ze=(s,t,e)=>{d.setAttr(s,t,e)},tr=(s,t,e)=>{s.checked=s.value==e},er=(s,t,e)=>{e=e==1,ne(s,t,e)},ne=(s,t,e)=>{s[t]=e},rr=(s,t)=>d.getAttr(s,t),sr=(s,t)=>s[t],vt=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=Ze,this.getValue=rr,this;this.getValue=sr;let r=t.type;if(r)switch(r){case"checkbox":this.setValue=er;return;case"radio":this.setValue=tr;return}return this.setValue=ne,this}getAttrBind(t){return t||xt(this.element)}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return r=>t.replace(e,r)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}};var St=class extends U{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new vt(t,e,r,this.pubSub)}addData(t,e){return this.data=new bt(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 ie=-1,$=class{constructor(){this.callBacks=new Map}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),ie=-1}on(t,e){let r=(++ie).toString();return this.get(t).set(r,e),r}off(t,e){let r=this.callBacks.get(t);r&&(e=String(e),r.delete(e),r.size===0&&this.callBacks.delete(t))}remove(t){this.callBacks.delete(t)}publish(t,...e){let r=this.callBacks.get(t);if(r)for(let n of r.values())n&&n.apply(this,e)}};var Ft=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=[20,37,38,39,40],this.connections=new mt,this.pubSub=new $,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null;if(r.indexOf(":")!==-1){let m=r.split(":");m.length>1&&(i=m[1],o=m[0])}let a=this.setupConnection(t,e,i,o,n),c=a.element,u=e.get(i);return typeof u<"u"?c.set(u):(u=c.get(),u!==""&&a.data.set(u)),this}setupConnection(t,e,r,n,i){let o=this.getBindId(t),a=new St(this.pubSub);a.addData(e,r).subscribe(o);let m=`${e.getDataId()}:${r}`;return a.addElement(t,n,i).subscribe(m),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(h.isObject(t)===!1)return this;let i=new yt;i.addSource(e).subscribe(r,n);let a=this.getBindId(t),c=e.getDataId()+":"+r;this.addConnection(a,c,i);let u=e.get(r);return n(u),this}unwatch(t,e,r){if(h.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 null;let e=t[this.attr];return e||null}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!==null){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(){typeof document<"u"&&f.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&f.off(["change","paste","input"],document,this.changeHandler,!1)}},b=new Ft;var T=s=>s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null;var nr={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"},et=s=>nr[s]||s,rt=s=>typeof s=="string"&&s.substring(0,2)==="on"?s.substring(2):s,w=class{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(r,i):this.append(r,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let r=e.type;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=rt(e),f.add(e,t,r);else{let i=et(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(!h.isObject(t)||!h.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){l.remove(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)}}t.bindId&&b.unbind(t)}static removeElement(t){if(!t)return this;let e=l.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!h.isObject(t))return this;let e=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 h.isObject(t)?t.cloneNode(e):!1}};var v=class extends w{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;this.addAttr(t,i,o,r)})}static addAttr(t,e,r,n){if(r===""||!e)return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){e=rt(e),f.add(e,t,function(a){r.call(this,a,n)});return}if(e.substr(4,1)==="-"){d.setAttr(t,e,r);return}let o=et(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 Vt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,S={isWatching(s){return Array.isArray(s)?typeof s[0]=="string"&&this.hasParams(s[0]):this.hasParams(s)},hasParams(s){return h.isString(s)&&s.includes("[[")},_getWatcherProps(s){let t=s.match(Vt);return t?t.map(e=>e.slice(2,-2)):null},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"disabled":s.disabled=!e;break;case"checked":s.checked=!!e;break;case"required":s.required=!!e;break;case"src":if(s.tagName.toLowerCase()==="img"){s.src=e&&e.indexOf(".")!==-1?e:"";break}s.src=e;break;default:v.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace(Vt,function(){let n=e?t[r]:t;r++;let i=n.get(arguments[2]);return typeof i<"u"&&i!==null?i:""})},_getWatcherCallBack(s,t,e,r,n){return()=>{let i=this.replaceParams(e,t,n);this.updateAttr(s,r,i)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,T(t)]:(e.length<2&&e.push(T(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=s.attr||"textContent",o=s.callBack;if(typeof o=="function"){let a=r.match(Vt)||[],c=a&&a.length>1;return(u,m)=>{u=c!==!0?u:this.getPropValues(e,a,n);let y=o(u,t,m);typeof y<"u"&&this.updateAttr(t,i,y)}}return this._getWatcherCallBack(t,e,r,i,n)},addDataWatcher(s,t,e){let r=this.getValue(t,e),n=r[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=r[0],o=Array.isArray(n),a=this.getCallBack(t,s,n,i,o),c=this._getWatcherProps(i);for(var u=0,m=c.length;u<m;u++){var y=o?n[u]:n;this.addWatcher(s,y,c[u],a)}},getWatcherSettings(s,t=null){if(typeof s=="string")return{attr:t,value:s};if(Array.isArray(s)){let e=s[s.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let r=s[1]&&typeof s[1]=="object"?[s[0],s[1]]:[s[0]];return typeof e=="function"?{attr:t,value:r,callBack:e}:{attr:e||"textContent",value:r}}return s},setup(s,t,e){t&&this.addDataWatcher(s,this.getWatcherSettings(t),e)},addWatcher(s,t,e,r){b.watch(s,t,e,r)}};var ir=s=>({props:{watch:s},children:[]}),or=s=>{if(!s)return ft();let t=s[0];if(typeof t=="string")return lt(t);if(Array.isArray(t))return S.isWatching(t)===!1?dt(t):ir(t);let e=s[1]??s[0]??[];return e&&Array.isArray(e)&&S.isWatching(e)===!0&&(s[0]=Array.isArray(s[0])?{}:s[0],s[0].watch=e,s[1]=[]),pt(s)},ar=s=>(...t)=>{let{props:e,children:r}=or(t);return s(e,r)};function oe(s,t){let e=isNaN(Number(t)),r=e?t:`[${t}]`;return s===""?r:e?`${s}.${r}`:`${s}${r}`}function ae(s,t="",e=""){return{get(r,n,i){let o=r[n];if(t===""&&n in r)return typeof o=="function"?o.bind(r):o;let a=r[e]||r;if(o=Reflect.get(a,n,i),g.isPlainObject(o)||Array.isArray(o)){let c=oe(t,n);return new Proxy(o,ae(s,c,e))}return o},set(r,n,i,o){if(t===""&&n in r)return r[n]=i,!0;let a=oe(t,n);return s.set(a,i),!0}}}var kt=(s,t="stage")=>new Proxy(s,ae(s,"",t));var st=class{static resume(t,e){if(!t)return null;let r,n=localStorage.getItem(t);return n===null?e&&(r=e):r=JSON.parse(n),r}static store(t,e){if(!t||!e)return!1;let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var wt=(s={})=>{let t={};if(!h.isObject(s))return t;let e=g.clone(s);return Object.keys(e).forEach(r=>{let n=e[r];typeof n!="function"&&(t[r]=n)}),t};var cr=0,H={CHANGE:"change",DELETE:"delete"},Jt=(s,t)=>`${s}:${t}`,O=class{constructor(t={}){this.dirty=!1,this.links={},this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new $;let e=wt(t);return this.set(e),kt(this)}setup(){this.stage={}}_init(){let t=++cr;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}getDataId(){return this._id}remove(){}on(t,e){let r=Jt(t,H.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=Jt(t,H.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,r,H.CHANGE))}publishLocalEvent(t,e,r,n){let i=Jt(t,n);this.eventSub.publish(i,e,r)}_publish(t,e,r,n){this.publishLocalEvent(t,e,r,n),r=r||this,b.publish(this._dataId+t,e,r)}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,r=this){delete t[e],this.publishLocalEvent(e,null,r,H.DELETE)}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=st.resume(this.key,t);return e?(this.set(e),this):this}store(){let t=this.get();return st.store(this.key,t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,r){let n=r||e,i=t.get(e);typeof i<"u"&&this.get(e)!==i&&this.set(e,i);let o=t.on(e,(c,u)=>{if(u===this)return!1;this.set(n,c,t)});this.addLink(o,t);let a=this.on(n,(c,u)=>{if(u===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;g.isEmpty(e)||(Object.entries(e).forEach(([r,n])=>{this.removeLink(n,!1)}),this.links={})}removeLink(t,e=!0){let r=this.links[t];r&&r.off(t),e!==!1&&delete this.links[t]}};O.prototype.isData=!0;var D={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},getSegments(s){let t=this.deepDataPattern;return s.match(t)}};var L=class{static set(t,e,r){if(!D.hasDeepData(e)){t[e]=r;return}let n,i=D.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]}}static delete(t,e){if(!D.hasDeepData(e)){delete t[e];return}let r=D.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(Number(a),1);break}delete t[a];break}t=c}}static get(t,e){if(!D.hasDeepData(e))return t[e]??void 0;let r=D.getSegments(e),n=r.length,i=n-1;for(var o=0;o<n;o++){var a=r[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var nt=class{static publishDeep(t,e,r,n){if(!D.hasDeepData(e)){this.publish(e,r,n);return}let i,o=D.getSegments(e),a=o.length,c=a-1,u="";for(var m=0;m<a;m++){i=o[m],t=t[i],m>0?isNaN(i)&&(u+="."+i):u=i;var y;if(m===c)y=r;else{var C=o[m+1];if(isNaN(C)===!1){u+="["+C+"]";continue}var K={};K[C]=t[C],y=K}this.publish(u,y,n)}}static publish(t,e,r){if(t=t||"",r(t,e),!(!e||typeof e!="object")){if(Array.isArray(e)){this.publishArray(t,e,r);return}this.publishObject(t,e,r)}}static publishArray(t,e,r){let n,i,o=e.length;for(var a=0;a<o;a++)i=e[a],n=t+"["+a+"]",this._checkPublish(n,i,r)}static publishObject(t,e,r){let n,i;for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i=e[o],n=t+"."+o,this._checkPublish(n,i,r))}static _checkPublish(t,e,r){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r)}};var M=class extends O{setup(){this.attributes={},this.stage={}}_setAttr(t,e,r,n){typeof e!="object"&&e===this.get(t)||(!r&&n!==!0?L.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),L.set(this.stage,t,e),r=r||this,this._publish(t,e,r,H.CHANGE))}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}getIndex(t,e,r){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===r)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r,n){let i=(o,a)=>this._publishAttr(o,a,r,n);nt.publish(t,e,i)}_publishAttr(t,e,r,n){let i=this._dataId+t;b.publish(i,e,r),this.publishLocalEvent(t,e,r,n)}mergeStage(){this.attributes=g.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,r=this){L.delete(t,e);let n=(i,o)=>this.publishLocalEvent(i,o,r,H.DELETE);nt.publish(e,e,n)}_getAttr(t,e){return L.get(t,e)}};var ur={"\n":"\\n","\r":"\\n"," ":"\\t"},hr=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>ur[r])},ce=(s,t)=>{if(typeof s!="string")return s;s=hr(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},qt=(s,t)=>{let e=typeof s;return e==="undefined"?s:e!=="object"?(s=ce(s),s):(Object.entries(s).forEach(([r,n])=>{n!==null&&(s[r]=typeof n=="string"?qt(n,t):ce(n,t))}),s)};function ue(s){return typeof s<"u"&&s.length>0?JSON.parse(s):!1}function zt(s){return typeof s<"u"?JSON.stringify(s):null}var it=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?g.clone(t):t,n=qt(r,e);return zt(n)}static json={encode:zt,decode:ue};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};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="id="+r,i=this.model;return this._get(`/${r}`,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+"="+it.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=typeof n>"u"?"":`/${n}`;return this._put(i,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=typeof n>"u"?"":`/${n}`;return this._post(i,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=typeof n>"u"?"":`/${n}`;return this._patch(i,r,t,e)}delete(t,e){let r=this.model.get("id"),n=typeof r<"u"?"id="+r:this.setupObjectData(),i=typeof r>"u"?"":`/${r}`;return this._delete(i,n,t,e)}all(t,e,r,n,i=null){let o=this.model.get();r=isNaN(r)?0:r,n=isNaN(n)?50:n;let a=o.search||"",c=o.filter||"";typeof c=="object"&&(c=JSON.stringify(c));let u=o.dates||"";typeof u=="object"&&(u=JSON.stringify(u));let m=o.orderBy||"";typeof m=="object"&&(m=JSON.stringify(m));let y=o.groupBy||"";Array.isArray(y)&&(y=JSON.stringify(y));let C="&filter="+c+"&offset="+r+"&limit="+n+"&dates="+u+"&orderBy="+m+"&groupBy="+y+"&search="+a+"&lastCursor="+(typeof i<"u"&&i!==null?i:"");return this._get("",C,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let r=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(r)}setupRequest(t,e,r,n,i){let o={url:this.getUrl(t),method:e,params:r,completed:(c,u)=>{typeof i=="function"&&i(c),this.getResponse(c,n,u)}};return this._isFormData(r)&&(o.headers={}),ht(o)}replaceUrl(t){return S.isWatching(t)&&(t=S.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,r,n){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 fr=s=>{let t={};if(!h.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},lr=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},dr=0,F=class extends M{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,r=lr(t),n=e.prototype.service.extend(r),i=fr(t);class o extends e{constructor(c){let u={...i,...wt(c)};super(u),this.xhr=new n(this)}dataTypeId=`bm${dr++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};F.prototype.service=Ct;var R=class extends O{};var At=class extends R{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=null}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 E=class{static targets=new Map;static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new At(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):null}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,r);return}this.targets.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};var Tt=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(r=>{this.on(...r)})}on(t,e,r,n){f.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){f.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=>{f.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{f.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset(),this.events=[]}};var Dt=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],u=c!==null?c:void 0;u&&typeof u=="object"&&(a=u.callBack,u=u.state),e.push(this.createState(o,u,a,r.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeActions(t,e){if(!(e.length<1))for(var r=0,n=e.length;r<n;r++){var i=e[r];i.token&&this.unbindRemoteState(t,i.token),E.remove(i.targetId,i.action,i.token)}}restore(t){E.restore(t.id,t);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=E.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(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=[])}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 he=s=>{if(!s)return ft();let t=s[0];return typeof t=="string"?lt(t):Array.isArray(t)?dt(t):pt(s)};l.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.rendered===!0&&t.prepareDestroy(),t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken))});var pr=0,ot=class{constructor(...t){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this.init();let{props:e,children:r}=he(t);this.setupProps(e),this.children=r||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+pr++,this.unitType=this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=this.persistedCount++,r="pc"+e,i=Object.keys(this.persistedChildren)[e],o=this.persistedChildren[i];return o&&t.unitType===o.unitType&&(r=i,t.resumeScope(o)),t.persistToken=r,this.persistedChildren[r]=t,r}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){l.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(var n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return w.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.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy(),this.removeContext();let t=this.panel||this.id;w.removeElement(t)}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy()}beforeDestroy(){}destroy(){this._remove()}};var k=class extends ot{constructor(...t){super(...t),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){this.data=t.data,this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,this.id=t.id}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=E.getTarget(e)}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper.restore(t);return}let e=this.setupStates();g.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Dt(this.state,t))}addState(t){!this.stateHelper||this.stateResumed==!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;t&&(this.stateHelper.removeRemoteStates(t),t.remove(),this.stateResumed=!1)}setEventHelper(){this.events||(this.events=new Tt)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy(),this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist===!1&&this.data.unlink()}};var Et={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var mr=s=>typeof s=="function"?s:()=>s,gr=s=>{let t={};return s&&Object.entries(s).forEach(([e,r])=>{let n=Et[e]||e;t[n]=mr(r)}),t},fe=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e},I=(s,t=k)=>{if(!s)return null;let e,r=typeof s;return r==="object"&&s.render?(e=gr(s),fe(t,e)):(e={render:r==="function"?s:()=>s},fe(t,e))};var yr=(s,t)=>(Object.entries(s).forEach(([e,r])=>{let n=Et[e]||e;t.prototype[n]=r}),t),br=s=>class extends s{},xr=(s,t=k)=>{if(!s)return null;let e=br(t),r={},n=s(r);return yr(r,e),e.prototype.render=n,e};var vr={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 null;let r=e[s];return t?r.substring(0,3):r},convertJsMonth(s){return this.padNumber(s+1)},convertDate(s,t=!1){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);return this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),s)},formatTime(s,t){let e=this.createDate(s),r=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),r)},getMeridian(s){return s=Number(s),s>=12?"PM":"AM"},convert24To12(s){return s=Number(s),s>12&&(s=s-12),s},convert12To24(s,t){return s=Number(s),t.toLowerCase()==="pm"&&(s=s+12),s},renderDate(s,t,e,r="sql"){return t=Number(t),e=Number(e),r==="sql"?`${s}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${s}`},renderTime(s,t,e=0,r="sql"){if(r==="sql")return`${this.padNumber(s)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(s);return s=this.convert24To12(s),`${s}:${this.padNumber(t)} ${n}`},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){let e=this.monthNames;if(s>e.length)return"";let r=e[s];return r?t?r.substring(0,3):r:""},getMonthLength(s,t){let e=new Date;return s=typeof s<"u"?s:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[s]},getMonthsLength(s=new Date().getFullYear()){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]},getLocalDate(s,t="America/Denver"){let e=new Date(s);if(Number.isNaN(e.getMonth())===!0){let i=/[- :]/,o=s.split(i);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let r=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),n=e.getTime()-r.getTime();return new Date(e.getTime()+n)},getLocalTime(s,t=!1,e=!1,r="America/Denver"){if(!s)return"";let n=this.getLocalDate(s,r),i=n.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(n.getFullYear(),i,n.getDate(),o)+" "),a+this.renderTime(n.getHours(),n.getMinutes(),n.getSeconds(),o)},getDiffFromNow(s,t=!1){s=s.replace(/\s/,"T");let e=new Date(s),r=new Date;return t===!0&&r.setHours(0,0,0,0),r.getTime()-e.getTime()},getAge(s){let t=this.getDiffFromNow(s),e,r;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 String(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"?0:Math.floor(s/31558464e3)},toMonths(s){return typeof s=="number"?Math.floor(s/2592e6):0},toDays(s){return typeof s!="number"?0:Math.floor(s/864e5*1)},toHours(s){return typeof s!="number"?0:Math.floor(s%864e5/36e5*1)},toMinutes(s){return typeof s!="number"?0:Math.floor(s%864e5%36e5/6e4*1)},toSeconds(s){return typeof s!="number"?0: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 le=(s,t)=>({name:s,callBack:t});var V={keys:[],items:{},add(s,t){return this.keys.push(s),this.items[s]=le(s,t),this},get(s){return this.items[s]||null},all(){return this.keys}};var Yt=(s,t)=>({attr:s,directive:t});var J=(s,t)=>({key:s,value:t});var de=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var N=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(J("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(Yt(J(e,S.getWatcherSettings(r,et(e))),V.get("watch")))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(J("type",n))}}static parse(t,e){let r=[],n=[],i=this.getTag(t);this.setButtonType(i,t,r),this.setupChildren(t);let o=[];var a,c;for(var u in t){if(!g.hasOwnProp(t,u)||u==="tag"||(a=t[u],a==null))continue;if((c=V.get(u))!==null){n.push(Yt(J(u,a),c));continue}let m=typeof a;if(m==="object"){if(u==="children"){o=o.concat(a);continue}if(S.isWatching(a)){this.setTextAsWatcher(n,u,a);continue}o.push(a);continue}if(m==="function"){let y=a;a=function(C){y.call(this,C,e)}}if(S.isWatching(a)){this.setTextAsWatcher(n,u,a);continue}this.setElementContent(u,a,r,o)||r.push(J(u,a))}return de(i,r,n,o)}};var q=class{build(t,e,r){}setupComponent(t,e,r){t.parent=r,r&&r.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&r&&(r[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t.getChildScope());return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var Pt=class extends q{build(t,e,r){let n=v.createDocFragment();return(Array.isArray(t)?t:[t]).forEach(o=>this.buildElement(o,n,r)),e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){let n=N.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)}setDirectives(t,e,r){e.forEach(n=>{this.handleDirective(t,n,r)})}handleDirective(t,e,r){e.directive.callBack(t,e.attr.value,r)}cache(t,e,r){r&&e&&(r[e]=t)}createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return v.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return v.createComment(o,e)}return v.create(n,t.attr,e,r)}removeNode(t){v.removeElement(t)}removeAll(t){v.removeAll(t)}};var Sr=["area","base","br","col","embed","hr","img","input","link","meta","source"],z=class{static create(t,e=[],r=""){let n=this.getInnerContent(e);n+=this.getInnerHtml(e);let i=this.createAttributes(e);return Sr.includes(t)?`<${t} ${i} />`:`<${t} ${i}>`+n+r+`</${t}>`}static getInnerContent(t){let e="";return t.forEach(({key:r,value:n},i)=>{if(r!=="text"&&r!=="textContent")return"";t.splice(i,1),e+=n}),e}static getInnerHtml(t){let e="";return t.forEach(({key:r,value:n},i)=>{if(r!=="html"&&r!=="innerHTML")return"";t.splice(i,1),e+=n}),e}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:r,value:n}=e;return typeof n=="function"&&(r="on"+rt(r)),`${r}="${n}"`}).join(" ")}static createText(t){return t}static createComment(t){return`<!-- ${t} -->`}};var Ot=class extends q{build(t,e,r){return(Array.isArray(t)?t:[t]).map(i=>this.buildElement(i,r)).join("")}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,e):this.createElement(t,e):""}createElement(t,e){let r=N.parse(t,e),n=r.children.map(i=>i!==null?this.buildElement(i,e):"").join("");return this.createNode(r,n)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return z.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return z.createComment(i)}return z.create(r,t.attr,e)}removeAll(t){}};var Mt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Pt:new Ot}};var _=Mt.setup(),kr=s=>typeof s=="object"&&s.isUnit===!0,wr=s=>{let t=I(s);return new t},p=class{static render(t,e,r){return t?(kr(t)||(t=wr(t)),_.createComponent(t,e,r)):null}static build(t,e,r){return _.build(t,e,r)}static rebuild(t,e,r){return _.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){_.setDirectives(t,e,r)}static createNode(t,e,r){return _.createNode(t,e,r)}static removeNode(t){_.removeNode(t)}static removeAll(t){_.removeAll(t)}};A.augment({buildLayout(s,t,e){p.build(s,t,e)}});var Gt=[],Cr=s=>Gt.indexOf(s)!==-1,Ar=s=>({tag:"script",src:s.src,async:!1,load(t){Gt.push(s.src);let e=s.load;e&&e()}}),Tr=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){Gt.push(s.src);let e=s.load;e&&e()}}),Bt=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=Tr({load:r,src:t}):e=Ar({load:r,src:t}),p.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Cr(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var Dr=s=>s?typeof s?.prototype?.constructor=="function":!1,Y=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Dr(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){let n=p.build(t,null,r),i=n.firstChild||t?.panel;return e.after(n),i}};var Nt=class{static load(t,e){return t.then(r=>(e&&e(r),r))}};var Er=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),Pr=s=>{let t=typeof s;return t==="string"?import(s):t==="function"?s():s},pe=I({declareProps(){this.loaded=!1,this.blockRender=!1},render(){return Er({onCreated:s=>{if(this.src){if(this.layout){this.layoutRoot=Y.render(this.layout,this.panel,this.parent);return}if(this.depends){new Bt(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){this.src=Pr(this.src),Nt.load(this.src,t=>{if(this.loaded=!0,this.blockRender===!0){this.blockRender=!1;return}let e=this.layout||Y.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.layoutRoot=Y.render(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)},destroy(){if(!this.layoutRoot){this.blockRender=!0;return}this.blockRender=!1,p.removeNode(this.layoutRoot)}});var Xt=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new pe(s)};var me=(s,t,e=null)=>{f.on("animationend",s,function r(){d.removeClass(s,t),f.off("animationend",s,r),e&&e()}),d.addClass(s,t)},ge=(s,t,e)=>{me(s,t)},ye=(s,t,e)=>{let r=()=>s&&s.remove();Or(s,()=>me(s,t,r),e)};l.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Or=(s,t,e)=>{l.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var at=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&at(s,t,n,r)});return}Mr(s,t,e,r)},Mr=(s,t,e,r)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;let o=Br(s,n,i,r);b.watch(s,t,n,o)},Br=(s,t,e,r)=>typeof e=="object"?n=>{Lr(s,e,n)}:n=>{Nr(s,e,t,n,r)},Nr=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":Hr(i,s,n);break;case"string":let o=xt(s);if(o!=="textContent"){d.setAttr(s,o,i);break}w.addHtml(s,i);break}},Hr=(s,t,e)=>{p.rebuild(s,t,e)},Lr=(s,t,e)=>{for(let[r,n]of Object.entries(t))r&&(n===e?d.addClass(s,r):d.removeClass(s,r))};var G=(s,t,e)=>{let r=T(e);at(s,r,t,e)};var be=(s,t,e)=>{t&&t&&d.setAttr(s,"role",t)},Rr=s=>(t,e)=>{let r=t?"true":"false";d.setAttr(e,s,r)},xe=(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}`;if(Array.isArray(i)){let a=[...i];a.push(Rr(o)),G(s,a,e)}else d.setAttr(s,o,i)})};var ve=(s,t,e)=>{if(!t)return;let r=N.parse(t,e);v.addAttributes(s,r.attr,e),p.setDirectives(s,r.directives,e)};l.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var Kt=s=>s?s.getContext():null,Se=(s,t,e)=>{if(typeof t!="function")return;let r=Kt(e),n=t(r);ve(s,n,e)},ke=(s,t,e)=>{if(typeof t!="function")return;let r=Kt(e);t(r)},we=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=Kt(e),n=t(r);n&&e.addContextBranch(n[0],n[1])};var Ce=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var Ae=(s,t,e)=>{},Te=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&p.build(r,s,e)},De=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Ee=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&p.build(r,s,e)},Pe=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&p.build(r,s,e)},Oe=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},Me=(s,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let r=t[2];t[2]=n=>{r(n,e)}}e.events.on(...t)}};var Be=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=T(e),!r)return;n=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=T(e);if(!o)return;t.unshift(o)}[r,n,i]=t}b.bind(s,r,n,i)};var Ht=(s,t,e)=>{at(s,e.state,t,e)};var Ne=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";d.setData(e,r,o)},He=(s,t,e)=>{if(!t)return;let r=[...t],n=r.pop();r.push(Ne(n)),G(s,r,e)},Le=(s,t,e)=>{if(!t)return;let r=[...t],n=r.pop();r.push(Ne(n)),Ht(s,r,e)};var Re=(s,t,e)=>{let r,n,i,o;if(t.length<3){let c=T(e);if(!c)return;r=c,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1;b.watch(s,r,n,c=>{if(p.removeAll(s),!c||c.length<1)return;let u=[];return c.forEach((m,y)=>{let C=a?r.scope(`${n}[${y}]`):null,K=i(c[y],y,C,u);K!==null&&u.push(K)}),p.build(u,s,e)})};var Ie=(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)}),p.build(i,s,e)};var _e=(s,t,e)=>{t(s,e)};l.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var je=(s,t,e)=>{Ir(s,t,e)},Ir=(s,t,e)=>{l.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var Ue=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(var r=0,n=t.length;r<n;r++)S.setup(s,t[r],e);else S.setup(s,t,e)};var _r=0,X=class{constructor(t){this.router=t,this.locationId="base-app-router-"+_r++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var Lt=class extends X{addEvent(){return f.on("popstate",window,this.callBack),this}removeEvent(){return f.off("popstate",window,this.callBack),this}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let r=e.scrollPosition;r&&this.scrollTo(r)}createState(t,e={}){let r=this.getScrollPosition();return{location:this.locationId,...e,scrollPosition:r,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 Rt=class extends X{addEvent(){return f.on("hashchange",window,this.callBack),this}removeEvent(){return f.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,r){return window.location.hash=t,this}};var It=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Lt(t).setup():new Rt(t).setup()}};var Qt=class extends k{getChildScope(){return this.parent}},We=s=>I(s,Qt);var _t=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent}focus(t){this.setup===!1&&this.create(),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template();this.transferSettings(t)}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){this.template.isUnit||(this.template=new(We(this.template)));let t=this.template;this.transferSettings(t)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;p.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var $e=s=>{if(!s.length)return null;let t={};return s.forEach(e=>{t[e]=null}),t},Fe=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);return n===null||n.forEach(i=>{i&&(i=i.replace(":",""),t.push(i))}),t};var jr=s=>s.replace(/\//g,"/"),Ur=s=>s.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)")),Wr=s=>(s=s.replace(/(\?\/+\*?)/g,"?/*"),s.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),$r=s=>s.replace(/(\*)/g,".*"),Fr=(s,t)=>s+=t[t.length-1]==="*"?"":"$",Ve=s=>{if(!s)return"";let t=jr(s);return t=Ur(t),t=Wr(t),t=$r(t),t=Fr(t,s),t};var Vr=0,jt=class extends O{constructor(t,e){let r=t.baseUri,n=Fe(r),i=$e(n),o=super(i);return this.uri=r,this.paramKeys=n,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setup(){this.stage={},this.id=null,this.uri=null,this.uriQuery=null,this.controller=null,this.paramKeys=null,this.titleCallBack=null,this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1}setupRoute(t){this.id=t.id||"bs-rte-"+Vr++,this.path=null,this.referralPath=null;let e=Ve(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1}setTitle(t){this.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?Xt(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i}=t,o={component:e,container:r,persist:n,parent:i},a=kt(this);this.controller=new _t(a,o)}resume(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let 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):(Array.isArray(r)&&(r.shift(),e=r,this.setParams(r)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let r={};e.forEach((n,i)=>{typeof n<"u"&&(r[n]=t[i])}),this.set(r)}getParams(){return this.stage}};var Jr=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},qr=(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},zr=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=qr(t,s),Jr(t)),Yr=(s,t)=>(t!==""&&(s+=" - "+t),s),Je=(s,t,e)=>t&&(t=zr(s,t),Yr(t,e));var qe={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 ze=(s,t)=>({attr:s,value:t}),Gr=(s,t)=>new RegExp("^"+s+"($|#|/|\\.).*").test(t),Ut=class extends k{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,n=P.data,i=[];return t&&typeof t=="object"&&i.push(ze("href",t)),e&&typeof e=="object"&&i.push(ze("text",e)),i.push({value:["[[path]]",n],callBack:(o,a)=>{let c=a.pathname+a.hash,u=r?o===c:Gr(a.pathname,o);this.update(u)}}),i}setupStates(){return{selected:!1}}update(t){this.state.selected=t}};var Xr=()=>typeof window<"u"?window.location:{},Zt=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=Xr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new M({path:""})}setupHistory(){this.history=It.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new jt(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()+qe.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);return t.forEach(n=>{let i=this.createRoute(n);r.push(i)}),this.checkGroup(r,this.getPath()),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);return t.forEach(i=>{let o=i.component.route;o.resume(e),n.push(o)}),this.checkGroup(n,this.getPath()),r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){this.switches.delete(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.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),f.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=new Map,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.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=Je(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){this.switches.forEach(r=>{this.checkGroup(r,t)})}checkGroup(t,e){if(!t.length)return;let r=t.find(o=>o.get("active"));r&&r.match(e)===!1&&r.deactivate();let n;for(let o of t){if(typeof o>"u")continue;if(n){o.deactivate();continue}o.match(e)!==!1&&n===void 0&&o.controller&&(n=o,this.select(o))}let i=t[0];n||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){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),t.preventScroll!==!0&&this.checkToScroll())}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){f.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},P=new Zt;l.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&P.removeRoute(t)});var Ge=(s,t,e)=>{t&&(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=P.add(t);Kr(s,r)},Kr=(s,t)=>{l.add(s,"routes",{route:t})};l.addType("switch",s=>{if(!s)return!1;let t=s.id;P.removeSwitch(t)});var Xe=(s,t,e)=>{let r=t[0];t.forEach(i=>{i.container=s,i.parent=e});let n=P.addSwitch(t);Qr(s,n)},Qr=(s,t)=>{l.add(s,"switch",{id:t})};V.add("cache",Ae).add("onCreated",_e).add("onDestroyed",je).add("bind",Be).add("onSet",G).add("onState",Ht).add("animateIn",ge).add("animateOut",ye).add("watch",Ue).add("useParent",Te).add("useData",Ee).add("useState",Pe).add("getId",De).add("addState",Oe).add("addEvent",Me).add("map",Ie).add("for",Re).add("useContext",ke).add("addContext",we).add("context",Se).add("role",be).add("aria",xe).add("route",Ge).add("debug",Ce).add("dataSet",He).add("dataStateSet",Le).add("switch",Xe);A.augment({Ajax:ht,Html:w,dataBinder:b,Data:M,SimpleData:R,Model:F,State:E,Builder:p,router:P,Component:k});export{ht as Ajax,B as Arrays,ar as Atom,p as Builder,k as Component,M as Data,l as DataTracker,vr as DateTime,V as Directives,d as Dom,it as Encode,$t as Events,w as Html,Xt as Import,I as Jot,F as Model,Ut as NavLink,g as Objects,xr as Pod,R as SimpleData,E as State,x as Strings,h as Types,ot as Unit,A as base,b as dataBinder,P as router};
1
+ var B=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var h=class{static getType(t){let e=typeof t;return e!=="object"?e:Array.isArray(t)?"array":"object"}static isUndefined(t){return typeof t>"u"}static isObject(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var g={create(s){return Object.create(s||null)},extendObject(s,t){return!h.isObject(s)||!h.isObject(t)?!1:(Object.keys(s).forEach(e=>{this.hasOwnProp(t,e)||(t[e]=s[e])}),t)},clone(s){return!s||!h.isObject(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!!s&&Object.prototype.toString.call(s)==="[object Object]"},isEmpty(s){return h.isObject(s)?Object.keys(s).length===0:!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 ct=class{constructor(){this.types=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let r,n=Q.get(t);if(n){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 l=class{static trackers=new Map;static trackingCount=0;static addType(t,e){Q.add(t,e)}static removeType(t){Q.remove(t)}static getTrackingId(t){return t?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 has(t,e){let r=this.getTrackingId(t);if(!r)return!1;let n=this.trackers.get(r);return n&&e?n.has(e):!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new ct),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);if(!e){n.remove(),this.trackers.delete(r);return}n.remove(e),this.isEmpty(n.types)&&this.trackers.delete(r)}};var Wt=s=>{let t=0;for(let[e,r]of Object.entries(s))t++,typeof s[e]=="object"&&(t+=Wt(s[e]));return t},te=(s,t)=>{let e=!1;if(typeof s!="object"||typeof t!="object")return e;for(let[r,n]of Object.entries(s)){if(!g.hasOwnProp(t,r))break;let i=t[r];if(typeof n!=typeof i)break;if(typeof n=="object"){if(e=te(n,i),e!==!0)break}else if(n===i)e=!0;else break}return e},Ke=(s,t)=>{let e=Wt(s),r=Wt(t);return e!==r?!1:te(s,t)},ee=(s,t)=>{let e=typeof s;return e!==typeof t?!1:e==="object"?Ke(s,t):s===t};var f={getEvents(s){return h.isObject(s)===!1?[]:l.get(s,"events")},create(s,t,e,r=!1,n=!1,i=null){return n=n===!0,{event:s,obj:t,fn:e,capture:r,swapped:n,originalFn:i}},on(s,t,e,r){return Array.isArray(s)?s.forEach(n=>this.add(n,t,e,r)):this.add(s,t,e,r),this},off(s,t,e,r){if(Array.isArray(s)){var n;s.forEach(i=>this.remove(i,t,e,r))}else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,n=!1,i=null){if(h.isObject(t)===!1)return this;let o=this.create(s,t,e,r,n,i);return l.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let n=this.getEvent(s,t,e,r);return n===!1?this:(typeof n=="object"&&this.removeEvent(n),this)},removeEvent(s){return typeof s=="object"&&s.obj.removeEventListener(s.event,s.fn,s.capture),this},getEvent(s,t,e,r){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(s,t,e,r);return this.search(i,n)},search(s,t){let e,r=this.isSwappable(s.event);for(var n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==s.event||e.obj!==s.obj)&&(e.fn===s.fn||r===!0&&e.originalFn===s.fn))return e;return!1},removeEvents(s){return h.isObject(s)===!1?this:(l.remove(s,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(s){this.swap.push(s)},isSwappable(s){return this.swap.includes(s)}};l.addType("events",s=>{f.removeEvent(s)});var $t={events:f,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;switch(t){case"HTMLEvents":n=new Event(s,e);break;case"MouseEvents":n=new MouseEvent(s,e);break;default:n=new CustomEvent(s,r);break}return n},createEvent(s,t,e,r){if(h.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};h.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(h.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=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof s=="function"&&s(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,r,!0,s),this},offMouseWheel(s,t,e=!1){typeof t>"u"&&(t=window);let r=this.getWheelEventType();return this.off(r,t,s,e),this},preventDefault(s){return typeof s.preventDefault=="function"?s.preventDefault():s.returnValue=!1,this},stopPropagation(s){return typeof s.stopPropagation=="function"?s.stopPropagation():s.cancelBubble=!0,this}};var Z=class{constructor(){this.errors=[],this.dataTracker=l}augment(t){if(!h.isObject(t))return this;let e=this.constructor.prototype;for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,n){return(t[e]=r).apply(t,B.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(h.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)}};Z.prototype.extend=(function(){return Z.prototype})();var A=new Z;A.augment({...g,...$t,...h,equals:ee});var tt={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};var re=()=>{A.augment({xhrSettings:tt,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=g.extendClass(A.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=tt}})};var x=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,r=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let n={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(o,a,c,u){n[a]=e!==!1?decodeURIComponent(u):u}),n}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,r=>r[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let r=/([A-Z]{1,})/g;return t.replace(r,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,r=>r.charAt(0).toUpperCase()+r.substring(1).toLowerCase())}};var ut=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:r,url:n,async:i}=this.settings;e.open(r,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=tt.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=g.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={...A.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=g.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=()=>{f.removeEvents(r.upload),f.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);f.on(["load","error","abort"],e,r),f.on("progress",e.upload,r)}};re();var ht=(...s)=>new ut(s).xhr;var Qe=s=>typeof s!="string"?s:se(s),se=s=>[{tag:"text",textContent:s}],ft=()=>({props:{},children:[]}),lt=s=>({props:{},children:se(s)}),dt=s=>({props:{},children:s}),pt=s=>({props:s[0]||{},children:Qe(s[1])});var mt=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{let i=r.values();for(let o of i)o&&o.unsubscribe();this.connections.delete(t)}}};var j=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var gt=class extends j{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 yt=class extends U{constructor(){super(),this.source=null}addSource(t){return this.source=new gt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var W=class extends j{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 bt=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 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?B.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]:B.toArray(r):!1}static html(t,e){return h.isObject(t)===!1?!1:h.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return h.isObject(t)===!1||h.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 h.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 h.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 h.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"?[]:t.querySelectorAll(e)}static show(t){if(h.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(h.isObject(t)===!1)return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return h.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return h.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return h.isObject(t)?t.offsetWidth:!1}static getHeight(t){return h.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,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 h.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(h.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(h.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 h.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return h.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return h.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var xt=s=>{let t="textContent";if(!s||typeof s!="object")return t;let e=s.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let r=s.type;if(!r)return t="value",t;switch(r){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var Ze=(s,t,e)=>{d.setAttr(s,t,e)},tr=(s,t,e)=>{s.checked=s.value==e},er=(s,t,e)=>{e=e==1,ne(s,t,e)},ne=(s,t,e)=>{s[t]=e},rr=(s,t)=>d.getAttr(s,t),sr=(s,t)=>s[t],vt=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=Ze,this.getValue=rr,this;this.getValue=sr;let r=t.type;if(r)switch(r){case"checkbox":this.setValue=er;return;case"radio":this.setValue=tr;return}return this.setValue=ne,this}getAttrBind(t){return t||xt(this.element)}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return r=>t.replace(e,r)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}};var St=class extends U{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new vt(t,e,r,this.pubSub)}addData(t,e){return this.data=new bt(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 ie=-1,$=class{constructor(){this.callBacks=new Map}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),ie=-1}on(t,e){let r=(++ie).toString();return this.get(t).set(r,e),r}off(t,e){let r=this.callBacks.get(t);r&&(e=String(e),r.delete(e),r.size===0&&this.callBacks.delete(t))}remove(t){this.callBacks.delete(t)}publish(t,...e){let r=this.callBacks.get(t);if(r)for(let n of r.values())n&&n.apply(this,e)}};var Ft=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=[20,37,38,39,40],this.connections=new mt,this.pubSub=new $,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null;if(r.indexOf(":")!==-1){let m=r.split(":");m.length>1&&(i=m[1],o=m[0])}let a=this.setupConnection(t,e,i,o,n),c=a.element,u=e.get(i);return typeof u<"u"?c.set(u):(u=c.get(),u!==""&&a.data.set(u)),this}setupConnection(t,e,r,n,i){let o=this.getBindId(t),a=new St(this.pubSub);a.addData(e,r).subscribe(o);let m=`${e.getDataId()}:${r}`;return a.addElement(t,n,i).subscribe(m),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(h.isObject(t)===!1)return this;let i=new yt;i.addSource(e).subscribe(r,n);let a=this.getBindId(t),c=e.getDataId()+":"+r;this.addConnection(a,c,i);let u=e.get(r);return n(u),this}unwatch(t,e,r){if(h.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 null;let e=t[this.attr];return e||null}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!==null){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(){typeof document<"u"&&f.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&f.off(["change","paste","input"],document,this.changeHandler,!1)}},b=new Ft;var T=s=>s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null;var nr={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"},et=s=>nr[s]||s,rt=s=>typeof s=="string"&&s.substring(0,2)==="on"?s.substring(2):s,w=class{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(r,i):this.append(r,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let r=e.type;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=rt(e),f.add(e,t,r);else{let i=et(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(!h.isObject(t)||!h.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){l.remove(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)}}t.bindId&&b.unbind(t)}static removeElement(t){if(!t)return this;let e=l.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!h.isObject(t))return this;let e=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 h.isObject(t)?t.cloneNode(e):!1}};var v=class extends w{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;this.addAttr(t,i,o,r)})}static addAttr(t,e,r,n){if(r===""||!e)return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){e=rt(e),f.add(e,t,function(a){r.call(this,a,n)});return}if(e.substr(4,1)==="-"){d.setAttr(t,e,r);return}let o=et(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 Vt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,S={isWatching(s){return Array.isArray(s)?typeof s[0]=="string"&&this.hasParams(s[0]):this.hasParams(s)},hasParams(s){return h.isString(s)&&s.includes("[[")},_getWatcherProps(s){let t=s.match(Vt);return t?t.map(e=>e.slice(2,-2)):null},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"disabled":s.disabled=!e;break;case"checked":s.checked=!!e;break;case"required":s.required=!!e;break;case"src":if(s.tagName.toLowerCase()==="img"){s.src=e&&e.indexOf(".")!==-1?e:"";break}s.src=e;break;default:v.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace(Vt,function(){let n=e?t[r]:t;r++;let i=n.get(arguments[2]);return typeof i<"u"&&i!==null?i:""})},_getWatcherCallBack(s,t,e,r,n){return()=>{let i=this.replaceParams(e,t,n);this.updateAttr(s,r,i)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,T(t)]:(e.length<2&&e.push(T(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=s.attr||"textContent",o=s.callBack;if(typeof o=="function"){let a=r.match(Vt)||[],c=a&&a.length>1;return(u,m)=>{u=c!==!0?u:this.getPropValues(e,a,n);let y=o(u,t,m);typeof y<"u"&&this.updateAttr(t,i,y)}}return this._getWatcherCallBack(t,e,r,i,n)},addDataWatcher(s,t,e){let r=this.getValue(t,e),n=r[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=r[0],o=Array.isArray(n),a=this.getCallBack(t,s,n,i,o),c=this._getWatcherProps(i);for(var u=0,m=c.length;u<m;u++){var y=o?n[u]:n;this.addWatcher(s,y,c[u],a)}},getWatcherSettings(s,t=null){if(typeof s=="string")return{attr:t,value:s};if(Array.isArray(s)){let e=s[s.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let r=s[1]&&typeof s[1]=="object"?[s[0],s[1]]:[s[0]];return typeof e=="function"?{attr:t,value:r,callBack:e}:{attr:e||"textContent",value:r}}return s},setup(s,t,e){t&&this.addDataWatcher(s,this.getWatcherSettings(t),e)},addWatcher(s,t,e,r){b.watch(s,t,e,r)}};var ir=s=>({props:{watch:s},children:[]}),or=s=>{if(!s)return ft();let t=s[0];if(typeof t=="string")return lt(t);if(Array.isArray(t))return S.isWatching(t)===!1?dt(t):ir(t);let e=s[1]??s[0]??[];return e&&Array.isArray(e)&&S.isWatching(e)===!0&&(s[0]=Array.isArray(s[0])?{}:s[0],s[0].watch=e,s[1]=[]),pt(s)},ar=s=>(...t)=>{let{props:e,children:r}=or(t);return s(e,r)};function oe(s,t){let e=isNaN(Number(t)),r=e?t:`[${t}]`;return s===""?r:e?`${s}.${r}`:`${s}${r}`}function ae(s,t="",e=""){return{get(r,n,i){let o=r[n];if(t===""&&n in r)return typeof o=="function"?o.bind(r):o;let a=r[e]||r;if(o=Reflect.get(a,n,i),g.isPlainObject(o)||Array.isArray(o)){let c=oe(t,n);return new Proxy(o,ae(s,c,e))}return o},set(r,n,i,o){if(t===""&&n in r)return r[n]=i,!0;let a=oe(t,n);return s.set(a,i),!0}}}var kt=(s,t="stage")=>new Proxy(s,ae(s,"",t));var st=class{static resume(t,e){if(!t)return null;let r,n=localStorage.getItem(t);return n===null?e&&(r=e):r=JSON.parse(n),r}static store(t,e){if(!t||!e)return!1;let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var wt=(s={})=>{let t={};if(!h.isObject(s))return t;let e=g.clone(s);return Object.keys(e).forEach(r=>{let n=e[r];typeof n!="function"&&(t[r]=n)}),t};var cr=0,H={CHANGE:"change",DELETE:"delete"},Jt=(s,t)=>`${s}:${t}`,O=class{constructor(t={}){this.dirty=!1,this.links={},this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new $;let e=wt(t);return this.set(e),kt(this)}setup(){this.stage={}}_init(){let t=++cr;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}getDataId(){return this._id}remove(){}on(t,e){let r=Jt(t,H.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=Jt(t,H.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,r,H.CHANGE))}publishLocalEvent(t,e,r,n){let i=Jt(t,n);this.eventSub.publish(i,e,r)}_publish(t,e,r,n){this.publishLocalEvent(t,e,r,n),r=r||this,b.publish(this._dataId+t,e,r)}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,r=this){delete t[e],this.publishLocalEvent(e,null,r,H.DELETE)}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=st.resume(this.key,t);return e?(this.set(e),this):this}store(){let t=this.get();return st.store(this.key,t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,r){let n=r||e,i=t.get(e);typeof i<"u"&&this.get(e)!==i&&this.set(e,i);let o=t.on(e,(c,u)=>{if(u===this)return!1;this.set(n,c,t)});this.addLink(o,t);let a=this.on(n,(c,u)=>{if(u===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;g.isEmpty(e)||(Object.entries(e).forEach(([r,n])=>{this.removeLink(n,!1)}),this.links={})}removeLink(t,e=!0){let r=this.links[t];r&&r.off(t),e!==!1&&delete this.links[t]}};O.prototype.isData=!0;var D={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},getSegments(s){let t=this.deepDataPattern;return s.match(t)}};var L=class{static set(t,e,r){if(!D.hasDeepData(e)){t[e]=r;return}let n,i=D.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]}}static delete(t,e){if(!D.hasDeepData(e)){delete t[e];return}let r=D.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(Number(a),1);break}delete t[a];break}t=c}}static get(t,e){if(!D.hasDeepData(e))return t[e]??void 0;let r=D.getSegments(e),n=r.length,i=n-1;for(var o=0;o<n;o++){var a=r[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var nt=class{static publishDeep(t,e,r,n){if(!D.hasDeepData(e)){this.publish(e,r,n);return}let i,o=D.getSegments(e),a=o.length,c=a-1,u="";for(var m=0;m<a;m++){i=o[m],t=t[i],m>0?isNaN(i)&&(u+="."+i):u=i;var y;if(m===c)y=r;else{var C=o[m+1];if(isNaN(C)===!1){u+="["+C+"]";continue}var K={};K[C]=t[C],y=K}this.publish(u,y,n)}}static publish(t,e,r){if(t=t||"",r(t,e),!(!e||typeof e!="object")){if(Array.isArray(e)){this.publishArray(t,e,r);return}this.publishObject(t,e,r)}}static publishArray(t,e,r){let n,i,o=e.length;for(var a=0;a<o;a++)i=e[a],n=t+"["+a+"]",this._checkPublish(n,i,r)}static publishObject(t,e,r){let n,i;for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i=e[o],n=t+"."+o,this._checkPublish(n,i,r))}static _checkPublish(t,e,r){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r)}};var M=class extends O{setup(){this.attributes={},this.stage={}}_setAttr(t,e,r,n){typeof e!="object"&&e===this.get(t)||(!r&&n!==!0?L.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),L.set(this.stage,t,e),r=r||this,this._publish(t,e,r,H.CHANGE))}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}getIndex(t,e,r){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===r)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r,n){let i=(o,a)=>this._publishAttr(o,a,r,n);nt.publish(t,e,i)}_publishAttr(t,e,r,n){let i=this._dataId+t;b.publish(i,e,r),this.publishLocalEvent(t,e,r,n)}mergeStage(){this.attributes=g.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,r=this){L.delete(t,e);let n=(i,o)=>this.publishLocalEvent(i,o,r,H.DELETE);nt.publish(e,e,n)}_getAttr(t,e){return L.get(t,e)}};var ur={"\n":"\\n","\r":"\\n"," ":"\\t"},hr=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>ur[r])},ce=(s,t)=>{if(typeof s!="string")return s;s=hr(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},qt=(s,t)=>{let e=typeof s;return e==="undefined"?s:e!=="object"?(s=ce(s),s):(Object.entries(s).forEach(([r,n])=>{n!==null&&(s[r]=typeof n=="string"?qt(n,t):ce(n,t))}),s)};function ue(s){return typeof s<"u"&&s.length>0?JSON.parse(s):!1}function zt(s){return typeof s<"u"?JSON.stringify(s):null}var it=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?g.clone(t):t,n=qt(r,e);return zt(n)}static json={encode:zt,decode:ue};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};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="id="+r,i=this.model;return this._get(`/${r}`,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+"="+it.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=typeof n>"u"?"":`/${n}`;return this._put(i,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=typeof n>"u"?"":`/${n}`;return this._post(i,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=typeof n>"u"?"":`/${n}`;return this._patch(i,r,t,e)}delete(t,e){let r=this.model.get("id"),n=typeof r<"u"?"id="+r:this.setupObjectData(),i=typeof r>"u"?"":`/${r}`;return this._delete(i,n,t,e)}all(t,e,r,n,i=null){let o=this.model.get();r=isNaN(r)?0:r,n=isNaN(n)?50:n;let a=o.search||"",c=o.filter||"";typeof c=="object"&&(c=JSON.stringify(c));let u=o.dates||"";typeof u=="object"&&(u=JSON.stringify(u));let m=o.orderBy||"";typeof m=="object"&&(m=JSON.stringify(m));let y=o.groupBy||"";Array.isArray(y)&&(y=JSON.stringify(y));let C="&filter="+c+"&offset="+r+"&limit="+n+"&dates="+u+"&orderBy="+m+"&groupBy="+y+"&search="+a+"&lastCursor="+(typeof i<"u"&&i!==null?i:"");return this._get("",C,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let r=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(r)}setupRequest(t,e,r,n,i){let o={url:this.getUrl(t),method:e,params:r,completed:(c,u)=>{typeof i=="function"&&i(c),this.getResponse(c,n,u)}};return this._isFormData(r)&&(o.headers={}),ht(o)}replaceUrl(t){return S.isWatching(t)&&(t=S.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,r,n){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 fr=s=>{let t={};if(!h.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},lr=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},dr=0,F=class extends M{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,r=lr(t),n=e.prototype.service.extend(r),i=fr(t);class o extends e{constructor(c){let u={...i,...wt(c)};super(u),this.xhr=new n(this)}dataTypeId=`bm${dr++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};F.prototype.service=Ct;var R=class extends O{};var At=class extends R{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=null}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 E=class{static targets=new Map;static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new At(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):null}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,r);return}this.targets.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};var Tt=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(r=>{this.on(...r)})}on(t,e,r,n){f.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){f.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=>{f.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{f.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset(),this.events=[]}};var Dt=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],u=c!==null?c:void 0;u&&typeof u=="object"&&(a=u.callBack,u=u.state),e.push(this.createState(o,u,a,r.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeActions(t,e){if(!(e.length<1))for(var r=0,n=e.length;r<n;r++){var i=e[r];i.token&&this.unbindRemoteState(t,i.token),E.remove(i.targetId,i.action,i.token)}}restore(t){E.restore(t.id,t);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=E.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(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=[])}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 he=s=>{if(!s)return ft();let t=s[0];return typeof t=="string"?lt(t):Array.isArray(t)?dt(t):pt(s)};l.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.rendered===!0&&t.prepareDestroy(),t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken))});var pr=0,ot=class{constructor(...t){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this.init();let{props:e,children:r}=he(t);this.setupProps(e),this.children=r||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+pr++,this.unitType=this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=this.persistedCount++,r="pc"+e,i=Object.keys(this.persistedChildren)[e],o=this.persistedChildren[i];return o&&t.unitType===o.unitType&&(r=i,t.resumeScope(o)),t.persistToken=r,this.persistedChildren[r]=t,r}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){l.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(var n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return w.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.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy(),this.removeContext();let t=this.panel||this.id;w.removeElement(t)}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy()}beforeDestroy(){}destroy(){this._remove()}};var k=class extends ot{constructor(...t){super(...t),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){this.data=t.data,this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,this.id=t.id}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=E.getTarget(e)}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper.restore(t);return}let e=this.setupStates();g.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Dt(this.state,t))}addState(t){!this.stateHelper||this.stateResumed==!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;t&&(this.stateHelper.removeRemoteStates(t),t.remove(),this.stateResumed=!1)}setEventHelper(){this.events||(this.events=new Tt)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy(),this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist===!1&&this.data.unlink()}};var Et={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var mr=s=>typeof s=="function"?s:()=>s,gr=s=>{let t={};return s&&Object.entries(s).forEach(([e,r])=>{let n=Et[e]||e;t[n]=mr(r)}),t},fe=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e},I=(s,t=k)=>{if(!s)return null;let e,r=typeof s;return r==="object"&&s.render?(e=gr(s),fe(t,e)):(e={render:r==="function"?s:()=>s},fe(t,e))};var yr=(s,t)=>(Object.entries(s).forEach(([e,r])=>{let n=Et[e]||e;t.prototype[n]=r}),t),br=s=>class extends s{},xr=(s,t=k)=>{if(!s)return null;let e=br(t),r={},n=s(r);return yr(r,e),e.prototype.render=n,e};var vr={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 null;let r=e[s];return t?r.substring(0,3):r},convertJsMonth(s){return this.padNumber(s+1)},convertDate(s,t=!1){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);return this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),s)},formatTime(s,t){let e=this.createDate(s),r=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),r)},getMeridian(s){return s=Number(s),s>=12?"PM":"AM"},convert24To12(s){return s=Number(s),s>12&&(s=s-12),s},convert12To24(s,t){return s=Number(s),t.toLowerCase()==="pm"&&(s=s+12),s},renderDate(s,t,e,r="sql"){return t=Number(t),e=Number(e),r==="sql"?`${s}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${s}`},renderTime(s,t,e=0,r="sql"){if(r==="sql")return`${this.padNumber(s)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(s);return s=this.convert24To12(s),`${s}:${this.padNumber(t)} ${n}`},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){let e=this.monthNames;if(s>e.length)return"";let r=e[s];return r?t?r.substring(0,3):r:""},getMonthLength(s,t){let e=new Date;return s=typeof s<"u"?s:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[s]},getMonthsLength(s=new Date().getFullYear()){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]},getLocalDate(s,t="America/Denver"){let e=new Date(s);if(Number.isNaN(e.getMonth())===!0){let i=/[- :]/,o=s.split(i);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let r=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),n=e.getTime()-r.getTime();return new Date(e.getTime()+n)},getLocalTime(s,t=!1,e=!1,r="America/Denver"){if(!s)return"";let n=this.getLocalDate(s,r),i=n.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(n.getFullYear(),i,n.getDate(),o)+" "),a+this.renderTime(n.getHours(),n.getMinutes(),n.getSeconds(),o)},getDiffFromNow(s,t=!1){s=s.replace(/\s/,"T");let e=new Date(s),r=new Date;return t===!0&&r.setHours(0,0,0,0),r.getTime()-e.getTime()},getAge(s){let t=this.getDiffFromNow(s),e,r;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 String(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"?0:Math.floor(s/31558464e3)},toMonths(s){return typeof s=="number"?Math.floor(s/2592e6):0},toDays(s){return typeof s!="number"?0:Math.floor(s/864e5*1)},toHours(s){return typeof s!="number"?0:Math.floor(s%864e5/36e5*1)},toMinutes(s){return typeof s!="number"?0:Math.floor(s%864e5%36e5/6e4*1)},toSeconds(s){return typeof s!="number"?0: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 le=(s,t)=>({name:s,callBack:t});var V={keys:[],items:{},add(s,t){return this.keys.push(s),this.items[s]=le(s,t),this},get(s){return this.items[s]||null},all(){return this.keys}};var Yt=(s,t)=>({attr:s,directive:t});var J=(s,t)=>({key:s,value:t});var de=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var N=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(J("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(Yt(J(e,S.getWatcherSettings(r,et(e))),V.get("watch")))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(J("type",n))}}static parse(t,e){let r=[],n=[],i=this.getTag(t);this.setButtonType(i,t,r),this.setupChildren(t);let o=[];var a,c;for(var u in t){if(!g.hasOwnProp(t,u)||u==="tag"||(a=t[u],a==null))continue;if((c=V.get(u))!==null){n.push(Yt(J(u,a),c));continue}let m=typeof a;if(m==="object"){if(u==="children"){o=o.concat(a);continue}if(S.isWatching(a)){this.setTextAsWatcher(n,u,a);continue}o.push(a);continue}if(m==="function"){let y=a;a=function(C){y.call(this,C,e)}}if(S.isWatching(a)){this.setTextAsWatcher(n,u,a);continue}this.setElementContent(u,a,r,o)||r.push(J(u,a))}return de(i,r,n,o)}};var q=class{build(t,e,r){}setupComponent(t,e,r){t.parent=r,r&&r.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&r&&(r[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t.getChildScope());return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var Pt=class extends q{build(t,e,r){let n=v.createDocFragment();return(Array.isArray(t)?t:[t]).forEach(o=>this.buildElement(o,n,r)),e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){let n=N.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)}setDirectives(t,e,r){e.forEach(n=>{this.handleDirective(t,n,r)})}handleDirective(t,e,r){e.directive.callBack(t,e.attr.value,r)}cache(t,e,r){r&&e&&(r[e]=t)}createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return v.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return v.createComment(o,e)}return v.create(n,t.attr,e,r)}removeNode(t){v.removeElement(t)}removeAll(t){v.removeAll(t)}};var Sr=["area","base","br","col","embed","hr","img","input","link","meta","source"],z=class{static create(t,e=[],r=""){let n=this.getInnerContent(e);n+=this.getInnerHtml(e);let i=this.createAttributes(e);return Sr.includes(t)?`<${t} ${i} />`:`<${t} ${i}>`+n+r+`</${t}>`}static getInnerContent(t){let e="";return t.forEach(({key:r,value:n},i)=>{if(r!=="text"&&r!=="textContent")return"";t.splice(i,1),e+=n}),e}static getInnerHtml(t){let e="";return t.forEach(({key:r,value:n},i)=>{if(r!=="html"&&r!=="innerHTML")return"";t.splice(i,1),e+=n}),e}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:r,value:n}=e;return typeof n=="function"&&(r="on"+rt(r)),`${r}="${n}"`}).join(" ")}static createText(t){return t}static createComment(t){return`<!-- ${t} -->`}};var Ot=class extends q{build(t,e,r){return(Array.isArray(t)?t:[t]).map(i=>this.buildElement(i,r)).join("")}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,e):this.createElement(t,e):""}createElement(t,e){let r=N.parse(t,e),n=r.children.map(i=>i!==null?this.buildElement(i,e):"").join("");return this.createNode(r,n)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return z.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return z.createComment(i)}return z.create(r,t.attr,e)}removeAll(t){}};var Mt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Pt:new Ot}};var _=Mt.setup(),kr=s=>typeof s=="object"&&s.isUnit===!0,wr=s=>{let t=I(s);return new t},p=class{static render(t,e,r){return t?(kr(t)||(t=wr(t)),_.createComponent(t,e,r)):null}static build(t,e,r){return _.build(t,e,r)}static rebuild(t,e,r){return _.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){_.setDirectives(t,e,r)}static createNode(t,e,r){return _.createNode(t,e,r)}static removeNode(t){_.removeNode(t)}static removeAll(t){_.removeAll(t)}};A.augment({buildLayout(s,t,e){p.build(s,t,e)}});var Gt=[],Cr=s=>Gt.indexOf(s)!==-1,Ar=s=>({tag:"script",src:s.src,async:!1,load(t){Gt.push(s.src);let e=s.load;e&&e()}}),Tr=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){Gt.push(s.src);let e=s.load;e&&e()}}),Bt=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=Tr({load:r,src:t}):e=Ar({load:r,src:t}),p.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Cr(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var Dr=s=>s?typeof s?.prototype?.constructor=="function":!1,Y=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Dr(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){let n=p.build(t,null,r),i=n.firstChild||t?.panel;return e.after(n),i}};var Nt=class{static load(t,e){return t.then(r=>(e&&e(r),r))}};var Er=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),Pr=s=>{let t=typeof s;return t==="string"?import(s):t==="function"?s():s},pe=I({declareProps(){this.loaded=!1,this.blockRender=!1},render(){return Er({onCreated:s=>{if(this.src){if(this.layout){this.layoutRoot=Y.render(this.layout,this.panel,this.parent);return}if(this.depends){new Bt(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){this.src=Pr(this.src),Nt.load(this.src,t=>{if(this.loaded=!0,this.blockRender===!0){this.blockRender=!1;return}let e=this.layout||Y.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.layoutRoot=Y.render(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)},destroy(){if(!this.layoutRoot){this.blockRender=!0;return}this.blockRender=!1,p.removeNode(this.layoutRoot)}});var Xt=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new pe(s)};var me=(s,t,e=null)=>{f.on("animationend",s,function r(){d.removeClass(s,t),f.off("animationend",s,r),e&&e()}),d.addClass(s,t)},ge=(s,t,e)=>{me(s,t)},ye=(s,t,e)=>{let r=()=>s&&s.remove();Or(s,()=>me(s,t,r),e)};l.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Or=(s,t,e)=>{l.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var at=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&at(s,t,n,r)});return}Mr(s,t,e,r)},Mr=(s,t,e,r)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;let o=Br(s,n,i,r);b.watch(s,t,n,o)},Br=(s,t,e,r)=>typeof e=="object"?n=>{Lr(s,e,n)}:n=>{Nr(s,e,t,n,r)},Nr=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":Hr(i,s,n);break;case"string":let o=xt(s);if(o!=="textContent"){d.setAttr(s,o,i);break}w.addHtml(s,i);break}},Hr=(s,t,e)=>{p.rebuild(s,t,e)},Lr=(s,t,e)=>{for(let[r,n]of Object.entries(t))r&&(n===e?d.addClass(s,r):d.removeClass(s,r))};var G=(s,t,e)=>{let r=T(e);at(s,r,t,e)};var be=(s,t,e)=>{t&&t&&d.setAttr(s,"role",t)},Rr=s=>(t,e)=>{let r=t?"true":"false";d.setAttr(e,s,r)},xe=(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}`;if(Array.isArray(i)){let a=[...i];a.push(Rr(o)),G(s,a,e)}else d.setAttr(s,o,i)})};var ve=(s,t,e)=>{if(!t)return;let r=N.parse(t,e);v.addAttributes(s,r.attr,e),p.setDirectives(s,r.directives,e)};l.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var Kt=s=>s?s.getContext():null,Se=(s,t,e)=>{if(typeof t!="function")return;let r=Kt(e),n=t(r);ve(s,n,e)},ke=(s,t,e)=>{if(typeof t!="function")return;let r=Kt(e);t(r)},we=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=Kt(e),n=t(r);n&&e.addContextBranch(n[0],n[1])};var Ce=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var Ae=(s,t,e)=>{},Te=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&p.build(r,s,e)},De=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Ee=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&p.build(r,s,e)},Pe=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&p.build(r,s,e)},Oe=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},Me=(s,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let r=t[2];t[2]=n=>{r(n,e)}}e.events.on(...t)}};var Be=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=T(e),!r)return;n=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=T(e);if(!o)return;t.unshift(o)}[r,n,i]=t}b.bind(s,r,n,i)};var Ht=(s,t,e)=>{at(s,e.state,t,e)};var Ne=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";d.setData(e,r,o)},He=(s,t,e)=>{if(!t)return;let r=[...t],n=r.pop();r.push(Ne(n)),G(s,r,e)},Le=(s,t,e)=>{if(!t)return;let r=[...t],n=r.pop();r.push(Ne(n)),Ht(s,r,e)};var Re=(s,t,e)=>{let r,n,i,o;if(t.length<3){let c=T(e);if(!c)return;r=c,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1;b.watch(s,r,n,c=>{if(p.removeAll(s),!c||c.length<1)return;let u=[];return c.forEach((m,y)=>{let C=a?r.scope(`${n}[${y}]`):null,K=i(c[y],y,C,u);K!==null&&u.push(K)}),p.build(u,s,e)})};var Ie=(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)}),p.build(i,s,e)};var _e=(s,t,e)=>{t(s,e)};l.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var je=(s,t,e)=>{Ir(s,t,e)},Ir=(s,t,e)=>{l.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var Ue=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(var r=0,n=t.length;r<n;r++)S.setup(s,t[r],e);else S.setup(s,t,e)};var _r=0,X=class{constructor(t){this.router=t,this.locationId="base-app-router-"+_r++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var Lt=class extends X{addEvent(){return f.on("popstate",window,this.callBack),this}removeEvent(){return f.off("popstate",window,this.callBack),this}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let r=e.scrollPosition;r&&this.scrollTo(r)}createState(t,e={}){let r=this.getScrollPosition();return{location:this.locationId,...e,scrollPosition:r,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 Rt=class extends X{addEvent(){return f.on("hashchange",window,this.callBack),this}removeEvent(){return f.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,r){return window.location.hash=t,this}};var It=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Lt(t).setup():new Rt(t).setup()}};var Qt=class extends k{getChildScope(){return this.parent}},We=s=>I(s,Qt);var _t=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent}focus(t){this.setup===!1&&this.create(),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template();this.transferSettings(t)}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){this.template.isUnit||(this.template=new(We(this.template)));let t=this.template;this.transferSettings(t)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;p.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var $e=s=>{if(!s.length)return null;let t={};return s.forEach(e=>{t[e]=null}),t},Fe=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);return n===null||n.forEach(i=>{i&&(i=i.replace(":",""),t.push(i))}),t};var jr=s=>s.replace(/\//g,"/"),Ur=s=>s.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)")),Wr=s=>(s=s.replace(/(\?\/+\*?)/g,"?/*"),s.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),$r=s=>s.replace(/(\*)/g,".*"),Fr=(s,t)=>s+=t[t.length-1]==="*"?"":"$",Ve=s=>{if(!s)return"";let t=jr(s);return t=Ur(t),t=Wr(t),t=$r(t),t=Fr(t,s),t};var Vr=0,jt=class extends O{constructor(t,e){let r=t.baseUri,n=Fe(r),i=$e(n),o=super(i);return this.uri=r,this.paramKeys=n,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setup(){this.stage={},this.id=null,this.uri=null,this.uriQuery=null,this.controller=null,this.paramKeys=null,this.titleCallBack=null,this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1}setupRoute(t){this.id=t.id||"bs-rte-"+Vr++,this.path=null,this.referralPath=null;let e=Ve(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1}setTitle(t){this.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?Xt(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i}=t,o={component:e,container:r,persist:n,parent:i},a=kt(this);this.controller=new _t(a,o)}resume(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let 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):(Array.isArray(r)&&(r.shift(),e=r,this.setParams(r)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let r={};e.forEach((n,i)=>{typeof n<"u"&&(r[n]=t[i])}),this.set(r)}getParams(){return this.stage}};var Jr=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},qr=(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},zr=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=qr(t,s),Jr(t)),Yr=(s,t)=>(t!==""&&(s+=" - "+t),s),Je=(s,t,e)=>t&&(t=zr(s,t),Yr(t,e));var qe={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 ze=(s,t)=>({attr:s,value:t}),Gr=(s,t)=>new RegExp("^"+s+"($|#|/|\\.).*").test(t),Ut=class extends k{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,n=P.data,i=[];return t&&typeof t=="object"&&i.push(ze("href",t)),e&&typeof e=="object"&&i.push(ze("text",e)),i.push({value:["[[path]]",n],callBack:(o,a)=>{let c=a.pathname+a.hash,u=r?o===c:Gr(a.pathname,o);this.update(u)}}),i}setupStates(){return{selected:!1}}update(t){this.state.selected=t}};var Xr=()=>typeof window<"u"?window.location:{},Zt=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=Xr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new M({path:""})}setupHistory(){this.history=It.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new jt(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()+qe.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);return t.forEach(n=>{let i=this.createRoute(n);r.push(i)}),this.checkGroup(r,this.getPath()),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);return t.forEach(i=>{let o=i.component.route;o.resume(e),n.push(o)}),this.checkGroup(n,this.getPath()),r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){this.switches.delete(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.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),f.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=new Map,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.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=Je(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){this.switches.forEach(r=>{this.checkGroup(r,t)})}checkGroup(t,e){if(!t.length)return;let r=t.find(o=>o.get("active"));r&&r.match(e)===!1&&r.deactivate();let n;for(let o of t){if(typeof o>"u")continue;if(n){o.deactivate();continue}o.match(e)!==!1&&n===void 0&&o.controller&&(n=o,this.select(o))}let i=t[0];n||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){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),t.preventScroll!==!0&&this.checkToScroll())}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){f.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},P=new Zt;l.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&P.removeRoute(t)});var Ge=(s,t,e)=>{t&&(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=P.add(t);Kr(s,r)},Kr=(s,t)=>{l.add(s,"routes",{route:t})};l.addType("switch",s=>{if(!s)return!1;let t=s.id;P.removeSwitch(t)});var Xe=(s,t,e)=>{let r=t[0];t.forEach(i=>{i.container=s,i.parent=e});let n=P.addSwitch(t);Qr(s,n)},Qr=(s,t)=>{l.add(s,"switch",{id:t})};V.add("cache",Ae).add("onCreated",_e).add("onDestroyed",je).add("bind",Be).add("onSet",G).add("onState",Ht).add("animateIn",ge).add("animateOut",ye).add("watch",Ue).add("useParent",Te).add("useData",Ee).add("useState",Pe).add("getId",De).add("addState",Oe).add("addEvent",Me).add("map",Ie).add("for",Re).add("useContext",ke).add("addContext",we).add("context",Se).add("role",be).add("aria",xe).add("route",Ge).add("debug",Ce).add("dataSet",He).add("dataStateSet",Le).add("switch",Xe);A.augment({Ajax:ht,Html:w,dataBinder:b,Data:M,SimpleData:R,Model:F,State:E,Builder:p,router:P,Component:k});export{ht as Ajax,B as Arrays,ar as Atom,p as Builder,k as Component,M as Data,l as DataTracker,vr as DateTime,V as Directives,d as Dom,it as Encode,$t as Events,w as Html,Xt as Import,I as Jot,F as Model,Ut as NavLink,g as Objects,xr as Pod,R as SimpleData,E as State,x as Strings,h as Types,ot as Unit,A as base,b as dataBinder,P as router};
2
2
  //# sourceMappingURL=base.js.map