rumious 0.0.7 → 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.
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.min.js +1 -1
- package/index.js +1 -5
- package/package.json +3 -3
- package/dist/index.cjs.js +0 -1
- package/dist/index.esm.js +0 -2
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -1
package/dist/index.cjs.min.js
CHANGED
@@ -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{}}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`${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=t.find(this.value.value.objectName);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=t.find(this.value.value.objectName);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,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(){}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 b(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends m{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function w(e,t,n){t.init(e,n)}function O(e,t,n={}){if(!e)return t;let o;return"COMPONENT"===e.type?function(e,t,n,r){const o=function(e,t,n,r){const o=b(e.tag??"r-component");return o.init(e,t,n,r),o}(e.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof s&&w(o,e,r)})),t.appendChild(o),t}(e,t,O,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>O(e,t,n))),t}(e,t,n):(o="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?w(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}(e,n),null===(i=e)||"object"!=typeof i&&"function"!=typeof i?(O(d(e),t,n),t):e instanceof Array?(e.forEach((e=>O(e,t,n))),t):e instanceof r?(e.children.forEach((e=>O(e,o,n))),t.appendChild(o),t):(O(d(JSON.stringify(e)),t,n),t));var i}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 S="remove",j="replace",x="add",R=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),k=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),A=Symbol.iterator,C={mutable:"mutable",immutable:"immutable"},P={};function z(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 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,C))===C.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 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 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)return D(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 _(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,C),void 0!==n)&&n!==C.mutable){if(n===C.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)]));return _(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(J);return D(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]=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,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)||N(e))return r.pop(),void o.pop();switch(q(e)){case 2:for(const[t,i]of e)ne(t,t,n,r,o),ne(i,t,n,r,o);e.set=e.clear=e.delete=te;break;case 3:for(const t of e)ne(t,t,n,r,o);e.add=e.clear=e.delete=te;break;case 1:Object.freeze(e);let t=0;for(const i of e)ne(i,t,n,r,o),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{ne(e[t],t,n,r,o)}))}r.pop(),o.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 oe(e,t,n){if(N(e)||!L(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,o=r?new Map:void 0;if(t.add(e),re(e,((i,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?o:e,i,n)}else oe(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 ie(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&oe($(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 o=V(e);o&&t(e,o,n,r)}e.finalized=!0}}function le(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(W($(l,t),n)){let n=o.original;o.copy&&(n=o.copy),se(e),ae(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)),X(l,t,n)}})),e.options.enableAutoFreeze&&o.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)&&ie(e,t)}))}function ce(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=Q($(t,a)),u=n?z(e,a)?j:x:S;if(W(l,c)&&u===j)return;const p=H(r.concat(a),s);o.push(u===S?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===x?{op:S,path:p}:u===S?{op:x,path:p,value:l}:{op:j,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=H(t.concat([e]),o);n.push({op:j,path:s,value:Q(l[e])}),r.push({op:j,path:s,value:Q(i[e])})}for(let e=i.length;e<l.length;e+=1){const r=H(t.concat([e]),o);n.push({op:x,path:r,value:Q(l[e])})}if(i.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=H(t.concat(["length"]),o);r.push({op:j,path:e,value:i.length})}else for(let e=l.length;i.length<e;e-=1){const n=H(t.concat([e-1]),o);r.push({op:S,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=H(n.concat([s]),i);r.push({op:S,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=H(n.concat([s]),i);r.push({op:x,path:e,value:t}),o.unshift({op:S,path:e,value:t})}s+=1}))}(e,t,n,r,o)}}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),o=I(r).get(e),i=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,o,C))===C.mutable;if(r.options.strict&&ue(o,r.options,i),i)return o;if(r.finalized||!L(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 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();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()}},fe=Reflect.ownKeys(pe),he=(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,C))===C.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=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]}},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,o;const i=null===(r=e.copy)||void 0===r?void 0:r[t];if(i&&ge.has(i))return i;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,C),s===C.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=T(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&&ue(l,e.options),e.finalized||!L(l,e.options))return l;if(l===B(e.original,t)){if(G(e),e.copy[t]=me({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 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=T(I(e),t);if(null==i?void 0:i.set)return i.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 me(e){const{original:t,parentDraft:n,key:r,finalities:o,options:i}=e,s=q(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,ve);if(o.revoke.push(c),ge.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=F(c)),se(u),ae(u,ce,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)),X(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)=>{se(e),ae(e,ce,t,n)}))}return l}function be(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&&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 we(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:o=!0}=e;re(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 X(o,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,we(e))})),o&&e.isContainDraft}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 o;function i(){o=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{i()}finally{n.finalized=!1}}else o=e;if(re(o,((t,r)=>{if(n&&W($(n.original,t),r))return;const s=Oe(r);s!==r&&(o===e&&i(),X(o,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:o;return D(e)?new Set(o):new(Object.getPrototypeOf(e).constructor)(o)}return o}function Ee(e){if(!N(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Oe(e)}P.createDraft=me;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=N(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(!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 o,i;t.enablePatches&&(o=[],i=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,C))!==C.mutable&&L(e,t)?me({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=be(s,e,o,i,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 m=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[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=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)};Object.prototype.constructor.toString();class Se{constructor(e,t=null){this.value=e,this.reactor=t??new E(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 je(e){return new Se(e)}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}}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 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]}}exports.RumiousApp=class{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){O(e,this.root,this.renderContext)}},exports.RumiousChildrensRef=Re,exports.RumiousComponent=t,exports.RumiousComponentElement=m,exports.RumiousComponentRef=ke,exports.RumiousContext=Ae,exports.RumiousElementRef=xe,exports.RumiousState=Se,exports.createChildrensRef=function(e){return new Re(e)},exports.createComponent=y,exports.createComponentElement=b,exports.createComponentRef=function(e){return new ke(e)},exports.createContext=function(e="",t={}){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 xe(e)},exports.createState=je,exports.createTextElement=d,exports.isComponent=n,exports.isState=function(e){return e instanceof Se},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)};
|
package/dist/index.esm.min.js
CHANGED
@@ -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{}}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`${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=t.find(this.value.value.objectName);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=t.find(this.value.value.objectName);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,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 b 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 m(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends b{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function w(e,t,n){t.init(e,n)}function O(e,t,n={}){if(!e)return t;let i;return"COMPONENT"===e.type?function(e,t,n,r){const i=function(e,t,n,r){const i=m(e.tag??"r-component");return i.init(e,t,n,r),i}(e.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof s&&w(i,e,r)})),t.appendChild(i),t}(e,t,O,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>O(e,t,n))),t}(e,t,n):(i="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?w(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}(e,n),null===(o=e)||"object"!=typeof o&&"function"!=typeof o?(O(d(e),t,n),t):e instanceof Array?(e.forEach((e=>O(e,t,n))),t):e instanceof r?(e.children.forEach((e=>O(e,i,n))),t.appendChild(i),t):(O(d(JSON.stringify(e)),t,n),t));var o}class M{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){O(e,this.root,this.renderContext)}}function E(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 S{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 j{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",P="add",A=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),x=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),z=Symbol.iterator,C={mutable:"mutable",immutable:"immutable"},T={};function D(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function _(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 N(e){return Object.getPrototypeOf(e)===Map.prototype}function U(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function F(e){return!!L(e)}function L(e){return"object"!=typeof e?null:null==e?void 0:e[A]}function V(e){var t;const n=L(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,C))===C.immutable||"function"==typeof n)}function $(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=L(B(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||D(n,o)))return null;t.push(o)}if(e.parent)return $(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===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 B(e,t){return 2===X(e)?e.get(t):e[t]}function W(e,t,n){2===X(e)?e.set(t,n):e[t]=n}function K(e,t){const n=L(e);return(n?U(n):e)[t]}function H(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 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 N(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,C),void 0!==n)&&n!==C.mutable){if(n===C.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 V(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 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]=ee(e[n]);return t}function te(e){return F(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 ie(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)||F(e))return r.pop(),void i.pop();switch(X(e)){case 2:for(const[t,o]of e)ie(t,t,n,r,i),ie(o,t,n,r,i);e.set=e.clear=e.delete=re;break;case 3:for(const t of e)ie(t,t,n,r,i);e.add=e.clear=e.delete=re;break;case 1:Object.freeze(e);let t=0;for(const o of e)ie(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{ie(e[t],t,n,r,i)}))}r.pop(),i.pop()}function oe(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 se(e,t,n){if(F(e)||!q(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),oe(e,((o,s)=>{var a;if(F(s)){const t=L(s);Q(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;W(r?i:e,o,n)}else se(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 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(V(t))})))}function ce(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=$(e);i&&t(e,i,n,r)}e.finalized=!0}}function ue(e,t,n,r){const i=L(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(H(B(l,t),n)){let n=i.original;i.copy&&(n=i.copy),le(e),ce(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)),W(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),q(n,e.options)&&e.finalities.draft.push((()=>{H(B(3===e.type?e.setMap:e.copy,t),n)&&ae(e,t)}))}function pe(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=B(e,a),c=te(B(t,a)),u=n?D(e,a)?R:P:k;if(H(l,c)&&u===R)return;const p=Z(r.concat(a),s);i.push(u===k?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===P?{op:k,path:p}:u===k?{op:P,path:p,value:l}:{op:R,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=Z(t.concat([e]),i);n.push({op:R,path:s,value:te(l[e])}),r.push({op:R,path:s,value:te(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=Z(t.concat([e]),i);n.push({op:P,path:r,value:te(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=Z(t.concat(["length"]),i);r.push({op:R,path:e,value:o.length})}else for(let e=l.length;o.length<e;e-=1){const n=Z(t.concat([e-1]),i);r.push({op:k,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=Z(n.concat([s]),o);r.push({op:k,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=Z(n.concat([s]),o);r.push({op:P,path:e,value:t}),i.unshift({op:k,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}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 U(L(this)).size},has(e){return U(L(this)).has(e)},set(e,t){const n=L(this),r=U(n);return r.has(e)&&H(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=L(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=L(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){U(L(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=L(this),i=U(r).get(e),o=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,i,C))===C.mutable;if(r.options.strict&&fe(i,r.options,o),o)return i;if(r.finalized||!q(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 Q(r),r.copy.set(e,s),s},keys(){return U(L(this)).keys()},values(){const e=this.keys();return{[z]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[z]:()=>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]}}}},[z](){return this.entries()}},de=Reflect.ownKeys(he),ye=(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=L(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,C))===C.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=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]}},ge={get size(){return L(this).setMap.size},has(e){const t=L(this);if(t.setMap.has(e))return!0;Q(t);const n=L(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=L(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=L(this);Q(t),ne(t);const n=L(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=L(this);Q(e),ne(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=L(this);Q(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ye(e,t,{isValuesIterator:!0})}},entries(){const e=L(this);Q(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ye(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[z](){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),be=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&&be.has(o))return o;if(t===A)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,C),s===C.mutable)return e.options.strict&&fe(r,e.options,!0),r}const a=U(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=_(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&&fe(l,e.options),e.finalized||!q(l,e.options))return l;if(l===K(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=L(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 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=_(U(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=K(U(e),t),a=L(s);return a&&H(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):(H(n,s)&&(void 0!==n||D(e.original,t))||(Q(e),ne(e),D(e.original,t)&&H(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 U(e),ownKeys:e=>Reflect.ownKeys(U(e)),getOwnPropertyDescriptor(e,t){const n=U(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!==K(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: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),be.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=L(l);let a=3===e.type?e.setMap:e.copy;const c=B(a,r),u=L(c);if(u){let o=u.original;u.operated&&(o=V(c)),le(u),ce(u,pe,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)),W(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=L(l);e.finalities.draft.push(((t,n)=>{le(e),ce(e,pe,t,n)}))}return l}function Oe(e,t,n,r,i){var o;const s=L(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&&Y(s),i&&ie(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 Me(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;oe(n,((n,r,i)=>{const o=L(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 W(i,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,Me(e))})),i&&e.isContainDraft}function Ee(e){var t;const n=L(e);if(!q(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?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{o()}finally{n.finalized=!1}}else i=e;if(oe(i,((t,r)=>{if(n&&H(B(n.original,t),r))return;const s=Ee(r);s!==r&&(i===e&&o(),W(i,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:i;return I(e)?new Set(i):new(Object.getPrototypeOf(e).constructor)(i)}return i}function Se(e){if(!F(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Ee(e)}T.createDraft=we;const je=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=F(a)?Se(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(!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 i,o;t.enablePatches&&(i=[],o=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,C))!==C.mutable&&q(e,t)?we({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=Oe(s,e,i,o,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(L(y)),e}const b=e=>{const t=L(y);if(!F(e)){if(void 0!==e&&!H(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[x];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=L(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([Se(e)])}return g([e])};return v instanceof Promise?v.then(b,(e=>{throw Y(L(y)),e})):b(v)};Object.prototype.constructor.toString();class ke{constructor(e,t=null){this.value=e,this.reactor=t??new S(this,[])}produce(e){return n=e,void(t=this).set(je(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new j(this,"",e[0]):new j(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 ke(e)}function Pe(e){return e instanceof ke}function Ae(e,t){e.reactor.addBinding(t)}function xe(e,t){e.reactor.removeBinding(t)}class ze{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 Ce(e){return new ze(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}}function De(e){return new Te(e)}class _e{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}function Ie(e){return new _e(e)}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Ne{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]}}function Ue(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Ne(t)),window.RUMIOUS_CONTEXTS[e]}export{M as RumiousApp,Te as RumiousChildrensRef,t as RumiousComponent,b as RumiousComponentElement,_e as RumiousComponentRef,Ne as RumiousContext,ze as RumiousElementRef,ke as RumiousState,De as createChildrensRef,y as createComponent,m as createComponentElement,Ie as createComponentRef,Ue as createContext,f as createDirective,h as createElement,Ce as createElementRef,Re as createState,d as createTextElement,n as isComponent,Pe as isState,E as styleHelper,xe as unwatch,Ae 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{}}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 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=t.find(this.value.value.objectName);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=t.find(this.value.value.objectName);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,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 i(e,t||{},m(n))}function y(e){return new i("TEXT_ELEMENT",{nodeValue:e},[])}function g(e,t,n){let r=new i("COMPONENT",{...t},new o(m(n)));return r.component=e,r}function v(...e){return new i("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(){}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 w(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends b{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function O(e,t,n){t.init(e,n)}function E(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=w(e.tag??"r-component");return i.init(e,t,n,r),i}(e.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof a&&O(i,e,r)})),t.appendChild(i),t}(e,t,E,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>E(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?O(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}(e,n),null===(o=e)||"object"!=typeof o&&"function"!=typeof o?(E(y(e),t,n),t):e instanceof Array?(e.forEach((e=>E(e,t,n))),t):e instanceof i?(e.children.forEach((e=>E(e,r,n))),t.appendChild(r),t):(E(y(JSON.stringify(e)),t,n),t));var o}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 S{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",R="replace",k="add",A=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),C=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),P=Symbol.iterator,x={mutable:"mutable",immutable:"immutable"},z={};function T(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 _(e){return Object.getPrototypeOf(e)===Set.prototype}function I(e){return Object.getPrototypeOf(e)===Map.prototype}function N(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function U(e){return!!F(e)}function F(e){return"object"!=typeof e?null:null==e?void 0:e[A]}function L(e){var t;const n=F(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function V(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 q(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=F(X(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||T(n,o)))return null;t.push(o)}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=X(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 X(e,t){return 2===$(e)?e.get(t):e[t]}function B(e,t,n){2===$(e)?e.set(t,n):e[t]=n}function W(e,t){const n=F(e);return(n?N(n):e)[t]}function K(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function H(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 _(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 I(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(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=>{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(!V(e))return L(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 I(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(Q);return _(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 U(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,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)||U(e))return r.pop(),void i.pop();switch($(e)){case 2:for(const[t,o]of e)re(t,t,n,r,i),re(o,t,n,r,i);e.set=e.clear=e.delete=ne;break;case 3:for(const t of e)re(t,t,n,r,i);e.add=e.clear=e.delete=ne;break;case 1:Object.freeze(e);let t=0;for(const o of e)re(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{re(e[t],t,n,r,i)}))}r.pop(),i.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 oe(e,t,n){if(U(e)||!V(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),ie(e,((o,s)=>{var a;if(U(s)){const t=F(s);J(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;B(r?i:e,o,n)}else oe(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 se(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&oe(X(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(L(t))})))}function le(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=q(e);i&&t(e,i,n,r)}e.finalized=!0}}function ce(e,t,n,r){const i=F(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(K(X(l,t),n)){let n=i.original;i.copy&&(n=i.copy),ae(e),le(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)),B(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),V(n,e.options)&&e.finalities.draft.push((()=>{K(X(3===e.type?e.setMap:e.copy,t),n)&&se(e,t)}))}function ue(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=X(e,a),c=ee(X(t,a)),u=n?T(e,a)?R:k:j;if(K(l,c)&&u===R)return;const p=Y(r.concat(a),s);i.push(u===j?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===k?{op:j,path:p}:u===j?{op:k,path:p,value:l}:{op:R,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=Y(t.concat([e]),i);n.push({op:R,path:s,value:ee(l[e])}),r.push({op:R,path:s,value:ee(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=Y(t.concat([e]),i);n.push({op:k,path:r,value:ee(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=Y(t.concat(["length"]),i);r.push({op:R,path:e,value:o.length})}else for(let e=l.length;o.length<e;e-=1){const n=Y(t.concat([e-1]),i);r.push({op:j,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=Y(n.concat([s]),o);r.push({op:j,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=Y(n.concat([s]),o);r.push({op:k,path:e,value:t}),i.unshift({op:j,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}const pe=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!V(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},fe={get size(){return N(F(this)).size},has(e){return N(F(this)).has(e)},set(e,t){const n=F(this),r=N(n);return r.has(e)&&K(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=F(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=F(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(F(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=F(this),i=N(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&&pe(i,r.options,o),o)return i;if(r.finalized||!V(i,r.options))return i;if(i!==r.original.get(e))return i;const s=z.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return J(r),r.copy.set(e,s),s},keys(){return N(F(this)).keys()},values(){const e=this.keys();return{[P]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{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()}},he=Reflect.ownKeys(fe),de=(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=F(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,x))===x.mutable;if(e.options.strict&&pe(s,e.options,c),c||l||!V(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]}},ye={get size(){return F(this).setMap.size},has(e){const t=F(this);if(t.setMap.has(e))return!0;J(t);const n=F(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=F(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=F(this);J(t),te(t);const n=F(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=F(this);J(e),te(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=F(this);J(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:de(e,t,{isValuesIterator:!0})}},entries(){const e=F(this);J(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:de(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(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,i;const o=null===(r=e.copy)||void 0===r?void 0:r[t];if(o&&ve.has(o))return o;if(t===A)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&&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(!T(a,t)){const n=D(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&&pe(l,e.options),e.finalized||!V(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=F(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 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=D(N(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=W(N(e),t),a=F(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||T(e.original,t))||(J(e),te(e),T(e.original,t)&&K(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:i,options:o}=e,s=$(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),ve.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=F(l);let a=3===e.type?e.setMap:e.copy;const c=X(a,r),u=F(c);if(u){let o=u.original;u.operated&&(o=L(c)),ae(u),le(u,ue,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)),B(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=F(l);e.finalities.draft.push(((t,n)=>{ae(e),le(e,ue,t,n)}))}return l}function we(e,t,n,r,i){var o;const s=F(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&&H(s),i&&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:i=!0}=e;ie(n,((n,r,i)=>{const o=F(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 B(i,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,Oe(e))})),i&&e.isContainDraft}function Ee(e){var t;const n=F(e);if(!V(e,null==n?void 0:n.options))return e;const r=$(e);if(n&&!n.operated)return n.original;let i;function o(){i=2===r?I(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{o()}finally{n.finalized=!1}}else i=e;if(ie(i,((t,r)=>{if(n&&K(X(n.original,t),r))return;const s=Ee(r);s!==r&&(i===e&&o(),B(i,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:i;return _(e)?new Set(i):new(Object.getPrototypeOf(e).constructor)(i)}return i}function Me(e){if(!U(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Ee(e)}z.createDraft=be;const Se=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=U(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(!V(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&&V(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(!V(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 H(F(y)),e}const m=e=>{const t=F(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[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=F(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 H(F(y)),e})):m(v)};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(Se(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new S(this,"",e[0]):new S(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 je(e)}class ke{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 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}}class Ce{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}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=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){E(e,this.root,this.renderContext)}},e.RumiousChildrensRef=Ae,e.RumiousComponent=n,e.RumiousComponentElement=b,e.RumiousComponentRef=Ce,e.RumiousContext=Pe,e.RumiousElementRef=ke,e.RumiousState=je,e.createChildrensRef=function(e){return new Ae(e)},e.createComponent=g,e.createComponentElement=w,e.createComponentRef=function(e){return new Ce(e)},e.createContext=function(e="",t={}){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 ke(e)},e.createState=Re,e.createTextElement=y,e.isComponent=r,e.isState=function(e){return e instanceof je},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
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rumious",
|
3
|
-
"version": "0.0.
|
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{}}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(){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=t.find(this.value.value.objectName);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=t.find(this.value.value.objectName);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,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(){}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 b(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends m{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function w(e,t,n,r){const o=function(e,t,n,r){const o=b(e.tag??"r-component");return o.init(e,t,n,r),o}(e.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof s&&E(o,e,r)})),t.appendChild(o),t}function O(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?E(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}function E(e,t,n){t.init(e,n)}function M(e,t,n={}){if(!e)return t;let o;return"COMPONENT"===e.type?w(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):(o="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):O(e,n),null===(i=e)||"object"!=typeof i&&"function"!=typeof i?(M(d(e),t,n),t):e instanceof Array?(e.forEach((e=>M(e,t,n))),t):e instanceof r?(e.children.forEach((e=>M(e,o,n))),t.appendChild(o),t):(M(d(JSON.stringify(e)),t,n),t));var i}class S{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 j{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 x="remove",R="replace",k="add",A=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),C=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),P=Symbol.iterator,T={mutable:"mutable",immutable:"immutable"},z={};function D(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function _(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 N(e){return Object.getPrototypeOf(e)===Map.prototype}function U(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function F(e){return!!L(e)}function L(e){return"object"!=typeof e?null:null==e?void 0:e[A]}function V(e){var t;const n=L(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,T))===T.immutable||"function"==typeof n)}function $(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=L(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 $(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===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 B(e,t){return 2===X(e)?e.get(t):e[t]}function W(e,t,n){2===X(e)?e.set(t,n):e[t]=n}function K(e,t){const n=L(e);return(n?U(n):e)[t]}function H(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){if(!I(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(!N(e)){return new(0,Object.getPrototypeOf(e).constructor)(e)}return new Map(e)}if((null==t?void 0:t.mark)&&(n=t.mark(e,T),void 0!==n)&&n!==T.mutable){if(n===T.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 V(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)]));if(!N(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Map(t)}if(e instanceof Set){const t=Array.from(e).map(ee);if(!I(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]=ee(e[n]);return t}function te(e){return F(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)||F(e))return r.pop(),void o.pop();switch(X(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=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 se(e,t,n){if(F(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(F(s)){const t=L(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(V(t))})))}function ce(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=$(e);o&&t(e,o,n,r)}e.finalized=!0}}function ue(e,t,n,r){const o=L(n);o&&(o.callbacks||(o.callbacks=[]),o.callbacks.push(((i,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(H(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((()=>{H(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)?R:k:x;if(H(l,c)&&u===R)return;const p=Z(r.concat(a),s);o.push(u===x?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===k?{op:x,path:p}:u===x?{op:k,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=Z(t.concat([e]),o);n.push({op:R,path:s,value:te(l[e])}),r.push({op:R,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:k,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:R,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:x,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:x,path:t,value:e}),o.unshift({op:k,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:k,path:e,value:t}),o.unshift({op:x,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 U(L(this)).size},has(e){return U(L(this)).has(e)},set(e,t){const n=L(this),r=U(n);return r.has(e)&&H(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=L(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=L(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){U(L(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=L(this),o=U(r).get(e),i=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,o,T))===T.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 U(L(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()}},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=L(a),c=(null===(o=(r=e.options).mark)||void 0===o?void 0:o.call(r,a,T))===T.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 L(this).setMap.size},has(e){const t=L(this);if(t.setMap.has(e))return!0;Q(t);const n=L(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=L(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=L(this);Q(t),ne(t);const n=L(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=L(this);Q(e),ne(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=L(this);Q(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ye(e,t,{isValuesIterator:!0})}},entries(){const e=L(this);Q(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ye(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(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===A)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,T),s===T.mutable)return e.options.strict&&fe(r,e.options,!0),r}const a=U(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=_(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===K(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=L(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=_(U(e),t);if(null==i?void 0:i.set)return i.set.call(e.proxy,n),!0;const s=K(U(e),t),a=L(s);return a&&H(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):(H(n,s)&&(void 0!==n||D(e.original,t))||(Q(e),ne(e),D(e.original,t)&&H(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 U(e),ownKeys:e=>Reflect.ownKeys(U(e)),getOwnPropertyDescriptor(e,t){const n=U(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!==K(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=X(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=L(l);let a=3===e.type?e.setMap:e.copy;const c=B(a,r),u=L(c);if(u){let i=u.original;u.operated&&(i=V(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=L(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=L(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:R,path:[],value:t[0]}]:n,r&&l?[{op:R,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=L(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||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 Me(e){var t;const n=L(e);if(!q(e,null==n?void 0:n.options))return e;const r=X(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&&H(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 I(e)?new Set(o):new(Object.getPrototypeOf(e).constructor)(o)}return o}function Se(e){if(!F(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Me(e)}z.createDraft=we;const je=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({},xe),c);const u=F(a)?Se(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,T))!==T.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(L(y)),e}const m=e=>{const t=L(y);if(!F(e)){if(void 0!==e&&!H(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&&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=L(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([Se(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw Y(L(y)),e})):m(v)};var xe;Object.prototype.constructor.toString();class Re{constructor(e,t=null){this.value=e,this.reactor=t??new S(this,[])}produce(e){return n=e,void(t=this).set(je(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new j(this,"",e[0]):new j(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 Re(e)}class Ae{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 Pe{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}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=ke(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){M(e,this.root,this.renderContext)}},exports.RumiousChildrensRef=Ce,exports.RumiousComponent=t,exports.RumiousComponentElement=m,exports.RumiousComponentRef=Pe,exports.RumiousContext=Te,exports.RumiousElementRef=Ae,exports.RumiousState=Re,exports.createChildrensRef=function(e){return new Ce(e)},exports.createComponent=y,exports.createComponentElement=b,exports.createComponentRef=function(e){return new Pe(e)},exports.createContext=function(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Te(t)),window.RUMIOUS_CONTEXTS[e]},exports.createDirective=f,exports.createElement=h,exports.createElementRef=function(e){return new Ae(e)},exports.createState=ke,exports.createTextElement=d,exports.isComponent=n,exports.isState=function(e){return e instanceof Re},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{}}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(){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=t.find(this.value.value.objectName);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=t.find(this.value.value.objectName);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,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 b 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 m(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends b{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function w(e,t,n,r){const i=function(e,t,n,r){const i=m(e.tag??"r-component");return i.init(e,t,n,r),i}(e.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof s&&M(i,e,r)})),t.appendChild(i),t}function O(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 E(e,t,n={}){if(!e)return t;let i;return"COMPONENT"===e.type?w(e,t,E,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>E(e,t,n))),t}(e,t,n):(i="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):O(e,n),null===(o=e)||"object"!=typeof o&&"function"!=typeof o?(E(d(e),t,n),t):e instanceof Array?(e.forEach((e=>E(e,t,n))),t):e instanceof r?(e.children.forEach((e=>E(e,i,n))),t.appendChild(i),t):(E(d(JSON.stringify(e)),t,n),t));var o}class S{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){E(e,this.root,this.renderContext)}}function j(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 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 P="remove",A="replace",x="add",T=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),z=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),C=Symbol.iterator,D={mutable:"mutable",immutable:"immutable"},_={};function I(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function N(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 F(e){return Object.getPrototypeOf(e)===Map.prototype}function L(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function V(e){return!!q(e)}function q(e){return"object"!=typeof e?null:null==e?void 0:e[T]}function $(e){var t;const n=q(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function X(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,D))===D.immutable||"function"==typeof n)}function B(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=q(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||I(n,o)))return null;t.push(o)}if(e.parent)return B(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===W(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 W(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function K(e,t){return 2===W(e)?e.get(t):e[t]}function H(e,t,n){2===W(e)?e.set(t,n):e[t]=n}function Y(e,t){const n=q(e);return(n?L(n):e)[t]}function Z(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function G(e){if(e)for(;e.finalities.revoke.length>0;){e.finalities.revoke.pop()()}}function J(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 Q=Object.prototype.propertyIsEnumerable;function ee(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!U(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(!F(e)){return new(0,Object.getPrototypeOf(e).constructor)(e)}return new Map(e)}if((null==t?void 0:t.mark)&&(n=t.mark(e,D),void 0!==n)&&n!==D.mutable){if(n===D.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=>{Q.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 te(e){e.copy||(e.copy=ee(e.original,e.options))}function ne(e){if(!X(e))return $(e);if(Array.isArray(e))return e.map(ne);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,ne(t)]));if(!F(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Map(t)}if(e instanceof Set){const t=Array.from(e).map(ne);if(!U(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]=ne(e[n]);return t}function re(e){return V(e)?ne(e):e}function ie(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&ie(e.parent))}function oe(){throw new Error("Cannot modify frozen object")}function se(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)||V(e))return r.pop(),void i.pop();switch(W(e)){case 2:for(const[t,o]of e)se(t,t,n,r,i),se(o,t,n,r,i);e.set=e.clear=e.delete=oe;break;case 3:for(const t of e)se(t,t,n,r,i);e.add=e.clear=e.delete=oe;break;case 1:Object.freeze(e);let t=0;for(const o of e)se(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{se(e[t],t,n,r,i)}))}r.pop(),i.pop()}function ae(e,t){const n=W(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 le(e,t,n){if(V(e)||!X(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),ae(e,((o,s)=>{var a;if(V(s)){const t=q(s);te(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;H(r?i:e,o,n)}else le(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 ce(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&le(K(n,t),e.finalities.handledSet,e.options)}function ue(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add($(t))})))}function pe(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=B(e);i&&t(e,i,n,r)}e.finalized=!0}}function fe(e,t,n,r){const i=q(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(Z(K(l,t),n)){let n=i.original;i.copy&&(n=i.copy),ue(e),pe(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)),H(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),X(n,e.options)&&e.finalities.draft.push((()=>{Z(K(3===e.type?e.setMap:e.copy,t),n)&&ce(e,t)}))}function he(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=re(K(t,a)),u=n?I(e,a)?A:x:P;if(Z(l,c)&&u===A)return;const p=J(r.concat(a),s);i.push(u===P?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===x?{op:P,path:p}:u===P?{op:x,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=J(t.concat([e]),i);n.push({op:A,path:s,value:re(l[e])}),r.push({op:A,path:s,value:re(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=J(t.concat([e]),i);n.push({op:x,path:r,value:re(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=J(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=J(t.concat([e-1]),i);r.push({op:P,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=J(n.concat([s]),o);r.push({op:P,path:t,value:e}),i.unshift({op:x,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=J(n.concat([s]),o);r.push({op:x,path:e,value:t}),i.unshift({op:P,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}const de=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!X(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},ye={get size(){return L(q(this)).size},has(e){return L(q(this)).has(e)},set(e,t){const n=q(this),r=L(n);return r.has(e)&&Z(r.get(e),t)||(te(n),ie(n),n.assignedMap.set(e,!0),n.copy.set(e,t),fe(n,e,t,he)),this},delete(e){if(!this.has(e))return!1;const t=q(this);return te(t),ie(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=q(this);if(this.size){te(e),ie(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){L(q(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=q(this),i=L(r).get(e),o=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,i,D))===D.mutable;if(r.options.strict&&de(i,r.options,o),o)return i;if(r.finalized||!X(i,r.options))return i;if(i!==r.original.get(e))return i;const s=_.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return te(r),r.copy.set(e,s),s},keys(){return L(q(this)).keys()},values(){const e=this.keys();return{[C]:()=>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{[C]:()=>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]}}}},[C](){return this.entries()}},ge=Reflect.ownKeys(ye),ve=(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=q(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,D))===D.mutable;if(e.options.strict&&de(s,e.options,c),c||l||!X(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const 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]}},be={get size(){return q(this).setMap.size},has(e){const t=q(this);if(t.setMap.has(e))return!0;te(t);const n=q(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=q(this);return this.has(e)||(te(t),ie(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),fe(t,e,e,he)),this},delete(e){if(!this.has(e))return!1;const t=q(this);te(t),ie(t);const n=q(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=q(this);te(e),ie(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=q(this);te(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ve(e,t,{isValuesIterator:!0})}},entries(){const e=q(this);te(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ve(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[C](){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 me=Reflect.ownKeys(be),we=new WeakSet,Oe={get(e,t,n){var r,i;const o=null===(r=e.copy)||void 0===r?void 0:r[t];if(o&&we.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,D),s===D.mutable)return e.options.strict&&de(r,e.options,!0),r}const a=L(e);if(a instanceof Map&&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(a instanceof Set&&me.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(!I(a,t)){const n=N(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&&de(l,e.options),e.finalized||!X(l,e.options))return l;if(l===Y(e.original,t)){if(te(e),e.copy[t]=Me({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=q(e.copy[t]);return te(n),ie(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=N(L(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=Y(L(e),t),a=q(s);return a&&Z(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):(Z(n,s)&&(void 0!==n||I(e.original,t))||(te(e),ie(e),I(e.original,t)&&Z(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,fe(e,t,n,he)),!0)},has:(e,t)=>t in L(e),ownKeys:e=>Reflect.ownKeys(L(e)),getOwnPropertyDescriptor(e,t){const n=L(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?Oe.set.call(this,e,t,void 0,e.proxy):(void 0!==Y(e.original,t)||t in e.original?(te(e),ie(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 Me(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,s=W(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,Oe);if(i.revoke.push(c),we.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=q(l);let a=3===e.type?e.setMap:e.copy;const c=K(a,r),u=q(c);if(u){let o=u.original;u.operated&&(o=$(c)),ue(u),pe(u,he,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)),H(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=q(l);e.finalities.draft.push(((t,n)=>{ue(e),pe(e,he,t,n)}))}return l}function Ee(e,t,n,r,i){var o;const s=q(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&&G(s),i&&se(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 Se(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;ae(n,((n,r,i)=>{const o=q(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 H(i,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,Se(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 je(e){var t;const n=q(e);if(!X(e,null==n?void 0:n.options))return e;const r=W(e);if(n&&!n.operated)return n.original;let i;function o(){i=2===r?F(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):ee(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(ae(i,((t,r)=>{if(n&&Z(K(n.original,t),r))return;const s=je(r);s!==r&&(i===e&&o(),H(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 ke(e){if(!V(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return je(e)}_.createDraft=Me;const Re=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({},Pe),c);const u=V(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!==(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(!X(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,D))!==D.mutable&&X(e,t)?Me({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=Ee(s,e,i,o,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!X(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 G(q(y)),e}const b=e=>{const t=q(y);if(!V(e)){if(void 0!==e&&!Z(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&&Se({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&Se({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=q(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(b,(e=>{throw G(q(y)),e})):b(v)};var Pe;Object.prototype.constructor.toString();class Ae{constructor(e,t=null){this.value=e,this.reactor=t??new k(this,[])}produce(e){return n=e,void(t=this).set(Re(t.get(),n));var t,n}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 Ae(e)}function Te(e){return e instanceof Ae}function ze(e,t){e.reactor.addBinding(t)}function Ce(e,t){e.reactor.removeBinding(t)}class De{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 _e(e){return new De(e)}class Ie{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 Ne(e){return new Ie(e)}class Ue{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}function Fe(e){return new Ue(e)}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class Le{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]}}function Ve(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new Le(t)),window.RUMIOUS_CONTEXTS[e]}export{S as RumiousApp,Ie as RumiousChildrensRef,t as RumiousComponent,b as RumiousComponentElement,Ue as RumiousComponentRef,Le as RumiousContext,De as RumiousElementRef,Ae as RumiousState,Ne as createChildrensRef,y as createComponent,m as createComponentElement,Fe as createComponentRef,Ve as createContext,f as createDirective,h as createElement,_e as createElementRef,xe as createState,d as createTextElement,n as isComponent,Te as isState,j as styleHelper,Ce as unwatch,ze as watch};
|
2
|
-
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
DELETED
@@ -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","render","document","createDocumentFragment","requestRender","fragment","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","createDirective","registerDirective","createElement","createComponent","createFragment","normalizeChildren","createTextElement","text","nodeValue","map","child","window","RUMIOUS_JSX_SUPPORT","RumiousComponentElement","HTMLElement","super","instance","cleanUp","setRef","componentConstructor","connectedCallback","forwardRef","disconnectCallback","createComponentElement","customElements","define","static","HTMLUnknownElement","handleComponentElement","container","componentElement","tag","renderComponent","entries","propValue","handleDirective","handleRegularElement","startsWith","test","substring","toLowerCase","nodeType","Node","TEXT_NODE","setAttribute","setElementProps","directive","handleFragmentOrElementList","createTextNode","handleTextElement","Array","item","JSON","stringify","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","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","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","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,EAAqBG,MAC9CA,KAAKQ,SAAW,KAChBR,KAAKS,QAAU,IACnB,CAEE,OAAAC,CAAQL,EAASC,EAAOG,EAAU,CAAE,EAAED,EAAW,MAC/CR,KAAKK,QAAUA,EACfL,KAAKM,MAAQA,EACbN,KAAKQ,SAAWA,EAChBR,KAAKS,QAAUA,CACnB,CAEE,QAAAE,GACE,MAAO,CAAE,CACb,CAEE,MAAAC,CAAOD,GACL,OAAOX,KAAKQ,SAASG,EAAUE,SAASC,yBAA0Bd,KAAKO,cAC3E,CAEE,aAAAQ,GACE,IAAIJ,EAAWX,KAAKW,WAChBK,EAAWhB,KAAKQ,SAASG,EAAUE,SAASC,yBAA0Bd,KAAKO,eAC/EP,KAAKK,QAAQY,YAAYD,GACzBhB,KAAKkB,UACT,CAEE,oBAAMC,GACJ,GAAInB,KAAKK,QAAS,CAChB,IAAIe,EAASpB,KAAKK,QAAQgB,WAAU,GAIpC,IAHArB,KAAKK,QAAQiB,YAAYF,GACzBpB,KAAKK,QAAUe,EAERpB,KAAKK,QAAQkB,YAClBvB,KAAKK,QAAQmB,YAAYxB,KAAKK,QAAQkB,WAE9C,CACA,CAEE,MAAAE,GAAS,CACT,QAAAC,GAAW,CACX,QAAAR,GAAW,CACX,QAAAS,GAAW,CACX,SAAAC,GAAY,EAGP,SAASC,EAAYC,GAC1B,OAAOC,OAAOC,eAAeF,KAAe1B,CAC9C,CCtDO,MAAM6B,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OsU,GACH7Y,KAAK4Y,OAAOrU,KACfvE,KAAK4Y,OAAOrU,GAAS,IAEvBvE,KAAK4Y,OAAOrU,GAAO8E,KAAKwP,EAC5B,CAEE,GAAAd,CAAIxT,EAAOsU,GACJ7Y,KAAK4Y,OAAOrU,KACjBvE,KAAK4Y,OAAOrU,GAASvE,KAAK4Y,OAAOrU,GAAOuU,QAAOC,GAAKA,IAAMF,IAC9D,CAEE,IAAAG,CAAKzU,KAAUmF,GACR1J,KAAK4Y,OAAOrU,IACjBvE,KAAK4Y,OAAOrU,GAAOjC,SAAQuW,GAAYA,KAAYnP,IACvD,CAEE,GAAAvF,CAAIoG,EAAK5H,GACP,IAAI4G,EAAQ6N,GAAYzU,GAExB,OADA3C,KAAK2Y,KAAKpO,GAAOhB,EACVA,CACX,CAEE,GAAApJ,CAAIoK,GACF,OAAOvK,KAAK2Y,KAAKpO,EACrB,EAIO,SAAS0O,GAAcC,EAAW,GAAGP,EAAK,CAAA,GAE/C,OADIrT,OAAOmT,iBAAiBS,KAAa5T,OAAOmT,iBAAiBS,GAAc,IAAIR,GAAeC,IAC3FrT,OAAOmT,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{}}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 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=t.find(this.value.value.objectName);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=t.find(this.value.value.objectName);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,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 i(e,t||{},m(n))}function y(e){return new i("TEXT_ELEMENT",{nodeValue:e},[])}function g(e,t,n){let r=new i("COMPONENT",{...t},new o(m(n)));return r.component=e,r}function v(...e){return new i("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(){}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 w(e="a-component"){return window.customElements.get(e)||window.customElements.define(e,class extends b{static tag=e;cleanUp(){window.customElements(e,HTMLUnknownElement)}}),document.createElement(e)}function O(e,t,n,r){const i=function(e,t,n,r){const i=w(e.tag??"r-component");return i.init(e,t,n,r),i}(e.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([,e])=>{e instanceof a&&M(i,e,r)})),t.appendChild(i),t}function E(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?M(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}function M(e,t,n){t.init(e,n)}function S(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?O(e,t,S,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>S(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):E(e,n),null===(o=e)||"object"!=typeof o&&"function"!=typeof o?(S(y(e),t,n),t):e instanceof Array?(e.forEach((e=>S(e,t,n))),t):e instanceof i?(e.children.forEach((e=>S(e,r,n))),t.appendChild(r),t):(S(y(JSON.stringify(e)),t,n),t));var o}class j{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 k="remove",A="replace",C="add",P=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),x=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),T=Symbol.iterator,z={mutable:"mutable",immutable:"immutable"},D={};function _(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 N(e){return Object.getPrototypeOf(e)===Set.prototype}function U(e){return Object.getPrototypeOf(e)===Map.prototype}function F(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function L(e){return!!V(e)}function V(e){return"object"!=typeof e?null:null==e?void 0:e[P]}function q(e){var t;const n=V(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function $(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,z))===z.immutable||"function"==typeof n)}function X(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=V(W(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 X(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=W(3===B(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 B(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function W(e,t){return 2===B(e)?e.get(t):e[t]}function K(e,t,n){2===B(e)?e.set(t,n):e[t]=n}function H(e,t){const n=V(e);return(n?F(n):e)[t]}function Y(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function Z(e){if(e)for(;e.finalities.revoke.length>0;){e.finalities.revoke.pop()()}}function G(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 J=Object.prototype.propertyIsEnumerable;function Q(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!N(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(!U(e)){return new(0,Object.getPrototypeOf(e).constructor)(e)}return new Map(e)}if((null==t?void 0:t.mark)&&(n=t.mark(e,z),void 0!==n)&&n!==z.mutable){if(n===z.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=>{J.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 ee(e){e.copy||(e.copy=Q(e.original,e.options))}function te(e){if(!$(e))return q(e);if(Array.isArray(e))return e.map(te);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,te(t)]));if(!U(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Map(t)}if(e instanceof Set){const t=Array.from(e).map(te);if(!N(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]=te(e[n]);return t}function ne(e){return L(e)?te(e):e}function re(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&re(e.parent))}function ie(){throw new Error("Cannot modify frozen object")}function oe(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)||L(e))return r.pop(),void i.pop();switch(B(e)){case 2:for(const[t,o]of e)oe(t,t,n,r,i),oe(o,t,n,r,i);e.set=e.clear=e.delete=ie;break;case 3:for(const t of e)oe(t,t,n,r,i);e.add=e.clear=e.delete=ie;break;case 1:Object.freeze(e);let t=0;for(const o of e)oe(o,t,n,r,i),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{oe(e[t],t,n,r,i)}))}r.pop(),i.pop()}function se(e,t){const n=B(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 ae(e,t,n){if(L(e)||!$(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),se(e,((o,s)=>{var a;if(L(s)){const t=V(s);ee(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;K(r?i:e,o,n)}else ae(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 le(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ae(W(n,t),e.finalities.handledSet,e.options)}function ce(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(q(t))})))}function ue(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const i=X(e);i&&t(e,i,n,r)}e.finalized=!0}}function pe(e,t,n,r){const i=V(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push(((o,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(Y(W(l,t),n)){let n=i.original;i.copy&&(n=i.copy),ce(e),ue(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)),K(l,t,n)}})),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),$(n,e.options)&&e.finalities.draft.push((()=>{Y(W(3===e.type?e.setMap:e.copy,t),n)&&le(e,t)}))}function fe(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=W(e,a),c=ne(W(t,a)),u=n?_(e,a)?A:C:k;if(Y(l,c)&&u===A)return;const p=G(r.concat(a),s);i.push(u===k?{op:u,path:p}:{op:u,path:p,value:c}),o.push(u===C?{op:k,path:p}:u===k?{op:C,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=G(t.concat([e]),i);n.push({op:A,path:s,value:ne(l[e])}),r.push({op:A,path:s,value:ne(o[e])})}for(let e=o.length;e<l.length;e+=1){const r=G(t.concat([e]),i);n.push({op:C,path:r,value:ne(l[e])})}if(o.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=G(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=G(t.concat([e-1]),i);r.push({op:k,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=G(n.concat([s]),o);r.push({op:k,path:t,value:e}),i.unshift({op:C,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=G(n.concat([s]),o);r.push({op:C,path:e,value:t}),i.unshift({op:k,path:e,value:t})}s+=1}))}(e,t,n,r,i)}}const he=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!$(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},de={get size(){return F(V(this)).size},has(e){return F(V(this)).has(e)},set(e,t){const n=V(this),r=F(n);return r.has(e)&&Y(r.get(e),t)||(ee(n),re(n),n.assignedMap.set(e,!0),n.copy.set(e,t),pe(n,e,t,fe)),this},delete(e){if(!this.has(e))return!1;const t=V(this);return ee(t),re(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){ee(e),re(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){F(V(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=V(this),i=F(r).get(e),o=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,i,z))===z.mutable;if(r.options.strict&&he(i,r.options,o),o)return i;if(r.finalized||!$(i,r.options))return i;if(i!==r.original.get(e))return i;const s=D.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return ee(r),r.copy.set(e,s),s},keys(){return F(V(this)).keys()},values(){const e=this.keys();return{[T]:()=>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{[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()}},ye=Reflect.ownKeys(de),ge=(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=V(a),c=(null===(i=(r=e.options).mark)||void 0===i?void 0:i.call(r,a,z))===z.mutable;if(e.options.strict&&he(s,e.options,c),c||l||!$(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=D.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]}},ve={get size(){return V(this).setMap.size},has(e){const t=V(this);if(t.setMap.has(e))return!0;ee(t);const n=V(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=V(this);return this.has(e)||(ee(t),re(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),pe(t,e,e,fe)),this},delete(e){if(!this.has(e))return!1;const t=V(this);ee(t),re(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);ee(e),re(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=V(this);ee(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ge(e,t,{isValuesIterator:!0})}},entries(){const e=V(this);ee(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ge(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(ve,{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 me=Reflect.ownKeys(ve),be=new WeakSet,we={get(e,t,n){var r,i;const o=null===(r=e.copy)||void 0===r?void 0:r[t];if(o&&be.has(o))return o;if(t===P)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,z),s===z.mutable)return e.options.strict&&he(r,e.options,!0),r}const a=F(e);if(a instanceof Map&&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(a instanceof Set&&me.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ve,"size").get.call(e.proxy);const n=ve[t];if(n)return n.bind(e.proxy)}if(!_(a,t)){const n=I(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&&he(l,e.options),e.finalized||!$(l,e.options))return l;if(l===H(e.original,t)){if(ee(e),e.copy[t]=Oe({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 ee(n),re(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=I(F(e),t);if(null==o?void 0:o.set)return o.set.call(e.proxy,n),!0;const s=H(F(e),t),a=V(s);return a&&Y(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):(Y(n,s)&&(void 0!==n||_(e.original,t))||(ee(e),re(e),_(e.original,t)&&Y(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,pe(e,t,n,fe)),!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?we.set.call(this,e,t,void 0,e.proxy):(void 0!==H(e.original,t)||t in e.original?(ee(e),re(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 Oe(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,s=B(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,we);if(i.revoke.push(c),be.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var i,o;const s=V(l);let a=3===e.type?e.setMap:e.copy;const c=W(a,r),u=V(c);if(u){let o=u.original;u.operated&&(o=q(c)),ce(u),ue(u,fe,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)),K(a,r,o)}null===(o=s.callbacks)||void 0===o||o.forEach((e=>{e(t,n)}))}))}else{const e=V(l);e.finalities.draft.push(((t,n)=>{ce(e),ue(e,fe,t,n)}))}return l}function Ee(e,t,n,r,i){var o;const s=V(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&&Z(s),i&&oe(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 Me(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;se(n,((n,r,i)=>{const o=V(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 K(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 Se(e){var t;const n=V(e);if(!$(e,null==n?void 0:n.options))return e;const r=B(e);if(n&&!n.operated)return n.original;let i;function o(){i=2===r?U(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):Q(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(se(i,((t,r)=>{if(n&&Y(W(n.original,t),r))return;const s=Se(r);s!==r&&(i===e&&o(),K(i,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:i;return N(e)?new Set(i):new(Object.getPrototypeOf(e).constructor)(i)}return i}function je(e){if(!L(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Se(e)}D.createDraft=Oe;const Re=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({},ke),c);const u=L(a)?je(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,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,z))!==z.mutable&&$(e,t)?Oe({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=Ee(s,e,i,o,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!$(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 Z(V(y)),e}const m=e=>{const t=V(y);if(!L(e)){if(void 0!==e&&!Y(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[x];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=V(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([je(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw Z(V(y)),e})):m(v)};var ke;Object.prototype.constructor.toString();class Ae{constructor(e,t=null){this.value=e,this.reactor=t??new j(this,[])}produce(e){return n=e,void(t=this).set(Re(t.get(),n));var t,n}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 Ce(e){return new Ae(e)}class Pe{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 xe{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,e.setRef(this)}}window.RUMIOUS_CONTEXTS||(window.RUMIOUS_CONTEXTS={});class ze{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=Ce(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){S(e,this.root,this.renderContext)}},e.RumiousChildrensRef=xe,e.RumiousComponent=n,e.RumiousComponentElement=b,e.RumiousComponentRef=Te,e.RumiousContext=ze,e.RumiousElementRef=Pe,e.RumiousState=Ae,e.createChildrensRef=function(e){return new xe(e)},e.createComponent=g,e.createComponentElement=w,e.createComponentRef=function(e){return new Te(e)},e.createContext=function(e="",t={}){return window.RUMIOUS_CONTEXTS[e]||(window.RUMIOUS_CONTEXTS[e]=new ze(t)),window.RUMIOUS_CONTEXTS[e]},e.createDirective=h,e.createElement=d,e.createElementRef=function(e){return new Pe(e)},e.createState=Ce,e.createTextElement=y,e.isComponent=r,e.isState=function(e){return e instanceof Ae},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}({});
|