rumious 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.js +1 -2648
- package/dist/index.cjs.min.js +1 -720
- package/dist/index.esm.js +1 -2637
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -710
- package/dist/index.js +1 -2653
- package/dist/index.min.js +1 -725
- package/package.json +2 -4
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.cjs.min.js
CHANGED
@@ -1,720 +1 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
function _arrayLikeToArray(r, a) {
|
4
|
-
(null == a || a > r.length) && (a = r.length);
|
5
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
6
|
-
return n;
|
7
|
-
}
|
8
|
-
function _arrayWithHoles(r) {
|
9
|
-
if (Array.isArray(r)) return r;
|
10
|
-
}
|
11
|
-
function _assertThisInitialized(e) {
|
12
|
-
if (undefined === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
13
|
-
return e;
|
14
|
-
}
|
15
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
16
|
-
try {
|
17
|
-
var i = n[a](c),
|
18
|
-
u = i.value;
|
19
|
-
} catch (n) {
|
20
|
-
return void e(n);
|
21
|
-
}
|
22
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
23
|
-
}
|
24
|
-
function _asyncToGenerator(n) {
|
25
|
-
return function () {
|
26
|
-
var t = this,
|
27
|
-
e = arguments;
|
28
|
-
return new Promise(function (r, o) {
|
29
|
-
var a = n.apply(t, e);
|
30
|
-
function _next(n) {
|
31
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
32
|
-
}
|
33
|
-
function _throw(n) {
|
34
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
35
|
-
}
|
36
|
-
_next(undefined);
|
37
|
-
});
|
38
|
-
};
|
39
|
-
}
|
40
|
-
function _callSuper(t, o, e) {
|
41
|
-
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
42
|
-
}
|
43
|
-
function _classCallCheck(a, n) {
|
44
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
45
|
-
}
|
46
|
-
function _construct(t, e, r) {
|
47
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
48
|
-
var o = [null];
|
49
|
-
o.push.apply(o, e);
|
50
|
-
var p = new (t.bind.apply(t, o))();
|
51
|
-
return r && _setPrototypeOf(p, r.prototype), p;
|
52
|
-
}
|
53
|
-
function _defineProperties(e, r) {
|
54
|
-
for (var t = 0; t < r.length; t++) {
|
55
|
-
var o = r[t];
|
56
|
-
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
function _createClass(e, r, t) {
|
60
|
-
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
61
|
-
writable: false
|
62
|
-
}), e;
|
63
|
-
}
|
64
|
-
function _createForOfIteratorHelper(r, e) {
|
65
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
66
|
-
if (!t) {
|
67
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
68
|
-
t && (r = t);
|
69
|
-
var n = 0,
|
70
|
-
F = function () {};
|
71
|
-
return {
|
72
|
-
s: F,
|
73
|
-
n: function () {
|
74
|
-
return n >= r.length ? {
|
75
|
-
done: true
|
76
|
-
} : {
|
77
|
-
done: false,
|
78
|
-
value: r[n++]
|
79
|
-
};
|
80
|
-
},
|
81
|
-
e: function (r) {
|
82
|
-
throw r;
|
83
|
-
},
|
84
|
-
f: F
|
85
|
-
};
|
86
|
-
}
|
87
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
88
|
-
}
|
89
|
-
var o,
|
90
|
-
a = true,
|
91
|
-
u = false;
|
92
|
-
return {
|
93
|
-
s: function () {
|
94
|
-
t = t.call(r);
|
95
|
-
},
|
96
|
-
n: function () {
|
97
|
-
var r = t.next();
|
98
|
-
return a = r.done, r;
|
99
|
-
},
|
100
|
-
e: function (r) {
|
101
|
-
u = true, o = r;
|
102
|
-
},
|
103
|
-
f: function () {
|
104
|
-
try {
|
105
|
-
a || null == t.return || t.return();
|
106
|
-
} finally {
|
107
|
-
if (u) throw o;
|
108
|
-
}
|
109
|
-
}
|
110
|
-
};
|
111
|
-
}
|
112
|
-
function _defineProperty(e, r, t) {
|
113
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
114
|
-
value: t,
|
115
|
-
enumerable: true,
|
116
|
-
configurable: true,
|
117
|
-
writable: true
|
118
|
-
}) : e[r] = t, e;
|
119
|
-
}
|
120
|
-
function _getPrototypeOf(t) {
|
121
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
122
|
-
return t.__proto__ || Object.getPrototypeOf(t);
|
123
|
-
}, _getPrototypeOf(t);
|
124
|
-
}
|
125
|
-
function _inherits(t, e) {
|
126
|
-
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
127
|
-
t.prototype = Object.create(e && e.prototype, {
|
128
|
-
constructor: {
|
129
|
-
value: t,
|
130
|
-
writable: true,
|
131
|
-
configurable: true
|
132
|
-
}
|
133
|
-
}), Object.defineProperty(t, "prototype", {
|
134
|
-
writable: false
|
135
|
-
}), e && _setPrototypeOf(t, e);
|
136
|
-
}
|
137
|
-
function _isNativeFunction(t) {
|
138
|
-
try {
|
139
|
-
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
140
|
-
} catch (n) {
|
141
|
-
return "function" == typeof t;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
function _isNativeReflectConstruct() {
|
145
|
-
try {
|
146
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
147
|
-
} catch (t) {}
|
148
|
-
return (_isNativeReflectConstruct = function () {
|
149
|
-
return !!t;
|
150
|
-
})();
|
151
|
-
}
|
152
|
-
function _iterableToArrayLimit(r, l) {
|
153
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
154
|
-
if (null != t) {
|
155
|
-
var e,
|
156
|
-
n,
|
157
|
-
i,
|
158
|
-
u,
|
159
|
-
a = [],
|
160
|
-
f = true,
|
161
|
-
o = false;
|
162
|
-
try {
|
163
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
164
|
-
if (Object(t) !== t) return;
|
165
|
-
f = !1;
|
166
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
167
|
-
} catch (r) {
|
168
|
-
o = true, n = r;
|
169
|
-
} finally {
|
170
|
-
try {
|
171
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
172
|
-
} finally {
|
173
|
-
if (o) throw n;
|
174
|
-
}
|
175
|
-
}
|
176
|
-
return a;
|
177
|
-
}
|
178
|
-
}
|
179
|
-
function _nonIterableRest() {
|
180
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
181
|
-
}
|
182
|
-
function ownKeys(e, r) {
|
183
|
-
var t = Object.keys(e);
|
184
|
-
if (Object.getOwnPropertySymbols) {
|
185
|
-
var o = Object.getOwnPropertySymbols(e);
|
186
|
-
r && (o = o.filter(function (r) {
|
187
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
188
|
-
})), t.push.apply(t, o);
|
189
|
-
}
|
190
|
-
return t;
|
191
|
-
}
|
192
|
-
function _objectSpread2(e) {
|
193
|
-
for (var r = 1; r < arguments.length; r++) {
|
194
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
195
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
196
|
-
_defineProperty(e, r, t[r]);
|
197
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
198
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
199
|
-
});
|
200
|
-
}
|
201
|
-
return e;
|
202
|
-
}
|
203
|
-
function _possibleConstructorReturn(t, e) {
|
204
|
-
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
205
|
-
if (undefined !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
206
|
-
return _assertThisInitialized(t);
|
207
|
-
}
|
208
|
-
function _regeneratorRuntime() {
|
209
|
-
_regeneratorRuntime = function () {
|
210
|
-
return e;
|
211
|
-
};
|
212
|
-
var t,
|
213
|
-
e = {},
|
214
|
-
r = Object.prototype,
|
215
|
-
n = r.hasOwnProperty,
|
216
|
-
o = Object.defineProperty || function (t, e, r) {
|
217
|
-
t[e] = r.value;
|
218
|
-
},
|
219
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
220
|
-
a = i.iterator || "@@iterator",
|
221
|
-
c = i.asyncIterator || "@@asyncIterator",
|
222
|
-
u = i.toStringTag || "@@toStringTag";
|
223
|
-
function define(t, e, r) {
|
224
|
-
return Object.defineProperty(t, e, {
|
225
|
-
value: r,
|
226
|
-
enumerable: true,
|
227
|
-
configurable: true,
|
228
|
-
writable: true
|
229
|
-
}), t[e];
|
230
|
-
}
|
231
|
-
try {
|
232
|
-
define({}, "");
|
233
|
-
} catch (t) {
|
234
|
-
define = function (t, e, r) {
|
235
|
-
return t[e] = r;
|
236
|
-
};
|
237
|
-
}
|
238
|
-
function wrap(t, e, r, n) {
|
239
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
240
|
-
a = Object.create(i.prototype),
|
241
|
-
c = new Context(n || []);
|
242
|
-
return o(a, "_invoke", {
|
243
|
-
value: makeInvokeMethod(t, r, c)
|
244
|
-
}), a;
|
245
|
-
}
|
246
|
-
function tryCatch(t, e, r) {
|
247
|
-
try {
|
248
|
-
return {
|
249
|
-
type: "normal",
|
250
|
-
arg: t.call(e, r)
|
251
|
-
};
|
252
|
-
} catch (t) {
|
253
|
-
return {
|
254
|
-
type: "throw",
|
255
|
-
arg: t
|
256
|
-
};
|
257
|
-
}
|
258
|
-
}
|
259
|
-
e.wrap = wrap;
|
260
|
-
var h = "suspendedStart",
|
261
|
-
l = "suspendedYield",
|
262
|
-
f = "executing",
|
263
|
-
s = "completed",
|
264
|
-
y = {};
|
265
|
-
function Generator() {}
|
266
|
-
function GeneratorFunction() {}
|
267
|
-
function GeneratorFunctionPrototype() {}
|
268
|
-
var p = {};
|
269
|
-
define(p, a, function () {
|
270
|
-
return this;
|
271
|
-
});
|
272
|
-
var d = Object.getPrototypeOf,
|
273
|
-
v = d && d(d(values([])));
|
274
|
-
v && v !== r && n.call(v, a) && (p = v);
|
275
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
276
|
-
function defineIteratorMethods(t) {
|
277
|
-
["next", "throw", "return"].forEach(function (e) {
|
278
|
-
define(t, e, function (t) {
|
279
|
-
return this._invoke(e, t);
|
280
|
-
});
|
281
|
-
});
|
282
|
-
}
|
283
|
-
function AsyncIterator(t, e) {
|
284
|
-
function invoke(r, o, i, a) {
|
285
|
-
var c = tryCatch(t[r], t, o);
|
286
|
-
if ("throw" !== c.type) {
|
287
|
-
var u = c.arg,
|
288
|
-
h = u.value;
|
289
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
290
|
-
invoke("next", t, i, a);
|
291
|
-
}, function (t) {
|
292
|
-
invoke("throw", t, i, a);
|
293
|
-
}) : e.resolve(h).then(function (t) {
|
294
|
-
u.value = t, i(u);
|
295
|
-
}, function (t) {
|
296
|
-
return invoke("throw", t, i, a);
|
297
|
-
});
|
298
|
-
}
|
299
|
-
a(c.arg);
|
300
|
-
}
|
301
|
-
var r;
|
302
|
-
o(this, "_invoke", {
|
303
|
-
value: function (t, n) {
|
304
|
-
function callInvokeWithMethodAndArg() {
|
305
|
-
return new e(function (e, r) {
|
306
|
-
invoke(t, n, e, r);
|
307
|
-
});
|
308
|
-
}
|
309
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
310
|
-
}
|
311
|
-
});
|
312
|
-
}
|
313
|
-
function makeInvokeMethod(e, r, n) {
|
314
|
-
var o = h;
|
315
|
-
return function (i, a) {
|
316
|
-
if (o === f) throw Error("Generator is already running");
|
317
|
-
if (o === s) {
|
318
|
-
if ("throw" === i) throw a;
|
319
|
-
return {
|
320
|
-
value: t,
|
321
|
-
done: true
|
322
|
-
};
|
323
|
-
}
|
324
|
-
for (n.method = i, n.arg = a;;) {
|
325
|
-
var c = n.delegate;
|
326
|
-
if (c) {
|
327
|
-
var u = maybeInvokeDelegate(c, n);
|
328
|
-
if (u) {
|
329
|
-
if (u === y) continue;
|
330
|
-
return u;
|
331
|
-
}
|
332
|
-
}
|
333
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
334
|
-
if (o === h) throw o = s, n.arg;
|
335
|
-
n.dispatchException(n.arg);
|
336
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
337
|
-
o = f;
|
338
|
-
var p = tryCatch(e, r, n);
|
339
|
-
if ("normal" === p.type) {
|
340
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
341
|
-
return {
|
342
|
-
value: p.arg,
|
343
|
-
done: n.done
|
344
|
-
};
|
345
|
-
}
|
346
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
347
|
-
}
|
348
|
-
};
|
349
|
-
}
|
350
|
-
function maybeInvokeDelegate(e, r) {
|
351
|
-
var n = r.method,
|
352
|
-
o = e.iterator[n];
|
353
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
354
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
355
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
356
|
-
var a = i.arg;
|
357
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
358
|
-
}
|
359
|
-
function pushTryEntry(t) {
|
360
|
-
var e = {
|
361
|
-
tryLoc: t[0]
|
362
|
-
};
|
363
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
364
|
-
}
|
365
|
-
function resetTryEntry(t) {
|
366
|
-
var e = t.completion || {};
|
367
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
368
|
-
}
|
369
|
-
function Context(t) {
|
370
|
-
this.tryEntries = [{
|
371
|
-
tryLoc: "root"
|
372
|
-
}], t.forEach(pushTryEntry, this), this.reset(true);
|
373
|
-
}
|
374
|
-
function values(e) {
|
375
|
-
if (e || "" === e) {
|
376
|
-
var r = e[a];
|
377
|
-
if (r) return r.call(e);
|
378
|
-
if ("function" == typeof e.next) return e;
|
379
|
-
if (!isNaN(e.length)) {
|
380
|
-
var o = -1,
|
381
|
-
i = function next() {
|
382
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
|
383
|
-
return next.value = t, next.done = true, next;
|
384
|
-
};
|
385
|
-
return i.next = i;
|
386
|
-
}
|
387
|
-
}
|
388
|
-
throw new TypeError(typeof e + " is not iterable");
|
389
|
-
}
|
390
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
391
|
-
value: GeneratorFunctionPrototype,
|
392
|
-
configurable: true
|
393
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
394
|
-
value: GeneratorFunction,
|
395
|
-
configurable: true
|
396
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
397
|
-
var e = "function" == typeof t && t.constructor;
|
398
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
399
|
-
}, e.mark = function (t) {
|
400
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
401
|
-
}, e.awrap = function (t) {
|
402
|
-
return {
|
403
|
-
__await: t
|
404
|
-
};
|
405
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
406
|
-
return this;
|
407
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
408
|
-
undefined === i && (i = Promise);
|
409
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
410
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
411
|
-
return t.done ? t.value : a.next();
|
412
|
-
});
|
413
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
414
|
-
return this;
|
415
|
-
}), define(g, "toString", function () {
|
416
|
-
return "[object Generator]";
|
417
|
-
}), e.keys = function (t) {
|
418
|
-
var e = Object(t),
|
419
|
-
r = [];
|
420
|
-
for (var n in e) r.push(n);
|
421
|
-
return r.reverse(), function next() {
|
422
|
-
for (; r.length;) {
|
423
|
-
var t = r.pop();
|
424
|
-
if (t in e) return next.value = t, next.done = false, next;
|
425
|
-
}
|
426
|
-
return next.done = true, next;
|
427
|
-
};
|
428
|
-
}, e.values = values, Context.prototype = {
|
429
|
-
constructor: Context,
|
430
|
-
reset: function (e) {
|
431
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
432
|
-
},
|
433
|
-
stop: function () {
|
434
|
-
this.done = true;
|
435
|
-
var t = this.tryEntries[0].completion;
|
436
|
-
if ("throw" === t.type) throw t.arg;
|
437
|
-
return this.rval;
|
438
|
-
},
|
439
|
-
dispatchException: function (e) {
|
440
|
-
if (this.done) throw e;
|
441
|
-
var r = this;
|
442
|
-
function handle(n, o) {
|
443
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
444
|
-
}
|
445
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
446
|
-
var i = this.tryEntries[o],
|
447
|
-
a = i.completion;
|
448
|
-
if ("root" === i.tryLoc) return handle("end");
|
449
|
-
if (i.tryLoc <= this.prev) {
|
450
|
-
var c = n.call(i, "catchLoc"),
|
451
|
-
u = n.call(i, "finallyLoc");
|
452
|
-
if (c && u) {
|
453
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
454
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
455
|
-
} else if (c) {
|
456
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
457
|
-
} else {
|
458
|
-
if (!u) throw Error("try statement without catch or finally");
|
459
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
460
|
-
}
|
461
|
-
}
|
462
|
-
}
|
463
|
-
},
|
464
|
-
abrupt: function (t, e) {
|
465
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
466
|
-
var o = this.tryEntries[r];
|
467
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
468
|
-
var i = o;
|
469
|
-
break;
|
470
|
-
}
|
471
|
-
}
|
472
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
473
|
-
var a = i ? i.completion : {};
|
474
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
475
|
-
},
|
476
|
-
complete: function (t, e) {
|
477
|
-
if ("throw" === t.type) throw t.arg;
|
478
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
479
|
-
},
|
480
|
-
finish: function (t) {
|
481
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
482
|
-
var r = this.tryEntries[e];
|
483
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
484
|
-
}
|
485
|
-
},
|
486
|
-
catch: function (t) {
|
487
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
488
|
-
var r = this.tryEntries[e];
|
489
|
-
if (r.tryLoc === t) {
|
490
|
-
var n = r.completion;
|
491
|
-
if ("throw" === n.type) {
|
492
|
-
var o = n.arg;
|
493
|
-
resetTryEntry(r);
|
494
|
-
}
|
495
|
-
return o;
|
496
|
-
}
|
497
|
-
}
|
498
|
-
throw Error("illegal catch attempt");
|
499
|
-
},
|
500
|
-
delegateYield: function (e, r, n) {
|
501
|
-
return this.delegate = {
|
502
|
-
iterator: values(e),
|
503
|
-
resultName: r,
|
504
|
-
nextLoc: n
|
505
|
-
}, "next" === this.method && (this.arg = t), y;
|
506
|
-
}
|
507
|
-
}, e;
|
508
|
-
}
|
509
|
-
function _setPrototypeOf(t, e) {
|
510
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
511
|
-
return t.__proto__ = e, t;
|
512
|
-
}, _setPrototypeOf(t, e);
|
513
|
-
}
|
514
|
-
function _slicedToArray(r, e) {
|
515
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
516
|
-
}
|
517
|
-
function _toPrimitive(t, r) {
|
518
|
-
if ("object" != typeof t || !t) return t;
|
519
|
-
var e = t[Symbol.toPrimitive];
|
520
|
-
if (undefined !== e) {
|
521
|
-
var i = e.call(t, r || "default");
|
522
|
-
if ("object" != typeof i) return i;
|
523
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
524
|
-
}
|
525
|
-
return ("string" === r ? String : Number)(t);
|
526
|
-
}
|
527
|
-
function _toPropertyKey(t) {
|
528
|
-
var i = _toPrimitive(t, "string");
|
529
|
-
return "symbol" == typeof i ? i : i + "";
|
530
|
-
}
|
531
|
-
function _typeof(o) {
|
532
|
-
"@babel/helpers - typeof";
|
533
|
-
|
534
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
535
|
-
return typeof o;
|
536
|
-
} : function (o) {
|
537
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
538
|
-
}, _typeof(o);
|
539
|
-
}
|
540
|
-
function _unsupportedIterableToArray(r, a) {
|
541
|
-
if (r) {
|
542
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
543
|
-
var t = {}.toString.call(r).slice(8, -1);
|
544
|
-
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;
|
545
|
-
}
|
546
|
-
}
|
547
|
-
function _wrapNativeSuper(t) {
|
548
|
-
var r = "function" == typeof Map ? new Map() : undefined;
|
549
|
-
return _wrapNativeSuper = function (t) {
|
550
|
-
if (null === t || !_isNativeFunction(t)) return t;
|
551
|
-
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
552
|
-
if (undefined !== r) {
|
553
|
-
if (r.has(t)) return r.get(t);
|
554
|
-
r.set(t, Wrapper);
|
555
|
-
}
|
556
|
-
function Wrapper() {
|
557
|
-
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
558
|
-
}
|
559
|
-
return Wrapper.prototype = Object.create(t.prototype, {
|
560
|
-
constructor: {
|
561
|
-
value: Wrapper,
|
562
|
-
enumerable: false,
|
563
|
-
writable: true,
|
564
|
-
configurable: true
|
565
|
-
}
|
566
|
-
}), _setPrototypeOf(Wrapper, t);
|
567
|
-
}, _wrapNativeSuper(t);
|
568
|
-
}
|
569
|
-
|
570
|
-
var RumiousRenderContext=/*#__PURE__*/function(){function RumiousRenderContext(target){_classCallCheck(this,RumiousRenderContext);this.target=target;}return _createClass(RumiousRenderContext,[{key:"find",value:function find(name){return this.target[name]}},{key:"get",value:function get(name){return this.target[name]}}])}();
|
571
|
-
|
572
|
-
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:"requestCleanUp",value:function(){var _requestCleanUp=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var cloned;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(this.element){cloned=this.element.cloneNode(true);this.element.replaceWith(cloned);this.element=cloned;while(this.element.firstChild){this.element.removeChild(this.element.firstChild);}}case 1:case "end":return _context.stop()}},_callee,this)}));function requestCleanUp(){return _requestCleanUp.apply(this,arguments)}return requestCleanUp}()},{key:"onInit",value:function onInit(){}},{key:"onCreate",value:function onCreate(){}},{key:"onRender",value:function onRender(){}},{key:"onUpdate",value:function onUpdate(){}},{key:"onDestroy",value:function onDestroy(){}}])}();function isComponent(component){return Object.getPrototypeOf(component)===RumiousComponent}
|
573
|
-
|
574
|
-
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);}}])}();
|
575
|
-
|
576
|
-
function isCamelCase(str){var camelCaseRegex=/^[a-zA-Z]+([A-Z][a-z]*)*$/;return camelCaseRegex.test(str)}function isFunction(object){return typeof object==="function"}
|
577
|
-
|
578
|
-
var RumiousDirective=/*#__PURE__*/function(){function RumiousDirective(type,name,value){_classCallCheck(this,RumiousDirective);this.type=type;this.name=name;this.value=value;}return _createClass(RumiousDirective,[{key:"init",value:function init(){console.warn("Directive haven't handler !");}}])}();var RumiousEventBindingDirective=/*#__PURE__*/function(_RumiousDirective){function RumiousEventBindingDirective(){_classCallCheck(this,RumiousEventBindingDirective);return _callSuper(this,RumiousEventBindingDirective,arguments)}_inherits(RumiousEventBindingDirective,_RumiousDirective);return _createClass(RumiousEventBindingDirective,[{key:"init",value:function(){var _init=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(dom,renderContext){var _this=this;var fn,getHandler;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:fn=null;getHandler=function getHandler(value){if(!renderContext.find(value)){console.warn("Missing event handler for event: ".concat(_this.name));return null}var handler=renderContext.get(value);if(!isFunction(handler)){throw "".concat(value," is not a function!")}return handler.bind(renderContext.target)};if(!(this.value.type==="string")){_context.next=6;break}fn=getHandler(this.value.value);_context.next=13;break;case 6:if(!(this.value.type==="expression")){_context.next=12;break}fn=this.value.value;if(isFunction(fn)){_context.next=10;break}throw "Event handler requires a function!";case 10:_context.next=13;break;case 12:if(this.value.type==="dynamic_value"){fn=getHandler(this.value.value.objectName);}case 13:if(fn){dom.addEventListener(this.name,fn);}case 14:case "end":return _context.stop()}},_callee,this)}));function init(_x,_x2){return _init.apply(this,arguments)}return init}()}])}(RumiousDirective);var RumiousPropsBindingDirective=/*#__PURE__*/function(_RumiousDirective2){function RumiousPropsBindingDirective(){_classCallCheck(this,RumiousPropsBindingDirective);return _callSuper(this,RumiousPropsBindingDirective,arguments)}_inherits(RumiousPropsBindingDirective,_RumiousDirective2);return _createClass(RumiousPropsBindingDirective,[{key:"init",value:function(){var _init2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dom,renderContext){var _this2=this;var _this$value$evaluator,_this$value,currentStateValue,currentState;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:if(!(this.value.type==="expression")){_context2.next=4;break}_context2.next=13;break;case 4:if(!(this.value.type==="dynamic_value")){_context2.next=13;break}currentStateValue=(_this$value$evaluator=(_this$value=this.value).evaluator)===null||_this$value$evaluator===undefined?undefined:_this$value$evaluator.call(_this$value,renderContext.target);currentState=renderContext.find(this.value.value.objectName);if(currentState){_context2.next=11;break}throw "Invalid props value: Directive bind: require a RumiousState Object !";case 11:currentState.reactor.addBinding(function(){var _this2$value$evaluato,_this2$value;var currentStateValue=(_this2$value$evaluato=(_this2$value=_this2.value).evaluator)===null||_this2$value$evaluato===undefined?undefined:_this2$value$evaluato.call(_this2$value,renderContext.target);_this2.bindAttr(dom,currentStateValue);});case 12:this.bindAttr(dom,currentStateValue);case 13:case "end":return _context2.stop()}},_callee2,this)}));function init(_x3,_x4){return _init2.apply(this,arguments)}return init}()},{key:"normalizeValue",value:function normalizeValue(value){if(_typeof(value)==="object"){var _value$toString,_value$toString2;return (_value$toString=(_value$toString2=value.toString)===null||_value$toString2===undefined?undefined:_value$toString2.call(value))!==null&&_value$toString!==undefined?_value$toString:""}return value}},{key:"bindAttr",value:function(){var _bindAttr=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(dom,value){return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.t0=this.name;_context3.next=_context3.t0==="html"?3:5;break;case 3:dom.innerHTML=this.normalizeValue(value);return _context3.abrupt("break",5);case 5:case "end":return _context3.stop()}},_callee3,this)}));function bindAttr(_x5,_x6){return _bindAttr.apply(this,arguments)}return bindAttr}()}])}(RumiousDirective);var directives={on:function on(event,value){return new RumiousEventBindingDirective("on",event,value)},bind:function bind(attr,value){return new RumiousPropsBindingDirective("bind",attr,value)}};function registerDirective(type,name,value){var _directives$type;return (_directives$type=directives[type])===null||_directives$type===undefined?undefined:_directives$type.call(directives,name,value)}
|
579
|
-
|
580
|
-
function createDirective(type,name,value){return registerDirective(type,name,value)}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,createDirective:createDirective};
|
581
|
-
|
582
|
-
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);this.instance.onInit();}},{key:"connectedCallback",value:function connectedCallback(){this.instance.onCreate();this.instance.requestRender();}},{key:"disconnectCallback",value:function disconnectCallback(){this.instance.onDestroy();this.instance.requestCleanUp();}}])}(/*#__PURE__*/_wrapNativeSuper(HTMLElement));function createComponentElement(){return document.createElement("a-component")}window.customElements.define("a-component",RumiousComponentElement);
|
583
|
-
|
584
|
-
function renderComponent(componentConstructor,props,wrapped,renderer){var componentElement=createComponentElement();componentElement.init(componentConstructor,props,wrapped,renderer);return componentElement}
|
585
|
-
|
586
|
-
function handleComponentElement(element,container,render){var dom=renderComponent(element.props.component,element.props,element.children,render);container.appendChild(dom);return container}function handleFragmentOrElementList(element,container,renderContext){element.children.forEach(function(child){return render(child,container,renderContext)});return container}function handleTextElement(element){return document.createTextNode(element.props.nodeValue)}function handleRegularElement(element,renderContext){var dom=document.createElement(element.type);Object.entries(element.props||{}).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),name=_ref2[0],propValue=_ref2[1];if(name.startsWith("on")&&isCamelCase(name)){dom.addEventListener(name.substring(2).toLowerCase(),propValue);}else {setElementProps(dom,name,propValue,renderContext);}});return dom}function handleDirective(dom,directive,renderContext){directive.init(dom,renderContext);}function setElementProps(dom,name,propValue,renderContext){if(dom.nodeType===Node.TEXT_NODE){dom.nodeValue=propValue;}else if(propValue instanceof RumiousDirective){handleDirective(dom,propValue,renderContext);}else {dom.setAttribute(name,propValue);}}function render(element,container){var renderContext=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!element)return container;var dom;if(element.type==="COMPONENT"){return handleComponentElement(element,container,render)}if(element.type==="FRAGMENT"||element.type==="ELEMENT_LIST"){return handleFragmentOrElementList(element,container,renderContext)}if(element.type==="TEXT_ELEMENT"){dom=handleTextElement(element);}else {dom=handleRegularElement(element,renderContext);}element.children.forEach(function(child){return render(child,dom,renderContext)});container.appendChild(dom);return container}
|
587
|
-
|
588
|
-
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);}}])}();
|
589
|
-
|
590
|
-
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);}}])}();
|
591
|
-
|
592
|
-
var RumiousReducer=/*#__PURE__*/function(){function RumiousReducer(state){var path=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var fn=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,RumiousReducer);this.state=state;this.path=path;this.fn=fn;}return _createClass(RumiousReducer,[{key:"trigger",value:function trigger(){var value=this.fn.apply(this,arguments);this.state.set(this.path,value);}}])}();
|
593
|
-
|
594
|
-
var Operation={Remove:"remove",Replace:"replace",Add:"add"};// Don't use `Symbol()` just for 3rd party access the draft
|
595
|
-
var PROXY_DRAFT=Symbol["for"]("__MUTATIVE_PROXY_DRAFT__");var RAW_RETURN_SYMBOL=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__");var iteratorSymbol=Symbol.iterator;var dataTypes={mutable:"mutable",immutable:"immutable"};var internal={};function has(target,key){return target instanceof Map?target.has(key):Object.prototype.hasOwnProperty.call(target,key)}function getDescriptor(target,key){if(key in target){var prototype=Reflect.getPrototypeOf(target);while(prototype){var descriptor=Reflect.getOwnPropertyDescriptor(prototype,key);if(descriptor)return descriptor;prototype=Reflect.getPrototypeOf(prototype);}}return}function isBaseSetInstance(obj){return Object.getPrototypeOf(obj)===Set.prototype}function isBaseMapInstance(obj){return Object.getPrototypeOf(obj)===Map.prototype}function latest(proxyDraft){var _a;return (_a=proxyDraft.copy)!==null&&_a!==undefined?_a:proxyDraft.original}/**
|
596
|
-
* Check if the value is a draft
|
597
|
-
*/function isDraft(target){return !!getProxyDraft(target)}function getProxyDraft(value){if(_typeof(value)!=="object")return null;return value===null||value===undefined?undefined:value[PROXY_DRAFT]}function getValue(value){var _a;var proxyDraft=getProxyDraft(value);return proxyDraft?(_a=proxyDraft.copy)!==null&&_a!==undefined?_a:proxyDraft.original:value}/**
|
598
|
-
* Check if a value is draftable
|
599
|
-
*/function isDraftable(value,options){if(!value||_typeof(value)!=="object")return false;var markResult;return Object.getPrototypeOf(value)===Object.prototype||Array.isArray(value)||value instanceof Map||value instanceof Set||!!(options===null||options===undefined?undefined:options.mark)&&((markResult=options.mark(value,dataTypes))===dataTypes.immutable||typeof markResult==="function")}function getPath(target){var path=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(Object.hasOwnProperty.call(target,"key")){// check if the parent is a draft and the original value is not equal to the current value
|
600
|
-
var parentCopy=target.parent.copy;var proxyDraft=getProxyDraft(get(parentCopy,target.key));if(proxyDraft!==null&&(proxyDraft===null||proxyDraft===undefined?undefined:proxyDraft.original)!==target.original){return null}var isSet=target.parent.type===3/* DraftType.Set */;var key=isSet?Array.from(target.parent.setMap.keys()).indexOf(target.key):target.key;// check if the key is still in the next state parent
|
601
|
-
if(!(isSet&&parentCopy.size>key||has(parentCopy,key)))return null;path.push(key);}if(target.parent){return getPath(target.parent,path)}// `target` is root draft.
|
602
|
-
path.reverse();try{// check if the path is valid
|
603
|
-
resolvePath(target.copy,path);}catch(e){return null}return path}function getType(target){if(Array.isArray(target))return 1/* DraftType.Array */;if(target instanceof Map)return 2/* DraftType.Map */;if(target instanceof Set)return 3/* DraftType.Set */;return 0/* DraftType.Object */}function get(target,key){return getType(target)===2/* DraftType.Map */?target.get(key):target[key]}function set(target,key,value){var type=getType(target);if(type===2/* DraftType.Map */){target.set(key,value);}else {target[key]=value;}}function peek(target,key){var state=getProxyDraft(target);var source=state?latest(state):target;return source[key]}function isEqual(x,y){if(x===y){return x!==0||1/x===1/y}else {return x!==x&&y!==y}}function revokeProxy(proxyDraft){if(!proxyDraft)return;while(proxyDraft.finalities.revoke.length>0){var revoke=proxyDraft.finalities.revoke.pop();revoke();}}// handle JSON Pointer path with spec https://www.rfc-editor.org/rfc/rfc6901
|
604
|
-
function escapePath(path,pathAsArray){return pathAsArray?path:[""].concat(path).map(function(_item){var item="".concat(_item);if(item.indexOf("/")===-1&&item.indexOf("~")===-1)return item;return item.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function resolvePath(base,path){for(var index=0;index<path.length-1;index+=1){var key=path[index];// use `index` in Set draft
|
605
|
-
base=get(getType(base)===3/* DraftType.Set */?Array.from(base):base,key);if(_typeof(base)!=="object"){throw new Error("Cannot resolve patch at '".concat(path.join("/"),"'."))}}return base}function strictCopy(target){var copy=Object.create(Object.getPrototypeOf(target));Reflect.ownKeys(target).forEach(function(key){var desc=Reflect.getOwnPropertyDescriptor(target,key);if(desc.enumerable&&desc.configurable&&desc.writable){copy[key]=target[key];return}// for freeze
|
606
|
-
if(!desc.writable){desc.writable=true;desc.configurable=true;}if(desc.get||desc.set)desc={configurable:true,writable:true,enumerable:desc.enumerable,value:target[key]};Reflect.defineProperty(copy,key,desc);});return copy}var propIsEnum=Object.prototype.propertyIsEnumerable;function shallowCopy(original,options){var markResult;if(Array.isArray(original)){return Array.prototype.concat.call(original)}else if(original instanceof Set){if(!isBaseSetInstance(original)){var SubClass=Object.getPrototypeOf(original).constructor;return new SubClass(original.values())}return Set.prototype.difference?Set.prototype.difference.call(original,new Set):new Set(original.values())}else if(original instanceof Map){if(!isBaseMapInstance(original)){var _SubClass=Object.getPrototypeOf(original).constructor;return new _SubClass(original)}return new Map(original)}else if((options===null||options===undefined?undefined:options.mark)&&(markResult=options.mark(original,dataTypes),markResult!==undefined)&&markResult!==dataTypes.mutable){if(markResult===dataTypes.immutable){return strictCopy(original)}else if(typeof markResult==="function"){if(options.enablePatches||options.enableAutoFreeze){throw new Error("You can't use mark and patches or auto freeze together.")}return markResult()}throw new Error("Unsupported mark result: ".concat(markResult))}else if(_typeof(original)==="object"&&Object.getPrototypeOf(original)===Object.prototype){// For best performance with shallow copies,
|
607
|
-
// don't use `Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));` by default.
|
608
|
-
var copy={};Object.keys(original).forEach(function(key){copy[key]=original[key];});Object.getOwnPropertySymbols(original).forEach(function(key){if(propIsEnum.call(original,key)){copy[key]=original[key];}});return copy}else {throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}}function ensureShallowCopy(target){if(target.copy)return;target.copy=shallowCopy(target.original,target.options);}function deepClone(target){if(!isDraftable(target))return getValue(target);if(Array.isArray(target))return target.map(deepClone);if(target instanceof Map){var iterable=Array.from(target.entries()).map(function(_ref){var _ref2=_slicedToArray(_ref,2),k=_ref2[0],v=_ref2[1];return [k,deepClone(v)]});if(!isBaseMapInstance(target)){var SubClass=Object.getPrototypeOf(target).constructor;return new SubClass(iterable)}return new Map(iterable)}if(target instanceof Set){var _iterable=Array.from(target).map(deepClone);if(!isBaseSetInstance(target)){var _SubClass2=Object.getPrototypeOf(target).constructor;return new _SubClass2(_iterable)}return new Set(_iterable)}var copy=Object.create(Object.getPrototypeOf(target));for(var key in target)copy[key]=deepClone(target[key]);return copy}function cloneIfNeeded(target){return isDraft(target)?deepClone(target):target}function markChanged(proxyDraft){var _a;proxyDraft.assignedMap=(_a=proxyDraft.assignedMap)!==null&&_a!==undefined?_a:new Map;if(!proxyDraft.operated){proxyDraft.operated=true;if(proxyDraft.parent){markChanged(proxyDraft.parent);}}}function throwFrozenError(){throw new Error("Cannot modify frozen object")}function deepFreeze(target,subKey,updatedValues,stack,keys){{updatedValues=updatedValues!==null&&updatedValues!==undefined?updatedValues:new WeakMap;stack=stack!==null&&stack!==undefined?stack:[];keys=keys!==null&&keys!==undefined?keys:[];var value=updatedValues.has(target)?updatedValues.get(target):target;if(stack.length>0){var index=stack.indexOf(value);if(value&&_typeof(value)==="object"&&index!==-1){if(stack[0]===value){throw new Error("Forbids circular reference")}throw new Error("Forbids circular reference: ~/".concat(keys.slice(0,index).map(function(key,index){if(_typeof(key)==="symbol")return "[".concat(key.toString(),"]");var parent=stack[index];if(_typeof(key)==="object"&&(parent instanceof Map||parent instanceof Set))return Array.from(parent.keys()).indexOf(key);return key}).join("/")))}stack.push(value);keys.push(subKey);}else {stack.push(value);}}if(Object.isFrozen(target)||isDraft(target)){{stack.pop();keys.pop();}return}var type=getType(target);switch(type){case 2/* DraftType.Map */:var _iterator=_createForOfIteratorHelper(target),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _step$value=_slicedToArray(_step.value,2),key=_step$value[0],_value2=_step$value[1];deepFreeze(key,key,updatedValues,stack,keys);deepFreeze(_value2,key,updatedValues,stack,keys);}}catch(err){_iterator.e(err);}finally{_iterator.f();}target.set=target.clear=target["delete"]=throwFrozenError;break;case 3/* DraftType.Set */:var _iterator2=_createForOfIteratorHelper(target),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _value3=_step2.value;deepFreeze(_value3,_value3,updatedValues,stack,keys);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}target.add=target.clear=target["delete"]=throwFrozenError;break;case 1/* DraftType.Array */:Object.freeze(target);var _index=0;var _iterator3=_createForOfIteratorHelper(target),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _value4=_step3.value;deepFreeze(_value4,_index,updatedValues,stack,keys);_index+=1;}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}break;default:Object.freeze(target);// ignore non-enumerable or symbol properties
|
609
|
-
Object.keys(target).forEach(function(name){var value=target[name];deepFreeze(value,name,updatedValues,stack,keys);});}{stack.pop();keys.pop();}}function forEach(target,iter){var type=getType(target);if(type===0/* DraftType.Object */){Reflect.ownKeys(target).forEach(function(key){iter(key,target[key],target);});}else if(type===1/* DraftType.Array */){var index=0;var _iterator4=_createForOfIteratorHelper(target),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var entry=_step4.value;iter(index,entry,target);index+=1;}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}else {target.forEach(function(entry,index){return iter(index,entry,target)});}}function handleValue(target,handledSet,options){if(isDraft(target)||!isDraftable(target,options)||handledSet.has(target)||Object.isFrozen(target))return;var isSet=target instanceof Set;var setMap=isSet?new Map:undefined;handledSet.add(target);forEach(target,function(key,value){var _a;if(isDraft(value)){var proxyDraft=getProxyDraft(value);ensureShallowCopy(proxyDraft);// A draft where a child node has been changed, or assigned a value
|
610
|
-
var updatedValue=((_a=proxyDraft.assignedMap)===null||_a===void 0?void 0:_a.size)||proxyDraft.operated?proxyDraft.copy:proxyDraft.original;// final update value
|
611
|
-
set(isSet?setMap:target,key,updatedValue);}else {handleValue(value,handledSet,options);}});if(setMap){var _set=target;var values=Array.from(_set);_set.clear();values.forEach(function(value){_set.add(setMap.has(value)?setMap.get(value):value);});}}function finalizeAssigned(proxyDraft,key){// handle the draftable assigned values, and the value is not a draft
|
612
|
-
var copy=proxyDraft.type===3/* DraftType.Set */?proxyDraft.setMap:proxyDraft.copy;if(proxyDraft.finalities.revoke.length>1&&proxyDraft.assignedMap.get(key)&©){handleValue(get(copy,key),proxyDraft.finalities.handledSet,proxyDraft.options);}}function finalizeSetValue(target){if(target.type===3/* DraftType.Set */&&target.copy){target.copy.clear();target.setMap.forEach(function(value){target.copy.add(getValue(value));});}}function finalizePatches(target,generatePatches,patches,inversePatches){var shouldFinalize=target.operated&&target.assignedMap&&target.assignedMap.size>0&&!target.finalized;if(shouldFinalize){if(patches&&inversePatches){var basePath=getPath(target);if(basePath){generatePatches(target,basePath,patches,inversePatches);}}target.finalized=true;}}function markFinalization(target,key,value,generatePatches){var proxyDraft=getProxyDraft(value);if(proxyDraft){// !case: assign the draft value
|
613
|
-
if(!proxyDraft.callbacks){proxyDraft.callbacks=[];}proxyDraft.callbacks.push(function(patches,inversePatches){var _a;var copy=target.type===3/* DraftType.Set */?target.setMap:target.copy;if(isEqual(get(copy,key),value)){var updatedValue=proxyDraft.original;if(proxyDraft.copy){updatedValue=proxyDraft.copy;}finalizeSetValue(target);finalizePatches(target,generatePatches,patches,inversePatches);if(target.options.enableAutoFreeze){target.options.updatedValues=(_a=target.options.updatedValues)!==null&&_a!==undefined?_a:new WeakMap;target.options.updatedValues.set(updatedValue,proxyDraft.original);}// final update value
|
614
|
-
set(copy,key,updatedValue);}});if(target.options.enableAutoFreeze){// !case: assign the draft value in cross draft tree
|
615
|
-
if(proxyDraft.finalities!==target.finalities){target.options.enableAutoFreeze=false;}}}if(isDraftable(value,target.options)){// !case: assign the non-draft value
|
616
|
-
target.finalities.draft.push(function(){var copy=target.type===3/* DraftType.Set */?target.setMap:target.copy;if(isEqual(get(copy,key),value)){finalizeAssigned(target,key);}});}}function generateArrayPatches(proxyState,basePath,patches,inversePatches,pathAsArray){var original=proxyState.original,assignedMap=proxyState.assignedMap,options=proxyState.options;var copy=proxyState.copy;if(copy.length<original.length){var _ref3=[copy,original];original=_ref3[0];copy=_ref3[1];var _ref4=[inversePatches,patches];patches=_ref4[0];inversePatches=_ref4[1];}for(var index=0;index<original.length;index+=1){if(assignedMap.get(index.toString())&©[index]!==original[index]){var _path=basePath.concat([index]);var path=escapePath(_path,pathAsArray);patches.push({op:Operation.Replace,path:path,// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
617
|
-
value:cloneIfNeeded(copy[index])});inversePatches.push({op:Operation.Replace,path:path,// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
618
|
-
value:cloneIfNeeded(original[index])});}}for(var _index2=original.length;_index2<copy.length;_index2+=1){var _path2=basePath.concat([_index2]);var _path3=escapePath(_path2,pathAsArray);patches.push({op:Operation.Add,path:_path3,// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
619
|
-
value:cloneIfNeeded(copy[_index2])});}if(original.length<copy.length){// https://www.rfc-editor.org/rfc/rfc6902#appendix-A.4
|
620
|
-
// For performance, here we only generate an operation that replaces the length of the array,
|
621
|
-
// which is inconsistent with JSON Patch specification
|
622
|
-
var _options$enablePatche=options.enablePatches.arrayLengthAssignment,arrayLengthAssignment=_options$enablePatche===undefined?true:_options$enablePatche;if(arrayLengthAssignment){var _path4=basePath.concat(["length"]);var _path5=escapePath(_path4,pathAsArray);inversePatches.push({op:Operation.Replace,path:_path5,value:original.length});}else {for(var _index3=copy.length;original.length<_index3;_index3-=1){var _path6=basePath.concat([_index3-1]);var _path7=escapePath(_path6,pathAsArray);inversePatches.push({op:Operation.Remove,path:_path7});}}}}function generatePatchesFromAssigned(_ref5,basePath,patches,inversePatches,pathAsArray){var original=_ref5.original,copy=_ref5.copy,assignedMap=_ref5.assignedMap;assignedMap.forEach(function(assignedValue,key){var originalValue=get(original,key);var value=cloneIfNeeded(get(copy,key));var op=!assignedValue?Operation.Remove:has(original,key)?Operation.Replace:Operation.Add;if(isEqual(originalValue,value)&&op===Operation.Replace)return;var _path=basePath.concat(key);var path=escapePath(_path,pathAsArray);patches.push(op===Operation.Remove?{op:op,path:path}:{op:op,path:path,value:value});inversePatches.push(op===Operation.Add?{op:Operation.Remove,path:path}:op===Operation.Remove?{op:Operation.Add,path:path,value:originalValue}:{op:Operation.Replace,path:path,value:originalValue});});}function generateSetPatches(_ref6,basePath,patches,inversePatches,pathAsArray){var original=_ref6.original,copy=_ref6.copy;var index=0;original.forEach(function(value){if(!copy.has(value)){var _path=basePath.concat([index]);var path=escapePath(_path,pathAsArray);patches.push({op:Operation.Remove,path:path,value:value});inversePatches.unshift({op:Operation.Add,path:path,value:value});}index+=1;});index=0;copy.forEach(function(value){if(!original.has(value)){var _path=basePath.concat([index]);var path=escapePath(_path,pathAsArray);patches.push({op:Operation.Add,path:path,value:value});inversePatches.unshift({op:Operation.Remove,path:path,value:value});}index+=1;});}function generatePatches(proxyState,basePath,patches,inversePatches){var _proxyState$options$e=proxyState.options.enablePatches.pathAsArray,pathAsArray=_proxyState$options$e===undefined?true:_proxyState$options$e;switch(proxyState.type){case 0/* DraftType.Object */:case 2/* DraftType.Map */:return generatePatchesFromAssigned(proxyState,basePath,patches,inversePatches,pathAsArray);case 1/* DraftType.Array */:return generateArrayPatches(proxyState,basePath,patches,inversePatches,pathAsArray);case 3/* DraftType.Set */:return generateSetPatches(proxyState,basePath,patches,inversePatches,pathAsArray)}}var checkReadable=function checkReadable(value,options){var ignoreCheckDraftable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(_typeof(value)==="object"&&value!==null&&(!isDraftable(value,options)||ignoreCheckDraftable)&&true){throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")}};var mapHandler=_defineProperty({get size(){var current=latest(getProxyDraft(this));return current.size},has:function has(key){return latest(getProxyDraft(this)).has(key)},set:function set(key,value){var target=getProxyDraft(this);var source=latest(target);if(!source.has(key)||!isEqual(source.get(key),value)){ensureShallowCopy(target);markChanged(target);target.assignedMap.set(key,true);target.copy.set(key,value);markFinalization(target,key,value,generatePatches);}return this},"delete":function _delete(key){if(!this.has(key)){return false}var target=getProxyDraft(this);ensureShallowCopy(target);markChanged(target);if(target.original.has(key)){target.assignedMap.set(key,false);}else {target.assignedMap["delete"](key);}target.copy["delete"](key);return true},clear:function clear(){var target=getProxyDraft(this);if(!this.size)return;ensureShallowCopy(target);markChanged(target);target.assignedMap=new Map;var _iterator5=_createForOfIteratorHelper(target.original),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_slicedToArray(_step5.value,1),key=_step5$value[0];target.assignedMap.set(key,false);}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}target.copy.clear();},forEach:function forEach(callback,thisArg){var _this=this;var target=getProxyDraft(this);latest(target).forEach(function(_value,_key){callback.call(thisArg,_this.get(_key),_key,_this);});},get:function get(key){var _a,_b;var target=getProxyDraft(this);var value=latest(target).get(key);var mutable=((_b=(_a=target.options).mark)===null||_b===undefined?undefined:_b.call(_a,value,dataTypes))===dataTypes.mutable;if(target.options.strict){checkReadable(value,target.options,mutable);}if(mutable){return value}if(target.finalized||!isDraftable(value,target.options)){return value}// drafted or reassigned
|
623
|
-
if(value!==target.original.get(key)){return value}var draft=internal.createDraft({original:value,parentDraft:target,key:key,finalities:target.finalities,options:target.options});ensureShallowCopy(target);target.copy.set(key,draft);return draft},keys:function keys(){return latest(getProxyDraft(this)).keys()},values:function values(){var _this2=this;var iterator=this.keys();return _defineProperty(_defineProperty({},iteratorSymbol,function(){return _this2.values()}),"next",function next(){var result=iterator.next();if(result.done)return result;var value=_this2.get(result.value);return {done:false,value:value}})},entries:function entries(){var _this3=this;var iterator=this.keys();return _defineProperty(_defineProperty({},iteratorSymbol,function(){return _this3.entries()}),"next",function next(){var result=iterator.next();if(result.done)return result;var value=_this3.get(result.value);return {done:false,value:[result.value,value]}})}},iteratorSymbol,function(){return this.entries()});var mapHandlerKeys=Reflect.ownKeys(mapHandler);var getNextIterator=function getNextIterator(target,iterator,_ref9){var isValuesIterator=_ref9.isValuesIterator;return function(){var _a,_b;var result=iterator.next();if(result.done)return result;var key=result.value;var value=target.setMap.get(key);var currentDraft=getProxyDraft(value);var mutable=((_b=(_a=target.options).mark)===null||_b===undefined?undefined:_b.call(_a,value,dataTypes))===dataTypes.mutable;if(target.options.strict){checkReadable(key,target.options,mutable);}if(!mutable&&!currentDraft&&isDraftable(key,target.options)&&!target.finalized&&target.original.has(key)){// draft a draftable original set item
|
624
|
-
var proxy=internal.createDraft({original:key,parentDraft:target,key:key,finalities:target.finalities,options:target.options});target.setMap.set(key,proxy);value=proxy;}else if(currentDraft){// drafted
|
625
|
-
value=currentDraft.proxy;}return {done:false,value:isValuesIterator?value:[value,value]}}};var setHandler=_defineProperty(_defineProperty({get size(){var target=getProxyDraft(this);return target.setMap.size},has:function has(value){var target=getProxyDraft(this);// reassigned or non-draftable values
|
626
|
-
if(target.setMap.has(value))return true;ensureShallowCopy(target);var valueProxyDraft=getProxyDraft(value);// drafted
|
627
|
-
if(valueProxyDraft&&target.setMap.has(valueProxyDraft.original))return true;return false},add:function add(value){var target=getProxyDraft(this);if(!this.has(value)){ensureShallowCopy(target);markChanged(target);target.assignedMap.set(value,true);target.setMap.set(value,value);markFinalization(target,value,value,generatePatches);}return this},"delete":function _delete(value){if(!this.has(value)){return false}var target=getProxyDraft(this);ensureShallowCopy(target);markChanged(target);var valueProxyDraft=getProxyDraft(value);if(valueProxyDraft&&target.setMap.has(valueProxyDraft.original)){// delete drafted
|
628
|
-
target.assignedMap.set(valueProxyDraft.original,false);return target.setMap["delete"](valueProxyDraft.original)}if(!valueProxyDraft&&target.setMap.has(value)){// non-draftable values
|
629
|
-
target.assignedMap.set(value,false);}else {// reassigned
|
630
|
-
target.assignedMap["delete"](value);}// delete reassigned or non-draftable values
|
631
|
-
return target.setMap["delete"](value)},clear:function clear(){if(!this.size)return;var target=getProxyDraft(this);ensureShallowCopy(target);markChanged(target);var _iterator6=_createForOfIteratorHelper(target.original),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var value=_step6.value;target.assignedMap.set(value,false);}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}target.setMap.clear();},values:function values(){var _this4=this;var target=getProxyDraft(this);ensureShallowCopy(target);var iterator=target.setMap.keys();return _defineProperty(_defineProperty({},Symbol.iterator,function(){return _this4.values()}),"next",getNextIterator(target,iterator,{isValuesIterator:true}))},entries:function entries(){var _this5=this;var target=getProxyDraft(this);ensureShallowCopy(target);var iterator=target.setMap.keys();return _defineProperty(_defineProperty({},Symbol.iterator,function(){return _this5.entries()}),"next",getNextIterator(target,iterator,{isValuesIterator:false}))},keys:function keys(){return this.values()}},iteratorSymbol,function(){return this.values()}),"forEach",function forEach(callback,thisArg){var iterator=this.values();var result=iterator.next();while(!result.done){callback.call(thisArg,result.value,result.value,this);result=iterator.next();}});if(Set.prototype.difference){// for compatibility with new Set methods
|
632
|
-
// https://github.com/tc39/proposal-set-methods
|
633
|
-
// And `https://github.com/tc39/proposal-set-methods/blob/main/details.md#symbolspecies` has some details about the `@@species` symbol.
|
634
|
-
// So we can't use SubSet instance constructor to get the constructor of the SubSet instance.
|
635
|
-
Object.assign(setHandler,{intersection:function intersection(other){return Set.prototype.intersection.call(new Set(this.values()),other)},union:function union(other){return Set.prototype.union.call(new Set(this.values()),other)},difference:function difference(other){return Set.prototype.difference.call(new Set(this.values()),other)},symmetricDifference:function symmetricDifference(other){return Set.prototype.symmetricDifference.call(new Set(this.values()),other)},isSubsetOf:function isSubsetOf(other){return Set.prototype.isSubsetOf.call(new Set(this.values()),other)},isSupersetOf:function isSupersetOf(other){return Set.prototype.isSupersetOf.call(new Set(this.values()),other)},isDisjointFrom:function isDisjointFrom(other){return Set.prototype.isDisjointFrom.call(new Set(this.values()),other)}});}var setHandlerKeys=Reflect.ownKeys(setHandler);var draftsCache=new WeakSet;var proxyHandler={get:function get(target,key,receiver){var _a,_b;var copy=(_a=target.copy)===null||_a===undefined?undefined:_a[key];// Improve draft reading performance by caching the draft copy.
|
636
|
-
if(copy&&draftsCache.has(copy)){return copy}if(key===PROXY_DRAFT)return target;var markResult;if(target.options.mark){// handle `Uncaught TypeError: Method get Map.prototype.size called on incompatible receiver #<Map>`
|
637
|
-
// or `Uncaught TypeError: Method get Set.prototype.size called on incompatible receiver #<Set>`
|
638
|
-
var _value5=key==="size"&&(target.original instanceof Map||target.original instanceof Set)?Reflect.get(target.original,key):Reflect.get(target.original,key,receiver);markResult=target.options.mark(_value5,dataTypes);if(markResult===dataTypes.mutable){if(target.options.strict){checkReadable(_value5,target.options,true);}return _value5}}var source=latest(target);if(source instanceof Map&&mapHandlerKeys.includes(key)){if(key==="size"){return Object.getOwnPropertyDescriptor(mapHandler,"size").get.call(target.proxy)}var handle=mapHandler[key];if(handle){return handle.bind(target.proxy)}}if(source instanceof Set&&setHandlerKeys.includes(key)){if(key==="size"){return Object.getOwnPropertyDescriptor(setHandler,"size").get.call(target.proxy)}var _handle=setHandler[key];if(_handle){return _handle.bind(target.proxy)}}if(!has(source,key)){var desc=getDescriptor(source,key);return desc?"value"in desc?desc.value:// !case: support for getter
|
639
|
-
(_b=desc.get)===null||_b===undefined?undefined:_b.call(target.proxy):undefined}var value=source[key];if(target.options.strict){checkReadable(value,target.options);}if(target.finalized||!isDraftable(value,target.options)){return value}// Ensure that the assigned values are not drafted
|
640
|
-
if(value===peek(target.original,key)){ensureShallowCopy(target);target.copy[key]=createDraft({original:target.original[key],parentDraft:target,key:target.type===1/* DraftType.Array */?Number(key):key,finalities:target.finalities,options:target.options});// !case: support for custom shallow copy function
|
641
|
-
if(typeof markResult==="function"){var subProxyDraft=getProxyDraft(target.copy[key]);ensureShallowCopy(subProxyDraft);// Trigger a custom shallow copy to update to a new copy
|
642
|
-
markChanged(subProxyDraft);return subProxyDraft.copy}return target.copy[key]}return value},set:function set(target,key,value){var _a;if(target.type===3/* DraftType.Set */||target.type===2/* DraftType.Map */){throw new Error("Map/Set draft does not support any property assignment.")}var _key;if(target.type===1/* DraftType.Array */&&key!=="length"&&!(Number.isInteger(_key=Number(key))&&_key>=0&&(key===0||_key===0||String(_key)===String(key)))){throw new Error("Only supports setting array indices and the 'length' property.")}var desc=getDescriptor(latest(target),key);if(desc===null||desc===undefined?undefined:desc.set){// !case: cover the case of setter
|
643
|
-
desc.set.call(target.proxy,value);return true}var current=peek(latest(target),key);var currentProxyDraft=getProxyDraft(current);if(currentProxyDraft&&isEqual(currentProxyDraft.original,value)){// !case: ignore the case of assigning the original draftable value to a draft
|
644
|
-
target.copy[key]=value;target.assignedMap=(_a=target.assignedMap)!==null&&_a!==undefined?_a:new Map;target.assignedMap.set(key,false);return true}// !case: handle new props with value 'undefined'
|
645
|
-
if(isEqual(value,current)&&(value!==undefined||has(target.original,key)))return true;ensureShallowCopy(target);markChanged(target);if(has(target.original,key)&&isEqual(value,target.original[key])){// !case: handle the case of assigning the original non-draftable value to a draft
|
646
|
-
target.assignedMap["delete"](key);}else {target.assignedMap.set(key,true);}target.copy[key]=value;markFinalization(target,key,value,generatePatches);return true},has:function has(target,key){return key in latest(target)},ownKeys:function ownKeys(target){return Reflect.ownKeys(latest(target))},getOwnPropertyDescriptor:function getOwnPropertyDescriptor(target,key){var source=latest(target);var descriptor=Reflect.getOwnPropertyDescriptor(source,key);if(!descriptor)return descriptor;return {writable:true,configurable:target.type!==1/* DraftType.Array */||key!=="length",enumerable:descriptor.enumerable,value:source[key]}},getPrototypeOf:function getPrototypeOf(target){return Reflect.getPrototypeOf(target.original)},setPrototypeOf:function setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty:function defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty:function deleteProperty(target,key){var _a;if(target.type===1/* DraftType.Array */){return proxyHandler.set.call(this,target,key,undefined,target.proxy)}if(peek(target.original,key)!==undefined||key in target.original){// !case: delete an existing key
|
647
|
-
ensureShallowCopy(target);markChanged(target);target.assignedMap.set(key,false);}else {target.assignedMap=(_a=target.assignedMap)!==null&&_a!==undefined?_a:new Map;// The original non-existent key has been deleted
|
648
|
-
target.assignedMap["delete"](key);}if(target.copy)delete target.copy[key];return true}};function createDraft(createDraftOptions){var original=createDraftOptions.original,parentDraft=createDraftOptions.parentDraft,key=createDraftOptions.key,finalities=createDraftOptions.finalities,options=createDraftOptions.options;var type=getType(original);var proxyDraft={type:type,finalized:false,parent:parentDraft,original:original,copy:null,proxy:null,finalities:finalities,options:options,// Mapping of draft Set items to their corresponding draft values.
|
649
|
-
setMap:type===3/* DraftType.Set */?new Map(original.entries()):undefined};// !case: undefined as a draft map key
|
650
|
-
if(key||"key"in createDraftOptions){proxyDraft.key=key;}var _Proxy$revocable=Proxy.revocable(type===1/* DraftType.Array */?Object.assign([],proxyDraft):proxyDraft,proxyHandler),proxy=_Proxy$revocable.proxy,revoke=_Proxy$revocable.revoke;finalities.revoke.push(revoke);draftsCache.add(proxy);proxyDraft.proxy=proxy;if(parentDraft){var target=parentDraft;target.finalities.draft.push(function(patches,inversePatches){var _a,_b;var oldProxyDraft=getProxyDraft(proxy);// if target is a Set draft, `setMap` is the real Set copies proxy mapping.
|
651
|
-
var copy=target.type===3/* DraftType.Set */?target.setMap:target.copy;var draft=get(copy,key);var proxyDraft=getProxyDraft(draft);if(proxyDraft){// assign the updated value to the copy object
|
652
|
-
var updatedValue=proxyDraft.original;if(proxyDraft.operated){updatedValue=getValue(draft);}finalizeSetValue(proxyDraft);finalizePatches(proxyDraft,generatePatches,patches,inversePatches);if(target.options.enableAutoFreeze){target.options.updatedValues=(_a=target.options.updatedValues)!==null&&_a!==undefined?_a:new WeakMap;target.options.updatedValues.set(updatedValue,proxyDraft.original);}// final update value
|
653
|
-
set(copy,key,updatedValue);}// !case: handle the deleted key
|
654
|
-
(_b=oldProxyDraft.callbacks)===null||_b===undefined?undefined:_b.forEach(function(callback){callback(patches,inversePatches);});});}else {// !case: handle the root draft
|
655
|
-
var _target=getProxyDraft(proxy);_target.finalities.draft.push(function(patches,inversePatches){finalizeSetValue(_target);finalizePatches(_target,generatePatches,patches,inversePatches);});}return proxy}internal.createDraft=createDraft;function finalizeDraft(result,returnedValue,patches,inversePatches,enableAutoFreeze){var _a;var proxyDraft=getProxyDraft(result);var original=(_a=proxyDraft===null||proxyDraft===undefined?undefined:proxyDraft.original)!==null&&_a!==undefined?_a:result;var hasReturnedValue=!!returnedValue.length;if(proxyDraft===null||proxyDraft===undefined?undefined:proxyDraft.operated){while(proxyDraft.finalities.draft.length>0){var finalize=proxyDraft.finalities.draft.pop();finalize(patches,inversePatches);}}var state=hasReturnedValue?returnedValue[0]:proxyDraft?proxyDraft.operated?proxyDraft.copy:proxyDraft.original:result;if(proxyDraft)revokeProxy(proxyDraft);if(enableAutoFreeze){deepFreeze(state,state,proxyDraft===null||proxyDraft===undefined?undefined:proxyDraft.options.updatedValues);}return [state,patches&&hasReturnedValue?[{op:Operation.Replace,path:[],value:returnedValue[0]}]:patches,inversePatches&&hasReturnedValue?[{op:Operation.Replace,path:[],value:original}]:inversePatches]}function draftify(baseState,options){var _a;var finalities={draft:[],revoke:[],handledSet:new WeakSet};var patches;var inversePatches;if(options.enablePatches){patches=[];inversePatches=[];}var isMutable=((_a=options.mark)===null||_a===undefined?undefined:_a.call(options,baseState,dataTypes))===dataTypes.mutable||!isDraftable(baseState,options);var draft=isMutable?baseState:createDraft({original:baseState,parentDraft:null,finalities:finalities,options:options});return [draft,function(){var returnedValue=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var _finalizeDraft=finalizeDraft(draft,returnedValue,patches,inversePatches,options.enableAutoFreeze),_finalizeDraft2=_slicedToArray(_finalizeDraft,3),finalizedState=_finalizeDraft2[0],finalizedPatches=_finalizeDraft2[1],finalizedInversePatches=_finalizeDraft2[2];return options.enablePatches?[finalizedState,finalizedPatches,finalizedInversePatches]:finalizedState}]}function handleReturnValue(options){var rootDraft=options.rootDraft,value=options.value,_options$useRawReturn=options.useRawReturn,useRawReturn=_options$useRawReturn===undefined?false:_options$useRawReturn,_options$isRoot=options.isRoot,isRoot=_options$isRoot===undefined?true:_options$isRoot;forEach(value,function(key,item,source){var proxyDraft=getProxyDraft(item);// just handle the draft which is created by the same rootDraft
|
656
|
-
if(proxyDraft&&rootDraft&&proxyDraft.finalities===rootDraft.finalities){options.isContainDraft=true;var currentValue=proxyDraft.original;// final update value, but just handle return value
|
657
|
-
if(source instanceof Set){var arr=Array.from(source);source.clear();arr.forEach(function(_item){return source.add(key===_item?currentValue:_item)});}else {set(source,key,currentValue);}}else if(_typeof(item)==="object"&&item!==null){options.value=item;options.isRoot=false;handleReturnValue(options);}});if(isRoot){if(!options.isContainDraft)console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance.");if(useRawReturn){console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value.");}}}function getCurrent(target){var _a;var proxyDraft=getProxyDraft(target);if(!isDraftable(target,proxyDraft===null||proxyDraft===undefined?undefined:proxyDraft.options))return target;var type=getType(target);if(proxyDraft&&!proxyDraft.operated)return proxyDraft.original;var currentValue;function ensureShallowCopy(){currentValue=type===2/* DraftType.Map */?!isBaseMapInstance(target)?new(Object.getPrototypeOf(target).constructor)(target):new Map(target):type===3/* DraftType.Set */?Array.from(proxyDraft.setMap.values()):shallowCopy(target,proxyDraft===null||proxyDraft===undefined?undefined:proxyDraft.options);}if(proxyDraft){// It's a proxy draft, let's create a shallow copy eagerly
|
658
|
-
proxyDraft.finalized=true;try{ensureShallowCopy();}finally{proxyDraft.finalized=false;}}else {// It's not a proxy draft, let's use the target directly and let's see
|
659
|
-
// lazily if we need to create a shallow copy
|
660
|
-
currentValue=target;}forEach(currentValue,function(key,value){if(proxyDraft&&isEqual(get(proxyDraft.original,key),value))return;var newValue=getCurrent(value);if(newValue!==value){if(currentValue===target)ensureShallowCopy();set(currentValue,key,newValue);}});if(type===3/* DraftType.Set */){var value=(_a=proxyDraft===null||proxyDraft===undefined?undefined:proxyDraft.original)!==null&&_a!==undefined?_a:currentValue;return !isBaseSetInstance(value)?new(Object.getPrototypeOf(value).constructor)(currentValue):new Set(currentValue)}return currentValue}function current(target){if(!isDraft(target)){throw new Error("current() is only used for Draft, parameter: ".concat(target))}return getCurrent(target)}/**
|
661
|
-
* `makeCreator(options)` to make a creator function.
|
662
|
-
*
|
663
|
-
* ## Example
|
664
|
-
*
|
665
|
-
* ```ts
|
666
|
-
* import { makeCreator } from '../index';
|
667
|
-
*
|
668
|
-
* const baseState = { foo: { bar: 'str' }, arr: [] };
|
669
|
-
* const create = makeCreator({ enableAutoFreeze: true });
|
670
|
-
* const state = create(
|
671
|
-
* baseState,
|
672
|
-
* (draft) => {
|
673
|
-
* draft.foo.bar = 'str2';
|
674
|
-
* },
|
675
|
-
* );
|
676
|
-
*
|
677
|
-
* expect(state).toEqual({ foo: { bar: 'str2' }, arr: [] });
|
678
|
-
* expect(state).not.toBe(baseState);
|
679
|
-
* expect(state.foo).not.toBe(baseState.foo);
|
680
|
-
* expect(state.arr).toBe(baseState.arr);
|
681
|
-
* expect(Object.isFrozen(state)).toBeTruthy();
|
682
|
-
* ```
|
683
|
-
*/var makeCreator=function makeCreator(arg){return function create(arg0,arg1,arg2){var _a,_b,_c;if(typeof arg0==="function"&&typeof arg1!=="function"){return function(base){var _this6=this;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key2=1;_key2<_len;_key2++){args[_key2-1]=arguments[_key2];}return create(base,function(draft){return arg0.call.apply(arg0,[_this6,draft].concat(args))},arg1)}}var base=arg0;var mutate=arg1;var options=arg2;if(typeof arg1!=="function"){options=arg1;}if(options!==undefined&&Object.prototype.toString.call(options)!=="[object Object]"){throw new Error("Invalid options: ".concat(options,", 'options' should be an object."))}options=Object.assign(Object.assign({},arg),options);var state=isDraft(base)?current(base):base;var mark=Array.isArray(options.mark)?function(value,types){var _iterator7=_createForOfIteratorHelper(options.mark),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _mark=_step7.value;if(typeof _mark!=="function"){throw new Error("Invalid mark: ".concat(_mark,", 'mark' should be a function."))}var _result=_mark(value,types);if(_result){return _result}}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}return}:options.mark;var enablePatches=(_a=options.enablePatches)!==null&&_a!==undefined?_a:false;var strict=(_b=options.strict)!==null&&_b!==undefined?_b:false;var enableAutoFreeze=(_c=options.enableAutoFreeze)!==null&&_c!==undefined?_c:false;var _options={enableAutoFreeze:enableAutoFreeze,mark:mark,strict:strict,enablePatches:enablePatches};if(!isDraftable(state,_options)&&_typeof(state)==="object"&&state!==null){throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.")}var _draftify=draftify(state,_options),_draftify2=_slicedToArray(_draftify,2),draft=_draftify2[0],finalize=_draftify2[1];if(typeof arg1!=="function"){if(!isDraftable(state,_options)){throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.")}return [draft,finalize]}var result;try{result=mutate(draft);}catch(error){revokeProxy(getProxyDraft(draft));throw error}var returnValue=function returnValue(value){var proxyDraft=getProxyDraft(draft);if(!isDraft(value)){if(value!==undefined&&!isEqual(value,draft)&&(proxyDraft===null||proxyDraft===undefined?undefined:proxyDraft.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.")}var rawReturnValue=value===null||value===undefined?undefined:value[RAW_RETURN_SYMBOL];if(rawReturnValue){var _value=rawReturnValue[0];if(_options.strict&&_typeof(value)==="object"&&value!==null){handleReturnValue({rootDraft:proxyDraft,value:value,useRawReturn:true});}return finalize([_value])}if(value!==undefined){if(_typeof(value)==="object"&&value!==null){handleReturnValue({rootDraft:proxyDraft,value:value});}return finalize([value])}}if(value===draft||value===undefined){return finalize([])}var returnedProxyDraft=getProxyDraft(value);if(_options===returnedProxyDraft.options){if(returnedProxyDraft.operated){throw new Error("Cannot return a modified child draft.")}return finalize([current(value)])}return finalize([value])};if(result instanceof Promise){return result.then(returnValue,function(error){revokeProxy(getProxyDraft(draft));throw error})}return returnValue(result)}};/**
|
684
|
-
* `create(baseState, callback, options)` to create the next state
|
685
|
-
*
|
686
|
-
* ## Example
|
687
|
-
*
|
688
|
-
* ```ts
|
689
|
-
* import { create } from '../index';
|
690
|
-
*
|
691
|
-
* const baseState = { foo: { bar: 'str' }, arr: [] };
|
692
|
-
* const state = create(
|
693
|
-
* baseState,
|
694
|
-
* (draft) => {
|
695
|
-
* draft.foo.bar = 'str2';
|
696
|
-
* },
|
697
|
-
* );
|
698
|
-
*
|
699
|
-
* expect(state).toEqual({ foo: { bar: 'str2' }, arr: [] });
|
700
|
-
* expect(state).not.toBe(baseState);
|
701
|
-
* expect(state.foo).not.toBe(baseState.foo);
|
702
|
-
* expect(state.arr).toBe(baseState.arr);
|
703
|
-
* ```
|
704
|
-
*/var create=makeCreator();Object.prototype.constructor.toString();
|
705
|
-
|
706
|
-
function produceState(state,fn){state.set(create(state.get(),fn));}
|
707
|
-
|
708
|
-
var RumiousState=/*#__PURE__*/function(){function RumiousState(target){var reactor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;_classCallCheck(this,RumiousState);this.value=target;this.reactor=reactor!==null&&reactor!==undefined?reactor:new RumiousReactor(this,[]);}return _createClass(RumiousState,[{key:"produce",value:function produce(recipe){return produceState(this,recipe)}},{key:"reducer",value:function reducer(){var computedObj;if(arguments.length===1){computedObj=new RumiousReducer(this,"",arguments.length<=0?undefined:arguments[0]);}else {computedObj=new RumiousReducer(this,arguments.length<=0?undefined:arguments[0],arguments.length<=1?undefined:arguments[1]);}return computedObj.trigger.bind(computedObj)}},{key:"setObjectByPath",value:function setObjectByPath(){var path=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var value=arguments.length>1?arguments[1]:undefined;if(path.length==0){this.value=value;return}if(typeof path!=="string"||!path){throw new Error("Invalid path")}var keys=path.split(".");var obj=this.value;for(var i=0;i<keys.length-1;i++){var key=keys[i];if(!(key in obj)){obj[key]={};}obj=obj[key];}obj[keys[keys.length-1]]=value;}},{key:"set",value:function set(){if(arguments.length===1){this.value=arguments.length<=0?undefined:arguments[0];}else {var path=arguments.length<=0?undefined:arguments[0];var value=arguments.length<=1?undefined:arguments[1];this.setObjectByPath(path,value);}this.reactor.react();}},{key:"get",value:function get(){return this.value}}])}();function createState(value){return new RumiousState(value)}function isState(obj){return obj instanceof RumiousState}
|
709
|
-
|
710
|
-
function watcher(state,callback){state.reactor.addBinding(callback);}
|
711
|
-
|
712
|
-
exports.RumiousApp = RumiousApp;
|
713
|
-
exports.RumiousComponent = RumiousComponent;
|
714
|
-
exports.RumiousComponentElement = RumiousComponentElement;
|
715
|
-
exports.RumiousState = RumiousState;
|
716
|
-
exports.createComponentElement = createComponentElement;
|
717
|
-
exports.createState = createState;
|
718
|
-
exports.isComponent = isComponent;
|
719
|
-
exports.isState = isState;
|
720
|
-
exports.watcher = watcher;
|
1
|
+
"use strict";class e{constructor(e){this.target=e}find(e){return this.target[e]}get(e){return this.target[e]}}class t{constructor(){this.element=null,this.props={},this.renderContext=new e(this),this.renderer=null,this.wrapped=null}prepare(e,t,n={},r=null){this.element=e,this.props=t,this.renderer=r,this.wrapped=n}template(){return{}}requestRender(){let e=this.template(),t=this.renderer(e,document.createDocumentFragment(),this.renderContext);this.element.appendChild(t),this.onRender()}async requestCleanUp(){if(this.element){let e=this.element.cloneNode(!0);for(this.element.replaceWith(e),this.element=e;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}}onInit(){}onCreate(){}onRender(){}onUpdate(){}onDestroy(){}}function n(e){return Object.getPrototypeOf(e)===t}class r{constructor(e,t,n=[]){this.type=e,this.props=t,this.children=n}}class o{constructor(e){this.type="ELEMENT_LIST",this.children=e}forEach(e){this.children.forEach(e)}}function i(e){return"function"==typeof e}class s{constructor(e,t,n){this.type=e,this.name=t,this.value=n}init(){}}class a extends s{async init(e,t){let n=null;const r=e=>{if(!t.find(e))return null;const n=t.get(e);if(!i(n))throw`${e} is not a function!`;return n.bind(t.target)};if("string"===this.value.type)n=r(this.value.value);else if("expression"===this.value.type){if(n=this.value.value,!i(n))throw"Event handler requires a function!"}else"dynamic_value"===this.value.type&&(n=r(this.value.value.objectName));n&&e.addEventListener(this.name,n)}}class l extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive bind: require a RumiousState Object !";t.reactor.addBinding((()=>{let n=t.get();this.bindAttr(e,n)})),this.bindAttr(e,t.get())}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target),r=t.find(this.value.value.objectName);if(!r)throw"Invalid props value: Directive bind: require a RumiousState Object !";r.reactor.addBinding((()=>{let n=this.value.evaluator?.(t.target);this.bindAttr(e,n)})),this.bindAttr(e,n)}}normalizeValue(e){return"object"==typeof e?e.toString?.()??"":e}async bindAttr(e,t){"html"===this.name&&(e.innerHTML=this.normalizeValue(t))}}class c extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive ref: require a RumiousRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive ref: require a RumiousRef Object !";n.set(e)}}}class u extends s{async init(e,t){if("expression"===this.value.type){let t=this.value.value;if(!t)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";t.set(e)}else if("dynamic_value"===this.value.type){let n=this.value.evaluator?.(t.target);if(!n)throw"Invalid props value: Directive childsRef: require a RumiousChildRef Object !";n.set(e)}}}const p={on:(e,t)=>new a("on",e,t),bind:(e,t)=>new l("bind",e,t),ref:(e,t,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 m{constructor(e=null,t=[]){this.target=e,this.bindings=t}react(){this.bindings.forEach((e=>e()))}addBinding(e){this.bindings.push(e)}}class b{constructor(e,t="",n){this.state=e,this.path=t,this.fn=n}trigger(...e){let t=this.fn(...e);this.state.set(this.path,t)}}const w="remove",O="replace",M="add",E=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),j=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),S=Symbol.iterator,k={mutable:"mutable",immutable:"immutable"},R={};function x(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function A(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 P(e){return Object.getPrototypeOf(e)===Set.prototype}function C(e){return Object.getPrototypeOf(e)===Map.prototype}function z(e){var t;return null!==(t=e.copy)&&void 0!==t?t:e.original}function D(e){return!!T(e)}function T(e){return"object"!=typeof e?null:null==e?void 0:e[E]}function _(e){var t;const n=T(e);return n?null!==(t=n.copy)&&void 0!==t?t:n.original:e}function I(e,t){if(!e||"object"!=typeof e)return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!(null==t?void 0:t.mark)&&((n=t.mark(e,k))===k.immutable||"function"==typeof n)}function N(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=T(V(n,e.key));if(null!==r&&(null==r?void 0:r.original)!==e.original)return null;const o=3===e.parent.type,i=o?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(o&&n.size>i||x(n,i)))return null;t.push(i)}if(e.parent)return N(e.parent,t);t.reverse();try{!function(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if("object"!=typeof(e=V(3===F(e)?Array.from(e):e,r)))throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}}(e.copy,t)}catch(e){return null}return t}function F(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function V(e,t){return 2===F(e)?e.get(t):e[t]}function L(e,t,n){2===F(e)?e.set(t,n):e[t]=n}function q(e,t){const n=T(e);return(n?z(n):e)[t]}function U(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function $(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function W(e,t){return t?e:[""].concat(e).map((e=>{const t=`${e}`;return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")}const B=Object.prototype.propertyIsEnumerable;function K(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set)return P(e)?Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values()):new(0,Object.getPrototypeOf(e).constructor)(e.values());if(e instanceof Map)return C(e)?new Map(e):new(0,Object.getPrototypeOf(e).constructor)(e);if((null==t?void 0:t.mark)&&(n=t.mark(e,k),void 0!==n)&&n!==k.mutable){if(n===k.immutable)return function(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach((n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);r.enumerable&&r.configurable&&r.writable?t[n]=e[n]:(r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r))})),t}(e);if("function"==typeof n){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}if("object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t={};return Object.keys(e).forEach((n=>{t[n]=e[n]})),Object.getOwnPropertySymbols(e).forEach((n=>{B.call(e,n)&&(t[n]=e[n])})),t}throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function X(e){e.copy||(e.copy=K(e.original,e.options))}function H(e){if(!I(e))return _(e);if(Array.isArray(e))return e.map(H);if(e instanceof Map){const t=Array.from(e.entries()).map((([e,t])=>[e,H(t)]));return C(e)?new Map(t):new(0,Object.getPrototypeOf(e).constructor)(t)}if(e instanceof Set){const t=Array.from(e).map(H);return P(e)?new Set(t):new(0,Object.getPrototypeOf(e).constructor)(t)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=H(e[n]);return t}function Y(e){return D(e)?H(e):e}function G(e){var t;e.assignedMap=null!==(t=e.assignedMap)&&void 0!==t?t:new Map,e.operated||(e.operated=!0,e.parent&&G(e.parent))}function Z(){throw new Error("Cannot modify frozen object")}function J(e,t,n,r,o){{n=null!=n?n:new WeakMap,r=null!=r?r:[],o=null!=o?o:[];const i=n.has(e)?n.get(e):e;if(r.length>0){const e=r.indexOf(i);if(i&&"object"==typeof i&&-1!==e){if(r[0]===i)throw new Error("Forbids circular reference");throw new Error(`Forbids circular reference: ~/${o.slice(0,e).map(((e,t)=>{if("symbol"==typeof e)return`[${e.toString()}]`;const n=r[t];return"object"==typeof e&&(n instanceof Map||n instanceof Set)?Array.from(n.keys()).indexOf(e):e})).join("/")}`)}r.push(i),o.push(t)}else r.push(i)}if(Object.isFrozen(e)||D(e))return r.pop(),void o.pop();switch(F(e)){case 2:for(const[t,i]of e)J(t,t,n,r,o),J(i,t,n,r,o);e.set=e.clear=e.delete=Z;break;case 3:for(const t of e)J(t,t,n,r,o);e.add=e.clear=e.delete=Z;break;case 1:Object.freeze(e);let t=0;for(const i of e)J(i,t,n,r,o),t+=1;break;default:Object.freeze(e),Object.keys(e).forEach((t=>{J(e[t],t,n,r,o)}))}r.pop(),o.pop()}function Q(e,t){const n=F(e);if(0===n)Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)}));else if(1===n){let n=0;for(const r of e)t(n,r,e),n+=1}else e.forEach(((n,r)=>t(r,n,e)))}function ee(e,t,n){if(D(e)||!I(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,o=r?new Map:void 0;if(t.add(e),Q(e,((i,s)=>{var a;if(D(s)){const t=T(s);X(t);const n=(null===(a=t.assignedMap)||void 0===a?void 0:a.size)||t.operated?t.copy:t.original;L(r?o:e,i,n)}else ee(s,t,n)})),o){const t=e,n=Array.from(t);t.clear(),n.forEach((e=>{t.add(o.has(e)?o.get(e):e)}))}}function te(e,t){const n=3===e.type?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ee(V(n,t),e.finalities.handledSet,e.options)}function ne(e){3===e.type&&e.copy&&(e.copy.clear(),e.setMap.forEach((t=>{e.copy.add(_(t))})))}function re(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=N(e);o&&t(e,o,n,r)}e.finalized=!0}}function oe(e,t,n,r){const o=T(n);o&&(o.callbacks||(o.callbacks=[]),o.callbacks.push(((i,s)=>{var a;const l=3===e.type?e.setMap:e.copy;if(U(V(l,t),n)){let n=o.original;o.copy&&(n=o.copy),ne(e),re(e,r,i,s),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(a=e.options.updatedValues)&&void 0!==a?a:new WeakMap,e.options.updatedValues.set(n,o.original)),L(l,t,n)}})),e.options.enableAutoFreeze&&o.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),I(n,e.options)&&e.finalities.draft.push((()=>{U(V(3===e.type?e.setMap:e.copy,t),n)&&te(e,t)}))}function ie(e,t,n,r){const{pathAsArray:o=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return function({original:e,copy:t,assignedMap:n},r,o,i,s){n.forEach(((n,a)=>{const l=V(e,a),c=Y(V(t,a)),u=n?x(e,a)?O:M:w;if(U(l,c)&&u===O)return;const p=W(r.concat(a),s);o.push(u===w?{op:u,path:p}:{op:u,path:p,value:c}),i.push(u===M?{op:w,path:p}:u===w?{op:M,path:p,value:l}:{op:O,path:p,value:l})}))}(e,t,n,r,o);case 1:return function(e,t,n,r,o){let{original:i,assignedMap:s,options:a}=e,l=e.copy;l.length<i.length&&([i,l]=[l,i],[n,r]=[r,n]);for(let e=0;e<i.length;e+=1)if(s.get(e.toString())&&l[e]!==i[e]){const s=W(t.concat([e]),o);n.push({op:O,path:s,value:Y(l[e])}),r.push({op:O,path:s,value:Y(i[e])})}for(let e=i.length;e<l.length;e+=1){const r=W(t.concat([e]),o);n.push({op:M,path:r,value:Y(l[e])})}if(i.length<l.length){const{arrayLengthAssignment:e=!0}=a.enablePatches;if(e){const e=W(t.concat(["length"]),o);r.push({op:O,path:e,value:i.length})}else for(let e=l.length;i.length<e;e-=1){const n=W(t.concat([e-1]),o);r.push({op:w,path:n})}}}(e,t,n,r,o);case 3:return function({original:e,copy:t},n,r,o,i){let s=0;e.forEach((e=>{if(!t.has(e)){const t=W(n.concat([s]),i);r.push({op:w,path:t,value:e}),o.unshift({op:M,path:t,value:e})}s+=1})),s=0,t.forEach((t=>{if(!e.has(t)){const e=W(n.concat([s]),i);r.push({op:M,path:e,value:t}),o.unshift({op:w,path:e,value:t})}s+=1}))}(e,t,n,r,o)}}const se=(e,t,n=!1)=>{if("object"==typeof e&&null!==e&&(!I(e,t)||n))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},ae={get size(){return z(T(this)).size},has(e){return z(T(this)).has(e)},set(e,t){const n=T(this),r=z(n);return r.has(e)&&U(r.get(e),t)||(X(n),G(n),n.assignedMap.set(e,!0),n.copy.set(e,t),oe(n,e,t,ie)),this},delete(e){if(!this.has(e))return!1;const t=T(this);return X(t),G(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=T(this);if(this.size){X(e),G(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){z(T(this)).forEach(((n,r)=>{e.call(t,this.get(r),r,this)}))},get(e){var t,n;const r=T(this),o=z(r).get(e),i=(null===(n=(t=r.options).mark)||void 0===n?void 0:n.call(t,o,k))===k.mutable;if(r.options.strict&&se(o,r.options,i),i)return o;if(r.finalized||!I(o,r.options))return o;if(o!==r.original.get(e))return o;const s=R.createDraft({original:o,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return X(r),r.copy.set(e,s),s},keys(){return z(T(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()}},le=Reflect.ownKeys(ae),ce=(e,t,{isValuesIterator:n})=>()=>{var r,o;const i=t.next();if(i.done)return i;const s=i.value;let a=e.setMap.get(s);const l=T(a),c=(null===(o=(r=e.options).mark)||void 0===o?void 0:o.call(r,a,k))===k.mutable;if(e.options.strict&&se(s,e.options,c),c||l||!I(s,e.options)||e.finalized||!e.original.has(s))l&&(a=l.proxy);else{const t=R.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,t),a=t}return{done:!1,value:n?a:[a,a]}},ue={get size(){return T(this).setMap.size},has(e){const t=T(this);if(t.setMap.has(e))return!0;X(t);const n=T(e);return!(!n||!t.setMap.has(n.original))},add(e){const t=T(this);return this.has(e)||(X(t),G(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),oe(t,e,e,ie)),this},delete(e){if(!this.has(e))return!1;const t=T(this);X(t),G(t);const n=T(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=T(this);X(e),G(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=T(this);X(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ce(e,t,{isValuesIterator:!0})}},entries(){const e=T(this);X(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ce(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(ue,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const pe=Reflect.ownKeys(ue),fe=new WeakSet,he={get(e,t,n){var r,o;const i=null===(r=e.copy)||void 0===r?void 0:r[t];if(i&&fe.has(i))return i;if(t===E)return e;let s;if(e.options.mark){const r="size"===t&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(r,k),s===k.mutable)return e.options.strict&&se(r,e.options,!0),r}const a=z(e);if(a instanceof Map&&le.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ae,"size").get.call(e.proxy);const n=ae[t];if(n)return n.bind(e.proxy)}if(a instanceof Set&&pe.includes(t)){if("size"===t)return Object.getOwnPropertyDescriptor(ue,"size").get.call(e.proxy);const n=ue[t];if(n)return n.bind(e.proxy)}if(!x(a,t)){const n=A(a,t);return n?"value"in n?n.value:null===(o=n.get)||void 0===o?void 0:o.call(e.proxy):void 0}const l=a[t];if(e.options.strict&&se(l,e.options),e.finalized||!I(l,e.options))return l;if(l===q(e.original,t)){if(X(e),e.copy[t]=de({original:e.original[t],parentDraft:e,key:1===e.type?Number(t):t,finalities:e.finalities,options:e.options}),"function"==typeof s){const n=T(e.copy[t]);return X(n),G(n),n.copy}return e.copy[t]}return l},set(e,t,n){var r;if(3===e.type||2===e.type)throw new Error("Map/Set draft does not support any property assignment.");let 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=A(z(e),t);if(null==i?void 0:i.set)return i.set.call(e.proxy,n),!0;const s=q(z(e),t),a=T(s);return a&&U(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):(U(n,s)&&(void 0!==n||x(e.original,t))||(X(e),G(e),x(e.original,t)&&U(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,oe(e,t,n,ie)),!0)},has:(e,t)=>t in z(e),ownKeys:e=>Reflect.ownKeys(z(e)),getOwnPropertyDescriptor(e,t){const n=z(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},getPrototypeOf:e=>Reflect.getPrototypeOf(e.original),setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return 1===e.type?he.set.call(this,e,t,void 0,e.proxy):(void 0!==q(e.original,t)||t in e.original?(X(e),G(e),e.assignedMap.set(t,!1)):(e.assignedMap=null!==(n=e.assignedMap)&&void 0!==n?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function de(e){const{original:t,parentDraft:n,key:r,finalities:o,options:i}=e,s=F(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:o,options:i,setMap:3===s?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:l,revoke:c}=Proxy.revocable(1===s?Object.assign([],a):a,he);if(o.revoke.push(c),fe.add(l),a.proxy=l,n){const e=n;e.finalities.draft.push(((t,n)=>{var o,i;const s=T(l);let a=3===e.type?e.setMap:e.copy;const c=V(a,r),u=T(c);if(u){let i=u.original;u.operated&&(i=_(c)),ne(u),re(u,ie,t,n),e.options.enableAutoFreeze&&(e.options.updatedValues=null!==(o=e.options.updatedValues)&&void 0!==o?o:new WeakMap,e.options.updatedValues.set(i,u.original)),L(a,r,i)}null===(i=s.callbacks)||void 0===i||i.forEach((e=>{e(t,n)}))}))}else{const e=T(l);e.finalities.draft.push(((t,n)=>{ne(e),re(e,ie,t,n)}))}return l}function ye(e,t,n,r,o){var i;const s=T(e),a=null!==(i=null==s?void 0:s.original)&&void 0!==i?i:e,l=!!t.length;if(null==s?void 0:s.operated)for(;s.finalities.draft.length>0;)s.finalities.draft.pop()(n,r);const c=l?t[0]:s?s.operated?s.copy:s.original:e;return s&&$(s),o&&J(c,c,null==s?void 0:s.options.updatedValues),[c,n&&l?[{op:O,path:[],value:t[0]}]:n,r&&l?[{op:O,path:[],value:a}]:r]}function ge(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:o=!0}=e;Q(n,((n,r,o)=>{const i=T(r);if(i&&t&&i.finalities===t.finalities){e.isContainDraft=!0;const t=i.original;if(o instanceof Set){const e=Array.from(o);o.clear(),e.forEach((e=>o.add(n===e?t:e)))}else L(o,n,t)}else"object"==typeof r&&null!==r&&(e.value=r,e.isRoot=!1,ge(e))})),o&&e.isContainDraft}function ve(e){var t;const n=T(e);if(!I(e,null==n?void 0:n.options))return e;const r=F(e);if(n&&!n.operated)return n.original;let o;function i(){o=2===r?C(e)?new Map(e):new(Object.getPrototypeOf(e).constructor)(e):3===r?Array.from(n.setMap.values()):K(e,null==n?void 0:n.options)}if(n){n.finalized=!0;try{i()}finally{n.finalized=!1}}else o=e;if(Q(o,((t,r)=>{if(n&&U(V(n.original,t),r))return;const s=ve(r);s!==r&&(o===e&&i(),L(o,t,s))})),3===r){const e=null!==(t=null==n?void 0:n.original)&&void 0!==t?t:o;return P(e)?new Set(o):new(Object.getPrototypeOf(e).constructor)(o)}return o}function me(e){if(!D(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return ve(e)}R.createDraft=de;const be=function e(t,n,r){var o,i,s;if("function"==typeof t&&"function"!=typeof n)return function(r,...o){return e(r,(e=>t.call(this,e,...o)),n)};const a=t,l=n;let c=r;if("function"!=typeof n&&(c=n),void 0!==c&&"[object Object]"!==Object.prototype.toString.call(c))throw new Error(`Invalid options: ${c}, 'options' should be an object.`);c=Object.assign(Object.assign({},void 0),c);const u=D(a)?me(a):a,p=Array.isArray(c.mark)?(e,t)=>{for(const n of c.mark){if("function"!=typeof n)throw new Error(`Invalid mark: ${n}, 'mark' should be a function.`);const r=n(e,t);if(r)return r}}:c.mark,f=null!==(o=c.enablePatches)&&void 0!==o&&o,h=null!==(i=c.strict)&&void 0!==i&&i,d={enableAutoFreeze:null!==(s=c.enableAutoFreeze)&&void 0!==s&&s,mark:p,strict:h,enablePatches:f};if(!I(u,d)&&"object"==typeof u&&null!==u)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[y,g]=function(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet};let o,i;t.enablePatches&&(o=[],i=[]);const s=(null===(n=t.mark)||void 0===n?void 0:n.call(t,e,k))!==k.mutable&&I(e,t)?de({original:e,parentDraft:null,finalities:r,options:t}):e;return[s,(e=[])=>{const[n,r,a]=ye(s,e,o,i,t.enableAutoFreeze);return t.enablePatches?[n,r,a]:n}]}(u,d);if("function"!=typeof n){if(!I(u,d))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[y,g]}let v;try{v=l(y)}catch(e){throw $(T(y)),e}const m=e=>{const t=T(y);if(!D(e)){if(void 0!==e&&!U(e,y)&&(null==t?void 0:t.operated))throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const n=null==e?void 0:e[j];if(n){const r=n[0];return d.strict&&"object"==typeof e&&null!==e&&ge({rootDraft:t,value:e,useRawReturn:!0}),g([r])}if(void 0!==e)return"object"==typeof e&&null!==e&&ge({rootDraft:t,value:e}),g([e])}if(e===y||void 0===e)return g([]);const n=T(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 $(T(y)),e})):m(v)};Object.prototype.constructor.toString();class we{constructor(e,t=null){this.value=e,this.reactor=t??new m(this,[])}produce(e){return n=e,void(t=this).set(be(t.get(),n));var t,n}reducer(...e){let t;return t=1===e.length?new b(this,"",e[0]):new b(this,e[0],e[1]),t.trigger.bind(t)}setObjectByPath(e="",t){if(0==e.length)return void(this.value=t);if("string"!=typeof e||!e)throw new Error("Invalid path");let n=e.split("."),r=this.value;for(let e=0;e<n.length-1;e++){let t=n[e];t in r||(r[t]={}),r=r[t]}r[n[n.length-1]]=t}set(...e){if(1===e.length)this.value=e[0];else{let t=e[0],n=e[1];this.setObjectByPath(t,n)}this.reactor.react()}get(){return this.value}}class Oe{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 Me{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 Ee{constructor(e){this.target=e}set(e){this.target=e,e.setRef(this)}}exports.RumiousApp=class{constructor(t=document.createElement("span"),n={}){this.root=t,this.configs=n,this.renderContext=new e(this)}render(e){v(e,this.root,this.renderContext)}},exports.RumiousChildrensRef=Me,exports.RumiousComponent=t,exports.RumiousComponentElement=d,exports.RumiousComponentRef=Ee,exports.RumiousElementRef=Oe,exports.RumiousState=we,exports.createChildrensRef=function(e){return new Me(e)},exports.createComponentElement=y,exports.createComponentRef=function(e){return new Ee(e)},exports.createElementRef=function(e){return new Oe(e)},exports.createState=function(e){return new we(e)},exports.isComponent=n,exports.isState=function(e){return e instanceof we},exports.watcher=function(e,t){e.reactor.addBinding(t)};
|