rumious 0.0.6 → 0.0.8

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.
@@ -1 +1 @@
1
- "use strict";class e{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class t{constructor(){this.element=null,this.props={},this.renderContext=new e(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function n(e){return Object.getPrototypeOf(e)===t}class r{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class o{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function i(e){return"function"==typeof e}class s{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){}}class a extends s{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return null;const n=t.get(e);if(!i(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!i(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class l extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){"html"===this.name&&(e.innerHTML=this.normalizeValue(t))}}class c extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class u extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const p={on:(e,t)=>new a("on",e,t),bind:(e,t)=>new l("bind",e,t),ref:(e,t)=>new c("ref",e,t),childsRef:(e,t)=>new u("childsRef",e,t)};function f(...e){return new r("FRAGMENT",{},h(e))}function h(e){return e.map((e=>"object"==typeof e?e:new r("TEXT_ELEMENT",{nodeValue:e},[])))}window.RUMIOUS_JSX_SUPPORT={createElement:function(e,t,...i){return n(e)?function(e,t,n){return new r("COMPONENT",{component:e,...t},new o(h(n)))}(e,t,i):e===f?f(...i):new r(e,t||{},h(i))},createFragment:f,createDirective:function(e,t,n){return function(e,t,n){return p[e]?.(t,n)}(e,t,n)}};class d extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){}setRef(e){this.ref=e}init(e,t,n={},r){this.instance=new e,this.instance.element=this,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.onCreate(),this.instance.requestRender(),this.instance.forwardRef=this.ref??{}}disconnectCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function y(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends d{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function g(e,t,n){t.init(e,n)}function v(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?function(e,t,n,r){const o=function(e,t,n,r){const o=y(e.tag??"r-component");return o.init(e,t,n,r),o}(e.props.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof s&&g(o,e,r)})),t.appendChild(o),t}(e,t,v,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>v(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):function(e,t){const n=document.createElement(e.type);return Object.entries(e.props||{}).forEach((([e,r])=>{e.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(e)?n.addEventListener(e.substring(2).toLowerCase(),r):function(e,t,n,r){e.nodeType===Node.TEXT_NODE?e.nodeValue=n:n instanceof s?g(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}(e,n),e.children.forEach((e=>v(e,r,n))),t.appendChild(r),t)}class m{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class b{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const w="remove",O="replace",M="add",E=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),S=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),j=Symbol.iterator,R={mutable:"mutable",immutable:"immutable"},k={};function x(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function P(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function A(e){return Object.getPrototypeOf(e)===Set.prototype}function C(e){return Object.getPrototypeOf(e)===Map.prototype}function z(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function T(e){return!!D(e)}function D(e){return"object"!=typeof e?null:null==e?void 0:e[E]}function _(e){var t;const n=D(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function I(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,R))===R.immutable||"function"==typeof n)}function N(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=D(F(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const o=3===e.parent.type,i=o?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(o&&n.size>i||x(n,i)))return null;t.push(i)}if(e.parent)return N(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=F(3===U(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function U(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function F(e,t){return 2===U(e)?e.get(t):e[t]}function L(e,t,n){2===U(e)?e.set(t,n):e[t]=n}function V(e,t){const n=D(e);return(n?z(n):e)[t]}function q(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function $(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function X(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const B=Object.prototype.propertyIsEnumerable;function W(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set)return A(e)?Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values()):new(0,Object.getPrototypeOf(e).constructor)(e.values());if(e instanceof Map)return C(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,R),void 0!==n)&&n!==R.mutable){if(n===R.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{B.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function K(e){e.copy||(e.copy=W(e.original,e.options))}function H(e){if(!I(e))return _(e);if(Array.isArray(e))return e.map(H);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,H(t)]));return C(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(H);return A(e)?new Set(t):new(0,Object.getPrototypeOf(e).constructor)(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=H(e[n]);return t}function Y(e){return T(e)?H(e):e}function Z(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&Z(e.parent))}function G(){throw new Error("Cannot modify frozen object")}function J(e,t,n,r,o){{n=null!=n?n:new WeakMap,r=null!=r?r:[],o=null!=o?o:[];const i=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(i);if(i&&"object"==typeof i&&-1!==e){if(r[0]===i)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${o.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(i),o.push(t)}else r.push(i)}if(Object.isFrozen(e)||T(e))return r.pop(),void o.pop();switch(U(e)){case 2:for(const[t,i]of e)J(t,t,n,r,o),J(i,t,n,r,o);e.set=e.clear=e.delete=G;break;case 3:for(const t of e)J(t,t,n,r,o);e.add=e.clear=e.delete=G;break;case 1:Object.freeze(e);let t=0;for(const i of e)J(i,t,n,r,o),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{J(e[t],t,n,r,o)}))}r.pop(),o.pop()}function Q(e,t){const n=U(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function ee(e,t,n){if(T(e)||!I(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,o=r?new Map:void 0;if(t.add(e),Q(e,((i,s)=>{var a;if(T(s)){const t=D(s);K(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;L(r?o:e,i,n)}else ee(s,t,n)})),o){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(o.has(e)?o.get(e):e)}))}}function te(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ee(F(n,t),e.finalities.handledSet,e.options)}function ne(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(_(t))})))}function re(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=N(e);o&&t(e,o,n,r)}e.finalized=!0}}function oe(e,t,n,r){const o=D(n);o&&(o.callbacks||(o.callbacks=[]),o.callbacks.push(((i,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(q(F(l,t),n)){let n=o.original;o.copy&&(n=o.copy),ne(e),re(e,r,i,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,o.original)),L(l,t,n)}})),e.options.enableAutoFreeze&&o.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),I(n,e.options)&&e.finalities.draft.push((()=>{q(F(3===e.type?e.setMap:e.copy,t),n)&&te(e,t)}))}function ie(e,t,n,r){const{pathAsArray:o=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,o,i,s){n.forEach(((n,a)=>{const l=F(e,a),c=Y(F(t,a)),u=n?x(e,a)?O:M:w;if(q(l,c)&&u===O)return;const p=X(r.concat(a),s);o.push(u===w?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===M?{op:w,path:p}:u===w?{op:M,path:p,value:l}:{op:O,path:p,value:l})}))}(e,t,n,r,o);case 1:return function(e,t,n,r,o){let{original:i,assignedMap:s,options:a}=e,l=e.copy;l.length<i.length&&([i,l]=[l,i],[n,r]=[r,n]);for(let e=0;e<i.length;e+=1)if(s.get(e.toString())&&l[e]!==i[e]){const s=X(t.concat([e]),o);n.push({op:O,path:s,value:Y(l[e])}),r.push({op:O,path:s,value:Y(i[e])})}for(let e=i.length;e<l.length;e+=1){const r=X(t.concat([e]),o);n.push({op:M,path:r,value:Y(l[e])})}if(i.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=X(t.concat(["length"]),o);r.push({op:O,path:e,value:i.length})}else for(let e=l.length;i.length<e;e-=1){const n=X(t.concat([e-1]),o);r.push({op:w,path:n})}}}(e,t,n,r,o);case 3:return function({original:e,copy:t},n,r,o,i){let s=0;e.forEach((e=>{if(!t.has(e)){const t=X(n.concat([s]),i);r.push({op:w,path:t,value:e}),o.unshift({op:M,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=X(n.concat([s]),i);r.push({op:M,path:e,value:t}),o.unshift({op:w,path:e,value:t})}s+=1}))}(e,t,n,r,o)}}const se=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!I(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},ae={get size(){return z(D(this)).size},has(e){return z(D(this)).has(e)},set(e,t){const n=D(this),r=z(n);return r.has(e)&&q(r.get(e),t)||(K(n),Z(n),n.assignedMap.set(e,!0),n.copy.set(e,t),oe(n,e,t,ie)),this},delete(e){if(!this.has(e))return!1;const t=D(this);return K(t),Z(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=D(this);if(this.size){K(e),Z(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){z(D(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=D(this),o=z(r).get(e),i=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,o,R))===R.mutable;if(r.options.strict&&se(o,r.options,i),i)return o;if(r.finalized||!I(o,r.options))return o;if(o!==r.original.get(e))return o;const s=k.createDraft({original:o,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return K(r),r.copy.set(e,s),s},keys(){return z(D(this)).keys()},values(){const e=this.keys();return{[j]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[j]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[j](){return this.entries()}},le=Reflect.ownKeys(ae),ce=(e,t,{isValuesIterator:n})=>()=>{var r,o;const i=t.next();if(i.done)return i;const s=i.value;let a=e.setMap.get(s);const l=D(a),c=(null===(o=(r=e.options).mark)||void 0===o?void 0:o.call(r,a,R))===R.mutable;if(e.options.strict&&se(s,e.options,c),c||l||!I(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=k.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},ue={get size(){return D(this).setMap.size},has(e){const t=D(this);if(t.setMap.has(e))return!0;K(t);const n=D(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=D(this);return this.has(e)||(K(t),Z(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),oe(t,e,e,ie)),this},delete(e){if(!this.has(e))return!1;const t=D(this);K(t),Z(t);const n=D(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=D(this);K(e),Z(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=D(this);K(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ce(e,t,{isValuesIterator:!0})}},entries(){const e=D(this);K(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ce(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[j](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(ue,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const pe=Reflect.ownKeys(ue),fe=new WeakSet,he={get(e,t,n){var r,o;const i=null===(r=e.copy)||void 0===r?void 0:r[t];if(i&&fe.has(i))return i;if(t===E)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,R),s===R.mutable)return e.options.strict&&se(r,e.options,!0),r}const a=z(e);if(a instanceof Map&&le.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ae,"size").get.call(e.proxy);const n=ae[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&pe.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ue,"size").get.call(e.proxy);const n=ue[t];if(n)return n.bind(e.proxy)}if(!x(a,t)){const n=P(a,t);return n?"value"in n?n.value:null===(o=n.get)||void 0===o?void 0:o.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&se(l,e.options),e.finalized||!I(l,e.options))return l;if(l===V(e.original,t)){if(K(e),e.copy[t]=de({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=D(e.copy[t]);return K(n),Z(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let o;if(1===e.type&&"length"!==t&&(!(Number.isInteger(o=Number(t))&&o>=0)||0!==t&&0!==o&&String(o)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const i=P(z(e),t);if(null==i?void 0:i.set)return i.set.call(e.proxy,n),!0;const s=V(z(e),t),a=D(s);return a&&q(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(q(n,s)&&(void 0!==n||x(e.original,t))||(K(e),Z(e),x(e.original,t)&&q(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,oe(e,t,n,ie)),!0)},has:(e,t)=>t in z(e),ownKeys:e=>Reflect.ownKeys(z(e)),getOwnPropertyDescriptor(e,t){const n=z(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?he.set.call(this,e,t,void 0,e.proxy):(void 0!==V(e.original,t)||t in e.original?(K(e),Z(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function de(e){const{original:t,parentDraft:n,key:r,finalities:o,options:i}=e,s=U(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:o,options:i,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,he);if(o.revoke.push(c),fe.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var o,i;const s=D(l);let a=3===e.type?e.setMap:e.copy;const c=F(a,r),u=D(c);if(u){let i=u.original;u.operated&&(i=_(c)),ne(u),re(u,ie,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(o=e.options.updatedValues)&&void 0!==o?o:new WeakMap,e.options.updatedValues.set(i,u.original)),L(a,r,i)}null===(i=s.callbacks)||void 0===i||i.forEach((e=>{e(t,n)}))}))}else{const e=D(l);e.finalities.draft.push(((t,n)=>{ne(e),re(e,ie,t,n)}))}return l}function ye(e,t,n,r,o){var i;const s=D(e),a=null!==(i=null==s?void 0:s.original)&&void 0!==i?i:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;)s.finalities.draft.pop()(n,r);const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&$(s),o&&J(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:O,path:[],value:t[0]}]:n,r&&l?[{op:O,path:[],value:a}]:r]}function ge(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:o=!0}=e;Q(n,((n,r,o)=>{const i=D(r);if(i&&t&&i.finalities===t.finalities){e.isContainDraft=!0;const t=i.original;if(o instanceof Set){const e=Array.from(o);o.clear(),e.forEach((e=>o.add(n===e?t:e)))}else L(o,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,ge(e))})),o&&e.isContainDraft}function ve(e){var t;const n=D(e);if(!I(e,null==n?void 0:n.options))return e;const r=U(e);if(n&&!n.operated)return n.original;let o;function i(){o=2===r?C(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):W(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{i()}finally{n.finalized=!1}}else o=e;if(Q(o,((t,r)=>{if(n&&q(F(n.original,t),r))return;const s=ve(r);s!==r&&(o===e&&i(),L(o,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:o;return A(e)?new Set(o):new(Object.getPrototypeOf(e).constructor)(o)}return o}function me(e){if(!T(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return ve(e)}k.createDraft=de;const be=function e(t,n,r){var o,i,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...o){return e(r,(e=>t.call(this,e,...o)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},void 0),c);const u=T(a)?me(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(o=c.enablePatches)&&void 0!==o&&o,h=null!==(i=c.strict)&&void 0!==i&&i,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!I(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let o,i;t.enablePatches&&(o=[],i=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,R))!==R.mutable&&I(e,t)?de({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=ye(s,e,o,i,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!I(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw $(D(y)),e}const m=e=>{const t=D(y);if(!T(e)){if(void 0!==e&&!q(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[S];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&ge({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&ge({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=D(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([me(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw $(D(y)),e})):m(v)};Object.prototype.constructor.toString();class we{constructor(e,t=null){this.value=e,this.reactor=t??new m(this,[])}produce(e){return n=e,void(t=this).set(be(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new b(this,"",e[0]):new b(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function Oe(e){return new we(e)}class Me{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Ee{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Se{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class je{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=Oe(t);return this.data[e]=n,n}get(e){return this.data[e]}}exports.RumiousApp=class{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){v(e,this.root,this.renderContext)}},exports.RumiousChildrensRef=Ee,exports.RumiousComponent=t,exports.RumiousComponentElement=d,exports.RumiousComponentRef=Se,exports.RumiousContext=je,exports.RumiousElementRef=Me,exports.RumiousState=we,exports.createChildrensRef=function(e){return new Ee(e)},exports.createComponentElement=y,exports.createComponentRef=function(e){return new Se(e)},exports.createContext=function(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new je(t)),window.RUMIOUS_CONTEXTS[e]},exports.createElementRef=function(e){return new Me(e)},exports.createState=Oe,exports.isComponent=n,exports.isState=function(e){return e instanceof we},exports.styleHelper=function(e){let t="";for(const n in e)if(e.hasOwnProperty(n)){t+=`${n} {`;const r=e[n];for(const e in r)r.hasOwnProperty(e)&&(t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`);t+="} "}return t.trim()},exports.unwatch=function(e,t){e.reactor.removeBinding(t)},exports.watch=function(e,t){e.reactor.addBinding(t)};
1
+ "use strict";class e{constructor(e){this.target=e,this.app=e.app,this.hooks={onRendered:[],onBeforeRender:[]}}find(e){return this.target[e]}get(e){return this.target[e]}addHook(e,t){if(!this.hooks[e])throw new Error(`Hook type "${e}" is not defined!`);this.hooks[e].push(t)}async runHooks(e,...t){if(this.hooks[e])for(const n of this.hooks[e])await n(...t)}}class t{constructor(){this.asynchronousRender=!1,this.element=null,this.app=null,this.props={},this.forwardRefs={},this.renderContext=new e(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n,this.renderContext.app=this.app}template(){return{}}render(e){return this.renderer(e,document.createDocumentFragment(),this.renderContext)}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function n(e){return Object.getPrototypeOf(e)===t}class r{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class o{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function i(e){return"function"==typeof e}class s{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){}}class a extends s{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return null;const n=t.get(e);if(!i(n))throw new Error(`${e} is not a function!`);return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!i(n))throw new Error("Event handler requires a function!")}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class l extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive bind requires a RumiousState Object!");t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw new Error("Invalid props value: Directive bind requires a RumiousState Object!");r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){switch(this.name){case"html":e.innerHTML=this.normalizeValue(t);break;case"text":e.textContent=this.normalizeValue(t);break;case"show":e.style.display=this.normalizeValue(t)?"block":"none";break;case"hide":e.style.display=this.normalizeValue(t)?"none":"block";break;case"className":e.className=this.normalizeValue(t);break;case"style":Object.assign(e.style,t);break;case"disabled":e.disabled=!!this.normalizeValue(t);break;case"visible":e.style.visibility=this.normalizeValue(t)?"visible":"hidden";break;default:e.setAttribute(this.name,this.normalizeValue(t))}}}class c extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive ref requires a RumiousRef Object!");t.set(e)}else if("dynamic_value"===this.value.type){let n=t.find(this.value.value.objectName);if(!n)throw new Error("Invalid props value: Directive ref requires a RumiousRef Object!");n.set(e)}}}class u extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive childsRef requires a RumiousChildRef Object!");t.set(e)}else if("dynamic_value"===this.value.type){let n=t.find(this.value.value.objectName);if(!n)throw new Error("Invalid props value: Directive childsRef requires a RumiousChildRef Object!");n.set(e)}}}const p={on:(e,t)=>new a("on",e,t),bind:(e,t)=>new l("bind",e,t),ref:(e,t)=>new c("ref",e,t),childsRef:(e,t)=>new u("childsRef",e,t)};function f(e,t,n){return function(e,t,n){return p[e]?.(t,n)}(e,t,n)}function h(e,t,...o){return n(e)?y(e,t,o):e===g?g(...o):new r(e,t||{},v(o))}function d(e){return new r("TEXT_ELEMENT",{nodeValue:e},[])}function y(e,t,n){let i=new r("COMPONENT",{...t},new o(v(n)));return i.component=e,i}function g(...e){return new r("FRAGMENT",{},v(e))}function v(e){return e.map((e=>"object"==typeof e?e:d(e)))}window.RUMIOUS_JSX_SUPPORT={createElement:h,createFragment:g,createDirective:f};class m extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){Object.setPrototypeOf(this,HTMLUnknownElement.prototype),this.remove()}init(e,t,n={},r,o){this.instance=new e,this.instance.element=this,this.instance.app=o,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.asynchronousRender?(async()=>{this.instance.onCreate(),this.instance.requestRender()})():(this.instance.onCreate(),this.instance.requestRender())}disconnectedCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function b(e="r-component"){return window.customElements.get(e)||window.customElements.define(e,class extends m{static tag=e}),document.createElement(e)}class w{constructor(){this.contents=[],this.targets=[],this.observers=new WeakMap}commit(e=[]){this.contents=e}setTarget(e,t,n){this.targets.push({element:e,context:n,renderer:t}),this.observeTarget(e)}observeTarget(e){if(this.observers.has(e))return;const t=new MutationObserver((()=>{e.parentNode||this.removeTarget(e)}));t.observe(e,{childList:!1,subtree:!1}),this.observers.set(e,t)}removeTarget(e){const t=this.observers.get(e);t&&(t.disconnect(),this.observers.delete(e)),this.targets=this.targets.filter((t=>t.element!==e))}inject(e=!1){for(let t of this.targets)e&&(t.element.textContent=""),this.contents.forEach((e=>{"html"===e.type?t.element.innerHTML=e.value:"text"===e.type?t.element.textContent=e.value:"component"===e.type&&t.renderer(h(e.value,e.props??{},e.child??{}),t.element,t.context)}))}}function O(e,t,n){for(const[r,o]of Object.entries(t||{}))o instanceof s?o.init(e,n):r.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(r)?e.addEventListener(r.substring(2).toLowerCase(),o):e.setAttribute(r,o)}function x(e,t,n={}){if(!e)return t;if(null===(o=e)||"object"!=typeof o&&"function"!=typeof o)return x(d(e),t,n);var o;if(Array.isArray(e)){for(const r of e)x(r,t,n);return t}if(e instanceof r){let r;switch(e.type){case"COMPONENT":return function(e,t,n,r){const o=function(e,t,n,r,o=null){const i=b(e.tag??"r-component");return i.init(e,t,n,r,o?.app),i}(e.component,e.props,e.children,n,r);return O(o,e.props,r),t.appendChild(o),t}(e,t,x,n);case"FRAGMENT":case"ELEMENT_LIST":for(const r of e.children)x(r,t,n);return t;case"TEXT_ELEMENT":r=function(e){return document.createTextNode(e.props.nodeValue)}(e);break;default:r=function(e,t){const n=document.createElement(e.type);O(n,e.props,t);for(const r of e.children)x(r,n,t);return n}(e,n)}return t.appendChild(r),t}if(e instanceof HTMLElement)return t.appendChild(e),t;if(e instanceof w){if(t instanceof HTMLDocument)throw"Rumious Render: Unsupported inject content in HTMLDocument!";return e.setTarget(t,x,n),e.inject(!0),t}return x(d(JSON.stringify(e)),t,n)}class E{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class M{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const k="remove",R="replace",j="add",S=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),C=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),T=Symbol.iterator,A={mutable:"mutable",immutable:"immutable"},P={};function z(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function D(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function I(e){return Object.getPrototypeOf(e)===Set.prototype}function L(e){return Object.getPrototypeOf(e)===Map.prototype}function N(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function _(e){return!!U(e)}function U(e){return"object"!=typeof e?null:null==e?void 0:e[S]}function V(e){var t;const n=U(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function F(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,A))===A.immutable||"function"==typeof n)}function q(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=U($(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const o=3===e.parent.type,i=o?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(o&&n.size>i||z(n,i)))return null;t.push(i)}if(e.parent)return q(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=$(3===H(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function H(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function $(e,t){return 2===H(e)?e.get(t):e[t]}function B(e,t,n){2===H(e)?e.set(t,n):e[t]=n}function W(e,t){const n=U(e);return(n?N(n):e)[t]}function X(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function K(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function Y(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const Z=Object.prototype.propertyIsEnumerable;function G(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set)return I(e)?Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values()):new(0,Object.getPrototypeOf(e).constructor)(e.values());if(e instanceof Map)return L(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,A),void 0!==n)&&n!==A.mutable){if(n===A.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{Z.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function J(e){e.copy||(e.copy=G(e.original,e.options))}function Q(e){if(!F(e))return V(e);if(Array.isArray(e))return e.map(Q);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,Q(t)]));return L(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(Q);return I(e)?new Set(t):new(0,Object.getPrototypeOf(e).constructor)(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=Q(e[n]);return t}function ee(e){return _(e)?Q(e):e}function te(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&te(e.parent))}function ne(){throw new Error("Cannot modify frozen object")}function re(e,t,n,r,o){{n=null!=n?n:new WeakMap,r=null!=r?r:[],o=null!=o?o:[];const i=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(i);if(i&&"object"==typeof i&&-1!==e){if(r[0]===i)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${o.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(i),o.push(t)}else r.push(i)}if(Object.isFrozen(e)||_(e))return r.pop(),void o.pop();switch(H(e)){case 2:for(const[t,i]of e)re(t,t,n,r,o),re(i,t,n,r,o);e.set=e.clear=e.delete=ne;break;case 3:for(const t of e)re(t,t,n,r,o);e.add=e.clear=e.delete=ne;break;case 1:Object.freeze(e);let t=0;for(const i of e)re(i,t,n,r,o),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{re(e[t],t,n,r,o)}))}r.pop(),o.pop()}function oe(e,t){const n=H(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function ie(e,t,n){if(_(e)||!F(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,o=r?new Map:void 0;if(t.add(e),oe(e,((i,s)=>{var a;if(_(s)){const t=U(s);J(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;B(r?o:e,i,n)}else ie(s,t,n)})),o){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(o.has(e)?o.get(e):e)}))}}function se(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ie($(n,t),e.finalities.handledSet,e.options)}function ae(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(V(t))})))}function le(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=q(e);o&&t(e,o,n,r)}e.finalized=!0}}function ce(e,t,n,r){const o=U(n);o&&(o.callbacks||(o.callbacks=[]),o.callbacks.push(((i,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(X($(l,t),n)){let n=o.original;o.copy&&(n=o.copy),ae(e),le(e,r,i,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,o.original)),B(l,t,n)}})),e.options.enableAutoFreeze&&o.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),F(n,e.options)&&e.finalities.draft.push((()=>{X($(3===e.type?e.setMap:e.copy,t),n)&&se(e,t)}))}function ue(e,t,n,r){const{pathAsArray:o=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,o,i,s){n.forEach(((n,a)=>{const l=$(e,a),c=ee($(t,a)),u=n?z(e,a)?R:j:k;if(X(l,c)&&u===R)return;const p=Y(r.concat(a),s);o.push(u===k?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===j?{op:k,path:p}:u===k?{op:j,path:p,value:l}:{op:R,path:p,value:l})}))}(e,t,n,r,o);case 1:return function(e,t,n,r,o){let{original:i,assignedMap:s,options:a}=e,l=e.copy;l.length<i.length&&([i,l]=[l,i],[n,r]=[r,n]);for(let e=0;e<i.length;e+=1)if(s.get(e.toString())&&l[e]!==i[e]){const s=Y(t.concat([e]),o);n.push({op:R,path:s,value:ee(l[e])}),r.push({op:R,path:s,value:ee(i[e])})}for(let e=i.length;e<l.length;e+=1){const r=Y(t.concat([e]),o);n.push({op:j,path:r,value:ee(l[e])})}if(i.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=Y(t.concat(["length"]),o);r.push({op:R,path:e,value:i.length})}else for(let e=l.length;i.length<e;e-=1){const n=Y(t.concat([e-1]),o);r.push({op:k,path:n})}}}(e,t,n,r,o);case 3:return function({original:e,copy:t},n,r,o,i){let s=0;e.forEach((e=>{if(!t.has(e)){const t=Y(n.concat([s]),i);r.push({op:k,path:t,value:e}),o.unshift({op:j,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=Y(n.concat([s]),i);r.push({op:j,path:e,value:t}),o.unshift({op:k,path:e,value:t})}s+=1}))}(e,t,n,r,o)}}const pe=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!F(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},fe={get size(){return N(U(this)).size},has(e){return N(U(this)).has(e)},set(e,t){const n=U(this),r=N(n);return r.has(e)&&X(r.get(e),t)||(J(n),te(n),n.assignedMap.set(e,!0),n.copy.set(e,t),ce(n,e,t,ue)),this},delete(e){if(!this.has(e))return!1;const t=U(this);return J(t),te(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=U(this);if(this.size){J(e),te(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){N(U(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=U(this),o=N(r).get(e),i=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,o,A))===A.mutable;if(r.options.strict&&pe(o,r.options,i),i)return o;if(r.finalized||!F(o,r.options))return o;if(o!==r.original.get(e))return o;const s=P.createDraft({original:o,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return J(r),r.copy.set(e,s),s},keys(){return N(U(this)).keys()},values(){const e=this.keys();return{[T]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[T]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[T](){return this.entries()}},he=Reflect.ownKeys(fe),de=(e,t,{isValuesIterator:n})=>()=>{var r,o;const i=t.next();if(i.done)return i;const s=i.value;let a=e.setMap.get(s);const l=U(a),c=(null===(o=(r=e.options).mark)||void 0===o?void 0:o.call(r,a,A))===A.mutable;if(e.options.strict&&pe(s,e.options,c),c||l||!F(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=P.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},ye={get size(){return U(this).setMap.size},has(e){const t=U(this);if(t.setMap.has(e))return!0;J(t);const n=U(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=U(this);return this.has(e)||(J(t),te(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),ce(t,e,e,ue)),this},delete(e){if(!this.has(e))return!1;const t=U(this);J(t),te(t);const n=U(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=U(this);J(e),te(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=U(this);J(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:de(e,t,{isValuesIterator:!0})}},entries(){const e=U(this);J(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:de(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[T](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(ye,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const ge=Reflect.ownKeys(ye),ve=new WeakSet,me={get(e,t,n){var r,o;const i=null===(r=e.copy)||void 0===r?void 0:r[t];if(i&&ve.has(i))return i;if(t===S)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,A),s===A.mutable)return e.options.strict&&pe(r,e.options,!0),r}const a=N(e);if(a instanceof Map&&he.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(fe,"size").get.call(e.proxy);const n=fe[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&ge.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ye,"size").get.call(e.proxy);const n=ye[t];if(n)return n.bind(e.proxy)}if(!z(a,t)){const n=D(a,t);return n?"value"in n?n.value:null===(o=n.get)||void 0===o?void 0:o.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&pe(l,e.options),e.finalized||!F(l,e.options))return l;if(l===W(e.original,t)){if(J(e),e.copy[t]=be({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=U(e.copy[t]);return J(n),te(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let o;if(1===e.type&&"length"!==t&&(!(Number.isInteger(o=Number(t))&&o>=0)||0!==t&&0!==o&&String(o)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const i=D(N(e),t);if(null==i?void 0:i.set)return i.set.call(e.proxy,n),!0;const s=W(N(e),t),a=U(s);return a&&X(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(X(n,s)&&(void 0!==n||z(e.original,t))||(J(e),te(e),z(e.original,t)&&X(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,ce(e,t,n,ue)),!0)},has:(e,t)=>t in N(e),ownKeys:e=>Reflect.ownKeys(N(e)),getOwnPropertyDescriptor(e,t){const n=N(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?me.set.call(this,e,t,void 0,e.proxy):(void 0!==W(e.original,t)||t in e.original?(J(e),te(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function be(e){const{original:t,parentDraft:n,key:r,finalities:o,options:i}=e,s=H(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:o,options:i,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,me);if(o.revoke.push(c),ve.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var o,i;const s=U(l);let a=3===e.type?e.setMap:e.copy;const c=$(a,r),u=U(c);if(u){let i=u.original;u.operated&&(i=V(c)),ae(u),le(u,ue,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(o=e.options.updatedValues)&&void 0!==o?o:new WeakMap,e.options.updatedValues.set(i,u.original)),B(a,r,i)}null===(i=s.callbacks)||void 0===i||i.forEach((e=>{e(t,n)}))}))}else{const e=U(l);e.finalities.draft.push(((t,n)=>{ae(e),le(e,ue,t,n)}))}return l}function we(e,t,n,r,o){var i;const s=U(e),a=null!==(i=null==s?void 0:s.original)&&void 0!==i?i:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;)s.finalities.draft.pop()(n,r);const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&K(s),o&&re(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:R,path:[],value:t[0]}]:n,r&&l?[{op:R,path:[],value:a}]:r]}function Oe(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:o=!0}=e;oe(n,((n,r,o)=>{const i=U(r);if(i&&t&&i.finalities===t.finalities){e.isContainDraft=!0;const t=i.original;if(o instanceof Set){const e=Array.from(o);o.clear(),e.forEach((e=>o.add(n===e?t:e)))}else B(o,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,Oe(e))})),o&&e.isContainDraft}function xe(e){var t;const n=U(e);if(!F(e,null==n?void 0:n.options))return e;const r=H(e);if(n&&!n.operated)return n.original;let o;function i(){o=2===r?L(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):G(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{i()}finally{n.finalized=!1}}else o=e;if(oe(o,((t,r)=>{if(n&&X($(n.original,t),r))return;const s=xe(r);s!==r&&(o===e&&i(),B(o,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:o;return I(e)?new Set(o):new(Object.getPrototypeOf(e).constructor)(o)}return o}function Ee(e){if(!_(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return xe(e)}P.createDraft=be;const Me=function e(t,n,r){var o,i,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...o){return e(r,(e=>t.call(this,e,...o)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},void 0),c);const u=_(a)?Ee(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(o=c.enablePatches)&&void 0!==o&&o,h=null!==(i=c.strict)&&void 0!==i&&i,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!F(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let o,i;t.enablePatches&&(o=[],i=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,A))!==A.mutable&&F(e,t)?be({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=we(s,e,o,i,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!F(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw K(U(y)),e}const m=e=>{const t=U(y);if(!_(e)){if(void 0!==e&&!X(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[C];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&Oe({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&Oe({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=U(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([Ee(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw K(U(y)),e})):m(v)};function ke(e,t){e.set(Me(e.get(),t))}Object.prototype.constructor.toString();class Re{constructor(e,t=null){this.value=e,this.reactor=t??new E(this,[])}produce(e){return ke(this,e)}reducer(...e){let t;return t=1===e.length?new M(this,"",e[0]):new M(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0===e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function je(e){return new Re(e)}class Se{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Ce{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Te{constructor(e){this.target=e}set(e){this.target=e.forwardRefs}}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Ae{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=je(t);return this.data[e]=n,n}get(e){return this.data[e]}}class Pe{constructor(e,t={}){this.hasExecuted=!1,this.result=null,this.callback=e,this.dependents=[],this.options=t}onLoad(e){this.hasExecuted?e(this.result):this.dependents.push(e)}execute(){return new Promise(((e,t)=>{if(this.hasExecuted)return e(this.result);this.hasExecuted=!0;const n=async()=>{try{this.result=await this.callback(),e(this.result),this.dependents.forEach((e=>e(this.result)))}catch(e){t(e)}};this.options.idle&&"requestIdleCallback"in window?requestIdleCallback(n):n()}))}}const ze=new Map;exports.Pending=class extends t{static tag="r-pending";constructor(){super(),this.asynchronousRender=!0}async setLoader(e){this.loader=e;try{this.result=await this.loader.execute(),this.renderResult()}catch(e){this.error=e,this.renderError()}}renderResult(){if(!this.result)throw"Rumious Render: Cannot find component when lazy loading!";this.element.before(this.render(h(this.result,{}))),this.element.remove()}renderError(){this.element.appendChild(this.render(this.props.errorComponent??this.error))}onRender(){let{loader:e}=this.props;this.setLoader(e)}template(){return this.props.fallback}},exports.RumiousApp=class{constructor(t=document.createElement("span"),n={}){this.root=t,this.app=this,this.modules=[],this.configs=n,this.renderContext=new e(this)}render(e){this.renderContext.runHooks("onBeforeRender",this.renderContext),x(e,this.root,this.renderContext),this.renderContext.runHooks("onRendered",this.renderContext)}addModule(e,t={}){return e.init(this,t)}},exports.RumiousChildrensRef=Ce,exports.RumiousComponent=t,exports.RumiousComponentElement=m,exports.RumiousComponentRef=Te,exports.RumiousContext=Ae,exports.RumiousDymanicInjector=w,exports.RumiousElementRef=Se,exports.RumiousLazyLoader=Pe,exports.RumiousReactor=E,exports.RumiousReducer=M,exports.RumiousState=Re,exports.createChildrensRef=function(e){return new Ce(e)},exports.createComponent=y,exports.createComponentElement=b,exports.createComponentRef=function(e){return new Te(e)},exports.createContext=function(e="",t={}){if(!t||"object"!=typeof t)throw"Rumious context: Initial value must be object !";return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Ae(t)),window.RUMIOUS_CONTEXTS[e]},exports.createDirective=f,exports.createElement=h,exports.createElementRef=function(e){return new Se(e)},exports.createState=je,exports.createTextElement=d,exports.denounce=function(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout((()=>e.apply(this,r)),t)}},exports.injectHTML=function(e){let t=new w;return t.commit([{type:"html",value:e}]),t},exports.injectText=function(e){let t=new w;return t.commit([{type:"text",value:e}]),t},exports.isComponent=n,exports.isState=function(e){return e instanceof Re},exports.lazyLoad=function(e,t={}){const n=t.key||e.toString();return ze.has(n)||ze.set(n,new Pe(e,t)),ze.get(n)},exports.leadingTrailingDebounce=function(e,t){let n,r=!0;return function(...o){r&&(e.apply(this,o),r=!1),clearTimeout(n),n=setTimeout((()=>{e.apply(this,o),r=!0}),t)}},exports.produceState=ke,exports.rafThrottle=function(e){let t=!1;return function(...n){t||(t=!0,requestAnimationFrame((()=>{e.apply(this,n),t=!1})))}},exports.styleHelper=function(e){let t="";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){t+=`${n} {`;const r=e[n];for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`);t+="} "}return t.trim()},exports.tholle=function(e,t){let n=0;return function(...r){const o=Date.now();o-n>=t&&(n=o,e.apply(this,r))}},exports.trailingThrottle=function(e,t){let n=0,r=null,o=null;function i(){n=Date.now(),e.apply(this,r),r=null}return function(...e){const s=Date.now();r=e,s-n>=t?i():o||(o=setTimeout((()=>{o=null,i()}),t-(s-n)))}},exports.unwatch=function(e,t){e.reactor.removeBinding(t)},exports.watch=function(e,t){e.reactor.addBinding(t)};
@@ -1 +1 @@
1
- class e{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class t{constructor(){this.element=null,this.props={},this.renderContext=new e(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function n(e){return Object.getPrototypeOf(e)===t}class r{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class i{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function o(e){return"function"==typeof e}class s{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){}}class a extends s{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return null;const n=t.get(e);if(!o(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!o(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class l extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){"html"===this.name&&(e.innerHTML=this.normalizeValue(t))}}class c extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class u extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const p={on:(e,t)=>new a("on",e,t),bind:(e,t)=>new l("bind",e,t),ref:(e,t)=>new c("ref",e,t),childsRef:(e,t)=>new u("childsRef",e,t)};function f(...e){return new r("FRAGMENT",{},h(e))}function h(e){return e.map((e=>"object"==typeof e?e:new r("TEXT_ELEMENT",{nodeValue:e},[])))}window.RUMIOUS_JSX_SUPPORT={createElement:function(e,t,...o){return n(e)?function(e,t,n){return new r("COMPONENT",{component:e,...t},new i(h(n)))}(e,t,o):e===f?f(...o):new r(e,t||{},h(o))},createFragment:f,createDirective:function(e,t,n){return function(e,t,n){return p[e]?.(t,n)}(e,t,n)}};class d extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){}setRef(e){this.ref=e}init(e,t,n={},r){this.instance=new e,this.instance.element=this,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.onCreate(),this.instance.requestRender(),this.instance.forwardRef=this.ref??{}}disconnectCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function y(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends d{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function g(e,t,n){t.init(e,n)}function v(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?function(e,t,n,r){const i=function(e,t,n,r){const i=y(e.tag??"r-component");return i.init(e,t,n,r),i}(e.props.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof s&&g(i,e,r)})),t.appendChild(i),t}(e,t,v,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>v(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):function(e,t){const n=document.createElement(e.type);return Object.entries(e.props||{}).forEach((([e,r])=>{e.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(e)?n.addEventListener(e.substring(2).toLowerCase(),r):function(e,t,n,r){e.nodeType===Node.TEXT_NODE?e.nodeValue=n:n instanceof s?g(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}(e,n),e.children.forEach((e=>v(e,r,n))),t.appendChild(r),t)}class b{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){v(e,this.root,this.renderContext)}}function m(e){let t="";for(const n in e)if(e.hasOwnProperty(n)){t+=`${n} {`;const r=e[n];for(const e in r)r.hasOwnProperty(e)&&(t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`);t+="} "}return t.trim()}class w{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class O{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const M="remove",E="replace",S="add",j=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),k=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),R=Symbol.iterator,P={mutable:"mutable",immutable:"immutable"},A={};function x(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function z(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function C(e){return Object.getPrototypeOf(e)===Set.prototype}function T(e){return Object.getPrototypeOf(e)===Map.prototype}function D(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function _(e){return!!I(e)}function I(e){return"object"!=typeof e?null:null==e?void 0:e[j]}function N(e){var t;const n=I(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function U(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,P))===P.immutable||"function"==typeof n)}function F(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=I(V(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const i=3===e.parent.type,o=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>o||x(n,o)))return null;t.push(o)}if(e.parent)return F(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=V(3===L(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function L(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function V(e,t){return 2===L(e)?e.get(t):e[t]}function q(e,t,n){2===L(e)?e.set(t,n):e[t]=n}function $(e,t){const n=I(e);return(n?D(n):e)[t]}function X(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function B(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function W(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const K=Object.prototype.propertyIsEnumerable;function H(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set)return C(e)?Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values()):new(0,Object.getPrototypeOf(e).constructor)(e.values());if(e instanceof Map)return T(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,P),void 0!==n)&&n!==P.mutable){if(n===P.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{K.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function Y(e){e.copy||(e.copy=H(e.original,e.options))}function Z(e){if(!U(e))return N(e);if(Array.isArray(e))return e.map(Z);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,Z(t)]));return T(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(Z);return C(e)?new Set(t):new(0,Object.getPrototypeOf(e).constructor)(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=Z(e[n]);return t}function G(e){return _(e)?Z(e):e}function J(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&J(e.parent))}function Q(){throw new Error("Cannot modify frozen object")}function ee(e,t,n,r,i){{n=null!=n?n:new WeakMap,r=null!=r?r:[],i=null!=i?i:[];const o=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(o);if(o&&"object"==typeof o&&-1!==e){if(r[0]===o)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${i.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(o),i.push(t)}else r.push(o)}if(Object.isFrozen(e)||_(e))return r.pop(),void i.pop();switch(L(e)){case 2:for(const[t,o]of e)ee(t,t,n,r,i),ee(o,t,n,r,i);e.set=e.clear=e.delete=Q;break;case 3:for(const t of e)ee(t,t,n,r,i);e.add=e.clear=e.delete=Q;break;case 1:Object.freeze(e);let t=0;for(const o of e)ee(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{ee(e[t],t,n,r,i)}))}r.pop(),i.pop()}function te(e,t){const n=L(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function ne(e,t,n){if(_(e)||!U(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),te(e,((o,s)=>{var a;if(_(s)){const t=I(s);Y(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;q(r?i:e,o,n)}else ne(s,t,n)})),i){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(i.has(e)?i.get(e):e)}))}}function re(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ne(V(n,t),e.finalities.handledSet,e.options)}function ie(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(N(t))})))}function oe(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=F(e);i&&t(e,i,n,r)}e.finalized=!0}}function se(e,t,n,r){const i=I(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(X(V(l,t),n)){let n=i.original;i.copy&&(n=i.copy),ie(e),oe(e,r,o,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,i.original)),q(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),U(n,e.options)&&e.finalities.draft.push((()=>{X(V(3===e.type?e.setMap:e.copy,t),n)&&re(e,t)}))}function ae(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,i,o,s){n.forEach(((n,a)=>{const l=V(e,a),c=G(V(t,a)),u=n?x(e,a)?E:S:M;if(X(l,c)&&u===E)return;const p=W(r.concat(a),s);i.push(u===M?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===S?{op:M,path:p}:u===M?{op:S,path:p,value:l}:{op:E,path:p,value:l})}))}(e,t,n,r,i);case 1:return function(e,t,n,r,i){let{original:o,assignedMap:s,options:a}=e,l=e.copy;l.length<o.length&&([o,l]=[l,o],[n,r]=[r,n]);for(let e=0;e<o.length;e+=1)if(s.get(e.toString())&&l[e]!==o[e]){const s=W(t.concat([e]),i);n.push({op:E,path:s,value:G(l[e])}),r.push({op:E,path:s,value:G(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=W(t.concat([e]),i);n.push({op:S,path:r,value:G(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=W(t.concat(["length"]),i);r.push({op:E,path:e,value:o.length})}else for(let e=l.length;o.length<e;e-=1){const n=W(t.concat([e-1]),i);r.push({op:M,path:n})}}}(e,t,n,r,i);case 3:return function({original:e,copy:t},n,r,i,o){let s=0;e.forEach((e=>{if(!t.has(e)){const t=W(n.concat([s]),o);r.push({op:M,path:t,value:e}),i.unshift({op:S,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=W(n.concat([s]),o);r.push({op:S,path:e,value:t}),i.unshift({op:M,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}const le=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!U(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},ce={get size(){return D(I(this)).size},has(e){return D(I(this)).has(e)},set(e,t){const n=I(this),r=D(n);return r.has(e)&&X(r.get(e),t)||(Y(n),J(n),n.assignedMap.set(e,!0),n.copy.set(e,t),se(n,e,t,ae)),this},delete(e){if(!this.has(e))return!1;const t=I(this);return Y(t),J(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=I(this);if(this.size){Y(e),J(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){D(I(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=I(this),i=D(r).get(e),o=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,i,P))===P.mutable;if(r.options.strict&&le(i,r.options,o),o)return i;if(r.finalized||!U(i,r.options))return i;if(i!==r.original.get(e))return i;const s=A.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return Y(r),r.copy.set(e,s),s},keys(){return D(I(this)).keys()},values(){const e=this.keys();return{[R]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[R]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[R](){return this.entries()}},ue=Reflect.ownKeys(ce),pe=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const s=o.value;let a=e.setMap.get(s);const l=I(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,P))===P.mutable;if(e.options.strict&&le(s,e.options,c),c||l||!U(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=A.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},fe={get size(){return I(this).setMap.size},has(e){const t=I(this);if(t.setMap.has(e))return!0;Y(t);const n=I(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=I(this);return this.has(e)||(Y(t),J(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),se(t,e,e,ae)),this},delete(e){if(!this.has(e))return!1;const t=I(this);Y(t),J(t);const n=I(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=I(this);Y(e),J(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=I(this);Y(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:pe(e,t,{isValuesIterator:!0})}},entries(){const e=I(this);Y(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:pe(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[R](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(fe,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const he=Reflect.ownKeys(fe),de=new WeakSet,ye={get(e,t,n){var r,i;const o=null===(r=e.copy)||void 0===r?void 0:r[t];if(o&&de.has(o))return o;if(t===j)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,P),s===P.mutable)return e.options.strict&&le(r,e.options,!0),r}const a=D(e);if(a instanceof Map&&ue.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ce,"size").get.call(e.proxy);const n=ce[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&he.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(fe,"size").get.call(e.proxy);const n=fe[t];if(n)return n.bind(e.proxy)}if(!x(a,t)){const n=z(a,t);return n?"value"in n?n.value:null===(i=n.get)||void 0===i?void 0:i.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&le(l,e.options),e.finalized||!U(l,e.options))return l;if(l===$(e.original,t)){if(Y(e),e.copy[t]=ge({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=I(e.copy[t]);return Y(n),J(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let i;if(1===e.type&&"length"!==t&&(!(Number.isInteger(i=Number(t))&&i>=0)||0!==t&&0!==i&&String(i)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const o=z(D(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=$(D(e),t),a=I(s);return a&&X(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(X(n,s)&&(void 0!==n||x(e.original,t))||(Y(e),J(e),x(e.original,t)&&X(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,se(e,t,n,ae)),!0)},has:(e,t)=>t in D(e),ownKeys:e=>Reflect.ownKeys(D(e)),getOwnPropertyDescriptor(e,t){const n=D(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?ye.set.call(this,e,t,void 0,e.proxy):(void 0!==$(e.original,t)||t in e.original?(Y(e),J(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function ge(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,s=L(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,ye);if(i.revoke.push(c),de.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=I(l);let a=3===e.type?e.setMap:e.copy;const c=V(a,r),u=I(c);if(u){let o=u.original;u.operated&&(o=N(c)),ie(u),oe(u,ae,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(i=e.options.updatedValues)&&void 0!==i?i:new WeakMap,e.options.updatedValues.set(o,u.original)),q(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=I(l);e.finalities.draft.push(((t,n)=>{ie(e),oe(e,ae,t,n)}))}return l}function ve(e,t,n,r,i){var o;const s=I(e),a=null!==(o=null==s?void 0:s.original)&&void 0!==o?o:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;)s.finalities.draft.pop()(n,r);const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&B(s),i&&ee(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:E,path:[],value:t[0]}]:n,r&&l?[{op:E,path:[],value:a}]:r]}function be(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;te(n,((n,r,i)=>{const o=I(r);if(o&&t&&o.finalities===t.finalities){e.isContainDraft=!0;const t=o.original;if(i instanceof Set){const e=Array.from(i);i.clear(),e.forEach((e=>i.add(n===e?t:e)))}else q(i,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,be(e))})),i&&e.isContainDraft}function me(e){var t;const n=I(e);if(!U(e,null==n?void 0:n.options))return e;const r=L(e);if(n&&!n.operated)return n.original;let i;function o(){i=2===r?T(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):H(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(te(i,((t,r)=>{if(n&&X(V(n.original,t),r))return;const s=me(r);s!==r&&(i===e&&o(),q(i,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:i;return C(e)?new Set(i):new(Object.getPrototypeOf(e).constructor)(i)}return i}function we(e){if(!_(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return me(e)}A.createDraft=ge;const Oe=function e(t,n,r){var i,o,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...i){return e(r,(e=>t.call(this,e,...i)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},void 0),c);const u=_(a)?we(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(i=c.enablePatches)&&void 0!==i&&i,h=null!==(o=c.strict)&&void 0!==o&&o,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!U(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,P))!==P.mutable&&U(e,t)?ge({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=ve(s,e,i,o,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!U(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw B(I(y)),e}const b=e=>{const t=I(y);if(!_(e)){if(void 0!==e&&!X(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[k];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&be({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&be({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=I(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([we(e)])}return g([e])};return v instanceof Promise?v.then(b,(e=>{throw B(I(y)),e})):b(v)};Object.prototype.constructor.toString();class Me{constructor(e,t=null){this.value=e,this.reactor=t??new w(this,[])}produce(e){return n=e,void(t=this).set(Oe(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new O(this,"",e[0]):new O(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function Ee(e){return new Me(e)}function Se(e){return e instanceof Me}function je(e,t){e.reactor.addBinding(t)}function ke(e,t){e.reactor.removeBinding(t)}class Re{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}function Pe(e){return new Re(e)}class Ae{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}function xe(e){return new Ae(e)}class ze{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}function Ce(e){return new ze(e)}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Te{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=Ee(t);return this.data[e]=n,n}get(e){return this.data[e]}}function De(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Te(t)),window.RUMIOUS_CONTEXTS[e]}export{b as RumiousApp,Ae as RumiousChildrensRef,t as RumiousComponent,d as RumiousComponentElement,ze as RumiousComponentRef,Te as RumiousContext,Re as RumiousElementRef,Me as RumiousState,xe as createChildrensRef,y as createComponentElement,Ce as createComponentRef,De as createContext,Pe as createElementRef,Ee as createState,n as isComponent,Se as isState,m as styleHelper,ke as unwatch,je as watch};
1
+ class e{constructor(e){this.target=e,this.app=e.app,this.hooks={onRendered:[],onBeforeRender:[]}}find(e){return this.target[e]}get(e){return this.target[e]}addHook(e,t){if(!this.hooks[e])throw new Error(`Hook type "${e}" is not defined!`);this.hooks[e].push(t)}async runHooks(e,...t){if(this.hooks[e])for(const n of this.hooks[e])await n(...t)}}class t{constructor(){this.asynchronousRender=!1,this.element=null,this.app=null,this.props={},this.forwardRefs={},this.renderContext=new e(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n,this.renderContext.app=this.app}template(){return{}}render(e){return this.renderer(e,document.createDocumentFragment(),this.renderContext)}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function n(e){return Object.getPrototypeOf(e)===t}class r{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class i{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function o(e){return"function"==typeof e}class s{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){}}class a extends s{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return null;const n=t.get(e);if(!o(n))throw new Error(`${e} is not a function!`);return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!o(n))throw new Error("Event handler requires a function!")}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class l extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive bind requires a RumiousState Object!");t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw new Error("Invalid props value: Directive bind requires a RumiousState Object!");r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){switch(this.name){case"html":e.innerHTML=this.normalizeValue(t);break;case"text":e.textContent=this.normalizeValue(t);break;case"show":e.style.display=this.normalizeValue(t)?"block":"none";break;case"hide":e.style.display=this.normalizeValue(t)?"none":"block";break;case"className":e.className=this.normalizeValue(t);break;case"style":Object.assign(e.style,t);break;case"disabled":e.disabled=!!this.normalizeValue(t);break;case"visible":e.style.visibility=this.normalizeValue(t)?"visible":"hidden";break;default:e.setAttribute(this.name,this.normalizeValue(t))}}}class c extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive ref requires a RumiousRef Object!");t.set(e)}else if("dynamic_value"===this.value.type){let n=t.find(this.value.value.objectName);if(!n)throw new Error("Invalid props value: Directive ref requires a RumiousRef Object!");n.set(e)}}}class u extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive childsRef requires a RumiousChildRef Object!");t.set(e)}else if("dynamic_value"===this.value.type){let n=t.find(this.value.value.objectName);if(!n)throw new Error("Invalid props value: Directive childsRef requires a RumiousChildRef Object!");n.set(e)}}}const p={on:(e,t)=>new a("on",e,t),bind:(e,t)=>new l("bind",e,t),ref:(e,t)=>new c("ref",e,t),childsRef:(e,t)=>new u("childsRef",e,t)};function f(e,t,n){return function(e,t,n){return p[e]?.(t,n)}(e,t,n)}function h(e,t,...i){return n(e)?y(e,t,i):e===g?g(...i):new r(e,t||{},v(i))}function d(e){return new r("TEXT_ELEMENT",{nodeValue:e},[])}function y(e,t,n){let o=new r("COMPONENT",{...t},new i(v(n)));return o.component=e,o}function g(...e){return new r("FRAGMENT",{},v(e))}function v(e){return e.map((e=>"object"==typeof e?e:d(e)))}window.RUMIOUS_JSX_SUPPORT={createElement:h,createFragment:g,createDirective:f};class m extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){Object.setPrototypeOf(this,HTMLUnknownElement.prototype),this.remove()}init(e,t,n={},r,i){this.instance=new e,this.instance.element=this,this.instance.app=i,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.asynchronousRender?(async()=>{this.instance.onCreate(),this.instance.requestRender()})():(this.instance.onCreate(),this.instance.requestRender())}disconnectedCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function b(e="r-component"){return window.customElements.get(e)||window.customElements.define(e,class extends m{static tag=e}),document.createElement(e)}class w{constructor(){this.contents=[],this.targets=[],this.observers=new WeakMap}commit(e=[]){this.contents=e}setTarget(e,t,n){this.targets.push({element:e,context:n,renderer:t}),this.observeTarget(e)}observeTarget(e){if(this.observers.has(e))return;const t=new MutationObserver((()=>{e.parentNode||this.removeTarget(e)}));t.observe(e,{childList:!1,subtree:!1}),this.observers.set(e,t)}removeTarget(e){const t=this.observers.get(e);t&&(t.disconnect(),this.observers.delete(e)),this.targets=this.targets.filter((t=>t.element!==e))}inject(e=!1){for(let t of this.targets)e&&(t.element.textContent=""),this.contents.forEach((e=>{"html"===e.type?t.element.innerHTML=e.value:"text"===e.type?t.element.textContent=e.value:"component"===e.type&&t.renderer(h(e.value,e.props??{},e.child??{}),t.element,t.context)}))}}function O(e){let t=new w;return t.commit([{type:"html",value:e}]),t}function M(e){let t=new w;return t.commit([{type:"text",value:e}]),t}function E(e,t,n){for(const[r,i]of Object.entries(t||{}))i instanceof s?i.init(e,n):r.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(r)?e.addEventListener(r.substring(2).toLowerCase(),i):e.setAttribute(r,i)}function k(e,t,n={}){if(!e)return t;if(null===(i=e)||"object"!=typeof i&&"function"!=typeof i)return k(d(e),t,n);var i;if(Array.isArray(e)){for(const r of e)k(r,t,n);return t}if(e instanceof r){let r;switch(e.type){case"COMPONENT":return function(e,t,n,r){const i=function(e,t,n,r,i=null){const o=b(e.tag??"r-component");return o.init(e,t,n,r,i?.app),o}(e.component,e.props,e.children,n,r);return E(i,e.props,r),t.appendChild(i),t}(e,t,k,n);case"FRAGMENT":case"ELEMENT_LIST":for(const r of e.children)k(r,t,n);return t;case"TEXT_ELEMENT":r=function(e){return document.createTextNode(e.props.nodeValue)}(e);break;default:r=function(e,t){const n=document.createElement(e.type);E(n,e.props,t);for(const r of e.children)k(r,n,t);return n}(e,n)}return t.appendChild(r),t}if(e instanceof HTMLElement)return t.appendChild(e),t;if(e instanceof w){if(t instanceof HTMLDocument)throw"Rumious Render: Unsupported inject content in HTMLDocument!";return e.setTarget(t,k,n),e.inject(!0),t}return k(d(JSON.stringify(e)),t,n)}class j{constructor(t=document.createElement("span"),n={}){this.root=t,this.app=this,this.modules=[],this.configs=n,this.renderContext=new e(this)}render(e){this.renderContext.runHooks("onBeforeRender",this.renderContext),k(e,this.root,this.renderContext),this.renderContext.runHooks("onRendered",this.renderContext)}addModule(e,t={}){return e.init(this,t)}}function S(e){let t="";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){t+=`${n} {`;const r=e[n];for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`);t+="} "}return t.trim()}class R{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class x{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const C="remove",A="replace",P="add",T=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),z=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),D=Symbol.iterator,I={mutable:"mutable",immutable:"immutable"},N={};function _(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function L(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function U(e){return Object.getPrototypeOf(e)===Set.prototype}function V(e){return Object.getPrototypeOf(e)===Map.prototype}function F(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function q(e){return!!$(e)}function $(e){return"object"!=typeof e?null:null==e?void 0:e[T]}function H(e){var t;const n=$(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function B(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,I))===I.immutable||"function"==typeof n)}function W(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=$(K(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const i=3===e.parent.type,o=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>o||_(n,o)))return null;t.push(o)}if(e.parent)return W(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=K(3===X(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function X(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function K(e,t){return 2===X(e)?e.get(t):e[t]}function Y(e,t,n){2===X(e)?e.set(t,n):e[t]=n}function Z(e,t){const n=$(e);return(n?F(n):e)[t]}function G(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function J(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function Q(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const ee=Object.prototype.propertyIsEnumerable;function te(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set)return U(e)?Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values()):new(0,Object.getPrototypeOf(e).constructor)(e.values());if(e instanceof Map)return V(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,I),void 0!==n)&&n!==I.mutable){if(n===I.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{ee.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function ne(e){e.copy||(e.copy=te(e.original,e.options))}function re(e){if(!B(e))return H(e);if(Array.isArray(e))return e.map(re);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,re(t)]));return V(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(re);return U(e)?new Set(t):new(0,Object.getPrototypeOf(e).constructor)(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=re(e[n]);return t}function ie(e){return q(e)?re(e):e}function oe(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&oe(e.parent))}function se(){throw new Error("Cannot modify frozen object")}function ae(e,t,n,r,i){{n=null!=n?n:new WeakMap,r=null!=r?r:[],i=null!=i?i:[];const o=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(o);if(o&&"object"==typeof o&&-1!==e){if(r[0]===o)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${i.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(o),i.push(t)}else r.push(o)}if(Object.isFrozen(e)||q(e))return r.pop(),void i.pop();switch(X(e)){case 2:for(const[t,o]of e)ae(t,t,n,r,i),ae(o,t,n,r,i);e.set=e.clear=e.delete=se;break;case 3:for(const t of e)ae(t,t,n,r,i);e.add=e.clear=e.delete=se;break;case 1:Object.freeze(e);let t=0;for(const o of e)ae(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{ae(e[t],t,n,r,i)}))}r.pop(),i.pop()}function le(e,t){const n=X(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function ce(e,t,n){if(q(e)||!B(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),le(e,((o,s)=>{var a;if(q(s)){const t=$(s);ne(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;Y(r?i:e,o,n)}else ce(s,t,n)})),i){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(i.has(e)?i.get(e):e)}))}}function ue(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ce(K(n,t),e.finalities.handledSet,e.options)}function pe(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(H(t))})))}function fe(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=W(e);i&&t(e,i,n,r)}e.finalized=!0}}function he(e,t,n,r){const i=$(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(G(K(l,t),n)){let n=i.original;i.copy&&(n=i.copy),pe(e),fe(e,r,o,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,i.original)),Y(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),B(n,e.options)&&e.finalities.draft.push((()=>{G(K(3===e.type?e.setMap:e.copy,t),n)&&ue(e,t)}))}function de(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,i,o,s){n.forEach(((n,a)=>{const l=K(e,a),c=ie(K(t,a)),u=n?_(e,a)?A:P:C;if(G(l,c)&&u===A)return;const p=Q(r.concat(a),s);i.push(u===C?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===P?{op:C,path:p}:u===C?{op:P,path:p,value:l}:{op:A,path:p,value:l})}))}(e,t,n,r,i);case 1:return function(e,t,n,r,i){let{original:o,assignedMap:s,options:a}=e,l=e.copy;l.length<o.length&&([o,l]=[l,o],[n,r]=[r,n]);for(let e=0;e<o.length;e+=1)if(s.get(e.toString())&&l[e]!==o[e]){const s=Q(t.concat([e]),i);n.push({op:A,path:s,value:ie(l[e])}),r.push({op:A,path:s,value:ie(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=Q(t.concat([e]),i);n.push({op:P,path:r,value:ie(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=Q(t.concat(["length"]),i);r.push({op:A,path:e,value:o.length})}else for(let e=l.length;o.length<e;e-=1){const n=Q(t.concat([e-1]),i);r.push({op:C,path:n})}}}(e,t,n,r,i);case 3:return function({original:e,copy:t},n,r,i,o){let s=0;e.forEach((e=>{if(!t.has(e)){const t=Q(n.concat([s]),o);r.push({op:C,path:t,value:e}),i.unshift({op:P,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=Q(n.concat([s]),o);r.push({op:P,path:e,value:t}),i.unshift({op:C,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}const ye=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!B(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},ge={get size(){return F($(this)).size},has(e){return F($(this)).has(e)},set(e,t){const n=$(this),r=F(n);return r.has(e)&&G(r.get(e),t)||(ne(n),oe(n),n.assignedMap.set(e,!0),n.copy.set(e,t),he(n,e,t,de)),this},delete(e){if(!this.has(e))return!1;const t=$(this);return ne(t),oe(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=$(this);if(this.size){ne(e),oe(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){F($(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=$(this),i=F(r).get(e),o=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,i,I))===I.mutable;if(r.options.strict&&ye(i,r.options,o),o)return i;if(r.finalized||!B(i,r.options))return i;if(i!==r.original.get(e))return i;const s=N.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return ne(r),r.copy.set(e,s),s},keys(){return F($(this)).keys()},values(){const e=this.keys();return{[D]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[D]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[D](){return this.entries()}},ve=Reflect.ownKeys(ge),me=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const s=o.value;let a=e.setMap.get(s);const l=$(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,I))===I.mutable;if(e.options.strict&&ye(s,e.options,c),c||l||!B(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=N.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},be={get size(){return $(this).setMap.size},has(e){const t=$(this);if(t.setMap.has(e))return!0;ne(t);const n=$(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=$(this);return this.has(e)||(ne(t),oe(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),he(t,e,e,de)),this},delete(e){if(!this.has(e))return!1;const t=$(this);ne(t),oe(t);const n=$(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=$(this);ne(e),oe(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=$(this);ne(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:me(e,t,{isValuesIterator:!0})}},entries(){const e=$(this);ne(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:me(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[D](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(be,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const we=Reflect.ownKeys(be),Oe=new WeakSet,Me={get(e,t,n){var r,i;const o=null===(r=e.copy)||void 0===r?void 0:r[t];if(o&&Oe.has(o))return o;if(t===T)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,I),s===I.mutable)return e.options.strict&&ye(r,e.options,!0),r}const a=F(e);if(a instanceof Map&&ve.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ge,"size").get.call(e.proxy);const n=ge[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&we.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(be,"size").get.call(e.proxy);const n=be[t];if(n)return n.bind(e.proxy)}if(!_(a,t)){const n=L(a,t);return n?"value"in n?n.value:null===(i=n.get)||void 0===i?void 0:i.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&ye(l,e.options),e.finalized||!B(l,e.options))return l;if(l===Z(e.original,t)){if(ne(e),e.copy[t]=Ee({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=$(e.copy[t]);return ne(n),oe(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let i;if(1===e.type&&"length"!==t&&(!(Number.isInteger(i=Number(t))&&i>=0)||0!==t&&0!==i&&String(i)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const o=L(F(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=Z(F(e),t),a=$(s);return a&&G(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(G(n,s)&&(void 0!==n||_(e.original,t))||(ne(e),oe(e),_(e.original,t)&&G(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,he(e,t,n,de)),!0)},has:(e,t)=>t in F(e),ownKeys:e=>Reflect.ownKeys(F(e)),getOwnPropertyDescriptor(e,t){const n=F(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?Me.set.call(this,e,t,void 0,e.proxy):(void 0!==Z(e.original,t)||t in e.original?(ne(e),oe(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function Ee(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,s=X(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,Me);if(i.revoke.push(c),Oe.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=$(l);let a=3===e.type?e.setMap:e.copy;const c=K(a,r),u=$(c);if(u){let o=u.original;u.operated&&(o=H(c)),pe(u),fe(u,de,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(i=e.options.updatedValues)&&void 0!==i?i:new WeakMap,e.options.updatedValues.set(o,u.original)),Y(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=$(l);e.finalities.draft.push(((t,n)=>{pe(e),fe(e,de,t,n)}))}return l}function ke(e,t,n,r,i){var o;const s=$(e),a=null!==(o=null==s?void 0:s.original)&&void 0!==o?o:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;)s.finalities.draft.pop()(n,r);const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&J(s),i&&ae(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:A,path:[],value:t[0]}]:n,r&&l?[{op:A,path:[],value:a}]:r]}function je(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;le(n,((n,r,i)=>{const o=$(r);if(o&&t&&o.finalities===t.finalities){e.isContainDraft=!0;const t=o.original;if(i instanceof Set){const e=Array.from(i);i.clear(),e.forEach((e=>i.add(n===e?t:e)))}else Y(i,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,je(e))})),i&&e.isContainDraft}function Se(e){var t;const n=$(e);if(!B(e,null==n?void 0:n.options))return e;const r=X(e);if(n&&!n.operated)return n.original;let i;function o(){i=2===r?V(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):te(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(le(i,((t,r)=>{if(n&&G(K(n.original,t),r))return;const s=Se(r);s!==r&&(i===e&&o(),Y(i,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:i;return U(e)?new Set(i):new(Object.getPrototypeOf(e).constructor)(i)}return i}function Re(e){if(!q(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Se(e)}N.createDraft=Ee;const xe=function e(t,n,r){var i,o,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...i){return e(r,(e=>t.call(this,e,...i)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},void 0),c);const u=q(a)?Re(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(i=c.enablePatches)&&void 0!==i&&i,h=null!==(o=c.strict)&&void 0!==o&&o,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!B(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,I))!==I.mutable&&B(e,t)?Ee({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=ke(s,e,i,o,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!B(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw J($(y)),e}const m=e=>{const t=$(y);if(!q(e)){if(void 0!==e&&!G(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[z];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&je({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&je({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=$(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([Re(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw J($(y)),e})):m(v)};function Ce(e,t){e.set(xe(e.get(),t))}Object.prototype.constructor.toString();class Ae{constructor(e,t=null){this.value=e,this.reactor=t??new R(this,[])}produce(e){return Ce(this,e)}reducer(...e){let t;return t=1===e.length?new x(this,"",e[0]):new x(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0===e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function Pe(e){return new Ae(e)}function Te(e){return e instanceof Ae}function ze(e,t){e.reactor.addBinding(t)}function De(e,t){e.reactor.removeBinding(t)}class Ie{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}function Ne(e){return new Ie(e)}class _e{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}function Le(e){return new _e(e)}class Ue{constructor(e){this.target=e}set(e){this.target=e.forwardRefs}}function Ve(e){return new Ue(e)}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Fe{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=Pe(t);return this.data[e]=n,n}get(e){return this.data[e]}}function qe(e="",t={}){if(!t||"object"!=typeof t)throw"Rumious context: Initial value must be object !";return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Fe(t)),window.RUMIOUS_CONTEXTS[e]}class $e extends t{static tag="r-pending";constructor(){super(),this.asynchronousRender=!0}async setLoader(e){this.loader=e;try{this.result=await this.loader.execute(),this.renderResult()}catch(e){this.error=e,this.renderError()}}renderResult(){if(!this.result)throw"Rumious Render: Cannot find component when lazy loading!";this.element.before(this.render(h(this.result,{}))),this.element.remove()}renderError(){this.element.appendChild(this.render(this.props.errorComponent??this.error))}onRender(){let{loader:e}=this.props;this.setLoader(e)}template(){return this.props.fallback}}class He{constructor(e,t={}){this.hasExecuted=!1,this.result=null,this.callback=e,this.dependents=[],this.options=t}onLoad(e){this.hasExecuted?e(this.result):this.dependents.push(e)}execute(){return new Promise(((e,t)=>{if(this.hasExecuted)return e(this.result);this.hasExecuted=!0;const n=async()=>{try{this.result=await this.callback(),e(this.result),this.dependents.forEach((e=>e(this.result)))}catch(e){t(e)}};this.options.idle&&"requestIdleCallback"in window?requestIdleCallback(n):n()}))}}const Be=new Map;function We(e,t={}){const n=t.key||e.toString();return Be.has(n)||Be.set(n,new He(e,t)),Be.get(n)}function Xe(e,t){let n=0;return function(...r){const i=Date.now();i-n>=t&&(n=i,e.apply(this,r))}}function Ke(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout((()=>e.apply(this,r)),t)}}function Ye(e,t){let n=0,r=null,i=null;function o(){n=Date.now(),e.apply(this,r),r=null}return function(...e){const s=Date.now();r=e,s-n>=t?o():i||(i=setTimeout((()=>{i=null,o()}),t-(s-n)))}}function Ze(e,t){let n,r=!0;return function(...i){r&&(e.apply(this,i),r=!1),clearTimeout(n),n=setTimeout((()=>{e.apply(this,i),r=!0}),t)}}function Ge(e){let t=!1;return function(...n){t||(t=!0,requestAnimationFrame((()=>{e.apply(this,n),t=!1})))}}export{$e as Pending,j as RumiousApp,_e as RumiousChildrensRef,t as RumiousComponent,m as RumiousComponentElement,Ue as RumiousComponentRef,Fe as RumiousContext,w as RumiousDymanicInjector,Ie as RumiousElementRef,He as RumiousLazyLoader,R as RumiousReactor,x as RumiousReducer,Ae as RumiousState,Le as createChildrensRef,y as createComponent,b as createComponentElement,Ve as createComponentRef,qe as createContext,f as createDirective,h as createElement,Ne as createElementRef,Pe as createState,d as createTextElement,Ke as denounce,O as injectHTML,M as injectText,n as isComponent,Te as isState,We as lazyLoad,Ze as leadingTrailingDebounce,Ce as produceState,Ge as rafThrottle,S as styleHelper,Xe as tholle,Ye as trailingThrottle,De as unwatch,ze as watch};
package/dist/index.min.js CHANGED
@@ -1 +1 @@
1
- var Rumious=function(e){"use strict";class t{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class n{constructor(){this.element=null,this.props={},this.renderContext=new t(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function r(e){return Object.getPrototypeOf(e)===n}class i{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class o{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function s(e){return"function"==typeof e}class a{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){}}class l extends a{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return null;const n=t.get(e);if(!s(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!s(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class c extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){"html"===this.name&&(e.innerHTML=this.normalizeValue(t))}}class u extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class p extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const f={on:(e,t)=>new l("on",e,t),bind:(e,t)=>new c("bind",e,t),ref:(e,t)=>new u("ref",e,t),childsRef:(e,t)=>new p("childsRef",e,t)};function h(...e){return new i("FRAGMENT",{},d(e))}function d(e){return e.map((e=>"object"==typeof e?e:new i("TEXT_ELEMENT",{nodeValue:e},[])))}window.RUMIOUS_JSX_SUPPORT={createElement:function(e,t,...n){return r(e)?function(e,t,n){return new i("COMPONENT",{component:e,...t},new o(d(n)))}(e,t,n):e===h?h(...n):new i(e,t||{},d(n))},createFragment:h,createDirective:function(e,t,n){return function(e,t,n){return f[e]?.(t,n)}(e,t,n)}};class y extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){}setRef(e){this.ref=e}init(e,t,n={},r){this.instance=new e,this.instance.element=this,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.onCreate(),this.instance.requestRender(),this.instance.forwardRef=this.ref??{}}disconnectCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function g(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends y{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function v(e,t,n){t.init(e,n)}function m(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?function(e,t,n,r){const i=function(e,t,n,r){const i=g(e.tag??"r-component");return i.init(e,t,n,r),i}(e.props.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof a&&v(i,e,r)})),t.appendChild(i),t}(e,t,m,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>m(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):function(e,t){const n=document.createElement(e.type);return Object.entries(e.props||{}).forEach((([e,r])=>{e.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(e)?n.addEventListener(e.substring(2).toLowerCase(),r):function(e,t,n,r){e.nodeType===Node.TEXT_NODE?e.nodeValue=n:n instanceof a?v(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}(e,n),e.children.forEach((e=>m(e,r,n))),t.appendChild(r),t)}class b{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class w{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const O="remove",M="replace",E="add",S=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),j=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),R=Symbol.iterator,k={mutable:"mutable",immutable:"immutable"},P={};function A(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function C(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function x(e){return Object.getPrototypeOf(e)===Set.prototype}function z(e){return Object.getPrototypeOf(e)===Map.prototype}function T(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function D(e){return!!_(e)}function _(e){return"object"!=typeof e?null:null==e?void 0:e[S]}function I(e){var t;const n=_(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function N(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,k))===k.immutable||"function"==typeof n)}function U(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=_(L(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const i=3===e.parent.type,o=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>o||A(n,o)))return null;t.push(o)}if(e.parent)return U(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=L(3===F(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function F(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function L(e,t){return 2===F(e)?e.get(t):e[t]}function V(e,t,n){2===F(e)?e.set(t,n):e[t]=n}function q(e,t){const n=_(e);return(n?T(n):e)[t]}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function X(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function B(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const W=Object.prototype.propertyIsEnumerable;function K(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set)return x(e)?Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values()):new(0,Object.getPrototypeOf(e).constructor)(e.values());if(e instanceof Map)return z(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,k),void 0!==n)&&n!==k.mutable){if(n===k.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{W.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function H(e){e.copy||(e.copy=K(e.original,e.options))}function Y(e){if(!N(e))return I(e);if(Array.isArray(e))return e.map(Y);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,Y(t)]));return z(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(Y);return x(e)?new Set(t):new(0,Object.getPrototypeOf(e).constructor)(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=Y(e[n]);return t}function Z(e){return D(e)?Y(e):e}function G(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&G(e.parent))}function J(){throw new Error("Cannot modify frozen object")}function Q(e,t,n,r,i){{n=null!=n?n:new WeakMap,r=null!=r?r:[],i=null!=i?i:[];const o=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(o);if(o&&"object"==typeof o&&-1!==e){if(r[0]===o)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${i.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(o),i.push(t)}else r.push(o)}if(Object.isFrozen(e)||D(e))return r.pop(),void i.pop();switch(F(e)){case 2:for(const[t,o]of e)Q(t,t,n,r,i),Q(o,t,n,r,i);e.set=e.clear=e.delete=J;break;case 3:for(const t of e)Q(t,t,n,r,i);e.add=e.clear=e.delete=J;break;case 1:Object.freeze(e);let t=0;for(const o of e)Q(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{Q(e[t],t,n,r,i)}))}r.pop(),i.pop()}function ee(e,t){const n=F(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function te(e,t,n){if(D(e)||!N(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),ee(e,((o,s)=>{var a;if(D(s)){const t=_(s);H(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;V(r?i:e,o,n)}else te(s,t,n)})),i){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(i.has(e)?i.get(e):e)}))}}function ne(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&te(L(n,t),e.finalities.handledSet,e.options)}function re(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(I(t))})))}function ie(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=U(e);i&&t(e,i,n,r)}e.finalized=!0}}function oe(e,t,n,r){const i=_(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if($(L(l,t),n)){let n=i.original;i.copy&&(n=i.copy),re(e),ie(e,r,o,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,i.original)),V(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),N(n,e.options)&&e.finalities.draft.push((()=>{$(L(3===e.type?e.setMap:e.copy,t),n)&&ne(e,t)}))}function se(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,i,o,s){n.forEach(((n,a)=>{const l=L(e,a),c=Z(L(t,a)),u=n?A(e,a)?M:E:O;if($(l,c)&&u===M)return;const p=B(r.concat(a),s);i.push(u===O?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===E?{op:O,path:p}:u===O?{op:E,path:p,value:l}:{op:M,path:p,value:l})}))}(e,t,n,r,i);case 1:return function(e,t,n,r,i){let{original:o,assignedMap:s,options:a}=e,l=e.copy;l.length<o.length&&([o,l]=[l,o],[n,r]=[r,n]);for(let e=0;e<o.length;e+=1)if(s.get(e.toString())&&l[e]!==o[e]){const s=B(t.concat([e]),i);n.push({op:M,path:s,value:Z(l[e])}),r.push({op:M,path:s,value:Z(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=B(t.concat([e]),i);n.push({op:E,path:r,value:Z(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=B(t.concat(["length"]),i);r.push({op:M,path:e,value:o.length})}else for(let e=l.length;o.length<e;e-=1){const n=B(t.concat([e-1]),i);r.push({op:O,path:n})}}}(e,t,n,r,i);case 3:return function({original:e,copy:t},n,r,i,o){let s=0;e.forEach((e=>{if(!t.has(e)){const t=B(n.concat([s]),o);r.push({op:O,path:t,value:e}),i.unshift({op:E,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=B(n.concat([s]),o);r.push({op:E,path:e,value:t}),i.unshift({op:O,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}const ae=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!N(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},le={get size(){return T(_(this)).size},has(e){return T(_(this)).has(e)},set(e,t){const n=_(this),r=T(n);return r.has(e)&&$(r.get(e),t)||(H(n),G(n),n.assignedMap.set(e,!0),n.copy.set(e,t),oe(n,e,t,se)),this},delete(e){if(!this.has(e))return!1;const t=_(this);return H(t),G(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=_(this);if(this.size){H(e),G(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){T(_(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=_(this),i=T(r).get(e),o=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,i,k))===k.mutable;if(r.options.strict&&ae(i,r.options,o),o)return i;if(r.finalized||!N(i,r.options))return i;if(i!==r.original.get(e))return i;const s=P.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return H(r),r.copy.set(e,s),s},keys(){return T(_(this)).keys()},values(){const e=this.keys();return{[R]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[R]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[R](){return this.entries()}},ce=Reflect.ownKeys(le),ue=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const s=o.value;let a=e.setMap.get(s);const l=_(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,k))===k.mutable;if(e.options.strict&&ae(s,e.options,c),c||l||!N(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=P.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},pe={get size(){return _(this).setMap.size},has(e){const t=_(this);if(t.setMap.has(e))return!0;H(t);const n=_(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=_(this);return this.has(e)||(H(t),G(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),oe(t,e,e,se)),this},delete(e){if(!this.has(e))return!1;const t=_(this);H(t),G(t);const n=_(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=_(this);H(e),G(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=_(this);H(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ue(e,t,{isValuesIterator:!0})}},entries(){const e=_(this);H(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ue(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[R](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(pe,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const fe=Reflect.ownKeys(pe),he=new WeakSet,de={get(e,t,n){var r,i;const o=null===(r=e.copy)||void 0===r?void 0:r[t];if(o&&he.has(o))return o;if(t===S)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,k),s===k.mutable)return e.options.strict&&ae(r,e.options,!0),r}const a=T(e);if(a instanceof Map&&ce.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(le,"size").get.call(e.proxy);const n=le[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&fe.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(pe,"size").get.call(e.proxy);const n=pe[t];if(n)return n.bind(e.proxy)}if(!A(a,t)){const n=C(a,t);return n?"value"in n?n.value:null===(i=n.get)||void 0===i?void 0:i.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&ae(l,e.options),e.finalized||!N(l,e.options))return l;if(l===q(e.original,t)){if(H(e),e.copy[t]=ye({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=_(e.copy[t]);return H(n),G(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let i;if(1===e.type&&"length"!==t&&(!(Number.isInteger(i=Number(t))&&i>=0)||0!==t&&0!==i&&String(i)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const o=C(T(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=q(T(e),t),a=_(s);return a&&$(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):($(n,s)&&(void 0!==n||A(e.original,t))||(H(e),G(e),A(e.original,t)&&$(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,oe(e,t,n,se)),!0)},has:(e,t)=>t in T(e),ownKeys:e=>Reflect.ownKeys(T(e)),getOwnPropertyDescriptor(e,t){const n=T(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?de.set.call(this,e,t,void 0,e.proxy):(void 0!==q(e.original,t)||t in e.original?(H(e),G(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function ye(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,s=F(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,de);if(i.revoke.push(c),he.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=_(l);let a=3===e.type?e.setMap:e.copy;const c=L(a,r),u=_(c);if(u){let o=u.original;u.operated&&(o=I(c)),re(u),ie(u,se,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(i=e.options.updatedValues)&&void 0!==i?i:new WeakMap,e.options.updatedValues.set(o,u.original)),V(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=_(l);e.finalities.draft.push(((t,n)=>{re(e),ie(e,se,t,n)}))}return l}function ge(e,t,n,r,i){var o;const s=_(e),a=null!==(o=null==s?void 0:s.original)&&void 0!==o?o:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;)s.finalities.draft.pop()(n,r);const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&X(s),i&&Q(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:M,path:[],value:t[0]}]:n,r&&l?[{op:M,path:[],value:a}]:r]}function ve(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;ee(n,((n,r,i)=>{const o=_(r);if(o&&t&&o.finalities===t.finalities){e.isContainDraft=!0;const t=o.original;if(i instanceof Set){const e=Array.from(i);i.clear(),e.forEach((e=>i.add(n===e?t:e)))}else V(i,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,ve(e))})),i&&e.isContainDraft}function me(e){var t;const n=_(e);if(!N(e,null==n?void 0:n.options))return e;const r=F(e);if(n&&!n.operated)return n.original;let i;function o(){i=2===r?z(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):K(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(ee(i,((t,r)=>{if(n&&$(L(n.original,t),r))return;const s=me(r);s!==r&&(i===e&&o(),V(i,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:i;return x(e)?new Set(i):new(Object.getPrototypeOf(e).constructor)(i)}return i}function be(e){if(!D(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return me(e)}P.createDraft=ye;const we=function e(t,n,r){var i,o,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...i){return e(r,(e=>t.call(this,e,...i)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},void 0),c);const u=D(a)?be(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(i=c.enablePatches)&&void 0!==i&&i,h=null!==(o=c.strict)&&void 0!==o&&o,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!N(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,k))!==k.mutable&&N(e,t)?ye({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=ge(s,e,i,o,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!N(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw X(_(y)),e}const m=e=>{const t=_(y);if(!D(e)){if(void 0!==e&&!$(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[j];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&ve({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&ve({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=_(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([be(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw X(_(y)),e})):m(v)};Object.prototype.constructor.toString();class Oe{constructor(e,t=null){this.value=e,this.reactor=t??new b(this,[])}produce(e){return n=e,void(t=this).set(we(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new w(this,"",e[0]):new w(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function Me(e){return new Oe(e)}class Ee{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Se{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class je{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Re{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=Me(t);return this.data[e]=n,n}get(e){return this.data[e]}}return e.RumiousApp=class{constructor(e=document.createElement("span"),n={}){this.root=e,this.configs=n,this.renderContext=new t(this)}render(e){m(e,this.root,this.renderContext)}},e.RumiousChildrensRef=Se,e.RumiousComponent=n,e.RumiousComponentElement=y,e.RumiousComponentRef=je,e.RumiousContext=Re,e.RumiousElementRef=Ee,e.RumiousState=Oe,e.createChildrensRef=function(e){return new Se(e)},e.createComponentElement=g,e.createComponentRef=function(e){return new je(e)},e.createContext=function(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Re(t)),window.RUMIOUS_CONTEXTS[e]},e.createElementRef=function(e){return new Ee(e)},e.createState=Me,e.isComponent=r,e.isState=function(e){return e instanceof Oe},e.styleHelper=function(e){let t="";for(const n in e)if(e.hasOwnProperty(n)){t+=`${n} {`;const r=e[n];for(const e in r)r.hasOwnProperty(e)&&(t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`);t+="} "}return t.trim()},e.unwatch=function(e,t){e.reactor.removeBinding(t)},e.watch=function(e,t){e.reactor.addBinding(t)},e}({});
1
+ var Rumious=function(e){"use strict";class t{constructor(e){this.target=e,this.app=e.app,this.hooks={onRendered:[],onBeforeRender:[]}}find(e){return this.target[e]}get(e){return this.target[e]}addHook(e,t){if(!this.hooks[e])throw new Error(`Hook type "${e}" is not defined!`);this.hooks[e].push(t)}async runHooks(e,...t){if(this.hooks[e])for(const n of this.hooks[e])await n(...t)}}class n{constructor(){this.asynchronousRender=!1,this.element=null,this.app=null,this.props={},this.forwardRefs={},this.renderContext=new t(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n,this.renderContext.app=this.app}template(){return{}}render(e){return this.renderer(e,document.createDocumentFragment(),this.renderContext)}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function r(e){return Object.getPrototypeOf(e)===n}class o{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class i{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function s(e){return"function"==typeof e}class a{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){}}class l extends a{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return null;const n=t.get(e);if(!s(n))throw new Error(`${e} is not a function!`);return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!s(n))throw new Error("Event handler requires a function!")}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class c extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive bind requires a RumiousState Object!");t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw new Error("Invalid props value: Directive bind requires a RumiousState Object!");r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){switch(this.name){case"html":e.innerHTML=this.normalizeValue(t);break;case"text":e.textContent=this.normalizeValue(t);break;case"show":e.style.display=this.normalizeValue(t)?"block":"none";break;case"hide":e.style.display=this.normalizeValue(t)?"none":"block";break;case"className":e.className=this.normalizeValue(t);break;case"style":Object.assign(e.style,t);break;case"disabled":e.disabled=!!this.normalizeValue(t);break;case"visible":e.style.visibility=this.normalizeValue(t)?"visible":"hidden";break;default:e.setAttribute(this.name,this.normalizeValue(t))}}}class u extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive ref requires a RumiousRef Object!");t.set(e)}else if("dynamic_value"===this.value.type){let n=t.find(this.value.value.objectName);if(!n)throw new Error("Invalid props value: Directive ref requires a RumiousRef Object!");n.set(e)}}}class p extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw new Error("Invalid props value: Directive childsRef requires a RumiousChildRef Object!");t.set(e)}else if("dynamic_value"===this.value.type){let n=t.find(this.value.value.objectName);if(!n)throw new Error("Invalid props value: Directive childsRef requires a RumiousChildRef Object!");n.set(e)}}}const f={on:(e,t)=>new l("on",e,t),bind:(e,t)=>new c("bind",e,t),ref:(e,t)=>new u("ref",e,t),childsRef:(e,t)=>new p("childsRef",e,t)};function h(e,t,n){return function(e,t,n){return f[e]?.(t,n)}(e,t,n)}function d(e,t,...n){return r(e)?g(e,t,n):e===v?v(...n):new o(e,t||{},m(n))}function y(e){return new o("TEXT_ELEMENT",{nodeValue:e},[])}function g(e,t,n){let r=new o("COMPONENT",{...t},new i(m(n)));return r.component=e,r}function v(...e){return new o("FRAGMENT",{},m(e))}function m(e){return e.map((e=>"object"==typeof e?e:y(e)))}window.RUMIOUS_JSX_SUPPORT={createElement:d,createFragment:v,createDirective:h};class b extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){Object.setPrototypeOf(this,HTMLUnknownElement.prototype),this.remove()}init(e,t,n={},r,o){this.instance=new e,this.instance.element=this,this.instance.app=o,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.asynchronousRender?(async()=>{this.instance.onCreate(),this.instance.requestRender()})():(this.instance.onCreate(),this.instance.requestRender())}disconnectedCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function w(e="r-component"){return window.customElements.get(e)||window.customElements.define(e,class extends b{static tag=e}),document.createElement(e)}class O{constructor(){this.contents=[],this.targets=[],this.observers=new WeakMap}commit(e=[]){this.contents=e}setTarget(e,t,n){this.targets.push({element:e,context:n,renderer:t}),this.observeTarget(e)}observeTarget(e){if(this.observers.has(e))return;const t=new MutationObserver((()=>{e.parentNode||this.removeTarget(e)}));t.observe(e,{childList:!1,subtree:!1}),this.observers.set(e,t)}removeTarget(e){const t=this.observers.get(e);t&&(t.disconnect(),this.observers.delete(e)),this.targets=this.targets.filter((t=>t.element!==e))}inject(e=!1){for(let t of this.targets)e&&(t.element.textContent=""),this.contents.forEach((e=>{"html"===e.type?t.element.innerHTML=e.value:"text"===e.type?t.element.textContent=e.value:"component"===e.type&&t.renderer(d(e.value,e.props??{},e.child??{}),t.element,t.context)}))}}function E(e,t,n){for(const[r,o]of Object.entries(t||{}))o instanceof a?o.init(e,n):r.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(r)?e.addEventListener(r.substring(2).toLowerCase(),o):e.setAttribute(r,o)}function M(e,t,n={}){if(!e)return t;if(null===(r=e)||"object"!=typeof r&&"function"!=typeof r)return M(y(e),t,n);var r;if(Array.isArray(e)){for(const r of e)M(r,t,n);return t}if(e instanceof o){let r;switch(e.type){case"COMPONENT":return function(e,t,n,r){const o=function(e,t,n,r,o=null){const i=w(e.tag??"r-component");return i.init(e,t,n,r,o?.app),i}(e.component,e.props,e.children,n,r);return E(o,e.props,r),t.appendChild(o),t}(e,t,M,n);case"FRAGMENT":case"ELEMENT_LIST":for(const r of e.children)M(r,t,n);return t;case"TEXT_ELEMENT":r=function(e){return document.createTextNode(e.props.nodeValue)}(e);break;default:r=function(e,t){const n=document.createElement(e.type);E(n,e.props,t);for(const r of e.children)M(r,n,t);return n}(e,n)}return t.appendChild(r),t}if(e instanceof HTMLElement)return t.appendChild(e),t;if(e instanceof O){if(t instanceof HTMLDocument)throw"Rumious Render: Unsupported inject content in HTMLDocument!";return e.setTarget(t,M,n),e.inject(!0),t}return M(y(JSON.stringify(e)),t,n)}class k{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class R{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const j="remove",S="replace",x="add",C=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),T=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),A=Symbol.iterator,P={mutable:"mutable",immutable:"immutable"},z={};function D(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function I(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function L(e){return Object.getPrototypeOf(e)===Set.prototype}function N(e){return Object.getPrototypeOf(e)===Map.prototype}function _(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function U(e){return!!V(e)}function V(e){return"object"!=typeof e?null:null==e?void 0:e[C]}function F(e){var t;const n=V(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function q(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,P))===P.immutable||"function"==typeof n)}function H(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=V(B(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const o=3===e.parent.type,i=o?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(o&&n.size>i||D(n,i)))return null;t.push(i)}if(e.parent)return H(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=B(3===$(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function $(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function B(e,t){return 2===$(e)?e.get(t):e[t]}function W(e,t,n){2===$(e)?e.set(t,n):e[t]=n}function X(e,t){const n=V(e);return(n?_(n):e)[t]}function K(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function Y(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function Z(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const G=Object.prototype.propertyIsEnumerable;function J(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set)return L(e)?Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values()):new(0,Object.getPrototypeOf(e).constructor)(e.values());if(e instanceof Map)return N(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,P),void 0!==n)&&n!==P.mutable){if(n===P.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{G.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function Q(e){e.copy||(e.copy=J(e.original,e.options))}function ee(e){if(!q(e))return F(e);if(Array.isArray(e))return e.map(ee);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,ee(t)]));return N(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(ee);return L(e)?new Set(t):new(0,Object.getPrototypeOf(e).constructor)(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=ee(e[n]);return t}function te(e){return U(e)?ee(e):e}function ne(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&ne(e.parent))}function re(){throw new Error("Cannot modify frozen object")}function oe(e,t,n,r,o){{n=null!=n?n:new WeakMap,r=null!=r?r:[],o=null!=o?o:[];const i=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(i);if(i&&"object"==typeof i&&-1!==e){if(r[0]===i)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${o.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(i),o.push(t)}else r.push(i)}if(Object.isFrozen(e)||U(e))return r.pop(),void o.pop();switch($(e)){case 2:for(const[t,i]of e)oe(t,t,n,r,o),oe(i,t,n,r,o);e.set=e.clear=e.delete=re;break;case 3:for(const t of e)oe(t,t,n,r,o);e.add=e.clear=e.delete=re;break;case 1:Object.freeze(e);let t=0;for(const i of e)oe(i,t,n,r,o),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{oe(e[t],t,n,r,o)}))}r.pop(),o.pop()}function ie(e,t){const n=$(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function se(e,t,n){if(U(e)||!q(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,o=r?new Map:void 0;if(t.add(e),ie(e,((i,s)=>{var a;if(U(s)){const t=V(s);Q(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;W(r?o:e,i,n)}else se(s,t,n)})),o){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(o.has(e)?o.get(e):e)}))}}function ae(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&se(B(n,t),e.finalities.handledSet,e.options)}function le(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(F(t))})))}function ce(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=H(e);o&&t(e,o,n,r)}e.finalized=!0}}function ue(e,t,n,r){const o=V(n);o&&(o.callbacks||(o.callbacks=[]),o.callbacks.push(((i,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(K(B(l,t),n)){let n=o.original;o.copy&&(n=o.copy),le(e),ce(e,r,i,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,o.original)),W(l,t,n)}})),e.options.enableAutoFreeze&&o.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),q(n,e.options)&&e.finalities.draft.push((()=>{K(B(3===e.type?e.setMap:e.copy,t),n)&&ae(e,t)}))}function pe(e,t,n,r){const{pathAsArray:o=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,o,i,s){n.forEach(((n,a)=>{const l=B(e,a),c=te(B(t,a)),u=n?D(e,a)?S:x:j;if(K(l,c)&&u===S)return;const p=Z(r.concat(a),s);o.push(u===j?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===x?{op:j,path:p}:u===j?{op:x,path:p,value:l}:{op:S,path:p,value:l})}))}(e,t,n,r,o);case 1:return function(e,t,n,r,o){let{original:i,assignedMap:s,options:a}=e,l=e.copy;l.length<i.length&&([i,l]=[l,i],[n,r]=[r,n]);for(let e=0;e<i.length;e+=1)if(s.get(e.toString())&&l[e]!==i[e]){const s=Z(t.concat([e]),o);n.push({op:S,path:s,value:te(l[e])}),r.push({op:S,path:s,value:te(i[e])})}for(let e=i.length;e<l.length;e+=1){const r=Z(t.concat([e]),o);n.push({op:x,path:r,value:te(l[e])})}if(i.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=Z(t.concat(["length"]),o);r.push({op:S,path:e,value:i.length})}else for(let e=l.length;i.length<e;e-=1){const n=Z(t.concat([e-1]),o);r.push({op:j,path:n})}}}(e,t,n,r,o);case 3:return function({original:e,copy:t},n,r,o,i){let s=0;e.forEach((e=>{if(!t.has(e)){const t=Z(n.concat([s]),i);r.push({op:j,path:t,value:e}),o.unshift({op:x,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=Z(n.concat([s]),i);r.push({op:x,path:e,value:t}),o.unshift({op:j,path:e,value:t})}s+=1}))}(e,t,n,r,o)}}const fe=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!q(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},he={get size(){return _(V(this)).size},has(e){return _(V(this)).has(e)},set(e,t){const n=V(this),r=_(n);return r.has(e)&&K(r.get(e),t)||(Q(n),ne(n),n.assignedMap.set(e,!0),n.copy.set(e,t),ue(n,e,t,pe)),this},delete(e){if(!this.has(e))return!1;const t=V(this);return Q(t),ne(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=V(this);if(this.size){Q(e),ne(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){_(V(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=V(this),o=_(r).get(e),i=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,o,P))===P.mutable;if(r.options.strict&&fe(o,r.options,i),i)return o;if(r.finalized||!q(o,r.options))return o;if(o!==r.original.get(e))return o;const s=z.createDraft({original:o,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return Q(r),r.copy.set(e,s),s},keys(){return _(V(this)).keys()},values(){const e=this.keys();return{[A]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[A]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[A](){return this.entries()}},de=Reflect.ownKeys(he),ye=(e,t,{isValuesIterator:n})=>()=>{var r,o;const i=t.next();if(i.done)return i;const s=i.value;let a=e.setMap.get(s);const l=V(a),c=(null===(o=(r=e.options).mark)||void 0===o?void 0:o.call(r,a,P))===P.mutable;if(e.options.strict&&fe(s,e.options,c),c||l||!q(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=z.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},ge={get size(){return V(this).setMap.size},has(e){const t=V(this);if(t.setMap.has(e))return!0;Q(t);const n=V(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=V(this);return this.has(e)||(Q(t),ne(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),ue(t,e,e,pe)),this},delete(e){if(!this.has(e))return!1;const t=V(this);Q(t),ne(t);const n=V(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=V(this);Q(e),ne(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=V(this);Q(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ye(e,t,{isValuesIterator:!0})}},entries(){const e=V(this);Q(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ye(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[A](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(ge,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const ve=Reflect.ownKeys(ge),me=new WeakSet,be={get(e,t,n){var r,o;const i=null===(r=e.copy)||void 0===r?void 0:r[t];if(i&&me.has(i))return i;if(t===C)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,P),s===P.mutable)return e.options.strict&&fe(r,e.options,!0),r}const a=_(e);if(a instanceof Map&&de.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(he,"size").get.call(e.proxy);const n=he[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&ve.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ge,"size").get.call(e.proxy);const n=ge[t];if(n)return n.bind(e.proxy)}if(!D(a,t)){const n=I(a,t);return n?"value"in n?n.value:null===(o=n.get)||void 0===o?void 0:o.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&fe(l,e.options),e.finalized||!q(l,e.options))return l;if(l===X(e.original,t)){if(Q(e),e.copy[t]=we({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=V(e.copy[t]);return Q(n),ne(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let o;if(1===e.type&&"length"!==t&&(!(Number.isInteger(o=Number(t))&&o>=0)||0!==t&&0!==o&&String(o)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const i=I(_(e),t);if(null==i?void 0:i.set)return i.set.call(e.proxy,n),!0;const s=X(_(e),t),a=V(s);return a&&K(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(K(n,s)&&(void 0!==n||D(e.original,t))||(Q(e),ne(e),D(e.original,t)&&K(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,ue(e,t,n,pe)),!0)},has:(e,t)=>t in _(e),ownKeys:e=>Reflect.ownKeys(_(e)),getOwnPropertyDescriptor(e,t){const n=_(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?be.set.call(this,e,t,void 0,e.proxy):(void 0!==X(e.original,t)||t in e.original?(Q(e),ne(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function we(e){const{original:t,parentDraft:n,key:r,finalities:o,options:i}=e,s=$(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:o,options:i,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,be);if(o.revoke.push(c),me.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var o,i;const s=V(l);let a=3===e.type?e.setMap:e.copy;const c=B(a,r),u=V(c);if(u){let i=u.original;u.operated&&(i=F(c)),le(u),ce(u,pe,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(o=e.options.updatedValues)&&void 0!==o?o:new WeakMap,e.options.updatedValues.set(i,u.original)),W(a,r,i)}null===(i=s.callbacks)||void 0===i||i.forEach((e=>{e(t,n)}))}))}else{const e=V(l);e.finalities.draft.push(((t,n)=>{le(e),ce(e,pe,t,n)}))}return l}function Oe(e,t,n,r,o){var i;const s=V(e),a=null!==(i=null==s?void 0:s.original)&&void 0!==i?i:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;)s.finalities.draft.pop()(n,r);const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&Y(s),o&&oe(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:S,path:[],value:t[0]}]:n,r&&l?[{op:S,path:[],value:a}]:r]}function Ee(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:o=!0}=e;ie(n,((n,r,o)=>{const i=V(r);if(i&&t&&i.finalities===t.finalities){e.isContainDraft=!0;const t=i.original;if(o instanceof Set){const e=Array.from(o);o.clear(),e.forEach((e=>o.add(n===e?t:e)))}else W(o,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,Ee(e))})),o&&e.isContainDraft}function Me(e){var t;const n=V(e);if(!q(e,null==n?void 0:n.options))return e;const r=$(e);if(n&&!n.operated)return n.original;let o;function i(){o=2===r?N(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):J(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{i()}finally{n.finalized=!1}}else o=e;if(ie(o,((t,r)=>{if(n&&K(B(n.original,t),r))return;const s=Me(r);s!==r&&(o===e&&i(),W(o,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:o;return L(e)?new Set(o):new(Object.getPrototypeOf(e).constructor)(o)}return o}function ke(e){if(!U(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Me(e)}z.createDraft=we;const Re=function e(t,n,r){var o,i,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...o){return e(r,(e=>t.call(this,e,...o)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},void 0),c);const u=U(a)?ke(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(o=c.enablePatches)&&void 0!==o&&o,h=null!==(i=c.strict)&&void 0!==i&&i,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!q(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let o,i;t.enablePatches&&(o=[],i=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,P))!==P.mutable&&q(e,t)?we({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=Oe(s,e,o,i,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!q(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw Y(V(y)),e}const m=e=>{const t=V(y);if(!U(e)){if(void 0!==e&&!K(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[T];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&Ee({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&Ee({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=V(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([ke(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw Y(V(y)),e})):m(v)};function je(e,t){e.set(Re(e.get(),t))}Object.prototype.constructor.toString();class Se{constructor(e,t=null){this.value=e,this.reactor=t??new k(this,[])}produce(e){return je(this,e)}reducer(...e){let t;return t=1===e.length?new R(this,"",e[0]):new R(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0===e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function xe(e){return new Se(e)}class Ce{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Te{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Ae{constructor(e){this.target=e}set(e){this.target=e.forwardRefs}}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Pe{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=xe(t);return this.data[e]=n,n}get(e){return this.data[e]}}class ze{constructor(e,t={}){this.hasExecuted=!1,this.result=null,this.callback=e,this.dependents=[],this.options=t}onLoad(e){this.hasExecuted?e(this.result):this.dependents.push(e)}execute(){return new Promise(((e,t)=>{if(this.hasExecuted)return e(this.result);this.hasExecuted=!0;const n=async()=>{try{this.result=await this.callback(),e(this.result),this.dependents.forEach((e=>e(this.result)))}catch(e){t(e)}};this.options.idle&&"requestIdleCallback"in window?requestIdleCallback(n):n()}))}}const De=new Map;return e.Pending=class extends n{static tag="r-pending";constructor(){super(),this.asynchronousRender=!0}async setLoader(e){this.loader=e;try{this.result=await this.loader.execute(),this.renderResult()}catch(e){this.error=e,this.renderError()}}renderResult(){if(!this.result)throw"Rumious Render: Cannot find component when lazy loading!";this.element.before(this.render(d(this.result,{}))),this.element.remove()}renderError(){this.element.appendChild(this.render(this.props.errorComponent??this.error))}onRender(){let{loader:e}=this.props;this.setLoader(e)}template(){return this.props.fallback}},e.RumiousApp=class{constructor(e=document.createElement("span"),n={}){this.root=e,this.app=this,this.modules=[],this.configs=n,this.renderContext=new t(this)}render(e){this.renderContext.runHooks("onBeforeRender",this.renderContext),M(e,this.root,this.renderContext),this.renderContext.runHooks("onRendered",this.renderContext)}addModule(e,t={}){return e.init(this,t)}},e.RumiousChildrensRef=Te,e.RumiousComponent=n,e.RumiousComponentElement=b,e.RumiousComponentRef=Ae,e.RumiousContext=Pe,e.RumiousDymanicInjector=O,e.RumiousElementRef=Ce,e.RumiousLazyLoader=ze,e.RumiousReactor=k,e.RumiousReducer=R,e.RumiousState=Se,e.createChildrensRef=function(e){return new Te(e)},e.createComponent=g,e.createComponentElement=w,e.createComponentRef=function(e){return new Ae(e)},e.createContext=function(e="",t={}){if(!t||"object"!=typeof t)throw"Rumious context: Initial value must be object !";return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Pe(t)),window.RUMIOUS_CONTEXTS[e]},e.createDirective=h,e.createElement=d,e.createElementRef=function(e){return new Ce(e)},e.createState=xe,e.createTextElement=y,e.denounce=function(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout((()=>e.apply(this,r)),t)}},e.injectHTML=function(e){let t=new O;return t.commit([{type:"html",value:e}]),t},e.injectText=function(e){let t=new O;return t.commit([{type:"text",value:e}]),t},e.isComponent=r,e.isState=function(e){return e instanceof Se},e.lazyLoad=function(e,t={}){const n=t.key||e.toString();return De.has(n)||De.set(n,new ze(e,t)),De.get(n)},e.leadingTrailingDebounce=function(e,t){let n,r=!0;return function(...o){r&&(e.apply(this,o),r=!1),clearTimeout(n),n=setTimeout((()=>{e.apply(this,o),r=!0}),t)}},e.produceState=je,e.rafThrottle=function(e){let t=!1;return function(...n){t||(t=!0,requestAnimationFrame((()=>{e.apply(this,n),t=!1})))}},e.styleHelper=function(e){let t="";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){t+=`${n} {`;const r=e[n];for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`);t+="} "}return t.trim()},e.tholle=function(e,t){let n=0;return function(...r){const o=Date.now();o-n>=t&&(n=o,e.apply(this,r))}},e.trailingThrottle=function(e,t){let n=0,r=null,o=null;function i(){n=Date.now(),e.apply(this,r),r=null}return function(...e){const s=Date.now();r=e,s-n>=t?i():o||(o=setTimeout((()=>{o=null,i()}),t-(s-n)))}},e.unwatch=function(e,t){e.reactor.removeBinding(t)},e.watch=function(e,t){e.reactor.addBinding(t)},e}({});
package/index.js CHANGED
@@ -1,7 +1,3 @@
1
1
  'use strict';
2
2
 
3
- if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./dist/index.cjs.min.js');
5
- } else {
6
- module.exports = require('./dist/index.cjs.js');
7
- }
3
+ module.exports = require('./dist/index.cjs.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rumious",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "The simple library for build UI",
5
5
  "keywords": [
6
6
  "rumious",
@@ -9,8 +9,8 @@
9
9
  ],
10
10
  "author": "smtdfc",
11
11
  "license": "MIT",
12
- "main": "dist/index.cjs.js",
13
- "module": "dist/index.esm.js",
12
+ "main": "dist/index.cjs.min.js",
13
+ "module": "dist/index.esm.min.js",
14
14
  "unpkg": "dist/index.min.js",
15
15
  "scripts": {
16
16
  "build": "rollup -c rollup.config.mjs"
package/dist/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";class e{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class t{constructor(){this.element=null,this.props={},this.renderContext=new e(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function n(e){return Object.getPrototypeOf(e)===t}class r{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class o{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function i(e){return"function"==typeof e}class s{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){console.warn("Directive haven't handler !")}}class a extends s{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return console.warn(`Missing event handler for event: ${this.name}`),null;const n=t.get(e);if(!i(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!i(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class l extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){if("html"===this.name)e.innerHTML=this.normalizeValue(t)}}class c extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class u extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const p={on:(e,t)=>new a("on",e,t),bind:(e,t)=>new l("bind",e,t),ref:(e,t)=>new c("ref",e,t),childsRef:(e,t)=>new u("childsRef",e,t)};function f(...e){return new r("FRAGMENT",{},h(e))}function h(e){return e.map((e=>"object"==typeof e?e:new r("TEXT_ELEMENT",{nodeValue:e},[])))}window.RUMIOUS_JSX_SUPPORT={createElement:function(e,t,...i){return n(e)?function(e,t,n){return new r("COMPONENT",{component:e,...t},new o(h(n)))}(e,t,i):e===f?f(...i):new r(e,t||{},h(i))},createFragment:f,createDirective:function(e,t,n){return function(e,t,n){return p[e]?.(t,n)}(e,t,n)}};class d extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){}setRef(e){this.ref=e}init(e,t,n={},r){this.instance=new e,this.instance.element=this,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.onCreate(),this.instance.requestRender(),this.instance.forwardRef=this.ref??{}}disconnectCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function y(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends d{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function g(e,t,n,r){const o=function(e,t,n,r){const o=y(e.tag??"r-component");return o.init(e,t,n,r),o}(e.props.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof s&&m(o,e,r)})),t.appendChild(o),t}function v(e,t){const n=document.createElement(e.type);return Object.entries(e.props||{}).forEach((([e,r])=>{e.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(e)?n.addEventListener(e.substring(2).toLowerCase(),r):function(e,t,n,r){e.nodeType===Node.TEXT_NODE?e.nodeValue=n:n instanceof s?m(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}function m(e,t,n){t.init(e,n)}function w(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?g(e,t,w,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>w(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):v(e,n),e.children.forEach((e=>w(e,r,n))),t.appendChild(r),t)}class b{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class O{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const M="remove",E="replace",S="add",j=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),R=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),k=Symbol.iterator,x={mutable:"mutable",immutable:"immutable"},P={};function A(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function C(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function T(e){return Object.getPrototypeOf(e)===Set.prototype}function z(e){return Object.getPrototypeOf(e)===Map.prototype}function D(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function _(e){return!!I(e)}function I(e){return"object"!=typeof e?null:null==e?void 0:e[j]}function N(e){var t;const n=I(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function U(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,x))===x.immutable||"function"==typeof n)}function F(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=I(V(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const o=3===e.parent.type,i=o?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(o&&n.size>i||A(n,i)))return null;t.push(i)}if(e.parent)return F(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=V(3===L(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function L(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function V(e,t){return 2===L(e)?e.get(t):e[t]}function q(e,t,n){2===L(e)?e.set(t,n):e[t]=n}function $(e,t){const n=I(e);return(n?D(n):e)[t]}function X(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function B(e){if(e)for(;e.finalities.revoke.length>0;){e.finalities.revoke.pop()()}}function W(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const K=Object.prototype.propertyIsEnumerable;function H(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!T(e)){return new(0,Object.getPrototypeOf(e).constructor)(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}if(e instanceof Map){if(!z(e)){return new(0,Object.getPrototypeOf(e).constructor)(e)}return new Map(e)}if((null==t?void 0:t.mark)&&(n=t.mark(e,x),void 0!==n)&&n!==x.mutable){if(n===x.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{K.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function Y(e){e.copy||(e.copy=H(e.original,e.options))}function Z(e){if(!U(e))return N(e);if(Array.isArray(e))return e.map(Z);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,Z(t)]));if(!z(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Map(t)}if(e instanceof Set){const t=Array.from(e).map(Z);if(!T(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Set(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=Z(e[n]);return t}function G(e){return _(e)?Z(e):e}function J(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&J(e.parent))}function Q(){throw new Error("Cannot modify frozen object")}function ee(e,t,n,r,o){{n=null!=n?n:new WeakMap,r=null!=r?r:[],o=null!=o?o:[];const i=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(i);if(i&&"object"==typeof i&&-1!==e){if(r[0]===i)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${o.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(i),o.push(t)}else r.push(i)}if(Object.isFrozen(e)||_(e))return r.pop(),void o.pop();switch(L(e)){case 2:for(const[t,i]of e)ee(t,t,n,r,o),ee(i,t,n,r,o);e.set=e.clear=e.delete=Q;break;case 3:for(const t of e)ee(t,t,n,r,o);e.add=e.clear=e.delete=Q;break;case 1:Object.freeze(e);let t=0;for(const i of e)ee(i,t,n,r,o),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{ee(e[t],t,n,r,o)}))}r.pop(),o.pop()}function te(e,t){const n=L(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function ne(e,t,n){if(_(e)||!U(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,o=r?new Map:void 0;if(t.add(e),te(e,((i,s)=>{var a;if(_(s)){const t=I(s);Y(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;q(r?o:e,i,n)}else ne(s,t,n)})),o){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(o.has(e)?o.get(e):e)}))}}function re(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ne(V(n,t),e.finalities.handledSet,e.options)}function oe(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(N(t))})))}function ie(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=F(e);o&&t(e,o,n,r)}e.finalized=!0}}function se(e,t,n,r){const o=I(n);o&&(o.callbacks||(o.callbacks=[]),o.callbacks.push(((i,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(X(V(l,t),n)){let n=o.original;o.copy&&(n=o.copy),oe(e),ie(e,r,i,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,o.original)),q(l,t,n)}})),e.options.enableAutoFreeze&&o.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),U(n,e.options)&&e.finalities.draft.push((()=>{X(V(3===e.type?e.setMap:e.copy,t),n)&&re(e,t)}))}function ae(e,t,n,r){const{pathAsArray:o=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,o,i,s){n.forEach(((n,a)=>{const l=V(e,a),c=G(V(t,a)),u=n?A(e,a)?E:S:M;if(X(l,c)&&u===E)return;const p=W(r.concat(a),s);o.push(u===M?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===S?{op:M,path:p}:u===M?{op:S,path:p,value:l}:{op:E,path:p,value:l})}))}(e,t,n,r,o);case 1:return function(e,t,n,r,o){let{original:i,assignedMap:s,options:a}=e,l=e.copy;l.length<i.length&&([i,l]=[l,i],[n,r]=[r,n]);for(let e=0;e<i.length;e+=1)if(s.get(e.toString())&&l[e]!==i[e]){const s=W(t.concat([e]),o);n.push({op:E,path:s,value:G(l[e])}),r.push({op:E,path:s,value:G(i[e])})}for(let e=i.length;e<l.length;e+=1){const r=W(t.concat([e]),o);n.push({op:S,path:r,value:G(l[e])})}if(i.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=W(t.concat(["length"]),o);r.push({op:E,path:e,value:i.length})}else for(let e=l.length;i.length<e;e-=1){const n=W(t.concat([e-1]),o);r.push({op:M,path:n})}}}(e,t,n,r,o);case 3:return function({original:e,copy:t},n,r,o,i){let s=0;e.forEach((e=>{if(!t.has(e)){const t=W(n.concat([s]),i);r.push({op:M,path:t,value:e}),o.unshift({op:S,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=W(n.concat([s]),i);r.push({op:S,path:e,value:t}),o.unshift({op:M,path:e,value:t})}s+=1}))}(e,t,n,r,o)}}const le=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!U(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},ce={get size(){return D(I(this)).size},has(e){return D(I(this)).has(e)},set(e,t){const n=I(this),r=D(n);return r.has(e)&&X(r.get(e),t)||(Y(n),J(n),n.assignedMap.set(e,!0),n.copy.set(e,t),se(n,e,t,ae)),this},delete(e){if(!this.has(e))return!1;const t=I(this);return Y(t),J(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=I(this);if(this.size){Y(e),J(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){D(I(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=I(this),o=D(r).get(e),i=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,o,x))===x.mutable;if(r.options.strict&&le(o,r.options,i),i)return o;if(r.finalized||!U(o,r.options))return o;if(o!==r.original.get(e))return o;const s=P.createDraft({original:o,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return Y(r),r.copy.set(e,s),s},keys(){return D(I(this)).keys()},values(){const e=this.keys();return{[k]:()=>this.values(),next:()=>{const t=e.next();if(t.done)return t;return{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[k]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[k](){return this.entries()}},ue=Reflect.ownKeys(ce),pe=(e,t,{isValuesIterator:n})=>()=>{var r,o;const i=t.next();if(i.done)return i;const s=i.value;let a=e.setMap.get(s);const l=I(a),c=(null===(o=(r=e.options).mark)||void 0===o?void 0:o.call(r,a,x))===x.mutable;if(e.options.strict&&le(s,e.options,c),c||l||!U(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=P.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},fe={get size(){return I(this).setMap.size},has(e){const t=I(this);if(t.setMap.has(e))return!0;Y(t);const n=I(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=I(this);return this.has(e)||(Y(t),J(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),se(t,e,e,ae)),this},delete(e){if(!this.has(e))return!1;const t=I(this);Y(t),J(t);const n=I(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=I(this);Y(e),J(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=I(this);Y(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:pe(e,t,{isValuesIterator:!0})}},entries(){const e=I(this);Y(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:pe(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[k](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(fe,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const he=Reflect.ownKeys(fe),de=new WeakSet,ye={get(e,t,n){var r,o;const i=null===(r=e.copy)||void 0===r?void 0:r[t];if(i&&de.has(i))return i;if(t===j)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,x),s===x.mutable)return e.options.strict&&le(r,e.options,!0),r}const a=D(e);if(a instanceof Map&&ue.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ce,"size").get.call(e.proxy);const n=ce[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&he.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(fe,"size").get.call(e.proxy);const n=fe[t];if(n)return n.bind(e.proxy)}if(!A(a,t)){const n=C(a,t);return n?"value"in n?n.value:null===(o=n.get)||void 0===o?void 0:o.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&le(l,e.options),e.finalized||!U(l,e.options))return l;if(l===$(e.original,t)){if(Y(e),e.copy[t]=ge({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=I(e.copy[t]);return Y(n),J(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let o;if(1===e.type&&"length"!==t&&(!(Number.isInteger(o=Number(t))&&o>=0)||0!==t&&0!==o&&String(o)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const i=C(D(e),t);if(null==i?void 0:i.set)return i.set.call(e.proxy,n),!0;const s=$(D(e),t),a=I(s);return a&&X(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(X(n,s)&&(void 0!==n||A(e.original,t))||(Y(e),J(e),A(e.original,t)&&X(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,se(e,t,n,ae)),!0)},has:(e,t)=>t in D(e),ownKeys:e=>Reflect.ownKeys(D(e)),getOwnPropertyDescriptor(e,t){const n=D(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?ye.set.call(this,e,t,void 0,e.proxy):(void 0!==$(e.original,t)||t in e.original?(Y(e),J(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function ge(e){const{original:t,parentDraft:n,key:r,finalities:o,options:i}=e,s=L(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:o,options:i,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,ye);if(o.revoke.push(c),de.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var o,i;const s=I(l);let a=3===e.type?e.setMap:e.copy;const c=V(a,r),u=I(c);if(u){let i=u.original;u.operated&&(i=N(c)),oe(u),ie(u,ae,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(o=e.options.updatedValues)&&void 0!==o?o:new WeakMap,e.options.updatedValues.set(i,u.original)),q(a,r,i)}null===(i=s.callbacks)||void 0===i||i.forEach((e=>{e(t,n)}))}))}else{const e=I(l);e.finalities.draft.push(((t,n)=>{oe(e),ie(e,ae,t,n)}))}return l}function ve(e,t,n,r,o){var i;const s=I(e),a=null!==(i=null==s?void 0:s.original)&&void 0!==i?i:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;){s.finalities.draft.pop()(n,r)}const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&B(s),o&&ee(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:E,path:[],value:t[0]}]:n,r&&l?[{op:E,path:[],value:a}]:r]}function me(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:o=!0}=e;te(n,((n,r,o)=>{const i=I(r);if(i&&t&&i.finalities===t.finalities){e.isContainDraft=!0;const t=i.original;if(o instanceof Set){const e=Array.from(o);o.clear(),e.forEach((e=>o.add(n===e?t:e)))}else q(o,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,me(e))})),o&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function we(e){var t;const n=I(e);if(!U(e,null==n?void 0:n.options))return e;const r=L(e);if(n&&!n.operated)return n.original;let o;function i(){o=2===r?z(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):H(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{i()}finally{n.finalized=!1}}else o=e;if(te(o,((t,r)=>{if(n&&X(V(n.original,t),r))return;const s=we(r);s!==r&&(o===e&&i(),q(o,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:o;return T(e)?new Set(o):new(Object.getPrototypeOf(e).constructor)(o)}return o}function be(e){if(!_(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return we(e)}P.createDraft=ge;const Oe=function e(t,n,r){var o,i,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...o){return e(r,(e=>t.call(this,e,...o)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},Me),c);const u=_(a)?be(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(o=c.enablePatches)&&void 0!==o&&o,h=null!==(i=c.strict)&&void 0!==i&&i,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!U(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let o,i;t.enablePatches&&(o=[],i=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,x))!==x.mutable&&U(e,t)?ge({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=ve(s,e,o,i,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!U(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw B(I(y)),e}const m=e=>{const t=I(y);if(!_(e)){if(void 0!==e&&!X(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[R];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&me({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&me({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=I(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([be(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw B(I(y)),e})):m(v)};var Me;Object.prototype.constructor.toString();class Ee{constructor(e,t=null){this.value=e,this.reactor=t??new b(this,[])}produce(e){return n=e,void(t=this).set(Oe(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new O(this,"",e[0]):new O(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function Se(e){return new Ee(e)}class je{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Re{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class ke{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class xe{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=Se(t);return this.data[e]=n,n}get(e){return this.data[e]}}exports.RumiousApp=class{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){w(e,this.root,this.renderContext)}},exports.RumiousChildrensRef=Re,exports.RumiousComponent=t,exports.RumiousComponentElement=d,exports.RumiousComponentRef=ke,exports.RumiousContext=xe,exports.RumiousElementRef=je,exports.RumiousState=Ee,exports.createChildrensRef=function(e){return new Re(e)},exports.createComponentElement=y,exports.createComponentRef=function(e){return new ke(e)},exports.createContext=function(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new xe(t)),window.RUMIOUS_CONTEXTS[e]},exports.createElementRef=function(e){return new je(e)},exports.createState=Se,exports.isComponent=n,exports.isState=function(e){return e instanceof Ee},exports.styleHelper=function(e){let t="";for(const n in e)if(e.hasOwnProperty(n)){t+=`${n} {`;const r=e[n];for(const e in r)if(r.hasOwnProperty(e)){t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`}t+="} "}return t.trim()},exports.unwatch=function(e,t){e.reactor.removeBinding(t)},exports.watch=function(e,t){e.reactor.addBinding(t)};
package/dist/index.esm.js DELETED
@@ -1,2 +0,0 @@
1
- class e{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class t{constructor(){this.element=null,this.props={},this.renderContext=new e(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function n(e){return Object.getPrototypeOf(e)===t}class r{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class i{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function o(e){return"function"==typeof e}class s{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){console.warn("Directive haven't handler !")}}class a extends s{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return console.warn(`Missing event handler for event: ${this.name}`),null;const n=t.get(e);if(!o(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!o(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class l extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){if("html"===this.name)e.innerHTML=this.normalizeValue(t)}}class c extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class u extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const p={on:(e,t)=>new a("on",e,t),bind:(e,t)=>new l("bind",e,t),ref:(e,t)=>new c("ref",e,t),childsRef:(e,t)=>new u("childsRef",e,t)};function f(...e){return new r("FRAGMENT",{},h(e))}function h(e){return e.map((e=>"object"==typeof e?e:new r("TEXT_ELEMENT",{nodeValue:e},[])))}window.RUMIOUS_JSX_SUPPORT={createElement:function(e,t,...o){return n(e)?function(e,t,n){return new r("COMPONENT",{component:e,...t},new i(h(n)))}(e,t,o):e===f?f(...o):new r(e,t||{},h(o))},createFragment:f,createDirective:function(e,t,n){return function(e,t,n){return p[e]?.(t,n)}(e,t,n)}};class d extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){}setRef(e){this.ref=e}init(e,t,n={},r){this.instance=new e,this.instance.element=this,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.onCreate(),this.instance.requestRender(),this.instance.forwardRef=this.ref??{}}disconnectCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function y(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends d{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function g(e,t,n,r){const i=function(e,t,n,r){const i=y(e.tag??"r-component");return i.init(e,t,n,r),i}(e.props.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof s&&b(i,e,r)})),t.appendChild(i),t}function v(e,t){const n=document.createElement(e.type);return Object.entries(e.props||{}).forEach((([e,r])=>{e.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(e)?n.addEventListener(e.substring(2).toLowerCase(),r):function(e,t,n,r){e.nodeType===Node.TEXT_NODE?e.nodeValue=n:n instanceof s?b(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}function b(e,t,n){t.init(e,n)}function w(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?g(e,t,w,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>w(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):v(e,n),e.children.forEach((e=>w(e,r,n))),t.appendChild(r),t)}class m{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){w(e,this.root,this.renderContext)}}function O(e){let t="";for(const n in e)if(e.hasOwnProperty(n)){t+=`${n} {`;const r=e[n];for(const e in r)if(r.hasOwnProperty(e)){t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`}t+="} "}return t.trim()}class M{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class E{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const S="remove",j="replace",k="add",R=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),P=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),A=Symbol.iterator,x={mutable:"mutable",immutable:"immutable"},T={};function z(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function C(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function D(e){return Object.getPrototypeOf(e)===Set.prototype}function _(e){return Object.getPrototypeOf(e)===Map.prototype}function I(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function N(e){return!!U(e)}function U(e){return"object"!=typeof e?null:null==e?void 0:e[R]}function F(e){var t;const n=U(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function L(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,x))===x.immutable||"function"==typeof n)}function V(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=U($(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const i=3===e.parent.type,o=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>o||z(n,o)))return null;t.push(o)}if(e.parent)return V(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=$(3===q(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function q(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function $(e,t){return 2===q(e)?e.get(t):e[t]}function X(e,t,n){2===q(e)?e.set(t,n):e[t]=n}function B(e,t){const n=U(e);return(n?I(n):e)[t]}function W(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function K(e){if(e)for(;e.finalities.revoke.length>0;){e.finalities.revoke.pop()()}}function H(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const Y=Object.prototype.propertyIsEnumerable;function Z(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!D(e)){return new(0,Object.getPrototypeOf(e).constructor)(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}if(e instanceof Map){if(!_(e)){return new(0,Object.getPrototypeOf(e).constructor)(e)}return new Map(e)}if((null==t?void 0:t.mark)&&(n=t.mark(e,x),void 0!==n)&&n!==x.mutable){if(n===x.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{Y.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function G(e){e.copy||(e.copy=Z(e.original,e.options))}function J(e){if(!L(e))return F(e);if(Array.isArray(e))return e.map(J);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,J(t)]));if(!_(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Map(t)}if(e instanceof Set){const t=Array.from(e).map(J);if(!D(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Set(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=J(e[n]);return t}function Q(e){return N(e)?J(e):e}function ee(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&ee(e.parent))}function te(){throw new Error("Cannot modify frozen object")}function ne(e,t,n,r,i){{n=null!=n?n:new WeakMap,r=null!=r?r:[],i=null!=i?i:[];const o=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(o);if(o&&"object"==typeof o&&-1!==e){if(r[0]===o)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${i.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(o),i.push(t)}else r.push(o)}if(Object.isFrozen(e)||N(e))return r.pop(),void i.pop();switch(q(e)){case 2:for(const[t,o]of e)ne(t,t,n,r,i),ne(o,t,n,r,i);e.set=e.clear=e.delete=te;break;case 3:for(const t of e)ne(t,t,n,r,i);e.add=e.clear=e.delete=te;break;case 1:Object.freeze(e);let t=0;for(const o of e)ne(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{ne(e[t],t,n,r,i)}))}r.pop(),i.pop()}function re(e,t){const n=q(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function ie(e,t,n){if(N(e)||!L(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),re(e,((o,s)=>{var a;if(N(s)){const t=U(s);G(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;X(r?i:e,o,n)}else ie(s,t,n)})),i){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(i.has(e)?i.get(e):e)}))}}function oe(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ie($(n,t),e.finalities.handledSet,e.options)}function se(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(F(t))})))}function ae(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=V(e);i&&t(e,i,n,r)}e.finalized=!0}}function le(e,t,n,r){const i=U(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(W($(l,t),n)){let n=i.original;i.copy&&(n=i.copy),se(e),ae(e,r,o,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,i.original)),X(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),L(n,e.options)&&e.finalities.draft.push((()=>{W($(3===e.type?e.setMap:e.copy,t),n)&&oe(e,t)}))}function ce(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,i,o,s){n.forEach(((n,a)=>{const l=$(e,a),c=Q($(t,a)),u=n?z(e,a)?j:k:S;if(W(l,c)&&u===j)return;const p=H(r.concat(a),s);i.push(u===S?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===k?{op:S,path:p}:u===S?{op:k,path:p,value:l}:{op:j,path:p,value:l})}))}(e,t,n,r,i);case 1:return function(e,t,n,r,i){let{original:o,assignedMap:s,options:a}=e,l=e.copy;l.length<o.length&&([o,l]=[l,o],[n,r]=[r,n]);for(let e=0;e<o.length;e+=1)if(s.get(e.toString())&&l[e]!==o[e]){const s=H(t.concat([e]),i);n.push({op:j,path:s,value:Q(l[e])}),r.push({op:j,path:s,value:Q(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=H(t.concat([e]),i);n.push({op:k,path:r,value:Q(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=H(t.concat(["length"]),i);r.push({op:j,path:e,value:o.length})}else for(let e=l.length;o.length<e;e-=1){const n=H(t.concat([e-1]),i);r.push({op:S,path:n})}}}(e,t,n,r,i);case 3:return function({original:e,copy:t},n,r,i,o){let s=0;e.forEach((e=>{if(!t.has(e)){const t=H(n.concat([s]),o);r.push({op:S,path:t,value:e}),i.unshift({op:k,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=H(n.concat([s]),o);r.push({op:k,path:e,value:t}),i.unshift({op:S,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}const ue=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!L(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},pe={get size(){return I(U(this)).size},has(e){return I(U(this)).has(e)},set(e,t){const n=U(this),r=I(n);return r.has(e)&&W(r.get(e),t)||(G(n),ee(n),n.assignedMap.set(e,!0),n.copy.set(e,t),le(n,e,t,ce)),this},delete(e){if(!this.has(e))return!1;const t=U(this);return G(t),ee(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=U(this);if(this.size){G(e),ee(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){I(U(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=U(this),i=I(r).get(e),o=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,i,x))===x.mutable;if(r.options.strict&&ue(i,r.options,o),o)return i;if(r.finalized||!L(i,r.options))return i;if(i!==r.original.get(e))return i;const s=T.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return G(r),r.copy.set(e,s),s},keys(){return I(U(this)).keys()},values(){const e=this.keys();return{[A]:()=>this.values(),next:()=>{const t=e.next();if(t.done)return t;return{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[A]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[A](){return this.entries()}},fe=Reflect.ownKeys(pe),he=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const s=o.value;let a=e.setMap.get(s);const l=U(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,x))===x.mutable;if(e.options.strict&&ue(s,e.options,c),c||l||!L(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=T.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},de={get size(){return U(this).setMap.size},has(e){const t=U(this);if(t.setMap.has(e))return!0;G(t);const n=U(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=U(this);return this.has(e)||(G(t),ee(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),le(t,e,e,ce)),this},delete(e){if(!this.has(e))return!1;const t=U(this);G(t),ee(t);const n=U(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=U(this);G(e),ee(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=U(this);G(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:he(e,t,{isValuesIterator:!0})}},entries(){const e=U(this);G(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:he(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[A](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(de,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const ye=Reflect.ownKeys(de),ge=new WeakSet,ve={get(e,t,n){var r,i;const o=null===(r=e.copy)||void 0===r?void 0:r[t];if(o&&ge.has(o))return o;if(t===R)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,x),s===x.mutable)return e.options.strict&&ue(r,e.options,!0),r}const a=I(e);if(a instanceof Map&&fe.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(pe,"size").get.call(e.proxy);const n=pe[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&ye.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(de,"size").get.call(e.proxy);const n=de[t];if(n)return n.bind(e.proxy)}if(!z(a,t)){const n=C(a,t);return n?"value"in n?n.value:null===(i=n.get)||void 0===i?void 0:i.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&ue(l,e.options),e.finalized||!L(l,e.options))return l;if(l===B(e.original,t)){if(G(e),e.copy[t]=be({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=U(e.copy[t]);return G(n),ee(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let i;if(1===e.type&&"length"!==t&&(!(Number.isInteger(i=Number(t))&&i>=0)||0!==t&&0!==i&&String(i)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const o=C(I(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=B(I(e),t),a=U(s);return a&&W(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(W(n,s)&&(void 0!==n||z(e.original,t))||(G(e),ee(e),z(e.original,t)&&W(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,le(e,t,n,ce)),!0)},has:(e,t)=>t in I(e),ownKeys:e=>Reflect.ownKeys(I(e)),getOwnPropertyDescriptor(e,t){const n=I(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?ve.set.call(this,e,t,void 0,e.proxy):(void 0!==B(e.original,t)||t in e.original?(G(e),ee(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function be(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,s=q(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,ve);if(i.revoke.push(c),ge.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=U(l);let a=3===e.type?e.setMap:e.copy;const c=$(a,r),u=U(c);if(u){let o=u.original;u.operated&&(o=F(c)),se(u),ae(u,ce,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(i=e.options.updatedValues)&&void 0!==i?i:new WeakMap,e.options.updatedValues.set(o,u.original)),X(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=U(l);e.finalities.draft.push(((t,n)=>{se(e),ae(e,ce,t,n)}))}return l}function we(e,t,n,r,i){var o;const s=U(e),a=null!==(o=null==s?void 0:s.original)&&void 0!==o?o:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;){s.finalities.draft.pop()(n,r)}const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&K(s),i&&ne(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:j,path:[],value:t[0]}]:n,r&&l?[{op:j,path:[],value:a}]:r]}function me(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;re(n,((n,r,i)=>{const o=U(r);if(o&&t&&o.finalities===t.finalities){e.isContainDraft=!0;const t=o.original;if(i instanceof Set){const e=Array.from(i);i.clear(),e.forEach((e=>i.add(n===e?t:e)))}else X(i,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,me(e))})),i&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function Oe(e){var t;const n=U(e);if(!L(e,null==n?void 0:n.options))return e;const r=q(e);if(n&&!n.operated)return n.original;let i;function o(){i=2===r?_(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):Z(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(re(i,((t,r)=>{if(n&&W($(n.original,t),r))return;const s=Oe(r);s!==r&&(i===e&&o(),X(i,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:i;return D(e)?new Set(i):new(Object.getPrototypeOf(e).constructor)(i)}return i}function Me(e){if(!N(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Oe(e)}T.createDraft=be;const Ee=function e(t,n,r){var i,o,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...i){return e(r,(e=>t.call(this,e,...i)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},Se),c);const u=N(a)?Me(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(i=c.enablePatches)&&void 0!==i&&i,h=null!==(o=c.strict)&&void 0!==o&&o,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!L(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,x))!==x.mutable&&L(e,t)?be({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=we(s,e,i,o,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!L(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw K(U(y)),e}const b=e=>{const t=U(y);if(!N(e)){if(void 0!==e&&!W(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[P];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&me({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&me({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=U(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([Me(e)])}return g([e])};return v instanceof Promise?v.then(b,(e=>{throw K(U(y)),e})):b(v)};var Se;Object.prototype.constructor.toString();class je{constructor(e,t=null){this.value=e,this.reactor=t??new M(this,[])}produce(e){return n=e,void(t=this).set(Ee(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new E(this,"",e[0]):new E(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function ke(e){return new je(e)}function Re(e){return e instanceof je}function Pe(e,t){e.reactor.addBinding(t)}function Ae(e,t){e.reactor.removeBinding(t)}class xe{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}function Te(e){return new xe(e)}class ze{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}function Ce(e){return new ze(e)}class De{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}function _e(e){return new De(e)}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Ie{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=ke(t);return this.data[e]=n,n}get(e){return this.data[e]}}function Ne(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Ie(t)),window.RUMIOUS_CONTEXTS[e]}export{m as RumiousApp,ze as RumiousChildrensRef,t as RumiousComponent,d as RumiousComponentElement,De as RumiousComponentRef,Ie as RumiousContext,xe as RumiousElementRef,je as RumiousState,Ce as createChildrensRef,y as createComponentElement,_e as createComponentRef,Ne as createContext,Te as createElementRef,ke as createState,n as isComponent,Re as isState,O as styleHelper,Ae as unwatch,Pe as watch};
2
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/render/context.js","../src/component/component.js","../src/dom/element.js","../src/utils/checker.js","../src/render/directives.js","../src/jsx/index.js","../src/component/element.js","../src/render/index.js","../src/component/render.js","../src/app/index.js","../src/component/style.js","../src/state/reactive.js","../src/state/reducer.js","../node_modules/mutative/dist/mutative.esm.mjs","../src/state/state.js","../src/state/produce.js","../src/state/watcher.js","../src/ref/ref.js","../src/ref/childrens.js","../src/ref/component.js","../src/context/context.js"],"sourcesContent":null,"names":["RumiousRenderContext","constructor","target","this","find","name","get","RumiousComponent","element","props","renderContext","renderer","wrapped","prepare","template","requestRender","fragment","document","createDocumentFragment","appendChild","onRender","requestCleanUp","cloned","cloneNode","replaceWith","firstChild","removeChild","onInit","onCreate","onUpdate","onDestroy","isComponent","component","Object","getPrototypeOf","RumiousElement","type","children","RumiousElementList","list","forEach","callback","isFunction","object","RumiousDirective","value","init","console","warn","RumiousEventBindingDirective","dom","fn","getHandler","handler","bind","objectName","addEventListener","RumiousPropsBindingDirective","currentState","reactor","addBinding","currentStateValue","bindAttr","evaluator","normalizeValue","toString","innerHTML","RumiousRefDirective","ref","set","RumiousChildrensRefDirective","directives","on","event","attr","_","childsRef","createFragment","normalizeChildren","map","child","nodeValue","window","RUMIOUS_JSX_SUPPORT","createElement","createComponent","createDirective","registerDirective","RumiousComponentElement","HTMLElement","super","instance","cleanUp","setRef","componentConstructor","connectedCallback","forwardRef","disconnectCallback","createComponentElement","customElements","define","static","HTMLUnknownElement","handleComponentElement","container","render","componentElement","tag","renderComponent","entries","propValue","handleDirective","handleRegularElement","startsWith","test","substring","toLowerCase","nodeType","Node","TEXT_NODE","setAttribute","setElementProps","directive","handleFragmentOrElementList","createTextNode","handleTextElement","RumiousApp","root","configs","styleHelper","styles","css","selector","hasOwnProperty","properties","property","replace","match","trim","RumiousReactor","bindings","react","removeBinding","i","length","splice","push","RumiousReducer","state","path","trigger","args","Operation","PROXY_DRAFT","Symbol","for","RAW_RETURN_SYMBOL","iteratorSymbol","iterator","dataTypes","mutable","immutable","internal","has","key","Map","prototype","call","getDescriptor","Reflect","descriptor","getOwnPropertyDescriptor","isBaseSetInstance","obj","Set","isBaseMapInstance","latest","proxyDraft","_a","copy","undefined","original","isDraft","getProxyDraft","getValue","isDraftable","options","markResult","Array","isArray","mark","getPath","parentCopy","parent","isSet","from","setMap","keys","indexOf","size","reverse","base","index","getType","Error","join","resolvePath","e","peek","isEqual","x","y","revokeProxy","finalities","revoke","pop","escapePath","pathAsArray","concat","_item","item","propIsEnum","propertyIsEnumerable","shallowCopy","SubClass","values","difference","create","ownKeys","desc","enumerable","configurable","writable","defineProperty","strictCopy","enablePatches","enableAutoFreeze","getOwnPropertySymbols","ensureShallowCopy","deepClone","iterable","k","v","cloneIfNeeded","markChanged","assignedMap","operated","throwFrozenError","deepFreeze","subKey","updatedValues","stack","WeakMap","slice","isFrozen","clear","delete","add","freeze","iter","entry","handleValue","handledSet","updatedValue","finalizeAssigned","finalizeSetValue","finalizePatches","generatePatches","patches","inversePatches","finalized","basePath","markFinalization","callbacks","draft","proxyState","assignedValue","originalValue","op","generatePatchesFromAssigned","arrayLengthAssignment","generateArrayPatches","unshift","generateSetPatches","checkReadable","ignoreCheckDraftable","mapHandler","source","thisArg","_value","_key","_b","strict","createDraft","parentDraft","next","result","done","mapHandlerKeys","getNextIterator","isValuesIterator","currentDraft","proxy","setHandler","valueProxyDraft","assign","intersection","other","union","symmetricDifference","isSubsetOf","isSupersetOf","isDisjointFrom","setHandlerKeys","draftsCache","WeakSet","proxyHandler","receiver","includes","handle","Number","subProxyDraft","isInteger","String","current","currentProxyDraft","setPrototypeOf","deleteProperty","createDraftOptions","Proxy","revocable","oldProxyDraft","finalizeDraft","returnedValue","hasReturnedValue","finalize","handleReturnValue","rootDraft","useRawReturn","isRoot","isContainDraft","currentValue","arr","getCurrent","newValue","arg0","arg1","arg2","_c","mutate","arg","types","_options","baseState","finalizedState","finalizedPatches","finalizedInversePatches","draftify","error","returnValue","rawReturnValue","returnedProxyDraft","Promise","then","RumiousState","produce","recipe","reducer","computedObj","setObjectByPath","split","createState","isState","watch","unwatch","RumiousElementRef","html","h","query","q","querySelectorAll","text","textContent","off","removeEventListener","remove","addChild","createElementRef","RumiousChildrensRef","idx","createChildrensRef","RumiousComponentRef","createComponentRef","RUMIOUS_CONTEXTS","RumiousContext","data","events","listener","filter","l","emit","createContext","globalName"],"mappings":"AAAO,MAAMA,EACX,WAAAC,CAAYC,GACVC,KAAKD,OAASA,CAClB,CAEE,IAAAE,CAAKC,GACH,OAAOF,KAAKD,OAAOG,EACvB,CAEE,GAAAC,CAAID,GACF,OAAOF,KAAKD,OAAOG,EACvB,ECTO,MAAME,EACX,WAAAN,GACEE,KAAKK,QAAU,KACfL,KAAKM,MAAQ,CAAE,EACfN,KAAKO,cAAgB,IAAIV,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KAAKD,OAAS8B,CAClB,CAGE,GAAAqC,CAAIrC,GACF7B,KAAKD,OAAS8B,EACdA,EAAU6D,OAAO1F,KACrB,EAGO,SAASqY,GAAmBxW,GACjC,OAAO,IAAIuW,GAAoBvW,EACjC,CCZKkD,OAAOuT,mBACVvT,OAAOuT,iBAAmB,CAAE,GAGvB,MAAMC,GACX,WAAAzY,CAAY0Y,EAAO,IACjBxY,KAAKwY,KAAOA,EACZxY,KAAKyY,OAAS,CAAE,CACpB,CAEE,EAAApU,CAAGC,EAAOoU,GACH1Y,KAAKyY,OAAOnU,KACftE,KAAKyY,OAAOnU,GAAS,IAEvBtE,KAAKyY,OAAOnU,GAAOyE,KAAK2P,EAC5B,CAEE,GAAAd,CAAItT,EAAOoU,GACJ1Y,KAAKyY,OAAOnU,KACjBtE,KAAKyY,OAAOnU,GAAStE,KAAKyY,OAAOnU,GAAOqU,QAAOC,GAAKA,IAAMF,IAC9D,CAEE,IAAAG,CAAKvU,KAAU8E,GACRpJ,KAAKyY,OAAOnU,IACjBtE,KAAKyY,OAAOnU,GAAOjC,SAAQqW,GAAYA,KAAYtP,IACvD,CAEE,GAAAlF,CAAI+F,EAAKvH,GACP,IAAIuG,EAAQ+N,GAAYtU,GAExB,OADA1C,KAAKwY,KAAKvO,GAAOhB,EACVA,CACX,CAEE,GAAA9I,CAAI8J,GACF,OAAOjK,KAAKwY,KAAKvO,EACrB,EAIO,SAAS6O,GAAcC,EAAW,GAAGP,EAAK,CAAA,GAE/C,OADIzT,OAAOuT,iBAAiBS,KAAahU,OAAOuT,iBAAiBS,GAAc,IAAIR,GAAeC,IAC3FzT,OAAOuT,iBAAiBS,EACjC","x_google_ignoreList":[13]}
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- var Rumious=function(e){"use strict";class t{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class n{constructor(){this.element=null,this.props={},this.renderContext=new t(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function r(e){return Object.getPrototypeOf(e)===n}class i{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class o{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function s(e){return"function"==typeof e}class a{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){console.warn("Directive haven't handler !")}}class l extends a{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return console.warn(`Missing event handler for event: ${this.name}`),null;const n=t.get(e);if(!s(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!s(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class c extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){if("html"===this.name)e.innerHTML=this.normalizeValue(t)}}class u extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class p extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const f={on:(e,t)=>new l("on",e,t),bind:(e,t)=>new c("bind",e,t),ref:(e,t)=>new u("ref",e,t),childsRef:(e,t)=>new p("childsRef",e,t)};function h(...e){return new i("FRAGMENT",{},d(e))}function d(e){return e.map((e=>"object"==typeof e?e:new i("TEXT_ELEMENT",{nodeValue:e},[])))}window.RUMIOUS_JSX_SUPPORT={createElement:function(e,t,...n){return r(e)?function(e,t,n){return new i("COMPONENT",{component:e,...t},new o(d(n)))}(e,t,n):e===h?h(...n):new i(e,t||{},d(n))},createFragment:h,createDirective:function(e,t,n){return function(e,t,n){return f[e]?.(t,n)}(e,t,n)}};class y extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}cleanUp(){}setRef(e){this.ref=e}init(e,t,n={},r){this.instance=new e,this.instance.element=this,this.instance.prepare(this,t,n,r),this.instance.onInit()}connectedCallback(){this.instance.onCreate(),this.instance.requestRender(),this.instance.forwardRef=this.ref??{}}disconnectCallback(){this.instance.onDestroy(),this.instance.requestCleanUp(),this.cleanUp()}}function g(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends y{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function v(e,t,n,r){const i=function(e,t,n,r){const i=g(e.tag??"r-component");return i.init(e,t,n,r),i}(e.props.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof a&&w(i,e,r)})),t.appendChild(i),t}function m(e,t){const n=document.createElement(e.type);return Object.entries(e.props||{}).forEach((([e,r])=>{e.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(e)?n.addEventListener(e.substring(2).toLowerCase(),r):function(e,t,n,r){e.nodeType===Node.TEXT_NODE?e.nodeValue=n:n instanceof a?w(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}function w(e,t,n){t.init(e,n)}function b(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?v(e,t,b,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>b(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):m(e,n),e.children.forEach((e=>b(e,r,n))),t.appendChild(r),t)}class O{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}removeBinding(e){for(let t=this.bindings.length-1;t>=0;t--)this.bindings[t]===e&&this.bindings.splice(t,1)}addBinding(e){this.bindings.push(e)}}class M{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const E="remove",S="replace",R="add",j=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),k=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),P=Symbol.iterator,A={mutable:"mutable",immutable:"immutable"},C={};function x(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function T(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function z(e){return Object.getPrototypeOf(e)===Set.prototype}function D(e){return Object.getPrototypeOf(e)===Map.prototype}function _(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function I(e){return!!N(e)}function N(e){return"object"!=typeof e?null:null==e?void 0:e[j]}function U(e){var t;const n=N(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function F(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,A))===A.immutable||"function"==typeof n)}function L(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=N(q(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const i=3===e.parent.type,o=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>o||x(n,o)))return null;t.push(o)}if(e.parent)return L(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=q(3===V(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function V(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function q(e,t){return 2===V(e)?e.get(t):e[t]}function $(e,t,n){2===V(e)?e.set(t,n):e[t]=n}function X(e,t){const n=N(e);return(n?_(n):e)[t]}function B(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){if(e)for(;e.finalities.revoke.length>0;){e.finalities.revoke.pop()()}}function K(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const H=Object.prototype.propertyIsEnumerable;function Y(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!z(e)){return new(0,Object.getPrototypeOf(e).constructor)(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}if(e instanceof Map){if(!D(e)){return new(0,Object.getPrototypeOf(e).constructor)(e)}return new Map(e)}if((null==t?void 0:t.mark)&&(n=t.mark(e,A),void 0!==n)&&n!==A.mutable){if(n===A.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{H.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function Z(e){e.copy||(e.copy=Y(e.original,e.options))}function G(e){if(!F(e))return U(e);if(Array.isArray(e))return e.map(G);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,G(t)]));if(!D(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Map(t)}if(e instanceof Set){const t=Array.from(e).map(G);if(!z(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Set(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=G(e[n]);return t}function J(e){return I(e)?G(e):e}function Q(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&Q(e.parent))}function ee(){throw new Error("Cannot modify frozen object")}function te(e,t,n,r,i){{n=null!=n?n:new WeakMap,r=null!=r?r:[],i=null!=i?i:[];const o=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(o);if(o&&"object"==typeof o&&-1!==e){if(r[0]===o)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${i.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(o),i.push(t)}else r.push(o)}if(Object.isFrozen(e)||I(e))return r.pop(),void i.pop();switch(V(e)){case 2:for(const[t,o]of e)te(t,t,n,r,i),te(o,t,n,r,i);e.set=e.clear=e.delete=ee;break;case 3:for(const t of e)te(t,t,n,r,i);e.add=e.clear=e.delete=ee;break;case 1:Object.freeze(e);let t=0;for(const o of e)te(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{te(e[t],t,n,r,i)}))}r.pop(),i.pop()}function ne(e,t){const n=V(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function re(e,t,n){if(I(e)||!F(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),ne(e,((o,s)=>{var a;if(I(s)){const t=N(s);Z(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;$(r?i:e,o,n)}else re(s,t,n)})),i){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(i.has(e)?i.get(e):e)}))}}function ie(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&re(q(n,t),e.finalities.handledSet,e.options)}function oe(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(U(t))})))}function se(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=L(e);i&&t(e,i,n,r)}e.finalized=!0}}function ae(e,t,n,r){const i=N(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(B(q(l,t),n)){let n=i.original;i.copy&&(n=i.copy),oe(e),se(e,r,o,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,i.original)),$(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),F(n,e.options)&&e.finalities.draft.push((()=>{B(q(3===e.type?e.setMap:e.copy,t),n)&&ie(e,t)}))}function le(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,i,o,s){n.forEach(((n,a)=>{const l=q(e,a),c=J(q(t,a)),u=n?x(e,a)?S:R:E;if(B(l,c)&&u===S)return;const p=K(r.concat(a),s);i.push(u===E?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===R?{op:E,path:p}:u===E?{op:R,path:p,value:l}:{op:S,path:p,value:l})}))}(e,t,n,r,i);case 1:return function(e,t,n,r,i){let{original:o,assignedMap:s,options:a}=e,l=e.copy;l.length<o.length&&([o,l]=[l,o],[n,r]=[r,n]);for(let e=0;e<o.length;e+=1)if(s.get(e.toString())&&l[e]!==o[e]){const s=K(t.concat([e]),i);n.push({op:S,path:s,value:J(l[e])}),r.push({op:S,path:s,value:J(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=K(t.concat([e]),i);n.push({op:R,path:r,value:J(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=K(t.concat(["length"]),i);r.push({op:S,path:e,value:o.length})}else for(let e=l.length;o.length<e;e-=1){const n=K(t.concat([e-1]),i);r.push({op:E,path:n})}}}(e,t,n,r,i);case 3:return function({original:e,copy:t},n,r,i,o){let s=0;e.forEach((e=>{if(!t.has(e)){const t=K(n.concat([s]),o);r.push({op:E,path:t,value:e}),i.unshift({op:R,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=K(n.concat([s]),o);r.push({op:R,path:e,value:t}),i.unshift({op:E,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}const ce=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!F(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},ue={get size(){return _(N(this)).size},has(e){return _(N(this)).has(e)},set(e,t){const n=N(this),r=_(n);return r.has(e)&&B(r.get(e),t)||(Z(n),Q(n),n.assignedMap.set(e,!0),n.copy.set(e,t),ae(n,e,t,le)),this},delete(e){if(!this.has(e))return!1;const t=N(this);return Z(t),Q(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=N(this);if(this.size){Z(e),Q(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){_(N(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=N(this),i=_(r).get(e),o=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,i,A))===A.mutable;if(r.options.strict&&ce(i,r.options,o),o)return i;if(r.finalized||!F(i,r.options))return i;if(i!==r.original.get(e))return i;const s=C.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return Z(r),r.copy.set(e,s),s},keys(){return _(N(this)).keys()},values(){const e=this.keys();return{[P]:()=>this.values(),next:()=>{const t=e.next();if(t.done)return t;return{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[P]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[P](){return this.entries()}},pe=Reflect.ownKeys(ue),fe=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const s=o.value;let a=e.setMap.get(s);const l=N(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,A))===A.mutable;if(e.options.strict&&ce(s,e.options,c),c||l||!F(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=C.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},he={get size(){return N(this).setMap.size},has(e){const t=N(this);if(t.setMap.has(e))return!0;Z(t);const n=N(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=N(this);return this.has(e)||(Z(t),Q(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),ae(t,e,e,le)),this},delete(e){if(!this.has(e))return!1;const t=N(this);Z(t),Q(t);const n=N(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=N(this);Z(e),Q(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=N(this);Z(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:fe(e,t,{isValuesIterator:!0})}},entries(){const e=N(this);Z(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:fe(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[P](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(he,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const de=Reflect.ownKeys(he),ye=new WeakSet,ge={get(e,t,n){var r,i;const o=null===(r=e.copy)||void 0===r?void 0:r[t];if(o&&ye.has(o))return o;if(t===j)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,A),s===A.mutable)return e.options.strict&&ce(r,e.options,!0),r}const a=_(e);if(a instanceof Map&&pe.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ue,"size").get.call(e.proxy);const n=ue[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&de.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(he,"size").get.call(e.proxy);const n=he[t];if(n)return n.bind(e.proxy)}if(!x(a,t)){const n=T(a,t);return n?"value"in n?n.value:null===(i=n.get)||void 0===i?void 0:i.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&ce(l,e.options),e.finalized||!F(l,e.options))return l;if(l===X(e.original,t)){if(Z(e),e.copy[t]=ve({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=N(e.copy[t]);return Z(n),Q(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let i;if(1===e.type&&"length"!==t&&(!(Number.isInteger(i=Number(t))&&i>=0)||0!==t&&0!==i&&String(i)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const o=T(_(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=X(_(e),t),a=N(s);return a&&B(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(B(n,s)&&(void 0!==n||x(e.original,t))||(Z(e),Q(e),x(e.original,t)&&B(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,ae(e,t,n,le)),!0)},has:(e,t)=>t in _(e),ownKeys:e=>Reflect.ownKeys(_(e)),getOwnPropertyDescriptor(e,t){const n=_(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?ge.set.call(this,e,t,void 0,e.proxy):(void 0!==X(e.original,t)||t in e.original?(Z(e),Q(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function ve(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,s=V(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,ge);if(i.revoke.push(c),ye.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=N(l);let a=3===e.type?e.setMap:e.copy;const c=q(a,r),u=N(c);if(u){let o=u.original;u.operated&&(o=U(c)),oe(u),se(u,le,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(i=e.options.updatedValues)&&void 0!==i?i:new WeakMap,e.options.updatedValues.set(o,u.original)),$(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=N(l);e.finalities.draft.push(((t,n)=>{oe(e),se(e,le,t,n)}))}return l}function me(e,t,n,r,i){var o;const s=N(e),a=null!==(o=null==s?void 0:s.original)&&void 0!==o?o:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;){s.finalities.draft.pop()(n,r)}const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&W(s),i&&te(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:S,path:[],value:t[0]}]:n,r&&l?[{op:S,path:[],value:a}]:r]}function we(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;ne(n,((n,r,i)=>{const o=N(r);if(o&&t&&o.finalities===t.finalities){e.isContainDraft=!0;const t=o.original;if(i instanceof Set){const e=Array.from(i);i.clear(),e.forEach((e=>i.add(n===e?t:e)))}else $(i,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,we(e))})),i&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function be(e){var t;const n=N(e);if(!F(e,null==n?void 0:n.options))return e;const r=V(e);if(n&&!n.operated)return n.original;let i;function o(){i=2===r?D(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):Y(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(ne(i,((t,r)=>{if(n&&B(q(n.original,t),r))return;const s=be(r);s!==r&&(i===e&&o(),$(i,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:i;return z(e)?new Set(i):new(Object.getPrototypeOf(e).constructor)(i)}return i}function Oe(e){if(!I(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return be(e)}C.createDraft=ve;const Me=function e(t,n,r){var i,o,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...i){return e(r,(e=>t.call(this,e,...i)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},Ee),c);const u=I(a)?Oe(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(i=c.enablePatches)&&void 0!==i&&i,h=null!==(o=c.strict)&&void 0!==o&&o,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!F(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,A))!==A.mutable&&F(e,t)?ve({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=me(s,e,i,o,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!F(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw W(N(y)),e}const m=e=>{const t=N(y);if(!I(e)){if(void 0!==e&&!B(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[k];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&we({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&we({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=N(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([Oe(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw W(N(y)),e})):m(v)};var Ee;Object.prototype.constructor.toString();class Se{constructor(e,t=null){this.value=e,this.reactor=t??new O(this,[])}produce(e){return n=e,void(t=this).set(Me(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new M(this,"",e[0]):new M(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function Re(e){return new Se(e)}class je{constructor(e){this.target=e}set html(e){this.target.innerHTML=e}query(e){return this.target.querySelectorAll(e)}set text(e){this.target.textContent=e}on(e,t){this.target.addEventListener(e,t)}off(e,t){this.target.removeEventListener(e,t)}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class ke{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Pe{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Ae{constructor(e={}){this.data=e,this.events={}}on(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){this.events[e]&&this.events[e].forEach((e=>e(...t)))}set(e,t){let n=Re(t);return this.data[e]=n,n}get(e){return this.data[e]}}return e.RumiousApp=class{constructor(e=document.createElement("span"),n={}){this.root=e,this.configs=n,this.renderContext=new t(this)}render(e){b(e,this.root,this.renderContext)}},e.RumiousChildrensRef=ke,e.RumiousComponent=n,e.RumiousComponentElement=y,e.RumiousComponentRef=Pe,e.RumiousContext=Ae,e.RumiousElementRef=je,e.RumiousState=Se,e.createChildrensRef=function(e){return new ke(e)},e.createComponentElement=g,e.createComponentRef=function(e){return new Pe(e)},e.createContext=function(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Ae(t)),window.RUMIOUS_CONTEXTS[e]},e.createElementRef=function(e){return new je(e)},e.createState=Re,e.isComponent=r,e.isState=function(e){return e instanceof Se},e.styleHelper=function(e){let t="";for(const n in e)if(e.hasOwnProperty(n)){t+=`${n} {`;const r=e[n];for(const e in r)if(r.hasOwnProperty(e)){t+=`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${r[e]};`}t+="} "}return t.trim()},e.unwatch=function(e,t){e.reactor.removeBinding(t)},e.watch=function(e,t){e.reactor.addBinding(t)},e}({});