@aventusjs/cli 0.0.30 → 0.0.31

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.
@@ -1020,6 +1020,7 @@ class Watcher {
1020
1020
  */
1021
1021
  static get(obj: object, onDataChanged?: Aventus.WatcherFunction): any;
1022
1022
  static is(obj: any): boolean;
1023
+ private static clearReservedNames;
1023
1024
  static extract<T>(obj: T, clearPath?: boolean): T;
1024
1025
  static trigger<T>(type: 'CREATED' | 'UPDATED' | 'DELETED', target: T): void;
1025
1026
  /**
@@ -2752,7 +2753,7 @@ type Actions = {
2752
2753
  };
2753
2754
  }//#endregion js def //
2754
2755
  //#region js src //
2755
- {"namespace":"Aventus","available":[{"code":"if(!Object.hasOwn(window, \"AvInstance\")) {\r\n\tObject.defineProperty(window, \"AvInstance\", {\r\n\t\tget() {return Aventus?.Instance;}\r\n\t});\r\n\r\n\t(() => {\r\n\t\tMap.prototype._defaultHas = Map.prototype.has;\r\n\t\tMap.prototype._defaultSet = Map.prototype.set;\r\n\t\tMap.prototype._defaultGet = Map.prototype.get;\r\n\t\tMap.prototype.has = function(key) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultHas.call(this,key.getTarget())\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultHas.call(this,key);\r\n\t\t}\r\n\r\n\t\tMap.prototype.set = function(key, value) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultSet.call(this, key.getTarget(), value)\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultSet.call(this, key, value);\r\n\t\t}\r\n\t\tMap.prototype.get = function(key) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultGet.call(this, key.getTarget())\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultGet.call(this, key);\r\n\t\t}\r\n\t})();\r\n}","dependencies":[],"fullName":"!staticClass_d7c80a432731707ddadd54ea59a56049","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":" ","dependencies":[],"fullName":"!staticClass_b8b6866d7faef0c1b536e38915cc5583","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":"let Style=class Style {\n static instance;\n static noAnimation;\n static defaultStyleSheets = {\n \"@default\": `:host{display:inline-block;box-sizing:border-box}:host *{box-sizing:border-box}`,\n };\n static store(name, content) {\n this.getInstance().store(name, content);\n }\n static get(name) {\n return this.getInstance().get(name);\n }\n static getAsString(name) {\n return this.getInstance().getAsString(name);\n }\n static sheetToString(stylesheet) {\n return this.getInstance().sheetToString(stylesheet);\n }\n static load(name, url) {\n return this.getInstance().load(name, url);\n }\n static appendToHead(name) {\n if (!document.head.querySelector(`style[data-name=\"${name}\"]`)) {\n const styleNode = document.createElement('style');\n styleNode.setAttribute(`data-name`, name);\n styleNode.innerHTML = Style.getAsString(name);\n document.getElementsByTagName('head')[0].appendChild(styleNode);\n }\n }\n static refreshHead(name) {\n const styleNode = document.head.querySelector(`style[data-name=\"${name}\"]`);\n if (styleNode) {\n styleNode.innerHTML = Style.getAsString(name);\n }\n }\n static getInstance() {\n if (!this.instance) {\n this.instance = new Style();\n }\n return this.instance;\n }\n constructor() {\n for (let name in Style.defaultStyleSheets) {\n this.store(name, Style.defaultStyleSheets[name]);\n }\n Style.noAnimation = new CSSStyleSheet();\n Style.noAnimation.replaceSync(`:host{-webkit-transition: none !important;-moz-transition: none !important;-ms-transition: none !important;-o-transition: none !important;transition: none !important;}:host *{-webkit-transition: none !important;-moz-transition: none !important;-ms-transition: none !important;-o-transition: none !important;transition: none !important;}`);\n }\n stylesheets = new Map();\n async load(name, url) {\n try {\n let style = this.stylesheets.get(name);\n if (!style || style.cssRules.length == 0) {\n let txt = await (await fetch(url)).text();\n this.store(name, txt);\n }\n }\n catch (e) {\n }\n }\n store(name, content) {\n let style = this.stylesheets.get(name);\n if (!style) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(content);\n this.stylesheets.set(name, sheet);\n return sheet;\n }\n else {\n style.replaceSync(content);\n Style.refreshHead(name);\n return style;\n }\n }\n get(name) {\n let style = this.stylesheets.get(name);\n if (!style) {\n style = this.store(name, \"\");\n }\n return style;\n }\n getAsString(name) {\n return this.sheetToString(this.get(name));\n }\n sheetToString(stylesheet) {\n return stylesheet.cssRules\n ? Array.from(stylesheet.cssRules)\n .map(rule => rule.cssText || '')\n .join('\\n')\n : '';\n }\n}\nStyle.Namespace=`Aventus`;\n__as1(_, 'Style', Style);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.Style","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let uuidv4=function uuidv4() {\n let uid = '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, c => (Number(c) ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> Number(c) / 4).toString(16));\n return uid;\n}\n__as1(_, 'uuidv4', uuidv4);\n","dependencies":[],"fullName":"Aventus.uuidv4","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let sleep=function sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n__as1(_, 'sleep', sleep);\n","dependencies":[],"fullName":"Aventus.sleep","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let isSubclassOf=function isSubclassOf(subClass, superClass) {\n if (typeof subClass !== 'function' || typeof superClass !== 'function')\n return false;\n let proto = subClass.prototype;\n while (proto) {\n if (proto === superClass.prototype)\n return true;\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n__as1(_, 'isSubclassOf', isSubclassOf);\n","dependencies":[],"fullName":"Aventus.isSubclassOf","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let isClass=function isClass(v) {\n return typeof v === 'function' && /^\\s*class\\s+/.test(v.toString());\n}\n__as1(_, 'isClass', isClass);\n","dependencies":[],"fullName":"Aventus.isClass","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let setValueToObject=function setValueToObject(path, obj, value) {\n path = path.replace(/\\[(.*?)\\]/g, '.$1');\n const val = (key) => {\n if (obj instanceof Map) {\n return obj.get(key);\n }\n return obj[key];\n };\n let splitted = path.split(\".\");\n for (let i = 0; i < splitted.length - 1; i++) {\n let split = splitted[i];\n let value = val(split);\n if (!value) {\n obj[split] = {};\n value = obj[split];\n }\n obj = value;\n }\n if (obj instanceof Map) {\n obj.set(splitted[splitted.length - 1], value);\n }\n else {\n obj[splitted[splitted.length - 1]] = value;\n }\n}\n__as1(_, 'setValueToObject', setValueToObject);\n","dependencies":[],"fullName":"Aventus.setValueToObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let Mutex=class Mutex {\n /**\n * Array to store functions waiting for the mutex to become available.\n * @type {((run: boolean) => void)[]}\n */\n waitingList = [];\n /**\n * Indicates whether the mutex is currently locked or not.\n * @type {boolean}\n */\n isLocked = false;\n /**\n * Waits for the mutex to become available and then acquires it.\n * @returns {Promise<boolean>} A Promise that resolves to true if the mutex was acquired successfully.\n */\n waitOne() {\n return new Promise((resolve) => {\n if (this.isLocked) {\n this.waitingList.push((run) => {\n resolve(run);\n });\n }\n else {\n this.isLocked = true;\n resolve(true);\n }\n });\n }\n /**\n * Release the mutex\n */\n release() {\n let nextFct = this.waitingList.shift();\n if (nextFct) {\n nextFct(true);\n }\n else {\n this.isLocked = false;\n }\n }\n /**\n * Releases the mutex, allowing only the last function in the waiting list to acquire it.\n */\n releaseOnlyLast() {\n if (this.waitingList.length > 0) {\n let lastFct = this.waitingList.pop();\n for (let fct of this.waitingList) {\n fct(false);\n }\n this.waitingList = [];\n if (lastFct) {\n lastFct(true);\n }\n }\n else {\n this.isLocked = false;\n }\n }\n /**\n * Clears the mutex, removing all waiting functions and releasing the lock.\n */\n dispose() {\n this.waitingList = [];\n this.isLocked = false;\n }\n /**\n * Executes a callback function safely within the mutex lock and releases the lock afterward.\n * @template T - The type of the return value of the callback function.\n * @param {() => T} cb - The callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the callback function or null if an error occurs.\n */\n async safeRun(cb) {\n let result = null;\n await this.waitOne();\n try {\n result = cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.release();\n return result;\n }\n /**\n * Executes an asynchronous callback function safely within the mutex lock and releases the lock afterward.\n * @template T - The type of the return value of the asynchronous callback function.\n * @param {() => Promise<T>} cb - The asynchronous callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the asynchronous callback function or null if an error occurs.\n */\n async safeRunAsync(cb) {\n let result = null;\n await this.waitOne();\n try {\n result = await cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.release();\n return result;\n }\n /**\n * Executes a callback function safely within the mutex lock, allowing only the last function in the waiting list to acquire the lock, and releases the lock afterward.\n * @template T - The type of the return value of the callback function.\n * @param {() => T} cb - The callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the callback function or null if an error occurs.\n */\n async safeRunLast(cb) {\n let result = null;\n if (await this.waitOne()) {\n try {\n result = cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.releaseOnlyLast();\n }\n return result;\n }\n /**\n * Executes an asynchronous callback function safely within the mutex lock, allowing only the last function in the waiting list to acquire the lock, and releases the lock afterward.\n * @template T - The type of the return value of the asynchronous callback function.\n * @param {() => Promise<T>} cb - The asynchronous callback function to execute.\n * @returns {Promise<T | undefined>} A Promise that resolves to the result of the asynchronous callback function or undefined if an error occurs.\n */\n async safeRunLastAsync(cb) {\n let result;\n if (await this.waitOne()) {\n try {\n result = await cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.releaseOnlyLast();\n }\n return result;\n }\n}\nMutex.Namespace=`Aventus`;\n__as1(_, 'Mutex', Mutex);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.Mutex","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ActionGuard=class ActionGuard {\n /**\n * Map to store actions that are currently running.\n * @type {Map<any[], ((res: any) => void)[]>}\n * @private\n */\n runningAction = new Map();\n run(keys, action) {\n return new Promise(async (resolve) => {\n if (typeof keys == 'function') {\n action = keys;\n keys = [];\n }\n if (!action) {\n throw \"No action inside the Mutex.run\";\n }\n let actions = undefined;\n let runningKeys = Array.from(this.runningAction.keys());\n for (let runningKey of runningKeys) {\n if (runningKey.length == keys.length) {\n let found = true;\n for (let i = 0; i < keys.length; i++) {\n if (runningKey[i] != keys[i]) {\n found = false;\n break;\n }\n }\n if (found) {\n actions = this.runningAction.get(runningKey);\n break;\n }\n }\n }\n if (actions) {\n actions.push((res) => {\n resolve(res);\n });\n }\n else {\n this.runningAction.set(keys, []);\n let res = await action();\n let actions = this.runningAction.get(keys);\n if (actions) {\n for (let action of actions) {\n action(res);\n }\n }\n this.runningAction.delete(keys);\n resolve(res);\n }\n });\n }\n}\nActionGuard.Namespace=`Aventus`;\n__as1(_, 'ActionGuard', ActionGuard);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.ActionGuard","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"var RamErrorCode;\n(function (RamErrorCode) {\n RamErrorCode[RamErrorCode[\"unknow\"] = 0] = \"unknow\";\n RamErrorCode[RamErrorCode[\"noId\"] = 1] = \"noId\";\n RamErrorCode[RamErrorCode[\"noItemInsideRam\"] = 2] = \"noItemInsideRam\";\n})(RamErrorCode || (RamErrorCode = {}));\n__as1(_, 'RamErrorCode', RamErrorCode);\n","dependencies":[],"fullName":"Aventus.RamErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let ResourceLoader=class ResourceLoader {\n static headerLoaded = {};\n static headerWaiting = {};\n /**\n * Load the resource inside the head tag\n */\n static async loadInHead(options) {\n const _options = this.prepareOptions(options);\n if (this.headerLoaded[_options.url]) {\n return true;\n }\n else if (this.headerWaiting.hasOwnProperty(_options.url)) {\n return await this.awaitFctHead(_options.url);\n }\n else {\n this.headerWaiting[_options.url] = [];\n let tagEl;\n if (_options.type == \"js\") {\n tagEl = document.createElement(\"SCRIPT\");\n }\n else if (_options.type == \"css\") {\n tagEl = document.createElement(\"LINK\");\n tagEl.setAttribute(\"rel\", \"stylesheet\");\n }\n else {\n throw \"unknow type \" + _options.type + \" to append into head\";\n }\n if (_options.nonce) {\n tagEl.setAttribute(\"nonce\", _options.nonce);\n }\n document.head.appendChild(tagEl);\n let result = await this.loadTag(tagEl, _options.url);\n this.headerLoaded[_options.url] = true;\n this.releaseAwaitFctHead(_options.url, result);\n return result;\n }\n }\n static loadTag(tagEl, url) {\n return new Promise((resolve, reject) => {\n tagEl.addEventListener(\"load\", (e) => {\n resolve(true);\n });\n tagEl.addEventListener(\"error\", (e) => {\n resolve(false);\n });\n if (tagEl instanceof HTMLLinkElement) {\n tagEl.setAttribute(\"href\", url);\n }\n else {\n tagEl.setAttribute('src', url);\n }\n });\n }\n static releaseAwaitFctHead(url, result) {\n if (this.headerWaiting[url]) {\n for (let i = 0; i < this.headerWaiting[url].length; i++) {\n this.headerWaiting[url][i](result);\n }\n delete this.headerWaiting[url];\n }\n }\n static awaitFctHead(url) {\n return new Promise((resolve) => {\n this.headerWaiting[url].push((result) => {\n resolve(result);\n });\n });\n }\n static requestLoaded = {};\n static requestWaiting = {};\n /**\n *\n */\n static async load(options) {\n options = this.prepareOptions(options);\n if (this.requestLoaded[options.url]) {\n return this.requestLoaded[options.url];\n }\n else if (this.requestWaiting.hasOwnProperty(options.url)) {\n await this.awaitFct(options.url);\n return this.requestLoaded[options.url];\n }\n else {\n this.requestWaiting[options.url] = [];\n let blob = false;\n if (options.type == \"img\") {\n blob = true;\n }\n let content = await this.fetching(options.url, blob);\n if (options.type == \"img\" && content.startsWith(\"data:text/html;\")) {\n console.error(\"Can't load img \" + options.url);\n content = \"\";\n }\n this.requestLoaded[options.url] = content;\n this.releaseAwaitFct(options.url);\n return content;\n }\n }\n static releaseAwaitFct(url) {\n if (this.requestWaiting[url]) {\n for (let i = 0; i < this.requestWaiting[url].length; i++) {\n this.requestWaiting[url][i]();\n }\n delete this.requestWaiting[url];\n }\n }\n static awaitFct(url) {\n return new Promise((resolve) => {\n this.requestWaiting[url].push(() => {\n resolve('');\n });\n });\n }\n static async fetching(url, useBlob = false) {\n if (useBlob) {\n let result = await fetch(url, {\n headers: {\n responseType: 'blob'\n }\n });\n let blob = await result.blob();\n return await this.readFile(blob);\n }\n else {\n let result = await fetch(url);\n return await result.text();\n }\n }\n static readFile(blob) {\n return new Promise((resolve) => {\n var reader = new FileReader();\n reader.onloadend = function () {\n resolve(reader.result);\n };\n reader.readAsDataURL(blob);\n });\n }\n static imgExtensions = [\"png\", \"jpg\", \"jpeg\", \"gif\"];\n static prepareOptions(options) {\n let result;\n if (typeof options === 'string' || options instanceof String) {\n result = {\n url: options,\n type: 'js'\n };\n let splittedURI = result.url.split('.');\n let extension = splittedURI[splittedURI.length - 1];\n extension = extension.split(\"?\")[0];\n if (extension == \"svg\") {\n result.type = 'svg';\n }\n else if (extension == \"js\") {\n result.type = 'js';\n }\n else if (extension == \"css\") {\n result.type = 'css';\n }\n else if (this.imgExtensions.indexOf(extension) != -1) {\n result.type = 'img';\n }\n else {\n delete result.type;\n }\n }\n else {\n result = options;\n }\n return result;\n }\n}\nResourceLoader.Namespace=`Aventus`;\n__as1(_, 'ResourceLoader', ResourceLoader);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResourceLoaderHeadOptions","isStrong":false},{"fullName":"Aventus.ResourceLoaderOptions","isStrong":false}],"fullName":"Aventus.ResourceLoader","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let DragElementXYType= [SVGGElement, SVGRectElement, SVGEllipseElement, SVGTextElement];\n__as1(_, 'DragElementXYType', DragElementXYType);\n","dependencies":[],"fullName":"Aventus.DragElementXYType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let DragElementLeftTopType= [HTMLElement, SVGSVGElement];\n__as1(_, 'DragElementLeftTopType', DragElementLeftTopType);\n","dependencies":[],"fullName":"Aventus.DragElementLeftTopType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let NormalizedEvent=class NormalizedEvent {\n _event;\n get event() {\n return this._event;\n }\n constructor(event) {\n this._event = event;\n }\n getProp(prop) {\n if (prop in this.event) {\n return this.event[prop];\n }\n return undefined;\n }\n stopImmediatePropagation() {\n this.event.stopImmediatePropagation();\n }\n get clientX() {\n if ('clientX' in this.event) {\n return this.event.clientX;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].clientX;\n }\n return 0;\n }\n get clientY() {\n if ('clientY' in this.event) {\n return this.event.clientY;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].clientY;\n }\n return 0;\n }\n get pageX() {\n if ('pageX' in this.event) {\n return this.event.pageX;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].pageX;\n }\n return 0;\n }\n get pageY() {\n if ('pageY' in this.event) {\n return this.event.pageY;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].pageY;\n }\n return 0;\n }\n get type() {\n return this.event.type;\n }\n get target() {\n return this.event.target;\n }\n get timeStamp() {\n return this.event.timeStamp;\n }\n get pointerType() {\n if ('TouchEvent' in window && this._event instanceof TouchEvent)\n return \"touch\";\n return this.getProp(\"pointerType\");\n }\n get button() {\n return this.getProp(\"button\");\n }\n get isTouch() {\n if ('TouchEvent' in window && this._event instanceof TouchEvent)\n return true;\n return this._event.pointerType == \"touch\";\n }\n}\nNormalizedEvent.Namespace=`Aventus`;\n__as1(_, 'NormalizedEvent', NormalizedEvent);\n","dependencies":[{"fullName":"T","isStrong":false}],"fullName":"Aventus.NormalizedEvent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Callback=class Callback {\n callbacks = new Map();\n /**\n * Clear all callbacks\n */\n clear() {\n this.callbacks.clear();\n }\n /**\n * Add a callback\n */\n add(cb, scope = null) {\n if (!this.callbacks.has(cb)) {\n this.callbacks.set(cb, scope);\n }\n }\n /**\n * Remove a callback\n */\n remove(cb) {\n this.callbacks.delete(cb);\n }\n /**\n * Trigger all callbacks\n */\n trigger(...args) {\n let result = [];\n let cbs = [...this.callbacks];\n for (let [cb, scope] of cbs) {\n result.push(cb.apply(scope, args));\n }\n return result;\n }\n}\nCallback.Namespace=`Aventus`;\n__as1(_, 'Callback', Callback);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.Callback","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let CallbackGroup=class CallbackGroup {\n callbacks = {};\n /**\n * Clear all callbacks\n */\n clearAll() {\n this.callbacks = {};\n }\n /**\n * Clear all callbacks for a specific group\n */\n clear(group) {\n delete this.callbacks[group];\n }\n /**\n * Add a callback for a group\n */\n add(group, cb, scope = null) {\n if (!this.callbacks[group]) {\n this.callbacks[group] = new Map();\n }\n if (!this.callbacks[group].has(cb)) {\n this.callbacks[group].set(cb, scope);\n }\n }\n /**\n * Remove a callback for a group\n */\n remove(group, cb) {\n if (this.callbacks[group]) {\n this.callbacks[group].delete(cb);\n }\n }\n /**\n * Trigger all callbacks inside a group\n */\n trigger(group, ...args) {\n if (this.callbacks[group]) {\n let cbs = [...this.callbacks[group]];\n for (let [cb, scope] of cbs) {\n cb.apply(scope, args);\n }\n }\n }\n}\nCallbackGroup.Namespace=`Aventus`;\n__as1(_, 'CallbackGroup', CallbackGroup);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.CallbackGroup","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Resource=class Resource {\n}\nResource.Namespace=`Aventus`;\n__as1(_, 'Resource', Resource);\n","dependencies":[],"fullName":"Aventus.Resource","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Request=class Request {\n}\nRequest.Namespace=`Aventus`;\n__as1(_, 'Request', Request);\n","dependencies":[],"fullName":"Aventus.Request","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let compareObject=function compareObject(obj1, obj2, tableOrder = true) {\n if (Array.isArray(obj1)) {\n if (!Array.isArray(obj2)) {\n return false;\n }\n obj2 = obj2.slice();\n if (obj1.length !== obj2.length) {\n return false;\n }\n if (tableOrder) {\n for (let i = 0; i < obj1.length; i++) {\n if (!compareObject(obj1[i], obj2[i])) {\n return false;\n }\n }\n return true;\n }\n else {\n for (let i = 0; i < obj1.length; i++) {\n let foundElement = false;\n for (let j = 0; j < obj2.length; j++) {\n if (compareObject(obj1[i], obj2[j])) {\n obj2.splice(j, 1);\n foundElement = true;\n break;\n }\n }\n if (!foundElement) {\n return false;\n }\n }\n }\n return true;\n }\n else if (typeof obj1 === 'object' && obj1 !== undefined && obj1 !== null) {\n if (typeof obj2 !== 'object' || obj2 === undefined || obj2 === null) {\n return false;\n }\n if (obj1 == obj2) {\n return true;\n }\n if (obj1 instanceof HTMLElement || obj2 instanceof HTMLElement) {\n return false;\n }\n if (obj1 instanceof Date || obj2 instanceof Date) {\n return obj1.toString() === obj2.toString();\n }\n let oneProxy = false;\n if (Watcher.is(obj1)) {\n oneProxy = true;\n obj1 = Watcher.extract(obj1, false);\n }\n if (Watcher.is(obj2)) {\n oneProxy = true;\n obj2 = Watcher.extract(obj2, false);\n }\n if (obj1 instanceof Map && obj2 instanceof Map) {\n if (obj1.size != obj2.size) {\n return false;\n }\n const keys = obj1.keys();\n for (let key in keys) {\n if (!obj2.has(key)) {\n return false;\n }\n if (!compareObject(obj1.get(key), obj2.get(key))) {\n return false;\n }\n }\n return true;\n }\n else {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n return false;\n }\n for (let key in obj1) {\n if (oneProxy && Watcher['__reservedName'][key]) {\n continue;\n }\n if (!(key in obj2)) {\n return false;\n }\n if (!compareObject(obj1[key], obj2[key])) {\n return false;\n }\n }\n return true;\n }\n }\n else {\n return obj1 === obj2;\n }\n}\n__as1(_, 'compareObject', compareObject);\n","dependencies":[{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.compareObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let getValueFromObject=function getValueFromObject(path, obj) {\n if (path === undefined) {\n path = '';\n }\n path = path.replace(/\\[(.*?)\\]/g, '.$1');\n if (path == \"\") {\n return obj;\n }\n const val = (key) => {\n if (obj instanceof Map) {\n return obj.get(key);\n }\n return obj[key];\n };\n let splitted = path.split(\".\");\n for (let i = 0; i < splitted.length - 1; i++) {\n let split = splitted[i];\n let value = val(split);\n if (!value || typeof value !== 'object') {\n return undefined;\n }\n obj = value;\n }\n if (!obj || typeof obj !== 'object') {\n return undefined;\n }\n return val(splitted[splitted.length - 1]);\n}\n__as1(_, 'getValueFromObject', getValueFromObject);\n","dependencies":[],"fullName":"Aventus.getValueFromObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"var WatchAction;\n(function (WatchAction) {\n WatchAction[WatchAction[\"CREATED\"] = 0] = \"CREATED\";\n WatchAction[WatchAction[\"UPDATED\"] = 1] = \"UPDATED\";\n WatchAction[WatchAction[\"DELETED\"] = 2] = \"DELETED\";\n})(WatchAction || (WatchAction = {}));\n__as1(_, 'WatchAction', WatchAction);\n","dependencies":[],"fullName":"Aventus.WatchAction","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let Async=function Async(el) {\n return new Promise((resolve) => {\n if (el instanceof Promise) {\n el.then(resolve);\n }\n else {\n resolve(el);\n }\n });\n}\n__as1(_, 'Async', Async);\n","dependencies":[{"fullName":"Aventus.Asyncable","isStrong":false}],"fullName":"Aventus.Async","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"var HttpMethod;\n(function (HttpMethod) {\n HttpMethod[\"GET\"] = \"GET\";\n HttpMethod[\"POST\"] = \"POST\";\n HttpMethod[\"DELETE\"] = \"DELETE\";\n HttpMethod[\"PUT\"] = \"PUT\";\n HttpMethod[\"OPTION\"] = \"OPTION\";\n})(HttpMethod || (HttpMethod = {}));\n__as1(_, 'HttpMethod', HttpMethod);\n","dependencies":[],"fullName":"Aventus.HttpMethod","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"var HttpErrorCode;\n(function (HttpErrorCode) {\n HttpErrorCode[HttpErrorCode[\"unknow\"] = 0] = \"unknow\";\n})(HttpErrorCode || (HttpErrorCode = {}));\n__as1(_, 'HttpErrorCode', HttpErrorCode);\n","dependencies":[],"fullName":"Aventus.HttpErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let DateConverter=class DateConverter {\n static __converter = new DateConverter();\n static get converter() {\n return this.__converter;\n }\n static set converter(value) {\n this.__converter = value;\n }\n isStringDate(txt) {\n return /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{3,6})Z$/.exec(txt) !== null;\n }\n fromString(txt) {\n return new Date(txt);\n }\n toString(date) {\n if (date.getFullYear() < 100) {\n return \"0001-01-01T00:00:00.000Z\";\n }\n return date.toISOString();\n }\n}\nDateConverter.Namespace=`Aventus`;\n__as1(_, 'DateConverter', DateConverter);\n","dependencies":[],"fullName":"Aventus.DateConverter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Json=class Json {\n /**\n * Converts a JavaScript class instance to a JSON object.\n * @template T - The type of the object to convert.\n * @param {T} obj - The object to convert to JSON.\n * @param {JsonToOptions} [options] - Options for JSON conversion.\n * @returns {{ [key: string | number]: any; }} Returns the JSON representation of the object.\n */\n static classToJson(obj, options) {\n const realOptions = {\n isValidKey: options?.isValidKey ?? (() => true),\n replaceKey: options?.replaceKey ?? ((key) => key),\n transformValue: options?.transformValue ?? ((key, value) => value),\n beforeEnd: options?.beforeEnd ?? ((res) => res)\n };\n return this.__classToJson(obj, realOptions);\n }\n static __classToJson(obj, options) {\n let result = {};\n let descriptors = Object.getOwnPropertyDescriptors(obj);\n for (let key in descriptors) {\n if (options.isValidKey(key))\n result[options.replaceKey(key)] = options.transformValue(key, descriptors[key].value);\n }\n let cst = obj.constructor;\n while (cst.prototype && cst != Object.prototype) {\n let descriptorsClass = Object.getOwnPropertyDescriptors(cst.prototype);\n for (let key in descriptorsClass) {\n if (options.isValidKey(key)) {\n let descriptor = descriptorsClass[key];\n if (descriptor?.get) {\n const o = obj;\n result[options.replaceKey(key)] = options.transformValue(key, o[key]);\n }\n }\n }\n cst = Object.getPrototypeOf(cst);\n }\n result = options.beforeEnd(result);\n return result;\n }\n /**\n * Converts a JSON object to a JavaScript class instance.\n * @template T - The type of the object to convert.\n * @param {T} obj - The object to populate with JSON data.\n * @param {*} data - The JSON data to populate the object with.\n * @param {JsonFromOptions} [options] - Options for JSON deserialization.\n * @returns {T} Returns the populated object.\n */\n static classFromJson(obj, data, options) {\n let realOptions = {\n transformValue: options?.transformValue ?? ((key, value) => value),\n replaceUndefined: options?.replaceUndefined ?? false,\n replaceUndefinedWithKey: options?.replaceUndefinedWithKey ?? false,\n };\n return this.__classFromJson(obj, data, realOptions);\n }\n static __classFromJson(obj, data, options) {\n let props = Object.getOwnPropertyNames(obj);\n for (let prop of props) {\n let propUpperFirst = prop[0].toUpperCase() + prop.slice(1);\n let value = data[prop] === undefined ? data[propUpperFirst] : data[prop];\n if (value !== undefined || options.replaceUndefined || (options.replaceUndefinedWithKey && (Object.hasOwn(data, prop) || Object.hasOwn(data, propUpperFirst)))) {\n let propInfo = Object.getOwnPropertyDescriptor(obj, prop);\n if (propInfo?.writable) {\n const o = obj;\n o[prop] = options.transformValue(prop, value);\n }\n }\n }\n let cstTemp = obj.constructor;\n while (cstTemp.prototype && cstTemp != Object.prototype) {\n props = Object.getOwnPropertyNames(cstTemp.prototype);\n for (let prop of props) {\n let propUpperFirst = prop[0].toUpperCase() + prop.slice(1);\n let value = data[prop] === undefined ? data[propUpperFirst] : data[prop];\n if (value !== undefined || options.replaceUndefined || (options.replaceUndefinedWithKey && (Object.hasOwn(data, prop) || Object.hasOwn(data, propUpperFirst)))) {\n let propInfo = Object.getOwnPropertyDescriptor(cstTemp.prototype, prop);\n if (propInfo?.set) {\n const o = obj;\n o[prop] = options.transformValue(prop, value);\n }\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n return obj;\n }\n}\nJson.Namespace=`Aventus`;\n__as1(_, 'Json', Json);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.JsonToOptions","isStrong":false},{"fullName":"Aventus.JsonFromOptions","isStrong":false}],"fullName":"Aventus.Json","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ConverterTransform=class ConverterTransform {\n transform(data) {\n return this.transformLoop(data);\n }\n createInstance(data) {\n if (data.$type) {\n let cst = Converter.info.get(data.$type);\n if (cst) {\n return new cst();\n }\n }\n return undefined;\n }\n beforeTransformObject(obj) {\n }\n afterTransformObject(obj) {\n }\n transformLoop(data) {\n if (data === null) {\n return data;\n }\n if (Array.isArray(data)) {\n let result = [];\n for (let element of data) {\n result.push(this.transformLoop(element));\n }\n return result;\n }\n if (data instanceof Date) {\n return data;\n }\n if (typeof data === 'object' && !/^\\s*class\\s+/.test(data.toString())) {\n let objTemp = this.createInstance(data);\n if (objTemp) {\n if (objTemp instanceof Map) {\n if (data.values) {\n for (const keyValue of data.values) {\n objTemp.set(this.transformLoop(keyValue[0]), this.transformLoop(keyValue[1]));\n }\n }\n return objTemp;\n }\n let obj = objTemp;\n this.beforeTransformObject(obj);\n if (obj.fromJSON) {\n obj = obj.fromJSON(data);\n }\n else {\n obj = Json.classFromJson(obj, data, {\n transformValue: (key, value) => {\n if (obj[key] instanceof Date) {\n return value ? new Date(value) : null;\n }\n else if (typeof value == 'string' && DateConverter.converter.isStringDate(value)) {\n return value ? DateConverter.converter.fromString(value) : null;\n }\n else if (obj[key] instanceof Map) {\n let map = new Map();\n if (\"$type\" in value && value['$type'] == \"Aventus.Map\") {\n value = value.values;\n }\n for (const keyValue of value) {\n map.set(this.transformLoop(keyValue[0]), this.transformLoop(keyValue[1]));\n }\n return map;\n }\n else if (obj instanceof Data) {\n let cst = obj.constructor;\n if (cst.$schema[key] == 'boolean') {\n return value ? true : false;\n }\n else if (cst.$schema[key] == 'number') {\n return isNaN(Number(value)) ? 0 : Number(value);\n }\n else if (cst.$schema[key] == 'number') {\n return isNaN(Number(value)) ? 0 : Number(value);\n }\n else if (cst.$schema[key] == 'Date') {\n return value ? new Date(value) : null;\n }\n }\n return this.transformLoop(value);\n }\n });\n }\n this.afterTransformObject(obj);\n return obj;\n }\n let result = {};\n for (let key in data) {\n result[key] = this.transformLoop(data[key]);\n }\n return result;\n }\n if (typeof data == 'string' && /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{3})Z$/.exec(data)) {\n return new Date(data);\n }\n return data;\n }\n copyValuesClass(target, src, options) {\n const realOptions = {\n isValidKey: options?.isValidKey ?? (() => true),\n replaceKey: options?.replaceKey ?? ((key) => key),\n transformValue: options?.transformValue ?? ((key, value) => value),\n };\n this.__classCopyValues(target, src, realOptions);\n }\n __classCopyValues(target, src, options) {\n let props = Object.getOwnPropertyNames(target);\n for (let prop of props) {\n let propInfo = Object.getOwnPropertyDescriptor(target, prop);\n if (propInfo?.writable) {\n if (options.isValidKey(prop)) {\n const _target = target;\n const _src = src;\n _target[options.replaceKey(prop)] = options.transformValue(prop, _src[prop]);\n }\n }\n }\n let cstTemp = target.constructor;\n while (cstTemp.prototype && cstTemp != Object.prototype) {\n props = Object.getOwnPropertyNames(cstTemp.prototype);\n for (let prop of props) {\n let propInfo = Object.getOwnPropertyDescriptor(cstTemp.prototype, prop);\n if (propInfo?.set && propInfo.get) {\n if (options.isValidKey(prop)) {\n const _target = target;\n const _src = src;\n _target[options.replaceKey(prop)] = options.transformValue(prop, _src[prop]);\n }\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n }\n}\nConverterTransform.Namespace=`Aventus`;\n__as1(_, 'ConverterTransform', ConverterTransform);\n","dependencies":[{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false},{"fullName":"Aventus.Data","isStrong":false}],"fullName":"Aventus.ConverterTransform","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Converter=class Converter {\n /**\n * Map storing information about registered types.\n */\n static info = new Map([[\"Aventus.Map\", Map]]);\n /**\n * Map storing schemas for registered types.\n */\n static schema = new Map();\n /**\n * Internal converter instance.\n */\n static __converter = new ConverterTransform();\n /**\n * Getter for the internal converter instance.\n */\n static get converterTransform() {\n return this.__converter;\n }\n /**\n * Sets the converter instance.\n * @param converter The converter instance to set.\n */\n static setConverter(converter) {\n this.__converter = converter;\n }\n /**\n * Registers a unique string type for any class.\n * @param $type The unique string type identifier.\n * @param cst The constructor function for the class.\n * @param schema Optional schema for the registered type.\n */\n static register($type, cst, schema) {\n this.info.set($type, cst);\n if (schema) {\n this.schema.set($type, schema);\n }\n }\n /**\n * Transforms the provided data using the current converter instance.\n * @template T\n * @param {*} data The data to transform.\n * @param {IConverterTransform} [converter] Optional converter instance to use for transformation.\n * @returns {T} Returns the transformed data.\n */\n static transform(data, converter) {\n if (!converter) {\n converter = this.converterTransform;\n }\n return converter.transform(data);\n }\n /**\n * Copies values from one class instance to another using the current converter instance.\n * @template T\n * @param {T} to The destination class instance to copy values into.\n * @param {T} from The source class instance to copy values from.\n * @param {ClassCopyOptions} [options] Optional options for the copy operation.\n * @param {IConverterTransform} [converter] Optional converter instance to use for the copy operation.\n * @returns {T} Returns the destination class instance with copied values.\n */\n static copyValuesClass(to, from, options, converter) {\n if (!converter) {\n converter = this.converterTransform;\n }\n return converter.copyValuesClass(to, from, options);\n }\n}\nConverter.Namespace=`Aventus`;\n__as1(_, 'Converter', Converter);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Schema","isStrong":true},{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Aventus.ConverterTransform","isStrong":true},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}],"fullName":"Aventus.Converter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let clone=function clone(item) {\n return Converter.transform(JSON.parse(JSON.stringify(item)));\n}\n__as1(_, 'clone', clone);\n","dependencies":[{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.clone","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let HttpResponse=class HttpResponse {\n get status() {\n return this.response.status;\n }\n get statusText() {\n return this.response.statusText;\n }\n get redirected() {\n return this.response.redirected;\n }\n get ok() {\n return this.response.ok;\n }\n get type() {\n return this.response.type;\n }\n get url() {\n return this.response.url;\n }\n get headers() {\n return this.response.headers;\n }\n response;\n constructor(response) {\n this.response = response;\n }\n bodyUsed = false;\n bodyContent;\n async json() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.json();\n }\n return Converter.transform(this.bodyContent);\n }\n async blob() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.blob();\n }\n return this.bodyContent;\n }\n async text() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.text();\n }\n return this.bodyContent;\n }\n}\nHttpResponse.Namespace=`Aventus`;\n__as1(_, 'HttpResponse', HttpResponse);\n","dependencies":[{"fullName":"T","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.HttpResponse","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Data=// @Dependencies([{ type: Aventus.Converter, strong: true }, { type: Converter, strong: true }])\nclass Data {\n static converter = new Converter();\n /**\n * The schema for the class\n */\n static $schema;\n /**\n * The current namespace\n */\n static Namespace = \"\";\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n /**\n * Get the name of the class\n */\n get className() {\n return this.constructor.name;\n }\n /**\n * Get a JSON for the current object\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key)\n });\n }\n /**\n * Clone the object by transforming a parsed JSON string back into the original type\n */\n clone() {\n return Converter.transform(JSON.parse(JSON.stringify(this)));\n }\n}\nData.Namespace=`Aventus`;\nData.$schema={\"namespace\":\"string\",\"$type\":\"string\",\"className\":\"string\"};\nConverter.register(Data.Fullname, Data);\n__as1(_, 'Data', Data);\n","dependencies":[{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Converter","isStrong":true},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"Aventus.Data","required":false,"type":2,"isExported":true,"convertibleName":""},{"code":"let HttpCache=class HttpCache {\n static cache = new Map();\n static async fetch(fullUrl, request) {\n const key = this.generateCacheKey(fullUrl, request);\n if (key) {\n const value = this.cache.get(key);\n if (value)\n return value;\n }\n const result = await fetch(fullUrl, request);\n const response = new HttpResponse(result);\n if (key)\n this.cache.set(key, response);\n return response;\n }\n static clear(fullUrl, request) {\n const key = this.generateCacheKey(fullUrl, request);\n if (key) {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n }\n }\n static generateCacheKey(fullUrl, request) {\n const method = request.method;\n const body = request.body;\n let bodyKey = \"\";\n if (typeof body == 'string') {\n bodyKey = this.hashStringToInt(body) + '';\n }\n else if (body instanceof FormData) {\n }\n return fullUrl + \"°\" + method + \"°\" + bodyKey;\n }\n static hashStringToInt(str) {\n let hash = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);\n }\n return hash >>> 0;\n }\n}\nHttpCache.Namespace=`Aventus`;\n__as1(_, 'HttpCache', HttpCache);\n","dependencies":[{"fullName":"Aventus.HttpResponse","isStrong":true}],"fullName":"Aventus.HttpCache","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let GenericError=// @Dependencies([{ type: Aventus.Converter, strong: true }, { type: Converter, strong: true }])\nclass GenericError {\n static converter = new Converter();\n static get Fullname() { return \"Aventus.GenericError\"; }\n /**\n * Code for the error\n */\n code;\n /**\n * Description of the error\n */\n message;\n /**\n * Additional details related to the error.\n */\n details = [];\n /**\n * Creates a new instance of GenericError.\n * @param {EnumValue<T>} code - The error code.\n * @param {string | Error | unknown} message - The error message.\n */\n constructor(code, message) {\n this.code = code;\n if (message instanceof Error) {\n this.message = message.message;\n }\n else {\n this.message = message + '';\n }\n }\n}\nGenericError.Namespace=`Aventus`;\nGenericError.$schema={\"code\":\"Aventus.EnumValue\",\"message\":\"string\"};\nConverter.register(GenericError.Fullname, GenericError);\n__as1(_, 'GenericError', GenericError);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.Converter","isStrong":true},{"fullName":"Aventus.EnumValue","isStrong":false}],"fullName":"Aventus.GenericError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let VoidWithError=class VoidWithError {\n static get Fullname() { return \"Aventus.VoidWithError\"; }\n /**\n * Determine if the action is a success\n */\n get success() {\n return this.errors.length == 0;\n }\n /**\n * List of errors\n */\n errors = [];\n /**\n * Converts the current instance to a VoidWithError object.\n * @returns {VoidWithError} A new instance of VoidWithError with the same error list.\n */\n toGeneric() {\n const result = new VoidWithError();\n result.errors = this.errors;\n return result;\n }\n /**\n * Checks if the error list contains a specific error code.\n * @template U - The type of error, extending GenericError.\n * @template T - The type of the error code, which extends either number or Enum.\n * @param {EnumValue<T>} code - The error code to check for.\n * @param {new (...args: any[]) => U} [type] - Optional constructor function of the error type.\n * @returns {boolean} True if the error list contains the specified error code, otherwise false.\n */\n containsCode(code, type) {\n if (type) {\n for (let error of this.errors) {\n if (error instanceof type) {\n if (error.code == code) {\n return true;\n }\n }\n }\n }\n else {\n for (let error of this.errors) {\n if (error.code == code) {\n return true;\n }\n }\n }\n return false;\n }\n run(fct) {\n if (this.success) {\n let result = fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n }\n return this;\n }\n async runAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n }\n return this;\n }\n extract(fct) {\n if (this.success) {\n let result = fct();\n if (result.success && result.result) {\n return result.result;\n }\n this.errors = [...this.errors, ...result.errors];\n }\n return undefined;\n }\n async extractAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (result.success && result.result) {\n return result.result;\n }\n this.errors = [...this.errors, ...result.errors];\n }\n return undefined;\n }\n}\nVoidWithError.Namespace=`Aventus`;\nVoidWithError.$schema={\"success\":\"boolean\",\"errors\":\"T[]\"};\nConverter.register(VoidWithError.Fullname, VoidWithError);\n__as1(_, 'VoidWithError', VoidWithError);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.EnumValue","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"X","isStrong":false}],"fullName":"Aventus.VoidWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let ResultWithError=class ResultWithError extends VoidWithError {\n static get Fullname() { return \"Aventus.ResultWithError\"; }\n /**\n * The result value of the action.\n * @type {U | undefined}\n */\n result;\n /**\n * Converts the current instance to a ResultWithError object.\n * @returns {ResultWithError<U>} A new instance of ResultWithError with the same error list and result value.\n */\n toGeneric() {\n const result = new ResultWithError();\n result.errors = this.errors;\n result.result = this.result;\n return result;\n }\n run(fct) {\n if (this.success) {\n let result = fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n if (result instanceof ResultWithError && result.success && result.result) {\n this.result = result.result;\n }\n }\n return this;\n }\n async runAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n if (result instanceof ResultWithError && result.success && result.result) {\n this.result = result.result;\n }\n }\n return this;\n }\n}\nResultWithError.Namespace=`Aventus`;\nResultWithError.$schema={...(VoidWithError?.$schema ?? {}), };\nConverter.register(ResultWithError.Fullname, ResultWithError);\n__as1(_, 'ResultWithError', ResultWithError);\n","dependencies":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"Aventus.ResultWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let HttpError=class HttpError extends GenericError {\n}\nHttpError.Namespace=`Aventus`;\nHttpError.$schema={...(GenericError?.$schema ?? {}), };\nConverter.register(HttpError.Fullname, HttpError);\n__as1(_, 'HttpError', HttpError);\n","dependencies":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.HttpError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let Signal=class Signal {\n __subscribes = [];\n _value;\n _onChange;\n get value() {\n Watcher._register?.register(this, \"*\", Watcher._register.version, \"*\");\n return this._value;\n }\n set value(item) {\n const oldValue = this._value;\n this._value = item;\n if (oldValue != item) {\n if (this._onChange) {\n this._onChange();\n }\n for (let fct of this.__subscribes) {\n fct(WatchAction.UPDATED, \"*\", item, []);\n }\n }\n }\n constructor(item, onChange) {\n this._value = item;\n this._onChange = onChange;\n }\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n }\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n }\n destroy() {\n this.__subscribes = [];\n }\n}\nSignal.Namespace=`Aventus`;\n__as1(_, 'Signal', Signal);\n","dependencies":[{"fullName":"Aventus.EffectReceiver","isStrong":true},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Signal","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Effect=class Effect {\n callbacks = [];\n isInit = false;\n isDestroy = false;\n __subscribes = [];\n __allowChanged = [];\n version = 0;\n fct;\n constructor(fct) {\n this.fct = fct;\n if (this.autoInit()) {\n this.init();\n }\n }\n autoInit() {\n return true;\n }\n init() {\n this.isInit = true;\n this.run();\n }\n run() {\n this.version++;\n Watcher._registering.push(this);\n let result = this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n for (let i = 0; i < this.callbacks.length; i++) {\n if (this.callbacks[i].version != this.version) {\n this.callbacks[i].receiver.unsubscribe(this.callbacks[i].cb);\n this.callbacks.splice(i, 1);\n i--;\n }\n }\n return result;\n }\n register(receiver, path, version, fullPath) {\n for (let info of this.callbacks) {\n if (info.receiver == receiver && info.path == path && receiver.__path == info.registerPath) {\n info.version = version;\n info.fullPath = fullPath;\n return;\n }\n }\n let cb;\n if (path == \"*\") {\n cb = (action, changePath, value, dones) => { this.onChange(action, changePath, value, dones); };\n }\n else {\n cb = (action, changePath, value, dones) => {\n if (changePath == path || changePath.startsWith(path + \".\") || changePath.startsWith(path + \"[\")) {\n // if(changePath == path) {\n this.onChange(action, changePath, value, dones);\n }\n };\n }\n this.callbacks.push({\n receiver,\n path,\n registerPath: receiver.__path,\n cb,\n version,\n fullPath\n });\n receiver.subscribe(cb);\n }\n canChange(fct) {\n this.__allowChanged.push(fct);\n }\n checkCanChange(action, changePath, value, dones) {\n if (this.isDestroy) {\n return false;\n }\n for (let fct of this.__allowChanged) {\n if (!fct(action, changePath, value, dones)) {\n return false;\n }\n }\n return true;\n }\n onChange(action, changePath, value, dones) {\n if (!this.checkCanChange(action, changePath, value, dones)) {\n return;\n }\n this.run();\n for (let fct of this.__subscribes) {\n fct(action, changePath, value, dones);\n }\n }\n destroy() {\n this.isDestroy = true;\n this.clearCallbacks();\n this.isInit = false;\n }\n clearCallbacks() {\n for (let pair of this.callbacks) {\n pair.receiver.unsubscribe(pair.cb);\n }\n this.callbacks = [];\n }\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n }\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n }\n}\nEffect.Namespace=`Aventus`;\n__as1(_, 'Effect', Effect);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Aventus.WatcherAllowed","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Effect","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Computed=class Computed extends Effect {\n _value;\n __path = \"*\";\n get value() {\n if (!this.isInit) {\n this.init();\n }\n Watcher._register?.register(this, \"*\", Watcher._register.version, \"*\");\n return this._value;\n }\n autoInit() {\n return false;\n }\n constructor(fct) {\n super(fct);\n }\n init() {\n this.isInit = true;\n this.computedValue();\n }\n computedValue() {\n this._value = this.run();\n }\n onChange(action, changePath, value, dones) {\n if (!this.checkCanChange(action, changePath, value, dones)) {\n return;\n }\n let oldValue = this._value;\n this.computedValue();\n if (oldValue === this._value) {\n return;\n }\n for (let fct of this.__subscribes) {\n fct(action, changePath, value, dones);\n }\n }\n}\nComputed.Namespace=`Aventus`;\n__as1(_, 'Computed', Computed);\n","dependencies":[{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.EffectReceiver","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.IsNotVoid","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Computed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Watcher=class Watcher {\n static isNative(obj) {\n if (obj instanceof Blob ||\n obj instanceof Element ||\n obj instanceof Window)\n return true;\n return false;\n }\n constructor() { }\n ;\n static __reservedName = {\n __path: '__path',\n };\n static __triggerForced = false;\n static _registering = [];\n static get _register() {\n return this._registering[this._registering.length - 1];\n }\n /**\n * Transform object into a watcher\n */\n static get(obj, onDataChanged) {\n if (obj == undefined) {\n console.error(\"You must define an objet / array for your proxy\");\n return;\n }\n if (obj.__isProxy) {\n if (onDataChanged)\n obj.subscribe(onDataChanged);\n return obj;\n }\n const reservedName = this.__reservedName;\n const clearReservedNames = (data) => {\n if (data instanceof Object && !data.__isProxy) {\n for (let key in reservedName) {\n delete data[key];\n }\n for (let key in data) {\n clearReservedNames(data[key]);\n }\n }\n };\n const setProxyPath = (newProxy, newPath) => {\n if (newProxy instanceof Object && newProxy.__isProxy) {\n newProxy.__path = newPath;\n }\n };\n const jsonReplacer = (key, value) => {\n if (reservedName[key])\n return undefined;\n return value;\n };\n const addAlias = (otherBaseData, name, cb) => {\n let cbs = aliases.get(otherBaseData);\n if (!cbs) {\n cbs = [];\n aliases.set(otherBaseData, cbs);\n }\n cbs.push({\n name: name,\n fct: cb\n });\n };\n const deleteAlias = (otherBaseData, name) => {\n let cbs = aliases.get(otherBaseData);\n if (!cbs)\n return;\n for (let i = 0; i < cbs.length; i++) {\n if (cbs[i].name == name) {\n cbs.splice(i, 1);\n if (cbs.length == 0) {\n aliases.delete(otherBaseData);\n }\n return;\n }\n }\n };\n const replaceByAlias = (target, element, prop, receiver, apply, out = {}) => {\n let fullInternalPath = \"\";\n if (Array.isArray(receiver)) {\n if (prop != \"length\") {\n if (target.__path) {\n fullInternalPath = target.__path;\n }\n fullInternalPath += \"[\" + prop + \"]\";\n }\n }\n else {\n if (target.__path) {\n fullInternalPath = target.__path + '.';\n }\n fullInternalPath += prop;\n }\n if (receiver && internalAliases[fullInternalPath]) {\n internalAliases[fullInternalPath].unbind();\n }\n if (element instanceof Object && element.__isProxy) {\n let root = element.__root;\n if (root != proxyData.baseData) {\n element.__validatePath();\n let oldPath = element.__path ?? '';\n let unbindElement = Watcher.extract(getValueFromObject(oldPath, root));\n if (unbindElement === undefined) {\n return element;\n }\n if (receiver == null) {\n receiver = getValueFromObject(target.__path, realProxy);\n if (internalAliases[fullInternalPath]) {\n internalAliases[fullInternalPath].unbind();\n }\n }\n if (apply) {\n let result = this.isNative(target) ? Reflect.set(target, prop, unbindElement) : Reflect.set(target, prop, unbindElement, receiver);\n }\n element.__addAlias(proxyData.baseData, oldPath, (type, target, receiver2, value, prop2, dones) => {\n let triggerPath;\n if (prop2.startsWith(\"[\") || fullInternalPath == \"\" || prop2 == \"\") {\n triggerPath = fullInternalPath + prop2;\n }\n else {\n triggerPath = fullInternalPath + \".\" + prop2;\n }\n if (type == 'DELETED' && internalAliases[triggerPath]) {\n internalAliases[triggerPath].unbind();\n }\n triggerPath = triggerPath.replace(/\\[(.*?)\\]/g, '.$1');\n let splitted = triggerPath.split(\".\");\n let newProp = splitted.pop();\n let newReceiver = getValueFromObject(splitted.join(\".\"), realProxy);\n if (newReceiver.getTarget(false) == target)\n trigger(type, target, newReceiver, value, newProp ?? '', dones);\n });\n internalAliases[fullInternalPath] = {\n unbind: () => {\n delete internalAliases[fullInternalPath];\n element.__deleteAlias(proxyData.baseData, oldPath);\n deleteAlias(root, fullInternalPath);\n }\n };\n addAlias(root, fullInternalPath, (type, target, receiver2, value, prop2, dones) => {\n const pathSave = element.__path;\n let proxy = element.__getProxy;\n let triggerPath;\n if (prop2.startsWith(\"[\") || oldPath == \"\" || prop2 == \"\") {\n triggerPath = oldPath + prop2;\n }\n else {\n triggerPath = oldPath + \".\" + prop2;\n }\n triggerPath = triggerPath.replace(/\\[(.*?)\\]/g, '.$1');\n let splitted = triggerPath.split(\".\");\n let newProp = splitted.pop();\n let newReceiver = getValueFromObject(splitted.join(\".\"), proxy);\n if (newReceiver.getTarget(false) == target)\n element.__trigger(type, target, newReceiver, value, newProp, dones);\n element.__path = pathSave;\n });\n out.otherRoot = root;\n return unbindElement;\n }\n }\n return element;\n };\n let currentTrace = new Error().stack?.split(\"\\n\") ?? [];\n currentTrace.shift();\n currentTrace.shift();\n const aliases = new Map();\n const internalAliases = {};\n let proxyData = {\n baseData: {},\n callbacks: {},\n callbacksReverse: new Map(),\n avoidUpdate: [],\n pathToRemove: [],\n injectedDones: null,\n history: [{\n object: JSON.parse(JSON.stringify(obj, jsonReplacer)),\n trace: currentTrace,\n action: 'init',\n path: ''\n }],\n useHistory: false,\n getProxyObject(target, element, prop) {\n let newProxy;\n element = replaceByAlias(target, element, prop, null, true);\n if (element instanceof Object && element.__isProxy) {\n newProxy = element;\n }\n else {\n try {\n if (element instanceof Computed) {\n return element;\n }\n if (element instanceof HTMLElement) {\n return element;\n }\n if (element instanceof Object) {\n newProxy = new Proxy(element, this);\n }\n else {\n return element;\n }\n }\n catch {\n return element;\n }\n }\n let newPath = '';\n if (Array.isArray(target)) {\n if (/^[0-9]*$/g.exec(prop)) {\n if (target.__path) {\n newPath = target.__path;\n }\n newPath += \"[\" + prop + \"]\";\n setProxyPath(newProxy, newPath);\n }\n else {\n newPath += \".\" + prop;\n setProxyPath(newProxy, newPath);\n }\n }\n else if (element instanceof Date) {\n return element;\n }\n else {\n if (target.__path) {\n newPath = target.__path + '.';\n }\n newPath += prop;\n setProxyPath(newProxy, newPath);\n }\n return newProxy;\n },\n tryCustomFunction(target, prop, receiver) {\n if (prop == \"__isProxy\") {\n return true;\n }\n else if (prop == \"__getProxy\") {\n return realProxy;\n }\n else if (prop == \"__root\") {\n return this.baseData;\n }\n else if (prop == \"__validatePath\") {\n return () => {\n if (this.baseData == target) {\n target.__path = \"\";\n }\n };\n }\n else if (prop == \"__callbacks\") {\n return this.callbacks;\n }\n else if (prop == \"subscribe\") {\n let path = receiver.__path;\n return (cb) => {\n if (!this.callbacks[path]) {\n this.callbacks[path] = [];\n }\n this.callbacks[path].push(cb);\n this.callbacksReverse.set(cb, path);\n };\n }\n else if (prop == \"unsubscribe\") {\n return (cb) => {\n let oldPath = this.callbacksReverse.get(cb);\n if (oldPath === undefined)\n return;\n if (!this.callbacks[oldPath]) {\n return;\n }\n let index = this.callbacks[oldPath].indexOf(cb);\n if (index > -1) {\n this.callbacks[oldPath].splice(index, 1);\n }\n this.callbacksReverse.delete(cb);\n };\n }\n else if (prop == \"getHistory\") {\n return () => {\n return this.history;\n };\n }\n else if (prop == \"clearHistory\") {\n this.history = [];\n }\n else if (prop == \"enableHistory\") {\n return () => {\n this.useHistory = true;\n };\n }\n else if (prop == \"disableHistory\") {\n return () => {\n this.useHistory = false;\n };\n }\n else if (prop == \"getTarget\") {\n return (clear = true) => {\n if (clear)\n clearReservedNames(target);\n return target;\n };\n }\n else if (prop == \"toJSON\") {\n if (target.toJSON) {\n return target.toJSON;\n }\n if (Array.isArray(receiver)) {\n return () => {\n let result = [];\n for (let element of target) {\n result.push(element);\n }\n return result;\n };\n }\n return () => {\n let result = {};\n for (let key of Object.keys(target)) {\n if (reservedName[key]) {\n continue;\n }\n result[key] = target[key];\n }\n return result;\n };\n }\n else if (prop == \"__addAlias\") {\n return addAlias;\n }\n else if (prop == \"__deleteAlias\") {\n return deleteAlias;\n }\n else if (prop == \"__injectedDones\") {\n return (dones) => {\n this.injectedDones = dones;\n };\n }\n else if (prop == \"__trigger\") {\n return trigger;\n }\n else if (prop == \"__static_trigger\") {\n return (type) => {\n Watcher.__triggerForced = true;\n trigger(type, target, receiver, target, '');\n Watcher.__triggerForced = false;\n };\n }\n return undefined;\n },\n get(target, prop, receiver) {\n if (typeof prop == 'symbol') {\n return Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n }\n if (reservedName[prop]) {\n return target[prop];\n }\n let customResult = this.tryCustomFunction(target, prop, receiver);\n if (customResult !== undefined) {\n return customResult;\n }\n let element = target[prop];\n if (typeof (element) == 'function') {\n if (Array.isArray(receiver)) {\n let result;\n if (prop == 'push') {\n if (target.__isProxy) {\n result = (el) => {\n let index = target.push(el);\n return index;\n };\n }\n else {\n result = (el) => {\n let index = target.length;\n let out = {};\n el = replaceByAlias(target, el, target.length + '', receiver, false, out);\n target.push(el);\n const dones = [];\n const dones2 = [];\n if (out.otherRoot) {\n dones.push(out.otherRoot);\n dones2.push(out.otherRoot);\n }\n trigger('CREATED', target, receiver, receiver[index], \"[\" + (index) + \"]\", dones);\n trigger('UPDATED', target, receiver, target.length, \"length\", dones2);\n return index;\n };\n }\n }\n else if (prop == 'splice') {\n if (target.__isProxy) {\n result = (index, nbRemove, ...insert) => {\n let res = target.splice(index, nbRemove, ...insert);\n return res;\n };\n }\n else {\n result = (index, nbRemove, ...insert) => {\n let oldValues = [];\n const extReceiver = Watcher.extract(receiver);\n for (let i = index; i < index + nbRemove; i++) {\n oldValues.push(extReceiver[i]);\n }\n let updateLength = nbRemove != insert.length;\n for (let i = 0; i < oldValues.length; i++) {\n target.splice((index + i), 1);\n trigger('DELETED', target, receiver, oldValues[i], \"[\" + index + \"]\");\n }\n for (let i = 0; i < insert.length; i++) {\n const out = {};\n let value = replaceByAlias(target, insert[i], (index + i) + '', receiver, false, out);\n const dones = out.otherRoot ? [out.otherRoot] : [];\n target.splice((index + i), 0, value);\n trigger('CREATED', target, receiver, receiver[(index + i)], \"[\" + (index + i) + \"]\", dones);\n }\n if (updateLength)\n trigger('UPDATED', target, receiver, target.length, \"length\");\n return target;\n };\n }\n }\n else if (prop == 'pop') {\n if (target.__isProxy) {\n result = () => {\n let res = target.pop();\n return res;\n };\n }\n else {\n result = () => {\n let index = target.length - 1;\n let oldValue = receiver.length ? receiver[receiver.length] : undefined;\n let res = target.pop();\n trigger('DELETED', target, receiver, oldValue, \"[\" + index + \"]\");\n trigger('UPDATED', target, receiver, target.length, \"length\");\n return res;\n };\n }\n }\n // else if(prop == 'find') {\n else {\n result = element.bind(target);\n }\n return result;\n }\n else if (target instanceof Map) {\n let result;\n if (prop == \"set\") {\n if (target.__isProxy) {\n result = (key, value) => {\n return target.set(key, value);\n };\n }\n else {\n result = (key, value) => {\n const out = {};\n let dones = [];\n let dones2 = [];\n key = Watcher.extract(key);\n value = replaceByAlias(target, value, key + '', receiver, false, out);\n if (out.otherRoot) {\n dones.push(out.otherRoot);\n dones2.push(out.otherRoot);\n }\n let result = target.set(key, value);\n trigger('CREATED', target, receiver, receiver.get(key), key + '', dones);\n trigger('UPDATED', target, receiver, target.size, \"size\", dones2);\n return result;\n };\n }\n }\n else if (prop == \"clear\") {\n if (target.__isProxy) {\n result = () => {\n return target.clear();\n };\n }\n else {\n result = () => {\n let keys = target.keys();\n for (let key of keys) {\n let oldValue = receiver.get(key);\n target.delete(key);\n trigger('DELETED', target, receiver, oldValue, key);\n trigger('UPDATED', target, receiver, target.size, \"size\");\n }\n };\n }\n }\n else if (prop == \"delete\") {\n if (target.__isProxy) {\n result = (key) => {\n return target.delete(key);\n };\n }\n else {\n result = (key) => {\n key = Watcher.extract(key);\n let oldValue = receiver.get(key);\n let res = target.delete(key);\n trigger('DELETED', target, receiver, oldValue, key + '');\n trigger('UPDATED', target, receiver, target.size, \"size\");\n return res;\n };\n }\n }\n else {\n result = element.bind(target);\n }\n return result;\n }\n return element.bind(target);\n }\n if (element instanceof Computed) {\n return element.value;\n }\n if (Watcher._registering.length > 0) {\n let currentPath;\n let fullPath;\n let isArray = Array.isArray(receiver);\n if (isArray && /^[0-9]*$/g.exec(prop)) {\n fullPath = receiver.__path + \"[\" + prop + \"]\";\n currentPath = \"[\" + prop + \"]\";\n }\n else {\n fullPath = receiver.__path ? receiver.__path + '.' + prop : prop;\n currentPath = prop;\n }\n Watcher._register?.register(receiver, currentPath, Watcher._register.version, fullPath);\n }\n if (typeof (element) == 'object') {\n return this.getProxyObject(target, element, prop);\n }\n return Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n },\n set(target, prop, value, receiver) {\n if (typeof prop == 'symbol') {\n if (Watcher.isNative(target))\n return Reflect.set(target, prop, value);\n return Reflect.set(target, prop, value, receiver);\n }\n let oldValue = Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n value = replaceByAlias(target, value, prop, receiver, true);\n if (value instanceof Signal) {\n value = value.value;\n }\n let triggerChange = false;\n if (!reservedName[prop]) {\n if (Array.isArray(receiver)) {\n if (prop != \"length\") {\n triggerChange = true;\n }\n }\n else {\n if (!compareObject(value, oldValue)) {\n triggerChange = true;\n }\n }\n if (Watcher.__triggerForced) {\n triggerChange = true;\n }\n }\n let result = Watcher.isNative(target) ? Reflect.set(target, prop, value) : Reflect.set(target, prop, value, receiver);\n if (triggerChange) {\n let index = this.avoidUpdate.indexOf(prop);\n if (index == -1) {\n let dones = this.injectedDones ?? [];\n this.injectedDones = null;\n trigger('UPDATED', target, receiver, value, prop, dones);\n }\n else {\n this.avoidUpdate.splice(index, 1);\n }\n }\n return result;\n },\n deleteProperty(target, prop) {\n if (typeof prop == 'symbol') {\n return Reflect.deleteProperty(target, prop);\n }\n let triggerChange = false;\n let pathToDelete = '';\n if (!reservedName[prop]) {\n if (Array.isArray(target)) {\n if (prop != \"length\") {\n if (target.__path) {\n pathToDelete = target.__path;\n }\n pathToDelete += \"[\" + prop + \"]\";\n triggerChange = true;\n }\n }\n else {\n if (target.__path) {\n pathToDelete = target.__path + '.';\n }\n pathToDelete += prop;\n triggerChange = true;\n }\n }\n if (internalAliases[pathToDelete]) {\n internalAliases[pathToDelete].unbind();\n }\n if (target.hasOwnProperty(prop)) {\n let oldValue = target[prop];\n if (oldValue instanceof Effect || oldValue instanceof Signal) {\n oldValue.destroy();\n }\n delete target[prop];\n if (triggerChange) {\n clearReservedNames(oldValue);\n trigger('DELETED', target, null, oldValue, prop);\n }\n return true;\n }\n return false;\n },\n defineProperty(target, prop, descriptor) {\n if (typeof prop == 'symbol') {\n return Reflect.defineProperty(target, prop, descriptor);\n }\n let triggerChange = false;\n let newPath = '';\n if (!reservedName[prop]) {\n if (Array.isArray(target)) {\n if (prop != \"length\") {\n if (target.__path) {\n newPath = target.__path;\n }\n newPath += \"[\" + prop + \"]\";\n if (!target.hasOwnProperty(prop)) {\n triggerChange = true;\n }\n }\n }\n else {\n if (target.__path) {\n newPath = target.__path + '.';\n }\n newPath += prop;\n if (!target.hasOwnProperty(prop)) {\n triggerChange = true;\n }\n }\n }\n let result = Reflect.defineProperty(target, prop, descriptor);\n if (triggerChange) {\n this.avoidUpdate.push(prop);\n let proxyEl = this.getProxyObject(target, descriptor.value, prop);\n target[prop] = proxyEl;\n trigger('CREATED', target, null, proxyEl, prop);\n }\n return result;\n },\n ownKeys(target) {\n let result = Reflect.ownKeys(target);\n for (let i = 0; i < result.length; i++) {\n let key = result[i];\n if (typeof key == 'string') {\n if (reservedName[key]) {\n result.splice(i, 1);\n i--;\n }\n }\n }\n return result;\n },\n };\n if (onDataChanged) {\n proxyData.callbacks[''] = [onDataChanged];\n }\n const trigger = (type, target, receiver, value, prop, dones = []) => {\n if (dones.includes(proxyData.baseData)) {\n return;\n }\n if (target.__isProxy) {\n return;\n }\n let rootPath;\n if (receiver == null) {\n rootPath = target.__path;\n }\n else {\n rootPath = receiver.__path;\n }\n if (rootPath != \"\") {\n if (Array.isArray(receiver)) {\n if (prop && !prop.startsWith(\"[\")) {\n if (/^[0-9]*$/g.exec(prop)) {\n rootPath += \"[\" + prop + \"]\";\n }\n else {\n rootPath += \".\" + prop;\n }\n }\n else {\n rootPath += prop;\n }\n }\n else {\n if (prop && !prop.startsWith(\"[\")) {\n rootPath += \".\";\n }\n rootPath += prop;\n }\n }\n else {\n rootPath = prop;\n }\n let stacks = [];\n if (proxyData.useHistory) {\n let allStacks = new Error().stack?.split(\"\\n\") ?? [];\n for (let i = allStacks.length - 1; i >= 0; i--) {\n let current = allStacks[i].trim().replace(\"at \", \"\");\n if (current.startsWith(\"Object.set\") || current.startsWith(\"Proxy.result\")) {\n break;\n }\n stacks.push(current);\n }\n }\n dones.push(proxyData.baseData);\n let aliasesDone = [];\n const callbacks = { ...proxyData.callbacks };\n for (let name in callbacks) {\n callbacks[name] = [...callbacks[name]];\n }\n for (let name in callbacks) {\n // for(let name in proxyData.callbacks) {\n let pathToSend = rootPath;\n if (name !== \"\") {\n let regex = new RegExp(\"^\" + name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex.test(rootPath)) {\n let regex2 = new RegExp(\"^\" + rootPath.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex2.test(name)) {\n continue;\n }\n else {\n pathToSend = \"\";\n }\n }\n else {\n pathToSend = rootPath.replace(regex, \"$2\");\n }\n }\n if (name === \"\" && proxyData.useHistory) {\n proxyData.history.push({\n object: JSON.parse(JSON.stringify(proxyData.baseData, jsonReplacer)),\n trace: stacks.reverse(),\n action: WatchAction[type],\n path: pathToSend\n });\n }\n let cbs = callbacks[name];\n for (let cb of cbs) {\n try {\n cb(WatchAction[type], pathToSend, value, dones);\n }\n catch (e) {\n if (e != 'impossible')\n console.error(e);\n }\n }\n for (let [key, infos] of aliases) {\n if (!dones.includes(key)) {\n for (let info of infos) {\n if (info.name == name) {\n aliasesDone.push(key);\n if (target.__path) {\n let oldPath = target.__path;\n info.fct(type, target, receiver, value, prop, dones);\n target.__path = oldPath;\n }\n else {\n info.fct(type, target, receiver, value, prop, dones);\n }\n }\n }\n }\n }\n }\n for (let [key, infos] of aliases) {\n if (!dones.includes(key) && !aliasesDone.includes(key)) {\n for (let info of infos) {\n let regex = new RegExp(\"^\" + info.name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex.test(rootPath)) {\n continue;\n }\n let newProp = rootPath.replace(info.name, \"\");\n if (newProp.startsWith(\".\")) {\n newProp = newProp.slice(1);\n }\n if (target.__path) {\n let oldPath = target.__path;\n info.fct(type, target, receiver, value, newProp, dones);\n target.__path = oldPath;\n }\n else {\n info.fct(type, target, receiver, value, newProp, dones);\n }\n }\n }\n }\n };\n var realProxy = new Proxy(obj, proxyData);\n proxyData.baseData = obj;\n setProxyPath(realProxy, '');\n return realProxy;\n }\n static is(obj) {\n return typeof obj == 'object' && obj.__isProxy;\n }\n static extract(obj, clearPath = false) {\n if (this.is(obj)) {\n return obj.getTarget(clearPath);\n }\n else {\n if (obj instanceof Object) {\n for (let key in this.__reservedName) {\n delete obj[key];\n }\n }\n }\n return obj;\n }\n static trigger(type, target) {\n if (this.is(target)) {\n target.__static_trigger(type);\n }\n }\n /**\n * Create a computed variable that will watch any changes\n */\n static computed(fct) {\n const comp = new Computed(fct);\n return comp;\n }\n /**\n * Create an effect variable that will watch any changes\n */\n static effect(fct) {\n const comp = new Effect(fct);\n return comp;\n }\n /**\n * Create an effect variable that will watch any changes inside the fct and trigger the cb on change\n */\n static watch(fct, cb) {\n const comp = new Effect(fct);\n comp.subscribe(cb);\n return comp;\n }\n /**\n * Create a signal variable\n */\n static signal(item, onChange) {\n return new Signal(item, onChange);\n }\n}\nWatcher.Namespace=`Aventus`;\n__as1(_, 'Watcher', Watcher);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":true},{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.WatcherFunctionInternal","isStrong":false},{"fullName":"ProxyData","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.Signal","isStrong":false},{"fullName":"Aventus.compareObject","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.IsNotVoid","isStrong":false}],"fullName":"Aventus.Watcher","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ComputedNoRecomputed=class ComputedNoRecomputed extends Computed {\n init() {\n this.isInit = true;\n Watcher._registering.push(this);\n this._value = this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n }\n computedValue() {\n if (this.isInit)\n this._value = this.fct();\n else\n this.init();\n }\n run() { }\n}\nComputedNoRecomputed.Namespace=`Aventus`;\n__as1(_, 'ComputedNoRecomputed', ComputedNoRecomputed);\n","dependencies":[{"fullName":"Aventus.Computed","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.ComputedNoRecomputed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let EffectNoRecomputed=class EffectNoRecomputed extends Effect {\n init() {\n this.isInit = true;\n Watcher._registering.push(this);\n this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n }\n run() {\n if (!this.isInit) {\n this.init();\n }\n }\n}\nEffectNoRecomputed.Namespace=`Aventus`;\n__as1(_, 'EffectNoRecomputed', EffectNoRecomputed);\n","dependencies":[{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.EffectNoRecomputed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRouter=class HttpRouter {\n static options;\n static configure(options) {\n this.options = options;\n }\n options;\n constructor() {\n this.options = this.defineOptions(this.defaultOptionsValue());\n }\n defaultOptionsValue() {\n return HttpRouter.options ?? {\n url: location.protocol + \"//\" + location.host\n };\n }\n defineOptions(options) {\n return options;\n }\n async get(url) {\n return await new HttpRequest(url).queryJSON(this);\n }\n async post(url, data) {\n return await new HttpRequest(url, HttpMethod.POST, data).queryJSON(this);\n }\n async put(url, data) {\n return await new HttpRequest(url, HttpMethod.PUT, data).queryJSON(this);\n }\n async delete(url, data) {\n return await new HttpRequest(url, HttpMethod.DELETE, data).queryJSON(this);\n }\n async option(url, data) {\n return await new HttpRequest(url, HttpMethod.OPTION, data).queryJSON(this);\n }\n}\nHttpRouter.Namespace=`Aventus`;\n__as1(_, 'HttpRouter', HttpRouter);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouterOptions","isStrong":true},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false}],"fullName":"Aventus.HttpRouter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRoute=class HttpRoute {\n router;\n constructor(router) {\n this.router = router ?? new HttpRouter();\n }\n getPrefix() {\n return \"\";\n }\n}\nHttpRoute.Namespace=`Aventus`;\n__as1(_, 'HttpRoute', HttpRoute);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}],"fullName":"Aventus.HttpRoute","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRequest=class HttpRequest {\n static options;\n static configure(options) {\n this.options = options;\n }\n request;\n url;\n methodSpoofing = false;\n useCache = false;\n constructor(url, method = HttpMethod.GET, body, methodSpoofing = false, useCache = false) {\n this.url = url;\n this.request = {};\n this.methodSpoofing = methodSpoofing;\n this.useCache = useCache;\n this.setMethod(method);\n this.prepareBody(body);\n }\n setUrl(url) {\n this.url = url;\n }\n toString() {\n return this.url + \" : \" + JSON.stringify(this.request);\n }\n setBody(body) {\n this.prepareBody(body);\n }\n setMethod(method) {\n this.request.method = method;\n }\n /**\n * Replace method Put/Delete by _method:\"put\" inside a form\n */\n enableMethodSpoofing() {\n this.methodSpoofing = true;\n }\n enableCache() {\n this.useCache = true;\n }\n disableCache() {\n this.useCache = false;\n }\n objectToFormData(obj, formData, parentKey) {\n formData = formData || new FormData();\n let byPass = obj;\n if (byPass.__isProxy) {\n obj = byPass.getTarget();\n }\n const keys = obj.toJSON ? Object.keys(obj.toJSON()) : Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n let value = obj[key];\n const newKey = parentKey ? `${parentKey}[${key}]` : key;\n if (value instanceof Date) {\n formData.append(newKey, DateConverter.converter.toString(value));\n }\n else if (typeof value === 'object' &&\n value !== null &&\n !(value instanceof File)) {\n if (Array.isArray(value)) {\n for (let j = 0; j < value.length; j++) {\n const arrayKey = `${newKey}[${j}]`;\n this.objectToFormData({ [arrayKey]: value[j] }, formData);\n }\n }\n else {\n this.objectToFormData(value, formData, newKey);\n }\n }\n else {\n if (value === undefined || value === null) {\n value = \"\";\n }\n else if (Watcher.is(value)) {\n value = Watcher.extract(value);\n }\n formData.append(newKey, value);\n }\n }\n return formData;\n }\n jsonReplacer(key, value) {\n const t = this;\n if (t[key] instanceof Date) {\n return DateConverter.converter.toString(t[key]);\n }\n return value;\n }\n prepareBody(data) {\n if (!data) {\n return;\n }\n else if (data instanceof FormData) {\n this.request.body = data;\n }\n else {\n let useFormData = false;\n const analyseFormData = (obj) => {\n for (let key in obj) {\n if (obj[key] instanceof File) {\n useFormData = true;\n break;\n }\n else if (Array.isArray(obj[key]) && obj[key].length > 0 && obj[key][0] instanceof File) {\n useFormData = true;\n break;\n }\n else if (typeof obj[key] == 'object' && !Array.isArray(obj[key]) && !(obj[key] instanceof Date)) {\n analyseFormData(obj[key]);\n if (useFormData) {\n break;\n }\n }\n }\n };\n analyseFormData(data);\n if (useFormData) {\n this.request.body = this.objectToFormData(data);\n }\n else {\n this.request.body = JSON.stringify(data, this.jsonReplacer);\n this.setHeader(\"Content-Type\", \"Application/json\");\n }\n }\n if (this.methodSpoofing) {\n if (this.request.method?.toUpperCase() == Aventus.HttpMethod.PUT) {\n if (this.request.body instanceof FormData) {\n this.request.body.append(\"_method\", Aventus.HttpMethod.PUT);\n this.request.method = Aventus.HttpMethod.POST;\n }\n }\n else if (this.request.method?.toUpperCase() == Aventus.HttpMethod.DELETE) {\n if (this.request.body instanceof FormData) {\n this.request.body.append(\"_method\", Aventus.HttpMethod.DELETE);\n this.request.method = Aventus.HttpMethod.POST;\n }\n }\n }\n }\n setHeader(name, value) {\n if (!this.request.headers) {\n this.request.headers = [];\n }\n this.request.headers.push([name, value]);\n }\n setCredentials(credentials) {\n this.request.credentials = credentials;\n }\n async _query(router) {\n let result = new ResultWithError();\n try {\n const isFull = this.url.match(\"https?://\");\n if (!this.url.startsWith(\"/\") && !isFull) {\n this.url = \"/\" + this.url;\n }\n if (HttpRequest.options?.beforeSend) {\n const beforeSendResult = await HttpRequest.options.beforeSend(this);\n result.errors = beforeSendResult.errors;\n }\n const fullUrl = isFull ? this.url : router ? router.options.url + this.url : this.url;\n if (this.useCache) {\n result.result = await HttpCache.fetch(fullUrl, this.request);\n }\n else {\n let response = await fetch(fullUrl, this.request);\n result.result = new HttpResponse(response);\n }\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async query(router) {\n let result = await this._query(router);\n if (HttpRequest.options?.responseMiddleware) {\n result = await HttpRequest.options.responseMiddleware(result, this);\n }\n return result;\n }\n async queryVoid(router) {\n let resultTemp = await this.query(router);\n let result = new VoidWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n if (resultTemp.result.status != 204) {\n let tempResult = await resultTemp.result.json();\n if (tempResult instanceof VoidWithError) {\n for (let error of tempResult.errors) {\n result.errors.push(error);\n }\n }\n }\n }\n catch (e) {\n }\n return result;\n }\n async queryJSON(router) {\n this.setHeader(\"Accept\", \"application/json\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n let tempResult = await resultTemp.result.json();\n if (tempResult instanceof VoidWithError) {\n for (let error of tempResult.errors) {\n result.errors.push(error);\n }\n if (tempResult instanceof ResultWithError) {\n result.result = tempResult.result;\n }\n }\n else {\n result.result = tempResult;\n }\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async queryTxt(router) {\n this.setHeader(\"Accept\", \"text/plain\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n result.result = await resultTemp.result.text();\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async queryBlob(router) {\n this.setHeader(\"Accept\", \"application/octet-stream\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n result.result = await resultTemp.result.blob();\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n clearCache(router) {\n const isFull = this.url.match(\"https?://\");\n if (!this.url.startsWith(\"/\") && !isFull) {\n this.url = \"/\" + this.url;\n }\n const fullUrl = isFull ? this.url : router ? router.options.url + this.url : this.url;\n HttpCache.clear(fullUrl, this.request);\n }\n}\nHttpRequest.Namespace=`Aventus`;\n__as1(_, 'HttpRequest', HttpRequest);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRequestOptions","isStrong":true},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpResponse","isStrong":false},{"fullName":"Aventus.HttpCache","isStrong":false},{"fullName":"Aventus.HttpError","isStrong":false},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.HttpRequest","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let StorableRoute=class StorableRoute extends HttpRoute {\n async GetAll() {\n const request = new HttpRequest(`/${this.StorableName()}`, HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Create(body) {\n const request = new HttpRequest(`/${this.StorableName()}`, HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async GetById(id) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Update(id, body) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.PUT);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async Delete(id) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.DELETE);\n return await request.queryJSON(this.router);\n }\n}\nStorableRoute.Namespace=`Aventus`;\n__as1(_, 'StorableRoute', StorableRoute);\n","dependencies":[{"fullName":"Aventus.HttpRoute","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"TypeResult","isStrong":false}],"fullName":"Aventus.StorableRoute","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Animation=class Animation {\n /**\n * Default FPS for all Animation if not set inside options\n */\n static FPS_DEFAULT = 60;\n options;\n nextFrame = 0;\n fpsInterval;\n continueAnimation = false;\n frame_id = 0;\n constructor(options) {\n if (!options.animate) {\n options.animate = () => { };\n }\n if (!options.stopped) {\n options.stopped = () => { };\n }\n if (!options.fps) {\n options.fps = Animation.FPS_DEFAULT;\n }\n this.options = options;\n this.fpsInterval = 1000 / options.fps;\n }\n animate() {\n let now = window.performance.now();\n let elapsed = now - this.nextFrame;\n if (elapsed <= this.fpsInterval) {\n this.frame_id = requestAnimationFrame(() => this.animate());\n return;\n }\n this.nextFrame = now - (elapsed % this.fpsInterval);\n setTimeout(() => {\n this.options.animate();\n }, 0);\n if (this.continueAnimation) {\n this.frame_id = requestAnimationFrame(() => this.animate());\n }\n else {\n this.options.stopped();\n }\n }\n /**\n * Start the of animation\n */\n start() {\n if (this.continueAnimation == false) {\n this.continueAnimation = true;\n this.nextFrame = window.performance.now();\n this.animate();\n }\n }\n /**\n * Stop the animation\n */\n stop() {\n this.continueAnimation = false;\n }\n /**\n * Stop the animation\n */\n immediateStop() {\n cancelAnimationFrame(this.frame_id);\n this.continueAnimation = false;\n this.options.stopped();\n }\n /**\n * Get the FPS\n */\n getFPS() {\n return this.options.fps;\n }\n /**\n * Set the FPS\n */\n setFPS(fps) {\n this.options.fps = fps;\n this.fpsInterval = 1000 / this.options.fps;\n }\n /**\n * Get the animation status (true if animation is running)\n */\n isStarted() {\n return this.continueAnimation;\n }\n}\nAnimation.Namespace=`Aventus`;\n__as1(_, 'Animation', Animation);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false},{"fullName":"Aventus.AnimationOptions","isStrong":false}],"fullName":"Aventus.Animation","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let PressManager=class PressManager {\n static globalConfig = {\n delayDblPress: 250,\n delayLongPress: 700,\n offsetDrag: 20\n };\n static configure(options) {\n this.globalConfig = options;\n }\n static create(options) {\n if (Array.isArray(options.element)) {\n let result = [];\n for (let el of options.element) {\n let cloneOpt = { ...options };\n cloneOpt.element = el;\n result.push(new PressManager(cloneOpt));\n }\n return result;\n }\n else {\n return new PressManager(options);\n }\n }\n static onEvent = new Callback();\n options;\n element;\n delayDblPress;\n delayLongPress;\n nbPress = 0;\n offsetDrag;\n dragDirection;\n state = {\n oneActionTriggered: null,\n };\n startPosition = { x: 0, y: 0 };\n customFcts = {};\n timeoutDblPress = 0;\n timeoutLongPress = 0;\n downEventSaved;\n useDblPress = false;\n stopPropagation = () => true;\n pointersRecord = {};\n functionsBinded = {\n downAction: (e) => { },\n downActionDelay: (e) => { },\n upAction: (e) => { },\n moveAction: (e) => { },\n childPressStart: (e) => { },\n childPressEnd: (e) => { },\n childPressMove: (e) => { }\n };\n /**\n * @param {*} options - The options\n * @param {HTMLElement | HTMLElement[]} options.element - The element to manage\n */\n constructor(options) {\n if (options.element === void 0) {\n throw 'You must provide an element';\n }\n this.offsetDrag = PressManager.globalConfig.offsetDrag !== undefined ? PressManager.globalConfig.offsetDrag : 20;\n this.dragDirection = 'XY';\n this.delayLongPress = PressManager.globalConfig.delayLongPress ?? 700;\n this.delayDblPress = PressManager.globalConfig.delayDblPress ?? 150;\n this.element = options.element;\n this.checkDragConstraint(options);\n this.assignValueOption(options);\n this.options = options;\n this.init();\n }\n /**\n * Get the current element focused by the PressManager\n */\n getElement() {\n return this.element;\n }\n checkDragConstraint(options) {\n if (options.onDrag !== void 0) {\n if (options.onDragStart === void 0) {\n options.onDragStart = (e) => { };\n }\n if (options.onDragEnd === void 0) {\n options.onDragEnd = (e) => { };\n }\n }\n if (options.onDragStart !== void 0) {\n if (options.onDrag === void 0) {\n options.onDrag = (e) => { };\n }\n if (options.onDragEnd === void 0) {\n options.onDragEnd = (e) => { };\n }\n }\n if (options.onDragEnd !== void 0) {\n if (options.onDragStart === void 0) {\n options.onDragStart = (e) => { };\n }\n if (options.onDrag === void 0) {\n options.onDrag = (e) => { };\n }\n }\n }\n assignValueOption(options) {\n if (PressManager.globalConfig.delayDblPress !== undefined) {\n this.delayDblPress = PressManager.globalConfig.delayDblPress;\n }\n if (options.delayDblPress !== undefined) {\n this.delayDblPress = options.delayDblPress;\n }\n if (PressManager.globalConfig.delayLongPress !== undefined) {\n this.delayLongPress = PressManager.globalConfig.delayLongPress;\n }\n if (options.delayLongPress !== undefined) {\n this.delayLongPress = options.delayLongPress;\n }\n if (PressManager.globalConfig.offsetDrag !== undefined) {\n this.offsetDrag = PressManager.globalConfig.offsetDrag;\n }\n if (options.offsetDrag !== undefined) {\n this.offsetDrag = options.offsetDrag;\n }\n if (options.dragDirection !== undefined) {\n this.dragDirection = options.dragDirection;\n }\n if (options.onDblPress !== undefined) {\n this.useDblPress = true;\n }\n if (PressManager.globalConfig.forceDblPress !== undefined) {\n this.useDblPress = PressManager.globalConfig.forceDblPress;\n }\n if (options.forceDblPress !== undefined) {\n this.useDblPress = options.forceDblPress;\n }\n if (typeof PressManager.globalConfig.stopPropagation == 'function') {\n this.stopPropagation = PressManager.globalConfig.stopPropagation;\n }\n else if (options.stopPropagation === false) {\n this.stopPropagation = () => false;\n }\n if (typeof options.stopPropagation == 'function') {\n this.stopPropagation = options.stopPropagation;\n }\n else if (options.stopPropagation === false) {\n this.stopPropagation = () => false;\n }\n if (!options.buttonAllowed)\n options.buttonAllowed = PressManager.globalConfig.buttonAllowed;\n if (!options.buttonAllowed)\n options.buttonAllowed = [0];\n if (!options.onEvent)\n options.onEvent = PressManager.globalConfig.onEvent;\n }\n bindAllFunction() {\n this.functionsBinded.downAction = this.downAction.bind(this);\n this.functionsBinded.downActionDelay = this.downActionDelay.bind(this);\n this.functionsBinded.moveAction = this.moveAction.bind(this);\n this.functionsBinded.upAction = this.upAction.bind(this);\n this.functionsBinded.childPressStart = this.childPressStart.bind(this);\n this.functionsBinded.childPressEnd = this.childPressEnd.bind(this);\n this.functionsBinded.childPressMove = this.childPressMove.bind(this);\n }\n init() {\n this.bindAllFunction();\n this.element.addEventListener(\"pointerdown\", this.functionsBinded.downAction);\n this.element.addEventListener(\"touchstart\", this.functionsBinded.downActionDelay);\n this.element.addEventListener(\"trigger_pointer_pressstart\", this.functionsBinded.childPressStart);\n this.element.addEventListener(\"trigger_pointer_pressend\", this.functionsBinded.childPressEnd);\n this.element.addEventListener(\"trigger_pointer_pressmove\", this.functionsBinded.childPressMove);\n }\n identifyEvent(touch) {\n if ('Touch' in window && touch instanceof Touch)\n return touch.identifier;\n return touch.pointerId;\n }\n registerEvent(ev) {\n if ('TouchEvent' in window && ev instanceof TouchEvent) {\n for (let touch of ev.targetTouches) {\n const id = this.identifyEvent(touch);\n if (this.pointersRecord[id]) {\n return false;\n }\n this.pointersRecord[id] = ev;\n }\n return true;\n }\n else {\n const id = this.identifyEvent(ev);\n if (this.pointersRecord[id]) {\n return false;\n }\n this.pointersRecord[id] = ev;\n return true;\n }\n }\n unregisterEvent(ev) {\n let result = true;\n if ('TouchEvent' in window && ev instanceof TouchEvent) {\n for (let touch of ev.changedTouches) {\n const id = this.identifyEvent(touch);\n if (!this.pointersRecord[id]) {\n result = false;\n }\n else {\n delete this.pointersRecord[id];\n }\n }\n }\n else {\n const id = this.identifyEvent(ev);\n if (!this.pointersRecord[id]) {\n result = false;\n }\n else {\n delete this.pointersRecord[id];\n }\n }\n return result;\n }\n genericDownAction(state, e) {\n this.downEventSaved = e;\n this.startPosition = { x: e.pageX, y: e.pageY };\n if (this.options.onLongPress) {\n this.timeoutLongPress = setTimeout(() => {\n if (!state.oneActionTriggered) {\n if (this.options.onLongPress) {\n if (this.options.onLongPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }, this.delayLongPress);\n }\n }\n pointerEventTriggered = false;\n downActionDelay(_ev) {\n const ev = _ev;\n if (!this.pointerEventTriggered) {\n this.downAction(ev);\n }\n else {\n ev.stopImmediatePropagation();\n }\n setTimeout(() => {\n this.pointerEventTriggered = false;\n }, 0);\n }\n downAction(_ev) {\n const ev = _ev;\n this.pointerEventTriggered = true;\n const isFirst = Object.values(this.pointersRecord).length == 0;\n if (!this.registerEvent(ev)) {\n if (this.stopPropagation()) {\n ev.stopImmediatePropagation();\n }\n return;\n }\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (e.button != undefined && !this.options.buttonAllowed?.includes(e.button)) {\n this.unregisterEvent(ev);\n return;\n }\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n this.customFcts = {};\n if (this.nbPress == 0 && isFirst) {\n this.state.oneActionTriggered = null;\n clearTimeout(this.timeoutDblPress);\n }\n if (isFirst) {\n document.addEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.addEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.addEventListener(\"touchend\", this.functionsBinded.upAction);\n document.addEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.addEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n this.genericDownAction(this.state, e);\n if (this.options.onPressStart) {\n this.options.onPressStart(e, this);\n this.lastEmitEvent = e;\n // this.emitTriggerFunctionParent(\"pressstart\", e);\n }\n this.emitTriggerFunction(\"pressstart\", e);\n }\n genericUpAction(state, e) {\n clearTimeout(this.timeoutLongPress);\n if (state.oneActionTriggered == this) {\n if (this.options.onDragEnd) {\n this.options.onDragEnd(e, this);\n }\n else if (this.customFcts.src && this.customFcts.onDragEnd) {\n this.customFcts.onDragEnd(e, this.customFcts.src);\n }\n }\n else {\n if (this.useDblPress) {\n this.nbPress++;\n if (this.nbPress == 2) {\n if (!state.oneActionTriggered) {\n this.nbPress = 0;\n if (this.options.onDblPress) {\n if (this.options.onDblPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n else if (this.nbPress == 1) {\n this.timeoutDblPress = setTimeout(() => {\n this.nbPress = 0;\n if (!state.oneActionTriggered) {\n if (this.options.onPress) {\n if (this.options.onPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }, this.delayDblPress);\n }\n }\n else {\n if (!state.oneActionTriggered) {\n if (this.options.onPress) {\n if (this.options.onPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n }\n }\n upAction(_ev) {\n const ev = _ev;\n if (!this.unregisterEvent(ev)) {\n if (this.stopPropagation()) {\n ev.stopImmediatePropagation();\n }\n return;\n }\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n if (Object.values(this.pointersRecord).length == 0) {\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n this.genericUpAction(this.state, e);\n if (this.options.onPressEnd) {\n this.options.onPressEnd(e, this);\n this.lastEmitEvent = e;\n // this.emitTriggerFunctionParent(\"pressend\", e);\n }\n this.emitTriggerFunction(\"pressend\", e);\n }\n genericMoveAction(state, e) {\n if (!state.oneActionTriggered) {\n let xDist = e.pageX - this.startPosition.x;\n let yDist = e.pageY - this.startPosition.y;\n let distance = 0;\n if (this.dragDirection == 'XY')\n distance = Math.sqrt(xDist * xDist + yDist * yDist);\n else if (this.dragDirection == 'X')\n distance = Math.abs(xDist);\n else\n distance = Math.abs(yDist);\n if (distance > this.offsetDrag && this.downEventSaved) {\n if (this.options.onDragStart) {\n if (this.options.onDragStart(this.downEventSaved, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n else if (state.oneActionTriggered == this) {\n if (this.options.onDrag) {\n this.options.onDrag(e, this);\n }\n else if (this.customFcts.src && this.customFcts.onDrag) {\n this.customFcts.onDrag(e, this.customFcts.src);\n }\n }\n }\n moveAction(_ev) {\n const ev = _ev;\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n this.genericMoveAction(this.state, e);\n this.lastEmitEvent = e;\n // if(this.options.onDrag) {\n // this.emitTriggerFunctionParent(\"pressmove\", e);\n this.emitTriggerFunction(\"pressmove\", e);\n }\n childPressStart(_e) {\n const e = _e;\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericDownAction(e.detail.state, e.detail.realEvent);\n if (this.options.onPressStart) {\n this.options.onPressStart(e.detail.realEvent, this);\n }\n }\n childPressEnd(_e) {\n const e = _e;\n this.unregisterEvent(e.detail.realEvent.event);\n if (Object.values(this.pointersRecord).length == 0) {\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericUpAction(e.detail.state, e.detail.realEvent);\n if (this.options.onPressEnd) {\n this.options.onPressEnd(e.detail.realEvent, this);\n }\n }\n childPressMove(_e) {\n const e = _e;\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericMoveAction(e.detail.state, e.detail.realEvent);\n }\n lastEmitEvent;\n emitTriggerFunction(action, e, el) {\n let ev = new CustomEvent(\"trigger_pointer_\" + action, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n state: this.state,\n customFcts: this.customFcts,\n realEvent: e\n }\n });\n this.lastEmitEvent = e;\n if (!el) {\n el = this.element;\n }\n el.dispatchEvent(ev);\n }\n /**\n * Destroy the Press instance byremoving all events\n */\n destroy() {\n if (this.element) {\n this.element.removeEventListener(\"pointerdown\", this.functionsBinded.downAction);\n this.element.removeEventListener(\"touchstart\", this.functionsBinded.downActionDelay);\n this.element.removeEventListener(\"trigger_pointer_pressstart\", this.functionsBinded.childPressStart);\n this.element.removeEventListener(\"trigger_pointer_pressend\", this.functionsBinded.childPressEnd);\n this.element.removeEventListener(\"trigger_pointer_pressmove\", this.functionsBinded.childPressMove);\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n }\n}\nPressManager.Namespace=`Aventus`;\n__as1(_, 'PressManager', PressManager);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":true},{"fullName":"Aventus.Callback","isStrong":true},{"fullName":"Aventus.NormalizedEvent","isStrong":true},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.InternalPointerEvent","isStrong":false}],"fullName":"Aventus.PressManager","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let DragAndDrop=class DragAndDrop {\n /**\n * Default offset before drag element\n */\n static defaultOffsetDrag = 20;\n pressManager;\n options;\n startCursorPosition = { x: 0, y: 0 };\n startElementPosition = { x: 0, y: 0 };\n isEnable = true;\n draggableElement;\n constructor(options) {\n this.options = this.getDefaultOptions(options.element);\n this.mergeProperties(options);\n this.mergeFunctions(options);\n this.options.elementTrigger.style.touchAction = 'none';\n this.pressManager = new PressManager({\n element: this.options.elementTrigger,\n onPressStart: this.onPressStart.bind(this),\n onPressEnd: this.onPressEnd.bind(this),\n onDragStart: this.onDragStart.bind(this),\n onDrag: this.onDrag.bind(this),\n onDragEnd: this.onDragEnd.bind(this),\n offsetDrag: this.options.offsetDrag,\n dragDirection: this.options.dragDirection,\n stopPropagation: this.options.stopPropagation\n });\n }\n getDefaultOptions(element) {\n return {\n applyDrag: true,\n element: element,\n elementTrigger: element,\n offsetDrag: DragAndDrop.defaultOffsetDrag,\n dragDirection: 'XY',\n shadow: {\n enable: false,\n container: document.body,\n removeOnStop: true,\n transform: () => { },\n delete: (el) => {\n el.remove();\n }\n },\n strict: false,\n targets: [],\n usePercent: false,\n stopPropagation: true,\n useMouseFinalPosition: false,\n useTransform: false,\n isDragEnable: () => true,\n getZoom: () => 1,\n getOffsetX: () => 0,\n getOffsetY: () => 0,\n onPointerDown: (e) => { },\n onPointerUp: (e) => { },\n onStart: (e) => { },\n onMove: (e) => { },\n onStop: (e) => { },\n onDrop: (element, targets) => { },\n correctPosition: (position) => position\n };\n }\n mergeProperties(options) {\n if (options.element === void 0) {\n throw \"You must define the element for the drag&drop\";\n }\n this.options.element = options.element;\n if (options.elementTrigger === void 0) {\n this.options.elementTrigger = this.options.element;\n }\n else {\n this.options.elementTrigger = options.elementTrigger;\n }\n this.defaultMerge(options, \"applyDrag\");\n this.defaultMerge(options, \"offsetDrag\");\n this.defaultMerge(options, \"dragDirection\");\n this.defaultMerge(options, \"strict\");\n this.defaultMerge(options, \"targets\");\n this.defaultMerge(options, \"usePercent\");\n this.defaultMerge(options, \"stopPropagation\");\n this.defaultMerge(options, \"useMouseFinalPosition\");\n this.defaultMerge(options, \"useTransform\");\n if (options.shadow !== void 0) {\n this.options.shadow.enable = options.shadow.enable;\n if (options.shadow.container !== void 0) {\n this.options.shadow.container = options.shadow.container;\n }\n else {\n this.options.shadow.container = document.body;\n }\n if (options.shadow.removeOnStop !== void 0) {\n this.options.shadow.removeOnStop = options.shadow.removeOnStop;\n }\n if (options.shadow.transform !== void 0) {\n this.options.shadow.transform = options.shadow.transform;\n }\n if (options.shadow.delete !== void 0) {\n this.options.shadow.delete = options.shadow.delete;\n }\n }\n }\n mergeFunctions(options) {\n this.defaultMerge(options, \"isDragEnable\");\n this.defaultMerge(options, \"getZoom\");\n this.defaultMerge(options, \"getOffsetX\");\n this.defaultMerge(options, \"getOffsetY\");\n this.defaultMerge(options, \"onPointerDown\");\n this.defaultMerge(options, \"onPointerUp\");\n this.defaultMerge(options, \"onStart\");\n this.defaultMerge(options, \"onMove\");\n this.defaultMerge(options, \"onStop\");\n this.defaultMerge(options, \"onDrop\");\n this.defaultMerge(options, \"correctPosition\");\n }\n defaultMerge(options, name) {\n if (options[name] !== void 0) {\n const opts = this.options;\n opts[name] = options[name];\n }\n }\n positionShadowRelativeToElement = { x: 0, y: 0 };\n onPressStart(e) {\n this.options.onPointerDown(e);\n }\n onPressEnd(e) {\n this.options.onPointerUp(e);\n }\n onDragStart(e) {\n this.isEnable = this.options.isDragEnable();\n if (!this.isEnable) {\n return false;\n }\n let draggableElement = this.options.element;\n this.startCursorPosition = {\n x: e.pageX,\n y: e.pageY\n };\n this.startElementPosition = this.getBoundingBoxRelative(draggableElement);\n if (this.options.shadow.enable) {\n draggableElement = this.options.element.cloneNode(true);\n let elBox = this.options.element.getBoundingClientRect();\n let containerBox = this.options.shadow.container.getBoundingClientRect();\n this.positionShadowRelativeToElement = {\n x: elBox.x - containerBox.x,\n y: elBox.y - containerBox.y\n };\n if (this.options.applyDrag) {\n draggableElement.style.position = \"absolute\";\n draggableElement.style.top = this.positionShadowRelativeToElement.y + this.options.getOffsetY() + 'px';\n draggableElement.style.left = this.positionShadowRelativeToElement.x + this.options.getOffsetX() + 'px';\n this.options.shadow.transform(draggableElement);\n this.options.shadow.container.appendChild(draggableElement);\n }\n }\n this.draggableElement = draggableElement;\n const result = this.options.onStart(e);\n if (result !== false) {\n document.body.style.userSelect = 'none';\n if (window.getSelection) {\n window.getSelection()?.removeAllRanges();\n }\n }\n return result;\n }\n onDrag(e) {\n if (!this.isEnable) {\n return;\n }\n let zoom = this.options.getZoom();\n let diff = {\n x: 0,\n y: 0\n };\n if (this.options.shadow.enable) {\n diff = {\n x: (e.pageX - this.startCursorPosition.x) + this.positionShadowRelativeToElement.x + this.options.getOffsetX(),\n y: (e.pageY - this.startCursorPosition.y) + this.positionShadowRelativeToElement.y + this.options.getOffsetY(),\n };\n }\n else {\n diff = {\n x: (e.pageX - this.startCursorPosition.x) / zoom + this.startElementPosition.x + this.options.getOffsetX(),\n y: (e.pageY - this.startCursorPosition.y) / zoom + this.startElementPosition.y + this.options.getOffsetY()\n };\n }\n let newPos = this.setPosition(diff);\n this.options.onMove(e, newPos);\n }\n onDragEnd(e) {\n if (!this.isEnable) {\n return;\n }\n document.body.style.userSelect = '';\n let targets = this.options.useMouseFinalPosition ? this.getMatchingTargetsWithMousePosition({\n x: e.clientX,\n y: e.clientY\n }) : this.getMatchingTargets();\n let draggableElement = this.draggableElement;\n if (this.options.shadow.enable && this.options.shadow.removeOnStop) {\n this.options.shadow.delete(draggableElement);\n }\n if (targets.length > 0) {\n this.options.onDrop(this.options.element, targets);\n }\n this.options.onStop(e);\n }\n setPosition(position) {\n let draggableElement = this.draggableElement;\n if (this.options.usePercent) {\n let elementParent = this.getOffsetParent(draggableElement);\n if (elementParent instanceof HTMLElement) {\n let percentPosition = {\n x: (position.x / elementParent.offsetWidth) * 100,\n y: (position.y / elementParent.offsetHeight) * 100\n };\n percentPosition = this.options.correctPosition(percentPosition);\n if (this.options.applyDrag) {\n draggableElement.style.left = percentPosition.x + '%';\n draggableElement.style.top = percentPosition.y + '%';\n }\n return percentPosition;\n }\n else {\n console.error(\"Can't find parent. Contact an admin\", draggableElement);\n }\n }\n else {\n position = this.options.correctPosition(position);\n if (this.options.applyDrag) {\n if (this.isLeftTopElement(draggableElement)) {\n draggableElement.style.left = position.x + 'px';\n draggableElement.style.top = position.y + 'px';\n }\n else {\n if (this.options.useTransform) {\n draggableElement.setAttribute(\"transform\", `translate(${position.x},${position.y})`);\n }\n else {\n draggableElement.style.left = position.x + 'px';\n draggableElement.style.top = position.y + 'px';\n }\n }\n }\n }\n return position;\n }\n getTargets() {\n if (typeof this.options.targets == \"function\") {\n return this.options.targets();\n }\n else {\n return this.options.targets;\n }\n }\n /**\n * Get targets within the current element position is matching\n */\n getMatchingTargets() {\n let draggableElement = this.draggableElement;\n let matchingTargets = [];\n let srcTargets = this.getTargets();\n for (let target of srcTargets) {\n let elementCoordinates = this.getBoundingBoxAbsolute(draggableElement);\n let targetCoordinates = this.getBoundingBoxAbsolute(target);\n let offsetX = this.options.getOffsetX();\n let offsetY = this.options.getOffsetY();\n let zoom = this.options.getZoom();\n targetCoordinates.x += offsetX;\n targetCoordinates.y += offsetY;\n targetCoordinates.width *= zoom;\n targetCoordinates.height *= zoom;\n if (this.options.strict) {\n if ((elementCoordinates.x >= targetCoordinates.x && elementCoordinates.x + elementCoordinates.width <= targetCoordinates.x + targetCoordinates.width) &&\n (elementCoordinates.y >= targetCoordinates.y && elementCoordinates.y + elementCoordinates.height <= targetCoordinates.y + targetCoordinates.height)) {\n matchingTargets.push(target);\n }\n }\n else {\n let elementLeft = elementCoordinates.x;\n let elementRight = elementCoordinates.x + elementCoordinates.width;\n let elementTop = elementCoordinates.y;\n let elementBottom = elementCoordinates.y + elementCoordinates.height;\n let targetLeft = targetCoordinates.x;\n let targetRight = targetCoordinates.x + targetCoordinates.width;\n let targetTop = targetCoordinates.y;\n let targetBottom = targetCoordinates.y + targetCoordinates.height;\n if (!(elementRight < targetLeft ||\n elementLeft > targetRight ||\n elementBottom < targetTop ||\n elementTop > targetBottom)) {\n matchingTargets.push(target);\n }\n }\n }\n return matchingTargets;\n }\n /**\n * This function will return the targets that are matching with the mouse position\n * @param mouse The mouse position\n */\n getMatchingTargetsWithMousePosition(mouse) {\n let matchingTargets = [];\n if (this.options.shadow.enable == false || this.options.shadow.container == null) {\n console.warn(\"DragAndDrop : To use useMouseFinalPosition=true, you must enable shadow and set a container\");\n return matchingTargets;\n }\n const container = this.options.shadow.container;\n let xCorrected = mouse.x - container.getBoundingClientRect().left;\n let yCorrected = mouse.y - container.getBoundingClientRect().top;\n for (let target of this.getTargets()) {\n if (this.isLeftTopElement(target)) {\n if (this.matchPosition(target, { x: mouse.x, y: mouse.y })) {\n matchingTargets.push(target);\n }\n }\n else {\n if (this.matchPosition(target, { x: xCorrected, y: yCorrected })) {\n matchingTargets.push(target);\n }\n }\n }\n return matchingTargets;\n }\n matchPosition(element, point) {\n let elementCoordinates = this.getBoundingBoxAbsolute(element);\n if (point.x >= elementCoordinates.x &&\n point.x <= elementCoordinates.x + elementCoordinates.width &&\n point.y >= elementCoordinates.y &&\n point.y <= elementCoordinates.y + elementCoordinates.height) {\n return true;\n }\n return false;\n }\n /**\n * Get element currently dragging\n */\n getElementDrag() {\n return this.options.element;\n }\n /**\n * Set targets where to drop\n */\n setTargets(targets) {\n this.options.targets = targets;\n }\n /**\n * Set targets where to drop\n */\n setTargetsFct(targets) {\n this.options.targets = targets;\n }\n /**\n * Destroy the current drag&drop instance\n */\n destroy() {\n this.pressManager.destroy();\n }\n isLeftTopElement(element) {\n for (let Type of DragElementLeftTopType) {\n if (element instanceof Type) {\n return true;\n }\n }\n return false;\n }\n isXYElement(element) {\n for (let Type of DragElementXYType) {\n if (element instanceof Type) {\n return true;\n }\n }\n return false;\n }\n getCoordinateFromAttribute(element) {\n if (this.options.useTransform) {\n const transform = element.getAttribute(\"transform\");\n const tvalue = transform?.match(/translate\\(([^,]+),([^,]+)\\)/);\n const x = tvalue ? parseFloat(tvalue[1]) : 0;\n const y = tvalue ? parseFloat(tvalue[2]) : 0;\n return {\n x: x,\n y: y\n };\n }\n return {\n x: parseFloat(element.getAttribute(\"x\")),\n y: parseFloat(element.getAttribute(\"y\"))\n };\n }\n XYElementToRelativeBox(element) {\n let coordinates = this.getCoordinateFromAttribute(element);\n const width = parseFloat(element.getAttribute(\"width\"));\n const height = parseFloat(element.getAttribute(\"height\"));\n return {\n x: coordinates.x,\n y: coordinates.y,\n width: width,\n height: height,\n bottom: coordinates.y + height,\n right: coordinates.x + width,\n top: coordinates.y,\n left: coordinates.x,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n XYElementToAbsoluteBox(element) {\n let coordinates = this.getCoordinateFromAttribute(element);\n const parent = this.getOffsetParent(element);\n if (parent) {\n const box = parent.getBoundingClientRect();\n coordinates = {\n x: coordinates.x + box.x,\n y: coordinates.y + box.y\n };\n }\n const width = parseFloat(element.getAttribute(\"width\"));\n const height = parseFloat(element.getAttribute(\"height\"));\n return {\n x: coordinates.x,\n y: coordinates.y,\n width: width,\n height: height,\n bottom: coordinates.y + height,\n right: coordinates.x + width,\n top: coordinates.y,\n left: coordinates.x,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getBoundingBoxAbsolute(element) {\n if (this.isLeftTopElement(element)) {\n if (element instanceof HTMLElement) {\n const bounds = element.getBoundingClientRect();\n return {\n x: bounds.x,\n y: bounds.y,\n width: bounds.width,\n height: bounds.height,\n bottom: bounds.bottom,\n right: bounds.right,\n top: bounds.top,\n left: bounds.left,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n }\n else if (this.isXYElement(element)) {\n return this.XYElementToAbsoluteBox(element);\n }\n const parent = this.getOffsetParent(element);\n if (parent instanceof HTMLElement) {\n const rect = element.getBoundingClientRect();\n const rectParent = parent.getBoundingClientRect();\n const x = rect.left - rectParent.left;\n const y = rect.top - rectParent.top;\n return {\n x: x,\n y: y,\n width: rect.width,\n height: rect.height,\n bottom: y + rect.height,\n right: x + rect.width,\n left: rect.left - rectParent.left,\n top: rect.top - rectParent.top,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n console.error(\"Element type not supported\");\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n top: 0,\n left: 0,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getBoundingBoxRelative(element) {\n if (this.isLeftTopElement(element)) {\n if (element instanceof HTMLElement) {\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: element.offsetWidth,\n height: element.offsetHeight,\n bottom: element.offsetTop + element.offsetHeight,\n right: element.offsetLeft + element.offsetWidth,\n top: element.offsetTop,\n left: element.offsetLeft,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n }\n else if (this.isXYElement(element)) {\n return this.XYElementToRelativeBox(element);\n }\n const parent = this.getOffsetParent(element);\n if (parent instanceof HTMLElement) {\n const rect = element.getBoundingClientRect();\n const rectParent = parent.getBoundingClientRect();\n const x = rect.left - rectParent.left;\n const y = rect.top - rectParent.top;\n return {\n x: x,\n y: y,\n width: rect.width,\n height: rect.height,\n bottom: y + rect.height,\n right: x + rect.width,\n left: rect.left - rectParent.left,\n top: rect.top - rectParent.top,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n console.error(\"Element type not supported\");\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n top: 0,\n left: 0,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getOffsetParent(element) {\n if (element instanceof HTMLElement) {\n return element.offsetParent;\n }\n let current = element.parentNode;\n while (current) {\n if (current instanceof Element) {\n const style = getComputedStyle(current);\n if (style.position !== 'static') {\n return current;\n }\n }\n if (current instanceof ShadowRoot) {\n current = current.host;\n }\n else {\n current = current.parentNode;\n }\n }\n return null;\n }\n}\nDragAndDrop.Namespace=`Aventus`;\n__as1(_, 'DragAndDrop', DragAndDrop);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsInternal","isStrong":false},{"fullName":"Aventus.Coordinate","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false},{"fullName":"Aventus.DragElementLeftTopType","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementXYType","isStrong":false},{"fullName":"Aventus.AnyElement","isStrong":false}],"fullName":"Aventus.DragAndDrop","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Instance=class Instance {\n static elements = new Map();\n static get(type) {\n let result = this.elements.get(type);\n if (!result) {\n let cst = type.prototype['constructor'];\n result = new cst();\n this.elements.set(type, result);\n }\n return result;\n }\n static set(el) {\n let cst = el.constructor;\n if (this.elements.get(cst)) {\n return false;\n }\n this.elements.set(cst, el);\n return true;\n }\n static destroy(el) {\n let cst = el.constructor;\n return this.elements.delete(cst);\n }\n}\nInstance.Namespace=`Aventus`;\n__as1(_, 'Instance', Instance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.InstanceCst2","isStrong":false},{"fullName":"X","isStrong":false},{"fullName":"Aventus.InstanceCst","isStrong":false}],"fullName":"Aventus.Instance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ResizeObserver=class ResizeObserver {\n callback;\n targets;\n fpsInterval = -1;\n nextFrame;\n entriesChangedEvent;\n willTrigger;\n static resizeObserverClassByObject = {};\n static uniqueInstance;\n static getUniqueInstance() {\n if (!ResizeObserver.uniqueInstance) {\n ResizeObserver.uniqueInstance = new window.ResizeObserver(entries => {\n let allClasses = [];\n for (let j = 0; j < entries.length; j++) {\n let entry = entries[j];\n const target = entry.target;\n let index = target['sourceIndex'];\n if (ResizeObserver.resizeObserverClassByObject[index]) {\n for (let i = 0; i < ResizeObserver.resizeObserverClassByObject[index].length; i++) {\n let classTemp = ResizeObserver.resizeObserverClassByObject[index][i];\n classTemp.entryChanged(entry);\n if (allClasses.indexOf(classTemp) == -1) {\n allClasses.push(classTemp);\n }\n }\n }\n }\n for (let i = 0; i < allClasses.length; i++) {\n allClasses[i].triggerCb();\n }\n });\n }\n return ResizeObserver.uniqueInstance;\n }\n constructor(options) {\n let realOption;\n if (options instanceof Function) {\n realOption = {\n callback: options,\n };\n }\n else {\n realOption = options;\n }\n this.callback = realOption.callback;\n this.targets = [];\n if (!realOption.fps) {\n realOption.fps = 60;\n }\n if (realOption.fps != -1) {\n this.fpsInterval = 1000 / realOption.fps;\n }\n this.nextFrame = 0;\n this.entriesChangedEvent = {};\n this.willTrigger = false;\n }\n /**\n * Observe size changing for the element\n */\n observe(target) {\n const _target = target;\n if (!_target[\"sourceIndex\"]) {\n _target[\"sourceIndex\"] = Math.random().toString(36);\n this.targets.push(_target);\n ResizeObserver.getUniqueInstance().observe(_target);\n }\n if (!ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]]) {\n ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]] = [];\n }\n if (ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]].indexOf(this) == -1) {\n ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]].push(this);\n }\n }\n /**\n * Stop observing size changing for the element\n */\n unobserve(target) {\n const _target = target;\n for (let i = 0; this.targets.length; i++) {\n let tempTarget = this.targets[i];\n if (tempTarget == _target) {\n let position = ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].indexOf(this);\n if (position != -1) {\n ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].splice(position, 1);\n }\n if (ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].length == 0) {\n delete ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']];\n }\n ResizeObserver.getUniqueInstance().unobserve(_target);\n this.targets.splice(i, 1);\n return;\n }\n }\n }\n /**\n * Destroy the resize observer\n */\n disconnect() {\n for (let i = 0; this.targets.length; i++) {\n this.unobserve(this.targets[i]);\n }\n }\n entryChanged(entry) {\n const _target = entry.target;\n let index = _target.sourceIndex;\n this.entriesChangedEvent[index] = entry;\n }\n triggerCb() {\n if (!this.willTrigger) {\n this.willTrigger = true;\n this._triggerCb();\n }\n }\n _triggerCb() {\n let now = window.performance.now();\n let elapsed = now - this.nextFrame;\n if (this.fpsInterval != -1 && elapsed <= this.fpsInterval) {\n requestAnimationFrame(() => {\n this._triggerCb();\n });\n return;\n }\n this.nextFrame = now - (elapsed % this.fpsInterval);\n let changed = Object.values(this.entriesChangedEvent);\n this.entriesChangedEvent = {};\n this.willTrigger = false;\n setTimeout(() => {\n this.callback(changed, ResizeObserver.uniqueInstance);\n }, 0);\n }\n}\nResizeObserver.Namespace=`Aventus`;\n__as1(_, 'ResizeObserver', ResizeObserver);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WindowResizeObserver","isStrong":true},{"fullName":"Aventus.ResizeObserverOptions","isStrong":false}],"fullName":"Aventus.ResizeObserver","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Uri=class Uri {\n static prepare(uri) {\n let params = [];\n let i = 0;\n let regexState = uri.replace(/{.*?}/g, (group, position) => {\n group = group.slice(1, -1);\n let splitted = group.split(\":\");\n let name = splitted[0].trim();\n let type = \"string\";\n let result = \"([^\\\\/]+)\";\n i++;\n if (splitted.length > 1) {\n if (splitted[1].trim() == \"number\") {\n result = \"([0-9]+)\";\n type = \"number\";\n }\n }\n params.push({\n name,\n type,\n position: i\n });\n return result;\n });\n regexState = regexState.replace(/\\*/g, \".*?\").toLowerCase();\n regexState = \"^\" + regexState + '$';\n return {\n regex: new RegExp(regexState),\n params\n };\n }\n static getParams(from, current) {\n if (typeof from == \"string\") {\n from = this.prepare(from);\n }\n let matches = from.regex.exec(current.toLowerCase());\n if (matches) {\n let slugs = {};\n for (let param of from.params) {\n if (param.type == \"number\") {\n slugs[param.name] = Number(matches[param.position]);\n }\n else {\n slugs[param.name] = matches[param.position];\n }\n }\n return slugs;\n }\n return null;\n }\n static isActive(from, current) {\n if (typeof from == \"string\") {\n from = this.prepare(from);\n }\n return from.regex.test(current);\n }\n static normalize(path) {\n const isAbsolute = path.startsWith('/');\n const parts = path.split('/');\n const normalizedParts = [];\n for (let i = 0; i < parts.length; i++) {\n if (parts[i] === '..') {\n normalizedParts.pop();\n }\n else if (parts[i] !== '.' && parts[i] !== '') {\n normalizedParts.push(parts[i]);\n }\n }\n let normalizedPath = normalizedParts.join('/');\n if (isAbsolute) {\n normalizedPath = '/' + normalizedPath;\n }\n return normalizedPath;\n }\n}\nUri.Namespace=`Aventus`;\n__as1(_, 'Uri', Uri);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PreparedUri","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}],"fullName":"Aventus.Uri","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let RamError=class RamError extends GenericError {\n}\nRamError.Namespace=`Aventus`;\nRamError.$schema={...(GenericError?.$schema ?? {}), };\nConverter.register(RamError.Fullname, RamError);\n__as1(_, 'RamError', RamError);\n","dependencies":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.RamError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let VoidRamWithError=class VoidRamWithError extends VoidWithError {\n}\nVoidRamWithError.Namespace=`Aventus`;\nVoidRamWithError.$schema={...(VoidWithError?.$schema ?? {}), };\nConverter.register(VoidRamWithError.Fullname, VoidRamWithError);\n__as1(_, 'VoidRamWithError', VoidRamWithError);\n","dependencies":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.VoidRamWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let ResultRamWithError=class ResultRamWithError extends ResultWithError {\n}\nResultRamWithError.Namespace=`Aventus`;\nResultRamWithError.$schema={...(ResultWithError?.$schema ?? {}), };\nConverter.register(ResultRamWithError.Fullname, ResultRamWithError);\n__as1(_, 'ResultRamWithError', ResultRamWithError);\n","dependencies":[{"fullName":"Aventus.ResultWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.ResultRamWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let GenericRam=class GenericRam {\n static info = new Map([]);\n /**\n * The current namespace\n */\n static Namespace = \"\";\n // public static get Namespace(): string { return \"\"; }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n subscribers = {\n created: [],\n updated: [],\n deleted: [],\n };\n recordsSubscribers = new Map();\n /**\n * List of stored item by index key\n */\n records = new Map();\n actionGuard = new ActionGuard();\n ramMapping = {};\n constructor() {\n if (this.constructor == GenericRam) {\n throw \"can't instanciate an abstract class\";\n }\n // RamManager.check();\n this.getIdWithError = this.getIdWithError.bind(this);\n this.getId = this.getId.bind(this);\n this.save = this.save.bind(this);\n this.saveWithError = this.saveWithError.bind(this);\n this.onCreated = this.onCreated.bind(this);\n this.offCreated = this.offCreated.bind(this);\n this.onUpdated = this.onUpdated.bind(this);\n this.offUpdated = this.offUpdated.bind(this);\n this.onDeleted = this.onDeleted.bind(this);\n this.offDeleted = this.offDeleted.bind(this);\n this.get = this.get.bind(this);\n this.getWithError = this.getWithError.bind(this);\n this.getById = this.getById.bind(this);\n this.getByIdWithError = this.getByIdWithError.bind(this);\n this.getByIds = this.getByIds.bind(this);\n this.getByIdsWithError = this.getByIdsWithError.bind(this);\n this.getAll = this.getAll.bind(this);\n this.getAllWithError = this.getAllWithError.bind(this);\n this.getList = this.getList.bind(this);\n this.getListWithError = this.getListWithError.bind(this);\n this.getRecords = this.getRecords.bind(this);\n this.getRecordsWithError = this.getRecordsWithError.bind(this);\n this.createList = this.createList.bind(this);\n this.createListWithError = this.createListWithError.bind(this);\n this.create = this.create.bind(this);\n this.createWithError = this.createWithError.bind(this);\n this.updateList = this.updateList.bind(this);\n this.updateListWithError = this.updateListWithError.bind(this);\n this.update = this.update.bind(this);\n this.updateWithError = this.updateWithError.bind(this);\n this.deleteList = this.deleteList.bind(this);\n this.deleteListWithError = this.deleteListWithError.bind(this);\n this.delete = this.delete.bind(this);\n this.deleteWithError = this.deleteWithError.bind(this);\n this.deleteById = this.deleteById.bind(this);\n this.deleteByIdWithError = this.deleteByIdWithError.bind(this);\n }\n /**\n * Get item id\n */\n getIdWithError(item) {\n let action = new ResultRamWithError();\n let idTemp = item[this.defineIndexKey()];\n if (idTemp !== undefined) {\n action.result = idTemp;\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noId, \"no key found for item\"));\n }\n return action;\n }\n /**\n * Get item id\n */\n getId(item) {\n let result = this.getIdWithError(item);\n if (result.success) {\n return result.result;\n }\n throw 'no key found for item';\n }\n /**\n * Prevent adding Watch element\n */\n removeWatch(element) {\n let byPass = element;\n if (byPass.__isProxy) {\n return byPass.getTarget();\n }\n return element;\n }\n /**\n * Add function update, onUpdate, offUpdate, delete, onDelete, offDelete\n */\n addRamAction(Base) {\n let that = this;\n return class ActionClass extends Base {\n static get className() {\n return Base.className || Base.name;\n }\n get className() {\n return Base.className || Base.name;\n }\n async update(newData) {\n return (await that.update(newData));\n }\n async updateWithError(newData) {\n return (await that.updateWithError(newData));\n }\n onUpdate(callback) {\n let id = that.getId(this);\n if (!that.recordsSubscribers.has(id)) {\n that.recordsSubscribers.set(id, {\n created: [],\n updated: [],\n deleted: []\n });\n }\n let sub = that.recordsSubscribers.get(id);\n if (sub && !sub.updated.includes(callback)) {\n sub.updated.push(callback);\n }\n }\n offUpdate(callback) {\n let id = that.getId(this);\n let sub = that.recordsSubscribers.get(id);\n if (sub) {\n let index = sub.updated.indexOf(callback);\n if (index != -1) {\n sub.updated.splice(index, 1);\n }\n }\n }\n async delete() {\n let id = that.getId(this);\n await that.deleteById(id);\n }\n async deleteWithError() {\n const result = new VoidRamWithError();\n let queryId = that.getIdWithError(this);\n if (!queryId.success || !queryId.result) {\n result.errors = queryId.errors;\n return result;\n }\n const queryDelete = await that.deleteByIdWithError(queryId.result);\n result.errors = queryDelete.errors;\n return result;\n }\n onDelete(callback) {\n let id = that.getId(this);\n if (!that.recordsSubscribers.has(id)) {\n that.recordsSubscribers.set(id, {\n created: [],\n updated: [],\n deleted: []\n });\n }\n let sub = that.recordsSubscribers.get(id);\n if (sub && !sub.deleted.includes(callback)) {\n sub.deleted.push(callback);\n }\n }\n offDelete(callback) {\n let id = that.getId(this);\n let sub = that.recordsSubscribers.get(id);\n if (sub) {\n let index = sub.deleted.indexOf(callback);\n if (index != -1) {\n sub.deleted.splice(index, 1);\n }\n }\n }\n };\n }\n /**\n * Define all the types you ram is capable of\n */\n ramForTypes() {\n return [this.getTypeForData({})];\n }\n /**\n * Transform the object into the object stored inside Ram\n */\n getObjectForRam(objJson) {\n let Item = this.addRamAction(this.getTypeForData(objJson));\n let item = new Item();\n this.mergeObject(item, objJson);\n return item;\n }\n // onCreated: (item: any) => void;\n // onUpdated: (item: any) => void;\n // onDeleted: (item: any) => void;\n // }> = new Map();\n // private linkInfo: { [key: string | number]: { [id: string | number]: Request[]; }; } = {};\n // private linkRamItem(item: Request) {\n // for(let key in this.ramMapping) {\n // this.linkRamItemByKey(item, key);\n // private linkRamItemByKey(item: Request, key: string) {\n // if(key in item) {\n // if(mapping.asArray) {\n // if(Array.isArray(item[key])) {\n // console.error(key + \" in type \" + item + \" must be an array\");\n // const id = mapping.ram.getId(item[key]);\n // if(!this.linkFct.has(mapping.ram)) {\n // onCreated: (item) => {\n // onUpdated: (item) => {\n // onDeleted: (item) => {\n // this.linkFct.set(mapping.ram, fcts);\n // mapping.ram.onCreated(fcts.onCreated);\n // mapping.ram.onUpdated(fcts.onUpdated);\n // mapping.ram.onDeleted(fcts.onDeleted);\n // if(!this.linkInfo[key])\n // if(!this.linkInfo[key][id])\n // this.linkInfo[key][id].push(item);\n /**\n * Add element inside Ram or update it. The instance inside the ram is unique and ll never be replaced\n */\n async addOrUpdateData(item) {\n const resultTemp = new ResultWithError();\n try {\n const id = resultTemp.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return resultTemp;\n if (this.records.has(id)) {\n let uniqueRecord = this.records.get(id);\n await resultTemp.runAsync(() => this.beforeRecordSet(uniqueRecord));\n // this.unlinkRamItem(uniqueRecord);\n if (resultTemp.success)\n this.mergeObject(uniqueRecord, item);\n await resultTemp.runAsync(() => this.afterRecordSet(uniqueRecord));\n // this.linkRamItem(uniqueRecord);\n resultTemp.result = {\n kind: 'updated',\n value: this.records.get(id)\n };\n }\n else {\n let realObject = this.getObjectForRam(item);\n await resultTemp.runAsync(() => this.beforeRecordSet(realObject));\n this.records.set(id, realObject);\n await resultTemp.runAsync(() => this.afterRecordSet(realObject));\n // this.linkRamItem(realObject);\n resultTemp.result = {\n kind: 'created',\n value: this.records.get(id)\n };\n }\n }\n catch (e) {\n resultTemp.errors.push(new RamError(RamErrorCode.unknow, e));\n }\n return resultTemp;\n }\n /**\n * Merge object and create real instance of class\n */\n mergeObject(item, objJson, options) {\n if (!item) {\n return;\n }\n if (!options) {\n options = {\n replaceUndefined: true\n };\n }\n Json.classFromJson(item, objJson, options);\n }\n /**\n * Create or update the item\n */\n async save(item, ...args) {\n let action = await this.saveWithError(item, ...args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Create or update the item\n */\n async saveWithError(item, ...args) {\n let action = new ResultRamWithError();\n const id = action.extract(() => this.getIdWithError(item));\n if (id !== undefined) {\n if (id) {\n return this.updateWithError(item, ...args);\n }\n else {\n return this.createWithError(item, ...args);\n }\n }\n return action;\n }\n async beforeRecordSet(item) {\n return new VoidWithError();\n }\n async afterRecordSet(item) {\n return new VoidWithError();\n }\n async beforeRecordDelete(item) {\n return new VoidWithError();\n }\n async afterRecordDelete(item) {\n return new VoidWithError();\n }\n publish(type, data) {\n let callbacks = [...this.subscribers[type]];\n for (let callback of callbacks) {\n callback(data);\n }\n let sub = this.recordsSubscribers.get(this.getId(data));\n if (sub) {\n let localCallbacks = [...sub[type]];\n for (let localCallback of localCallbacks) {\n localCallback(data);\n }\n }\n }\n subscribe(type, cb) {\n if (!this.subscribers[type].includes(cb)) {\n this.subscribers[type].push(cb);\n }\n }\n unsubscribe(type, cb) {\n let index = this.subscribers[type].indexOf(cb);\n if (index != -1) {\n this.subscribers[type].splice(index, 1);\n }\n }\n /**\n * Add a callback that ll be triggered when a new item is stored\n */\n onCreated(cb) {\n this.subscribe('created', cb);\n }\n /**\n * Remove a created callback\n */\n offCreated(cb) {\n this.unsubscribe('created', cb);\n }\n /**\n * Add a callback that ll be triggered when an item is updated\n */\n onUpdated(cb) {\n this.subscribe('updated', cb);\n }\n /**\n * Remove an updated callback\n */\n offUpdated(cb) {\n this.unsubscribe('updated', cb);\n }\n /**\n * Add a callback that ll be triggered when an item is deleted\n */\n onDeleted(cb) {\n this.subscribe('deleted', cb);\n }\n /**\n * Remove an deleted callback\n */\n offDeleted(cb) {\n this.unsubscribe('deleted', cb);\n }\n /**\n * Get an item by id if exist (alias for getById)\n */\n async get(id) {\n return await this.getById(id);\n }\n ;\n /**\n * Get an item by id if exist (alias for getById)\n */\n async getWithError(id) {\n return await this.getByIdWithError(id);\n }\n ;\n /**\n * Get an item by id if exist\n */\n async getById(id) {\n let action = await this.getByIdWithError(id);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Get an item by id if exist\n */\n async getByIdWithError(id) {\n return this.actionGuard.run(['getByIdWithError', id], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetById(id));\n if (action.success) {\n if (this.records.has(id)) {\n const item = this.records.get(id);\n action.result = item;\n await action.runAsync(() => this.afterGetById(item));\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't find the item \" + id + \" inside ram\"));\n }\n }\n return action;\n });\n }\n /**\n * Trigger before getting an item by id\n */\n async beforeGetById(id) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting an item by id\n */\n async afterGetById(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get multiple items by ids\n */\n async getByIds(ids) {\n let result = await this.getByIdsWithError(ids);\n if (result.success) {\n return result.result ?? [];\n }\n return [];\n }\n ;\n /**\n * Get multiple items by ids\n */\n async getByIdsWithError(ids) {\n return this.actionGuard.run(['getByIdsWithError', ids], async () => {\n const action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetByIds(ids));\n if (action.success) {\n const result = [];\n for (let id of ids) {\n let rec = this.records.get(id);\n if (rec) {\n result.push(rec);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't find the item \" + id + \" inside ram\"));\n }\n }\n if (action.success) {\n action.result = result;\n await action.runAsync(() => this.afterGetByIds(result));\n }\n }\n return action;\n });\n }\n ;\n /**\n * Trigger before getting a list of items by id\n */\n async beforeGetByIds(ids) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting a list of items by id\n */\n async afterGetByIds(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getAll() {\n let result = await this.getAllWithError();\n if (result.success) {\n return result.result ?? [];\n }\n return [];\n }\n /**\n * Get all elements inside the Ram\n */\n async getAllWithError() {\n return this.actionGuard.run(['getAllWithError'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetAll());\n if (action.success) {\n const result = Object.values(this.records);\n action.result = result;\n await action.runAsync(() => this.afterGetAll(result));\n }\n return action;\n });\n }\n /**\n * Trigger before getting all items inside Ram\n */\n async beforeGetAll() {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting all items inside Ram\n */\n async afterGetAll(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getList() {\n return await this.getAll();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getListWithError() {\n return await this.getAllWithError();\n }\n /**\n * Get all elements inside the Ram\n */\n async getRecords() {\n const result = await this.getRecordsWithError();\n if (result.success) {\n return result.result ?? new Map();\n }\n return new Map();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getRecordsWithError() {\n let action = new ResultRamWithError();\n action.runAsync(() => this.getAllWithError());\n if (action.success) {\n action.result = this.records;\n }\n return action;\n }\n /**\n * Create a list of items inside ram\n */\n async createList(list) {\n let result = await this.createListWithError(list);\n return result.result ?? [];\n }\n /**\n * Create a list of items inside ram\n */\n async createListWithError(list) {\n list = this.removeWatch(list);\n return this.actionGuard.run(['_createList'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeCreateList(list));\n for (let item of list) {\n await action.runAsync(() => this.beforeCreateItem(item, true));\n }\n const resources = await action.extractAsync(() => this.transformCreateRequestListToItem(list));\n if (!resources)\n return action;\n const result = [];\n for (let item of resources) {\n const resultItem = await action.extractAsync(() => this.addOrUpdateData(item));\n if (!resultItem)\n return action;\n await action.runAsync(() => this.afterCreateItem(resultItem.value, true));\n if (action.success) {\n result.push(resultItem.value);\n this.publish('created', resultItem.value);\n }\n }\n action.result = result;\n await action.runAsync(() => this.afterCreateList(result));\n return action;\n });\n }\n /**\n * Create an item inside ram\n */\n async create(item, ...args) {\n let action = await this.createWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Create an item inside ram\n */\n async createWithError(item, ...args) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_create', item], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeCreateItem(item, false));\n const resource = await action.extractAsync(() => this.transformCreateRequestToItem(item));\n if (!resource)\n return action;\n const id = await action.extract(() => this.getIdWithError(resource));\n if (id !== undefined) {\n const resultTemp = await action.extractAsync(() => this.addOrUpdateData(resource));\n if (!resultTemp)\n return action;\n await action.runAsync(() => this.afterCreateItem(resultTemp.value, false));\n if (action.success) {\n action.result = resultTemp.value;\n this.publish('created', resultTemp.value);\n }\n }\n return action;\n });\n }\n /**\n * Trigger before creating a list of items\n */\n async beforeCreateList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before creating an item\n */\n async beforeCreateItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after creating an item\n */\n async afterCreateItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after creating a list of items\n */\n async afterCreateList(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Update a list of items inside ram\n */\n async updateList(list) {\n let result = await this.updateListWithError(list);\n return result.result ?? [];\n }\n ;\n /**\n * Update a list of items inside ram\n */\n async updateListWithError(list) {\n list = this.removeWatch(list);\n return this.actionGuard.run(['_updateList'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeUpdateList(list));\n for (let item of list) {\n await action.runAsync(() => this.beforeUpdateItem(item, true));\n }\n const resources = await action.extractAsync(() => this.transformUpdateRequestListToItem(list));\n if (!resources)\n return action;\n const result = [];\n for (let item of resources) {\n const resultItem = await action.extractAsync(() => this.addOrUpdateData(item));\n if (!resultItem)\n return action;\n await action.runAsync(() => this.afterUpdateItem(resultItem.value, true));\n if (action.success) {\n result.push(resultItem.value);\n this.publish('created', resultItem.value);\n }\n }\n action.result = result;\n await action.runAsync(() => this.afterUpdateList(result));\n return action;\n });\n }\n ;\n /**\n * Update an item inside ram\n */\n async update(item, ...args) {\n let action = await this.updateWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Update an item inside ram\n */\n async updateWithError(item, ...args) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_update', item], async () => {\n let action = new ResultRamWithError();\n const id = await action.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return action;\n if (this.records.has(id)) {\n const currentEl = this.records.get(id);\n if (currentEl == item) {\n console.warn(\"You are updating the same item. You should clone the object first to avoid weird effect\");\n }\n await action.runAsync(() => this.beforeUpdateItem(item, false));\n const resource = await action.extractAsync(() => this.transformUpdateRequestToItem(item));\n if (!resource)\n return action;\n const resultTemp = await action.extractAsync(() => this.addOrUpdateData(resource));\n if (!resultTemp)\n return action;\n await action.runAsync(() => this.afterUpdateItem(resultTemp.value, false));\n if (action.success) {\n action.result = resultTemp.value;\n this.publish('updated', resultTemp.value);\n }\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't update the item \" + id + \" because it wasn't found inside ram\"));\n }\n return action;\n });\n }\n /**\n * Trigger before updating a list of items\n */\n async beforeUpdateList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before updating an item\n */\n async beforeUpdateItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after updating an item\n */\n async afterUpdateItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after updating a list of items\n */\n async afterUpdateList(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Delete a list of items inside ram\n */\n async deleteList(list) {\n let result = await this.deleteListWithError(list);\n return result.result ?? [];\n }\n ;\n /**\n * Delete a list of items inside ram\n */\n async deleteListWithError(list) {\n list = this.removeWatch(list);\n let action = new ResultRamWithError();\n action.result = [];\n await action.runAsync(() => this.beforeDeleteList(list));\n const result = [];\n for (let item of list) {\n const resultItem = await action.extractAsync(() => this._delete(item, true));\n if (!resultItem)\n return action;\n result.push(resultItem);\n }\n if (action.success) {\n action.result = result;\n await action.runAsync(() => this.afterDeleteList(result));\n }\n return action;\n }\n ;\n /**\n * Delete an item inside ram\n */\n async delete(item, ...args) {\n let action = await this.deleteWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n ;\n /**\n * Delete an item inside ram\n */\n async deleteWithError(item, ...args) {\n return await this._delete(item, false);\n }\n ;\n /**\n * Delete an item by id inside ram\n */\n async deleteById(id) {\n let action = await this.deleteByIdWithError(id);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Delete an item by id inside ram\n */\n async deleteByIdWithError(id) {\n let item = this.records.get(id);\n if (item) {\n return await this._delete(item, false);\n }\n let result = new ResultRamWithError();\n result.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n return result;\n }\n async _delete(item, fromList) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_delete', item], async () => {\n let action = new ResultRamWithError();\n const id = action.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return action;\n let oldItem = this.records.get(id);\n if (oldItem) {\n await action.runAsync(() => this.beforeDeleteItem(oldItem, fromList));\n await action.runAsync(() => this.beforeRecordDelete(oldItem));\n this.records.delete(id);\n await action.runAsync(() => this.afterRecordDelete(oldItem));\n await action.runAsync(() => this.afterDeleteItem(oldItem, fromList));\n if (action.success) {\n action.result = oldItem;\n this.publish('deleted', oldItem);\n }\n this.recordsSubscribers.delete(id);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n }\n return action;\n });\n }\n /**\n * Trigger before deleting a list of items\n */\n async beforeDeleteList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before deleting an item\n */\n async beforeDeleteItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after deleting an item\n */\n async afterDeleteItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after deleting a list of items\n */\n async afterDeleteList(result) {\n return new VoidWithError();\n }\n}\nGenericRam.Namespace=`Aventus`;\n__as1(_, 'GenericRam', GenericRam);\n","dependencies":[{"fullName":"Aventus.IRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.Request","isStrong":false},{"fullName":"Aventus.KeysObject","isStrong":false},{"fullName":"Aventus.Resource","isStrong":false},{"fullName":"Aventus.RamSubscribers","isStrong":false},{"fullName":"Aventus.RamItem","isStrong":false},{"fullName":"Aventus.ActionGuard","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"BindThis","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"X","isStrong":false},{"fullName":"B","isStrong":false},{"fullName":"Base","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.JsonFromOptions","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}],"fullName":"Aventus.GenericRam","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Ram=class Ram extends GenericRam {\n}\nRam.Namespace=`Aventus`;\n__as1(_, 'Ram', Ram);\n","dependencies":[{"fullName":"Aventus.GenericRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.Request","isStrong":false},{"fullName":"Aventus.Resource","isStrong":false}],"fullName":"Aventus.Ram","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let StateManager=class StateManager {\n subscribers = {};\n static canBeActivate(statePattern, stateName) {\n let stateInfo = Uri.prepare(statePattern);\n return stateInfo.regex.test(stateName);\n }\n activeState;\n changeStateMutex = new Mutex();\n canChangeStateCbs = [];\n afterStateChanged = new Callback();\n /**\n * Subscribe actions for a state or a state list\n */\n subscribe(statePatterns, callbacks, autoActiveState = true) {\n if (!callbacks.active && !callbacks.inactive && !callbacks.askChange) {\n this._log(`Trying to subscribe to state : ${statePatterns} with no callbacks !`, \"warning\");\n return;\n }\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (!this.subscribers.hasOwnProperty(statePattern)) {\n let res = Uri.prepare(statePattern);\n let isActive = this.activeState !== undefined && res.regex.test(this.activeState.name);\n this.subscribers[statePattern] = {\n \"regex\": res.regex,\n \"params\": res.params,\n \"callbacks\": {\n \"active\": [],\n \"inactive\": [],\n \"askChange\": [],\n },\n \"isActive\": isActive,\n };\n }\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n this.subscribers[statePattern].callbacks.active.push(activeFct);\n if (this.subscribers[statePattern].isActive && this.activeState && autoActiveState) {\n let slugs = Uri.getParams(this.subscribers[statePattern], this.activeState.name);\n if (slugs) {\n activeFct(this.activeState, slugs);\n }\n }\n }\n }\n if (callbacks.inactive) {\n if (!Array.isArray(callbacks.inactive)) {\n callbacks.inactive = [callbacks.inactive];\n }\n for (let inactiveFct of callbacks.inactive) {\n this.subscribers[statePattern].callbacks.inactive.push(inactiveFct);\n }\n }\n if (callbacks.askChange) {\n if (!Array.isArray(callbacks.askChange)) {\n callbacks.askChange = [callbacks.askChange];\n }\n for (let askChangeFct of callbacks.askChange) {\n this.subscribers[statePattern].callbacks.askChange.push(askChangeFct);\n }\n }\n }\n }\n /**\n *\n */\n activateAfterSubscribe(statePatterns, callbacks) {\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n if (this.subscribers[statePattern].isActive && this.activeState) {\n let slugs = Uri.getParams(this.subscribers[statePattern], this.activeState.name);\n if (slugs) {\n activeFct(this.activeState, slugs);\n }\n }\n }\n }\n }\n }\n /**\n * Unsubscribe actions for a state or a state list\n */\n unsubscribe(statePatterns, callbacks) {\n if (!callbacks.active && !callbacks.inactive && !callbacks.askChange) {\n this._log(`Trying to unsubscribe to state : ${statePatterns} with no callbacks !`, \"warning\");\n return;\n }\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (this.subscribers[statePattern]) {\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n let index = this.subscribers[statePattern].callbacks.active.indexOf(activeFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.active.splice(index, 1);\n }\n }\n }\n if (callbacks.inactive) {\n if (!Array.isArray(callbacks.inactive)) {\n callbacks.inactive = [callbacks.inactive];\n }\n for (let inactiveFct of callbacks.inactive) {\n let index = this.subscribers[statePattern].callbacks.inactive.indexOf(inactiveFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.inactive.splice(index, 1);\n }\n }\n }\n if (callbacks.askChange) {\n if (!Array.isArray(callbacks.askChange)) {\n callbacks.askChange = [callbacks.askChange];\n }\n for (let askChangeFct of callbacks.askChange) {\n let index = this.subscribers[statePattern].callbacks.askChange.indexOf(askChangeFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.askChange.splice(index, 1);\n }\n }\n }\n if (this.subscribers[statePattern].callbacks.active.length === 0 &&\n this.subscribers[statePattern].callbacks.inactive.length === 0 &&\n this.subscribers[statePattern].callbacks.askChange.length === 0) {\n delete this.subscribers[statePattern];\n }\n }\n }\n }\n onAfterStateChanged(cb) {\n this.afterStateChanged.add(cb);\n }\n offAfterStateChanged(cb) {\n this.afterStateChanged.remove(cb);\n }\n assignDefaultState(stateName) {\n return new EmptyState(stateName);\n }\n canChangeState(cb) {\n this.canChangeStateCbs.push(cb);\n }\n /**\n * Activate a current state\n */\n async setState(state) {\n let result = await this.changeStateMutex.safeRunLastAsync(async () => {\n let stateToUse;\n if (typeof state == \"string\") {\n stateToUse = this.assignDefaultState(state);\n }\n else {\n stateToUse = state;\n }\n if (!stateToUse) {\n this._log(\"state is undefined\", \"error\");\n this.changeStateMutex.release();\n return false;\n }\n for (let cb of this.canChangeStateCbs) {\n if (!(await cb(stateToUse))) {\n return false;\n }\n }\n let canChange = true;\n if (this.activeState) {\n let activeToInactive = [];\n let inactiveToActive = [];\n let triggerActive = [];\n canChange = await this.activeState.askChange(this.activeState, stateToUse);\n if (canChange) {\n for (let statePattern in this.subscribers) {\n let subscriber = this.subscribers[statePattern];\n if (subscriber.isActive) {\n let clone = [...subscriber.callbacks.askChange];\n let currentSlug = Uri.getParams(subscriber, this.activeState.name);\n if (currentSlug) {\n for (let i = 0; i < clone.length; i++) {\n let askChange = clone[i];\n if (!await askChange(this.activeState, stateToUse, currentSlug)) {\n canChange = false;\n break;\n }\n }\n }\n let slugs = Uri.getParams(subscriber, stateToUse.name);\n if (slugs === null) {\n activeToInactive.push(subscriber);\n }\n else {\n triggerActive.push({\n subscriber: subscriber,\n params: slugs\n });\n }\n }\n else {\n let slugs = Uri.getParams(subscriber, stateToUse.name);\n if (slugs) {\n inactiveToActive.push({\n subscriber,\n params: slugs\n });\n }\n }\n if (!canChange) {\n break;\n }\n }\n }\n if (canChange) {\n const oldState = this.activeState;\n this.activeState = stateToUse;\n oldState.onInactivate(stateToUse);\n for (let subscriber of activeToInactive) {\n subscriber.isActive = false;\n let oldSlug = Uri.getParams(subscriber, oldState.name);\n if (oldSlug) {\n let oldSlugNotNull = oldSlug;\n let callbacks = [...subscriber.callbacks.inactive];\n for (let callback of callbacks) {\n callback(oldState, stateToUse, oldSlugNotNull);\n }\n }\n }\n for (let trigger of triggerActive) {\n let callbacks = [...trigger.subscriber.callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, trigger.params);\n }\n }\n for (let trigger of inactiveToActive) {\n trigger.subscriber.isActive = true;\n let callbacks = [...trigger.subscriber.callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, trigger.params);\n }\n }\n stateToUse.onActivate();\n }\n }\n else {\n this.activeState = stateToUse;\n for (let key in this.subscribers) {\n let slugs = Uri.getParams(this.subscribers[key], stateToUse.name);\n if (slugs) {\n let slugsNotNull = slugs;\n this.subscribers[key].isActive = true;\n let callbacks = [...this.subscribers[key].callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, slugsNotNull);\n }\n }\n }\n stateToUse.onActivate();\n }\n this.afterStateChanged.trigger();\n return true;\n });\n return result ?? false;\n }\n getState() {\n return this.activeState;\n }\n /**\n * Check if a state is in the subscribers and active, return true if it is, false otherwise\n */\n isStateActive(statePattern) {\n return Uri.isActive(statePattern, this.activeState?.name ?? '');\n }\n /**\n * Get slugs information for the current state, return null if state isn't active\n */\n getStateSlugs(statePattern) {\n return Uri.getParams(statePattern, this.activeState?.name ?? '');\n }\n // 0 = error only / 1 = errors and warning / 2 = error, warning and logs (not implemented)\n logLevel() {\n return 0;\n }\n _log(msg, type) {\n if (type === \"error\") {\n console.error(msg);\n }\n else if (type === \"warning\" && this.logLevel() > 0) {\n console.warn(msg);\n }\n else if (type === \"info\" && this.logLevel() > 1) {\n console.log(msg);\n }\n }\n}\nStateManager.Namespace=`Aventus`;\n__as1(_, 'StateManager', StateManager);\n","dependencies":[{"fullName":"Aventus.IStateManager","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Subscriber","isStrong":false},{"fullName":"Aventus.Uri","isStrong":false},{"fullName":"Aventus.Mutex","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.EmptyState","isStrong":false},{"fullName":"Aventus.State","isStrong":false}],"fullName":"Aventus.StateManager","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let State=class State {\n /**\n * Activate a custom state inside a specific manager\n * It ll be a generic state with no information inside exept name\n */\n static async activate(stateName, manager) {\n return await manager.setState(stateName);\n }\n /**\n * Activate this state inside a specific manager\n */\n async activate(manager) {\n return await manager.setState(this);\n }\n onActivate() {\n }\n onInactivate(nextState) {\n }\n async askChange(state, nextState) {\n return true;\n }\n}\nState.Namespace=`Aventus`;\n__as1(_, 'State', State);\n","dependencies":[{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false}],"fullName":"Aventus.State","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let EmptyState=class EmptyState extends State {\n localName;\n constructor(stateName) {\n super();\n this.localName = stateName;\n }\n /**\n * @inheritdoc\n */\n get name() {\n return this.localName;\n }\n}\nEmptyState.Namespace=`Aventus`;\n__as1(_, 'EmptyState', EmptyState);\n","dependencies":[{"fullName":"Aventus.State","isStrong":true},{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.EmptyState","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let TemplateInstance=class TemplateInstance {\n context;\n content;\n actions;\n component;\n _components = {};\n firstRenderUniqueCb = {};\n firstRenderCb = [];\n firstChild;\n lastChild;\n computeds = [];\n renderingComputeds = [];\n loopRegisteries = {};\n loops = [];\n ifs = [];\n isDestroyed = false;\n constructor(component, content, actions, loops, ifs, context) {\n this.component = component;\n this.content = content;\n this.actions = actions;\n this.ifs = ifs;\n this.loops = loops;\n this.context = context ? context : new TemplateContext(component);\n this.firstChild = content.firstElementChild;\n this.lastChild = content.lastElementChild;\n this.selectElements();\n this.transformActionsListening();\n }\n render() {\n this.updateContext();\n this.bindEvents();\n for (let cb of this.firstRenderCb) {\n cb();\n }\n for (let key in this.firstRenderUniqueCb) {\n this.firstRenderUniqueCb[key]();\n }\n this.renderSubTemplate();\n }\n destructor() {\n this.isDestroyed = true;\n for (let name in this.loopRegisteries) {\n let register = this.loopRegisteries[name];\n for (let item of register.templates) {\n item.destructor();\n }\n for (let item of register.computeds) {\n item.destroy();\n }\n if (register.unsub) {\n register.unsub();\n }\n }\n this.loopRegisteries = {};\n this.context.destructor();\n for (let computed of this.computeds) {\n computed.destroy();\n }\n for (let computed of this.renderingComputeds) {\n computed.destroy();\n }\n this.computeds = [];\n this.removeFromDOM();\n }\n removeFromDOM(avoidTrigger = false) {\n if (avoidTrigger) {\n let node = this.firstChild;\n while (node && node != this.lastChild) {\n let next = node.nextElementSibling;\n node.parentNode?.removeChild(node);\n node = next;\n }\n this.lastChild?.parentNode?.removeChild(this.lastChild);\n }\n else {\n let node = this.firstChild;\n while (node && node != this.lastChild) {\n let next = node.nextElementSibling;\n node.remove();\n node = next;\n }\n this.lastChild?.remove();\n }\n }\n selectElements() {\n this._components = {};\n let idEls = Array.from(this.content.querySelectorAll('[_id]'));\n for (let idEl of idEls) {\n let id = idEl.attributes['_id'].value;\n if (!this._components[id]) {\n this._components[id] = [];\n }\n this._components[id].push(idEl);\n }\n if (this.actions.elements) {\n for (let element of this.actions.elements) {\n let components = [];\n for (let id of element.ids) {\n if (this._components[id]) {\n components = [...components, ...this._components[id]];\n }\n }\n if (element.isArray) {\n setValueToObject(element.name, this.component, components);\n }\n else if (components[0]) {\n setValueToObject(element.name, this.component, components[0]);\n }\n }\n }\n }\n updateContext() {\n if (this.actions.contextEdits) {\n for (let contextEdit of this.actions.contextEdits) {\n this.renderContextEdit(contextEdit);\n }\n }\n }\n renderContextEdit(edit) {\n let _class = edit.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return edit.fct(this.context);\n }\n catch (e) {\n }\n return {};\n });\n computed.subscribe((action, path, value, dones) => {\n for (let key in computed.value) {\n let newValue = computed.value[key];\n this.context.updateWatch(key, newValue, dones);\n }\n });\n this.computeds.push(computed);\n for (let key in computed.value) {\n this.context.registerWatch(key, computed.value[key]);\n }\n }\n bindEvents() {\n if (this.actions.events) {\n for (let event of this.actions.events) {\n this.bindEvent(event);\n }\n }\n if (this.actions.pressEvents) {\n for (let event of this.actions.pressEvents) {\n this.bindPressEvent(event);\n }\n }\n }\n bindEvent(event) {\n if (!this._components[event.id]) {\n return;\n }\n if (event.isCallback) {\n for (let el of this._components[event.id]) {\n let cb = getValueFromObject(event.eventName, el);\n if (!cb && el.tagName.includes('-')) {\n customElements.upgrade(el);\n cb = getValueFromObject(event.eventName, el);\n }\n cb?.add((...args) => {\n try {\n return event.fct(this.context, args);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n else {\n for (let el of this._components[event.id]) {\n el.addEventListener(event.eventName, (e) => {\n try {\n event.fct(e, this.context);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n }\n bindPressEvent(event) {\n let id = event['id'];\n if (id && this._components[id]) {\n let clone = {};\n for (let temp in event) {\n if (temp != 'id') {\n const ev = event;\n if (ev[temp] instanceof Function) {\n clone[temp] = (e, pressInstance) => { ev[temp](e, pressInstance, this.context); };\n }\n else {\n clone[temp] = ev[temp];\n }\n }\n }\n clone.element = this._components[id];\n PressManager.create(clone);\n }\n }\n transformActionsListening() {\n if (this.actions.content) {\n for (let name in this.actions.content) {\n this.transformChangeAction(name, this.actions.content[name]);\n }\n }\n if (this.actions.injection) {\n for (let injection of this.actions.injection) {\n this.transformInjectionAction(injection);\n }\n }\n if (this.actions.bindings) {\n for (let binding of this.actions.bindings) {\n this.transformBindigAction(binding);\n }\n }\n }\n transformChangeAction(name, change) {\n const [id, attr] = name.split(\"°\");\n if (!this._components[id])\n return;\n let apply = () => { };\n if (attr == \"@HTML\") {\n apply = () => {\n let value = this.context.print(computed.value);\n for (const el of this._components[id])\n el.innerHTML = value;\n };\n }\n else {\n apply = () => {\n let value = this.context.print(computed.value);\n if (value === \"false\") {\n for (const el of this._components[id]) {\n el.removeAttribute(attr);\n }\n }\n else {\n for (const el of this._components[id]) {\n el.setAttribute(attr, value);\n }\n }\n };\n }\n let _class = change.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return change.fct(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n return \"\";\n });\n let timeout;\n computed.subscribe((action, path, value, dones) => {\n clearTimeout(timeout);\n // add timeout to group change that append on the same frame (for example index update)\n timeout = setTimeout(() => {\n if (computed.isDestroy)\n return;\n apply();\n });\n });\n this.renderingComputeds.push(computed);\n this.firstRenderUniqueCb[name] = () => {\n apply();\n };\n }\n transformInjectionAction(injection) {\n if (!this._components[injection.id])\n return;\n let _class = injection.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return injection.inject(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n });\n this.computeds.push(computed);\n computed.subscribe((action, path, value, dones) => {\n for (const el of this._components[injection.id]) {\n if (el instanceof WebComponent && el.__watch && Object.hasOwn(el.__watch, injection.injectionName)) {\n el.__watch.__injectedDones(dones);\n }\n el[injection.injectionName] = computed.value;\n }\n });\n this.firstRenderCb.push(() => {\n for (const el of this._components[injection.id]) {\n customElements.upgrade(el);\n el[injection.injectionName] = computed.value;\n }\n });\n }\n transformBindigAction(binding) {\n let isLocalChange = false;\n let _class = binding.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return binding.inject(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n });\n this.computeds.push(computed);\n computed.subscribe((action, path, value, dones) => {\n if (isLocalChange)\n return;\n for (const el of this._components[binding.id]) {\n if (el instanceof WebComponent && el.__watch && Object.hasOwn(el.__watch, binding.injectionName)) {\n el.__watch.__injectedDones(dones);\n }\n el[binding.injectionName] = computed.value;\n }\n });\n this.firstRenderCb.push(() => {\n for (const el of this._components[binding.id]) {\n customElements.upgrade(el);\n el[binding.injectionName] = computed.value;\n }\n });\n if (binding.isCallback) {\n this.firstRenderCb.push(() => {\n for (var el of this._components[binding.id]) {\n for (let fct of binding.eventNames) {\n let cb = getValueFromObject(fct, el);\n if (!cb && el.tagName.includes('-')) {\n customElements.upgrade(el);\n cb = getValueFromObject(binding.injectionName, el);\n }\n cb?.add((value) => {\n let valueToSet = getValueFromObject(binding.injectionName, el);\n isLocalChange = true;\n binding.extract(this.context, valueToSet);\n isLocalChange = false;\n });\n }\n }\n });\n }\n else {\n this.firstRenderCb.push(() => {\n for (var el of this._components[binding.id]) {\n customElements.upgrade(el);\n for (let fct of binding.eventNames) {\n el.addEventListener(fct, (e) => {\n let valueToSet = getValueFromObject(binding.injectionName, e.target);\n isLocalChange = true;\n binding.extract(this.context, valueToSet);\n isLocalChange = false;\n });\n }\n }\n });\n }\n }\n renderSubTemplate() {\n for (let loop of this.loops) {\n this.renderLoop(loop);\n }\n for (let _if of this.ifs) {\n this.renderIf(_if);\n }\n }\n renderLoop(loop) {\n if (loop.func) {\n this.renderLoopComplex(loop);\n }\n else if (loop.simple) {\n this.renderLoopSimple(loop, loop.simple);\n }\n }\n resetLoopComplex(anchorId) {\n if (this.loopRegisteries[anchorId]) {\n for (let item of this.loopRegisteries[anchorId].templates) {\n item.destructor();\n }\n for (let item of this.loopRegisteries[anchorId].computeds) {\n item.destroy();\n }\n }\n this.loopRegisteries[anchorId] = {\n templates: [],\n computeds: [],\n };\n }\n renderLoopComplex(loop) {\n if (!loop.func)\n return;\n let fctsTemp = loop.func.bind(this.component)(this.context);\n let fcts = {\n apply: fctsTemp.apply,\n condition: fctsTemp.condition,\n transform: fctsTemp.transform ?? (() => { })\n };\n this.resetLoopComplex(loop.anchorId);\n let computedsCondition = [];\n let alreadyRecreated = false;\n const createComputedCondition = () => {\n let compCondition = new Computed(() => {\n return fcts.condition();\n });\n compCondition.value;\n compCondition.subscribe((action, path, value) => {\n if (!alreadyRecreated) {\n alreadyRecreated = true;\n this.renderLoopComplex(loop);\n }\n });\n computedsCondition.push(compCondition);\n this.loopRegisteries[loop.anchorId].computeds.push(compCondition);\n return compCondition;\n };\n let result = [];\n let compCondition = createComputedCondition();\n while (compCondition.value) {\n result.push(fcts.apply());\n fcts.transform();\n compCondition = createComputedCondition();\n }\n let anchor = this._components[loop.anchorId][0];\n for (let i = 0; i < result.length; i++) {\n let context = new TemplateContext(this.component, result[i], this.context, this.loopRegisteries[loop.anchorId]);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n anchor.parentNode?.insertBefore(instance.content, anchor);\n this.loopRegisteries[loop.anchorId].templates.push(instance);\n }\n }\n resetLoopSimple(anchorId, basePath) {\n let register = this.loopRegisteries[anchorId];\n if (register?.unsub) {\n register.unsub();\n }\n this.resetLoopComplex(anchorId);\n }\n renderLoopSimple(loop, simple) {\n let onThis = simple.data.startsWith(\"this.\");\n let basePath = this.context.normalizePath(simple.data);\n this.resetLoopSimple(loop.anchorId, basePath);\n let getElements = () => this.context.getValueFromItem(basePath);\n let elements = getElements();\n if (!elements) {\n let currentPath = basePath;\n while (currentPath != '' && !elements) {\n let splittedPath = currentPath.split(\".\");\n splittedPath.pop();\n currentPath = splittedPath.join(\".\");\n elements = this.context.getValueFromItem(currentPath);\n }\n if (!elements && onThis) {\n const splittedPath = basePath.split(\".\");\n const firstPart = splittedPath.length > 0 ? splittedPath[0] : null;\n if (firstPart && this.component.__signals[firstPart]) {\n elements = this.component.__signals[firstPart];\n }\n else {\n elements = this.component.__watch;\n }\n }\n if (!elements || !(elements.__isProxy || elements instanceof Signal)) {\n debugger;\n }\n const subTemp = (action, path, value) => {\n if (basePath.startsWith(path) || path == \"*\") {\n elements.unsubscribe(subTemp);\n this.renderLoopSimple(loop, simple);\n return;\n }\n };\n elements.subscribe(subTemp);\n return;\n }\n let indexName = this.context.registerIndex();\n let keys = Object.keys(elements);\n if (elements.__isProxy) {\n let regexArray = new RegExp(\"^\\\\[(\\\\d+?)\\\\]$\");\n let regexObject = new RegExp(\"^([^\\\\.]*)$\");\n let sub = (action, path, value) => {\n if (this.isDestroyed)\n return;\n if (path == \"\") {\n this.renderLoopSimple(loop, simple);\n return;\n }\n if (action == WatchAction.UPDATED) {\n return;\n }\n let index = undefined;\n regexArray.lastIndex = 0;\n regexObject.lastIndex = 0;\n let resultArray = regexArray.exec(path);\n if (resultArray) {\n index = Number(resultArray[1]);\n }\n else {\n let resultObject = regexObject.exec(path);\n if (resultObject) {\n let oldKey = resultObject[1];\n if (action == WatchAction.CREATED) {\n keys = Object.keys(getElements());\n index = keys.indexOf(oldKey);\n }\n else if (action == WatchAction.DELETED) {\n index = keys.indexOf(oldKey);\n keys = Object.keys(getElements());\n }\n }\n }\n if (index !== undefined) {\n let registry = this.loopRegisteries[loop.anchorId];\n if (action == WatchAction.CREATED) {\n let context = new TemplateContext(this.component, {}, this.context, registry);\n context.registerLoop(basePath, index, indexName, simple.index, simple.item, onThis);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n let anchor;\n if (index < registry.templates.length) {\n anchor = registry.templates[index].firstChild;\n }\n else {\n anchor = this._components[loop.anchorId][0];\n }\n anchor?.parentNode?.insertBefore(instance.content, anchor);\n registry.templates.splice(index, 0, instance);\n for (let i = index + 1; i < registry.templates.length; i++) {\n registry.templates[i].context.increaseIndex(indexName);\n }\n }\n else if (action == WatchAction.DELETED) {\n registry.templates[index].destructor();\n registry.templates.splice(index, 1);\n for (let i = index; i < registry.templates.length; i++) {\n registry.templates[i].context.decreaseIndex(indexName);\n }\n }\n }\n };\n this.loopRegisteries[loop.anchorId].unsub = () => {\n elements.unsubscribe(sub);\n };\n elements.subscribe(sub);\n }\n let anchor = this._components[loop.anchorId][0];\n for (let i = 0; i < keys.length; i++) {\n let context = new TemplateContext(this.component, {}, this.context, this.loopRegisteries[loop.anchorId]);\n context.registerLoop(basePath, i, indexName, simple.index, simple.item, onThis);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n anchor.parentNode?.insertBefore(instance.content, anchor);\n this.loopRegisteries[loop.anchorId].templates.push(instance);\n }\n }\n renderIf(_if) {\n // this.renderIfMemory(_if);\n this.renderIfRecreate(_if);\n }\n renderIfMemory(_if) {\n let computeds = [];\n let instances = [];\n if (!this._components[_if.anchorId] || this._components[_if.anchorId].length == 0)\n return;\n let anchor = this._components[_if.anchorId][0];\n let currentActive = -1;\n const calculateActive = () => {\n let newActive = -1;\n for (let i = 0; i < _if.parts.length; i++) {\n if (computeds[i].value) {\n newActive = i;\n break;\n }\n }\n if (newActive == currentActive) {\n return;\n }\n if (currentActive != -1) {\n let instance = instances[currentActive];\n let node = instance.firstChild;\n while (node && node != instance.lastChild) {\n let next = node.nextElementSibling;\n instance.content.appendChild(node);\n node = next;\n }\n if (instance.lastChild)\n instance.content.appendChild(instance.lastChild);\n }\n currentActive = newActive;\n if (instances[currentActive])\n anchor.parentNode?.insertBefore(instances[currentActive].content, anchor);\n };\n for (let i = 0; i < _if.parts.length; i++) {\n const part = _if.parts[i];\n let _class = part.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n return part.condition(this.context);\n });\n computeds.push(computed);\n computed.subscribe(() => {\n calculateActive();\n });\n this.computeds.push(computed);\n let context = new TemplateContext(this.component, {}, this.context);\n let content = part.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = part.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, part.template.loops, part.template.ifs, context);\n instances.push(instance);\n instance.render();\n }\n calculateActive();\n }\n renderIfRecreate(_if) {\n let computeds = [];\n if (!this._components[_if.anchorId] || this._components[_if.anchorId].length == 0)\n return;\n let anchor = this._components[_if.anchorId][0];\n let currentActive = undefined;\n let currentActiveNb = -1;\n const createContext = () => {\n if (currentActiveNb < 0 || currentActiveNb > _if.parts.length - 1) {\n currentActive = undefined;\n return;\n }\n const part = _if.parts[currentActiveNb];\n let context = new TemplateContext(this.component, {}, this.context);\n let content = part.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = part.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, part.template.loops, part.template.ifs, context);\n currentActive = instance;\n instance.render();\n anchor.parentNode?.insertBefore(currentActive.content, anchor);\n };\n for (let i = 0; i < _if.parts.length; i++) {\n const part = _if.parts[i];\n let _class = part.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n return part.condition(this.context);\n });\n computeds.push(computed);\n computed.subscribe(() => {\n calculateActive();\n });\n this.computeds.push(computed);\n }\n const calculateActive = () => {\n let newActive = -1;\n for (let i = 0; i < _if.parts.length; i++) {\n if (computeds[i].value) {\n newActive = i;\n break;\n }\n }\n if (newActive == currentActiveNb) {\n return;\n }\n if (currentActive) {\n currentActive.destructor();\n }\n currentActiveNb = newActive;\n createContext();\n };\n calculateActive();\n }\n}\nTemplateInstance.Namespace=`Aventus`;\n__as1(_, 'TemplateInstance', TemplateInstance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Effect","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Aventus.setValueToObject","isStrong":false},{"fullName":"Aventus.ContextEdit","isStrong":false},{"fullName":"Aventus.ComputedNoRecomputed","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.ActionEvent","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":false},{"fullName":"clone","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false},{"fullName":"Signal","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.TemplateInstance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let TemplateContext=class TemplateContext {\n data = {};\n comp;\n computeds = [];\n watch;\n registry;\n isDestroyed = false;\n constructor(component, data = {}, parentContext, registry) {\n this.comp = component;\n this.registry = registry;\n this.watch = Watcher.get({});\n let that = this;\n for (let key in data) {\n if (data[key].__isProxy) {\n Object.defineProperty(this.data, key, {\n get() {\n return data[key];\n }\n });\n }\n else {\n this.watch[key] = data[key];\n Object.defineProperty(this.data, key, {\n get() {\n return that.watch[key];\n }\n });\n }\n }\n if (parentContext) {\n const descriptors = Object.getOwnPropertyDescriptors(parentContext.data);\n for (let name in descriptors) {\n Object.defineProperty(this.data, name, {\n get() {\n return parentContext.data[name];\n }\n });\n }\n }\n }\n print(value) {\n return value == null ? \"\" : value + \"\";\n }\n registerIndex() {\n let name = \"index\";\n let i = 0;\n let fullName = name + i;\n while (this.watch[fullName] !== undefined) {\n i++;\n fullName = name + i;\n }\n return fullName;\n }\n registerLoop(dataName, _indexValue, _indexName, indexName, itemName, onThis) {\n this.watch[_indexName] = _indexValue;\n let getItems;\n let mustBeRecomputed = /if|switch|\\?|\\[.+?\\]/g.test(dataName);\n let _class = mustBeRecomputed ? Computed : ComputedNoRecomputed;\n if (!onThis) {\n getItems = new _class(() => {\n return getValueFromObject(dataName, this.data);\n });\n }\n else {\n dataName = dataName.replace(/^this\\./, '');\n getItems = new _class(() => {\n return getValueFromObject(dataName, this.comp);\n });\n }\n let getIndex = new ComputedNoRecomputed(() => {\n let items = getItems.value;\n if (!items)\n throw 'impossible';\n let keys = Object.keys(items);\n let index = keys[_getIndex.value];\n if (/^[0-9]+$/g.test(index))\n return Number(index);\n return index;\n });\n let getItem = new ComputedNoRecomputed(() => {\n let items = getItems.value;\n if (!items)\n throw 'impossible';\n let keys = Object.keys(items);\n let index = keys[_getIndex.value];\n let element = items[index];\n if (element === undefined && (Array.isArray(items) || !items)) {\n if (this.registry) {\n let indexNb = Number(_getIndex.value);\n if (!isNaN(indexNb)) {\n this.registry.templates[indexNb].destructor();\n this.registry.templates.splice(indexNb, 1);\n for (let i = indexNb; i < this.registry.templates.length; i++) {\n this.registry.templates[i].context.decreaseIndex(_indexName);\n }\n }\n }\n }\n return element;\n });\n let _getIndex = new ComputedNoRecomputed(() => {\n return this.watch[_indexName];\n });\n this.computeds.push(getIndex);\n this.computeds.push(getItem);\n this.computeds.push(_getIndex);\n if (itemName) {\n Object.defineProperty(this.data, itemName, {\n get() {\n return getItem.value;\n }\n });\n }\n if (indexName) {\n Object.defineProperty(this.data, indexName, {\n get() {\n return getIndex.value;\n }\n });\n }\n }\n updateIndex(newIndex, _indexName) {\n // let items: any[] | {};\n // if(!dataName.startsWith(\"this.\")) {\n // let comp = new Computed(() => {\n // return getValueFromObject(dataName, this.data);\n // });\n // fullName = dataName.replace(/^this\\./, '');\n // items = getValueFromObject(fullName, this.comp);\n // if(Array.isArray(items)) {\n // let regex = new RegExp(\"^(\" + fullName.replace(/\\./g, \"\\\\.\") + \")\\\\[(\\\\d+?)\\\\]\");\n // for(let computed of computeds) {\n // for(let cb of computed.callbacks) {\n // cb.path = cb.path.replace(regex, \"$1[\" + newIndex + \"]\");\n // let oldKey = Object.keys(items)[this.watch[_indexName]]\n // let newKey = Object.keys(items)[newIndex]\n // let regex = new RegExp(\"^(\" + fullName.replace(/\\./g, \"\\\\.\") + \"\\\\.)(\" + oldKey + \")($|\\\\.)\");\n // for (let computed of computeds) {\n // for (let cb of computed.callbacks) {\n // cb.path = cb.path.replace(regex, \"$1\" + newKey + \"$3\")\n this.watch[_indexName] = newIndex;\n }\n increaseIndex(_indexName) {\n this.updateIndex(this.watch[_indexName] + 1, _indexName);\n }\n decreaseIndex(_indexName) {\n this.updateIndex(this.watch[_indexName] - 1, _indexName);\n }\n destructor() {\n this.isDestroyed = true;\n for (let computed of this.computeds) {\n computed.destroy();\n }\n this.computeds = [];\n }\n registerWatch(name, value) {\n let that = this;\n that.watch[name] = value;\n Object.defineProperty(that.data, name, {\n get() {\n return that.watch[name];\n }\n });\n }\n updateWatch(name, value, dones) {\n if (Watcher.is(this.watch[name])) {\n this.watch[name].__injectedDones(dones);\n }\n this.watch[name] = value;\n }\n normalizePath(path) {\n path = path.replace(/^this\\./, '');\n const regex = /\\[(.*?)\\]/g;\n let m;\n while ((m = regex.exec(path)) !== null) {\n if (m.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n let name = m[1];\n let result = getValueFromObject(name, this.data);\n if (result !== undefined) {\n path = path.replace(m[0], `[${result}]`);\n }\n }\n return path;\n }\n getValueFromItem(name) {\n if (!name)\n return undefined;\n let result = getValueFromObject(name, this.data);\n if (result !== undefined) {\n return result;\n }\n result = getValueFromObject(name, this.comp);\n if (result !== undefined) {\n return result;\n }\n return undefined;\n }\n setValueToItem(name, value) {\n setValueToObject(name, this.comp, value);\n }\n}\nTemplateContext.Namespace=`Aventus`;\n__as1(_, 'TemplateContext', TemplateContext);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.ComputedNoRecomputed","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.setValueToObject","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.TemplateContext","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Template=class Template {\n static validatePath(path, pathToCheck) {\n if (pathToCheck.startsWith(path)) {\n return true;\n }\n return false;\n }\n cst;\n constructor(component) {\n this.cst = component;\n }\n htmlParts = [];\n setHTML(data) {\n this.htmlParts.push(data);\n }\n generateTemplate() {\n this.template = document.createElement('template');\n let currentHTML = \"<slot></slot>\";\n let previousSlots = {\n default: '<slot></slot>'\n };\n for (let htmlPart of this.htmlParts) {\n for (let blockName in htmlPart.blocks) {\n if (!previousSlots.hasOwnProperty(blockName)) {\n throw \"can't found slot with name \" + blockName;\n }\n currentHTML = currentHTML.replace(previousSlots[blockName], htmlPart.blocks[blockName]);\n }\n for (let slotName in htmlPart.slots) {\n previousSlots[slotName] = htmlPart.slots[slotName];\n }\n }\n this.template.innerHTML = currentHTML;\n }\n /**\n * Used by the for loop and the if\n * @param template\n */\n setTemplate(template) {\n this.template = document.createElement('template');\n this.template.innerHTML = template;\n }\n template;\n actions = {};\n setActions(actions) {\n if (!this.actions) {\n this.actions = actions;\n }\n else {\n if (actions.elements) {\n if (!this.actions.elements) {\n this.actions.elements = [];\n }\n this.actions.elements = [...actions.elements, ...this.actions.elements];\n }\n if (actions.events) {\n if (!this.actions.events) {\n this.actions.events = [];\n }\n this.actions.events = [...actions.events, ...this.actions.events];\n }\n if (actions.pressEvents) {\n if (!this.actions.pressEvents) {\n this.actions.pressEvents = [];\n }\n this.actions.pressEvents = [...actions.pressEvents, ...this.actions.pressEvents];\n }\n if (actions.content) {\n if (!this.actions.content) {\n this.actions.content = actions.content;\n }\n else {\n for (let contextProp in actions.content) {\n if (!this.actions.content[contextProp]) {\n this.actions.content[contextProp] = actions.content[contextProp];\n }\n else {\n throw 'this should be impossible';\n }\n }\n }\n }\n if (actions.injection) {\n if (!this.actions.injection) {\n this.actions.injection = actions.injection;\n }\n else {\n for (let contextProp in actions.injection) {\n if (!this.actions.injection[contextProp]) {\n this.actions.injection[contextProp] = actions.injection[contextProp];\n }\n else {\n this.actions.injection[contextProp] = { ...actions.injection[contextProp], ...this.actions.injection[contextProp] };\n }\n }\n }\n }\n if (actions.bindings) {\n if (!this.actions.bindings) {\n this.actions.bindings = actions.bindings;\n }\n else {\n for (let contextProp in actions.bindings) {\n if (!this.actions.bindings[contextProp]) {\n this.actions.bindings[contextProp] = actions.bindings[contextProp];\n }\n else {\n this.actions.bindings[contextProp] = { ...actions.bindings[contextProp], ...this.actions.bindings[contextProp] };\n }\n }\n }\n }\n if (actions.contextEdits) {\n if (!this.actions.contextEdits) {\n this.actions.contextEdits = [];\n }\n this.actions.contextEdits = [...actions.contextEdits, ...this.actions.contextEdits];\n }\n }\n }\n loops = [];\n addLoop(loop) {\n this.loops.push(loop);\n }\n ifs = [];\n addIf(_if) {\n this.ifs.push(_if);\n }\n createInstance(component) {\n let content = this.template.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n return new TemplateInstance(component, content, this.actions, this.loops, this.ifs);\n }\n}\nTemplate.Namespace=`Aventus`;\n__as1(_, 'Template', Template);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateHTML","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.Template","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let WebComponent=class WebComponent extends HTMLElement {\n /**\n * Add attributes informations\n */\n static get observedAttributes() {\n return [];\n }\n _first;\n _isReady;\n /**\n * Determine if the component is ready (postCreation done)\n */\n get isReady() {\n return this._isReady;\n }\n /**\n * The current namespace\n */\n static Namespace = \"\";\n /**\n * The current Tag / empty if abstract class\n */\n static Tag = \"\";\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the name of the component class\n */\n getClassName() {\n return this.constructor.name;\n }\n /**\n * The current tag\n */\n get tag() {\n return this.constructor['Tag'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n __onChangeFct = {};\n __watch;\n __watchActions = {};\n __watchActionsCb = {};\n __watchFunctions = {};\n __watchFunctionsComputed = {};\n __pressManagers = [];\n __signalActions = {};\n __signals = {};\n __isDefaultState = true;\n __defaultActiveState = new Map();\n __defaultInactiveState = new Map();\n __statesList = {};\n constructor() {\n super();\n if (this.constructor == WebComponent) {\n throw \"can't instanciate an abstract class\";\n }\n this.__removeNoAnimations = this.__removeNoAnimations.bind(this);\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", this.__removeNoAnimations);\n }\n this._first = true;\n this._isReady = false;\n this.__renderTemplate();\n this.__registerWatchesActions();\n this.__registerPropertiesActions();\n this.__registerSignalsActions();\n this.__createStates();\n this.__subscribeState();\n if (this.constructor == WebComponent) {\n throw \"can't instanciate an abstract class\";\n }\n }\n /**\n * Remove all listeners\n * State + press\n */\n destructor() {\n WebComponentInstance.removeInstance(this);\n this.__unsubscribeState();\n for (let press of this.__pressManagers) {\n press.destroy();\n }\n for (let name in this.__watchFunctionsComputed) {\n this.__watchFunctionsComputed[name].destroy();\n }\n for (let name in this.__signals) {\n this.__signals[name].destroy();\n }\n // TODO add missing info for destructor();\n this.postDestruction();\n this.destructChildren();\n }\n destructChildren() {\n const recu = (el) => {\n for (let child of Array.from(el.children)) {\n if (child instanceof WebComponent) {\n child.destructor();\n }\n else if (child instanceof HTMLElement) {\n recu(child);\n }\n }\n if (el.shadowRoot) {\n for (let child of Array.from(el.shadowRoot.children)) {\n if (child instanceof WebComponent) {\n child.destructor();\n }\n else if (child instanceof HTMLElement) {\n recu(child);\n }\n }\n }\n };\n recu(this);\n }\n __addWatchesActions(name, fct) {\n if (!this.__watchActions[name]) {\n this.__watchActions[name] = [];\n this.__watchActionsCb[name] = (action, path, value) => {\n for (let fct of this.__watchActions[name]) {\n fct(this, action, path, value);\n }\n if (this.__onChangeFct[name]) {\n for (let fct of this.__onChangeFct[name]) {\n fct(path);\n }\n }\n };\n }\n if (fct) {\n this.__watchActions[name].push(fct);\n }\n }\n __addWatchesFunctions(infos) {\n for (let info of infos) {\n let realName;\n let autoInit;\n if (typeof info == \"string\") {\n realName = info;\n autoInit = false;\n }\n else {\n realName = info.name;\n autoInit = info.autoInit;\n }\n if (!this.__watchFunctions[realName]) {\n this.__watchFunctions[realName] = { autoInit };\n }\n }\n }\n __registerWatchesActions() {\n if (Object.keys(this.__watchActions).length > 0) {\n if (!this.__watch) {\n let defaultValue = {};\n this.__defaultValuesWatch(defaultValue);\n this.__watch = Watcher.get(defaultValue, (type, path, element) => {\n try {\n let action = this.__watchActionsCb[path.split(\".\")[0]] || this.__watchActionsCb[path.split(\"[\")[0]];\n action(type, path, element);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n for (let name in this.__watchFunctions) {\n this.__watchFunctionsComputed[name] = Watcher.computed(this[name].bind(this));\n if (this.__watchFunctions[name].autoInit) {\n this.__watchFunctionsComputed[name].value;\n }\n }\n }\n __addSignalActions(name, fct) {\n this.__signalActions[name] = () => {\n fct(this);\n };\n }\n __registerSignalsActions() {\n if (Object.keys(this.__signals).length > 0) {\n const defaultValues = {};\n for (let name in this.__signals) {\n this.__registerSignalsAction(name);\n this.__defaultValuesSignal(defaultValues);\n }\n for (let name in defaultValues) {\n this.__signals[name].value = defaultValues[name];\n }\n }\n }\n __registerSignalsAction(name) {\n this.__signals[name] = new Signal(undefined, () => {\n if (this.__signalActions[name]) {\n this.__signalActions[name]();\n }\n });\n }\n __defaultValuesSignal(s) { }\n __addPropertyActions(name, fct) {\n if (!this.__onChangeFct[name]) {\n this.__onChangeFct[name] = [];\n }\n if (fct) {\n this.__onChangeFct[name].push(() => {\n fct(this);\n });\n }\n }\n __registerPropertiesActions() { }\n static __style = ``;\n static __template;\n __templateInstance;\n styleBefore(addStyle) {\n addStyle(\"@default\");\n }\n styleAfter(addStyle) {\n }\n __getStyle() {\n return [WebComponent.__style];\n }\n __getHtml() { }\n __getStatic() {\n return WebComponent;\n }\n static __styleSheets = {};\n __renderStyles() {\n let sheets = {};\n const addStyle = (name) => {\n let sheet = Style.get(name);\n if (sheet) {\n sheets[name] = sheet;\n }\n };\n this.styleBefore(addStyle);\n let localStyle = new CSSStyleSheet();\n let styleTxt = this.__getStyle().join(\"\\r\\n\");\n if (styleTxt.length > 0) {\n localStyle.replace(styleTxt);\n sheets['@local'] = localStyle;\n }\n this.styleAfter(addStyle);\n return sheets;\n }\n __renderTemplate() {\n let staticInstance = this.__getStatic();\n if (!staticInstance.__template || staticInstance.__template.cst != staticInstance) {\n staticInstance.__template = new Template(staticInstance);\n this.__getHtml();\n this.__registerTemplateAction();\n staticInstance.__template.generateTemplate();\n staticInstance.__styleSheets = this.__renderStyles();\n }\n this.__templateInstance = staticInstance.__template.createInstance(this);\n let shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.adoptedStyleSheets = [...Object.values(staticInstance.__styleSheets), Style.noAnimation];\n shadowRoot.appendChild(this.__templateInstance.content);\n // customElements.upgrade(shadowRoot);\n return shadowRoot;\n }\n __registerTemplateAction() {\n }\n connectedCallback() {\n if (this._first) {\n WebComponentInstance.addInstance(this);\n this._first = false;\n this.__defaultValues();\n this.__upgradeAttributes();\n this.__activateState();\n this.__templateInstance?.render();\n this.__removeNoAnimations();\n }\n else {\n setTimeout(() => {\n this.postConnect();\n });\n }\n }\n disconnectedCallback() {\n setTimeout(() => {\n this.postDisconnect();\n });\n }\n __onReadyCb = [];\n onReady(cb) {\n if (this._isReady) {\n cb();\n }\n else {\n this.__onReadyCb.push(cb);\n }\n }\n __setReady() {\n this._isReady = true;\n this.dispatchEvent(new CustomEvent('postCreationDone'));\n let cbs = [...this.__onReadyCb];\n for (let cb of cbs) {\n cb();\n }\n this.__onReadyCb = [];\n }\n __removeNoAnimations() {\n if (document.readyState !== \"loading\") {\n setTimeout(() => {\n this.postCreation();\n this.__setReady();\n this.shadowRoot.adoptedStyleSheets = Object.values(this.__getStatic().__styleSheets);\n document.removeEventListener(\"DOMContentLoaded\", this.__removeNoAnimations);\n this.postConnect();\n }, 50);\n }\n }\n __defaultValues() { }\n __defaultValuesWatch(w) { }\n __upgradeAttributes() { }\n __listBoolProps() {\n return [];\n }\n __upgradeProperty(prop) {\n let boolProps = this.__listBoolProps();\n const t = this;\n if (boolProps.indexOf(prop) != -1) {\n if (this.hasAttribute(prop) && (this.getAttribute(prop) === \"true\" || this.getAttribute(prop) === \"\")) {\n let value = this.getAttribute(prop);\n delete t[prop];\n t[prop] = value;\n }\n else {\n this.removeAttribute(prop);\n delete t[prop];\n t[prop] = false;\n }\n }\n else {\n if (this.hasAttribute(prop)) {\n let value = this.getAttribute(prop);\n delete t[prop];\n t[prop] = value;\n }\n else if (Object.hasOwn(this, prop)) {\n const value = t[prop];\n delete t[prop];\n t[prop] = value;\n }\n }\n }\n __correctGetter(prop) {\n if (Object.hasOwn(this, prop)) {\n const t = this;\n const value = t[prop];\n delete t[prop];\n t[prop] = value;\n }\n }\n __getStateManager(managerClass) {\n let mClass;\n if (managerClass instanceof StateManager) {\n mClass = managerClass;\n }\n else {\n mClass = Instance.get(managerClass);\n }\n return mClass;\n }\n __addActiveDefState(managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n if (!this.__defaultActiveState.has(mClass)) {\n this.__defaultActiveState.set(mClass, []);\n }\n this.__defaultActiveState.get(mClass)?.push(cb);\n }\n __addInactiveDefState(managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n if (!this.__defaultInactiveState.has(mClass)) {\n this.__defaultInactiveState.set(mClass, []);\n }\n this.__defaultInactiveState.get(mClass)?.push(cb);\n }\n __addActiveState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.active.push(cb);\n }\n __addInactiveState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.inactive.push(cb);\n }\n __addAskChangeState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.askChange.push(cb);\n }\n __createStates() { }\n __createStatesList(statePattern, managerClass) {\n if (!this.__statesList[statePattern]) {\n this.__statesList[statePattern] = new Map();\n }\n let mClass = this.__getStateManager(managerClass);\n if (!this.__statesList[statePattern].has(mClass)) {\n this.__statesList[statePattern].set(mClass, {\n active: [],\n inactive: [],\n askChange: []\n });\n }\n }\n __inactiveDefaultState(managerClass) {\n if (this.__isDefaultState) {\n this.__isDefaultState = false;\n let mClass = this.__getStateManager(managerClass);\n if (this.__defaultInactiveState.has(mClass)) {\n let fcts = this.__defaultInactiveState.get(mClass) ?? [];\n for (let fct of fcts) {\n fct.bind(this)();\n }\n }\n }\n }\n __activeDefaultState(nextStep, managerClass) {\n if (!this.__isDefaultState) {\n for (let pattern in this.__statesList) {\n if (StateManager.canBeActivate(pattern, nextStep)) {\n let mClass = this.__getStateManager(managerClass);\n if (this.__statesList[pattern].has(mClass)) {\n return;\n }\n }\n }\n this.__isDefaultState = true;\n let mClass = this.__getStateManager(managerClass);\n if (this.__defaultActiveState.has(mClass)) {\n let fcts = this.__defaultActiveState.get(mClass) ?? [];\n for (let fct of fcts) {\n fct.bind(this)();\n }\n }\n }\n }\n __subscribeState() {\n if (!this.isReady && this.__stateCleared) {\n return;\n }\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.subscribe(route, el, false);\n }\n }\n }\n }\n __activateState() {\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.activateAfterSubscribe(route, el);\n }\n }\n }\n }\n __stateCleared = false;\n __unsubscribeState() {\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.unsubscribe(route, el);\n }\n }\n }\n this.__stateCleared = true;\n }\n dateToString(d) {\n if (typeof d == 'string') {\n d = this.stringToDate(d);\n }\n if (d instanceof Date) {\n return new Date(d.getTime() - (d.getTimezoneOffset() * 60000)).toISOString().split(\"T\")[0];\n }\n return null;\n }\n dateTimeToString(dt) {\n if (typeof dt == 'string') {\n dt = this.stringToDate(dt);\n }\n if (dt instanceof Date) {\n return new Date(dt.getTime() - (dt.getTimezoneOffset() * 60000)).toISOString().slice(0, -1);\n }\n return null;\n }\n stringToDate(s) {\n let td = new Date(s);\n let d = new Date(td.getTime() + (td.getTimezoneOffset() * 60000));\n if (isNaN(d)) {\n return null;\n }\n return d;\n }\n stringToDateTime(s) {\n let td = new Date(s);\n let d = new Date(td.getTime() + (td.getTimezoneOffset() * 60000));\n if (isNaN(d)) {\n return null;\n }\n return d;\n }\n getBoolean(val) {\n if (val === true || val === 1 || val === 'true' || val === '') {\n return true;\n }\n else if (val === false || val === 0 || val === 'false' || val === null || val === undefined) {\n return false;\n }\n console.error(\"error parsing boolean value \" + val);\n return false;\n }\n __registerPropToWatcher(name) {\n if (Watcher._register) {\n Watcher._register.register(this.getReceiver(name), name, Watcher._register.version, name);\n }\n }\n getStringAttr(name) {\n return this.getAttribute(name)?.replace(/&avquot;/g, '\"') ?? undefined;\n }\n setStringAttr(name, val) {\n if (val === undefined || val === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, (val + \"\").replace(/\"/g, '&avquot;'));\n }\n }\n getStringProp(name) {\n this.__registerPropToWatcher(name);\n return this.getStringAttr(name);\n }\n getNumberAttr(name) {\n return Number(this.getAttribute(name));\n }\n setNumberAttr(name, val) {\n if (val === undefined || val === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, val);\n }\n }\n getNumberProp(name) {\n this.__registerPropToWatcher(name);\n return this.getNumberAttr(name);\n }\n getBoolAttr(name) {\n return this.hasAttribute(name);\n }\n setBoolAttr(name, val) {\n val = this.getBoolean(val);\n if (val) {\n this.setAttribute(name, 'true');\n }\n else {\n this.removeAttribute(name);\n }\n }\n getBoolProp(name) {\n this.__registerPropToWatcher(name);\n return this.getBoolAttr(name);\n }\n getDateAttr(name) {\n if (!this.hasAttribute(name)) {\n return undefined;\n }\n return this.stringToDate(this.getAttribute(name));\n }\n setDateAttr(name, val) {\n let valTxt = this.dateToString(val);\n if (valTxt === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, valTxt);\n }\n }\n getDateProp(name) {\n this.__registerPropToWatcher(name);\n return this.getDateAttr(name);\n }\n getDateTimeAttr(name) {\n if (!this.hasAttribute(name))\n return undefined;\n return this.stringToDateTime(this.getAttribute(name));\n }\n setDateTimeAttr(name, val) {\n let valTxt = this.dateTimeToString(val);\n if (valTxt === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, valTxt);\n }\n }\n getDateTimeProp(name) {\n this.__registerPropToWatcher(name);\n return this.getDateTimeAttr(name);\n }\n __propertyReceivers = {};\n getReceiver(name) {\n if (!this.__propertyReceivers[name]) {\n let that = this;\n let result = {\n __subscribes: [],\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n },\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n },\n onChange() {\n for (let fct of this.__subscribes) {\n fct(WatchAction.UPDATED, name, that[name], []);\n }\n },\n __path: name\n };\n this.__propertyReceivers[name] = result;\n }\n return this.__propertyReceivers[name];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue !== newValue || !this.isReady) {\n if (this.__propertyReceivers.hasOwnProperty(name)) {\n this.__propertyReceivers[name].onChange();\n }\n if (this.__onChangeFct.hasOwnProperty(name)) {\n for (let fct of this.__onChangeFct[name]) {\n fct('');\n }\n }\n }\n }\n /**\n * Remove a component from the dom\n * If desctruct is set to true, the component will be fully destroyed\n */\n remove(destruct = true) {\n super.remove();\n if (destruct) {\n this.destructor();\n }\n }\n /**\n * Function triggered when the component is destroyed\n */\n postDestruction() { }\n /**\n * Function triggered the first time the component is rendering inside DOM\n */\n postCreation() { }\n /**\n * Function triggered each time the component is rendering inside DOM\n */\n postConnect() { }\n /**\n * Function triggered each time the component is removed from the DOM\n */\n postDisconnect() { }\n /**\n * Find a parent by tagname if exist\n */\n findParentByTag(tagname, untilNode) {\n return ElementExtension.findParentByTag(this, tagname, untilNode);\n }\n /**\n * Find a parent by class name if exist\n */\n findParentByClass(classname, untilNode) {\n return ElementExtension.findParentByClass(this, classname, untilNode);\n }\n /**\n * Find a parent by type if exist\n */\n findParentByType(type, untilNode) {\n return ElementExtension.findParentByType(this, type, untilNode);\n }\n /**\n * Find list of parents by tagname\n */\n findParentsByTag(tagname, untilNode) {\n return ElementExtension.findParentsByTag(this, tagname, untilNode);\n }\n /**\n * Find list of parents by custom check\n */\n findParents(tagname, check, untilNode) {\n return ElementExtension.findParents(this, check, untilNode);\n }\n /**\n * Find list of parents by custom check\n */\n findParent(tagname, check, untilNode) {\n return ElementExtension.findParent(this, check, untilNode);\n }\n /**\n * Check if element contains a child\n */\n containsChild(el) {\n return ElementExtension.containsChild(this, el);\n }\n /**\n * Get elements inside slot\n */\n getElementsInSlot(slotName) {\n return ElementExtension.getElementsInSlot(this, slotName);\n }\n /**\n * Get nodes inside slot\n */\n getNodesInSlot(slotName) {\n return ElementExtension.getNodesInSlot(this, slotName);\n }\n /**\n * Get active element from the shadowroot or the document\n */\n getActiveElement(document) {\n return ElementExtension.getActiveElement(document ?? this.shadowRoot);\n }\n}\nWebComponent.Namespace=`Aventus`;\n__as1(_, 'WebComponent', WebComponent);\n","dependencies":[{"fullName":"Aventus.DefaultComponent","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Dependencies","isStrong":false},{"fullName":"Aventus.WebComponentInstance","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.Signal","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.State","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.Template","isStrong":true},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Style","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ElementExtension","isStrong":false}],"fullName":"Aventus.WebComponent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let WebComponentInstance=class WebComponentInstance {\n static __allDefinitions = [];\n static __allInstances = [];\n /**\n * Last definition insert datetime\n */\n static lastDefinition = 0;\n static registerDefinition(def) {\n WebComponentInstance.lastDefinition = Date.now();\n WebComponentInstance.__allDefinitions.push(def);\n }\n static removeDefinition(def) {\n WebComponentInstance.lastDefinition = Date.now();\n let index = WebComponentInstance.__allDefinitions.indexOf(def);\n if (index > -1) {\n WebComponentInstance.__allDefinitions.splice(index, 1);\n }\n }\n /**\n * Get all sub classes of type\n */\n static getAllClassesOf(type) {\n let result = [];\n for (let def of WebComponentInstance.__allDefinitions) {\n if (def.prototype instanceof type) {\n result.push(def);\n }\n }\n return result;\n }\n /**\n * Get all registered definitions\n */\n static getAllDefinitions() {\n return WebComponentInstance.__allDefinitions;\n }\n static addInstance(instance) {\n this.__allInstances.push(instance);\n }\n static removeInstance(instance) {\n let index = this.__allInstances.indexOf(instance);\n if (index > -1) {\n this.__allInstances.splice(index, 1);\n }\n }\n static getAllInstances(type) {\n let result = [];\n for (let instance of this.__allInstances) {\n if (instance instanceof type) {\n result.push(instance);\n }\n }\n return result;\n }\n static create(type) {\n let _class = customElements.get(type);\n if (_class) {\n return new _class();\n }\n let splitted = type.split(\".\");\n let current = window;\n for (let part of splitted) {\n current = current[part];\n }\n if (current && current.prototype instanceof WebComponent) {\n return new current();\n }\n return null;\n }\n}\nWebComponentInstance.Namespace=`Aventus`;\n__as1(_, 'WebComponentInstance', WebComponentInstance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":true},{"fullName":"T","isStrong":false}],"fullName":"Aventus.WebComponentInstance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ElementExtension=class ElementExtension {\n /**\n * Find a parent by custom check\n */\n static findParent(element, check, untilNode) {\n let el = element;\n if (el) {\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n }\n while (el) {\n if (check(el)) {\n return el;\n }\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n if (el == untilNode) {\n break;\n }\n }\n return null;\n }\n /**\n * Find a list of parent by custom check\n */\n static findParents(element, check, untilNode) {\n let result = [];\n let el = element;\n if (el) {\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n }\n while (el) {\n if (check(el)) {\n result.push(el);\n }\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n if (el == untilNode) {\n break;\n }\n }\n return result;\n }\n /**\n * Find a parent by tagname if exist Static.findParentByTag(this, \"av-img\")\n */\n static findParentByTag(element, tagname, untilNode) {\n if (Array.isArray(tagname)) {\n for (let i = 0; i < tagname.length; i++) {\n tagname[i] = tagname[i].toLowerCase();\n }\n }\n else {\n tagname = [tagname.toLowerCase()];\n }\n const checkFunc = (el) => {\n if (el instanceof Element) {\n return tagname.indexOf((el.nodeName || el.tagName).toLowerCase()) != -1;\n }\n return tagname.indexOf(el.nodeName.toLowerCase()) != -1;\n };\n return this.findParent(element, checkFunc, untilNode);\n }\n /**\n * Find a parent by class name if exist Static.findParentByClass(this, \"my-class-img\") = querySelector('.my-class-img')\n */\n static findParentByClass(element, classname, untilNode) {\n if (!Array.isArray(classname)) {\n classname = [classname];\n }\n const check = (el) => {\n for (let classnameTemp of classname) {\n if (el instanceof Element && el['classList'].contains(classnameTemp)) {\n return true;\n }\n }\n return false;\n };\n return this.findParent(element, check, untilNode);\n }\n static findParentByType(element, types, untilNode) {\n if (!Array.isArray(types)) {\n types = [types];\n }\n let isValid = true;\n for (let type of types) {\n if (typeof type == \"function\" && type['prototype']['constructor'])\n continue;\n isValid = false;\n }\n if (isValid) {\n let checkFunc = (el) => {\n for (let type of types) {\n const t = type;\n if (el instanceof t) {\n return true;\n }\n }\n return false;\n };\n return this.findParent(element, checkFunc, untilNode);\n }\n console.error(\"you must provide a class inside this function\");\n return null;\n }\n /**\n * Find list of parents by tagname\n */\n static findParentsByTag(element, tagname, untilNode) {\n let el = element;\n if (Array.isArray(tagname)) {\n for (let i = 0; i < tagname.length; i++) {\n tagname[i] = tagname[i].toLowerCase();\n }\n }\n else {\n tagname = [tagname.toLowerCase()];\n }\n let check = (el) => {\n if (el instanceof Element) {\n return tagname.indexOf((el.nodeName || el.tagName).toLowerCase()) != -1;\n }\n return tagname.indexOf(el.nodeName.toLowerCase()) != -1;\n };\n return this.findParents(element, check, untilNode);\n }\n /**\n * Check if element contains a child\n */\n static containsChild(element, child) {\n let rootScope = element.getRootNode();\n let elScope = child.getRootNode();\n while (elScope != rootScope) {\n if (!elScope['host']) {\n return false;\n }\n child = elScope['host'];\n elScope = elScope['host'].getRootNode();\n }\n return element.contains(child);\n }\n /**\n * Get element inside slot\n */\n static getElementsInSlot(element, slotName) {\n let result = [];\n if (element.shadowRoot) {\n let slotEl;\n if (slotName) {\n slotEl = element.shadowRoot.querySelector('slot[name=\"' + slotName + '\"]');\n }\n else {\n slotEl = element.shadowRoot.querySelector(\"slot:not([name])\");\n if (!slotEl) {\n slotEl = element.shadowRoot.querySelector(\"slot\");\n }\n }\n while (true) {\n if (!slotEl) {\n return result;\n }\n var listChild = Array.from(slotEl.assignedElements());\n if (!listChild) {\n return result;\n }\n let slotFound = false;\n for (let i = 0; i < listChild.length; i++) {\n let child = listChild[i];\n if (listChild[i].nodeName == \"SLOT\") {\n slotEl = listChild[i];\n slotFound = true;\n }\n else if (child instanceof HTMLElement) {\n result.push(child);\n }\n }\n if (!slotFound) {\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get element inside slot\n */\n static getNodesInSlot(element, slotName) {\n let result = [];\n if (element.shadowRoot) {\n let slotEl;\n if (slotName) {\n slotEl = element.shadowRoot.querySelector('slot[name=\"' + slotName + '\"]');\n }\n else {\n slotEl = element.shadowRoot.querySelector(\"slot:not([name])\");\n if (!slotEl) {\n slotEl = element.shadowRoot.querySelector(\"slot\");\n }\n }\n while (true) {\n if (!slotEl) {\n return result;\n }\n var listChild = Array.from(slotEl.assignedNodes());\n if (!listChild) {\n return result;\n }\n let slotFound = false;\n for (let i = 0; i < listChild.length; i++) {\n let child = listChild[i];\n if (listChild[i].nodeName == \"SLOT\") {\n slotEl = listChild[i];\n slotFound = true;\n }\n else if (child instanceof Node) {\n result.push(child);\n }\n }\n if (!slotFound) {\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get deeper element inside dom at the position X and Y\n */\n static getElementAtPosition(x, y, startFrom) {\n const _realTarget = (el, i = 0) => {\n if (i == 50) {\n debugger;\n }\n if (el.shadowRoot && x !== undefined && y !== undefined) {\n const elements = el.shadowRoot.elementsFromPoint(x, y);\n var newEl = elements.length > 0 ? elements[0] : null;\n if (newEl && newEl != el && (el.shadowRoot.contains(newEl) || el.contains(newEl))) {\n return _realTarget(newEl, i + 1);\n }\n }\n return el;\n };\n if (startFrom == null) {\n startFrom = document.body;\n }\n return _realTarget(startFrom);\n }\n /**\n * Get active element from the define root\n */\n static getActiveElement(root = document) {\n if (!root)\n return null;\n let el = root.activeElement;\n while (el instanceof WebComponent) {\n let elTemp = el.shadowRoot?.activeElement;\n if (!elTemp)\n return el;\n el = elTemp;\n }\n return el;\n }\n}\nElementExtension.Namespace=`Aventus`;\n__as1(_, 'ElementExtension', ElementExtension);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.ElementExtension","required":false,"type":1,"isExported":true,"convertibleName":""}],"existing":[{"fullName":"Aventus.DebuggerConfig","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ActionBindings","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionInjection","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventCallback","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventListener","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ContextEdit","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.If","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Template","isStrong":false}]},{"fullName":"Aventus.LoopSimple","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.LoopFct","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.TemplateHTML","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DefaultComponent","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Last","dependencies":[{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.NotVoid","dependencies":[]},{"fullName":"Aventus.StringLiteral","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Constructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.OnlyConstructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.AnyConstructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.OnlyConstructor","isStrong":false}]},{"fullName":"Aventus.KeysObject","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Item","isStrong":false}]},{"fullName":"Aventus.RamSubscribers","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRam","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRamData","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.UriParamsValue","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.StateSlug","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}]},{"fullName":"Aventus.StateAskChangeFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.StateInactivationFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.UriParams","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderHeadOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.WindowResizeObserver","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"globalThis.ResizeObserver","isStrong":false}]},{"fullName":"Aventus.ResizeObserverOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Pointer","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InstanceCst","dependencies":[]},{"fullName":"Aventus.InstanceCst2","dependencies":[{"fullName":"X","isStrong":false}]},{"fullName":"Aventus.PressManagerState","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.Coordinate","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InternalCustomFunction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.InternalPointerEvent","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.PressManagerOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.TargetableElement","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DragElementLeftTop","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DragElementXY","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ContainerElement","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnyElement","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false}]},{"fullName":"Aventus.AnimationOptionsInternal","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnimationOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false}]},{"fullName":"Aventus.RouterOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.HttpRouterOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IsNotVoid","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.WatcherFunctionInternal","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherFunction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherAllowed","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.Asyncable","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Enum","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.EnumValue","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.JsonFromOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.JsonToOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ClassCopyOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.SchemaType","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IData","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Schema","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.SchemaType","isStrong":false}]},{"fullName":"Aventus.IConverterTransform","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}]},{"fullName":"Aventus.ExtractFromError","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}]},{"fullName":"Aventus.HttpRequestOptions","dependencies":[{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpResponse","isStrong":false}]},{"fullName":"Aventus.WatcherChange","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.EffectReceiver","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false}]},{"fullName":"Aventus.RouterType","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}]},{"fullName":"Aventus.RouteType","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRoute","isStrong":false}]},{"fullName":"Aventus.DragElement","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsShadow","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.Coordinate","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsInternal","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false}]},{"fullName":"Aventus.PreparedUri","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false}]},{"fullName":"Aventus.IRamAction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false}]},{"fullName":"Aventus.RamItem","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Resource","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false}]},{"fullName":"Aventus.StateActivationFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Subscriber","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.StateAction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.IStateManager","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.IState","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Loop","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Template","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false}]},{"fullName":"Aventus.ActionEvent","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionEventListener","isStrong":false},{"fullName":"Aventus.ActionEventCallback","isStrong":false}]},{"fullName":"Aventus.LoopRegistery","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false}]},{"fullName":"Aventus.ActionChange","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.Actions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Aventus.ActionEvent","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":false},{"fullName":"Aventus.ContextEdit","isStrong":false}]}]}
2756
+ {"namespace":"Aventus","available":[{"code":"if(!Object.hasOwn(window, \"AvInstance\")) {\r\n\tObject.defineProperty(window, \"AvInstance\", {\r\n\t\tget() {return Aventus?.Instance;}\r\n\t});\r\n\r\n\t(() => {\r\n\t\tMap.prototype._defaultHas = Map.prototype.has;\r\n\t\tMap.prototype._defaultSet = Map.prototype.set;\r\n\t\tMap.prototype._defaultGet = Map.prototype.get;\r\n\t\tMap.prototype.has = function(key) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultHas.call(this,key.getTarget())\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultHas.call(this,key);\r\n\t\t}\r\n\r\n\t\tMap.prototype.set = function(key, value) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultSet.call(this, key.getTarget(), value)\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultSet.call(this, key, value);\r\n\t\t}\r\n\t\tMap.prototype.get = function(key) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultGet.call(this, key.getTarget())\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultGet.call(this, key);\r\n\t\t}\r\n\t})();\r\n}","dependencies":[],"fullName":"!staticClass_d7c80a432731707ddadd54ea59a56049","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":" ","dependencies":[],"fullName":"!staticClass_b8b6866d7faef0c1b536e38915cc5583","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":"let Style=class Style {\n static instance;\n static noAnimation;\n static defaultStyleSheets = {\n \"@default\": `:host{display:inline-block;box-sizing:border-box}:host *{box-sizing:border-box}`,\n };\n static store(name, content) {\n this.getInstance().store(name, content);\n }\n static get(name) {\n return this.getInstance().get(name);\n }\n static getAsString(name) {\n return this.getInstance().getAsString(name);\n }\n static sheetToString(stylesheet) {\n return this.getInstance().sheetToString(stylesheet);\n }\n static load(name, url) {\n return this.getInstance().load(name, url);\n }\n static appendToHead(name) {\n if (!document.head.querySelector(`style[data-name=\"${name}\"]`)) {\n const styleNode = document.createElement('style');\n styleNode.setAttribute(`data-name`, name);\n styleNode.innerHTML = Style.getAsString(name);\n document.getElementsByTagName('head')[0].appendChild(styleNode);\n }\n }\n static refreshHead(name) {\n const styleNode = document.head.querySelector(`style[data-name=\"${name}\"]`);\n if (styleNode) {\n styleNode.innerHTML = Style.getAsString(name);\n }\n }\n static getInstance() {\n if (!this.instance) {\n this.instance = new Style();\n }\n return this.instance;\n }\n constructor() {\n for (let name in Style.defaultStyleSheets) {\n this.store(name, Style.defaultStyleSheets[name]);\n }\n Style.noAnimation = new CSSStyleSheet();\n Style.noAnimation.replaceSync(`:host{-webkit-transition: none !important;-moz-transition: none !important;-ms-transition: none !important;-o-transition: none !important;transition: none !important;}:host *{-webkit-transition: none !important;-moz-transition: none !important;-ms-transition: none !important;-o-transition: none !important;transition: none !important;}`);\n }\n stylesheets = new Map();\n async load(name, url) {\n try {\n let style = this.stylesheets.get(name);\n if (!style || style.cssRules.length == 0) {\n let txt = await (await fetch(url)).text();\n this.store(name, txt);\n }\n }\n catch (e) {\n }\n }\n store(name, content) {\n let style = this.stylesheets.get(name);\n if (!style) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(content);\n this.stylesheets.set(name, sheet);\n return sheet;\n }\n else {\n style.replaceSync(content);\n Style.refreshHead(name);\n return style;\n }\n }\n get(name) {\n let style = this.stylesheets.get(name);\n if (!style) {\n style = this.store(name, \"\");\n }\n return style;\n }\n getAsString(name) {\n return this.sheetToString(this.get(name));\n }\n sheetToString(stylesheet) {\n return stylesheet.cssRules\n ? Array.from(stylesheet.cssRules)\n .map(rule => rule.cssText || '')\n .join('\\n')\n : '';\n }\n}\nStyle.Namespace=`Aventus`;\n__as1(_, 'Style', Style);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.Style","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let uuidv4=function uuidv4() {\n let uid = '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, c => (Number(c) ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> Number(c) / 4).toString(16));\n return uid;\n}\n__as1(_, 'uuidv4', uuidv4);\n","dependencies":[],"fullName":"Aventus.uuidv4","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let sleep=function sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n__as1(_, 'sleep', sleep);\n","dependencies":[],"fullName":"Aventus.sleep","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let isSubclassOf=function isSubclassOf(subClass, superClass) {\n if (typeof subClass !== 'function' || typeof superClass !== 'function')\n return false;\n let proto = subClass.prototype;\n while (proto) {\n if (proto === superClass.prototype)\n return true;\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n__as1(_, 'isSubclassOf', isSubclassOf);\n","dependencies":[],"fullName":"Aventus.isSubclassOf","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let isClass=function isClass(v) {\n return typeof v === 'function' && /^\\s*class\\s+/.test(v.toString());\n}\n__as1(_, 'isClass', isClass);\n","dependencies":[],"fullName":"Aventus.isClass","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let setValueToObject=function setValueToObject(path, obj, value) {\n path = path.replace(/\\[(.*?)\\]/g, '.$1');\n const val = (key) => {\n if (obj instanceof Map) {\n return obj.get(key);\n }\n return obj[key];\n };\n let splitted = path.split(\".\");\n for (let i = 0; i < splitted.length - 1; i++) {\n let split = splitted[i];\n let value = val(split);\n if (!value) {\n obj[split] = {};\n value = obj[split];\n }\n obj = value;\n }\n if (obj instanceof Map) {\n obj.set(splitted[splitted.length - 1], value);\n }\n else {\n obj[splitted[splitted.length - 1]] = value;\n }\n}\n__as1(_, 'setValueToObject', setValueToObject);\n","dependencies":[],"fullName":"Aventus.setValueToObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let Mutex=class Mutex {\n /**\n * Array to store functions waiting for the mutex to become available.\n * @type {((run: boolean) => void)[]}\n */\n waitingList = [];\n /**\n * Indicates whether the mutex is currently locked or not.\n * @type {boolean}\n */\n isLocked = false;\n /**\n * Waits for the mutex to become available and then acquires it.\n * @returns {Promise<boolean>} A Promise that resolves to true if the mutex was acquired successfully.\n */\n waitOne() {\n return new Promise((resolve) => {\n if (this.isLocked) {\n this.waitingList.push((run) => {\n resolve(run);\n });\n }\n else {\n this.isLocked = true;\n resolve(true);\n }\n });\n }\n /**\n * Release the mutex\n */\n release() {\n let nextFct = this.waitingList.shift();\n if (nextFct) {\n nextFct(true);\n }\n else {\n this.isLocked = false;\n }\n }\n /**\n * Releases the mutex, allowing only the last function in the waiting list to acquire it.\n */\n releaseOnlyLast() {\n if (this.waitingList.length > 0) {\n let lastFct = this.waitingList.pop();\n for (let fct of this.waitingList) {\n fct(false);\n }\n this.waitingList = [];\n if (lastFct) {\n lastFct(true);\n }\n }\n else {\n this.isLocked = false;\n }\n }\n /**\n * Clears the mutex, removing all waiting functions and releasing the lock.\n */\n dispose() {\n this.waitingList = [];\n this.isLocked = false;\n }\n /**\n * Executes a callback function safely within the mutex lock and releases the lock afterward.\n * @template T - The type of the return value of the callback function.\n * @param {() => T} cb - The callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the callback function or null if an error occurs.\n */\n async safeRun(cb) {\n let result = null;\n await this.waitOne();\n try {\n result = cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.release();\n return result;\n }\n /**\n * Executes an asynchronous callback function safely within the mutex lock and releases the lock afterward.\n * @template T - The type of the return value of the asynchronous callback function.\n * @param {() => Promise<T>} cb - The asynchronous callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the asynchronous callback function or null if an error occurs.\n */\n async safeRunAsync(cb) {\n let result = null;\n await this.waitOne();\n try {\n result = await cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.release();\n return result;\n }\n /**\n * Executes a callback function safely within the mutex lock, allowing only the last function in the waiting list to acquire the lock, and releases the lock afterward.\n * @template T - The type of the return value of the callback function.\n * @param {() => T} cb - The callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the callback function or null if an error occurs.\n */\n async safeRunLast(cb) {\n let result = null;\n if (await this.waitOne()) {\n try {\n result = cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.releaseOnlyLast();\n }\n return result;\n }\n /**\n * Executes an asynchronous callback function safely within the mutex lock, allowing only the last function in the waiting list to acquire the lock, and releases the lock afterward.\n * @template T - The type of the return value of the asynchronous callback function.\n * @param {() => Promise<T>} cb - The asynchronous callback function to execute.\n * @returns {Promise<T | undefined>} A Promise that resolves to the result of the asynchronous callback function or undefined if an error occurs.\n */\n async safeRunLastAsync(cb) {\n let result;\n if (await this.waitOne()) {\n try {\n result = await cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.releaseOnlyLast();\n }\n return result;\n }\n}\nMutex.Namespace=`Aventus`;\n__as1(_, 'Mutex', Mutex);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.Mutex","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ActionGuard=class ActionGuard {\n /**\n * Map to store actions that are currently running.\n * @type {Map<any[], ((res: any) => void)[]>}\n * @private\n */\n runningAction = new Map();\n run(keys, action) {\n return new Promise(async (resolve) => {\n if (typeof keys == 'function') {\n action = keys;\n keys = [];\n }\n if (!action) {\n throw \"No action inside the Mutex.run\";\n }\n let actions = undefined;\n let runningKeys = Array.from(this.runningAction.keys());\n for (let runningKey of runningKeys) {\n if (runningKey.length == keys.length) {\n let found = true;\n for (let i = 0; i < keys.length; i++) {\n if (runningKey[i] != keys[i]) {\n found = false;\n break;\n }\n }\n if (found) {\n actions = this.runningAction.get(runningKey);\n break;\n }\n }\n }\n if (actions) {\n actions.push((res) => {\n resolve(res);\n });\n }\n else {\n this.runningAction.set(keys, []);\n let res = await action();\n let actions = this.runningAction.get(keys);\n if (actions) {\n for (let action of actions) {\n action(res);\n }\n }\n this.runningAction.delete(keys);\n resolve(res);\n }\n });\n }\n}\nActionGuard.Namespace=`Aventus`;\n__as1(_, 'ActionGuard', ActionGuard);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.ActionGuard","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"var RamErrorCode;\n(function (RamErrorCode) {\n RamErrorCode[RamErrorCode[\"unknow\"] = 0] = \"unknow\";\n RamErrorCode[RamErrorCode[\"noId\"] = 1] = \"noId\";\n RamErrorCode[RamErrorCode[\"noItemInsideRam\"] = 2] = \"noItemInsideRam\";\n})(RamErrorCode || (RamErrorCode = {}));\n__as1(_, 'RamErrorCode', RamErrorCode);\n","dependencies":[],"fullName":"Aventus.RamErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let ResourceLoader=class ResourceLoader {\n static headerLoaded = {};\n static headerWaiting = {};\n /**\n * Load the resource inside the head tag\n */\n static async loadInHead(options) {\n const _options = this.prepareOptions(options);\n if (this.headerLoaded[_options.url]) {\n return true;\n }\n else if (this.headerWaiting.hasOwnProperty(_options.url)) {\n return await this.awaitFctHead(_options.url);\n }\n else {\n this.headerWaiting[_options.url] = [];\n let tagEl;\n if (_options.type == \"js\") {\n tagEl = document.createElement(\"SCRIPT\");\n }\n else if (_options.type == \"css\") {\n tagEl = document.createElement(\"LINK\");\n tagEl.setAttribute(\"rel\", \"stylesheet\");\n }\n else {\n throw \"unknow type \" + _options.type + \" to append into head\";\n }\n if (_options.nonce) {\n tagEl.setAttribute(\"nonce\", _options.nonce);\n }\n document.head.appendChild(tagEl);\n let result = await this.loadTag(tagEl, _options.url);\n this.headerLoaded[_options.url] = true;\n this.releaseAwaitFctHead(_options.url, result);\n return result;\n }\n }\n static loadTag(tagEl, url) {\n return new Promise((resolve, reject) => {\n tagEl.addEventListener(\"load\", (e) => {\n resolve(true);\n });\n tagEl.addEventListener(\"error\", (e) => {\n resolve(false);\n });\n if (tagEl instanceof HTMLLinkElement) {\n tagEl.setAttribute(\"href\", url);\n }\n else {\n tagEl.setAttribute('src', url);\n }\n });\n }\n static releaseAwaitFctHead(url, result) {\n if (this.headerWaiting[url]) {\n for (let i = 0; i < this.headerWaiting[url].length; i++) {\n this.headerWaiting[url][i](result);\n }\n delete this.headerWaiting[url];\n }\n }\n static awaitFctHead(url) {\n return new Promise((resolve) => {\n this.headerWaiting[url].push((result) => {\n resolve(result);\n });\n });\n }\n static requestLoaded = {};\n static requestWaiting = {};\n /**\n *\n */\n static async load(options) {\n options = this.prepareOptions(options);\n if (this.requestLoaded[options.url]) {\n return this.requestLoaded[options.url];\n }\n else if (this.requestWaiting.hasOwnProperty(options.url)) {\n await this.awaitFct(options.url);\n return this.requestLoaded[options.url];\n }\n else {\n this.requestWaiting[options.url] = [];\n let blob = false;\n if (options.type == \"img\") {\n blob = true;\n }\n let content = await this.fetching(options.url, blob);\n if (options.type == \"img\" && content.startsWith(\"data:text/html;\")) {\n console.error(\"Can't load img \" + options.url);\n content = \"\";\n }\n this.requestLoaded[options.url] = content;\n this.releaseAwaitFct(options.url);\n return content;\n }\n }\n static releaseAwaitFct(url) {\n if (this.requestWaiting[url]) {\n for (let i = 0; i < this.requestWaiting[url].length; i++) {\n this.requestWaiting[url][i]();\n }\n delete this.requestWaiting[url];\n }\n }\n static awaitFct(url) {\n return new Promise((resolve) => {\n this.requestWaiting[url].push(() => {\n resolve('');\n });\n });\n }\n static async fetching(url, useBlob = false) {\n if (useBlob) {\n let result = await fetch(url, {\n headers: {\n responseType: 'blob'\n }\n });\n let blob = await result.blob();\n return await this.readFile(blob);\n }\n else {\n let result = await fetch(url);\n return await result.text();\n }\n }\n static readFile(blob) {\n return new Promise((resolve) => {\n var reader = new FileReader();\n reader.onloadend = function () {\n resolve(reader.result);\n };\n reader.readAsDataURL(blob);\n });\n }\n static imgExtensions = [\"png\", \"jpg\", \"jpeg\", \"gif\"];\n static prepareOptions(options) {\n let result;\n if (typeof options === 'string' || options instanceof String) {\n result = {\n url: options,\n type: 'js'\n };\n let splittedURI = result.url.split('.');\n let extension = splittedURI[splittedURI.length - 1];\n extension = extension.split(\"?\")[0];\n if (extension == \"svg\") {\n result.type = 'svg';\n }\n else if (extension == \"js\") {\n result.type = 'js';\n }\n else if (extension == \"css\") {\n result.type = 'css';\n }\n else if (this.imgExtensions.indexOf(extension) != -1) {\n result.type = 'img';\n }\n else {\n delete result.type;\n }\n }\n else {\n result = options;\n }\n return result;\n }\n}\nResourceLoader.Namespace=`Aventus`;\n__as1(_, 'ResourceLoader', ResourceLoader);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResourceLoaderHeadOptions","isStrong":false},{"fullName":"Aventus.ResourceLoaderOptions","isStrong":false}],"fullName":"Aventus.ResourceLoader","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let DragElementXYType= [SVGGElement, SVGRectElement, SVGEllipseElement, SVGTextElement];\n__as1(_, 'DragElementXYType', DragElementXYType);\n","dependencies":[],"fullName":"Aventus.DragElementXYType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let DragElementLeftTopType= [HTMLElement, SVGSVGElement];\n__as1(_, 'DragElementLeftTopType', DragElementLeftTopType);\n","dependencies":[],"fullName":"Aventus.DragElementLeftTopType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let NormalizedEvent=class NormalizedEvent {\n _event;\n get event() {\n return this._event;\n }\n constructor(event) {\n this._event = event;\n }\n getProp(prop) {\n if (prop in this.event) {\n return this.event[prop];\n }\n return undefined;\n }\n stopImmediatePropagation() {\n this.event.stopImmediatePropagation();\n }\n get clientX() {\n if ('clientX' in this.event) {\n return this.event.clientX;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].clientX;\n }\n return 0;\n }\n get clientY() {\n if ('clientY' in this.event) {\n return this.event.clientY;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].clientY;\n }\n return 0;\n }\n get pageX() {\n if ('pageX' in this.event) {\n return this.event.pageX;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].pageX;\n }\n return 0;\n }\n get pageY() {\n if ('pageY' in this.event) {\n return this.event.pageY;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].pageY;\n }\n return 0;\n }\n get type() {\n return this.event.type;\n }\n get target() {\n return this.event.target;\n }\n get timeStamp() {\n return this.event.timeStamp;\n }\n get pointerType() {\n if ('TouchEvent' in window && this._event instanceof TouchEvent)\n return \"touch\";\n return this.getProp(\"pointerType\");\n }\n get button() {\n return this.getProp(\"button\");\n }\n get isTouch() {\n if ('TouchEvent' in window && this._event instanceof TouchEvent)\n return true;\n return this._event.pointerType == \"touch\";\n }\n}\nNormalizedEvent.Namespace=`Aventus`;\n__as1(_, 'NormalizedEvent', NormalizedEvent);\n","dependencies":[{"fullName":"T","isStrong":false}],"fullName":"Aventus.NormalizedEvent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Callback=class Callback {\n callbacks = new Map();\n /**\n * Clear all callbacks\n */\n clear() {\n this.callbacks.clear();\n }\n /**\n * Add a callback\n */\n add(cb, scope = null) {\n if (!this.callbacks.has(cb)) {\n this.callbacks.set(cb, scope);\n }\n }\n /**\n * Remove a callback\n */\n remove(cb) {\n this.callbacks.delete(cb);\n }\n /**\n * Trigger all callbacks\n */\n trigger(...args) {\n let result = [];\n let cbs = [...this.callbacks];\n for (let [cb, scope] of cbs) {\n result.push(cb.apply(scope, args));\n }\n return result;\n }\n}\nCallback.Namespace=`Aventus`;\n__as1(_, 'Callback', Callback);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.Callback","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let CallbackGroup=class CallbackGroup {\n callbacks = {};\n /**\n * Clear all callbacks\n */\n clearAll() {\n this.callbacks = {};\n }\n /**\n * Clear all callbacks for a specific group\n */\n clear(group) {\n delete this.callbacks[group];\n }\n /**\n * Add a callback for a group\n */\n add(group, cb, scope = null) {\n if (!this.callbacks[group]) {\n this.callbacks[group] = new Map();\n }\n if (!this.callbacks[group].has(cb)) {\n this.callbacks[group].set(cb, scope);\n }\n }\n /**\n * Remove a callback for a group\n */\n remove(group, cb) {\n if (this.callbacks[group]) {\n this.callbacks[group].delete(cb);\n }\n }\n /**\n * Trigger all callbacks inside a group\n */\n trigger(group, ...args) {\n if (this.callbacks[group]) {\n let cbs = [...this.callbacks[group]];\n for (let [cb, scope] of cbs) {\n cb.apply(scope, args);\n }\n }\n }\n}\nCallbackGroup.Namespace=`Aventus`;\n__as1(_, 'CallbackGroup', CallbackGroup);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.CallbackGroup","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Resource=class Resource {\n}\nResource.Namespace=`Aventus`;\n__as1(_, 'Resource', Resource);\n","dependencies":[],"fullName":"Aventus.Resource","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Request=class Request {\n}\nRequest.Namespace=`Aventus`;\n__as1(_, 'Request', Request);\n","dependencies":[],"fullName":"Aventus.Request","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let compareObject=function compareObject(obj1, obj2, tableOrder = true) {\n if (Array.isArray(obj1)) {\n if (!Array.isArray(obj2)) {\n return false;\n }\n obj2 = obj2.slice();\n if (obj1.length !== obj2.length) {\n return false;\n }\n if (tableOrder) {\n for (let i = 0; i < obj1.length; i++) {\n if (!compareObject(obj1[i], obj2[i])) {\n return false;\n }\n }\n return true;\n }\n else {\n for (let i = 0; i < obj1.length; i++) {\n let foundElement = false;\n for (let j = 0; j < obj2.length; j++) {\n if (compareObject(obj1[i], obj2[j])) {\n obj2.splice(j, 1);\n foundElement = true;\n break;\n }\n }\n if (!foundElement) {\n return false;\n }\n }\n }\n return true;\n }\n else if (typeof obj1 === 'object' && obj1 !== undefined && obj1 !== null) {\n if (typeof obj2 !== 'object' || obj2 === undefined || obj2 === null) {\n return false;\n }\n if (obj1 == obj2) {\n return true;\n }\n if (obj1 instanceof HTMLElement || obj2 instanceof HTMLElement) {\n return false;\n }\n if (obj1 instanceof Date || obj2 instanceof Date) {\n return obj1.toString() === obj2.toString();\n }\n let oneProxy = false;\n if (Watcher.is(obj1)) {\n oneProxy = true;\n obj1 = Watcher.extract(obj1, false);\n }\n if (Watcher.is(obj2)) {\n oneProxy = true;\n obj2 = Watcher.extract(obj2, false);\n }\n if (obj1 instanceof Map && obj2 instanceof Map) {\n if (obj1.size != obj2.size) {\n return false;\n }\n const keys = obj1.keys();\n for (let key in keys) {\n if (!obj2.has(key)) {\n return false;\n }\n if (!compareObject(obj1.get(key), obj2.get(key))) {\n return false;\n }\n }\n return true;\n }\n else {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n return false;\n }\n for (let key in obj1) {\n if (oneProxy && Watcher['__reservedName'][key]) {\n continue;\n }\n if (!(key in obj2)) {\n return false;\n }\n if (!compareObject(obj1[key], obj2[key])) {\n return false;\n }\n }\n return true;\n }\n }\n else {\n return obj1 === obj2;\n }\n}\n__as1(_, 'compareObject', compareObject);\n","dependencies":[{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.compareObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let getValueFromObject=function getValueFromObject(path, obj) {\n if (path === undefined) {\n path = '';\n }\n path = path.replace(/\\[(.*?)\\]/g, '.$1');\n if (path == \"\") {\n return obj;\n }\n const val = (key) => {\n if (obj instanceof Map) {\n return obj.get(key);\n }\n return obj[key];\n };\n let splitted = path.split(\".\");\n for (let i = 0; i < splitted.length - 1; i++) {\n let split = splitted[i];\n let value = val(split);\n if (!value || typeof value !== 'object') {\n return undefined;\n }\n obj = value;\n }\n if (!obj || typeof obj !== 'object') {\n return undefined;\n }\n return val(splitted[splitted.length - 1]);\n}\n__as1(_, 'getValueFromObject', getValueFromObject);\n","dependencies":[],"fullName":"Aventus.getValueFromObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"var WatchAction;\n(function (WatchAction) {\n WatchAction[WatchAction[\"CREATED\"] = 0] = \"CREATED\";\n WatchAction[WatchAction[\"UPDATED\"] = 1] = \"UPDATED\";\n WatchAction[WatchAction[\"DELETED\"] = 2] = \"DELETED\";\n})(WatchAction || (WatchAction = {}));\n__as1(_, 'WatchAction', WatchAction);\n","dependencies":[],"fullName":"Aventus.WatchAction","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let Async=function Async(el) {\n return new Promise((resolve) => {\n if (el instanceof Promise) {\n el.then(resolve);\n }\n else {\n resolve(el);\n }\n });\n}\n__as1(_, 'Async', Async);\n","dependencies":[{"fullName":"Aventus.Asyncable","isStrong":false}],"fullName":"Aventus.Async","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"var HttpMethod;\n(function (HttpMethod) {\n HttpMethod[\"GET\"] = \"GET\";\n HttpMethod[\"POST\"] = \"POST\";\n HttpMethod[\"DELETE\"] = \"DELETE\";\n HttpMethod[\"PUT\"] = \"PUT\";\n HttpMethod[\"OPTION\"] = \"OPTION\";\n})(HttpMethod || (HttpMethod = {}));\n__as1(_, 'HttpMethod', HttpMethod);\n","dependencies":[],"fullName":"Aventus.HttpMethod","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"var HttpErrorCode;\n(function (HttpErrorCode) {\n HttpErrorCode[HttpErrorCode[\"unknow\"] = 0] = \"unknow\";\n})(HttpErrorCode || (HttpErrorCode = {}));\n__as1(_, 'HttpErrorCode', HttpErrorCode);\n","dependencies":[],"fullName":"Aventus.HttpErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let DateConverter=class DateConverter {\n static __converter = new DateConverter();\n static get converter() {\n return this.__converter;\n }\n static set converter(value) {\n this.__converter = value;\n }\n isStringDate(txt) {\n return /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{3,6})Z$/.exec(txt) !== null;\n }\n fromString(txt) {\n return new Date(txt);\n }\n toString(date) {\n if (date.getFullYear() < 100) {\n return \"0001-01-01T00:00:00.000Z\";\n }\n return date.toISOString();\n }\n}\nDateConverter.Namespace=`Aventus`;\n__as1(_, 'DateConverter', DateConverter);\n","dependencies":[],"fullName":"Aventus.DateConverter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Json=class Json {\n /**\n * Converts a JavaScript class instance to a JSON object.\n * @template T - The type of the object to convert.\n * @param {T} obj - The object to convert to JSON.\n * @param {JsonToOptions} [options] - Options for JSON conversion.\n * @returns {{ [key: string | number]: any; }} Returns the JSON representation of the object.\n */\n static classToJson(obj, options) {\n const realOptions = {\n isValidKey: options?.isValidKey ?? (() => true),\n replaceKey: options?.replaceKey ?? ((key) => key),\n transformValue: options?.transformValue ?? ((key, value) => value),\n beforeEnd: options?.beforeEnd ?? ((res) => res)\n };\n return this.__classToJson(obj, realOptions);\n }\n static __classToJson(obj, options) {\n let result = {};\n let descriptors = Object.getOwnPropertyDescriptors(obj);\n for (let key in descriptors) {\n if (options.isValidKey(key))\n result[options.replaceKey(key)] = options.transformValue(key, descriptors[key].value);\n }\n let cst = obj.constructor;\n while (cst.prototype && cst != Object.prototype) {\n let descriptorsClass = Object.getOwnPropertyDescriptors(cst.prototype);\n for (let key in descriptorsClass) {\n if (options.isValidKey(key)) {\n let descriptor = descriptorsClass[key];\n if (descriptor?.get) {\n const o = obj;\n result[options.replaceKey(key)] = options.transformValue(key, o[key]);\n }\n }\n }\n cst = Object.getPrototypeOf(cst);\n }\n result = options.beforeEnd(result);\n return result;\n }\n /**\n * Converts a JSON object to a JavaScript class instance.\n * @template T - The type of the object to convert.\n * @param {T} obj - The object to populate with JSON data.\n * @param {*} data - The JSON data to populate the object with.\n * @param {JsonFromOptions} [options] - Options for JSON deserialization.\n * @returns {T} Returns the populated object.\n */\n static classFromJson(obj, data, options) {\n let realOptions = {\n transformValue: options?.transformValue ?? ((key, value) => value),\n replaceUndefined: options?.replaceUndefined ?? false,\n replaceUndefinedWithKey: options?.replaceUndefinedWithKey ?? false,\n };\n return this.__classFromJson(obj, data, realOptions);\n }\n static __classFromJson(obj, data, options) {\n let props = Object.getOwnPropertyNames(obj);\n for (let prop of props) {\n let propUpperFirst = prop[0].toUpperCase() + prop.slice(1);\n let value = data[prop] === undefined ? data[propUpperFirst] : data[prop];\n if (value !== undefined || options.replaceUndefined || (options.replaceUndefinedWithKey && (Object.hasOwn(data, prop) || Object.hasOwn(data, propUpperFirst)))) {\n let propInfo = Object.getOwnPropertyDescriptor(obj, prop);\n if (propInfo?.writable) {\n const o = obj;\n o[prop] = options.transformValue(prop, value);\n }\n }\n }\n let cstTemp = obj.constructor;\n while (cstTemp.prototype && cstTemp != Object.prototype) {\n props = Object.getOwnPropertyNames(cstTemp.prototype);\n for (let prop of props) {\n let propUpperFirst = prop[0].toUpperCase() + prop.slice(1);\n let value = data[prop] === undefined ? data[propUpperFirst] : data[prop];\n if (value !== undefined || options.replaceUndefined || (options.replaceUndefinedWithKey && (Object.hasOwn(data, prop) || Object.hasOwn(data, propUpperFirst)))) {\n let propInfo = Object.getOwnPropertyDescriptor(cstTemp.prototype, prop);\n if (propInfo?.set) {\n const o = obj;\n o[prop] = options.transformValue(prop, value);\n }\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n return obj;\n }\n}\nJson.Namespace=`Aventus`;\n__as1(_, 'Json', Json);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.JsonToOptions","isStrong":false},{"fullName":"Aventus.JsonFromOptions","isStrong":false}],"fullName":"Aventus.Json","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ConverterTransform=class ConverterTransform {\n transform(data) {\n return this.transformLoop(data);\n }\n createInstance(data) {\n if (data.$type) {\n let cst = Converter.info.get(data.$type);\n if (cst) {\n return new cst();\n }\n }\n return undefined;\n }\n beforeTransformObject(obj) {\n }\n afterTransformObject(obj) {\n }\n transformLoop(data) {\n if (data === null) {\n return data;\n }\n if (Array.isArray(data)) {\n let result = [];\n for (let element of data) {\n result.push(this.transformLoop(element));\n }\n return result;\n }\n if (data instanceof Date) {\n return data;\n }\n if (typeof data === 'object' && !/^\\s*class\\s+/.test(data.toString())) {\n let objTemp = this.createInstance(data);\n if (objTemp) {\n if (objTemp instanceof Map) {\n if (data.values) {\n for (const keyValue of data.values) {\n objTemp.set(this.transformLoop(keyValue[0]), this.transformLoop(keyValue[1]));\n }\n }\n return objTemp;\n }\n let obj = objTemp;\n this.beforeTransformObject(obj);\n if (obj.fromJSON) {\n obj = obj.fromJSON(data);\n }\n else {\n obj = Json.classFromJson(obj, data, {\n transformValue: (key, value) => {\n if (obj[key] instanceof Date) {\n return value ? new Date(value) : null;\n }\n else if (typeof value == 'string' && DateConverter.converter.isStringDate(value)) {\n return value ? DateConverter.converter.fromString(value) : null;\n }\n else if (obj[key] instanceof Map) {\n let map = new Map();\n if (\"$type\" in value && value['$type'] == \"Aventus.Map\") {\n value = value.values;\n }\n for (const keyValue of value) {\n map.set(this.transformLoop(keyValue[0]), this.transformLoop(keyValue[1]));\n }\n return map;\n }\n else if (obj instanceof Data) {\n let cst = obj.constructor;\n if (cst.$schema[key] == 'boolean') {\n return value ? true : false;\n }\n else if (cst.$schema[key] == 'number') {\n return isNaN(Number(value)) ? 0 : Number(value);\n }\n else if (cst.$schema[key] == 'number') {\n return isNaN(Number(value)) ? 0 : Number(value);\n }\n else if (cst.$schema[key] == 'Date') {\n return value ? new Date(value) : null;\n }\n }\n return this.transformLoop(value);\n }\n });\n }\n this.afterTransformObject(obj);\n return obj;\n }\n let result = {};\n for (let key in data) {\n result[key] = this.transformLoop(data[key]);\n }\n return result;\n }\n if (typeof data == 'string' && /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{3})Z$/.exec(data)) {\n return new Date(data);\n }\n return data;\n }\n copyValuesClass(target, src, options) {\n const realOptions = {\n isValidKey: options?.isValidKey ?? (() => true),\n replaceKey: options?.replaceKey ?? ((key) => key),\n transformValue: options?.transformValue ?? ((key, value) => value),\n };\n this.__classCopyValues(target, src, realOptions);\n }\n __classCopyValues(target, src, options) {\n let props = Object.getOwnPropertyNames(target);\n for (let prop of props) {\n let propInfo = Object.getOwnPropertyDescriptor(target, prop);\n if (propInfo?.writable) {\n if (options.isValidKey(prop)) {\n const _target = target;\n const _src = src;\n _target[options.replaceKey(prop)] = options.transformValue(prop, _src[prop]);\n }\n }\n }\n let cstTemp = target.constructor;\n while (cstTemp.prototype && cstTemp != Object.prototype) {\n props = Object.getOwnPropertyNames(cstTemp.prototype);\n for (let prop of props) {\n let propInfo = Object.getOwnPropertyDescriptor(cstTemp.prototype, prop);\n if (propInfo?.set && propInfo.get) {\n if (options.isValidKey(prop)) {\n const _target = target;\n const _src = src;\n _target[options.replaceKey(prop)] = options.transformValue(prop, _src[prop]);\n }\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n }\n}\nConverterTransform.Namespace=`Aventus`;\n__as1(_, 'ConverterTransform', ConverterTransform);\n","dependencies":[{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false},{"fullName":"Aventus.Data","isStrong":false}],"fullName":"Aventus.ConverterTransform","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Converter=class Converter {\n /**\n * Map storing information about registered types.\n */\n static info = new Map([[\"Aventus.Map\", Map]]);\n /**\n * Map storing schemas for registered types.\n */\n static schema = new Map();\n /**\n * Internal converter instance.\n */\n static __converter = new ConverterTransform();\n /**\n * Getter for the internal converter instance.\n */\n static get converterTransform() {\n return this.__converter;\n }\n /**\n * Sets the converter instance.\n * @param converter The converter instance to set.\n */\n static setConverter(converter) {\n this.__converter = converter;\n }\n /**\n * Registers a unique string type for any class.\n * @param $type The unique string type identifier.\n * @param cst The constructor function for the class.\n * @param schema Optional schema for the registered type.\n */\n static register($type, cst, schema) {\n this.info.set($type, cst);\n if (schema) {\n this.schema.set($type, schema);\n }\n }\n /**\n * Transforms the provided data using the current converter instance.\n * @template T\n * @param {*} data The data to transform.\n * @param {IConverterTransform} [converter] Optional converter instance to use for transformation.\n * @returns {T} Returns the transformed data.\n */\n static transform(data, converter) {\n if (!converter) {\n converter = this.converterTransform;\n }\n return converter.transform(data);\n }\n /**\n * Copies values from one class instance to another using the current converter instance.\n * @template T\n * @param {T} to The destination class instance to copy values into.\n * @param {T} from The source class instance to copy values from.\n * @param {ClassCopyOptions} [options] Optional options for the copy operation.\n * @param {IConverterTransform} [converter] Optional converter instance to use for the copy operation.\n * @returns {T} Returns the destination class instance with copied values.\n */\n static copyValuesClass(to, from, options, converter) {\n if (!converter) {\n converter = this.converterTransform;\n }\n return converter.copyValuesClass(to, from, options);\n }\n}\nConverter.Namespace=`Aventus`;\n__as1(_, 'Converter', Converter);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Schema","isStrong":true},{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Aventus.ConverterTransform","isStrong":true},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}],"fullName":"Aventus.Converter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let clone=function clone(item) {\n return Converter.transform(JSON.parse(JSON.stringify(item)));\n}\n__as1(_, 'clone', clone);\n","dependencies":[{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.clone","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let HttpResponse=class HttpResponse {\n get status() {\n return this.response.status;\n }\n get statusText() {\n return this.response.statusText;\n }\n get redirected() {\n return this.response.redirected;\n }\n get ok() {\n return this.response.ok;\n }\n get type() {\n return this.response.type;\n }\n get url() {\n return this.response.url;\n }\n get headers() {\n return this.response.headers;\n }\n response;\n constructor(response) {\n this.response = response;\n }\n bodyUsed = false;\n bodyContent;\n async json() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.json();\n }\n return Converter.transform(this.bodyContent);\n }\n async blob() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.blob();\n }\n return this.bodyContent;\n }\n async text() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.text();\n }\n return this.bodyContent;\n }\n}\nHttpResponse.Namespace=`Aventus`;\n__as1(_, 'HttpResponse', HttpResponse);\n","dependencies":[{"fullName":"T","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.HttpResponse","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Data=// @Dependencies([{ type: Aventus.Converter, strong: true }, { type: Converter, strong: true }])\nclass Data {\n static converter = new Converter();\n /**\n * The schema for the class\n */\n static $schema;\n /**\n * The current namespace\n */\n static Namespace = \"\";\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n /**\n * Get the name of the class\n */\n get className() {\n return this.constructor.name;\n }\n /**\n * Get a JSON for the current object\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key)\n });\n }\n /**\n * Clone the object by transforming a parsed JSON string back into the original type\n */\n clone() {\n return Converter.transform(JSON.parse(JSON.stringify(this)));\n }\n}\nData.Namespace=`Aventus`;\nData.$schema={\"namespace\":\"string\",\"$type\":\"string\",\"className\":\"string\"};\nConverter.register(Data.Fullname, Data);\n__as1(_, 'Data', Data);\n","dependencies":[{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Converter","isStrong":true},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"Aventus.Data","required":false,"type":2,"isExported":true,"convertibleName":""},{"code":"let HttpCache=class HttpCache {\n static cache = new Map();\n static async fetch(fullUrl, request) {\n const key = this.generateCacheKey(fullUrl, request);\n if (key) {\n const value = this.cache.get(key);\n if (value)\n return value;\n }\n const result = await fetch(fullUrl, request);\n const response = new HttpResponse(result);\n if (key)\n this.cache.set(key, response);\n return response;\n }\n static clear(fullUrl, request) {\n const key = this.generateCacheKey(fullUrl, request);\n if (key) {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n }\n }\n static generateCacheKey(fullUrl, request) {\n const method = request.method;\n const body = request.body;\n let bodyKey = \"\";\n if (typeof body == 'string') {\n bodyKey = this.hashStringToInt(body) + '';\n }\n else if (body instanceof FormData) {\n }\n return fullUrl + \"°\" + method + \"°\" + bodyKey;\n }\n static hashStringToInt(str) {\n let hash = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);\n }\n return hash >>> 0;\n }\n}\nHttpCache.Namespace=`Aventus`;\n__as1(_, 'HttpCache', HttpCache);\n","dependencies":[{"fullName":"Aventus.HttpResponse","isStrong":true}],"fullName":"Aventus.HttpCache","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let GenericError=// @Dependencies([{ type: Aventus.Converter, strong: true }, { type: Converter, strong: true }])\nclass GenericError {\n static converter = new Converter();\n static get Fullname() { return \"Aventus.GenericError\"; }\n /**\n * Code for the error\n */\n code;\n /**\n * Description of the error\n */\n message;\n /**\n * Additional details related to the error.\n */\n details = [];\n /**\n * Creates a new instance of GenericError.\n * @param {EnumValue<T>} code - The error code.\n * @param {string | Error | unknown} message - The error message.\n */\n constructor(code, message) {\n this.code = code;\n if (message instanceof Error) {\n this.message = message.message;\n }\n else {\n this.message = message + '';\n }\n }\n}\nGenericError.Namespace=`Aventus`;\nGenericError.$schema={\"code\":\"Aventus.EnumValue\",\"message\":\"string\"};\nConverter.register(GenericError.Fullname, GenericError);\n__as1(_, 'GenericError', GenericError);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.Converter","isStrong":true},{"fullName":"Aventus.EnumValue","isStrong":false}],"fullName":"Aventus.GenericError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let VoidWithError=class VoidWithError {\n static get Fullname() { return \"Aventus.VoidWithError\"; }\n /**\n * Determine if the action is a success\n */\n get success() {\n return this.errors.length == 0;\n }\n /**\n * List of errors\n */\n errors = [];\n /**\n * Converts the current instance to a VoidWithError object.\n * @returns {VoidWithError} A new instance of VoidWithError with the same error list.\n */\n toGeneric() {\n const result = new VoidWithError();\n result.errors = this.errors;\n return result;\n }\n /**\n * Checks if the error list contains a specific error code.\n * @template U - The type of error, extending GenericError.\n * @template T - The type of the error code, which extends either number or Enum.\n * @param {EnumValue<T>} code - The error code to check for.\n * @param {new (...args: any[]) => U} [type] - Optional constructor function of the error type.\n * @returns {boolean} True if the error list contains the specified error code, otherwise false.\n */\n containsCode(code, type) {\n if (type) {\n for (let error of this.errors) {\n if (error instanceof type) {\n if (error.code == code) {\n return true;\n }\n }\n }\n }\n else {\n for (let error of this.errors) {\n if (error.code == code) {\n return true;\n }\n }\n }\n return false;\n }\n run(fct) {\n if (this.success) {\n let result = fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n }\n return this;\n }\n async runAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n }\n return this;\n }\n extract(fct) {\n if (this.success) {\n let result = fct();\n if (result.success && result.result) {\n return result.result;\n }\n this.errors = [...this.errors, ...result.errors];\n }\n return undefined;\n }\n async extractAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (result.success && result.result) {\n return result.result;\n }\n this.errors = [...this.errors, ...result.errors];\n }\n return undefined;\n }\n}\nVoidWithError.Namespace=`Aventus`;\nVoidWithError.$schema={\"success\":\"boolean\",\"errors\":\"T[]\"};\nConverter.register(VoidWithError.Fullname, VoidWithError);\n__as1(_, 'VoidWithError', VoidWithError);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.EnumValue","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"X","isStrong":false}],"fullName":"Aventus.VoidWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let ResultWithError=class ResultWithError extends VoidWithError {\n static get Fullname() { return \"Aventus.ResultWithError\"; }\n /**\n * The result value of the action.\n * @type {U | undefined}\n */\n result;\n /**\n * Converts the current instance to a ResultWithError object.\n * @returns {ResultWithError<U>} A new instance of ResultWithError with the same error list and result value.\n */\n toGeneric() {\n const result = new ResultWithError();\n result.errors = this.errors;\n result.result = this.result;\n return result;\n }\n run(fct) {\n if (this.success) {\n let result = fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n if (result instanceof ResultWithError && result.success && result.result) {\n this.result = result.result;\n }\n }\n return this;\n }\n async runAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n if (result instanceof ResultWithError && result.success && result.result) {\n this.result = result.result;\n }\n }\n return this;\n }\n}\nResultWithError.Namespace=`Aventus`;\nResultWithError.$schema={...(VoidWithError?.$schema ?? {}), };\nConverter.register(ResultWithError.Fullname, ResultWithError);\n__as1(_, 'ResultWithError', ResultWithError);\n","dependencies":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"Aventus.ResultWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let HttpError=class HttpError extends GenericError {\n}\nHttpError.Namespace=`Aventus`;\nHttpError.$schema={...(GenericError?.$schema ?? {}), };\nConverter.register(HttpError.Fullname, HttpError);\n__as1(_, 'HttpError', HttpError);\n","dependencies":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.HttpError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let Signal=class Signal {\n __subscribes = [];\n _value;\n _onChange;\n get value() {\n Watcher._register?.register(this, \"*\", Watcher._register.version, \"*\");\n return this._value;\n }\n set value(item) {\n const oldValue = this._value;\n this._value = item;\n if (oldValue != item) {\n if (this._onChange) {\n this._onChange();\n }\n for (let fct of this.__subscribes) {\n fct(WatchAction.UPDATED, \"*\", item, []);\n }\n }\n }\n constructor(item, onChange) {\n this._value = item;\n this._onChange = onChange;\n }\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n }\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n }\n destroy() {\n this.__subscribes = [];\n }\n}\nSignal.Namespace=`Aventus`;\n__as1(_, 'Signal', Signal);\n","dependencies":[{"fullName":"Aventus.EffectReceiver","isStrong":true},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Signal","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Effect=class Effect {\n callbacks = [];\n isInit = false;\n isDestroy = false;\n __subscribes = [];\n __allowChanged = [];\n version = 0;\n fct;\n constructor(fct) {\n this.fct = fct;\n if (this.autoInit()) {\n this.init();\n }\n }\n autoInit() {\n return true;\n }\n init() {\n this.isInit = true;\n this.run();\n }\n run() {\n this.version++;\n Watcher._registering.push(this);\n let result = this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n for (let i = 0; i < this.callbacks.length; i++) {\n if (this.callbacks[i].version != this.version) {\n this.callbacks[i].receiver.unsubscribe(this.callbacks[i].cb);\n this.callbacks.splice(i, 1);\n i--;\n }\n }\n return result;\n }\n register(receiver, path, version, fullPath) {\n for (let info of this.callbacks) {\n if (info.receiver == receiver && info.path == path && receiver.__path == info.registerPath) {\n info.version = version;\n info.fullPath = fullPath;\n return;\n }\n }\n let cb;\n if (path == \"*\") {\n cb = (action, changePath, value, dones) => { this.onChange(action, changePath, value, dones); };\n }\n else {\n cb = (action, changePath, value, dones) => {\n if (changePath == path || changePath.startsWith(path + \".\") || changePath.startsWith(path + \"[\")) {\n // if(changePath == path) {\n this.onChange(action, changePath, value, dones);\n }\n };\n }\n this.callbacks.push({\n receiver,\n path,\n registerPath: receiver.__path,\n cb,\n version,\n fullPath\n });\n receiver.subscribe(cb);\n }\n canChange(fct) {\n this.__allowChanged.push(fct);\n }\n checkCanChange(action, changePath, value, dones) {\n if (this.isDestroy) {\n return false;\n }\n for (let fct of this.__allowChanged) {\n if (!fct(action, changePath, value, dones)) {\n return false;\n }\n }\n return true;\n }\n onChange(action, changePath, value, dones) {\n if (!this.checkCanChange(action, changePath, value, dones)) {\n return;\n }\n this.run();\n for (let fct of this.__subscribes) {\n fct(action, changePath, value, dones);\n }\n }\n destroy() {\n this.isDestroy = true;\n this.clearCallbacks();\n this.isInit = false;\n }\n clearCallbacks() {\n for (let pair of this.callbacks) {\n pair.receiver.unsubscribe(pair.cb);\n }\n this.callbacks = [];\n }\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n }\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n }\n}\nEffect.Namespace=`Aventus`;\n__as1(_, 'Effect', Effect);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Aventus.WatcherAllowed","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Effect","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Computed=class Computed extends Effect {\n _value;\n __path = \"*\";\n get value() {\n if (!this.isInit) {\n this.init();\n }\n Watcher._register?.register(this, \"*\", Watcher._register.version, \"*\");\n return this._value;\n }\n autoInit() {\n return false;\n }\n constructor(fct) {\n super(fct);\n }\n init() {\n this.isInit = true;\n this.computedValue();\n }\n computedValue() {\n this._value = this.run();\n }\n onChange(action, changePath, value, dones) {\n if (!this.checkCanChange(action, changePath, value, dones)) {\n return;\n }\n let oldValue = this._value;\n this.computedValue();\n if (oldValue === this._value) {\n return;\n }\n for (let fct of this.__subscribes) {\n fct(action, changePath, value, dones);\n }\n }\n}\nComputed.Namespace=`Aventus`;\n__as1(_, 'Computed', Computed);\n","dependencies":[{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.EffectReceiver","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.IsNotVoid","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Computed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Watcher=class Watcher {\n static isNative(obj) {\n if (obj instanceof Blob ||\n obj instanceof Element ||\n obj instanceof Window)\n return true;\n return false;\n }\n constructor() { }\n ;\n static __reservedName = {\n __path: '__path',\n };\n static __triggerForced = false;\n static _registering = [];\n static get _register() {\n return this._registering[this._registering.length - 1];\n }\n /**\n * Transform object into a watcher\n */\n static get(obj, onDataChanged) {\n if (obj == undefined) {\n console.error(\"You must define an objet / array for your proxy\");\n return;\n }\n if (obj.__isProxy) {\n if (onDataChanged)\n obj.subscribe(onDataChanged);\n return obj;\n }\n const reservedName = this.__reservedName;\n const setProxyPath = (newProxy, newPath) => {\n if (newProxy instanceof Object && newProxy.__isProxy) {\n newProxy.__path = newPath;\n }\n };\n const jsonReplacer = (key, value) => {\n if (reservedName[key])\n return undefined;\n return value;\n };\n const addAlias = (otherBaseData, name, cb) => {\n let cbs = aliases.get(otherBaseData);\n if (!cbs) {\n cbs = [];\n aliases.set(otherBaseData, cbs);\n }\n cbs.push({\n name: name,\n fct: cb\n });\n };\n const deleteAlias = (otherBaseData, name) => {\n let cbs = aliases.get(otherBaseData);\n if (!cbs)\n return;\n for (let i = 0; i < cbs.length; i++) {\n if (cbs[i].name == name) {\n cbs.splice(i, 1);\n if (cbs.length == 0) {\n aliases.delete(otherBaseData);\n }\n return;\n }\n }\n };\n const replaceByAlias = (target, element, prop, receiver, apply, out = {}) => {\n let fullInternalPath = \"\";\n if (Array.isArray(receiver)) {\n if (prop != \"length\") {\n if (target.__path) {\n fullInternalPath = target.__path;\n }\n fullInternalPath += \"[\" + prop + \"]\";\n }\n }\n else {\n if (target.__path) {\n fullInternalPath = target.__path + '.';\n }\n fullInternalPath += prop;\n }\n if (receiver && internalAliases[fullInternalPath]) {\n internalAliases[fullInternalPath].unbind();\n }\n if (element instanceof Object && element.__isProxy) {\n let root = element.__root;\n if (root != proxyData.baseData) {\n element.__validatePath();\n let oldPath = element.__path ?? '';\n let unbindElement = Watcher.extract(getValueFromObject(oldPath, root));\n if (unbindElement === undefined) {\n return element;\n }\n if (receiver == null) {\n receiver = getValueFromObject(target.__path, realProxy);\n if (internalAliases[fullInternalPath]) {\n internalAliases[fullInternalPath].unbind();\n }\n }\n if (apply) {\n let result = this.isNative(target) ? Reflect.set(target, prop, unbindElement) : Reflect.set(target, prop, unbindElement, receiver);\n }\n element.__addAlias(proxyData.baseData, oldPath, (type, target, receiver2, value, prop2, dones) => {\n let triggerPath;\n if (prop2.startsWith(\"[\") || fullInternalPath == \"\" || prop2 == \"\") {\n triggerPath = fullInternalPath + prop2;\n }\n else {\n triggerPath = fullInternalPath + \".\" + prop2;\n }\n if (type == 'DELETED' && internalAliases[triggerPath]) {\n internalAliases[triggerPath].unbind();\n }\n triggerPath = triggerPath.replace(/\\[(.*?)\\]/g, '.$1');\n let splitted = triggerPath.split(\".\");\n let newProp = splitted.pop();\n let newReceiver = getValueFromObject(splitted.join(\".\"), realProxy);\n if (newReceiver.getTarget(false) == target)\n trigger(type, target, newReceiver, value, newProp ?? '', dones);\n });\n internalAliases[fullInternalPath] = {\n unbind: () => {\n delete internalAliases[fullInternalPath];\n element.__deleteAlias(proxyData.baseData, oldPath);\n deleteAlias(root, fullInternalPath);\n }\n };\n addAlias(root, fullInternalPath, (type, target, receiver2, value, prop2, dones) => {\n const pathSave = element.__path;\n let proxy = element.__getProxy;\n let triggerPath;\n if (prop2.startsWith(\"[\") || oldPath == \"\" || prop2 == \"\") {\n triggerPath = oldPath + prop2;\n }\n else {\n triggerPath = oldPath + \".\" + prop2;\n }\n triggerPath = triggerPath.replace(/\\[(.*?)\\]/g, '.$1');\n let splitted = triggerPath.split(\".\");\n let newProp = splitted.pop();\n let newReceiver = getValueFromObject(splitted.join(\".\"), proxy);\n if (newReceiver.getTarget(false) == target)\n element.__trigger(type, target, newReceiver, value, newProp, dones);\n element.__path = pathSave;\n });\n out.otherRoot = root;\n return unbindElement;\n }\n }\n return element;\n };\n let currentTrace = new Error().stack?.split(\"\\n\") ?? [];\n currentTrace.shift();\n currentTrace.shift();\n const aliases = new Map();\n const internalAliases = {};\n let proxyData = {\n baseData: {},\n callbacks: {},\n callbacksReverse: new Map(),\n avoidUpdate: [],\n pathToRemove: [],\n injectedDones: null,\n history: [{\n object: JSON.parse(JSON.stringify(obj, jsonReplacer)),\n trace: currentTrace,\n action: 'init',\n path: ''\n }],\n useHistory: false,\n getProxyObject(target, element, prop) {\n let newProxy;\n element = replaceByAlias(target, element, prop, null, true);\n if (element instanceof Object && element.__isProxy) {\n newProxy = element;\n }\n else {\n try {\n if (element instanceof Computed) {\n return element;\n }\n if (element instanceof HTMLElement) {\n return element;\n }\n if (element instanceof Object) {\n newProxy = new Proxy(element, this);\n }\n else {\n return element;\n }\n }\n catch {\n return element;\n }\n }\n let newPath = '';\n if (Array.isArray(target)) {\n if (/^[0-9]*$/g.exec(prop)) {\n if (target.__path) {\n newPath = target.__path;\n }\n newPath += \"[\" + prop + \"]\";\n setProxyPath(newProxy, newPath);\n }\n else {\n newPath += \".\" + prop;\n setProxyPath(newProxy, newPath);\n }\n }\n else if (element instanceof Date) {\n return element;\n }\n else {\n if (target.__path) {\n newPath = target.__path + '.';\n }\n newPath += prop;\n setProxyPath(newProxy, newPath);\n }\n return newProxy;\n },\n tryCustomFunction(target, prop, receiver) {\n if (prop == \"__isProxy\") {\n return true;\n }\n else if (prop == \"__getProxy\") {\n return realProxy;\n }\n else if (prop == \"__root\") {\n return this.baseData;\n }\n else if (prop == \"__validatePath\") {\n return () => {\n if (this.baseData == target) {\n target.__path = \"\";\n }\n };\n }\n else if (prop == \"__callbacks\") {\n return this.callbacks;\n }\n else if (prop == \"subscribe\") {\n let path = receiver.__path;\n return (cb) => {\n if (!this.callbacks[path]) {\n this.callbacks[path] = [];\n }\n this.callbacks[path].push(cb);\n this.callbacksReverse.set(cb, path);\n };\n }\n else if (prop == \"unsubscribe\") {\n return (cb) => {\n let oldPath = this.callbacksReverse.get(cb);\n if (oldPath === undefined)\n return;\n if (!this.callbacks[oldPath]) {\n return;\n }\n let index = this.callbacks[oldPath].indexOf(cb);\n if (index > -1) {\n this.callbacks[oldPath].splice(index, 1);\n }\n this.callbacksReverse.delete(cb);\n };\n }\n else if (prop == \"getHistory\") {\n return () => {\n return this.history;\n };\n }\n else if (prop == \"clearHistory\") {\n this.history = [];\n }\n else if (prop == \"enableHistory\") {\n return () => {\n this.useHistory = true;\n };\n }\n else if (prop == \"disableHistory\") {\n return () => {\n this.useHistory = false;\n };\n }\n else if (prop == \"getTarget\") {\n return (clear = true) => {\n if (clear)\n Watcher.clearReservedNames(target);\n return target;\n };\n }\n else if (prop == \"toJSON\") {\n if (target.toJSON) {\n return target.toJSON;\n }\n if (Array.isArray(receiver)) {\n return () => {\n let result = [];\n for (let element of target) {\n result.push(element);\n }\n return result;\n };\n }\n return () => {\n let result = {};\n for (let key of Object.keys(target)) {\n if (reservedName[key]) {\n continue;\n }\n result[key] = target[key];\n }\n return result;\n };\n }\n else if (prop == \"__addAlias\") {\n return addAlias;\n }\n else if (prop == \"__deleteAlias\") {\n return deleteAlias;\n }\n else if (prop == \"__injectedDones\") {\n return (dones) => {\n this.injectedDones = dones;\n };\n }\n else if (prop == \"__trigger\") {\n return trigger;\n }\n else if (prop == \"__static_trigger\") {\n return (type) => {\n Watcher.__triggerForced = true;\n trigger(type, target, receiver, target, '');\n Watcher.__triggerForced = false;\n };\n }\n return undefined;\n },\n get(target, prop, receiver) {\n if (typeof prop == 'symbol') {\n return Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n }\n if (reservedName[prop]) {\n return target[prop];\n }\n let customResult = this.tryCustomFunction(target, prop, receiver);\n if (customResult !== undefined) {\n return customResult;\n }\n let element = target[prop];\n if (typeof (element) == 'function') {\n if (Array.isArray(receiver)) {\n let result;\n if (prop == 'push') {\n if (target.__isProxy) {\n result = (el) => {\n let index = target.push(el);\n return index;\n };\n }\n else {\n result = (el) => {\n let index = target.length;\n let out = {};\n el = replaceByAlias(target, el, target.length + '', receiver, false, out);\n target.push(el);\n const dones = [];\n const dones2 = [];\n if (out.otherRoot) {\n dones.push(out.otherRoot);\n dones2.push(out.otherRoot);\n }\n trigger('CREATED', target, receiver, receiver[index], \"[\" + (index) + \"]\", dones);\n trigger('UPDATED', target, receiver, target.length, \"length\", dones2);\n return index;\n };\n }\n }\n else if (prop == 'splice') {\n if (target.__isProxy) {\n result = (index, nbRemove, ...insert) => {\n let res = target.splice(index, nbRemove, ...insert);\n return res;\n };\n }\n else {\n result = (index, nbRemove, ...insert) => {\n let oldValues = [];\n const extReceiver = Watcher.extract(receiver);\n for (let i = index; i < index + nbRemove; i++) {\n oldValues.push(extReceiver[i]);\n }\n let updateLength = nbRemove != insert.length;\n for (let i = 0; i < oldValues.length; i++) {\n target.splice((index + i), 1);\n trigger('DELETED', target, receiver, oldValues[i], \"[\" + index + \"]\");\n }\n for (let i = 0; i < insert.length; i++) {\n const out = {};\n let value = replaceByAlias(target, insert[i], (index + i) + '', receiver, false, out);\n const dones = out.otherRoot ? [out.otherRoot] : [];\n target.splice((index + i), 0, value);\n trigger('CREATED', target, receiver, receiver[(index + i)], \"[\" + (index + i) + \"]\", dones);\n }\n if (updateLength)\n trigger('UPDATED', target, receiver, target.length, \"length\");\n return target;\n };\n }\n }\n else if (prop == 'pop') {\n if (target.__isProxy) {\n result = () => {\n let res = target.pop();\n return res;\n };\n }\n else {\n result = () => {\n let index = target.length - 1;\n let oldValue = receiver.length ? receiver[receiver.length] : undefined;\n let res = target.pop();\n trigger('DELETED', target, receiver, oldValue, \"[\" + index + \"]\");\n trigger('UPDATED', target, receiver, target.length, \"length\");\n return res;\n };\n }\n }\n // else if(prop == 'find') {\n else {\n result = element.bind(target);\n }\n return result;\n }\n else if (target instanceof Map) {\n let result;\n if (prop == \"set\") {\n if (target.__isProxy) {\n result = (key, value) => {\n return target.set(key, value);\n };\n }\n else {\n result = (key, value) => {\n const out = {};\n let dones = [];\n let dones2 = [];\n key = Watcher.extract(key);\n value = replaceByAlias(target, value, key + '', receiver, false, out);\n if (out.otherRoot) {\n dones.push(out.otherRoot);\n dones2.push(out.otherRoot);\n }\n let result = target.set(key, value);\n trigger('CREATED', target, receiver, receiver.get(key), key + '', dones);\n trigger('UPDATED', target, receiver, target.size, \"size\", dones2);\n return result;\n };\n }\n }\n else if (prop == \"clear\") {\n if (target.__isProxy) {\n result = () => {\n return target.clear();\n };\n }\n else {\n result = () => {\n let keys = target.keys();\n for (let key of keys) {\n let oldValue = receiver.get(key);\n target.delete(key);\n trigger('DELETED', target, receiver, oldValue, key);\n trigger('UPDATED', target, receiver, target.size, \"size\");\n }\n };\n }\n }\n else if (prop == \"delete\") {\n if (target.__isProxy) {\n result = (key) => {\n return target.delete(key);\n };\n }\n else {\n result = (key) => {\n key = Watcher.extract(key);\n let oldValue = receiver.get(key);\n let res = target.delete(key);\n trigger('DELETED', target, receiver, oldValue, key + '');\n trigger('UPDATED', target, receiver, target.size, \"size\");\n return res;\n };\n }\n }\n else {\n result = element.bind(target);\n }\n return result;\n }\n return element.bind(target);\n }\n if (element instanceof Computed) {\n return element.value;\n }\n if (Watcher._registering.length > 0) {\n let currentPath;\n let fullPath;\n let isArray = Array.isArray(receiver);\n if (isArray && /^[0-9]*$/g.exec(prop)) {\n fullPath = receiver.__path + \"[\" + prop + \"]\";\n currentPath = \"[\" + prop + \"]\";\n }\n else {\n fullPath = receiver.__path ? receiver.__path + '.' + prop : prop;\n currentPath = prop;\n }\n Watcher._register?.register(receiver, currentPath, Watcher._register.version, fullPath);\n }\n if (typeof (element) == 'object') {\n return this.getProxyObject(target, element, prop);\n }\n return Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n },\n set(target, prop, value, receiver) {\n if (typeof prop == 'symbol') {\n if (Watcher.isNative(target))\n return Reflect.set(target, prop, value);\n return Reflect.set(target, prop, value, receiver);\n }\n let oldValue = Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n value = replaceByAlias(target, value, prop, receiver, true);\n if (value instanceof Signal) {\n value = value.value;\n }\n let triggerChange = false;\n if (!reservedName[prop]) {\n if (Array.isArray(receiver)) {\n if (prop != \"length\") {\n triggerChange = true;\n }\n }\n else {\n if (!compareObject(value, oldValue)) {\n triggerChange = true;\n }\n }\n if (Watcher.__triggerForced) {\n triggerChange = true;\n }\n }\n let result = Watcher.isNative(target) ? Reflect.set(target, prop, value) : Reflect.set(target, prop, value, receiver);\n if (triggerChange) {\n let index = this.avoidUpdate.indexOf(prop);\n if (index == -1) {\n let dones = this.injectedDones ?? [];\n this.injectedDones = null;\n trigger('UPDATED', target, receiver, value, prop, dones);\n }\n else {\n this.avoidUpdate.splice(index, 1);\n }\n }\n return result;\n },\n deleteProperty(target, prop) {\n if (typeof prop == 'symbol') {\n return Reflect.deleteProperty(target, prop);\n }\n let triggerChange = false;\n let pathToDelete = '';\n if (!reservedName[prop]) {\n if (Array.isArray(target)) {\n if (prop != \"length\") {\n if (target.__path) {\n pathToDelete = target.__path;\n }\n pathToDelete += \"[\" + prop + \"]\";\n triggerChange = true;\n }\n }\n else {\n if (target.__path) {\n pathToDelete = target.__path + '.';\n }\n pathToDelete += prop;\n triggerChange = true;\n }\n }\n if (internalAliases[pathToDelete]) {\n internalAliases[pathToDelete].unbind();\n }\n if (target.hasOwnProperty(prop)) {\n let oldValue = target[prop];\n if (oldValue instanceof Effect || oldValue instanceof Signal) {\n oldValue.destroy();\n }\n delete target[prop];\n if (triggerChange) {\n Watcher.clearReservedNames(oldValue);\n trigger('DELETED', target, null, oldValue, prop);\n }\n return true;\n }\n return false;\n },\n defineProperty(target, prop, descriptor) {\n if (typeof prop == 'symbol') {\n return Reflect.defineProperty(target, prop, descriptor);\n }\n let triggerChange = false;\n let newPath = '';\n if (!reservedName[prop]) {\n if (Array.isArray(target)) {\n if (prop != \"length\") {\n if (target.__path) {\n newPath = target.__path;\n }\n newPath += \"[\" + prop + \"]\";\n if (!target.hasOwnProperty(prop)) {\n triggerChange = true;\n }\n }\n }\n else {\n if (target.__path) {\n newPath = target.__path + '.';\n }\n newPath += prop;\n if (!target.hasOwnProperty(prop)) {\n triggerChange = true;\n }\n }\n }\n let result = Reflect.defineProperty(target, prop, descriptor);\n if (triggerChange) {\n this.avoidUpdate.push(prop);\n let proxyEl = this.getProxyObject(target, descriptor.value, prop);\n target[prop] = proxyEl;\n trigger('CREATED', target, null, proxyEl, prop);\n }\n return result;\n },\n ownKeys(target) {\n let result = Reflect.ownKeys(target);\n for (let i = 0; i < result.length; i++) {\n let key = result[i];\n if (typeof key == 'string') {\n if (reservedName[key]) {\n result.splice(i, 1);\n i--;\n }\n }\n }\n return result;\n },\n };\n if (onDataChanged) {\n proxyData.callbacks[''] = [onDataChanged];\n }\n const trigger = (type, target, receiver, value, prop, dones = []) => {\n if (dones.includes(proxyData.baseData)) {\n return;\n }\n if (target.__isProxy) {\n return;\n }\n let rootPath;\n if (receiver == null) {\n rootPath = target.__path;\n }\n else {\n rootPath = receiver.__path;\n }\n if (rootPath != \"\") {\n if (Array.isArray(receiver)) {\n if (prop && !prop.startsWith(\"[\")) {\n if (/^[0-9]*$/g.exec(prop)) {\n rootPath += \"[\" + prop + \"]\";\n }\n else {\n rootPath += \".\" + prop;\n }\n }\n else {\n rootPath += prop;\n }\n }\n else {\n if (prop && !prop.startsWith(\"[\")) {\n rootPath += \".\";\n }\n rootPath += prop;\n }\n }\n else {\n rootPath = prop;\n }\n let stacks = [];\n if (proxyData.useHistory) {\n let allStacks = new Error().stack?.split(\"\\n\") ?? [];\n for (let i = allStacks.length - 1; i >= 0; i--) {\n let current = allStacks[i].trim().replace(\"at \", \"\");\n if (current.startsWith(\"Object.set\") || current.startsWith(\"Proxy.result\")) {\n break;\n }\n stacks.push(current);\n }\n }\n dones.push(proxyData.baseData);\n let aliasesDone = [];\n const callbacks = { ...proxyData.callbacks };\n for (let name in callbacks) {\n callbacks[name] = [...callbacks[name]];\n }\n for (let name in callbacks) {\n // for(let name in proxyData.callbacks) {\n let pathToSend = rootPath;\n if (name !== \"\") {\n let regex = new RegExp(\"^\" + name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex.test(rootPath)) {\n let regex2 = new RegExp(\"^\" + rootPath.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex2.test(name)) {\n continue;\n }\n else {\n pathToSend = \"\";\n }\n }\n else {\n pathToSend = rootPath.replace(regex, \"$2\");\n }\n }\n if (name === \"\" && proxyData.useHistory) {\n proxyData.history.push({\n object: JSON.parse(JSON.stringify(proxyData.baseData, jsonReplacer)),\n trace: stacks.reverse(),\n action: WatchAction[type],\n path: pathToSend\n });\n }\n let cbs = callbacks[name];\n for (let cb of cbs) {\n try {\n cb(WatchAction[type], pathToSend, value, dones);\n }\n catch (e) {\n if (e != 'impossible')\n console.error(e);\n }\n }\n for (let [key, infos] of aliases) {\n if (!dones.includes(key)) {\n for (let info of infos) {\n if (info.name == name) {\n aliasesDone.push(key);\n if (target.__path) {\n let oldPath = target.__path;\n info.fct(type, target, receiver, value, prop, dones);\n target.__path = oldPath;\n }\n else {\n info.fct(type, target, receiver, value, prop, dones);\n }\n }\n }\n }\n }\n }\n for (let [key, infos] of aliases) {\n if (!dones.includes(key) && !aliasesDone.includes(key)) {\n for (let info of infos) {\n let regex = new RegExp(\"^\" + info.name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex.test(rootPath)) {\n continue;\n }\n let newProp = rootPath.replace(info.name, \"\");\n if (newProp.startsWith(\".\")) {\n newProp = newProp.slice(1);\n }\n if (target.__path) {\n let oldPath = target.__path;\n info.fct(type, target, receiver, value, newProp, dones);\n target.__path = oldPath;\n }\n else {\n info.fct(type, target, receiver, value, newProp, dones);\n }\n }\n }\n }\n };\n var realProxy = new Proxy(obj, proxyData);\n proxyData.baseData = obj;\n setProxyPath(realProxy, '');\n return realProxy;\n }\n static is(obj) {\n return typeof obj == 'object' && obj.__isProxy;\n }\n static clearReservedNames(data) {\n if (data instanceof Object && !data.__isProxy) {\n for (let key in this.__reservedName) {\n delete data[key];\n }\n for (let key in data) {\n this.clearReservedNames(data[key]);\n }\n }\n else if (Array.isArray(data)) {\n for (let item of data) {\n this.clearReservedNames(item);\n }\n }\n }\n static extract(obj, clearPath = false) {\n if (this.is(obj)) {\n return obj.getTarget(clearPath);\n }\n else {\n if (obj instanceof Object) {\n for (let key in this.__reservedName) {\n delete obj[key];\n }\n }\n }\n return obj;\n }\n static trigger(type, target) {\n if (this.is(target)) {\n target.__static_trigger(type);\n }\n }\n /**\n * Create a computed variable that will watch any changes\n */\n static computed(fct) {\n const comp = new Computed(fct);\n return comp;\n }\n /**\n * Create an effect variable that will watch any changes\n */\n static effect(fct) {\n const comp = new Effect(fct);\n return comp;\n }\n /**\n * Create an effect variable that will watch any changes inside the fct and trigger the cb on change\n */\n static watch(fct, cb) {\n const comp = new Effect(fct);\n comp.subscribe(cb);\n return comp;\n }\n /**\n * Create a signal variable\n */\n static signal(item, onChange) {\n return new Signal(item, onChange);\n }\n}\nWatcher.Namespace=`Aventus`;\n__as1(_, 'Watcher', Watcher);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":true},{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.WatcherFunctionInternal","isStrong":false},{"fullName":"ProxyData","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.Signal","isStrong":false},{"fullName":"Aventus.compareObject","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.IsNotVoid","isStrong":false}],"fullName":"Aventus.Watcher","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ComputedNoRecomputed=class ComputedNoRecomputed extends Computed {\n init() {\n this.isInit = true;\n Watcher._registering.push(this);\n this._value = this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n }\n computedValue() {\n if (this.isInit)\n this._value = this.fct();\n else\n this.init();\n }\n run() { }\n}\nComputedNoRecomputed.Namespace=`Aventus`;\n__as1(_, 'ComputedNoRecomputed', ComputedNoRecomputed);\n","dependencies":[{"fullName":"Aventus.Computed","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.ComputedNoRecomputed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let EffectNoRecomputed=class EffectNoRecomputed extends Effect {\n init() {\n this.isInit = true;\n Watcher._registering.push(this);\n this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n }\n run() {\n if (!this.isInit) {\n this.init();\n }\n }\n}\nEffectNoRecomputed.Namespace=`Aventus`;\n__as1(_, 'EffectNoRecomputed', EffectNoRecomputed);\n","dependencies":[{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.EffectNoRecomputed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRouter=class HttpRouter {\n static options;\n static configure(options) {\n this.options = options;\n }\n options;\n constructor() {\n this.options = this.defineOptions(this.defaultOptionsValue());\n }\n defaultOptionsValue() {\n return HttpRouter.options ?? {\n url: location.protocol + \"//\" + location.host\n };\n }\n defineOptions(options) {\n return options;\n }\n async get(url) {\n return await new HttpRequest(url).queryJSON(this);\n }\n async post(url, data) {\n return await new HttpRequest(url, HttpMethod.POST, data).queryJSON(this);\n }\n async put(url, data) {\n return await new HttpRequest(url, HttpMethod.PUT, data).queryJSON(this);\n }\n async delete(url, data) {\n return await new HttpRequest(url, HttpMethod.DELETE, data).queryJSON(this);\n }\n async option(url, data) {\n return await new HttpRequest(url, HttpMethod.OPTION, data).queryJSON(this);\n }\n}\nHttpRouter.Namespace=`Aventus`;\n__as1(_, 'HttpRouter', HttpRouter);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouterOptions","isStrong":true},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false}],"fullName":"Aventus.HttpRouter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRoute=class HttpRoute {\n router;\n constructor(router) {\n this.router = router ?? new HttpRouter();\n }\n getPrefix() {\n return \"\";\n }\n}\nHttpRoute.Namespace=`Aventus`;\n__as1(_, 'HttpRoute', HttpRoute);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}],"fullName":"Aventus.HttpRoute","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRequest=class HttpRequest {\n static options;\n static configure(options) {\n this.options = options;\n }\n request;\n url;\n methodSpoofing = false;\n useCache = false;\n constructor(url, method = HttpMethod.GET, body, methodSpoofing = false, useCache = false) {\n this.url = url;\n this.request = {};\n this.methodSpoofing = methodSpoofing;\n this.useCache = useCache;\n this.setMethod(method);\n this.prepareBody(body);\n }\n setUrl(url) {\n this.url = url;\n }\n toString() {\n return this.url + \" : \" + JSON.stringify(this.request);\n }\n setBody(body) {\n this.prepareBody(body);\n }\n setMethod(method) {\n this.request.method = method;\n }\n /**\n * Replace method Put/Delete by _method:\"put\" inside a form\n */\n enableMethodSpoofing() {\n this.methodSpoofing = true;\n }\n enableCache() {\n this.useCache = true;\n }\n disableCache() {\n this.useCache = false;\n }\n objectToFormData(obj, formData, parentKey) {\n formData = formData || new FormData();\n let byPass = obj;\n if (byPass.__isProxy) {\n obj = byPass.getTarget();\n }\n const keys = obj.toJSON ? Object.keys(obj.toJSON()) : Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n let value = obj[key];\n const newKey = parentKey ? `${parentKey}[${key}]` : key;\n if (value instanceof Date) {\n formData.append(newKey, DateConverter.converter.toString(value));\n }\n else if (typeof value === 'object' &&\n value !== null &&\n !(value instanceof File)) {\n if (Array.isArray(value)) {\n for (let j = 0; j < value.length; j++) {\n const arrayKey = `${newKey}[${j}]`;\n this.objectToFormData({ [arrayKey]: value[j] }, formData);\n }\n }\n else {\n this.objectToFormData(value, formData, newKey);\n }\n }\n else {\n if (value === undefined || value === null) {\n value = \"\";\n }\n else if (Watcher.is(value)) {\n value = Watcher.extract(value);\n }\n formData.append(newKey, value);\n }\n }\n return formData;\n }\n jsonReplacer(key, value) {\n const t = this;\n if (t[key] instanceof Date) {\n return DateConverter.converter.toString(t[key]);\n }\n return value;\n }\n prepareBody(data) {\n if (!data) {\n return;\n }\n else if (data instanceof FormData) {\n this.request.body = data;\n }\n else {\n let useFormData = false;\n const analyseFormData = (obj) => {\n for (let key in obj) {\n if (obj[key] instanceof File) {\n useFormData = true;\n break;\n }\n else if (Array.isArray(obj[key]) && obj[key].length > 0 && obj[key][0] instanceof File) {\n useFormData = true;\n break;\n }\n else if (typeof obj[key] == 'object' && !Array.isArray(obj[key]) && !(obj[key] instanceof Date)) {\n analyseFormData(obj[key]);\n if (useFormData) {\n break;\n }\n }\n }\n };\n analyseFormData(data);\n if (useFormData) {\n this.request.body = this.objectToFormData(data);\n }\n else {\n this.request.body = JSON.stringify(data, this.jsonReplacer);\n this.setHeader(\"Content-Type\", \"Application/json\");\n }\n }\n if (this.methodSpoofing) {\n if (this.request.method?.toUpperCase() == Aventus.HttpMethod.PUT) {\n if (this.request.body instanceof FormData) {\n this.request.body.append(\"_method\", Aventus.HttpMethod.PUT);\n this.request.method = Aventus.HttpMethod.POST;\n }\n }\n else if (this.request.method?.toUpperCase() == Aventus.HttpMethod.DELETE) {\n if (this.request.body instanceof FormData) {\n this.request.body.append(\"_method\", Aventus.HttpMethod.DELETE);\n this.request.method = Aventus.HttpMethod.POST;\n }\n }\n }\n }\n setHeader(name, value) {\n if (!this.request.headers) {\n this.request.headers = [];\n }\n this.request.headers.push([name, value]);\n }\n setCredentials(credentials) {\n this.request.credentials = credentials;\n }\n async _query(router) {\n let result = new ResultWithError();\n try {\n const isFull = this.url.match(\"https?://\");\n if (!this.url.startsWith(\"/\") && !isFull) {\n this.url = \"/\" + this.url;\n }\n if (HttpRequest.options?.beforeSend) {\n const beforeSendResult = await HttpRequest.options.beforeSend(this);\n result.errors = beforeSendResult.errors;\n }\n const fullUrl = isFull ? this.url : router ? router.options.url + this.url : this.url;\n if (this.useCache) {\n result.result = await HttpCache.fetch(fullUrl, this.request);\n }\n else {\n let response = await fetch(fullUrl, this.request);\n result.result = new HttpResponse(response);\n }\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async query(router) {\n let result = await this._query(router);\n if (HttpRequest.options?.responseMiddleware) {\n result = await HttpRequest.options.responseMiddleware(result, this);\n }\n return result;\n }\n async queryVoid(router) {\n let resultTemp = await this.query(router);\n let result = new VoidWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n if (resultTemp.result.status != 204) {\n let tempResult = await resultTemp.result.json();\n if (tempResult instanceof VoidWithError) {\n for (let error of tempResult.errors) {\n result.errors.push(error);\n }\n }\n }\n }\n catch (e) {\n }\n return result;\n }\n async queryJSON(router) {\n this.setHeader(\"Accept\", \"application/json\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n let tempResult = await resultTemp.result.json();\n if (tempResult instanceof VoidWithError) {\n for (let error of tempResult.errors) {\n result.errors.push(error);\n }\n if (tempResult instanceof ResultWithError) {\n result.result = tempResult.result;\n }\n }\n else {\n result.result = tempResult;\n }\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async queryTxt(router) {\n this.setHeader(\"Accept\", \"text/plain\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n result.result = await resultTemp.result.text();\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async queryBlob(router) {\n this.setHeader(\"Accept\", \"application/octet-stream\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n result.result = await resultTemp.result.blob();\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n clearCache(router) {\n const isFull = this.url.match(\"https?://\");\n if (!this.url.startsWith(\"/\") && !isFull) {\n this.url = \"/\" + this.url;\n }\n const fullUrl = isFull ? this.url : router ? router.options.url + this.url : this.url;\n HttpCache.clear(fullUrl, this.request);\n }\n}\nHttpRequest.Namespace=`Aventus`;\n__as1(_, 'HttpRequest', HttpRequest);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRequestOptions","isStrong":true},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpResponse","isStrong":false},{"fullName":"Aventus.HttpCache","isStrong":false},{"fullName":"Aventus.HttpError","isStrong":false},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.HttpRequest","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let StorableRoute=class StorableRoute extends HttpRoute {\n async GetAll() {\n const request = new HttpRequest(`/${this.StorableName()}`, HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Create(body) {\n const request = new HttpRequest(`/${this.StorableName()}`, HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async GetById(id) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Update(id, body) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.PUT);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async Delete(id) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.DELETE);\n return await request.queryJSON(this.router);\n }\n}\nStorableRoute.Namespace=`Aventus`;\n__as1(_, 'StorableRoute', StorableRoute);\n","dependencies":[{"fullName":"Aventus.HttpRoute","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"TypeResult","isStrong":false}],"fullName":"Aventus.StorableRoute","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Animation=class Animation {\n /**\n * Default FPS for all Animation if not set inside options\n */\n static FPS_DEFAULT = 60;\n options;\n nextFrame = 0;\n fpsInterval;\n continueAnimation = false;\n frame_id = 0;\n constructor(options) {\n if (!options.animate) {\n options.animate = () => { };\n }\n if (!options.stopped) {\n options.stopped = () => { };\n }\n if (!options.fps) {\n options.fps = Animation.FPS_DEFAULT;\n }\n this.options = options;\n this.fpsInterval = 1000 / options.fps;\n }\n animate() {\n let now = window.performance.now();\n let elapsed = now - this.nextFrame;\n if (elapsed <= this.fpsInterval) {\n this.frame_id = requestAnimationFrame(() => this.animate());\n return;\n }\n this.nextFrame = now - (elapsed % this.fpsInterval);\n setTimeout(() => {\n this.options.animate();\n }, 0);\n if (this.continueAnimation) {\n this.frame_id = requestAnimationFrame(() => this.animate());\n }\n else {\n this.options.stopped();\n }\n }\n /**\n * Start the of animation\n */\n start() {\n if (this.continueAnimation == false) {\n this.continueAnimation = true;\n this.nextFrame = window.performance.now();\n this.animate();\n }\n }\n /**\n * Stop the animation\n */\n stop() {\n this.continueAnimation = false;\n }\n /**\n * Stop the animation\n */\n immediateStop() {\n cancelAnimationFrame(this.frame_id);\n this.continueAnimation = false;\n this.options.stopped();\n }\n /**\n * Get the FPS\n */\n getFPS() {\n return this.options.fps;\n }\n /**\n * Set the FPS\n */\n setFPS(fps) {\n this.options.fps = fps;\n this.fpsInterval = 1000 / this.options.fps;\n }\n /**\n * Get the animation status (true if animation is running)\n */\n isStarted() {\n return this.continueAnimation;\n }\n}\nAnimation.Namespace=`Aventus`;\n__as1(_, 'Animation', Animation);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false},{"fullName":"Aventus.AnimationOptions","isStrong":false}],"fullName":"Aventus.Animation","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let PressManager=class PressManager {\n static globalConfig = {\n delayDblPress: 250,\n delayLongPress: 700,\n offsetDrag: 20\n };\n static configure(options) {\n this.globalConfig = options;\n }\n static create(options) {\n if (Array.isArray(options.element)) {\n let result = [];\n for (let el of options.element) {\n let cloneOpt = { ...options };\n cloneOpt.element = el;\n result.push(new PressManager(cloneOpt));\n }\n return result;\n }\n else {\n return new PressManager(options);\n }\n }\n static onEvent = new Callback();\n options;\n element;\n delayDblPress;\n delayLongPress;\n nbPress = 0;\n offsetDrag;\n dragDirection;\n state = {\n oneActionTriggered: null,\n };\n startPosition = { x: 0, y: 0 };\n customFcts = {};\n timeoutDblPress = 0;\n timeoutLongPress = 0;\n downEventSaved;\n useDblPress = false;\n stopPropagation = () => true;\n pointersRecord = {};\n functionsBinded = {\n downAction: (e) => { },\n downActionDelay: (e) => { },\n upAction: (e) => { },\n moveAction: (e) => { },\n childPressStart: (e) => { },\n childPressEnd: (e) => { },\n childPressMove: (e) => { }\n };\n /**\n * @param {*} options - The options\n * @param {HTMLElement | HTMLElement[]} options.element - The element to manage\n */\n constructor(options) {\n if (options.element === void 0) {\n throw 'You must provide an element';\n }\n this.offsetDrag = PressManager.globalConfig.offsetDrag !== undefined ? PressManager.globalConfig.offsetDrag : 20;\n this.dragDirection = 'XY';\n this.delayLongPress = PressManager.globalConfig.delayLongPress ?? 700;\n this.delayDblPress = PressManager.globalConfig.delayDblPress ?? 150;\n this.element = options.element;\n this.checkDragConstraint(options);\n this.assignValueOption(options);\n this.options = options;\n this.init();\n }\n /**\n * Get the current element focused by the PressManager\n */\n getElement() {\n return this.element;\n }\n checkDragConstraint(options) {\n if (options.onDrag !== void 0) {\n if (options.onDragStart === void 0) {\n options.onDragStart = (e) => { };\n }\n if (options.onDragEnd === void 0) {\n options.onDragEnd = (e) => { };\n }\n }\n if (options.onDragStart !== void 0) {\n if (options.onDrag === void 0) {\n options.onDrag = (e) => { };\n }\n if (options.onDragEnd === void 0) {\n options.onDragEnd = (e) => { };\n }\n }\n if (options.onDragEnd !== void 0) {\n if (options.onDragStart === void 0) {\n options.onDragStart = (e) => { };\n }\n if (options.onDrag === void 0) {\n options.onDrag = (e) => { };\n }\n }\n }\n assignValueOption(options) {\n if (PressManager.globalConfig.delayDblPress !== undefined) {\n this.delayDblPress = PressManager.globalConfig.delayDblPress;\n }\n if (options.delayDblPress !== undefined) {\n this.delayDblPress = options.delayDblPress;\n }\n if (PressManager.globalConfig.delayLongPress !== undefined) {\n this.delayLongPress = PressManager.globalConfig.delayLongPress;\n }\n if (options.delayLongPress !== undefined) {\n this.delayLongPress = options.delayLongPress;\n }\n if (PressManager.globalConfig.offsetDrag !== undefined) {\n this.offsetDrag = PressManager.globalConfig.offsetDrag;\n }\n if (options.offsetDrag !== undefined) {\n this.offsetDrag = options.offsetDrag;\n }\n if (options.dragDirection !== undefined) {\n this.dragDirection = options.dragDirection;\n }\n if (options.onDblPress !== undefined) {\n this.useDblPress = true;\n }\n if (PressManager.globalConfig.forceDblPress !== undefined) {\n this.useDblPress = PressManager.globalConfig.forceDblPress;\n }\n if (options.forceDblPress !== undefined) {\n this.useDblPress = options.forceDblPress;\n }\n if (typeof PressManager.globalConfig.stopPropagation == 'function') {\n this.stopPropagation = PressManager.globalConfig.stopPropagation;\n }\n else if (options.stopPropagation === false) {\n this.stopPropagation = () => false;\n }\n if (typeof options.stopPropagation == 'function') {\n this.stopPropagation = options.stopPropagation;\n }\n else if (options.stopPropagation === false) {\n this.stopPropagation = () => false;\n }\n if (!options.buttonAllowed)\n options.buttonAllowed = PressManager.globalConfig.buttonAllowed;\n if (!options.buttonAllowed)\n options.buttonAllowed = [0];\n if (!options.onEvent)\n options.onEvent = PressManager.globalConfig.onEvent;\n }\n bindAllFunction() {\n this.functionsBinded.downAction = this.downAction.bind(this);\n this.functionsBinded.downActionDelay = this.downActionDelay.bind(this);\n this.functionsBinded.moveAction = this.moveAction.bind(this);\n this.functionsBinded.upAction = this.upAction.bind(this);\n this.functionsBinded.childPressStart = this.childPressStart.bind(this);\n this.functionsBinded.childPressEnd = this.childPressEnd.bind(this);\n this.functionsBinded.childPressMove = this.childPressMove.bind(this);\n }\n init() {\n this.bindAllFunction();\n this.element.addEventListener(\"pointerdown\", this.functionsBinded.downAction);\n this.element.addEventListener(\"touchstart\", this.functionsBinded.downActionDelay);\n this.element.addEventListener(\"trigger_pointer_pressstart\", this.functionsBinded.childPressStart);\n this.element.addEventListener(\"trigger_pointer_pressend\", this.functionsBinded.childPressEnd);\n this.element.addEventListener(\"trigger_pointer_pressmove\", this.functionsBinded.childPressMove);\n }\n identifyEvent(touch) {\n if ('Touch' in window && touch instanceof Touch)\n return touch.identifier;\n return touch.pointerId;\n }\n registerEvent(ev) {\n if ('TouchEvent' in window && ev instanceof TouchEvent) {\n for (let touch of ev.targetTouches) {\n const id = this.identifyEvent(touch);\n if (this.pointersRecord[id]) {\n return false;\n }\n this.pointersRecord[id] = ev;\n }\n return true;\n }\n else {\n const id = this.identifyEvent(ev);\n if (this.pointersRecord[id]) {\n return false;\n }\n this.pointersRecord[id] = ev;\n return true;\n }\n }\n unregisterEvent(ev) {\n let result = true;\n if ('TouchEvent' in window && ev instanceof TouchEvent) {\n for (let touch of ev.changedTouches) {\n const id = this.identifyEvent(touch);\n if (!this.pointersRecord[id]) {\n result = false;\n }\n else {\n delete this.pointersRecord[id];\n }\n }\n }\n else {\n const id = this.identifyEvent(ev);\n if (!this.pointersRecord[id]) {\n result = false;\n }\n else {\n delete this.pointersRecord[id];\n }\n }\n return result;\n }\n genericDownAction(state, e) {\n this.downEventSaved = e;\n this.startPosition = { x: e.pageX, y: e.pageY };\n if (this.options.onLongPress) {\n this.timeoutLongPress = setTimeout(() => {\n if (!state.oneActionTriggered) {\n if (this.options.onLongPress) {\n if (this.options.onLongPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }, this.delayLongPress);\n }\n }\n pointerEventTriggered = false;\n downActionDelay(_ev) {\n const ev = _ev;\n if (!this.pointerEventTriggered) {\n this.downAction(ev);\n }\n else {\n ev.stopImmediatePropagation();\n }\n setTimeout(() => {\n this.pointerEventTriggered = false;\n }, 0);\n }\n downAction(_ev) {\n const ev = _ev;\n this.pointerEventTriggered = true;\n const isFirst = Object.values(this.pointersRecord).length == 0;\n if (!this.registerEvent(ev)) {\n if (this.stopPropagation()) {\n ev.stopImmediatePropagation();\n }\n return;\n }\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (e.button != undefined && !this.options.buttonAllowed?.includes(e.button)) {\n this.unregisterEvent(ev);\n return;\n }\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n this.customFcts = {};\n if (this.nbPress == 0 && isFirst) {\n this.state.oneActionTriggered = null;\n clearTimeout(this.timeoutDblPress);\n }\n if (isFirst) {\n document.addEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.addEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.addEventListener(\"touchend\", this.functionsBinded.upAction);\n document.addEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.addEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n this.genericDownAction(this.state, e);\n if (this.options.onPressStart) {\n this.options.onPressStart(e, this);\n this.lastEmitEvent = e;\n // this.emitTriggerFunctionParent(\"pressstart\", e);\n }\n this.emitTriggerFunction(\"pressstart\", e);\n }\n genericUpAction(state, e) {\n clearTimeout(this.timeoutLongPress);\n if (state.oneActionTriggered == this) {\n if (this.options.onDragEnd) {\n this.options.onDragEnd(e, this);\n }\n else if (this.customFcts.src && this.customFcts.onDragEnd) {\n this.customFcts.onDragEnd(e, this.customFcts.src);\n }\n }\n else {\n if (this.useDblPress) {\n this.nbPress++;\n if (this.nbPress == 2) {\n if (!state.oneActionTriggered) {\n this.nbPress = 0;\n if (this.options.onDblPress) {\n if (this.options.onDblPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n else if (this.nbPress == 1) {\n this.timeoutDblPress = setTimeout(() => {\n this.nbPress = 0;\n if (!state.oneActionTriggered) {\n if (this.options.onPress) {\n if (this.options.onPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }, this.delayDblPress);\n }\n }\n else {\n if (!state.oneActionTriggered) {\n if (this.options.onPress) {\n if (this.options.onPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n }\n }\n upAction(_ev) {\n const ev = _ev;\n if (!this.unregisterEvent(ev)) {\n if (this.stopPropagation()) {\n ev.stopImmediatePropagation();\n }\n return;\n }\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n if (Object.values(this.pointersRecord).length == 0) {\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n this.genericUpAction(this.state, e);\n if (this.options.onPressEnd) {\n this.options.onPressEnd(e, this);\n this.lastEmitEvent = e;\n // this.emitTriggerFunctionParent(\"pressend\", e);\n }\n this.emitTriggerFunction(\"pressend\", e);\n }\n genericMoveAction(state, e) {\n if (!state.oneActionTriggered) {\n let xDist = e.pageX - this.startPosition.x;\n let yDist = e.pageY - this.startPosition.y;\n let distance = 0;\n if (this.dragDirection == 'XY')\n distance = Math.sqrt(xDist * xDist + yDist * yDist);\n else if (this.dragDirection == 'X')\n distance = Math.abs(xDist);\n else\n distance = Math.abs(yDist);\n if (distance > this.offsetDrag && this.downEventSaved) {\n if (this.options.onDragStart) {\n if (this.options.onDragStart(this.downEventSaved, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n else if (state.oneActionTriggered == this) {\n if (this.options.onDrag) {\n this.options.onDrag(e, this);\n }\n else if (this.customFcts.src && this.customFcts.onDrag) {\n this.customFcts.onDrag(e, this.customFcts.src);\n }\n }\n }\n moveAction(_ev) {\n const ev = _ev;\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n this.genericMoveAction(this.state, e);\n this.lastEmitEvent = e;\n // if(this.options.onDrag) {\n // this.emitTriggerFunctionParent(\"pressmove\", e);\n this.emitTriggerFunction(\"pressmove\", e);\n }\n childPressStart(_e) {\n const e = _e;\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericDownAction(e.detail.state, e.detail.realEvent);\n if (this.options.onPressStart) {\n this.options.onPressStart(e.detail.realEvent, this);\n }\n }\n childPressEnd(_e) {\n const e = _e;\n this.unregisterEvent(e.detail.realEvent.event);\n if (Object.values(this.pointersRecord).length == 0) {\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericUpAction(e.detail.state, e.detail.realEvent);\n if (this.options.onPressEnd) {\n this.options.onPressEnd(e.detail.realEvent, this);\n }\n }\n childPressMove(_e) {\n const e = _e;\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericMoveAction(e.detail.state, e.detail.realEvent);\n }\n lastEmitEvent;\n emitTriggerFunction(action, e, el) {\n let ev = new CustomEvent(\"trigger_pointer_\" + action, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n state: this.state,\n customFcts: this.customFcts,\n realEvent: e\n }\n });\n this.lastEmitEvent = e;\n if (!el) {\n el = this.element;\n }\n el.dispatchEvent(ev);\n }\n /**\n * Destroy the Press instance byremoving all events\n */\n destroy() {\n if (this.element) {\n this.element.removeEventListener(\"pointerdown\", this.functionsBinded.downAction);\n this.element.removeEventListener(\"touchstart\", this.functionsBinded.downActionDelay);\n this.element.removeEventListener(\"trigger_pointer_pressstart\", this.functionsBinded.childPressStart);\n this.element.removeEventListener(\"trigger_pointer_pressend\", this.functionsBinded.childPressEnd);\n this.element.removeEventListener(\"trigger_pointer_pressmove\", this.functionsBinded.childPressMove);\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n }\n}\nPressManager.Namespace=`Aventus`;\n__as1(_, 'PressManager', PressManager);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":true},{"fullName":"Aventus.Callback","isStrong":true},{"fullName":"Aventus.NormalizedEvent","isStrong":true},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.InternalPointerEvent","isStrong":false}],"fullName":"Aventus.PressManager","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let DragAndDrop=class DragAndDrop {\n /**\n * Default offset before drag element\n */\n static defaultOffsetDrag = 20;\n pressManager;\n options;\n startCursorPosition = { x: 0, y: 0 };\n startElementPosition = { x: 0, y: 0 };\n isEnable = true;\n draggableElement;\n constructor(options) {\n this.options = this.getDefaultOptions(options.element);\n this.mergeProperties(options);\n this.mergeFunctions(options);\n this.options.elementTrigger.style.touchAction = 'none';\n this.pressManager = new PressManager({\n element: this.options.elementTrigger,\n onPressStart: this.onPressStart.bind(this),\n onPressEnd: this.onPressEnd.bind(this),\n onDragStart: this.onDragStart.bind(this),\n onDrag: this.onDrag.bind(this),\n onDragEnd: this.onDragEnd.bind(this),\n offsetDrag: this.options.offsetDrag,\n dragDirection: this.options.dragDirection,\n stopPropagation: this.options.stopPropagation\n });\n }\n getDefaultOptions(element) {\n return {\n applyDrag: true,\n element: element,\n elementTrigger: element,\n offsetDrag: DragAndDrop.defaultOffsetDrag,\n dragDirection: 'XY',\n shadow: {\n enable: false,\n container: document.body,\n removeOnStop: true,\n transform: () => { },\n delete: (el) => {\n el.remove();\n }\n },\n strict: false,\n targets: [],\n usePercent: false,\n stopPropagation: true,\n useMouseFinalPosition: false,\n useTransform: false,\n isDragEnable: () => true,\n getZoom: () => 1,\n getOffsetX: () => 0,\n getOffsetY: () => 0,\n onPointerDown: (e) => { },\n onPointerUp: (e) => { },\n onStart: (e) => { },\n onMove: (e) => { },\n onStop: (e) => { },\n onDrop: (element, targets) => { },\n correctPosition: (position) => position\n };\n }\n mergeProperties(options) {\n if (options.element === void 0) {\n throw \"You must define the element for the drag&drop\";\n }\n this.options.element = options.element;\n if (options.elementTrigger === void 0) {\n this.options.elementTrigger = this.options.element;\n }\n else {\n this.options.elementTrigger = options.elementTrigger;\n }\n this.defaultMerge(options, \"applyDrag\");\n this.defaultMerge(options, \"offsetDrag\");\n this.defaultMerge(options, \"dragDirection\");\n this.defaultMerge(options, \"strict\");\n this.defaultMerge(options, \"targets\");\n this.defaultMerge(options, \"usePercent\");\n this.defaultMerge(options, \"stopPropagation\");\n this.defaultMerge(options, \"useMouseFinalPosition\");\n this.defaultMerge(options, \"useTransform\");\n if (options.shadow !== void 0) {\n this.options.shadow.enable = options.shadow.enable;\n if (options.shadow.container !== void 0) {\n this.options.shadow.container = options.shadow.container;\n }\n else {\n this.options.shadow.container = document.body;\n }\n if (options.shadow.removeOnStop !== void 0) {\n this.options.shadow.removeOnStop = options.shadow.removeOnStop;\n }\n if (options.shadow.transform !== void 0) {\n this.options.shadow.transform = options.shadow.transform;\n }\n if (options.shadow.delete !== void 0) {\n this.options.shadow.delete = options.shadow.delete;\n }\n }\n }\n mergeFunctions(options) {\n this.defaultMerge(options, \"isDragEnable\");\n this.defaultMerge(options, \"getZoom\");\n this.defaultMerge(options, \"getOffsetX\");\n this.defaultMerge(options, \"getOffsetY\");\n this.defaultMerge(options, \"onPointerDown\");\n this.defaultMerge(options, \"onPointerUp\");\n this.defaultMerge(options, \"onStart\");\n this.defaultMerge(options, \"onMove\");\n this.defaultMerge(options, \"onStop\");\n this.defaultMerge(options, \"onDrop\");\n this.defaultMerge(options, \"correctPosition\");\n }\n defaultMerge(options, name) {\n if (options[name] !== void 0) {\n const opts = this.options;\n opts[name] = options[name];\n }\n }\n positionShadowRelativeToElement = { x: 0, y: 0 };\n onPressStart(e) {\n this.options.onPointerDown(e);\n }\n onPressEnd(e) {\n this.options.onPointerUp(e);\n }\n onDragStart(e) {\n this.isEnable = this.options.isDragEnable();\n if (!this.isEnable) {\n return false;\n }\n let draggableElement = this.options.element;\n this.startCursorPosition = {\n x: e.pageX,\n y: e.pageY\n };\n this.startElementPosition = this.getBoundingBoxRelative(draggableElement);\n if (this.options.shadow.enable) {\n draggableElement = this.options.element.cloneNode(true);\n let elBox = this.options.element.getBoundingClientRect();\n let containerBox = this.options.shadow.container.getBoundingClientRect();\n this.positionShadowRelativeToElement = {\n x: elBox.x - containerBox.x,\n y: elBox.y - containerBox.y\n };\n if (this.options.applyDrag) {\n draggableElement.style.position = \"absolute\";\n draggableElement.style.top = this.positionShadowRelativeToElement.y + this.options.getOffsetY() + 'px';\n draggableElement.style.left = this.positionShadowRelativeToElement.x + this.options.getOffsetX() + 'px';\n this.options.shadow.transform(draggableElement);\n this.options.shadow.container.appendChild(draggableElement);\n }\n }\n this.draggableElement = draggableElement;\n const result = this.options.onStart(e);\n if (result !== false) {\n document.body.style.userSelect = 'none';\n if (window.getSelection) {\n window.getSelection()?.removeAllRanges();\n }\n }\n return result;\n }\n onDrag(e) {\n if (!this.isEnable) {\n return;\n }\n let zoom = this.options.getZoom();\n let diff = {\n x: 0,\n y: 0\n };\n if (this.options.shadow.enable) {\n diff = {\n x: (e.pageX - this.startCursorPosition.x) + this.positionShadowRelativeToElement.x + this.options.getOffsetX(),\n y: (e.pageY - this.startCursorPosition.y) + this.positionShadowRelativeToElement.y + this.options.getOffsetY(),\n };\n }\n else {\n diff = {\n x: (e.pageX - this.startCursorPosition.x) / zoom + this.startElementPosition.x + this.options.getOffsetX(),\n y: (e.pageY - this.startCursorPosition.y) / zoom + this.startElementPosition.y + this.options.getOffsetY()\n };\n }\n let newPos = this.setPosition(diff);\n this.options.onMove(e, newPos);\n }\n onDragEnd(e) {\n if (!this.isEnable) {\n return;\n }\n document.body.style.userSelect = '';\n let targets = this.options.useMouseFinalPosition ? this.getMatchingTargetsWithMousePosition({\n x: e.clientX,\n y: e.clientY\n }) : this.getMatchingTargets();\n let draggableElement = this.draggableElement;\n if (this.options.shadow.enable && this.options.shadow.removeOnStop) {\n this.options.shadow.delete(draggableElement);\n }\n if (targets.length > 0) {\n this.options.onDrop(this.options.element, targets);\n }\n this.options.onStop(e);\n }\n setPosition(position) {\n let draggableElement = this.draggableElement;\n if (this.options.usePercent) {\n let elementParent = this.getOffsetParent(draggableElement);\n if (elementParent instanceof HTMLElement) {\n let percentPosition = {\n x: (position.x / elementParent.offsetWidth) * 100,\n y: (position.y / elementParent.offsetHeight) * 100\n };\n percentPosition = this.options.correctPosition(percentPosition);\n if (this.options.applyDrag) {\n draggableElement.style.left = percentPosition.x + '%';\n draggableElement.style.top = percentPosition.y + '%';\n }\n return percentPosition;\n }\n else {\n console.error(\"Can't find parent. Contact an admin\", draggableElement);\n }\n }\n else {\n position = this.options.correctPosition(position);\n if (this.options.applyDrag) {\n if (this.isLeftTopElement(draggableElement)) {\n draggableElement.style.left = position.x + 'px';\n draggableElement.style.top = position.y + 'px';\n }\n else {\n if (this.options.useTransform) {\n draggableElement.setAttribute(\"transform\", `translate(${position.x},${position.y})`);\n }\n else {\n draggableElement.style.left = position.x + 'px';\n draggableElement.style.top = position.y + 'px';\n }\n }\n }\n }\n return position;\n }\n getTargets() {\n if (typeof this.options.targets == \"function\") {\n return this.options.targets();\n }\n else {\n return this.options.targets;\n }\n }\n /**\n * Get targets within the current element position is matching\n */\n getMatchingTargets() {\n let draggableElement = this.draggableElement;\n let matchingTargets = [];\n let srcTargets = this.getTargets();\n for (let target of srcTargets) {\n let elementCoordinates = this.getBoundingBoxAbsolute(draggableElement);\n let targetCoordinates = this.getBoundingBoxAbsolute(target);\n let offsetX = this.options.getOffsetX();\n let offsetY = this.options.getOffsetY();\n let zoom = this.options.getZoom();\n targetCoordinates.x += offsetX;\n targetCoordinates.y += offsetY;\n targetCoordinates.width *= zoom;\n targetCoordinates.height *= zoom;\n if (this.options.strict) {\n if ((elementCoordinates.x >= targetCoordinates.x && elementCoordinates.x + elementCoordinates.width <= targetCoordinates.x + targetCoordinates.width) &&\n (elementCoordinates.y >= targetCoordinates.y && elementCoordinates.y + elementCoordinates.height <= targetCoordinates.y + targetCoordinates.height)) {\n matchingTargets.push(target);\n }\n }\n else {\n let elementLeft = elementCoordinates.x;\n let elementRight = elementCoordinates.x + elementCoordinates.width;\n let elementTop = elementCoordinates.y;\n let elementBottom = elementCoordinates.y + elementCoordinates.height;\n let targetLeft = targetCoordinates.x;\n let targetRight = targetCoordinates.x + targetCoordinates.width;\n let targetTop = targetCoordinates.y;\n let targetBottom = targetCoordinates.y + targetCoordinates.height;\n if (!(elementRight < targetLeft ||\n elementLeft > targetRight ||\n elementBottom < targetTop ||\n elementTop > targetBottom)) {\n matchingTargets.push(target);\n }\n }\n }\n return matchingTargets;\n }\n /**\n * This function will return the targets that are matching with the mouse position\n * @param mouse The mouse position\n */\n getMatchingTargetsWithMousePosition(mouse) {\n let matchingTargets = [];\n if (this.options.shadow.enable == false || this.options.shadow.container == null) {\n console.warn(\"DragAndDrop : To use useMouseFinalPosition=true, you must enable shadow and set a container\");\n return matchingTargets;\n }\n const container = this.options.shadow.container;\n let xCorrected = mouse.x - container.getBoundingClientRect().left;\n let yCorrected = mouse.y - container.getBoundingClientRect().top;\n for (let target of this.getTargets()) {\n if (this.isLeftTopElement(target)) {\n if (this.matchPosition(target, { x: mouse.x, y: mouse.y })) {\n matchingTargets.push(target);\n }\n }\n else {\n if (this.matchPosition(target, { x: xCorrected, y: yCorrected })) {\n matchingTargets.push(target);\n }\n }\n }\n return matchingTargets;\n }\n matchPosition(element, point) {\n let elementCoordinates = this.getBoundingBoxAbsolute(element);\n if (point.x >= elementCoordinates.x &&\n point.x <= elementCoordinates.x + elementCoordinates.width &&\n point.y >= elementCoordinates.y &&\n point.y <= elementCoordinates.y + elementCoordinates.height) {\n return true;\n }\n return false;\n }\n /**\n * Get element currently dragging\n */\n getElementDrag() {\n return this.options.element;\n }\n /**\n * Set targets where to drop\n */\n setTargets(targets) {\n this.options.targets = targets;\n }\n /**\n * Set targets where to drop\n */\n setTargetsFct(targets) {\n this.options.targets = targets;\n }\n /**\n * Destroy the current drag&drop instance\n */\n destroy() {\n this.pressManager.destroy();\n }\n isLeftTopElement(element) {\n for (let Type of DragElementLeftTopType) {\n if (element instanceof Type) {\n return true;\n }\n }\n return false;\n }\n isXYElement(element) {\n for (let Type of DragElementXYType) {\n if (element instanceof Type) {\n return true;\n }\n }\n return false;\n }\n getCoordinateFromAttribute(element) {\n if (this.options.useTransform) {\n const transform = element.getAttribute(\"transform\");\n const tvalue = transform?.match(/translate\\(([^,]+),([^,]+)\\)/);\n const x = tvalue ? parseFloat(tvalue[1]) : 0;\n const y = tvalue ? parseFloat(tvalue[2]) : 0;\n return {\n x: x,\n y: y\n };\n }\n return {\n x: parseFloat(element.getAttribute(\"x\")),\n y: parseFloat(element.getAttribute(\"y\"))\n };\n }\n XYElementToRelativeBox(element) {\n let coordinates = this.getCoordinateFromAttribute(element);\n const width = parseFloat(element.getAttribute(\"width\"));\n const height = parseFloat(element.getAttribute(\"height\"));\n return {\n x: coordinates.x,\n y: coordinates.y,\n width: width,\n height: height,\n bottom: coordinates.y + height,\n right: coordinates.x + width,\n top: coordinates.y,\n left: coordinates.x,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n XYElementToAbsoluteBox(element) {\n let coordinates = this.getCoordinateFromAttribute(element);\n const parent = this.getOffsetParent(element);\n if (parent) {\n const box = parent.getBoundingClientRect();\n coordinates = {\n x: coordinates.x + box.x,\n y: coordinates.y + box.y\n };\n }\n const width = parseFloat(element.getAttribute(\"width\"));\n const height = parseFloat(element.getAttribute(\"height\"));\n return {\n x: coordinates.x,\n y: coordinates.y,\n width: width,\n height: height,\n bottom: coordinates.y + height,\n right: coordinates.x + width,\n top: coordinates.y,\n left: coordinates.x,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getBoundingBoxAbsolute(element) {\n if (this.isLeftTopElement(element)) {\n if (element instanceof HTMLElement) {\n const bounds = element.getBoundingClientRect();\n return {\n x: bounds.x,\n y: bounds.y,\n width: bounds.width,\n height: bounds.height,\n bottom: bounds.bottom,\n right: bounds.right,\n top: bounds.top,\n left: bounds.left,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n }\n else if (this.isXYElement(element)) {\n return this.XYElementToAbsoluteBox(element);\n }\n const parent = this.getOffsetParent(element);\n if (parent instanceof HTMLElement) {\n const rect = element.getBoundingClientRect();\n const rectParent = parent.getBoundingClientRect();\n const x = rect.left - rectParent.left;\n const y = rect.top - rectParent.top;\n return {\n x: x,\n y: y,\n width: rect.width,\n height: rect.height,\n bottom: y + rect.height,\n right: x + rect.width,\n left: rect.left - rectParent.left,\n top: rect.top - rectParent.top,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n console.error(\"Element type not supported\");\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n top: 0,\n left: 0,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getBoundingBoxRelative(element) {\n if (this.isLeftTopElement(element)) {\n if (element instanceof HTMLElement) {\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: element.offsetWidth,\n height: element.offsetHeight,\n bottom: element.offsetTop + element.offsetHeight,\n right: element.offsetLeft + element.offsetWidth,\n top: element.offsetTop,\n left: element.offsetLeft,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n }\n else if (this.isXYElement(element)) {\n return this.XYElementToRelativeBox(element);\n }\n const parent = this.getOffsetParent(element);\n if (parent instanceof HTMLElement) {\n const rect = element.getBoundingClientRect();\n const rectParent = parent.getBoundingClientRect();\n const x = rect.left - rectParent.left;\n const y = rect.top - rectParent.top;\n return {\n x: x,\n y: y,\n width: rect.width,\n height: rect.height,\n bottom: y + rect.height,\n right: x + rect.width,\n left: rect.left - rectParent.left,\n top: rect.top - rectParent.top,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n console.error(\"Element type not supported\");\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n top: 0,\n left: 0,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getOffsetParent(element) {\n if (element instanceof HTMLElement) {\n return element.offsetParent;\n }\n let current = element.parentNode;\n while (current) {\n if (current instanceof Element) {\n const style = getComputedStyle(current);\n if (style.position !== 'static') {\n return current;\n }\n }\n if (current instanceof ShadowRoot) {\n current = current.host;\n }\n else {\n current = current.parentNode;\n }\n }\n return null;\n }\n}\nDragAndDrop.Namespace=`Aventus`;\n__as1(_, 'DragAndDrop', DragAndDrop);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsInternal","isStrong":false},{"fullName":"Aventus.Coordinate","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false},{"fullName":"Aventus.DragElementLeftTopType","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementXYType","isStrong":false},{"fullName":"Aventus.AnyElement","isStrong":false}],"fullName":"Aventus.DragAndDrop","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Instance=class Instance {\n static elements = new Map();\n static get(type) {\n let result = this.elements.get(type);\n if (!result) {\n let cst = type.prototype['constructor'];\n result = new cst();\n this.elements.set(type, result);\n }\n return result;\n }\n static set(el) {\n let cst = el.constructor;\n if (this.elements.get(cst)) {\n return false;\n }\n this.elements.set(cst, el);\n return true;\n }\n static destroy(el) {\n let cst = el.constructor;\n return this.elements.delete(cst);\n }\n}\nInstance.Namespace=`Aventus`;\n__as1(_, 'Instance', Instance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.InstanceCst2","isStrong":false},{"fullName":"X","isStrong":false},{"fullName":"Aventus.InstanceCst","isStrong":false}],"fullName":"Aventus.Instance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ResizeObserver=class ResizeObserver {\n callback;\n targets;\n fpsInterval = -1;\n nextFrame;\n entriesChangedEvent;\n willTrigger;\n static resizeObserverClassByObject = {};\n static uniqueInstance;\n static getUniqueInstance() {\n if (!ResizeObserver.uniqueInstance) {\n ResizeObserver.uniqueInstance = new window.ResizeObserver(entries => {\n let allClasses = [];\n for (let j = 0; j < entries.length; j++) {\n let entry = entries[j];\n const target = entry.target;\n let index = target['sourceIndex'];\n if (ResizeObserver.resizeObserverClassByObject[index]) {\n for (let i = 0; i < ResizeObserver.resizeObserverClassByObject[index].length; i++) {\n let classTemp = ResizeObserver.resizeObserverClassByObject[index][i];\n classTemp.entryChanged(entry);\n if (allClasses.indexOf(classTemp) == -1) {\n allClasses.push(classTemp);\n }\n }\n }\n }\n for (let i = 0; i < allClasses.length; i++) {\n allClasses[i].triggerCb();\n }\n });\n }\n return ResizeObserver.uniqueInstance;\n }\n constructor(options) {\n let realOption;\n if (options instanceof Function) {\n realOption = {\n callback: options,\n };\n }\n else {\n realOption = options;\n }\n this.callback = realOption.callback;\n this.targets = [];\n if (!realOption.fps) {\n realOption.fps = 60;\n }\n if (realOption.fps != -1) {\n this.fpsInterval = 1000 / realOption.fps;\n }\n this.nextFrame = 0;\n this.entriesChangedEvent = {};\n this.willTrigger = false;\n }\n /**\n * Observe size changing for the element\n */\n observe(target) {\n const _target = target;\n if (!_target[\"sourceIndex\"]) {\n _target[\"sourceIndex\"] = Math.random().toString(36);\n this.targets.push(_target);\n ResizeObserver.getUniqueInstance().observe(_target);\n }\n if (!ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]]) {\n ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]] = [];\n }\n if (ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]].indexOf(this) == -1) {\n ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]].push(this);\n }\n }\n /**\n * Stop observing size changing for the element\n */\n unobserve(target) {\n const _target = target;\n for (let i = 0; this.targets.length; i++) {\n let tempTarget = this.targets[i];\n if (tempTarget == _target) {\n let position = ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].indexOf(this);\n if (position != -1) {\n ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].splice(position, 1);\n }\n if (ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].length == 0) {\n delete ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']];\n }\n ResizeObserver.getUniqueInstance().unobserve(_target);\n this.targets.splice(i, 1);\n return;\n }\n }\n }\n /**\n * Destroy the resize observer\n */\n disconnect() {\n for (let i = 0; this.targets.length; i++) {\n this.unobserve(this.targets[i]);\n }\n }\n entryChanged(entry) {\n const _target = entry.target;\n let index = _target.sourceIndex;\n this.entriesChangedEvent[index] = entry;\n }\n triggerCb() {\n if (!this.willTrigger) {\n this.willTrigger = true;\n this._triggerCb();\n }\n }\n _triggerCb() {\n let now = window.performance.now();\n let elapsed = now - this.nextFrame;\n if (this.fpsInterval != -1 && elapsed <= this.fpsInterval) {\n requestAnimationFrame(() => {\n this._triggerCb();\n });\n return;\n }\n this.nextFrame = now - (elapsed % this.fpsInterval);\n let changed = Object.values(this.entriesChangedEvent);\n this.entriesChangedEvent = {};\n this.willTrigger = false;\n setTimeout(() => {\n this.callback(changed, ResizeObserver.uniqueInstance);\n }, 0);\n }\n}\nResizeObserver.Namespace=`Aventus`;\n__as1(_, 'ResizeObserver', ResizeObserver);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WindowResizeObserver","isStrong":true},{"fullName":"Aventus.ResizeObserverOptions","isStrong":false}],"fullName":"Aventus.ResizeObserver","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Uri=class Uri {\n static prepare(uri) {\n let params = [];\n let i = 0;\n let regexState = uri.replace(/{.*?}/g, (group, position) => {\n group = group.slice(1, -1);\n let splitted = group.split(\":\");\n let name = splitted[0].trim();\n let type = \"string\";\n let result = \"([^\\\\/]+)\";\n i++;\n if (splitted.length > 1) {\n if (splitted[1].trim() == \"number\") {\n result = \"([0-9]+)\";\n type = \"number\";\n }\n }\n params.push({\n name,\n type,\n position: i\n });\n return result;\n });\n regexState = regexState.replace(/\\*/g, \".*?\").toLowerCase();\n regexState = \"^\" + regexState + '$';\n return {\n regex: new RegExp(regexState),\n params\n };\n }\n static getParams(from, current) {\n if (typeof from == \"string\") {\n from = this.prepare(from);\n }\n let matches = from.regex.exec(current.toLowerCase());\n if (matches) {\n let slugs = {};\n for (let param of from.params) {\n if (param.type == \"number\") {\n slugs[param.name] = Number(matches[param.position]);\n }\n else {\n slugs[param.name] = matches[param.position];\n }\n }\n return slugs;\n }\n return null;\n }\n static isActive(from, current) {\n if (typeof from == \"string\") {\n from = this.prepare(from);\n }\n return from.regex.test(current);\n }\n static normalize(path) {\n const isAbsolute = path.startsWith('/');\n const parts = path.split('/');\n const normalizedParts = [];\n for (let i = 0; i < parts.length; i++) {\n if (parts[i] === '..') {\n normalizedParts.pop();\n }\n else if (parts[i] !== '.' && parts[i] !== '') {\n normalizedParts.push(parts[i]);\n }\n }\n let normalizedPath = normalizedParts.join('/');\n if (isAbsolute) {\n normalizedPath = '/' + normalizedPath;\n }\n return normalizedPath;\n }\n}\nUri.Namespace=`Aventus`;\n__as1(_, 'Uri', Uri);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PreparedUri","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}],"fullName":"Aventus.Uri","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let RamError=class RamError extends GenericError {\n}\nRamError.Namespace=`Aventus`;\nRamError.$schema={...(GenericError?.$schema ?? {}), };\nConverter.register(RamError.Fullname, RamError);\n__as1(_, 'RamError', RamError);\n","dependencies":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.RamError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let VoidRamWithError=class VoidRamWithError extends VoidWithError {\n}\nVoidRamWithError.Namespace=`Aventus`;\nVoidRamWithError.$schema={...(VoidWithError?.$schema ?? {}), };\nConverter.register(VoidRamWithError.Fullname, VoidRamWithError);\n__as1(_, 'VoidRamWithError', VoidRamWithError);\n","dependencies":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.VoidRamWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let ResultRamWithError=class ResultRamWithError extends ResultWithError {\n}\nResultRamWithError.Namespace=`Aventus`;\nResultRamWithError.$schema={...(ResultWithError?.$schema ?? {}), };\nConverter.register(ResultRamWithError.Fullname, ResultRamWithError);\n__as1(_, 'ResultRamWithError', ResultRamWithError);\n","dependencies":[{"fullName":"Aventus.ResultWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.ResultRamWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let GenericRam=class GenericRam {\n static info = new Map([]);\n /**\n * The current namespace\n */\n static Namespace = \"\";\n // public static get Namespace(): string { return \"\"; }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n subscribers = {\n created: [],\n updated: [],\n deleted: [],\n };\n recordsSubscribers = new Map();\n /**\n * List of stored item by index key\n */\n records = new Map();\n actionGuard = new ActionGuard();\n ramMapping = {};\n constructor() {\n if (this.constructor == GenericRam) {\n throw \"can't instanciate an abstract class\";\n }\n // RamManager.check();\n this.getIdWithError = this.getIdWithError.bind(this);\n this.getId = this.getId.bind(this);\n this.save = this.save.bind(this);\n this.saveWithError = this.saveWithError.bind(this);\n this.onCreated = this.onCreated.bind(this);\n this.offCreated = this.offCreated.bind(this);\n this.onUpdated = this.onUpdated.bind(this);\n this.offUpdated = this.offUpdated.bind(this);\n this.onDeleted = this.onDeleted.bind(this);\n this.offDeleted = this.offDeleted.bind(this);\n this.get = this.get.bind(this);\n this.getWithError = this.getWithError.bind(this);\n this.getById = this.getById.bind(this);\n this.getByIdWithError = this.getByIdWithError.bind(this);\n this.getByIds = this.getByIds.bind(this);\n this.getByIdsWithError = this.getByIdsWithError.bind(this);\n this.getAll = this.getAll.bind(this);\n this.getAllWithError = this.getAllWithError.bind(this);\n this.getList = this.getList.bind(this);\n this.getListWithError = this.getListWithError.bind(this);\n this.getRecords = this.getRecords.bind(this);\n this.getRecordsWithError = this.getRecordsWithError.bind(this);\n this.createList = this.createList.bind(this);\n this.createListWithError = this.createListWithError.bind(this);\n this.create = this.create.bind(this);\n this.createWithError = this.createWithError.bind(this);\n this.updateList = this.updateList.bind(this);\n this.updateListWithError = this.updateListWithError.bind(this);\n this.update = this.update.bind(this);\n this.updateWithError = this.updateWithError.bind(this);\n this.deleteList = this.deleteList.bind(this);\n this.deleteListWithError = this.deleteListWithError.bind(this);\n this.delete = this.delete.bind(this);\n this.deleteWithError = this.deleteWithError.bind(this);\n this.deleteById = this.deleteById.bind(this);\n this.deleteByIdWithError = this.deleteByIdWithError.bind(this);\n }\n /**\n * Get item id\n */\n getIdWithError(item) {\n let action = new ResultRamWithError();\n let idTemp = item[this.defineIndexKey()];\n if (idTemp !== undefined) {\n action.result = idTemp;\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noId, \"no key found for item\"));\n }\n return action;\n }\n /**\n * Get item id\n */\n getId(item) {\n let result = this.getIdWithError(item);\n if (result.success) {\n return result.result;\n }\n throw 'no key found for item';\n }\n /**\n * Prevent adding Watch element\n */\n removeWatch(element) {\n let byPass = element;\n if (byPass.__isProxy) {\n return byPass.getTarget();\n }\n return element;\n }\n /**\n * Add function update, onUpdate, offUpdate, delete, onDelete, offDelete\n */\n addRamAction(Base) {\n let that = this;\n return class ActionClass extends Base {\n static get className() {\n return Base.className || Base.name;\n }\n get className() {\n return Base.className || Base.name;\n }\n async update(newData) {\n return (await that.update(newData));\n }\n async updateWithError(newData) {\n return (await that.updateWithError(newData));\n }\n onUpdate(callback) {\n let id = that.getId(this);\n if (!that.recordsSubscribers.has(id)) {\n that.recordsSubscribers.set(id, {\n created: [],\n updated: [],\n deleted: []\n });\n }\n let sub = that.recordsSubscribers.get(id);\n if (sub && !sub.updated.includes(callback)) {\n sub.updated.push(callback);\n }\n }\n offUpdate(callback) {\n let id = that.getId(this);\n let sub = that.recordsSubscribers.get(id);\n if (sub) {\n let index = sub.updated.indexOf(callback);\n if (index != -1) {\n sub.updated.splice(index, 1);\n }\n }\n }\n async delete() {\n let id = that.getId(this);\n await that.deleteById(id);\n }\n async deleteWithError() {\n const result = new VoidRamWithError();\n let queryId = that.getIdWithError(this);\n if (!queryId.success || !queryId.result) {\n result.errors = queryId.errors;\n return result;\n }\n const queryDelete = await that.deleteByIdWithError(queryId.result);\n result.errors = queryDelete.errors;\n return result;\n }\n onDelete(callback) {\n let id = that.getId(this);\n if (!that.recordsSubscribers.has(id)) {\n that.recordsSubscribers.set(id, {\n created: [],\n updated: [],\n deleted: []\n });\n }\n let sub = that.recordsSubscribers.get(id);\n if (sub && !sub.deleted.includes(callback)) {\n sub.deleted.push(callback);\n }\n }\n offDelete(callback) {\n let id = that.getId(this);\n let sub = that.recordsSubscribers.get(id);\n if (sub) {\n let index = sub.deleted.indexOf(callback);\n if (index != -1) {\n sub.deleted.splice(index, 1);\n }\n }\n }\n };\n }\n /**\n * Define all the types you ram is capable of\n */\n ramForTypes() {\n return [this.getTypeForData({})];\n }\n /**\n * Transform the object into the object stored inside Ram\n */\n getObjectForRam(objJson) {\n let Item = this.addRamAction(this.getTypeForData(objJson));\n let item = new Item();\n this.mergeObject(item, objJson);\n return item;\n }\n // onCreated: (item: any) => void;\n // onUpdated: (item: any) => void;\n // onDeleted: (item: any) => void;\n // }> = new Map();\n // private linkInfo: { [key: string | number]: { [id: string | number]: Request[]; }; } = {};\n // private linkRamItem(item: Request) {\n // for(let key in this.ramMapping) {\n // this.linkRamItemByKey(item, key);\n // private linkRamItemByKey(item: Request, key: string) {\n // if(key in item) {\n // if(mapping.asArray) {\n // if(Array.isArray(item[key])) {\n // console.error(key + \" in type \" + item + \" must be an array\");\n // const id = mapping.ram.getId(item[key]);\n // if(!this.linkFct.has(mapping.ram)) {\n // onCreated: (item) => {\n // onUpdated: (item) => {\n // onDeleted: (item) => {\n // this.linkFct.set(mapping.ram, fcts);\n // mapping.ram.onCreated(fcts.onCreated);\n // mapping.ram.onUpdated(fcts.onUpdated);\n // mapping.ram.onDeleted(fcts.onDeleted);\n // if(!this.linkInfo[key])\n // if(!this.linkInfo[key][id])\n // this.linkInfo[key][id].push(item);\n /**\n * Add element inside Ram or update it. The instance inside the ram is unique and ll never be replaced\n */\n async addOrUpdateData(item) {\n const resultTemp = new ResultWithError();\n try {\n const id = resultTemp.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return resultTemp;\n if (this.records.has(id)) {\n let uniqueRecord = this.records.get(id);\n await resultTemp.runAsync(() => this.beforeRecordSet(uniqueRecord));\n // this.unlinkRamItem(uniqueRecord);\n if (resultTemp.success)\n this.mergeObject(uniqueRecord, item);\n await resultTemp.runAsync(() => this.afterRecordSet(uniqueRecord));\n // this.linkRamItem(uniqueRecord);\n resultTemp.result = {\n kind: 'updated',\n value: this.records.get(id)\n };\n }\n else {\n let realObject = this.getObjectForRam(item);\n await resultTemp.runAsync(() => this.beforeRecordSet(realObject));\n this.records.set(id, realObject);\n await resultTemp.runAsync(() => this.afterRecordSet(realObject));\n // this.linkRamItem(realObject);\n resultTemp.result = {\n kind: 'created',\n value: this.records.get(id)\n };\n }\n }\n catch (e) {\n resultTemp.errors.push(new RamError(RamErrorCode.unknow, e));\n }\n return resultTemp;\n }\n /**\n * Merge object and create real instance of class\n */\n mergeObject(item, objJson, options) {\n if (!item) {\n return;\n }\n if (!options) {\n options = {\n replaceUndefined: true\n };\n }\n Json.classFromJson(item, objJson, options);\n }\n /**\n * Create or update the item\n */\n async save(item, ...args) {\n let action = await this.saveWithError(item, ...args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Create or update the item\n */\n async saveWithError(item, ...args) {\n let action = new ResultRamWithError();\n const id = action.extract(() => this.getIdWithError(item));\n if (id !== undefined) {\n if (id) {\n return this.updateWithError(item, ...args);\n }\n else {\n return this.createWithError(item, ...args);\n }\n }\n return action;\n }\n async beforeRecordSet(item) {\n return new VoidWithError();\n }\n async afterRecordSet(item) {\n return new VoidWithError();\n }\n async beforeRecordDelete(item) {\n return new VoidWithError();\n }\n async afterRecordDelete(item) {\n return new VoidWithError();\n }\n publish(type, data) {\n let callbacks = [...this.subscribers[type]];\n for (let callback of callbacks) {\n callback(data);\n }\n let sub = this.recordsSubscribers.get(this.getId(data));\n if (sub) {\n let localCallbacks = [...sub[type]];\n for (let localCallback of localCallbacks) {\n localCallback(data);\n }\n }\n }\n subscribe(type, cb) {\n if (!this.subscribers[type].includes(cb)) {\n this.subscribers[type].push(cb);\n }\n }\n unsubscribe(type, cb) {\n let index = this.subscribers[type].indexOf(cb);\n if (index != -1) {\n this.subscribers[type].splice(index, 1);\n }\n }\n /**\n * Add a callback that ll be triggered when a new item is stored\n */\n onCreated(cb) {\n this.subscribe('created', cb);\n }\n /**\n * Remove a created callback\n */\n offCreated(cb) {\n this.unsubscribe('created', cb);\n }\n /**\n * Add a callback that ll be triggered when an item is updated\n */\n onUpdated(cb) {\n this.subscribe('updated', cb);\n }\n /**\n * Remove an updated callback\n */\n offUpdated(cb) {\n this.unsubscribe('updated', cb);\n }\n /**\n * Add a callback that ll be triggered when an item is deleted\n */\n onDeleted(cb) {\n this.subscribe('deleted', cb);\n }\n /**\n * Remove an deleted callback\n */\n offDeleted(cb) {\n this.unsubscribe('deleted', cb);\n }\n /**\n * Get an item by id if exist (alias for getById)\n */\n async get(id) {\n return await this.getById(id);\n }\n ;\n /**\n * Get an item by id if exist (alias for getById)\n */\n async getWithError(id) {\n return await this.getByIdWithError(id);\n }\n ;\n /**\n * Get an item by id if exist\n */\n async getById(id) {\n let action = await this.getByIdWithError(id);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Get an item by id if exist\n */\n async getByIdWithError(id) {\n return this.actionGuard.run(['getByIdWithError', id], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetById(id));\n if (action.success) {\n if (this.records.has(id)) {\n const item = this.records.get(id);\n action.result = item;\n await action.runAsync(() => this.afterGetById(item));\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't find the item \" + id + \" inside ram\"));\n }\n }\n return action;\n });\n }\n /**\n * Trigger before getting an item by id\n */\n async beforeGetById(id) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting an item by id\n */\n async afterGetById(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get multiple items by ids\n */\n async getByIds(ids) {\n let result = await this.getByIdsWithError(ids);\n if (result.success) {\n return result.result ?? [];\n }\n return [];\n }\n ;\n /**\n * Get multiple items by ids\n */\n async getByIdsWithError(ids) {\n return this.actionGuard.run(['getByIdsWithError', ids], async () => {\n const action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetByIds(ids));\n if (action.success) {\n const result = [];\n for (let id of ids) {\n let rec = this.records.get(id);\n if (rec) {\n result.push(rec);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't find the item \" + id + \" inside ram\"));\n }\n }\n if (action.success) {\n action.result = result;\n await action.runAsync(() => this.afterGetByIds(result));\n }\n }\n return action;\n });\n }\n ;\n /**\n * Trigger before getting a list of items by id\n */\n async beforeGetByIds(ids) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting a list of items by id\n */\n async afterGetByIds(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getAll() {\n let result = await this.getAllWithError();\n if (result.success) {\n return result.result ?? [];\n }\n return [];\n }\n /**\n * Get all elements inside the Ram\n */\n async getAllWithError() {\n return this.actionGuard.run(['getAllWithError'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetAll());\n if (action.success) {\n const result = Object.values(this.records);\n action.result = result;\n await action.runAsync(() => this.afterGetAll(result));\n }\n return action;\n });\n }\n /**\n * Trigger before getting all items inside Ram\n */\n async beforeGetAll() {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting all items inside Ram\n */\n async afterGetAll(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getList() {\n return await this.getAll();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getListWithError() {\n return await this.getAllWithError();\n }\n /**\n * Get all elements inside the Ram\n */\n async getRecords() {\n const result = await this.getRecordsWithError();\n if (result.success) {\n return result.result ?? new Map();\n }\n return new Map();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getRecordsWithError() {\n let action = new ResultRamWithError();\n action.runAsync(() => this.getAllWithError());\n if (action.success) {\n action.result = this.records;\n }\n return action;\n }\n /**\n * Create a list of items inside ram\n */\n async createList(list) {\n let result = await this.createListWithError(list);\n return result.result ?? [];\n }\n /**\n * Create a list of items inside ram\n */\n async createListWithError(list) {\n list = this.removeWatch(list);\n return this.actionGuard.run(['_createList'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeCreateList(list));\n for (let item of list) {\n await action.runAsync(() => this.beforeCreateItem(item, true));\n }\n const resources = await action.extractAsync(() => this.transformCreateRequestListToItem(list));\n if (!resources)\n return action;\n const result = [];\n for (let item of resources) {\n const resultItem = await action.extractAsync(() => this.addOrUpdateData(item));\n if (!resultItem)\n return action;\n await action.runAsync(() => this.afterCreateItem(resultItem.value, true));\n if (action.success) {\n result.push(resultItem.value);\n this.publish('created', resultItem.value);\n }\n }\n action.result = result;\n await action.runAsync(() => this.afterCreateList(result));\n return action;\n });\n }\n /**\n * Create an item inside ram\n */\n async create(item, ...args) {\n let action = await this.createWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Create an item inside ram\n */\n async createWithError(item, ...args) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_create', item], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeCreateItem(item, false));\n const resource = await action.extractAsync(() => this.transformCreateRequestToItem(item));\n if (!resource)\n return action;\n const id = await action.extract(() => this.getIdWithError(resource));\n if (id !== undefined) {\n const resultTemp = await action.extractAsync(() => this.addOrUpdateData(resource));\n if (!resultTemp)\n return action;\n await action.runAsync(() => this.afterCreateItem(resultTemp.value, false));\n if (action.success) {\n action.result = resultTemp.value;\n this.publish('created', resultTemp.value);\n }\n }\n return action;\n });\n }\n /**\n * Trigger before creating a list of items\n */\n async beforeCreateList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before creating an item\n */\n async beforeCreateItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after creating an item\n */\n async afterCreateItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after creating a list of items\n */\n async afterCreateList(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Update a list of items inside ram\n */\n async updateList(list) {\n let result = await this.updateListWithError(list);\n return result.result ?? [];\n }\n ;\n /**\n * Update a list of items inside ram\n */\n async updateListWithError(list) {\n list = this.removeWatch(list);\n return this.actionGuard.run(['_updateList'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeUpdateList(list));\n for (let item of list) {\n await action.runAsync(() => this.beforeUpdateItem(item, true));\n }\n const resources = await action.extractAsync(() => this.transformUpdateRequestListToItem(list));\n if (!resources)\n return action;\n const result = [];\n for (let item of resources) {\n const resultItem = await action.extractAsync(() => this.addOrUpdateData(item));\n if (!resultItem)\n return action;\n await action.runAsync(() => this.afterUpdateItem(resultItem.value, true));\n if (action.success) {\n result.push(resultItem.value);\n this.publish('created', resultItem.value);\n }\n }\n action.result = result;\n await action.runAsync(() => this.afterUpdateList(result));\n return action;\n });\n }\n ;\n /**\n * Update an item inside ram\n */\n async update(item, ...args) {\n let action = await this.updateWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Update an item inside ram\n */\n async updateWithError(item, ...args) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_update', item], async () => {\n let action = new ResultRamWithError();\n const id = await action.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return action;\n if (this.records.has(id)) {\n const currentEl = this.records.get(id);\n if (currentEl == item) {\n console.warn(\"You are updating the same item. You should clone the object first to avoid weird effect\");\n }\n await action.runAsync(() => this.beforeUpdateItem(item, false));\n const resource = await action.extractAsync(() => this.transformUpdateRequestToItem(item));\n if (!resource)\n return action;\n const resultTemp = await action.extractAsync(() => this.addOrUpdateData(resource));\n if (!resultTemp)\n return action;\n await action.runAsync(() => this.afterUpdateItem(resultTemp.value, false));\n if (action.success) {\n action.result = resultTemp.value;\n this.publish('updated', resultTemp.value);\n }\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't update the item \" + id + \" because it wasn't found inside ram\"));\n }\n return action;\n });\n }\n /**\n * Trigger before updating a list of items\n */\n async beforeUpdateList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before updating an item\n */\n async beforeUpdateItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after updating an item\n */\n async afterUpdateItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after updating a list of items\n */\n async afterUpdateList(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Delete a list of items inside ram\n */\n async deleteList(list) {\n let result = await this.deleteListWithError(list);\n return result.result ?? [];\n }\n ;\n /**\n * Delete a list of items inside ram\n */\n async deleteListWithError(list) {\n list = this.removeWatch(list);\n let action = new ResultRamWithError();\n action.result = [];\n await action.runAsync(() => this.beforeDeleteList(list));\n const result = [];\n for (let item of list) {\n const resultItem = await action.extractAsync(() => this._delete(item, true));\n if (!resultItem)\n return action;\n result.push(resultItem);\n }\n if (action.success) {\n action.result = result;\n await action.runAsync(() => this.afterDeleteList(result));\n }\n return action;\n }\n ;\n /**\n * Delete an item inside ram\n */\n async delete(item, ...args) {\n let action = await this.deleteWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n ;\n /**\n * Delete an item inside ram\n */\n async deleteWithError(item, ...args) {\n return await this._delete(item, false);\n }\n ;\n /**\n * Delete an item by id inside ram\n */\n async deleteById(id) {\n let action = await this.deleteByIdWithError(id);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Delete an item by id inside ram\n */\n async deleteByIdWithError(id) {\n let item = this.records.get(id);\n if (item) {\n return await this._delete(item, false);\n }\n let result = new ResultRamWithError();\n result.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n return result;\n }\n async _delete(item, fromList) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_delete', item], async () => {\n let action = new ResultRamWithError();\n const id = action.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return action;\n let oldItem = this.records.get(id);\n if (oldItem) {\n await action.runAsync(() => this.beforeDeleteItem(oldItem, fromList));\n await action.runAsync(() => this.beforeRecordDelete(oldItem));\n this.records.delete(id);\n await action.runAsync(() => this.afterRecordDelete(oldItem));\n await action.runAsync(() => this.afterDeleteItem(oldItem, fromList));\n if (action.success) {\n action.result = oldItem;\n this.publish('deleted', oldItem);\n }\n this.recordsSubscribers.delete(id);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n }\n return action;\n });\n }\n /**\n * Trigger before deleting a list of items\n */\n async beforeDeleteList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before deleting an item\n */\n async beforeDeleteItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after deleting an item\n */\n async afterDeleteItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after deleting a list of items\n */\n async afterDeleteList(result) {\n return new VoidWithError();\n }\n}\nGenericRam.Namespace=`Aventus`;\n__as1(_, 'GenericRam', GenericRam);\n","dependencies":[{"fullName":"Aventus.IRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.Request","isStrong":false},{"fullName":"Aventus.KeysObject","isStrong":false},{"fullName":"Aventus.Resource","isStrong":false},{"fullName":"Aventus.RamSubscribers","isStrong":false},{"fullName":"Aventus.RamItem","isStrong":false},{"fullName":"Aventus.ActionGuard","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"BindThis","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"X","isStrong":false},{"fullName":"B","isStrong":false},{"fullName":"Base","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.JsonFromOptions","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}],"fullName":"Aventus.GenericRam","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Ram=class Ram extends GenericRam {\n}\nRam.Namespace=`Aventus`;\n__as1(_, 'Ram', Ram);\n","dependencies":[{"fullName":"Aventus.GenericRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.Request","isStrong":false},{"fullName":"Aventus.Resource","isStrong":false}],"fullName":"Aventus.Ram","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let StateManager=class StateManager {\n subscribers = {};\n static canBeActivate(statePattern, stateName) {\n let stateInfo = Uri.prepare(statePattern);\n return stateInfo.regex.test(stateName);\n }\n activeState;\n changeStateMutex = new Mutex();\n canChangeStateCbs = [];\n afterStateChanged = new Callback();\n /**\n * Subscribe actions for a state or a state list\n */\n subscribe(statePatterns, callbacks, autoActiveState = true) {\n if (!callbacks.active && !callbacks.inactive && !callbacks.askChange) {\n this._log(`Trying to subscribe to state : ${statePatterns} with no callbacks !`, \"warning\");\n return;\n }\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (!this.subscribers.hasOwnProperty(statePattern)) {\n let res = Uri.prepare(statePattern);\n let isActive = this.activeState !== undefined && res.regex.test(this.activeState.name);\n this.subscribers[statePattern] = {\n \"regex\": res.regex,\n \"params\": res.params,\n \"callbacks\": {\n \"active\": [],\n \"inactive\": [],\n \"askChange\": [],\n },\n \"isActive\": isActive,\n };\n }\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n this.subscribers[statePattern].callbacks.active.push(activeFct);\n if (this.subscribers[statePattern].isActive && this.activeState && autoActiveState) {\n let slugs = Uri.getParams(this.subscribers[statePattern], this.activeState.name);\n if (slugs) {\n activeFct(this.activeState, slugs);\n }\n }\n }\n }\n if (callbacks.inactive) {\n if (!Array.isArray(callbacks.inactive)) {\n callbacks.inactive = [callbacks.inactive];\n }\n for (let inactiveFct of callbacks.inactive) {\n this.subscribers[statePattern].callbacks.inactive.push(inactiveFct);\n }\n }\n if (callbacks.askChange) {\n if (!Array.isArray(callbacks.askChange)) {\n callbacks.askChange = [callbacks.askChange];\n }\n for (let askChangeFct of callbacks.askChange) {\n this.subscribers[statePattern].callbacks.askChange.push(askChangeFct);\n }\n }\n }\n }\n /**\n *\n */\n activateAfterSubscribe(statePatterns, callbacks) {\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n if (this.subscribers[statePattern].isActive && this.activeState) {\n let slugs = Uri.getParams(this.subscribers[statePattern], this.activeState.name);\n if (slugs) {\n activeFct(this.activeState, slugs);\n }\n }\n }\n }\n }\n }\n /**\n * Unsubscribe actions for a state or a state list\n */\n unsubscribe(statePatterns, callbacks) {\n if (!callbacks.active && !callbacks.inactive && !callbacks.askChange) {\n this._log(`Trying to unsubscribe to state : ${statePatterns} with no callbacks !`, \"warning\");\n return;\n }\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (this.subscribers[statePattern]) {\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n let index = this.subscribers[statePattern].callbacks.active.indexOf(activeFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.active.splice(index, 1);\n }\n }\n }\n if (callbacks.inactive) {\n if (!Array.isArray(callbacks.inactive)) {\n callbacks.inactive = [callbacks.inactive];\n }\n for (let inactiveFct of callbacks.inactive) {\n let index = this.subscribers[statePattern].callbacks.inactive.indexOf(inactiveFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.inactive.splice(index, 1);\n }\n }\n }\n if (callbacks.askChange) {\n if (!Array.isArray(callbacks.askChange)) {\n callbacks.askChange = [callbacks.askChange];\n }\n for (let askChangeFct of callbacks.askChange) {\n let index = this.subscribers[statePattern].callbacks.askChange.indexOf(askChangeFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.askChange.splice(index, 1);\n }\n }\n }\n if (this.subscribers[statePattern].callbacks.active.length === 0 &&\n this.subscribers[statePattern].callbacks.inactive.length === 0 &&\n this.subscribers[statePattern].callbacks.askChange.length === 0) {\n delete this.subscribers[statePattern];\n }\n }\n }\n }\n onAfterStateChanged(cb) {\n this.afterStateChanged.add(cb);\n }\n offAfterStateChanged(cb) {\n this.afterStateChanged.remove(cb);\n }\n assignDefaultState(stateName) {\n return new EmptyState(stateName);\n }\n canChangeState(cb) {\n this.canChangeStateCbs.push(cb);\n }\n /**\n * Activate a current state\n */\n async setState(state) {\n let result = await this.changeStateMutex.safeRunLastAsync(async () => {\n let stateToUse;\n if (typeof state == \"string\") {\n stateToUse = this.assignDefaultState(state);\n }\n else {\n stateToUse = state;\n }\n if (!stateToUse) {\n this._log(\"state is undefined\", \"error\");\n this.changeStateMutex.release();\n return false;\n }\n for (let cb of this.canChangeStateCbs) {\n if (!(await cb(stateToUse))) {\n return false;\n }\n }\n let canChange = true;\n if (this.activeState) {\n let activeToInactive = [];\n let inactiveToActive = [];\n let triggerActive = [];\n canChange = await this.activeState.askChange(this.activeState, stateToUse);\n if (canChange) {\n for (let statePattern in this.subscribers) {\n let subscriber = this.subscribers[statePattern];\n if (subscriber.isActive) {\n let clone = [...subscriber.callbacks.askChange];\n let currentSlug = Uri.getParams(subscriber, this.activeState.name);\n if (currentSlug) {\n for (let i = 0; i < clone.length; i++) {\n let askChange = clone[i];\n if (!await askChange(this.activeState, stateToUse, currentSlug)) {\n canChange = false;\n break;\n }\n }\n }\n let slugs = Uri.getParams(subscriber, stateToUse.name);\n if (slugs === null) {\n activeToInactive.push(subscriber);\n }\n else {\n triggerActive.push({\n subscriber: subscriber,\n params: slugs\n });\n }\n }\n else {\n let slugs = Uri.getParams(subscriber, stateToUse.name);\n if (slugs) {\n inactiveToActive.push({\n subscriber,\n params: slugs\n });\n }\n }\n if (!canChange) {\n break;\n }\n }\n }\n if (canChange) {\n const oldState = this.activeState;\n this.activeState = stateToUse;\n oldState.onInactivate(stateToUse);\n for (let subscriber of activeToInactive) {\n subscriber.isActive = false;\n let oldSlug = Uri.getParams(subscriber, oldState.name);\n if (oldSlug) {\n let oldSlugNotNull = oldSlug;\n let callbacks = [...subscriber.callbacks.inactive];\n for (let callback of callbacks) {\n callback(oldState, stateToUse, oldSlugNotNull);\n }\n }\n }\n for (let trigger of triggerActive) {\n let callbacks = [...trigger.subscriber.callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, trigger.params);\n }\n }\n for (let trigger of inactiveToActive) {\n trigger.subscriber.isActive = true;\n let callbacks = [...trigger.subscriber.callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, trigger.params);\n }\n }\n stateToUse.onActivate();\n }\n }\n else {\n this.activeState = stateToUse;\n for (let key in this.subscribers) {\n let slugs = Uri.getParams(this.subscribers[key], stateToUse.name);\n if (slugs) {\n let slugsNotNull = slugs;\n this.subscribers[key].isActive = true;\n let callbacks = [...this.subscribers[key].callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, slugsNotNull);\n }\n }\n }\n stateToUse.onActivate();\n }\n this.afterStateChanged.trigger();\n return true;\n });\n return result ?? false;\n }\n getState() {\n return this.activeState;\n }\n /**\n * Check if a state is in the subscribers and active, return true if it is, false otherwise\n */\n isStateActive(statePattern) {\n return Uri.isActive(statePattern, this.activeState?.name ?? '');\n }\n /**\n * Get slugs information for the current state, return null if state isn't active\n */\n getStateSlugs(statePattern) {\n return Uri.getParams(statePattern, this.activeState?.name ?? '');\n }\n // 0 = error only / 1 = errors and warning / 2 = error, warning and logs (not implemented)\n logLevel() {\n return 0;\n }\n _log(msg, type) {\n if (type === \"error\") {\n console.error(msg);\n }\n else if (type === \"warning\" && this.logLevel() > 0) {\n console.warn(msg);\n }\n else if (type === \"info\" && this.logLevel() > 1) {\n console.log(msg);\n }\n }\n}\nStateManager.Namespace=`Aventus`;\n__as1(_, 'StateManager', StateManager);\n","dependencies":[{"fullName":"Aventus.IStateManager","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Subscriber","isStrong":false},{"fullName":"Aventus.Uri","isStrong":false},{"fullName":"Aventus.Mutex","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.EmptyState","isStrong":false},{"fullName":"Aventus.State","isStrong":false}],"fullName":"Aventus.StateManager","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let State=class State {\n /**\n * Activate a custom state inside a specific manager\n * It ll be a generic state with no information inside exept name\n */\n static async activate(stateName, manager) {\n return await manager.setState(stateName);\n }\n /**\n * Activate this state inside a specific manager\n */\n async activate(manager) {\n return await manager.setState(this);\n }\n onActivate() {\n }\n onInactivate(nextState) {\n }\n async askChange(state, nextState) {\n return true;\n }\n}\nState.Namespace=`Aventus`;\n__as1(_, 'State', State);\n","dependencies":[{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false}],"fullName":"Aventus.State","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let EmptyState=class EmptyState extends State {\n localName;\n constructor(stateName) {\n super();\n this.localName = stateName;\n }\n /**\n * @inheritdoc\n */\n get name() {\n return this.localName;\n }\n}\nEmptyState.Namespace=`Aventus`;\n__as1(_, 'EmptyState', EmptyState);\n","dependencies":[{"fullName":"Aventus.State","isStrong":true},{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.EmptyState","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let TemplateInstance=class TemplateInstance {\n context;\n content;\n actions;\n component;\n _components = {};\n firstRenderUniqueCb = {};\n firstRenderCb = [];\n firstChild;\n lastChild;\n computeds = [];\n renderingComputeds = [];\n loopRegisteries = {};\n loops = [];\n ifs = [];\n isDestroyed = false;\n constructor(component, content, actions, loops, ifs, context) {\n this.component = component;\n this.content = content;\n this.actions = actions;\n this.ifs = ifs;\n this.loops = loops;\n this.context = context ? context : new TemplateContext(component);\n this.firstChild = content.firstElementChild;\n this.lastChild = content.lastElementChild;\n this.selectElements();\n this.transformActionsListening();\n }\n render() {\n this.updateContext();\n this.bindEvents();\n for (let cb of this.firstRenderCb) {\n cb();\n }\n for (let key in this.firstRenderUniqueCb) {\n this.firstRenderUniqueCb[key]();\n }\n this.renderSubTemplate();\n }\n destructor() {\n this.isDestroyed = true;\n for (let name in this.loopRegisteries) {\n let register = this.loopRegisteries[name];\n for (let item of register.templates) {\n item.destructor();\n }\n for (let item of register.computeds) {\n item.destroy();\n }\n if (register.unsub) {\n register.unsub();\n }\n }\n this.loopRegisteries = {};\n this.context.destructor();\n for (let computed of this.computeds) {\n computed.destroy();\n }\n for (let computed of this.renderingComputeds) {\n computed.destroy();\n }\n this.computeds = [];\n this.removeFromDOM();\n }\n removeFromDOM(avoidTrigger = false) {\n if (avoidTrigger) {\n let node = this.firstChild;\n while (node && node != this.lastChild) {\n let next = node.nextElementSibling;\n node.parentNode?.removeChild(node);\n node = next;\n }\n this.lastChild?.parentNode?.removeChild(this.lastChild);\n }\n else {\n let node = this.firstChild;\n while (node && node != this.lastChild) {\n let next = node.nextElementSibling;\n node.remove();\n node = next;\n }\n this.lastChild?.remove();\n }\n }\n selectElements() {\n this._components = {};\n let idEls = Array.from(this.content.querySelectorAll('[_id]'));\n for (let idEl of idEls) {\n let id = idEl.attributes['_id'].value;\n if (!this._components[id]) {\n this._components[id] = [];\n }\n this._components[id].push(idEl);\n }\n if (this.actions.elements) {\n for (let element of this.actions.elements) {\n let components = [];\n for (let id of element.ids) {\n if (this._components[id]) {\n components = [...components, ...this._components[id]];\n }\n }\n if (element.isArray) {\n setValueToObject(element.name, this.component, components);\n }\n else if (components[0]) {\n setValueToObject(element.name, this.component, components[0]);\n }\n }\n }\n }\n updateContext() {\n if (this.actions.contextEdits) {\n for (let contextEdit of this.actions.contextEdits) {\n this.renderContextEdit(contextEdit);\n }\n }\n }\n renderContextEdit(edit) {\n let _class = edit.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return edit.fct(this.context);\n }\n catch (e) {\n }\n return {};\n });\n computed.subscribe((action, path, value, dones) => {\n for (let key in computed.value) {\n let newValue = computed.value[key];\n this.context.updateWatch(key, newValue, dones);\n }\n });\n this.computeds.push(computed);\n for (let key in computed.value) {\n this.context.registerWatch(key, computed.value[key]);\n }\n }\n bindEvents() {\n if (this.actions.events) {\n for (let event of this.actions.events) {\n this.bindEvent(event);\n }\n }\n if (this.actions.pressEvents) {\n for (let event of this.actions.pressEvents) {\n this.bindPressEvent(event);\n }\n }\n }\n bindEvent(event) {\n if (!this._components[event.id]) {\n return;\n }\n if (event.isCallback) {\n for (let el of this._components[event.id]) {\n let cb = getValueFromObject(event.eventName, el);\n if (!cb && el.tagName.includes('-')) {\n customElements.upgrade(el);\n cb = getValueFromObject(event.eventName, el);\n }\n cb?.add((...args) => {\n try {\n return event.fct(this.context, args);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n else {\n for (let el of this._components[event.id]) {\n el.addEventListener(event.eventName, (e) => {\n try {\n event.fct(e, this.context);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n }\n bindPressEvent(event) {\n let id = event['id'];\n if (id && this._components[id]) {\n let clone = {};\n for (let temp in event) {\n if (temp != 'id') {\n const ev = event;\n if (ev[temp] instanceof Function) {\n clone[temp] = (e, pressInstance) => { ev[temp](e, pressInstance, this.context); };\n }\n else {\n clone[temp] = ev[temp];\n }\n }\n }\n clone.element = this._components[id];\n PressManager.create(clone);\n }\n }\n transformActionsListening() {\n if (this.actions.content) {\n for (let name in this.actions.content) {\n this.transformChangeAction(name, this.actions.content[name]);\n }\n }\n if (this.actions.injection) {\n for (let injection of this.actions.injection) {\n this.transformInjectionAction(injection);\n }\n }\n if (this.actions.bindings) {\n for (let binding of this.actions.bindings) {\n this.transformBindigAction(binding);\n }\n }\n }\n transformChangeAction(name, change) {\n const [id, attr] = name.split(\"°\");\n if (!this._components[id])\n return;\n let apply = () => { };\n if (attr == \"@HTML\") {\n apply = () => {\n let value = this.context.print(computed.value);\n for (const el of this._components[id])\n el.innerHTML = value;\n };\n }\n else {\n apply = () => {\n let value = this.context.print(computed.value);\n if (value === \"false\") {\n for (const el of this._components[id]) {\n el.removeAttribute(attr);\n }\n }\n else {\n for (const el of this._components[id]) {\n el.setAttribute(attr, value);\n }\n }\n };\n }\n let _class = change.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return change.fct(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n return \"\";\n });\n let timeout;\n computed.subscribe((action, path, value, dones) => {\n clearTimeout(timeout);\n // add timeout to group change that append on the same frame (for example index update)\n timeout = setTimeout(() => {\n if (computed.isDestroy)\n return;\n apply();\n });\n });\n this.renderingComputeds.push(computed);\n this.firstRenderUniqueCb[name] = () => {\n apply();\n };\n }\n transformInjectionAction(injection) {\n if (!this._components[injection.id])\n return;\n let _class = injection.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return injection.inject(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n });\n this.computeds.push(computed);\n computed.subscribe((action, path, value, dones) => {\n for (const el of this._components[injection.id]) {\n if (el instanceof WebComponent && el.__watch && Object.hasOwn(el.__watch, injection.injectionName)) {\n el.__watch.__injectedDones(dones);\n }\n el[injection.injectionName] = computed.value;\n }\n });\n this.firstRenderCb.push(() => {\n for (const el of this._components[injection.id]) {\n customElements.upgrade(el);\n el[injection.injectionName] = computed.value;\n }\n });\n }\n transformBindigAction(binding) {\n let isLocalChange = false;\n let _class = binding.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return binding.inject(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n });\n this.computeds.push(computed);\n computed.subscribe((action, path, value, dones) => {\n if (isLocalChange)\n return;\n for (const el of this._components[binding.id]) {\n if (el instanceof WebComponent && el.__watch && Object.hasOwn(el.__watch, binding.injectionName)) {\n el.__watch.__injectedDones(dones);\n }\n el[binding.injectionName] = computed.value;\n }\n });\n this.firstRenderCb.push(() => {\n for (const el of this._components[binding.id]) {\n customElements.upgrade(el);\n el[binding.injectionName] = computed.value;\n }\n });\n if (binding.isCallback) {\n this.firstRenderCb.push(() => {\n for (var el of this._components[binding.id]) {\n for (let fct of binding.eventNames) {\n let cb = getValueFromObject(fct, el);\n if (!cb && el.tagName.includes('-')) {\n customElements.upgrade(el);\n cb = getValueFromObject(binding.injectionName, el);\n }\n cb?.add((value) => {\n let valueToSet = getValueFromObject(binding.injectionName, el);\n isLocalChange = true;\n binding.extract(this.context, valueToSet);\n isLocalChange = false;\n });\n }\n }\n });\n }\n else {\n this.firstRenderCb.push(() => {\n for (var el of this._components[binding.id]) {\n customElements.upgrade(el);\n for (let fct of binding.eventNames) {\n el.addEventListener(fct, (e) => {\n let valueToSet = getValueFromObject(binding.injectionName, e.target);\n isLocalChange = true;\n binding.extract(this.context, valueToSet);\n isLocalChange = false;\n });\n }\n }\n });\n }\n }\n renderSubTemplate() {\n for (let loop of this.loops) {\n this.renderLoop(loop);\n }\n for (let _if of this.ifs) {\n this.renderIf(_if);\n }\n }\n renderLoop(loop) {\n if (loop.func) {\n this.renderLoopComplex(loop);\n }\n else if (loop.simple) {\n this.renderLoopSimple(loop, loop.simple);\n }\n }\n resetLoopComplex(anchorId) {\n if (this.loopRegisteries[anchorId]) {\n for (let item of this.loopRegisteries[anchorId].templates) {\n item.destructor();\n }\n for (let item of this.loopRegisteries[anchorId].computeds) {\n item.destroy();\n }\n }\n this.loopRegisteries[anchorId] = {\n templates: [],\n computeds: [],\n };\n }\n renderLoopComplex(loop) {\n if (!loop.func)\n return;\n let fctsTemp = loop.func.bind(this.component)(this.context);\n let fcts = {\n apply: fctsTemp.apply,\n condition: fctsTemp.condition,\n transform: fctsTemp.transform ?? (() => { })\n };\n this.resetLoopComplex(loop.anchorId);\n let computedsCondition = [];\n let alreadyRecreated = false;\n const createComputedCondition = () => {\n let compCondition = new Computed(() => {\n return fcts.condition();\n });\n compCondition.value;\n compCondition.subscribe((action, path, value) => {\n if (!alreadyRecreated) {\n alreadyRecreated = true;\n this.renderLoopComplex(loop);\n }\n });\n computedsCondition.push(compCondition);\n this.loopRegisteries[loop.anchorId].computeds.push(compCondition);\n return compCondition;\n };\n let result = [];\n let compCondition = createComputedCondition();\n while (compCondition.value) {\n result.push(fcts.apply());\n fcts.transform();\n compCondition = createComputedCondition();\n }\n let anchor = this._components[loop.anchorId][0];\n for (let i = 0; i < result.length; i++) {\n let context = new TemplateContext(this.component, result[i], this.context, this.loopRegisteries[loop.anchorId]);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n anchor.parentNode?.insertBefore(instance.content, anchor);\n this.loopRegisteries[loop.anchorId].templates.push(instance);\n }\n }\n resetLoopSimple(anchorId, basePath) {\n let register = this.loopRegisteries[anchorId];\n if (register?.unsub) {\n register.unsub();\n }\n this.resetLoopComplex(anchorId);\n }\n renderLoopSimple(loop, simple) {\n let onThis = simple.data.startsWith(\"this.\");\n let basePath = this.context.normalizePath(simple.data);\n this.resetLoopSimple(loop.anchorId, basePath);\n let getElements = () => this.context.getValueFromItem(basePath);\n let elements = getElements();\n if (!elements) {\n let currentPath = basePath;\n while (currentPath != '' && !elements) {\n let splittedPath = currentPath.split(\".\");\n splittedPath.pop();\n currentPath = splittedPath.join(\".\");\n elements = this.context.getValueFromItem(currentPath);\n }\n if (!elements && onThis) {\n const splittedPath = basePath.split(\".\");\n const firstPart = splittedPath.length > 0 ? splittedPath[0] : null;\n if (firstPart && this.component.__signals[firstPart]) {\n elements = this.component.__signals[firstPart];\n }\n else {\n elements = this.component.__watch;\n }\n }\n if (!elements || !(elements.__isProxy || elements instanceof Signal)) {\n debugger;\n }\n const subTemp = (action, path, value) => {\n if (basePath.startsWith(path) || path == \"*\") {\n elements.unsubscribe(subTemp);\n this.renderLoopSimple(loop, simple);\n return;\n }\n };\n elements.subscribe(subTemp);\n return;\n }\n let indexName = this.context.registerIndex();\n let keys = Object.keys(elements);\n if (elements.__isProxy) {\n let regexArray = new RegExp(\"^\\\\[(\\\\d+?)\\\\]$\");\n let regexObject = new RegExp(\"^([^\\\\.]*)$\");\n let sub = (action, path, value) => {\n if (this.isDestroyed)\n return;\n if (path == \"\") {\n this.renderLoopSimple(loop, simple);\n return;\n }\n if (action == WatchAction.UPDATED) {\n return;\n }\n let index = undefined;\n regexArray.lastIndex = 0;\n regexObject.lastIndex = 0;\n let resultArray = regexArray.exec(path);\n if (resultArray) {\n index = Number(resultArray[1]);\n }\n else {\n let resultObject = regexObject.exec(path);\n if (resultObject) {\n let oldKey = resultObject[1];\n if (action == WatchAction.CREATED) {\n keys = Object.keys(getElements());\n index = keys.indexOf(oldKey);\n }\n else if (action == WatchAction.DELETED) {\n index = keys.indexOf(oldKey);\n keys = Object.keys(getElements());\n }\n }\n }\n if (index !== undefined) {\n let registry = this.loopRegisteries[loop.anchorId];\n if (action == WatchAction.CREATED) {\n let context = new TemplateContext(this.component, {}, this.context, registry);\n context.registerLoop(basePath, index, indexName, simple.index, simple.item, onThis);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n let anchor;\n if (index < registry.templates.length) {\n anchor = registry.templates[index].firstChild;\n }\n else {\n anchor = this._components[loop.anchorId][0];\n }\n anchor?.parentNode?.insertBefore(instance.content, anchor);\n registry.templates.splice(index, 0, instance);\n for (let i = index + 1; i < registry.templates.length; i++) {\n registry.templates[i].context.increaseIndex(indexName);\n }\n }\n else if (action == WatchAction.DELETED) {\n registry.templates[index].destructor();\n registry.templates.splice(index, 1);\n for (let i = index; i < registry.templates.length; i++) {\n registry.templates[i].context.decreaseIndex(indexName);\n }\n }\n }\n };\n this.loopRegisteries[loop.anchorId].unsub = () => {\n elements.unsubscribe(sub);\n };\n elements.subscribe(sub);\n }\n let anchor = this._components[loop.anchorId][0];\n for (let i = 0; i < keys.length; i++) {\n let context = new TemplateContext(this.component, {}, this.context, this.loopRegisteries[loop.anchorId]);\n context.registerLoop(basePath, i, indexName, simple.index, simple.item, onThis);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n anchor.parentNode?.insertBefore(instance.content, anchor);\n this.loopRegisteries[loop.anchorId].templates.push(instance);\n }\n }\n renderIf(_if) {\n // this.renderIfMemory(_if);\n this.renderIfRecreate(_if);\n }\n renderIfMemory(_if) {\n let computeds = [];\n let instances = [];\n if (!this._components[_if.anchorId] || this._components[_if.anchorId].length == 0)\n return;\n let anchor = this._components[_if.anchorId][0];\n let currentActive = -1;\n const calculateActive = () => {\n let newActive = -1;\n for (let i = 0; i < _if.parts.length; i++) {\n if (computeds[i].value) {\n newActive = i;\n break;\n }\n }\n if (newActive == currentActive) {\n return;\n }\n if (currentActive != -1) {\n let instance = instances[currentActive];\n let node = instance.firstChild;\n while (node && node != instance.lastChild) {\n let next = node.nextElementSibling;\n instance.content.appendChild(node);\n node = next;\n }\n if (instance.lastChild)\n instance.content.appendChild(instance.lastChild);\n }\n currentActive = newActive;\n if (instances[currentActive])\n anchor.parentNode?.insertBefore(instances[currentActive].content, anchor);\n };\n for (let i = 0; i < _if.parts.length; i++) {\n const part = _if.parts[i];\n let _class = part.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n return part.condition(this.context);\n });\n computeds.push(computed);\n computed.subscribe(() => {\n calculateActive();\n });\n this.computeds.push(computed);\n let context = new TemplateContext(this.component, {}, this.context);\n let content = part.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = part.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, part.template.loops, part.template.ifs, context);\n instances.push(instance);\n instance.render();\n }\n calculateActive();\n }\n renderIfRecreate(_if) {\n let computeds = [];\n if (!this._components[_if.anchorId] || this._components[_if.anchorId].length == 0)\n return;\n let anchor = this._components[_if.anchorId][0];\n let currentActive = undefined;\n let currentActiveNb = -1;\n const createContext = () => {\n if (currentActiveNb < 0 || currentActiveNb > _if.parts.length - 1) {\n currentActive = undefined;\n return;\n }\n const part = _if.parts[currentActiveNb];\n let context = new TemplateContext(this.component, {}, this.context);\n let content = part.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = part.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, part.template.loops, part.template.ifs, context);\n currentActive = instance;\n instance.render();\n anchor.parentNode?.insertBefore(currentActive.content, anchor);\n };\n for (let i = 0; i < _if.parts.length; i++) {\n const part = _if.parts[i];\n let _class = part.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n return part.condition(this.context);\n });\n computeds.push(computed);\n computed.subscribe(() => {\n calculateActive();\n });\n this.computeds.push(computed);\n }\n const calculateActive = () => {\n let newActive = -1;\n for (let i = 0; i < _if.parts.length; i++) {\n if (computeds[i].value) {\n newActive = i;\n break;\n }\n }\n if (newActive == currentActiveNb) {\n return;\n }\n if (currentActive) {\n currentActive.destructor();\n }\n currentActiveNb = newActive;\n createContext();\n };\n calculateActive();\n }\n}\nTemplateInstance.Namespace=`Aventus`;\n__as1(_, 'TemplateInstance', TemplateInstance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Effect","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Aventus.setValueToObject","isStrong":false},{"fullName":"Aventus.ContextEdit","isStrong":false},{"fullName":"Aventus.ComputedNoRecomputed","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.ActionEvent","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":false},{"fullName":"clone","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false},{"fullName":"Signal","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.TemplateInstance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let TemplateContext=class TemplateContext {\n data = {};\n comp;\n computeds = [];\n watch;\n registry;\n isDestroyed = false;\n constructor(component, data = {}, parentContext, registry) {\n this.comp = component;\n this.registry = registry;\n this.watch = Watcher.get({});\n let that = this;\n for (let key in data) {\n if (data[key].__isProxy) {\n Object.defineProperty(this.data, key, {\n get() {\n return data[key];\n }\n });\n }\n else {\n this.watch[key] = data[key];\n Object.defineProperty(this.data, key, {\n get() {\n return that.watch[key];\n }\n });\n }\n }\n if (parentContext) {\n const descriptors = Object.getOwnPropertyDescriptors(parentContext.data);\n for (let name in descriptors) {\n Object.defineProperty(this.data, name, {\n get() {\n return parentContext.data[name];\n }\n });\n }\n }\n }\n print(value) {\n return value == null ? \"\" : value + \"\";\n }\n registerIndex() {\n let name = \"index\";\n let i = 0;\n let fullName = name + i;\n while (this.watch[fullName] !== undefined) {\n i++;\n fullName = name + i;\n }\n return fullName;\n }\n registerLoop(dataName, _indexValue, _indexName, indexName, itemName, onThis) {\n this.watch[_indexName] = _indexValue;\n let getItems;\n let mustBeRecomputed = /if|switch|\\?|\\[.+?\\]/g.test(dataName);\n let _class = mustBeRecomputed ? Computed : ComputedNoRecomputed;\n if (!onThis) {\n getItems = new _class(() => {\n return getValueFromObject(dataName, this.data);\n });\n }\n else {\n dataName = dataName.replace(/^this\\./, '');\n getItems = new _class(() => {\n return getValueFromObject(dataName, this.comp);\n });\n }\n let getIndex = new ComputedNoRecomputed(() => {\n let items = getItems.value;\n if (!items)\n throw 'impossible';\n let keys = Object.keys(items);\n let index = keys[_getIndex.value];\n if (/^[0-9]+$/g.test(index))\n return Number(index);\n return index;\n });\n let getItem = new ComputedNoRecomputed(() => {\n let items = getItems.value;\n if (!items)\n throw 'impossible';\n let keys = Object.keys(items);\n let index = keys[_getIndex.value];\n let element = items[index];\n if (element === undefined && (Array.isArray(items) || !items)) {\n if (this.registry) {\n let indexNb = Number(_getIndex.value);\n if (!isNaN(indexNb)) {\n this.registry.templates[indexNb].destructor();\n this.registry.templates.splice(indexNb, 1);\n for (let i = indexNb; i < this.registry.templates.length; i++) {\n this.registry.templates[i].context.decreaseIndex(_indexName);\n }\n }\n }\n }\n return element;\n });\n let _getIndex = new ComputedNoRecomputed(() => {\n return this.watch[_indexName];\n });\n this.computeds.push(getIndex);\n this.computeds.push(getItem);\n this.computeds.push(_getIndex);\n if (itemName) {\n Object.defineProperty(this.data, itemName, {\n get() {\n return getItem.value;\n }\n });\n }\n if (indexName) {\n Object.defineProperty(this.data, indexName, {\n get() {\n return getIndex.value;\n }\n });\n }\n }\n updateIndex(newIndex, _indexName) {\n // let items: any[] | {};\n // if(!dataName.startsWith(\"this.\")) {\n // let comp = new Computed(() => {\n // return getValueFromObject(dataName, this.data);\n // });\n // fullName = dataName.replace(/^this\\./, '');\n // items = getValueFromObject(fullName, this.comp);\n // if(Array.isArray(items)) {\n // let regex = new RegExp(\"^(\" + fullName.replace(/\\./g, \"\\\\.\") + \")\\\\[(\\\\d+?)\\\\]\");\n // for(let computed of computeds) {\n // for(let cb of computed.callbacks) {\n // cb.path = cb.path.replace(regex, \"$1[\" + newIndex + \"]\");\n // let oldKey = Object.keys(items)[this.watch[_indexName]]\n // let newKey = Object.keys(items)[newIndex]\n // let regex = new RegExp(\"^(\" + fullName.replace(/\\./g, \"\\\\.\") + \"\\\\.)(\" + oldKey + \")($|\\\\.)\");\n // for (let computed of computeds) {\n // for (let cb of computed.callbacks) {\n // cb.path = cb.path.replace(regex, \"$1\" + newKey + \"$3\")\n this.watch[_indexName] = newIndex;\n }\n increaseIndex(_indexName) {\n this.updateIndex(this.watch[_indexName] + 1, _indexName);\n }\n decreaseIndex(_indexName) {\n this.updateIndex(this.watch[_indexName] - 1, _indexName);\n }\n destructor() {\n this.isDestroyed = true;\n for (let computed of this.computeds) {\n computed.destroy();\n }\n this.computeds = [];\n }\n registerWatch(name, value) {\n let that = this;\n that.watch[name] = value;\n Object.defineProperty(that.data, name, {\n get() {\n return that.watch[name];\n }\n });\n }\n updateWatch(name, value, dones) {\n if (Watcher.is(this.watch[name])) {\n this.watch[name].__injectedDones(dones);\n }\n this.watch[name] = value;\n }\n normalizePath(path) {\n path = path.replace(/^this\\./, '');\n const regex = /\\[(.*?)\\]/g;\n let m;\n while ((m = regex.exec(path)) !== null) {\n if (m.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n let name = m[1];\n let result = getValueFromObject(name, this.data);\n if (result !== undefined) {\n path = path.replace(m[0], `[${result}]`);\n }\n }\n return path;\n }\n getValueFromItem(name) {\n if (!name)\n return undefined;\n let result = getValueFromObject(name, this.data);\n if (result !== undefined) {\n return result;\n }\n result = getValueFromObject(name, this.comp);\n if (result !== undefined) {\n return result;\n }\n return undefined;\n }\n setValueToItem(name, value) {\n setValueToObject(name, this.comp, value);\n }\n}\nTemplateContext.Namespace=`Aventus`;\n__as1(_, 'TemplateContext', TemplateContext);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.ComputedNoRecomputed","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.setValueToObject","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.TemplateContext","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Template=class Template {\n static validatePath(path, pathToCheck) {\n if (pathToCheck.startsWith(path)) {\n return true;\n }\n return false;\n }\n cst;\n constructor(component) {\n this.cst = component;\n }\n htmlParts = [];\n setHTML(data) {\n this.htmlParts.push(data);\n }\n generateTemplate() {\n this.template = document.createElement('template');\n let currentHTML = \"<slot></slot>\";\n let previousSlots = {\n default: '<slot></slot>'\n };\n for (let htmlPart of this.htmlParts) {\n for (let blockName in htmlPart.blocks) {\n if (!previousSlots.hasOwnProperty(blockName)) {\n throw \"can't found slot with name \" + blockName;\n }\n currentHTML = currentHTML.replace(previousSlots[blockName], htmlPart.blocks[blockName]);\n }\n for (let slotName in htmlPart.slots) {\n previousSlots[slotName] = htmlPart.slots[slotName];\n }\n }\n this.template.innerHTML = currentHTML;\n }\n /**\n * Used by the for loop and the if\n * @param template\n */\n setTemplate(template) {\n this.template = document.createElement('template');\n this.template.innerHTML = template;\n }\n template;\n actions = {};\n setActions(actions) {\n if (!this.actions) {\n this.actions = actions;\n }\n else {\n if (actions.elements) {\n if (!this.actions.elements) {\n this.actions.elements = [];\n }\n this.actions.elements = [...actions.elements, ...this.actions.elements];\n }\n if (actions.events) {\n if (!this.actions.events) {\n this.actions.events = [];\n }\n this.actions.events = [...actions.events, ...this.actions.events];\n }\n if (actions.pressEvents) {\n if (!this.actions.pressEvents) {\n this.actions.pressEvents = [];\n }\n this.actions.pressEvents = [...actions.pressEvents, ...this.actions.pressEvents];\n }\n if (actions.content) {\n if (!this.actions.content) {\n this.actions.content = actions.content;\n }\n else {\n for (let contextProp in actions.content) {\n if (!this.actions.content[contextProp]) {\n this.actions.content[contextProp] = actions.content[contextProp];\n }\n else {\n throw 'this should be impossible';\n }\n }\n }\n }\n if (actions.injection) {\n if (!this.actions.injection) {\n this.actions.injection = actions.injection;\n }\n else {\n for (let contextProp in actions.injection) {\n if (!this.actions.injection[contextProp]) {\n this.actions.injection[contextProp] = actions.injection[contextProp];\n }\n else {\n this.actions.injection[contextProp] = { ...actions.injection[contextProp], ...this.actions.injection[contextProp] };\n }\n }\n }\n }\n if (actions.bindings) {\n if (!this.actions.bindings) {\n this.actions.bindings = actions.bindings;\n }\n else {\n for (let contextProp in actions.bindings) {\n if (!this.actions.bindings[contextProp]) {\n this.actions.bindings[contextProp] = actions.bindings[contextProp];\n }\n else {\n this.actions.bindings[contextProp] = { ...actions.bindings[contextProp], ...this.actions.bindings[contextProp] };\n }\n }\n }\n }\n if (actions.contextEdits) {\n if (!this.actions.contextEdits) {\n this.actions.contextEdits = [];\n }\n this.actions.contextEdits = [...actions.contextEdits, ...this.actions.contextEdits];\n }\n }\n }\n loops = [];\n addLoop(loop) {\n this.loops.push(loop);\n }\n ifs = [];\n addIf(_if) {\n this.ifs.push(_if);\n }\n createInstance(component) {\n let content = this.template.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n return new TemplateInstance(component, content, this.actions, this.loops, this.ifs);\n }\n}\nTemplate.Namespace=`Aventus`;\n__as1(_, 'Template', Template);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateHTML","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.Template","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let WebComponent=class WebComponent extends HTMLElement {\n /**\n * Add attributes informations\n */\n static get observedAttributes() {\n return [];\n }\n _first;\n _isReady;\n /**\n * Determine if the component is ready (postCreation done)\n */\n get isReady() {\n return this._isReady;\n }\n /**\n * The current namespace\n */\n static Namespace = \"\";\n /**\n * The current Tag / empty if abstract class\n */\n static Tag = \"\";\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the name of the component class\n */\n getClassName() {\n return this.constructor.name;\n }\n /**\n * The current tag\n */\n get tag() {\n return this.constructor['Tag'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n __onChangeFct = {};\n __watch;\n __watchActions = {};\n __watchActionsCb = {};\n __watchFunctions = {};\n __watchFunctionsComputed = {};\n __pressManagers = [];\n __signalActions = {};\n __signals = {};\n __isDefaultState = true;\n __defaultActiveState = new Map();\n __defaultInactiveState = new Map();\n __statesList = {};\n constructor() {\n super();\n if (this.constructor == WebComponent) {\n throw \"can't instanciate an abstract class\";\n }\n this.__removeNoAnimations = this.__removeNoAnimations.bind(this);\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", this.__removeNoAnimations);\n }\n this._first = true;\n this._isReady = false;\n this.__renderTemplate();\n this.__registerWatchesActions();\n this.__registerPropertiesActions();\n this.__registerSignalsActions();\n this.__createStates();\n this.__subscribeState();\n if (this.constructor == WebComponent) {\n throw \"can't instanciate an abstract class\";\n }\n }\n /**\n * Remove all listeners\n * State + press\n */\n destructor() {\n WebComponentInstance.removeInstance(this);\n this.__unsubscribeState();\n for (let press of this.__pressManagers) {\n press.destroy();\n }\n for (let name in this.__watchFunctionsComputed) {\n this.__watchFunctionsComputed[name].destroy();\n }\n for (let name in this.__signals) {\n this.__signals[name].destroy();\n }\n // TODO add missing info for destructor();\n this.postDestruction();\n this.destructChildren();\n }\n destructChildren() {\n const recu = (el) => {\n for (let child of Array.from(el.children)) {\n if (child instanceof WebComponent) {\n child.destructor();\n }\n else if (child instanceof HTMLElement) {\n recu(child);\n }\n }\n if (el.shadowRoot) {\n for (let child of Array.from(el.shadowRoot.children)) {\n if (child instanceof WebComponent) {\n child.destructor();\n }\n else if (child instanceof HTMLElement) {\n recu(child);\n }\n }\n }\n };\n recu(this);\n }\n __addWatchesActions(name, fct) {\n if (!this.__watchActions[name]) {\n this.__watchActions[name] = [];\n this.__watchActionsCb[name] = (action, path, value) => {\n for (let fct of this.__watchActions[name]) {\n fct(this, action, path, value);\n }\n if (this.__onChangeFct[name]) {\n for (let fct of this.__onChangeFct[name]) {\n fct(path);\n }\n }\n };\n }\n if (fct) {\n this.__watchActions[name].push(fct);\n }\n }\n __addWatchesFunctions(infos) {\n for (let info of infos) {\n let realName;\n let autoInit;\n if (typeof info == \"string\") {\n realName = info;\n autoInit = false;\n }\n else {\n realName = info.name;\n autoInit = info.autoInit;\n }\n if (!this.__watchFunctions[realName]) {\n this.__watchFunctions[realName] = { autoInit };\n }\n }\n }\n __registerWatchesActions() {\n if (Object.keys(this.__watchActions).length > 0) {\n if (!this.__watch) {\n let defaultValue = {};\n this.__defaultValuesWatch(defaultValue);\n this.__watch = Watcher.get(defaultValue, (type, path, element) => {\n try {\n let action = this.__watchActionsCb[path.split(\".\")[0]] || this.__watchActionsCb[path.split(\"[\")[0]];\n action(type, path, element);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n for (let name in this.__watchFunctions) {\n this.__watchFunctionsComputed[name] = Watcher.computed(this[name].bind(this));\n if (this.__watchFunctions[name].autoInit) {\n this.__watchFunctionsComputed[name].value;\n }\n }\n }\n __addSignalActions(name, fct) {\n this.__signalActions[name] = () => {\n fct(this);\n };\n }\n __registerSignalsActions() {\n if (Object.keys(this.__signals).length > 0) {\n const defaultValues = {};\n for (let name in this.__signals) {\n this.__registerSignalsAction(name);\n this.__defaultValuesSignal(defaultValues);\n }\n for (let name in defaultValues) {\n this.__signals[name].value = defaultValues[name];\n }\n }\n }\n __registerSignalsAction(name) {\n this.__signals[name] = new Signal(undefined, () => {\n if (this.__signalActions[name]) {\n this.__signalActions[name]();\n }\n });\n }\n __defaultValuesSignal(s) { }\n __addPropertyActions(name, fct) {\n if (!this.__onChangeFct[name]) {\n this.__onChangeFct[name] = [];\n }\n if (fct) {\n this.__onChangeFct[name].push(() => {\n fct(this);\n });\n }\n }\n __registerPropertiesActions() { }\n static __style = ``;\n static __template;\n __templateInstance;\n styleBefore(addStyle) {\n addStyle(\"@default\");\n }\n styleAfter(addStyle) {\n }\n __getStyle() {\n return [WebComponent.__style];\n }\n __getHtml() { }\n __getStatic() {\n return WebComponent;\n }\n static __styleSheets = {};\n __renderStyles() {\n let sheets = {};\n const addStyle = (name) => {\n let sheet = Style.get(name);\n if (sheet) {\n sheets[name] = sheet;\n }\n };\n this.styleBefore(addStyle);\n let localStyle = new CSSStyleSheet();\n let styleTxt = this.__getStyle().join(\"\\r\\n\");\n if (styleTxt.length > 0) {\n localStyle.replace(styleTxt);\n sheets['@local'] = localStyle;\n }\n this.styleAfter(addStyle);\n return sheets;\n }\n __renderTemplate() {\n let staticInstance = this.__getStatic();\n if (!staticInstance.__template || staticInstance.__template.cst != staticInstance) {\n staticInstance.__template = new Template(staticInstance);\n this.__getHtml();\n this.__registerTemplateAction();\n staticInstance.__template.generateTemplate();\n staticInstance.__styleSheets = this.__renderStyles();\n }\n this.__templateInstance = staticInstance.__template.createInstance(this);\n let shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.adoptedStyleSheets = [...Object.values(staticInstance.__styleSheets), Style.noAnimation];\n shadowRoot.appendChild(this.__templateInstance.content);\n // customElements.upgrade(shadowRoot);\n return shadowRoot;\n }\n __registerTemplateAction() {\n }\n connectedCallback() {\n if (this._first) {\n WebComponentInstance.addInstance(this);\n this._first = false;\n this.__defaultValues();\n this.__upgradeAttributes();\n this.__activateState();\n this.__templateInstance?.render();\n this.__removeNoAnimations();\n }\n else {\n setTimeout(() => {\n this.postConnect();\n });\n }\n }\n disconnectedCallback() {\n setTimeout(() => {\n this.postDisconnect();\n });\n }\n __onReadyCb = [];\n onReady(cb) {\n if (this._isReady) {\n cb();\n }\n else {\n this.__onReadyCb.push(cb);\n }\n }\n __setReady() {\n this._isReady = true;\n this.dispatchEvent(new CustomEvent('postCreationDone'));\n let cbs = [...this.__onReadyCb];\n for (let cb of cbs) {\n cb();\n }\n this.__onReadyCb = [];\n }\n __removeNoAnimations() {\n if (document.readyState !== \"loading\") {\n setTimeout(() => {\n this.postCreation();\n this.__setReady();\n this.shadowRoot.adoptedStyleSheets = Object.values(this.__getStatic().__styleSheets);\n document.removeEventListener(\"DOMContentLoaded\", this.__removeNoAnimations);\n this.postConnect();\n }, 50);\n }\n }\n __defaultValues() { }\n __defaultValuesWatch(w) { }\n __upgradeAttributes() { }\n __listBoolProps() {\n return [];\n }\n __upgradeProperty(prop) {\n let boolProps = this.__listBoolProps();\n const t = this;\n if (boolProps.indexOf(prop) != -1) {\n if (this.hasAttribute(prop) && (this.getAttribute(prop) === \"true\" || this.getAttribute(prop) === \"\")) {\n let value = this.getAttribute(prop);\n delete t[prop];\n t[prop] = value;\n }\n else {\n this.removeAttribute(prop);\n delete t[prop];\n t[prop] = false;\n }\n }\n else {\n if (this.hasAttribute(prop)) {\n let value = this.getAttribute(prop);\n delete t[prop];\n t[prop] = value;\n }\n else if (Object.hasOwn(this, prop)) {\n const value = t[prop];\n delete t[prop];\n t[prop] = value;\n }\n }\n }\n __correctGetter(prop) {\n if (Object.hasOwn(this, prop)) {\n const t = this;\n const value = t[prop];\n delete t[prop];\n t[prop] = value;\n }\n }\n __getStateManager(managerClass) {\n let mClass;\n if (managerClass instanceof StateManager) {\n mClass = managerClass;\n }\n else {\n mClass = Instance.get(managerClass);\n }\n return mClass;\n }\n __addActiveDefState(managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n if (!this.__defaultActiveState.has(mClass)) {\n this.__defaultActiveState.set(mClass, []);\n }\n this.__defaultActiveState.get(mClass)?.push(cb);\n }\n __addInactiveDefState(managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n if (!this.__defaultInactiveState.has(mClass)) {\n this.__defaultInactiveState.set(mClass, []);\n }\n this.__defaultInactiveState.get(mClass)?.push(cb);\n }\n __addActiveState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.active.push(cb);\n }\n __addInactiveState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.inactive.push(cb);\n }\n __addAskChangeState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.askChange.push(cb);\n }\n __createStates() { }\n __createStatesList(statePattern, managerClass) {\n if (!this.__statesList[statePattern]) {\n this.__statesList[statePattern] = new Map();\n }\n let mClass = this.__getStateManager(managerClass);\n if (!this.__statesList[statePattern].has(mClass)) {\n this.__statesList[statePattern].set(mClass, {\n active: [],\n inactive: [],\n askChange: []\n });\n }\n }\n __inactiveDefaultState(managerClass) {\n if (this.__isDefaultState) {\n this.__isDefaultState = false;\n let mClass = this.__getStateManager(managerClass);\n if (this.__defaultInactiveState.has(mClass)) {\n let fcts = this.__defaultInactiveState.get(mClass) ?? [];\n for (let fct of fcts) {\n fct.bind(this)();\n }\n }\n }\n }\n __activeDefaultState(nextStep, managerClass) {\n if (!this.__isDefaultState) {\n for (let pattern in this.__statesList) {\n if (StateManager.canBeActivate(pattern, nextStep)) {\n let mClass = this.__getStateManager(managerClass);\n if (this.__statesList[pattern].has(mClass)) {\n return;\n }\n }\n }\n this.__isDefaultState = true;\n let mClass = this.__getStateManager(managerClass);\n if (this.__defaultActiveState.has(mClass)) {\n let fcts = this.__defaultActiveState.get(mClass) ?? [];\n for (let fct of fcts) {\n fct.bind(this)();\n }\n }\n }\n }\n __subscribeState() {\n if (!this.isReady && this.__stateCleared) {\n return;\n }\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.subscribe(route, el, false);\n }\n }\n }\n }\n __activateState() {\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.activateAfterSubscribe(route, el);\n }\n }\n }\n }\n __stateCleared = false;\n __unsubscribeState() {\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.unsubscribe(route, el);\n }\n }\n }\n this.__stateCleared = true;\n }\n dateToString(d) {\n if (typeof d == 'string') {\n d = this.stringToDate(d);\n }\n if (d instanceof Date) {\n return new Date(d.getTime() - (d.getTimezoneOffset() * 60000)).toISOString().split(\"T\")[0];\n }\n return null;\n }\n dateTimeToString(dt) {\n if (typeof dt == 'string') {\n dt = this.stringToDate(dt);\n }\n if (dt instanceof Date) {\n return new Date(dt.getTime() - (dt.getTimezoneOffset() * 60000)).toISOString().slice(0, -1);\n }\n return null;\n }\n stringToDate(s) {\n let td = new Date(s);\n let d = new Date(td.getTime() + (td.getTimezoneOffset() * 60000));\n if (isNaN(d)) {\n return null;\n }\n return d;\n }\n stringToDateTime(s) {\n let td = new Date(s);\n let d = new Date(td.getTime() + (td.getTimezoneOffset() * 60000));\n if (isNaN(d)) {\n return null;\n }\n return d;\n }\n getBoolean(val) {\n if (val === true || val === 1 || val === 'true' || val === '') {\n return true;\n }\n else if (val === false || val === 0 || val === 'false' || val === null || val === undefined) {\n return false;\n }\n console.error(\"error parsing boolean value \" + val);\n return false;\n }\n __registerPropToWatcher(name) {\n if (Watcher._register) {\n Watcher._register.register(this.getReceiver(name), name, Watcher._register.version, name);\n }\n }\n getStringAttr(name) {\n return this.getAttribute(name)?.replace(/&avquot;/g, '\"') ?? undefined;\n }\n setStringAttr(name, val) {\n if (val === undefined || val === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, (val + \"\").replace(/\"/g, '&avquot;'));\n }\n }\n getStringProp(name) {\n this.__registerPropToWatcher(name);\n return this.getStringAttr(name);\n }\n getNumberAttr(name) {\n return Number(this.getAttribute(name));\n }\n setNumberAttr(name, val) {\n if (val === undefined || val === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, val);\n }\n }\n getNumberProp(name) {\n this.__registerPropToWatcher(name);\n return this.getNumberAttr(name);\n }\n getBoolAttr(name) {\n return this.hasAttribute(name);\n }\n setBoolAttr(name, val) {\n val = this.getBoolean(val);\n if (val) {\n this.setAttribute(name, 'true');\n }\n else {\n this.removeAttribute(name);\n }\n }\n getBoolProp(name) {\n this.__registerPropToWatcher(name);\n return this.getBoolAttr(name);\n }\n getDateAttr(name) {\n if (!this.hasAttribute(name)) {\n return undefined;\n }\n return this.stringToDate(this.getAttribute(name));\n }\n setDateAttr(name, val) {\n let valTxt = this.dateToString(val);\n if (valTxt === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, valTxt);\n }\n }\n getDateProp(name) {\n this.__registerPropToWatcher(name);\n return this.getDateAttr(name);\n }\n getDateTimeAttr(name) {\n if (!this.hasAttribute(name))\n return undefined;\n return this.stringToDateTime(this.getAttribute(name));\n }\n setDateTimeAttr(name, val) {\n let valTxt = this.dateTimeToString(val);\n if (valTxt === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, valTxt);\n }\n }\n getDateTimeProp(name) {\n this.__registerPropToWatcher(name);\n return this.getDateTimeAttr(name);\n }\n __propertyReceivers = {};\n getReceiver(name) {\n if (!this.__propertyReceivers[name]) {\n let that = this;\n let result = {\n __subscribes: [],\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n },\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n },\n onChange() {\n for (let fct of this.__subscribes) {\n fct(WatchAction.UPDATED, name, that[name], []);\n }\n },\n __path: name\n };\n this.__propertyReceivers[name] = result;\n }\n return this.__propertyReceivers[name];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue !== newValue || !this.isReady) {\n if (this.__propertyReceivers.hasOwnProperty(name)) {\n this.__propertyReceivers[name].onChange();\n }\n if (this.__onChangeFct.hasOwnProperty(name)) {\n for (let fct of this.__onChangeFct[name]) {\n fct('');\n }\n }\n }\n }\n /**\n * Remove a component from the dom\n * If desctruct is set to true, the component will be fully destroyed\n */\n remove(destruct = true) {\n super.remove();\n if (destruct) {\n this.destructor();\n }\n }\n /**\n * Function triggered when the component is destroyed\n */\n postDestruction() { }\n /**\n * Function triggered the first time the component is rendering inside DOM\n */\n postCreation() { }\n /**\n * Function triggered each time the component is rendering inside DOM\n */\n postConnect() { }\n /**\n * Function triggered each time the component is removed from the DOM\n */\n postDisconnect() { }\n /**\n * Find a parent by tagname if exist\n */\n findParentByTag(tagname, untilNode) {\n return ElementExtension.findParentByTag(this, tagname, untilNode);\n }\n /**\n * Find a parent by class name if exist\n */\n findParentByClass(classname, untilNode) {\n return ElementExtension.findParentByClass(this, classname, untilNode);\n }\n /**\n * Find a parent by type if exist\n */\n findParentByType(type, untilNode) {\n return ElementExtension.findParentByType(this, type, untilNode);\n }\n /**\n * Find list of parents by tagname\n */\n findParentsByTag(tagname, untilNode) {\n return ElementExtension.findParentsByTag(this, tagname, untilNode);\n }\n /**\n * Find list of parents by custom check\n */\n findParents(tagname, check, untilNode) {\n return ElementExtension.findParents(this, check, untilNode);\n }\n /**\n * Find list of parents by custom check\n */\n findParent(tagname, check, untilNode) {\n return ElementExtension.findParent(this, check, untilNode);\n }\n /**\n * Check if element contains a child\n */\n containsChild(el) {\n return ElementExtension.containsChild(this, el);\n }\n /**\n * Get elements inside slot\n */\n getElementsInSlot(slotName) {\n return ElementExtension.getElementsInSlot(this, slotName);\n }\n /**\n * Get nodes inside slot\n */\n getNodesInSlot(slotName) {\n return ElementExtension.getNodesInSlot(this, slotName);\n }\n /**\n * Get active element from the shadowroot or the document\n */\n getActiveElement(document) {\n return ElementExtension.getActiveElement(document ?? this.shadowRoot);\n }\n}\nWebComponent.Namespace=`Aventus`;\n__as1(_, 'WebComponent', WebComponent);\n","dependencies":[{"fullName":"Aventus.DefaultComponent","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Dependencies","isStrong":false},{"fullName":"Aventus.WebComponentInstance","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.Signal","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.State","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.Template","isStrong":true},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Style","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ElementExtension","isStrong":false}],"fullName":"Aventus.WebComponent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let WebComponentInstance=class WebComponentInstance {\n static __allDefinitions = [];\n static __allInstances = [];\n /**\n * Last definition insert datetime\n */\n static lastDefinition = 0;\n static registerDefinition(def) {\n WebComponentInstance.lastDefinition = Date.now();\n WebComponentInstance.__allDefinitions.push(def);\n }\n static removeDefinition(def) {\n WebComponentInstance.lastDefinition = Date.now();\n let index = WebComponentInstance.__allDefinitions.indexOf(def);\n if (index > -1) {\n WebComponentInstance.__allDefinitions.splice(index, 1);\n }\n }\n /**\n * Get all sub classes of type\n */\n static getAllClassesOf(type) {\n let result = [];\n for (let def of WebComponentInstance.__allDefinitions) {\n if (def.prototype instanceof type) {\n result.push(def);\n }\n }\n return result;\n }\n /**\n * Get all registered definitions\n */\n static getAllDefinitions() {\n return WebComponentInstance.__allDefinitions;\n }\n static addInstance(instance) {\n this.__allInstances.push(instance);\n }\n static removeInstance(instance) {\n let index = this.__allInstances.indexOf(instance);\n if (index > -1) {\n this.__allInstances.splice(index, 1);\n }\n }\n static getAllInstances(type) {\n let result = [];\n for (let instance of this.__allInstances) {\n if (instance instanceof type) {\n result.push(instance);\n }\n }\n return result;\n }\n static create(type) {\n let _class = customElements.get(type);\n if (_class) {\n return new _class();\n }\n let splitted = type.split(\".\");\n let current = window;\n for (let part of splitted) {\n current = current[part];\n }\n if (current && current.prototype instanceof WebComponent) {\n return new current();\n }\n return null;\n }\n}\nWebComponentInstance.Namespace=`Aventus`;\n__as1(_, 'WebComponentInstance', WebComponentInstance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":true},{"fullName":"T","isStrong":false}],"fullName":"Aventus.WebComponentInstance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ElementExtension=class ElementExtension {\n /**\n * Find a parent by custom check\n */\n static findParent(element, check, untilNode) {\n let el = element;\n if (el) {\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n }\n while (el) {\n if (check(el)) {\n return el;\n }\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n if (el == untilNode) {\n break;\n }\n }\n return null;\n }\n /**\n * Find a list of parent by custom check\n */\n static findParents(element, check, untilNode) {\n let result = [];\n let el = element;\n if (el) {\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n }\n while (el) {\n if (check(el)) {\n result.push(el);\n }\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n if (el == untilNode) {\n break;\n }\n }\n return result;\n }\n /**\n * Find a parent by tagname if exist Static.findParentByTag(this, \"av-img\")\n */\n static findParentByTag(element, tagname, untilNode) {\n if (Array.isArray(tagname)) {\n for (let i = 0; i < tagname.length; i++) {\n tagname[i] = tagname[i].toLowerCase();\n }\n }\n else {\n tagname = [tagname.toLowerCase()];\n }\n const checkFunc = (el) => {\n if (el instanceof Element) {\n return tagname.indexOf((el.nodeName || el.tagName).toLowerCase()) != -1;\n }\n return tagname.indexOf(el.nodeName.toLowerCase()) != -1;\n };\n return this.findParent(element, checkFunc, untilNode);\n }\n /**\n * Find a parent by class name if exist Static.findParentByClass(this, \"my-class-img\") = querySelector('.my-class-img')\n */\n static findParentByClass(element, classname, untilNode) {\n if (!Array.isArray(classname)) {\n classname = [classname];\n }\n const check = (el) => {\n for (let classnameTemp of classname) {\n if (el instanceof Element && el['classList'].contains(classnameTemp)) {\n return true;\n }\n }\n return false;\n };\n return this.findParent(element, check, untilNode);\n }\n static findParentByType(element, types, untilNode) {\n if (!Array.isArray(types)) {\n types = [types];\n }\n let isValid = true;\n for (let type of types) {\n if (typeof type == \"function\" && type['prototype']['constructor'])\n continue;\n isValid = false;\n }\n if (isValid) {\n let checkFunc = (el) => {\n for (let type of types) {\n const t = type;\n if (el instanceof t) {\n return true;\n }\n }\n return false;\n };\n return this.findParent(element, checkFunc, untilNode);\n }\n console.error(\"you must provide a class inside this function\");\n return null;\n }\n /**\n * Find list of parents by tagname\n */\n static findParentsByTag(element, tagname, untilNode) {\n let el = element;\n if (Array.isArray(tagname)) {\n for (let i = 0; i < tagname.length; i++) {\n tagname[i] = tagname[i].toLowerCase();\n }\n }\n else {\n tagname = [tagname.toLowerCase()];\n }\n let check = (el) => {\n if (el instanceof Element) {\n return tagname.indexOf((el.nodeName || el.tagName).toLowerCase()) != -1;\n }\n return tagname.indexOf(el.nodeName.toLowerCase()) != -1;\n };\n return this.findParents(element, check, untilNode);\n }\n /**\n * Check if element contains a child\n */\n static containsChild(element, child) {\n let rootScope = element.getRootNode();\n let elScope = child.getRootNode();\n while (elScope != rootScope) {\n if (!elScope['host']) {\n return false;\n }\n child = elScope['host'];\n elScope = elScope['host'].getRootNode();\n }\n return element.contains(child);\n }\n /**\n * Get element inside slot\n */\n static getElementsInSlot(element, slotName) {\n let result = [];\n if (element.shadowRoot) {\n let slotEl;\n if (slotName) {\n slotEl = element.shadowRoot.querySelector('slot[name=\"' + slotName + '\"]');\n }\n else {\n slotEl = element.shadowRoot.querySelector(\"slot:not([name])\");\n if (!slotEl) {\n slotEl = element.shadowRoot.querySelector(\"slot\");\n }\n }\n while (true) {\n if (!slotEl) {\n return result;\n }\n var listChild = Array.from(slotEl.assignedElements());\n if (!listChild) {\n return result;\n }\n let slotFound = false;\n for (let i = 0; i < listChild.length; i++) {\n let child = listChild[i];\n if (listChild[i].nodeName == \"SLOT\") {\n slotEl = listChild[i];\n slotFound = true;\n }\n else if (child instanceof HTMLElement) {\n result.push(child);\n }\n }\n if (!slotFound) {\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get element inside slot\n */\n static getNodesInSlot(element, slotName) {\n let result = [];\n if (element.shadowRoot) {\n let slotEl;\n if (slotName) {\n slotEl = element.shadowRoot.querySelector('slot[name=\"' + slotName + '\"]');\n }\n else {\n slotEl = element.shadowRoot.querySelector(\"slot:not([name])\");\n if (!slotEl) {\n slotEl = element.shadowRoot.querySelector(\"slot\");\n }\n }\n while (true) {\n if (!slotEl) {\n return result;\n }\n var listChild = Array.from(slotEl.assignedNodes());\n if (!listChild) {\n return result;\n }\n let slotFound = false;\n for (let i = 0; i < listChild.length; i++) {\n let child = listChild[i];\n if (listChild[i].nodeName == \"SLOT\") {\n slotEl = listChild[i];\n slotFound = true;\n }\n else if (child instanceof Node) {\n result.push(child);\n }\n }\n if (!slotFound) {\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get deeper element inside dom at the position X and Y\n */\n static getElementAtPosition(x, y, startFrom) {\n const _realTarget = (el, i = 0) => {\n if (i == 50) {\n debugger;\n }\n if (el.shadowRoot && x !== undefined && y !== undefined) {\n const elements = el.shadowRoot.elementsFromPoint(x, y);\n var newEl = elements.length > 0 ? elements[0] : null;\n if (newEl && newEl != el && (el.shadowRoot.contains(newEl) || el.contains(newEl))) {\n return _realTarget(newEl, i + 1);\n }\n }\n return el;\n };\n if (startFrom == null) {\n startFrom = document.body;\n }\n return _realTarget(startFrom);\n }\n /**\n * Get active element from the define root\n */\n static getActiveElement(root = document) {\n if (!root)\n return null;\n let el = root.activeElement;\n while (el instanceof WebComponent) {\n let elTemp = el.shadowRoot?.activeElement;\n if (!elTemp)\n return el;\n el = elTemp;\n }\n return el;\n }\n}\nElementExtension.Namespace=`Aventus`;\n__as1(_, 'ElementExtension', ElementExtension);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.ElementExtension","required":false,"type":1,"isExported":true,"convertibleName":""}],"existing":[{"fullName":"Aventus.DebuggerConfig","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ActionBindings","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionInjection","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventCallback","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventListener","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ContextEdit","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.If","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Template","isStrong":false}]},{"fullName":"Aventus.LoopSimple","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.LoopFct","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.TemplateHTML","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DefaultComponent","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Last","dependencies":[{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.NotVoid","dependencies":[]},{"fullName":"Aventus.StringLiteral","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Constructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.OnlyConstructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.AnyConstructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.OnlyConstructor","isStrong":false}]},{"fullName":"Aventus.KeysObject","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Item","isStrong":false}]},{"fullName":"Aventus.RamSubscribers","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRam","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRamData","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.UriParamsValue","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.StateSlug","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}]},{"fullName":"Aventus.StateAskChangeFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.StateInactivationFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.UriParams","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderHeadOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.WindowResizeObserver","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"globalThis.ResizeObserver","isStrong":false}]},{"fullName":"Aventus.ResizeObserverOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Pointer","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InstanceCst","dependencies":[]},{"fullName":"Aventus.InstanceCst2","dependencies":[{"fullName":"X","isStrong":false}]},{"fullName":"Aventus.PressManagerState","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.Coordinate","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InternalCustomFunction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.InternalPointerEvent","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.PressManagerOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.TargetableElement","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DragElementLeftTop","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DragElementXY","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ContainerElement","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnyElement","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false}]},{"fullName":"Aventus.AnimationOptionsInternal","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnimationOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false}]},{"fullName":"Aventus.RouterOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.HttpRouterOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IsNotVoid","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.WatcherFunctionInternal","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherFunction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherAllowed","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.Asyncable","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Enum","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.EnumValue","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.JsonFromOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.JsonToOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ClassCopyOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.SchemaType","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IData","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Schema","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.SchemaType","isStrong":false}]},{"fullName":"Aventus.IConverterTransform","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}]},{"fullName":"Aventus.ExtractFromError","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}]},{"fullName":"Aventus.HttpRequestOptions","dependencies":[{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpResponse","isStrong":false}]},{"fullName":"Aventus.WatcherChange","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.EffectReceiver","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false}]},{"fullName":"Aventus.RouterType","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}]},{"fullName":"Aventus.RouteType","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRoute","isStrong":false}]},{"fullName":"Aventus.DragElement","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsShadow","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.Coordinate","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsInternal","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false}]},{"fullName":"Aventus.PreparedUri","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false}]},{"fullName":"Aventus.IRamAction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false}]},{"fullName":"Aventus.RamItem","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Resource","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false}]},{"fullName":"Aventus.StateActivationFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Subscriber","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.StateAction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.IStateManager","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.IState","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Loop","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Template","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false}]},{"fullName":"Aventus.ActionEvent","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionEventListener","isStrong":false},{"fullName":"Aventus.ActionEventCallback","isStrong":false}]},{"fullName":"Aventus.LoopRegistery","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false}]},{"fullName":"Aventus.ActionChange","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.Actions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Aventus.ActionEvent","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":false},{"fullName":"Aventus.ContextEdit","isStrong":false}]}]}
2756
2757
  //#endregion js src //
2757
2758
  //#region css def //
2758
2759
  {}