native-document 1.0.163 → 1.0.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/native-document.components.min.js +21 -7
- package/dist/native-document.dev.js +52 -17
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/index.js +2 -0
- package/package.json +1 -1
- package/src/core/data/ObservableResource.js +21 -3
- package/src/core/wrappers/NDElement.js +19 -1
- package/src/core/wrappers/NdPrototype.js +3 -7
- package/src/core/wrappers/SingletonView.js +13 -10
- package/src/router/Route.js +18 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
var NativeDocument=function(e){"use strict";let t={};t={log(){},warn(){},error(){},disable(){}};var n=t;class r extends Error{constructor(e,t={}){super(e),this.name="NativeDocumentError",this.context=t,this.timestamp=(new Date).toISOString()}}const o=3,s=8,i=11,a=[];a[1]=!0,a[o]=!0,a[i]=!0,a[s]=!0;const l={isObservable:e=>e&&(e.__$isObservable||e.__$Observable),isTemplateBinding:e=>e?.__$isTemplateBinding,isObservableWhenResult:e=>e&&(e.__$isObservableWhen||"object"==typeof e&&"$target"in e&&"$observer"in e),isArrayObservable:e=>e?.__$isObservableArray,isProxy:e=>e?.__isProxy__,isObservableOrProxy:e=>l.isObservable(e)||l.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker,isArray:e=>Array.isArray(e),isString:e=>"string"==typeof e,isNumber:e=>"number"==typeof e,isBoolean:e=>"boolean"==typeof e,isFunction:e=>"function"==typeof e,isAsyncFunction:e=>"function"==typeof e&&"AsyncFunction"===e.constructor.name,isObject:e=>"object"==typeof e&&null!==e,isJson:e=>!("object"!=typeof e||null===e||Array.isArray(e)||"Object"!==e.constructor.name),isElement:e=>e&&a[e.nodeType],isDOMNode:e=>a[e.nodeType],isFragment:e=>e?.nodeType===i,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||e.__$Observable||e?.__$isNDElement||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement,isValidChildren(e){Array.isArray(e)||(e=[e]);return 0===e.filter(e=>!this.isValidChild(e)).length},validateChildren(e){Array.isArray(e)||(e=[e]);const t=e.filter(e=>!this.isValidChild(e));if(t.length>0)throw new r(`Invalid children detected: ${t.map(e=>typeof e).join(", ")}`);return e},containsObservables:e=>!!e&&(l.isObject(e)&&Object.values(e).some(e=>l.isObservable(e))),containsObservableReference:e=>!(!e||"string"!=typeof e)&&/\{\{#ObItem::\([0-9]+\)\}\}/.test(e),validateAttributes(e){},validateEventCallback(e){if("function"!=typeof e)throw new r("Event callback must be a function")}},u=new Set(["checked","selected","disabled","readonly","required","autofocus","multiple","autocomplete","hidden","contenteditable","spellcheck","translate","draggable","async","defer","autoplay","controls","loop","muted","download","reversed","open","default","formnovalidate","novalidate","scoped","itemscope","allowfullscreen","allowpaymentrequest","playsinline"]),c=function(){let e=0;const t=new Map;return{register(n){const r=++e;return t.set(r,new WeakRef(n)),r},unregister(e){t.delete(e)},getObservableById:e=>t.get(e)?.deref(),cleanup(){for(const[e,n]of t){const e=n.deref();e&&e.cleanup()}t.clear()},cleanObservables(e){if(t.size<e)return;let r=0;for(const[e,n]of t)n.deref()||(t.delete(e),r++);r>0&&n.log("Memory Auto Clean",`🧹 Cleaned ${r} orphaned observables`)}}}();const h=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}},p=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},d=(e,t)=>{try{if(void 0!==window.structuredClone)return window.structuredClone(e)}catch(e){}if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(e=>d(e));if(l.isObservable(e))return t&&t(e),e;const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=d(e[t]));return n},f={getJson(e){let t=localStorage.getItem(e);try{return JSON.parse(t)}catch(t){throw new r("invalid_json:"+e)}},getNumber(e){return Number(this.get(e))},getBool(e){const t=this.get(e);return"true"===t||"1"===t},setJson(e,t){localStorage.setItem(e,JSON.stringify(t))},setBool(e,t){localStorage.setItem(e,t?"true":"false")},get:(e,t=null)=>localStorage.getItem(e)||t,set:(e,t)=>localStorage.setItem(e,t),remove(e){localStorage.removeItem(e)},has:e=>null!=localStorage.getItem(e)},m=(e,t)=>{if(!f.has(e))return t;switch(typeof t){case"object":return f.getJson(e)??t;case"boolean":return f.getBool(e)??t;case"number":return f.getNumber(e)??t;default:return f.get(e,t)??t}},b=e=>{switch(typeof e){case"object":return f.setJson;case"boolean":return f.setBool;default:return f.set}};function y(e,t=null){e=l.isObservable(e)?e.val():e,this.$previousValue=null,this.$currentValue=e,this.$firstListener=null,this.$listeners=null,this.$watchers=null,this.$memoryId=null,t&&(this.configs=t,t.reset&&(this.$initialValue=l.isObject(e)?d(e):e))}Object.defineProperty(y.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),y.prototype.__$Observable=!0,y.prototype.__$isObservable=!0,y.computed=()=>{};const g=function(){};y.prototype.intercept=function(e){return this.$interceptor=e,this.set=this.$setWithInterceptor,this},y.prototype.interceptMutations=function(e){return this.$mutationInterceptor=e,this},y.prototype.triggerFirstListener=function(e){this.$firstListener(this.$currentValue,this.$previousValue,e)},y.prototype.triggerListeners=function(e){const t=this.$listeners,n=this.$previousValue,r=this.$currentValue;for(let o=0,s=t.length;o<s;o++)t[o](r,n,e)},y.prototype.triggerWatchers=function(e){const t=this.$watchers,n=this.$previousValue,r=this.$currentValue,o=t.get(r),s=t.get(n);o&&o(!0,n,e),s&&s(!1,r,e)},y.prototype.triggerAll=function(e){this.triggerWatchers(e),this.triggerListeners(e)},y.prototype.triggerWatchersAndFirstListener=function(e){this.triggerWatchers(e),this.triggerFirstListener(e)},y.prototype.assocTrigger=function(){if(this.$firstListener=null,this.$watchers?.size&&this.$listeners?.length)return this.$firstListener=this.$listeners[0],this.trigger=0===this.$firstListener.length?this.$firstListener:this.triggerFirstListener,void(this.trigger=1===this.$listeners.length?this.triggerWatchersAndFirstListener:this.triggerAll);this.$listeners?.length?1===this.$listeners.length?(this.$firstListener=this.$listeners[0],this.trigger=0===this.$firstListener.length?this.$firstListener:this.triggerFirstListener):this.trigger=this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=g},y.prototype.trigger=g;const v={action:"set"};function $(e){return e instanceof Date?e:new Date(e)}function w(e,t){const n=$(e),r=$(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function S(e){const t=$(e);return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}function C(e,t){const n=l.isObservable(e);return{dependencies:n?e:null,callback:r=>t(r,n?e.val():e)}}function O(e,t){const n=e.filter(l.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>l.isObservable(e)?e.val():e))}}function A(e){return C(e,(e,t)=>e===t)}function E(e){return C(e,(e,t)=>e!==t)}function _(e){return C(e,(e,t)=>e>t)}function x(e){return C(e,(e,t)=>e>=t)}function N(e){return C(e,(e,t)=>e<t)}function F(e){return C(e,(e,t)=>e<=t)}function D(e,t=!0,r=""){return O([e,t,r],(e,[t,r,o])=>{if(!t)return!0;if(r)try{return new RegExp(t,o).test(String(e))}catch(e){return n.warn("Invalid regex pattern:",t,e),!1}return o&&""!==o?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}function M(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(l.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.every(e=>e.callback(t))}}function T(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(l.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.some(e=>e.callback(t))}}y.prototype.$updateWithNewValue=function(e){e=e?.__$isObservable?e.val():e,this.$currentValue!==e&&(this.$previousValue=this.$currentValue,this.$currentValue=e,this.trigger(v),this.$previousValue=null)},y.prototype.$setWithInterceptor=function(e){let t="function"==typeof e?e(this.$currentValue):e;const n=this.$interceptor(t,this.$currentValue);void 0!==n&&(t=n),this.$updateWithNewValue(t)},y.prototype.$basicSet=function(e){let t="function"==typeof e?e(this.$currentValue):e;this.$updateWithNewValue(t)},y.prototype.set=y.prototype.$basicSet,y.prototype.val=function(){return this.$currentValue},y.prototype.disconnectAll=function(){this.$previousValue=null,this.$currentValue=null,this.$listeners=null,this.$watchers=null,this.trigger=g},y.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},y.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}c.unregister(this.$memoryId),this.disconnectAll(),delete this.$value},y.prototype.subscribe=function(e){this.$listeners=this.$listeners??[],this.$listeners.push(e),this.assocTrigger()},y.prototype.on=function(e,t){this.$watchers=this.$watchers??new Map;let n=this.$watchers.get(e);t.__$isObservable&&(t=t.set.bind(t)),n?l.isArray(n.list)?n.list.push(t):(n=[n,t],t=e=>{for(let t=0,r=n.length;t<r;t++)n[t](e)},t.list=n,this.$watchers.set(e,t)):(n=t,this.$watchers.set(e,t)),this.assocTrigger()},y.prototype.off=function(e,t){if(!this.$watchers)return;const n=this.$watchers.get(e);if(!n)return;if(!t||!Array.isArray(n.list))return this.$watchers?.delete(e),void this.assocTrigger();const r=n.indexOf(t);n?.splice(r,1),1===n.length?this.$watchers.set(e,n[0]):0===n.length&&this.$watchers?.delete(e),this.assocTrigger()},y.prototype.once=function(e,t){const n="function"==typeof e?e:t=>t===e,r=e=>{n(e)&&(this.unsubscribe(r),t(e))};this.subscribe(r)},y.prototype.unsubscribe=function(e){if(!this.$listeners)return;const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},y.prototype.get=function(e){const t=this.$currentValue[e];return l.isObservable(t)?t.val():t},y.prototype.equals=function(e){return l.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},y.prototype.toBool=function(){return!!this.$currentValue},y.prototype.toggle=function(){this.set(!this.$currentValue)},y.prototype.reset=function(){if(!this.configs?.reset)return;const e=l.isObject(this.$initialValue)?d(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},y.prototype.toString=function(){return String(this.$currentValue)},y.prototype.valueOf=function(){return this.$currentValue},y.prototype.persist=function(e,t={}){let n=m(e,this.$currentValue);t.get&&(n=t.get(n)),this.set(n);const r=b(this.$currentValue);return this.subscribe(n=>{r(e,t.set?t.set(n):n)}),this},y.prototype.clone=function(){let e=this.$currentValue;return e&&"object"==typeof e&&(e="function"==typeof e.clone?e.clone():structuredClone(e)),new y(e)};const k=_,P=x,L=N,I=F,R=A,V=E,j=M,B=T;function W(e,t=!1){return C(e,(e,n)=>!!e&&(!n||(t?String(e).includes(String(n)):String(e).toLowerCase().includes(String(n).toLowerCase()))))}const q=W;var U=Object.freeze({__proto__:null,all:j,and:M,any:B,between:function(e,t){return O([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:q,createFilter:C,createMultiSourceFilter:O,custom:function(e,...t){const n=t.filter(l.isObservable);return{dependencies:n.length>0?n:null,callback:n=>{const r=t.map(e=>l.isObservable(e)?e.val():e);return e(n,...r)}}},dateAfter:e=>C(e,(e,t)=>!(!e||!t)&&$(e)>$(t)),dateBefore:e=>C(e,(e,t)=>!(!e||!t)&&$(e)<$(t)),dateBetween:(e,t)=>O([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=$(e);return r>=$(t)&&r<=$(n)}),dateEquals:e=>C(e,(e,t)=>!(!e||!t)&&w(e,t)),dateTimeAfter:e=>C(e,(e,t)=>!(!e||!t)&&$(e)>$(t)),dateTimeBefore:e=>C(e,(e,t)=>!(!e||!t)&&$(e)<$(t)),dateTimeBetween:(e,t)=>O([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=$(e);return r>=$(t)&&r<=$(n)}),dateTimeEquals:e=>C(e,(e,t)=>!(!e||!t)&&$(e).getTime()===$(t).getTime()),endsWith:function(e,t=!1){return C(e,(e,n)=>!n||(t?String(e).endsWith(String(n)):String(e).toLowerCase().endsWith(String(n).toLowerCase())))},eq:R,equals:A,getSecondsOfDay:S,greaterThan:_,greaterThanOrEqual:x,gt:k,gte:P,inArray:function(e){return C(e,(e,t)=>t.includes(e))},includes:W,isEmpty:function(e=!0){return C(e,(e,t)=>{const n=!e||""===e||Array.isArray(e)&&0===e.length;return t?n:!n})},isNotEmpty:function(e=!0){return C(e,(e,t)=>{const n=!!e&&""!==e&&(!Array.isArray(e)||e.length>0);return t?n:!n})},isSameDay:w,lessThan:N,lessThanOrEqual:F,lt:L,lte:I,match:D,neq:V,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:E,notIn:function(e){return C(e,(e,t)=>!t.includes(e))},or:T,startsWith:function(e,t=!1){return C(e,(e,n)=>!n||(t?String(e).startsWith(String(n)):String(e).toLowerCase().startsWith(String(n).toLowerCase())))},timeAfter:e=>C(e,(e,t)=>!(!e||!t)&&S(e)>S(t)),timeBefore:e=>C(e,(e,t)=>!(!e||!t)&&S(e)<S(t)),timeBetween:(e,t)=>O([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=S(e);return r>=S(t)&&r<=S(n)}),timeEquals:e=>C(e,(e,t)=>{if(!e||!t)return!1;const n=$(e),r=$(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:$});const H=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");y.call(this,e,t)};(H.prototype=Object.create(y.prototype)).constructor=H,H.prototype.__$isObservableArray=!0,Object.defineProperty(H.prototype,"length",{get(){return this.$currentValue.length}}),H.prototype.$mutate=function(e,t,n){if(this.$mutationInterceptor){const n=this.$mutationInterceptor(t,{action:e});void 0!==t&&(t=n)}n(t)},["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{H.prototype[e]=function(...t){return this.$mutate(e,t,t=>{const n=this.$currentValue[e].apply(this.$currentValue,t);return this.trigger({action:e,args:t,result:n}),n})}}),["map","forEach","filter","reduce","some","every","find","findIndex","concat","includes","indexOf"].forEach(e=>{H.prototype[e]=function(...t){return this.$currentValue[e].apply(this.$currentValue,t)}});const z={action:"clear"};H.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$mutate("clear",[],()=>{this.$currentValue.length=0,this.trigger(z)}),!0},H.prototype.at=function(e){return this.$currentValue[e]},H.prototype.merge=function(e){this.$mutate("merge",e,e=>{this.$currentValue.push.apply(this.$currentValue,e),this.trigger({action:"merge",args:e})})},H.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},H.prototype.swap=function(e,t){return this.$mutate("swap",[e,t],([e,t])=>{const n=this.$currentValue,r=n.length;if(t<e){const n=e;e=t,t=n}if(r<e||r<t)return!1;const o=n[e],s=n[t];n[e]=s,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,s]})}),!0},H.prototype.swapItems=function(e,t){const n=this.$currentValue.indexOf(e),r=this.$currentValue.indexOf(t);return this.swap(n,r)},H.prototype.insertAfter=function(e,t){const n=this.$currentValue.indexOf(t);return this.splice(n+1,0,e)},H.prototype.remove=function(e){let t=[];return this.$mutate("remove",[e],([e])=>{t=this.$currentValue.splice(e,1),0!==t.length&&this.trigger({action:"remove",args:[e],result:t[0]})}),t},H.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return-1===t?[]:this.remove(t)},H.prototype.empty=function(){return 0===this.$currentValue.length},H.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},H.prototype.where=function(e){"function"==typeof e&&(e={_:e});const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=l.isObservable(o)?D(o,!1):o;if(e&&"object"==typeof e&&"callback"in e){if(r[t]=e.callback,e.dependencies){const t=Array.isArray(e.dependencies)?e.dependencies:[e.dependencies];n.push.apply(n,t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=new H([]),s=Object.entries(r),i=()=>{const e=t.val().filter(e=>{for(const[t,n]of s)if("_"===t){if(!n(e))return!1}else if(!n(e[t]))return!1;return!0});o.set(e)};return n.forEach(e=>e.subscribe(i)),i(),o},H.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},H.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},H.prototype.deepSubscribe=function(e){const t=h(()=>e(this.val())),n=new WeakMap,r=e=>{n.has(e)||(e?.__$isObservableArray?n.set(e,e.deepSubscribe(t)):e?.__$isObservable&&(e.subscribe(t),n.set(e,()=>e.unsubscribe(t))))},o=e=>{const t=n.get(e);t&&(t(),n.delete(e))};return this.$currentValue.forEach(r),this.subscribe(t),this.subscribe((e,t,n)=>{switch(n?.action){case"push":case"unshift":case"merge":n.args.forEach(r);break;case"splice":{const[e,t,...s]=n.args;n.result?.forEach(o),s.forEach(r);break}case"remove":o(n.result);break;case"clear":this.$currentValue.forEach(o)}}),()=>{this.$currentValue.forEach(o)}},H.prototype.sync=function(e){if(!e||!e.__$isObservableArray)throw new r("ObservableArray.sync : target must be an ObservableArray");e.set([...this.$currentValue]);const t=(t,n,r)=>{if(!r)return void e.set([...t]);const{action:o,args:s}=r;e[o].apply(e,s)};return this.subscribe(t),()=>this.unsubscribe(t)},H.prototype.clone=function(){return new H(this.resolve())},H.prototype.isNotEmpty=function(){return this.is(e=>e.length>0)};const G=function(e,t){y.call(this,e),this.$observables={},this.configs=t,this.$load(e);for(const t in e)Object.hasOwn(this,t)||Object.defineProperty(this,t,{get:()=>this.$observables[t],set:e=>this.$observables[t].set(e)})};G.prototype=Object.create(y.prototype),Object.defineProperty(G,"$value",{get(){return this.val()},set(e){this.set(e)}}),G.prototype.__$isObservableObject=!0,G.prototype.__isProxy__=!0,G.prototype.$load=function(e){const t=this.configs;for(const n in e){const r=e[n];if(Array.isArray(r)){if(!1!==t?.deep){const e=r.map(e=>l.isJson(e)?new G(e,t):l.isArray(e)?new H(e,t):new y(e,t));this.$observables[n]=new H(e,t);continue}this.$observables[n]=new H(r,t)}else l.isObservable(r)||l.isProxy(r)?this.$observables[n]=r:this.$observables[n]="object"==typeof r?new G(r,t):new y(r,t)}},G.prototype.val=function(){const e={};for(const t in this.$observables){const n=this.$observables[t];if(l.isObservable(n)){let r=n.val();Array.isArray(r)&&(r=r.map(e=>l.isObservable(e)?e.val():l.isProxy(e)?e.$value:e)),e[t]=r}else l.isProxy(n)?e[t]=n.$value:e[t]=n}return e},G.prototype.$val=G.prototype.val,G.prototype.get=function(e){const t=this.$observables[e];return l.isObservable(t)?t.val():l.isProxy(t)?t.$value:t},G.prototype.$get=G.prototype.get,G.prototype.set=function(e){const t=l.isProxy(e)?e.$value:e,n=this.configs;for(const r in t){const o=this.$observables[r],s=e[r],i=t[r];if(l.isObservable(o)){if(!l.isArray(i)){o.set(i);continue}const e=s.at(0);if(l.isObservable(e)||l.isProxy(e)){const t=i.map(t=>l.isProxy(e)?new G(t,n):y(t,n));o.set(t);continue}o.set([...i]);continue}l.isProxy(o)?o.update(i):this[r]=i}},G.prototype.$set=G.prototype.set,G.prototype.$updateWith=G.prototype.set,G.prototype.observables=function(){return Object.values(this.$observables)},G.prototype.$observables=G.prototype.observables,G.prototype.keys=function(){return Object.keys(this.$observables)},G.prototype.$keys=G.prototype.keys,G.prototype.clone=function(){return new G(this.val(),this.configs)},G.prototype.$clone=G.prototype.clone,G.prototype.reset=function(){for(const e in this.$observables)this.$observables[e].reset()},G.prototype.originalSubscribe=G.prototype.subscribe,G.prototype.subscribe=function(e){const t=this.observables(),n=h(()=>this.trigger());this.originalSubscribe(e);for(let e=0,r=t.length;e<r;e++){const r=t[e];r.__$isObservableArray?r.deepSubscribe(n):r.subscribe(n)}},G.prototype.configs=function(){return this.configs},G.prototype.update=G.prototype.set;const K=(e,t)=>y.computed(e,t),J=(e,t)=>e.transform(t);y.prototype.isEqualTo=function(e){return e?.__$Observable?K((e,t)=>e===t,[this,e]):J(this,t=>t===e)},y.prototype.isNotEqualTo=function(e){return e?.__$Observable?K((e,t)=>e!==t,[this,e]):J(this,t=>t!==e)},y.prototype.isGreaterThan=function(e){return e?.__$Observable?K((e,t)=>e>t,[this,e]):J(this,t=>t>e)},y.prototype.isGreaterThanOrEqualTo=function(e){return e?.__$Observable?K((e,t)=>e>=t,[this,e]):J(this,t=>t>=e)},y.prototype.isLessThan=function(e){return e?.__$Observable?K((e,t)=>e<t,[this,e]):J(this,t=>t<e)},y.prototype.isLessThanOrEqualTo=function(e){return e?.__$Observable?K((e,t)=>e<=t,[this,e]):J(this,t=>t<=e)},y.prototype.isBetween=function(e,t){return e.__$Observable&&t.__$Observable?K((e,t,n)=>e>=t&&e<=n,[this,e,t]):e.__$Observable?K((e,n)=>e>=n&&e<=t,[this,e]):t.__$Observable?K((t,n)=>t>=e&&t<=n,[this,t]):J(this,n=>n>=e&&n<=t)},y.prototype.isNull=function(){return J(this,e=>null==e)},y.prototype.isTruthy=function(){return J(this,e=>!!e)},y.prototype.isFalsy=function(){return J(this,e=>!e)},y.prototype.isStartingWith=function(e){return e?.__$Observable?K((e,t)=>String(e).startsWith(t),[this,e]):J(this,t=>String(t).startsWith(e))},y.prototype.isEndingWith=function(e){return e?.__$Observable?K((e,t)=>String(e).endsWith(t),[this,e]):J(this,t=>String(t).endsWith(e))},y.prototype.isMatchingPattern=function(e){return e?.__$Observable?K((e,t)=>new RegExp(t).test(String(e)),[this,e]):J(this,t=>e.test(String(t)))},y.prototype.isEmpty=function(){return J(this,e=>null==e||""===e||Array.isArray(e)&&0===e.length)},y.prototype.isNotEmpty=function(){return J(this,e=>null!=e&&""!==e&&!(Array.isArray(e)&&0===e.length))},y.prototype.isIncludes=function(e){return e?.__$Observable?K((e,t)=>Array.isArray(e)?e.includes(t):String(e).includes(String(t)),[this,e]):J(this,t=>Array.isArray(t)?t.includes(e):String(t).includes(String(e)))},y.prototype.isIncludedIn=function(e){return e?.__$Observable?K((e,t)=>t.includes(e),[this,e]):J(this,t=>e.includes(t))},y.prototype.isOneOf=y.prototype.isIncludedIn,y.prototype.isHaving=function(e){return e?.__$Observable?K((e,t)=>t in Object(e),[this,e]):J(this,t=>e in Object(t))},y.prototype.toUpperCase=function(){return J(this,e=>String(e).toUpperCase())},y.prototype.toLowerCase=function(){return J(this,e=>String(e).toLowerCase())},y.prototype.toTrimmed=function(){return J(this,e=>String(e).trim())},y.prototype.toBoolean=function(){return J(this,e=>!!e)},y.prototype.toLiteral=function(e,t="${v}"){return J(this,n=>e.replace(t,n))},y.prototype.toFormatted=y.prototype.toLiteral,y.prototype.toProperty=function(e){const t=e.split(".");return J(this,e=>{let n=e;for(const e of t){if(null==n)return;n=n[e]}return n})},y.prototype.toLength=function(){return J(this,e=>null==e?0:e.length)},y.prototype.toClamped=function(e,t){return e.__$Observable&&t.__$Observable?K((e,t,n)=>Math.min(Math.max(e,t),n),[this,e,t]):e.__$Observable?K((e,n)=>Math.min(Math.max(e,n),t),[this,e]):t.__$Observable?K((t,n)=>Math.min(Math.max(t,e),n),[this,t]):J(this,n=>Math.min(Math.max(n,e),t))},y.prototype.toPercent=function(e){return e?.__$Observable?K((e,t)=>0===t?0:e/t*100,[this,e]):J(this,t=>0===e?0:t/e*100)};const Y=function(e,t){this.$target=t,this.$observer=e};function Q(e,t){this.observable=e,y.call(this),this.$mutation=t,e.subscribe(e=>{this.$updateWithMutation(e)}),this.$updateWithMutation(e.val())}Y.prototype.__$Observable=!0,Y.prototype.__$isObservableWhen=!0,Y.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},Y.prototype.val=function(){return this.$observer.$currentValue===this.$target},Y.prototype.isMatch=Y.prototype.val,Y.prototype.isActive=Y.prototype.val,Q.prototype=Object.create(y.prototype),Q.prototype.constructor=Q,Q.prototype.__$Observable=!0,Q.prototype.__$isObservableChecker=!0;const X=Q;X.prototype.constructor=X,Q.prototype.$updateWithMutation=function(e){return e=this.$mutation(e),this.set(e)};const Z=(e,t)=>{const n=new Date(e);return{d:n,parts:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(n).reduce((e,{type:t,value:n})=>(e[t]=n,e),{})}},ee=(e,t,n)=>{const r=e=>String(e).padStart(2,"0");return e.replace("YYYY",n.year).replace("YY",n.year.slice(-2)).replace("MMMM",n.month).replace("MMM",n.month.slice(0,3)).replace("MM",r(t.getMonth()+1)).replace("DD",r(t.getDate())).replace("D",t.getDate()).replace("HH",n.hour).replace("mm",n.minute).replace("ss",n.second)},te={currency:(e,t,{currency:n="XOF",notation:r,minimumFractionDigits:o,maximumFractionDigits:s}={})=>new Intl.NumberFormat(t,{style:"currency",currency:n,notation:r,minimumFractionDigits:o,maximumFractionDigits:s}).format(e),number:(e,t,{notation:n,minimumFractionDigits:r,maximumFractionDigits:o}={})=>new Intl.NumberFormat(t,{notation:n,minimumFractionDigits:r,maximumFractionDigits:o}).format(e),percent:(e,t,{decimals:n=1}={})=>new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:n}).format(e),date:(e,t,{format:n,dateStyle:r="long"}={})=>{if(n){const{d:r,parts:o}=Z(e,t);return ee(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r}).format(new Date(e))},time:(e,t,{format:n,hour:r="2-digit",minute:o="2-digit",second:s}={})=>{if(n){const{d:r,parts:o}=Z(e,t);return ee(n,r,o)}return new Intl.DateTimeFormat(t,{hour:r,minute:o,second:s}).format(new Date(e))},datetime:(e,t,{format:n,dateStyle:r="long",hour:o="2-digit",minute:s="2-digit",second:i}={})=>{if(n){const{d:r,parts:o}=Z(e,t);return ee(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r,hour:o,minute:s,second:i}).format(new Date(e))},relative:(e,t,{unit:n="day",numeric:r="auto"}={})=>{const o=Math.round((e-Date.now())/864e5);return new Intl.RelativeTimeFormat(t,{numeric:r}).format(o,n)},plural:(e,t,{singular:n,plural:r}={})=>`${e} ${"one"===new Intl.PluralRules(t).select(e)?n:r}`};y.prototype.when=function(e){return new Y(this,e)},y.prototype.check=function(e){return new Q(this,e)},y.prototype.transform=y.prototype.check,y.prototype.pluck=function(e){return new Q(this,t=>t[e])},y.prototype.is=function(e){return new Q(this,"function"==typeof e?e:t=>t===e)},y.prototype.select=y.prototype.check,y.prototype.format=function(e,t={}){const n=this;if("function"==typeof e)return new Q(n,e);const r=te[e],o=te.locale;return y.computed(()=>r(n.val(),o.val(),t),[n,o])};const ne="unresolved",re="pending",oe="ready",se="refreshing",ie="errored";function ae(e,t,n){if(this.$fn=n.debounce>0?function(e,t,n={}){let r=null,o=null;return function(...s){const i=!0===n.context?this:null;n.check&&n.check(...s),o=s,clearTimeout(r),r=setTimeout(()=>function(e,t,n){n?e.apply(n,t):e(...t)}(e,o,i),t)}}(e,n.debounce):e,this.$dependencies=t,this.$config=n,this.$controller=null,this.$subscriptions=[],this.data=n.initial??new y(null),this.error=new y(null),this.state=new y(ne),this.loading=y.computed(e=>e===re||e===se,[this.state]),n.auto){if(t.length>0)return void this.$watchDependencies();this.fetch()}}function le(e,t=null){return new y(e,t)}ae.prototype.$abort=function(){this.$controller&&(this.$controller.abort(),this.$controller=null)},ae.prototype.$runWithAbortController=function(e=!1){this.$abort(),this.$controller=new AbortController;const t=this.$controller.signal,n=null!==this.data.val(),r=e&&n?se:re;this.error.set(null),this.state.set(r);const o=[...this.$dependencies.map(e=>e.val()),t];Promise.resolve(this.$fn(...o)).then(e=>{t.aborted||(this.data.set(e),this.error.set(null),this.state.set(oe),this.$controller=null)}).catch(e=>{t.aborted||(this.error.set(e),this.state.set(ie),this.$controller=null)})},ae.prototype.$runWithoutAbortController=function(e=!1){const t=null!==this.data.val(),n=e&&t?se:re;this.error.set(null),this.state.set(n);const r=this.$dependencies.map(e=>e.val());Promise.resolve(this.$fn(...r)).then(e=>{this.data.set(e),this.error.set(null),this.state.set(oe)}).catch(e=>{this.error.set(e),this.state.set(ie)})},ae.prototype.$run=function(e=!1){return this.$fn.length>this.$dependencies.length?(this.$run=this.$runWithAbortController,this.$runWithAbortController(e)):(this.$run=this.$runWithoutAbortController,this.$run(e))},ae.prototype.$watchDependencies=function(){this.$subscriptions.forEach(e=>e()),this.$subscriptions=[],this.$dependencies.forEach(e=>{const t=()=>this.$run(!0);e.subscribe(t),this.$subscriptions.push(()=>e.unsubscribe(t))}),this.$config.lazy||this.$run(!1)},ae.prototype.fetch=function(){return this.$run(!1),this},ae.prototype.refetch=function(){return this.$run(!0),this},ae.prototype.mutate=function(e){return this.data.set(e),this.state.set(oe),this},ae.prototype.destroy=function(){this.$abort(),this.$subscriptions.forEach(e=>e()),this.$subscriptions=[]},ae.prototype.isReady=function(){return this.state.isEqualTo(oe)},ae.prototype.isPending=function(){return this.state.isEqualTo(re)},ae.prototype.isRefreshing=function(){return this.state.isEqualTo(se)},ae.prototype.isErrored=function(){return this.state.isEqualTo(ie)},ae.prototype.isUnresolved=function(){return this.state.isEqualTo(ne)},ae.prototype.onSuccess=function(e){return this.data.subscribe(t=>{this.state.val()===oe&&e(t)}),this},ae.prototype.onError=function(e){return this.error.subscribe(t=>{null!==t&&e(t)}),this};const ue=le,ce=le;le.useValueProperty=function(e="value"){Object.defineProperty(y.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},le.setLocale=function(e){te.locale=e.__$Observable?e:le(e)},le.getById=function(e){const t=c.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},le.cleanup=function(e){e.cleanup()},le.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{c.cleanup()}),setInterval(()=>c.cleanObservables(r),n)},le.array=function(e=[],t=null){return new H(e,t)},le.batch=function(e){const t=le(0),n=function(){if(l.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n},le.computed=function(e,t=[]){const n=()=>t.map(e=>e.val()),o=new y(e(...n())),s=h(()=>o.set(e(...n())));if(l.isFunction(t)){if(!l.isObservable(t.$observer))throw new r("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(s),o}return t.forEach(e=>{l.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(s)}):e.subscribe(s)}),o},y.computed=le.computed,le.init=function(e,t=null){return new G(e,t)},le.arrayOfObject=function(e){return e.map(e=>le.object(e))},le.value=function(e){if(e?.__$isObservableArray){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.at(n);t.push(le.value(r))}return t}return e?.__$Observable?e.val():l.isProxy(e)?e.$value:e},le.object=le.init,le.json=le.init,le.resource=function(e,t=[],n=!1){return new ae(e,t,"boolean"==typeof n?{auto:n,debounce:0,lazy:!1}:{auto:!1,debounce:0,lazy:!1,...n})},y.prototype.resolve=function(){return le.value(this)};const he=(e,t)=>{for(const n in t){const r=t[n];if(r.__$Observable){if(r.__$isObservableChecker){let t=r.val();if("string"==typeof t){e.classes.toggle(t,!0),r.subscribe(n=>{e.classes.remove(t),e.classes.toggle(n,!0),t=n});continue}}e.classes.toggle(n,r.val()),r.subscribe(t=>e.classes.toggle(n,t))}else r.$hydrate?r.$hydrate(e,n):e.classes.toggle(n,r)}},pe=(e,t)=>{for(const n in t){const r=t[n],o=n.startsWith("--");r.__$Observable?o?(e.style.setProperty(n,r.val()),r.subscribe(t=>{!1!==t?e.style.setProperty(n,t):e.style.removeProperty(n)})):(e.style[n]=r.val(),r.subscribe(t=>{!1!==t?e.style[n]=t:e.style.removeProperty(n)})):o?e.style.setProperty(n,r):e.style[n]=r}},de=(e,t,n)=>{const r=n.__$isObservable,o=r?n.val():n;if(l.isBoolean(o)?e[t]=o:e[t]=o===e.value,r){if("checked"===t)return"boolean"==typeof o?e.addEventListener("input",()=>n.set(e[t])):e.addEventListener("input",()=>n.set(e.value)),void n.subscribe(n=>e[t]=n);n.subscribe(n=>e[t]=n===e.value)}},fe=(e,t,n)=>{const r="value"===t?t=>e.value=t:n=>e.setAttribute(t,n);if(n.subscribe(r),"value"===t)return e.value=n.val(),void e.addEventListener("input",()=>n.set(e.value));e.setAttribute(t,n.val())},me=(e,t)=>{for(const n in t){const r=n.toLowerCase();let o=t[n];if(null!=o)if(o.handleNdAttribute)o.handleNdAttribute(e,r,o);else{if("object"==typeof o){if("class"===r){he(e,o);continue}if("style"===r){pe(e,o);continue}}u.has(r)?de(e,r,o):e.setAttribute(r,o)}}return e};let be=null;const ye={createTextNode:()=>(be||(be=document.createTextNode(""),ye.createTextNode=()=>be.cloneNode()),be.cloneNode()),createObservableNode:(e,t)=>{const n=ye.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode:(e,t)=>{const n=ye.createTextNode();return t.$hydrate(n),n},createStaticTextNode:(e,t)=>{let n=ye.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement:e=>document.createElement(e).cloneNode(),bindTextNode:(e,t)=>{if(t?.__$isObservable)return t.subscribe(t=>e.nodeValue=t),void(e.nodeValue=t.val());e.nodeValue=t},processChildren:(e,t)=>{if(null===e)return;let n=ye.getChild(e);n&&t.appendChild(n)},async safeRemove(e){await e.remove()},getChild:e=>{if(null==e)return null;if(e.toNdElement)do{if(e=e.toNdElement(),l.isElement(e))return e}while(e.toNdElement);return ye.createStaticTextNode(null,e)},processAttributes:(e,t)=>{t&&me(e,t)},processAttributesDirect:me,processClassAttribute:he,processStyleAttribute:pe};function ge(e){const t=Reflect.construct(DocumentFragment,[],ge),n=document.createComment((e||"")+" Anchor Sentinel"),r=document.createComment("Anchor Start : "+e),o=document.createComment("/ Anchor End "+e),s={};t.append(r,n,o);const i=new MutationObserver(()=>{n.parentNode===t||n.parentNode instanceof DocumentFragment||s.connected&&s.connected(n.parentNode)});return i.observe(document,{childList:!0,subtree:!0}),t.$sentinel=n,t.$start=r,t.$end=o,t.$observer=i,t.$events=s,t}function ve(e,t=!1){const n=new ge(e);n.onConnectedOnce(e=>{t&&function(e,t){e.remove=()=>{e.append.apply(e,t.childNodes)},e.getParent=()=>t,e.appendChild=e=>{e=l.isElement(e)?e:ye.getChild(e),t.appendChild(e)},e.appendChildRaw=t.appendChild.bind(t),e.append=e.appendChild,e.appendRaw=e.appendChildRaw,e.insertAtStart=e=>{e=l.isElement(e)?e:ye.getChild(e),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},e.insertAtStartRaw=e=>{t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},e.appendElement=e.appendChild,e.removeChildren=()=>{t.textContent=""},e.replaceContent=function(e){const n=l.isElement(e)?e:ye.getChild(e);t.replaceChildren(n)},e.replaceContentRaw=function(e){t.replaceChildren(e)},e.setContent=e.replaceContent,e.insertBefore=(e,n)=>{e=l.isElement(e)?e:ye.getChild(e),t.insertBefore(e,n)},e.insertBeforeRaw=(e,n)=>{t.insertBefore(e,n)},e.appendChildBefore=e.insertBefore,e.appendChildBeforeRaw=e.insertBeforeRaw,e.clear=e.remove,e.detach=e.remove,e.replaceChildren=function(){t.replaceChildren(...arguments)},e.getByIndex=e=>t.childNodes[e]}(n,e)}),n.__Anchor__=!0;const r=n.$start,o=n.$end;n.nativeInsertBefore=n.insertBefore,n.nativeAppendChild=n.appendChild,n.nativeAppend=n.append;const s=t?()=>!0:e=>e.firstChild===r&&e.lastChild===o,i=(e,t,r)=>{e!==n?s(e)&&r===o?e.append(t,r):e.insertBefore(t,r):e.nativeInsertBefore(t,r)};return n.appendElement=function(e){const t=r.parentNode;t!==n?t.insertBefore(e,o):t.nativeInsertBefore(e,o)},n.appendChild=function(e,t=null){const n=o.parentNode;n?((e,t,n)=>{const r=l.isElement(t)?t:ye.getChild(t);i(e,r,n)})(n,e,t=t??o):DebugManager.error("Anchor","Anchor : parent not found",e)},n.appendChildRaw=function(e,t=null){const n=o.parentNode;n?i(n,e,t=t??o):DebugManager.error("Anchor","Anchor : parent not found",e)},n.getParent=()=>o.parentNode,n.append=n.appendChild,n.appendRaw=n.appendChildRaw,n.insertAtStart=function(e){e=l.isElement(e)?e:ye.getChild(e),n.insertAtStartRaw(e)},n.insertAtStartRaw=function(e){const t=r.parentNode;t!==n?t.insertBefore(e,r):t.nativeInsertBefore(e,r)},n.removeChildren=function(){const e=o.parentNode;if(e===n)return;if(s(e))return void e.replaceChildren(r,o);let t,i=r.nextSibling;for(;i&&i!==o;)t=i.nextSibling,i.remove(),i=t},n.remove=function(){const e=o.parentNode;if(e===n)return;if(s(e))return n.nativeAppend.apply(n,e.childNodes),void e.replaceChildren(r,o);let t,i=r.nextSibling;for(;i&&i!==o;)t=i.nextSibling,n.nativeAppend(i),i=t},n.removeWithAnchors=function(){n.removeChildren(),r.remove(),o.remove()},n.delete=n.removeWithAnchors,n.replaceContent=function(e){const t=l.isElement(e)?e:ye.getChild(e);n.replaceContentRaw(t)},n.replaceContentRaw=function(e){const t=o.parentNode;t&&(s(t)?t.replaceChildren(r,e,o):(n.removeChildren(),t.insertBefore(e,o)))},n.setContent=n.replaceContent,n.setContentRaw=n.replaceContentRaw,n.insertBefore=n.appendChild,n.insertBeforeRaw=n.appendChildRaw,n.endElement=function(){return o},n.startElement=function(){return r},n.restore=function(){n.appendChild(n)},n.clear=n.remove,n.detach=n.remove,n.getByIndex=function(e){let t=r;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==r?t:null},n}ge.prototype=Object.create(DocumentFragment.prototype),ge.prototype.constructor=ge,ge.prototype.onConnected=function(e){return this.$events.connected=e,this},ge.prototype.onConnectedOnce=function(e){this.$events.connected=t=>{e(t),this.$observer.disconnect(),this.$events.connectedOnce=null}},DocumentFragment.prototype.setAttribute=()=>{};let $e=e=>e;e.ArgTypes={},e.ArgTypes={string:()=>!0,number:()=>!0,boolean:()=>!0,observable:()=>!0,element:()=>!0,function:()=>!0,object:()=>!0,objectNotNull:()=>!0,children:()=>!0,attributes:()=>!0,optional:()=>!0,oneOf:()=>!0};const we=function(e,t=null){return e&&t?{props:e,children:t}:"object"!=typeof e||Array.isArray(e)||null===e||"Object"!==e.constructor.name||e.$hydrate?{props:t,children:e}:{props:e,children:t}},Se={mounted:new WeakMap,beforeUnmount:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,initObserver:()=>{Se.observer||(Se.observer=new MutationObserver(Se.checkMutation),Se.observer.observe(document.body,{childList:!0,subtree:!0}))},executeMountedCallback(e){const t=Se.mounted.get(e);if(t&&(t.inDom=!0,t.mounted))if(Array.isArray(t.mounted))for(const n of t.mounted)n(e);else t.mounted(e)},executeUnmountedCallback(e){const t=Se.unmounted.get(e);if(!t)return;if(t.inDom=!1,!t.unmounted)return;let n=!1;if(Array.isArray(t.unmounted))for(const r of t.unmounted)!0===r(e)&&(n=!0);else n=!0===t.unmounted(e);n&&(t.disconnect(),e.nd?.remove())},checkMutation:function(e){for(const t of e){if(Se.mountedSupposedSize>0)for(const e of t.addedNodes){if(Se.executeMountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-mounted]");for(const e of t)Se.executeMountedCallback(e)}if(Se.unmountedSupposedSize>0)for(const e of t.removedNodes){if(Se.executeUnmountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-unmounted]");for(const e of t)Se.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n=!1,r=!1;Se.initObserver();let o={inDom:t,mounted:null,unmounted:null,disconnect:()=>{n&&(Se.mounted.delete(e),Se.mountedSupposedSize--),r&&(Se.unmounted.delete(e),Se.unmountedSupposedSize--),o=null}};const s=(e,t)=>{o[e]?Array.isArray(o[e])?o[e].push(t):o[e]=[o[e],t]:o[e]=t};return{disconnect:()=>o?.disconnect(),mounted:t=>{s("mounted",t),Se.mounted.set(e,o),n||(Se.mountedSupposedSize++,n=!0)},unmounted:t=>{s("unmounted",t),Se.unmounted.set(e,o),r||(Se.unmountedSupposedSize++,r=!0)},off:(e,t)=>{((e,t)=>{if(o?.[e]){if(Array.isArray(o[e])){const n=o[e].indexOf(t);return n>-1&&o[e].splice(n,1),1===o[e].length&&(o[e]=o[e][0]),void(0===o[e].length&&(o[e]=null))}o[e]=null}})(e,t)}}}};function Ce(e){this.$element=e,this.$attachements=null}Ce.prototype.__$isNDElement=!0,Ce.$getChild=e=>e,Ce.prototype.ghostDom=function(e){return this.$attachements||(this.$attachements=document.createDocumentFragment()),this.$attachements.appendChild(Ce.$getChild(e)),this},Ce.prototype.valueOf=function(){return this.$element},Ce.prototype.ref=function(e,t){return e[t]=this.$element,this},Ce.prototype.refSelf=function(e,t){return e[t]=this,this},Ce.prototype.unmountChildren=function(){let e=this.$element;for(let t=0,n=e.children.length;t<n;t++){let n=e.children[t];n.$ndProx||n.nd?.remove(),n=null}return e=null,this},Ce.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,Oe.delete(e),e=null,this};const Oe=new WeakMap;Ce.prototype.lifecycle=function(e){const t=this.$element;Oe.has(t)||Oe.set(t,Se.watch(t));const n=Oe.get(t);return e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),n.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),n.unmounted(e.unmounted)),this},Ce.prototype.mounted=function(e){return this.lifecycle({mounted:e})},Ce.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},Ce.prototype.beforeUnmount=function(e,t){const n=this.$element;if(!Se.beforeUnmount.has(n)){Se.beforeUnmount.set(n,new Map);const e=n.remove.bind(n);let t=!1;n.remove=async()=>{if(!t){t=!0;try{const e=Se.beforeUnmount.get(n);for(const t of e.values())await t.call(this,n)}finally{e(),t=!1}}}}return Se.beforeUnmount.get(n).set(e,t),this},Ce.prototype.htmlElement=function(){return this.$element},Ce.prototype.node=Ce.prototype.htmlElement,Ce.prototype.shadow=function(e,t=null){const n=this.$element,r=Array.from(n.childNodes),o=n.attachShadow({mode:e});if(t){const e=document.createElement("style");e.textContent=t,o.appendChild(e)}return n.append=o.append.bind(o),n.appendChild=o.appendChild.bind(o),o.append(...r),this},Ce.prototype.openShadow=function(e=null){return this.shadow("open",e)},Ce.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},Ce.prototype.with=function(e){if(!e||"object"!=typeof e)throw new r("extend() requires an object of methods");for(const t in e){const r=e[t];"function"==typeof r?this[t]=r.bind(this):n.warn(`⚠️ extends(): "${t}" is not a function, skipping`)}return this},Ce.prototype.attr=function(e,t){return t?.__$Observable?(fe(this.$element,e,t),this):(this.$element.setAttribute(e,t),this)},Ce.prototype.attrs=function(e){return me(this.$element,e),this},Ce.prototype.class=function(e){return he(this.$element,e),this},Ce.prototype.style=function(e){return pe(this.$element,e),this},Ce.extend=function(e){if(!e||"object"!=typeof e)throw new r("NDElement.extend() requires an object of methods");if(Array.isArray(e))throw new r("NDElement.extend() requires an object, not an array");const t=new Set(["constructor","valueOf","$element","$observer","ref","remove","cleanup","with","extend","attach","lifecycle","mounted","unmounted","unmountChildren"]);for(const o in e){if(!Object.hasOwn(e,o))continue;const s=e[o];if("function"==typeof s){if(t.has(o))throw n.error("NDElement.extend",`Cannot override protected method "${o}"`),new r(`Cannot override protected method "${o}"`);Ce.prototype[o]&&n.warn("NDElement.extend",`Overwriting existing prototype method "${o}"`),Ce.prototype[o]=s}else n.warn("NDElement.extend",`"${o}" is not a function, skipping`)}return Ce};const Ae={configurable:!0,get(){return new Ce(this)}};Object.defineProperty(HTMLElement.prototype,"nd",Ae),Object.defineProperty(DocumentFragment.prototype,"nd",Ae),Object.defineProperty(Ce.prototype,"nd",{configurable:!0,get:function(){return this}}),["Click","DblClick","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","Wheel","KeyDown","KeyPress","KeyUp","Blur","Change","Focus","Input","Invalid","Reset","Search","Select","Submit","Drag","DragEnd","DragEnter","DragLeave","DragOver","DragStart","Drop","AfterPrint","BeforePrint","BeforeUnload","Error","HashChange","Load","Offline","Online","PageHide","PageShow","Resize","Scroll","Unload","Abort","CanPlay","CanPlayThrough","DurationChange","Emptied","Ended","LoadedData","LoadedMetadata","LoadStart","Pause","Play","Playing","Progress","RateChange","Seeked","Seeking","Stalled","Suspend","TimeUpdate","VolumeChange","Waiting","TouchCancel","TouchEnd","TouchMove","TouchStart","AnimationEnd","AnimationIteration","AnimationStart","TransitionEnd","Copy","Cut","Paste","FocusIn","FocusOut","ContextMenu"].forEach(e=>{const t=e.toLowerCase();Ce.prototype["on"+e]=function(e=null,n={}){return this.$element.addEventListener(t,e,{signal:this.$getSignal(),...n}),this}}),["Click","DblClick","MouseDown","MouseMove","MouseOut","MouseOver","MouseUp","Wheel","KeyDown","KeyPress","KeyUp","Change","Input","Invalid","Reset","Search","Select","Submit","Drag","DragEnd","DragEnter","DragLeave","DragOver","DragStart","Drop","BeforeUnload","HashChange","TouchCancel","TouchEnd","TouchMove","TouchStart","AnimationEnd","AnimationIteration","AnimationStart","TransitionEnd","Copy","Cut","Paste","FocusIn","FocusOut","ContextMenu"].forEach(e=>{const t=e.toLowerCase();Ce.prototype["onStop"+e]=function(e=null,n={}){return _e(this.$element,t,e,{signal:this.$getSignal(),...n}),this},Ce.prototype["onPreventStop"+e]=function(e=null,n={}){return xe(this.$element,t,e,{signal:this.$getSignal(),...n}),this}}),["Click","DblClick","MouseDown","MouseUp","Wheel","KeyDown","KeyPress","Invalid","Reset","Submit","DragOver","Drop","BeforeUnload","TouchCancel","TouchEnd","TouchMove","TouchStart","Copy","Cut","Paste","ContextMenu"].forEach(e=>{const t=e.toLowerCase();Ce.prototype["onPrevent"+e]=function(e=null,n={}){return Ee(this.$element,t,e,{signal:this.$getSignal(),...n}),this}}),Ce.prototype.$getSignal=function(){return this.$controller||(this.$controller=new AbortController,this.beforeUnmount("abort-controller",()=>{this.$controller.abort(),this.$controller=null})),this.$controller.signal},Ce.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,{signal:this.$getSignal(),...n}),this},Ce.prototype.off=function(e,t){return this.$element.removeEventListener(e.toLowerCase(),t),this},Ce.prototype.once=function(e,t){return this.$element.addEventListener(e.toLowerCase(),t,{signal:this.$getSignal(),once:!0}),this},Ce.prototype.emit=function(e,t=null){const n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.$element.dispatchEvent(n),this};const Ee=function(e,t,n,r){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)},r),this},_e=function(e,t,n,r){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)},r),this},xe=function(e,t,n,r){return e.addEventListener(t,t=>{t.stopPropagation(),t.preventDefault(),n&&n.call(e,t)},r),this},Ne={getClasses(){return this.$element.className?.split(" ").filter(Boolean)},add(e){const t=this.getClasses();t.indexOf(e)>=0||(t.push(e),this.$element.className=t.join(" "))},remove(e){const t=this.getClasses(),n=t.indexOf(e);n<0||(t.splice(n,1),this.$element.className=t.join(" "))},toggle(e,t=void 0){const n=this.getClasses(),r=n.indexOf(e);if(r>=0){if(!0===t)return;n.splice(r,1)}else{if(!1===t)return;n.push(e)}this.$element.className=n.join(" ")},contains(e){return this.getClasses().indexOf(e)>=0}};function Fe(e){this.$hydrate=e}Object.defineProperty(HTMLElement.prototype,"classes",{configurable:!0,get(){return{$element:this,...Ne}}}),DocumentFragment.prototype.__IS_FRAGMENT=!0,Function.prototype.args=function(...e){return this},Function.prototype.errorBoundary=function(e){const t=(...n)=>{try{return this.apply(this,n)}catch(r){return e(r,{caller:t,args:n})}};return t},Fe.prototype.__$isTemplateBinding=!0,Ce.$getChild=ye.getChild,String.prototype.toNdElement=function(){return ye.createStaticTextNode(null,this)},Number.prototype.toNdElement=function(){return ye.createStaticTextNode(null,this.toString())},Element.prototype.toNdElement=function(){return this},Text.prototype.toNdElement=function(){return this},Comment.prototype.toNdElement=function(){return this},Document.prototype.toNdElement=function(){return this},DocumentFragment.prototype.toNdElement=function(){return this},y.prototype.toNdElement=function(){return ye.createObservableNode(null,this)},Q.prototype.toNdElement=y.prototype.toNdElement,Ce.prototype.toNdElement=function(){const e=this.$element??this.$build?.()??this.build?.()??null;return this.$attachements?(this.$attachements.contains(this.$element)||this.$attachements.append(this.$element),this.$attachements):e},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=ye.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return ye.getChild(this())},Fe.prototype.toNdElement=function(){return ye.createHydratableNode(null,this)};const De=(e,t=1e3)=>new Promise(n=>{let r=!1;const o=t=>{t&&t.target!==e||r||(r=!0,e.removeEventListener("transitionend",o),e.removeEventListener("animationend",o),clearTimeout(s),n())};e.addEventListener("transitionend",o),e.addEventListener("animationend",o);const s=setTimeout(o,t),i=window.getComputedStyle(e),a="0s"!==i.transitionDuration,l="0s"!==i.animationDuration;a||l||o()});Ce.prototype.transitionOut=function(e){const t=e+"-exit",n=this.$element;return this.beforeUnmount("transition-exit",async function(){n.classes.add(t),await De(n),n.classes.remove(t)}),this},Ce.prototype.transitionIn=function(e){const t=e+"-enter-from",n=e+"-enter-to",r=this.$element;return r.classes.add(t),this.mounted(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.classes.remove(t),r.classes.add(n),De(r).then(()=>{r.classes.remove(n)})})})}),this},Ce.prototype.transition=function(e){return this.transitionIn(e),this.transitionOut(e),this},Ce.prototype.animate=function(e){const t=this.$element;return t.classes.add(e),De(t).then(()=>{t.classes.remove(e)}),this},y.prototype.handleNdAttribute=function(e,t){u.has(t)?de(e,t,this):fe(e,t,this)},Q.prototype.handleNdAttribute=y.prototype.handleNdAttribute,Fe.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const Me=e=>e?e.toNdElement():ye.createTextNode(),Te=(e,t,n=null)=>{let{props:r,children:o=null}=we(t,n);return ye.processAttributes(e,r),ye.processChildren(o,e),e};function ke(e,t=null){if(e){if(t){let n=null,r=(o,s)=>(n=document.createElement(e),r=(e,r)=>Te(t(n.cloneNode()),e,r),Te(t(n.cloneNode()),o,s));return(e,t)=>r(e,t)}let n=null,r=(t,o)=>(n=document.createElement(e),r=(e,t)=>Te(n.cloneNode(),e,t),Te(n.cloneNode(),t,o));return(e,t)=>r(e,t)}return(e,t="")=>{const n=ve(t);return n.append(e),n}}function Pe(e){this.$element=e,this.$classes=null,this.$styles=null,this.$attrs=null,this.$ndMethods=null}Ce.prototype.attach=function(e,t){if("function"==typeof t){const n=this.$element;return n.nodeCloner=n.nodeCloner||new Pe(n),n.nodeCloner.attach(e,t),n}return t.$hydrate(this.$element,e),this.$element},Pe.prototype.__$isNodeCloner=!0;const Le=(e,t,n)=>{for(const r in t)e[r]=t[r].apply(null,n);return e};Pe.prototype.resolve=function(){if(this.$content)return;const e=[];if(this.$ndMethods){const t=Object.keys(this.$ndMethods);if(1===t.length){const n=t[0],r=this.$ndMethods[n];e.push((e,t)=>{e.nd[n](r.bind(e,...t))})}else e.push((e,t)=>{const n=e.nd;for(const r in this.$ndMethods)n[r](this.$ndMethods[r].bind(e,...t))})}if(this.$classes){const t={},n=Object.keys(this.$classes);if(1===n.length){const r=n[0],o=this.$classes[r];e.push((e,n)=>{t[r]=o.apply(null,n),ye.processClassAttribute(e,t)})}else e.push((e,n)=>{ye.processClassAttribute(e,Le(t,this.$classes,n))})}if(this.$styles){const t={},n=Object.keys(this.$styles);if(1===n.length){const r=n[0],o=this.$styles[r];e.push((e,n)=>{t[r]=o.apply(null,n),ye.processStyleAttribute(e,t)})}else e.push((e,n)=>{ye.processStyleAttribute(e,Le(t,this.$styles,n))})}if(this.$attrs){const t={},n=Object.keys(this.$attrs);if(1===n.length){const r=n[0],o=this.$attrs[r];e.push((e,n)=>{t[r]=o.apply(null,n),ye.processAttributes(e,t)})}else e.push((e,n)=>{ye.processAttributes(e,Le(t,this.$attrs,n))})}const t=e.length,n=this.$element;this.cloneNode=r=>{const o=n.cloneNode(!1);for(let n=0;n<t;n++)e[n](o,r);return o}},Pe.prototype.cloneNode=function(e){return this.$element.cloneNode(!1)},Pe.prototype.attach=function(e,t){return this.$ndMethods=this.$ndMethods||{},this.$ndMethods[e]=t,this},Pe.prototype.text=function(e){return this.$content=e,"function"==typeof e?(this.cloneNode=t=>Me(e.apply(null,t)),this):(this.cloneNode=t=>Me(t[0][e]),this)},Pe.prototype.attr=function(e,t){return"class"===e?(this.$classes=this.$classes||{},this.$classes[t.property]=t.value,this):"style"===e?(this.$styles=this.$styles||{},this.$styles[t.property]=t.value,this):(this.$attrs=this.$attrs||{},this.$attrs[e]=t.value,this)};function Ie(e){let t=null;const n=e=>{const t=e.childNodes;let r=!!e.nodeCloner;const o=t.length;for(let e=0;e<o;e++){const o=t[e];o.nodeCloner&&(r=!0);n(o)&&(r=!0)}return r?e.nodeCloner?(e.nodeCloner.resolve(),e.dynamicCloneNode=n=>{const r=e.nodeCloner.cloneNode(n);for(let e=0;e<o;e++)r.appendChild(t[e].dynamicCloneNode(n));return r}):e.dynamicCloneNode=n=>{const r=e.cloneNode();for(let e=0;e<o;e++)r.appendChild(t[e].dynamicCloneNode(n));return r}:e.dynamicCloneNode=e.cloneNode.bind(e,!0),r};this.clone=r=>{const o=Re(this);return t=e(o),t.nodeCloner||(t.nodeCloner=new Pe(t)),n(t),this.clone=t.dynamicCloneNode,t.dynamicCloneNode(r)};const r=(e,t)=>new Fe((n,r)=>{!function(e,t,n,r){n.nodeCloner=n.nodeCloner||new Pe(n),"value"!==t?"attach"!==t?n.nodeCloner.attr(t,{property:r,value:e}):n.nodeCloner.attach(r,e):n.nodeCloner.text(e)}(e,t,n,r)});this.style=e=>r(e,"style"),this.class=e=>r(e,"class"),this.property=e=>this.value(e),this.value=e=>r(e,"value"),this.text=this.value,this.attr=e=>r(e,"attributes"),this.attach=e=>r(e,"attach"),this.callback=this.attach}const Re=e=>new Proxy(e,{get:(e,t)=>t in e||"symbol"==typeof t?e[t]:e.value(t)});function Ve(e){let t=null,n=null;this.render=r=>{if(t||(t=e(this)),!n)return t;for(const e in n){(0,n[e])(...r)}return t},this.createSection=(e,t)=>{n=n||{};const r=ve("Component "+e);return n[e]=function(...e){r.removeChildren(),t?r.appendChild(t(...e)):r.append(e)},r}}const je=function(e={}){let t=l.isString(e)?e.split(";").filter(Boolean):e;return{add(e,n){if(Array.isArray(t))t.push(e+": "+n);else if(l.isObject(e)){n=e;for(const e in n)t[e]=n[e]}else t[e]=n},value:()=>Array.isArray(t)?t.join(";").concat(";"):{...t}}},Be=function(e=[]){let t=l.isString(e)?e.split(" ").filter(Boolean):e;return{add(e,n=!0){if(l.isJson(e))for(const n in e)e[n]&&(t[n]=e[n]);else if(null!=n||e.__$Observable)if(Array.isArray(t)&&(t=t.reduce((e,t)=>(e[t]=!0,e),{})),e.__$Observable){const n=`obs-${Math.random().toString(36).substr(2,9)}`;t[n]=e}else t[e]=n;else Array.isArray(t)?t.push(e):t[e]=n},value:()=>Array.isArray(t)?t.join(" "):{...t}}},We=e=>{let t=null;return(...n)=>(null!=t||(t=e(...n)),t)},qe=e=>{let t=null;return new Proxy({},{get:(n,r)=>(t||(t=e()),t[r])})},Ue=e=>{const t=new Map;return new Proxy({},{get:(n,r)=>{const o=t.get(r);if(o)return o;if(e.length>0)return(...n)=>{const o=e(...n,r);return t.set(r,o),o};const s=e(r);return t.set(r,s),s}})},He=function(){const e=new Map,t=new Map,o=(t,o)=>{const s=e.get(o);if(!s)throw n.error("Store",`Store.${t}('${o}') : store not found. Did you call Store.create('${o}') first?`),new r(`Store.${t}('${o}') : store not found.`);return s},s=(e,t={})=>Array.isArray(e)?le.array(e,t):"object"==typeof e?le.object(e,t):le(e,t);return new Proxy({create(t,o){if(e.has(t))throw n.warn("Store",`Store.create('${t}') : a store with this name already exists. Use Store.get('${t}') to retrieve it.`),new r(`Store.create('${t}') : a store with this name already exists.`);const i=s(o);return e.set(t,{observer:i,subscribers:new Set,resettable:!1,composed:!1}),i},createResettable(t,o){if(e.has(t))throw n.warn("Store",`Store.createResettable('${t}') : a store with this name already exists.`),new r(`Store.createResettable('${t}') : a store with this name already exists.`);const i=s(o,{reset:!0});return e.set(t,{observer:i,subscribers:new Set,resettable:!0,composed:!1}),i},createComposed(t,o,s){if(e.has(t))throw n.warn("Store",`Store.createComposed('${t}') : a store with this name already exists.`),new r(`Store.createComposed('${t}') : a store with this name already exists.`);if("function"!=typeof o)throw new r(`Store.createComposed('${t}') : computation must be a function.`);if(!Array.isArray(s)||0===s.length)throw new r(`Store.createComposed('${t}') : dependencies must be a non-empty array of store names.`);const i=s.map(o=>{if("string"!=typeof o)return o;const s=e.get(o);if(!s)throw n.error("Store",`Store.createComposed('${t}') : dependency '${o}' not found. Create it first.`),new r(`Store.createComposed('${t}') : dependency store '${o}' not found.`);return s.observer}),a=le.computed(o,i);return e.set(t,{observer:a,subscribers:new Set,resettable:!1,composed:!0}),a},has:t=>e.has(t),reset(e){const t=o("reset",e);if(t.composed)throw n.error("Store",`Store.reset('${e}') : composed stores cannot be reset. Their value is derived from dependencies.`),new r(`Store.reset('${e}') : composed stores cannot be reset.`);if(!t.resettable)throw n.error("Store",`Store.reset('${e}') : this store is not resettable. Use Store.createResettable('${e}', value) instead of Store.create().`),new r(`Store.reset('${e}') : this store is not resettable. Use Store.createResettable('${e}', value) instead of Store.create().`);t.observer.reset()},use(e){const t=o("use",e);if(t.composed)throw n.error("Store",`Store.use('${e}') : composed stores are read-only. Use Store.follow('${e}') instead.`),new r(`Store.use('${e}') : composed stores are read-only. Use Store.follow('${e}') instead.`);const{observer:i,subscribers:a}=t,l=s(i.val()),u=e=>l.set(e),c=e=>i.set(e);return i.subscribe(u),l.subscribe(c),l.destroy=()=>{i.unsubscribe(u),l.unsubscribe(c),a.delete(l),l.cleanup()},l.dispose=l.destroy,a.add(l),l},follow(e){const{observer:t,subscribers:i}=o("follow",e),a=s(t.val()),l=e=>a.set(e);return t.subscribe(l),((e,t,o)=>{const s=e=>()=>{throw n.error("Store",`Store.${o}('${t}') is read-only. '${e}()' is not allowed.`),new r(`Store.${o}('${t}') is read-only.`)};e.set=s("set"),e.toggle=s("toggle"),e.reset=s("reset")})(a,e,"follow"),a.destroy=()=>{t.unsubscribe(l),i.delete(a),a.cleanup()},a.dispose=a.destroy,i.add(a),a},get(t){const r=e.get(t);return r?r.observer:(n.warn("Store",`Store.get('${t}') : store not found.`),null)},getWithSubscribers:t=>e.get(t)??null,delete(t){const r=e.get(t);r?(r.subscribers.forEach(e=>e.destroy()),r.subscribers.clear(),r.observer.cleanup(),e.delete(t)):n.warn("Store",`Store.delete('${t}') : store not found, nothing to delete.`)},group(e,t){"function"==typeof e&&(t=e,e="anonymous");const n=He();return t&&t(n),n},createPersistent(e,t,n){n=n||e;const r=this.create(e,m(n,t)),o=b(t);return r.subscribe(e=>o(n,e)),r},createPersistentResettable(e,t,n){n=n||e;const r=this.createResettable(e,m(n,t)),o=b(t);r.subscribe(e=>o(n,e));const s=r.reset.bind(r);return r.reset=()=>{f.remove(n),s()},r}},{get(e,n){if("symbol"==typeof n||n.startsWith("$")||n in e)return e[n];if(e.has(n)){if(t.has(n))return t.get(n);const r=e.follow(n);return t.set(n,r),r}},set(e,t,o){throw n.error("Store",`Forbidden: You cannot overwrite the store key '${String(t)}'. Use .use('${String(t)}').set(value) instead.`),new r("Store structure is immutable. Use .set() on the observable.")},deleteProperty(e,t){throw new r("Store keys cannot be deleted.")}})},ze=He();ze.create("locale",navigator.language.split("-")[0]||"en");const Ge=e=>e;const Ke=new Set(["clear","push","unshift","replace"]),Je=e=>e;const Ye=function(e,t,{comment:r=null,shouldKeepInCache:o=!0}={}){if(!l.isObservable(e))return"boolean"==typeof e?e?ye.getChild(t):null:n.warn("ShowIf","ShowIf : condition must be an Observable or boolean / "+r,e);const s=ve("Show if : "+(r||""));let i=null;const a=()=>(i&&o||(i=ye.getChild(t),l.isFragment(i)&&(i=Array.from(i.childNodes))),i);return e.val()&&s.appendChild(a()),e.subscribe(e=>{e?s.appendChild(a()):s.remove()}),s},Qe=function(e,t,n=!0){if(!l.isObservable(e))throw new r("Toggle : condition must be an Observable");const o=ve("Match"),s=new Map,i=function(e){if(n&&s.has(e))return s.get(e);let r=t[e];return r?(r=ye.getChild(r),l.isFragment(r)&&(r=Array.from(r.children)),n&&s.set(e,r),r):null},a=e.val(),u=i(a);return u&&o.appendChild(u),e.subscribe(e=>{const t=i(e);o.remove(),t&&o.appendChild(t)}),o.nd.with({add(n,r,o=!1){t[n]=r,o&&e.set(n)},remove(r){n&&s.delete(r),e.set([...s.keys()].at(-1)??""),delete t[r]}})},Xe=function(e,t,n){if(!l.isObservable(e))throw new r("Toggle : condition must be an Observable");return Qe(e.toBoolean(),{true:t,false:n})},Ze=ke("div"),et=ke("span"),tt=ke("label"),nt=ke("p"),rt=nt,ot=ke("strong"),st=ke("h1"),it=ke("h2"),at=ke("h3"),lt=ke("h4"),ut=ke("h5"),ct=ke("h6"),ht=ke("br"),pt=ke("a"),dt=ke("pre"),ft=ke("code"),mt=ke("blockquote"),bt=ke("hr"),yt=ke("em"),gt=ke("small"),vt=ke("mark"),$t=ke("del"),wt=ke("ins"),St=ke("sub"),Ct=ke("sup"),Ot=ke("abbr"),At=ke("cite"),Et=ke("q"),_t=ke("dl"),xt=ke("dt"),Nt=ke("dd"),Ft=ke("form",e=>(e.submit=function(t){return"function"==typeof t?(e.onSubmit(e=>{e.preventDefault(),t(e)}),e):(this.setAttribute("action",t),e)},e.multipartFormData=function(){return this.setAttribute("enctype","multipart/form-data"),e},e.post=function(t){return this.setAttribute("method","post"),this.setAttribute("action",t),e},e.get=function(e){this.setAttribute("method","get"),this.setAttribute("action",e)},e)),Dt=ke("input"),Mt=ke("textarea"),Tt=Mt,kt=ke("select"),Pt=ke("fieldset"),Lt=ke("option"),It=ke("legend"),Rt=ke("datalist"),Vt=ke("output"),jt=ke("progress"),Bt=ke("meter"),Wt=ke("button"),qt=ke("main"),Ut=ke("section"),Ht=ke("article"),zt=ke("aside"),Gt=ke("nav"),Kt=ke("figure"),Jt=ke("figcaption"),Yt=ke("header"),Qt=ke("footer"),Xt=ke("img"),Zt=function(e,t){return Xt({src:e,...t})},en=ke("details"),tn=ke("summary"),nn=ke("dialog"),rn=ke("menu"),on=ke("ol"),sn=ke("ul"),an=ke("li"),ln=an,un=on,cn=sn,hn=ke("audio"),pn=ke("video"),dn=ke("source"),fn=ke("track"),mn=ke("canvas"),bn=ke("svg"),yn=ke("time"),gn=ke("data"),vn=ke("address"),$n=ke("kbd"),wn=ke("samp"),Sn=ke("var"),Cn=ke("wbr"),On=ke("caption"),An=ke("table"),En=ke("thead"),_n=ke("tfoot"),xn=ke("tbody"),Nn=ke("tr"),Fn=Nn,Dn=ke("th"),Mn=Dn,Tn=Dn,kn=ke("td"),Pn=kn;function Ln(e){let t=null,n=(r,o)=>(t=document.createElementNS("http://www.w3.org/2000/svg",e),n=(e,n)=>Te(t.cloneNode(),e,n),Te(t.cloneNode(),r,o));return(e,t)=>n(e,t)}const In=Ln("svg"),Rn=Ln("circle"),Vn=Ln("rect"),jn=Ln("ellipse"),Bn=Ln("line"),Wn=Ln("polyline"),qn=Ln("polygon"),Un=Ln("path"),Hn=Ln("text"),zn=Ln("tspan"),Gn=Ln("textPath"),Kn=Ln("g"),Jn=Ln("defs"),Yn=Ln("use"),Qn=Ln("symbol"),Xn=Ln("clipPath"),Zn=Ln("mask"),er=Ln("marker"),tr=Ln("pattern"),nr=Ln("image"),rr=Ln("foreignObject"),or=Ln("switch"),sr=Ln("linearGradient"),ir=Ln("radialGradient"),ar=Ln("stop"),lr=Ln("filter"),ur=Ln("feBlend"),cr=Ln("feColorMatrix"),hr=Ln("feComposite"),pr=Ln("feFlood"),dr=Ln("feGaussianBlur"),fr=Ln("feMerge"),mr=Ln("feMergeNode"),br=Ln("feOffset"),yr=Ln("feTurbulence"),gr=Ln("feDisplacementMap"),vr=Ln("feDiffuseLighting"),$r=Ln("feSpecularLighting"),wr=Ln("feDistantLight"),Sr=Ln("fePointLight"),Cr=Ln("feSpotLight"),Or=Ln("feMorphology"),Ar=Ln("feConvolveMatrix"),Er=Ln("feComponentTransfer"),_r=Ln("feFuncR"),xr=Ln("feFuncG"),Nr=Ln("feFuncB"),Fr=Ln("feFuncA"),Dr=Ln("animate"),Mr=Ln("animateTransform"),Tr=Ln("animateMotion"),kr=Ln("mpath"),Pr=Ln("set"),Lr=Ln("desc"),Ir=Ln("title"),Rr=Ln("metadata"),Vr=Ln("view"),jr=Ln("style"),Br=Ln("script"),Wr=ke("");var qr=Object.freeze({__proto__:null,Abbr:Ot,Address:vn,Anchor:ve,Article:Ht,Aside:zt,AsyncImg:function(e,t,n,o){const s=l.isObservable(e)?e.val():e,i=Zt(t||s,n),a=new Image;return a.onload=()=>{l.isFunction(o)&&o(null,i),i.src=l.isObservable(e)?e.val():e},a.onerror=()=>{l.isFunction(o)&&o(new r("Image not found"))},l.isObservable(e)&&e.subscribe(e=>{a.src=e}),a.src=s,i},Audio:hn,BaseImage:Xt,Blockquote:mt,Br:ht,Button:Wt,Canvas:mn,Caption:On,Checkbox:e=>Dt({type:"checkbox",...e}),Cite:At,Code:ft,ColorInput:e=>Dt({type:"color",...e}),Data:gn,Datalist:Rt,DateInput:e=>Dt({type:"date",...e}),DateTimeInput:e=>Dt({type:"datetime-local",...e}),Dd:Nt,Del:$t,Details:en,Dialog:nn,Div:Ze,Dl:_t,Dt:xt,Em:yt,EmailInput:e=>Dt({type:"email",...e}),FieldSet:Pt,FigCaption:Jt,Figure:Kt,FileInput:e=>Dt({type:"file",...e}),Footer:Qt,ForEach:function(e,t,o,{shouldKeepItemsInCache:s=!1}={}){t=t||Ge;const i=ve("ForEach"),a=i.endElement();i.startElement();let u=new Map,c=null;const h=new Set,p=e=>{if(!s)for(const[t,n]of u.entries()){if(h.has(t))continue;const r=n.child?.deref();e&&r&&r.remove(),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,u.delete(n.keyId),c&&c.delete(n.keyId)}},d=(e,s)=>{const i=((e,t,n)=>{if(l.isString(n)){const r=l.isObservable(e)?e.val():e,o=r?.[n];return l.isObservable(o)?o.val():o??t}return l.isFunction(n)?n(e,t):(l.isObservable(e)?e.val():e)??t})(e,s,o);if(u.has(i)){const e=u.get(i);if(e.indexObserver?.set(s),e.isNew=!1,e.child?.deref())return i;u.delete(i)}try{const n=t.length>=2?le(s):null;let o=ye.getChild(t(e,n));if(!o)throw new r("ForEach child can't be null or undefined!");u.set(i,{keyId:i,isNew:!0,child:new WeakRef(o),indexObserver:n})}catch(e){throw n.error("ForEach",`Error creating element for key ${i}`,e),e}return i},f=()=>{const t=a.parentNode;if(!t)return;const n=l.isObservable(e)?e.val():e;if(h.clear(),Array.isArray(n))for(let e=0,t=n.length;e<t;e++){const t=d(n[e],e);h.add(t)}else for(const e in n){const t=d(n[e],e);h.add(t)}if(0===h.size)return i.removeChildren(),p(),void c?.clear();p(t),c&&0!==c.size?(()=>{let e=document.createDocumentFragment();const t=Array.from(h);Array.from(c);for(const n in t){const r=t[n],o=u.get(r);if(!o)continue;const s=o.child.deref();s&&e.appendChild(s)}i.replaceContent(e)})():(e=>{const t=document.createDocumentFragment();for(const e of h){const n=u.get(e);if(!n)continue;const r=n.child?.deref();r&&t.appendChild(r)}e.insertBefore(t,a)})(t),c?.clear(),c=new Set([...h])};return f(),l.isObservable(e)&&e.subscribe(f),i},ForEachArray:function(e,t,n={}){t=t||Je;const r=ve("ForEach Array",n.isParentUniqueChild),o=r.endElement();let s=new Map,i=0;const a=t.length>=2,l=e=>{r.removeChildren(),f(e),i=0},u=e=>s.get(e)?.child,c=(e,t=!0)=>{const n=s.get(e);if(n){if(t){const t=n.child;t?.remove(),s.delete(e)}n.indexObserver?.cleanup()}},h=e=>{const n=ye.getChild(t(e,null));return s.set(e,{child:n,indexObserver:null}),n};let p=(n,r)=>{const o=e.transform(e=>e.indexOf(n)),i=ye.getChild(t(n,o));return s.set(n,{child:i,indexObserver:o}),i};e.__$Observable||(p=(e,n)=>{const r=ye.getChild(t(e,n));return s.set(e,{child:r,indexObserver:null}),r});const d=(e,t)=>{const n=s.get(e);return n?(n.indexObserver?.set(t),n.child):h(e)};let f,m=h;f=a?n.shouldKeepItemsInCache?()=>{}:e=>{for(const[t,n]of s.entries())e&&e.includes(t)||c(t,!1)}:s.clear.bind(s);const b=(e,t)=>{const n=s.get(e);if(!n)return null;const r=n.child;if(!r)return null;t?t.appendChild(r):r.remove()};let y=null;y=Array.isArray(e)?()=>{l(e),r.appendChildRaw(g.toFragment(e))}:()=>{const t=e.val();l(t),r.appendChildRaw(g.toFragment(t))};const g={toFragment:e=>{const t=document.createDocumentFragment();for(let n=0,r=e.length;n<r;n++)t.appendChild(m(e[n],i)),i++;return t},add:e=>{r.appendChildRaw(g.toFragment(e))},replace:e=>{l(e),r.appendChildRaw(g.toFragment(e))},set:y,reOrder:e=>{let t=null;const n=document.createDocumentFragment();for(const r of e)t=u(r),t&&n.appendChild(t);t=null,r.appendChildRaw(n)},removeOne:(e,t)=>{c(e,!0)},clear:l,populate:([e,t,n])=>{const o=document.createDocumentFragment();for(let r=0;r<t;r++){const t=n(r);e.push(t),o.append(m(t,r)),i++}r.appendChildRaw(o),o.replaceChildren()},unshift:e=>{r.insertAtStartRaw(g.toFragment(e))},splice:(t,n)=>{const[s,i,...a]=t;let l=null;const c=document.createDocumentFragment();if(n.length>0){let e=n[0];if(1===n.length)b(e,c);else if(n.length>1){const e=u(n[0]);l=e?.previousSibling;for(let e=0;e<n.length;e++)b(n[e],c)}}else{const t=s-1>=0?s-1:s,n=e.at(t);l=u(n)||o.previousSibling}c.replaceChildren(),a&&a.length&&l&&r.insertBeforeRaw(g.toFragment(a),l.nextSibling)},reverse:(e,t)=>{g.reOrder(t)},sort:(e,t)=>{g.reOrder(t)},remove:(e,t)=>{g.removeOne(t)},pop:(e,t)=>{g.removeOne(t)},shift:(e,t)=>{g.removeOne(t)},swap:(e,t)=>{const n=r.getParent();let o=u(t[0]),s=u(t[1]);if(!o||!s)return;const i=s.nextSibling;n.insertBefore(s,o),n.insertBefore(o,i),o=null,s=null}};g.merge=g.add,g.push=g.add;const v=(e,t,n={})=>{((e=null)=>{m=Ke.has(e)?a?p:h:s.size?d:a?p:h})(n.action),g[n.action]&&g[n.action](n.args,n.result)};return Array.isArray(e)?(v(0,0,{action:"set"}),r):(e.val().length&&v(e.val(),0,{action:"set"}),e.subscribe(v),r)},Form:Ft,Fragment:Wr,H1:st,H2:it,H3:at,H4:lt,H5:ut,H6:ct,Header:Yt,HiddenInput:e=>Dt({type:"hidden",...e}),HideIf:function(e,t,n){const r=le(!e.val());return e.subscribe(e=>r.set(!e)),Ye(r,t,n)},HideIfNot:function(e,t,n){return Ye(e,t,n)},Hr:bt,Img:Zt,Input:Dt,Ins:wt,Kbd:$n,Label:tt,LazyImg:function(e,t){return Zt(e,{...t,loading:"lazy"})},Legend:It,Li:ln,Link:pt,ListItem:an,Main:qt,Mark:vt,Match:Qe,Menu:rn,Meter:Bt,MonthInput:e=>Dt({type:"month",...e}),NativeDocumentFragment:ve,Nav:Gt,NumberInput:e=>Dt({type:"number",...e}),Ol:un,Option:Lt,OrderedList:on,Output:Vt,P:nt,Paragraph:rt,PasswordInput:e=>Dt({type:"password",...e}),Pre:dt,Progress:jt,Quote:Et,Radio:e=>Dt({type:"radio",...e}),RangeInput:e=>Dt({type:"range",...e}),ReadonlyInput:e=>Dt({readonly:!0,...e}),Samp:wn,SearchInput:e=>Dt({type:"search",...e}),Section:Ut,Select:kt,ShowIf:Ye,ShowWhen:function(){if(2===arguments.length){const[e,t]=arguments;if(!l.isObservableWhenResult(e))throw new r("showWhen observer must be an ObservableWhenResult",{data:e,help:"Use observer.when(target) to create an ObservableWhenResult"});return Ye(e,t)}if(3===arguments.length){const[e,t,n]=arguments;if(!l.isObservable(e))throw new r("showWhen observer must be an Observable",{data:e});return Ye(e.when(t),n)}throw new r("showWhen must have 2 or 3 arguments",{data:["showWhen(observer, target, view)","showWhen(observerWhenResult, view)"]})},SimpleButton:(e,t)=>Wt(e,{type:"button",...t}),Small:gt,Source:dn,Span:et,Strong:ot,Sub:St,SubmitButton:(e,t)=>Wt(e,{type:"submit",...t}),Summary:tn,Sup:Ct,Svg:bn,SvgAnimate:Dr,SvgAnimateMotion:Tr,SvgAnimateTransform:Mr,SvgCircle:Rn,SvgClipPath:Xn,SvgDefs:Jn,SvgDesc:Lr,SvgEllipse:jn,SvgFEBlend:ur,SvgFEColorMatrix:cr,SvgFEComponentTransfer:Er,SvgFEComposite:hr,SvgFEConvolveMatrix:Ar,SvgFEDiffuseLighting:vr,SvgFEDisplacementMap:gr,SvgFEDistantLight:wr,SvgFEFlood:pr,SvgFEFuncA:Fr,SvgFEFuncB:Nr,SvgFEFuncG:xr,SvgFEFuncR:_r,SvgFEGaussianBlur:dr,SvgFEMerge:fr,SvgFEMergeNode:mr,SvgFEMorphology:Or,SvgFEOffset:br,SvgFEPointLight:Sr,SvgFESpecularLighting:$r,SvgFESpotLight:Cr,SvgFETurbulence:yr,SvgFilter:lr,SvgForeignObject:rr,SvgG:Kn,SvgImage:nr,SvgLine:Bn,SvgLinearGradient:sr,SvgMPath:kr,SvgMarker:er,SvgMask:Zn,SvgMetadata:Rr,SvgPath:Un,SvgPattern:tr,SvgPolygon:qn,SvgPolyline:Wn,SvgRadialGradient:ir,SvgRect:Vn,SvgScript:Br,SvgSet:Pr,SvgStop:ar,SvgStyle:jr,SvgSvg:In,SvgSwitch:or,SvgSymbol:Qn,SvgTSpan:zn,SvgText:Hn,SvgTextPath:Gn,SvgTitle:Ir,SvgUse:Yn,SvgView:Vr,Switch:Xe,TBody:xn,TBodyCell:Pn,TFoot:_n,TFootCell:Tn,THead:En,THeadCell:Mn,TRow:Fn,Table:An,Td:kn,TelInput:e=>Dt({type:"tel",...e}),TextArea:Mt,TextInput:Tt,Th:Dn,Time:yn,TimeInput:e=>Dt({type:"time",...e}),Tr:Nn,Track:fn,Ul:cn,UnorderedList:sn,UrlInput:e=>Dt({type:"url",...e}),Var:Sn,Video:pn,Wbr:Cn,WeekInput:e=>Dt({type:"week",...e}),When:function(e){if(!l.isObservable(e))throw new r("When : condition must be an Observable");let t=null,n=null;return{show(e){return t=e,this},otherwise:r=>(n=r,Xe(e,t,n)),toNdElement:()=>Xe(e,t,n)}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=ve("Portal "+n);return r.appendChild(ye.getChild(e)),(t||document.body).appendChild(r),r}});const Ur={};function Hr(e,t,n={}){e="/"+p(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,a=n.with||{},l=n.layout||null,u={},c=[],h=e=>{if(!e)return null;const[t,n]=e.split(":");let r=a[t];return!r&&n&&(r=Ur[n]),r||(r="[^/]+"),r=r.replace("(","(?:"),{name:t,pattern:`(${r})`}},d=()=>{if(r)return r;const t=e.replace(/\{(.*?)}/gi,(e,t)=>{const n=h(t);return n&&n.pattern?(u[n.name]=n.pattern,c.push(n.name),n.pattern):e});return r=new RegExp("^"+t+"$"),r};this.name=()=>o,this.component=()=>t,this.middlewares=()=>s,this.shouldRebuild=()=>i,this.path=()=>e,this.layout=()=>l,this.match=function(e){e="/"+p(e,"/");if(!d().exec(e))return!1;const t={};return d().exec(e).forEach((e,n)=>{if(n<1)return;const r=c[n-1];t[r]=e}),t},this.url=function(t){const n=e.replace(/\{(.*?)}/gi,(e,n)=>{const r=h(n);if(t.params&&t.params[r.name])return t.params[r.name];throw new Error(`Missing parameter '${r.name}'`)}),r="object"==typeof t.query?new URLSearchParams(t.query).toString():null;return(t.basePath?t.basePath:"")+(r?`${n}?${r}`:n)}}class zr extends Error{constructor(e,t){super(e),this.context=t}}const Gr=(e,t)=>{const n=[];return e.forEach(e=>{n.push(p(e.suffix,"/"))}),n.push(p(t,"/")),n.join("/")},Kr=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},Jr=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},Yr=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Qr(){const e=[];let t=0;const n=n=>{const o=t+n;if(!e[o])return;t=o;const{route:s,params:i,query:a,path:l}=e[o];r(l)},r=e=>{window.location.replace(`${window.location.pathname}${window.location.search}#${e}`)},o=()=>window.location.hash.slice(1);this.push=function(n){const{route:s,params:i,query:a,path:l}=this.resolve(n);l!==o()&&(e.splice(t+1),e.push({route:s,params:i,query:a,path:l}),t++,r(l))},this.replace=function(n){const{route:r,params:s,query:i,path:a}=this.resolve(n);a!==o()&&(e[t]={route:r,params:s,query:i,path:a})},this.forward=function(){return t<e.length-1&&n(1)},this.back=function(){return t>0&&n(-1)},this.init=function(n){window.addEventListener("hashchange",()=>{const{route:e,params:t,query:n,path:r}=this.resolve(o());this.handleRouteChange(e,t,n,r)});const{route:r,params:s,query:i,path:a}=this.resolve(n||o());e.push({route:r,params:s,query:i,path:a}),t=0,this.handleRouteChange(r,s,i,a)}}function Xr(){this.push=function(e){try{const{route:t,path:n,params:r,query:o}=this.resolve(e);if(window.history.state&&window.history.state.path===n)return;window.history.pushState({name:t.name(),params:r,path:n},t.name()||n,n),this.handleRouteChange(t,r,o,n)}catch(e){n.error("HistoryRouter","Error in pushState",e)}},this.replace=function(e){const{route:t,path:r,params:o}=this.resolve(e);try{window.history.replaceState({name:t.name(),params:o,path:r},t.name()||r,r),this.handleRouteChange(t,o,{},r)}catch(e){n.error("HistoryRouter","Error in replaceState",e)}},this.forward=function(){window.history.forward()},this.back=function(){window.history.back()},this.init=function(e){window.addEventListener("popstate",e=>{try{if(!e.state||!e.state.path)return;const t=e.state.path,{route:n,params:r,query:o,path:s}=this.resolve(t);if(!n)return;this.handleRouteChange(n,r,o,s)}catch(e){n.error("HistoryRouter","Error in popstate event",e)}});const{route:t,params:r,query:o,path:s}=this.resolve(e||window.location.pathname+window.location.search);this.handleRouteChange(t,r,o,s)}}function Zr(){const e=[];let t=0;const n=n=>{const r=t+n;if(!e[r])return;t=r;const{route:o,params:s,query:i,path:a}=e[r];this.handleRouteChange(o,s,i,a)};this.push=function(n){const{route:r,params:o,query:s,path:i}=this.resolve(n);e[t]&&e[t].path===i||(e.splice(t+1),e.push({route:r,params:o,query:s,path:i}),t++,this.handleRouteChange(r,o,s,i))},this.replace=function(n){const{route:r,params:o,query:s,path:i}=this.resolve(n);e[t]={route:r,params:o,query:s,path:i},this.handleRouteChange(r,o,s,i)},this.forward=function(){return t<e.length-1&&n(1)},this.back=function(){return t>0&&n(-1)},this.init=function(n){const r=n||window.location.pathname+window.location.search,{route:o,params:s,query:i,path:a}=this.resolve(r);e.push({route:o,params:s,query:i,path:a}),t=0,this.handleRouteChange(o,s,i,a)}}function eo(e,t){const n=new Map,r=new WeakMap,o=new WeakMap;let s=null,i=null;const a=(e,t)=>{const n=o.get(e);if(n)return n;let r=e;return l.isAnchor(e)||(r=ve(t),r.appendChild(e)),o.set(e,r),r},u=()=>{i?.remove()},c=()=>{t.nodeValue="",u(),s&&s.remove()},h=e=>{let t=e;return l.isNDElement(e)&&(t=e.node()),t},p=function(e,n,o){const l=n.layout();if(l)return void((e,n,o,l)=>{let p=h(n);const d=r.get(p);if(d){if(d===s){const e=a(p,l);return u(),i=p,void e.replaceContent(p)}return c(),i=p,s=d,a(p,l).replaceContent(p),void t.appendChild(s)}c(),i=p;const f=a(p,l);s=ye.getChild(e(f)),r.set(p,s),t.appendChild(s)})(l,e,0,o);let p=h(e);c(),t.appendChild(p),i=e},d=function(e){if(!e.route)return;const{route:t,params:r,query:o,path:s}=e;if(n.has(s)){const e=n.get(s);return void p(e,t)}const i=t.component()({params:r,query:o});n.set(s,i),p(i,t,s)};return e.subscribe(d),d(e.currentState()),t}const to="default";function no(e={}){const t=[],r={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Qr.apply(this,[]);else if("history"===e.mode)Xr.apply(this,[]);else{if("memory"!==e.mode)throw new zr("Invalid router mode "+e.mode);Zr.apply(this,[])}const a=function(e,t){for(const r of s)try{r(e),t&&t(e)}catch(e){n.warn("Route Listener","Error in listener:",e)}};this.routes=()=>[...t],this.currentState=()=>({...i}),this.add=function(e,n,s){const i=new Hr(Gr(o,e),n,{...s,middlewares:Kr(o,s?.middlewares||[]),name:s?.name?Jr(o,s.name):null,layout:s?.layout||Yr(o)});return t.push(i),i.name()&&(r[i.name()]=i),this},this.group=function(e,t,n){if(!l.isFunction(n))throw new zr("Callback must be a function");return o.push({suffix:e,options:t}),n(),o.pop(),this},this.generateUrl=function(e,t={},n={}){const o=r[e];if(!o)throw new zr(`Route not found for name: ${e}`);return o.url({params:t,query:n})},this.resolve=function(e){if("string"==typeof e){const t=r[e];if(t)return{route:t,params:[],query:[],path:t.url({name:e})}}if(l.isJson(e)){const t=r[e.name];if(!t)throw new zr(`Route not found for name: ${e.name}`);return{route:t,params:e.params,query:e.query,path:t.url({...e})}}const[n,o]=e.split("?"),s="/"+p(n,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new zr(`Route not found for url: ${n}`);const u={};if(o){const e=new URLSearchParams(o).entries();for(const[t,n]of e)u[t]=n}return{route:a,params:i,query:u,path:e}},this.subscribe=function(e){if(!l.isFunction(e))throw new zr("Listener must be a function");return s.push(e),()=>{s.splice(s.indexOf(e),1)}},this.handleRouteChange=function(e,t,n,r){i.route=e,i.params=t,i.query=n,i.path=r;const o=[...e.middlewares(),a];let s=0;const l={...i},u=e=>{if(s++,!(s>=o.length))return o[s](e||l,u)};return o[s](l,u)}}function ro(e,t){const{to:n,href:r,...o}=e;if(r){const e=no.get();return pt({...o,href:r},t).nd.onPreventClick(()=>{e.push(r)})}const s="string"==typeof n?{name:n}:n,i=s.router||to,a=no.get(i);if(!a)throw new zr('Router not found "'+i+'" for link "'+s.name+'"');const l=a.generateUrl(s.name,s.params,s.query);return pt({...o,href:l},t).nd.onPreventClick(()=>{a.push(l)})}no.routers={},no.create=function(e,t){if(!l.isFunction(t))throw n.error("Router","Callback must be a function"),new zr("Callback must be a function");const r=new no(e);return no.routers[e.name||to]=r,t(r),r.init(e.entry),r.mount=function(e){if(l.isString(e)){const t=document.querySelector(e);if(!t)throw new zr(`Container not found for selector: ${e}`);e=t}else if(!l.isElement(e))throw new zr("Container must be a string or an Element");return eo(r,e)},r},no.get=function(e){const t=no.routers[e||to];if(!t)throw new zr(`Router not found for name: ${e}`);return t},no.push=function(e,t=null){return no.get(t).push(e)},no.replace=function(e,t=null){return no.get(t).replace(e)},no.forward=function(e=null){return no.get(e).forward()},no.back=function(e=null){return no.get(e).back()},no.redirectTo=function(e,t=null,n=null){let r=e;const o=no.get(n);return o.resolve({name:e,params:t})&&(r={name:e,params:t}),o.push(r)},ro.blank=function(e,t){return pt({...e,target:"_blank"},t)};var oo=Object.freeze({__proto__:null,Link:ro,RouteParamPatterns:Ur,Router:no});var so=Object.freeze({__proto__:null,memoize:e=>Ue(e),once:e=>qe(e),singleton:e=>We(e)}),io=Object.freeze({__proto__:null,Cache:so,NativeFetch:function(e){const t={request:[],response:[]};this.interceptors={response:e=>{t.response.push(e)},request:e=>{t.request.push(e)}},this.fetch=async function(n,r,o={},s={}){if(s.formData){const e=new FormData;for(const t in o)e.append(t,o[t]);o=e}r.startsWith("http")||(r=(e.endsWith("/")?e:e+"/")+r);let i={method:n,headers:{...s.headers||{}}};if(o)if(o instanceof FormData)i.body=o;else if("GET"!==n)i.headers["Content-Type"]="application/json",i.body=JSON.stringify(o);else{const e=new URLSearchParams(o).toString();e&&(r=r+(r.includes("?")?"&":"?")+e)}for(const e of t.request)i=await e(i,r)||i;let a=await fetch(r,i);for(const e of t.response)a=await e(a,r)||a;const l=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok){const e=new Error(l?.message||a.statusText);throw e.status=a.status,e.data=l,e}return l},this.post=function(e,t={},n={}){return this.fetch("POST",e,t,n)},this.put=function(e,t={},n={}){return this.fetch("PUT",e,t,n)},this.delete=function(e,t={},n={}){return this.fetch("DELETE",e,t,n)},this.get=function(e,t={},n={}){return this.fetch("GET",e,t,n)}},classPropertyAccumulator:Be,cssPropertyAccumulator:je,filters:U});return e.$=ue,e.ElementCreator=ye,e.HtmlElementWrapper=ke,e.NDElement=Ce,e.Observable=le,e.PluginsManager=null,e.SingletonView=Ve,e.Store=ze,e.StoreFactory=He,e.TemplateCloner=Ie,e.Validator=l,e.autoMemoize=Ue,e.autoOnce=qe,e.classPropertyAccumulator=Be,e.createTextNode=Me,e.cssPropertyAccumulator=je,e.elements=qr,e.memoize=e=>{const t=new Map;return(...n)=>{const[r,...o]=n,s=t.get(r);if(s)return s;const i=e(...o);return t.set(r,i),i}},e.normalizeComponentArgs=we,e.obs=ce,e.once=We,e.router=oo,e.useCache=function(e){let t=null,n=r=>{t=new Ie(e);const o=t.clone(r);return n=t.clone,o};return e.length<2?(...e)=>n(e):(e,t,...r)=>n([e,t,...r])},e.useSingleton=function(e){let t=null;return function(...n){return t||(t=new Ve(e)),t.render(n)}},e.utils=io,e.withValidation=$e,e}({});
|
|
1
|
+
var NativeDocument=function(e){"use strict";let t={};t={log(){},warn(){},error(){},disable(){}};var n=t;class r extends Error{constructor(e,t={}){super(e),this.name="NativeDocumentError",this.context=t,this.timestamp=(new Date).toISOString()}}const o=3,s=8,i=11,a=[];a[1]=!0,a[o]=!0,a[i]=!0,a[s]=!0;const l={isObservable:e=>e&&(e.__$isObservable||e.__$Observable),isTemplateBinding:e=>e?.__$isTemplateBinding,isObservableWhenResult:e=>e&&(e.__$isObservableWhen||"object"==typeof e&&"$target"in e&&"$observer"in e),isArrayObservable:e=>e?.__$isObservableArray,isProxy:e=>e?.__isProxy__,isObservableOrProxy:e=>l.isObservable(e)||l.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker,isArray:e=>Array.isArray(e),isString:e=>"string"==typeof e,isNumber:e=>"number"==typeof e,isBoolean:e=>"boolean"==typeof e,isFunction:e=>"function"==typeof e,isAsyncFunction:e=>"function"==typeof e&&"AsyncFunction"===e.constructor.name,isObject:e=>"object"==typeof e&&null!==e,isJson:e=>!("object"!=typeof e||null===e||Array.isArray(e)||"Object"!==e.constructor.name),isElement:e=>e&&a[e.nodeType],isDOMNode:e=>a[e.nodeType],isFragment:e=>e?.nodeType===i,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||e.__$Observable||e?.__$isNDElement||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement,isValidChildren(e){Array.isArray(e)||(e=[e]);return 0===e.filter(e=>!this.isValidChild(e)).length},validateChildren(e){Array.isArray(e)||(e=[e]);const t=e.filter(e=>!this.isValidChild(e));if(t.length>0)throw new r(`Invalid children detected: ${t.map(e=>typeof e).join(", ")}`);return e},containsObservables:e=>!!e&&(l.isObject(e)&&Object.values(e).some(e=>l.isObservable(e))),containsObservableReference:e=>!(!e||"string"!=typeof e)&&/\{\{#ObItem::\([0-9]+\)\}\}/.test(e),validateAttributes(e){},validateEventCallback(e){if("function"!=typeof e)throw new r("Event callback must be a function")}},u=new Set(["checked","selected","disabled","readonly","required","autofocus","multiple","autocomplete","hidden","contenteditable","spellcheck","translate","draggable","async","defer","autoplay","controls","loop","muted","download","reversed","open","default","formnovalidate","novalidate","scoped","itemscope","allowfullscreen","allowpaymentrequest","playsinline"]),c=function(){let e=0;const t=new Map;return{register(n){const r=++e;return t.set(r,new WeakRef(n)),r},unregister(e){t.delete(e)},getObservableById:e=>t.get(e)?.deref(),cleanup(){for(const[e,n]of t){const e=n.deref();e&&e.cleanup()}t.clear()},cleanObservables(e){if(t.size<e)return;let r=0;for(const[e,n]of t)n.deref()||(t.delete(e),r++);r>0&&n.log("Memory Auto Clean",`🧹 Cleaned ${r} orphaned observables`)}}}();const h=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}},p=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},d=(e,t)=>{try{if(void 0!==window.structuredClone)return window.structuredClone(e)}catch(e){}if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(e=>d(e));if(l.isObservable(e))return t&&t(e),e;const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=d(e[t]));return n},f={getJson(e){let t=localStorage.getItem(e);try{return JSON.parse(t)}catch(t){throw new r("invalid_json:"+e)}},getNumber(e){return Number(this.get(e))},getBool(e){const t=this.get(e);return"true"===t||"1"===t},setJson(e,t){localStorage.setItem(e,JSON.stringify(t))},setBool(e,t){localStorage.setItem(e,t?"true":"false")},get:(e,t=null)=>localStorage.getItem(e)||t,set:(e,t)=>localStorage.setItem(e,t),remove(e){localStorage.removeItem(e)},has:e=>null!=localStorage.getItem(e)},m=(e,t)=>{if(!f.has(e))return t;switch(typeof t){case"object":return f.getJson(e)??t;case"boolean":return f.getBool(e)??t;case"number":return f.getNumber(e)??t;default:return f.get(e,t)??t}},b=e=>{switch(typeof e){case"object":return f.setJson;case"boolean":return f.setBool;default:return f.set}};function y(e,t=null){e=l.isObservable(e)?e.val():e,this.$previousValue=null,this.$currentValue=e,this.$firstListener=null,this.$listeners=null,this.$watchers=null,this.$memoryId=null,t&&(this.configs=t,t.reset&&(this.$initialValue=l.isObject(e)?d(e):e))}Object.defineProperty(y.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),y.prototype.__$Observable=!0,y.prototype.__$isObservable=!0,y.computed=()=>{};const g=function(){};y.prototype.intercept=function(e){return this.$interceptor=e,this.set=this.$setWithInterceptor,this},y.prototype.interceptMutations=function(e){return this.$mutationInterceptor=e,this},y.prototype.triggerFirstListener=function(e){this.$firstListener(this.$currentValue,this.$previousValue,e)},y.prototype.triggerListeners=function(e){const t=this.$listeners,n=this.$previousValue,r=this.$currentValue;for(let o=0,s=t.length;o<s;o++)t[o](r,n,e)},y.prototype.triggerWatchers=function(e){const t=this.$watchers,n=this.$previousValue,r=this.$currentValue,o=t.get(r),s=t.get(n);o&&o(!0,n,e),s&&s(!1,r,e)},y.prototype.triggerAll=function(e){this.triggerWatchers(e),this.triggerListeners(e)},y.prototype.triggerWatchersAndFirstListener=function(e){this.triggerWatchers(e),this.triggerFirstListener(e)},y.prototype.assocTrigger=function(){if(this.$firstListener=null,this.$watchers?.size&&this.$listeners?.length)return this.$firstListener=this.$listeners[0],this.trigger=0===this.$firstListener.length?this.$firstListener:this.triggerFirstListener,void(this.trigger=1===this.$listeners.length?this.triggerWatchersAndFirstListener:this.triggerAll);this.$listeners?.length?1===this.$listeners.length?(this.$firstListener=this.$listeners[0],this.trigger=0===this.$firstListener.length?this.$firstListener:this.triggerFirstListener):this.trigger=this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=g},y.prototype.trigger=g;const v={action:"set"};function $(e){return e instanceof Date?e:new Date(e)}function w(e,t){const n=$(e),r=$(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function S(e){const t=$(e);return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}function C(e,t){const n=l.isObservable(e);return{dependencies:n?e:null,callback:r=>t(r,n?e.val():e)}}function O(e,t){const n=e.filter(l.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>l.isObservable(e)?e.val():e))}}function A(e){return C(e,(e,t)=>e===t)}function E(e){return C(e,(e,t)=>e!==t)}function _(e){return C(e,(e,t)=>e>t)}function x(e){return C(e,(e,t)=>e>=t)}function N(e){return C(e,(e,t)=>e<t)}function F(e){return C(e,(e,t)=>e<=t)}function D(e,t=!0,r=""){return O([e,t,r],(e,[t,r,o])=>{if(!t)return!0;if(r)try{return new RegExp(t,o).test(String(e))}catch(e){return n.warn("Invalid regex pattern:",t,e),!1}return o&&""!==o?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}function M(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(l.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.every(e=>e.callback(t))}}function T(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(l.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.some(e=>e.callback(t))}}y.prototype.$updateWithNewValue=function(e){e=e?.__$isObservable?e.val():e,this.$currentValue!==e&&(this.$previousValue=this.$currentValue,this.$currentValue=e,this.trigger(v),this.$previousValue=null)},y.prototype.$setWithInterceptor=function(e){let t="function"==typeof e?e(this.$currentValue):e;const n=this.$interceptor(t,this.$currentValue);void 0!==n&&(t=n),this.$updateWithNewValue(t)},y.prototype.$basicSet=function(e){let t="function"==typeof e?e(this.$currentValue):e;this.$updateWithNewValue(t)},y.prototype.set=y.prototype.$basicSet,y.prototype.val=function(){return this.$currentValue},y.prototype.disconnectAll=function(){this.$previousValue=null,this.$currentValue=null,this.$listeners=null,this.$watchers=null,this.trigger=g},y.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},y.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}c.unregister(this.$memoryId),this.disconnectAll(),delete this.$value},y.prototype.subscribe=function(e){this.$listeners=this.$listeners??[],this.$listeners.push(e),this.assocTrigger()},y.prototype.on=function(e,t){this.$watchers=this.$watchers??new Map;let n=this.$watchers.get(e);t.__$isObservable&&(t=t.set.bind(t)),n?l.isArray(n.list)?n.list.push(t):(n=[n,t],t=e=>{for(let t=0,r=n.length;t<r;t++)n[t](e)},t.list=n,this.$watchers.set(e,t)):(n=t,this.$watchers.set(e,t)),this.assocTrigger()},y.prototype.off=function(e,t){if(!this.$watchers)return;const n=this.$watchers.get(e);if(!n)return;if(!t||!Array.isArray(n.list))return this.$watchers?.delete(e),void this.assocTrigger();const r=n.indexOf(t);n?.splice(r,1),1===n.length?this.$watchers.set(e,n[0]):0===n.length&&this.$watchers?.delete(e),this.assocTrigger()},y.prototype.once=function(e,t){const n="function"==typeof e?e:t=>t===e,r=e=>{n(e)&&(this.unsubscribe(r),t(e))};this.subscribe(r)},y.prototype.unsubscribe=function(e){if(!this.$listeners)return;const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},y.prototype.get=function(e){const t=this.$currentValue[e];return l.isObservable(t)?t.val():t},y.prototype.equals=function(e){return l.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},y.prototype.toBool=function(){return!!this.$currentValue},y.prototype.toggle=function(){this.set(!this.$currentValue)},y.prototype.reset=function(){if(!this.configs?.reset)return;const e=l.isObject(this.$initialValue)?d(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},y.prototype.toString=function(){return String(this.$currentValue)},y.prototype.valueOf=function(){return this.$currentValue},y.prototype.persist=function(e,t={}){let n=m(e,this.$currentValue);t.get&&(n=t.get(n)),this.set(n);const r=b(this.$currentValue);return this.subscribe(n=>{r(e,t.set?t.set(n):n)}),this},y.prototype.clone=function(){let e=this.$currentValue;return e&&"object"==typeof e&&(e="function"==typeof e.clone?e.clone():structuredClone(e)),new y(e)};const k=_,P=x,L=N,I=F,R=A,V=E,j=M,B=T;function q(e,t=!1){return C(e,(e,n)=>!!e&&(!n||(t?String(e).includes(String(n)):String(e).toLowerCase().includes(String(n).toLowerCase()))))}const W=q;var U=Object.freeze({__proto__:null,all:j,and:M,any:B,between:function(e,t){return O([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:W,createFilter:C,createMultiSourceFilter:O,custom:function(e,...t){const n=t.filter(l.isObservable);return{dependencies:n.length>0?n:null,callback:n=>{const r=t.map(e=>l.isObservable(e)?e.val():e);return e(n,...r)}}},dateAfter:e=>C(e,(e,t)=>!(!e||!t)&&$(e)>$(t)),dateBefore:e=>C(e,(e,t)=>!(!e||!t)&&$(e)<$(t)),dateBetween:(e,t)=>O([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=$(e);return r>=$(t)&&r<=$(n)}),dateEquals:e=>C(e,(e,t)=>!(!e||!t)&&w(e,t)),dateTimeAfter:e=>C(e,(e,t)=>!(!e||!t)&&$(e)>$(t)),dateTimeBefore:e=>C(e,(e,t)=>!(!e||!t)&&$(e)<$(t)),dateTimeBetween:(e,t)=>O([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=$(e);return r>=$(t)&&r<=$(n)}),dateTimeEquals:e=>C(e,(e,t)=>!(!e||!t)&&$(e).getTime()===$(t).getTime()),endsWith:function(e,t=!1){return C(e,(e,n)=>!n||(t?String(e).endsWith(String(n)):String(e).toLowerCase().endsWith(String(n).toLowerCase())))},eq:R,equals:A,getSecondsOfDay:S,greaterThan:_,greaterThanOrEqual:x,gt:k,gte:P,inArray:function(e){return C(e,(e,t)=>t.includes(e))},includes:q,isEmpty:function(e=!0){return C(e,(e,t)=>{const n=!e||""===e||Array.isArray(e)&&0===e.length;return t?n:!n})},isNotEmpty:function(e=!0){return C(e,(e,t)=>{const n=!!e&&""!==e&&(!Array.isArray(e)||e.length>0);return t?n:!n})},isSameDay:w,lessThan:N,lessThanOrEqual:F,lt:L,lte:I,match:D,neq:V,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:E,notIn:function(e){return C(e,(e,t)=>!t.includes(e))},or:T,startsWith:function(e,t=!1){return C(e,(e,n)=>!n||(t?String(e).startsWith(String(n)):String(e).toLowerCase().startsWith(String(n).toLowerCase())))},timeAfter:e=>C(e,(e,t)=>!(!e||!t)&&S(e)>S(t)),timeBefore:e=>C(e,(e,t)=>!(!e||!t)&&S(e)<S(t)),timeBetween:(e,t)=>O([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=S(e);return r>=S(t)&&r<=S(n)}),timeEquals:e=>C(e,(e,t)=>{if(!e||!t)return!1;const n=$(e),r=$(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:$});const z=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");y.call(this,e,t)};(z.prototype=Object.create(y.prototype)).constructor=z,z.prototype.__$isObservableArray=!0,Object.defineProperty(z.prototype,"length",{get(){return this.$currentValue.length}}),z.prototype.$mutate=function(e,t,n){if(this.$mutationInterceptor){const n=this.$mutationInterceptor(t,{action:e});void 0!==t&&(t=n)}n(t)},["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{z.prototype[e]=function(...t){return this.$mutate(e,t,t=>{const n=this.$currentValue[e].apply(this.$currentValue,t);return this.trigger({action:e,args:t,result:n}),n})}}),["map","forEach","filter","reduce","some","every","find","findIndex","concat","includes","indexOf"].forEach(e=>{z.prototype[e]=function(...t){return this.$currentValue[e].apply(this.$currentValue,t)}});const H={action:"clear"};z.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$mutate("clear",[],()=>{this.$currentValue.length=0,this.trigger(H)}),!0},z.prototype.at=function(e){return this.$currentValue[e]},z.prototype.merge=function(e){this.$mutate("merge",e,e=>{this.$currentValue.push.apply(this.$currentValue,e),this.trigger({action:"merge",args:e})})},z.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},z.prototype.swap=function(e,t){return this.$mutate("swap",[e,t],([e,t])=>{const n=this.$currentValue,r=n.length;if(t<e){const n=e;e=t,t=n}if(r<e||r<t)return!1;const o=n[e],s=n[t];n[e]=s,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,s]})}),!0},z.prototype.swapItems=function(e,t){const n=this.$currentValue.indexOf(e),r=this.$currentValue.indexOf(t);return this.swap(n,r)},z.prototype.insertAfter=function(e,t){const n=this.$currentValue.indexOf(t);return this.splice(n+1,0,e)},z.prototype.remove=function(e){let t=[];return this.$mutate("remove",[e],([e])=>{t=this.$currentValue.splice(e,1),0!==t.length&&this.trigger({action:"remove",args:[e],result:t[0]})}),t},z.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return-1===t?[]:this.remove(t)},z.prototype.empty=function(){return 0===this.$currentValue.length},z.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},z.prototype.where=function(e){"function"==typeof e&&(e={_:e});const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=l.isObservable(o)?D(o,!1):o;if(e&&"object"==typeof e&&"callback"in e){if(r[t]=e.callback,e.dependencies){const t=Array.isArray(e.dependencies)?e.dependencies:[e.dependencies];n.push.apply(n,t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=new z([]),s=Object.entries(r),i=()=>{const e=t.val().filter(e=>{for(const[t,n]of s)if("_"===t){if(!n(e))return!1}else if(!n(e[t]))return!1;return!0});o.set(e)};return n.forEach(e=>e.subscribe(i)),i(),o},z.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},z.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},z.prototype.deepSubscribe=function(e){const t=h(()=>e(this.val())),n=new WeakMap,r=e=>{n.has(e)||(e?.__$isObservableArray?n.set(e,e.deepSubscribe(t)):e?.__$isObservable&&(e.subscribe(t),n.set(e,()=>e.unsubscribe(t))))},o=e=>{const t=n.get(e);t&&(t(),n.delete(e))};return this.$currentValue.forEach(r),this.subscribe(t),this.subscribe((e,t,n)=>{switch(n?.action){case"push":case"unshift":case"merge":n.args.forEach(r);break;case"splice":{const[e,t,...s]=n.args;n.result?.forEach(o),s.forEach(r);break}case"remove":o(n.result);break;case"clear":this.$currentValue.forEach(o)}}),()=>{this.$currentValue.forEach(o)}},z.prototype.sync=function(e){if(!e||!e.__$isObservableArray)throw new r("ObservableArray.sync : target must be an ObservableArray");e.set([...this.$currentValue]);const t=(t,n,r)=>{if(!r)return void e.set([...t]);const{action:o,args:s}=r;e[o].apply(e,s)};return this.subscribe(t),()=>this.unsubscribe(t)},z.prototype.clone=function(){return new z(this.resolve())},z.prototype.isNotEmpty=function(){return this.is(e=>e.length>0)};const G=function(e,t){y.call(this,e),this.$observables={},this.configs=t,this.$load(e);for(const t in e)Object.hasOwn(this,t)||Object.defineProperty(this,t,{get:()=>this.$observables[t],set:e=>this.$observables[t].set(e)})};G.prototype=Object.create(y.prototype),Object.defineProperty(G,"$value",{get(){return this.val()},set(e){this.set(e)}}),G.prototype.__$isObservableObject=!0,G.prototype.__isProxy__=!0,G.prototype.$load=function(e){const t=this.configs;for(const n in e){const r=e[n];if(Array.isArray(r)){if(!1!==t?.deep){const e=r.map(e=>l.isJson(e)?new G(e,t):l.isArray(e)?new z(e,t):new y(e,t));this.$observables[n]=new z(e,t);continue}this.$observables[n]=new z(r,t)}else l.isObservable(r)||l.isProxy(r)?this.$observables[n]=r:this.$observables[n]="object"==typeof r?new G(r,t):new y(r,t)}},G.prototype.val=function(){const e={};for(const t in this.$observables){const n=this.$observables[t];if(l.isObservable(n)){let r=n.val();Array.isArray(r)&&(r=r.map(e=>l.isObservable(e)?e.val():l.isProxy(e)?e.$value:e)),e[t]=r}else l.isProxy(n)?e[t]=n.$value:e[t]=n}return e},G.prototype.$val=G.prototype.val,G.prototype.get=function(e){const t=this.$observables[e];return l.isObservable(t)?t.val():l.isProxy(t)?t.$value:t},G.prototype.$get=G.prototype.get,G.prototype.set=function(e){const t=l.isProxy(e)?e.$value:e,n=this.configs;for(const r in t){const o=this.$observables[r],s=e[r],i=t[r];if(l.isObservable(o)){if(!l.isArray(i)){o.set(i);continue}const e=s.at(0);if(l.isObservable(e)||l.isProxy(e)){const t=i.map(t=>l.isProxy(e)?new G(t,n):y(t,n));o.set(t);continue}o.set([...i]);continue}l.isProxy(o)?o.update(i):this[r]=i}},G.prototype.$set=G.prototype.set,G.prototype.$updateWith=G.prototype.set,G.prototype.observables=function(){return Object.values(this.$observables)},G.prototype.$observables=G.prototype.observables,G.prototype.keys=function(){return Object.keys(this.$observables)},G.prototype.$keys=G.prototype.keys,G.prototype.clone=function(){return new G(this.val(),this.configs)},G.prototype.$clone=G.prototype.clone,G.prototype.reset=function(){for(const e in this.$observables)this.$observables[e].reset()},G.prototype.originalSubscribe=G.prototype.subscribe,G.prototype.subscribe=function(e){const t=this.observables(),n=h(()=>this.trigger());this.originalSubscribe(e);for(let e=0,r=t.length;e<r;e++){const r=t[e];r.__$isObservableArray?r.deepSubscribe(n):r.subscribe(n)}},G.prototype.configs=function(){return this.configs},G.prototype.update=G.prototype.set;const K=(e,t)=>y.computed(e,t),J=(e,t)=>e.transform(t);y.prototype.isEqualTo=function(e){return e?.__$Observable?K((e,t)=>e===t,[this,e]):J(this,t=>t===e)},y.prototype.isNotEqualTo=function(e){return e?.__$Observable?K((e,t)=>e!==t,[this,e]):J(this,t=>t!==e)},y.prototype.isGreaterThan=function(e){return e?.__$Observable?K((e,t)=>e>t,[this,e]):J(this,t=>t>e)},y.prototype.isGreaterThanOrEqualTo=function(e){return e?.__$Observable?K((e,t)=>e>=t,[this,e]):J(this,t=>t>=e)},y.prototype.isLessThan=function(e){return e?.__$Observable?K((e,t)=>e<t,[this,e]):J(this,t=>t<e)},y.prototype.isLessThanOrEqualTo=function(e){return e?.__$Observable?K((e,t)=>e<=t,[this,e]):J(this,t=>t<=e)},y.prototype.isBetween=function(e,t){return e.__$Observable&&t.__$Observable?K((e,t,n)=>e>=t&&e<=n,[this,e,t]):e.__$Observable?K((e,n)=>e>=n&&e<=t,[this,e]):t.__$Observable?K((t,n)=>t>=e&&t<=n,[this,t]):J(this,n=>n>=e&&n<=t)},y.prototype.isNull=function(){return J(this,e=>null==e)},y.prototype.isTruthy=function(){return J(this,e=>!!e)},y.prototype.isFalsy=function(){return J(this,e=>!e)},y.prototype.isStartingWith=function(e){return e?.__$Observable?K((e,t)=>String(e).startsWith(t),[this,e]):J(this,t=>String(t).startsWith(e))},y.prototype.isEndingWith=function(e){return e?.__$Observable?K((e,t)=>String(e).endsWith(t),[this,e]):J(this,t=>String(t).endsWith(e))},y.prototype.isMatchingPattern=function(e){return e?.__$Observable?K((e,t)=>new RegExp(t).test(String(e)),[this,e]):J(this,t=>e.test(String(t)))},y.prototype.isEmpty=function(){return J(this,e=>null==e||""===e||Array.isArray(e)&&0===e.length)},y.prototype.isNotEmpty=function(){return J(this,e=>null!=e&&""!==e&&!(Array.isArray(e)&&0===e.length))},y.prototype.isIncludes=function(e){return e?.__$Observable?K((e,t)=>Array.isArray(e)?e.includes(t):String(e).includes(String(t)),[this,e]):J(this,t=>Array.isArray(t)?t.includes(e):String(t).includes(String(e)))},y.prototype.isIncludedIn=function(e){return e?.__$Observable?K((e,t)=>t.includes(e),[this,e]):J(this,t=>e.includes(t))},y.prototype.isOneOf=y.prototype.isIncludedIn,y.prototype.isHaving=function(e){return e?.__$Observable?K((e,t)=>t in Object(e),[this,e]):J(this,t=>e in Object(t))},y.prototype.toUpperCase=function(){return J(this,e=>String(e).toUpperCase())},y.prototype.toLowerCase=function(){return J(this,e=>String(e).toLowerCase())},y.prototype.toTrimmed=function(){return J(this,e=>String(e).trim())},y.prototype.toBoolean=function(){return J(this,e=>!!e)},y.prototype.toLiteral=function(e,t="${v}"){return J(this,n=>e.replace(t,n))},y.prototype.toFormatted=y.prototype.toLiteral,y.prototype.toProperty=function(e){const t=e.split(".");return J(this,e=>{let n=e;for(const e of t){if(null==n)return;n=n[e]}return n})},y.prototype.toLength=function(){return J(this,e=>null==e?0:e.length)},y.prototype.toClamped=function(e,t){return e.__$Observable&&t.__$Observable?K((e,t,n)=>Math.min(Math.max(e,t),n),[this,e,t]):e.__$Observable?K((e,n)=>Math.min(Math.max(e,n),t),[this,e]):t.__$Observable?K((t,n)=>Math.min(Math.max(t,e),n),[this,t]):J(this,n=>Math.min(Math.max(n,e),t))},y.prototype.toPercent=function(e){return e?.__$Observable?K((e,t)=>0===t?0:e/t*100,[this,e]):J(this,t=>0===e?0:t/e*100)};const Y=function(e,t){this.$target=t,this.$observer=e};function Z(e,t){this.observable=e,y.call(this),this.$mutation=t,e.subscribe(e=>{this.$updateWithMutation(e)}),this.$updateWithMutation(e.val())}Y.prototype.__$Observable=!0,Y.prototype.__$isObservableWhen=!0,Y.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},Y.prototype.val=function(){return this.$observer.$currentValue===this.$target},Y.prototype.isMatch=Y.prototype.val,Y.prototype.isActive=Y.prototype.val,Z.prototype=Object.create(y.prototype),Z.prototype.constructor=Z,Z.prototype.__$Observable=!0,Z.prototype.__$isObservableChecker=!0;const Q=Z;Q.prototype.constructor=Q,Z.prototype.$updateWithMutation=function(e){return e=this.$mutation(e),this.set(e)};const X=(e,t)=>{const n=new Date(e);return{d:n,parts:new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(n).reduce((e,{type:t,value:n})=>(e[t]=n,e),{})}},ee=(e,t,n)=>{const r=e=>String(e).padStart(2,"0");return e.replace("YYYY",n.year).replace("YY",n.year.slice(-2)).replace("MMMM",n.month).replace("MMM",n.month.slice(0,3)).replace("MM",r(t.getMonth()+1)).replace("DD",r(t.getDate())).replace("D",t.getDate()).replace("HH",n.hour).replace("mm",n.minute).replace("ss",n.second)},te={currency:(e,t,{currency:n="XOF",notation:r,minimumFractionDigits:o,maximumFractionDigits:s}={})=>new Intl.NumberFormat(t,{style:"currency",currency:n,notation:r,minimumFractionDigits:o,maximumFractionDigits:s}).format(e),number:(e,t,{notation:n,minimumFractionDigits:r,maximumFractionDigits:o}={})=>new Intl.NumberFormat(t,{notation:n,minimumFractionDigits:r,maximumFractionDigits:o}).format(e),percent:(e,t,{decimals:n=1}={})=>new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:n}).format(e),date:(e,t,{format:n,dateStyle:r="long"}={})=>{if(n){const{d:r,parts:o}=X(e,t);return ee(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r}).format(new Date(e))},time:(e,t,{format:n,hour:r="2-digit",minute:o="2-digit",second:s}={})=>{if(n){const{d:r,parts:o}=X(e,t);return ee(n,r,o)}return new Intl.DateTimeFormat(t,{hour:r,minute:o,second:s}).format(new Date(e))},datetime:(e,t,{format:n,dateStyle:r="long",hour:o="2-digit",minute:s="2-digit",second:i}={})=>{if(n){const{d:r,parts:o}=X(e,t);return ee(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r,hour:o,minute:s,second:i}).format(new Date(e))},relative:(e,t,{unit:n="day",numeric:r="auto"}={})=>{const o=Math.round((e-Date.now())/864e5);return new Intl.RelativeTimeFormat(t,{numeric:r}).format(o,n)},plural:(e,t,{singular:n,plural:r}={})=>`${e} ${"one"===new Intl.PluralRules(t).select(e)?n:r}`};y.prototype.when=function(e){return new Y(this,e)},y.prototype.check=function(e){return new Z(this,e)},y.prototype.transform=y.prototype.check,y.prototype.pluck=function(e){return new Z(this,t=>t[e])},y.prototype.is=function(e){return new Z(this,"function"==typeof e?e:t=>t===e)},y.prototype.select=y.prototype.check,y.prototype.format=function(e,t={}){const n=this;if("function"==typeof e)return new Z(n,e);const r=te[e],o=te.locale;return y.computed(()=>r(n.val(),o.val(),t),[n,o])};const ne="unresolved",re="pending",oe="ready",se="refreshing",ie="errored";function ae(e,t,n){if(this.$fn=n.debounce>0?function(e,t,n={}){let r=null,o=null;return function(...s){const i=!0===n.context?this:null;n.check&&n.check(...s),o=s,clearTimeout(r),r=setTimeout(()=>function(e,t,n){n?e.apply(n,t):e(...t)}(e,o,i),t)}}(e,n.debounce):e,this.$dependencies=t,this.$config=n,this.$controller=null,this.$subscriptions=[],this.data=n.initial??new y(null),this.error=new y(null),this.state=new y(ne),this.loading=y.computed(e=>e===re||e===se,[this.state]),n.auto){if(t.length>0)return void this.$watchDependencies();this.fetch()}}function le(e,t=null){return new y(e,t)}ae.prototype.$abort=function(){this.$controller&&(this.$controller.abort(),this.$controller=null)},ae.prototype.$runWithAbortController=function(e=!1){this.$abort(),this.$controller=new AbortController;const t=this.$controller.signal,n=null!==this.data.val(),r=e&&n?se:re;this.error.set(null),this.state.set(r);const o=[...this.$dependencies.map(e=>e.val()),t];Promise.resolve(this.$fn(...o)).then(e=>{t.aborted||(this.data.set(e),this.error.set(null),this.state.set(oe),this.$controller=null)}).catch(e=>{t.aborted||(this.error.set(e),this.state.set(ie),this.$controller=null)})},ae.prototype.$runWithoutAbortController=function(e=!1){const t=null!==this.data.val(),n=e&&t?se:re;this.error.set(null),this.state.set(n);const r=this.$dependencies.map(e=>e.val());Promise.resolve(this.$fn(...r)).then(e=>{this.data.set(e),this.error.set(null),this.state.set(oe)}).catch(e=>{this.error.set(e),this.state.set(ie)})},ae.prototype.$run=function(e=!1){return this.$fn.length>this.$dependencies.length?(this.$run=this.$runWithAbortController,this.$runWithAbortController(e)):(this.$run=this.$runWithoutAbortController,this.$run(e))},ae.prototype.$watchDependencies=function(){this.$subscriptions.forEach(e=>e()),this.$subscriptions=[],this.$dependencies.forEach(e=>{const t=()=>this.$run(!0);e.subscribe(t),this.$subscriptions.push(()=>e.unsubscribe(t))}),this.$config.lazy||this.$run(!1)},ae.prototype.fetch=function(){return this.$run(!1),this},ae.prototype.refetch=function(){return this.$run(!0),this},ae.prototype.mutate=function(e){return this.data.set(e),this.state.set(oe),this},ae.prototype.destroy=function(){this.$abort(),this.$subscriptions.forEach(e=>e()),this.$subscriptions=[]},ae.prototype.isReady=function(){return this.state.isEqualTo(oe)},ae.prototype.isPending=function(){return this.state.isEqualTo(re)},ae.prototype.isRefreshing=function(){return this.state.isEqualTo(se)},ae.prototype.isErrored=function(){return this.state.isEqualTo(ie)},ae.prototype.isUnresolved=function(){return this.state.isEqualTo(ne)},ae.prototype.onSuccess=function(e){return this.data.subscribe(t=>{this.state.val()===oe&&e(t)}),this},ae.prototype.onError=function(e){return this.error.subscribe(t=>{null!==t&&e(t)}),this};const ue=le,ce=le;le.useValueProperty=function(e="value"){Object.defineProperty(y.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},le.setLocale=function(e){te.locale=e.__$Observable?e:le(e)},le.getById=function(e){const t=c.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},le.cleanup=function(e){e.cleanup()},le.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{c.cleanup()}),setInterval(()=>c.cleanObservables(r),n)},le.array=function(e=[],t=null){return new z(e,t)},le.batch=function(e){const t=le(0),n=function(){if(l.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n},le.computed=function(e,t=[]){const n=()=>t.map(e=>e.val()),o=new y(e(...n())),s=h(()=>o.set(e(...n())));if(l.isFunction(t)){if(!l.isObservable(t.$observer))throw new r("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(s),o}return t.forEach(e=>{l.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(s)}):e.subscribe(s)}),o},y.computed=le.computed,le.init=function(e,t=null){return new G(e,t)},le.arrayOfObject=function(e){return e.map(e=>le.object(e))},le.value=function(e){if(e?.__$isObservableArray){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.at(n);t.push(le.value(r))}return t}return e?.__$Observable?e.val():l.isProxy(e)?e.$value:e},le.object=le.init,le.json=le.init,le.resource=function(e,t=[],n=!1){return new ae(e,t,"boolean"==typeof n?{auto:n,debounce:0,lazy:!1}:{auto:!1,debounce:0,lazy:!1,...n})},y.prototype.resolve=function(){return le.value(this)};const he=(e,t)=>{for(const n in t){const r=t[n];if(r.__$Observable){if(r.__$isObservableChecker){let t=r.val();if("string"==typeof t){e.classes.toggle(t,!0),r.subscribe(n=>{e.classes.remove(t),e.classes.toggle(n,!0),t=n});continue}}e.classes.toggle(n,r.val()),r.subscribe(t=>e.classes.toggle(n,t))}else r.$hydrate?r.$hydrate(e,n):e.classes.toggle(n,r)}},pe=(e,t)=>{for(const n in t){const r=t[n],o=n.startsWith("--");r.__$Observable?o?(e.style.setProperty(n,r.val()),r.subscribe(t=>{!1!==t?e.style.setProperty(n,t):e.style.removeProperty(n)})):(e.style[n]=r.val(),r.subscribe(t=>{!1!==t?e.style[n]=t:e.style.removeProperty(n)})):o?e.style.setProperty(n,r):e.style[n]=r}},de=(e,t,n)=>{const r=n.__$isObservable,o=r?n.val():n;if(l.isBoolean(o)?e[t]=o:e[t]=o===e.value,r){if("checked"===t)return"boolean"==typeof o?e.addEventListener("input",()=>n.set(e[t])):e.addEventListener("input",()=>n.set(e.value)),void n.subscribe(n=>e[t]=n);n.subscribe(n=>e[t]=n===e.value)}},fe=(e,t,n)=>{const r="value"===t?t=>e.value=t:n=>e.setAttribute(t,n);if(n.subscribe(r),"value"===t)return e.value=n.val(),void e.addEventListener("input",()=>n.set(e.value));e.setAttribute(t,n.val())},me=(e,t)=>{for(const n in t){const r=n.toLowerCase();let o=t[n];if(null!=o)if(o.handleNdAttribute)o.handleNdAttribute(e,r,o);else{if("object"==typeof o){if("class"===r){he(e,o);continue}if("style"===r){pe(e,o);continue}}u.has(r)?de(e,r,o):e.setAttribute(r,o)}}return e};let be=null;const ye={createTextNode:()=>(be||(be=document.createTextNode(""),ye.createTextNode=()=>be.cloneNode()),be.cloneNode()),createObservableNode:(e,t)=>{const n=ye.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode:(e,t)=>{const n=ye.createTextNode();return t.$hydrate(n),n},createStaticTextNode:(e,t)=>{let n=ye.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement:e=>document.createElement(e).cloneNode(),bindTextNode:(e,t)=>{if(t?.__$isObservable)return t.subscribe(t=>e.nodeValue=t),void(e.nodeValue=t.val());e.nodeValue=t},processChildren:(e,t)=>{if(null===e)return;let n=ye.getChild(e);n&&t.appendChild(n)},async safeRemove(e){await e.remove()},getChild:e=>{if(null==e)return null;if(e.toNdElement)do{if(e=e.toNdElement(),l.isElement(e))return e}while(e.toNdElement);return ye.createStaticTextNode(null,e)},processAttributes:(e,t)=>{t&&me(e,t)},processAttributesDirect:me,processClassAttribute:he,processStyleAttribute:pe};function ge(e){const t=Reflect.construct(DocumentFragment,[],ge),n=document.createComment((e||"")+" Anchor Sentinel"),r=document.createComment("Anchor Start : "+e),o=document.createComment("/ Anchor End "+e),s={};t.append(r,n,o);const i=new MutationObserver(()=>{n.parentNode===t||n.parentNode instanceof DocumentFragment||s.connected&&s.connected(n.parentNode)});return i.observe(document,{childList:!0,subtree:!0}),t.$sentinel=n,t.$start=r,t.$end=o,t.$observer=i,t.$events=s,t}function ve(e,t=!1){const n=new ge(e);n.onConnectedOnce(e=>{t&&function(e,t){e.remove=()=>{e.append.apply(e,t.childNodes)},e.getParent=()=>t,e.appendChild=e=>{e=l.isElement(e)?e:ye.getChild(e),t.appendChild(e)},e.appendChildRaw=t.appendChild.bind(t),e.append=e.appendChild,e.appendRaw=e.appendChildRaw,e.insertAtStart=e=>{e=l.isElement(e)?e:ye.getChild(e),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},e.insertAtStartRaw=e=>{t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},e.appendElement=e.appendChild,e.removeChildren=()=>{t.textContent=""},e.replaceContent=function(e){const n=l.isElement(e)?e:ye.getChild(e);t.replaceChildren(n)},e.replaceContentRaw=function(e){t.replaceChildren(e)},e.setContent=e.replaceContent,e.insertBefore=(e,n)=>{e=l.isElement(e)?e:ye.getChild(e),t.insertBefore(e,n)},e.insertBeforeRaw=(e,n)=>{t.insertBefore(e,n)},e.appendChildBefore=e.insertBefore,e.appendChildBeforeRaw=e.insertBeforeRaw,e.clear=e.remove,e.detach=e.remove,e.replaceChildren=function(){t.replaceChildren(...arguments)},e.getByIndex=e=>t.childNodes[e]}(n,e)}),n.__Anchor__=!0;const r=n.$start,o=n.$end;n.nativeInsertBefore=n.insertBefore,n.nativeAppendChild=n.appendChild,n.nativeAppend=n.append;const s=t?()=>!0:e=>e.firstChild===r&&e.lastChild===o,i=(e,t,r)=>{e!==n?s(e)&&r===o?e.append(t,r):e.insertBefore(t,r):e.nativeInsertBefore(t,r)};return n.appendElement=function(e){const t=r.parentNode;t!==n?t.insertBefore(e,o):t.nativeInsertBefore(e,o)},n.appendChild=function(e,t=null){const n=o.parentNode;n?((e,t,n)=>{const r=l.isElement(t)?t:ye.getChild(t);i(e,r,n)})(n,e,t=t??o):DebugManager.error("Anchor","Anchor : parent not found",e)},n.appendChildRaw=function(e,t=null){const n=o.parentNode;n?i(n,e,t=t??o):DebugManager.error("Anchor","Anchor : parent not found",e)},n.getParent=()=>o.parentNode,n.append=n.appendChild,n.appendRaw=n.appendChildRaw,n.insertAtStart=function(e){e=l.isElement(e)?e:ye.getChild(e),n.insertAtStartRaw(e)},n.insertAtStartRaw=function(e){const t=r.parentNode;t!==n?t.insertBefore(e,r):t.nativeInsertBefore(e,r)},n.removeChildren=function(){const e=o.parentNode;if(e===n)return;if(s(e))return void e.replaceChildren(r,o);let t,i=r.nextSibling;for(;i&&i!==o;)t=i.nextSibling,i.remove(),i=t},n.remove=function(){const e=o.parentNode;if(e===n)return;if(s(e))return n.nativeAppend.apply(n,e.childNodes),void e.replaceChildren(r,o);let t,i=r.nextSibling;for(;i&&i!==o;)t=i.nextSibling,n.nativeAppend(i),i=t},n.removeWithAnchors=function(){n.removeChildren(),r.remove(),o.remove()},n.delete=n.removeWithAnchors,n.replaceContent=function(e){const t=l.isElement(e)?e:ye.getChild(e);n.replaceContentRaw(t)},n.replaceContentRaw=function(e){const t=o.parentNode;t&&(s(t)?t.replaceChildren(r,e,o):(n.removeChildren(),t.insertBefore(e,o)))},n.setContent=n.replaceContent,n.setContentRaw=n.replaceContentRaw,n.insertBefore=n.appendChild,n.insertBeforeRaw=n.appendChildRaw,n.endElement=function(){return o},n.startElement=function(){return r},n.restore=function(){n.appendChild(n)},n.clear=n.remove,n.detach=n.remove,n.getByIndex=function(e){let t=r;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==r?t:null},n}ge.prototype=Object.create(DocumentFragment.prototype),ge.prototype.constructor=ge,ge.prototype.onConnected=function(e){return this.$events.connected=e,this},ge.prototype.onConnectedOnce=function(e){this.$events.connected=t=>{e(t),this.$observer.disconnect(),this.$events.connectedOnce=null}},DocumentFragment.prototype.setAttribute=()=>{};let $e=e=>e;e.ArgTypes={},e.ArgTypes={string:()=>!0,number:()=>!0,boolean:()=>!0,observable:()=>!0,element:()=>!0,function:()=>!0,object:()=>!0,objectNotNull:()=>!0,children:()=>!0,attributes:()=>!0,optional:()=>!0,oneOf:()=>!0};const we=function(e,t=null){return e&&t?{props:e,children:t}:"object"!=typeof e||Array.isArray(e)||null===e||"Object"!==e.constructor.name||e.$hydrate?{props:t,children:e}:{props:e,children:t}},Se={mounted:new WeakMap,beforeUnmount:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,initObserver:()=>{Se.observer||(Se.observer=new MutationObserver(Se.checkMutation),Se.observer.observe(document.body,{childList:!0,subtree:!0}))},executeMountedCallback(e){const t=Se.mounted.get(e);if(t&&(t.inDom=!0,t.mounted))if(Array.isArray(t.mounted))for(const n of t.mounted)n(e);else t.mounted(e)},executeUnmountedCallback(e){const t=Se.unmounted.get(e);if(!t)return;if(t.inDom=!1,!t.unmounted)return;let n=!1;if(Array.isArray(t.unmounted))for(const r of t.unmounted)!0===r(e)&&(n=!0);else n=!0===t.unmounted(e);n&&(t.disconnect(),e.nd?.remove())},checkMutation:function(e){for(const t of e){if(Se.mountedSupposedSize>0)for(const e of t.addedNodes){if(Se.executeMountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-mounted]");for(const e of t)Se.executeMountedCallback(e)}if(Se.unmountedSupposedSize>0)for(const e of t.removedNodes){if(Se.executeUnmountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-unmounted]");for(const e of t)Se.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n=!1,r=!1;Se.initObserver();let o={inDom:t,mounted:null,unmounted:null,disconnect:()=>{n&&(Se.mounted.delete(e),Se.mountedSupposedSize--),r&&(Se.unmounted.delete(e),Se.unmountedSupposedSize--),o=null}};const s=(e,t)=>{o[e]?Array.isArray(o[e])?o[e].push(t):o[e]=[o[e],t]:o[e]=t};return{disconnect:()=>o?.disconnect(),mounted:t=>{s("mounted",t),Se.mounted.set(e,o),n||(Se.mountedSupposedSize++,n=!0)},unmounted:t=>{s("unmounted",t),Se.unmounted.set(e,o),r||(Se.unmountedSupposedSize++,r=!0)},off:(e,t)=>{((e,t)=>{if(o?.[e]){if(Array.isArray(o[e])){const n=o[e].indexOf(t);return n>-1&&o[e].splice(n,1),1===o[e].length&&(o[e]=o[e][0]),void(0===o[e].length&&(o[e]=null))}o[e]=null}})(e,t)}}}};function Ce(e){this.$element=e,this.$attachements=null}Ce.prototype.__$isNDElement=!0,Ce.$getChild=e=>e,Ce.prototype.ghostDom=function(e){return this.$attachements||(this.$attachements=document.createDocumentFragment()),this.$attachements.appendChild(Ce.$getChild(e)),this},Ce.prototype.valueOf=function(){return this.$element},Ce.prototype.ref=function(e,t){return e[t]=this.$element,this},Ce.prototype.refSelf=function(e,t){return e[t]=this,this},Ce.prototype.unmountChildren=function(){let e=this.$element;for(let t=0,n=e.children.length;t<n;t++){let n=e.children[t];n.$ndProx||n.nd?.remove(),n=null}return e=null,this},Ce.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,Oe.delete(e),e=null,this};const Oe=new WeakMap;Ce.prototype.lifecycle=function(e){const t=this.$element;Oe.has(t)||Oe.set(t,Se.watch(t));const n=Oe.get(t);return e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),n.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),n.unmounted(e.unmounted)),this},Ce.prototype.destroyOnUnmount=function(){return this.unmounted(()=>{this.$element?.querySelectorAll("[data--nd-before-unmount]").forEach(e=>{e.remove(),e.__$controller?.abort(),e.__$controller=null,Oe.delete(e)}),this.$element.__$controller?.abort(),this.$element.__$controller=null,Oe.delete(this.$element),this.$element=null}),this},Ce.prototype.mounted=function(e){return this.lifecycle({mounted:e})},Ce.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},Ce.prototype.beforeUnmount=function(e,t){const n=this.$element;if(!Se.beforeUnmount.has(n)){Se.beforeUnmount.set(n,new Map);const e=n.remove.bind(n);let t=!1;this.$element.setAttribute("data--nd-before-unmount","1"),n.remove=async()=>{if(!t){t=!0;try{const e=Se.beforeUnmount.get(n);for(const t of e.values())await t.call(this,n)}finally{e(),t=!1}}}}return Se.beforeUnmount.get(n).set(e,t),this},Ce.prototype.htmlElement=function(){return this.$element},Ce.prototype.node=Ce.prototype.htmlElement,Ce.prototype.shadow=function(e,t=null){const n=this.$element,r=Array.from(n.childNodes),o=n.attachShadow({mode:e});if(t){const e=document.createElement("style");e.textContent=t,o.appendChild(e)}return n.append=o.append.bind(o),n.appendChild=o.appendChild.bind(o),o.append(...r),this},Ce.prototype.openShadow=function(e=null){return this.shadow("open",e)},Ce.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},Ce.prototype.with=function(e){if(!e||"object"!=typeof e)throw new r("extend() requires an object of methods");for(const t in e){const r=e[t];"function"==typeof r?this[t]=r.bind(this):n.warn(`⚠️ extends(): "${t}" is not a function, skipping`)}return this},Ce.prototype.attr=function(e,t){return t?.__$Observable?(fe(this.$element,e,t),this):(this.$element.setAttribute(e,t),this)},Ce.prototype.attrs=function(e){return me(this.$element,e),this},Ce.prototype.class=function(e){return he(this.$element,e),this},Ce.prototype.style=function(e){return pe(this.$element,e),this},Ce.extend=function(e){if(!e||"object"!=typeof e)throw new r("NDElement.extend() requires an object of methods");if(Array.isArray(e))throw new r("NDElement.extend() requires an object, not an array");const t=new Set(["constructor","valueOf","$element","$observer","ref","remove","cleanup","with","extend","attach","lifecycle","mounted","unmounted","unmountChildren"]);for(const o in e){if(!Object.hasOwn(e,o))continue;const s=e[o];if("function"==typeof s){if(t.has(o))throw n.error("NDElement.extend",`Cannot override protected method "${o}"`),new r(`Cannot override protected method "${o}"`);Ce.prototype[o]&&n.warn("NDElement.extend",`Overwriting existing prototype method "${o}"`),Ce.prototype[o]=s}else n.warn("NDElement.extend",`"${o}" is not a function, skipping`)}return Ce};const Ae={configurable:!0,get(){return new Ce(this)}};Object.defineProperty(HTMLElement.prototype,"nd",Ae),Object.defineProperty(DocumentFragment.prototype,"nd",Ae),Object.defineProperty(Ce.prototype,"nd",{configurable:!0,get:function(){return this}}),["Click","DblClick","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","Wheel","KeyDown","KeyPress","KeyUp","Blur","Change","Focus","Input","Invalid","Reset","Search","Select","Submit","Drag","DragEnd","DragEnter","DragLeave","DragOver","DragStart","Drop","AfterPrint","BeforePrint","BeforeUnload","Error","HashChange","Load","Offline","Online","PageHide","PageShow","Resize","Scroll","Unload","Abort","CanPlay","CanPlayThrough","DurationChange","Emptied","Ended","LoadedData","LoadedMetadata","LoadStart","Pause","Play","Playing","Progress","RateChange","Seeked","Seeking","Stalled","Suspend","TimeUpdate","VolumeChange","Waiting","TouchCancel","TouchEnd","TouchMove","TouchStart","AnimationEnd","AnimationIteration","AnimationStart","TransitionEnd","Copy","Cut","Paste","FocusIn","FocusOut","ContextMenu"].forEach(e=>{const t=e.toLowerCase();Ce.prototype["on"+e]=function(e=null,n={}){return this.$element.addEventListener(t,e,{signal:this.$getSignal(),...n}),this}}),["Click","DblClick","MouseDown","MouseMove","MouseOut","MouseOver","MouseUp","Wheel","KeyDown","KeyPress","KeyUp","Change","Input","Invalid","Reset","Search","Select","Submit","Drag","DragEnd","DragEnter","DragLeave","DragOver","DragStart","Drop","BeforeUnload","HashChange","TouchCancel","TouchEnd","TouchMove","TouchStart","AnimationEnd","AnimationIteration","AnimationStart","TransitionEnd","Copy","Cut","Paste","FocusIn","FocusOut","ContextMenu"].forEach(e=>{const t=e.toLowerCase();Ce.prototype["onStop"+e]=function(e=null,n={}){return _e(this.$element,t,e,{signal:this.$getSignal(),...n}),this},Ce.prototype["onPreventStop"+e]=function(e=null,n={}){return xe(this.$element,t,e,{signal:this.$getSignal(),...n}),this}}),["Click","DblClick","MouseDown","MouseUp","Wheel","KeyDown","KeyPress","Invalid","Reset","Submit","DragOver","Drop","BeforeUnload","TouchCancel","TouchEnd","TouchMove","TouchStart","Copy","Cut","Paste","ContextMenu"].forEach(e=>{const t=e.toLowerCase();Ce.prototype["onPrevent"+e]=function(e=null,n={}){return Ee(this.$element,t,e,{signal:this.$getSignal(),...n}),this}}),Ce.prototype.$getSignal=function(){return this.$element.__$controller||(this.$element.__$controller=new AbortController),this.$element.__$controller.signal},Ce.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,{signal:this.$getSignal(),...n}),this},Ce.prototype.off=function(e,t){return this.$element.removeEventListener(e.toLowerCase(),t),this},Ce.prototype.once=function(e,t){return this.$element.addEventListener(e.toLowerCase(),t,{signal:this.$getSignal(),once:!0}),this},Ce.prototype.emit=function(e,t=null){const n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.$element.dispatchEvent(n),this};const Ee=function(e,t,n,r){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)},r),this},_e=function(e,t,n,r){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)},r),this},xe=function(e,t,n,r){return e.addEventListener(t,t=>{t.stopPropagation(),t.preventDefault(),n&&n.call(e,t)},r),this},Ne={getClasses(){return this.$element.className?.split(" ").filter(Boolean)},add(e){const t=this.getClasses();t.indexOf(e)>=0||(t.push(e),this.$element.className=t.join(" "))},remove(e){const t=this.getClasses(),n=t.indexOf(e);n<0||(t.splice(n,1),this.$element.className=t.join(" "))},toggle(e,t=void 0){const n=this.getClasses(),r=n.indexOf(e);if(r>=0){if(!0===t)return;n.splice(r,1)}else{if(!1===t)return;n.push(e)}this.$element.className=n.join(" ")},contains(e){return this.getClasses().indexOf(e)>=0}};function Fe(e){this.$hydrate=e}Object.defineProperty(HTMLElement.prototype,"classes",{configurable:!0,get(){return{$element:this,...Ne}}}),DocumentFragment.prototype.__IS_FRAGMENT=!0,Function.prototype.args=function(...e){return this},Function.prototype.errorBoundary=function(e){const t=(...n)=>{try{return this.apply(this,n)}catch(r){return e(r,{caller:t,args:n})}};return t},Fe.prototype.__$isTemplateBinding=!0,Ce.$getChild=ye.getChild,String.prototype.toNdElement=function(){return ye.createStaticTextNode(null,this)},Number.prototype.toNdElement=function(){return ye.createStaticTextNode(null,this.toString())},Element.prototype.toNdElement=function(){return this},Text.prototype.toNdElement=function(){return this},Comment.prototype.toNdElement=function(){return this},Document.prototype.toNdElement=function(){return this},DocumentFragment.prototype.toNdElement=function(){return this},y.prototype.toNdElement=function(){return ye.createObservableNode(null,this)},Z.prototype.toNdElement=y.prototype.toNdElement,Ce.prototype.toNdElement=function(){const e=this.$element??this.$build?.()??this.build?.()??null;return this.$attachements?(this.$attachements.contains(this.$element)||this.$attachements.append(this.$element),this.$attachements):e},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=ye.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return ye.getChild(this())},Fe.prototype.toNdElement=function(){return ye.createHydratableNode(null,this)};const De=(e,t=1e3)=>new Promise(n=>{let r=!1;const o=t=>{t&&t.target!==e||r||(r=!0,e.removeEventListener("transitionend",o),e.removeEventListener("animationend",o),clearTimeout(s),n())};e.addEventListener("transitionend",o),e.addEventListener("animationend",o);const s=setTimeout(o,t),i=window.getComputedStyle(e),a="0s"!==i.transitionDuration,l="0s"!==i.animationDuration;a||l||o()});Ce.prototype.transitionOut=function(e){const t=e+"-exit",n=this.$element;return this.beforeUnmount("transition-exit",async function(){n.classes.add(t),await De(n),n.classes.remove(t)}),this},Ce.prototype.transitionIn=function(e){const t=e+"-enter-from",n=e+"-enter-to",r=this.$element;return r.classes.add(t),this.mounted(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.classes.remove(t),r.classes.add(n),De(r).then(()=>{r.classes.remove(n)})})})}),this},Ce.prototype.transition=function(e){return this.transitionIn(e),this.transitionOut(e),this},Ce.prototype.animate=function(e){const t=this.$element;return t.classes.add(e),De(t).then(()=>{t.classes.remove(e)}),this},y.prototype.handleNdAttribute=function(e,t){u.has(t)?de(e,t,this):fe(e,t,this)},Z.prototype.handleNdAttribute=y.prototype.handleNdAttribute,Fe.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const Me=e=>e?e.toNdElement():ye.createTextNode(),Te=(e,t,n=null)=>{let{props:r,children:o=null}=we(t,n);return ye.processAttributes(e,r),ye.processChildren(o,e),e};function ke(e,t=null){if(e){if(t){let n=null,r=(o,s)=>(n=document.createElement(e),r=(e,r)=>Te(t(n.cloneNode()),e,r),Te(t(n.cloneNode()),o,s));return(e,t)=>r(e,t)}let n=null,r=(t,o)=>(n=document.createElement(e),r=(e,t)=>Te(n.cloneNode(),e,t),Te(n.cloneNode(),t,o));return(e,t)=>r(e,t)}return(e,t="")=>{const n=ve(t);return n.append(e),n}}function Pe(e){this.$element=e,this.$classes=null,this.$styles=null,this.$attrs=null,this.$ndMethods=null}Ce.prototype.attach=function(e,t){if("function"==typeof t){const n=this.$element;return n.nodeCloner=n.nodeCloner||new Pe(n),n.nodeCloner.attach(e,t),n}return t.$hydrate(this.$element,e),this.$element},Pe.prototype.__$isNodeCloner=!0;const Le=(e,t,n)=>{for(const r in t)e[r]=t[r].apply(null,n);return e};Pe.prototype.resolve=function(){if(this.$content)return;const e=[];if(this.$ndMethods){const t=Object.keys(this.$ndMethods);if(1===t.length){const n=t[0],r=this.$ndMethods[n];e.push((e,t)=>{e.nd[n](r.bind(e,...t))})}else e.push((e,t)=>{const n=e.nd;for(const r in this.$ndMethods)n[r](this.$ndMethods[r].bind(e,...t))})}if(this.$classes){const t={},n=Object.keys(this.$classes);if(1===n.length){const r=n[0],o=this.$classes[r];e.push((e,n)=>{t[r]=o.apply(null,n),ye.processClassAttribute(e,t)})}else e.push((e,n)=>{ye.processClassAttribute(e,Le(t,this.$classes,n))})}if(this.$styles){const t={},n=Object.keys(this.$styles);if(1===n.length){const r=n[0],o=this.$styles[r];e.push((e,n)=>{t[r]=o.apply(null,n),ye.processStyleAttribute(e,t)})}else e.push((e,n)=>{ye.processStyleAttribute(e,Le(t,this.$styles,n))})}if(this.$attrs){const t={},n=Object.keys(this.$attrs);if(1===n.length){const r=n[0],o=this.$attrs[r];e.push((e,n)=>{t[r]=o.apply(null,n),ye.processAttributes(e,t)})}else e.push((e,n)=>{ye.processAttributes(e,Le(t,this.$attrs,n))})}const t=e.length,n=this.$element;this.cloneNode=r=>{const o=n.cloneNode(!1);for(let n=0;n<t;n++)e[n](o,r);return o}},Pe.prototype.cloneNode=function(e){return this.$element.cloneNode(!1)},Pe.prototype.attach=function(e,t){return this.$ndMethods=this.$ndMethods||{},this.$ndMethods[e]=t,this},Pe.prototype.text=function(e){return this.$content=e,"function"==typeof e?(this.cloneNode=t=>Me(e.apply(null,t)),this):(this.cloneNode=t=>Me(t[0][e]),this)},Pe.prototype.attr=function(e,t){return"class"===e?(this.$classes=this.$classes||{},this.$classes[t.property]=t.value,this):"style"===e?(this.$styles=this.$styles||{},this.$styles[t.property]=t.value,this):(this.$attrs=this.$attrs||{},this.$attrs[e]=t.value,this)};function Ie(e){let t=null;const n=e=>{const t=e.childNodes;let r=!!e.nodeCloner;const o=t.length;for(let e=0;e<o;e++){const o=t[e];o.nodeCloner&&(r=!0);n(o)&&(r=!0)}return r?e.nodeCloner?(e.nodeCloner.resolve(),e.dynamicCloneNode=n=>{const r=e.nodeCloner.cloneNode(n);for(let e=0;e<o;e++)r.appendChild(t[e].dynamicCloneNode(n));return r}):e.dynamicCloneNode=n=>{const r=e.cloneNode();for(let e=0;e<o;e++)r.appendChild(t[e].dynamicCloneNode(n));return r}:e.dynamicCloneNode=e.cloneNode.bind(e,!0),r};this.clone=r=>{const o=Re(this);return t=e(o),t.nodeCloner||(t.nodeCloner=new Pe(t)),n(t),this.clone=t.dynamicCloneNode,t.dynamicCloneNode(r)};const r=(e,t)=>new Fe((n,r)=>{!function(e,t,n,r){n.nodeCloner=n.nodeCloner||new Pe(n),"value"!==t?"attach"!==t?n.nodeCloner.attr(t,{property:r,value:e}):n.nodeCloner.attach(r,e):n.nodeCloner.text(e)}(e,t,n,r)});this.style=e=>r(e,"style"),this.class=e=>r(e,"class"),this.property=e=>this.value(e),this.value=e=>r(e,"value"),this.text=this.value,this.attr=e=>r(e,"attributes"),this.attach=e=>r(e,"attach"),this.callback=this.attach}const Re=e=>new Proxy(e,{get:(e,t)=>t in e||"symbol"==typeof t?e[t]:e.value(t)});function Ve(e){let t=null,n=null;this.render=r=>{if(t||(t=e(this)),!n)return t;const o=r[0];if(o&&"object"==typeof o)for(const e in o)n[e]&&n[e](o[e]);return t},this.createSection=(e,t)=>{n=n||{};const r=ve("Component "+e);return n[e]=function(e){r.removeChildren(),t?r.appendChild(t(e)):r.append(e)},r}}const je=function(e={}){let t=l.isString(e)?e.split(";").filter(Boolean):e;return{add(e,n){if(Array.isArray(t))t.push(e+": "+n);else if(l.isObject(e)){n=e;for(const e in n)t[e]=n[e]}else t[e]=n},value:()=>Array.isArray(t)?t.join(";").concat(";"):{...t}}},Be=function(e=[]){let t=l.isString(e)?e.split(" ").filter(Boolean):e;return{add(e,n=!0){if(l.isJson(e))for(const n in e)e[n]&&(t[n]=e[n]);else if(null!=n||e.__$Observable)if(Array.isArray(t)&&(t=t.reduce((e,t)=>(e[t]=!0,e),{})),e.__$Observable){const n=`obs-${Math.random().toString(36).substr(2,9)}`;t[n]=e}else t[e]=n;else Array.isArray(t)?t.push(e):t[e]=n},value:()=>Array.isArray(t)?t.join(" "):{...t}}},qe=e=>{let t=null;return(...n)=>(null!=t||(t=e(...n)),t)},We=e=>{let t=null;return new Proxy({},{get:(n,r)=>(t||(t=e()),t[r])})},Ue=e=>{const t=new Map;return new Proxy({},{get:(n,r)=>{const o=t.get(r);if(o)return o;if(e.length>0)return(...n)=>{const o=e(...n,r);return t.set(r,o),o};const s=e(r);return t.set(r,s),s}})},ze=function(){const e=new Map,t=new Map,o=(t,o)=>{const s=e.get(o);if(!s)throw n.error("Store",`Store.${t}('${o}') : store not found. Did you call Store.create('${o}') first?`),new r(`Store.${t}('${o}') : store not found.`);return s},s=(e,t={})=>Array.isArray(e)?le.array(e,t):"object"==typeof e?le.object(e,t):le(e,t);return new Proxy({create(t,o){if(e.has(t))throw n.warn("Store",`Store.create('${t}') : a store with this name already exists. Use Store.get('${t}') to retrieve it.`),new r(`Store.create('${t}') : a store with this name already exists.`);const i=s(o);return e.set(t,{observer:i,subscribers:new Set,resettable:!1,composed:!1}),i},createResettable(t,o){if(e.has(t))throw n.warn("Store",`Store.createResettable('${t}') : a store with this name already exists.`),new r(`Store.createResettable('${t}') : a store with this name already exists.`);const i=s(o,{reset:!0});return e.set(t,{observer:i,subscribers:new Set,resettable:!0,composed:!1}),i},createComposed(t,o,s){if(e.has(t))throw n.warn("Store",`Store.createComposed('${t}') : a store with this name already exists.`),new r(`Store.createComposed('${t}') : a store with this name already exists.`);if("function"!=typeof o)throw new r(`Store.createComposed('${t}') : computation must be a function.`);if(!Array.isArray(s)||0===s.length)throw new r(`Store.createComposed('${t}') : dependencies must be a non-empty array of store names.`);const i=s.map(o=>{if("string"!=typeof o)return o;const s=e.get(o);if(!s)throw n.error("Store",`Store.createComposed('${t}') : dependency '${o}' not found. Create it first.`),new r(`Store.createComposed('${t}') : dependency store '${o}' not found.`);return s.observer}),a=le.computed(o,i);return e.set(t,{observer:a,subscribers:new Set,resettable:!1,composed:!0}),a},has:t=>e.has(t),reset(e){const t=o("reset",e);if(t.composed)throw n.error("Store",`Store.reset('${e}') : composed stores cannot be reset. Their value is derived from dependencies.`),new r(`Store.reset('${e}') : composed stores cannot be reset.`);if(!t.resettable)throw n.error("Store",`Store.reset('${e}') : this store is not resettable. Use Store.createResettable('${e}', value) instead of Store.create().`),new r(`Store.reset('${e}') : this store is not resettable. Use Store.createResettable('${e}', value) instead of Store.create().`);t.observer.reset()},use(e){const t=o("use",e);if(t.composed)throw n.error("Store",`Store.use('${e}') : composed stores are read-only. Use Store.follow('${e}') instead.`),new r(`Store.use('${e}') : composed stores are read-only. Use Store.follow('${e}') instead.`);const{observer:i,subscribers:a}=t,l=s(i.val()),u=e=>l.set(e),c=e=>i.set(e);return i.subscribe(u),l.subscribe(c),l.destroy=()=>{i.unsubscribe(u),l.unsubscribe(c),a.delete(l),l.cleanup()},l.dispose=l.destroy,a.add(l),l},follow(e){const{observer:t,subscribers:i}=o("follow",e),a=s(t.val()),l=e=>a.set(e);return t.subscribe(l),((e,t,o)=>{const s=e=>()=>{throw n.error("Store",`Store.${o}('${t}') is read-only. '${e}()' is not allowed.`),new r(`Store.${o}('${t}') is read-only.`)};e.set=s("set"),e.toggle=s("toggle"),e.reset=s("reset")})(a,e,"follow"),a.destroy=()=>{t.unsubscribe(l),i.delete(a),a.cleanup()},a.dispose=a.destroy,i.add(a),a},get(t){const r=e.get(t);return r?r.observer:(n.warn("Store",`Store.get('${t}') : store not found.`),null)},getWithSubscribers:t=>e.get(t)??null,delete(t){const r=e.get(t);r?(r.subscribers.forEach(e=>e.destroy()),r.subscribers.clear(),r.observer.cleanup(),e.delete(t)):n.warn("Store",`Store.delete('${t}') : store not found, nothing to delete.`)},group(e,t){"function"==typeof e&&(t=e,e="anonymous");const n=ze();return t&&t(n),n},createPersistent(e,t,n){n=n||e;const r=this.create(e,m(n,t)),o=b(t);return r.subscribe(e=>o(n,e)),r},createPersistentResettable(e,t,n){n=n||e;const r=this.createResettable(e,m(n,t)),o=b(t);r.subscribe(e=>o(n,e));const s=r.reset.bind(r);return r.reset=()=>{f.remove(n),s()},r}},{get(e,n){if("symbol"==typeof n||n.startsWith("$")||n in e)return e[n];if(e.has(n)){if(t.has(n))return t.get(n);const r=e.follow(n);return t.set(n,r),r}},set(e,t,o){throw n.error("Store",`Forbidden: You cannot overwrite the store key '${String(t)}'. Use .use('${String(t)}').set(value) instead.`),new r("Store structure is immutable. Use .set() on the observable.")},deleteProperty(e,t){throw new r("Store keys cannot be deleted.")}})},He=ze();He.create("locale",navigator.language.split("-")[0]||"en");const Ge=e=>e;const Ke=new Set(["clear","push","unshift","replace"]),Je=e=>e;const Ye=function(e,t,{comment:r=null,shouldKeepInCache:o=!0}={}){if(!l.isObservable(e))return"boolean"==typeof e?e?ye.getChild(t):null:n.warn("ShowIf","ShowIf : condition must be an Observable or boolean / "+r,e);const s=ve("Show if : "+(r||""));let i=null;const a=()=>(i&&o||(i=ye.getChild(t),l.isFragment(i)&&(i=Array.from(i.childNodes))),i);return e.val()&&s.appendChild(a()),e.subscribe(e=>{e?s.appendChild(a()):s.remove()}),s},Ze=function(e,t,n=!0){if(!l.isObservable(e))throw new r("Toggle : condition must be an Observable");const o=ve("Match"),s=new Map,i=function(e){if(n&&s.has(e))return s.get(e);let r=t[e];return r?(r=ye.getChild(r),l.isFragment(r)&&(r=Array.from(r.children)),n&&s.set(e,r),r):null},a=e.val(),u=i(a);return u&&o.appendChild(u),e.subscribe(e=>{const t=i(e);o.remove(),t&&o.appendChild(t)}),o.nd.with({add(n,r,o=!1){t[n]=r,o&&e.set(n)},remove(r){n&&s.delete(r),e.set([...s.keys()].at(-1)??""),delete t[r]}})},Qe=function(e,t,n){if(!l.isObservable(e))throw new r("Toggle : condition must be an Observable");return Ze(e.toBoolean(),{true:t,false:n})},Xe=ke("div"),et=ke("span"),tt=ke("label"),nt=ke("p"),rt=nt,ot=ke("strong"),st=ke("h1"),it=ke("h2"),at=ke("h3"),lt=ke("h4"),ut=ke("h5"),ct=ke("h6"),ht=ke("br"),pt=ke("a"),dt=ke("pre"),ft=ke("code"),mt=ke("blockquote"),bt=ke("hr"),yt=ke("em"),gt=ke("small"),vt=ke("mark"),$t=ke("del"),wt=ke("ins"),St=ke("sub"),Ct=ke("sup"),Ot=ke("abbr"),At=ke("cite"),Et=ke("q"),_t=ke("dl"),xt=ke("dt"),Nt=ke("dd"),Ft=ke("form",e=>(e.submit=function(t){return"function"==typeof t?(e.onSubmit(e=>{e.preventDefault(),t(e)}),e):(this.setAttribute("action",t),e)},e.multipartFormData=function(){return this.setAttribute("enctype","multipart/form-data"),e},e.post=function(t){return this.setAttribute("method","post"),this.setAttribute("action",t),e},e.get=function(e){this.setAttribute("method","get"),this.setAttribute("action",e)},e)),Dt=ke("input"),Mt=ke("textarea"),Tt=Mt,kt=ke("select"),Pt=ke("fieldset"),Lt=ke("option"),It=ke("legend"),Rt=ke("datalist"),Vt=ke("output"),jt=ke("progress"),Bt=ke("meter"),qt=ke("button"),Wt=ke("main"),Ut=ke("section"),zt=ke("article"),Ht=ke("aside"),Gt=ke("nav"),Kt=ke("figure"),Jt=ke("figcaption"),Yt=ke("header"),Zt=ke("footer"),Qt=ke("img"),Xt=function(e,t){return Qt({src:e,...t})},en=ke("details"),tn=ke("summary"),nn=ke("dialog"),rn=ke("menu"),on=ke("ol"),sn=ke("ul"),an=ke("li"),ln=an,un=on,cn=sn,hn=ke("audio"),pn=ke("video"),dn=ke("source"),fn=ke("track"),mn=ke("canvas"),bn=ke("svg"),yn=ke("time"),gn=ke("data"),vn=ke("address"),$n=ke("kbd"),wn=ke("samp"),Sn=ke("var"),Cn=ke("wbr"),On=ke("caption"),An=ke("table"),En=ke("thead"),_n=ke("tfoot"),xn=ke("tbody"),Nn=ke("tr"),Fn=Nn,Dn=ke("th"),Mn=Dn,Tn=Dn,kn=ke("td"),Pn=kn;function Ln(e){let t=null,n=(r,o)=>(t=document.createElementNS("http://www.w3.org/2000/svg",e),n=(e,n)=>Te(t.cloneNode(),e,n),Te(t.cloneNode(),r,o));return(e,t)=>n(e,t)}const In=Ln("svg"),Rn=Ln("circle"),Vn=Ln("rect"),jn=Ln("ellipse"),Bn=Ln("line"),qn=Ln("polyline"),Wn=Ln("polygon"),Un=Ln("path"),zn=Ln("text"),Hn=Ln("tspan"),Gn=Ln("textPath"),Kn=Ln("g"),Jn=Ln("defs"),Yn=Ln("use"),Zn=Ln("symbol"),Qn=Ln("clipPath"),Xn=Ln("mask"),er=Ln("marker"),tr=Ln("pattern"),nr=Ln("image"),rr=Ln("foreignObject"),or=Ln("switch"),sr=Ln("linearGradient"),ir=Ln("radialGradient"),ar=Ln("stop"),lr=Ln("filter"),ur=Ln("feBlend"),cr=Ln("feColorMatrix"),hr=Ln("feComposite"),pr=Ln("feFlood"),dr=Ln("feGaussianBlur"),fr=Ln("feMerge"),mr=Ln("feMergeNode"),br=Ln("feOffset"),yr=Ln("feTurbulence"),gr=Ln("feDisplacementMap"),vr=Ln("feDiffuseLighting"),$r=Ln("feSpecularLighting"),wr=Ln("feDistantLight"),Sr=Ln("fePointLight"),Cr=Ln("feSpotLight"),Or=Ln("feMorphology"),Ar=Ln("feConvolveMatrix"),Er=Ln("feComponentTransfer"),_r=Ln("feFuncR"),xr=Ln("feFuncG"),Nr=Ln("feFuncB"),Fr=Ln("feFuncA"),Dr=Ln("animate"),Mr=Ln("animateTransform"),Tr=Ln("animateMotion"),kr=Ln("mpath"),Pr=Ln("set"),Lr=Ln("desc"),Ir=Ln("title"),Rr=Ln("metadata"),Vr=Ln("view"),jr=Ln("style"),Br=Ln("script"),qr=ke("");var Wr=Object.freeze({__proto__:null,Abbr:Ot,Address:vn,Anchor:ve,Article:zt,Aside:Ht,AsyncImg:function(e,t,n,o){const s=l.isObservable(e)?e.val():e,i=Xt(t||s,n),a=new Image;return a.onload=()=>{l.isFunction(o)&&o(null,i),i.src=l.isObservable(e)?e.val():e},a.onerror=()=>{l.isFunction(o)&&o(new r("Image not found"))},l.isObservable(e)&&e.subscribe(e=>{a.src=e}),a.src=s,i},Audio:hn,BaseImage:Qt,Blockquote:mt,Br:ht,Button:qt,Canvas:mn,Caption:On,Checkbox:e=>Dt({type:"checkbox",...e}),Cite:At,Code:ft,ColorInput:e=>Dt({type:"color",...e}),Data:gn,Datalist:Rt,DateInput:e=>Dt({type:"date",...e}),DateTimeInput:e=>Dt({type:"datetime-local",...e}),Dd:Nt,Del:$t,Details:en,Dialog:nn,Div:Xe,Dl:_t,Dt:xt,Em:yt,EmailInput:e=>Dt({type:"email",...e}),FieldSet:Pt,FigCaption:Jt,Figure:Kt,FileInput:e=>Dt({type:"file",...e}),Footer:Zt,ForEach:function(e,t,o,{shouldKeepItemsInCache:s=!1}={}){t=t||Ge;const i=ve("ForEach"),a=i.endElement();i.startElement();let u=new Map,c=null;const h=new Set,p=e=>{if(!s)for(const[t,n]of u.entries()){if(h.has(t))continue;const r=n.child?.deref();e&&r&&r.remove(),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,u.delete(n.keyId),c&&c.delete(n.keyId)}},d=(e,s)=>{const i=((e,t,n)=>{if(l.isString(n)){const r=l.isObservable(e)?e.val():e,o=r?.[n];return l.isObservable(o)?o.val():o??t}return l.isFunction(n)?n(e,t):(l.isObservable(e)?e.val():e)??t})(e,s,o);if(u.has(i)){const e=u.get(i);if(e.indexObserver?.set(s),e.isNew=!1,e.child?.deref())return i;u.delete(i)}try{const n=t.length>=2?le(s):null;let o=ye.getChild(t(e,n));if(!o)throw new r("ForEach child can't be null or undefined!");u.set(i,{keyId:i,isNew:!0,child:new WeakRef(o),indexObserver:n})}catch(e){throw n.error("ForEach",`Error creating element for key ${i}`,e),e}return i},f=()=>{const t=a.parentNode;if(!t)return;const n=l.isObservable(e)?e.val():e;if(h.clear(),Array.isArray(n))for(let e=0,t=n.length;e<t;e++){const t=d(n[e],e);h.add(t)}else for(const e in n){const t=d(n[e],e);h.add(t)}if(0===h.size)return i.removeChildren(),p(),void c?.clear();p(t),c&&0!==c.size?(()=>{let e=document.createDocumentFragment();const t=Array.from(h);Array.from(c);for(const n in t){const r=t[n],o=u.get(r);if(!o)continue;const s=o.child.deref();s&&e.appendChild(s)}i.replaceContent(e)})():(e=>{const t=document.createDocumentFragment();for(const e of h){const n=u.get(e);if(!n)continue;const r=n.child?.deref();r&&t.appendChild(r)}e.insertBefore(t,a)})(t),c?.clear(),c=new Set([...h])};return f(),l.isObservable(e)&&e.subscribe(f),i},ForEachArray:function(e,t,n={}){t=t||Je;const r=ve("ForEach Array",n.isParentUniqueChild),o=r.endElement();let s=new Map,i=0;const a=t.length>=2,l=e=>{r.removeChildren(),f(e),i=0},u=e=>s.get(e)?.child,c=(e,t=!0)=>{const n=s.get(e);if(n){if(t){const t=n.child;t?.remove(),s.delete(e)}n.indexObserver?.cleanup()}},h=e=>{const n=ye.getChild(t(e,null));return s.set(e,{child:n,indexObserver:null}),n};let p=(n,r)=>{const o=e.transform(e=>e.indexOf(n)),i=ye.getChild(t(n,o));return s.set(n,{child:i,indexObserver:o}),i};e.__$Observable||(p=(e,n)=>{const r=ye.getChild(t(e,n));return s.set(e,{child:r,indexObserver:null}),r});const d=(e,t)=>{const n=s.get(e);return n?(n.indexObserver?.set(t),n.child):h(e)};let f,m=h;f=a?n.shouldKeepItemsInCache?()=>{}:e=>{for(const[t,n]of s.entries())e&&e.includes(t)||c(t,!1)}:s.clear.bind(s);const b=(e,t)=>{const n=s.get(e);if(!n)return null;const r=n.child;if(!r)return null;t?t.appendChild(r):r.remove()};let y=null;y=Array.isArray(e)?()=>{l(e),r.appendChildRaw(g.toFragment(e))}:()=>{const t=e.val();l(t),r.appendChildRaw(g.toFragment(t))};const g={toFragment:e=>{const t=document.createDocumentFragment();for(let n=0,r=e.length;n<r;n++)t.appendChild(m(e[n],i)),i++;return t},add:e=>{r.appendChildRaw(g.toFragment(e))},replace:e=>{l(e),r.appendChildRaw(g.toFragment(e))},set:y,reOrder:e=>{let t=null;const n=document.createDocumentFragment();for(const r of e)t=u(r),t&&n.appendChild(t);t=null,r.appendChildRaw(n)},removeOne:(e,t)=>{c(e,!0)},clear:l,populate:([e,t,n])=>{const o=document.createDocumentFragment();for(let r=0;r<t;r++){const t=n(r);e.push(t),o.append(m(t,r)),i++}r.appendChildRaw(o),o.replaceChildren()},unshift:e=>{r.insertAtStartRaw(g.toFragment(e))},splice:(t,n)=>{const[s,i,...a]=t;let l=null;const c=document.createDocumentFragment();if(n.length>0){let e=n[0];if(1===n.length)b(e,c);else if(n.length>1){const e=u(n[0]);l=e?.previousSibling;for(let e=0;e<n.length;e++)b(n[e],c)}}else{const t=s-1>=0?s-1:s,n=e.at(t);l=u(n)||o.previousSibling}c.replaceChildren(),a&&a.length&&l&&r.insertBeforeRaw(g.toFragment(a),l.nextSibling)},reverse:(e,t)=>{g.reOrder(t)},sort:(e,t)=>{g.reOrder(t)},remove:(e,t)=>{g.removeOne(t)},pop:(e,t)=>{g.removeOne(t)},shift:(e,t)=>{g.removeOne(t)},swap:(e,t)=>{const n=r.getParent();let o=u(t[0]),s=u(t[1]);if(!o||!s)return;const i=s.nextSibling;n.insertBefore(s,o),n.insertBefore(o,i),o=null,s=null}};g.merge=g.add,g.push=g.add;const v=(e,t,n={})=>{((e=null)=>{m=Ke.has(e)?a?p:h:s.size?d:a?p:h})(n.action),g[n.action]&&g[n.action](n.args,n.result)};return Array.isArray(e)?(v(0,0,{action:"set"}),r):(e.val().length&&v(e.val(),0,{action:"set"}),e.subscribe(v),r)},Form:Ft,Fragment:qr,H1:st,H2:it,H3:at,H4:lt,H5:ut,H6:ct,Header:Yt,HiddenInput:e=>Dt({type:"hidden",...e}),HideIf:function(e,t,n){const r=le(!e.val());return e.subscribe(e=>r.set(!e)),Ye(r,t,n)},HideIfNot:function(e,t,n){return Ye(e,t,n)},Hr:bt,Img:Xt,Input:Dt,Ins:wt,Kbd:$n,Label:tt,LazyImg:function(e,t){return Xt(e,{...t,loading:"lazy"})},Legend:It,Li:ln,Link:pt,ListItem:an,Main:Wt,Mark:vt,Match:Ze,Menu:rn,Meter:Bt,MonthInput:e=>Dt({type:"month",...e}),NativeDocumentFragment:ve,Nav:Gt,NumberInput:e=>Dt({type:"number",...e}),Ol:un,Option:Lt,OrderedList:on,Output:Vt,P:nt,Paragraph:rt,PasswordInput:e=>Dt({type:"password",...e}),Pre:dt,Progress:jt,Quote:Et,Radio:e=>Dt({type:"radio",...e}),RangeInput:e=>Dt({type:"range",...e}),ReadonlyInput:e=>Dt({readonly:!0,...e}),Samp:wn,SearchInput:e=>Dt({type:"search",...e}),Section:Ut,Select:kt,ShowIf:Ye,ShowWhen:function(){if(2===arguments.length){const[e,t]=arguments;if(!l.isObservableWhenResult(e))throw new r("showWhen observer must be an ObservableWhenResult",{data:e,help:"Use observer.when(target) to create an ObservableWhenResult"});return Ye(e,t)}if(3===arguments.length){const[e,t,n]=arguments;if(!l.isObservable(e))throw new r("showWhen observer must be an Observable",{data:e});return Ye(e.when(t),n)}throw new r("showWhen must have 2 or 3 arguments",{data:["showWhen(observer, target, view)","showWhen(observerWhenResult, view)"]})},SimpleButton:(e,t)=>qt(e,{type:"button",...t}),Small:gt,Source:dn,Span:et,Strong:ot,Sub:St,SubmitButton:(e,t)=>qt(e,{type:"submit",...t}),Summary:tn,Sup:Ct,Svg:bn,SvgAnimate:Dr,SvgAnimateMotion:Tr,SvgAnimateTransform:Mr,SvgCircle:Rn,SvgClipPath:Qn,SvgDefs:Jn,SvgDesc:Lr,SvgEllipse:jn,SvgFEBlend:ur,SvgFEColorMatrix:cr,SvgFEComponentTransfer:Er,SvgFEComposite:hr,SvgFEConvolveMatrix:Ar,SvgFEDiffuseLighting:vr,SvgFEDisplacementMap:gr,SvgFEDistantLight:wr,SvgFEFlood:pr,SvgFEFuncA:Fr,SvgFEFuncB:Nr,SvgFEFuncG:xr,SvgFEFuncR:_r,SvgFEGaussianBlur:dr,SvgFEMerge:fr,SvgFEMergeNode:mr,SvgFEMorphology:Or,SvgFEOffset:br,SvgFEPointLight:Sr,SvgFESpecularLighting:$r,SvgFESpotLight:Cr,SvgFETurbulence:yr,SvgFilter:lr,SvgForeignObject:rr,SvgG:Kn,SvgImage:nr,SvgLine:Bn,SvgLinearGradient:sr,SvgMPath:kr,SvgMarker:er,SvgMask:Xn,SvgMetadata:Rr,SvgPath:Un,SvgPattern:tr,SvgPolygon:Wn,SvgPolyline:qn,SvgRadialGradient:ir,SvgRect:Vn,SvgScript:Br,SvgSet:Pr,SvgStop:ar,SvgStyle:jr,SvgSvg:In,SvgSwitch:or,SvgSymbol:Zn,SvgTSpan:Hn,SvgText:zn,SvgTextPath:Gn,SvgTitle:Ir,SvgUse:Yn,SvgView:Vr,Switch:Qe,TBody:xn,TBodyCell:Pn,TFoot:_n,TFootCell:Tn,THead:En,THeadCell:Mn,TRow:Fn,Table:An,Td:kn,TelInput:e=>Dt({type:"tel",...e}),TextArea:Mt,TextInput:Tt,Th:Dn,Time:yn,TimeInput:e=>Dt({type:"time",...e}),Tr:Nn,Track:fn,Ul:cn,UnorderedList:sn,UrlInput:e=>Dt({type:"url",...e}),Var:Sn,Video:pn,Wbr:Cn,WeekInput:e=>Dt({type:"week",...e}),When:function(e){if(!l.isObservable(e))throw new r("When : condition must be an Observable");let t=null,n=null;return{show(e){return t=e,this},otherwise:r=>(n=r,Qe(e,t,n)),toNdElement:()=>Qe(e,t,n)}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=ve("Portal "+n);return r.appendChild(ye.getChild(e)),(t||document.body).appendChild(r),r}});const Ur={id:"[0-9]+",uuid:"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",slug:"[a-z0-9]+(?:-[a-z0-9]+)*",hash:"[a-f0-9]{32,64}",alpha:"[a-zA-Z]+",alphanum:"[a-zA-Z0-9]+",string:"[^/]+",any:".*",int:"[0-9]+",float:"[0-9]+\\.[0-9]+",number:"[0-9]+(\\.[0-9]+)?",positive:"[1-9][0-9]*",locale:"[a-z]{2}(-[A-Z]{2})?",lang:"[a-z]{2}",token:"[A-Za-z0-9_\\-]+"};function zr(e,t,n={}){e="/"+p(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,a=n.with||{},l=n.layout||null,u={},c=[],h=e=>{if(!e)return null;const[t,n]=e.split(":");let r=a[t];return!r&&n&&(r=Ur[n]),r||(r="[^/]+"),r=r.replace("(","(?:"),{name:t,pattern:`(${r})`}},d=()=>{if(r)return r;const t=e.replace(/\{(.*?)}/gi,(e,t)=>{const n=h(t);return n&&n.pattern?(u[n.name]=n.pattern,c.push(n.name),n.pattern):e});return r=new RegExp("^"+t+"$"),r};this.name=()=>o,this.component=()=>t,this.middlewares=()=>s,this.shouldRebuild=()=>i,this.path=()=>e,this.layout=()=>l,this.match=function(e){e="/"+p(e,"/");if(!d().exec(e))return!1;const t={};return d().exec(e).forEach((e,n)=>{if(n<1)return;const r=c[n-1];t[r]=e}),t},this.url=function(t){const n=e.replace(/\{(.*?)}/gi,(e,n)=>{const r=h(n);if(t.params&&t.params[r.name])return t.params[r.name];throw new Error(`Missing parameter '${r.name}'`)}),r="object"==typeof t.query?new URLSearchParams(t.query).toString():null;return(t.basePath?t.basePath:"")+(r?`${n}?${r}`:n)}}class Hr extends Error{constructor(e,t){super(e),this.context=t}}const Gr=(e,t)=>{const n=[];return e.forEach(e=>{n.push(p(e.suffix,"/"))}),n.push(p(t,"/")),n.join("/")},Kr=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},Jr=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},Yr=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Zr(){const e=[];let t=0;const n=n=>{const o=t+n;if(!e[o])return;t=o;const{route:s,params:i,query:a,path:l}=e[o];r(l)},r=e=>{window.location.replace(`${window.location.pathname}${window.location.search}#${e}`)},o=()=>window.location.hash.slice(1);this.push=function(n){const{route:s,params:i,query:a,path:l}=this.resolve(n);l!==o()&&(e.splice(t+1),e.push({route:s,params:i,query:a,path:l}),t++,r(l))},this.replace=function(n){const{route:r,params:s,query:i,path:a}=this.resolve(n);a!==o()&&(e[t]={route:r,params:s,query:i,path:a})},this.forward=function(){return t<e.length-1&&n(1)},this.back=function(){return t>0&&n(-1)},this.init=function(n){window.addEventListener("hashchange",()=>{const{route:e,params:t,query:n,path:r}=this.resolve(o());this.handleRouteChange(e,t,n,r)});const{route:r,params:s,query:i,path:a}=this.resolve(n||o());e.push({route:r,params:s,query:i,path:a}),t=0,this.handleRouteChange(r,s,i,a)}}function Qr(){this.push=function(e){try{const{route:t,path:n,params:r,query:o}=this.resolve(e);if(window.history.state&&window.history.state.path===n)return;window.history.pushState({name:t.name(),params:r,path:n},t.name()||n,n),this.handleRouteChange(t,r,o,n)}catch(e){n.error("HistoryRouter","Error in pushState",e)}},this.replace=function(e){const{route:t,path:r,params:o}=this.resolve(e);try{window.history.replaceState({name:t.name(),params:o,path:r},t.name()||r,r),this.handleRouteChange(t,o,{},r)}catch(e){n.error("HistoryRouter","Error in replaceState",e)}},this.forward=function(){window.history.forward()},this.back=function(){window.history.back()},this.init=function(e){window.addEventListener("popstate",e=>{try{if(!e.state||!e.state.path)return;const t=e.state.path,{route:n,params:r,query:o,path:s}=this.resolve(t);if(!n)return;this.handleRouteChange(n,r,o,s)}catch(e){n.error("HistoryRouter","Error in popstate event",e)}});const{route:t,params:r,query:o,path:s}=this.resolve(e||window.location.pathname+window.location.search);this.handleRouteChange(t,r,o,s)}}function Xr(){const e=[];let t=0;const n=n=>{const r=t+n;if(!e[r])return;t=r;const{route:o,params:s,query:i,path:a}=e[r];this.handleRouteChange(o,s,i,a)};this.push=function(n){const{route:r,params:o,query:s,path:i}=this.resolve(n);e[t]&&e[t].path===i||(e.splice(t+1),e.push({route:r,params:o,query:s,path:i}),t++,this.handleRouteChange(r,o,s,i))},this.replace=function(n){const{route:r,params:o,query:s,path:i}=this.resolve(n);e[t]={route:r,params:o,query:s,path:i},this.handleRouteChange(r,o,s,i)},this.forward=function(){return t<e.length-1&&n(1)},this.back=function(){return t>0&&n(-1)},this.init=function(n){const r=n||window.location.pathname+window.location.search,{route:o,params:s,query:i,path:a}=this.resolve(r);e.push({route:o,params:s,query:i,path:a}),t=0,this.handleRouteChange(o,s,i,a)}}function eo(e,t){const n=new Map,r=new WeakMap,o=new WeakMap;let s=null,i=null;const a=(e,t)=>{const n=o.get(e);if(n)return n;let r=e;return l.isAnchor(e)||(r=ve(t),r.appendChild(e)),o.set(e,r),r},u=()=>{i?.remove()},c=()=>{t.nodeValue="",u(),s&&s.remove()},h=e=>{let t=e;return l.isNDElement(e)&&(t=e.node()),t},p=function(e,n,o){const l=n.layout();if(l)return void((e,n,o,l)=>{let p=h(n);const d=r.get(p);if(d){if(d===s){const e=a(p,l);return u(),i=p,void e.replaceContent(p)}return c(),i=p,s=d,a(p,l).replaceContent(p),void t.appendChild(s)}c(),i=p;const f=a(p,l);s=ye.getChild(e(f)),r.set(p,s),t.appendChild(s)})(l,e,0,o);let p=h(e);c(),t.appendChild(p),i=e},d=function(e){if(!e.route)return;const{route:t,params:r,query:o,path:s}=e;if(n.has(s)){const e=n.get(s);return void p(e,t)}const i=t.component()({params:r,query:o});n.set(s,i),p(i,t,s)};return e.subscribe(d),d(e.currentState()),t}const to="default";function no(e={}){const t=[],r={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Zr.apply(this,[]);else if("history"===e.mode)Qr.apply(this,[]);else{if("memory"!==e.mode)throw new Hr("Invalid router mode "+e.mode);Xr.apply(this,[])}const a=function(e,t){for(const r of s)try{r(e),t&&t(e)}catch(e){n.warn("Route Listener","Error in listener:",e)}};this.routes=()=>[...t],this.currentState=()=>({...i}),this.add=function(e,n,s){const i=new zr(Gr(o,e),n,{...s,middlewares:Kr(o,s?.middlewares||[]),name:s?.name?Jr(o,s.name):null,layout:s?.layout||Yr(o)});return t.push(i),i.name()&&(r[i.name()]=i),this},this.group=function(e,t,n){if(!l.isFunction(n))throw new Hr("Callback must be a function");return o.push({suffix:e,options:t}),n(),o.pop(),this},this.generateUrl=function(e,t={},n={}){const o=r[e];if(!o)throw new Hr(`Route not found for name: ${e}`);return o.url({params:t,query:n})},this.resolve=function(e){if("string"==typeof e){const t=r[e];if(t)return{route:t,params:[],query:[],path:t.url({name:e})}}if(l.isJson(e)){const t=r[e.name];if(!t)throw new Hr(`Route not found for name: ${e.name}`);return{route:t,params:e.params,query:e.query,path:t.url({...e})}}const[n,o]=e.split("?"),s="/"+p(n,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new Hr(`Route not found for url: ${n}`);const u={};if(o){const e=new URLSearchParams(o).entries();for(const[t,n]of e)u[t]=n}return{route:a,params:i,query:u,path:e}},this.subscribe=function(e){if(!l.isFunction(e))throw new Hr("Listener must be a function");return s.push(e),()=>{s.splice(s.indexOf(e),1)}},this.handleRouteChange=function(e,t,n,r){i.route=e,i.params=t,i.query=n,i.path=r;const o=[...e.middlewares(),a];let s=0;const l={...i},u=e=>{if(s++,!(s>=o.length))return o[s](e||l,u)};return o[s](l,u)}}function ro(e,t){const{to:n,href:r,...o}=e;if(r){const e=no.get();return pt({...o,href:r},t).nd.onPreventClick(()=>{e.push(r)})}const s="string"==typeof n?{name:n}:n,i=s.router||to,a=no.get(i);if(!a)throw new Hr('Router not found "'+i+'" for link "'+s.name+'"');const l=a.generateUrl(s.name,s.params,s.query);return pt({...o,href:l},t).nd.onPreventClick(()=>{a.push(l)})}no.routers={},no.create=function(e,t){if(!l.isFunction(t))throw n.error("Router","Callback must be a function"),new Hr("Callback must be a function");const r=new no(e);return no.routers[e.name||to]=r,t(r),r.init(e.entry),r.mount=function(e){if(l.isString(e)){const t=document.querySelector(e);if(!t)throw new Hr(`Container not found for selector: ${e}`);e=t}else if(!l.isElement(e))throw new Hr("Container must be a string or an Element");return eo(r,e)},r},no.get=function(e){const t=no.routers[e||to];if(!t)throw new Hr(`Router not found for name: ${e}`);return t},no.push=function(e,t=null){return no.get(t).push(e)},no.replace=function(e,t=null){return no.get(t).replace(e)},no.forward=function(e=null){return no.get(e).forward()},no.back=function(e=null){return no.get(e).back()},no.redirectTo=function(e,t=null,n=null){let r=e;const o=no.get(n);return o.resolve({name:e,params:t})&&(r={name:e,params:t}),o.push(r)},ro.blank=function(e,t){return pt({...e,target:"_blank"},t)};var oo=Object.freeze({__proto__:null,Link:ro,RouteParamPatterns:Ur,Router:no});var so=Object.freeze({__proto__:null,memoize:e=>Ue(e),once:e=>We(e),singleton:e=>qe(e)}),io=Object.freeze({__proto__:null,Cache:so,NativeFetch:function(e){const t={request:[],response:[]};this.interceptors={response:e=>{t.response.push(e)},request:e=>{t.request.push(e)}},this.fetch=async function(n,r,o={},s={}){if(s.formData){const e=new FormData;for(const t in o)e.append(t,o[t]);o=e}r.startsWith("http")||(r=(e.endsWith("/")?e:e+"/")+r);let i={method:n,headers:{...s.headers||{}}};if(o)if(o instanceof FormData)i.body=o;else if("GET"!==n)i.headers["Content-Type"]="application/json",i.body=JSON.stringify(o);else{const e=new URLSearchParams(o).toString();e&&(r=r+(r.includes("?")?"&":"?")+e)}for(const e of t.request)i=await e(i,r)||i;let a=await fetch(r,i);for(const e of t.response)a=await e(a,r)||a;const l=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok){const e=new Error(l?.message||a.statusText);throw e.status=a.status,e.data=l,e}return l},this.post=function(e,t={},n={}){return this.fetch("POST",e,t,n)},this.put=function(e,t={},n={}){return this.fetch("PUT",e,t,n)},this.delete=function(e,t={},n={}){return this.fetch("DELETE",e,t,n)},this.get=function(e,t={},n={}){return this.fetch("GET",e,t,n)}},classPropertyAccumulator:Be,cssPropertyAccumulator:je,filters:U});return e.$=ue,e.ElementCreator=ye,e.HtmlElementWrapper=ke,e.NDElement=Ce,e.Observable=le,e.PluginsManager=null,e.SingletonView=Ve,e.Store=He,e.StoreFactory=ze,e.TemplateCloner=Ie,e.Validator=l,e.autoMemoize=Ue,e.autoOnce=We,e.classPropertyAccumulator=Be,e.createTextNode=Me,e.cssPropertyAccumulator=je,e.elements=Wr,e.memoize=e=>{const t=new Map;return(...n)=>{const[r,...o]=n,s=t.get(r);if(s)return s;const i=e(...o);return t.set(r,i),i}},e.normalizeComponentArgs=we,e.obs=ce,e.once=qe,e.router=oo,e.useCache=function(e){let t=null,n=r=>{t=new Ie(e);const o=t.clone(r);return n=t.clone,o};return e.length<2?(...e)=>n(e):(e,t,...r)=>n([e,t,...r])},e.useSingleton=function(e){let t=null;return function(...n){return t||(t=new Ve(e)),t.render(n)}},e.utils=io,e.withValidation=$e,e}({});
|
package/index.js
CHANGED
|
@@ -6,6 +6,8 @@ export { SingletonView, useSingleton } from './src/core/wrappers/SingletonView';
|
|
|
6
6
|
export { default as PluginsManager } from './src/core/utils/plugins-manager';
|
|
7
7
|
export { default as Validator } from './src/core/utils/validator';
|
|
8
8
|
|
|
9
|
+
export { Formatters } from "./elements";
|
|
10
|
+
|
|
9
11
|
export * from './src/core/utils/property-accumulator';
|
|
10
12
|
export * from './src/core/utils/args-types';
|
|
11
13
|
export * from './src/core/utils/memoize';
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ export default function ObservableResource(fn, deps, config) {
|
|
|
16
16
|
this.$controller = null;
|
|
17
17
|
this.$subscriptions = [];
|
|
18
18
|
|
|
19
|
-
this.data = config.
|
|
19
|
+
this.data = config.into ?? new ObservableItem(null);
|
|
20
20
|
this.error = new ObservableItem(null);
|
|
21
21
|
this.state = new ObservableItem(STATE.UNRESOLVED);
|
|
22
22
|
|
|
@@ -34,6 +34,14 @@ export default function ObservableResource(fn, deps, config) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
ObservableResource.prototype.$applyResult = function(result) {
|
|
38
|
+
if(this.$config.apply) {
|
|
39
|
+
this.$config.apply(result, this.data);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.data.set(result);
|
|
43
|
+
};
|
|
44
|
+
|
|
37
45
|
ObservableResource.prototype.$abort = function() {
|
|
38
46
|
if (this.$controller) {
|
|
39
47
|
this.$controller.abort();
|
|
@@ -61,7 +69,7 @@ ObservableResource.prototype.$runWithAbortController = function(isRefetch = fals
|
|
|
61
69
|
if (signal.aborted) {
|
|
62
70
|
return;
|
|
63
71
|
}
|
|
64
|
-
this
|
|
72
|
+
this.$applyResult(result);
|
|
65
73
|
this.error.set(null);
|
|
66
74
|
this.state.set(STATE.READY);
|
|
67
75
|
this.$controller = null;
|
|
@@ -86,7 +94,7 @@ ObservableResource.prototype.$runWithoutAbortController = function(isRefetch = f
|
|
|
86
94
|
|
|
87
95
|
Promise.resolve(this.$fn(...args))
|
|
88
96
|
.then(result => {
|
|
89
|
-
this
|
|
97
|
+
this.$applyResult(result);
|
|
90
98
|
this.error.set(null);
|
|
91
99
|
this.state.set(STATE.READY);
|
|
92
100
|
})
|
|
@@ -121,6 +129,16 @@ ObservableResource.prototype.$watchDependencies = function() {
|
|
|
121
129
|
}
|
|
122
130
|
};
|
|
123
131
|
|
|
132
|
+
ObservableResource.prototype.apply = function(fn) {
|
|
133
|
+
this.$config.apply = fn;
|
|
134
|
+
return this;
|
|
135
|
+
};
|
|
136
|
+
ObservableResource.prototype.into = function($observable) {
|
|
137
|
+
this.$config.into = $observable;
|
|
138
|
+
this.data = $observable;
|
|
139
|
+
return this;
|
|
140
|
+
};
|
|
141
|
+
|
|
124
142
|
ObservableResource.prototype.fetch = function() {
|
|
125
143
|
this.$run(false);
|
|
126
144
|
return this;
|
|
@@ -87,6 +87,23 @@ NDElement.prototype.lifecycle = function(states) {
|
|
|
87
87
|
return this;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
+
NDElement.prototype.destroyOnUnmount = function() {
|
|
91
|
+
this.unmounted(() => {
|
|
92
|
+
this.$element?.querySelectorAll('[data--nd-before-unmount]').forEach(child => {
|
|
93
|
+
child.remove();
|
|
94
|
+
child.__$controller?.abort();
|
|
95
|
+
child.__$controller = null;
|
|
96
|
+
$lifeCycleObservers.delete(child);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
this.$element.__$controller?.abort();
|
|
100
|
+
this.$element.__$controller = null;
|
|
101
|
+
$lifeCycleObservers.delete(this.$element);
|
|
102
|
+
this.$element = null;
|
|
103
|
+
});
|
|
104
|
+
return this;
|
|
105
|
+
};
|
|
106
|
+
|
|
90
107
|
NDElement.prototype.mounted = function(callback) {
|
|
91
108
|
return this.lifecycle({ mounted: callback });
|
|
92
109
|
};
|
|
@@ -102,7 +119,8 @@ NDElement.prototype.beforeUnmount = function(id, callback) {
|
|
|
102
119
|
DocumentObserver.beforeUnmount.set(el, new Map());
|
|
103
120
|
const originalRemove = el.remove.bind(el);
|
|
104
121
|
|
|
105
|
-
let $isUnmounting = false
|
|
122
|
+
let $isUnmounting = false;
|
|
123
|
+
this.$element.setAttribute('data--nd-before-unmount', '1');
|
|
106
124
|
|
|
107
125
|
el.remove = async () => {
|
|
108
126
|
if($isUnmounting) {
|
|
@@ -65,14 +65,10 @@ EVENTS_WITH_PREVENT.forEach(eventSourceName => {
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
NDElement.prototype.$getSignal = function() {
|
|
68
|
-
if(!this.$controller) {
|
|
69
|
-
this.$controller = new AbortController();
|
|
70
|
-
this.beforeUnmount('abort-controller', () => {
|
|
71
|
-
this.$controller.abort();
|
|
72
|
-
this.$controller = null;
|
|
73
|
-
});
|
|
68
|
+
if(!this.$element.__$controller) {
|
|
69
|
+
this.$element.__$controller = new AbortController();
|
|
74
70
|
}
|
|
75
|
-
return this.$controller.signal;
|
|
71
|
+
return this.$element.__$controller.signal;
|
|
76
72
|
};
|
|
77
73
|
|
|
78
74
|
NDElement.prototype.on = function(name, callback, options) {
|
|
@@ -9,27 +9,30 @@ export function SingletonView($viewCreator) {
|
|
|
9
9
|
if(!$cacheNode) {
|
|
10
10
|
$cacheNode = $viewCreator(this);
|
|
11
11
|
}
|
|
12
|
-
if(!$components)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
12
|
+
if(!$components) return $cacheNode;
|
|
13
|
+
|
|
14
|
+
const updates = data[0];
|
|
15
|
+
if(updates && typeof updates === 'object') {
|
|
16
|
+
for(const key in updates) {
|
|
17
|
+
if($components[key]) {
|
|
18
|
+
$components[key](updates[key]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
return $cacheNode;
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
this.createSection = (name, fn) => {
|
|
23
26
|
$components = $components || {};
|
|
24
|
-
const anchor = Anchor('Component '+name);
|
|
27
|
+
const anchor = Anchor('Component ' + name);
|
|
25
28
|
|
|
26
|
-
$components[name] = function(
|
|
29
|
+
$components[name] = function(content) {
|
|
27
30
|
anchor.removeChildren();
|
|
28
31
|
if(!fn) {
|
|
29
|
-
anchor.append(
|
|
32
|
+
anchor.append(content);
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
|
-
anchor.appendChild(fn(
|
|
35
|
+
anchor.appendChild(fn(content));
|
|
33
36
|
};
|
|
34
37
|
return anchor;
|
|
35
38
|
};
|