@metapages/metapage 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +262 -261
- package/dist/index.js.map +1 -1
- package/dist/metapage/Metapage.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/metapage/Metapage.ts +16 -16
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const
|
|
1
|
+
const je = ["0.3", "0.4", "0.5", "0.6", "1"], Ce = ["0.2", "0.3", "1"], Kt = "1", ve = "1", Yt = "metaframe.json", Xt = "metapage/definition", Qt = "metapage/state", Fe = Ce[Ce.length - 1], ut = je[je.length - 1], ct = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Pe = (t) => {
|
|
2
2
|
if (typeof t != "string")
|
|
3
3
|
throw new TypeError("Invalid argument expected string");
|
|
4
4
|
const e = t.match(ct);
|
|
5
5
|
if (!e)
|
|
6
6
|
throw new Error(`Invalid argument not valid semver ('${t}' received)`);
|
|
7
7
|
return e.shift(), e;
|
|
8
|
-
},
|
|
8
|
+
}, Le = (t) => t === "*" || t === "x" || t === "X", Ue = (t) => {
|
|
9
9
|
const e = parseInt(t, 10);
|
|
10
10
|
return isNaN(e) ? t : e;
|
|
11
11
|
}, lt = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], ht = (t, e) => {
|
|
12
|
-
if (
|
|
12
|
+
if (Le(t) || Le(e))
|
|
13
13
|
return 0;
|
|
14
|
-
const [s, n] = lt(
|
|
14
|
+
const [s, n] = lt(Ue(t), Ue(e));
|
|
15
15
|
return s > n ? 1 : s < n ? -1 : 0;
|
|
16
|
-
},
|
|
16
|
+
}, Te = (t, e) => {
|
|
17
17
|
for (let s = 0; s < Math.max(t.length, e.length); s++) {
|
|
18
18
|
const n = ht(t[s] || "0", e[s] || "0");
|
|
19
19
|
if (n !== 0)
|
|
@@ -21,20 +21,20 @@ const De = ["0.3", "0.4", "0.5", "0.6", "1"], je = ["0.2", "0.3", "1"], Kt = "1"
|
|
|
21
21
|
}
|
|
22
22
|
return 0;
|
|
23
23
|
}, k = (t, e) => {
|
|
24
|
-
const s =
|
|
25
|
-
return r !== 0 ? r : i && a ?
|
|
24
|
+
const s = Pe(t), n = Pe(e), i = s.pop(), a = n.pop(), r = Te(s, n);
|
|
25
|
+
return r !== 0 ? r : i && a ? Te(i.split("."), a.split(".")) : i || a ? i ? -1 : 1 : 0;
|
|
26
26
|
}, I = {
|
|
27
27
|
Remove: "remove",
|
|
28
28
|
Replace: "replace",
|
|
29
29
|
Add: "add"
|
|
30
|
-
}, Be = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), pt = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),
|
|
30
|
+
}, Be = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), pt = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), oe = Symbol.iterator, j = {
|
|
31
31
|
mutable: "mutable",
|
|
32
32
|
immutable: "immutable"
|
|
33
|
-
},
|
|
34
|
-
function
|
|
33
|
+
}, we = {};
|
|
34
|
+
function Z(t, e) {
|
|
35
35
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function ze(t, e) {
|
|
38
38
|
if (e in t) {
|
|
39
39
|
let s = Reflect.getPrototypeOf(t);
|
|
40
40
|
for (; s; ) {
|
|
@@ -49,15 +49,15 @@ function A(t) {
|
|
|
49
49
|
var e;
|
|
50
50
|
return (e = t.copy) !== null && e !== void 0 ? e : t.original;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return !!
|
|
52
|
+
function W(t) {
|
|
53
|
+
return !!_(t);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function _(t) {
|
|
56
56
|
return typeof t != "object" ? null : t == null ? void 0 : t[Be];
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Me(t) {
|
|
59
59
|
var e;
|
|
60
|
-
const s =
|
|
60
|
+
const s = _(t);
|
|
61
61
|
return s ? (e = s.copy) !== null && e !== void 0 ? e : s.original : t;
|
|
62
62
|
}
|
|
63
63
|
function C(t, e) {
|
|
@@ -68,11 +68,11 @@ function C(t, e) {
|
|
|
68
68
|
}
|
|
69
69
|
function Je(t, e = []) {
|
|
70
70
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
71
|
-
const s = t.parent.copy, n =
|
|
71
|
+
const s = t.parent.copy, n = _(V(s, t.key));
|
|
72
72
|
if (n !== null && (n == null ? void 0 : n.original) !== t.original)
|
|
73
73
|
return null;
|
|
74
74
|
const i = t.parent.type === 3, a = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
75
|
-
if (!(i && s.size > a ||
|
|
75
|
+
if (!(i && s.size > a || Z(s, a)))
|
|
76
76
|
return null;
|
|
77
77
|
e.push(a);
|
|
78
78
|
}
|
|
@@ -86,28 +86,28 @@ function Je(t, e = []) {
|
|
|
86
86
|
}
|
|
87
87
|
return e;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function H(t) {
|
|
90
90
|
return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
|
|
91
91
|
}
|
|
92
92
|
function V(t, e) {
|
|
93
|
-
return
|
|
93
|
+
return H(t) === 2 ? t.get(e) : t[e];
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
95
|
+
function ne(t, e, s) {
|
|
96
|
+
H(t) === 2 ? t.set(e, s) : t[e] = s;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
const s =
|
|
98
|
+
function le(t, e) {
|
|
99
|
+
const s = _(t);
|
|
100
100
|
return (s ? A(s) : t)[e];
|
|
101
101
|
}
|
|
102
102
|
function $(t, e) {
|
|
103
103
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function pe(t) {
|
|
106
106
|
if (t)
|
|
107
107
|
for (; t.finalities.revoke.length > 0; )
|
|
108
108
|
t.finalities.revoke.pop()();
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function J(t, e) {
|
|
111
111
|
return e ? t : [""].concat(t).map((s) => {
|
|
112
112
|
const n = `${s}`;
|
|
113
113
|
return n.indexOf("/") === -1 && n.indexOf("~") === -1 ? n : n.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
@@ -116,7 +116,7 @@ function B(t, e) {
|
|
|
116
116
|
function dt(t, e) {
|
|
117
117
|
for (let s = 0; s < e.length - 1; s += 1) {
|
|
118
118
|
const n = e[s];
|
|
119
|
-
if (t = V(
|
|
119
|
+
if (t = V(H(t) === 3 ? Array.from(t) : t, n), typeof t != "object")
|
|
120
120
|
throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
|
|
121
121
|
}
|
|
122
122
|
return t;
|
|
@@ -168,31 +168,31 @@ function We(t, e) {
|
|
|
168
168
|
function E(t) {
|
|
169
169
|
t.copy || (t.copy = We(t.original, t.options));
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function X(t) {
|
|
172
172
|
if (!C(t))
|
|
173
|
-
return
|
|
173
|
+
return Me(t);
|
|
174
174
|
if (Array.isArray(t))
|
|
175
|
-
return t.map(
|
|
175
|
+
return t.map(X);
|
|
176
176
|
if (t instanceof Map)
|
|
177
|
-
return new Map(Array.from(t.entries()).map(([s, n]) => [s,
|
|
177
|
+
return new Map(Array.from(t.entries()).map(([s, n]) => [s, X(n)]));
|
|
178
178
|
if (t instanceof Set)
|
|
179
|
-
return new Set(Array.from(t).map(
|
|
179
|
+
return new Set(Array.from(t).map(X));
|
|
180
180
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
181
181
|
for (const s in t)
|
|
182
|
-
e[s] =
|
|
182
|
+
e[s] = X(t[s]);
|
|
183
183
|
return e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
return
|
|
185
|
+
function ae(t) {
|
|
186
|
+
return W(t) ? X(t) : t;
|
|
187
187
|
}
|
|
188
188
|
function U(t) {
|
|
189
189
|
var e;
|
|
190
190
|
t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && U(t.parent));
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function $e() {
|
|
193
193
|
throw new Error("Cannot modify frozen object");
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function q(t, e, s, n, i) {
|
|
196
196
|
{
|
|
197
197
|
s = s ?? /* @__PURE__ */ new WeakMap(), n = n ?? [], i = i ?? [];
|
|
198
198
|
const r = s.has(t) ? s.get(t) : t;
|
|
@@ -209,37 +209,37 @@ function H(t, e, s, n, i) {
|
|
|
209
209
|
} else
|
|
210
210
|
n.push(r);
|
|
211
211
|
}
|
|
212
|
-
if (Object.isFrozen(t) ||
|
|
212
|
+
if (Object.isFrozen(t) || W(t)) {
|
|
213
213
|
n.pop(), i.pop();
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
switch (
|
|
216
|
+
switch (H(t)) {
|
|
217
217
|
case 2:
|
|
218
218
|
for (const [o, f] of t)
|
|
219
|
-
|
|
220
|
-
t.set = t.clear = t.delete =
|
|
219
|
+
q(o, o, s, n, i), q(f, o, s, n, i);
|
|
220
|
+
t.set = t.clear = t.delete = $e;
|
|
221
221
|
break;
|
|
222
222
|
case 3:
|
|
223
223
|
for (const o of t)
|
|
224
|
-
|
|
225
|
-
t.add = t.clear = t.delete =
|
|
224
|
+
q(o, o, s, n, i);
|
|
225
|
+
t.add = t.clear = t.delete = $e;
|
|
226
226
|
break;
|
|
227
227
|
case 1:
|
|
228
228
|
Object.freeze(t);
|
|
229
229
|
let r = 0;
|
|
230
230
|
for (const o of t)
|
|
231
|
-
|
|
231
|
+
q(o, r, s, n, i), r += 1;
|
|
232
232
|
break;
|
|
233
233
|
default:
|
|
234
234
|
Object.freeze(t), Object.keys(t).forEach((o) => {
|
|
235
235
|
const f = t[o];
|
|
236
|
-
|
|
236
|
+
q(f, o, s, n, i);
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
n.pop(), i.pop();
|
|
240
240
|
}
|
|
241
|
-
function
|
|
242
|
-
const s =
|
|
241
|
+
function Oe(t, e) {
|
|
242
|
+
const s = H(t);
|
|
243
243
|
if (s === 0)
|
|
244
244
|
Reflect.ownKeys(t).forEach((n) => {
|
|
245
245
|
e(n, t[n], t);
|
|
@@ -252,16 +252,16 @@ function Me(t, e) {
|
|
|
252
252
|
t.forEach((n, i) => e(i, n, t));
|
|
253
253
|
}
|
|
254
254
|
function He(t, e, s) {
|
|
255
|
-
if (
|
|
255
|
+
if (W(t) || !C(t, s) || e.has(t) || Object.isFrozen(t))
|
|
256
256
|
return;
|
|
257
257
|
const n = t instanceof Set, i = n ? /* @__PURE__ */ new Map() : void 0;
|
|
258
|
-
if (e.add(t),
|
|
258
|
+
if (e.add(t), Oe(t, (a, r) => {
|
|
259
259
|
var o;
|
|
260
|
-
if (
|
|
261
|
-
const f =
|
|
260
|
+
if (W(r)) {
|
|
261
|
+
const f = _(r);
|
|
262
262
|
E(f);
|
|
263
263
|
const u = !((o = f.assignedMap) === null || o === void 0) && o.size || f.operated ? f.copy : f.original;
|
|
264
|
-
|
|
264
|
+
ne(n ? i : t, a, u);
|
|
265
265
|
} else
|
|
266
266
|
He(r, e, s);
|
|
267
267
|
}), i) {
|
|
@@ -275,12 +275,12 @@ function gt(t, e) {
|
|
|
275
275
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
276
276
|
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && s && He(V(s, e), t.finalities.handledSet, t.options);
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function de(t) {
|
|
279
279
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
280
|
-
t.copy.add(
|
|
280
|
+
t.copy.add(Me(e));
|
|
281
281
|
}));
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function me(t, e, s, n) {
|
|
284
284
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
285
285
|
if (s && n) {
|
|
286
286
|
const a = Je(t);
|
|
@@ -289,51 +289,51 @@ function de(t, e, s, n) {
|
|
|
289
289
|
t.finalized = !0;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
const i =
|
|
292
|
+
function Ie(t, e, s, n) {
|
|
293
|
+
const i = _(s);
|
|
294
294
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((a, r) => {
|
|
295
295
|
var o;
|
|
296
296
|
const f = t.type === 3 ? t.setMap : t.copy;
|
|
297
297
|
if ($(V(f, e), s)) {
|
|
298
298
|
let u = i.original;
|
|
299
|
-
i.copy && (u = i.copy),
|
|
299
|
+
i.copy && (u = i.copy), de(t), me(t, n, a, r), t.options.enableAutoFreeze && (t.options.updatedValues = (o = t.options.updatedValues) !== null && o !== void 0 ? o : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(u, i.original)), ne(f, e, u);
|
|
300
300
|
}
|
|
301
301
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), C(s, t.options) && t.finalities.draft.push(() => {
|
|
302
302
|
const a = t.type === 3 ? t.setMap : t.copy;
|
|
303
303
|
$(V(a, e), s) && gt(t, e);
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function _t(t, e, s, n, i) {
|
|
307
307
|
let { original: a, assignedMap: r, options: o } = t, f = t.copy;
|
|
308
308
|
f.length < a.length && ([a, f] = [f, a], [s, n] = [n, s]);
|
|
309
309
|
for (let u = 0; u < a.length; u += 1)
|
|
310
310
|
if (r.get(u.toString()) && f[u] !== a[u]) {
|
|
311
|
-
const c = e.concat([u]), l =
|
|
311
|
+
const c = e.concat([u]), l = J(c, i);
|
|
312
312
|
s.push({
|
|
313
313
|
op: I.Replace,
|
|
314
314
|
path: l,
|
|
315
315
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
316
|
-
value:
|
|
316
|
+
value: ae(f[u])
|
|
317
317
|
}), n.push({
|
|
318
318
|
op: I.Replace,
|
|
319
319
|
path: l,
|
|
320
320
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
321
|
-
value:
|
|
321
|
+
value: ae(a[u])
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
324
|
for (let u = a.length; u < f.length; u += 1) {
|
|
325
|
-
const c = e.concat([u]), l =
|
|
325
|
+
const c = e.concat([u]), l = J(c, i);
|
|
326
326
|
s.push({
|
|
327
327
|
op: I.Add,
|
|
328
328
|
path: l,
|
|
329
329
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
330
|
-
value:
|
|
330
|
+
value: ae(f[u])
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
if (a.length < f.length) {
|
|
334
334
|
const { arrayLengthAssignment: u = !0 } = o.enablePatches;
|
|
335
335
|
if (u) {
|
|
336
|
-
const c = e.concat(["length"]), l =
|
|
336
|
+
const c = e.concat(["length"]), l = J(c, i);
|
|
337
337
|
n.push({
|
|
338
338
|
op: I.Replace,
|
|
339
339
|
path: l,
|
|
@@ -341,7 +341,7 @@ function bt(t, e, s, n, i) {
|
|
|
341
341
|
});
|
|
342
342
|
} else
|
|
343
343
|
for (let c = f.length; a.length < c; c -= 1) {
|
|
344
|
-
const l = e.concat([c - 1]), h =
|
|
344
|
+
const l = e.concat([c - 1]), h = J(l, i);
|
|
345
345
|
n.push({
|
|
346
346
|
op: I.Remove,
|
|
347
347
|
path: h
|
|
@@ -349,12 +349,12 @@ function bt(t, e, s, n, i) {
|
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function bt({ original: t, copy: e, assignedMap: s }, n, i, a, r) {
|
|
353
353
|
s.forEach((o, f) => {
|
|
354
|
-
const u = V(t, f), c =
|
|
354
|
+
const u = V(t, f), c = ae(V(e, f)), l = o ? Z(t, f) ? I.Replace : I.Add : I.Remove;
|
|
355
355
|
if ($(u, c) && l === I.Replace)
|
|
356
356
|
return;
|
|
357
|
-
const h = n.concat(f), m =
|
|
357
|
+
const h = n.concat(f), m = J(h, r);
|
|
358
358
|
i.push(l === I.Remove ? { op: l, path: m } : { op: l, path: m, value: c }), a.push(l === I.Add ? { op: I.Remove, path: m } : l === I.Remove ? { op: I.Add, path: m, value: u } : { op: I.Replace, path: m, value: u });
|
|
359
359
|
});
|
|
360
360
|
}
|
|
@@ -362,7 +362,7 @@ function vt({ original: t, copy: e }, s, n, i, a) {
|
|
|
362
362
|
let r = 0;
|
|
363
363
|
t.forEach((o) => {
|
|
364
364
|
if (!e.has(o)) {
|
|
365
|
-
const f = s.concat([r]), u =
|
|
365
|
+
const f = s.concat([r]), u = J(f, a);
|
|
366
366
|
n.push({
|
|
367
367
|
op: I.Remove,
|
|
368
368
|
path: u,
|
|
@@ -376,7 +376,7 @@ function vt({ original: t, copy: e }, s, n, i, a) {
|
|
|
376
376
|
r += 1;
|
|
377
377
|
}), r = 0, e.forEach((o) => {
|
|
378
378
|
if (!t.has(o)) {
|
|
379
|
-
const f = s.concat([r]), u =
|
|
379
|
+
const f = s.concat([r]), u = J(f, a);
|
|
380
380
|
n.push({
|
|
381
381
|
op: I.Add,
|
|
382
382
|
path: u,
|
|
@@ -390,41 +390,41 @@ function vt({ original: t, copy: e }, s, n, i, a) {
|
|
|
390
390
|
r += 1;
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function te(t, e, s, n) {
|
|
394
394
|
const { pathAsArray: i = !0 } = t.options.enablePatches;
|
|
395
395
|
switch (t.type) {
|
|
396
396
|
case 0:
|
|
397
397
|
case 2:
|
|
398
|
-
return _t(t, e, s, n, i);
|
|
399
|
-
case 1:
|
|
400
398
|
return bt(t, e, s, n, i);
|
|
399
|
+
case 1:
|
|
400
|
+
return _t(t, e, s, n, i);
|
|
401
401
|
case 3:
|
|
402
402
|
return vt(t, e, s, n, i);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
let wt = !1;
|
|
406
|
-
const
|
|
406
|
+
const fe = (t, e, s = !1) => {
|
|
407
407
|
if (typeof t == "object" && t !== null && (!C(t, e) || s) && !wt)
|
|
408
408
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
409
|
-
},
|
|
409
|
+
}, ye = {
|
|
410
410
|
get size() {
|
|
411
|
-
return A(
|
|
411
|
+
return A(_(this)).size;
|
|
412
412
|
},
|
|
413
413
|
has(t) {
|
|
414
|
-
return A(
|
|
414
|
+
return A(_(this)).has(t);
|
|
415
415
|
},
|
|
416
416
|
set(t, e) {
|
|
417
|
-
const s =
|
|
418
|
-
return (!n.has(t) || !$(n.get(t), e)) && (E(s), U(s), s.assignedMap.set(t, !0), s.copy.set(t, e),
|
|
417
|
+
const s = _(this), n = A(s);
|
|
418
|
+
return (!n.has(t) || !$(n.get(t), e)) && (E(s), U(s), s.assignedMap.set(t, !0), s.copy.set(t, e), Ie(s, t, e, te)), this;
|
|
419
419
|
},
|
|
420
420
|
delete(t) {
|
|
421
421
|
if (!this.has(t))
|
|
422
422
|
return !1;
|
|
423
|
-
const e =
|
|
423
|
+
const e = _(this);
|
|
424
424
|
return E(e), U(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
|
|
425
425
|
},
|
|
426
426
|
clear() {
|
|
427
|
-
const t =
|
|
427
|
+
const t = _(this);
|
|
428
428
|
if (this.size) {
|
|
429
429
|
E(t), U(t), t.assignedMap = /* @__PURE__ */ new Map();
|
|
430
430
|
for (const [e] of t.original)
|
|
@@ -433,17 +433,17 @@ const ae = (t, e, s = !1) => {
|
|
|
433
433
|
}
|
|
434
434
|
},
|
|
435
435
|
forEach(t, e) {
|
|
436
|
-
const s =
|
|
436
|
+
const s = _(this);
|
|
437
437
|
A(s).forEach((n, i) => {
|
|
438
438
|
t.call(e, this.get(i), i, this);
|
|
439
439
|
});
|
|
440
440
|
},
|
|
441
441
|
get(t) {
|
|
442
442
|
var e, s;
|
|
443
|
-
const n =
|
|
444
|
-
if (n.options.strict &&
|
|
443
|
+
const n = _(this), i = A(n).get(t), a = ((s = (e = n.options).mark) === null || s === void 0 ? void 0 : s.call(e, i, j)) === j.mutable;
|
|
444
|
+
if (n.options.strict && fe(i, n.options, a), a || n.finalized || !C(i, n.options) || i !== n.original.get(t))
|
|
445
445
|
return i;
|
|
446
|
-
const r =
|
|
446
|
+
const r = we.createDraft({
|
|
447
447
|
original: i,
|
|
448
448
|
parentDraft: n,
|
|
449
449
|
key: t,
|
|
@@ -453,12 +453,12 @@ const ae = (t, e, s = !1) => {
|
|
|
453
453
|
return E(n), n.copy.set(t, r), r;
|
|
454
454
|
},
|
|
455
455
|
keys() {
|
|
456
|
-
return A(
|
|
456
|
+
return A(_(this)).keys();
|
|
457
457
|
},
|
|
458
458
|
values() {
|
|
459
459
|
const t = this.keys();
|
|
460
460
|
return {
|
|
461
|
-
[
|
|
461
|
+
[oe]: () => this.values(),
|
|
462
462
|
next: () => {
|
|
463
463
|
const e = t.next();
|
|
464
464
|
return e.done ? e : {
|
|
@@ -471,7 +471,7 @@ const ae = (t, e, s = !1) => {
|
|
|
471
471
|
entries() {
|
|
472
472
|
const t = this.keys();
|
|
473
473
|
return {
|
|
474
|
-
[
|
|
474
|
+
[oe]: () => this.entries(),
|
|
475
475
|
next: () => {
|
|
476
476
|
const e = t.next();
|
|
477
477
|
if (e.done)
|
|
@@ -484,19 +484,19 @@ const ae = (t, e, s = !1) => {
|
|
|
484
484
|
}
|
|
485
485
|
};
|
|
486
486
|
},
|
|
487
|
-
[
|
|
487
|
+
[oe]() {
|
|
488
488
|
return this.entries();
|
|
489
489
|
}
|
|
490
|
-
}, Mt = Reflect.ownKeys(
|
|
490
|
+
}, Mt = Reflect.ownKeys(ye), Ve = (t, e, { isValuesIterator: s }) => () => {
|
|
491
491
|
var n, i;
|
|
492
492
|
const a = e.next();
|
|
493
493
|
if (a.done)
|
|
494
494
|
return a;
|
|
495
495
|
const r = a.value;
|
|
496
496
|
let o = t.setMap.get(r);
|
|
497
|
-
const f =
|
|
498
|
-
if (t.options.strict &&
|
|
499
|
-
const c =
|
|
497
|
+
const f = _(o), u = ((i = (n = t.options).mark) === null || i === void 0 ? void 0 : i.call(n, o, j)) === j.mutable;
|
|
498
|
+
if (t.options.strict && fe(r, t.options, u), !u && !f && C(r, t.options) && !t.finalized && t.original.has(r)) {
|
|
499
|
+
const c = we.createDraft({
|
|
500
500
|
original: r,
|
|
501
501
|
parentDraft: t,
|
|
502
502
|
key: r,
|
|
@@ -510,55 +510,55 @@ const ae = (t, e, s = !1) => {
|
|
|
510
510
|
done: !1,
|
|
511
511
|
value: s ? o : [o, o]
|
|
512
512
|
};
|
|
513
|
-
},
|
|
513
|
+
}, ge = {
|
|
514
514
|
get size() {
|
|
515
|
-
return
|
|
515
|
+
return _(this).setMap.size;
|
|
516
516
|
},
|
|
517
517
|
has(t) {
|
|
518
|
-
const e =
|
|
518
|
+
const e = _(this);
|
|
519
519
|
if (e.setMap.has(t))
|
|
520
520
|
return !0;
|
|
521
521
|
E(e);
|
|
522
|
-
const s =
|
|
522
|
+
const s = _(t);
|
|
523
523
|
return !!(s && e.setMap.has(s.original));
|
|
524
524
|
},
|
|
525
525
|
add(t) {
|
|
526
|
-
const e =
|
|
527
|
-
return this.has(t) || (E(e), U(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
526
|
+
const e = _(this);
|
|
527
|
+
return this.has(t) || (E(e), U(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Ie(e, t, t, te)), this;
|
|
528
528
|
},
|
|
529
529
|
delete(t) {
|
|
530
530
|
if (!this.has(t))
|
|
531
531
|
return !1;
|
|
532
|
-
const e =
|
|
532
|
+
const e = _(this);
|
|
533
533
|
E(e), U(e);
|
|
534
|
-
const s =
|
|
534
|
+
const s = _(t);
|
|
535
535
|
return s && e.setMap.has(s.original) ? (e.assignedMap.set(s.original, !1), e.setMap.delete(s.original)) : (!s && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
|
|
536
536
|
},
|
|
537
537
|
clear() {
|
|
538
538
|
if (!this.size)
|
|
539
539
|
return;
|
|
540
|
-
const t =
|
|
540
|
+
const t = _(this);
|
|
541
541
|
E(t), U(t);
|
|
542
542
|
for (const e of t.original)
|
|
543
543
|
t.assignedMap.set(e, !1);
|
|
544
544
|
t.setMap.clear();
|
|
545
545
|
},
|
|
546
546
|
values() {
|
|
547
|
-
const t =
|
|
547
|
+
const t = _(this);
|
|
548
548
|
E(t);
|
|
549
549
|
const e = t.setMap.keys();
|
|
550
550
|
return {
|
|
551
551
|
[Symbol.iterator]: () => this.values(),
|
|
552
|
-
next:
|
|
552
|
+
next: Ve(t, e, { isValuesIterator: !0 })
|
|
553
553
|
};
|
|
554
554
|
},
|
|
555
555
|
entries() {
|
|
556
|
-
const t =
|
|
556
|
+
const t = _(this);
|
|
557
557
|
E(t);
|
|
558
558
|
const e = t.setMap.keys();
|
|
559
559
|
return {
|
|
560
560
|
[Symbol.iterator]: () => this.entries(),
|
|
561
|
-
next:
|
|
561
|
+
next: Ve(t, e, {
|
|
562
562
|
isValuesIterator: !1
|
|
563
563
|
})
|
|
564
564
|
};
|
|
@@ -566,7 +566,7 @@ const ae = (t, e, s = !1) => {
|
|
|
566
566
|
keys() {
|
|
567
567
|
return this.values();
|
|
568
568
|
},
|
|
569
|
-
[
|
|
569
|
+
[oe]() {
|
|
570
570
|
return this.values();
|
|
571
571
|
},
|
|
572
572
|
forEach(t, e) {
|
|
@@ -575,7 +575,7 @@ const ae = (t, e, s = !1) => {
|
|
|
575
575
|
for (; !n.done; )
|
|
576
576
|
t.call(e, n.value, n.value, this), n = s.next();
|
|
577
577
|
}
|
|
578
|
-
}, Ot = Reflect.ownKeys(
|
|
578
|
+
}, Ot = Reflect.ownKeys(ge), qe = /* @__PURE__ */ new WeakSet(), Ge = {
|
|
579
579
|
get(t, e, s) {
|
|
580
580
|
var n, i;
|
|
581
581
|
const a = (n = t.copy) === null || n === void 0 ? void 0 : n[e];
|
|
@@ -587,42 +587,42 @@ const ae = (t, e, s = !1) => {
|
|
|
587
587
|
if (t.options.mark) {
|
|
588
588
|
const u = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, s);
|
|
589
589
|
if (r = t.options.mark(u, j), r === j.mutable)
|
|
590
|
-
return t.options.strict &&
|
|
590
|
+
return t.options.strict && fe(u, t.options, !0), u;
|
|
591
591
|
}
|
|
592
592
|
const o = A(t);
|
|
593
593
|
if (o instanceof Map && Mt.includes(e)) {
|
|
594
594
|
if (e === "size")
|
|
595
|
-
return Object.getOwnPropertyDescriptor(
|
|
596
|
-
const u =
|
|
595
|
+
return Object.getOwnPropertyDescriptor(ye, "size").get.call(t.proxy);
|
|
596
|
+
const u = ye[e];
|
|
597
597
|
if (u)
|
|
598
598
|
return u.bind(t.proxy);
|
|
599
599
|
}
|
|
600
600
|
if (o instanceof Set && Ot.includes(e)) {
|
|
601
601
|
if (e === "size")
|
|
602
|
-
return Object.getOwnPropertyDescriptor(
|
|
603
|
-
const u =
|
|
602
|
+
return Object.getOwnPropertyDescriptor(ge, "size").get.call(t.proxy);
|
|
603
|
+
const u = ge[e];
|
|
604
604
|
if (u)
|
|
605
605
|
return u.bind(t.proxy);
|
|
606
606
|
}
|
|
607
|
-
if (!
|
|
608
|
-
const u =
|
|
607
|
+
if (!Z(o, e)) {
|
|
608
|
+
const u = ze(o, e);
|
|
609
609
|
return u ? "value" in u ? u.value : (
|
|
610
610
|
// !case: support for getter
|
|
611
611
|
(i = u.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
612
612
|
) : void 0;
|
|
613
613
|
}
|
|
614
614
|
const f = o[e];
|
|
615
|
-
if (t.options.strict &&
|
|
615
|
+
if (t.options.strict && fe(f, t.options), t.finalized || !C(f, t.options))
|
|
616
616
|
return f;
|
|
617
|
-
if (f ===
|
|
618
|
-
if (E(t), t.copy[e] =
|
|
617
|
+
if (f === le(t.original, e)) {
|
|
618
|
+
if (E(t), t.copy[e] = Se({
|
|
619
619
|
original: t.original[e],
|
|
620
620
|
parentDraft: t,
|
|
621
621
|
key: t.type === 1 ? Number(e) : e,
|
|
622
622
|
finalities: t.finalities,
|
|
623
623
|
options: t.options
|
|
624
624
|
}), typeof r == "function") {
|
|
625
|
-
const u =
|
|
625
|
+
const u = _(t.copy[e]);
|
|
626
626
|
return E(u), U(u), u.copy;
|
|
627
627
|
}
|
|
628
628
|
return t.copy[e];
|
|
@@ -636,11 +636,11 @@ const ae = (t, e, s = !1) => {
|
|
|
636
636
|
let i;
|
|
637
637
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
|
|
638
638
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
639
|
-
const a =
|
|
639
|
+
const a = ze(A(t), e);
|
|
640
640
|
if (a != null && a.set)
|
|
641
641
|
return a.set.call(t.proxy, s), !0;
|
|
642
|
-
const r =
|
|
643
|
-
return o && $(o.original, s) ? (t.copy[e] = s, t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : ($(s, r) && (s !== void 0 ||
|
|
642
|
+
const r = le(A(t), e), o = _(r);
|
|
643
|
+
return o && $(o.original, s) ? (t.copy[e] = s, t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : ($(s, r) && (s !== void 0 || Z(t.original, e)) || (E(t), U(t), Z(t.original, e) && $(s, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = s, Ie(t, e, s, te)), !0);
|
|
644
644
|
},
|
|
645
645
|
has(t, e) {
|
|
646
646
|
return e in A(t);
|
|
@@ -668,11 +668,11 @@ const ae = (t, e, s = !1) => {
|
|
|
668
668
|
},
|
|
669
669
|
deleteProperty(t, e) {
|
|
670
670
|
var s;
|
|
671
|
-
return t.type === 1 ? Ge.set.call(this, t, e, void 0, t.proxy) : (
|
|
671
|
+
return t.type === 1 ? Ge.set.call(this, t, e, void 0, t.proxy) : (le(t.original, e) !== void 0 || e in t.original ? (E(t), U(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (s = t.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
672
672
|
}
|
|
673
673
|
};
|
|
674
|
-
function
|
|
675
|
-
const { original: e, parentDraft: s, key: n, finalities: i, options: a } = t, r =
|
|
674
|
+
function Se(t) {
|
|
675
|
+
const { original: e, parentDraft: s, key: n, finalities: i, options: a } = t, r = H(e), o = {
|
|
676
676
|
type: r,
|
|
677
677
|
finalized: !1,
|
|
678
678
|
parent: s,
|
|
@@ -690,34 +690,34 @@ function Ie(t) {
|
|
|
690
690
|
const c = s;
|
|
691
691
|
c.finalities.draft.push((l, h) => {
|
|
692
692
|
var m, y;
|
|
693
|
-
const M =
|
|
693
|
+
const M = _(f);
|
|
694
694
|
let p = c.type === 3 ? c.setMap : c.copy;
|
|
695
|
-
const O = V(p, n), v =
|
|
695
|
+
const O = V(p, n), v = _(O);
|
|
696
696
|
if (v) {
|
|
697
|
-
let
|
|
698
|
-
v.operated && (
|
|
697
|
+
let b = v.original;
|
|
698
|
+
v.operated && (b = Me(O)), de(v), me(v, te, l, h), c.options.enableAutoFreeze && (c.options.updatedValues = (m = c.options.updatedValues) !== null && m !== void 0 ? m : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(b, v.original)), ne(p, n, b);
|
|
699
699
|
}
|
|
700
|
-
(y = M.callbacks) === null || y === void 0 || y.forEach((
|
|
701
|
-
|
|
700
|
+
(y = M.callbacks) === null || y === void 0 || y.forEach((b) => {
|
|
701
|
+
b(l, h);
|
|
702
702
|
});
|
|
703
703
|
});
|
|
704
704
|
} else {
|
|
705
|
-
const c =
|
|
705
|
+
const c = _(f);
|
|
706
706
|
c.finalities.draft.push((l, h) => {
|
|
707
|
-
|
|
707
|
+
de(c), me(c, te, l, h);
|
|
708
708
|
});
|
|
709
709
|
}
|
|
710
710
|
return f;
|
|
711
711
|
}
|
|
712
|
-
|
|
712
|
+
we.createDraft = Se;
|
|
713
713
|
function It(t, e, s, n, i) {
|
|
714
714
|
var a;
|
|
715
|
-
const r =
|
|
715
|
+
const r = _(t), o = (a = r == null ? void 0 : r.original) !== null && a !== void 0 ? a : t, f = !!e.length;
|
|
716
716
|
if (r != null && r.operated)
|
|
717
717
|
for (; r.finalities.draft.length > 0; )
|
|
718
718
|
r.finalities.draft.pop()(s, n);
|
|
719
719
|
const u = f ? e[0] : r ? r.operated ? r.copy : r.original : t;
|
|
720
|
-
return r &&
|
|
720
|
+
return r && pe(r), i && q(u, u, r == null ? void 0 : r.options.updatedValues), [
|
|
721
721
|
u,
|
|
722
722
|
s && f ? [{ op: I.Replace, path: [], value: e[0] }] : s,
|
|
723
723
|
n && f ? [{ op: I.Replace, path: [], value: o }] : n
|
|
@@ -732,7 +732,7 @@ function St(t, e) {
|
|
|
732
732
|
};
|
|
733
733
|
let i, a;
|
|
734
734
|
e.enablePatches && (i = [], a = []);
|
|
735
|
-
const o = ((s = e.mark) === null || s === void 0 ? void 0 : s.call(e, t, j)) === j.mutable || !C(t, e) ? t :
|
|
735
|
+
const o = ((s = e.mark) === null || s === void 0 ? void 0 : s.call(e, t, j)) === j.mutable || !C(t, e) ? t : Se({
|
|
736
736
|
original: t,
|
|
737
737
|
parentDraft: null,
|
|
738
738
|
finalities: n,
|
|
@@ -746,10 +746,10 @@ function St(t, e) {
|
|
|
746
746
|
}
|
|
747
747
|
];
|
|
748
748
|
}
|
|
749
|
-
function
|
|
749
|
+
function _e(t) {
|
|
750
750
|
const { rootDraft: e, value: s, useRawReturn: n = !1, isRoot: i = !0 } = t;
|
|
751
|
-
|
|
752
|
-
const f =
|
|
751
|
+
Oe(s, (a, r, o) => {
|
|
752
|
+
const f = _(r);
|
|
753
753
|
if (f && e && f.finalities === e.finalities) {
|
|
754
754
|
t.isContainDraft = !0;
|
|
755
755
|
const u = f.original;
|
|
@@ -757,16 +757,16 @@ function ge(t) {
|
|
|
757
757
|
const c = Array.from(o);
|
|
758
758
|
o.clear(), c.forEach((l) => o.add(a === l ? u : l));
|
|
759
759
|
} else
|
|
760
|
-
|
|
760
|
+
ne(o, a, u);
|
|
761
761
|
} else
|
|
762
|
-
typeof r == "object" && r !== null && (t.value = r, t.isRoot = !1,
|
|
762
|
+
typeof r == "object" && r !== null && (t.value = r, t.isRoot = !1, _e(t));
|
|
763
763
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), n && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
764
764
|
}
|
|
765
765
|
function Ke(t) {
|
|
766
|
-
const e =
|
|
766
|
+
const e = _(t);
|
|
767
767
|
if (!C(t, e == null ? void 0 : e.options))
|
|
768
768
|
return t;
|
|
769
|
-
const s =
|
|
769
|
+
const s = H(t);
|
|
770
770
|
if (e && !e.operated)
|
|
771
771
|
return e.original;
|
|
772
772
|
let n;
|
|
@@ -782,15 +782,15 @@ function Ke(t) {
|
|
|
782
782
|
}
|
|
783
783
|
} else
|
|
784
784
|
n = t;
|
|
785
|
-
return
|
|
785
|
+
return Oe(n, (a, r) => {
|
|
786
786
|
if (e && $(V(e.original, a), r))
|
|
787
787
|
return;
|
|
788
788
|
const o = Ke(r);
|
|
789
|
-
o !== r && (n === t && i(),
|
|
789
|
+
o !== r && (n === t && i(), ne(n, a, o));
|
|
790
790
|
}), s === 3 ? new Set(n) : n;
|
|
791
791
|
}
|
|
792
|
-
function
|
|
793
|
-
if (!
|
|
792
|
+
function xe(t) {
|
|
793
|
+
if (!W(t))
|
|
794
794
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
795
795
|
return Ke(t);
|
|
796
796
|
}
|
|
@@ -808,13 +808,13 @@ const Rt = (t) => {
|
|
|
808
808
|
if (typeof n != "function" && (c = n), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
809
809
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
810
810
|
c = Object.assign(Object.assign({}, t), c);
|
|
811
|
-
const l =
|
|
811
|
+
const l = W(f) ? xe(f) : f, h = Array.isArray(c.mark) ? (d, T) => {
|
|
812
812
|
for (const x of c.mark) {
|
|
813
813
|
if (typeof x != "function")
|
|
814
814
|
throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
|
|
815
|
-
const
|
|
816
|
-
if (
|
|
817
|
-
return
|
|
815
|
+
const Y = x(d, T);
|
|
816
|
+
if (Y)
|
|
817
|
+
return Y;
|
|
818
818
|
}
|
|
819
819
|
} : c.mark, m = (a = c.enablePatches) !== null && a !== void 0 ? a : !1, y = (r = c.strict) !== null && r !== void 0 ? r : !1, p = {
|
|
820
820
|
enableAutoFreeze: (o = c.enableAutoFreeze) !== null && o !== void 0 ? o : !1,
|
|
@@ -830,42 +830,42 @@ const Rt = (t) => {
|
|
|
830
830
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
831
831
|
return [O, v];
|
|
832
832
|
}
|
|
833
|
-
let
|
|
833
|
+
let b;
|
|
834
834
|
try {
|
|
835
|
-
|
|
835
|
+
b = u(O);
|
|
836
836
|
} catch (d) {
|
|
837
|
-
throw
|
|
837
|
+
throw pe(_(O)), d;
|
|
838
838
|
}
|
|
839
839
|
const S = (d) => {
|
|
840
|
-
const T =
|
|
841
|
-
if (!
|
|
840
|
+
const T = _(O);
|
|
841
|
+
if (!W(d)) {
|
|
842
842
|
if (d !== void 0 && !$(d, O) && (T != null && T.operated))
|
|
843
843
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
844
|
-
const
|
|
845
|
-
if (
|
|
846
|
-
const ft =
|
|
847
|
-
return p.strict && typeof d == "object" && d !== null &&
|
|
844
|
+
const Y = d == null ? void 0 : d[pt];
|
|
845
|
+
if (Y) {
|
|
846
|
+
const ft = Y[0];
|
|
847
|
+
return p.strict && typeof d == "object" && d !== null && _e({
|
|
848
848
|
rootDraft: T,
|
|
849
849
|
value: d,
|
|
850
850
|
useRawReturn: !0
|
|
851
851
|
}), v([ft]);
|
|
852
852
|
}
|
|
853
853
|
if (d !== void 0)
|
|
854
|
-
return typeof d == "object" && d !== null &&
|
|
854
|
+
return typeof d == "object" && d !== null && _e({ rootDraft: T, value: d }), v([d]);
|
|
855
855
|
}
|
|
856
856
|
if (d === O || d === void 0)
|
|
857
857
|
return v([]);
|
|
858
|
-
const x =
|
|
858
|
+
const x = _(d);
|
|
859
859
|
if (p === x.options) {
|
|
860
860
|
if (x.operated)
|
|
861
861
|
throw new Error("Cannot return a modified child draft.");
|
|
862
|
-
return v([
|
|
862
|
+
return v([xe(d)]);
|
|
863
863
|
}
|
|
864
864
|
return v([d]);
|
|
865
865
|
};
|
|
866
|
-
return
|
|
867
|
-
throw
|
|
868
|
-
}) : S(
|
|
866
|
+
return b instanceof Promise ? b.then(S, (d) => {
|
|
867
|
+
throw pe(_(O)), d;
|
|
868
|
+
}) : S(b);
|
|
869
869
|
};
|
|
870
870
|
}, w = Rt();
|
|
871
871
|
Object.prototype.constructor.toString();
|
|
@@ -913,8 +913,8 @@ var Xe = { exports: {} };
|
|
|
913
913
|
throw new i("retryOn property expects an array or function");
|
|
914
914
|
return new Promise(function(y, M) {
|
|
915
915
|
var p = function(v) {
|
|
916
|
-
var
|
|
917
|
-
a(
|
|
916
|
+
var b = typeof Request < "u" && u instanceof Request ? u.clone() : u;
|
|
917
|
+
a(b, c).then(function(S) {
|
|
918
918
|
if (Array.isArray(m) && m.indexOf(S.status) === -1)
|
|
919
919
|
y(S);
|
|
920
920
|
else if (typeof m == "function")
|
|
@@ -942,8 +942,8 @@ var Xe = { exports: {} };
|
|
|
942
942
|
v < l ? O(v, S, null) : M(S);
|
|
943
943
|
});
|
|
944
944
|
};
|
|
945
|
-
function O(v,
|
|
946
|
-
var d = typeof h == "function" ? h(v,
|
|
945
|
+
function O(v, b, S) {
|
|
946
|
+
var d = typeof h == "function" ? h(v, b, S) : h;
|
|
947
947
|
setTimeout(function() {
|
|
948
948
|
p(++v);
|
|
949
949
|
}, d);
|
|
@@ -985,12 +985,12 @@ const Qe = /* @__PURE__ */ Ye(At), Dt = Qe(fetch), Ze = async (t, e) => {
|
|
|
985
985
|
throw `Error converting metapage definition to version ${e}: ${n}`;
|
|
986
986
|
}
|
|
987
987
|
return Ct(t, e);
|
|
988
|
-
}, jt = async (t) => Ze(t,
|
|
988
|
+
}, jt = async (t) => Ze(t, ve), Ct = (t, e) => {
|
|
989
989
|
if (!t)
|
|
990
990
|
throw "Metapage definition null";
|
|
991
991
|
if (!t.version)
|
|
992
992
|
throw 'Missing "version" key in metapage definition';
|
|
993
|
-
let s =
|
|
993
|
+
let s = G(t.version);
|
|
994
994
|
if (s === e)
|
|
995
995
|
return t;
|
|
996
996
|
let n = t;
|
|
@@ -998,19 +998,19 @@ const Qe = /* @__PURE__ */ Ye(At), Dt = Qe(fetch), Ze = async (t, e) => {
|
|
|
998
998
|
switch (s) {
|
|
999
999
|
case "0.2": {
|
|
1000
1000
|
if (k(e, s) > 0)
|
|
1001
|
-
n = Ut(n), s =
|
|
1001
|
+
n = Ut(n), s = G(n.version);
|
|
1002
1002
|
else
|
|
1003
1003
|
throw `Cannot convert from version ${s} to ${e}`;
|
|
1004
1004
|
break;
|
|
1005
1005
|
}
|
|
1006
1006
|
case "0.3": {
|
|
1007
|
-
k(e, s) > 0 ? (n = zt(n), s =
|
|
1007
|
+
k(e, s) > 0 ? (n = zt(n), s = G(n.version)) : (n = Tt(n), s = G(n.version));
|
|
1008
1008
|
break;
|
|
1009
1009
|
}
|
|
1010
1010
|
case "1": {
|
|
1011
1011
|
if (k(e, s) > 0)
|
|
1012
1012
|
throw `Cannot convert from version ${s} to ${e}, 1 is the latest version`;
|
|
1013
|
-
n = $t(n), s =
|
|
1013
|
+
n = $t(n), s = G(n.version);
|
|
1014
1014
|
break;
|
|
1015
1015
|
}
|
|
1016
1016
|
default:
|
|
@@ -1023,9 +1023,9 @@ const Qe = /* @__PURE__ */ Ye(At), Dt = Qe(fetch), Ze = async (t, e) => {
|
|
|
1023
1023
|
case void 0:
|
|
1024
1024
|
case "0.3":
|
|
1025
1025
|
case "0.4":
|
|
1026
|
-
return et(
|
|
1026
|
+
return et(Ne(Pt(t)));
|
|
1027
1027
|
case "0.5":
|
|
1028
|
-
return
|
|
1028
|
+
return Ne(t);
|
|
1029
1029
|
case "0.6":
|
|
1030
1030
|
return tt(t);
|
|
1031
1031
|
case "1":
|
|
@@ -1056,7 +1056,7 @@ ${window.location.href}`), t;
|
|
|
1056
1056
|
metadata: M,
|
|
1057
1057
|
...r
|
|
1058
1058
|
};
|
|
1059
|
-
}, tt = (t) => t,
|
|
1059
|
+
}, tt = (t) => t, Ne = (t) => tt(Lt(t)), Lt = (t) => w(t, (e) => {
|
|
1060
1060
|
const { metadata: s, ...n } = e, i = {
|
|
1061
1061
|
...n,
|
|
1062
1062
|
version: "0.6"
|
|
@@ -1097,9 +1097,9 @@ ${window.location.href}`), t;
|
|
|
1097
1097
|
}), zt = (t) => w(t, (e) => {
|
|
1098
1098
|
const s = e;
|
|
1099
1099
|
delete s.plugins, s.version = "1";
|
|
1100
|
-
}), $t = (t) => w(t, (e) => (e.version = "0.3", e)),
|
|
1100
|
+
}), $t = (t) => w(t, (e) => (e.version = "0.3", e)), G = (t) => {
|
|
1101
1101
|
if (t === "latest")
|
|
1102
|
-
return
|
|
1102
|
+
return ve;
|
|
1103
1103
|
if (k(t, "0.2") < 0)
|
|
1104
1104
|
throw `Unknown version: ${t}`;
|
|
1105
1105
|
if (k(t, "0.2") <= 0 && k(t, "0.3") < 0)
|
|
@@ -1110,28 +1110,28 @@ ${window.location.href}`), t;
|
|
|
1110
1110
|
return "1";
|
|
1111
1111
|
throw `Unknown version: ${t}`;
|
|
1112
1112
|
};
|
|
1113
|
-
var
|
|
1114
|
-
for (var
|
|
1115
|
-
|
|
1116
|
-
var
|
|
1113
|
+
var K = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Q = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
1114
|
+
for (var ie = 0; ie < K.length; ie++)
|
|
1115
|
+
Q[K.charCodeAt(ie)] = ie;
|
|
1116
|
+
var re = function(t) {
|
|
1117
1117
|
var e = new Uint8Array(t), s, n = e.length, i = "";
|
|
1118
1118
|
for (s = 0; s < n; s += 3)
|
|
1119
|
-
i +=
|
|
1119
|
+
i += K[e[s] >> 2], i += K[(e[s] & 3) << 4 | e[s + 1] >> 4], i += K[(e[s + 1] & 15) << 2 | e[s + 2] >> 6], i += K[e[s + 2] & 63];
|
|
1120
1120
|
return n % 3 === 2 ? i = i.substring(0, i.length - 1) + "=" : n % 3 === 1 && (i = i.substring(0, i.length - 2) + "=="), i;
|
|
1121
1121
|
}, F = function(t) {
|
|
1122
1122
|
var e = t.length * 0.75, s = t.length, n, i = 0, a, r, o, f;
|
|
1123
1123
|
t[t.length - 1] === "=" && (e--, t[t.length - 2] === "=" && e--);
|
|
1124
1124
|
var u = new ArrayBuffer(e), c = new Uint8Array(u);
|
|
1125
1125
|
for (n = 0; n < s; n += 4)
|
|
1126
|
-
a =
|
|
1126
|
+
a = Q[t.charCodeAt(n)], r = Q[t.charCodeAt(n + 1)], o = Q[t.charCodeAt(n + 2)], f = Q[t.charCodeAt(n + 3)], c[i++] = a << 2 | r >> 4, c[i++] = (r & 15) << 4 | o >> 2, c[i++] = (o & 3) << 6 | f & 63;
|
|
1127
1127
|
return u;
|
|
1128
1128
|
};
|
|
1129
|
-
const
|
|
1129
|
+
const ce = async (t) => w(t, async (e) => {
|
|
1130
1130
|
for (const s of Object.keys(t)) {
|
|
1131
1131
|
const n = await Vt(t[s]);
|
|
1132
1132
|
return e[s] = n, e;
|
|
1133
1133
|
}
|
|
1134
|
-
}),
|
|
1134
|
+
}), ee = async (t) => w(t, async (e) => {
|
|
1135
1135
|
for (const s of Object.keys(t)) {
|
|
1136
1136
|
const n = await xt(t[s]);
|
|
1137
1137
|
return e[s] = n, e;
|
|
@@ -1141,7 +1141,7 @@ const ue = async (t) => w(t, async (e) => {
|
|
|
1141
1141
|
const e = t, s = {
|
|
1142
1142
|
_s: !0,
|
|
1143
1143
|
_c: t.constructor.name,
|
|
1144
|
-
value:
|
|
1144
|
+
value: re(e.buffer),
|
|
1145
1145
|
byteLength: e.byteLength,
|
|
1146
1146
|
byteOffset: e.byteOffset,
|
|
1147
1147
|
size: e.byteLength
|
|
@@ -1152,7 +1152,7 @@ const ue = async (t) => w(t, async (e) => {
|
|
|
1152
1152
|
return {
|
|
1153
1153
|
_s: !0,
|
|
1154
1154
|
_c: File.name,
|
|
1155
|
-
value:
|
|
1155
|
+
value: re(s),
|
|
1156
1156
|
name: e.name,
|
|
1157
1157
|
fileType: e.type,
|
|
1158
1158
|
lastModified: e.lastModified,
|
|
@@ -1163,7 +1163,7 @@ const ue = async (t) => w(t, async (e) => {
|
|
|
1163
1163
|
return {
|
|
1164
1164
|
_s: !0,
|
|
1165
1165
|
_c: Blob.name,
|
|
1166
|
-
value:
|
|
1166
|
+
value: re(s),
|
|
1167
1167
|
fileType: e.type,
|
|
1168
1168
|
size: s.byteLength
|
|
1169
1169
|
};
|
|
@@ -1171,7 +1171,7 @@ const ue = async (t) => w(t, async (e) => {
|
|
|
1171
1171
|
const e = t, s = {
|
|
1172
1172
|
_s: !0,
|
|
1173
1173
|
_c: ArrayBuffer.name,
|
|
1174
|
-
value:
|
|
1174
|
+
value: re(e),
|
|
1175
1175
|
size: e.byteLength
|
|
1176
1176
|
};
|
|
1177
1177
|
return Promise.resolve(s);
|
|
@@ -1301,7 +1301,7 @@ var st = { exports: {} };
|
|
|
1301
1301
|
var M = s ? s + u : u;
|
|
1302
1302
|
if (!this._events[M])
|
|
1303
1303
|
return !1;
|
|
1304
|
-
var p = this._events[M], O = arguments.length, v,
|
|
1304
|
+
var p = this._events[M], O = arguments.length, v, b;
|
|
1305
1305
|
if (p.fn) {
|
|
1306
1306
|
switch (p.once && this.removeListener(u, p.fn, void 0, !0), O) {
|
|
1307
1307
|
case 1:
|
|
@@ -1317,30 +1317,30 @@ var st = { exports: {} };
|
|
|
1317
1317
|
case 6:
|
|
1318
1318
|
return p.fn.call(p.context, c, l, h, m, y), !0;
|
|
1319
1319
|
}
|
|
1320
|
-
for (
|
|
1321
|
-
v[
|
|
1320
|
+
for (b = 1, v = new Array(O - 1); b < O; b++)
|
|
1321
|
+
v[b - 1] = arguments[b];
|
|
1322
1322
|
p.fn.apply(p.context, v);
|
|
1323
1323
|
} else {
|
|
1324
1324
|
var S = p.length, d;
|
|
1325
|
-
for (
|
|
1326
|
-
switch (p[
|
|
1325
|
+
for (b = 0; b < S; b++)
|
|
1326
|
+
switch (p[b].once && this.removeListener(u, p[b].fn, void 0, !0), O) {
|
|
1327
1327
|
case 1:
|
|
1328
|
-
p[
|
|
1328
|
+
p[b].fn.call(p[b].context);
|
|
1329
1329
|
break;
|
|
1330
1330
|
case 2:
|
|
1331
|
-
p[
|
|
1331
|
+
p[b].fn.call(p[b].context, c);
|
|
1332
1332
|
break;
|
|
1333
1333
|
case 3:
|
|
1334
|
-
p[
|
|
1334
|
+
p[b].fn.call(p[b].context, c, l);
|
|
1335
1335
|
break;
|
|
1336
1336
|
case 4:
|
|
1337
|
-
p[
|
|
1337
|
+
p[b].fn.call(p[b].context, c, l, h);
|
|
1338
1338
|
break;
|
|
1339
1339
|
default:
|
|
1340
1340
|
if (!v)
|
|
1341
1341
|
for (d = 1, v = new Array(O - 1); d < O; d++)
|
|
1342
1342
|
v[d - 1] = arguments[d];
|
|
1343
|
-
p[
|
|
1343
|
+
p[b].fn.apply(p[b].context, v);
|
|
1344
1344
|
}
|
|
1345
1345
|
}
|
|
1346
1346
|
return !0;
|
|
@@ -1368,7 +1368,7 @@ var st = { exports: {} };
|
|
|
1368
1368
|
return u ? (c = s ? s + u : u, this._events[c] && r(this, c)) : (this._events = new n(), this._eventsCount = 0), this;
|
|
1369
1369
|
}, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = s, o.EventEmitter = o, t.exports = o;
|
|
1370
1370
|
})(st);
|
|
1371
|
-
var
|
|
1371
|
+
var Re = st.exports, Nt = function(t, e) {
|
|
1372
1372
|
e || (e = {}), typeof e == "function" && (e = { cmp: e });
|
|
1373
1373
|
var s = typeof e.cycles == "boolean" ? e.cycles : !1, n = e.cmp && function(a) {
|
|
1374
1374
|
return function(r) {
|
|
@@ -1407,10 +1407,10 @@ var Se = st.exports, Nt = function(t, e) {
|
|
|
1407
1407
|
}(t);
|
|
1408
1408
|
};
|
|
1409
1409
|
const nt = /* @__PURE__ */ Ye(Nt);
|
|
1410
|
-
var
|
|
1410
|
+
var se;
|
|
1411
1411
|
(function(t) {
|
|
1412
1412
|
t.mp_debug = "mp_debug";
|
|
1413
|
-
})(
|
|
1413
|
+
})(se || (se = {}));
|
|
1414
1414
|
const kt = () => {
|
|
1415
1415
|
try {
|
|
1416
1416
|
return window !== window.top;
|
|
@@ -1418,10 +1418,10 @@ const kt = () => {
|
|
|
1418
1418
|
return !1;
|
|
1419
1419
|
}
|
|
1420
1420
|
}, it = {
|
|
1421
|
-
version:
|
|
1421
|
+
version: ve,
|
|
1422
1422
|
metaframes: {}
|
|
1423
1423
|
};
|
|
1424
|
-
class Ft extends
|
|
1424
|
+
class Ft extends Re.EventEmitter {
|
|
1425
1425
|
constructor() {
|
|
1426
1426
|
super(), this._definition = it, this.getDefinition = this.getDefinition.bind(this);
|
|
1427
1427
|
}
|
|
@@ -1432,18 +1432,18 @@ class Ft extends Se.EventEmitter {
|
|
|
1432
1432
|
return this._definition;
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
|
-
const
|
|
1435
|
+
const ue = (t, e) => e ? w(t, (s) => {
|
|
1436
1436
|
Object.keys(e).forEach((n) => {
|
|
1437
1437
|
e[n] === void 0 ? delete s[n] : s[n] = e[n];
|
|
1438
1438
|
});
|
|
1439
|
-
}) : t, os = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, as = () => new URLSearchParams(window.location.search).has(
|
|
1440
|
-
const t = new URLSearchParams(window.location.search).get(
|
|
1439
|
+
}) : t, os = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, as = () => new URLSearchParams(window.location.search).has(se.mp_debug), be = () => {
|
|
1440
|
+
const t = new URLSearchParams(window.location.search).get(se.mp_debug);
|
|
1441
1441
|
return t === "true" || t === "1";
|
|
1442
|
-
}, fs = (t = 8) =>
|
|
1443
|
-
for (var e = "", s =
|
|
1444
|
-
e +=
|
|
1442
|
+
}, fs = (t = 8) => Ee(t), Bt = (t = 8) => Ee(t), us = (t = 8) => Ee(t), ke = "abcdefghijklmnopqrstuvwxyz0123456789", Ee = (t = 8) => {
|
|
1443
|
+
for (var e = "", s = ke.length, n = 0; n < t; n++)
|
|
1444
|
+
e += ke.charAt(Math.floor(Math.random() * s));
|
|
1445
1445
|
return e;
|
|
1446
|
-
},
|
|
1446
|
+
}, Ae = (t, e, s) => {
|
|
1447
1447
|
e = e || "000", e && e.trim() == "" && (e = void 0);
|
|
1448
1448
|
let n;
|
|
1449
1449
|
if (typeof t == "string" ? n = t : typeof t == "number" ? n = t + "" : n = JSON.stringify(t, null, " "), e && e.trim() != "") {
|
|
@@ -1459,8 +1459,8 @@ const fe = (t, e) => e ? w(t, (s) => {
|
|
|
1459
1459
|
}, Wt = (t) => {
|
|
1460
1460
|
var e = (t & 16777215).toString(16).toUpperCase();
|
|
1461
1461
|
return "00000".substring(0, 6 - e.length) + e;
|
|
1462
|
-
},
|
|
1463
|
-
if (
|
|
1462
|
+
}, he = () => document.readyState == "complete" || document.readyState == "interactive", De = async () => he() ? Promise.resolve() : new Promise((t) => {
|
|
1463
|
+
if (he()) {
|
|
1464
1464
|
t();
|
|
1465
1465
|
return;
|
|
1466
1466
|
}
|
|
@@ -1468,7 +1468,7 @@ const fe = (t, e) => e ? w(t, (s) => {
|
|
|
1468
1468
|
window.addEventListener("load", () => {
|
|
1469
1469
|
e || (e = !0, t());
|
|
1470
1470
|
}), setTimeout(() => {
|
|
1471
|
-
!e &&
|
|
1471
|
+
!e && he() && (e = !0, t());
|
|
1472
1472
|
}, 200);
|
|
1473
1473
|
}), cs = async (t) => {
|
|
1474
1474
|
const e = nt(t);
|
|
@@ -1492,14 +1492,14 @@ var R;
|
|
|
1492
1492
|
(function(t) {
|
|
1493
1493
|
t.Connected = "connected", t.Error = "error", t.Input = "input", t.Inputs = "inputs", t.Message = "message";
|
|
1494
1494
|
})(R || (R = {}));
|
|
1495
|
-
class P extends
|
|
1495
|
+
class P extends Re.EventEmitter {
|
|
1496
1496
|
constructor(e) {
|
|
1497
1497
|
if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = N.WaitingForPageLoad, this._messageSendCount = 0, this.debug = be(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = be(), this._isIframe = kt(), this.addListener = this.addListener.bind(this), this.dispose = this.dispose.bind(this), this.error = this.error.bind(this), this.getInput = this.getInput.bind(this), this.getInputs = this.getInputs.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.onInput = this.onInput.bind(this), this.onInputs = this.onInputs.bind(this), this.onMessage = this.onMessage.bind(this), this.sendRpc = this.sendRpc.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInternalInputsAndNotify = this.setInternalInputsAndNotify.bind(this), this.setOutput = this.setOutput.bind(this), this.setOutputs = this.setOutputs.bind(this), this.warn = this.warn.bind(this), this._resolveSetupIframeServerResponse = this._resolveSetupIframeServerResponse.bind(this), this.addListenerReturnDisposer = this.addListenerReturnDisposer.bind(this), this.connected = this.connected.bind(this), this.disableNotifyOnHashUrlChange = this.disableNotifyOnHashUrlChange.bind(this), this._onHashUrlChange = this._onHashUrlChange.bind(this), !this._isIframe) {
|
|
1498
1498
|
this.log("Not an iframe, metaframe code disabled");
|
|
1499
1499
|
return;
|
|
1500
1500
|
}
|
|
1501
1501
|
const s = this;
|
|
1502
|
-
|
|
1502
|
+
De().then(() => {
|
|
1503
1503
|
this.log("pageLoaded"), window.addEventListener("message", this.onMessage), s.sendRpc(D.SetupIframeClientRequest, {
|
|
1504
1504
|
version: P.version
|
|
1505
1505
|
}), s._state = N.SentSetupIframeClientRequest;
|
|
@@ -1508,7 +1508,7 @@ class P extends Se.EventEmitter {
|
|
|
1508
1508
|
_resolveSetupIframeServerResponse(e) {
|
|
1509
1509
|
if (this._state === N.WaitingForPageLoad)
|
|
1510
1510
|
throw "Got message but page has not finished loading, we should never get in this state";
|
|
1511
|
-
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = rt(this.id), this._parentId = e.parentId, this.log(`metapage[${this._parentId}](v${this._parentVersion ? this._parentVersion : "unknown"}) registered`), e.state && e.state.inputs && (this.isInputOutputBlobSerialization ? this._inputPipeValues = await
|
|
1511
|
+
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = rt(this.id), this._parentId = e.parentId, this.log(`metapage[${this._parentId}](v${this._parentVersion ? this._parentVersion : "unknown"}) registered`), e.state && e.state.inputs && (this.isInputOutputBlobSerialization ? this._inputPipeValues = await ee(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = N.Ready, this.sendRpc(D.SetupIframeServerResponseAck, {
|
|
1512
1512
|
version: P.version
|
|
1513
1513
|
}), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(R.Inputs, this._inputPipeValues), Object.keys(this._inputPipeValues).forEach((s) => this.emit(R.Input, s, this._inputPipeValues[s]))), this.emit(R.Inputs, this._inputPipeValues), this.emit(R.Connected)))();
|
|
1514
1514
|
}
|
|
@@ -1537,7 +1537,7 @@ class P extends Se.EventEmitter {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
logInternal(e, s, n) {
|
|
1539
1539
|
let i;
|
|
1540
|
-
typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), s = s && s + "", i = (this.id ? `Metaframe[${this.id}] ` : "") + `${i}`,
|
|
1540
|
+
typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), s = s && s + "", i = (this.id ? `Metaframe[${this.id}] ` : "") + `${i}`, Ae(i, s, n);
|
|
1541
1541
|
}
|
|
1542
1542
|
dispose() {
|
|
1543
1543
|
super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this.disableNotifyOnHashUrlChange(), this._inputPipeValues = void 0, this._outputPipeValues = void 0;
|
|
@@ -1560,12 +1560,12 @@ class P extends Se.EventEmitter {
|
|
|
1560
1560
|
n[e] = s, this.setInputs(n);
|
|
1561
1561
|
}
|
|
1562
1562
|
async setInputs(e) {
|
|
1563
|
-
this.isInputOutputBlobSerialization && (e = await
|
|
1563
|
+
this.isInputOutputBlobSerialization && (e = await ee(e)), this.sendRpc(D.InputsUpdate, e);
|
|
1564
1564
|
}
|
|
1565
1565
|
async setInternalInputsAndNotify(e) {
|
|
1566
|
-
this.isInputOutputBlobSerialization && (e = await
|
|
1566
|
+
this.isInputOutputBlobSerialization && (e = await ee(e));
|
|
1567
1567
|
const s = e;
|
|
1568
|
-
if (this._inputPipeValues =
|
|
1568
|
+
if (this._inputPipeValues = ue(this._inputPipeValues, e), this._inputPipeValues !== s) {
|
|
1569
1569
|
Object.keys(e).forEach((n) => {
|
|
1570
1570
|
try {
|
|
1571
1571
|
this.emit(R.Input, n, e[n]);
|
|
@@ -1592,9 +1592,9 @@ class P extends Se.EventEmitter {
|
|
|
1592
1592
|
n[e] = s, this.setOutputs(n);
|
|
1593
1593
|
}
|
|
1594
1594
|
async setOutputs(e) {
|
|
1595
|
-
this.isInputOutputBlobSerialization && (e = await
|
|
1595
|
+
this.isInputOutputBlobSerialization && (e = await ce(e));
|
|
1596
1596
|
const s = e;
|
|
1597
|
-
this._outputPipeValues =
|
|
1597
|
+
this._outputPipeValues = ue(this._outputPipeValues, e), this._outputPipeValues !== s && this.sendRpc(D.OutputsUpdate, e);
|
|
1598
1598
|
}
|
|
1599
1599
|
disableNotifyOnHashUrlChange() {
|
|
1600
1600
|
window.removeEventListener("hashchange", this._onHashUrlChange);
|
|
@@ -1656,9 +1656,9 @@ P.CONNECTED = R.Connected;
|
|
|
1656
1656
|
P.INPUT = R.Input;
|
|
1657
1657
|
P.INPUTS = R.Inputs;
|
|
1658
1658
|
P.MESSAGE = R.Message;
|
|
1659
|
-
P.deserializeInputs =
|
|
1660
|
-
P.serializeInputs =
|
|
1661
|
-
class Ht extends
|
|
1659
|
+
P.deserializeInputs = ee;
|
|
1660
|
+
P.serializeInputs = ce;
|
|
1661
|
+
class Ht extends Re.EventEmitter {
|
|
1662
1662
|
constructor(e, s, n, i, a, r = !1) {
|
|
1663
1663
|
if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._cachedEventInputsUpdate = {
|
|
1664
1664
|
iframeId: void 0,
|
|
@@ -1673,12 +1673,12 @@ class Ht extends Se.EventEmitter {
|
|
|
1673
1673
|
}
|
|
1674
1674
|
if (this.url = s, this._metapage = e, this._debug = r, r) {
|
|
1675
1675
|
var o = new URL(this.url);
|
|
1676
|
-
o.searchParams.set(
|
|
1676
|
+
o.searchParams.set(se.mp_debug, "true"), this.url = o.href;
|
|
1677
1677
|
}
|
|
1678
1678
|
this.id = n, this._parentId = i, this._color = rt(this.id), this._consoleBackgroundColor = a, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
|
|
1679
1679
|
const f = this;
|
|
1680
1680
|
this.iframe = new Promise((u) => {
|
|
1681
|
-
|
|
1681
|
+
De().then(async () => {
|
|
1682
1682
|
var c, l, h, m;
|
|
1683
1683
|
if (f._iframe) {
|
|
1684
1684
|
if ((m = (h = (l = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : l.metaframes) == null ? void 0 : h[this.id]) != null && m.allow)
|
|
@@ -1734,7 +1734,7 @@ Error: ${s}`);
|
|
|
1734
1734
|
setInputs(e) {
|
|
1735
1735
|
this.log({ m: "MetapageIFrameRpcClient", inputs: e });
|
|
1736
1736
|
const s = e;
|
|
1737
|
-
if (this.inputs =
|
|
1737
|
+
if (this.inputs = ue(this.inputs, e), this.inputs === s)
|
|
1738
1738
|
return this;
|
|
1739
1739
|
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(g.Inputs, this.inputs), this._metapage.listenerCount(g.Inputs) > 0) {
|
|
1740
1740
|
var n = {};
|
|
@@ -1749,7 +1749,7 @@ Error: ${s}`);
|
|
|
1749
1749
|
}
|
|
1750
1750
|
setOutputs(e) {
|
|
1751
1751
|
const s = e;
|
|
1752
|
-
if (this.outputs =
|
|
1752
|
+
if (this.outputs = ue(this.outputs, e), this.outputs === s)
|
|
1753
1753
|
return this;
|
|
1754
1754
|
if (this.emit(g.Outputs, e), this._metapage.listenerCount(g.Outputs) > 0) {
|
|
1755
1755
|
var n = {};
|
|
@@ -1805,7 +1805,7 @@ Error: ${s}`);
|
|
|
1805
1805
|
}
|
|
1806
1806
|
}
|
|
1807
1807
|
async sendInputs(e) {
|
|
1808
|
-
e = await
|
|
1808
|
+
e = await ce(e), this.sendRpc(z.InputsUpdate, {
|
|
1809
1809
|
inputs: e,
|
|
1810
1810
|
parentId: this._parentId
|
|
1811
1811
|
});
|
|
@@ -1837,7 +1837,7 @@ Error: ${s}`);
|
|
|
1837
1837
|
}
|
|
1838
1838
|
logInternal(e) {
|
|
1839
1839
|
let s;
|
|
1840
|
-
typeof e == "string" ? s = e : typeof e == "string" ? s = e + "" : s = JSON.stringify(e),
|
|
1840
|
+
typeof e == "string" ? s = e : typeof e == "string" ? s = e + "" : s = JSON.stringify(e), Ae(`Metapage[${this._parentId}] Metaframe[${this.id}] ${s}`, this._color, this._consoleBackgroundColor);
|
|
1841
1841
|
}
|
|
1842
1842
|
sendRpcInternal(e, s) {
|
|
1843
1843
|
const n = {
|
|
@@ -1864,12 +1864,12 @@ Error: ${s}`);
|
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
1866
|
}
|
|
1867
|
-
const
|
|
1867
|
+
const B = w({
|
|
1868
1868
|
metaframes: {
|
|
1869
1869
|
inputs: {},
|
|
1870
1870
|
outputs: {}
|
|
1871
1871
|
}
|
|
1872
|
-
}, (t) => t), hs = (t) =>
|
|
1872
|
+
}, (t) => t), hs = (t) => G(t), qt = (t, e) => !e || e === "*" || t === e ? !0 : e.endsWith("*") ? t.startsWith(e.slice(0, -1)) : e.startsWith("*") ? t.endsWith(e.slice(1)) : !1, Gt = "bcbcbc";
|
|
1873
1873
|
class L extends Ft {
|
|
1874
1874
|
static async from(e, s) {
|
|
1875
1875
|
if (e == null)
|
|
@@ -1884,7 +1884,7 @@ class L extends Ft {
|
|
|
1884
1884
|
return n.setDefinition(e);
|
|
1885
1885
|
}
|
|
1886
1886
|
constructor(e) {
|
|
1887
|
-
super(), this._state =
|
|
1887
|
+
super(), this._state = B, this._metaframes = w({}, (s) => s), this.debug = be(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = w({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : Bt(), this._consoleBackgroundColor = e && e.color ? e.color : Gt, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), De().then(() => {
|
|
1888
1888
|
this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
|
|
1889
1889
|
});
|
|
1890
1890
|
}
|
|
@@ -1906,7 +1906,7 @@ class L extends Ft {
|
|
|
1906
1906
|
setState(e) {
|
|
1907
1907
|
this._state = w(e, (s) => s), this.getMetaframeIds().forEach((s) => {
|
|
1908
1908
|
this.getMetaframe(s).setInputs(this._state.metaframes.inputs[s]), this.getMetaframe(s).setOutputs(this._state.metaframes.outputs[s]);
|
|
1909
|
-
}), this.listenerCount(g.State) > 0 && this.emit(g.State, this._state);
|
|
1909
|
+
}), this.listenerCount(g.State) > 0 && B !== this._state && this.emit(g.State, this._state);
|
|
1910
1910
|
}
|
|
1911
1911
|
getStateMetaframes() {
|
|
1912
1912
|
return this._state.metaframes;
|
|
@@ -1936,7 +1936,7 @@ class L extends Ft {
|
|
|
1936
1936
|
this.addMetaframe(a, r);
|
|
1937
1937
|
}
|
|
1938
1938
|
}), i !== it && window.setTimeout(() => {
|
|
1939
|
-
!this.isDisposed() && n === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(g.State) > 0 && this.emit(g.State, this._state));
|
|
1939
|
+
!this.isDisposed() && n === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(g.State) > 0 && B !== this._state && this.emit(g.State, this._state));
|
|
1940
1940
|
}, 0), this;
|
|
1941
1941
|
}
|
|
1942
1942
|
_emitDefinitionEvent() {
|
|
@@ -1968,7 +1968,7 @@ class L extends Ft {
|
|
|
1968
1968
|
}), this._cachedInputLookupMap = w({}, (s) => s));
|
|
1969
1969
|
}
|
|
1970
1970
|
removeAll() {
|
|
1971
|
-
Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = w({}, (e) => e), this._state =
|
|
1971
|
+
Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = w({}, (e) => e), this._state = B, this._inputMap = w({}, (e) => e), this._cachedInputLookupMap = w({}, (e) => e);
|
|
1972
1972
|
}
|
|
1973
1973
|
metaframes() {
|
|
1974
1974
|
return this.getMetaframes();
|
|
@@ -2044,7 +2044,8 @@ class L extends Ft {
|
|
|
2044
2044
|
}
|
|
2045
2045
|
}
|
|
2046
2046
|
setInput(e, s, n) {
|
|
2047
|
-
|
|
2047
|
+
var i, a;
|
|
2048
|
+
typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount(g.State) > 0 || this.listenerCount(g.Inputs) > 0) && B !== this._state && (this.emit(g.State, this._state), this.emit(g.Inputs, (a = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : a.inputs));
|
|
2048
2049
|
}
|
|
2049
2050
|
setMetaframeClientInputAndSentClientEvent(e, s, n) {
|
|
2050
2051
|
if (typeof e == "object") {
|
|
@@ -2162,13 +2163,13 @@ class L extends Ft {
|
|
|
2162
2163
|
});
|
|
2163
2164
|
}), i && (this.setInputStateOnlyMetapageInstanceInputs(l), Object.keys(l).forEach((h) => {
|
|
2164
2165
|
this._metaframes[h].setInputs(l[h]);
|
|
2165
|
-
})), this.listenerCount(g.State) > 0 && this.emit(g.State, this._state), this.debug && n.ack({ jsonrpc: r, state: this._state });
|
|
2166
|
+
})), this.listenerCount(g.State) > 0 && B !== this._state && this.emit(g.State, this._state), this.debug && n.ack({ jsonrpc: r, state: this._state });
|
|
2166
2167
|
} else
|
|
2167
2168
|
this.error(`missing metaframe=${o}`);
|
|
2168
2169
|
break;
|
|
2169
2170
|
case D.InputsUpdate:
|
|
2170
2171
|
var a = r.params;
|
|
2171
|
-
this.debug && this.log(`inputs ${JSON.stringify(a)} from ${o}`), this._metaframes[o] ? (this.setInputStateOnlyMetaframeInputMap(o, a), this._metaframes[o].setInputs(a), this.listenerCount(g.State) > 0 && this.emit(g.State, this._state), this.debug && this._metaframes[o].ack({
|
|
2172
|
+
this.debug && this.log(`inputs ${JSON.stringify(a)} from ${o}`), this._metaframes[o] ? (this.setInputStateOnlyMetaframeInputMap(o, a), this._metaframes[o].setInputs(a), this.listenerCount(g.State) > 0 && B !== this._state && this.emit(g.State, this._state), this.debug && this._metaframes[o].ack({
|
|
2172
2173
|
jsonrpc: r,
|
|
2173
2174
|
state: this._state
|
|
2174
2175
|
})) : (console.error(`InputsUpdate failed no metaframe id: "${o}"`), this.error(`InputsUpdate failed no metaframe id: "${o}"`));
|
|
@@ -2190,7 +2191,7 @@ class L extends Ft {
|
|
|
2190
2191
|
logInternal(e, s, n) {
|
|
2191
2192
|
n = n || this._consoleBackgroundColor;
|
|
2192
2193
|
let i;
|
|
2193
|
-
typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), i = this._id ? `Metapage[${this._id}] ${i}` : i,
|
|
2194
|
+
typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), i = this._id ? `Metapage[${this._id}] ${i}` : i, Ae(i, s, n);
|
|
2194
2195
|
}
|
|
2195
2196
|
}
|
|
2196
2197
|
L.version = Fe;
|
|
@@ -2200,8 +2201,8 @@ L.INPUTS = g.Inputs;
|
|
|
2200
2201
|
L.MESSAGE = g.Message;
|
|
2201
2202
|
L.OUTPUTS = g.Outputs;
|
|
2202
2203
|
L.STATE = g.State;
|
|
2203
|
-
L.deserializeInputs =
|
|
2204
|
-
L.serializeInputs =
|
|
2204
|
+
L.deserializeInputs = ee;
|
|
2205
|
+
L.serializeInputs = ce;
|
|
2205
2206
|
const at = Qe(fetch), ps = async (t, e) => {
|
|
2206
2207
|
const s = new URL(t);
|
|
2207
2208
|
s.pathname = s.pathname + (s.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
|
|
@@ -2234,27 +2235,27 @@ export {
|
|
|
2234
2235
|
R as MetaframeEvents,
|
|
2235
2236
|
N as MetaframeLoadingState,
|
|
2236
2237
|
Kt as MetaframeVersionCurrent,
|
|
2237
|
-
|
|
2238
|
+
je as MetaframeVersionsAll,
|
|
2238
2239
|
L as Metapage,
|
|
2239
2240
|
g as MetapageEvents,
|
|
2240
|
-
|
|
2241
|
+
se as MetapageHashParams,
|
|
2241
2242
|
Ht as MetapageIFrameRpcClient,
|
|
2242
2243
|
Ft as MetapageShared,
|
|
2243
|
-
|
|
2244
|
-
|
|
2244
|
+
ve as MetapageVersionCurrent,
|
|
2245
|
+
Ce as MetapageVersionsAll,
|
|
2245
2246
|
es as PARSE_ERROR,
|
|
2246
2247
|
ut as VERSION_METAFRAME,
|
|
2247
2248
|
Fe as VERSION_METAPAGE,
|
|
2248
2249
|
et as convertMetaframeJsonToCurrentVersion,
|
|
2249
2250
|
jt as convertMetapageDefinitionToCurrentVersion,
|
|
2250
2251
|
Ze as convertMetapageDefinitionToVersion,
|
|
2251
|
-
|
|
2252
|
-
|
|
2252
|
+
ee as deserializeInputs,
|
|
2253
|
+
Ee as generateId,
|
|
2253
2254
|
fs as generateMetaframeId,
|
|
2254
2255
|
Bt as generateMetapageId,
|
|
2255
2256
|
us as generateNonce,
|
|
2256
2257
|
hs as getLibraryVersionMatching,
|
|
2257
|
-
|
|
2258
|
+
G as getMatchingMetapageVersion,
|
|
2258
2259
|
ds as getMetaframeDefinitionFromUrl,
|
|
2259
2260
|
ps as getMetapageDefinitionFromUrl,
|
|
2260
2261
|
os as getUrlParam,
|
|
@@ -2264,17 +2265,17 @@ export {
|
|
|
2264
2265
|
be as isDebugFromUrlsParams,
|
|
2265
2266
|
kt as isIframe,
|
|
2266
2267
|
rs as isJsonRpcId,
|
|
2267
|
-
|
|
2268
|
-
|
|
2268
|
+
he as isPageLoaded,
|
|
2269
|
+
Ae as log,
|
|
2269
2270
|
qt as matchPipe,
|
|
2270
|
-
|
|
2271
|
+
ue as merge,
|
|
2271
2272
|
cs as metapageAllSha256Hash,
|
|
2272
2273
|
ls as metapageOnlyEssentailSha256Hash,
|
|
2273
|
-
|
|
2274
|
+
De as pageLoaded,
|
|
2274
2275
|
Zt as possiblyDeserializeDatarefToFile,
|
|
2275
2276
|
xt as possiblyDeserializeDatarefToValue,
|
|
2276
2277
|
Vt as possiblySerializeValueToDataref,
|
|
2277
|
-
|
|
2278
|
+
ce as serializeInputs,
|
|
2278
2279
|
rt as stringToRgb
|
|
2279
2280
|
};
|
|
2280
2281
|
//# sourceMappingURL=index.js.map
|