taggedjs 2.8.28 → 2.8.29

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.
Files changed (29) hide show
  1. package/bundle.js +1 -1
  2. package/bundle.js.map +1 -1
  3. package/js/interpolations/attributes/processAttribute.function.js +2 -13
  4. package/js/interpolations/attributes/processAttribute.function.js.map +1 -1
  5. package/js/interpolations/optimizers/domProcessContextItem.function.js +1 -4
  6. package/js/interpolations/optimizers/domProcessContextItem.function.js.map +1 -1
  7. package/js/interpolations/processSubscriptionUpdate.function.js +1 -1
  8. package/js/interpolations/processSubscriptionUpdate.function.js.map +1 -1
  9. package/js/tag/Context.types.d.ts +4 -3
  10. package/js/tag/checkDestroyPrevious.function.d.ts +1 -1
  11. package/js/tag/checkDestroyPrevious.function.js +3 -3
  12. package/js/tag/checkDestroyPrevious.function.js.map +1 -1
  13. package/js/tag/processUpdateAttrContext.function.d.ts +1 -1
  14. package/js/tag/processUpdateAttrContext.function.js +1 -1
  15. package/js/tag/processUpdateAttrContext.function.js.map +1 -1
  16. package/js/tag/processUpdateContext.function.js +1 -1
  17. package/js/tag/processUpdateContext.function.js.map +1 -1
  18. package/js/tag/update/createAndProcessContextItem.function.d.ts +2 -2
  19. package/js/tag/update/createAndProcessContextItem.function.js +3 -3
  20. package/js/tag/update/createAndProcessContextItem.function.js.map +1 -1
  21. package/js/tag/update/processTagArray.js +4 -3
  22. package/js/tag/update/processTagArray.js.map +1 -1
  23. package/js/tag/update/setupSubscribe.function.d.ts +2 -0
  24. package/js/tag/update/setupSubscribe.function.js +23 -21
  25. package/js/tag/update/setupSubscribe.function.js.map +1 -1
  26. package/js/tag/update/updateExistingValue.function.d.ts +2 -2
  27. package/js/tag/update/updateExistingValue.function.js +2 -2
  28. package/js/tag/update/updateExistingValue.function.js.map +1 -1
  29. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,2 +1,2 @@
1
- var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};function n(t){return t.renderCount=t.renderCount||0,t.global={}}t.d(e,{W9:()=>de,cg:()=>c,m0:()=>s,rS:()=>Se,Y2:()=>r,ei:()=>ge,B7:()=>R,TU:()=>L,XF:()=>he,PC:()=>fe,Ot:()=>ln,Mj:()=>pn,tD:()=>a,j8:()=>Yt,um:()=>Qt,E2:()=>Tn,OH:()=>En,TB:()=>Jt,Ii:()=>Nt,yV:()=>se,zV:()=>I,pf:()=>qe,ze:()=>jn,WJ:()=>M,Ng:()=>Wt,VI:()=>ce,aZ:()=>It,O:()=>Ot,Ie:()=>o,B4:()=>Ge,Az:()=>sr,Xi:()=>Rn,Ah:()=>n,ck:()=>Wn,Gk:()=>ie,zC:()=>$e,cF:()=>dr,jU:()=>Q,PB:()=>q,qy:()=>cr,cy:()=>S,Tn:()=>C,Gv:()=>k,yL:()=>w,D8:()=>b,Ze:()=>m,_4:()=>y,mn:()=>v,z:()=>kn,sA:()=>On,MG:()=>An,PL:()=>pe,nI:()=>h,PZ:()=>_t,N_:()=>fr,r5:()=>Sn,uc:()=>Me,pG:()=>ye,QB:()=>Je,R6:()=>lr,Ll:()=>B,vP:()=>an,wk:()=>hn,xP:()=>Cn,bc:()=>wn,B1:()=>Pn,ag:()=>xn,Tc:()=>Te,Hf:()=>ur,_A:()=>le,Ag:()=>Xe,NU:()=>In,hW:()=>Nn,wB:()=>bn,id:()=>fn,MC:()=>dn,SZ:()=>gn});class r{get(t){return"todo"}}const o="";var s,c;!function(t){t.string="string",t.number="number",t.boolean="boolean",t[void 0]="undefined"}(s||(s={})),function(t){t.function="function",t.date="date",t.unknown="unknown",t.object="object"}(c||(c={}));const a={tag:"html",dom:"dom",templater:"templater",tagComponent:"tagComponent",tagArray:"tagArray",subscribe:"subscribe",signal:"signal",renderOnce:"renderOnce",stateRender:"stateRender",version:Date.now()};let u=[],i=[],l=[],p=[],f=[],d=[];const g={locks:0};function h(){if(!(g.locks>0)){for(let t=u.length-1;t>=0;--t){const e=u[t];e.parentNode.removeChild(e)}for(const t of i)t();for(const[t,e]of l)e.textContent=t;for(const t of p)t.relative.appendChild(t.element);for(const{element:t,relative:e}of f)e.parentNode.insertBefore(t,e);u=[],i=[],p=[],f=[],l=[];for(const t of d)t();d=[]}}function b(t){switch(t){case s.string:case s.number:case s.boolean:return!0}return!1}function m(t){if(!t)return!1;switch(t.tagJsType){case a.dom:case a.tag:case a.templater:return!0}return!1}function v(t){const e=t?.tagJsType;return e===a.tagComponent||e===a.stateRender}function y(t){return k(t)&&typeof t.subscribe===c.function}function w(t){return t&&C(t.then)}function C(t){return typeof t===c.function}function k(t){return typeof t===c.object&&null!==t}function S(t){return Array.isArray(t)}function T(t){let e=t;for(;e.ownerSupport&&!v(e.templater);)e=e.ownerSupport;return e.subject.global.newest||e}function j(t){const e=B.stateConfig;return e.states[e.statesIndex]=t,++e.statesIndex,t(((...t)=>t))}function E(t){const e=B.stateConfig,n=e.statesIndex,r=T(e.prevSupport).states[n];let o=[];r((function(...t){return o=t,t}));return e.states[e.statesIndex]=t,++e.statesIndex,t(((...t)=>o))}function x(t,e){e.handlers.handler=J,e.handlers.statesHandler=j,e.rearray=[],e.stateArray=[],e.states=[],e.statesIndex=0,e.support=t}function A(t,e,n,r){n.rearray=r,n.stateArray=[],n.states=[],n.statesIndex=0,n.handlers.handler=V,n.handlers.statesHandler=E,n.prevSupport=e}class O{}function P(t){const e=t.callback;if(!e)return t.defaultValue;const[n]=function(t){const[e]=t(O),[n]=t(e);return[e,n]}(e);return n}function V(){const t=B.stateConfig,e=t.rearray[t.stateArray.length];return t.stateArray.push(e),e.defaultValue}function J(t){const e=B.stateConfig;let n=t;if(typeof t===c.function&&(n=t()),typeof n===c.function){const t=n;n=function(...e){return t(...e)},n.original=t}const r={get:function(){return P(r)},defaultValue:n};return e.stateArray.push(r),n}function I(t){const e=new R;return e.subscribeWith=e=>{const n=[],r=[],o=(o,s)=>{n[s]=!0,r[s]=o;if(n.length===t.length){for(const t of n)if(!t)return;e(r,c)}},s=[...t],c=s.shift().subscribe((t=>o(t,0))),a=s.map(((t,e)=>t.subscribe((t=>o(t,e+1)))));return c.subscriptions=a,c},e}function N(t,e,n){const r=R.globalSubCount$;R.globalSubCount$.next(r.value+1);const o=function(){o.unsubscribe()};return o.callback=e,o.subscriptions=[],o.unsubscribe=function(){return function(t,e,n){!function(t,e){const n=t.findIndex((t=>t.callback===e));-1!==n&&t.splice(n,1)}(e,n);const r=R.globalSubCount$;R.globalSubCount$.next(r.value-1),t.unsubscribe=()=>t;const o=t.subscriptions;for(const t of o)t.unsubscribe();return t}(o,n,e)},o.add=t=>(o.subscriptions.push(t),o),o.next=t=>{e(t,o)},o}function W(t,e,n){const r=[...e],o=r.shift(),s=t=>{if(r.length)return W(t,r,n);n(t)};let c=s;const a=o(t,{setHandler:t=>c=t,next:s});c(a)}class R{value;onSubscription;methods=[];isSubject=!0;subscribers=[];subscribeWith;constructor(t,e){this.value=t,this.onSubscription=e}subscribe(t){const e=N(0,t,this.subscribers),n=this.subscribeWith;if(n){if(this.methods.length){const n=t;t=t=>{W(t,this.methods,(t=>n(t,e)))}}return n(t)}return this.subscribers.push(e),this.onSubscription&&this.onSubscription(e),e}next(t){this.value=t,this.emit()}set=this.next.bind(this);emit(){const t=this.value,e=this.subscribers;for(const n of e)n.callback(t,n)}toPromise(){return new Promise((t=>{this.subscribe(((e,n)=>{n.unsubscribe(),t(e)}))}))}toCallback(t){const e=this.subscribe(((n,r)=>{const o=r?.unsubscribe;o?o():setTimeout((()=>e.unsubscribe()),0),t(n)}));return this}pipe(...t){const e=new R(this.value);return e.setMethods(t),e.subscribeWith=t=>this.subscribe(t),e.next=t=>this.next(t),e}setMethods(t){this.methods=t}static all(t){return I(t.map((t=>{if(y(t))return t;return new R(t,(e=>(e.next(t),e)))})))}static globalSubCount$=new R(0)}class L extends R{value;onSubscription;_value;constructor(t,e){super(t,e),this.value=t,this.onSubscription=e,this._value=t,M(this)}next(t){this._value=t,this.emit()}emit(){const t=this._value,e=this.subscribers;for(const n of e)n.callback(t,n)}}function M(t){Object.defineProperty(t,"value",{set(e){t._value=e,t.emit()},get:()=>t._value})}const D=new R(void 0,(function(t){Vn()||t.next()})),B={stateConfig:{stateArray:[],version:Date.now(),handlers:{handler:J,statesHandler:j}},tagClosed$:D};function $(t,e){for(let n=0;n<t.length;++n){_(t[n],e[n])}}function _(t,e){let n;t(((...t)=>(n=t,t)),1),e((()=>n),2)}function H(t,e,n,r){for(let n=t.length-1;n>=0;--n){const r=t[n].get(),o=e[n].callback;o&&o(r)}for(let t=r.length-1;t>=0;--t){const e=[],o=(...t)=>(e.push(t),t);(0,r[t])(o);let s=0;const c=(...t)=>e[s++];n[t](c)}}function U(t,e){return F(t,e)}function F(t,e){if(null===t||typeof t!==c.object)return t;if(e<0)return t;if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);const n=S(t)?[]:Object.create(Object.getPrototypeOf(t));if(S(t))for(let r=0;r<t.length;r++)n[r]=F(t[r],e-1);else for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=F(t[r],e-1));return n}function z(t,e,n){return Z(t,e,n)}function Z(t,e,n){return!(t!==e&&(r=t,o=e,!C(r)||!C(o)||r.toString()!==o.toString()))||(n<0||typeof t===c.object&&typeof e===c.object&&(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():S(t)&&S(e)?function(t,e,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Z(t[r],e[r],n-1))return!1;return!0}(t,e,n-1):!S(t)&&!S(e)&&function(t,e,n){const r=Object.keys(t),o=Object.keys(e);if(0===r.length&&0===o.length)return!0;if(r.length!==o.length)return!1;for(const s of r){if(!o.includes(s)||!Z(t[s],e[s],n-1))return!1}return!0}(t,e,n-1)));var r,o}function G(t){return t.map(X)}function X(t,e){const n=t,r=t?.tagJsType;if(r)switch(r){case a.signal:case a.subscribe:case a.stateRender:return;case a.dom:case a.tag:case a.templater:return G(n.values)}return S(t)?G(n):U(t,e)}function q(t,e,n){i.push((()=>{Q(t,e,n)}))}function Q(t,e,n){void 0!==n&&!1!==n&&null!==n?t.setAttribute(e,n):t.removeAttribute(e)}function Y(t,e,n,r,o,s){switch(r){case"init":{const t=s.added;return void d.push((()=>{e({target:n,stagger:t})}))}case"destroy":{const t=++s.removed,r=o.subject.global;return r.destroys=r.destroys||[],void r.destroys.push((()=>e({target:n,stagger:t})))}case"autofocus":return void d.push((()=>n.focus()));case"autoselect":return void d.push((()=>n.select()));case"style":{const r=t.split(".");return void i.push((()=>n.style[r[1]]=e))}case"class":return void function(t,e,n){const r=t.split(".");if(r.shift(),e){for(const t of r)i.push((()=>n.classList.add(t)));return}for(const t of r)i.push((()=>n.classList.remove(t)))}(t,e,n)}throw new Error(`Invalid special attribute of ${r}. ${t}`)}function K(t,e){const n=function(t,e,n=[]){const r=t.subject;n.push({support:t,renderCount:r.renderCount,provider:e});const o=e.children;for(let t=o.length-1;t>=0;--t){const r=o[t],s=r.subject;n.push({support:r,renderCount:s.renderCount,provider:e})}return n}(t,e);return n}function tt(t,e=[]){const n=t.subject.global,r=Le(t.templater),o=t.ownerSupport;if(n.locked)return e.push(t),e;if(r)return tt(o,e);const s=t,c=v(s.templater),u=t.templater.tagJsType,i=o&&u!==a.stateRender&&(!c||function(t,e,n){const r=function(t,e){const n=t.props,r=e.propsConfig,o=r.latest;if(Be(n,o))return!0;switch(t.propWatch){case Se.IMMUTABLE:return He(n,o);case Se.SHALLOW:return Ue(n,o)}return!z(n,o,ze)}(e,n);if(t&&r)return!0;return!1}(o,s.templater,s)),l=function(t){const e=t.subject.global.providers;if(!e)return[];const n=[];for(const t of e){const e=K(t.owner,t);n.push(...e.map((t=>t.support)))}return n}(s);return e.push(...l),i?(tt(o,e),c&&e.push(s),e):(e.push(s),e)}function et(t){++g.locks,t.forEach(nt),--g.locks,h()}function nt(t){const e=t.subject.global;e&&Me(e.newest)}const rt="no-data-ever",ot="promise-no-data-ever";function st(t,e){const n=e.subject.global,r=function(t,e){if(!0!==n.deleted)return function(t,e,n,r,o){const s=T(e),c=s.subject,a=c.global;a.locked=!0;const u=t.apply(r,o);delete a.locked;const i=function(t,e){const n=e.subject.global;return function(t,e,n){return et(tt(t)),function(t,e,n){if(w(t)){return e.subject.global.locked=!0,t.then((()=>{if(!0===n.deleted)return ot;delete e.subject.global.locked;return et(tt(e)),ot}))}return rt}(e,t,n)}(e,t,n)}(u,s);return i}(r.tagFunction,r.support,r.states,t,e)};r.tagFunction=t;const o=T(e);r.support=e;const s=o.states;return r.states=s,r}const ct=["init","destroy"];function at(t,e,n,r,o,s,c){if(c)return Y(t,e,n,c,s,o);r(n,t,e)}function ut(t,e,n,r){const o=t.appElement;"blur"===e&&(e="focusout");const s="_"+e,c=t.subject.global.events;if(!c[e]){const t=function(t){t.originalStopPropagation=t.stopPropagation,it(t,s,t.target)};c[e]=t,o.addEventListener(e,t)}n[s]=r,n[e]=r}function it(t,e,n){const r=n[e];if(r){let e=!1;if(t.stopPropagation=function(){e=!0,t.originalStopPropagation.call(t)},r(t),t.defaultPrevented||e)return}const o=n.parentNode;o&&it(t,e,o)}function lt(t,e,n,r){const o=function(...e){return o.tagFunction(t,e)};o.tagFunction=e,o.support=n,ut(n.appSupport,r,t,o)}function pt(t){if(t.startsWith("class."))return"class";const e=function(t){switch(t){case"autoselect":return"autoselect";case"autofocus":return"autofocus";case"oninit":case"init":return"oninit";case"ondestroy":case"destroy":return"destroy"}return!1}(t);return!1!==e||!!t.startsWith("style.")&&"style"}const ft={added:0,removed:0};function dt(t,e,n,r){if(n.isNameOnly)return function(t,e,n,r,o,s,a,u){if(n){if(wt(e))return void r.removeAttribute(n);if(typeof n===c.object)if(typeof e===c.object)for(const t in n)t in e||i.push((function(){r.removeAttribute(t)}));else for(const t in n)i.push((function(){r.removeAttribute(t)}))}ht(t,e,r,o,s,a,u)}(t,e,n.value,n.element,r,n.howToSet,[],ft),void(n.value=e);const o=n.element;bt(e,n.attrName,n,o,r,n.howToSet,n.isSpecial,ft),n.value=e}function gt(t,e,n,r,o,s,a,u,l){const p=yt(e);if(p>=0){const e=t[p],c=Yt(e,s,!0);return c.isAttr=!0,c.element=n,c.howToSet=o,c.isNameOnly=!0,c.handler=(t,e)=>dt(e,t,c,r),void ht(t,e,n,r,o,s,u)}const f=yt(l);if(f>=0){const l=t[f],p={isAttr:!0,element:n,attrName:e,checkValueChange:Nt,delete:Wt,withinOwnerElement:!0};s.push(p);return y(p.value)?function(t,e,n,r,o,s,c){s&&i.push((function(){n.removeAttribute(t)}));const a=e.value;if(y(a)){e.handler=zt;const u=function(a){bt(a,t,e,n,r,o,s,c)},i=a.subscribe(u),l=e.global;(l.subscriptions=l.subscriptions||[]).push(i)}return void bt(e.value,t,e,n,r,o,s,c)}(e,p,n,r,o,a,u):(p.handler=(t,e)=>dt(e,t,p,r),function(t,e,n,r,o,s,a,u){n.attrName=t,n.element=r,n.howToSet=o,typeof e===c.function?u&&ct.includes(t)?Y(t,e,r,t,s,a):vt(n,e,s,t,r):(n.attrName=t,n.element=r,n.howToSet=o,n.isSpecial=u,at(t,e,r,o,a,s,u))}(e,l,p,n,o,r,u,a),void(p.value=l))}return at(e,l,n,o,u,r,a)}function ht(t,e,n,r,s,a,u){if(!wt(e))if(typeof e!==c.object)0!==e.length&&s(n,e,o);else for(const o in e){const c=e[o];gt(t,o,n,r,s,a,pt(o),u,c)}}function bt(t,e,n,r,o,s,c,u){return C(t)?function(t,e,n,r,o,s,c,u){const i=t.templater.wrapper;if((i?.tagJsType||i?.original?.tagJsType)!==a.renderOnce)return vt(c,e,t,r,n);return mt(e,n,r,o,s,t,u)}(o,t,r,e,c,s,n,u):mt(t,r,e,c,s,o,u)}function mt(t,e,n,r,o,s,c){if(!1===r){switch(t){case void 0:case!1:case null:return void i.push((function(){e.removeAttribute(n)}))}if(C(t))return lt(e,t,s,n);o(e,n,t)}else Y(n,t,e,r,s,c)}function vt(t,e,n,r,o){return lt(o,e=st(e,n),n,r)}function yt(t){return k(t)&&"tagJsVar"in t?t.tagJsVar:-1}function wt(t){return null==t||!1===t}function Ct(t,e){const n=document.createTextNode(t);return f.push({element:n,relative:e}),n}function kt(t){switch(t){case void 0:case!1:case null:return o}return t}function St(t,e){const n=e.providers;if(n)for(const t of n)for(let n=t.children.length-1;n>=0;--n){t.children[n].subject.global===e&&t.children.splice(n,1)}e.destroy$&&e.destroy$.next(),t.subject.renderCount=0}function Tt(t){for(const e of t){const t=e.lastArray;if(t){Tt(t);continue}const n=e.global;if(!n)continue;const r=n.newest,o=n.subscriptions;o&&o.forEach((t=>t.unsubscribe())),v(r.templater)&&St(r,n);Tt(n.context)}}function jt(t,e=[],n=[]){for(const r of t){const t=r.global;if(!t)continue;const o=t.newest;if(o){e.push(o);const r=t.subscriptions;r&&n.push(...r)}const s=t.context;s&&jt(s,e,n)}return{tags:e,subs:n}}function Et(t,e){const n=t.context,r=t.destroys;if(r)return function(t,e,n){const r=[];if(t.forEach((t=>{const e=t();e instanceof Promise&&r.push(e)})),r.length){const t=Promise.all(r).then((()=>{++g.locks,xt(e.context,n),At(e),--g.locks,h()}));return void n.push(t)}++g.locks,xt(e.context,n),At(e),--g.locks,h()}(r,t,e);xt(n,e),At(t)}function xt(t,e){for(const n of t){if(n.withinOwnerElement)continue;const t=n.lastArray;if(t){It(n,t);continue}const r=n.simpleValueElm;if(r){delete n.simpleValueElm,u.push(r);continue}const o=n.global;if(void 0===o)continue;if(!0===o.deleted)continue;o.deleted=!0;o.oldest&&Et(o,e)}}function At(t){t.htmlDomMeta.forEach((t=>{const e=t.marker;e&&u.push(e);const n=t.domElement;n&&u.push(n)}))}function Ot(t,e){const n=t.subject;e.deleted=!0,n.renderCount=0;const r=[];return Tt(e.context),e.destroy$&&St(t,e),Et(e,r),r}function Pt(t,e,n,r,o){const s=t.length-1,c=e-r,a=c<0||s<c,u=n[e];if(a)return Vt(u,o),1;const i=function(t,e,n,r,o,s){const c=e&&t!==e.arrayValue;if(c)return Vt(n,r),o.splice(s,1),2;return 0}(u.value.arrayValue,t[e],u,o,n,e);return i}function Vt(t,e){!function(t,e){if(t){Ot(t.oldest,t)}else{const t=e.simpleValueElm;delete e.simpleValueElm,u.push(t)}}(t.global,t),++e.removed}function Jt(t,e){if(!S(t)){return It(e,e.lastArray),9}return!1}function It(t,e){const n={added:0,removed:0};for(let t=0;t<e.length;++t)Vt(e[t],n);delete t.lastArray}function Nt(t,e){return null==t||typeof t!==c.object?(function(t,e){const n=kt(t),r=e.simpleValueElm;l.push([n,r])}(t,e),-1):(Wt(e),6)}function Wt(t){const e=t.simpleValueElm;delete t.simpleValueElm,u.push(e)}function Rt(t,e,n,r,o){const s=Ge(t,r,o);return s.ownerSupport=e,Xe(t,s,n,o)}function Lt(t,e,n){e!==t.value&&rn(t,e,n)}function Mt(t,e,r){if(!e.global.newest)return void xe(t,e,r,{added:0,removed:0});!function(t,e,r){const o=r.global,s=o.newest,c=s.templater.wrapper,u=e.templater.wrapper;let i=!1;const l=e.templater.tagJsType,p=a.stateRender===l||a.renderOnce===l;if(p)i=e.templater.tagJsType===a.renderOnce||oe(s,e);else if(c&&u){i=c.original===u.original}const f=e.templater;if(!i)return void function(t,e,r){const o=t.global,s=o.oldest;Ot(s,o),n(t);const c=xe(e,t,r,{added:0,removed:0})}(r,f,t);const d=p||function(t,e){const n=e.props,r=t.propsConfig,o=r.latest,s=$e(n,o,t.templater.propWatch);return s}(s,f);if(!d){return void function(t,e,n,r,o){const s=t.props,c=Oe(e,n,r,s,o),a=e.propsConfig;a.castProps=c;const u=n.propsConfig;u.latest=a.latest}(f,e,s,t,f.propWatch===Se.DEEP?ze:Fe)}if(o.locked)return void o.blocked.push(e);Me(e),++r.renderCount}(r,Rt(t,r,r.appSupport,e),e)}function Dt(t,e,n,r,o){const s=document.createTextNode(""),c={value:t,checkValueChange:Nt,delete:Wt,withinOwnerElement:!1,placeholder:s};return n.added=n.added+1,o||f.push({element:s,relative:r}),Ht(t,c,e,n,o,r),o&&p.push({element:s,relative:o}),c}function Bt(t,e,n,r,o){const s=void 0===t.lastArray;s&&(t.lastArray=[]);const c=t.lastArray;let a=t.placeholder,u=0;const i=[];if(!s){for(let t=0;t<c.length;++t){const n=c[t],o=Pt(e,t,c,u,r);0!==o?2!==o?u+=o:t-=1:i.push(n)}t.lastArray=i}const l=e.length;for(let s=0;s<l;++s){a=$t(e,s,t.lastArray,n,a,r,o).placeholder}}function $t(t,e,n,r,o,s,c){const a=t[e],u=n[e];if(u)return function(t,e,n,r,o,s,c,a){const u=n.length>o;if(u)return Lt(e,t,r),e;const i=Dt(t,r,c,s,a);return n.push(i),i}(a,u,n,r,e,o,s,c);const i=Dt(a,r,s,o,c);return n.push(i),i}function _t(t,e,n,r,o,s){const c=t?.tagJsType;return c?t.processInit(t,e,n,r,o,s):S(t)?(Bt(e,t,n,r,o),void(e.checkValueChange=Jt)):void function(t,e,n){const r=kt(t),o=Ct(r,n);e.simpleValueElm=o,e.checkValueChange=Nt}(t,e,e.placeholder)}function Ht(t,e,n,r,o,s){e.handler=Ut;n.subject.global.locked=!0,_t(t,e,n,r,o,s);delete n.subject.global.locked,e.value=t}function Ut(t,e,n,r){return Lt(r,t,n)}function Ft(t,e,n,r,s,c,a){const u=document.createTextNode(o),i=Yt(t,e,s>0);i.placeholder=u,c?p.push({relative:c,element:u}):f.push({relative:a,element:u}),Ht(t,i,n,r,c,a)}const zt=()=>{},Zt="object"==typeof document&&document.createElement("div");function Gt(t,e,n,r,s,c,a,u){const i=[];a&&void 0===u&&(u=document.createTextNode(o),p.push({element:u,relative:a}),a=void 0);for(let o=0;o<t.length;++o){const l=t[o],p=l.v;if(!isNaN(p)){Ft(e[s.length],s,n,r,c,a,u);continue}const f={};if(i.push(f),"text"===l.nn){qt(f,l,a,u);continue}const d=Xt(f,l,e,n,s,r,a,u);l.ch&&(f.ch=Gt(l.ch,e,n,r,s,c+1,d,u).dom)}return{dom:i,context:s}}function Xt(t,e,n,r,o,s,c,a){const u=t.domElement=document.createElement(e.nn);return e.at&&e.at.forEach((t=>{const e=t[0],c=t[1],a=t[2]||!1;gt(n,e,u,r,Q,o,a,s,c)})),c?p.push({element:u,relative:c}):f.push({element:u,relative:a}),u}function qt(t,e,n,r){const o=t,s=o.tc=e.tc;Zt.innerHTML=s;const c=o.domElement=document.createTextNode(Zt.innerText);n?p.push({element:c,relative:n}):f.push({element:c,relative:r})}function Qt(t,e,n,r){const o=t.subject;o.delete=ce;const s=o.global;s.oldest=t,s.newest=t,++g.locks;const c=function(t,e,n,r){const o=function(t){const e=t.templater,n=e.tag;if(n.tagJsType===a.dom)return n.dom;const r=n.strings;return sr(r,n.values)}(t),s=t.templater.tag,c=s.values,u=[],i=t.subject.global;i.context=u;const l=Gt(o,c,t,e,u,0,n,r);return l}(t,e,n,r);return s.htmlDomMeta=c.dom,--g.locks,c}function Yt(t,e,n){const r={value:t,checkValueChange:Nt,delete:Wt,withinOwnerElement:n};return e.push(r),r}function Kt(t,e,n){return t.map((t=>function(t,e,n,r){if(m(t)||!t)return t;if(!e)return t;return te(t,e,n,r)}(t,e.ownerSupport,e,n)))}function te(t,e,n,r,o){if(!t)return t;if(t.tagJsType)return t;if(typeof t===c.function)return function(t,e,n){const r=t.mem;if(r)return t;const o=function(...t){return o.toCall(...t)};return o.original=t,o.mem=t,o.toCall=function(...t){return function(t,e,n,r){const o=r.subject.global,s=o?.newest||r,c=void 0===Vn(),a=t.apply(e,n),u=function(){const t=s.subject.global;return t&&!0!==t.locked?(function(t,e){const n=t.subject,r=Le(t.templater);if(r){return De(e,t)}const o=n.global;o.locked=!0,Re(o.newest,t,e,n),delete o.locked}(s,r),a):a};if(c)return u();return B.tagClosed$.toCallback(u),a}(o.mem,e,t,n)},Object.assign(o,t),o}(t,o,e);if(r===ze)return t;return ne(t)?t:S(t)?function(t,e,n,r){for(let o=t.length-1;o>=0;--o){const s=t[o];if(t[o]=te(s,n,e,r+1,t),typeof s===c.function){if(s.mem)continue;ee(r+1,o,s,t,e)}}return t}(t,n,e,r):function(t,e,n,r){const o=Object.keys(t);for(const s of o){const o=t[s],a=te(o,n,e,r+1,t);if(t[s]===a)continue;const u=Object.getOwnPropertyDescriptor(t,s);if(!(u?.get||u?.set)&&(t[s]=a,typeof a===c.function)){if(o.mem)continue;ee(r+1,s,o,t,e)}}return t}(t,n,e,r)}function ee(t,e,n,r,o){if(t>0){const t=o.subject.global;r[e].subscription=t.destroy$.toCallback((function(){r[e]=n}))}}function ne(t){return typeof t!==c.object||!t||t.tagJsType}function re(t,e,n,r){const o=e.original,s=t.tagJsType===a.stateRender,u=B.stateConfig;let i;return u.support=n,s?i=t():(i=o(...r),typeof i===c.function&&(i=i())),i.templater=t,t.tag=i,n.state=u.stateArray,n.states=u.states,n}function oe(t,e){const n=t.templater,r=e.templater,o=n?.tag||t,s=r.tag;if(n?.tagJsType===a.stateRender)return n.dom===r.dom;switch(o.tagJsType){case a.dom:return s?.tagJsType===a.dom&&function(t,e){const n=t.dom,r=e.dom;return n===r}(o,s);case a.tag:{const n=function(t,e,n,r){const o=t.strings,s=e.strings;if(o.length!==s.length)return!1;if(!o.every(((t,e)=>s[e].length===t.length)))return!1;const a=n.templater.values||t.values,u=r.templater.values||e.values;return function(t,e){const n=t.length===e.length;if(!n)return!1;const r=e.every(((e,n)=>{const r=t[n];if(typeof e===c.function&&typeof r===c.function){return!!(e.toString()===r.toString())}return!0}));if(r)return!0;return!1}(a,u)}(o,s,t,e);return n}}throw new Error(`unknown tagJsType of ${o.tagJsType}`)}function se(t,e){const r=e.global,o=r?.newest;if(m(t)){return!oe(t,o)&&(Ot(o,r),n(e),7)}const s=t?.tagJsType;if(s){return!0===en(e,t,r.newest.ownerSupport)&&-1}return 0===o.subject.renderCount?(delete e.global,e.renderCount=0,d.push((()=>{Ot(o,r),d.shift(),h()})),8):(ce(e),8)}function ce(t){const e=t.global,n=e?.newest;Ot(n,e),delete t.global,t.renderCount=0}function ae(t,e,n,r,o,s){e.checkValueChange=se;const c=Ke(t,n,e);c.ownerSupport=n;const a=Qt(c,r,o,o?void 0:s);for(const t of a.dom)t.marker&&(o?p.push({element:t.marker,relative:o}):f.push({element:t.marker,relative:s})),t.domElement&&(o?p.push({element:t.domElement,relative:o}):f.push({element:t.domElement,relative:s}));return c}function ue(t,e,n,r,o,s){return e.checkValueChange=se,o?ae(t,e,n,r,o,s):Qe(n,e,r)}function ie(t,e){const n={tagJsType:a.templater,processInit:ue,propWatch:t,props:e,key:function(t){return n.arrayValue=t,n}};return n}const le=[];function pe(t,e,n){const r=ie(Se.DEEP);r.tagJsType=t.tagJsType;const o=Ke(r,n,e);function s(){return r.tag=t(),o}return r.wrapper=s,s.tagJsType=t.tagJsType,s.original=t.original||t,o}class fe extends Error{details;constructor(t,e,n={}){super(t),this.name=fe.name,this.details={...n,errorCode:e}}}class de extends fe{constructor(t,e){super(t,"array-no-key-error",e),this.name=de.name}}class ge extends fe{constructor(t,e){super(t,"state-mismatch-error",e),this.name=ge.name}}class he extends fe{constructor(t,e){super(t,"sync-callback-error",e),this.name=he.name}}function be(t,e){const n=t.rearray;n.length&&n.length!==t.stateArray.length&&function(t,e,n){const r=`Saved states between renders are inconsistent. Expected ${t.length} states got ${n.stateArray.length}.`,o=e.templater?.wrapper;let s=o;(o?.original||o?.original)&&(s=o.original);const c={oldStates:n.stateArray,newStates:n.rearray,tagFunction:s,templater:e.templater},a=new ge(r,c);throw console.error(me,c),a}(n,e,t)}const me="State tracking requires same number of state calls on every render. This error typically occurs when a state call is only reachable behind a condition. Also, wrapping tags that have state, with tag(), often helps when tag is only reachable by a condition.";function ve(t,e){const n=t.subject;++n.renderCount;const r=B.stateConfig;t.state=r.stateArray,t.states=r.states,n.global.newest=t,be(r,t),delete r.prevSupport,delete r.support,delete r.stateArray,delete r.states,B.tagClosed$.next(e)}function ye(t,e,n,r){const o=e?.state,s=B.stateConfig;o?A(0,e,B.stateConfig,o):x(t,s);const c=t.templater;let u;if(c.tagJsType===a.stateRender){const e=c;u=Rt(c,r,t.appSupport,n),re(c,e,u)}else{u=(0,c.wrapper)(t,n,e)}return ve(u,r),u}function we(t,e,r,o,s,c){n(e);const a=pe(t,e,r);ye(a,void 0,e,r);const u=ae(a.templater,e,r,o,s,c);return e.checkValueChange=se,u}function Ce(t,e,r,o,s){if(n(e),e.checkValueChange=se,s){const n=function(t,e,n,r,o){const s=Rt(t,n,n.appSupport,e),c=s.propsConfig;if(c){const e=t.tagJsType!==a.tagComponent?[]:Ee(t,s);c.castProps=e}const u=e.global,{support:i}=Je(s,u.newest,e,n);return function(t,e,n){let r=p.length;const o=Qt(t,e,n,void 0);for(const t of o.dom)t.domElement&&p.splice(r++,0,{element:t.domElement,relative:n}),t.marker&&p.splice(r++,0,{element:t.marker,relative:n})}(i,r,o),i}(t,e,r,o,s);return n}return xe(t,e,r,o)}let ke=0;var Se;function Te(t,e=Se.SHALLOW){const n=function(...r){const o=ie(e,r);o.tagJsType=a.tagComponent,o.processInit=Ce;const s=function(t,e){const n=function(n,r,o){const s=Ee(t,n,o),c=n.ownerSupport,a=Rt(t,c,n.appSupport,r,s);return re(t,e,a,s)};return n}(o,n);return s.original=t,o.wrapper=s,o},r=t;return n.original=t,r.tags=le,r.setUse=B,r.ValueTypes=a,r.tagIndex=ke++,le.push(n),n}function je(){throw new Error("Do not call tag.use as a function but instead set it as: `(props) => tag.use = (use) => html`` `")}function Ee(t,e,n){const r=t.propWatch===Se.DEEP?ze:Fe,o=t.props,s=e.propsConfig;let c=s.castProps;const a=n?.propsConfig,u=a?.castProps;u&&(s.castProps=u,c=Oe(e,n,n.ownerSupport,o,r));return c||Kt(o,e,0)}function xe(t,e,n,r){const o=Rt(t,n,n.appSupport,e),s=o.propsConfig;if(s){const e=t.tagJsType!==a.tagComponent?[]:Ee(t,o);s.castProps=e}const c=e.global,{support:u}=Je(o,c.newest,e,n);return function(t,e,n){n.checkValueChange=se,Qt(t,e,void 0,n.placeholder)}(u,r,e),u}function Ae(t,e,n,r,o,s){return null==t||s>o?e:typeof t===c.function?e.mem?(t.mem=e.mem,e):(t.mem=e,t):ne(e)?e:S(e)?function(t,e,n,r,o,s){for(let c=t.length-1;c>=0;--c){const a=t[c],u=e[c];t[c]=Ae(u,a,n,r,s,o+1)}return t}(e,t,n,r,s,o):function(t,e,n,r,o,s){const c=Object.keys(t);for(const a of c){const c=t[a],u=Ae(e[a],c,n,r,s,o+1);if(c===u)continue;const i=Object.getOwnPropertyDescriptor(t,a)?.set;i||(t[a]=u)}return t}(e,t,n,r,s,o)}function Oe(t,e,n,r,o,s=-1){if(0===o)throw new Error("before here");const c=e.subject.global.newest;if(!c){const e=Kt(r,t,s);r.push(...e);return t.propsConfig.castProps=e,r}const a=(e=c||e).propsConfig.castProps,u=[];for(let e=0;e<r.length;++e){const c=r[e],i=Ae(a[e],c,t,n,o,s+1);u.push(i)}return t.propsConfig.castProps=u,u}function Pe(t){const e=t.subject,r=e.global,{subs:o,tags:s}=jt(r.context);Ve(r);for(const t of s){const e=t.subject.global;if(!0===e.deleted)return;Ve(e)}r.subscriptions&&o.forEach((t=>t.unsubscribe())),n(e)}function Ve(t){t.deleted=!0,Et(t,[])}function Je(t,e,n,r){const o=e?.templater,s=o?.tag,c=ye(t,e,n,r),u=!e||oe(e,c);if(u){if(e){const t=e.templater.tag;t&&n.renderCount>0&&function(t,e,n){if(t.tagJsType===a.dom){const r=n?.dom;return void(r!==t.dom&&Pe(e))}if(n){const r=n.strings;if(r){const n=r?.length;n!==t.strings.length&&Pe(e)}}}(t,e,s)}}else{!function(t,e){const n=t.subject.global;let r=-1;const o=n.providers=n.providers||[],s=o.length-1;for(;r++<s;){const t=o[r];let s=-1;const c=t.children.length-1;for(;s++<c;)if(n===t.children[s].subject.global)return t.children.splice(s,1),void t.children.push(e)}}(e,c),Pe(e);const t=c.subject.global;t.oldest=c,t.newest=c}const i=e?.ownerSupport;return c.ownerSupport=r||i,{support:c,wasLikeTags:u}}function Ie(t,e,n,r){const o=t[e],s=n[e];if(o===s.value)return;(0,s.handler)(o,t,r,s),s.value=o}function Ne(t,e){const n=t.subject.global.context;!function(t,e){const n=e.templater,r=e.templater.tag,o=n.values||r.values,s=t.templater.tag;s.values=o}(t,e),++g.locks,function(t,e){const n=t.templater.tag.values;let r=0;const o=n.length;for(;r<o;)Ie(n,r,e,t),++r}(t,n),--g.locks,h()}!function(t){t.DEEP="deep",t.SHALLOW="shallow",t.NONE="none",t.IMMUTABLE="immutable"}(Se||(Se={})),Te.renderOnce=function(){throw new Error("Do not call tag.renderOnce as a function but instead set it as: `(props) => tag.renderOnce = () => html`` `")},Te.state=je,Te.use=je,Te.route=function(t){throw new Error("Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `")},Te.app=function(t){throw new Error("Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `")},Te.deepPropWatch=Te,Te.immutableProps=function(t){return Te(t,Se.IMMUTABLE)},Te.watchProps=function(t){return Te(t,Se.SHALLOW)},Object.defineProperty(Te,"renderOnce",{set(t){t.tagJsType=a.renderOnce,t.processInit=we}}),Object.defineProperty(Te,"state",{set(t){t.original={setUse:B,tags:le},t.tagJsType=a.stateRender,t.processInit=Ce}}),Object.defineProperty(Te,"use",{set(t){t.original={setUse:B,tags:le},t.tagJsType=a.stateRender,t.processInit=Ce}});const We={added:0,removed:0};function Re(t,e,n,r){const o=r.global,{support:s,wasLikeTags:c}=Je(e,t,r,n);return c?(Ne(o.oldest,s),s):(Qe(n,r,We),s)}function Le(t){return a.templater===t.tagJsType}function Me(t){const e=t.subject.global,n=Le(t.templater),r=t.ownerSupport;if(e.locked)return e.blocked.push(t),t;if(n){return De(r,t)}e.locked=!0;const o=t.subject;e.blocked.length&&(t=e.blocked.pop(),e.blocked=[]);const s=Re(e.newest,t,r,o);return delete e.locked,s}function De(t,e){const n=t.subject.global;if(!n||!0===n.deleted)return e;return Me(n.newest||t)}function Be(t,e){return t.length!==e.length}function $e(t,e,n){if(Be(t,e))return 11;switch(n){case Se.NONE:return 1;case Se.SHALLOW:return Ue(t,e);case Se.IMMUTABLE:return He(t,e)}return function(t,e){let n=t,r=e;n=[...t],r=[...e||[]];if(!n.every(((t,e)=>function(t,e,n,r){const o=r[e];if(typeof t===c.object){const e={...t},n={...o||{}},r=Object.entries(e).every((([t,r])=>_e(r,n[t],(()=>{delete e[t],delete n[t]}))));return r}return _e(t,o,(()=>{n.splice(e,1),r.splice(e,1)}))}(t,e,n,r))))return 7;return!1}(t,e)}function _e(t,e,n){if(typeof t!==c.function)return!!z(t,e,ze)&&4;if(typeof e!==c.function)return!1;const r=e?.original;r&&(e=r);t.original&&(t=t.original);return t.toString()===e.toString()?(n(),5):(n(),6)}function He(t,e){const n=t.length;for(let r=0;r<n;++r){if(t[r]!==e[r])return 2}return!1}function Ue(t,e){const n=t.length;for(let r=0;r<n;++r){const n=t[r],o=e[r];if(S(n)&&S(o)){if(n===o)continue;return 3}if(typeof n!==c.function||typeof o!==c.function)if(typeof n!==c.object){if(n!==o)return 3.3}else if(typeof e===c.object){const t=Object.entries(n);for(const e of t){if(!Ze(e,o))return 3.1}}}return!1}const Fe=3,ze=10;function Ze([t,e],n){const r=n[t];return typeof e===c.function&&typeof r===c.function||r===e}function Ge(t,e,n){const r={templater:t,subject:e,castedProps:n,appSupport:void 0},o=e.global;return o.blocked=[],o.destroy$=new R,r}function Xe(t,e,n,r){e.appSupport=n;const o=t.props;return o&&(e.propsConfig=function(t,e,n){const r=t.templater;if(r.tagJsType!==a.stateRender){switch(r.propWatch){case Se.IMMUTABLE:return t.propsConfig={latest:e,castProps:n};case Se.SHALLOW:return t.propsConfig={latest:e.map((t=>X(t,Fe))),castProps:n}}return t.propsConfig={latest:e.map((t=>X(t,ze))),castProps:n}}}(e,o,r)),e}function qe(t,e,n,r,o){const s={templater:t,subject:r,castedProps:o,appSupport:void 0};return s.ownerSupport=e,s.appSupport=n,s}function Qe(t,e,n){const r=e.global.newest;r.ownerSupport=t,e.checkValueChange=se;return Qt(r,n,void 0,e.placeholder),r}function Ye(){return{tagJsType:a.templater,processInit:ue}}function Ke(t,e,n){const r=qe(t,e,e.appSupport,n);return n.global.context=[],r}const tn={added:0,removed:0};function en(t,e,r){const o=e.tagJsType;if(v(e))return void 0===t.global&&n(t),Mt(e,t,r),!0;const s=t.global;if(s){const n=s.newest;if(n)return typeof e===c.function||function(t,e,n,r){const o=Rt(n.templater||n,r,r.appSupport,e);Ne(t.subject.global.oldest,o)}(n,t,e,r),!0}switch(o){case a.templater:return Qe(r,t,tn),!0;case a.tag:case a.dom:return function(t,e,r){const o=t;let s=o.templater;s||(s=Ye(),o.templater=s,s.tag=o);const c=e.global?e.global:n(e);c.newest=Ke(s,r,e),Qe(r,e,tn)}(e,t,r),!0;case a.subscribe:return e.processInit(e,t,r,{added:0,removed:0},void 0,t.placeholder),!0}return!1}function nn(t,e,n,r){const o=t&&t.tagJsType;if(o){if(o===a.renderOnce)return;en(e,t,n)}else S(t)?Bt(e,t,n,{added:0,removed:0}):typeof t!==c.function?r&&function(t,e){e.checkValueChange=Nt;const n=e.placeholder,r=kt(t);e.simpleValueElm=Ct(r,n)}(t,e):e.value=t}function rn(t,e,n){const r=t.checkValueChange(e,t);-1!==r&&nn(e,t,n,r)}function on(t,e,n,r,o,s,c){let u;s&&(u=c=document.createTextNode(""),p.push({element:c,relative:s}));const i=function(t,e,n,r,o,s){const c=T(n);let a;let u=function(t){l.callback&&(t=l.callback(t)),l.hasEmitted=!0,l.contextItem=Dt(t,n,r,s),u=function(t){rn(l.contextItem,t,n),p||B.stateConfig.support||h()}};const i=function(t){a=t;const e=c.subject.global.newest;var n;n=c,$(e.states,n.states),l.callback&&(t=l.callback(t)),u(t)},l={hasEmitted:!1,handler:i,getLastValue:()=>a,callback:o,states:c.states};let p=!0;return l.subscription=t.subscribe(i),p=!1,l}(t,0,n,r,o,c),l=e.delete=()=>{if(i.contextItem.delete(i.contextItem),i.subscription.unsubscribe(),u){u.parentNode.removeChild(u)}};e.handler=(t,e,n)=>{if(!t||!t.tagJsType||t.tagJsType!==a.subscribe)return l(),99;if(!i.hasEmitted)return;i.callback=t.callback,i.handler(i.getLastValue());const r=T(n);i.states=r.states}}function sn(t,e,n,r,o,s){return on(t.Observable,e,n,r,t.callback,o,s)}function cn(t,e,n,r,o){on(t,e,n,r,void 0,o)}function an(t){return Vn()?hn((()=>un(t))):un(t)}function un(t){let e=t;const n=new Set;return{tagJsType:a.signal,processInit:cn,get value(){return e},set value(t){e!==t&&(e=t,n.forEach((e=>e(t))))},subscribe(t){t(e),n.add(t);const r=()=>n.delete(t);return r.unsubscribe=r,r}}}class ln extends R{value;constructor(t){super(t),this.value=t}subscribe(t){const e=super.subscribe(t);return t(this.value,e),e}}class pn extends R{value;constructor(t){super(t),this.value=t,this._value=t,M(this)}subscribe(t){const e=super.subscribe(t);return t(this._value,e),e}}function fn(t){return(e,n)=>{n.setHandler((()=>{})),t(e,n.next)}}function dn(t){return(e,n)=>{n.setHandler((()=>{}));t(e).then((t=>n.next(t)))}}const gn=t=>(e,n)=>{n.setHandler((()=>{}));const r=t(e).subscribe((t=>{r.unsubscribe(),n.next(t)}))};function hn(t){return B.stateConfig.handlers.handler(t)}const bn=(t,e)=>vn(t,e),mn=t=>t;const vn=(t,e,{init:n,before:r,final:o=mn}={})=>{const s=hn({pastResult:void 0,values:void 0}),c=s.values;if(void 0===c){if(r&&!r(t))return s.values=t,s.pastResult;const a=(n||e)(t,c);return s.pastResult=o(a),s.values=t,s.pastResult}if(t.every(((t,e)=>t===c[e])))return s.pastResult;if(r&&!r(t))return s.values=t,s.pastResult;const a=e(t,c);return s.pastResult=o(a),c.length=0,c.push(...t),s.pastResult};function yn(t,e){return Object.defineProperty(e,"noInit",{get(){const e=t();return e.setup.init=()=>{},e}}),Object.defineProperty(e,"asSubject",{get(){const e=t(),n=hn((()=>Vn())),r=hn((()=>new ln(void 0))),o=hn((()=>({stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}))),s=(t,s)=>(vn(t,((t,e)=>{const c=Vn(),a=s(t,e);if(c!==n){const t=o.stateArray,e=n.subject.global.oldest;H(t,e.state,o.states,e.states)}r.next(a)}),e.setup),r);return s.setup=e.setup,yn((()=>s),s),s}}),Object.defineProperty(e,"truthy",{get(){const e=t();return e.setup.before=t=>t.every((t=>t)),e}}),e}function wn(t){return Vn()?hn((()=>new R(t))):new R(t)}function Cn(t){return B.stateConfig.handlers.statesHandler(t)}function kn(t){const e=an([]),n=an(0),r=an(0);let o=[],s=0;return r.value=n.value,t(((...t)=>(o=t,e.value))),bn(o,(()=>{++s,e.value=o,t((()=>o))})),Cn(((o,c)=>{if(s)return t(((...t)=>(c&&1!==c||(e.value=t),e.value))),r.value=n.value,void++n.value;t((()=>e.value))})),++s,e.value}yn((()=>function(t){const e=(e,n)=>vn(e,n,t);return e.setup=t,yn((()=>e),e),e}({})),bn),wn._value=t=>{const e=hn((function(){return{stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}})),n=Vn();return hn((function(){return new ln(t).pipe((t=>(H(n.state,e.stateArray,n.states,e.states),t)))}))},wn.all=function(t){const e=hn((()=>({stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}))),n=Vn();return R.all(t).pipe((t=>(H(n.state,e.stateArray,n.states,e.states),t)))};const Sn={create:t=>{const e=hn((()=>({stateDiff:0,provider:void 0})));if(e.stateDiff){let t=e.stateDiff;for(;t--;)hn(void 0);return hn(void 0)}const n=hn((()=>{const n=B.stateConfig,r=n.stateArray.length,o=t.prototype?new t:t(),s=n.support,c=n.stateArray.length-r,a={constructMethod:t,instance:o,stateDiff:c,owner:s,children:[]};e.provider=a;const u=s.subject.global;return(u.providers=u.providers||[]).push(a),e.stateDiff=c,o})),r=t,o=r.compareTo=r.toString();return e.provider.constructMethod.compareTo=o,n},inject:t=>hn((()=>{const e=t,n=e.compareTo=e.compareTo||t.toString(),r=Vn(),o=[];let s={ownerSupport:r.ownerSupport};for(;s.ownerSupport;){const t=s.ownerSupport.subject.global.providers;if(!t){s=s.ownerSupport;continue}const e=t.find((t=>{o.push(t);if(t.constructMethod.compareTo===n)return!0}));if(e){const t=r.subject.global;return(t.providers=t.providers||[]).push(e),e.children.push(r),e.instance}s=s.ownerSupport}const c=`Could not inject provider: ${t.name} ${t}`;throw console.warn(`${c}. Available providers`,o),new Error(c)}))};function Tn(t){const e=Vn();if(!e)throw xn;return jn(e,B.stateConfig,t)}function jn(t,e,n){const r=e.states;return function(...e){return t.subject.renderCount>0?function(t,e,n,...r){const o=t.subject.global.newest;$(o.states,e);const s=n(...r);return $(e,o.states),Me(o),w(s)&&s.finally((()=>{$(e,o.states),Me(o)})),s}(t,r,n,...e):n(...e)}}const En=()=>{const t=Vn();if(!t)throw xn;const e=B.stateConfig;return function(n){return jn(t,e,n)}},xn=new he("callback() was called outside of synchronous rendering. Use `callback = callbackMaker()` to create a callback that could be called out of sync with rendering");function An(t){hn(t)}function On(t){hn((function(){Vn().subject.global.destroy$.toCallback(t)}))}function Pn(t,e){return{tagJsType:a.subscribe,processInit:sn,Observable:t,callback:e,states:T(Vn()).states}}function Vn(){return B.stateConfig.support}function Jn(t,e,r,o,s,c){e.checkValueChange=se;const a=t;let u=a.templater;u||(u=function(t){const e=Ye();return e.tag=t,t.templater=e,e}(a));const i=n(e);return s?ae(u,e,r,o,s,c):(i.newest=Ke(u,r,e),e.checkValueChange=se,Qe(r,e,o))}const In=":tagvar",Nn=":";function Wn(t,e){const n={values:e,ownerSupport:Vn(),tagJsType:a.tag,processInit:Jn,strings:t,key:t=>(n.arrayValue=t,n),html:function(t,e){return n.children={strings:t,values:e},n}};return n}function Rn(t,e){const n={values:e,ownerSupport:Vn(),dom:t,tagJsType:a.dom,processInit:Jn,key:function(t){return n.arrayValue=t,n},html:{dom:function(t,e){return n.children={dom:t,values:e},n}}};return n}const Ln=/(:tagvar\d+:)/,Mn="ondoubleclick",Dn=/([:_a-zA-Z0-9\-.]+)\s*(?:=\s*"([^"]*)"|=\s*(\S+))?/g,Bn=/<\/?([a-zA-Z0-9-]+)((?:\s+[a-zA-Z_:*][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)+\s*|\s*)\/?>/g;function $n(t){const e=[],n=[],r=[];let o=null,s=-1,c=0;const a=new RegExp(Bn,"g");for(t=function(t){return t.replace(_n,(function(t){return t.replace(/\[l t\]/g,"[l&nbsp;t]").replace(/\[g t\]/g,"[g&nbsp;t]").replace(/</g,"[l t]").replace(/>/g,"[g t]")}))}(t);c<t.length;){const u=a.exec(t);if(!u)break;const[i,l,p]=u,f=i.startsWith("</"),d=i.endsWith("/>");if(c<u.index){const e=t.slice(c,u.index);if(e.trim()){zn(e).forEach((t=>{t.startsWith(In)&&(t=In+ ++s+Nn),Un(o,n,t)}))}}if(c=u.index+i.length,f){o=r.pop()||null;continue}const g=[];let h;for(;null!==(h=Dn.exec(p));){const t=h[1]||h[3]||h[5];let n=h[2]||h[4]||h[6];if(void 0===t)continue;const r=""!==h[2],o=void 0===n&&r,c=t.toLowerCase(),a=c.startsWith("on")?Hn(c):c;if(o){if(t.slice(0,In.length)===In){const t=In+ ++s+Nn;e.push(["at",t]),g.push([t]);continue}if(h[0].startsWith(t)&&h[0].slice(t.length,h[0].length).search(/\s+$/)>=0){g.push([a]);continue}n=In+ ++s+Nn}r||(n=h[2]);const u=[a,n],i=pt(c);i&&u.push(i),g.push(u)}const b={nn:l};g.length&&(b.at=g),o?(o.ch||(o.ch=[]),o.ch.push(b)):n.push(b),d||(r.push(o),o=b)}if(c<t.length){const e=t.slice(c);if(e.trim()){zn(e).forEach((t=>(t.startsWith(In)&&++s,Un(o,n,t))))}}return n}const _n=new RegExp("(\x3c!--[\\s\\S]*?--\x3e)","g");function Hn(t){if(t.startsWith("on")){return t.length===Mn.length&&t===Mn?"dblclick":t.slice(2,t.length)}return t}function Un(t,e,n){!function(t,e,n){t?(t.ch||(t.ch=[]),t.ch.push(n)):e.push(n)}(t,e,{nn:"text",tc:Fn(n)})}function Fn(t){return t.replace(/(\[l t\]!--[\s\S]*?--\[g t\])/g,(function(t){return t.replace(/\[l t\]/g,"<").replace(/\[g t\]/g,">").replace(/\[l&nbsp;t\]/g,"[l t]").replace(/\[g&nbsp;t\]/g,"[g t]")}))}function zn(t){return t.split(Ln).filter((t=>""!==t))}const Zn=/(^:tagvar\d+:|:tagvar\d+:$)/g,Gn="__safeTagVar";function Xn(t,e){return function(t,e){const n=t.map(((t,n)=>n<e.length?t+In+n+Nn:t));return function(t,e,n){const r=n.length-e.length;if(r>0)for(let n=r;n>0;--n)t.push(In+(e.length+n-1)+Nn)}(n,t,e),n}(t.map((t=>t.replace(Zn,((t,e)=>Gn+e)))),e)}const qn=new RegExp(In+"(\\d+)"+Nn,"g"),Qn="ch";function Yn(t,e,n=[],r=[]){const o=t;for(let t=0;t<o.length;t++){const s=[...r,t],c=o[t];if(c.at){const t=c.at;c.at=tr(t,e)}if(c.ch){const t=c.ch,r=[...s,Qn];c.ch=Yn(t,e,n,r)}t=Kn(c,e,o,t)}return o}function Kn(t,e,n,r){if("text"!==t.nn)return r;const o=t;let c,a=o.tc;if(typeof a!==s.string)return r;for(;null!==(c=qn.exec(a));){const t=c[1],o=parseInt(t,10);if(!isNaN(o)&&o<e){const t=In+o+Nn,e=a.slice(c.index+t.length);n.splice(r,1,{nn:"text",v:o}),a=e,qn.lastIndex=0}}return o.tc=a,r}function tr(t,e){return t.map((t=>{const[n,r,o]=t;if(n.startsWith(In)){const t=parseInt(n.replace(In,""),10);if(!isNaN(t)&&t<e)return[{tagJsVar:t}]}if(typeof r===s.string&&r.startsWith(In)){const t=parseInt(r.replace(In,""),10);if(!isNaN(t)&&t<e)return[n,{tagJsVar:t},o]}return t}))}const er="__safeTagVar";const nr=/__safeTagVar(\d+)/g;function rr(t){if(t.at&&(t.at=t.at?t.at.map((t=>{if(1===t.length)return t;const[,e]=t;if(typeof e===s.string&&e.startsWith(er)){const n=parseInt(e.replace(er,""),10);t[1]=In+n+Nn}return t})):[]),t.ch){const e=t.ch;for(let t=0;t<e.length;t++){const n=e[t];if("text"===n.nn){if(typeof n.tc!==s.string)return;n.tc=n.tc.replace(nr,((t,e)=>In+e+Nn))}rr(n)}0===e.length&&delete t.ch}}const or={};function sr(t,e){const n=function(t){const e=t.map((t=>t.length));return e.push(t.length),Number(e.join(""))}(t),r=or[n],o=r&&function(t,e,n){if(n&&n.strings.length===t.length&&n.strings.every(((e,n)=>e===t[n]))&&n.values.length===e.length)return!0;return!1}(t,e,r);if(o)return r.domMetaMap;const s=function(t,e){return Xn(t,e),$n(Xn(t,e).join(""))}(t,e),c=Yn(s,e.length);c.forEach(rr);const a={interpolation:void 0,string:void 0,strings:t,values:e,domMetaMap:c};return or[n]=a,c}function cr(t,...e){const n=Wn(t,e),r=ie(Se.NONE);return r.tag=n,n.templater=r,n}cr.dom=function(t,...e){return Rn(t,e)};const ar=[];function ur(t,e,r){const o=ar.findIndex((t=>t.element===e));if(o>=0){const t=ar[o].support;Ot(t,t.subject.global),ar.splice(o,1),console.warn("Found and destroyed app element already rendered to element",{element:e})}let s=()=>l(r);s.propWatch=Se.NONE,s.tagJsType=a.stateRender,s.props=[r],s.isApp=!0;const u=function(t,e){const r={value:t,checkValueChange:se,delete:ce,withinOwnerElement:!1,renderCount:0,global:void 0},o=n(r);return o.events={},ir(t,r,e),r}(s,e),i=u.global;x(i.newest,B.stateConfig);let l=t(r);const p=typeof l==c.function;p||(v(l)?(i.newest.propsConfig={latest:[r],castProps:[r]},s.propWatch=l.propWatch,s.tagJsType=l.tagJsType,s.wrapper=l.wrapper,s=l):(s.tag=l,l=t));const f=document.createTextNode("");le.push(s.wrapper||{original:s});const d=lr(s,f,e,u,p);if(i.isApp=!0,p&&(l.tag=d.templater.tag),!e)throw new Error(`Cannot tagElement, element received is type ${typeof e} and not type Element`);e.destroy=function(){const t=i.events;for(const n in t){const r=t[n];e.removeEventListener(n,r)}i.events={},++g.locks;const n=Ot(d,i);return--g.locks,h(),n},++g.locks;const b=function(t,e,n,r,o,s){const c=Qt(t,{added:0,removed:0},e,void 0);n.oldest=t,n.newest=t;let u=r.setUse;if(r.tagJsType!==a.stateRender){const t=o.original;u=t.setUse,t.isApp=!0}e.setUse=u,e.ValueTypes=a,ar.push({element:e,support:t});const i=document.createDocumentFragment();i.appendChild(s);for(const t of c.dom)pr(t,i);return i}(d,e,i,s,t,f);return--g.locks,h(),e.appendChild(b),{support:d,tags:le,ValueTypes:a}}function ir(t,e,n){const r=e.global,o=Ge(t,e);return Xe(t,o,o),o.appElement=n,r.oldest=r.oldest||o,r.newest=o,o}function lr(t,e,n,r,o){r.placeholder=e;const s=r.global,c=s.oldest,u=s.newest===c,i=Rt(t,s.newest,s.newest.appSupport,r);if(u||A(0,s.newest,B.stateConfig,c.state),t.tagJsType===a.stateRender)return function(t,e,n,r,o){const s=t.wrapper||{original:t};if(!e){const e=ir(t,r,o);return ve(e),e}return re(t,s,n),ve(n),n}(t,o,i,r,n);const l=(0,t.wrapper)(i,r);return ve(i),l}function pr(t,e){t.domElement&&e.appendChild(t.domElement),t.marker&&e.appendChild(t.marker)}function fr(t,e,n){n.subject.global.deleted||(Lt(e,t,n),B.stateConfig.support||h())}const dr={tagElement:ur,renderWithSupport:Je,renderSupport:Me,renderTagOnly:ye,paint:h};var gr=e.W9,hr=e.cg,br=e.m0,mr=e.rS,vr=e.Y2,yr=e.ei,wr=e.B7,Cr=e.TU,kr=e.XF,Sr=e.PC,Tr=e.Ot,jr=e.Mj,Er=e.tD,xr=e.j8,Ar=e.um,Or=e.E2,Pr=e.OH,Vr=e.TB,Jr=e.Ii,Ir=e.yV,Nr=e.zV,Wr=e.pf,Rr=e.ze,Lr=e.WJ,Mr=e.Ng,Dr=e.VI,Br=e.aZ,$r=e.O,_r=e.Ie,Hr=e.B4,Ur=e.Az,Fr=e.Xi,zr=e.Ah,Zr=e.ck,Gr=e.Gk,Xr=e.zC,qr=e.cF,Qr=e.jU,Yr=e.PB,Kr=e.qy,to=e.cy,eo=e.Tn,no=e.Gv,ro=e.yL,oo=e.D8,so=e.Ze,co=e._4,ao=e.mn,uo=e.z,io=e.sA,lo=e.MG,po=e.PL,fo=e.nI,go=e.PZ,ho=e.N_,bo=e.r5,mo=e.uc,vo=e.pG,yo=e.QB,wo=e.R6,Co=e.Ll,ko=e.vP,So=e.wk,To=e.xP,jo=e.bc,Eo=e.B1,xo=e.ag,Ao=e.Tc,Oo=e.Hf,Po=e._A,Vo=e.Ag,Jo=e.NU,Io=e.hW,No=e.wB,Wo=e.id,Ro=e.MC,Lo=e.SZ;export{gr as ArrayNoKeyError,hr as BasicTypes,br as ImmutableTypes,mr as PropWatches,vr as RouteQuery,yr as StateMismatchError,wr as Subject,Cr as Subjective,kr as SyncCallbackError,Sr as TagError,Tr as ValueSubject,jr as ValueSubjective,Er as ValueTypes,xr as addOneContext,Ar as buildBeforeElement,Or as callback,Pr as callbackMaker,Vr as checkArrayValueChange,Jr as checkSimpleValueChange,Ir as checkTagValueChange,Nr as combineLatest,Wr as createHtmlSupport,Rr as createTrigger,Lr as defineValueOn,Mr as deleteSimpleValue,Dr as destorySupportByContextItem,Br as destroyArray,$r as destroySupport,_r as empty,Hr as getBaseSupport,Ur as getDomMeta,Fr as getDomTag,zr as getNewGlobal,Zr as getStringTag,Gr as getTemplaterResult,Xr as hasPropChanges,qr as hmr,Qr as howToSetFirstInputValue,Yr as howToSetInputValue,Kr as html,to as isArray,eo as isFunction,no as isObject,ro as isPromise,oo as isSimpleType,so as isStaticTag,co as isSubjectInstance,ao as isTagComponent,uo as letProp,io as onDestroy,lo as onInit,po as oneRenderToSupport,fo as paint,go as processFirstSubjectValue,ho as processSubUpdate,bo as providers,mo as renderSupport,vo as renderTagOnly,yo as renderWithSupport,wo as runWrapper,Co as setUseMemory,ko as signal,So as state,To as states,jo as subject,Eo as subscribe,xo as syncError,Ao as tag,Oo as tagElement,Po as tags,Vo as upgradeBaseToSupport,Jo as variablePrefix,Io as variableSuffix,No as watch,Wo as willCallback,Ro as willPromise,Lo as willSubscribe};
1
+ var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};function n(t){return t.renderCount=t.renderCount||0,t.global={}}t.d(e,{W9:()=>fe,cg:()=>c,m0:()=>s,rS:()=>ke,Y2:()=>r,ei:()=>de,B7:()=>R,TU:()=>L,XF:()=>ge,PC:()=>pe,Ot:()=>un,Mj:()=>ln,tD:()=>a,j8:()=>Qt,um:()=>qt,E2:()=>Sn,OH:()=>jn,TB:()=>Jt,Ii:()=>Nt,yV:()=>oe,zV:()=>I,pf:()=>Xe,ze:()=>Tn,WJ:()=>M,Ng:()=>Wt,VI:()=>se,aZ:()=>It,O:()=>Ot,Ie:()=>o,B4:()=>Ze,Az:()=>or,Xi:()=>Wn,Ah:()=>n,ck:()=>Nn,Gk:()=>ue,zC:()=>Be,cF:()=>fr,jU:()=>Q,PB:()=>q,qy:()=>sr,cy:()=>S,Tn:()=>C,Gv:()=>k,yL:()=>w,D8:()=>b,Ze:()=>m,_4:()=>y,mn:()=>v,z:()=>Cn,sA:()=>An,MG:()=>xn,PL:()=>le,nI:()=>h,PZ:()=>_t,N_:()=>pr,r5:()=>kn,uc:()=>Le,pG:()=>ve,QB:()=>Ve,R6:()=>ir,Ll:()=>B,vP:()=>cn,wk:()=>gn,xP:()=>wn,bc:()=>yn,B1:()=>On,ag:()=>En,Tc:()=>Se,Hf:()=>ar,_A:()=>ie,Ag:()=>Ge,NU:()=>Jn,hW:()=>In,wB:()=>hn,id:()=>pn,MC:()=>fn,SZ:()=>dn});class r{get(t){return"todo"}}const o="";var s,c;!function(t){t.string="string",t.number="number",t.boolean="boolean",t[void 0]="undefined"}(s||(s={})),function(t){t.function="function",t.date="date",t.unknown="unknown",t.object="object"}(c||(c={}));const a={tag:"html",dom:"dom",templater:"templater",tagComponent:"tagComponent",tagArray:"tagArray",subscribe:"subscribe",signal:"signal",renderOnce:"renderOnce",stateRender:"stateRender",version:Date.now()};let u=[],i=[],l=[],p=[],f=[],d=[];const g={locks:0};function h(){if(!(g.locks>0)){for(let t=u.length-1;t>=0;--t){const e=u[t];e.parentNode.removeChild(e)}for(const t of i)t();for(const[t,e]of l)e.textContent=t;for(const t of p)t.relative.appendChild(t.element);for(const{element:t,relative:e}of f)e.parentNode.insertBefore(t,e);u=[],i=[],p=[],f=[],l=[];for(const t of d)t();d=[]}}function b(t){switch(t){case s.string:case s.number:case s.boolean:return!0}return!1}function m(t){if(!t)return!1;switch(t.tagJsType){case a.dom:case a.tag:case a.templater:return!0}return!1}function v(t){const e=t?.tagJsType;return e===a.tagComponent||e===a.stateRender}function y(t){return k(t)&&typeof t.subscribe===c.function}function w(t){return t&&C(t.then)}function C(t){return typeof t===c.function}function k(t){return typeof t===c.object&&null!==t}function S(t){return Array.isArray(t)}function T(t){let e=t;for(;e.ownerSupport&&!v(e.templater);)e=e.ownerSupport;return e.subject.global.newest||e}function j(t){const e=B.stateConfig;return e.states[e.statesIndex]=t,++e.statesIndex,t(((...t)=>t))}function E(t){const e=B.stateConfig,n=e.statesIndex,r=T(e.prevSupport).states[n];let o=[];r((function(...t){return o=t,t}));return e.states[e.statesIndex]=t,++e.statesIndex,t(((...t)=>o))}function x(t,e){e.handlers.handler=J,e.handlers.statesHandler=j,e.rearray=[],e.stateArray=[],e.states=[],e.statesIndex=0,e.support=t}function A(t,e,n,r){n.rearray=r,n.stateArray=[],n.states=[],n.statesIndex=0,n.handlers.handler=V,n.handlers.statesHandler=E,n.prevSupport=e}class O{}function P(t){const e=t.callback;if(!e)return t.defaultValue;const[n]=function(t){const[e]=t(O),[n]=t(e);return[e,n]}(e);return n}function V(){const t=B.stateConfig,e=t.rearray[t.stateArray.length];return t.stateArray.push(e),e.defaultValue}function J(t){const e=B.stateConfig;let n=t;if(typeof t===c.function&&(n=t()),typeof n===c.function){const t=n;n=function(...e){return t(...e)},n.original=t}const r={get:function(){return P(r)},defaultValue:n};return e.stateArray.push(r),n}function I(t){const e=new R;return e.subscribeWith=e=>{const n=[],r=[],o=(o,s)=>{n[s]=!0,r[s]=o;if(n.length===t.length){for(const t of n)if(!t)return;e(r,c)}},s=[...t],c=s.shift().subscribe((t=>o(t,0))),a=s.map(((t,e)=>t.subscribe((t=>o(t,e+1)))));return c.subscriptions=a,c},e}function N(t,e,n){const r=R.globalSubCount$;R.globalSubCount$.next(r.value+1);const o=function(){o.unsubscribe()};return o.callback=e,o.subscriptions=[],o.unsubscribe=function(){return function(t,e,n){!function(t,e){const n=t.findIndex((t=>t.callback===e));-1!==n&&t.splice(n,1)}(e,n);const r=R.globalSubCount$;R.globalSubCount$.next(r.value-1),t.unsubscribe=()=>t;const o=t.subscriptions;for(const t of o)t.unsubscribe();return t}(o,n,e)},o.add=t=>(o.subscriptions.push(t),o),o.next=t=>{e(t,o)},o}function W(t,e,n){const r=[...e],o=r.shift(),s=t=>{if(r.length)return W(t,r,n);n(t)};let c=s;const a=o(t,{setHandler:t=>c=t,next:s});c(a)}class R{value;onSubscription;methods=[];isSubject=!0;subscribers=[];subscribeWith;constructor(t,e){this.value=t,this.onSubscription=e}subscribe(t){const e=N(0,t,this.subscribers),n=this.subscribeWith;if(n){if(this.methods.length){const n=t;t=t=>{W(t,this.methods,(t=>n(t,e)))}}return n(t)}return this.subscribers.push(e),this.onSubscription&&this.onSubscription(e),e}next(t){this.value=t,this.emit()}set=this.next.bind(this);emit(){const t=this.value,e=this.subscribers;for(const n of e)n.callback(t,n)}toPromise(){return new Promise((t=>{this.subscribe(((e,n)=>{n.unsubscribe(),t(e)}))}))}toCallback(t){const e=this.subscribe(((n,r)=>{const o=r?.unsubscribe;o?o():setTimeout((()=>e.unsubscribe()),0),t(n)}));return this}pipe(...t){const e=new R(this.value);return e.setMethods(t),e.subscribeWith=t=>this.subscribe(t),e.next=t=>this.next(t),e}setMethods(t){this.methods=t}static all(t){return I(t.map((t=>{if(y(t))return t;return new R(t,(e=>(e.next(t),e)))})))}static globalSubCount$=new R(0)}class L extends R{value;onSubscription;_value;constructor(t,e){super(t,e),this.value=t,this.onSubscription=e,this._value=t,M(this)}next(t){this._value=t,this.emit()}emit(){const t=this._value,e=this.subscribers;for(const n of e)n.callback(t,n)}}function M(t){Object.defineProperty(t,"value",{set(e){t._value=e,t.emit()},get:()=>t._value})}const D=new R(void 0,(function(t){Pn()||t.next()})),B={stateConfig:{stateArray:[],version:Date.now(),handlers:{handler:J,statesHandler:j}},tagClosed$:D};function $(t,e){for(let n=0;n<t.length;++n){_(t[n],e[n])}}function _(t,e){let n;t(((...t)=>(n=t,t)),1),e((()=>n),2)}function H(t,e,n,r){for(let n=t.length-1;n>=0;--n){const r=t[n].get(),o=e[n].callback;o&&o(r)}for(let t=r.length-1;t>=0;--t){const e=[],o=(...t)=>(e.push(t),t);(0,r[t])(o);let s=0;const c=(...t)=>e[s++];n[t](c)}}function U(t,e){return F(t,e)}function F(t,e){if(null===t||typeof t!==c.object)return t;if(e<0)return t;if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);const n=S(t)?[]:Object.create(Object.getPrototypeOf(t));if(S(t))for(let r=0;r<t.length;r++)n[r]=F(t[r],e-1);else for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=F(t[r],e-1));return n}function z(t,e,n){return Z(t,e,n)}function Z(t,e,n){return!(t!==e&&(r=t,o=e,!C(r)||!C(o)||r.toString()!==o.toString()))||(n<0||typeof t===c.object&&typeof e===c.object&&(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():S(t)&&S(e)?function(t,e,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Z(t[r],e[r],n-1))return!1;return!0}(t,e,n-1):!S(t)&&!S(e)&&function(t,e,n){const r=Object.keys(t),o=Object.keys(e);if(0===r.length&&0===o.length)return!0;if(r.length!==o.length)return!1;for(const s of r){if(!o.includes(s)||!Z(t[s],e[s],n-1))return!1}return!0}(t,e,n-1)));var r,o}function G(t){return t.map(X)}function X(t,e){const n=t,r=t?.tagJsType;if(r)switch(r){case a.signal:case a.subscribe:case a.stateRender:return;case a.dom:case a.tag:case a.templater:return G(n.values)}return S(t)?G(n):U(t,e)}function q(t,e,n){i.push((()=>{Q(t,e,n)}))}function Q(t,e,n){void 0!==n&&!1!==n&&null!==n?t.setAttribute(e,n):t.removeAttribute(e)}function Y(t,e,n,r,o,s){switch(r){case"init":{const t=s.added;return void d.push((()=>{e({target:n,stagger:t})}))}case"destroy":{const t=++s.removed,r=o.subject.global;return r.destroys=r.destroys||[],void r.destroys.push((()=>e({target:n,stagger:t})))}case"autofocus":return void d.push((()=>n.focus()));case"autoselect":return void d.push((()=>n.select()));case"style":{const r=t.split(".");return void i.push((()=>n.style[r[1]]=e))}case"class":return void function(t,e,n){const r=t.split(".");if(r.shift(),e){for(const t of r)i.push((()=>n.classList.add(t)));return}for(const t of r)i.push((()=>n.classList.remove(t)))}(t,e,n)}throw new Error(`Invalid special attribute of ${r}. ${t}`)}function K(t,e){const n=function(t,e,n=[]){const r=t.subject;n.push({support:t,renderCount:r.renderCount,provider:e});const o=e.children;for(let t=o.length-1;t>=0;--t){const r=o[t],s=r.subject;n.push({support:r,renderCount:s.renderCount,provider:e})}return n}(t,e);return n}function tt(t,e=[]){const n=t.subject.global,r=Re(t.templater),o=t.ownerSupport;if(n.locked)return e.push(t),e;if(r)return tt(o,e);const s=t,c=v(s.templater),u=t.templater.tagJsType,i=o&&u!==a.stateRender&&(!c||function(t,e,n){const r=function(t,e){const n=t.props,r=e.propsConfig,o=r.latest;if(De(n,o))return!0;switch(t.propWatch){case ke.IMMUTABLE:return _e(n,o);case ke.SHALLOW:return He(n,o)}return!z(n,o,Fe)}(e,n);if(t&&r)return!0;return!1}(o,s.templater,s)),l=function(t){const e=t.subject.global.providers;if(!e)return[];const n=[];for(const t of e){const e=K(t.owner,t);n.push(...e.map((t=>t.support)))}return n}(s);return e.push(...l),i?(tt(o,e),c&&e.push(s),e):(e.push(s),e)}function et(t){++g.locks,t.forEach(nt),--g.locks,h()}function nt(t){const e=t.subject.global;e&&Le(e.newest)}const rt="no-data-ever",ot="promise-no-data-ever";function st(t,e){const n=e.subject.global,r=function(t,e){if(!0!==n.deleted)return function(t,e,n,r,o){const s=T(e),c=s.subject,a=c.global;a.locked=!0;const u=t.apply(r,o);delete a.locked;const i=function(t,e){const n=e.subject.global;return function(t,e,n){return et(tt(t)),function(t,e,n){if(w(t)){return e.subject.global.locked=!0,t.then((()=>{if(!0===n.deleted)return ot;delete e.subject.global.locked;return et(tt(e)),ot}))}return rt}(e,t,n)}(e,t,n)}(u,s);return i}(r.tagFunction,r.support,r.states,t,e)};r.tagFunction=t;const o=T(e);r.support=e;const s=o.states;return r.states=s,r}const ct=["init","destroy"];function at(t,e,n,r,o,s,c){if(c)return Y(t,e,n,c,s,o);r(n,t,e)}function ut(t,e,n,r){const o=t.appElement;"blur"===e&&(e="focusout");const s="_"+e,c=t.subject.global.events;if(!c[e]){const t=function(t){t.originalStopPropagation=t.stopPropagation,it(t,s,t.target)};c[e]=t,o.addEventListener(e,t)}n[s]=r,n[e]=r}function it(t,e,n){const r=n[e];if(r){let e=!1;if(t.stopPropagation=function(){e=!0,t.originalStopPropagation.call(t)},r(t),t.defaultPrevented||e)return}const o=n.parentNode;o&&it(t,e,o)}function lt(t,e,n,r){const o=function(...e){return o.tagFunction(t,e)};o.tagFunction=e,o.support=n,ut(n.appSupport,r,t,o)}function pt(t){if(t.startsWith("class."))return"class";const e=function(t){switch(t){case"autoselect":return"autoselect";case"autofocus":return"autofocus";case"oninit":case"init":return"oninit";case"ondestroy":case"destroy":return"destroy"}return!1}(t);return!1!==e||!!t.startsWith("style.")&&"style"}const ft={added:0,removed:0};function dt(t,e,n,r){if(n.isNameOnly)return function(t,e,n,r,o,s,a,u){if(n){if(wt(e))return void r.removeAttribute(n);if(typeof n===c.object)if(typeof e===c.object)for(const t in n)t in e||i.push((function(){r.removeAttribute(t)}));else for(const t in n)i.push((function(){r.removeAttribute(t)}))}ht(t,e,r,o,s,a,u)}(r,t,n.value,n.element,e,n.howToSet,[],ft),void(n.value=t);const o=n.element;bt(t,n.attrName,n,o,e,n.howToSet,n.isSpecial,ft),n.value=t}function gt(t,e,n,r,o,s,a,u,l){const p=yt(e);if(p>=0){const e=t[p],c=Qt(e,s,!0);return c.isAttr=!0,c.element=n,c.howToSet=o,c.isNameOnly=!0,c.handler=dt,void ht(t,e,n,r,o,s,u)}const f=yt(l);if(f>=0){const l=t[f],p={isAttr:!0,element:n,attrName:e,checkValueChange:Nt,delete:Wt,withinOwnerElement:!0};s.push(p);return y(p.value)?function(t,e,n,r,o,s,c){s&&i.push((function(){n.removeAttribute(t)}));const a=e.value;if(y(a)){e.handler=Ft;const u=function(a){bt(a,t,e,n,r,o,s,c)},i=a.subscribe(u),l=e.global;(l.subscriptions=l.subscriptions||[]).push(i)}return void bt(e.value,t,e,n,r,o,s,c)}(e,p,n,r,o,a,u):(p.handler=dt,function(t,e,n,r,o,s,a,u){n.attrName=t,n.element=r,n.howToSet=o,typeof e===c.function?u&&ct.includes(t)?Y(t,e,r,t,s,a):vt(n,e,s,t,r):(n.attrName=t,n.element=r,n.howToSet=o,n.isSpecial=u,at(t,e,r,o,a,s,u))}(e,l,p,n,o,r,u,a),void(p.value=l))}return at(e,l,n,o,u,r,a)}function ht(t,e,n,r,s,a,u){if(!wt(e))if(typeof e!==c.object)0!==e.length&&s(n,e,o);else for(const o in e){const c=e[o];gt(t,o,n,r,s,a,pt(o),u,c)}}function bt(t,e,n,r,o,s,c,u){return C(t)?function(t,e,n,r,o,s,c,u){const i=t.templater.wrapper;if((i?.tagJsType||i?.original?.tagJsType)!==a.renderOnce)return vt(c,e,t,r,n);return mt(e,n,r,o,s,t,u)}(o,t,r,e,c,s,n,u):mt(t,r,e,c,s,o,u)}function mt(t,e,n,r,o,s,c){if(!1===r){switch(t){case void 0:case!1:case null:return void i.push((function(){e.removeAttribute(n)}))}if(C(t))return lt(e,t,s,n);o(e,n,t)}else Y(n,t,e,r,s,c)}function vt(t,e,n,r,o){return lt(o,e=st(e,n),n,r)}function yt(t){return k(t)&&"tagJsVar"in t?t.tagJsVar:-1}function wt(t){return null==t||!1===t}function Ct(t,e){const n=document.createTextNode(t);return f.push({element:n,relative:e}),n}function kt(t){switch(t){case void 0:case!1:case null:return o}return t}function St(t,e){const n=e.providers;if(n)for(const t of n)for(let n=t.children.length-1;n>=0;--n){t.children[n].subject.global===e&&t.children.splice(n,1)}e.destroy$&&e.destroy$.next(),t.subject.renderCount=0}function Tt(t){for(const e of t){const t=e.lastArray;if(t){Tt(t);continue}const n=e.global;if(!n)continue;const r=n.newest,o=n.subscriptions;o&&o.forEach((t=>t.unsubscribe())),v(r.templater)&&St(r,n);Tt(n.context)}}function jt(t,e=[],n=[]){for(const r of t){const t=r.global;if(!t)continue;const o=t.newest;if(o){e.push(o);const r=t.subscriptions;r&&n.push(...r)}const s=t.context;s&&jt(s,e,n)}return{tags:e,subs:n}}function Et(t,e){const n=t.context,r=t.destroys;if(r)return function(t,e,n){const r=[];if(t.forEach((t=>{const e=t();e instanceof Promise&&r.push(e)})),r.length){const t=Promise.all(r).then((()=>{++g.locks,xt(e.context,n),At(e),--g.locks,h()}));return void n.push(t)}++g.locks,xt(e.context,n),At(e),--g.locks,h()}(r,t,e);xt(n,e),At(t)}function xt(t,e){for(const n of t){if(n.withinOwnerElement)continue;const t=n.lastArray;if(t){It(n,t);continue}const r=n.simpleValueElm;if(r){delete n.simpleValueElm,u.push(r);continue}const o=n.global;if(void 0===o)continue;if(!0===o.deleted)continue;o.deleted=!0;o.oldest&&Et(o,e)}}function At(t){t.htmlDomMeta.forEach((t=>{const e=t.marker;e&&u.push(e);const n=t.domElement;n&&u.push(n)}))}function Ot(t,e){const n=t.subject;e.deleted=!0,n.renderCount=0;const r=[];return Tt(e.context),e.destroy$&&St(t,e),Et(e,r),r}function Pt(t,e,n,r,o){const s=t.length-1,c=e-r,a=c<0||s<c,u=n[e];if(a)return Vt(u,o),1;const i=function(t,e,n,r,o,s){const c=e&&t!==e.arrayValue;if(c)return Vt(n,r),o.splice(s,1),2;return 0}(u.value.arrayValue,t[e],u,o,n,e);return i}function Vt(t,e){!function(t,e){if(t){Ot(t.oldest,t)}else{const t=e.simpleValueElm;delete e.simpleValueElm,u.push(t)}}(t.global,t),++e.removed}function Jt(t,e){if(!S(t)){return It(e,e.lastArray),9}return!1}function It(t,e){const n={added:0,removed:0};for(let t=0;t<e.length;++t)Vt(e[t],n);delete t.lastArray}function Nt(t,e){return null==t||typeof t!==c.object?(function(t,e){const n=kt(t),r=e.simpleValueElm;l.push([n,r])}(t,e),-1):(Wt(e),6)}function Wt(t){const e=t.simpleValueElm;delete t.simpleValueElm,u.push(e)}function Rt(t,e,n,r,o){const s=Ze(t,r,o);return s.ownerSupport=e,Ge(t,s,n,o)}function Lt(t,e,n){t!==n.value&&nn(n,t,e)}function Mt(t,e,r){if(!e.global.newest)return void Ee(t,e,r,{added:0,removed:0});!function(t,e,r){const o=r.global,s=o.newest,c=s.templater.wrapper,u=e.templater.wrapper;let i=!1;const l=e.templater.tagJsType,p=a.stateRender===l||a.renderOnce===l;if(p)i=e.templater.tagJsType===a.renderOnce||re(s,e);else if(c&&u){i=c.original===u.original}const f=e.templater;if(!i)return void function(t,e,r){const o=t.global,s=o.oldest;Ot(s,o),n(t);const c=Ee(e,t,r,{added:0,removed:0})}(r,f,t);const d=p||function(t,e){const n=e.props,r=t.propsConfig,o=r.latest,s=Be(n,o,t.templater.propWatch);return s}(s,f);if(!d){return void function(t,e,n,r,o){const s=t.props,c=Ae(e,n,r,s,o),a=e.propsConfig;a.castProps=c;const u=n.propsConfig;u.latest=a.latest}(f,e,s,t,f.propWatch===ke.DEEP?Fe:Ue)}if(o.locked)return void o.blocked.push(e);Le(e),++r.renderCount}(r,Rt(t,r,r.appSupport,e),e)}function Dt(t,e,n,r,o,s){const c=document.createTextNode(""),a={value:t,checkValueChange:r,delete:Wt,withinOwnerElement:!1,placeholder:c};return n.added=n.added+1,s||f.push({element:c,relative:o}),Ht(t,a,e,n,s,o),s&&p.push({element:c,relative:s}),a}function Bt(t,e,n,r,o){const s=void 0===t.lastArray;s&&(t.lastArray=[]);const c=t.lastArray;let a=t.placeholder,u=0;const i=[];if(!s){for(let t=0;t<c.length;++t){const n=c[t],o=Pt(e,t,c,u,r);0!==o?2!==o?u+=o:t-=1:i.push(n)}t.lastArray=i}const l=e.length;for(let s=0;s<l;++s){a=$t(e,s,t.lastArray,n,a,r,o).placeholder}}function $t(t,e,n,r,o,s,c){const a=t[e],u=n[e];if(u)return function(t,e,n,r,o,s,c,a){const u=n.length>o;if(u)return Lt(t,r,e),e;const i=Dt(t,r,c,Nt,s,a);return n.push(i),i}(a,u,n,r,e,o,s,c);const i=Dt(a,r,s,Nt,o,c);return n.push(i),i}function _t(t,e,n,r,o,s){const c=t?.tagJsType;return c?t.processInit(t,e,n,r,o,s):S(t)?(Bt(e,t,n,r,o),void(e.checkValueChange=Jt)):void function(t,e,n){const r=kt(t),o=Ct(r,n);e.simpleValueElm=o,e.checkValueChange=Nt}(t,e,e.placeholder)}function Ht(t,e,n,r,o,s){e.handler=Lt;n.subject.global.locked=!0,_t(t,e,n,r,o,s);delete n.subject.global.locked,e.value=t}function Ut(t,e,n,r,s,c,a){const u=document.createTextNode(o),i=Qt(t,e,s>0);i.placeholder=u,c?p.push({relative:c,element:u}):f.push({relative:a,element:u}),Ht(t,i,n,r,c,a)}const Ft=()=>{},zt="object"==typeof document&&document.createElement("div");function Zt(t,e,n,r,s,c,a,u){const i=[];a&&void 0===u&&(u=document.createTextNode(o),p.push({element:u,relative:a}),a=void 0);for(let o=0;o<t.length;++o){const l=t[o],p=l.v;if(!isNaN(p)){Ut(e[s.length],s,n,r,c,a,u);continue}const f={};if(i.push(f),"text"===l.nn){Xt(f,l,a,u);continue}const d=Gt(f,l,e,n,s,r,a,u);l.ch&&(f.ch=Zt(l.ch,e,n,r,s,c+1,d,u).dom)}return{dom:i,context:s}}function Gt(t,e,n,r,o,s,c,a){const u=t.domElement=document.createElement(e.nn);return e.at&&e.at.forEach((t=>{const e=t[0],c=t[1],a=t[2]||!1;gt(n,e,u,r,Q,o,a,s,c)})),c?p.push({element:u,relative:c}):f.push({element:u,relative:a}),u}function Xt(t,e,n,r){const o=t,s=o.tc=e.tc;zt.innerHTML=s;const c=o.domElement=document.createTextNode(zt.innerText);n?p.push({element:c,relative:n}):f.push({element:c,relative:r})}function qt(t,e,n,r){const o=t.subject;o.delete=se;const s=o.global;s.oldest=t,s.newest=t,++g.locks;const c=function(t,e,n,r){const o=function(t){const e=t.templater,n=e.tag;if(n.tagJsType===a.dom)return n.dom;const r=n.strings;return or(r,n.values)}(t),s=t.templater.tag,c=s.values,u=[],i=t.subject.global;i.context=u;const l=Zt(o,c,t,e,u,0,n,r);return l}(t,e,n,r);return s.htmlDomMeta=c.dom,--g.locks,c}function Qt(t,e,n){const r={value:t,checkValueChange:Nt,delete:Wt,withinOwnerElement:n};return e.push(r),r}function Yt(t,e,n){return t.map((t=>function(t,e,n,r){if(m(t)||!t)return t;if(!e)return t;return Kt(t,e,n,r)}(t,e.ownerSupport,e,n)))}function Kt(t,e,n,r,o){if(!t)return t;if(t.tagJsType)return t;if(typeof t===c.function)return function(t,e,n){const r=t.mem;if(r)return t;const o=function(...t){return o.toCall(...t)};return o.original=t,o.mem=t,o.toCall=function(...t){return function(t,e,n,r){const o=r.subject.global,s=o?.newest||r,c=void 0===Pn(),a=t.apply(e,n),u=function(){const t=s.subject.global;return t&&!0!==t.locked?(function(t,e){const n=t.subject,r=Re(t.templater);if(r){return Me(e,t)}const o=n.global;o.locked=!0,We(o.newest,t,e,n),delete o.locked}(s,r),a):a};if(c)return u();return B.tagClosed$.toCallback(u),a}(o.mem,e,t,n)},Object.assign(o,t),o}(t,o,e);if(r===Fe)return t;return ee(t)?t:S(t)?function(t,e,n,r){for(let o=t.length-1;o>=0;--o){const s=t[o];if(t[o]=Kt(s,n,e,r+1,t),typeof s===c.function){if(s.mem)continue;te(r+1,o,s,t,e)}}return t}(t,n,e,r):function(t,e,n,r){const o=Object.keys(t);for(const s of o){const o=t[s],a=Kt(o,n,e,r+1,t);if(t[s]===a)continue;const u=Object.getOwnPropertyDescriptor(t,s);if(!(u?.get||u?.set)&&(t[s]=a,typeof a===c.function)){if(o.mem)continue;te(r+1,s,o,t,e)}}return t}(t,n,e,r)}function te(t,e,n,r,o){if(t>0){const t=o.subject.global;r[e].subscription=t.destroy$.toCallback((function(){r[e]=n}))}}function ee(t){return typeof t!==c.object||!t||t.tagJsType}function ne(t,e,n,r){const o=e.original,s=t.tagJsType===a.stateRender,u=B.stateConfig;let i;return u.support=n,s?i=t():(i=o(...r),typeof i===c.function&&(i=i())),i.templater=t,t.tag=i,n.state=u.stateArray,n.states=u.states,n}function re(t,e){const n=t.templater,r=e.templater,o=n?.tag||t,s=r.tag;if(n?.tagJsType===a.stateRender)return n.dom===r.dom;switch(o.tagJsType){case a.dom:return s?.tagJsType===a.dom&&function(t,e){const n=t.dom,r=e.dom;return n===r}(o,s);case a.tag:{const n=function(t,e,n,r){const o=t.strings,s=e.strings;if(o.length!==s.length)return!1;if(!o.every(((t,e)=>s[e].length===t.length)))return!1;const a=n.templater.values||t.values,u=r.templater.values||e.values;return function(t,e){const n=t.length===e.length;if(!n)return!1;const r=e.every(((e,n)=>{const r=t[n];if(typeof e===c.function&&typeof r===c.function){return!!(e.toString()===r.toString())}return!0}));if(r)return!0;return!1}(a,u)}(o,s,t,e);return n}}throw new Error(`unknown tagJsType of ${o.tagJsType}`)}function oe(t,e){const r=e.global,o=r?.newest;if(m(t)){return!re(t,o)&&(Ot(o,r),n(e),7)}const s=t?.tagJsType;if(s){return!0===tn(e,t,r.newest.ownerSupport)&&-1}return 0===o.subject.renderCount?(delete e.global,e.renderCount=0,d.push((()=>{Ot(o,r),d.shift(),h()})),8):(se(e),8)}function se(t){const e=t.global,n=e?.newest;Ot(n,e),delete t.global,t.renderCount=0}function ce(t,e,n,r,o,s){e.checkValueChange=oe;const c=Ye(t,n,e);c.ownerSupport=n;const a=qt(c,r,o,o?void 0:s);for(const t of a.dom)t.marker&&(o?p.push({element:t.marker,relative:o}):f.push({element:t.marker,relative:s})),t.domElement&&(o?p.push({element:t.domElement,relative:o}):f.push({element:t.domElement,relative:s}));return c}function ae(t,e,n,r,o,s){return e.checkValueChange=oe,o?ce(t,e,n,r,o,s):qe(n,e,r)}function ue(t,e){const n={tagJsType:a.templater,processInit:ae,propWatch:t,props:e,key:function(t){return n.arrayValue=t,n}};return n}const ie=[];function le(t,e,n){const r=ue(ke.DEEP);r.tagJsType=t.tagJsType;const o=Ye(r,n,e);function s(){return r.tag=t(),o}return r.wrapper=s,s.tagJsType=t.tagJsType,s.original=t.original||t,o}class pe extends Error{details;constructor(t,e,n={}){super(t),this.name=pe.name,this.details={...n,errorCode:e}}}class fe extends pe{constructor(t,e){super(t,"array-no-key-error",e),this.name=fe.name}}class de extends pe{constructor(t,e){super(t,"state-mismatch-error",e),this.name=de.name}}class ge extends pe{constructor(t,e){super(t,"sync-callback-error",e),this.name=ge.name}}function he(t,e){const n=t.rearray;n.length&&n.length!==t.stateArray.length&&function(t,e,n){const r=`Saved states between renders are inconsistent. Expected ${t.length} states got ${n.stateArray.length}.`,o=e.templater?.wrapper;let s=o;(o?.original||o?.original)&&(s=o.original);const c={oldStates:n.stateArray,newStates:n.rearray,tagFunction:s,templater:e.templater},a=new de(r,c);throw console.error(be,c),a}(n,e,t)}const be="State tracking requires same number of state calls on every render. This error typically occurs when a state call is only reachable behind a condition. Also, wrapping tags that have state, with tag(), often helps when tag is only reachable by a condition.";function me(t,e){const n=t.subject;++n.renderCount;const r=B.stateConfig;t.state=r.stateArray,t.states=r.states,n.global.newest=t,he(r,t),delete r.prevSupport,delete r.support,delete r.stateArray,delete r.states,B.tagClosed$.next(e)}function ve(t,e,n,r){const o=e?.state,s=B.stateConfig;o?A(0,e,B.stateConfig,o):x(t,s);const c=t.templater;let u;if(c.tagJsType===a.stateRender){const e=c;u=Rt(c,r,t.appSupport,n),ne(c,e,u)}else{u=(0,c.wrapper)(t,n,e)}return me(u,r),u}function ye(t,e,r,o,s,c){n(e);const a=le(t,e,r);ve(a,void 0,e,r);const u=ce(a.templater,e,r,o,s,c);return e.checkValueChange=oe,u}function we(t,e,r,o,s){if(n(e),e.checkValueChange=oe,s){const n=function(t,e,n,r,o){const s=Rt(t,n,n.appSupport,e),c=s.propsConfig;if(c){const e=t.tagJsType!==a.tagComponent?[]:je(t,s);c.castProps=e}const u=e.global,{support:i}=Ve(s,u.newest,e,n);return function(t,e,n){let r=p.length;const o=qt(t,e,n,void 0);for(const t of o.dom)t.domElement&&p.splice(r++,0,{element:t.domElement,relative:n}),t.marker&&p.splice(r++,0,{element:t.marker,relative:n})}(i,r,o),i}(t,e,r,o,s);return n}return Ee(t,e,r,o)}let Ce=0;var ke;function Se(t,e=ke.SHALLOW){const n=function(...r){const o=ue(e,r);o.tagJsType=a.tagComponent,o.processInit=we;const s=function(t,e){const n=function(n,r,o){const s=je(t,n,o),c=n.ownerSupport,a=Rt(t,c,n.appSupport,r,s);return ne(t,e,a,s)};return n}(o,n);return s.original=t,o.wrapper=s,o},r=t;return n.original=t,r.tags=ie,r.setUse=B,r.ValueTypes=a,r.tagIndex=Ce++,ie.push(n),n}function Te(){throw new Error("Do not call tag.use as a function but instead set it as: `(props) => tag.use = (use) => html`` `")}function je(t,e,n){const r=t.propWatch===ke.DEEP?Fe:Ue,o=t.props,s=e.propsConfig;let c=s.castProps;const a=n?.propsConfig,u=a?.castProps;u&&(s.castProps=u,c=Ae(e,n,n.ownerSupport,o,r));return c||Yt(o,e,0)}function Ee(t,e,n,r){const o=Rt(t,n,n.appSupport,e),s=o.propsConfig;if(s){const e=t.tagJsType!==a.tagComponent?[]:je(t,o);s.castProps=e}const c=e.global,{support:u}=Ve(o,c.newest,e,n);return function(t,e,n){n.checkValueChange=oe,qt(t,e,void 0,n.placeholder)}(u,r,e),u}function xe(t,e,n,r,o,s){return null==t||s>o?e:typeof t===c.function?e.mem?(t.mem=e.mem,e):(t.mem=e,t):ee(e)?e:S(e)?function(t,e,n,r,o,s){for(let c=t.length-1;c>=0;--c){const a=t[c],u=e[c];t[c]=xe(u,a,n,r,s,o+1)}return t}(e,t,n,r,s,o):function(t,e,n,r,o,s){const c=Object.keys(t);for(const a of c){const c=t[a],u=xe(e[a],c,n,r,s,o+1);if(c===u)continue;const i=Object.getOwnPropertyDescriptor(t,a)?.set;i||(t[a]=u)}return t}(e,t,n,r,s,o)}function Ae(t,e,n,r,o,s=-1){if(0===o)throw new Error("before here");const c=e.subject.global.newest;if(!c){const e=Yt(r,t,s);r.push(...e);return t.propsConfig.castProps=e,r}const a=(e=c||e).propsConfig.castProps,u=[];for(let e=0;e<r.length;++e){const c=r[e],i=xe(a[e],c,t,n,o,s+1);u.push(i)}return t.propsConfig.castProps=u,u}function Oe(t){const e=t.subject,r=e.global,{subs:o,tags:s}=jt(r.context);Pe(r);for(const t of s){const e=t.subject.global;if(!0===e.deleted)return;Pe(e)}r.subscriptions&&o.forEach((t=>t.unsubscribe())),n(e)}function Pe(t){t.deleted=!0,Et(t,[])}function Ve(t,e,n,r){const o=e?.templater,s=o?.tag,c=ve(t,e,n,r),u=!e||re(e,c);if(u){if(e){const t=e.templater.tag;t&&n.renderCount>0&&function(t,e,n){if(t.tagJsType===a.dom){const r=n?.dom;return void(r!==t.dom&&Oe(e))}if(n){const r=n.strings;if(r){const n=r?.length;n!==t.strings.length&&Oe(e)}}}(t,e,s)}}else{!function(t,e){const n=t.subject.global;let r=-1;const o=n.providers=n.providers||[],s=o.length-1;for(;r++<s;){const t=o[r];let s=-1;const c=t.children.length-1;for(;s++<c;)if(n===t.children[s].subject.global)return t.children.splice(s,1),void t.children.push(e)}}(e,c),Oe(e);const t=c.subject.global;t.oldest=c,t.newest=c}const i=e?.ownerSupport;return c.ownerSupport=r||i,{support:c,wasLikeTags:u}}function Je(t,e,n,r){const o=t[e],s=n[e];if(o===s.value)return;(0,s.handler)(o,r,s,t),s.value=o}function Ie(t,e){const n=t.subject.global.context;!function(t,e){const n=e.templater,r=e.templater.tag,o=n.values||r.values,s=t.templater.tag;s.values=o}(t,e),++g.locks,function(t,e){const n=t.templater.tag.values;let r=0;const o=n.length;for(;r<o;)Je(n,r,e,t),++r}(t,n),--g.locks,h()}!function(t){t.DEEP="deep",t.SHALLOW="shallow",t.NONE="none",t.IMMUTABLE="immutable"}(ke||(ke={})),Se.renderOnce=function(){throw new Error("Do not call tag.renderOnce as a function but instead set it as: `(props) => tag.renderOnce = () => html`` `")},Se.state=Te,Se.use=Te,Se.route=function(t){throw new Error("Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `")},Se.app=function(t){throw new Error("Do not call tag.route as a function but instead set it as: `tag.route = (routeProps: RouteProps) => (state) => html`` `")},Se.deepPropWatch=Se,Se.immutableProps=function(t){return Se(t,ke.IMMUTABLE)},Se.watchProps=function(t){return Se(t,ke.SHALLOW)},Object.defineProperty(Se,"renderOnce",{set(t){t.tagJsType=a.renderOnce,t.processInit=ye}}),Object.defineProperty(Se,"state",{set(t){t.original={setUse:B,tags:ie},t.tagJsType=a.stateRender,t.processInit=we}}),Object.defineProperty(Se,"use",{set(t){t.original={setUse:B,tags:ie},t.tagJsType=a.stateRender,t.processInit=we}});const Ne={added:0,removed:0};function We(t,e,n,r){const o=r.global,{support:s,wasLikeTags:c}=Ve(e,t,r,n);return c?(Ie(o.oldest,s),s):(qe(n,r,Ne),s)}function Re(t){return a.templater===t.tagJsType}function Le(t){const e=t.subject.global,n=Re(t.templater),r=t.ownerSupport;if(e.locked)return e.blocked.push(t),t;if(n){return Me(r,t)}e.locked=!0;const o=t.subject;e.blocked.length&&(t=e.blocked.pop(),e.blocked=[]);const s=We(e.newest,t,r,o);return delete e.locked,s}function Me(t,e){const n=t.subject.global;if(!n||!0===n.deleted)return e;return Le(n.newest||t)}function De(t,e){return t.length!==e.length}function Be(t,e,n){if(De(t,e))return 11;switch(n){case ke.NONE:return 1;case ke.SHALLOW:return He(t,e);case ke.IMMUTABLE:return _e(t,e)}return function(t,e){let n=t,r=e;n=[...t],r=[...e||[]];if(!n.every(((t,e)=>function(t,e,n,r){const o=r[e];if(typeof t===c.object){const e={...t},n={...o||{}},r=Object.entries(e).every((([t,r])=>$e(r,n[t],(()=>{delete e[t],delete n[t]}))));return r}return $e(t,o,(()=>{n.splice(e,1),r.splice(e,1)}))}(t,e,n,r))))return 7;return!1}(t,e)}function $e(t,e,n){if(typeof t!==c.function)return!!z(t,e,Fe)&&4;if(typeof e!==c.function)return!1;const r=e?.original;r&&(e=r);t.original&&(t=t.original);return t.toString()===e.toString()?(n(),5):(n(),6)}function _e(t,e){const n=t.length;for(let r=0;r<n;++r){if(t[r]!==e[r])return 2}return!1}function He(t,e){const n=t.length;for(let r=0;r<n;++r){const n=t[r],o=e[r];if(S(n)&&S(o)){if(n===o)continue;return 3}if(typeof n!==c.function||typeof o!==c.function)if(typeof n!==c.object){if(n!==o)return 3.3}else if(typeof e===c.object){const t=Object.entries(n);for(const e of t){if(!ze(e,o))return 3.1}}}return!1}const Ue=3,Fe=10;function ze([t,e],n){const r=n[t];return typeof e===c.function&&typeof r===c.function||r===e}function Ze(t,e,n){const r={templater:t,subject:e,castedProps:n,appSupport:void 0},o=e.global;return o.blocked=[],o.destroy$=new R,r}function Ge(t,e,n,r){e.appSupport=n;const o=t.props;return o&&(e.propsConfig=function(t,e,n){const r=t.templater;if(r.tagJsType!==a.stateRender){switch(r.propWatch){case ke.IMMUTABLE:return t.propsConfig={latest:e,castProps:n};case ke.SHALLOW:return t.propsConfig={latest:e.map((t=>X(t,Ue))),castProps:n}}return t.propsConfig={latest:e.map((t=>X(t,Fe))),castProps:n}}}(e,o,r)),e}function Xe(t,e,n,r,o){const s={templater:t,subject:r,castedProps:o,appSupport:void 0};return s.ownerSupport=e,s.appSupport=n,s}function qe(t,e,n){const r=e.global.newest;r.ownerSupport=t,e.checkValueChange=oe;return qt(r,n,void 0,e.placeholder),r}function Qe(){return{tagJsType:a.templater,processInit:ae}}function Ye(t,e,n){const r=Xe(t,e,e.appSupport,n);return n.global.context=[],r}const Ke={added:0,removed:0};function tn(t,e,r){const o=e.tagJsType;if(v(e))return void 0===t.global&&n(t),Mt(e,t,r),!0;const s=t.global;if(s){const n=s.newest;if(n)return typeof e===c.function||function(t,e,n,r){const o=Rt(n.templater||n,r,r.appSupport,e);Ie(t.subject.global.oldest,o)}(n,t,e,r),!0}switch(o){case a.templater:return qe(r,t,Ke),!0;case a.tag:case a.dom:return function(t,e,r){const o=t;let s=o.templater;s||(s=Qe(),o.templater=s,s.tag=o);const c=e.global?e.global:n(e);c.newest=Ye(s,r,e),qe(r,e,Ke)}(e,t,r),!0;case a.subscribe:return e.processInit(e,t,r,{added:0,removed:0},void 0,t.placeholder),!0}return!1}function en(t,e,n,r){const o=t&&t.tagJsType;if(o){if(o===a.renderOnce)return;tn(e,t,n)}else S(t)?Bt(e,t,n,{added:0,removed:0}):typeof t!==c.function?r&&function(t,e){e.checkValueChange=Nt;const n=e.placeholder,r=kt(t);e.simpleValueElm=Ct(r,n)}(t,e):e.value=t}function nn(t,e,n){const r=t.checkValueChange(e,t);-1!==r&&en(e,t,n,r)}function rn(t,e,n,r,o,s,c){let u;s&&(u=c=document.createTextNode(""),p.push({element:c,relative:s}));const i=function(t,e,n,r,o,s){const c=T(n);let a;let u=function(t){l.hasEmitted=!0,l.contextItem=Dt(t,n,r,void 0,s),u=function(t){nn(l.contextItem,t,n),p||B.stateConfig.support||h()}};const i=function(t){a=t;const e=c.subject.global.newest;var n;n=c,$(e.states,n.states),l.callback&&(t=l.callback(t)),u(t)},l={hasEmitted:!1,handler:i,getLastValue:()=>a,callback:o,states:c.states};e.subscription=l;let p=!0;return l.subscription=t.subscribe(i),p=!1,l}(t,e,n,r,o,c);e.delete=()=>{if(console.log("🗑️ delete subscribe"),i.contextItem.delete(i.contextItem),i.subscription.unsubscribe(),u){u.parentNode.removeChild(u)}},e.handler=(t,e,n)=>{!function(t,e,n,r){if(!t||!t.tagJsType||t.tagJsType!==a.subscribe)return n.delete(n),99;if(!r.hasEmitted)return-1;r.callback=t.callback,r.handler(r.getLastValue());const o=T(e);r.states=o.states}(t,e,n,i)}}function on(t,e,n,r,o,s){return rn(t.Observable,e,n,r,t.callback,o,s)}function sn(t,e,n,r,o){rn(t,e,n,r,void 0,o)}function cn(t){return Pn()?gn((()=>an(t))):an(t)}function an(t){let e=t;const n=new Set;return{tagJsType:a.signal,processInit:sn,get value(){return e},set value(t){e!==t&&(e=t,n.forEach((e=>e(t))))},subscribe(t){t(e),n.add(t);const r=()=>n.delete(t);return r.unsubscribe=r,r}}}class un extends R{value;constructor(t){super(t),this.value=t}subscribe(t){const e=super.subscribe(t);return t(this.value,e),e}}class ln extends R{value;constructor(t){super(t),this.value=t,this._value=t,M(this)}subscribe(t){const e=super.subscribe(t);return t(this._value,e),e}}function pn(t){return(e,n)=>{n.setHandler((()=>{})),t(e,n.next)}}function fn(t){return(e,n)=>{n.setHandler((()=>{}));t(e).then((t=>n.next(t)))}}const dn=t=>(e,n)=>{n.setHandler((()=>{}));const r=t(e).subscribe((t=>{r.unsubscribe(),n.next(t)}))};function gn(t){return B.stateConfig.handlers.handler(t)}const hn=(t,e)=>mn(t,e),bn=t=>t;const mn=(t,e,{init:n,before:r,final:o=bn}={})=>{const s=gn({pastResult:void 0,values:void 0}),c=s.values;if(void 0===c){if(r&&!r(t))return s.values=t,s.pastResult;const a=(n||e)(t,c);return s.pastResult=o(a),s.values=t,s.pastResult}if(t.every(((t,e)=>t===c[e])))return s.pastResult;if(r&&!r(t))return s.values=t,s.pastResult;const a=e(t,c);return s.pastResult=o(a),c.length=0,c.push(...t),s.pastResult};function vn(t,e){return Object.defineProperty(e,"noInit",{get(){const e=t();return e.setup.init=()=>{},e}}),Object.defineProperty(e,"asSubject",{get(){const e=t(),n=gn((()=>Pn())),r=gn((()=>new un(void 0))),o=gn((()=>({stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}))),s=(t,s)=>(mn(t,((t,e)=>{const c=Pn(),a=s(t,e);if(c!==n){const t=o.stateArray,e=n.subject.global.oldest;H(t,e.state,o.states,e.states)}r.next(a)}),e.setup),r);return s.setup=e.setup,vn((()=>s),s),s}}),Object.defineProperty(e,"truthy",{get(){const e=t();return e.setup.before=t=>t.every((t=>t)),e}}),e}function yn(t){return Pn()?gn((()=>new R(t))):new R(t)}function wn(t){return B.stateConfig.handlers.statesHandler(t)}function Cn(t){const e=cn([]),n=cn(0),r=cn(0);let o=[],s=0;return r.value=n.value,t(((...t)=>(o=t,e.value))),hn(o,(()=>{++s,e.value=o,t((()=>o))})),wn(((o,c)=>{if(s)return t(((...t)=>(c&&1!==c||(e.value=t),e.value))),r.value=n.value,void++n.value;t((()=>e.value))})),++s,e.value}vn((()=>function(t){const e=(e,n)=>mn(e,n,t);return e.setup=t,vn((()=>e),e),e}({})),hn),yn._value=t=>{const e=gn((function(){return{stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}})),n=Pn();return gn((function(){return new un(t).pipe((t=>(H(n.state,e.stateArray,n.states,e.states),t)))}))},yn.all=function(t){const e=gn((()=>({stateArray:B.stateConfig.stateArray,states:B.stateConfig.states}))),n=Pn();return R.all(t).pipe((t=>(H(n.state,e.stateArray,n.states,e.states),t)))};const kn={create:t=>{const e=gn((()=>({stateDiff:0,provider:void 0})));if(e.stateDiff){let t=e.stateDiff;for(;t--;)gn(void 0);return gn(void 0)}const n=gn((()=>{const n=B.stateConfig,r=n.stateArray.length,o=t.prototype?new t:t(),s=n.support,c=n.stateArray.length-r,a={constructMethod:t,instance:o,stateDiff:c,owner:s,children:[]};e.provider=a;const u=s.subject.global;return(u.providers=u.providers||[]).push(a),e.stateDiff=c,o})),r=t,o=r.compareTo=r.toString();return e.provider.constructMethod.compareTo=o,n},inject:t=>gn((()=>{const e=t,n=e.compareTo=e.compareTo||t.toString(),r=Pn(),o=[];let s={ownerSupport:r.ownerSupport};for(;s.ownerSupport;){const t=s.ownerSupport.subject.global.providers;if(!t){s=s.ownerSupport;continue}const e=t.find((t=>{o.push(t);if(t.constructMethod.compareTo===n)return!0}));if(e){const t=r.subject.global;return(t.providers=t.providers||[]).push(e),e.children.push(r),e.instance}s=s.ownerSupport}const c=`Could not inject provider: ${t.name} ${t}`;throw console.warn(`${c}. Available providers`,o),new Error(c)}))};function Sn(t){const e=Pn();if(!e)throw En;return Tn(e,B.stateConfig,t)}function Tn(t,e,n){const r=e.states;return function(...e){return t.subject.renderCount>0?function(t,e,n,...r){const o=t.subject.global.newest;$(o.states,e);const s=n(...r);return $(e,o.states),Le(o),w(s)&&s.finally((()=>{$(e,o.states),Le(o)})),s}(t,r,n,...e):n(...e)}}const jn=()=>{const t=Pn();if(!t)throw En;const e=B.stateConfig;return function(n){return Tn(t,e,n)}},En=new ge("callback() was called outside of synchronous rendering. Use `callback = callbackMaker()` to create a callback that could be called out of sync with rendering");function xn(t){gn(t)}function An(t){gn((function(){Pn().subject.global.destroy$.toCallback(t)}))}function On(t,e){return{tagJsType:a.subscribe,processInit:on,Observable:t,callback:e,states:T(Pn()).states}}function Pn(){return B.stateConfig.support}function Vn(t,e,r,o,s,c){e.checkValueChange=oe;const a=t;let u=a.templater;u||(u=function(t){const e=Qe();return e.tag=t,t.templater=e,e}(a));const i=n(e);return s?ce(u,e,r,o,s,c):(i.newest=Ye(u,r,e),e.checkValueChange=oe,qe(r,e,o))}const Jn=":tagvar",In=":";function Nn(t,e){const n={values:e,ownerSupport:Pn(),tagJsType:a.tag,processInit:Vn,strings:t,key:t=>(n.arrayValue=t,n),html:function(t,e){return n.children={strings:t,values:e},n}};return n}function Wn(t,e){const n={values:e,ownerSupport:Pn(),dom:t,tagJsType:a.dom,processInit:Vn,key:function(t){return n.arrayValue=t,n},html:{dom:function(t,e){return n.children={dom:t,values:e},n}}};return n}const Rn=/(:tagvar\d+:)/,Ln="ondoubleclick",Mn=/([:_a-zA-Z0-9\-.]+)\s*(?:=\s*"([^"]*)"|=\s*(\S+))?/g,Dn=/<\/?([a-zA-Z0-9-]+)((?:\s+[a-zA-Z_:*][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)+\s*|\s*)\/?>/g;function Bn(t){const e=[],n=[],r=[];let o=null,s=-1,c=0;const a=new RegExp(Dn,"g");for(t=function(t){return t.replace($n,(function(t){return t.replace(/\[l t\]/g,"[l&nbsp;t]").replace(/\[g t\]/g,"[g&nbsp;t]").replace(/</g,"[l t]").replace(/>/g,"[g t]")}))}(t);c<t.length;){const u=a.exec(t);if(!u)break;const[i,l,p]=u,f=i.startsWith("</"),d=i.endsWith("/>");if(c<u.index){const e=t.slice(c,u.index);if(e.trim()){Fn(e).forEach((t=>{t.startsWith(Jn)&&(t=Jn+ ++s+In),Hn(o,n,t)}))}}if(c=u.index+i.length,f){o=r.pop()||null;continue}const g=[];let h;for(;null!==(h=Mn.exec(p));){const t=h[1]||h[3]||h[5];let n=h[2]||h[4]||h[6];if(void 0===t)continue;const r=""!==h[2],o=void 0===n&&r,c=t.toLowerCase(),a=c.startsWith("on")?_n(c):c;if(o){if(t.slice(0,Jn.length)===Jn){const t=Jn+ ++s+In;e.push(["at",t]),g.push([t]);continue}if(h[0].startsWith(t)&&h[0].slice(t.length,h[0].length).search(/\s+$/)>=0){g.push([a]);continue}n=Jn+ ++s+In}r||(n=h[2]);const u=[a,n],i=pt(c);i&&u.push(i),g.push(u)}const b={nn:l};g.length&&(b.at=g),o?(o.ch||(o.ch=[]),o.ch.push(b)):n.push(b),d||(r.push(o),o=b)}if(c<t.length){const e=t.slice(c);if(e.trim()){Fn(e).forEach((t=>(t.startsWith(Jn)&&++s,Hn(o,n,t))))}}return n}const $n=new RegExp("(\x3c!--[\\s\\S]*?--\x3e)","g");function _n(t){if(t.startsWith("on")){return t.length===Ln.length&&t===Ln?"dblclick":t.slice(2,t.length)}return t}function Hn(t,e,n){!function(t,e,n){t?(t.ch||(t.ch=[]),t.ch.push(n)):e.push(n)}(t,e,{nn:"text",tc:Un(n)})}function Un(t){return t.replace(/(\[l t\]!--[\s\S]*?--\[g t\])/g,(function(t){return t.replace(/\[l t\]/g,"<").replace(/\[g t\]/g,">").replace(/\[l&nbsp;t\]/g,"[l t]").replace(/\[g&nbsp;t\]/g,"[g t]")}))}function Fn(t){return t.split(Rn).filter((t=>""!==t))}const zn=/(^:tagvar\d+:|:tagvar\d+:$)/g,Zn="__safeTagVar";function Gn(t,e){return function(t,e){const n=t.map(((t,n)=>n<e.length?t+Jn+n+In:t));return function(t,e,n){const r=n.length-e.length;if(r>0)for(let n=r;n>0;--n)t.push(Jn+(e.length+n-1)+In)}(n,t,e),n}(t.map((t=>t.replace(zn,((t,e)=>Zn+e)))),e)}const Xn=new RegExp(Jn+"(\\d+)"+In,"g"),qn="ch";function Qn(t,e,n=[],r=[]){const o=t;for(let t=0;t<o.length;t++){const s=[...r,t],c=o[t];if(c.at){const t=c.at;c.at=Kn(t,e)}if(c.ch){const t=c.ch,r=[...s,qn];c.ch=Qn(t,e,n,r)}t=Yn(c,e,o,t)}return o}function Yn(t,e,n,r){if("text"!==t.nn)return r;const o=t;let c,a=o.tc;if(typeof a!==s.string)return r;for(;null!==(c=Xn.exec(a));){const t=c[1],o=parseInt(t,10);if(!isNaN(o)&&o<e){const t=Jn+o+In,e=a.slice(c.index+t.length);n.splice(r,1,{nn:"text",v:o}),a=e,Xn.lastIndex=0}}return o.tc=a,r}function Kn(t,e){return t.map((t=>{const[n,r,o]=t;if(n.startsWith(Jn)){const t=parseInt(n.replace(Jn,""),10);if(!isNaN(t)&&t<e)return[{tagJsVar:t}]}if(typeof r===s.string&&r.startsWith(Jn)){const t=parseInt(r.replace(Jn,""),10);if(!isNaN(t)&&t<e)return[n,{tagJsVar:t},o]}return t}))}const tr="__safeTagVar";const er=/__safeTagVar(\d+)/g;function nr(t){if(t.at&&(t.at=t.at?t.at.map((t=>{if(1===t.length)return t;const[,e]=t;if(typeof e===s.string&&e.startsWith(tr)){const n=parseInt(e.replace(tr,""),10);t[1]=Jn+n+In}return t})):[]),t.ch){const e=t.ch;for(let t=0;t<e.length;t++){const n=e[t];if("text"===n.nn){if(typeof n.tc!==s.string)return;n.tc=n.tc.replace(er,((t,e)=>Jn+e+In))}nr(n)}0===e.length&&delete t.ch}}const rr={};function or(t,e){const n=function(t){const e=t.map((t=>t.length));return e.push(t.length),Number(e.join(""))}(t),r=rr[n],o=r&&function(t,e,n){if(n&&n.strings.length===t.length&&n.strings.every(((e,n)=>e===t[n]))&&n.values.length===e.length)return!0;return!1}(t,e,r);if(o)return r.domMetaMap;const s=function(t,e){return Gn(t,e),Bn(Gn(t,e).join(""))}(t,e),c=Qn(s,e.length);c.forEach(nr);const a={interpolation:void 0,string:void 0,strings:t,values:e,domMetaMap:c};return rr[n]=a,c}function sr(t,...e){const n=Nn(t,e),r=ue(ke.NONE);return r.tag=n,n.templater=r,n}sr.dom=function(t,...e){return Wn(t,e)};const cr=[];function ar(t,e,r){const o=cr.findIndex((t=>t.element===e));if(o>=0){const t=cr[o].support;Ot(t,t.subject.global),cr.splice(o,1),console.warn("Found and destroyed app element already rendered to element",{element:e})}let s=()=>l(r);s.propWatch=ke.NONE,s.tagJsType=a.stateRender,s.props=[r],s.isApp=!0;const u=function(t,e){const r={value:t,checkValueChange:oe,delete:se,withinOwnerElement:!1,renderCount:0,global:void 0},o=n(r);return o.events={},ur(t,r,e),r}(s,e),i=u.global;x(i.newest,B.stateConfig);let l=t(r);const p=typeof l==c.function;p||(v(l)?(i.newest.propsConfig={latest:[r],castProps:[r]},s.propWatch=l.propWatch,s.tagJsType=l.tagJsType,s.wrapper=l.wrapper,s=l):(s.tag=l,l=t));const f=document.createTextNode("");ie.push(s.wrapper||{original:s});const d=ir(s,f,e,u,p);if(i.isApp=!0,p&&(l.tag=d.templater.tag),!e)throw new Error(`Cannot tagElement, element received is type ${typeof e} and not type Element`);e.destroy=function(){const t=i.events;for(const n in t){const r=t[n];e.removeEventListener(n,r)}i.events={},++g.locks;const n=Ot(d,i);return--g.locks,h(),n},++g.locks;const b=function(t,e,n,r,o,s){const c=qt(t,{added:0,removed:0},e,void 0);n.oldest=t,n.newest=t;let u=r.setUse;if(r.tagJsType!==a.stateRender){const t=o.original;u=t.setUse,t.isApp=!0}e.setUse=u,e.ValueTypes=a,cr.push({element:e,support:t});const i=document.createDocumentFragment();i.appendChild(s);for(const t of c.dom)lr(t,i);return i}(d,e,i,s,t,f);return--g.locks,h(),e.appendChild(b),{support:d,tags:ie,ValueTypes:a}}function ur(t,e,n){const r=e.global,o=Ze(t,e);return Ge(t,o,o),o.appElement=n,r.oldest=r.oldest||o,r.newest=o,o}function ir(t,e,n,r,o){r.placeholder=e;const s=r.global,c=s.oldest,u=s.newest===c,i=Rt(t,s.newest,s.newest.appSupport,r);if(u||A(0,s.newest,B.stateConfig,c.state),t.tagJsType===a.stateRender)return function(t,e,n,r,o){const s=t.wrapper||{original:t};if(!e){const e=ur(t,r,o);return me(e),e}return ne(t,s,n),me(n),n}(t,o,i,r,n);const l=(0,t.wrapper)(i,r);return me(i),l}function lr(t,e){t.domElement&&e.appendChild(t.domElement),t.marker&&e.appendChild(t.marker)}function pr(t,e,n){n.subject.global.deleted||(Lt(t,n,e),B.stateConfig.support||h())}const fr={tagElement:ar,renderWithSupport:Ve,renderSupport:Le,renderTagOnly:ve,paint:h};var dr=e.W9,gr=e.cg,hr=e.m0,br=e.rS,mr=e.Y2,vr=e.ei,yr=e.B7,wr=e.TU,Cr=e.XF,kr=e.PC,Sr=e.Ot,Tr=e.Mj,jr=e.tD,Er=e.j8,xr=e.um,Ar=e.E2,Or=e.OH,Pr=e.TB,Vr=e.Ii,Jr=e.yV,Ir=e.zV,Nr=e.pf,Wr=e.ze,Rr=e.WJ,Lr=e.Ng,Mr=e.VI,Dr=e.aZ,Br=e.O,$r=e.Ie,_r=e.B4,Hr=e.Az,Ur=e.Xi,Fr=e.Ah,zr=e.ck,Zr=e.Gk,Gr=e.zC,Xr=e.cF,qr=e.jU,Qr=e.PB,Yr=e.qy,Kr=e.cy,to=e.Tn,eo=e.Gv,no=e.yL,ro=e.D8,oo=e.Ze,so=e._4,co=e.mn,ao=e.z,uo=e.sA,io=e.MG,lo=e.PL,po=e.nI,fo=e.PZ,go=e.N_,ho=e.r5,bo=e.uc,mo=e.pG,vo=e.QB,yo=e.R6,wo=e.Ll,Co=e.vP,ko=e.wk,So=e.xP,To=e.bc,jo=e.B1,Eo=e.ag,xo=e.Tc,Ao=e.Hf,Oo=e._A,Po=e.Ag,Vo=e.NU,Jo=e.hW,Io=e.wB,No=e.id,Wo=e.MC,Ro=e.SZ;export{dr as ArrayNoKeyError,gr as BasicTypes,hr as ImmutableTypes,br as PropWatches,mr as RouteQuery,vr as StateMismatchError,yr as Subject,wr as Subjective,Cr as SyncCallbackError,kr as TagError,Sr as ValueSubject,Tr as ValueSubjective,jr as ValueTypes,Er as addOneContext,xr as buildBeforeElement,Ar as callback,Or as callbackMaker,Pr as checkArrayValueChange,Vr as checkSimpleValueChange,Jr as checkTagValueChange,Ir as combineLatest,Nr as createHtmlSupport,Wr as createTrigger,Rr as defineValueOn,Lr as deleteSimpleValue,Mr as destorySupportByContextItem,Dr as destroyArray,Br as destroySupport,$r as empty,_r as getBaseSupport,Hr as getDomMeta,Ur as getDomTag,Fr as getNewGlobal,zr as getStringTag,Zr as getTemplaterResult,Gr as hasPropChanges,Xr as hmr,qr as howToSetFirstInputValue,Qr as howToSetInputValue,Yr as html,Kr as isArray,to as isFunction,eo as isObject,no as isPromise,ro as isSimpleType,oo as isStaticTag,so as isSubjectInstance,co as isTagComponent,ao as letProp,uo as onDestroy,io as onInit,lo as oneRenderToSupport,po as paint,fo as processFirstSubjectValue,go as processSubUpdate,ho as providers,bo as renderSupport,mo as renderTagOnly,vo as renderWithSupport,yo as runWrapper,wo as setUseMemory,Co as signal,ko as state,So as states,To as subject,jo as subscribe,Eo as syncError,xo as tag,Ao as tagElement,Oo as tags,Po as upgradeBaseToSupport,Vo as variablePrefix,Jo as variableSuffix,Io as watch,No as willCallback,Wo as willPromise,Ro as willSubscribe};
2
2
  //# sourceMappingURL=bundle.js.map