rumious 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,215 +1 @@
1
- function _arrayLikeToArray(r, a) {
2
- (null == a || a > r.length) && (a = r.length);
3
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
4
- return n;
5
- }
6
- function _arrayWithHoles(r) {
7
- if (Array.isArray(r)) return r;
8
- }
9
- function _assertThisInitialized(e) {
10
- if (undefined === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11
- return e;
12
- }
13
- function _callSuper(t, o, e) {
14
- return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, [], _getPrototypeOf(t).constructor) : o.apply(t, e));
15
- }
16
- function _classCallCheck(a, n) {
17
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
18
- }
19
- function _construct(t, e, r) {
20
- if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
21
- var o = [null];
22
- o.push.apply(o, e);
23
- var p = new (t.bind.apply(t, o))();
24
- return r && _setPrototypeOf(p, r.prototype), p;
25
- }
26
- function _defineProperties(e, r) {
27
- for (var t = 0; t < r.length; t++) {
28
- var o = r[t];
29
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
30
- }
31
- }
32
- function _createClass(e, r, t) {
33
- return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
34
- writable: false
35
- }), e;
36
- }
37
- function _defineProperty(e, r, t) {
38
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
39
- value: t,
40
- enumerable: true,
41
- configurable: true,
42
- writable: true
43
- }) : e[r] = t, e;
44
- }
45
- function _getPrototypeOf(t) {
46
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
47
- return t.__proto__ || Object.getPrototypeOf(t);
48
- }, _getPrototypeOf(t);
49
- }
50
- function _inherits(t, e) {
51
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
52
- t.prototype = Object.create(e && e.prototype, {
53
- constructor: {
54
- value: t,
55
- writable: true,
56
- configurable: true
57
- }
58
- }), Object.defineProperty(t, "prototype", {
59
- writable: false
60
- }), e && _setPrototypeOf(t, e);
61
- }
62
- function _isNativeFunction(t) {
63
- try {
64
- return -1 !== Function.toString.call(t).indexOf("[native code]");
65
- } catch (n) {
66
- return "function" == typeof t;
67
- }
68
- }
69
- function _isNativeReflectConstruct() {
70
- try {
71
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
72
- } catch (t) {}
73
- return (_isNativeReflectConstruct = function () {
74
- return !!t;
75
- })();
76
- }
77
- function _iterableToArrayLimit(r, l) {
78
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
79
- if (null != t) {
80
- var e,
81
- n,
82
- i,
83
- u,
84
- a = [],
85
- f = true,
86
- o = false;
87
- try {
88
- if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
89
- } catch (r) {
90
- o = true, n = r;
91
- } finally {
92
- try {
93
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
94
- } finally {
95
- if (o) throw n;
96
- }
97
- }
98
- return a;
99
- }
100
- }
101
- function _nonIterableRest() {
102
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
103
- }
104
- function ownKeys(e, r) {
105
- var t = Object.keys(e);
106
- if (Object.getOwnPropertySymbols) {
107
- var o = Object.getOwnPropertySymbols(e);
108
- r && (o = o.filter(function (r) {
109
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
110
- })), t.push.apply(t, o);
111
- }
112
- return t;
113
- }
114
- function _objectSpread2(e) {
115
- for (var r = 1; r < arguments.length; r++) {
116
- var t = null != arguments[r] ? arguments[r] : {};
117
- r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
118
- _defineProperty(e, r, t[r]);
119
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
120
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
121
- });
122
- }
123
- return e;
124
- }
125
- function _possibleConstructorReturn(t, e) {
126
- if (e && ("object" == typeof e || "function" == typeof e)) return e;
127
- if (undefined !== e) throw new TypeError("Derived constructors may only return object or undefined");
128
- return _assertThisInitialized(t);
129
- }
130
- function _setPrototypeOf(t, e) {
131
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
132
- return t.__proto__ = e, t;
133
- }, _setPrototypeOf(t, e);
134
- }
135
- function _slicedToArray(r, e) {
136
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
137
- }
138
- function _toPrimitive(t, r) {
139
- if ("object" != typeof t || !t) return t;
140
- var e = t[Symbol.toPrimitive];
141
- if (undefined !== e) {
142
- var i = e.call(t, r || "default");
143
- if ("object" != typeof i) return i;
144
- throw new TypeError("@@toPrimitive must return a primitive value.");
145
- }
146
- return ("string" === r ? String : Number)(t);
147
- }
148
- function _toPropertyKey(t) {
149
- var i = _toPrimitive(t, "string");
150
- return "symbol" == typeof i ? i : i + "";
151
- }
152
- function _typeof(o) {
153
- "@babel/helpers - typeof";
154
-
155
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
156
- return typeof o;
157
- } : function (o) {
158
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
159
- }, _typeof(o);
160
- }
161
- function _unsupportedIterableToArray(r, a) {
162
- if (r) {
163
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
164
- var t = {}.toString.call(r).slice(8, -1);
165
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : undefined;
166
- }
167
- }
168
- function _wrapNativeSuper(t) {
169
- var r = "function" == typeof Map ? new Map() : undefined;
170
- return _wrapNativeSuper = function (t) {
171
- if (null === t || !_isNativeFunction(t)) return t;
172
- if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
173
- if (undefined !== r) {
174
- if (r.has(t)) return r.get(t);
175
- r.set(t, Wrapper);
176
- }
177
- function Wrapper() {
178
- return _construct(t, arguments, _getPrototypeOf(this).constructor);
179
- }
180
- return Wrapper.prototype = Object.create(t.prototype, {
181
- constructor: {
182
- value: Wrapper,
183
- enumerable: false,
184
- writable: true,
185
- configurable: true
186
- }
187
- }), _setPrototypeOf(Wrapper, t);
188
- }, _wrapNativeSuper(t);
189
- }
190
-
191
- var RumiousRenderContext=/*#__PURE__*/_createClass(function RumiousRenderContext(target){_classCallCheck(this,RumiousRenderContext);this.target=target;});
192
-
193
- var RumiousComponent=/*#__PURE__*/function(){function RumiousComponent(){_classCallCheck(this,RumiousComponent);this.element=null;this.props={};this.renderContext=new RumiousRenderContext(this);this.renderer=null;this.wrapped=null;}return _createClass(RumiousComponent,[{key:"prepare",value:function prepare(element,props){var wrapped=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var renderer=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;this.element=element;this.props=props;this.renderer=renderer;this.wrapped=wrapped;}},{key:"template",value:function template(){return {}}},{key:"requestRender",value:function requestRender(){var template=this.template();var fragment=this.renderer(template,document.createDocumentFragment(),this.renderContext);this.element.appendChild(fragment);this.onRender();}},{key:"onCreate",value:function onCreate(){}},{key:"onRender",value:function onRender(){}},{key:"onUpdate",value:function onUpdate(){}},{key:"onDestroy",value:function onDestroy(){}}])}();function isComponent(constructor){return Object.getPrototypeOf(constructor)===RumiousComponent}
194
-
195
- var RumiousElement=/*#__PURE__*/_createClass(function RumiousElement(type,props){var children=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];_classCallCheck(this,RumiousElement);this.type=type;this.props=props;this.children=children;});var RumiousElementList=/*#__PURE__*/function(){function RumiousElementList(list){_classCallCheck(this,RumiousElementList);this.type="ELEMENT_LIST";this.children=list;}return _createClass(RumiousElementList,[{key:"forEach",value:function forEach(callback){this.children.forEach(callback);}}])}();
196
-
197
- function createElement(type,props){for(var _len=arguments.length,children=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){children[_key-2]=arguments[_key];}if(isComponent(type)){return createComponent(type,props,children)}if(type===createFragment){return createFragment.apply(undefined,children)}return new RumiousElement(type,props||{},normalizeChildren(children))}function createTextElement(text){return new RumiousElement("TEXT_ELEMENT",{nodeValue:text},[])}function createComponent(type,props,children){return new RumiousElement("COMPONENT",_objectSpread2({component:type},props),new RumiousElementList(normalizeChildren(children)))}function createFragment(){for(var _len2=arguments.length,children=new Array(_len2),_key2=0;_key2<_len2;_key2++){children[_key2]=arguments[_key2];}return new RumiousElement("FRAGMENT",{},normalizeChildren(children))}function normalizeChildren(children){return children.map(function(child){return _typeof(child)==="object"?child:createTextElement(child)})}window.RUMIOUS_JSX_SUPPORT={createElement:createElement,createFragment:createFragment};
198
-
199
- function isCamelCase(str){var camelCaseRegex=/^[a-z]+([A-Z][a-z]*)*$/;return camelCaseRegex.test(str)}
200
-
201
- var RumiousComponentElement=/*#__PURE__*/function(_HTMLElement){function RumiousComponentElement(){var _this;_classCallCheck(this,RumiousComponentElement);_this=_callSuper(this,RumiousComponentElement);_this.instance=null;return _this}_inherits(RumiousComponentElement,_HTMLElement);return _createClass(RumiousComponentElement,[{key:"init",value:function init(componentConstructor,props){var wrapped=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var renderer=arguments.length>3?arguments[3]:undefined;this.instance=new componentConstructor;this.instance.prepare(this,props,wrapped,renderer);}},{key:"connectedCallback",value:function connectedCallback(){this.instance.onCreate();this.instance.requestRender();}}])}(/*#__PURE__*/_wrapNativeSuper(HTMLElement));function createComponentElement(){return document.createElement("a-component")}window.customElements.define("a-component",RumiousComponentElement);
202
-
203
- function renderComponent(componentConstructor,props,wrapped,renderer){var componentElement=createComponentElement();componentElement.init(componentConstructor,props,wrapped,renderer);return componentElement}
204
-
205
- function render(element,container){var renderContext=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!element)return container;var dom;if(element.type==="COMPONENT"){dom=renderComponent(element.props.component,element.props,element.children,render);container.appendChild(dom);return container}if(element.type==="FRAGMENT"||element.type==="ELEMENT_LIST"){element.children.forEach(function(child){return render(child,container,renderContext)});return container}if(element.type==="TEXT_ELEMENT"){dom=document.createTextNode(element.props.nodeValue);}else {dom=document.createElement(element.type);}Object.entries(element.props||{}).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),name=_ref2[0],value=_ref2[1];if(name==="ref"){var _renderContext$addRef;(_renderContext$addRef=renderContext.addRef)===null||_renderContext$addRef===undefined||_renderContext$addRef.call(renderContext,value);}else if(name.startsWith("on")&&isCamelCase(name)){dom.addEventListener(name.substring(2).toLowerCase(),value);}else if(dom.nodeType===Node.TEXT_NODE){dom.nodeValue=value;}else {dom.setAttribute(name,value);}});element.children.forEach(function(child){return render(child,dom,renderContext)});container.appendChild(dom);return container}
206
-
207
- var RumiousApp=/*#__PURE__*/function(){function RumiousApp(){var root=arguments.length>0&&arguments[0]!==undefined?arguments[0]:document.createElement("span");var configs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,RumiousApp);this.root=root;this.configs=configs;this.renderContext=new RumiousRenderContext(this);}return _createClass(RumiousApp,[{key:"render",value:function render$1(element){render(element,this.root,this.renderContext);}}])}();
208
-
209
- var RumiousReactor=/*#__PURE__*/function(){function RumiousReactor(){var target=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var bindings=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];_classCallCheck(this,RumiousReactor);this.target=target;this.bindings=bindings;}return _createClass(RumiousReactor,[{key:"react",value:function react(){this.bindings.forEach(function(callback){return callback()});}},{key:"addBinding",value:function addBinding(fn){this.bindings.push(fn);}}])}();
210
-
211
- var RumiousState=/*#__PURE__*/function(){function RumiousState(target){var reactor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;_classCallCheck(this,RumiousState);this.target=target;this.reactor=reactor!==null&&reactor!==undefined?reactor:new RumiousReactor(this,[]);if(target&&_typeof(target)==="object"){this.wrapProxy(target);}else {this._value=target;}}return _createClass(RumiousState,[{key:"wrapProxy",value:function wrapProxy(target){var _this=this;this._value=new Proxy(target,{get:function get(target,prop){var value=target[prop];return value&&_typeof(value)==="object"?new RumiousState(value,_this.reactor).value:value},set:function set(target,prop,value){if(value&&_typeof(value)==="object"){value=new RumiousState(value,_this.reactor).proxy;}_this.reactor.react();target[prop]=value;return true}});}},{key:"value",get:function get(){return this._value},set:function set(val){if(val&&_typeof(val)==="object"){this.wrapProxy(val);}else {this._value=val;}this.reactor.react();}}])}();function createState(value){return new RumiousState(value)}
212
-
213
- function watcher(state,callback){state.reactor.addBinding(callback);}
214
-
215
- export { RumiousApp, RumiousComponent, RumiousComponentElement, RumiousState, createComponentElement, createState, isComponent, watcher };
1
+ class e{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class t{constructor(){this.element=null,this.props={},this.renderContext=new e(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function n(e){return Object.getPrototypeOf(e)===t}class r{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class o{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function i(e){return"function"==typeof e}class s{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){}}class a extends s{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return null;const n=t.get(e);if(!i(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!i(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class l extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){"html"===this.name&&(e.innerHTML=this.normalizeValue(t))}}class c extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class u extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const p={on:(e,t)=>new a("on",e,t),bind:(e,t)=>new l("bind",e,t),ref:(e,t,n="element")=>new c("ref",e,t),childsRef:(e,t)=>new u("childsRef",e,t)};function f(...e){return new r("FRAGMENT",{},h(e))}function h(e){return e.map((e=>"object"==typeof e?e:new r("TEXT_ELEMENT",{nodeValue:e},[])))}window.RUMIOUS_JSX_SUPPORT={createElement:function(e,t,...i){return n(e)?function(e,t,n){return new r("COMPONENT",{component:e,...t},new o(h(n)))}(e,t,i):e===f?f(...i):new r(e,t||{},h(i))},createFragment:f,createDirective:function(e,t,n){return function(e,t,n){return p[e]?.(t,n)}(e,t,n)}};class d extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}setRef(e){this.ref=e}init(e,t,n={},r){this.instance=new e,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()}}function y(){return document.createElement("a-component")}function g(e,t,n){t.init(e,n)}function v(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?function(e,t,n,r){const o=function(e,t,n,r){const o=y();return o.init(e,t,n,r),o}(e.props.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([e,t])=>{t instanceof s&&g(o,t,r)})),t.appendChild(o),t}(e,t,v,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>v(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):function(e,t){const n=document.createElement(e.type);return Object.entries(e.props||{}).forEach((([e,r])=>{e.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(e)?n.addEventListener(e.substring(2).toLowerCase(),r):function(e,t,n,r){e.nodeType===Node.TEXT_NODE?e.nodeValue=n:n instanceof s?g(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}(e,n),e.children.forEach((e=>v(e,r,n))),t.appendChild(r),t)}window.customElements.define("a-component",d);class b{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){v(e,this.root,this.renderContext)}}class m{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}addBinding(e){this.bindings.push(e)}}class w{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const O="remove",M="replace",E="add",j=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),k=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),S=Symbol.iterator,R={mutable:"mutable",immutable:"immutable"},P={};function A(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function x(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function z(e){return Object.getPrototypeOf(e)===Set.prototype}function D(e){return Object.getPrototypeOf(e)===Map.prototype}function C(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function T(e){return!!_(e)}function _(e){return"object"!=typeof e?null:null==e?void 0:e[j]}function I(e){var t;const n=_(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function N(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,R))===R.immutable||"function"==typeof n)}function F(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=_(L(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const o=3===e.parent.type,i=o?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(o&&n.size>i||A(n,i)))return null;t.push(i)}if(e.parent)return F(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=L(3===V(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function V(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function L(e,t){return 2===V(e)?e.get(t):e[t]}function q(e,t,n){2===V(e)?e.set(t,n):e[t]=n}function U(e,t){const n=_(e);return(n?C(n):e)[t]}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function B(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const K=Object.prototype.propertyIsEnumerable;function X(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set)return z(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 D(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,R),void 0!==n)&&n!==R.mutable){if(n===R.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{K.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function H(e){e.copy||(e.copy=X(e.original,e.options))}function Y(e){if(!N(e))return I(e);if(Array.isArray(e))return e.map(Y);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,Y(t)]));return D(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(Y);return z(e)?new Set(t):new(0,Object.getPrototypeOf(e).constructor)(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=Y(e[n]);return t}function G(e){return T(e)?Y(e):e}function Z(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&Z(e.parent))}function J(){throw new Error("Cannot modify frozen object")}function Q(e,t,n,r,o){{n=null!=n?n:new WeakMap,r=null!=r?r:[],o=null!=o?o:[];const i=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(i);if(i&&"object"==typeof i&&-1!==e){if(r[0]===i)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${o.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(i),o.push(t)}else r.push(i)}if(Object.isFrozen(e)||T(e))return r.pop(),void o.pop();switch(V(e)){case 2:for(const[t,i]of e)Q(t,t,n,r,o),Q(i,t,n,r,o);e.set=e.clear=e.delete=J;break;case 3:for(const t of e)Q(t,t,n,r,o);e.add=e.clear=e.delete=J;break;case 1:Object.freeze(e);let t=0;for(const i of e)Q(i,t,n,r,o),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{Q(e[t],t,n,r,o)}))}r.pop(),o.pop()}function ee(e,t){const n=V(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function te(e,t,n){if(T(e)||!N(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,o=r?new Map:void 0;if(t.add(e),ee(e,((i,s)=>{var a;if(T(s)){const t=_(s);H(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;q(r?o:e,i,n)}else te(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 ne(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&te(L(n,t),e.finalities.handledSet,e.options)}function re(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(I(t))})))}function oe(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=F(e);o&&t(e,o,n,r)}e.finalized=!0}}function ie(e,t,n,r){const o=_(n);o&&(o.callbacks||(o.callbacks=[]),o.callbacks.push(((i,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if($(L(l,t),n)){let n=o.original;o.copy&&(n=o.copy),re(e),oe(e,r,i,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,o.original)),q(l,t,n)}})),e.options.enableAutoFreeze&&o.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),N(n,e.options)&&e.finalities.draft.push((()=>{$(L(3===e.type?e.setMap:e.copy,t),n)&&ne(e,t)}))}function se(e,t,n,r){const{pathAsArray: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=L(e,a),c=G(L(t,a)),u=n?A(e,a)?M:E:O;if($(l,c)&&u===M)return;const p=B(r.concat(a),s);o.push(u===O?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===E?{op:O,path:p}:u===O?{op:E,path:p,value:l}:{op:M,path:p,value:l})}))}(e,t,n,r,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=B(t.concat([e]),o);n.push({op:M,path:s,value:G(l[e])}),r.push({op:M,path:s,value:G(i[e])})}for(let e=i.length;e<l.length;e+=1){const r=B(t.concat([e]),o);n.push({op:E,path:r,value:G(l[e])})}if(i.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=B(t.concat(["length"]),o);r.push({op:M,path:e,value:i.length})}else for(let e=l.length;i.length<e;e-=1){const n=B(t.concat([e-1]),o);r.push({op:O,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=B(n.concat([s]),i);r.push({op:O,path:t,value:e}),o.unshift({op:E,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=B(n.concat([s]),i);r.push({op:E,path:e,value:t}),o.unshift({op:O,path:e,value:t})}s+=1}))}(e,t,n,r,o)}}const ae=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!N(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},le={get size(){return C(_(this)).size},has(e){return C(_(this)).has(e)},set(e,t){const n=_(this),r=C(n);return r.has(e)&&$(r.get(e),t)||(H(n),Z(n),n.assignedMap.set(e,!0),n.copy.set(e,t),ie(n,e,t,se)),this},delete(e){if(!this.has(e))return!1;const t=_(this);return H(t),Z(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=_(this);if(this.size){H(e),Z(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){C(_(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=_(this),o=C(r).get(e),i=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,o,R))===R.mutable;if(r.options.strict&&ae(o,r.options,i),i)return o;if(r.finalized||!N(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 H(r),r.copy.set(e,s),s},keys(){return C(_(this)).keys()},values(){const e=this.keys();return{[S]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[S]:()=>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]}}}},[S](){return this.entries()}},ce=Reflect.ownKeys(le),ue=(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=_(a),c=(null===(o=(r=e.options).mark)||void 0===o?void 0:o.call(r,a,R))===R.mutable;if(e.options.strict&&ae(s,e.options,c),c||l||!N(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=P.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},pe={get size(){return _(this).setMap.size},has(e){const t=_(this);if(t.setMap.has(e))return!0;H(t);const n=_(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=_(this);return this.has(e)||(H(t),Z(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),ie(t,e,e,se)),this},delete(e){if(!this.has(e))return!1;const t=_(this);H(t),Z(t);const n=_(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=_(this);H(e),Z(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=_(this);H(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ue(e,t,{isValuesIterator:!0})}},entries(){const e=_(this);H(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ue(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[S](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(pe,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const fe=Reflect.ownKeys(pe),he=new WeakSet,de={get(e,t,n){var r,o;const i=null===(r=e.copy)||void 0===r?void 0:r[t];if(i&&he.has(i))return i;if(t===j)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,R),s===R.mutable)return e.options.strict&&ae(r,e.options,!0),r}const a=C(e);if(a instanceof Map&&ce.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(le,"size").get.call(e.proxy);const n=le[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&fe.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(pe,"size").get.call(e.proxy);const n=pe[t];if(n)return n.bind(e.proxy)}if(!A(a,t)){const n=x(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&&ae(l,e.options),e.finalized||!N(l,e.options))return l;if(l===U(e.original,t)){if(H(e),e.copy[t]=ye({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=_(e.copy[t]);return H(n),Z(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let o;if(1===e.type&&"length"!==t&&(!(Number.isInteger(o=Number(t))&&o>=0)||0!==t&&0!==o&&String(o)!==String(t)))throw new Error("Only supports setting array indices and the 'length' property.");const i=x(C(e),t);if(null==i?void 0:i.set)return i.set.call(e.proxy,n),!0;const s=U(C(e),t),a=_(s);return a&&$(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):($(n,s)&&(void 0!==n||A(e.original,t))||(H(e),Z(e),A(e.original,t)&&$(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,ie(e,t,n,se)),!0)},has:(e,t)=>t in C(e),ownKeys:e=>Reflect.ownKeys(C(e)),getOwnPropertyDescriptor(e,t){const n=C(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?de.set.call(this,e,t,void 0,e.proxy):(void 0!==U(e.original,t)||t in e.original?(H(e),Z(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function ye(e){const{original:t,parentDraft:n,key:r,finalities:o,options:i}=e,s=V(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,de);if(o.revoke.push(c),he.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var o,i;const s=_(l);let a=3===e.type?e.setMap:e.copy;const c=L(a,r),u=_(c);if(u){let i=u.original;u.operated&&(i=I(c)),re(u),oe(u,se,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(o=e.options.updatedValues)&&void 0!==o?o:new WeakMap,e.options.updatedValues.set(i,u.original)),q(a,r,i)}null===(i=s.callbacks)||void 0===i||i.forEach((e=>{e(t,n)}))}))}else{const e=_(l);e.finalities.draft.push(((t,n)=>{re(e),oe(e,se,t,n)}))}return l}function ge(e,t,n,r,o){var i;const s=_(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&&W(s),o&&Q(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:M,path:[],value:t[0]}]:n,r&&l?[{op:M,path:[],value:a}]:r]}function ve(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:o=!0}=e;ee(n,((n,r,o)=>{const i=_(r);if(i&&t&&i.finalities===t.finalities){e.isContainDraft=!0;const t=i.original;if(o instanceof Set){const e=Array.from(o);o.clear(),e.forEach((e=>o.add(n===e?t:e)))}else q(o,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,ve(e))})),o&&e.isContainDraft}function be(e){var t;const n=_(e);if(!N(e,null==n?void 0:n.options))return e;const r=V(e);if(n&&!n.operated)return n.original;let o;function i(){o=2===r?D(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):X(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{i()}finally{n.finalized=!1}}else o=e;if(ee(o,((t,r)=>{if(n&&$(L(n.original,t),r))return;const s=be(r);s!==r&&(o===e&&i(),q(o,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:o;return z(e)?new Set(o):new(Object.getPrototypeOf(e).constructor)(o)}return o}function me(e){if(!T(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return be(e)}P.createDraft=ye;const we=function e(t,n,r){var o,i,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...o){return e(r,(e=>t.call(this,e,...o)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},void 0),c);const u=T(a)?me(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(o=c.enablePatches)&&void 0!==o&&o,h=null!==(i=c.strict)&&void 0!==i&&i,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!N(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let o,i;t.enablePatches&&(o=[],i=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,R))!==R.mutable&&N(e,t)?ye({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=ge(s,e,o,i,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!N(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw W(_(y)),e}const b=e=>{const t=_(y);if(!T(e)){if(void 0!==e&&!$(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[k];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&ve({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&ve({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=_(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([me(e)])}return g([e])};return v instanceof Promise?v.then(b,(e=>{throw W(_(y)),e})):b(v)};Object.prototype.constructor.toString();class Oe{constructor(e,t=null){this.value=e,this.reactor=t??new m(this,[])}produce(e){return n=e,void(t=this).set(we(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new w(this,"",e[0]):new w(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}function Me(e){return new Oe(e)}function Ee(e){return e instanceof Oe}function je(e,t){e.reactor.addBinding(t)}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}}function Se(e){return new ke(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}}function Pe(e){return new Re(e)}class Ae{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}function xe(e){return new Ae(e)}export{b as RumiousApp,Re as RumiousChildrensRef,t as RumiousComponent,d as RumiousComponentElement,Ae as RumiousComponentRef,ke as RumiousElementRef,Oe as RumiousState,Pe as createChildrensRef,y as createComponentElement,xe as createComponentRef,Se as createElementRef,Me as createState,n as isComponent,Ee as isState,je as watcher};
package/dist/index.js CHANGED
@@ -1,230 +1 @@
1
- var Rumious = (function (exports) {
2
- 'use strict';
3
-
4
- function _arrayLikeToArray(r, a) {
5
- (null == a || a > r.length) && (a = r.length);
6
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
7
- return n;
8
- }
9
- function _arrayWithHoles(r) {
10
- if (Array.isArray(r)) return r;
11
- }
12
- function _assertThisInitialized(e) {
13
- if (undefined === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14
- return e;
15
- }
16
- function _callSuper(t, o, e) {
17
- return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, [], _getPrototypeOf(t).constructor) : o.apply(t, e));
18
- }
19
- function _classCallCheck(a, n) {
20
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
21
- }
22
- function _construct(t, e, r) {
23
- if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
24
- var o = [null];
25
- o.push.apply(o, e);
26
- var p = new (t.bind.apply(t, o))();
27
- return r && _setPrototypeOf(p, r.prototype), p;
28
- }
29
- function _defineProperties(e, r) {
30
- for (var t = 0; t < r.length; t++) {
31
- var o = r[t];
32
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
33
- }
34
- }
35
- function _createClass(e, r, t) {
36
- return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
37
- writable: false
38
- }), e;
39
- }
40
- function _defineProperty(e, r, t) {
41
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
42
- value: t,
43
- enumerable: true,
44
- configurable: true,
45
- writable: true
46
- }) : e[r] = t, e;
47
- }
48
- function _getPrototypeOf(t) {
49
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
50
- return t.__proto__ || Object.getPrototypeOf(t);
51
- }, _getPrototypeOf(t);
52
- }
53
- function _inherits(t, e) {
54
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
55
- t.prototype = Object.create(e && e.prototype, {
56
- constructor: {
57
- value: t,
58
- writable: true,
59
- configurable: true
60
- }
61
- }), Object.defineProperty(t, "prototype", {
62
- writable: false
63
- }), e && _setPrototypeOf(t, e);
64
- }
65
- function _isNativeFunction(t) {
66
- try {
67
- return -1 !== Function.toString.call(t).indexOf("[native code]");
68
- } catch (n) {
69
- return "function" == typeof t;
70
- }
71
- }
72
- function _isNativeReflectConstruct() {
73
- try {
74
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
75
- } catch (t) {}
76
- return (_isNativeReflectConstruct = function () {
77
- return !!t;
78
- })();
79
- }
80
- function _iterableToArrayLimit(r, l) {
81
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
82
- if (null != t) {
83
- var e,
84
- n,
85
- i,
86
- u,
87
- a = [],
88
- f = true,
89
- o = false;
90
- try {
91
- if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
92
- } catch (r) {
93
- o = true, n = r;
94
- } finally {
95
- try {
96
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
97
- } finally {
98
- if (o) throw n;
99
- }
100
- }
101
- return a;
102
- }
103
- }
104
- function _nonIterableRest() {
105
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
106
- }
107
- function ownKeys(e, r) {
108
- var t = Object.keys(e);
109
- if (Object.getOwnPropertySymbols) {
110
- var o = Object.getOwnPropertySymbols(e);
111
- r && (o = o.filter(function (r) {
112
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
113
- })), t.push.apply(t, o);
114
- }
115
- return t;
116
- }
117
- function _objectSpread2(e) {
118
- for (var r = 1; r < arguments.length; r++) {
119
- var t = null != arguments[r] ? arguments[r] : {};
120
- r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
121
- _defineProperty(e, r, t[r]);
122
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
123
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
124
- });
125
- }
126
- return e;
127
- }
128
- function _possibleConstructorReturn(t, e) {
129
- if (e && ("object" == typeof e || "function" == typeof e)) return e;
130
- if (undefined !== e) throw new TypeError("Derived constructors may only return object or undefined");
131
- return _assertThisInitialized(t);
132
- }
133
- function _setPrototypeOf(t, e) {
134
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
135
- return t.__proto__ = e, t;
136
- }, _setPrototypeOf(t, e);
137
- }
138
- function _slicedToArray(r, e) {
139
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
140
- }
141
- function _toPrimitive(t, r) {
142
- if ("object" != typeof t || !t) return t;
143
- var e = t[Symbol.toPrimitive];
144
- if (undefined !== e) {
145
- var i = e.call(t, r || "default");
146
- if ("object" != typeof i) return i;
147
- throw new TypeError("@@toPrimitive must return a primitive value.");
148
- }
149
- return ("string" === r ? String : Number)(t);
150
- }
151
- function _toPropertyKey(t) {
152
- var i = _toPrimitive(t, "string");
153
- return "symbol" == typeof i ? i : i + "";
154
- }
155
- function _typeof(o) {
156
- "@babel/helpers - typeof";
157
-
158
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
159
- return typeof o;
160
- } : function (o) {
161
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
162
- }, _typeof(o);
163
- }
164
- function _unsupportedIterableToArray(r, a) {
165
- if (r) {
166
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
167
- var t = {}.toString.call(r).slice(8, -1);
168
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : undefined;
169
- }
170
- }
171
- function _wrapNativeSuper(t) {
172
- var r = "function" == typeof Map ? new Map() : undefined;
173
- return _wrapNativeSuper = function (t) {
174
- if (null === t || !_isNativeFunction(t)) return t;
175
- if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
176
- if (undefined !== r) {
177
- if (r.has(t)) return r.get(t);
178
- r.set(t, Wrapper);
179
- }
180
- function Wrapper() {
181
- return _construct(t, arguments, _getPrototypeOf(this).constructor);
182
- }
183
- return Wrapper.prototype = Object.create(t.prototype, {
184
- constructor: {
185
- value: Wrapper,
186
- enumerable: false,
187
- writable: true,
188
- configurable: true
189
- }
190
- }), _setPrototypeOf(Wrapper, t);
191
- }, _wrapNativeSuper(t);
192
- }
193
-
194
- var RumiousRenderContext=/*#__PURE__*/_createClass(function RumiousRenderContext(target){_classCallCheck(this,RumiousRenderContext);this.target=target;});
195
-
196
- var RumiousComponent=/*#__PURE__*/function(){function RumiousComponent(){_classCallCheck(this,RumiousComponent);this.element=null;this.props={};this.renderContext=new RumiousRenderContext(this);this.renderer=null;this.wrapped=null;}return _createClass(RumiousComponent,[{key:"prepare",value:function prepare(element,props){var wrapped=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var renderer=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;this.element=element;this.props=props;this.renderer=renderer;this.wrapped=wrapped;}},{key:"template",value:function template(){return {};}},{key:"requestRender",value:function requestRender(){var template=this.template();var fragment=this.renderer(template,document.createDocumentFragment(),this.renderContext);this.element.appendChild(fragment);this.onRender();}},{key:"onCreate",value:function onCreate(){}},{key:"onRender",value:function onRender(){}},{key:"onUpdate",value:function onUpdate(){}},{key:"onDestroy",value:function onDestroy(){}}]);}();function isComponent(constructor){return Object.getPrototypeOf(constructor)===RumiousComponent;}
197
-
198
- var RumiousElement=/*#__PURE__*/_createClass(function RumiousElement(type,props){var children=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];_classCallCheck(this,RumiousElement);this.type=type;this.props=props;this.children=children;});var RumiousElementList=/*#__PURE__*/function(){function RumiousElementList(list){_classCallCheck(this,RumiousElementList);this.type="ELEMENT_LIST";this.children=list;}return _createClass(RumiousElementList,[{key:"forEach",value:function forEach(callback){this.children.forEach(callback);}}]);}();
199
-
200
- function createElement(type,props){for(var _len=arguments.length,children=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){children[_key-2]=arguments[_key];}if(isComponent(type)){return createComponent(type,props,children);}if(type===createFragment){return createFragment.apply(undefined,children);}return new RumiousElement(type,props||{},normalizeChildren(children));}function createTextElement(text){return new RumiousElement("TEXT_ELEMENT",{nodeValue:text},[]);}function createComponent(type,props,children){return new RumiousElement("COMPONENT",_objectSpread2({component:type},props),new RumiousElementList(normalizeChildren(children)));}function createFragment(){for(var _len2=arguments.length,children=new Array(_len2),_key2=0;_key2<_len2;_key2++){children[_key2]=arguments[_key2];}return new RumiousElement("FRAGMENT",{},normalizeChildren(children));}function normalizeChildren(children){return children.map(function(child){return _typeof(child)==="object"?child:createTextElement(child);});}window.RUMIOUS_JSX_SUPPORT={createElement:createElement,createFragment:createFragment};
201
-
202
- function isCamelCase(str){var camelCaseRegex=/^[a-z]+([A-Z][a-z]*)*$/;return camelCaseRegex.test(str);}
203
-
204
- var RumiousComponentElement=/*#__PURE__*/function(_HTMLElement){function RumiousComponentElement(){var _this;_classCallCheck(this,RumiousComponentElement);_this=_callSuper(this,RumiousComponentElement);_this.instance=null;return _this;}_inherits(RumiousComponentElement,_HTMLElement);return _createClass(RumiousComponentElement,[{key:"init",value:function init(componentConstructor,props){var wrapped=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var renderer=arguments.length>3?arguments[3]:undefined;this.instance=new componentConstructor();this.instance.prepare(this,props,wrapped,renderer);}},{key:"connectedCallback",value:function connectedCallback(){this.instance.onCreate();this.instance.requestRender();}}]);}(/*#__PURE__*/_wrapNativeSuper(HTMLElement));function createComponentElement(){return document.createElement("a-component");}window.customElements.define("a-component",RumiousComponentElement);
205
-
206
- function renderComponent(componentConstructor,props,wrapped,renderer){var componentElement=createComponentElement();componentElement.init(componentConstructor,props,wrapped,renderer);return componentElement;}
207
-
208
- function render(element,container){var renderContext=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!element)return container;var dom;if(element.type==="COMPONENT"){dom=renderComponent(element.props.component,element.props,element.children,render);container.appendChild(dom);return container;}if(element.type==="FRAGMENT"||element.type==="ELEMENT_LIST"){element.children.forEach(function(child){return render(child,container,renderContext);});return container;}if(element.type==="TEXT_ELEMENT"){dom=document.createTextNode(element.props.nodeValue);}else {dom=document.createElement(element.type);}Object.entries(element.props||{}).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),name=_ref2[0],value=_ref2[1];if(name==="ref"){var _renderContext$addRef;(_renderContext$addRef=renderContext.addRef)===null||_renderContext$addRef===undefined||_renderContext$addRef.call(renderContext,value);}else if(name.startsWith("on")&&isCamelCase(name)){dom.addEventListener(name.substring(2).toLowerCase(),value);}else if(dom.nodeType===Node.TEXT_NODE){dom.nodeValue=value;}else {dom.setAttribute(name,value);}});element.children.forEach(function(child){return render(child,dom,renderContext);});container.appendChild(dom);return container;}
209
-
210
- var RumiousApp=/*#__PURE__*/function(){function RumiousApp(){var root=arguments.length>0&&arguments[0]!==undefined?arguments[0]:document.createElement("span");var configs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,RumiousApp);this.root=root;this.configs=configs;this.renderContext=new RumiousRenderContext(this);}return _createClass(RumiousApp,[{key:"render",value:function render$1(element){render(element,this.root,this.renderContext);}}]);}();
211
-
212
- var RumiousReactor=/*#__PURE__*/function(){function RumiousReactor(){var target=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var bindings=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];_classCallCheck(this,RumiousReactor);this.target=target;this.bindings=bindings;}return _createClass(RumiousReactor,[{key:"react",value:function react(){this.bindings.forEach(function(callback){return callback();});}},{key:"addBinding",value:function addBinding(fn){this.bindings.push(fn);}}]);}();
213
-
214
- var RumiousState=/*#__PURE__*/function(){function RumiousState(target){var reactor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;_classCallCheck(this,RumiousState);this.target=target;this.reactor=reactor!==null&&reactor!==undefined?reactor:new RumiousReactor(this,[]);if(target&&_typeof(target)==='object'){this.wrapProxy(target);}else {this._value=target;}}return _createClass(RumiousState,[{key:"wrapProxy",value:function wrapProxy(target){var _this=this;this._value=new Proxy(target,{get:function get(target,prop){var value=target[prop];return value&&_typeof(value)==='object'?new RumiousState(value,_this.reactor).value:value;},set:function set(target,prop,value){if(value&&_typeof(value)==='object'){value=new RumiousState(value,_this.reactor).proxy;}_this.reactor.react();target[prop]=value;return true;}});}},{key:"value",get:function get(){return this._value;},set:function set(val){if(val&&_typeof(val)==="object"){this.wrapProxy(val);}else {this._value=val;}this.reactor.react();}}]);}();function createState(value){return new RumiousState(value);}
215
-
216
- function watcher(state,callback){state.reactor.addBinding(callback);}
217
-
218
- exports.RumiousApp = RumiousApp;
219
- exports.RumiousComponent = RumiousComponent;
220
- exports.RumiousComponentElement = RumiousComponentElement;
221
- exports.RumiousState = RumiousState;
222
- exports.createComponentElement = createComponentElement;
223
- exports.createState = createState;
224
- exports.isComponent = isComponent;
225
- exports.watcher = watcher;
226
-
227
- return exports;
228
-
229
- })({});
230
- //# sourceMappingURL=index.js.map
1
+ var Rumious=function(e){"use strict";class t{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class n{constructor(){this.element=null,this.props={},this.renderContext=new t(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function r(e){return Object.getPrototypeOf(e)===n}class 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(){console.warn("Directive haven't handler !")}}class l extends a{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return console.warn(`Missing event handler for event: ${this.name}`),null;const n=t.get(e);if(!s(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!s(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class c extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){if("html"===this.name)e.innerHTML=this.normalizeValue(t)}}class u extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class p extends a{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const f={on:(e,t)=>new l("on",e,t),bind:(e,t)=>new c("bind",e,t),ref:(e,t,n="element")=>new u("ref",e,t),childsRef:(e,t)=>new p("childsRef",e,t)};function h(...e){return new o("FRAGMENT",{},d(e))}function d(e){return e.map((e=>"object"==typeof e?e:new o("TEXT_ELEMENT",{nodeValue:e},[])))}window.RUMIOUS_JSX_SUPPORT={createElement:function(e,t,...n){return r(e)?function(e,t,n){return new o("COMPONENT",{component:e,...t},new i(d(n)))}(e,t,n):e===h?h(...n):new o(e,t||{},d(n))},createFragment:h,createDirective:function(e,t,n){return function(e,t,n){return f[e]?.(t,n)}(e,t,n)}};class y extends HTMLElement{constructor(){super(),this.instance=null,this.ref=null}setRef(e){this.ref=e}init(e,t,n={},r){this.instance=new e,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()}}function g(){return document.createElement("a-component")}function v(e,t,n,r){const o=function(e,t,n,r){const o=g();return o.init(e,t,n,r),o}(e.props.component,e.props,e.children,n);return Object.entries(e.props||{}).forEach((([e,t])=>{t instanceof a&&b(o,t,r)})),t.appendChild(o),t}function m(e,t){const n=document.createElement(e.type);return Object.entries(e.props||{}).forEach((([e,r])=>{e.startsWith("on")&&/^[a-zA-Z]+([A-Z][a-z]*)*$/.test(e)?n.addEventListener(e.substring(2).toLowerCase(),r):function(e,t,n,r){e.nodeType===Node.TEXT_NODE?e.nodeValue=n:n instanceof a?b(e,n,r):e.setAttribute(t,n)}(n,e,r,t)})),n}function b(e,t,n){t.init(e,n)}function w(e,t,n={}){if(!e)return t;let r;return"COMPONENT"===e.type?v(e,t,w,n):"FRAGMENT"===e.type||"ELEMENT_LIST"===e.type?function(e,t,n){return e.children.forEach((e=>w(e,t,n))),t}(e,t,n):(r="TEXT_ELEMENT"===e.type?function(e){return document.createTextNode(e.props.nodeValue)}(e):m(e,n),e.children.forEach((e=>w(e,r,n))),t.appendChild(r),t)}window.customElements.define("a-component",y);class O{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}addBinding(e){this.bindings.push(e)}}class M{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const E="remove",j="replace",S="add",k=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),R=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),A=Symbol.iterator,P={mutable:"mutable",immutable:"immutable"},x={};function C(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function z(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Reflect.getPrototypeOf(n)}}}function D(e){return Object.getPrototypeOf(e)===Set.prototype}function T(e){return Object.getPrototypeOf(e)===Map.prototype}function _(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function I(e){return!!N(e)}function N(e){return"object"!=typeof e?null:null==e?void 0:e[k]}function F(e){var t;const n=N(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,P))===P.immutable||"function"==typeof n)}function L(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=N($(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||C(n,i)))return null;t.push(i)}if(e.parent)return L(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=$(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 U(e,t,n){2===q(e)?e.set(t,n):e[t]=n}function W(e,t){const n=N(e);return(n?_(n):e)[t]}function B(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function K(e){if(e)for(;e.finalities.revoke.length>0;){e.finalities.revoke.pop()()}}function X(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const H=Object.prototype.propertyIsEnumerable;function Y(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!D(e)){return new(0,Object.getPrototypeOf(e).constructor)(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}if(e instanceof Map){if(!T(e)){return new(0,Object.getPrototypeOf(e).constructor)(e)}return new Map(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=>{H.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function G(e){e.copy||(e.copy=Y(e.original,e.options))}function Z(e){if(!V(e))return F(e);if(Array.isArray(e))return e.map(Z);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,Z(t)]));if(!T(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Map(t)}if(e instanceof Set){const t=Array.from(e).map(Z);if(!D(e)){return new(0,Object.getPrototypeOf(e).constructor)(t)}return new Set(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=Z(e[n]);return t}function J(e){return I(e)?Z(e):e}function Q(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&Q(e.parent))}function ee(){throw new Error("Cannot modify frozen object")}function te(e,t,n,r,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)||I(e))return r.pop(),void o.pop();switch(q(e)){case 2:for(const[t,i]of e)te(t,t,n,r,o),te(i,t,n,r,o);e.set=e.clear=e.delete=ee;break;case 3:for(const t of e)te(t,t,n,r,o);e.add=e.clear=e.delete=ee;break;case 1:Object.freeze(e);let t=0;for(const i of e)te(i,t,n,r,o),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{te(e[t],t,n,r,o)}))}r.pop(),o.pop()}function ne(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 re(e,t,n){if(I(e)||!V(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,o=r?new Map:void 0;if(t.add(e),ne(e,((i,s)=>{var a;if(I(s)){const t=N(s);G(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;U(r?o:e,i,n)}else re(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 oe(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&re($(n,t),e.finalities.handledSet,e.options)}function ie(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(F(t))})))}function se(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=L(e);o&&t(e,o,n,r)}e.finalized=!0}}function ae(e,t,n,r){const o=N(n);o&&(o.callbacks||(o.callbacks=[]),o.callbacks.push(((i,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(B($(l,t),n)){let n=o.original;o.copy&&(n=o.copy),ie(e),se(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)),U(l,t,n)}})),e.options.enableAutoFreeze&&o.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),V(n,e.options)&&e.finalities.draft.push((()=>{B($(3===e.type?e.setMap:e.copy,t),n)&&oe(e,t)}))}function le(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=J($(t,a)),u=n?C(e,a)?j:S:E;if(B(l,c)&&u===j)return;const p=X(r.concat(a),s);o.push(u===E?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===S?{op:E,path:p}:u===E?{op:S,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=X(t.concat([e]),o);n.push({op:j,path:s,value:J(l[e])}),r.push({op:j,path:s,value:J(i[e])})}for(let e=i.length;e<l.length;e+=1){const r=X(t.concat([e]),o);n.push({op:S,path:r,value:J(l[e])})}if(i.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=X(t.concat(["length"]),o);r.push({op:j,path:e,value:i.length})}else for(let e=l.length;i.length<e;e-=1){const n=X(t.concat([e-1]),o);r.push({op:E,path:n})}}}(e,t,n,r,o);case 3:return function({original:e,copy:t},n,r,o,i){let s=0;e.forEach((e=>{if(!t.has(e)){const t=X(n.concat([s]),i);r.push({op:E,path:t,value:e}),o.unshift({op:S,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=X(n.concat([s]),i);r.push({op:S,path:e,value:t}),o.unshift({op:E,path:e,value:t})}s+=1}))}(e,t,n,r,o)}}const ce=(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.")},ue={get size(){return _(N(this)).size},has(e){return _(N(this)).has(e)},set(e,t){const n=N(this),r=_(n);return r.has(e)&&B(r.get(e),t)||(G(n),Q(n),n.assignedMap.set(e,!0),n.copy.set(e,t),ae(n,e,t,le)),this},delete(e){if(!this.has(e))return!1;const t=N(this);return G(t),Q(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=N(this);if(this.size){G(e),Q(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){_(N(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=N(this),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&&ce(o,r.options,i),i)return o;if(r.finalized||!V(o,r.options))return o;if(o!==r.original.get(e))return o;const s=x.createDraft({original:o,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return G(r),r.copy.set(e,s),s},keys(){return _(N(this)).keys()},values(){const e=this.keys();return{[A]:()=>this.values(),next:()=>{const t=e.next();if(t.done)return t;return{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[A]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[A](){return this.entries()}},pe=Reflect.ownKeys(ue),fe=(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=N(a),c=(null===(o=(r=e.options).mark)||void 0===o?void 0:o.call(r,a,P))===P.mutable;if(e.options.strict&&ce(s,e.options,c),c||l||!V(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=x.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},he={get size(){return N(this).setMap.size},has(e){const t=N(this);if(t.setMap.has(e))return!0;G(t);const n=N(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=N(this);return this.has(e)||(G(t),Q(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),ae(t,e,e,le)),this},delete(e){if(!this.has(e))return!1;const t=N(this);G(t),Q(t);const n=N(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=N(this);G(e),Q(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=N(this);G(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:fe(e,t,{isValuesIterator:!0})}},entries(){const e=N(this);G(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:fe(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(he,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const de=Reflect.ownKeys(he),ye=new WeakSet,ge={get(e,t,n){var r,o;const i=null===(r=e.copy)||void 0===r?void 0:r[t];if(i&&ye.has(i))return i;if(t===k)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&&ce(r,e.options,!0),r}const a=_(e);if(a instanceof Map&&pe.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ue,"size").get.call(e.proxy);const n=ue[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&de.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(he,"size").get.call(e.proxy);const n=he[t];if(n)return n.bind(e.proxy)}if(!C(a,t)){const n=z(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&&ce(l,e.options),e.finalized||!V(l,e.options))return l;if(l===W(e.original,t)){if(G(e),e.copy[t]=ve({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=N(e.copy[t]);return G(n),Q(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let 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=z(_(e),t);if(null==i?void 0:i.set)return i.set.call(e.proxy,n),!0;const s=W(_(e),t),a=N(s);return a&&B(a.original,n)?(e.copy[t]=n,e.assignedMap=null!==(r=e.assignedMap)&&void 0!==r?r:new Map,e.assignedMap.set(t,!1),!0):(B(n,s)&&(void 0!==n||C(e.original,t))||(G(e),Q(e),C(e.original,t)&&B(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,ae(e,t,n,le)),!0)},has:(e,t)=>t in _(e),ownKeys:e=>Reflect.ownKeys(_(e)),getOwnPropertyDescriptor(e,t){const n=_(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?ge.set.call(this,e,t,void 0,e.proxy):(void 0!==W(e.original,t)||t in e.original?(G(e),Q(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function ve(e){const{original:t,parentDraft:n,key:r,finalities: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,ge);if(o.revoke.push(c),ye.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var o,i;const s=N(l);let a=3===e.type?e.setMap:e.copy;const c=$(a,r),u=N(c);if(u){let i=u.original;u.operated&&(i=F(c)),ie(u),se(u,le,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)),U(a,r,i)}null===(i=s.callbacks)||void 0===i||i.forEach((e=>{e(t,n)}))}))}else{const e=N(l);e.finalities.draft.push(((t,n)=>{ie(e),se(e,le,t,n)}))}return l}function me(e,t,n,r,o){var i;const s=N(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&&te(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 be(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:o=!0}=e;ne(n,((n,r,o)=>{const i=N(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 U(o,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,be(e))})),o&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function we(e){var t;const n=N(e);if(!V(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?T(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):Y(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{i()}finally{n.finalized=!1}}else o=e;if(ne(o,((t,r)=>{if(n&&B($(n.original,t),r))return;const s=we(r);s!==r&&(o===e&&i(),U(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 Oe(e){if(!I(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return we(e)}x.createDraft=ve;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({},Ee),c);const u=I(a)?Oe(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(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(!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 o,i;t.enablePatches&&(o=[],i=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,P))!==P.mutable&&V(e,t)?ve({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=me(s,e,o,i,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 K(N(y)),e}const m=e=>{const t=N(y);if(!I(e)){if(void 0!==e&&!B(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[R];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&be({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&be({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=N(e);if(d===n.options){if(n.operated)throw new Error("Cannot return a modified child draft.");return g([Oe(e)])}return g([e])};return v instanceof Promise?v.then(m,(e=>{throw K(N(y)),e})):m(v)};var Ee;Object.prototype.constructor.toString();class je{constructor(e,t=null){this.value=e,this.reactor=t??new O(this,[])}produce(e){return n=e,void(t=this).set(Me(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new M(this,"",e[0]):new M(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}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 ke{constructor(e){this.target=e}query(e){return this.target.querySelectorAll(e)}index(e){return Array.from(this.target.children)[e]}list(){return Array.from(this.target.children)}get parent(){return this.target}remove(){this.target.remove()}addChild(e){this.target.appendChild(e)}set(e){this.target=e}}class Re{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}return e.RumiousApp=class{constructor(e=document.createElement("span"),n={}){this.root=e,this.configs=n,this.renderContext=new t(this)}render(e){w(e,this.root,this.renderContext)}},e.RumiousChildrensRef=ke,e.RumiousComponent=n,e.RumiousComponentElement=y,e.RumiousComponentRef=Re,e.RumiousElementRef=Se,e.RumiousState=je,e.createChildrensRef=function(e){return new ke(e)},e.createComponentElement=g,e.createComponentRef=function(e){return new Re(e)},e.createElementRef=function(e){return new Se(e)},e.createState=function(e){return new je(e)},e.isComponent=r,e.isState=function(e){return e instanceof je},e.watcher=function(e,t){e.reactor.addBinding(t)},e}({});