@metapages/metapage 1.0.11 → 1.0.13

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 CHANGED
@@ -1,4 +1,4 @@
1
- const De = ["0.3", "0.4", "0.5", "0.6", "1"], je = ["0.2", "0.3", "1"], Kt = "1", _e = "1", Yt = "metaframe.json", Xt = "metapage/definition", Qt = "metapage/state", Fe = je[je.length - 1], ut = De[De.length - 1], ct = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Ce = (t) => {
1
+ const De = ["0.3", "0.4", "0.5", "0.6", "1"], je = ["0.2", "0.3", "1"], Kt = "1", be = "1", Yt = "metaframe.json", Xt = "metapage/definition", Qt = "metapage/state", Fe = je[je.length - 1], ut = De[De.length - 1], ct = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Ce = (t) => {
2
2
  if (typeof t != "string")
3
3
  throw new TypeError("Invalid argument expected string");
4
4
  const e = t.match(ct);
@@ -8,14 +8,14 @@ const De = ["0.3", "0.4", "0.5", "0.6", "1"], je = ["0.2", "0.3", "1"], Kt = "1"
8
8
  }, Pe = (t) => t === "*" || t === "x" || t === "X", Le = (t) => {
9
9
  const e = parseInt(t, 10);
10
10
  return isNaN(e) ? t : e;
11
- }, lt = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], ht = (t, e) => {
11
+ }, ht = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], lt = (t, e) => {
12
12
  if (Pe(t) || Pe(e))
13
13
  return 0;
14
- const [s, n] = lt(Le(t), Le(e));
14
+ const [s, n] = ht(Le(t), Le(e));
15
15
  return s > n ? 1 : s < n ? -1 : 0;
16
16
  }, Ue = (t, e) => {
17
17
  for (let s = 0; s < Math.max(t.length, e.length); s++) {
18
- const n = ht(t[s] || "0", e[s] || "0");
18
+ const n = lt(t[s] || "0", e[s] || "0");
19
19
  if (n !== 0)
20
20
  return n;
21
21
  }
@@ -50,14 +50,14 @@ function A(t) {
50
50
  return (e = t.copy) !== null && e !== void 0 ? e : t.original;
51
51
  }
52
52
  function J(t) {
53
- return !!b(t);
53
+ return !!_(t);
54
54
  }
55
- function b(t) {
55
+ function _(t) {
56
56
  return typeof t != "object" ? null : t == null ? void 0 : t[Je];
57
57
  }
58
58
  function we(t) {
59
59
  var e;
60
- const s = b(t);
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,7 +68,7 @@ function C(t, e) {
68
68
  }
69
69
  function Be(t, e = []) {
70
70
  if (Object.hasOwnProperty.call(t, "key")) {
71
- const s = t.parent.copy, n = b(x(s, t.key));
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;
@@ -89,20 +89,20 @@ function Be(t, e = []) {
89
89
  function B(t) {
90
90
  return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
91
91
  }
92
- function x(t, e) {
92
+ function V(t, e) {
93
93
  return B(t) === 2 ? t.get(e) : t[e];
94
94
  }
95
95
  function te(t, e, s) {
96
96
  B(t) === 2 ? t.set(e, s) : t[e] = s;
97
97
  }
98
98
  function ce(t, e) {
99
- const s = b(t);
99
+ const s = _(t);
100
100
  return (s ? A(s) : t)[e];
101
101
  }
102
102
  function z(t, e) {
103
103
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
104
104
  }
105
- function he(t) {
105
+ function le(t) {
106
106
  if (t)
107
107
  for (; t.finalities.revoke.length > 0; )
108
108
  t.finalities.revoke.pop()();
@@ -116,7 +116,7 @@ function F(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 = x(B(t) === 3 ? Array.from(t) : t, n), typeof t != "object")
119
+ if (t = V(B(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;
@@ -258,7 +258,7 @@ function He(t, e, s) {
258
258
  if (e.add(t), Me(t, (a, r) => {
259
259
  var o;
260
260
  if (J(r)) {
261
- const f = b(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
  te(n ? i : t, a, u);
@@ -273,7 +273,7 @@ function He(t, e, s) {
273
273
  }
274
274
  function gt(t, e) {
275
275
  const s = t.type === 3 ? t.setMap : t.copy;
276
- t.finalities.revoke.length > 1 && t.assignedMap.get(e) && s && He(x(s, e), t.finalities.handledSet, t.options);
276
+ t.finalities.revoke.length > 1 && t.assignedMap.get(e) && s && He(V(s, e), t.finalities.handledSet, t.options);
277
277
  }
278
278
  function pe(t) {
279
279
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
@@ -290,42 +290,42 @@ function de(t, e, s, n) {
290
290
  }
291
291
  }
292
292
  function Oe(t, e, s, n) {
293
- const i = b(s);
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
- if (z(x(f, e), s)) {
297
+ if (z(V(f, e), s)) {
298
298
  let u = i.original;
299
299
  i.copy && (u = i.copy), pe(t), de(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)), te(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
- z(x(a, e), s) && gt(t, e);
303
+ z(V(a, e), s) && gt(t, e);
304
304
  });
305
305
  }
306
- function bt(t, e, s, n, i) {
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 = F(c, i);
311
+ const c = e.concat([u]), h = F(c, i);
312
312
  s.push({
313
313
  op: I.Replace,
314
- path: l,
314
+ path: h,
315
315
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
316
316
  value: oe(f[u])
317
317
  }), n.push({
318
318
  op: I.Replace,
319
- path: l,
319
+ path: h,
320
320
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
321
321
  value: oe(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 = F(c, i);
325
+ const c = e.concat([u]), h = F(c, i);
326
326
  s.push({
327
327
  op: I.Add,
328
- path: l,
328
+ path: h,
329
329
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
330
330
  value: oe(f[u])
331
331
  });
@@ -333,29 +333,29 @@ function bt(t, e, s, n, i) {
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 = F(c, i);
336
+ const c = e.concat(["length"]), h = F(c, i);
337
337
  n.push({
338
338
  op: I.Replace,
339
- path: l,
339
+ path: h,
340
340
  value: a.length
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 = F(l, i);
344
+ const h = e.concat([c - 1]), l = F(h, i);
345
345
  n.push({
346
346
  op: I.Remove,
347
- path: h
347
+ path: l
348
348
  });
349
349
  }
350
350
  }
351
351
  }
352
- function _t({ original: t, copy: e, assignedMap: s }, n, i, a, r) {
352
+ function bt({ original: t, copy: e, assignedMap: s }, n, i, a, r) {
353
353
  s.forEach((o, f) => {
354
- const u = x(t, f), c = oe(x(e, f)), l = o ? X(t, f) ? I.Replace : I.Add : I.Remove;
355
- if (z(u, c) && l === I.Replace)
354
+ const u = V(t, f), c = oe(V(e, f)), h = o ? X(t, f) ? I.Replace : I.Add : I.Remove;
355
+ if (z(u, c) && h === I.Replace)
356
356
  return;
357
- const h = n.concat(f), m = F(h, r);
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 });
357
+ const l = n.concat(f), m = F(l, r);
358
+ i.push(h === I.Remove ? { op: h, path: m } : { op: h, path: m, value: c }), a.push(h === I.Add ? { op: I.Remove, path: m } : h === I.Remove ? { op: I.Add, path: m, value: u } : { op: I.Replace, path: m, value: u });
359
359
  });
360
360
  }
361
361
  function vt({ original: t, copy: e }, s, n, i, a) {
@@ -395,9 +395,9 @@ function Z(t, e, s, n) {
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
  }
@@ -408,23 +408,23 @@ const ae = (t, e, s = !1) => {
408
408
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
409
409
  }, me = {
410
410
  get size() {
411
- return A(b(this)).size;
411
+ return A(_(this)).size;
412
412
  },
413
413
  has(t) {
414
- return A(b(this)).has(t);
414
+ return A(_(this)).has(t);
415
415
  },
416
416
  set(t, e) {
417
- const s = b(this), n = A(s);
417
+ const s = _(this), n = A(s);
418
418
  return (!n.has(t) || !z(n.get(t), e)) && (E(s), U(s), s.assignedMap.set(t, !0), s.copy.set(t, e), Oe(s, t, e, Z)), this;
419
419
  },
420
420
  delete(t) {
421
421
  if (!this.has(t))
422
422
  return !1;
423
- const e = b(this);
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 = b(this);
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,14 +433,14 @@ const ae = (t, e, s = !1) => {
433
433
  }
434
434
  },
435
435
  forEach(t, e) {
436
- const s = b(this);
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 = b(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;
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
444
  if (n.options.strict && ae(i, n.options, a), a || n.finalized || !C(i, n.options) || i !== n.original.get(t))
445
445
  return i;
446
446
  const r = ve.createDraft({
@@ -453,7 +453,7 @@ 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(b(this)).keys();
456
+ return A(_(this)).keys();
457
457
  },
458
458
  values() {
459
459
  const t = this.keys();
@@ -494,7 +494,7 @@ const ae = (t, e, s = !1) => {
494
494
  return a;
495
495
  const r = a.value;
496
496
  let o = t.setMap.get(r);
497
- const f = b(o), u = ((i = (n = t.options).mark) === null || i === void 0 ? void 0 : i.call(n, o, j)) === j.mutable;
497
+ const f = _(o), u = ((i = (n = t.options).mark) === null || i === void 0 ? void 0 : i.call(n, o, j)) === j.mutable;
498
498
  if (t.options.strict && ae(r, t.options, u), !u && !f && C(r, t.options) && !t.finalized && t.original.has(r)) {
499
499
  const c = ve.createDraft({
500
500
  original: r,
@@ -512,39 +512,39 @@ const ae = (t, e, s = !1) => {
512
512
  };
513
513
  }, ye = {
514
514
  get size() {
515
- return b(this).setMap.size;
515
+ return _(this).setMap.size;
516
516
  },
517
517
  has(t) {
518
- const e = b(this);
518
+ const e = _(this);
519
519
  if (e.setMap.has(t))
520
520
  return !0;
521
521
  E(e);
522
- const s = b(t);
522
+ const s = _(t);
523
523
  return !!(s && e.setMap.has(s.original));
524
524
  },
525
525
  add(t) {
526
- const e = b(this);
526
+ const e = _(this);
527
527
  return this.has(t) || (E(e), U(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Oe(e, t, t, Z)), this;
528
528
  },
529
529
  delete(t) {
530
530
  if (!this.has(t))
531
531
  return !1;
532
- const e = b(this);
532
+ const e = _(this);
533
533
  E(e), U(e);
534
- const s = b(t);
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 = b(this);
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 = b(this);
547
+ const t = _(this);
548
548
  E(t);
549
549
  const e = t.setMap.keys();
550
550
  return {
@@ -553,7 +553,7 @@ const ae = (t, e, s = !1) => {
553
553
  };
554
554
  },
555
555
  entries() {
556
- const t = b(this);
556
+ const t = _(this);
557
557
  E(t);
558
558
  const e = t.setMap.keys();
559
559
  return {
@@ -622,7 +622,7 @@ const ae = (t, e, s = !1) => {
622
622
  finalities: t.finalities,
623
623
  options: t.options
624
624
  }), typeof r == "function") {
625
- const u = b(t.copy[e]);
625
+ const u = _(t.copy[e]);
626
626
  return E(u), U(u), u.copy;
627
627
  }
628
628
  return t.copy[e];
@@ -639,7 +639,7 @@ const ae = (t, e, s = !1) => {
639
639
  const a = Te(A(t), e);
640
640
  if (a != null && a.set)
641
641
  return a.set.call(t.proxy, s), !0;
642
- const r = ce(A(t), e), o = b(r);
642
+ const r = ce(A(t), e), o = _(r);
643
643
  return o && z(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) : (z(s, r) && (s !== void 0 || X(t.original, e)) || (E(t), U(t), X(t.original, e) && z(s, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = s, Oe(t, e, s, Z)), !0);
644
644
  },
645
645
  has(t, e) {
@@ -688,23 +688,23 @@ function Ie(t) {
688
688
  const { proxy: f, revoke: u } = Proxy.revocable(r === 1 ? Object.assign([], o) : o, Ge);
689
689
  if (i.revoke.push(u), qe.add(f), o.proxy = f, s) {
690
690
  const c = s;
691
- c.finalities.draft.push((l, h) => {
691
+ c.finalities.draft.push((h, l) => {
692
692
  var m, y;
693
- const w = b(f);
693
+ const M = _(f);
694
694
  let p = c.type === 3 ? c.setMap : c.copy;
695
- const O = x(p, n), v = b(O);
695
+ const O = V(p, n), v = _(O);
696
696
  if (v) {
697
- let _ = v.original;
698
- v.operated && (_ = we(O)), pe(v), de(v, Z, l, h), c.options.enableAutoFreeze && (c.options.updatedValues = (m = c.options.updatedValues) !== null && m !== void 0 ? m : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(_, v.original)), te(p, n, _);
697
+ let b = v.original;
698
+ v.operated && (b = we(O)), pe(v), de(v, Z, h, l), 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)), te(p, n, b);
699
699
  }
700
- (y = w.callbacks) === null || y === void 0 || y.forEach((_) => {
701
- _(l, h);
700
+ (y = M.callbacks) === null || y === void 0 || y.forEach((b) => {
701
+ b(h, l);
702
702
  });
703
703
  });
704
704
  } else {
705
- const c = b(f);
706
- c.finalities.draft.push((l, h) => {
707
- pe(c), de(c, Z, l, h);
705
+ const c = _(f);
706
+ c.finalities.draft.push((h, l) => {
707
+ pe(c), de(c, Z, h, l);
708
708
  });
709
709
  }
710
710
  return f;
@@ -712,12 +712,12 @@ function Ie(t) {
712
712
  ve.createDraft = Ie;
713
713
  function It(t, e, s, n, i) {
714
714
  var a;
715
- const r = b(t), o = (a = r == null ? void 0 : r.original) !== null && a !== void 0 ? a : t, f = !!e.length;
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 && he(r), i && W(u, u, r == null ? void 0 : r.options.updatedValues), [
720
+ return r && le(r), i && W(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
@@ -741,21 +741,21 @@ function St(t, e) {
741
741
  return [
742
742
  o,
743
743
  (f = []) => {
744
- const [u, c, l] = It(o, f, i, a, e.enableAutoFreeze);
745
- return e.enablePatches ? [u, c, l] : u;
744
+ const [u, c, h] = It(o, f, i, a, e.enableAutoFreeze);
745
+ return e.enablePatches ? [u, c, h] : u;
746
746
  }
747
747
  ];
748
748
  }
749
749
  function ge(t) {
750
750
  const { rootDraft: e, value: s, useRawReturn: n = !1, isRoot: i = !0 } = t;
751
751
  Me(s, (a, r, o) => {
752
- const f = b(r);
752
+ const f = _(r);
753
753
  if (f && e && f.finalities === e.finalities) {
754
754
  t.isContainDraft = !0;
755
755
  const u = f.original;
756
756
  if (o instanceof Set) {
757
757
  const c = Array.from(o);
758
- o.clear(), c.forEach((l) => o.add(a === l ? u : l));
758
+ o.clear(), c.forEach((h) => o.add(a === h ? u : h));
759
759
  } else
760
760
  te(o, a, u);
761
761
  } else
@@ -763,7 +763,7 @@ function ge(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 = b(t);
766
+ const e = _(t);
767
767
  if (!C(t, e == null ? void 0 : e.options))
768
768
  return t;
769
769
  const s = B(t);
@@ -783,13 +783,13 @@ function Ke(t) {
783
783
  } else
784
784
  n = t;
785
785
  return Me(n, (a, r) => {
786
- if (e && z(x(e.original, a), r))
786
+ if (e && z(V(e.original, a), r))
787
787
  return;
788
788
  const o = Ke(r);
789
789
  o !== r && (n === t && i(), te(n, a, o));
790
790
  }), s === 3 ? new Set(n) : n;
791
791
  }
792
- function xe(t) {
792
+ function Ve(t) {
793
793
  if (!J(t))
794
794
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
795
795
  return Ke(t);
@@ -801,43 +801,43 @@ const Rt = (t) => {
801
801
  var a, r, o;
802
802
  if (typeof s == "function" && typeof n != "function")
803
803
  return function(d, ...T) {
804
- return e(d, (N) => s.call(this, N, ...T), n);
804
+ return e(d, (x) => s.call(this, x, ...T), n);
805
805
  };
806
806
  const f = s, u = n;
807
807
  let c = i;
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 = J(f) ? xe(f) : f, h = Array.isArray(c.mark) ? (d, T) => {
812
- for (const N of c.mark) {
813
- if (typeof N != "function")
814
- throw new Error(`Invalid mark: ${N}, 'mark' should be a function.`);
815
- const G = N(d, T);
811
+ const h = J(f) ? Ve(f) : f, l = Array.isArray(c.mark) ? (d, T) => {
812
+ for (const x of c.mark) {
813
+ if (typeof x != "function")
814
+ throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
815
+ const G = x(d, T);
816
816
  if (G)
817
817
  return G;
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,
821
- mark: h,
821
+ mark: l,
822
822
  strict: y,
823
823
  enablePatches: m
824
824
  };
825
- if (!C(l, p) && typeof l == "object" && l !== null)
825
+ if (!C(h, p) && typeof h == "object" && h !== null)
826
826
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
827
- const [O, v] = St(l, p);
827
+ const [O, v] = St(h, p);
828
828
  if (typeof n != "function") {
829
- if (!C(l, p))
829
+ if (!C(h, p))
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
- _ = u(O);
835
+ b = u(O);
836
836
  } catch (d) {
837
- throw he(b(O)), d;
837
+ throw le(_(O)), d;
838
838
  }
839
839
  const S = (d) => {
840
- const T = b(O);
840
+ const T = _(O);
841
841
  if (!J(d)) {
842
842
  if (d !== void 0 && !z(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.");
@@ -855,19 +855,19 @@ const Rt = (t) => {
855
855
  }
856
856
  if (d === O || d === void 0)
857
857
  return v([]);
858
- const N = b(d);
859
- if (p === N.options) {
860
- if (N.operated)
858
+ const x = _(d);
859
+ if (p === x.options) {
860
+ if (x.operated)
861
861
  throw new Error("Cannot return a modified child draft.");
862
- return v([xe(d)]);
862
+ return v([Ve(d)]);
863
863
  }
864
864
  return v([d]);
865
865
  };
866
- return _ instanceof Promise ? _.then(S, (d) => {
867
- throw he(b(O)), d;
868
- }) : S(_);
866
+ return b instanceof Promise ? b.then(S, (d) => {
867
+ throw le(_(O)), d;
868
+ }) : S(b);
869
869
  };
870
- }, M = Rt();
870
+ }, w = Rt();
871
871
  Object.prototype.constructor.toString();
872
872
  var Et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
873
873
  function Ye(t) {
@@ -895,15 +895,15 @@ var Xe = { exports: {} };
895
895
  retryOn: []
896
896
  };
897
897
  return r = Object.assign(o, r), function(u, c) {
898
- var l = r.retries, h = r.retryDelay, m = r.retryOn;
898
+ var h = r.retries, l = r.retryDelay, m = r.retryOn;
899
899
  if (c && c.retries !== void 0)
900
900
  if (n(c.retries))
901
- l = c.retries;
901
+ h = c.retries;
902
902
  else
903
903
  throw new i("retries must be a positive integer");
904
904
  if (c && c.retryDelay !== void 0)
905
905
  if (n(c.retryDelay) || typeof c.retryDelay == "function")
906
- h = c.retryDelay;
906
+ l = c.retryDelay;
907
907
  else
908
908
  throw new i("retryDelay must be a positive integer or a function returning a positive integer");
909
909
  if (c && c.retryOn)
@@ -911,39 +911,39 @@ var Xe = { exports: {} };
911
911
  m = c.retryOn;
912
912
  else
913
913
  throw new i("retryOn property expects an array or function");
914
- return new Promise(function(y, w) {
914
+ return new Promise(function(y, M) {
915
915
  var p = function(v) {
916
- var _ = typeof Request < "u" && u instanceof Request ? u.clone() : u;
917
- a(_, c).then(function(S) {
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")
921
921
  try {
922
922
  return Promise.resolve(m(v, null, S)).then(function(d) {
923
923
  d ? O(v, null, S) : y(S);
924
- }).catch(w);
924
+ }).catch(M);
925
925
  } catch (d) {
926
- w(d);
926
+ M(d);
927
927
  }
928
928
  else
929
- v < l ? O(v, null, S) : y(S);
929
+ v < h ? O(v, null, S) : y(S);
930
930
  }).catch(function(S) {
931
931
  if (typeof m == "function")
932
932
  try {
933
933
  Promise.resolve(m(v, S, null)).then(function(d) {
934
- d ? O(v, S, null) : w(S);
934
+ d ? O(v, S, null) : M(S);
935
935
  }).catch(function(d) {
936
- w(d);
936
+ M(d);
937
937
  });
938
938
  } catch (d) {
939
- w(d);
939
+ M(d);
940
940
  }
941
941
  else
942
- v < l ? O(v, S, null) : w(S);
942
+ v < h ? O(v, S, null) : M(S);
943
943
  });
944
944
  };
945
- function O(v, _, S) {
946
- var d = typeof h == "function" ? h(v, _, S) : h;
945
+ function O(v, b, S) {
946
+ var d = typeof l == "function" ? l(v, b, S) : l;
947
947
  setTimeout(function() {
948
948
  p(++v);
949
949
  }, d);
@@ -985,7 +985,7 @@ 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, _e), Ct = (t, e) => {
988
+ }, jt = async (t) => Ze(t, be), Ct = (t, e) => {
989
989
  if (!t)
990
990
  throw "Metapage definition null";
991
991
  if (!t.version)
@@ -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(Ne(Pt(t)));
1026
+ return et(xe(Pt(t)));
1027
1027
  case "0.5":
1028
- return Ne(t);
1028
+ return xe(t);
1029
1029
  case "0.6":
1030
1030
  return tt(t);
1031
1031
  case "1":
@@ -1040,12 +1040,12 @@ ${window.location.href}`;
1040
1040
  ${window.location.href}`), t;
1041
1041
  }
1042
1042
  }, Pt = (t) => {
1043
- const { version: e, inputs: s, outputs: n, allow: i, metadata: a, ...r } = t, o = a, { title: f, author: u, image: c, descriptionUrl: l, keywords: h, iconUrl: m, ...y } = o, w = {
1043
+ const { version: e, inputs: s, outputs: n, allow: i, metadata: a, ...r } = t, o = a, { title: f, author: u, image: c, descriptionUrl: h, keywords: l, iconUrl: m, ...y } = o, M = {
1044
1044
  name: f,
1045
1045
  author: u,
1046
- description: l,
1046
+ description: h,
1047
1047
  image: c,
1048
- tags: h,
1048
+ tags: l,
1049
1049
  ...y
1050
1050
  };
1051
1051
  return {
@@ -1053,10 +1053,10 @@ ${window.location.href}`), t;
1053
1053
  inputs: s,
1054
1054
  outputs: n,
1055
1055
  allow: i,
1056
- metadata: w,
1056
+ metadata: M,
1057
1057
  ...r
1058
1058
  };
1059
- }, tt = (t) => t, Ne = (t) => tt(Lt(t)), Lt = (t) => M(t, (e) => {
1059
+ }, tt = (t) => t, xe = (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"
@@ -1074,32 +1074,32 @@ ${window.location.href}`), t;
1074
1074
  o.operations.edit = u;
1075
1075
  break;
1076
1076
  case "metaframe":
1077
- const c = a.value, l = {
1077
+ const c = a.value, h = {
1078
1078
  type: "url",
1079
1079
  url: c.url,
1080
- params: c.params ? c.params.map((h) => ({
1081
- to: h.to,
1082
- from: h.from,
1083
- toType: h.toType === "path" ? void 0 : h.toType
1080
+ params: c.params ? c.params.map((l) => ({
1081
+ to: l.to,
1082
+ from: l.from,
1083
+ toType: l.toType === "path" ? void 0 : l.toType
1084
1084
  })) : void 0
1085
1085
  };
1086
- o.operations.edit = l;
1086
+ o.operations.edit = h;
1087
1087
  break;
1088
1088
  default:
1089
1089
  throw `Unsupported edit type: ${a.type} in metadata for metaframe ${JSON.stringify(s)}`;
1090
1090
  }
1091
1091
  }
1092
1092
  return i;
1093
- }), Ut = (t) => M(t, (e) => {
1093
+ }), Ut = (t) => w(t, (e) => {
1094
1094
  e.version = "0.3";
1095
- }), Tt = (t) => M(t, (e) => {
1095
+ }), Tt = (t) => w(t, (e) => {
1096
1096
  e.version = "0.2";
1097
- }), $t = (t) => M(t, (e) => {
1097
+ }), $t = (t) => w(t, (e) => {
1098
1098
  const s = e;
1099
1099
  delete s.plugins, s.version = "1";
1100
- }), zt = (t) => M(t, (e) => (e.version = "0.3", e)), H = (t) => {
1100
+ }), zt = (t) => w(t, (e) => (e.version = "0.3", e)), H = (t) => {
1101
1101
  if (t === "latest")
1102
- return _e;
1102
+ return be;
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)
@@ -1126,19 +1126,18 @@ var ne = function(t) {
1126
1126
  a = Y[t.charCodeAt(n)], r = Y[t.charCodeAt(n + 1)], o = Y[t.charCodeAt(n + 2)], f = Y[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 ue = async (t) => {
1130
- for (const e of Object.keys(t)) {
1131
- const s = await xt(t[e]);
1132
- t[e] = s;
1129
+ const ue = async (t) => w(t, async (e) => {
1130
+ for (const s of Object.keys(t)) {
1131
+ const n = await Vt(t[s]);
1132
+ return e[s] = n, e;
1133
1133
  }
1134
- return t;
1135
- }, Q = async (t) => {
1134
+ }), Q = async (t) => {
1136
1135
  for (const e of Object.keys(t)) {
1137
- const s = await Nt(t[e]);
1136
+ const s = await xt(t[e]);
1138
1137
  t[e] = s;
1139
1138
  }
1140
1139
  return t;
1141
- }, xt = async (t) => {
1140
+ }, Vt = async (t) => {
1142
1141
  if (t instanceof Int8Array || t instanceof Uint8Array || t instanceof Uint8ClampedArray || t instanceof Int16Array || t instanceof Uint16Array || t instanceof Int32Array || t instanceof Uint32Array || t instanceof Float32Array || t instanceof Float64Array) {
1143
1142
  const e = t, s = {
1144
1143
  _s: !0,
@@ -1179,7 +1178,7 @@ const ue = async (t) => {
1179
1178
  return Promise.resolve(s);
1180
1179
  }
1181
1180
  return Promise.resolve(t);
1182
- }, Nt = (t) => {
1181
+ }, xt = (t) => {
1183
1182
  if (!(t && typeof t == "object" && t._s === !0))
1184
1183
  return t;
1185
1184
  const e = t, s = e._c;
@@ -1237,10 +1236,10 @@ var st = { exports: {} };
1237
1236
  function i(f, u, c) {
1238
1237
  this.fn = f, this.context = u, this.once = c || !1;
1239
1238
  }
1240
- function a(f, u, c, l, h) {
1239
+ function a(f, u, c, h, l) {
1241
1240
  if (typeof c != "function")
1242
1241
  throw new TypeError("The listener must be a function");
1243
- var m = new i(c, l || f, h), y = s ? s + u : u;
1242
+ var m = new i(c, h || f, l), y = s ? s + u : u;
1244
1243
  return f._events[y] ? f._events[y].fn ? f._events[y] = [f._events[y], m] : f._events[y].push(m) : (f._events[y] = m, f._eventsCount++), f;
1245
1244
  }
1246
1245
  function r(f, u) {
@@ -1250,29 +1249,29 @@ var st = { exports: {} };
1250
1249
  this._events = new n(), this._eventsCount = 0;
1251
1250
  }
1252
1251
  o.prototype.eventNames = function() {
1253
- var u = [], c, l;
1252
+ var u = [], c, h;
1254
1253
  if (this._eventsCount === 0)
1255
1254
  return u;
1256
- for (l in c = this._events)
1257
- e.call(c, l) && u.push(s ? l.slice(1) : l);
1255
+ for (h in c = this._events)
1256
+ e.call(c, h) && u.push(s ? h.slice(1) : h);
1258
1257
  return Object.getOwnPropertySymbols ? u.concat(Object.getOwnPropertySymbols(c)) : u;
1259
1258
  }, o.prototype.listeners = function(u) {
1260
- var c = s ? s + u : u, l = this._events[c];
1261
- if (!l)
1259
+ var c = s ? s + u : u, h = this._events[c];
1260
+ if (!h)
1262
1261
  return [];
1263
- if (l.fn)
1264
- return [l.fn];
1265
- for (var h = 0, m = l.length, y = new Array(m); h < m; h++)
1266
- y[h] = l[h].fn;
1262
+ if (h.fn)
1263
+ return [h.fn];
1264
+ for (var l = 0, m = h.length, y = new Array(m); l < m; l++)
1265
+ y[l] = h[l].fn;
1267
1266
  return y;
1268
1267
  }, o.prototype.listenerCount = function(u) {
1269
- var c = s ? s + u : u, l = this._events[c];
1270
- return l ? l.fn ? 1 : l.length : 0;
1271
- }, o.prototype.emit = function(u, c, l, h, m, y) {
1272
- var w = s ? s + u : u;
1273
- if (!this._events[w])
1268
+ var c = s ? s + u : u, h = this._events[c];
1269
+ return h ? h.fn ? 1 : h.length : 0;
1270
+ }, o.prototype.emit = function(u, c, h, l, m, y) {
1271
+ var M = s ? s + u : u;
1272
+ if (!this._events[M])
1274
1273
  return !1;
1275
- var p = this._events[w], O = arguments.length, v, _;
1274
+ var p = this._events[M], O = arguments.length, v, b;
1276
1275
  if (p.fn) {
1277
1276
  switch (p.once && this.removeListener(u, p.fn, void 0, !0), O) {
1278
1277
  case 1:
@@ -1280,46 +1279,46 @@ var st = { exports: {} };
1280
1279
  case 2:
1281
1280
  return p.fn.call(p.context, c), !0;
1282
1281
  case 3:
1283
- return p.fn.call(p.context, c, l), !0;
1282
+ return p.fn.call(p.context, c, h), !0;
1284
1283
  case 4:
1285
- return p.fn.call(p.context, c, l, h), !0;
1284
+ return p.fn.call(p.context, c, h, l), !0;
1286
1285
  case 5:
1287
- return p.fn.call(p.context, c, l, h, m), !0;
1286
+ return p.fn.call(p.context, c, h, l, m), !0;
1288
1287
  case 6:
1289
- return p.fn.call(p.context, c, l, h, m, y), !0;
1288
+ return p.fn.call(p.context, c, h, l, m, y), !0;
1290
1289
  }
1291
- for (_ = 1, v = new Array(O - 1); _ < O; _++)
1292
- v[_ - 1] = arguments[_];
1290
+ for (b = 1, v = new Array(O - 1); b < O; b++)
1291
+ v[b - 1] = arguments[b];
1293
1292
  p.fn.apply(p.context, v);
1294
1293
  } else {
1295
1294
  var S = p.length, d;
1296
- for (_ = 0; _ < S; _++)
1297
- switch (p[_].once && this.removeListener(u, p[_].fn, void 0, !0), O) {
1295
+ for (b = 0; b < S; b++)
1296
+ switch (p[b].once && this.removeListener(u, p[b].fn, void 0, !0), O) {
1298
1297
  case 1:
1299
- p[_].fn.call(p[_].context);
1298
+ p[b].fn.call(p[b].context);
1300
1299
  break;
1301
1300
  case 2:
1302
- p[_].fn.call(p[_].context, c);
1301
+ p[b].fn.call(p[b].context, c);
1303
1302
  break;
1304
1303
  case 3:
1305
- p[_].fn.call(p[_].context, c, l);
1304
+ p[b].fn.call(p[b].context, c, h);
1306
1305
  break;
1307
1306
  case 4:
1308
- p[_].fn.call(p[_].context, c, l, h);
1307
+ p[b].fn.call(p[b].context, c, h, l);
1309
1308
  break;
1310
1309
  default:
1311
1310
  if (!v)
1312
1311
  for (d = 1, v = new Array(O - 1); d < O; d++)
1313
1312
  v[d - 1] = arguments[d];
1314
- p[_].fn.apply(p[_].context, v);
1313
+ p[b].fn.apply(p[b].context, v);
1315
1314
  }
1316
1315
  }
1317
1316
  return !0;
1318
- }, o.prototype.on = function(u, c, l) {
1319
- return a(this, u, c, l, !1);
1320
- }, o.prototype.once = function(u, c, l) {
1321
- return a(this, u, c, l, !0);
1322
- }, o.prototype.removeListener = function(u, c, l, h) {
1317
+ }, o.prototype.on = function(u, c, h) {
1318
+ return a(this, u, c, h, !1);
1319
+ }, o.prototype.once = function(u, c, h) {
1320
+ return a(this, u, c, h, !0);
1321
+ }, o.prototype.removeListener = function(u, c, h, l) {
1323
1322
  var m = s ? s + u : u;
1324
1323
  if (!this._events[m])
1325
1324
  return this;
@@ -1327,10 +1326,10 @@ var st = { exports: {} };
1327
1326
  return r(this, m), this;
1328
1327
  var y = this._events[m];
1329
1328
  if (y.fn)
1330
- y.fn === c && (!h || y.once) && (!l || y.context === l) && r(this, m);
1329
+ y.fn === c && (!l || y.once) && (!h || y.context === h) && r(this, m);
1331
1330
  else {
1332
- for (var w = 0, p = [], O = y.length; w < O; w++)
1333
- (y[w].fn !== c || h && !y[w].once || l && y[w].context !== l) && p.push(y[w]);
1331
+ for (var M = 0, p = [], O = y.length; M < O; M++)
1332
+ (y[M].fn !== c || l && !y[M].once || h && y[M].context !== h) && p.push(y[M]);
1334
1333
  p.length ? this._events[m] = p.length === 1 ? p[0] : p : r(this, m);
1335
1334
  }
1336
1335
  return this;
@@ -1339,7 +1338,7 @@ var st = { exports: {} };
1339
1338
  return u ? (c = s ? s + u : u, this._events[c] && r(this, c)) : (this._events = new n(), this._eventsCount = 0), this;
1340
1339
  }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = s, o.EventEmitter = o, t.exports = o;
1341
1340
  })(st);
1342
- var Se = st.exports, Vt = function(t, e) {
1341
+ var Se = st.exports, Nt = function(t, e) {
1343
1342
  e || (e = {}), typeof e == "function" && (e = { cmp: e });
1344
1343
  var s = typeof e.cycles == "boolean" ? e.cycles : !1, n = e.cmp && function(a) {
1345
1344
  return function(r) {
@@ -1370,14 +1369,14 @@ var Se = st.exports, Vt = function(t, e) {
1370
1369
  }
1371
1370
  var u = i.push(r) - 1, c = Object.keys(r).sort(n && n(r));
1372
1371
  for (f = "", o = 0; o < c.length; o++) {
1373
- var l = c[o], h = a(r[l]);
1374
- h && (f && (f += ","), f += JSON.stringify(l) + ":" + h);
1372
+ var h = c[o], l = a(r[h]);
1373
+ l && (f && (f += ","), f += JSON.stringify(h) + ":" + l);
1375
1374
  }
1376
1375
  return i.splice(u, 1), "{" + f + "}";
1377
1376
  }
1378
1377
  }(t);
1379
1378
  };
1380
- const nt = /* @__PURE__ */ Ye(Vt);
1379
+ const nt = /* @__PURE__ */ Ye(Nt);
1381
1380
  var ee;
1382
1381
  (function(t) {
1383
1382
  t.mp_debug = "mp_debug";
@@ -1389,7 +1388,7 @@ const kt = () => {
1389
1388
  return !1;
1390
1389
  }
1391
1390
  }, it = {
1392
- version: _e,
1391
+ version: be,
1393
1392
  metaframes: {}
1394
1393
  };
1395
1394
  class Ft extends Se.EventEmitter {
@@ -1403,19 +1402,16 @@ class Ft extends Se.EventEmitter {
1403
1402
  return this._definition;
1404
1403
  }
1405
1404
  }
1406
- const fe = (t, e) => {
1407
- if (!e)
1408
- return !1;
1409
- let s = !1;
1410
- return Object.keys(e).forEach((n) => {
1411
- s = !0, e[n] === void 0 ? delete t[n] : t[n] = e[n];
1412
- }), s;
1413
- }, rs = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, os = () => new URLSearchParams(window.location.search).has(ee.mp_debug), be = () => {
1405
+ const fe = (t, e) => e ? w(t, (s) => {
1406
+ Object.keys(e).forEach((n) => {
1407
+ e[n] === void 0 ? delete s[n] : s[n] = e[n];
1408
+ });
1409
+ }) : t, rs = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, os = () => new URLSearchParams(window.location.search).has(ee.mp_debug), _e = () => {
1414
1410
  const t = new URLSearchParams(window.location.search).get(ee.mp_debug);
1415
1411
  return t === "true" || t === "1";
1416
- }, as = (t = 8) => Re(t), Jt = (t = 8) => Re(t), fs = (t = 8) => Re(t), Ve = "abcdefghijklmnopqrstuvwxyz0123456789", Re = (t = 8) => {
1417
- for (var e = "", s = Ve.length, n = 0; n < t; n++)
1418
- e += Ve.charAt(Math.floor(Math.random() * s));
1412
+ }, as = (t = 8) => Re(t), Jt = (t = 8) => Re(t), fs = (t = 8) => Re(t), Ne = "abcdefghijklmnopqrstuvwxyz0123456789", Re = (t = 8) => {
1413
+ for (var e = "", s = Ne.length, n = 0; n < t; n++)
1414
+ e += Ne.charAt(Math.floor(Math.random() * s));
1419
1415
  return e;
1420
1416
  }, Ee = (t, e, s) => {
1421
1417
  e = e || "000", e && e.trim() == "" && (e = void 0);
@@ -1433,8 +1429,8 @@ const fe = (t, e) => {
1433
1429
  }, Wt = (t) => {
1434
1430
  var e = (t & 16777215).toString(16).toUpperCase();
1435
1431
  return "00000".substring(0, 6 - e.length) + e;
1436
- }, le = () => document.readyState == "complete" || document.readyState == "interactive", Ae = async () => le() ? Promise.resolve() : new Promise((t) => {
1437
- if (le()) {
1432
+ }, he = () => document.readyState == "complete" || document.readyState == "interactive", Ae = async () => he() ? Promise.resolve() : new Promise((t) => {
1433
+ if (he()) {
1438
1434
  t();
1439
1435
  return;
1440
1436
  }
@@ -1442,7 +1438,7 @@ const fe = (t, e) => {
1442
1438
  window.addEventListener("load", () => {
1443
1439
  e || (e = !0, t());
1444
1440
  }), setTimeout(() => {
1445
- !e && le() && (e = !0, t());
1441
+ !e && he() && (e = !0, t());
1446
1442
  }, 200);
1447
1443
  }), us = async (t) => {
1448
1444
  const e = nt(t);
@@ -1458,17 +1454,17 @@ async function ot(t) {
1458
1454
  const s = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", s);
1459
1455
  return btoa(String.fromCharCode(...new Uint8Array(n)));
1460
1456
  }
1461
- var V;
1457
+ var N;
1462
1458
  (function(t) {
1463
1459
  t.WaitingForPageLoad = "WaitingForPageLoad", t.SentSetupIframeClientRequest = "SentSetupIframeClientRequest", t.Ready = "Ready";
1464
- })(V || (V = {}));
1460
+ })(N || (N = {}));
1465
1461
  var R;
1466
1462
  (function(t) {
1467
1463
  t.Connected = "connected", t.Error = "error", t.Input = "input", t.Inputs = "inputs", t.Message = "message";
1468
1464
  })(R || (R = {}));
1469
1465
  class P extends Se.EventEmitter {
1470
1466
  constructor(e) {
1471
- if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = V.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) {
1467
+ if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = N.WaitingForPageLoad, this._messageSendCount = 0, this.debug = _e(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = _e(), 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) {
1472
1468
  this.log("Not an iframe, metaframe code disabled");
1473
1469
  return;
1474
1470
  }
@@ -1476,18 +1472,18 @@ class P extends Se.EventEmitter {
1476
1472
  Ae().then(() => {
1477
1473
  this.log("pageLoaded"), window.addEventListener("message", this.onMessage), s.sendRpc(D.SetupIframeClientRequest, {
1478
1474
  version: P.version
1479
- }), s._state = V.SentSetupIframeClientRequest;
1475
+ }), s._state = N.SentSetupIframeClientRequest;
1480
1476
  }), e && e.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
1481
1477
  }
1482
1478
  _resolveSetupIframeServerResponse(e) {
1483
- if (this._state === V.WaitingForPageLoad)
1479
+ if (this._state === N.WaitingForPageLoad)
1484
1480
  throw "Got message but page has not finished loading, we should never get in this state";
1485
- (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 Q(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = V.Ready, this.sendRpc(D.SetupIframeServerResponseAck, {
1481
+ (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 Q(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = N.Ready, this.sendRpc(D.SetupIframeServerResponseAck, {
1486
1482
  version: P.version
1487
1483
  }), 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)))();
1488
1484
  }
1489
1485
  async connected() {
1490
- if (this._state !== V.Ready)
1486
+ if (this._state !== N.Ready)
1491
1487
  return new Promise((e, s) => {
1492
1488
  let n;
1493
1489
  n = this.addListenerReturnDisposer(R.Connected, () => {
@@ -1537,18 +1533,20 @@ class P extends Se.EventEmitter {
1537
1533
  this.isInputOutputBlobSerialization && (e = await Q(e)), this.sendRpc(D.InputsUpdate, e);
1538
1534
  }
1539
1535
  async setInternalInputsAndNotify(e) {
1540
- if (this.isInputOutputBlobSerialization && (e = await Q(e)), !!fe(this._inputPipeValues, e)) {
1541
- Object.keys(e).forEach((s) => {
1536
+ this.isInputOutputBlobSerialization && (e = await Q(e));
1537
+ const s = e;
1538
+ if (this._inputPipeValues = fe(this._inputPipeValues, e), this._inputPipeValues !== s) {
1539
+ Object.keys(e).forEach((n) => {
1542
1540
  try {
1543
- this.emit(R.Input, s, e[s]);
1544
- } catch (n) {
1545
- console.error(`Error emitting input ${s}: ${n}`), this.emit(R.Error, `Error emitting input ${s}: ${n}`);
1541
+ this.emit(R.Input, n, e[n]);
1542
+ } catch (i) {
1543
+ console.error(`Error emitting input ${n}: ${i}`), this.emit(R.Error, `Error emitting input ${n}: ${i}`);
1546
1544
  }
1547
1545
  });
1548
1546
  try {
1549
1547
  this.emit(R.Inputs, e);
1550
- } catch (s) {
1551
- console.error(`Error emitting inputs: ${s}`), this.emit(R.Error, `Error emitting inputs: ${s}`);
1548
+ } catch (n) {
1549
+ console.error(`Error emitting inputs: ${n}`), this.emit(R.Error, `Error emitting inputs: ${n}`);
1552
1550
  }
1553
1551
  }
1554
1552
  }
@@ -1564,7 +1562,9 @@ class P extends Se.EventEmitter {
1564
1562
  n[e] = s, this.setOutputs(n);
1565
1563
  }
1566
1564
  async setOutputs(e) {
1567
- this.isInputOutputBlobSerialization && (e = await ue(e)), fe(this._outputPipeValues, e) && this.sendRpc(D.OutputsUpdate, e);
1565
+ this.isInputOutputBlobSerialization && (e = await ue(e));
1566
+ const s = e;
1567
+ this._outputPipeValues = fe(this._outputPipeValues, e), this._outputPipeValues !== s && this.sendRpc(D.OutputsUpdate, e);
1568
1568
  }
1569
1569
  disableNotifyOnHashUrlChange() {
1570
1570
  window.removeEventListener("hashchange", this._onHashUrlChange);
@@ -1604,7 +1604,7 @@ class P extends Se.EventEmitter {
1604
1604
  this._resolveSetupIframeServerResponse(n.params);
1605
1605
  break;
1606
1606
  case $.InputsUpdate:
1607
- if (this._state !== V.Ready)
1607
+ if (this._state !== N.Ready)
1608
1608
  throw "Got InputsUpdate but metaframe is not MetaframeLoadingState.Ready";
1609
1609
  this.setInternalInputsAndNotify(n.params.inputs);
1610
1610
  break;
@@ -1649,9 +1649,9 @@ class Ht extends Se.EventEmitter {
1649
1649
  const f = this;
1650
1650
  this.iframe = new Promise((u) => {
1651
1651
  Ae().then(async () => {
1652
- var c, l, h, m;
1652
+ var c, h, l, m;
1653
1653
  if (f._iframe) {
1654
- 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)
1654
+ if ((m = (l = (h = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : h.metaframes) == null ? void 0 : l[this.id]) != null && m.allow)
1655
1655
  f._iframe.allow = this._metapage._definition.metaframes[this.id].allow;
1656
1656
  else {
1657
1657
  const y = await f.getDefinition();
@@ -1702,11 +1702,13 @@ Error: ${s}`);
1702
1702
  n[e] = s, this.setInputs(n);
1703
1703
  }
1704
1704
  setInputs(e) {
1705
- if (this.log({ m: "MetapageIFrameRpcClient", inputs: e }), !fe(this.inputs, e))
1705
+ this.log({ m: "MetapageIFrameRpcClient", inputs: e });
1706
+ const s = e;
1707
+ if (this.inputs = fe(this.inputs, e), this.inputs === s)
1706
1708
  return this;
1707
1709
  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) {
1708
- var s = {};
1709
- s[this.id] = e, this._metapage.emit(g.Inputs, s);
1710
+ var n = {};
1711
+ n[this.id] = e, this._metapage.emit(g.Inputs, n);
1710
1712
  }
1711
1713
  return this;
1712
1714
  }
@@ -1716,9 +1718,12 @@ Error: ${s}`);
1716
1718
  n[e] = s, this.setOutputs(n);
1717
1719
  }
1718
1720
  setOutputs(e) {
1719
- if (fe(this.outputs, e) && (this.emit(g.Outputs, e), this._metapage.listenerCount(g.Outputs) > 0)) {
1720
- var s = {};
1721
- s[this.id] = this.outputs, this._metapage.emit(g.Outputs, s);
1721
+ const s = e;
1722
+ if (this.outputs = fe(this.outputs, e), this.outputs === s)
1723
+ return this;
1724
+ if (this.emit(g.Outputs, e), this._metapage.listenerCount(g.Outputs) > 0) {
1725
+ var n = {};
1726
+ n[this.id] = this.outputs, this._metapage.emit(g.Outputs, n);
1722
1727
  }
1723
1728
  }
1724
1729
  onInputs(e) {
@@ -1829,12 +1834,12 @@ Error: ${s}`);
1829
1834
  }
1830
1835
  }
1831
1836
  }
1832
- const ke = () => M({
1837
+ const ke = () => w({
1833
1838
  metaframes: {
1834
1839
  inputs: {},
1835
1840
  outputs: {}
1836
1841
  }
1837
- }, (t) => t), ls = (t) => H(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";
1842
+ }, (t) => t), hs = (t) => H(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";
1838
1843
  class L extends Ft {
1839
1844
  static async from(e, s) {
1840
1845
  if (e == null)
@@ -1849,7 +1854,7 @@ class L extends Ft {
1849
1854
  return n.setDefinition(e);
1850
1855
  }
1851
1856
  constructor(e) {
1852
- super(), this._state = ke(), this._metaframes = M({}, (s) => s), this.debug = be(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = M({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : Jt(), 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), Ae().then(() => {
1857
+ super(), this._state = ke(), this._metaframes = w({}, (s) => s), this.debug = _e(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = w({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : Jt(), 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), Ae().then(() => {
1853
1858
  this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
1854
1859
  });
1855
1860
  }
@@ -1869,7 +1874,7 @@ class L extends Ft {
1869
1874
  return this._state;
1870
1875
  }
1871
1876
  setState(e) {
1872
- this._state = M(e, (s) => s), this.getMetaframeIds().forEach((s) => {
1877
+ this._state = w(e, (s) => s), this.getMetaframeIds().forEach((s) => {
1873
1878
  this.getMetaframe(s).setInputs(this._state.metaframes.inputs[s]), this.getMetaframe(s).setOutputs(this._state.metaframes.outputs[s]);
1874
1879
  }), this.listenerCount(g.State) > 0 && this.emit(g.State, this._state);
1875
1880
  }
@@ -1883,6 +1888,8 @@ class L extends Ft {
1883
1888
  if (!e.version)
1884
1889
  throw "Metapage definition must have a version";
1885
1890
  const n = await jt(e);
1891
+ if (this.isDisposed())
1892
+ return this;
1886
1893
  n.metaframes && Object.keys(n.metaframes).forEach((a) => {
1887
1894
  var r = n.metaframes[a];
1888
1895
  if (typeof r != "object")
@@ -1893,7 +1900,7 @@ class L extends Ft {
1893
1900
  const i = this._definition;
1894
1901
  return this._definition = n, Object.keys(this._metaframes).forEach((a) => {
1895
1902
  (!n.metaframes || !n.metaframes[a]) && this.removeMetaframe(a);
1896
- }), s && (this._state = M(s, (a) => a)), n.metaframes && Object.keys(n.metaframes).forEach((a) => {
1903
+ }), s && (this._state = w(s, (a) => a)), n.metaframes && Object.keys(n.metaframes).forEach((a) => {
1897
1904
  if (!this._metaframes.hasOwnProperty(a)) {
1898
1905
  const r = n.metaframes[a];
1899
1906
  this.addMetaframe(a, r);
@@ -1912,26 +1919,26 @@ class L extends Ft {
1912
1919
  }
1913
1920
  }
1914
1921
  addPipe(e, s) {
1915
- this._inputMap = M(this._inputMap, (n) => {
1922
+ this._inputMap = w(this._inputMap, (n) => {
1916
1923
  n[e] || (n[e] = []), n[e].push(s);
1917
1924
  });
1918
1925
  }
1919
1926
  removeMetaframe(e) {
1920
- this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = M(this._metaframes, (s) => {
1927
+ this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = w(this._metaframes, (s) => {
1921
1928
  delete s[e];
1922
- }), this._state = M(this._state, (s) => {
1929
+ }), this._state = w(this._state, (s) => {
1923
1930
  delete s.metaframes.inputs[e], delete s.metaframes.outputs[e];
1924
- }), this._inputMap = M(this._inputMap, (s) => {
1931
+ }), this._inputMap = w(this._inputMap, (s) => {
1925
1932
  delete s[e], Object.keys(s).forEach((n) => {
1926
1933
  const i = s[n];
1927
1934
  let a = 0;
1928
1935
  for (; a <= i.length; )
1929
1936
  i[a] && i[a].metaframe === e ? i.splice(a, 1) : a++;
1930
1937
  });
1931
- }), this._cachedInputLookupMap = M({}, (s) => s));
1938
+ }), this._cachedInputLookupMap = w({}, (s) => s));
1932
1939
  }
1933
1940
  removeAll() {
1934
- Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = M({}, (e) => e), this._state = ke(), this._inputMap = M({}, (e) => e), this._cachedInputLookupMap = M({}, (e) => e);
1941
+ Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = w({}, (e) => e), this._state = ke(), this._inputMap = w({}, (e) => e), this._cachedInputLookupMap = w({}, (e) => e);
1935
1942
  }
1936
1943
  metaframes() {
1937
1944
  return this.getMetaframes();
@@ -1958,7 +1965,7 @@ class L extends Ft {
1958
1965
  if (!s.url)
1959
1966
  throw this.emitErrorMessage(`Metaframe definition missing url id=${e}`), `Metaframe definition missing url id=${e}`;
1960
1967
  var n = new Ht(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
1961
- return this._metaframes = M(this._metaframes, (i) => {
1968
+ return this._metaframes = w(this._metaframes, (i) => {
1962
1969
  i[e] = n;
1963
1970
  }), n.addListener(g.Error, (i) => {
1964
1971
  this.emit(g.Error, {
@@ -1981,9 +1988,9 @@ class L extends Ft {
1981
1988
  this.emit(g.Error, e);
1982
1989
  }
1983
1990
  getInputsFromOutput(e, s) {
1984
- return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = M(this._cachedInputLookupMap, (n) => {
1985
- n[e] = M({}, (i) => i);
1986
- })), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap = M(this._cachedInputLookupMap, (n) => {
1991
+ return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = w(this._cachedInputLookupMap, (n) => {
1992
+ n[e] = w({}, (i) => i);
1993
+ })), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap = w(this._cachedInputLookupMap, (n) => {
1987
1994
  var i = [];
1988
1995
  n[e][s] = i, Object.keys(this._inputMap).forEach((a) => {
1989
1996
  a !== e && this._inputMap[a].forEach((r) => {
@@ -2054,7 +2061,7 @@ class L extends Ft {
2054
2061
  this._setStateOnlyMetaframeInputMap(!0, e, s);
2055
2062
  }
2056
2063
  _setStateOnlyMetaframeInputValue(e, s, n, i) {
2057
- this._state = M(this._state, (a) => {
2064
+ this._state = w(this._state, (a) => {
2058
2065
  if (!this._metaframes.hasOwnProperty(s))
2059
2066
  throw `No metaframe: ${s}`;
2060
2067
  a.metaframes || (a.metaframes = { inputs: {}, outputs: {} }), e ? a.metaframes.inputs || (a.metaframes.inputs = {}) : a.metaframes.outputs || (a.metaframes.outputs = {});
@@ -2063,7 +2070,7 @@ class L extends Ft {
2063
2070
  });
2064
2071
  }
2065
2072
  _setStateOnlyMetaframeInputMap(e, s, n) {
2066
- !n || Object.keys(n).length === 0 || (this._state = M(this._state, (i) => {
2073
+ !n || Object.keys(n).length === 0 || (this._state = w(this._state, (i) => {
2067
2074
  if (!this._metaframes.hasOwnProperty(s))
2068
2075
  throw `No metaframe: ${s}`;
2069
2076
  let r = e ? i.metaframes.inputs : i.metaframes.outputs;
@@ -2073,7 +2080,7 @@ class L extends Ft {
2073
2080
  }));
2074
2081
  }
2075
2082
  _setStateOnlyMetaframes(e, s) {
2076
- !s || Object.keys(s).length === 0 || (this._state = M(this._state, (n) => {
2083
+ !s || Object.keys(s).length === 0 || (this._state = w(this._state, (n) => {
2077
2084
  Object.keys(s).forEach((i) => {
2078
2085
  var a = s[i];
2079
2086
  if (typeof a != "object")
@@ -2117,14 +2124,14 @@ class L extends Ft {
2117
2124
  var n = this._metaframes[o];
2118
2125
  this.setOutputStateOnlyMetaframeInputMap(o, u), n.setOutputs(u);
2119
2126
  var i = !1;
2120
- const c = Object.keys(u), l = {};
2121
- c.forEach((h, m) => {
2122
- const y = this.getInputsFromOutput(o, h);
2123
- y.length > 0 && y.forEach((w) => {
2124
- l[w.metaframe] || (l[w.metaframe] = {}), l[w.metaframe][w.pipe] = u[h], i = !0;
2127
+ const c = Object.keys(u), h = {};
2128
+ c.forEach((l, m) => {
2129
+ const y = this.getInputsFromOutput(o, l);
2130
+ y.length > 0 && y.forEach((M) => {
2131
+ h[M.metaframe] || (h[M.metaframe] = {}), h[M.metaframe][M.pipe] = u[l], i = !0;
2125
2132
  });
2126
- }), i && (this.setInputStateOnlyMetapageInstanceInputs(l), Object.keys(l).forEach((h) => {
2127
- this._metaframes[h].setInputs(l[h]);
2133
+ }), i && (this.setInputStateOnlyMetapageInstanceInputs(h), Object.keys(h).forEach((l) => {
2134
+ this._metaframes[l].setInputs(h[l]);
2128
2135
  })), this.listenerCount(g.State) > 0 && this.emit(g.State, this._state), this.debug && n.ack({ jsonrpc: r, state: this._state });
2129
2136
  } else
2130
2137
  this.error(`missing metaframe=${o}`);
@@ -2138,9 +2145,9 @@ class L extends Ft {
2138
2145
  break;
2139
2146
  case D.HashParamsUpdate:
2140
2147
  if (f) {
2141
- const c = r.params, l = new URL(f.url);
2142
- l.hash = c.hash, f.url = l.href, this._definition = M(this._definition, (h) => {
2143
- h.metaframes[c.metaframe].url = l.href;
2148
+ const c = r.params, h = new URL(f.url);
2149
+ h.hash = c.hash, f.url = h.href, this._definition = w(this._definition, (l) => {
2150
+ l.metaframes[c.metaframe].url = h.href;
2144
2151
  }), this._emitDefinitionEvent();
2145
2152
  }
2146
2153
  break;
@@ -2165,7 +2172,7 @@ L.OUTPUTS = g.Outputs;
2165
2172
  L.STATE = g.State;
2166
2173
  L.deserializeInputs = Q;
2167
2174
  L.serializeInputs = ue;
2168
- const at = Qe(fetch), hs = async (t, e) => {
2175
+ const at = Qe(fetch), ls = async (t, e) => {
2169
2176
  const s = new URL(t);
2170
2177
  s.pathname = s.pathname + (s.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
2171
2178
  const i = await (await at(s.href, {
@@ -2195,7 +2202,7 @@ export {
2195
2202
  ts as METHOD_NOT_FOUND,
2196
2203
  P as Metaframe,
2197
2204
  R as MetaframeEvents,
2198
- V as MetaframeLoadingState,
2205
+ N as MetaframeLoadingState,
2199
2206
  Kt as MetaframeVersionCurrent,
2200
2207
  De as MetaframeVersionsAll,
2201
2208
  L as Metapage,
@@ -2203,7 +2210,7 @@ export {
2203
2210
  ee as MetapageHashParams,
2204
2211
  Ht as MetapageIFrameRpcClient,
2205
2212
  Ft as MetapageShared,
2206
- _e as MetapageVersionCurrent,
2213
+ be as MetapageVersionCurrent,
2207
2214
  je as MetapageVersionsAll,
2208
2215
  Zt as PARSE_ERROR,
2209
2216
  ut as VERSION_METAFRAME,
@@ -2216,26 +2223,26 @@ export {
2216
2223
  as as generateMetaframeId,
2217
2224
  Jt as generateMetapageId,
2218
2225
  fs as generateNonce,
2219
- ls as getLibraryVersionMatching,
2226
+ hs as getLibraryVersionMatching,
2220
2227
  H as getMatchingMetapageVersion,
2221
2228
  ps as getMetaframeDefinitionFromUrl,
2222
- hs as getMetapageDefinitionFromUrl,
2229
+ ls as getMetapageDefinitionFromUrl,
2223
2230
  rs as getUrlParam,
2224
2231
  os as getUrlParamDebug,
2225
2232
  Bt as hashCode,
2226
2233
  Wt as intToRGB,
2227
- be as isDebugFromUrlsParams,
2234
+ _e as isDebugFromUrlsParams,
2228
2235
  kt as isIframe,
2229
2236
  is as isJsonRpcId,
2230
- le as isPageLoaded,
2237
+ he as isPageLoaded,
2231
2238
  Ee as log,
2232
2239
  qt as matchPipe,
2233
2240
  fe as merge,
2234
2241
  us as metapageAllSha256Hash,
2235
2242
  cs as metapageOnlyEssentailSha256Hash,
2236
2243
  Ae as pageLoaded,
2237
- Nt as possiblyDeserializeDatarefToValue,
2238
- xt as possiblySerializeValueToDataref,
2244
+ xt as possiblyDeserializeDatarefToValue,
2245
+ Vt as possiblySerializeValueToDataref,
2239
2246
  ue as serializeInputs,
2240
2247
  rt as stringToRgb
2241
2248
  };