native-document 1.0.77 → 1.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/native-document.components.min.js +158 -130
  2. package/dist/native-document.dev.js +191 -144
  3. package/dist/native-document.dev.js.map +1 -1
  4. package/dist/native-document.devtools.min.js +1 -1
  5. package/dist/native-document.min.js +1 -1
  6. package/package.json +1 -1
  7. package/rollup.config.js +0 -16
  8. package/src/components/$traits/HasItems.js +1 -1
  9. package/src/components/accordion/Accordion.js +2 -2
  10. package/src/components/accordion/AccordionItem.js +2 -2
  11. package/src/components/alert/Alert.js +2 -2
  12. package/src/components/avatar/Avatar.js +2 -2
  13. package/src/components/badge/Badge.js +2 -2
  14. package/src/components/breadcrumb/BreadCrumb.js +2 -2
  15. package/src/components/button/Button.js +2 -2
  16. package/src/components/card/Card.js +1 -1
  17. package/src/components/context-menu/ContextMenu.js +2 -2
  18. package/src/components/context-menu/ContextMenuGroup.js +1 -1
  19. package/src/components/context-menu/ContextMenuItem.js +1 -1
  20. package/src/components/divider/Divider.js +1 -1
  21. package/src/components/dropdown/Dropdown.js +2 -2
  22. package/src/components/dropdown/DropdownDivider.js +1 -1
  23. package/src/components/dropdown/DropdownGroup.js +1 -1
  24. package/src/components/dropdown/DropdownItem.js +1 -1
  25. package/src/components/dropdown/DropdownTrigger.js +1 -1
  26. package/src/components/form/FormControl.js +5 -5
  27. package/src/components/form/field/DefaultRender.js +2 -2
  28. package/src/components/form/field/Field.js +4 -4
  29. package/src/components/form/field/FieldCollection.js +5 -5
  30. package/src/components/form/field/types/CheckboxField.js +1 -1
  31. package/src/components/form/field/types/ColorField.js +1 -1
  32. package/src/components/form/field/types/DateField.js +1 -1
  33. package/src/components/form/field/types/EmailField.js +1 -1
  34. package/src/components/form/field/types/FileField.js +1 -1
  35. package/src/components/form/field/types/ImageField.js +1 -1
  36. package/src/components/form/field/types/NumberField.js +1 -1
  37. package/src/components/form/field/types/PasswordField.js +1 -1
  38. package/src/components/form/field/types/RadioField.js +1 -1
  39. package/src/components/form/field/types/StringField.js +1 -1
  40. package/src/components/form/field/types/TelField.js +1 -1
  41. package/src/components/form/field/types/TimeField.js +1 -1
  42. package/src/components/form/field/types/UrlField.js +1 -1
  43. package/src/components/form/validation/Validation.js +1 -1
  44. package/src/components/list/List.js +4 -4
  45. package/src/components/list/ListGroup.js +2 -2
  46. package/src/components/list/ListItem.js +2 -2
  47. package/src/components/menu/Menu.js +3 -3
  48. package/src/components/menu/MenuDivider.js +1 -1
  49. package/src/components/menu/MenuGroup.js +2 -2
  50. package/src/components/menu/MenuItem.js +2 -2
  51. package/src/components/modal/Modal.js +2 -2
  52. package/src/components/pagination/Pagination.js +2 -2
  53. package/src/components/popover/Popover.js +2 -2
  54. package/src/components/popover/PopoverFooter.js +1 -1
  55. package/src/components/popover/PopoverHeader.js +1 -1
  56. package/src/components/progress/Progress.js +3 -3
  57. package/src/components/slider/Slider.js +2 -2
  58. package/src/components/splitter/Splitter.js +3 -4
  59. package/src/components/splitter/SplitterPanel.js +1 -1
  60. package/src/components/stepper/Stepper.js +3 -3
  61. package/src/components/stepper/StepperStep.js +2 -2
  62. package/src/components/switch/Switch.js +2 -2
  63. package/src/components/table/ColumnGroup.js +1 -1
  64. package/src/components/table/DataTable.js +1 -1
  65. package/src/components/table/SimpleTable.js +1 -1
  66. package/src/components/tabs/Tabs.js +2 -2
  67. package/src/components/toast/Toast.js +2 -2
  68. package/src/components/tooltip/prototypes.js +1 -1
  69. package/src/core/data/MemoryManager.js +1 -2
  70. package/src/core/data/Observable.js +1 -1
  71. package/src/core/data/ObservableArray.js +4 -4
  72. package/src/core/data/ObservableItem.js +5 -5
  73. package/src/core/data/observable-helpers/array.js +2 -2
  74. package/src/core/data/observable-helpers/batch.js +2 -2
  75. package/src/core/data/observable-helpers/computed.js +6 -6
  76. package/src/core/data/observable-helpers/object.js +2 -2
  77. package/src/core/elements/anchor.js +3 -3
  78. package/src/core/elements/content-formatter.js +1 -1
  79. package/src/core/elements/control/for-each-array.js +5 -6
  80. package/src/core/elements/control/for-each.js +7 -7
  81. package/src/core/elements/control/show-if.js +5 -5
  82. package/src/core/elements/control/show-when.js +2 -2
  83. package/src/core/elements/control/switch.js +4 -4
  84. package/src/core/elements/description-list.js +1 -1
  85. package/src/core/elements/form.js +1 -1
  86. package/src/core/elements/html5-semantics.js +1 -1
  87. package/src/core/elements/img.js +3 -3
  88. package/src/core/elements/index.js +1 -1
  89. package/src/core/elements/interactive.js +1 -1
  90. package/src/core/elements/list.js +1 -1
  91. package/src/core/elements/medias.js +1 -1
  92. package/src/core/elements/meta-data.js +1 -1
  93. package/src/core/elements/table.js +1 -1
  94. package/src/core/utils/EventEmitter.js +1 -1
  95. package/src/core/utils/args-types.js +2 -2
  96. package/src/core/utils/filters/standard.js +1 -1
  97. package/src/core/utils/filters/utils.js +1 -1
  98. package/src/core/utils/prototypes.js +2 -2
  99. package/src/core/utils/validator.js +5 -5
  100. package/src/core/wrappers/AttributesWrapper.js +3 -3
  101. package/src/core/wrappers/DocumentObserver.js +0 -1
  102. package/src/core/wrappers/ElementCreator.js +3 -3
  103. package/src/core/wrappers/HtmlElementWrapper.js +2 -2
  104. package/src/core/wrappers/NDElement.js +3 -3
  105. package/src/core/wrappers/NdPrototype.js +1 -1
  106. package/src/core/wrappers/SingletonView.js +1 -1
  107. package/src/core/wrappers/prototypes/attributes-extensions.js +4 -4
  108. package/src/core/wrappers/prototypes/bind-class-extensions.js +4 -4
  109. package/src/core/wrappers/prototypes/nd-element-extensions.js +6 -6
  110. package/src/devtools/app/App.js +2 -2
  111. package/src/devtools/hrm/ComponentRegistry.js +2 -2
  112. package/src/devtools/plugin.js +1 -1
  113. package/src/devtools/widget/DevToolsWidget.js +2 -2
  114. package/src/router/Route.js +1 -1
  115. package/src/router/RouteGroupHelper.js +1 -1
  116. package/src/router/Router.js +4 -4
  117. package/src/router/RouterComponent.js +1 -1
  118. package/src/router/link.js +4 -4
  119. package/src/router/modes/HistoryRouter.js +1 -1
  120. package/types/control-flow.d.ts +0 -1
  121. package/types/filters/dates.d.ts +1 -1
  122. package/types/filters/types.d.ts +1 -1
  123. package/utils.js +3 -3
  124. package/jsconfig.json +0 -15
  125. /package/src/{core → router}/errors/RouterError.js +0 -0
@@ -1 +1 @@
1
- var NativeDocumentDevTools=function(){"use strict";let e={};"development"===process.env.NODE_ENV&&(e={enabled:!1,enable(){this.enabled=!0,console.log("🔍 NativeDocument Debug Mode enabled")},disable(){this.enabled=!1},log(e,t,n){this.enabled&&(console.group(`🔍 [${e}] ${t}`),n&&console.log(n),console.trace(),console.groupEnd())},warn(e,t,n){this.enabled&&console.warn(`⚠️ [${e}] ${t}`,n)},error(e,t,n){console.error(`❌ [${e}] ${t}`,n)}}),"production"===process.env.NODE_ENV&&(e={log(){},warn(){},error(){},disable(){}});var t=e;const n=function(){let e=0;const n=new Map;return{register(t){const r=++e;return n.set(r,new WeakRef(t)),r},unregister(e){n.delete(e)},getObservableById:e=>n.get(e)?.deref(),cleanup(){for(const[e,t]of n){const e=t.deref();e&&e.cleanup()}n.clear()},cleanObservables(e){if(n.size<e)return;let r=0;for(const[e,t]of n)t.deref()||(n.delete(e),r++);r>0&&t.log("Memory Auto Clean",`🧹 Cleaned ${r} orphaned observables`)}}}();class r extends Error{constructor(e,t={}){super(e),this.name="NativeDocumentError",this.context=t,this.timestamp=(new Date).toISOString()}}function o(e,t){this.observable=e,this.checker=t,this.unSubscriptions=[]}o.prototype.__$isObservableChecker=!0,o.prototype.subscribe=function(e){const t=this.observable.subscribe(t=>{e&&e(this.checker(t))});return this.unSubscriptions.push(t),t},o.prototype.check=function(e){return this.observable.check(()=>e(this.val()))},o.prototype.val=function(){return this.checker&&this.checker(this.observable.val())},o.prototype.set=function(e){return this.observable.set(e)},o.prototype.trigger=function(){return this.observable.trigger()},o.prototype.cleanup=function(){return this.observable.cleanup()};const i=function(){const e=new Map,n=new Map;return{list:()=>n,add(t,r){if(!t||"object"!=typeof t)throw new Error(`Plugin ${r} must be an object`);if(!(r=r||t.name)||"string"!=typeof r)throw new Error("Please, provide a valid plugin name");if(!e.has(r)){t.$name=r,e.set(r,t),"function"==typeof t?.init&&t.init();for(const e in t)if(/^on[A-Z]/.test(e)){const r=e.replace(/^on/,"");n.has(r)||n.set(r,new Set),n.get(r).add(t)}}},remove(t){if(!e.has(t))return;const r=e.get(t);"function"==typeof r.cleanup&&r.cleanup();for(const[e,t]of n.entries())t.has(r)&&t.delete(r),0===t.size&&n.delete(e);e.delete(t)},emit(e,...r){if(!n.has(e))return;const o=n.get(e);for(const n of o){const o=n["on"+e];if("function"==typeof o)try{o.call(n,...r)}catch(r){t.error("Plugin Manager",`Error in plugin ${n.$name} for event ${e}`,r)}}}}}(),s=function(e,t){this.$target=t,this.$observer=e};s.prototype.__$isObservableWhen=!0,s.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},s.prototype.val=function(){return this.$observer.$currentValue===this.$target},s.prototype.isMath=function(){return this.$observer.$currentValue===this.$target},s.prototype.isActive=function(){return this.$observer.$currentValue===this.$target};const l=(e,t)=>{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=>l(e));if(v.isObservable(e))return t&&t(e),e;const n={};for(const t in e)e.hasOwnProperty(t)&&(n[t]=l(e[t]));return n};function a(e,t=null){e=v.isObservable(e)?e.val():e,this.$previousValue=null,this.$currentValue=e,this.$isCleanedUp=!1,this.$listeners=null,this.$watchers=null,this.$memoryId=null,t&&(this.configs=t,t.reset&&(this.$initialValue=v.isObject(e)?l(e):e)),i.emit("CreateObservable",this)}Object.defineProperty(a.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),a.prototype.__$isObservable=!0;const u={},c=function(){};a.prototype.intercept=function(e){return this.$interceptor=e,this},a.prototype.triggerFirstListener=function(e){this.$listeners[0](this.$currentValue,this.$previousValue,e||{})},a.prototype.triggerListeners=function(e){const t=this.$listeners,n=this.$previousValue,r=this.$currentValue;e=e||u;for(let o=0,i=t.length;o<i;o++)t[o],t[o](r,n,e)};const p=function(e,t){"function"!=typeof e?e.set?e.set(t):e.forEach(e=>{e.set?e.set(t):e(t)}):e(t)};a.prototype.triggerWatchers=function(){if(!this.$watchers)return;const e=this.$watchers,t=this.$previousValue,n=this.$currentValue;if(e.has(n)){const t=e.get(n);p(t,!0)}if(e.has(t)){const n=e.get(t);p(n,!1)}},a.prototype.triggerAll=function(e){this.triggerListeners(e),this.triggerWatchers()},a.prototype.triggerWatchersAndFirstListener=function(e){this.triggerListeners(e),this.triggerWatchers()},a.prototype.assocTrigger=function(){this.$watchers?.size&&this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerWatchersAndFirstListener:this.triggerAll:this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerFirstListener:this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=c},a.prototype.trigger=c,a.prototype.set=function(e){let t="function"==typeof e?e(this.$currentValue):e;if(t=v.isObservable(t)?t.val():t,this.$interceptor){const e=this.$interceptor(t,this.$currentValue);void 0!==e&&(t=e)}this.$currentValue!==t&&(this.$previousValue=this.$currentValue,this.$currentValue=t,i.emit("ObservableBeforeChange",this),this.trigger(),this.$previousValue=null,i.emit("ObservableAfterChange",this))},a.prototype.val=function(){return this.$currentValue},a.prototype.disconnectAll=function(){if(this.$listeners?.splice(0),this.$previousValue=null,this.$currentValue=null,this.$watchers)for(const[e,t]of this.$watchers)v.isArray(t)&&t.splice(0);this.$watchers?.clear(),this.$listeners=null,this.$watchers=null,this.trigger=c},a.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},a.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}n.unregister(this.$memoryId),this.disconnectAll(),this.$isCleanedUp=!0,delete this.$value},a.prototype.subscribe=function(e,n=null){if(this.$listeners=this.$listeners??[],this.$isCleanedUp)return t.warn("Observable subscription","⚠️ Attempted to subscribe to a cleaned up observable."),()=>{};if("function"!=typeof e)throw new r("Callback must be a function");return this.$listeners.push(e),this.assocTrigger(),i.emit("ObservableSubscribe",this,n),()=>{this.unsubscribe(e),this.assocTrigger(),i.emit("ObservableUnsubscribe",this)}},a.prototype.on=function(e,t){this.$watchers=this.$watchers??new Map;let n=this.$watchers.get(e);if(n){if(!v.isArray(n))return n=[n],void this.$watchers.set(e,n);n.push(t)}else this.$watchers.set(e,t);return this.assocTrigger(),()=>{const r=n.indexOf(t);n?.splice(r,1),1===n.size?this.$watchers.set(e,n[0]):0===n.size&&(this.$watchers?.delete(e),n=null),this.assocTrigger()}},a.prototype.once=function(e,t){const n="function"==typeof e?e:t=>t===e,r=this.subscribe(e=>{n(e)&&(r(),t(e))});return r},a.prototype.unsubscribe=function(e){const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},a.prototype.check=function(e){return new o(this,e)},a.prototype.get=function(e){const t=this.$currentValue[e];return v.isObservable(t)?t.val():t},a.prototype.when=function(e){return new s(this,e)},a.prototype.toString=function(){return this.$memoryId||n.register(this),"{{#ObItem::("+this.$memoryId+")}}"},a.prototype.equals=function(e){return v.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},a.prototype.toBool=function(){return!!this.$currentValue},a.prototype.toggle=function(){this.set(!this.$currentValue)},a.prototype.reset=function(){if(!this.configs?.reset)return;const e=v.isObject(this.$initialValue)?l(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},a.prototype.toString=function(){return String(this.$currentValue)};const d={mounted:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,executeMountedCallback(e){const t=d.mounted.get(e);t&&(t.inDom=!0,t.mounted&&t.mounted(e))},executeUnmountedCallback(e){const t=d.unmounted.get(e);t&&(t.inDom=!1,t.unmounted&&!0===t.unmounted(e)&&(t.disconnect(),e.nd?.remove()))},checkMutation:function(e){for(const t of e){if(d.mountedSupposedSize>0)for(const e of t.addedNodes){if(d.executeMountedCallback(e),!e.querySelectorAll)return;const t=e.querySelectorAll("[data--nd-mounted]");if(!t.length)return;for(const e of t)d.executeMountedCallback(e)}if(d.unmountedSupposedSize>0)for(const e of t.removedNodes){if(d.executeUnmountedCallback(e),!e.querySelectorAll)return;const t=e.querySelectorAll("[data--nd-unmounted]");if(!t.length)return;for(const e of t)d.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n={inDom:t,mounted:null,unmounted:null,disconnect:()=>{d.mounted.delete(e),d.unmounted.delete(e),d.mountedSupposedSize--,d.unmountedSupposedSize--,n=null}};return{disconnect:n.disconnect,mounted:t=>{n.mounted=t,d.mounted.set(e,n),d.mountedSupposedSize++},unmounted:t=>{n.unmounted=t,d.unmounted.set(e,n),d.unmountedSupposedSize++}}}};function h(e){this.$element=e,this.$observer=null,i.emit("NDElementCreated",e,this)}function f(e){this.$hydrate=e}d.observer=new MutationObserver(d.checkMutation),d.observer.observe(document.body,{childList:!0,subtree:!0}),h.prototype.__$isNDElement=!0,h.prototype.valueOf=function(){return this.$element},h.prototype.ref=function(e,t){return e[t]=this.$element,this},h.prototype.refSelf=function(e,t){return e[t]=this,this},h.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},h.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,delete e.nd?.on?.prevent,delete e.nd?.on,delete e.nd,e=null,this},h.prototype.lifecycle=function(e){return this.$observer=this.$observer||d.watch(this.$element),e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),this.$observer.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),this.$observer.unmounted(e.unmounted)),this},h.prototype.mounted=function(e){return this.lifecycle({mounted:e})},h.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},h.prototype.htmlElement=function(){return this.$element},h.prototype.node=h.prototype.htmlElement,h.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},h.prototype.openShadow=function(e=null){return this.shadow("open",e)},h.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},h.prototype.attach=function(e,t){return t.$hydrate(this.$element,e),this.$element},h.prototype.with=function(e){if(!e||"object"!=typeof e)throw new r("extend() requires an object of methods");"development"===process.env.NODE_ENV&&(this.$localExtensions||(this.$localExtensions=new Map));for(const n in e){const r=e[n];"function"==typeof r?("development"===process.env.NODE_ENV&&(this[n]&&!this.$localExtensions.has(n)&&t.warn("NDElement.extend",`Method "${n}" already exists and will be overwritten`),this.$localExtensions.set(n,r)),this[n]=r.bind(this)):console.warn(`⚠️ extends(): "${n}" is not a function, skipping`)}return this},h.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 n=new Set(["constructor","valueOf","$element","$observer","ref","remove","cleanup","with","extend","attach","lifecycle","mounted","unmounted","unmountChildren"]);for(const o in e){if(!e.hasOwnProperty(o))continue;const i=e[o];if("function"==typeof i){if(n.has(o))throw t.error("NDElement.extend",`Cannot override protected method "${o}"`),new r(`Cannot override protected method "${o}"`);h.prototype[o]&&t.warn("NDElement.extend",`Overwriting existing prototype method "${o}"`),h.prototype[o]=i}else t.warn("NDElement.extend",`"${o}" is not a function, skipping`)}return i.emit("NDElementExtended",e),h},f.prototype.__$isTemplateBinding=!0;const b=1,m=3,g=8,y=11,v={isObservable:e=>e?.__$isObservable||e instanceof a||e instanceof o,isTemplateBinding:e=>e?.__$isTemplateBinding||e instanceof f,isObservableWhenResult:e=>e&&(e.__$isObservableWhen||"object"==typeof e&&"$target"in e&&"$observer"in e),isArrayObservable:e=>e?.__$isObservableArray,isProxy:e=>e?.__isProxy__,isObservableOrProxy:e=>v.isObservable(e)||v.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker||e instanceof o,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&&(e.nodeType===b||e.nodeType===m||e.nodeType===y||e.nodeType===g),isFragment:e=>e?.nodeType===y,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||this.isObservable(e)||this.isNDElement(e)||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement||e instanceof h,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&&(v.isObject(e)&&Object.values(e).some(e=>v.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")}};"development"===process.env.NODE_ENV&&(v.validateAttributes=function(e){if(!e||"object"!=typeof e)return e;const n=[],r=Object.keys(e).filter(e=>n.includes(e));return r.length>0&&t.warn("Validator",`Reserved attributes found: ${r.join(", ")}`),e});const $=["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"];function w(e,t=null){return new a(e,t)}function O(e,t,n){e.classes.toggle(t,n)}function C(e,t,n){e.style[t]=n}function E(e,t,n){v.isBoolean(n)?e[t]=n:e[t]=n===e.value}function x(e,t,n,r){v.isBoolean(n)?r.set(e[t]):r.set(e.value)}function A(e,t){for(let n in t){const r=t[n];r?.bindNdClass?r.bindNdClass(e,n):e.classes.toggle(n,r)}t=null}function N(e,t){for(let n in t){const r=t[n];v.isObservable(r)?(e.style[n]=r.val(),r.subscribe(C.bind(null,e,n))):e.style[n]=r}}function S(e,t,n){const r=v.isObservable(n)?n.val():n;v.isBoolean(r)?e[t]=r:e[t]=r===e.value,v.isObservable(n)&&(["checked"].includes(t)&&e.addEventListener("input",x.bind(null,e,t,r,n)),n.subscribe(E.bind(null,e,t)))}function D(e,t,n){const r=n=>{"value"!==t?e.setAttribute(t,n):e.value=n};r(n.val()),n.subscribe(r),"value"===t&&e.addEventListener("input",()=>n.set(e.value))}w.useValueProperty=function(e="value"){Object.defineProperty(a.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},w.getById=function(e){const t=n.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},w.cleanup=function(e){e.cleanup()},w.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:r=6e4,threshold:o=100}=t;window.addEventListener("beforeunload",()=>{n.cleanup()}),setInterval(()=>n.cleanObservables(o),r)},a.prototype.bindNdClass=function(e,t){e.classes.toggle(t,this.val()),this.subscribe(O.bind(null,e,t))},s.prototype.bindNdClass=function(e,t){e.classes.toggle(t,this.isMath()),this.subscribe(O.bind(null,e,t))},f.prototype.bindNdClass=function(e,t){this.$hydrate(e,t)},String.prototype.toNdElement=function(){const e=this.resolveObservableTemplate?this.resolveObservableTemplate():this;return v.isString(e)?P.createStaticTextNode(null,e):P.getChild(null,e)},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},a.prototype.toNdElement=function(){return P.createObservableNode(null,this)},h.prototype.toNdElement=function(){return this.$element??this.$build?.()??this.build?.()??null},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=P.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return i.emit("BeforeProcessComponent",this),P.getChild(this())},f.prototype.toNdElement=function(){return P.createHydratableNode(null,this)},String.prototype.handleNdAttribute=function(e,t){e.setAttribute(t,this)},a.prototype.handleNdAttribute=function(e,t){$.includes(t)?S(e,t,this):D(e,t,this)},f.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const V=new Map;let k=null;const P={createTextNode:()=>(k||(k=document.createTextNode("")),k.cloneNode()),createObservableNode(e,t){const n=P.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode(e,t){const n=P.createTextNode();return t.$hydrate(n),n},createStaticTextNode(e,t){let n=P.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement(e){if(e){if(V.has(e))return V.get(e).cloneNode();const t=document.createElement(e);return V.set(e,t),t.cloneNode()}return function(e,n=!1){const r=document.createDocumentFragment();r.__Anchor__=!0;const o=document.createComment("Anchor Start : "+e),i=document.createComment("/ Anchor End "+e);r.appendChild(o),r.appendChild(i),r.nativeInsertBefore=r.insertBefore,r.nativeAppendChild=r.appendChild;const s=e=>n||e.firstChild===o&&e.lastChild===i,l=function(e,t,n){const o=v.isElement(t)?t:P.getChild(t);e!==r?s(e)&&n===i?e.append(o,n):e.insertBefore(o,n):e.nativeInsertBefore(o,n)};return r.appendElement=function(e,t=null){const n=o.parentNode,s=t||i;n!==r?n?.insertBefore(e,s):n.nativeInsertBefore(e,s)},r.appendChild=function(e,n=null){const r=i.parentNode;r?l(r,e,n=n??i):t.error("Anchor","Anchor : parent not found",e)},r.append=function(...e){return r.appendChild(e)},r.removeChildren=function(){const e=i.parentNode;if(e===r)return;if(s(e))return void e.replaceChildren(o,i);let t,n=o.nextSibling;const l=document.createDocumentFragment();for(;n&&n!==i;)t=n.nextSibling,l.append(n),n=t;l.replaceChildren()},r.remove=function(){if(i.parentNode===r)return;let e,t=o.nextSibling;for(;t&&t!==i;)e=t.nextSibling,r.nativeAppendChild(t),t=e},r.removeWithAnchors=function(){r.removeChildren(),o.remove(),i.remove()},r.replaceContent=function(e){const t=v.isElement(e)?e:P.getChild(e),n=i.parentNode;n&&(s(n)?n.replaceChildren(o,t,i):(r.removeChildren(),n.insertBefore(t,i)))},r.setContent=r.replaceContent,r.insertBefore=function(e,t=null){r.appendChild(e,t)},r.endElement=function(){return i},r.startElement=function(){return o},r.restore=function(){r.appendChild(r)},r.clear=r.remove,r.detach=r.remove,r.getByIndex=function(e){let t=o;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==o?t:null},r}("Fragment")},processChildren(e,t){if(null===e)return;i.emit("BeforeProcessChildren",t);let n=this.getChild(e);n&&t.appendChild(n),i.emit("AfterProcessChildren",t)},getChild(e){if(null==e)return null;if(e.toNdElement)do{if(e=e.toNdElement(),v.isElement(e))return e;if(null==e)return null}while(e.toNdElement);return P.createStaticTextNode(null,e)},processAttributes(e,t){v.isFragment(e)||t&&function(e,t){if(v.validateAttributes(t),!v.isObject(t))throw new r("Attributes must be an object");for(let n in t){const r=n.toLowerCase();let o=t[r];if(null!=o)if(o.handleNdAttribute)o.handleNdAttribute(e,r,o);else{if(v.isString(o))return void e.setAttribute(r,o);"class"===r&&v.isObject(o)?A(e,o):"style"===r&&v.isObject(o)?N(e,o):$.includes(r)?S(e,r,o):v.isObservable(o)?D(e,r,o):o.$hydrate?o.$hydrate(e,r):e.setAttribute(r,o)}}}(e,t)},setup:(e,t,n)=>(i.emit("Setup",e,t,n),e)};const j={configurable:!0,get(){return new h(this)}};Object.defineProperty(HTMLElement.prototype,"nd",j),Object.defineProperty(DocumentFragment.prototype,"nd",j),Object.defineProperty(h.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();h.prototype["on"+e]=function(e=null){return this.$element.addEventListener(t,e),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();h.prototype["onStop"+e]=function(e=null){return M(this.$element,t,e),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();h.prototype["onPrevent"+e]=function(e=null){return _(this.$element,t,e),this}}),h.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,n),this};const _=function(e,t,n){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)}),this},M=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},T={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}};Object.defineProperty(HTMLElement.prototype,"classes",{configurable:!0,get(){return{$element:this,...T}}});class L extends Error{constructor(e,t){super(`${e}\n\n${t.join("\n")}\n\n`)}}let I=e=>e;if("development"===process.env.NODE_ENV){const e=(e,t,n="Function")=>{if(!t)return;const r=[],o=t.filter(e=>!e.optional).length;if(e.length<o&&r.push(`${n}: Expected at least ${o} arguments, got ${e.length}`),t.forEach((t,o)=>{const i=o+1,s=e[o];if(void 0!==s){if(!t.validate(s)){const e=s?.constructor?.name||typeof s;r.push(`${n}: Invalid argument '${t.name}' at position ${i}, expected ${t.type}, got ${e}`)}}else t.optional||r.push(`${n}: Missing required argument '${t.name}' at position ${i}`)}),r.length>0)throw new L("Argument validation failed",r)};I=(t,n,o="Function")=>{if(!v.isArray(n))throw new r("withValidation : argSchema must be an array");return function(...r){return e(r,n,t.name||o),t.apply(this,r)}}}process.env.NODE_ENV;function B(e,t,n,r=null){let{props:o,children:i=null}=function(e,t=null){if(!v.isJson(e)||e?.$hydrate){const n=t;t=e,e=n}return{props:e,children:t}}(n,r),s=P.createElement(e),l=t&&"function"==typeof t?t(s):s;return o&&P.processAttributes(l,o),i&&P.processChildren(i,l),P.setup(l,o,t)}function F(e,t){return B.bind(null,e.toLowerCase(),t)}const z=F("div");F("span"),F("label"),F("p"),F("strong"),F("h1"),F("h2"),F("h3"),F("h4"),F("h5"),F("h6"),F("br"),F("a"),F("pre"),F("code"),F("blockquote"),F("hr"),F("em"),F("small"),F("mark"),F("del"),F("ins"),F("sub"),F("sup"),F("abbr"),F("cite"),F("q"),F("dl"),F("dt"),F("dd"),F("form",function(e){return 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}),F("input"),F("textarea"),F("select"),F("fieldset"),F("option"),F("legend"),F("datalist"),F("output"),F("progress"),F("meter");const U=F("button");function W(e,t){const n=e.filter(v.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>v.isObservable(e)?e.val():e))}}function q(e,t=!0,n=""){return W([e,t,n],(e,[t,n,r])=>{if(!t)return!0;if(n)try{return new RegExp(t,r).test(String(e))}catch(e){return console.warn("Invalid regex pattern:",t,e),!1}return r&&""!==r?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}F("main"),F("section"),F("article"),F("aside"),F("nav"),F("figure"),F("figcaption"),F("header"),F("footer"),F("img"),F("details"),F("summary"),F("dialog"),F("menu"),F("ol"),F("ul"),F("li"),F("audio"),F("video"),F("source"),F("track"),F("canvas"),F("svg"),F("time"),F("data"),F("address"),F("kbd"),F("samp"),F("var"),F("wbr"),F("caption"),F("table"),F("thead"),F("tfoot"),F("tbody"),F("tr"),F("th"),F("td"),F(""),Function.prototype.args=function(...e){return I(this,e)},Function.prototype.cached=function(...e){let t,n=()=>t;return()=>(t||(t=this.apply(this,e),t.cloneNode?n=()=>t.cloneNode(!0):t.$element&&(n=()=>new h(t.$element.cloneNode(!0)))),n())},Function.prototype.errorBoundary=function(e){return(...t)=>{try{return this.apply(this,t)}catch(t){return e(t)}}},String.prototype.use=function(e){const t=this;return w.computed(()=>t.replace(/\$\{(.*?)}/g,(t,n)=>{const r=e[n];return v.isObservable(r)?r.val():r}),Object.values(e))},String.prototype.resolveObservableTemplate=function(){return v.containsObservableReference(this)?this.split(/(\{\{#ObItem::\([0-9]+\)\}\})/g).filter(Boolean).map(e=>{if(!v.containsObservableReference(e))return e;const[t,n]=e.match(/\{\{#ObItem::\(([0-9]+)\)\}\}/);return w.getById(n)}):this.valueOf()};const R=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");a.call(this,e,t),i.emit("CreateObservableArray",this)};(R.prototype=Object.create(a.prototype)).constructor=R,R.prototype.__$isObservableArray=!0,Object.defineProperty(R.prototype,"length",{get(){return this.$currentValue.length}}),["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{R.prototype[e]=function(...t){const n=this.$currentValue[e](...t);return this.trigger({action:e,args:t,result:n}),n}}),["map","forEach","filter","reduce","some","every","find","findIndex","concat","includes","indexOf"].forEach(e=>{R.prototype[e]=function(...t){return this.$currentValue[e](...t)}}),R.prototype.clear=function(){return this.$currentValue.length=0,this.trigger({action:"clear"}),!0},R.prototype.at=function(e){return this.$currentValue[e]},R.prototype.merge=function(e){this.$currentValue.push(...e),this.trigger({action:"merge",args:e})},R.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},R.prototype.swap=function(e,t){const n=this.$currentValue,r=n.length;if(r<e||r<t)return!1;if(t<e){const n=e;e=t,t=n}const o=n[e],i=n[t];return n[e]=i,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,i]}),!0},R.prototype.remove=function(e){const t=this.$currentValue.splice(e,1);return 0===t.length?[]:(this.trigger({action:"remove",args:[e],result:t[0]}),t)},R.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return this.remove(t)},R.prototype.isEmpty=function(){return 0===this.$currentValue.length},R.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},R.prototype.where=function(e){const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=v.isObservable(o)?q(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(...t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=w.array(),i=Object.entries(r),s=()=>{const e=t.val().filter(e=>{for(const[t,n]of i)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(s)),s(),o},R.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},R.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},w.array=function(e=[],t=null){return new R(e,t)},w.batch=function(e){const t=w(0),n=function(){if(v.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n};w.init=function(e,t=null){const n={};for(const r in e){const o=e[r];if(Array.isArray(o)){if(!1!==t?.deep){const e=o.map(e=>v.isJson(e)?w.json(e,t):v.isArray(e)?w.array(e,t):w(e,t));n[r]=w.array(e,t);continue}n[r]=w.array(o,t)}else v.isObservable(o)||v.isProxy(o)?n[r]=o:n[r]=w(o,t)}const r=()=>{for(const e in n){n[e].reset()}},o=()=>function(e){const t={};for(const n in e){const r=e[n];if(v.isObservable(r)){let e=r.val();Array.isArray(e)&&(e=e.map(e=>v.isObservable(e)?e.val():v.isProxy(e)?e.$value:e)),t[n]=e}else v.isProxy(r)?t[n]=r.$value:t[n]=r}return t}(n),i=()=>w.init(o(),t),s=e=>{w.update(a,e)},l=e=>function(e,t){const n=e[t];return v.isObservable(n)?n.val():v.isProxy(n)?n.$value:n}(n,e),a=new Proxy(n,{get:(n,a)=>"__isProxy__"===a||("$value"===a?o():"get"===a||"$get"===a?l:"val"===a||"$val"===a?o:"set"===a||"$set"===a||"$updateWith"===a?s:"observables"===a||"$observables"===a?Object.values(n):"keys"===a||"$keys"===a?Object.keys(e):"clone"===a||"$clone"===a?i:"reset"===a?r:"configs"===a?t:n[a]),set:(e,t,n)=>void 0===e[t]||(v.isObservable(n)?e[t].set(n.val()):e[t].set(n),!0)});return a},w.arrayOfObject=function(e){return e.map(e=>w.object(e))},w.value=function(e){if(v.isObservable(e))return e.val();if(v.isProxy(e))return e.$value;if(v.isArray(e)){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(w.value(r))}return t}return e},w.update=function(e,t){const n=v.isProxy(t)?t.$value:t,r=e.configs;for(const o in n){const i=e[o],s=t[o],l=n[o];if(v.isObservable(i)){if(v.isArray(l)){const e=s.at(0);if(v.isObservable(e)||v.isProxy(e)){const t=l.map(t=>v.isProxy(e)?w.init(t,r):w(t,r));i.set(t);continue}i.set([...l]);continue}i.set(l)}else v.isProxy(i)?w.update(i,l):e[o]=l}},w.object=w.init,w.json=w.init,w.computed=function(e,t=[]){const n=new a(e()),o=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}}(()=>n.set(e()));if(i.emit("CreateObservableComputed",n,t),v.isFunction(t)){if(!v.isObservable(t.$observer))throw new r("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(o),n}return t.forEach(e=>{v.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(o)}):e.subscribe(o)}),n};const K={createdObservable:w(0)},H={name:"DevTools",onCreateObservable(e){K.createdObservable.set(e=>++e),console.log("Création Capturé",e)}};function J(){let e=!1;const t=z({class:"devtools-app-panel-widget",style:"left: 50%; top: 95%"},[z({class:"widget-label"},K.createdObservable),U({class:"widget-button"},"Full").nd.onClick(()=>{alert("Move to full-screen")})]);return t.nd.onStopMouseDown(()=>e=!0).onMouseUp(t=>e=!1),document.addEventListener("mousemove",n=>{e&&(t.style="left: "+n.clientX+"px; top: "+n.clientY+"px")}),t}return{config(){console.log("devtool init configuratzion")},init(){const e=z(z({class:"devtools-app-panel-wrapper pin-to-right"},[J,z({class:"devtools-app-panel"}),z("Gogo Panel")])).nd.closedShadow("\n .devtools-app-panel-wrapper {\n position: fixed;\n width: 0px;\n background: red;\n animate: .25s linear;\n }\n .devtools-app-panel-wrapper.pin-to-right {\n right: 0;\n top: 0;\n bottom: 0;\n }\n .devtools-app-panel-widget {\n position: fixed;\n background: rgba(0, 0, 0, 0.8);\n backdrop-filter: blur(5px);\n padding: 2px;\n width: 150px;\n height: 30px;\n border-radius: 5px;\n border: 1px solid black;\n z-index: 10000009;\n color: white;\n cursor: pointer;\n transform: translate(-50%, -50%);\n display: flex;\n justify-content: space-between;\n align-items: stretch;\n align-content: center;\n }\n .widget-button {\n width: 30px;\n padding: 2px;\n background: rgba(0, 0, 0, 0.8);\n border: 1px solid black;\n display: flex;\n justify-content: center;\n align-items: center;\n align-content: center;\n color: white;\n border-radius: 5px;\n cursor: pointer;\n font-size: .9rem;\n }\n .widget-label {\n font-weight: bold;\n font-size: 1.5rem;\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n ");document.body.parentNode.appendChild(e.$element)},plugin:H}}();
1
+ var NativeDocumentDevTools=function(){"use strict";let e={};"development"===process.env.NODE_ENV&&(e={enabled:!1,enable(){this.enabled=!0,console.log("🔍 NativeDocument Debug Mode enabled")},disable(){this.enabled=!1},log(e,t,n){this.enabled&&(console.group(`🔍 [${e}] ${t}`),n&&console.log(n),console.trace(),console.groupEnd())},warn(e,t,n){this.enabled&&console.warn(`⚠️ [${e}] ${t}`,n)},error(e,t,n){console.error(`❌ [${e}] ${t}`,n)}}),"production"===process.env.NODE_ENV&&(e={log(){},warn(){},error(){},disable(){}});var t=e;const n=function(){let e=0;const n=new Map;return{register(t){const r=++e;return n.set(r,new WeakRef(t)),r},unregister(e){n.delete(e)},getObservableById:e=>n.get(e)?.deref(),cleanup(){for(const[e,t]of n){const e=t.deref();e&&e.cleanup()}n.clear()},cleanObservables(e){if(n.size<e)return;let r=0;for(const[e,t]of n)t.deref()||(n.delete(e),r++);r>0&&t.log("Memory Auto Clean",`🧹 Cleaned ${r} orphaned observables`)}}}();class r extends Error{constructor(e,t={}){super(e),this.name="NativeDocumentError",this.context=t,this.timestamp=(new Date).toISOString()}}function o(e,t){this.observable=e,this.checker=t,this.unSubscriptions=[]}o.prototype.__$isObservableChecker=!0,o.prototype.subscribe=function(e){const t=this.observable.subscribe(t=>{e&&e(this.checker(t))});return this.unSubscriptions.push(t),t},o.prototype.check=function(e){return this.observable.check(()=>e(this.val()))},o.prototype.val=function(){return this.checker&&this.checker(this.observable.val())},o.prototype.set=function(e){return this.observable.set(e)},o.prototype.trigger=function(){return this.observable.trigger()},o.prototype.cleanup=function(){return this.observable.cleanup()};const i=function(){const e=new Map,n=new Map;return{list:()=>n,add(t,r){if(!t||"object"!=typeof t)throw new Error(`Plugin ${r} must be an object`);if(!(r=r||t.name)||"string"!=typeof r)throw new Error("Please, provide a valid plugin name");if(!e.has(r)){t.$name=r,e.set(r,t),"function"==typeof t?.init&&t.init();for(const e in t)if(/^on[A-Z]/.test(e)){const r=e.replace(/^on/,"");n.has(r)||n.set(r,new Set),n.get(r).add(t)}}},remove(t){if(!e.has(t))return;const r=e.get(t);"function"==typeof r.cleanup&&r.cleanup();for(const[e,t]of n.entries())t.has(r)&&t.delete(r),0===t.size&&n.delete(e);e.delete(t)},emit(e,...r){if(!n.has(e))return;const o=n.get(e);for(const n of o){const o=n["on"+e];if("function"==typeof o)try{o.call(n,...r)}catch(r){t.error("Plugin Manager",`Error in plugin ${n.$name} for event ${e}`,r)}}}}}(),s=function(e,t){this.$target=t,this.$observer=e};s.prototype.__$isObservableWhen=!0,s.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},s.prototype.val=function(){return this.$observer.$currentValue===this.$target},s.prototype.isMath=function(){return this.$observer.$currentValue===this.$target},s.prototype.isActive=function(){return this.$observer.$currentValue===this.$target};const l=(e,t)=>{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=>l(e));if(v.isObservable(e))return t&&t(e),e;const n={};for(const t in e)e.hasOwnProperty(t)&&(n[t]=l(e[t]));return n};function a(e,t=null){e=v.isObservable(e)?e.val():e,this.$previousValue=null,this.$currentValue=e,this.$isCleanedUp=!1,this.$listeners=null,this.$watchers=null,this.$memoryId=null,t&&(this.configs=t,t.reset&&(this.$initialValue=v.isObject(e)?l(e):e)),i.emit("CreateObservable",this)}Object.defineProperty(a.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),a.prototype.__$isObservable=!0;const u={},c=function(){};a.prototype.intercept=function(e){return this.$interceptor=e,this},a.prototype.triggerFirstListener=function(e){this.$listeners[0](this.$currentValue,this.$previousValue,e||{})},a.prototype.triggerListeners=function(e){const t=this.$listeners,n=this.$previousValue,r=this.$currentValue;e=e||u;for(let o=0,i=t.length;o<i;o++)t[o],t[o](r,n,e)};const p=function(e,t){"function"!=typeof e?e.set?e.set(t):e.forEach(e=>{e.set?e.set(t):e(t)}):e(t)};a.prototype.triggerWatchers=function(){if(!this.$watchers)return;const e=this.$watchers,t=this.$previousValue,n=this.$currentValue;if(e.has(n)){const t=e.get(n);p(t,!0)}if(e.has(t)){const n=e.get(t);p(n,!1)}},a.prototype.triggerAll=function(e){this.triggerListeners(e),this.triggerWatchers()},a.prototype.triggerWatchersAndFirstListener=function(e){this.triggerListeners(e),this.triggerWatchers()},a.prototype.assocTrigger=function(){this.$watchers?.size&&this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerWatchersAndFirstListener:this.triggerAll:this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerFirstListener:this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=c},a.prototype.trigger=c,a.prototype.set=function(e){let t="function"==typeof e?e(this.$currentValue):e;if(t=v.isObservable(t)?t.val():t,this.$interceptor){const e=this.$interceptor(t,this.$currentValue);void 0!==e&&(t=e)}this.$currentValue!==t&&(this.$previousValue=this.$currentValue,this.$currentValue=t,i.emit("ObservableBeforeChange",this),this.trigger(),this.$previousValue=null,i.emit("ObservableAfterChange",this))},a.prototype.val=function(){return this.$currentValue},a.prototype.disconnectAll=function(){if(this.$listeners?.splice(0),this.$previousValue=null,this.$currentValue=null,this.$watchers)for(const[e,t]of this.$watchers)v.isArray(t)&&t.splice(0);this.$watchers?.clear(),this.$listeners=null,this.$watchers=null,this.trigger=c},a.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},a.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}n.unregister(this.$memoryId),this.disconnectAll(),this.$isCleanedUp=!0,delete this.$value},a.prototype.subscribe=function(e,n=null){if(this.$listeners=this.$listeners??[],this.$isCleanedUp)return t.warn("Observable subscription","⚠️ Attempted to subscribe to a cleaned up observable."),()=>{};if("function"!=typeof e)throw new r("Callback must be a function");return this.$listeners.push(e),this.assocTrigger(),i.emit("ObservableSubscribe",this,n),()=>{this.unsubscribe(e),this.assocTrigger(),i.emit("ObservableUnsubscribe",this)}},a.prototype.on=function(e,t){this.$watchers=this.$watchers??new Map;let n=this.$watchers.get(e);if(n){if(!v.isArray(n))return n=[n],void this.$watchers.set(e,n);n.push(t)}else this.$watchers.set(e,t);return this.assocTrigger(),()=>{const r=n.indexOf(t);n?.splice(r,1),1===n.size?this.$watchers.set(e,n[0]):0===n.size&&(this.$watchers?.delete(e),n=null),this.assocTrigger()}},a.prototype.once=function(e,t){const n="function"==typeof e?e:t=>t===e,r=this.subscribe(e=>{n(e)&&(r(),t(e))});return r},a.prototype.unsubscribe=function(e){const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},a.prototype.check=function(e){return new o(this,e)},a.prototype.get=function(e){const t=this.$currentValue[e];return v.isObservable(t)?t.val():t},a.prototype.when=function(e){return new s(this,e)},a.prototype.toString=function(){return this.$memoryId||n.register(this),"{{#ObItem::("+this.$memoryId+")}}"},a.prototype.equals=function(e){return v.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},a.prototype.toBool=function(){return!!this.$currentValue},a.prototype.toggle=function(){this.set(!this.$currentValue)},a.prototype.reset=function(){if(!this.configs?.reset)return;const e=v.isObject(this.$initialValue)?l(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},a.prototype.toString=function(){return String(this.$currentValue)};const d={mounted:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,executeMountedCallback(e){const t=d.mounted.get(e);t&&(t.inDom=!0,t.mounted&&t.mounted(e))},executeUnmountedCallback(e){const t=d.unmounted.get(e);t&&(t.inDom=!1,t.unmounted&&!0===t.unmounted(e)&&(t.disconnect(),e.nd?.remove()))},checkMutation:function(e){for(const t of e){if(d.mountedSupposedSize>0)for(const e of t.addedNodes){if(d.executeMountedCallback(e),!e.querySelectorAll)return;const t=e.querySelectorAll("[data--nd-mounted]");if(!t.length)return;for(const e of t)d.executeMountedCallback(e)}if(d.unmountedSupposedSize>0)for(const e of t.removedNodes){if(d.executeUnmountedCallback(e),!e.querySelectorAll)return;const t=e.querySelectorAll("[data--nd-unmounted]");if(!t.length)return;for(const e of t)d.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n={inDom:t,mounted:null,unmounted:null,disconnect:()=>{d.mounted.delete(e),d.unmounted.delete(e),d.mountedSupposedSize--,d.unmountedSupposedSize--,n=null}};return{disconnect:n.disconnect,mounted:t=>{n.mounted=t,d.mounted.set(e,n),d.mountedSupposedSize++},unmounted:t=>{n.unmounted=t,d.unmounted.set(e,n),d.unmountedSupposedSize++}}}};function h(e){this.$element=e,this.$observer=null,i.emit("NDElementCreated",e,this)}function f(e){this.$hydrate=e}d.observer=new MutationObserver(d.checkMutation),d.observer.observe(document.body,{childList:!0,subtree:!0}),h.prototype.__$isNDElement=!0,h.prototype.valueOf=function(){return this.$element},h.prototype.ref=function(e,t){return e[t]=this.$element,this},h.prototype.refSelf=function(e,t){return e[t]=this,this},h.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},h.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,delete e.nd?.on?.prevent,delete e.nd?.on,delete e.nd,e=null,this},h.prototype.lifecycle=function(e){return this.$observer=this.$observer||d.watch(this.$element),e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),this.$observer.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),this.$observer.unmounted(e.unmounted)),this},h.prototype.mounted=function(e){return this.lifecycle({mounted:e})},h.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},h.prototype.htmlElement=function(){return this.$element},h.prototype.node=h.prototype.htmlElement,h.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},h.prototype.openShadow=function(e=null){return this.shadow("open",e)},h.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},h.prototype.attach=function(e,t){return t.$hydrate(this.$element,e),this.$element},h.prototype.with=function(e){if(!e||"object"!=typeof e)throw new r("extend() requires an object of methods");"development"===process.env.NODE_ENV&&(this.$localExtensions||(this.$localExtensions=new Map));for(const n in e){const r=e[n];"function"==typeof r?("development"===process.env.NODE_ENV&&(this[n]&&!this.$localExtensions.has(n)&&t.warn("NDElement.extend",`Method "${n}" already exists and will be overwritten`),this.$localExtensions.set(n,r)),this[n]=r.bind(this)):console.warn(`⚠️ extends(): "${n}" is not a function, skipping`)}return this},h.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 n=new Set(["constructor","valueOf","$element","$observer","ref","remove","cleanup","with","extend","attach","lifecycle","mounted","unmounted","unmountChildren"]);for(const o in e){if(!e.hasOwnProperty(o))continue;const i=e[o];if("function"==typeof i){if(n.has(o))throw t.error("NDElement.extend",`Cannot override protected method "${o}"`),new r(`Cannot override protected method "${o}"`);h.prototype[o]&&t.warn("NDElement.extend",`Overwriting existing prototype method "${o}"`),h.prototype[o]=i}else t.warn("NDElement.extend",`"${o}" is not a function, skipping`)}return i.emit("NDElementExtended",e),h},f.prototype.__$isTemplateBinding=!0;const b=1,m=3,g=8,y=11,v={isObservable:e=>e?.__$isObservable||e instanceof a||e instanceof o,isTemplateBinding:e=>e?.__$isTemplateBinding||e instanceof f,isObservableWhenResult:e=>e&&(e.__$isObservableWhen||"object"==typeof e&&"$target"in e&&"$observer"in e),isArrayObservable:e=>e?.__$isObservableArray,isProxy:e=>e?.__isProxy__,isObservableOrProxy:e=>v.isObservable(e)||v.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker||e instanceof o,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&&(e.nodeType===b||e.nodeType===m||e.nodeType===y||e.nodeType===g),isFragment:e=>e?.nodeType===y,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||this.isObservable(e)||this.isNDElement(e)||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement||e instanceof h,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&&(v.isObject(e)&&Object.values(e).some(e=>v.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")}};"development"===process.env.NODE_ENV&&(v.validateAttributes=function(e){if(console.log("AttributesWrapper",e),!e||"object"!=typeof e)return e;const n=[],r=Object.keys(e).filter(e=>n.includes(e));return r.length>0&&t.warn("Validator",`Reserved attributes found: ${r.join(", ")}`),e});const $=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"]);function O(e,t=null){return new a(e,t)}function C(e,t,n){e.classes.toggle(t,n)}function E(e,t,n){e.style[t]=n}function x(e,t,n){v.isBoolean(n)?e[t]=n:e[t]=n===e.value}function A(e,t,n,r){v.isBoolean(n)?r.set(e[t]):r.set(e.value)}function N(e,t,n){const r=v.isObservable(n)?n.val():n;v.isBoolean(r)?e[t]=r:e[t]=r===e.value,v.isObservable(n)&&(["checked"].includes(t)&&e.addEventListener("input",A.bind(null,e,t,r,n)),n.subscribe(x.bind(null,e,t)))}O.useValueProperty=function(e="value"){Object.defineProperty(a.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},O.getById=function(e){const t=n.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},O.cleanup=function(e){e.cleanup()},O.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:r=6e4,threshold:o=100}=t;window.addEventListener("beforeunload",()=>{n.cleanup()}),setInterval(()=>n.cleanObservables(o),r)},a.prototype.bindNdClass=function(e,t){e.classes.toggle(t,this.val()),this.subscribe(C.bind(null,e,t))},s.prototype.bindNdClass=function(e,t){e.classes.toggle(t,this.isMath()),this.subscribe(C.bind(null,e,t))},f.prototype.bindNdClass=function(e,t){this.$hydrate(e,t)};const S={class:(e,t)=>function(e,t){for(let n in t){const r=t[n];r?.bindNdClass?r.bindNdClass(e,n):e.classes.toggle(n,r)}t=null}(e,t),style:(e,t)=>function(e,t){for(let n in t){const r=t[n];v.isObservable(r)?(e.style[n]=r.val(),r.subscribe(E.bind(null,e,n))):e.style[n]=r}}(e,t)};String.prototype.toNdElement=function(){const e=this.resolveObservableTemplate?this.resolveObservableTemplate():this;return v.isString(e)?k.createStaticTextNode(null,e):k.getChild(null,e)},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},a.prototype.toNdElement=function(){return k.createObservableNode(null,this)},h.prototype.toNdElement=function(){return this.$element??this.$build?.()??this.build?.()??null},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=k.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return i.emit("BeforeProcessComponent",this),k.getChild(this())},f.prototype.toNdElement=function(){return k.createHydratableNode(null,this)},String.prototype.handleNdAttribute=function(e,t){e.setAttribute(t,this)},Number.prototype.handleNdAttribute=function(e,t){e.setAttribute(t,this)},Boolean.prototype.handleNdAttribute=function(e,t){N(e,t,this)},a.prototype.handleNdAttribute=function(e,t){$.has(t)?N(e,t,this):function(e,t,n){const r=n=>{"value"!==t?e.setAttribute(t,n):e.value=n};r(n.val()),n.subscribe(r),"value"===t&&e.addEventListener("input",()=>n.set(e.value))}(e,t,this)},f.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const D=new Map;let V=null;const k={createTextNode:()=>(V||(V=document.createTextNode("")),V.cloneNode()),createObservableNode(e,t){const n=k.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode(e,t){const n=k.createTextNode();return t.$hydrate(n),n},createStaticTextNode(e,t){let n=k.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement(e){if(e){if(D.has(e))return D.get(e).cloneNode();const t=document.createElement(e);return D.set(e,t),t.cloneNode()}return function(e,n=!1){const r=document.createDocumentFragment();r.__Anchor__=!0;const o=document.createComment("Anchor Start : "+e),i=document.createComment("/ Anchor End "+e);r.appendChild(o),r.appendChild(i),r.nativeInsertBefore=r.insertBefore,r.nativeAppendChild=r.appendChild;const s=e=>n||e.firstChild===o&&e.lastChild===i,l=function(e,t,n){const o=v.isElement(t)?t:k.getChild(t);e!==r?s(e)&&n===i?e.append(o,n):e.insertBefore(o,n):e.nativeInsertBefore(o,n)};return r.appendElement=function(e,t=null){const n=o.parentNode,s=t||i;n!==r?n?.insertBefore(e,s):n.nativeInsertBefore(e,s)},r.appendChild=function(e,n=null){const r=i.parentNode;r?l(r,e,n=n??i):t.error("Anchor","Anchor : parent not found",e)},r.append=function(...e){return r.appendChild(e)},r.removeChildren=function(){const e=i.parentNode;if(e===r)return;if(s(e))return void e.replaceChildren(o,i);let t,n=o.nextSibling;const l=document.createDocumentFragment();for(;n&&n!==i;)t=n.nextSibling,l.append(n),n=t;l.replaceChildren()},r.remove=function(){if(i.parentNode===r)return;let e,t=o.nextSibling;for(;t&&t!==i;)e=t.nextSibling,r.nativeAppendChild(t),t=e},r.removeWithAnchors=function(){r.removeChildren(),o.remove(),i.remove()},r.replaceContent=function(e){const t=v.isElement(e)?e:k.getChild(e),n=i.parentNode;n&&(s(n)?n.replaceChildren(o,t,i):(r.removeChildren(),n.insertBefore(t,i)))},r.setContent=r.replaceContent,r.insertBefore=function(e,t=null){r.appendChild(e,t)},r.endElement=function(){return i},r.startElement=function(){return o},r.restore=function(){r.appendChild(r)},r.clear=r.remove,r.detach=r.remove,r.getByIndex=function(e){let t=o;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==o?t:null},r}("Fragment")},processChildren(e,t){if(null===e)return;i.emit("BeforeProcessChildren",t);let n=this.getChild(e);n&&t.appendChild(n),i.emit("AfterProcessChildren",t)},getChild(e){for(;e?.toNdElement;){if(e=e.toNdElement(),v.isElement(e))return e;if(!e)return null}return e?k.createStaticTextNode(null,e):null},processAttributes(e,t){v.isFragment(e)||t&&function(e,t){if(v.validateAttributes(t),!v.isObject(t))throw new r("Attributes must be an object");for(let 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){const t=S[r];if(t){t(e,o);continue}}$.has(r)?N(e,r,o):e.setAttribute(r,o)}}}(e,t)},setup:(e,t,n)=>(i.emit("Setup",e,t,n),e)};const P={configurable:!0,get(){return new h(this)}};Object.defineProperty(HTMLElement.prototype,"nd",P),Object.defineProperty(DocumentFragment.prototype,"nd",P),Object.defineProperty(h.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();h.prototype["on"+e]=function(e=null){return this.$element.addEventListener(t,e),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();h.prototype["onStop"+e]=function(e=null){return _(this.$element,t,e),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();h.prototype["onPrevent"+e]=function(e=null){return j(this.$element,t,e),this}}),h.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,n),this};const j=function(e,t,n){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)}),this},_=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},M={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}};Object.defineProperty(HTMLElement.prototype,"classes",{configurable:!0,get(){return{$element:this,...M}}});class T extends Error{constructor(e,t){super(`${e}\n\n${t.join("\n")}\n\n`)}}let L=e=>e;if("development"===process.env.NODE_ENV){const e=(e,t,n="Function")=>{if(!t)return;const r=[],o=t.filter(e=>!e.optional).length;if(e.length<o&&r.push(`${n}: Expected at least ${o} arguments, got ${e.length}`),t.forEach((t,o)=>{const i=o+1,s=e[o];if(void 0!==s){if(!t.validate(s)){const e=s?.constructor?.name||typeof s;r.push(`${n}: Invalid argument '${t.name}' at position ${i}, expected ${t.type}, got ${e}`)}}else t.optional||r.push(`${n}: Missing required argument '${t.name}' at position ${i}`)}),r.length>0)throw new T("Argument validation failed",r)};L=(t,n,o="Function")=>{if(!v.isArray(n))throw new r("withValidation : argSchema must be an array");return function(...r){return e(r,n,t.name||o),t.apply(this,r)}}}process.env.NODE_ENV;function B(e,t,n,r=null){let{props:o,children:i=null}=function(e,t=null){if(!v.isJson(e)||e?.$hydrate){const n=t;t=e,e=n}return{props:e,children:t}}(n,r),s=k.createElement(e),l=t&&"function"==typeof t?t(s):s;return o&&k.processAttributes(l,o),i&&k.processChildren(i,l),k.setup(l,o,t)}function I(e,t){return B.bind(null,e.toLowerCase(),t)}const F=I("div");I("span"),I("label"),I("p"),I("strong"),I("h1"),I("h2"),I("h3"),I("h4"),I("h5"),I("h6"),I("br"),I("a"),I("pre"),I("code"),I("blockquote"),I("hr"),I("em"),I("small"),I("mark"),I("del"),I("ins"),I("sub"),I("sup"),I("abbr"),I("cite"),I("q"),I("dl"),I("dt"),I("dd"),I("form",function(e){return 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}),I("input"),I("textarea"),I("select"),I("fieldset"),I("option"),I("legend"),I("datalist"),I("output"),I("progress"),I("meter");const z=I("button");function W(e,t){const n=e.filter(v.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>v.isObservable(e)?e.val():e))}}function U(e,t=!0,n=""){return W([e,t,n],(e,[t,n,r])=>{if(!t)return!0;if(n)try{return new RegExp(t,r).test(String(e))}catch(e){return console.warn("Invalid regex pattern:",t,e),!1}return r&&""!==r?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}I("main"),I("section"),I("article"),I("aside"),I("nav"),I("figure"),I("figcaption"),I("header"),I("footer"),I("img"),I("details"),I("summary"),I("dialog"),I("menu"),I("ol"),I("ul"),I("li"),I("audio"),I("video"),I("source"),I("track"),I("canvas"),I("svg"),I("time"),I("data"),I("address"),I("kbd"),I("samp"),I("var"),I("wbr"),I("caption"),I("table"),I("thead"),I("tfoot"),I("tbody"),I("tr"),I("th"),I("td"),I(""),w,Function.prototype.args=function(...e){return L(this,e)},Function.prototype.cached=function(...e){let t,n=()=>t;return()=>(t||(t=this.apply(this,e),t.cloneNode?n=()=>t.cloneNode(!0):t.$element&&(n=()=>new h(t.$element.cloneNode(!0)))),n())},Function.prototype.errorBoundary=function(e){return(...t)=>{try{return this.apply(this,t)}catch(t){return e(t)}}},String.prototype.use=function(e){const t=this;return O.computed(()=>t.replace(/\$\{(.*?)}/g,(t,n)=>{const r=e[n];return v.isObservable(r)?r.val():r}),Object.values(e))},String.prototype.resolveObservableTemplate=function(){return v.containsObservableReference(this)?this.split(/(\{\{#ObItem::\([0-9]+\)\}\})/g).filter(Boolean).map(e=>{if(!v.containsObservableReference(e))return e;const[t,n]=e.match(/\{\{#ObItem::\(([0-9]+)\)\}\}/);return O.getById(n)}):this.valueOf()};const q=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");a.call(this,e,t),i.emit("CreateObservableArray",this)};(q.prototype=Object.create(a.prototype)).constructor=q,q.prototype.__$isObservableArray=!0,Object.defineProperty(q.prototype,"length",{get(){return this.$currentValue.length}}),["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{q.prototype[e]=function(...t){const n=this.$currentValue[e](...t);return this.trigger({action:e,args:t,result:n}),n}}),["map","forEach","filter","reduce","some","every","find","findIndex","concat","includes","indexOf"].forEach(e=>{q.prototype[e]=function(...t){return this.$currentValue[e](...t)}}),q.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$currentValue.length=0,this.trigger({action:"clear"}),!0},q.prototype.at=function(e){return this.$currentValue[e]},q.prototype.merge=function(e){this.$currentValue.push(...e),this.trigger({action:"merge",args:e})},q.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},q.prototype.swap=function(e,t){const n=this.$currentValue,r=n.length;if(r<e||r<t)return!1;if(t<e){const n=e;e=t,t=n}const o=n[e],i=n[t];return n[e]=i,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,i]}),!0},q.prototype.remove=function(e){const t=this.$currentValue.splice(e,1);return 0===t.length?[]:(this.trigger({action:"remove",args:[e],result:t[0]}),t)},q.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return this.remove(t)},q.prototype.isEmpty=function(){return 0===this.$currentValue.length},q.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},q.prototype.where=function(e){const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=v.isObservable(o)?U(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(...t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=O.array(),i=Object.entries(r),s=()=>{const e=t.val().filter(e=>{for(const[t,n]of i)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(s)),s(),o},q.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},q.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},O.array=function(e=[],t=null){return new q(e,t)},O.batch=function(e){const t=O(0),n=function(){if(v.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n};O.init=function(e,t=null){const n={};for(const r in e){const o=e[r];if(Array.isArray(o)){if(!1!==t?.deep){const e=o.map(e=>v.isJson(e)?O.json(e,t):v.isArray(e)?O.array(e,t):O(e,t));n[r]=O.array(e,t);continue}n[r]=O.array(o,t)}else v.isObservable(o)||v.isProxy(o)?n[r]=o:n[r]=O(o,t)}const r=()=>{for(const e in n){n[e].reset()}},o=()=>function(e){const t={};for(const n in e){const r=e[n];if(v.isObservable(r)){let e=r.val();Array.isArray(e)&&(e=e.map(e=>v.isObservable(e)?e.val():v.isProxy(e)?e.$value:e)),t[n]=e}else v.isProxy(r)?t[n]=r.$value:t[n]=r}return t}(n),i=()=>O.init(o(),t),s=e=>{O.update(a,e)},l=e=>function(e,t){const n=e[t];return v.isObservable(n)?n.val():v.isProxy(n)?n.$value:n}(n,e),a=new Proxy(n,{get:(n,a)=>"__isProxy__"===a||("$value"===a?o():"get"===a||"$get"===a?l:"val"===a||"$val"===a?o:"set"===a||"$set"===a||"$updateWith"===a?s:"observables"===a||"$observables"===a?Object.values(n):"keys"===a||"$keys"===a?Object.keys(e):"clone"===a||"$clone"===a?i:"reset"===a?r:"configs"===a?t:n[a]),set:(e,t,n)=>void 0===e[t]||(v.isObservable(n)?e[t].set(n.val()):e[t].set(n),!0)});return a},O.arrayOfObject=function(e){return e.map(e=>O.object(e))},O.value=function(e){if(v.isObservable(e))return e.val();if(v.isProxy(e))return e.$value;if(v.isArray(e)){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(O.value(r))}return t}return e},O.update=function(e,t){const n=v.isProxy(t)?t.$value:t,r=e.configs;for(const o in n){const i=e[o],s=t[o],l=n[o];if(v.isObservable(i)){if(v.isArray(l)){const e=s.at(0);if(v.isObservable(e)||v.isProxy(e)){const t=l.map(t=>v.isProxy(e)?O.init(t,r):O(t,r));i.set(t);continue}i.set([...l]);continue}i.set(l)}else v.isProxy(i)?O.update(i,l):e[o]=l}},O.object=O.init,O.json=O.init,O.computed=function(e,t=[]){const n=new a(e()),o=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}}(()=>n.set(e()));if(i.emit("CreateObservableComputed",n,t),v.isFunction(t)){if(!v.isObservable(t.$observer))throw new r("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(o),n}return t.forEach(e=>{v.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(o)}):e.subscribe(o)}),n};const R={createdObservable:O(0)},K={name:"DevTools",onCreateObservable(e){R.createdObservable.set(e=>++e),console.log("Création Capturé",e)}};function H(){let e=!1;const t=F({class:"devtools-app-panel-widget",style:"left: 50%; top: 95%"},[F({class:"widget-label"},R.createdObservable),z({class:"widget-button"},"Full").nd.onClick(()=>{alert("Move to full-screen")})]);return t.nd.onStopMouseDown(()=>e=!0).onMouseUp(t=>e=!1),document.addEventListener("mousemove",n=>{e&&(t.style="left: "+n.clientX+"px; top: "+n.clientY+"px")}),t}return{config(){console.log("devtool init configuratzion")},init(){const e=F(F({class:"devtools-app-panel-wrapper pin-to-right"},[H,F({class:"devtools-app-panel"}),F("Gogo Panel")])).nd.closedShadow("\n .devtools-app-panel-wrapper {\n position: fixed;\n width: 0px;\n background: red;\n animate: .25s linear;\n }\n .devtools-app-panel-wrapper.pin-to-right {\n right: 0;\n top: 0;\n bottom: 0;\n }\n .devtools-app-panel-widget {\n position: fixed;\n background: rgba(0, 0, 0, 0.8);\n backdrop-filter: blur(5px);\n padding: 2px;\n width: 150px;\n height: 30px;\n border-radius: 5px;\n border: 1px solid black;\n z-index: 10000009;\n color: white;\n cursor: pointer;\n transform: translate(-50%, -50%);\n display: flex;\n justify-content: space-between;\n align-items: stretch;\n align-content: center;\n }\n .widget-button {\n width: 30px;\n padding: 2px;\n background: rgba(0, 0, 0, 0.8);\n border: 1px solid black;\n display: flex;\n justify-content: center;\n align-items: center;\n align-content: center;\n color: white;\n border-radius: 5px;\n cursor: pointer;\n font-size: .9rem;\n }\n .widget-label {\n font-weight: bold;\n font-size: 1.5rem;\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n ");document.body.parentNode.appendChild(e.$element)},plugin:K}}();
@@ -1 +1 @@
1
- var NativeDocument=function(t){"use strict";let n={};n={log(){},warn(){},error(){},disable(){}};var r=n;const o=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 n=0;for(const[e,r]of t)r.deref()||(t.delete(e),n++);n>0&&r.log("Memory Auto Clean",`🧹 Cleaned ${n} orphaned observables`)}}}();class s extends Error{constructor(e,t={}){super(e),this.name="NativeDocumentError",this.context=t,this.timestamp=(new Date).toISOString()}}function i(e,t){this.observable=e,this.checker=t,this.unSubscriptions=[]}i.prototype.__$isObservableChecker=!0,i.prototype.subscribe=function(e){const t=this.observable.subscribe(t=>{e&&e(this.checker(t))});return this.unSubscriptions.push(t),t},i.prototype.check=function(e){return this.observable.check(()=>e(this.val()))},i.prototype.val=function(){return this.checker&&this.checker(this.observable.val())},i.prototype.set=function(e){return this.observable.set(e)},i.prototype.trigger=function(){return this.observable.trigger()},i.prototype.cleanup=function(){return this.observable.cleanup()};const a=function(){const e=new Map,t=new Map;return{list:()=>t,add(n,r){if(!n||"object"!=typeof n)throw new Error(`Plugin ${r} must be an object`);if(!(r=r||n.name)||"string"!=typeof r)throw new Error("Please, provide a valid plugin name");if(!e.has(r)){n.$name=r,e.set(r,n),"function"==typeof n?.init&&n.init();for(const e in n)if(/^on[A-Z]/.test(e)){const r=e.replace(/^on/,"");t.has(r)||t.set(r,new Set),t.get(r).add(n)}}},remove(n){if(!e.has(n))return;const r=e.get(n);"function"==typeof r.cleanup&&r.cleanup();for(const[e,n]of t.entries())n.has(r)&&n.delete(r),0===n.size&&t.delete(e);e.delete(n)},emit(e,...n){if(!t.has(e))return;const o=t.get(e);for(const t of o){const o=t["on"+e];if("function"==typeof o)try{o.call(t,...n)}catch(n){r.error("Plugin Manager",`Error in plugin ${t.$name} for event ${e}`,n)}}}}}(),u=function(e,t){this.$target=t,this.$observer=e};u.prototype.__$isObservableWhen=!0,u.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},u.prototype.val=function(){return this.$observer.$currentValue===this.$target},u.prototype.isMath=function(){return this.$observer.$currentValue===this.$target},u.prototype.isActive=function(){return this.$observer.$currentValue===this.$target};const l=(e,t,n)=>{if(O.isFunction(n))return n(e,t);if(O.isObservable(e)){const r=e.val();return r&&n?r[n]:t}return O.isObject(e)?e[n]?.val?.()??e[n]??t:e},c=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},h=(e,t)=>{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=>h(e));if(O.isObservable(e))return t&&t(e),e;const n={};for(const t in e)e.hasOwnProperty(t)&&(n[t]=h(e[t]));return n};function p(e,t=null){e=O.isObservable(e)?e.val():e,this.$previousValue=null,this.$currentValue=e,this.$isCleanedUp=!1,this.$listeners=null,this.$watchers=null,this.$memoryId=null,t&&(this.configs=t,t.reset&&(this.$initialValue=O.isObject(e)?h(e):e)),a.emit("CreateObservable",this)}Object.defineProperty(p.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),p.prototype.__$isObservable=!0;const d={},f=function(){};p.prototype.intercept=function(e){return this.$interceptor=e,this},p.prototype.triggerFirstListener=function(e){this.$listeners[0](this.$currentValue,this.$previousValue,e||{})},p.prototype.triggerListeners=function(e){const t=this.$listeners,n=this.$previousValue,r=this.$currentValue;e=e||d;for(let o=0,s=t.length;o<s;o++)t[o],t[o](r,n,e)};const b=function(e,t){"function"!=typeof e?e.set?e.set(t):e.forEach(e=>{e.set?e.set(t):e(t)}):e(t)};p.prototype.triggerWatchers=function(){if(!this.$watchers)return;const e=this.$watchers,t=this.$previousValue,n=this.$currentValue;if(e.has(n)){const t=e.get(n);b(t,!0)}if(e.has(t)){const n=e.get(t);b(n,!1)}},p.prototype.triggerAll=function(e){this.triggerListeners(e),this.triggerWatchers()},p.prototype.triggerWatchersAndFirstListener=function(e){this.triggerListeners(e),this.triggerWatchers()},p.prototype.assocTrigger=function(){this.$watchers?.size&&this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerWatchersAndFirstListener:this.triggerAll:this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerFirstListener:this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=f},p.prototype.trigger=f,p.prototype.set=function(e){let t="function"==typeof e?e(this.$currentValue):e;if(t=O.isObservable(t)?t.val():t,this.$interceptor){const e=this.$interceptor(t,this.$currentValue);void 0!==e&&(t=e)}this.$currentValue!==t&&(this.$previousValue=this.$currentValue,this.$currentValue=t,a.emit("ObservableBeforeChange",this),this.trigger(),this.$previousValue=null,a.emit("ObservableAfterChange",this))},p.prototype.val=function(){return this.$currentValue},p.prototype.disconnectAll=function(){if(this.$listeners?.splice(0),this.$previousValue=null,this.$currentValue=null,this.$watchers)for(const[e,t]of this.$watchers)O.isArray(t)&&t.splice(0);this.$watchers?.clear(),this.$listeners=null,this.$watchers=null,this.trigger=f},p.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},p.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}o.unregister(this.$memoryId),this.disconnectAll(),this.$isCleanedUp=!0,delete this.$value},p.prototype.subscribe=function(e,t=null){if(this.$listeners=this.$listeners??[],this.$isCleanedUp)return r.warn("Observable subscription","⚠️ Attempted to subscribe to a cleaned up observable."),()=>{};if("function"!=typeof e)throw new s("Callback must be a function");return this.$listeners.push(e),this.assocTrigger(),a.emit("ObservableSubscribe",this,t),()=>{this.unsubscribe(e),this.assocTrigger(),a.emit("ObservableUnsubscribe",this)}},p.prototype.on=function(e,t){this.$watchers=this.$watchers??new Map;let n=this.$watchers.get(e);if(n){if(!O.isArray(n))return n=[n],void this.$watchers.set(e,n);n.push(t)}else this.$watchers.set(e,t);return this.assocTrigger(),()=>{const r=n.indexOf(t);n?.splice(r,1),1===n.size?this.$watchers.set(e,n[0]):0===n.size&&(this.$watchers?.delete(e),n=null),this.assocTrigger()}},p.prototype.once=function(e,t){const n="function"==typeof e?e:t=>t===e,r=this.subscribe(e=>{n(e)&&(r(),t(e))});return r},p.prototype.unsubscribe=function(e){const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},p.prototype.check=function(e){return new i(this,e)},p.prototype.get=function(e){const t=this.$currentValue[e];return O.isObservable(t)?t.val():t},p.prototype.when=function(e){return new u(this,e)},p.prototype.toString=function(){return this.$memoryId||o.register(this),"{{#ObItem::("+this.$memoryId+")}}"},p.prototype.equals=function(e){return O.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},p.prototype.toBool=function(){return!!this.$currentValue},p.prototype.toggle=function(){this.set(!this.$currentValue)},p.prototype.reset=function(){if(!this.configs?.reset)return;const e=O.isObject(this.$initialValue)?h(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},p.prototype.toString=function(){return String(this.$currentValue)};const m={mounted:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,executeMountedCallback(e){const t=m.mounted.get(e);t&&(t.inDom=!0,t.mounted&&t.mounted(e))},executeUnmountedCallback(e){const t=m.unmounted.get(e);t&&(t.inDom=!1,t.unmounted&&!0===t.unmounted(e)&&(t.disconnect(),e.nd?.remove()))},checkMutation:function(e){for(const t of e){if(m.mountedSupposedSize>0)for(const e of t.addedNodes){if(m.executeMountedCallback(e),!e.querySelectorAll)return;const t=e.querySelectorAll("[data--nd-mounted]");if(!t.length)return;for(const e of t)m.executeMountedCallback(e)}if(m.unmountedSupposedSize>0)for(const e of t.removedNodes){if(m.executeUnmountedCallback(e),!e.querySelectorAll)return;const t=e.querySelectorAll("[data--nd-unmounted]");if(!t.length)return;for(const e of t)m.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n={inDom:t,mounted:null,unmounted:null,disconnect:()=>{m.mounted.delete(e),m.unmounted.delete(e),m.mountedSupposedSize--,m.unmountedSupposedSize--,n=null}};return{disconnect:n.disconnect,mounted:t=>{n.mounted=t,m.mounted.set(e,n),m.mountedSupposedSize++},unmounted:t=>{n.unmounted=t,m.unmounted.set(e,n),m.unmountedSupposedSize++}}}};function g(e){this.$element=e,this.$observer=null,a.emit("NDElementCreated",e,this)}function y(e){this.$hydrate=e}m.observer=new MutationObserver(m.checkMutation),m.observer.observe(document.body,{childList:!0,subtree:!0}),g.prototype.__$isNDElement=!0,g.prototype.valueOf=function(){return this.$element},g.prototype.ref=function(e,t){return e[t]=this.$element,this},g.prototype.refSelf=function(e,t){return e[t]=this,this},g.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},g.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,delete e.nd?.on?.prevent,delete e.nd?.on,delete e.nd,e=null,this},g.prototype.lifecycle=function(e){return this.$observer=this.$observer||m.watch(this.$element),e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),this.$observer.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),this.$observer.unmounted(e.unmounted)),this},g.prototype.mounted=function(e){return this.lifecycle({mounted:e})},g.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},g.prototype.htmlElement=function(){return this.$element},g.prototype.node=g.prototype.htmlElement,g.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},g.prototype.openShadow=function(e=null){return this.shadow("open",e)},g.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},g.prototype.attach=function(e,t){return t.$hydrate(this.$element,e),this.$element},g.prototype.with=function(e){if(!e||"object"!=typeof e)throw new s("extend() requires an object of methods");for(const t in e){const n=e[t];"function"==typeof n?this[t]=n.bind(this):console.warn(`⚠️ extends(): "${t}" is not a function, skipping`)}return this},g.extend=function(e){if(!e||"object"!=typeof e)throw new s("NDElement.extend() requires an object of methods");if(Array.isArray(e))throw new s("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 n in e){if(!e.hasOwnProperty(n))continue;const o=e[n];if("function"==typeof o){if(t.has(n))throw r.error("NDElement.extend",`Cannot override protected method "${n}"`),new s(`Cannot override protected method "${n}"`);g.prototype[n]&&r.warn("NDElement.extend",`Overwriting existing prototype method "${n}"`),g.prototype[n]=o}else r.warn("NDElement.extend",`"${n}" is not a function, skipping`)}return a.emit("NDElementExtended",e),g},y.prototype.__$isTemplateBinding=!0;const v=1,w=3,$=8,C=11,O={isObservable:e=>e?.__$isObservable||e instanceof p||e instanceof i,isTemplateBinding:e=>e?.__$isTemplateBinding||e instanceof y,isObservableWhenResult:e=>e&&(e.__$isObservableWhen||"object"==typeof e&&"$target"in e&&"$observer"in e),isArrayObservable:e=>e?.__$isObservableArray,isProxy:e=>e?.__isProxy__,isObservableOrProxy:e=>O.isObservable(e)||O.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker||e instanceof i,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&&(e.nodeType===v||e.nodeType===w||e.nodeType===C||e.nodeType===$),isFragment:e=>e?.nodeType===C,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||this.isObservable(e)||this.isNDElement(e)||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement||e instanceof g,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 s(`Invalid children detected: ${t.map(e=>typeof e).join(", ")}`);return e},containsObservables:e=>!!e&&(O.isObject(e)&&Object.values(e).some(e=>O.isObservable(e))),containsObservableReference:e=>!(!e||"string"!=typeof e)&&/\{\{#ObItem::\([0-9]+\)\}\}/.test(e),validateAttributes(e){},validateEventCallback(e){if("function"!=typeof e)throw new s("Event callback must be a function")}};function S(e,t=!1){const n=document.createDocumentFragment();n.__Anchor__=!0;const o=document.createComment("Anchor Start : "+e),s=document.createComment("/ Anchor End "+e);n.appendChild(o),n.appendChild(s),n.nativeInsertBefore=n.insertBefore,n.nativeAppendChild=n.appendChild;const i=e=>t||e.firstChild===o&&e.lastChild===s;return n.appendElement=function(e,t=null){const r=o.parentNode,i=t||s;r!==n?r?.insertBefore(e,i):r.nativeInsertBefore(e,i)},n.appendChild=function(e,t=null){const o=s.parentNode;o?function(e,t,r){const o=O.isElement(t)?t:j.getChild(t);e!==n?i(e)&&r===s?e.append(o,r):e.insertBefore(o,r):e.nativeInsertBefore(o,r)}(o,e,t=t??s):r.error("Anchor","Anchor : parent not found",e)},n.append=function(...e){return n.appendChild(e)},n.removeChildren=function(){const e=s.parentNode;if(e===n)return;if(i(e))return void e.replaceChildren(o,s);let t,r=o.nextSibling;const a=document.createDocumentFragment();for(;r&&r!==s;)t=r.nextSibling,a.append(r),r=t;a.replaceChildren()},n.remove=function(){if(s.parentNode===n)return;let e,t=o.nextSibling;for(;t&&t!==s;)e=t.nextSibling,n.nativeAppendChild(t),t=e},n.removeWithAnchors=function(){n.removeChildren(),o.remove(),s.remove()},n.replaceContent=function(e){const t=O.isElement(e)?e:j.getChild(e),r=s.parentNode;r&&(i(r)?r.replaceChildren(o,t,s):(n.removeChildren(),r.insertBefore(t,s)))},n.setContent=n.replaceContent,n.insertBefore=function(e,t=null){n.appendChild(e,t)},n.endElement=function(){return s},n.startElement=function(){return o},n.restore=function(){n.appendChild(n)},n.clear=n.remove,n.detach=n.remove,n.getByIndex=function(e){let t=o;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==o?t:null},n}const E=["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"];function A(e,t=null){return new p(e,t)}const x=A,N=A;function k(e,t,n){e.classes.toggle(t,n)}function T(e,t,n){e.style[t]=n}function D(e,t,n){O.isBoolean(n)?e[t]=n:e[t]=n===e.value}function I(e,t,n,r){O.isBoolean(n)?r.set(e[t]):r.set(e.value)}function P(e,t){for(let n in t){const r=t[n];r?.bindNdClass?r.bindNdClass(e,n):e.classes.toggle(n,r)}t=null}function F(e,t){for(let n in t){const r=t[n];O.isObservable(r)?(e.style[n]=r.val(),r.subscribe(T.bind(null,e,n))):e.style[n]=r}}function M(e,t,n){const r=O.isObservable(n)?n.val():n;O.isBoolean(r)?e[t]=r:e[t]=r===e.value,O.isObservable(n)&&(["checked"].includes(t)&&e.addEventListener("input",I.bind(null,e,t,r,n)),n.subscribe(D.bind(null,e,t)))}function L(e,t,n){const r=n=>{"value"!==t?e.setAttribute(t,n):e.value=n};r(n.val()),n.subscribe(r),"value"===t&&e.addEventListener("input",()=>n.set(e.value))}A.useValueProperty=function(e="value"){Object.defineProperty(p.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},A.getById=function(e){const t=o.getObservableById(parseInt(e));if(!t)throw new s("Observable.getById : No observable found with id "+e);return t},A.cleanup=function(e){e.cleanup()},A.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{o.cleanup()}),setInterval(()=>o.cleanObservables(r),n)},p.prototype.bindNdClass=function(e,t){e.classes.toggle(t,this.val()),this.subscribe(k.bind(null,e,t))},u.prototype.bindNdClass=function(e,t){e.classes.toggle(t,this.isMath()),this.subscribe(k.bind(null,e,t))},y.prototype.bindNdClass=function(e,t){this.$hydrate(e,t)},String.prototype.toNdElement=function(){const e=this.resolveObservableTemplate?this.resolveObservableTemplate():this;return O.isString(e)?j.createStaticTextNode(null,e):j.getChild(null,e)},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},p.prototype.toNdElement=function(){return j.createObservableNode(null,this)},g.prototype.toNdElement=function(){return this.$element??this.$build?.()??this.build?.()??null},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=j.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return a.emit("BeforeProcessComponent",this),j.getChild(this())},y.prototype.toNdElement=function(){return j.createHydratableNode(null,this)},String.prototype.handleNdAttribute=function(e,t){e.setAttribute(t,this)},p.prototype.handleNdAttribute=function(e,t){E.includes(t)?M(e,t,this):L(e,t,this)},y.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const V=new Map;let _=null;const j={createTextNode:()=>(_||(_=document.createTextNode("")),_.cloneNode()),createObservableNode(e,t){const n=j.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode(e,t){const n=j.createTextNode();return t.$hydrate(n),n},createStaticTextNode(e,t){let n=j.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement(e){if(e){if(V.has(e))return V.get(e).cloneNode();const t=document.createElement(e);return V.set(e,t),t.cloneNode()}return S("Fragment")},processChildren(e,t){if(null===e)return;a.emit("BeforeProcessChildren",t);let n=this.getChild(e);n&&t.appendChild(n),a.emit("AfterProcessChildren",t)},getChild(e){if(null==e)return null;if(e.toNdElement)do{if(e=e.toNdElement(),O.isElement(e))return e;if(null==e)return null}while(e.toNdElement);return j.createStaticTextNode(null,e)},processAttributes(e,t){O.isFragment(e)||t&&function(e,t){if(O.validateAttributes(t),!O.isObject(t))throw new s("Attributes must be an object");for(let n in t){const r=n.toLowerCase();let o=t[r];if(null!=o)if(o.handleNdAttribute)o.handleNdAttribute(e,r,o);else{if(O.isString(o))return void e.setAttribute(r,o);"class"===r&&O.isObject(o)?P(e,o):"style"===r&&O.isObject(o)?F(e,o):E.includes(r)?M(e,r,o):O.isObservable(o)?L(e,r,o):o.$hydrate?o.$hydrate(e,r):e.setAttribute(r,o)}}}(e,t)},setup:(e,t,n)=>(a.emit("Setup",e,t,n),e)},q={configurable:!0,get(){return new g(this)}};Object.defineProperty(HTMLElement.prototype,"nd",q),Object.defineProperty(DocumentFragment.prototype,"nd",q),Object.defineProperty(g.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();g.prototype["on"+e]=function(e=null){return this.$element.addEventListener(t,e),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();g.prototype["onStop"+e]=function(e=null){return R(this.$element,t,e),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();g.prototype["onPrevent"+e]=function(e=null){return B(this.$element,t,e),this}}),g.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,n),this};const B=function(e,t,n){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)}),this},R=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},W={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}};Object.defineProperty(HTMLElement.prototype,"classes",{configurable:!0,get(){return{$element:this,...W}}});let H=e=>e;t.ArgTypes={},t.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 z=function(e,t=null){if(!O.isJson(e)||e?.$hydrate){const n=t;t=e,e=n}return{props:e,children:t}},U=function(e){return O.isObservable(e)?j.createObservableNode(null,e):j.createStaticTextNode(null,e)};function K(e,t,n,r=null){let{props:o,children:s=null}=z(n,r),i=j.createElement(e),a=t&&"function"==typeof t?t(i):i;return o&&j.processAttributes(a,o),s&&j.processChildren(s,a),j.setup(a,o,t)}function J(e,t){return K.bind(null,e.toLowerCase(),t)}const G=new WeakMap;function Y(e){let t=null,n=!1;const r=(e,t)=>{const n=G.get(e);if(3===e.nodeType)return n&&n.value?n.value(t):e.cloneNode(!0);const o=e.cloneNode(e.fullCloneNode);if(n&&(((e,t,n)=>{let r=null;if(t.attributes){r={};for(const e in t.attributes)r[e]=t.attributes[e](...n)}if(t.classes){r=r||{},r.class={};for(const e in t.classes)r.class[e]=t.classes[e](...n)}if(t.styles){r=r||{},r.style={};for(const e in t.styles)r.style[e]=t.styles[e](...n)}r&&j.processAttributes(e,r)})(o,n,t),function(e,t,n){if(!t.attach)return null;for(const r in t.attach)e.nd[r](function(...e){t.attach[r].call(this,...e,...n)})}(o,n,t)),e.fullCloneNode)return o;const s=e.childNodes;for(let e=0,n=s.length;e<n;e++){const n=s[e],i=r(n,t);o.appendChild(i)}return o};this.clone=o=>{if(!t&&(t=e(this),!n)){const e=t.cloneNode(!0);return e.fullCloneNode=!0,e}return n?r(t,o):t.cloneNode(!0)};const o=(e,t)=>new y((r,o)=>{n=!0,function(e,t,n,r){G.has(n)||G.set(n,{});const o=G.get(n);"value"!==t?(o[t]=o[t]||{},o[t][r]=e):o.value=e}(e,t,r,o)});this.style=e=>o(e,"styles"),this.class=e=>o(e,"classes"),this.property=e=>this.value(e),this.value=e=>o("function"!=typeof e?function(t){const n=t[0];return U(n[e])}:function(t){return U(e(...t))},"value"),this.attr=e=>o(e,"attributes"),this.attach=e=>o(e,"attach")}function Q(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=S("Component "+e);return n[e]=function(...e){r.removeChildren(),t?r.appendChild(t(...e)):r.append(e)},r}}Function.prototype.args=function(...e){return this},Function.prototype.cached=function(...e){let t,n=()=>t;return()=>(t||(t=this.apply(this,e),t.cloneNode?n=()=>t.cloneNode(!0):t.$element&&(n=()=>new g(t.$element.cloneNode(!0)))),n())},Function.prototype.errorBoundary=function(e){return(...t)=>{try{return this.apply(this,t)}catch(t){return e(t)}}},String.prototype.use=function(e){const t=this;return A.computed(()=>t.replace(/\$\{(.*?)}/g,(t,n)=>{const r=e[n];return O.isObservable(r)?r.val():r}),Object.values(e))},String.prototype.resolveObservableTemplate=function(){return O.containsObservableReference(this)?this.split(/(\{\{#ObItem::\([0-9]+\)\}\})/g).filter(Boolean).map(e=>{if(!O.containsObservableReference(e))return e;const[t,n]=e.match(/\{\{#ObItem::\(([0-9]+)\)\}\}/);return A.getById(n)}):this.valueOf()};const Z=e=>{let t=null;return new Proxy({},{get:(n,r)=>(null===t&&(t=e()),t[r])})},X=e=>{const t=new Map;return new Proxy({},{get:(n,r)=>{if(!t.has(r)){if(e.length>0)return(...n)=>{const o=e(...n);return t.set(r,o),o};t.set(r,e())}return t.get(r)}})};function ee(e){return e instanceof Date?e:new Date(e)}function te(e,t){const n=ee(e),r=ee(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function ne(e){const t=ee(e);return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}function re(e,t){const n=O.isObservable(e);return{dependencies:n?e:null,callback:r=>t(r,n?e.val():e)}}function oe(e,t){const n=e.filter(O.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>O.isObservable(e)?e.val():e))}}function se(e){return re(e,(e,t)=>e===t)}function ie(e){return re(e,(e,t)=>e!==t)}function ae(e){return re(e,(e,t)=>e>t)}function ue(e){return re(e,(e,t)=>e>=t)}function le(e){return re(e,(e,t)=>e<t)}function ce(e){return re(e,(e,t)=>e<=t)}function he(e,t=!0,n=""){return oe([e,t,n],(e,[t,n,r])=>{if(!t)return!0;if(n)try{return new RegExp(t,r).test(String(e))}catch(e){return console.warn("Invalid regex pattern:",t,e),!1}return r&&""!==r?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}function pe(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(O.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.every(e=>e.callback(t))}}function de(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(O.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.some(e=>e.callback(t))}}const fe=ae,be=ue,me=le,ge=ce,ye=se,ve=ie,we=pe,$e=de;function Ce(e,t=!1){return re(e,(e,n)=>!!e&&(!n||(t?String(e).includes(String(n)):String(e).toLowerCase().includes(String(n).toLowerCase()))))}const Oe=Ce;var Se=Object.freeze({__proto__:null,all:we,and:pe,any:$e,between:function(e,t){return oe([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:Oe,createFilter:re,createMultiSourceFilter:oe,custom:function(e,...t){const n=t.filter(O.isObservable);return{dependencies:n.length>0?n:null,callback:n=>{const r=t.map(e=>O.isObservable(e)?e.val():e);return e(n,...r)}}},dateAfter:e=>re(e,(e,t)=>!(!e||!t)&&ee(e)>ee(t)),dateBefore:e=>re(e,(e,t)=>!(!e||!t)&&ee(e)<ee(t)),dateBetween:(e,t)=>oe([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ee(e);return r>=ee(t)&&r<=ee(n)}),dateEquals:e=>re(e,(e,t)=>!(!e||!t)&&te(e,t)),dateTimeAfter:e=>re(e,(e,t)=>!(!e||!t)&&ee(e)>ee(t)),dateTimeBefore:e=>re(e,(e,t)=>!(!e||!t)&&ee(e)<ee(t)),dateTimeBetween:(e,t)=>oe([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ee(e);return r>=ee(t)&&r<=ee(n)}),dateTimeEquals:e=>re(e,(e,t)=>!(!e||!t)&&ee(e).getTime()===ee(t).getTime()),endsWith:function(e,t=!1){return re(e,(e,n)=>!n||(t?String(e).endsWith(String(n)):String(e).toLowerCase().endsWith(String(n).toLowerCase())))},eq:ye,equals:se,getSecondsOfDay:ne,greaterThan:ae,greaterThanOrEqual:ue,gt:fe,gte:be,inArray:function(e){return re(e,(e,t)=>t.includes(e))},includes:Ce,isEmpty:function(e=!0){return re(e,(e,t)=>{const n=!e||""===e||Array.isArray(e)&&0===e.length;return t?n:!n})},isNotEmpty:function(e=!0){return re(e,(e,t)=>{const n=!!e&&""!==e&&(!Array.isArray(e)||e.length>0);return t?n:!n})},isSameDay:te,lessThan:le,lessThanOrEqual:ce,lt:me,lte:ge,match:he,neq:ve,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:ie,notIn:function(e){return re(e,(e,t)=>!t.includes(e))},or:de,startsWith:function(e,t=!1){return re(e,(e,n)=>!n||(t?String(e).startsWith(String(n)):String(e).toLowerCase().startsWith(String(n).toLowerCase())))},timeAfter:e=>re(e,(e,t)=>!(!e||!t)&&ne(e)>ne(t)),timeBefore:e=>re(e,(e,t)=>!(!e||!t)&&ne(e)<ne(t)),timeBetween:(e,t)=>oe([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ne(e);return r>=ne(t)&&r<=ne(n)}),timeEquals:e=>re(e,(e,t)=>{if(!e||!t)return!1;const n=ee(e),r=ee(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:ee});const Ee=function(e,t=null){if(!Array.isArray(e))throw new s("Observable.array : target must be an array");p.call(this,e,t),a.emit("CreateObservableArray",this)};(Ee.prototype=Object.create(p.prototype)).constructor=Ee,Ee.prototype.__$isObservableArray=!0,Object.defineProperty(Ee.prototype,"length",{get(){return this.$currentValue.length}}),["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{Ee.prototype[e]=function(...t){const n=this.$currentValue[e](...t);return this.trigger({action:e,args:t,result:n}),n}}),["map","forEach","filter","reduce","some","every","find","findIndex","concat","includes","indexOf"].forEach(e=>{Ee.prototype[e]=function(...t){return this.$currentValue[e](...t)}}),Ee.prototype.clear=function(){return this.$currentValue.length=0,this.trigger({action:"clear"}),!0},Ee.prototype.at=function(e){return this.$currentValue[e]},Ee.prototype.merge=function(e){this.$currentValue.push(...e),this.trigger({action:"merge",args:e})},Ee.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},Ee.prototype.swap=function(e,t){const n=this.$currentValue,r=n.length;if(r<e||r<t)return!1;if(t<e){const n=e;e=t,t=n}const o=n[e],s=n[t];return n[e]=s,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,s]}),!0},Ee.prototype.remove=function(e){const t=this.$currentValue.splice(e,1);return 0===t.length?[]:(this.trigger({action:"remove",args:[e],result:t[0]}),t)},Ee.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return this.remove(t)},Ee.prototype.isEmpty=function(){return 0===this.$currentValue.length},Ee.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},Ee.prototype.where=function(e){const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=O.isObservable(o)?he(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(...t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=A.array(),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},Ee.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},Ee.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},A.array=function(e=[],t=null){return new Ee(e,t)},A.batch=function(e){const t=A(0),n=function(){if(O.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n};A.init=function(e,t=null){const n={};for(const r in e){const o=e[r];if(Array.isArray(o)){if(!1!==t?.deep){const e=o.map(e=>O.isJson(e)?A.json(e,t):O.isArray(e)?A.array(e,t):A(e,t));n[r]=A.array(e,t);continue}n[r]=A.array(o,t)}else O.isObservable(o)||O.isProxy(o)?n[r]=o:n[r]=A(o,t)}const r=()=>{for(const e in n){n[e].reset()}},o=()=>function(e){const t={};for(const n in e){const r=e[n];if(O.isObservable(r)){let e=r.val();Array.isArray(e)&&(e=e.map(e=>O.isObservable(e)?e.val():O.isProxy(e)?e.$value:e)),t[n]=e}else O.isProxy(r)?t[n]=r.$value:t[n]=r}return t}(n),s=()=>A.init(o(),t),i=e=>{A.update(u,e)},a=e=>function(e,t){const n=e[t];return O.isObservable(n)?n.val():O.isProxy(n)?n.$value:n}(n,e),u=new Proxy(n,{get:(n,u)=>"__isProxy__"===u||("$value"===u?o():"get"===u||"$get"===u?a:"val"===u||"$val"===u?o:"set"===u||"$set"===u||"$updateWith"===u?i:"observables"===u||"$observables"===u?Object.values(n):"keys"===u||"$keys"===u?Object.keys(e):"clone"===u||"$clone"===u?s:"reset"===u?r:"configs"===u?t:n[u]),set:(e,t,n)=>void 0===e[t]||(O.isObservable(n)?e[t].set(n.val()):e[t].set(n),!0)});return u},A.arrayOfObject=function(e){return e.map(e=>A.object(e))},A.value=function(e){if(O.isObservable(e))return e.val();if(O.isProxy(e))return e.$value;if(O.isArray(e)){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(A.value(r))}return t}return e},A.update=function(e,t){const n=O.isProxy(t)?t.$value:t,r=e.configs;for(const o in n){const s=e[o],i=t[o],a=n[o];if(O.isObservable(s)){if(O.isArray(a)){const e=i.at(0);if(O.isObservable(e)||O.isProxy(e)){const t=a.map(t=>O.isProxy(e)?A.init(t,r):A(t,r));s.set(t);continue}s.set([...a]);continue}s.set(a)}else O.isProxy(s)?A.update(s,a):e[o]=a}},A.object=A.init,A.json=A.init,A.computed=function(e,t=[]){const n=new p(e()),r=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}}(()=>n.set(e()));if(a.emit("CreateObservableComputed",n,t),O.isFunction(t)){if(!O.isObservable(t.$observer))throw new s("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(r),n}return t.forEach(e=>{O.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(r)}):e.subscribe(r)}),n};const Ae=function(){const e=new Map;return{use(t){const{observer:n,subscribers:r}=e.get(t),o=A(n.val()),s=n.subscribe(e=>o.set(e)),i=o.subscribe(e=>n.set(e));return o.destroy=()=>{s(),i(),o.cleanup()},r.add(o),o},follow(e){return this.use(e)},create(t,n){const r=A(n);return e.set(t,{observer:r,subscribers:new Set}),r},get(t){const n=e.get(t);return n?n.observer:null},getWithSubscribers:t=>e.get(t),delete(t){const n=e.get(t);n&&(n.observer.cleanup(),n.subscribers.forEach(e=>e.destroy()),n.observer.clear())}}}();const xe=function(e,t,{comment:n=null,shouldKeepInCache:o=!0}={}){if(!O.isObservable(e)&&!O.isObservableWhenResult(e))return r.warn("ShowIf","ShowIf : condition must be an Observable / "+n,e);const s=S("Show if : "+(n||""));let i=null;const a=()=>(i&&o||(i=j.getChild(t),O.isFragment(i)&&(i=Array.from(i.childNodes))),i);return e.val()&&s.appendChild(a()),e.subscribe(e=>{e?s.appendChild(a()):s.remove()}),s},Ne=function(e,t,n=!0){if(!O.isObservable(e))throw new s("Toggle : condition must be an Observable");const r=S("Match"),o=new Map,i=function(e){if(n&&o.has(e))return o.get(e);let r=t[e];return r?(r=j.getChild(r),O.isFragment(r)&&(r=Array.from(r.children)),n&&o.set(e,r),r):null},a=e.val(),u=i(a);return u&&r.appendChild(u),e.subscribe(e=>{const t=i(e);r.remove(),t&&r.appendChild(t)}),r.nd.with({add(n,r,o=!1){t[n]=r,o&&e.set(n)},remove(e){n&&o.delete(e),delete t[e]}})},ke=function(e,t,n){if(!O.isObservable(e))throw new s("Toggle : condition must be an Observable");return Ne(e,{true:t,false:n})},Te=J("div"),De=J("span"),Ie=J("label"),Pe=J("p"),Fe=Pe,Me=J("strong"),Le=J("h1"),Ve=J("h2"),_e=J("h3"),je=J("h4"),qe=J("h5"),Be=J("h6"),Re=J("br"),We=J("a"),He=J("pre"),ze=J("code"),Ue=J("blockquote"),Ke=J("hr"),Je=J("em"),Ge=J("small"),Ye=J("mark"),Qe=J("del"),Ze=J("ins"),Xe=J("sub"),et=J("sup"),tt=J("abbr"),nt=J("cite"),rt=J("q"),ot=J("dl"),st=J("dt"),it=J("dd"),at=J("form",function(e){return 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}),ut=J("input"),lt=J("textarea"),ct=lt,ht=J("select"),pt=J("fieldset"),dt=J("option"),ft=J("legend"),bt=J("datalist"),mt=J("output"),gt=J("progress"),yt=J("meter"),vt=J("button"),wt=J("main"),$t=J("section"),Ct=J("article"),Ot=J("aside"),St=J("nav"),Et=J("figure"),At=J("figcaption"),xt=J("header"),Nt=J("footer"),kt=J("img"),Tt=function(e,t){return kt({src:e,...t})},Dt=J("details"),It=J("summary"),Pt=J("dialog"),Ft=J("menu"),Mt=J("ol"),Lt=J("ul"),Vt=J("li"),_t=Vt,jt=Mt,qt=Lt,Bt=J("audio"),Rt=J("video"),Wt=J("source"),Ht=J("track"),zt=J("canvas"),Ut=J("svg"),Kt=J("time"),Jt=J("data"),Gt=J("address"),Yt=J("kbd"),Qt=J("samp"),Zt=J("var"),Xt=J("wbr"),en=J("caption"),tn=J("table"),nn=J("thead"),rn=J("tfoot"),on=J("tbody"),sn=J("tr"),an=sn,un=J("th"),ln=un,cn=un,hn=J("td"),pn=hn,dn=J("");var fn=Object.freeze({__proto__:null,Abbr:tt,Address:Gt,Anchor:S,Article:Ct,Aside:Ot,AsyncImg:function(e,t,n,r){const o=O.isObservable(e)?e.val():e,i=Tt(t||o,n),a=new Image;return a.onload=()=>{O.isFunction(r)&&r(null,i),i.src=O.isObservable(e)?e.val():e},a.onerror=()=>{O.isFunction(r)&&r(new s("Image not found"))},O.isObservable(e)&&e.subscribe(e=>{a.src=e}),a.src=o,i},Audio:Bt,BaseImage:kt,Blockquote:Ue,Br:Re,Button:vt,Canvas:zt,Caption:en,Checkbox:e=>ut({type:"checkbox",...e}),Cite:nt,Code:ze,ColorInput:e=>ut({type:"color",...e}),Data:Jt,Datalist:bt,DateInput:e=>ut({type:"date",...e}),DateTimeInput:e=>ut({type:"datetime-local",...e}),Dd:it,Del:Qe,Details:Dt,Dialog:Pt,Div:Te,Dl:ot,Dt:st,Em:Je,EmailInput:e=>ut({type:"email",...e}),FieldSet:pt,FigCaption:At,Figure:Et,FileInput:e=>ut({type:"file",...e}),Footer:Nt,ForEach:function(e,t,n,{shouldKeepItemsInCache:o=!1}={}){const i=S("ForEach"),a=i.endElement();i.startElement();let u=new Map,c=null;const h=new Set,p=e=>{if(!o)for(const[t,n]of u.entries()){if(h.has(t))continue;const r=n.child?.deref();e&&r&&e.removeChild(r),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,u.delete(n.keyId),c&&c.delete(n.keyId)}},d=(e,o)=>{const i=l(e,o,n);if(u.has(i)){const e=u.get(i);if(e.indexObserver?.set(o),e.isNew=!1,e.child?.deref())return i;u.delete(i)}try{const n=t.length>=2?A(o):null;let r=j.getChild(t(e,n));if(!r)throw new s("ForEach child can't be null or undefined!");u.set(i,{keyId:i,isNew:!0,child:new WeakRef(r),indexObserver:n})}catch(e){throw r.error("ForEach",`Error creating element for key ${i}`,e),e}return i},f=()=>{const t=a.parentNode;if(!t)return;const n=O.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(),O.isObservable(e)&&e.subscribe(f),i},ForEachArray:function(e,t,n,r={}){const o=S("ForEach Array"),i=o.endElement(),a=o.startElement();let u=new Map,c=0;const h=t.length>=2,p=new WeakMap,d=()=>{o.removeChildren(),g(),c=0},f=(e,t)=>p.has(e)?p.get(e):l(e,t,n),b=e=>v(f(e)),m=(e,t=!0)=>{if(e){if(t){const t=e.child;t?.remove(),u.delete(e.keyId)}e.indexObserver?.deref()?.cleanup()}},g=()=>{if(!r.shouldKeepItemsInCache)if(h){for(const[e,t]of u.entries())m(t,!1);u.clear()}else u.clear()},y=(e,n)=>{const r=f(e,n);if(u.has(r)){const e=u.get(r);e.indexObserver?.deref()?.set(n);const t=e.child;if(t)return t;u.delete(r)}const o=h?A(n):null;let i=j.getChild(t(e,o));if(!i)throw new s("ForEachArray child can't be null or undefined!");return u.set(r,{keyId:r,child:i,indexObserver:o?new WeakRef(o):null}),p.set(e,r),i},v=function(e){const t=u.get(e);if(!t)return null;const n=t.child;return n||(m(t,!1),null)},w=function(e,t){const n=u.get(e);if(!n)return null;const r=n.child;if(!r)return null;t?t.appendChild(r):r.remove()},$={toFragment(e,t=0){const n=document.createDocumentFragment();for(let t=0,r=e.length;t<r;t++)n.appendChild(y(e[t],c)),c++;return n},add(e,t=2){const n=$.toFragment(e);o.appendElement(n)},replace(e){d(),$.add(e)},reOrder(e){let t=null;const n=document.createDocumentFragment();for(const r of e)t=b(r),t&&n.appendChild(t);t=null,o.appendElement(n,i)},removeOne(e,t){((e,t=!0)=>{m(u.get(e),t)})(f(e,t),!0)},clear:d,merge(e){$.add(e)},push(e){let t=0;r.pushDelay&&(t=r.pushDelay(e)??0),$.add(e,t)},populate([e,t,n]){const r=document.createDocumentFragment();for(let o=0;o<t;o++){const t=n(o);e.push(t),r.append(y(t,o)),c++}o.appendChild(r),r.replaceChildren()},unshift(e){o.insertBefore($.toFragment(e),a.nextSibling)},splice(e,t){const[n,r,...s]=e;let a=null;const u=document.createDocumentFragment();if(t.length>0){let e=f(t[0],n);if(1===t.length)w(e,u);else if(t.length>1){const r=v(e);a=r?.previousSibling;for(let e=0;e<t.length;e++){const r=f(t[e],n+e);w(r,u)}}}else a=i;u.replaceChildren(),s&&s.length&&a&&o.insertBefore($.toFragment(s),a.nextSibling)},reverse(e,t){$.reOrder(t)},sort(e,t){$.reOrder(t)},remove(e,t){$.removeOne(t)},pop(e,t){$.removeOne(t)},shift(e,t){$.removeOne(t)},swap(e,t){const n=i.parentNode;let r=b(t[0]),o=b(t[1]);if(!r||!o)return;const s=o.nextSibling;n.insertBefore(o,r),n.insertBefore(r,s),r=null,o=null}},C=(e,t,n)=>{if("clear"!==n.action&&e.length){if(n?.action)$[n.action]&&$[n.action](n.args,n.result);else{if(0===c)return void $.add(e);$.replace(e)}((e,t=0)=>{if(!h)return;let n=t;for(let r=t,o=e?.length;r<o;r++){const t=u.get(f(e[r],r));t&&(t.indexObserver?.deref()?.set(n),n++)}})(e,0)}else{if(0===c)return;d()}};return e.val().length&&C(e.val(),0,{action:null}),O.isObservable(e)&&e.subscribe(C),o},Form:at,Fragment:dn,H1:Le,H2:Ve,H3:_e,H4:je,H5:qe,H6:Be,Header:xt,HiddenInput:e=>ut({type:"hidden",...e}),HideIf:function(e,t,n){const r=A(!e.val());return e.subscribe(e=>r.set(!e)),xe(r,t,n)},HideIfNot:function(e,t,n){return xe(e,t,n)},Hr:Ke,Img:Tt,Input:ut,Ins:Ze,Kbd:Yt,Label:Ie,LazyImg:function(e,t){return Tt(e,{...t,loading:"lazy"})},Legend:ft,Li:_t,Link:We,ListItem:Vt,Main:wt,Mark:Ye,Match:Ne,Menu:Ft,Meter:yt,MonthInput:e=>ut({type:"month",...e}),NativeDocumentFragment:S,Nav:St,NumberInput:e=>ut({type:"number",...e}),Ol:jt,Option:dt,OrderedList:Mt,Output:mt,P:Pe,Paragraph:Fe,PasswordInput:e=>ut({type:"password",...e}),Pre:He,Progress:gt,Quote:rt,Radio:e=>ut({type:"radio",...e}),RangeInput:e=>ut({type:"range",...e}),ReadonlyInput:e=>ut({readonly:!0,...e}),Samp:Qt,SearchInput:e=>ut({type:"search",...e}),Section:$t,Select:ht,ShowIf:xe,ShowWhen:function(){if(2===arguments.length){const[e,t]=arguments;if(!O.isObservableWhenResult(e))throw new s("showWhen observer must be an ObservableWhenResult",{data:e,help:"Use observer.when(target) to create an ObservableWhenResult"});return xe(e,t)}if(3===arguments.length){const[e,t,n]=arguments;if(!O.isObservable(e))throw new s("showWhen observer must be an Observable",{data:e});return xe(e.when(t),n)}throw new s("showWhen must have 2 or 3 arguments",{data:["showWhen(observer, target, view)","showWhen(observerWhenResult, view)"]})},SimpleButton:(e,t)=>vt(e,{type:"button",...t}),Small:Ge,Source:Wt,Span:De,Strong:Me,Sub:Xe,SubmitButton:(e,t)=>vt(e,{type:"submit",...t}),Summary:It,Sup:et,Svg:Ut,Switch:ke,TBody:on,TBodyCell:pn,TFoot:rn,TFootCell:cn,THead:nn,THeadCell:ln,TRow:an,Table:tn,Td:hn,TelInput:e=>ut({type:"tel",...e}),TextArea:lt,TextInput:ct,Th:un,Time:Kt,TimeInput:e=>ut({type:"time",...e}),Tr:sn,Track:Ht,Ul:qt,UnorderedList:Lt,UrlInput:e=>ut({type:"url",...e}),Var:Zt,Video:Rt,Wbr:Xt,WeekInput:e=>ut({type:"week",...e}),When:function(e){if(!O.isObservable(e))throw new s("When : condition must be an Observable");let t=null,n=null;return{show(e){return t=e,this},otherwise:r=>(n=r,ke(e,t,n))}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=S("Portal "+n);return r.appendChild(j.getChild(e)),(t||document.body).appendChild(r),r}});const bn={};function mn(e,t,n={}){e="/"+c(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,a=n.with||{},u=n.layout||null,l={},h=[],p=e=>{if(!e)return null;const[t,n]=e.split(":");let r=a[t];return!r&&n&&(r=bn[n]),r||(r="[^/]+"),r=r.replace("(","(?:"),{name:t,pattern:`(${r})`}},d=()=>{if(r)return r;const t=e.replace(/\{(.*?)}/gi,(e,t)=>{const n=p(t);return n&&n.pattern?(l[n.name]=n.pattern,h.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=()=>u,this.match=function(e){e="/"+c(e,"/");if(!d().exec(e))return!1;const t={};return d().exec(e).forEach((e,n)=>{if(n<1)return;const r=h[n-1];t[r]=e}),t},this.url=function(t){const n=e.replace(/\{(.*?)}/gi,(e,n)=>{const r=p(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 gn extends Error{constructor(e,t){super(e),this.context=t}}const yn=(e,t)=>{const n=[];return e.forEach(e=>{n.push(c(e.suffix,"/"))}),n.push(c(t,"/")),n.join("/")},vn=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},wn=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},$n=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Cn(){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:u}=e[o];r(u)},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:u}=this.resolve(n);u!==o()&&(e.splice(t+1),e.push({route:s,params:i,query:a,path:u}),t++,r(u))},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 On(){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){r.error("HistoryRouter","Error in pushState",e)}},this.replace=function(e){const{route:t,path:n,params:o}=this.resolve(e);try{window.history.replaceState({name:t.name(),params:o,path:n},t.name()||n,n),this.handleRouteChange(t,o,{},n)}catch(e){r.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){r.error("HistoryRouter","Error in popstate event",e)}});const{route:t,params:n,query:o,path:s}=this.resolve(e||window.location.pathname+window.location.search);this.handleRouteChange(t,n,o,s)}}function Sn(){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)}}const En="default";function An(e={}){const t=[],n={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Cn.apply(this,[]);else if("history"===e.mode)On.apply(this,[]);else{if("memory"!==e.mode)throw new gn("Invalid router mode "+e.mode);Sn.apply(this,[])}const a=function(e,t){for(const n of s)try{n(e),t&&t(e)}catch(e){r.warn("Route Listener","Error in listener:",e)}};this.routes=()=>[...t],this.currentState=()=>({...i}),this.add=function(e,r,s){const i=new mn(yn(o,e),r,{...s,middlewares:vn(o,s?.middlewares||[]),name:s?.name?wn(o,s.name):null,layout:s?.layout||$n(o)});return t.push(i),i.name()&&(n[i.name()]=i),this},this.group=function(e,t,n){if(!O.isFunction(n))throw new gn("Callback must be a function");return o.push({suffix:e,options:t}),n(),o.pop(),this},this.generateUrl=function(e,t={},r={}){const o=n[e];if(!o)throw new gn(`Route not found for name: ${e}`);return o.url({params:t,query:r})},this.resolve=function(e){if(O.isJson(e)){const t=n[e.name];if(!t)throw new gn(`Route not found for name: ${e.name}`);return{route:t,params:e.params,query:e.query,path:t.url({...e})}}const[r,o]=e.split("?"),s="/"+c(r,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new gn(`Route not found for url: ${r}`);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(!O.isFunction(e))throw new gn("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 u={...i},l=e=>{if(s++,!(s>=o.length))return o[s](e||u,l)};return o[s](u,l)}}function xn(e,t){const{to:n,href:r,...o}=e,s=n||r;if(O.isString(s)){const e=An.get();return We({...o,href:s},t).nd.onPreventClick(()=>{e.push(s)})}const i=s.router||En,a=An.get(i);if(!a)throw new gn('Router not found "'+i+'" for link "'+s.name+'"');const u=a.generateUrl(s.name,s.params,s.query);return We({...o,href:u},t).nd.onPreventClick(()=>{a.push(u)})}An.routers={},An.create=function(t,n){if(!O.isFunction(n))throw r.error("Router","Callback must be a function",e),new gn("Callback must be a function");const o=new An(t);return An.routers[t.name||En]=o,n(o),o.init(t.entry),o.mount=function(e){if(O.isString(e)){const t=document.querySelector(e);if(!t)throw new gn(`Container not found for selector: ${e}`);e=t}else if(!O.isElement(e))throw new gn("Container must be a string or an Element");return function(e,t){const n=new Map;let r=null;const o=function(e,n){t.innerHTML="";let o=e;const s=n.layout();O.isNDElement(e)&&(o=e.node()),s?t.appendChild(s(o)):(O.isAnchor(r)&&r.remove(),t.appendChild(o),r=e)},s=function(e){if(!e.route)return;const{route:t,params:r,query:s,path:i}=e;if(n.has(i)){const e=n.get(i);return void o(e,t)}const a=t.component()({params:r,query:s});n.set(i,a),o(a,t)};return e.subscribe(s),s(e.currentState()),t}(o,e)},o},An.get=function(e){const t=An.routers[e||En];if(!t)throw new gn(`Router not found for name: ${e}`);return t},An.push=function(e,t=null){return An.get(t).push(e)},An.replace=function(e,t=null){return An.get(t).replace(e)},An.forward=function(e=null){return An.get(e).forward()},An.back=function(e=null){return An.get(e).back()},xn.blank=function(e,t){return We({...e,target:"_blank"},t)};var Nn=Object.freeze({__proto__:null,Link:xn,RouteParamPatterns:bn,Router:An});const kn={once:e=>Z(e),memoize:e=>X(e)};var Tn=Object.freeze({__proto__:null,Filters:Se,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||{}}};o&&(o instanceof FormData?i.body=o:(i.headers["Content-Type"]="application/json","GET"!==n?i.body=JSON.stringify(o):i.params=o));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 u=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok){const e=new Error(u?.message||a.statusText);throw e.status=a.status,e.data=u,e}return u},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)}},Service:kn});return t.$=x,t.ElementCreator=j,t.HtmlElementWrapper=J,t.NDElement=g,t.Observable=A,t.PluginsManager=a,t.SingletonView=Q,t.Store=Ae,t.TemplateCloner=Y,t.Validator=O,t.autoMemoize=X,t.autoOnce=Z,t.classPropertyAccumulator=function(e=[]){let t=O.isString(e)?e.split(" ").filter(Boolean):e;const n=O.isArray(t);return{add(e,r=!0){n?t.push(e):t[e]=r},value:()=>n?t.join(" "):{...t}}},t.createTextNode=U,t.cssPropertyAccumulator=function(e={}){let t=O.isString(e)?e.split(";").filter(Boolean):e;const n=O.isArray(t);return{add(e,r){n?t.push(e+" : "+r):t[e]=r},value:()=>n?t.join(";").concat(";"):{...t}}},t.elements=fn,t.memoize=e=>{const t=new Map;return(...n)=>{const[r,...o]=n;return t.has(r)||t.set(r,e(...o)),t.get(r)}},t.normalizeComponentArgs=z,t.obs=N,t.once=e=>{let t=null;return(...n)=>(null===t&&(t=e(...n)),t)},t.router=Nn,t.useCache=function(e){let t=null;const n=function(n){return t||(t=new Y(e)),t.clone(n)};return e.length<2?function(...e){return n(e)}:function(e,t,...r){return n([e,t,...r])}},t.useSingleton=function(e){let t=null;return function(...n){return t||(t=new Q(e)),t.render(n)}},t.utils=Tn,t.withValidation=H,t}({});
1
+ var NativeDocument=function(t){"use strict";let n={};n={log(){},warn(){},error(){},disable(){}};var r=n;const o=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 n=0;for(const[e,r]of t)r.deref()||(t.delete(e),n++);n>0&&r.log("Memory Auto Clean",`🧹 Cleaned ${n} orphaned observables`)}}}();class s extends Error{constructor(e,t={}){super(e),this.name="NativeDocumentError",this.context=t,this.timestamp=(new Date).toISOString()}}function i(e,t){this.observable=e,this.checker=t,this.unSubscriptions=[]}i.prototype.__$isObservableChecker=!0,i.prototype.subscribe=function(e){const t=this.observable.subscribe(t=>{e&&e(this.checker(t))});return this.unSubscriptions.push(t),t},i.prototype.check=function(e){return this.observable.check(()=>e(this.val()))},i.prototype.val=function(){return this.checker&&this.checker(this.observable.val())},i.prototype.set=function(e){return this.observable.set(e)},i.prototype.trigger=function(){return this.observable.trigger()},i.prototype.cleanup=function(){return this.observable.cleanup()};const a=function(){const e=new Map,t=new Map;return{list:()=>t,add(n,r){if(!n||"object"!=typeof n)throw new Error(`Plugin ${r} must be an object`);if(!(r=r||n.name)||"string"!=typeof r)throw new Error("Please, provide a valid plugin name");if(!e.has(r)){n.$name=r,e.set(r,n),"function"==typeof n?.init&&n.init();for(const e in n)if(/^on[A-Z]/.test(e)){const r=e.replace(/^on/,"");t.has(r)||t.set(r,new Set),t.get(r).add(n)}}},remove(n){if(!e.has(n))return;const r=e.get(n);"function"==typeof r.cleanup&&r.cleanup();for(const[e,n]of t.entries())n.has(r)&&n.delete(r),0===n.size&&t.delete(e);e.delete(n)},emit(e,...n){if(!t.has(e))return;const o=t.get(e);for(const t of o){const o=t["on"+e];if("function"==typeof o)try{o.call(t,...n)}catch(n){r.error("Plugin Manager",`Error in plugin ${t.$name} for event ${e}`,n)}}}}}(),u=function(e,t){this.$target=t,this.$observer=e};u.prototype.__$isObservableWhen=!0,u.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},u.prototype.val=function(){return this.$observer.$currentValue===this.$target},u.prototype.isMath=function(){return this.$observer.$currentValue===this.$target},u.prototype.isActive=function(){return this.$observer.$currentValue===this.$target};const l=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},c=(e,t)=>{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=>c(e));if(O.isObservable(e))return t&&t(e),e;const n={};for(const t in e)e.hasOwnProperty(t)&&(n[t]=c(e[t]));return n};function h(e,t=null){e=O.isObservable(e)?e.val():e,this.$previousValue=null,this.$currentValue=e,this.$isCleanedUp=!1,this.$listeners=null,this.$watchers=null,this.$memoryId=null,t&&(this.configs=t,t.reset&&(this.$initialValue=O.isObject(e)?c(e):e)),a.emit("CreateObservable",this)}Object.defineProperty(h.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),h.prototype.__$isObservable=!0;const p={},d=function(){};h.prototype.intercept=function(e){return this.$interceptor=e,this},h.prototype.triggerFirstListener=function(e){this.$listeners[0](this.$currentValue,this.$previousValue,e||{})},h.prototype.triggerListeners=function(e){const t=this.$listeners,n=this.$previousValue,r=this.$currentValue;e=e||p;for(let o=0,s=t.length;o<s;o++)t[o],t[o](r,n,e)};const f=function(e,t){"function"!=typeof e?e.set?e.set(t):e.forEach(e=>{e.set?e.set(t):e(t)}):e(t)};h.prototype.triggerWatchers=function(){if(!this.$watchers)return;const e=this.$watchers,t=this.$previousValue,n=this.$currentValue;if(e.has(n)){const t=e.get(n);f(t,!0)}if(e.has(t)){const n=e.get(t);f(n,!1)}},h.prototype.triggerAll=function(e){this.triggerListeners(e),this.triggerWatchers()},h.prototype.triggerWatchersAndFirstListener=function(e){this.triggerListeners(e),this.triggerWatchers()},h.prototype.assocTrigger=function(){this.$watchers?.size&&this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerWatchersAndFirstListener:this.triggerAll:this.$listeners?.length?this.trigger=1===this.$listeners.length?this.triggerFirstListener:this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=d},h.prototype.trigger=d,h.prototype.set=function(e){let t="function"==typeof e?e(this.$currentValue):e;if(t=O.isObservable(t)?t.val():t,this.$interceptor){const e=this.$interceptor(t,this.$currentValue);void 0!==e&&(t=e)}this.$currentValue!==t&&(this.$previousValue=this.$currentValue,this.$currentValue=t,a.emit("ObservableBeforeChange",this),this.trigger(),this.$previousValue=null,a.emit("ObservableAfterChange",this))},h.prototype.val=function(){return this.$currentValue},h.prototype.disconnectAll=function(){if(this.$listeners?.splice(0),this.$previousValue=null,this.$currentValue=null,this.$watchers)for(const[e,t]of this.$watchers)O.isArray(t)&&t.splice(0);this.$watchers?.clear(),this.$listeners=null,this.$watchers=null,this.trigger=d},h.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},h.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}o.unregister(this.$memoryId),this.disconnectAll(),this.$isCleanedUp=!0,delete this.$value},h.prototype.subscribe=function(e,t=null){if(this.$listeners=this.$listeners??[],this.$isCleanedUp)return r.warn("Observable subscription","⚠️ Attempted to subscribe to a cleaned up observable."),()=>{};if("function"!=typeof e)throw new s("Callback must be a function");return this.$listeners.push(e),this.assocTrigger(),a.emit("ObservableSubscribe",this,t),()=>{this.unsubscribe(e),this.assocTrigger(),a.emit("ObservableUnsubscribe",this)}},h.prototype.on=function(e,t){this.$watchers=this.$watchers??new Map;let n=this.$watchers.get(e);if(n){if(!O.isArray(n))return n=[n],void this.$watchers.set(e,n);n.push(t)}else this.$watchers.set(e,t);return this.assocTrigger(),()=>{const r=n.indexOf(t);n?.splice(r,1),1===n.size?this.$watchers.set(e,n[0]):0===n.size&&(this.$watchers?.delete(e),n=null),this.assocTrigger()}},h.prototype.once=function(e,t){const n="function"==typeof e?e:t=>t===e,r=this.subscribe(e=>{n(e)&&(r(),t(e))});return r},h.prototype.unsubscribe=function(e){const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},h.prototype.check=function(e){return new i(this,e)},h.prototype.get=function(e){const t=this.$currentValue[e];return O.isObservable(t)?t.val():t},h.prototype.when=function(e){return new u(this,e)},h.prototype.toString=function(){return this.$memoryId||o.register(this),"{{#ObItem::("+this.$memoryId+")}}"},h.prototype.equals=function(e){return O.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},h.prototype.toBool=function(){return!!this.$currentValue},h.prototype.toggle=function(){this.set(!this.$currentValue)},h.prototype.reset=function(){if(!this.configs?.reset)return;const e=O.isObject(this.$initialValue)?c(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},h.prototype.toString=function(){return String(this.$currentValue)};const b={mounted:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,executeMountedCallback(e){const t=b.mounted.get(e);t&&(t.inDom=!0,t.mounted&&t.mounted(e))},executeUnmountedCallback(e){const t=b.unmounted.get(e);t&&(t.inDom=!1,t.unmounted&&!0===t.unmounted(e)&&(t.disconnect(),e.nd?.remove()))},checkMutation:function(e){for(const t of e){if(b.mountedSupposedSize>0)for(const e of t.addedNodes){if(b.executeMountedCallback(e),!e.querySelectorAll)return;const t=e.querySelectorAll("[data--nd-mounted]");if(!t.length)return;for(const e of t)b.executeMountedCallback(e)}if(b.unmountedSupposedSize>0)for(const e of t.removedNodes){if(b.executeUnmountedCallback(e),!e.querySelectorAll)return;const t=e.querySelectorAll("[data--nd-unmounted]");if(!t.length)return;for(const e of t)b.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n={inDom:t,mounted:null,unmounted:null,disconnect:()=>{b.mounted.delete(e),b.unmounted.delete(e),b.mountedSupposedSize--,b.unmountedSupposedSize--,n=null}};return{disconnect:n.disconnect,mounted:t=>{n.mounted=t,b.mounted.set(e,n),b.mountedSupposedSize++},unmounted:t=>{n.unmounted=t,b.unmounted.set(e,n),b.unmountedSupposedSize++}}}};function m(e){this.$element=e,this.$observer=null,a.emit("NDElementCreated",e,this)}function g(e){this.$hydrate=e}b.observer=new MutationObserver(b.checkMutation),b.observer.observe(document.body,{childList:!0,subtree:!0}),m.prototype.__$isNDElement=!0,m.prototype.valueOf=function(){return this.$element},m.prototype.ref=function(e,t){return e[t]=this.$element,this},m.prototype.refSelf=function(e,t){return e[t]=this,this},m.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},m.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,delete e.nd?.on?.prevent,delete e.nd?.on,delete e.nd,e=null,this},m.prototype.lifecycle=function(e){return this.$observer=this.$observer||b.watch(this.$element),e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),this.$observer.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),this.$observer.unmounted(e.unmounted)),this},m.prototype.mounted=function(e){return this.lifecycle({mounted:e})},m.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},m.prototype.htmlElement=function(){return this.$element},m.prototype.node=m.prototype.htmlElement,m.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},m.prototype.openShadow=function(e=null){return this.shadow("open",e)},m.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},m.prototype.attach=function(e,t){return t.$hydrate(this.$element,e),this.$element},m.prototype.with=function(e){if(!e||"object"!=typeof e)throw new s("extend() requires an object of methods");for(const t in e){const n=e[t];"function"==typeof n?this[t]=n.bind(this):console.warn(`⚠️ extends(): "${t}" is not a function, skipping`)}return this},m.extend=function(e){if(!e||"object"!=typeof e)throw new s("NDElement.extend() requires an object of methods");if(Array.isArray(e))throw new s("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 n in e){if(!e.hasOwnProperty(n))continue;const o=e[n];if("function"==typeof o){if(t.has(n))throw r.error("NDElement.extend",`Cannot override protected method "${n}"`),new s(`Cannot override protected method "${n}"`);m.prototype[n]&&r.warn("NDElement.extend",`Overwriting existing prototype method "${n}"`),m.prototype[n]=o}else r.warn("NDElement.extend",`"${n}" is not a function, skipping`)}return a.emit("NDElementExtended",e),m},g.prototype.__$isTemplateBinding=!0;const y=1,v=3,$=8,C=11,O={isObservable:e=>e?.__$isObservable||e instanceof h||e instanceof i,isTemplateBinding:e=>e?.__$isTemplateBinding||e instanceof g,isObservableWhenResult:e=>e&&(e.__$isObservableWhen||"object"==typeof e&&"$target"in e&&"$observer"in e),isArrayObservable:e=>e?.__$isObservableArray,isProxy:e=>e?.__isProxy__,isObservableOrProxy:e=>O.isObservable(e)||O.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker||e instanceof i,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&&(e.nodeType===y||e.nodeType===v||e.nodeType===C||e.nodeType===$),isFragment:e=>e?.nodeType===C,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||this.isObservable(e)||this.isNDElement(e)||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement||e instanceof m,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 s(`Invalid children detected: ${t.map(e=>typeof e).join(", ")}`);return e},containsObservables:e=>!!e&&(O.isObject(e)&&Object.values(e).some(e=>O.isObservable(e))),containsObservableReference:e=>!(!e||"string"!=typeof e)&&/\{\{#ObItem::\([0-9]+\)\}\}/.test(e),validateAttributes(e){},validateEventCallback(e){if("function"!=typeof e)throw new s("Event callback must be a function")}};function S(e,t=!1){const n=document.createDocumentFragment();n.__Anchor__=!0;const o=document.createComment("Anchor Start : "+e),s=document.createComment("/ Anchor End "+e);n.appendChild(o),n.appendChild(s),n.nativeInsertBefore=n.insertBefore,n.nativeAppendChild=n.appendChild;const i=e=>t||e.firstChild===o&&e.lastChild===s;return n.appendElement=function(e,t=null){const r=o.parentNode,i=t||s;r!==n?r?.insertBefore(e,i):r.nativeInsertBefore(e,i)},n.appendChild=function(e,t=null){const o=s.parentNode;o?function(e,t,r){const o=O.isElement(t)?t:V.getChild(t);e!==n?i(e)&&r===s?e.append(o,r):e.insertBefore(o,r):e.nativeInsertBefore(o,r)}(o,e,t=t??s):r.error("Anchor","Anchor : parent not found",e)},n.append=function(...e){return n.appendChild(e)},n.removeChildren=function(){const e=s.parentNode;if(e===n)return;if(i(e))return void e.replaceChildren(o,s);let t,r=o.nextSibling;const a=document.createDocumentFragment();for(;r&&r!==s;)t=r.nextSibling,a.append(r),r=t;a.replaceChildren()},n.remove=function(){if(s.parentNode===n)return;let e,t=o.nextSibling;for(;t&&t!==s;)e=t.nextSibling,n.nativeAppendChild(t),t=e},n.removeWithAnchors=function(){n.removeChildren(),o.remove(),s.remove()},n.replaceContent=function(e){const t=O.isElement(e)?e:V.getChild(e),r=s.parentNode;r&&(i(r)?r.replaceChildren(o,t,s):(n.removeChildren(),r.insertBefore(t,s)))},n.setContent=n.replaceContent,n.insertBefore=function(e,t=null){n.appendChild(e,t)},n.endElement=function(){return s},n.startElement=function(){return o},n.restore=function(){n.appendChild(n)},n.clear=n.remove,n.detach=n.remove,n.getByIndex=function(e){let t=o;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==o?t:null},n}const E=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"]);function A(e,t=null){return new h(e,t)}const x=A,N=A;function k(e,t,n){e.classes.toggle(t,n)}function T(e,t,n){e.style[t]=n}function D(e,t,n){O.isBoolean(n)?e[t]=n:e[t]=n===e.value}function I(e,t,n,r){O.isBoolean(n)?r.set(e[t]):r.set(e.value)}function P(e,t,n){const r=O.isObservable(n)?n.val():n;O.isBoolean(r)?e[t]=r:e[t]=r===e.value,O.isObservable(n)&&(["checked"].includes(t)&&e.addEventListener("input",I.bind(null,e,t,r,n)),n.subscribe(D.bind(null,e,t)))}A.useValueProperty=function(e="value"){Object.defineProperty(h.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},A.getById=function(e){const t=o.getObservableById(parseInt(e));if(!t)throw new s("Observable.getById : No observable found with id "+e);return t},A.cleanup=function(e){e.cleanup()},A.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{o.cleanup()}),setInterval(()=>o.cleanObservables(r),n)},h.prototype.bindNdClass=function(e,t){e.classes.toggle(t,this.val()),this.subscribe(k.bind(null,e,t))},u.prototype.bindNdClass=function(e,t){e.classes.toggle(t,this.isMath()),this.subscribe(k.bind(null,e,t))},g.prototype.bindNdClass=function(e,t){this.$hydrate(e,t)};const F={class:(e,t)=>function(e,t){for(let n in t){const r=t[n];r?.bindNdClass?r.bindNdClass(e,n):e.classes.toggle(n,r)}t=null}(e,t),style:(e,t)=>function(e,t){for(let n in t){const r=t[n];O.isObservable(r)?(e.style[n]=r.val(),r.subscribe(T.bind(null,e,n))):e.style[n]=r}}(e,t)};String.prototype.toNdElement=function(){const e=this.resolveObservableTemplate?this.resolveObservableTemplate():this;return O.isString(e)?V.createStaticTextNode(null,e):V.getChild(null,e)},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},h.prototype.toNdElement=function(){return V.createObservableNode(null,this)},m.prototype.toNdElement=function(){return this.$element??this.$build?.()??this.build?.()??null},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=V.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return a.emit("BeforeProcessComponent",this),V.getChild(this())},g.prototype.toNdElement=function(){return V.createHydratableNode(null,this)},String.prototype.handleNdAttribute=function(e,t){e.setAttribute(t,this)},Number.prototype.handleNdAttribute=function(e,t){e.setAttribute(t,this)},Boolean.prototype.handleNdAttribute=function(e,t){P(e,t,this)},h.prototype.handleNdAttribute=function(e,t){E.has(t)?P(e,t,this):function(e,t,n){const r=n=>{"value"!==t?e.setAttribute(t,n):e.value=n};r(n.val()),n.subscribe(r),"value"===t&&e.addEventListener("input",()=>n.set(e.value))}(e,t,this)},g.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const M=new Map;let L=null;const V={createTextNode:()=>(L||(L=document.createTextNode("")),L.cloneNode()),createObservableNode(e,t){const n=V.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode(e,t){const n=V.createTextNode();return t.$hydrate(n),n},createStaticTextNode(e,t){let n=V.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement(e){if(e){if(M.has(e))return M.get(e).cloneNode();const t=document.createElement(e);return M.set(e,t),t.cloneNode()}return S("Fragment")},processChildren(e,t){if(null===e)return;a.emit("BeforeProcessChildren",t);let n=this.getChild(e);n&&t.appendChild(n),a.emit("AfterProcessChildren",t)},getChild(e){for(;e?.toNdElement;){if(e=e.toNdElement(),O.isElement(e))return e;if(!e)return null}return e?V.createStaticTextNode(null,e):null},processAttributes(e,t){O.isFragment(e)||t&&function(e,t){if(O.validateAttributes(t),!O.isObject(t))throw new s("Attributes must be an object");for(let 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){const t=F[r];if(t){t(e,o);continue}}E.has(r)?P(e,r,o):e.setAttribute(r,o)}}}(e,t)},setup:(e,t,n)=>(a.emit("Setup",e,t,n),e)},_={configurable:!0,get(){return new m(this)}};Object.defineProperty(HTMLElement.prototype,"nd",_),Object.defineProperty(DocumentFragment.prototype,"nd",_),Object.defineProperty(m.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();m.prototype["on"+e]=function(e=null){return this.$element.addEventListener(t,e),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();m.prototype["onStop"+e]=function(e=null){return q(this.$element,t,e),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();m.prototype["onPrevent"+e]=function(e=null){return j(this.$element,t,e),this}}),m.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,n),this};const j=function(e,t,n){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)}),this},q=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},B={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}};Object.defineProperty(HTMLElement.prototype,"classes",{configurable:!0,get(){return{$element:this,...B}}});let R=e=>e;t.ArgTypes={},t.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 W=function(e,t=null){if(!O.isJson(e)||e?.$hydrate){const n=t;t=e,e=n}return{props:e,children:t}},H=function(e){return O.isObservable(e)?V.createObservableNode(null,e):V.createStaticTextNode(null,e)};function z(e,t,n,r=null){let{props:o,children:s=null}=W(n,r),i=V.createElement(e),a=t&&"function"==typeof t?t(i):i;return o&&V.processAttributes(a,o),s&&V.processChildren(s,a),V.setup(a,o,t)}function U(e,t){return z.bind(null,e.toLowerCase(),t)}const K=new WeakMap,J=(e,t,n)=>{let r=null;if(t.attributes){r={};for(const e in t.attributes)r[e]=t.attributes[e].apply(null,n)}if(t.classes){r=r||{},r.class={};for(const e in t.classes)r.class[e]=t.classes[e].apply(null,n)}if(t.styles){r=r||{},r.style={};for(const e in t.styles)r.style[e]=t.styles[e].apply(null,n)}return r?(V.processAttributes(e,r),!0):null},G=(e,t)=>{let n=e;for(let e=0,r=t.length;e<r;e++)n=n.childNodes[t[e]];return n},Y=function(e,t,n){if(!t.attach)return null;for(const r in t.attach)e.nd[r](function(...e){t.attach[r].apply(this,[...e,...n])})};function Q(e){let t=null,n=!1;const r=[],o=(e,t,n)=>{const s=K.get(e);if(3===e.nodeType)return s&&s.value?(r.push({path:[...n],fn:(e,t,n)=>{const r=s.value(e);return t.replaceWith(r),t===n?r:null}}),s.value(t)):e.cloneNode(!0);const i=e.cloneNode(e.fullCloneNode);if(e.fullCloneNode)return i;s&&(J(i,s,t),Y(i,s,t),r.push({path:[...n],fn:(e,t)=>{J(t,s,e),Y(t,s,e)}}));const a=e.childNodes;for(let e=0,r=a.length;e<r;e++){const r=a[e];n.push(e);const s=o(r,t,n);n.pop(),i.appendChild(s)}return i},s=e=>{let n=t.cloneNode(!0);for(let t=0,o=r.length;t<o;t++){const o=r[t],s=G(n,o.path),i=o.fn(e,s,n);i&&(n=i)}return n};this.clone=r=>{if(t=e(this),!n)return this.clone=()=>t.cloneNode(!0),t.cloneNode(!0);const i=o(t,r,[]);return this.clone=s,i};const i=(e,t)=>new g((r,o)=>{n=!0,function(e,t,n,r){K.has(n)||K.set(n,{});const o=K.get(n);"value"!==t?(o[t]=o[t]||{},o[t][r]=e):o.value=e}(e,t,r,o)});this.style=e=>i(e,"styles"),this.class=e=>i(e,"classes"),this.property=e=>this.value(e),this.value=e=>i("function"!=typeof e?function(t){const n=t[0];return H(n[e])}:function(t){return H(e(...t))},"value"),this.attr=e=>i(e,"attributes"),this.attach=e=>i(e,"attach")}function Z(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=S("Component "+e);return n[e]=function(...e){r.removeChildren(),t?r.appendChild(t(...e)):r.append(e)},r}}w,Function.prototype.args=function(...e){return this},Function.prototype.cached=function(...e){let t,n=()=>t;return()=>(t||(t=this.apply(this,e),t.cloneNode?n=()=>t.cloneNode(!0):t.$element&&(n=()=>new m(t.$element.cloneNode(!0)))),n())},Function.prototype.errorBoundary=function(e){return(...t)=>{try{return this.apply(this,t)}catch(t){return e(t)}}},String.prototype.use=function(e){const t=this;return A.computed(()=>t.replace(/\$\{(.*?)}/g,(t,n)=>{const r=e[n];return O.isObservable(r)?r.val():r}),Object.values(e))},String.prototype.resolveObservableTemplate=function(){return O.containsObservableReference(this)?this.split(/(\{\{#ObItem::\([0-9]+\)\}\})/g).filter(Boolean).map(e=>{if(!O.containsObservableReference(e))return e;const[t,n]=e.match(/\{\{#ObItem::\(([0-9]+)\)\}\}/);return A.getById(n)}):this.valueOf()};const X=e=>{let t=null;return new Proxy({},{get:(n,r)=>(null===t&&(t=e()),t[r])})},ee=e=>{const t=new Map;return new Proxy({},{get:(n,r)=>{if(!t.has(r)){if(e.length>0)return(...n)=>{const o=e(...n);return t.set(r,o),o};t.set(r,e())}return t.get(r)}})};function te(e){return e instanceof Date?e:new Date(e)}function ne(e,t){const n=te(e),r=te(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function re(e){const t=te(e);return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}function oe(e,t){const n=O.isObservable(e);return{dependencies:n?e:null,callback:r=>t(r,n?e.val():e)}}function se(e,t){const n=e.filter(O.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>O.isObservable(e)?e.val():e))}}function ie(e){return oe(e,(e,t)=>e===t)}function ae(e){return oe(e,(e,t)=>e!==t)}function ue(e){return oe(e,(e,t)=>e>t)}function le(e){return oe(e,(e,t)=>e>=t)}function ce(e){return oe(e,(e,t)=>e<t)}function he(e){return oe(e,(e,t)=>e<=t)}function pe(e,t=!0,n=""){return se([e,t,n],(e,[t,n,r])=>{if(!t)return!0;if(n)try{return new RegExp(t,r).test(String(e))}catch(e){return console.warn("Invalid regex pattern:",t,e),!1}return r&&""!==r?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}function de(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(O.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.every(e=>e.callback(t))}}function fe(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(O.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.some(e=>e.callback(t))}}const be=ue,me=le,ge=ce,ye=he,ve=ie,we=ae,$e=de,Ce=fe;function Oe(e,t=!1){return oe(e,(e,n)=>!!e&&(!n||(t?String(e).includes(String(n)):String(e).toLowerCase().includes(String(n).toLowerCase()))))}const Se=Oe;var Ee=Object.freeze({__proto__:null,all:$e,and:de,any:Ce,between:function(e,t){return se([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:Se,createFilter:oe,createMultiSourceFilter:se,custom:function(e,...t){const n=t.filter(O.isObservable);return{dependencies:n.length>0?n:null,callback:n=>{const r=t.map(e=>O.isObservable(e)?e.val():e);return e(n,...r)}}},dateAfter:e=>oe(e,(e,t)=>!(!e||!t)&&te(e)>te(t)),dateBefore:e=>oe(e,(e,t)=>!(!e||!t)&&te(e)<te(t)),dateBetween:(e,t)=>se([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=te(e);return r>=te(t)&&r<=te(n)}),dateEquals:e=>oe(e,(e,t)=>!(!e||!t)&&ne(e,t)),dateTimeAfter:e=>oe(e,(e,t)=>!(!e||!t)&&te(e)>te(t)),dateTimeBefore:e=>oe(e,(e,t)=>!(!e||!t)&&te(e)<te(t)),dateTimeBetween:(e,t)=>se([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=te(e);return r>=te(t)&&r<=te(n)}),dateTimeEquals:e=>oe(e,(e,t)=>!(!e||!t)&&te(e).getTime()===te(t).getTime()),endsWith:function(e,t=!1){return oe(e,(e,n)=>!n||(t?String(e).endsWith(String(n)):String(e).toLowerCase().endsWith(String(n).toLowerCase())))},eq:ve,equals:ie,getSecondsOfDay:re,greaterThan:ue,greaterThanOrEqual:le,gt:be,gte:me,inArray:function(e){return oe(e,(e,t)=>t.includes(e))},includes:Oe,isEmpty:function(e=!0){return oe(e,(e,t)=>{const n=!e||""===e||Array.isArray(e)&&0===e.length;return t?n:!n})},isNotEmpty:function(e=!0){return oe(e,(e,t)=>{const n=!!e&&""!==e&&(!Array.isArray(e)||e.length>0);return t?n:!n})},isSameDay:ne,lessThan:ce,lessThanOrEqual:he,lt:ge,lte:ye,match:pe,neq:we,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:ae,notIn:function(e){return oe(e,(e,t)=>!t.includes(e))},or:fe,startsWith:function(e,t=!1){return oe(e,(e,n)=>!n||(t?String(e).startsWith(String(n)):String(e).toLowerCase().startsWith(String(n).toLowerCase())))},timeAfter:e=>oe(e,(e,t)=>!(!e||!t)&&re(e)>re(t)),timeBefore:e=>oe(e,(e,t)=>!(!e||!t)&&re(e)<re(t)),timeBetween:(e,t)=>se([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=re(e);return r>=re(t)&&r<=re(n)}),timeEquals:e=>oe(e,(e,t)=>{if(!e||!t)return!1;const n=te(e),r=te(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:te});const Ae=function(e,t=null){if(!Array.isArray(e))throw new s("Observable.array : target must be an array");h.call(this,e,t),a.emit("CreateObservableArray",this)};(Ae.prototype=Object.create(h.prototype)).constructor=Ae,Ae.prototype.__$isObservableArray=!0,Object.defineProperty(Ae.prototype,"length",{get(){return this.$currentValue.length}}),["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{Ae.prototype[e]=function(...t){const n=this.$currentValue[e](...t);return this.trigger({action:e,args:t,result:n}),n}}),["map","forEach","filter","reduce","some","every","find","findIndex","concat","includes","indexOf"].forEach(e=>{Ae.prototype[e]=function(...t){return this.$currentValue[e](...t)}}),Ae.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$currentValue.length=0,this.trigger({action:"clear"}),!0},Ae.prototype.at=function(e){return this.$currentValue[e]},Ae.prototype.merge=function(e){this.$currentValue.push(...e),this.trigger({action:"merge",args:e})},Ae.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},Ae.prototype.swap=function(e,t){const n=this.$currentValue,r=n.length;if(r<e||r<t)return!1;if(t<e){const n=e;e=t,t=n}const o=n[e],s=n[t];return n[e]=s,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,s]}),!0},Ae.prototype.remove=function(e){const t=this.$currentValue.splice(e,1);return 0===t.length?[]:(this.trigger({action:"remove",args:[e],result:t[0]}),t)},Ae.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return this.remove(t)},Ae.prototype.isEmpty=function(){return 0===this.$currentValue.length},Ae.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},Ae.prototype.where=function(e){const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=O.isObservable(o)?pe(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(...t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=A.array(),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},Ae.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},Ae.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},A.array=function(e=[],t=null){return new Ae(e,t)},A.batch=function(e){const t=A(0),n=function(){if(O.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n};A.init=function(e,t=null){const n={};for(const r in e){const o=e[r];if(Array.isArray(o)){if(!1!==t?.deep){const e=o.map(e=>O.isJson(e)?A.json(e,t):O.isArray(e)?A.array(e,t):A(e,t));n[r]=A.array(e,t);continue}n[r]=A.array(o,t)}else O.isObservable(o)||O.isProxy(o)?n[r]=o:n[r]=A(o,t)}const r=()=>{for(const e in n){n[e].reset()}},o=()=>function(e){const t={};for(const n in e){const r=e[n];if(O.isObservable(r)){let e=r.val();Array.isArray(e)&&(e=e.map(e=>O.isObservable(e)?e.val():O.isProxy(e)?e.$value:e)),t[n]=e}else O.isProxy(r)?t[n]=r.$value:t[n]=r}return t}(n),s=()=>A.init(o(),t),i=e=>{A.update(u,e)},a=e=>function(e,t){const n=e[t];return O.isObservable(n)?n.val():O.isProxy(n)?n.$value:n}(n,e),u=new Proxy(n,{get:(n,u)=>"__isProxy__"===u||("$value"===u?o():"get"===u||"$get"===u?a:"val"===u||"$val"===u?o:"set"===u||"$set"===u||"$updateWith"===u?i:"observables"===u||"$observables"===u?Object.values(n):"keys"===u||"$keys"===u?Object.keys(e):"clone"===u||"$clone"===u?s:"reset"===u?r:"configs"===u?t:n[u]),set:(e,t,n)=>void 0===e[t]||(O.isObservable(n)?e[t].set(n.val()):e[t].set(n),!0)});return u},A.arrayOfObject=function(e){return e.map(e=>A.object(e))},A.value=function(e){if(O.isObservable(e))return e.val();if(O.isProxy(e))return e.$value;if(O.isArray(e)){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(A.value(r))}return t}return e},A.update=function(e,t){const n=O.isProxy(t)?t.$value:t,r=e.configs;for(const o in n){const s=e[o],i=t[o],a=n[o];if(O.isObservable(s)){if(O.isArray(a)){const e=i.at(0);if(O.isObservable(e)||O.isProxy(e)){const t=a.map(t=>O.isProxy(e)?A.init(t,r):A(t,r));s.set(t);continue}s.set([...a]);continue}s.set(a)}else O.isProxy(s)?A.update(s,a):e[o]=a}},A.object=A.init,A.json=A.init,A.computed=function(e,t=[]){const n=new h(e()),r=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}}(()=>n.set(e()));if(a.emit("CreateObservableComputed",n,t),O.isFunction(t)){if(!O.isObservable(t.$observer))throw new s("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(r),n}return t.forEach(e=>{O.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(r)}):e.subscribe(r)}),n};const xe=function(){const e=new Map;return{use(t){const{observer:n,subscribers:r}=e.get(t),o=A(n.val()),s=n.subscribe(e=>o.set(e)),i=o.subscribe(e=>n.set(e));return o.destroy=()=>{s(),i(),o.cleanup()},r.add(o),o},follow(e){return this.use(e)},create(t,n){const r=A(n);return e.set(t,{observer:r,subscribers:new Set}),r},get(t){const n=e.get(t);return n?n.observer:null},getWithSubscribers:t=>e.get(t),delete(t){const n=e.get(t);n&&(n.observer.cleanup(),n.subscribers.forEach(e=>e.destroy()),n.observer.clear())}}}();const Ne=function(e,t,{comment:n=null,shouldKeepInCache:o=!0}={}){if(!O.isObservable(e)&&!O.isObservableWhenResult(e))return r.warn("ShowIf","ShowIf : condition must be an Observable / "+n,e);const s=S("Show if : "+(n||""));let i=null;const a=()=>(i&&o||(i=V.getChild(t),O.isFragment(i)&&(i=Array.from(i.childNodes))),i);return e.val()&&s.appendChild(a()),e.subscribe(e=>{e?s.appendChild(a()):s.remove()}),s},ke=function(e,t,n=!0){if(!O.isObservable(e))throw new s("Toggle : condition must be an Observable");const r=S("Match"),o=new Map,i=function(e){if(n&&o.has(e))return o.get(e);let r=t[e];return r?(r=V.getChild(r),O.isFragment(r)&&(r=Array.from(r.children)),n&&o.set(e,r),r):null},a=e.val(),u=i(a);return u&&r.appendChild(u),e.subscribe(e=>{const t=i(e);r.remove(),t&&r.appendChild(t)}),r.nd.with({add(n,r,o=!1){t[n]=r,o&&e.set(n)},remove(e){n&&o.delete(e),delete t[e]}})},Te=function(e,t,n){if(!O.isObservable(e))throw new s("Toggle : condition must be an Observable");return ke(e,{true:t,false:n})},De=U("div"),Ie=U("span"),Pe=U("label"),Fe=U("p"),Me=Fe,Le=U("strong"),Ve=U("h1"),_e=U("h2"),je=U("h3"),qe=U("h4"),Be=U("h5"),Re=U("h6"),We=U("br"),He=U("a"),ze=U("pre"),Ue=U("code"),Ke=U("blockquote"),Je=U("hr"),Ge=U("em"),Ye=U("small"),Qe=U("mark"),Ze=U("del"),Xe=U("ins"),et=U("sub"),tt=U("sup"),nt=U("abbr"),rt=U("cite"),ot=U("q"),st=U("dl"),it=U("dt"),at=U("dd"),ut=U("form",function(e){return 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}),lt=U("input"),ct=U("textarea"),ht=ct,pt=U("select"),dt=U("fieldset"),ft=U("option"),bt=U("legend"),mt=U("datalist"),gt=U("output"),yt=U("progress"),vt=U("meter"),wt=U("button"),$t=U("main"),Ct=U("section"),Ot=U("article"),St=U("aside"),Et=U("nav"),At=U("figure"),xt=U("figcaption"),Nt=U("header"),kt=U("footer"),Tt=U("img"),Dt=function(e,t){return Tt({src:e,...t})},It=U("details"),Pt=U("summary"),Ft=U("dialog"),Mt=U("menu"),Lt=U("ol"),Vt=U("ul"),_t=U("li"),jt=_t,qt=Lt,Bt=Vt,Rt=U("audio"),Wt=U("video"),Ht=U("source"),zt=U("track"),Ut=U("canvas"),Kt=U("svg"),Jt=U("time"),Gt=U("data"),Yt=U("address"),Qt=U("kbd"),Zt=U("samp"),Xt=U("var"),en=U("wbr"),tn=U("caption"),nn=U("table"),rn=U("thead"),on=U("tfoot"),sn=U("tbody"),an=U("tr"),un=an,ln=U("th"),cn=ln,hn=ln,pn=U("td"),dn=pn,fn=U("");var bn=Object.freeze({__proto__:null,Abbr:nt,Address:Yt,Anchor:S,Article:Ot,Aside:St,AsyncImg:function(e,t,n,r){const o=O.isObservable(e)?e.val():e,i=Dt(t||o,n),a=new Image;return a.onload=()=>{O.isFunction(r)&&r(null,i),i.src=O.isObservable(e)?e.val():e},a.onerror=()=>{O.isFunction(r)&&r(new s("Image not found"))},O.isObservable(e)&&e.subscribe(e=>{a.src=e}),a.src=o,i},Audio:Rt,BaseImage:Tt,Blockquote:Ke,Br:We,Button:wt,Canvas:Ut,Caption:tn,Checkbox:e=>lt({type:"checkbox",...e}),Cite:rt,Code:Ue,ColorInput:e=>lt({type:"color",...e}),Data:Gt,Datalist:mt,DateInput:e=>lt({type:"date",...e}),DateTimeInput:e=>lt({type:"datetime-local",...e}),Dd:at,Del:Ze,Details:It,Dialog:Ft,Div:De,Dl:st,Dt:it,Em:Ge,EmailInput:e=>lt({type:"email",...e}),FieldSet:dt,FigCaption:xt,Figure:At,FileInput:e=>lt({type:"file",...e}),Footer:kt,ForEach:function(e,t,n,{shouldKeepItemsInCache:o=!1}={}){const i=S("ForEach"),a=i.endElement();i.startElement();let u=new Map,l=null;const c=new Set,h=e=>{if(!o)for(const[t,n]of u.entries()){if(c.has(t))continue;const r=n.child?.deref();e&&r&&e.removeChild(r),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,u.delete(n.keyId),l&&l.delete(n.keyId)}},p=(e,o)=>{const i=((e,t,n)=>{if(O.isString(n)){const r=O.isObservable(e)?e.val():e,o=r?.[n];return O.isObservable(o)?o.val():o??t}return O.isFunction(n)?n(e,t):(O.isObservable(e)?e.val():e)??t})(e,o,n);if(u.has(i)){const e=u.get(i);if(e.indexObserver?.set(o),e.isNew=!1,e.child?.deref())return i;u.delete(i)}try{const n=t.length>=2?A(o):null;let r=V.getChild(t(e,n));if(!r)throw new s("ForEach child can't be null or undefined!");u.set(i,{keyId:i,isNew:!0,child:new WeakRef(r),indexObserver:n})}catch(e){throw r.error("ForEach",`Error creating element for key ${i}`,e),e}return i},d=()=>{const t=a.parentNode;if(!t)return;const n=O.isObservable(e)?e.val():e;if(c.clear(),Array.isArray(n))for(let e=0,t=n.length;e<t;e++){const t=p(n[e],e);c.add(t)}else for(const e in n){const t=p(n[e],e);c.add(t)}if(0===c.size)return i.removeChildren(),h(),void l?.clear();h(t),l&&0!==l.size?(()=>{let e=document.createDocumentFragment();const t=Array.from(c);Array.from(l);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 c){const n=u.get(e);if(!n)continue;const r=n.child?.deref();r&&t.appendChild(r)}e.insertBefore(t,a)})(t),l?.clear(),l=new Set([...c])};return d(),O.isObservable(e)&&e.subscribe(d),i},ForEachArray:function(e,t,n={}){const r=S("ForEach Array"),o=r.endElement(),i=r.startElement();let a=new Map,u=0;const l=t.length>=2,c=e=>{r.removeChildren(),d(e),u=0},h=e=>a.get(e)?.child,p=(e,t=!0)=>{const n=a.get(e);if(n){if(t){const e=n.child;e?.remove(),a.delete(n.keyId)}n.indexObserver?.cleanup()}},d=e=>{if(!n.shouldKeepItemsInCache)if(l){for(const[t,n]of a.entries())e&&e.contains(t)||p(t,!1);a.clear()}else a.clear()},f=(e,n)=>{const r=a.get(e);if(r){r.indexObserver?.set(n);const t=r.child;if(t)return t;a.delete(e)}const o=l?A(n):null;let i=V.getChild(t(e,o));if(i)return a.set(e,{child:i,indexObserver:o?new WeakRef(o):null}),i;throw new s("ForEachArray child can't be null or undefined!")},b={toFragment(e,t=0){const n=document.createDocumentFragment();for(let t=0,r=e.length;t<r;t++)n.appendChild(f(e[t],u)),u++;return n},add(e,t=2){r.appendElement(b.toFragment(e))},replace(e){c(e),b.add(e)},reOrder(e){let t=null;const n=document.createDocumentFragment();for(const r of e)t=h(r),t&&n.appendChild(t);t=null,r.appendElement(n,o)},removeOne(e,t){p(e,!0)},clear:c,merge(e){b.add(e)},push(e){let t=0;n.pushDelay&&(t=n.pushDelay(e)??0),b.add(e,t)},populate([e,t,n]){const o=document.createDocumentFragment();for(let r=0;r<t;r++){const t=n(r);e.push(t),o.append(f(t,r)),u++}r.appendChild(o),o.replaceChildren()},unshift(e){r.insertBefore(b.toFragment(e),i.nextSibling)},splice(e,t){const[n,s,...i]=e;let u=null;const l=document.createDocumentFragment();if(t.length>0){let e=t[0];if(1===t.length)!function(e,t){const n=a.get(e);if(!n)return null;const r=n.child;if(!r)return null;t?t.appendChild(r):r.remove()}(e,l);else if(t.length>1){const n=h(t[0]);u=n?.previousSibling;for(let n=0;n<t.length;n++)e(t[n],l)}}else u=o;l.replaceChildren(),i&&i.length&&u&&r.insertBefore(b.toFragment(i),u.nextSibling)},reverse(e,t){b.reOrder(t)},sort(e,t){b.reOrder(t)},remove(e,t){b.removeOne(t)},pop(e,t){b.removeOne(t)},shift(e,t){b.removeOne(t)},swap(e,t){const n=o.parentNode;let r=h(t[0]),s=h(t[1]);if(!r||!s)return;const i=s.nextSibling;n.insertBefore(s,r),n.insertBefore(r,i),r=null,s=null}},m=(e,t,n)=>{if("clear"!==n.action&&e.length){if(n?.action)b[n.action]&&b[n.action](n.args,n.result);else{if(0===u)return void b.add(e);b.replace(e)}((e,t=0)=>{if(!l)return;let n=t;for(let r=t,o=e?.length;r<o;r++){const t=a.get(e[r]);t&&(t.indexObserver?.set(n),n++)}})(e,0)}else{if(0===u)return;c()}};return e.val().length&&m(e.val(),0,{action:null}),O.isObservable(e)&&e.subscribe(m),r},Form:ut,Fragment:fn,H1:Ve,H2:_e,H3:je,H4:qe,H5:Be,H6:Re,Header:Nt,HiddenInput:e=>lt({type:"hidden",...e}),HideIf:function(e,t,n){const r=A(!e.val());return e.subscribe(e=>r.set(!e)),Ne(r,t,n)},HideIfNot:function(e,t,n){return Ne(e,t,n)},Hr:Je,Img:Dt,Input:lt,Ins:Xe,Kbd:Qt,Label:Pe,LazyImg:function(e,t){return Dt(e,{...t,loading:"lazy"})},Legend:bt,Li:jt,Link:He,ListItem:_t,Main:$t,Mark:Qe,Match:ke,Menu:Mt,Meter:vt,MonthInput:e=>lt({type:"month",...e}),NativeDocumentFragment:S,Nav:Et,NumberInput:e=>lt({type:"number",...e}),Ol:qt,Option:ft,OrderedList:Lt,Output:gt,P:Fe,Paragraph:Me,PasswordInput:e=>lt({type:"password",...e}),Pre:ze,Progress:yt,Quote:ot,Radio:e=>lt({type:"radio",...e}),RangeInput:e=>lt({type:"range",...e}),ReadonlyInput:e=>lt({readonly:!0,...e}),Samp:Zt,SearchInput:e=>lt({type:"search",...e}),Section:Ct,Select:pt,ShowIf:Ne,ShowWhen:function(){if(2===arguments.length){const[e,t]=arguments;if(!O.isObservableWhenResult(e))throw new s("showWhen observer must be an ObservableWhenResult",{data:e,help:"Use observer.when(target) to create an ObservableWhenResult"});return Ne(e,t)}if(3===arguments.length){const[e,t,n]=arguments;if(!O.isObservable(e))throw new s("showWhen observer must be an Observable",{data:e});return Ne(e.when(t),n)}throw new s("showWhen must have 2 or 3 arguments",{data:["showWhen(observer, target, view)","showWhen(observerWhenResult, view)"]})},SimpleButton:(e,t)=>wt(e,{type:"button",...t}),Small:Ye,Source:Ht,Span:Ie,Strong:Le,Sub:et,SubmitButton:(e,t)=>wt(e,{type:"submit",...t}),Summary:Pt,Sup:tt,Svg:Kt,Switch:Te,TBody:sn,TBodyCell:dn,TFoot:on,TFootCell:hn,THead:rn,THeadCell:cn,TRow:un,Table:nn,Td:pn,TelInput:e=>lt({type:"tel",...e}),TextArea:ct,TextInput:ht,Th:ln,Time:Jt,TimeInput:e=>lt({type:"time",...e}),Tr:an,Track:zt,Ul:Bt,UnorderedList:Vt,UrlInput:e=>lt({type:"url",...e}),Var:Xt,Video:Wt,Wbr:en,WeekInput:e=>lt({type:"week",...e}),When:function(e){if(!O.isObservable(e))throw new s("When : condition must be an Observable");let t=null,n=null;return{show(e){return t=e,this},otherwise:r=>(n=r,Te(e,t,n))}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=S("Portal "+n);return r.appendChild(V.getChild(e)),(t||document.body).appendChild(r),r}});const mn={};function gn(e,t,n={}){e="/"+l(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,a=n.with||{},u=n.layout||null,c={},h=[],p=e=>{if(!e)return null;const[t,n]=e.split(":");let r=a[t];return!r&&n&&(r=mn[n]),r||(r="[^/]+"),r=r.replace("(","(?:"),{name:t,pattern:`(${r})`}},d=()=>{if(r)return r;const t=e.replace(/\{(.*?)}/gi,(e,t)=>{const n=p(t);return n&&n.pattern?(c[n.name]=n.pattern,h.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=()=>u,this.match=function(e){e="/"+l(e,"/");if(!d().exec(e))return!1;const t={};return d().exec(e).forEach((e,n)=>{if(n<1)return;const r=h[n-1];t[r]=e}),t},this.url=function(t){const n=e.replace(/\{(.*?)}/gi,(e,n)=>{const r=p(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 yn extends Error{constructor(e,t){super(e),this.context=t}}const vn=(e,t)=>{const n=[];return e.forEach(e=>{n.push(l(e.suffix,"/"))}),n.push(l(t,"/")),n.join("/")},wn=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},$n=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},Cn=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function On(){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:u}=e[o];r(u)},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:u}=this.resolve(n);u!==o()&&(e.splice(t+1),e.push({route:s,params:i,query:a,path:u}),t++,r(u))},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 Sn(){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){r.error("HistoryRouter","Error in pushState",e)}},this.replace=function(e){const{route:t,path:n,params:o}=this.resolve(e);try{window.history.replaceState({name:t.name(),params:o,path:n},t.name()||n,n),this.handleRouteChange(t,o,{},n)}catch(e){r.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){r.error("HistoryRouter","Error in popstate event",e)}});const{route:t,params:n,query:o,path:s}=this.resolve(e||window.location.pathname+window.location.search);this.handleRouteChange(t,n,o,s)}}function En(){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)}}const An="default";function xn(e={}){const t=[],n={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)On.apply(this,[]);else if("history"===e.mode)Sn.apply(this,[]);else{if("memory"!==e.mode)throw new yn("Invalid router mode "+e.mode);En.apply(this,[])}const a=function(e,t){for(const n of s)try{n(e),t&&t(e)}catch(e){r.warn("Route Listener","Error in listener:",e)}};this.routes=()=>[...t],this.currentState=()=>({...i}),this.add=function(e,r,s){const i=new gn(vn(o,e),r,{...s,middlewares:wn(o,s?.middlewares||[]),name:s?.name?$n(o,s.name):null,layout:s?.layout||Cn(o)});return t.push(i),i.name()&&(n[i.name()]=i),this},this.group=function(e,t,n){if(!O.isFunction(n))throw new yn("Callback must be a function");return o.push({suffix:e,options:t}),n(),o.pop(),this},this.generateUrl=function(e,t={},r={}){const o=n[e];if(!o)throw new yn(`Route not found for name: ${e}`);return o.url({params:t,query:r})},this.resolve=function(e){if(O.isJson(e)){const t=n[e.name];if(!t)throw new yn(`Route not found for name: ${e.name}`);return{route:t,params:e.params,query:e.query,path:t.url({...e})}}const[r,o]=e.split("?"),s="/"+l(r,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new yn(`Route not found for url: ${r}`);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(!O.isFunction(e))throw new yn("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 u={...i},l=e=>{if(s++,!(s>=o.length))return o[s](e||u,l)};return o[s](u,l)}}function Nn(e,t){const{to:n,href:r,...o}=e,s=n||r;if(O.isString(s)){const e=xn.get();return He({...o,href:s},t).nd.onPreventClick(()=>{e.push(s)})}const i=s.router||An,a=xn.get(i);if(!a)throw new yn('Router not found "'+i+'" for link "'+s.name+'"');const u=a.generateUrl(s.name,s.params,s.query);return He({...o,href:u},t).nd.onPreventClick(()=>{a.push(u)})}xn.routers={},xn.create=function(t,n){if(!O.isFunction(n))throw r.error("Router","Callback must be a function",e),new yn("Callback must be a function");const o=new xn(t);return xn.routers[t.name||An]=o,n(o),o.init(t.entry),o.mount=function(e){if(O.isString(e)){const t=document.querySelector(e);if(!t)throw new yn(`Container not found for selector: ${e}`);e=t}else if(!O.isElement(e))throw new yn("Container must be a string or an Element");return function(e,t){const n=new Map;let r=null;const o=function(e,n){t.innerHTML="";let o=e;const s=n.layout();O.isNDElement(e)&&(o=e.node()),s?t.appendChild(s(o)):(O.isAnchor(r)&&r.remove(),t.appendChild(o),r=e)},s=function(e){if(!e.route)return;const{route:t,params:r,query:s,path:i}=e;if(n.has(i)){const e=n.get(i);return void o(e,t)}const a=t.component()({params:r,query:s});n.set(i,a),o(a,t)};return e.subscribe(s),s(e.currentState()),t}(o,e)},o},xn.get=function(e){const t=xn.routers[e||An];if(!t)throw new yn(`Router not found for name: ${e}`);return t},xn.push=function(e,t=null){return xn.get(t).push(e)},xn.replace=function(e,t=null){return xn.get(t).replace(e)},xn.forward=function(e=null){return xn.get(e).forward()},xn.back=function(e=null){return xn.get(e).back()},Nn.blank=function(e,t){return He({...e,target:"_blank"},t)};var kn=Object.freeze({__proto__:null,Link:Nn,RouteParamPatterns:mn,Router:xn});const Tn={once:e=>X(e),memoize:e=>ee(e)};var Dn=Object.freeze({__proto__:null,Filters:Ee,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||{}}};o&&(o instanceof FormData?i.body=o:(i.headers["Content-Type"]="application/json","GET"!==n?i.body=JSON.stringify(o):i.params=o));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 u=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok){const e=new Error(u?.message||a.statusText);throw e.status=a.status,e.data=u,e}return u},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)}},Service:Tn});return t.$=x,t.ElementCreator=V,t.HtmlElementWrapper=U,t.NDElement=m,t.Observable=A,t.PluginsManager=a,t.SingletonView=Z,t.Store=xe,t.TemplateCloner=Q,t.Validator=O,t.autoMemoize=ee,t.autoOnce=X,t.classPropertyAccumulator=function(e=[]){let t=O.isString(e)?e.split(" ").filter(Boolean):e;const n=O.isArray(t);return{add(e,r=!0){n?t.push(e):t[e]=r},value:()=>n?t.join(" "):{...t}}},t.createTextNode=H,t.cssPropertyAccumulator=function(e={}){let t=O.isString(e)?e.split(";").filter(Boolean):e;const n=O.isArray(t);return{add(e,r){n?t.push(e+" : "+r):t[e]=r},value:()=>n?t.join(";").concat(";"):{...t}}},t.elements=bn,t.memoize=e=>{const t=new Map;return(...n)=>{const[r,...o]=n;return t.has(r)||t.set(r,e(...o)),t.get(r)}},t.normalizeComponentArgs=W,t.obs=N,t.once=e=>{let t=null;return(...n)=>(null===t&&(t=e(...n)),t)},t.router=kn,t.useCache=function(e){let t=null;const n=function(n){return t||(t=new Q(e)),t.clone(n)};return e.length<2?function(...e){return n(e)}:function(e,t,...r){return n([e,t,...r])}},t.useSingleton=function(e){let t=null;return function(...n){return t||(t=new Z(e)),t.render(n)}},t.utils=Dn,t.withValidation=R,t}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
package/rollup.config.js CHANGED
@@ -3,18 +3,6 @@ import replace from '@rollup/plugin-replace';
3
3
  import alias from '@rollup/plugin-alias';
4
4
  import { fileURLToPath } from 'node:url'
5
5
 
6
- const AliasPlugin = alias({
7
- entries: [
8
- { find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
9
- { find: '@src', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
10
- { find: '@root', replacement: fileURLToPath(new URL('./', import.meta.url)) },
11
- { find: '@components', replacement: fileURLToPath(new URL('./src/components', import.meta.url)) },
12
- { find: '@devtools', replacement: fileURLToPath(new URL('./src/devtools', import.meta.url)) },
13
- { find: '@core', replacement: fileURLToPath(new URL('./index', import.meta.url)) },
14
- { find: '@elements', replacement: fileURLToPath(new URL('./elements', import.meta.url)) },
15
- ]
16
- });
17
-
18
6
  const PreventProd = replace({
19
7
  'process.env.NODE_ENV': JSON.stringify('production'),
20
8
  preventAssignment: true,
@@ -33,7 +21,6 @@ export default [
33
21
  sourcemap: true
34
22
  },
35
23
  plugins: [
36
- AliasPlugin,
37
24
  replace({
38
25
  'process.env.NODE_ENV': JSON.stringify('development'),
39
26
  preventAssignment: true,
@@ -51,7 +38,6 @@ export default [
51
38
  name: 'NativeDocument'
52
39
  },
53
40
  plugins: [
54
- AliasPlugin,
55
41
  PreventProd,
56
42
  terser()
57
43
  ]
@@ -67,7 +53,6 @@ export default [
67
53
  name: 'NativeDocumentDevTools',
68
54
  },
69
55
  plugins: [
70
- AliasPlugin,
71
56
  terser()
72
57
  ]
73
58
  },
@@ -83,7 +68,6 @@ export default [
83
68
  name: 'NativeComponents',
84
69
  },
85
70
  plugins: [
86
- AliasPlugin,
87
71
  PreventProd,
88
72
  // terser()
89
73
  ]
@@ -1,4 +1,4 @@
1
- import {$} from "@core";
1
+ import {$} from "../../../index";
2
2
 
3
3
  export default function HasItems() {}
4
4
 
@@ -1,5 +1,5 @@
1
- import BaseComponent from "@components/BaseComponent";
2
- import EventEmitter from "@src/core/utils/EventEmitter";
1
+ import BaseComponent from "../BaseComponent";
2
+ import EventEmitter from "../../../src/core/utils/EventEmitter";
3
3
 
4
4
  export default function Accordion(config = {}) {
5
5
  if (!(this instanceof Accordion)) {
@@ -1,5 +1,5 @@
1
- import { $ } from '@core';
2
- import BaseComponent from "@components/BaseComponent";
1
+ import { $ } from '../../../index';
2
+ import BaseComponent from "../BaseComponent";
3
3
 
4
4
  export default function AccordionItem(config = {}) {
5
5
  if(!(this instanceof AccordionItem)){
@@ -1,5 +1,5 @@
1
- import BaseComponent from "@components/BaseComponent";
2
- import EventEmitter from "@src/core/utils/EventEmitter";
1
+ import BaseComponent from "../BaseComponent";
2
+ import EventEmitter from "../../../src/core/utils/EventEmitter";
3
3
 
4
4
  export default function Alert(message, config = {}) {
5
5
  if(!(this instanceof Alert)) {
@@ -1,5 +1,5 @@
1
- import {Validator} from "@core";
2
- import BaseComponent from "@components/BaseComponent";
1
+ import {Validator} from "../../../index";
2
+ import BaseComponent from "../BaseComponent";
3
3
 
4
4
  export default function Avatar(source, config = {}) {
5
5
  if (!(this instanceof Avatar)) {
@@ -1,5 +1,5 @@
1
- import BaseComponent from "@components/BaseComponent";
2
- import EventEmitter from "@src/core/utils/EventEmitter";
1
+ import BaseComponent from "../BaseComponent";
2
+ import EventEmitter from "../../../src/core/utils/EventEmitter";
3
3
 
4
4
 
5
5
  export default function Badge(config = {}) {
@@ -1,5 +1,5 @@
1
- import BaseComponent from "@components/BaseComponent";
2
- import EventEmitter from "@src/core/utils/EventEmitter";
1
+ import BaseComponent from "../BaseComponent";
2
+ import EventEmitter from "../../../src/core/utils/EventEmitter";
3
3
 
4
4
  export default function Breadcrumb(config = {}) {
5
5
  if (!(this instanceof Breadcrumb)) {