@metapages/metapage 1.0.10 → 1.0.12

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,17 +1,17 @@
1
- const De = ["0.3", "0.4", "0.5", "0.6", "1"], Ce = ["0.2", "0.3", "1"], Kt = "1", _e = "1", Yt = "metaframe.json", Xt = "metapage/definition", Qt = "metapage/state", Fe = Ce[Ce.length - 1], ft = De[De.length - 1], ut = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, je = (t) => {
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) => {
2
2
  if (typeof t != "string")
3
3
  throw new TypeError("Invalid argument expected string");
4
- const e = t.match(ut);
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
  }, Pe = (t) => t === "*" || t === "x" || t === "X", Le = (t) => {
9
9
  const e = parseInt(t, 10);
10
10
  return isNaN(e) ? t : e;
11
- }, ct = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], lt = (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] = ct(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++) {
@@ -21,13 +21,13 @@ const De = ["0.3", "0.4", "0.5", "0.6", "1"], Ce = ["0.2", "0.3", "1"], Kt = "1"
21
21
  }
22
22
  return 0;
23
23
  }, k = (t, e) => {
24
- const s = je(t), n = je(e), i = s.pop(), a = n.pop(), r = Ue(s, n);
24
+ const s = Ce(t), n = Ce(e), i = s.pop(), a = n.pop(), r = Ue(s, n);
25
25
  return r !== 0 ? r : i && a ? Ue(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
- }, Je = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), ht = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), re = Symbol.iterator, C = {
30
+ }, Je = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), pt = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), re = Symbol.iterator, j = {
31
31
  mutable: "mutable",
32
32
  immutable: "immutable"
33
33
  }, ve = {};
@@ -60,11 +60,11 @@ function we(t) {
60
60
  const s = b(t);
61
61
  return s ? (e = s.copy) !== null && e !== void 0 ? e : s.original : t;
62
62
  }
63
- function j(t, e) {
63
+ function C(t, e) {
64
64
  if (!t || typeof t != "object")
65
65
  return !1;
66
66
  let s;
67
- return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((s = e.mark(t, C)) === C.immutable || typeof s == "function");
67
+ return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((s = e.mark(t, j)) === j.immutable || typeof s == "function");
68
68
  }
69
69
  function Be(t, e = []) {
70
70
  if (Object.hasOwnProperty.call(t, "key")) {
@@ -80,7 +80,7 @@ function Be(t, e = []) {
80
80
  return Be(t.parent, e);
81
81
  e.reverse();
82
82
  try {
83
- pt(t.copy, e);
83
+ dt(t.copy, e);
84
84
  } catch {
85
85
  return null;
86
86
  }
@@ -102,7 +102,7 @@ function ce(t, e) {
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()();
@@ -113,7 +113,7 @@ function F(t, e) {
113
113
  return n.indexOf("/") === -1 && n.indexOf("~") === -1 ? n : n.replace(/~/g, "~0").replace(/\//g, "~1");
114
114
  }).join("/");
115
115
  }
116
- function pt(t, e) {
116
+ function dt(t, e) {
117
117
  for (let s = 0; s < e.length - 1; s += 1) {
118
118
  const n = e[s];
119
119
  if (t = x(B(t) === 3 ? Array.from(t) : t, n), typeof t != "object")
@@ -121,7 +121,7 @@ function pt(t, e) {
121
121
  }
122
122
  return t;
123
123
  }
124
- function dt(t) {
124
+ function mt(t) {
125
125
  const e = Object.create(Object.getPrototypeOf(t));
126
126
  return Reflect.ownKeys(t).forEach((s) => {
127
127
  let n = Reflect.getOwnPropertyDescriptor(t, s);
@@ -137,7 +137,7 @@ function dt(t) {
137
137
  }), Reflect.defineProperty(e, s, n);
138
138
  }), e;
139
139
  }
140
- const mt = Object.prototype.propertyIsEnumerable;
140
+ const yt = Object.prototype.propertyIsEnumerable;
141
141
  function We(t, e) {
142
142
  let s;
143
143
  if (Array.isArray(t))
@@ -146,9 +146,9 @@ function We(t, e) {
146
146
  return new Set(t.values());
147
147
  if (t instanceof Map)
148
148
  return new Map(t);
149
- if (e != null && e.mark && (s = e.mark(t, C), s !== void 0) && s !== C.mutable) {
150
- if (s === C.immutable)
151
- return dt(t);
149
+ if (e != null && e.mark && (s = e.mark(t, j), s !== void 0) && s !== j.mutable) {
150
+ if (s === j.immutable)
151
+ return mt(t);
152
152
  if (typeof s == "function") {
153
153
  if (e.enablePatches || e.enableAutoFreeze)
154
154
  throw new Error("You can't use mark and patches or auto freeze together.");
@@ -160,7 +160,7 @@ function We(t, e) {
160
160
  return Object.keys(t).forEach((i) => {
161
161
  n[i] = t[i];
162
162
  }), Object.getOwnPropertySymbols(t).forEach((i) => {
163
- mt.call(t, i) && (n[i] = t[i]);
163
+ yt.call(t, i) && (n[i] = t[i]);
164
164
  }), n;
165
165
  } else
166
166
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
@@ -169,7 +169,7 @@ function E(t) {
169
169
  t.copy || (t.copy = We(t.original, t.options));
170
170
  }
171
171
  function K(t) {
172
- if (!j(t))
172
+ if (!C(t))
173
173
  return we(t);
174
174
  if (Array.isArray(t))
175
175
  return t.map(K);
@@ -252,7 +252,7 @@ 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 (J(t) || !j(t, s) || e.has(t) || Object.isFrozen(t))
255
+ if (J(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
258
  if (e.add(t), Me(t, (a, r) => {
@@ -271,7 +271,7 @@ function He(t, e, s) {
271
271
  });
272
272
  }
273
273
  }
274
- function yt(t, e) {
274
+ 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(x(s, e), t.finalities.handledSet, t.options);
277
277
  }
@@ -298,34 +298,34 @@ function Oe(t, e, s, n) {
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
- }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), j(s, t.options) && t.finalities.draft.push(() => {
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) && yt(t, e);
303
+ z(x(a, e), s) && gt(t, e);
304
304
  });
305
305
  }
306
- function gt(t, e, s, n, i) {
306
+ function bt(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,32 +333,32 @@ function gt(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 bt({ original: t, copy: e, assignedMap: s }, n, i, a, r) {
352
+ function _t({ 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 = x(t, f), c = oe(x(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
- function _t({ original: t, copy: e }, s, n, i, a) {
361
+ 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)) {
@@ -395,16 +395,16 @@ function Z(t, e, s, n) {
395
395
  switch (t.type) {
396
396
  case 0:
397
397
  case 2:
398
- return bt(t, e, s, n, i);
398
+ return _t(t, e, s, n, i);
399
399
  case 1:
400
- return gt(t, e, s, n, i);
400
+ return bt(t, e, s, n, i);
401
401
  case 3:
402
- return _t(t, e, s, n, i);
402
+ return vt(t, e, s, n, i);
403
403
  }
404
404
  }
405
- let vt = !1;
405
+ let wt = !1;
406
406
  const ae = (t, e, s = !1) => {
407
- if (typeof t == "object" && t !== null && (!j(t, e) || s) && !vt)
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
  }, me = {
410
410
  get size() {
@@ -440,8 +440,8 @@ const ae = (t, e, s = !1) => {
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, C)) === C.mutable;
444
- if (n.options.strict && ae(i, n.options, a), a || n.finalized || !j(i, n.options) || i !== n.original.get(t))
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;
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({
447
447
  original: i,
@@ -487,15 +487,15 @@ const ae = (t, e, s = !1) => {
487
487
  [re]() {
488
488
  return this.entries();
489
489
  }
490
- }, wt = Reflect.ownKeys(me), ze = (t, e, { isValuesIterator: s }) => () => {
490
+ }, Mt = Reflect.ownKeys(me), ze = (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 = b(o), u = ((i = (n = t.options).mark) === null || i === void 0 ? void 0 : i.call(n, o, C)) === C.mutable;
498
- if (t.options.strict && ae(r, t.options, u), !u && !f && j(r, t.options) && !t.finalized && t.original.has(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;
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,
501
501
  parentDraft: t,
@@ -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
- }, Mt = Reflect.ownKeys(ye), qe = /* @__PURE__ */ new WeakSet(), Ge = {
578
+ }, Ot = Reflect.ownKeys(ye), 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];
@@ -586,18 +586,18 @@ const ae = (t, e, s = !1) => {
586
586
  let r;
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
- if (r = t.options.mark(u, C), r === C.mutable)
589
+ if (r = t.options.mark(u, j), r === j.mutable)
590
590
  return t.options.strict && ae(u, t.options, !0), u;
591
591
  }
592
592
  const o = A(t);
593
- if (o instanceof Map && wt.includes(e)) {
593
+ if (o instanceof Map && Mt.includes(e)) {
594
594
  if (e === "size")
595
595
  return Object.getOwnPropertyDescriptor(me, "size").get.call(t.proxy);
596
596
  const u = me[e];
597
597
  if (u)
598
598
  return u.bind(t.proxy);
599
599
  }
600
- if (o instanceof Set && Mt.includes(e)) {
600
+ if (o instanceof Set && Ot.includes(e)) {
601
601
  if (e === "size")
602
602
  return Object.getOwnPropertyDescriptor(ye, "size").get.call(t.proxy);
603
603
  const u = ye[e];
@@ -612,7 +612,7 @@ const ae = (t, e, s = !1) => {
612
612
  ) : void 0;
613
613
  }
614
614
  const f = o[e];
615
- if (t.options.strict && ae(f, t.options), t.finalized || !j(f, t.options))
615
+ if (t.options.strict && ae(f, t.options), t.finalized || !C(f, t.options))
616
616
  return f;
617
617
  if (f === ce(t.original, e)) {
618
618
  if (E(t), t.copy[e] = Ie({
@@ -688,42 +688,42 @@ 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
693
  const w = b(f);
694
694
  let p = c.type === 3 ? c.setMap : c.copy;
695
695
  const O = x(p, n), v = b(O);
696
696
  if (v) {
697
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, _);
698
+ v.operated && (_ = 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(_, v.original)), te(p, n, _);
699
699
  }
700
700
  (y = w.callbacks) === null || y === void 0 || y.forEach((_) => {
701
- _(l, h);
701
+ _(h, l);
702
702
  });
703
703
  });
704
704
  } else {
705
705
  const c = b(f);
706
- c.finalities.draft.push((l, h) => {
707
- pe(c), de(c, Z, l, h);
706
+ c.finalities.draft.push((h, l) => {
707
+ pe(c), de(c, Z, h, l);
708
708
  });
709
709
  }
710
710
  return f;
711
711
  }
712
712
  ve.createDraft = Ie;
713
- function Ot(t, e, s, n, i) {
713
+ function It(t, e, s, n, i) {
714
714
  var a;
715
715
  const r = b(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
724
724
  ];
725
725
  }
726
- function It(t, e) {
726
+ function St(t, e) {
727
727
  var s;
728
728
  const n = {
729
729
  draft: [],
@@ -732,7 +732,7 @@ function It(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, C)) === C.mutable || !j(t, e) ? t : Ie({
735
+ const o = ((s = e.mark) === null || s === void 0 ? void 0 : s.call(e, t, j)) === j.mutable || !C(t, e) ? t : Ie({
736
736
  original: t,
737
737
  parentDraft: null,
738
738
  finalities: n,
@@ -741,8 +741,8 @@ function It(t, e) {
741
741
  return [
742
742
  o,
743
743
  (f = []) => {
744
- const [u, c, l] = Ot(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
  }
@@ -755,7 +755,7 @@ function ge(t) {
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
@@ -764,7 +764,7 @@ function ge(t) {
764
764
  }
765
765
  function Ke(t) {
766
766
  const e = b(t);
767
- if (!j(t, e == null ? void 0 : e.options))
767
+ if (!C(t, e == null ? void 0 : e.options))
768
768
  return t;
769
769
  const s = B(t);
770
770
  if (e && !e.operated)
@@ -794,7 +794,7 @@ function xe(t) {
794
794
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
795
795
  return Ke(t);
796
796
  }
797
- const St = (t) => {
797
+ const Rt = (t) => {
798
798
  if (t !== void 0 && Object.prototype.toString.call(t) !== "[object Object]")
799
799
  throw new Error(`Invalid options: ${String(t)}, 'options' should be an object.`);
800
800
  return function e(s, n, i) {
@@ -808,7 +808,7 @@ const St = (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 = J(f) ? xe(f) : f, h = Array.isArray(c.mark) ? (d, T) => {
811
+ const h = J(f) ? xe(f) : f, l = Array.isArray(c.mark) ? (d, T) => {
812
812
  for (const N of c.mark) {
813
813
  if (typeof N != "function")
814
814
  throw new Error(`Invalid mark: ${N}, 'mark' should be a function.`);
@@ -818,15 +818,15 @@ const St = (t) => {
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 (!j(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] = It(l, p);
827
+ const [O, v] = St(h, p);
828
828
  if (typeof n != "function") {
829
- if (!j(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
  }
@@ -834,21 +834,21 @@ const St = (t) => {
834
834
  try {
835
835
  _ = u(O);
836
836
  } catch (d) {
837
- throw he(b(O)), d;
837
+ throw le(b(O)), d;
838
838
  }
839
839
  const S = (d) => {
840
840
  const T = b(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.");
844
- const G = d == null ? void 0 : d[ht];
844
+ const G = d == null ? void 0 : d[pt];
845
845
  if (G) {
846
- const at = G[0];
846
+ const ft = G[0];
847
847
  return p.strict && typeof d == "object" && d !== null && ge({
848
848
  rootDraft: T,
849
849
  value: d,
850
850
  useRawReturn: !0
851
- }), v([at]);
851
+ }), v([ft]);
852
852
  }
853
853
  if (d !== void 0)
854
854
  return typeof d == "object" && d !== null && ge({ rootDraft: T, value: d }), v([d]);
@@ -864,12 +864,12 @@ const St = (t) => {
864
864
  return v([d]);
865
865
  };
866
866
  return _ instanceof Promise ? _.then(S, (d) => {
867
- throw he(b(O)), d;
867
+ throw le(b(O)), d;
868
868
  }) : S(_);
869
869
  };
870
- }, M = St();
870
+ }, M = Rt();
871
871
  Object.prototype.constructor.toString();
872
- var Rt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
872
+ var Et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
873
873
  function Ye(t) {
874
874
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
875
875
  }
@@ -877,7 +877,7 @@ var Xe = { exports: {} };
877
877
  (function(t, e) {
878
878
  (function(s, n) {
879
879
  t.exports = n();
880
- })(Rt, function() {
880
+ })(Et, function() {
881
881
  var s = function(a, r) {
882
882
  if (r = r || {}, typeof a != "function")
883
883
  throw new i("fetch must be a function");
@@ -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)
@@ -926,7 +926,7 @@ var Xe = { exports: {} };
926
926
  w(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 {
@@ -939,11 +939,11 @@ var Xe = { exports: {} };
939
939
  w(d);
940
940
  }
941
941
  else
942
- v < l ? O(v, S, null) : w(S);
942
+ v < h ? O(v, S, null) : w(S);
943
943
  });
944
944
  };
945
945
  function O(v, _, S) {
946
- var d = typeof h == "function" ? h(v, _, S) : h;
946
+ var d = typeof l == "function" ? l(v, _, S) : l;
947
947
  setTimeout(function() {
948
948
  p(++v);
949
949
  }, d);
@@ -961,8 +961,8 @@ var Xe = { exports: {} };
961
961
  return s;
962
962
  });
963
963
  })(Xe);
964
- var Et = Xe.exports;
965
- const Qe = /* @__PURE__ */ Ye(Et), At = Qe(fetch), Ze = async (t, e) => {
964
+ var At = Xe.exports;
965
+ const Qe = /* @__PURE__ */ Ye(At), Dt = Qe(fetch), Ze = async (t, e) => {
966
966
  if (!t)
967
967
  throw "Metapage definition null";
968
968
  if (!t.version)
@@ -971,7 +971,7 @@ const Qe = /* @__PURE__ */ Ye(Et), At = Qe(fetch), Ze = async (t, e) => {
971
971
  throw 'Missing "version" argument';
972
972
  if (k(t.version, e) > 0)
973
973
  try {
974
- return await (await At(`https://module.metapage.io/conversion/metapage/${e}`, {
974
+ return await (await Dt(`https://module.metapage.io/conversion/metapage/${e}`, {
975
975
  redirect: "follow",
976
976
  retries: 3,
977
977
  retryDelay: 1e3,
@@ -985,7 +985,7 @@ const Qe = /* @__PURE__ */ Ye(Et), At = 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
- }, Dt = async (t) => Ze(t, _e), Ct = (t, e) => {
988
+ }, jt = async (t) => Ze(t, _e), Ct = (t, e) => {
989
989
  if (!t)
990
990
  throw "Metapage definition null";
991
991
  if (!t.version)
@@ -998,19 +998,19 @@ const Qe = /* @__PURE__ */ Ye(Et), At = Qe(fetch), Ze = async (t, e) => {
998
998
  switch (s) {
999
999
  case "0.2": {
1000
1000
  if (k(e, s) > 0)
1001
- n = Lt(n), s = H(n.version);
1001
+ n = Ut(n), s = H(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 = Tt(n), s = H(n.version)) : (n = Ut(n), s = H(n.version));
1007
+ k(e, s) > 0 ? (n = $t(n), s = H(n.version)) : (n = Tt(n), s = H(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 = H(n.version);
1013
+ n = zt(n), s = H(n.version);
1014
1014
  break;
1015
1015
  }
1016
1016
  default:
@@ -1023,7 +1023,7 @@ const Qe = /* @__PURE__ */ Ye(Et), At = 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(jt(t)));
1026
+ return et(Ne(Pt(t)));
1027
1027
  case "0.5":
1028
1028
  return Ne(t);
1029
1029
  case "0.6":
@@ -1039,13 +1039,13 @@ ${window.location.href}`;
1039
1039
  ${JSON.stringify(t)}
1040
1040
  ${window.location.href}`), t;
1041
1041
  }
1042
- }, jt = (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 = {
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: h, keywords: l, iconUrl: m, ...y } = o, w = {
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 {
@@ -1056,7 +1056,7 @@ ${window.location.href}`), t;
1056
1056
  metadata: w,
1057
1057
  ...r
1058
1058
  };
1059
- }, tt = (t) => t, Ne = (t) => tt(Pt(t)), Pt = (t) => M(t, (e) => {
1059
+ }, tt = (t) => t, Ne = (t) => tt(Lt(t)), Lt = (t) => M(t, (e) => {
1060
1060
  const { metadata: s, ...n } = e, i = {
1061
1061
  ...n,
1062
1062
  version: "0.6"
@@ -1074,30 +1074,30 @@ ${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
- }), Lt = (t) => M(t, (e) => {
1094
- e.version = "0.3";
1095
1093
  }), Ut = (t) => M(t, (e) => {
1096
- e.version = "0.2";
1094
+ e.version = "0.3";
1097
1095
  }), Tt = (t) => M(t, (e) => {
1096
+ e.version = "0.2";
1097
+ }), $t = (t) => M(t, (e) => {
1098
1098
  const s = e;
1099
1099
  delete s.plugins, s.version = "1";
1100
- }), $t = (t) => M(t, (e) => (e.version = "0.3", e)), H = (t) => {
1100
+ }), zt = (t) => M(t, (e) => (e.version = "0.3", e)), H = (t) => {
1101
1101
  if (t === "latest")
1102
1102
  return _e;
1103
1103
  if (k(t, "0.2") < 0)
@@ -1128,17 +1128,17 @@ var ne = function(t) {
1128
1128
  };
1129
1129
  const ue = async (t) => {
1130
1130
  for (const e of Object.keys(t)) {
1131
- const s = await zt(t[e]);
1131
+ const s = await xt(t[e]);
1132
1132
  t[e] = s;
1133
1133
  }
1134
1134
  return t;
1135
1135
  }, Q = async (t) => {
1136
1136
  for (const e of Object.keys(t)) {
1137
- const s = await xt(t[e]);
1137
+ const s = await Nt(t[e]);
1138
1138
  t[e] = s;
1139
1139
  }
1140
1140
  return t;
1141
- }, zt = async (t) => {
1141
+ }, xt = async (t) => {
1142
1142
  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
1143
  const e = t, s = {
1144
1144
  _s: !0,
@@ -1179,7 +1179,7 @@ const ue = async (t) => {
1179
1179
  return Promise.resolve(s);
1180
1180
  }
1181
1181
  return Promise.resolve(t);
1182
- }, xt = (t) => {
1182
+ }, Nt = (t) => {
1183
1183
  if (!(t && typeof t == "object" && t._s === !0))
1184
1184
  return t;
1185
1185
  const e = t, s = e._c;
@@ -1237,10 +1237,10 @@ var st = { exports: {} };
1237
1237
  function i(f, u, c) {
1238
1238
  this.fn = f, this.context = u, this.once = c || !1;
1239
1239
  }
1240
- function a(f, u, c, l, h) {
1240
+ function a(f, u, c, h, l) {
1241
1241
  if (typeof c != "function")
1242
1242
  throw new TypeError("The listener must be a function");
1243
- var m = new i(c, l || f, h), y = s ? s + u : u;
1243
+ var m = new i(c, h || f, l), y = s ? s + u : u;
1244
1244
  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
1245
  }
1246
1246
  function r(f, u) {
@@ -1250,25 +1250,25 @@ var st = { exports: {} };
1250
1250
  this._events = new n(), this._eventsCount = 0;
1251
1251
  }
1252
1252
  o.prototype.eventNames = function() {
1253
- var u = [], c, l;
1253
+ var u = [], c, h;
1254
1254
  if (this._eventsCount === 0)
1255
1255
  return u;
1256
- for (l in c = this._events)
1257
- e.call(c, l) && u.push(s ? l.slice(1) : l);
1256
+ for (h in c = this._events)
1257
+ e.call(c, h) && u.push(s ? h.slice(1) : h);
1258
1258
  return Object.getOwnPropertySymbols ? u.concat(Object.getOwnPropertySymbols(c)) : u;
1259
1259
  }, o.prototype.listeners = function(u) {
1260
- var c = s ? s + u : u, l = this._events[c];
1261
- if (!l)
1260
+ var c = s ? s + u : u, h = this._events[c];
1261
+ if (!h)
1262
1262
  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;
1263
+ if (h.fn)
1264
+ return [h.fn];
1265
+ for (var l = 0, m = h.length, y = new Array(m); l < m; l++)
1266
+ y[l] = h[l].fn;
1267
1267
  return y;
1268
1268
  }, 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) {
1269
+ var c = s ? s + u : u, h = this._events[c];
1270
+ return h ? h.fn ? 1 : h.length : 0;
1271
+ }, o.prototype.emit = function(u, c, h, l, m, y) {
1272
1272
  var w = s ? s + u : u;
1273
1273
  if (!this._events[w])
1274
1274
  return !1;
@@ -1280,13 +1280,13 @@ var st = { exports: {} };
1280
1280
  case 2:
1281
1281
  return p.fn.call(p.context, c), !0;
1282
1282
  case 3:
1283
- return p.fn.call(p.context, c, l), !0;
1283
+ return p.fn.call(p.context, c, h), !0;
1284
1284
  case 4:
1285
- return p.fn.call(p.context, c, l, h), !0;
1285
+ return p.fn.call(p.context, c, h, l), !0;
1286
1286
  case 5:
1287
- return p.fn.call(p.context, c, l, h, m), !0;
1287
+ return p.fn.call(p.context, c, h, l, m), !0;
1288
1288
  case 6:
1289
- return p.fn.call(p.context, c, l, h, m, y), !0;
1289
+ return p.fn.call(p.context, c, h, l, m, y), !0;
1290
1290
  }
1291
1291
  for (_ = 1, v = new Array(O - 1); _ < O; _++)
1292
1292
  v[_ - 1] = arguments[_];
@@ -1302,10 +1302,10 @@ var st = { exports: {} };
1302
1302
  p[_].fn.call(p[_].context, c);
1303
1303
  break;
1304
1304
  case 3:
1305
- p[_].fn.call(p[_].context, c, l);
1305
+ p[_].fn.call(p[_].context, c, h);
1306
1306
  break;
1307
1307
  case 4:
1308
- p[_].fn.call(p[_].context, c, l, h);
1308
+ p[_].fn.call(p[_].context, c, h, l);
1309
1309
  break;
1310
1310
  default:
1311
1311
  if (!v)
@@ -1315,11 +1315,11 @@ var st = { exports: {} };
1315
1315
  }
1316
1316
  }
1317
1317
  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) {
1318
+ }, o.prototype.on = function(u, c, h) {
1319
+ return a(this, u, c, h, !1);
1320
+ }, o.prototype.once = function(u, c, h) {
1321
+ return a(this, u, c, h, !0);
1322
+ }, o.prototype.removeListener = function(u, c, h, l) {
1323
1323
  var m = s ? s + u : u;
1324
1324
  if (!this._events[m])
1325
1325
  return this;
@@ -1327,10 +1327,10 @@ var st = { exports: {} };
1327
1327
  return r(this, m), this;
1328
1328
  var y = this._events[m];
1329
1329
  if (y.fn)
1330
- y.fn === c && (!h || y.once) && (!l || y.context === l) && r(this, m);
1330
+ y.fn === c && (!l || y.once) && (!h || y.context === h) && r(this, m);
1331
1331
  else {
1332
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]);
1333
+ (y[w].fn !== c || l && !y[w].once || h && y[w].context !== h) && p.push(y[w]);
1334
1334
  p.length ? this._events[m] = p.length === 1 ? p[0] : p : r(this, m);
1335
1335
  }
1336
1336
  return this;
@@ -1339,7 +1339,7 @@ var st = { exports: {} };
1339
1339
  return u ? (c = s ? s + u : u, this._events[c] && r(this, c)) : (this._events = new n(), this._eventsCount = 0), this;
1340
1340
  }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = s, o.EventEmitter = o, t.exports = o;
1341
1341
  })(st);
1342
- var Se = st.exports, Nt = function(t, e) {
1342
+ var Se = st.exports, Vt = function(t, e) {
1343
1343
  e || (e = {}), typeof e == "function" && (e = { cmp: e });
1344
1344
  var s = typeof e.cycles == "boolean" ? e.cycles : !1, n = e.cmp && function(a) {
1345
1345
  return function(r) {
@@ -1370,19 +1370,19 @@ var Se = st.exports, Nt = function(t, e) {
1370
1370
  }
1371
1371
  var u = i.push(r) - 1, c = Object.keys(r).sort(n && n(r));
1372
1372
  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);
1373
+ var h = c[o], l = a(r[h]);
1374
+ l && (f && (f += ","), f += JSON.stringify(h) + ":" + l);
1375
1375
  }
1376
1376
  return i.splice(u, 1), "{" + f + "}";
1377
1377
  }
1378
1378
  }(t);
1379
1379
  };
1380
- const nt = /* @__PURE__ */ Ye(Nt);
1380
+ const nt = /* @__PURE__ */ Ye(Vt);
1381
1381
  var ee;
1382
1382
  (function(t) {
1383
1383
  t.mp_debug = "mp_debug";
1384
1384
  })(ee || (ee = {}));
1385
- const Vt = () => {
1385
+ const kt = () => {
1386
1386
  try {
1387
1387
  return window !== window.top;
1388
1388
  } catch {
@@ -1392,7 +1392,7 @@ const Vt = () => {
1392
1392
  version: _e,
1393
1393
  metaframes: {}
1394
1394
  };
1395
- class kt extends Se.EventEmitter {
1395
+ class Ft extends Se.EventEmitter {
1396
1396
  constructor() {
1397
1397
  super(), this._definition = it, this.getDefinition = this.getDefinition.bind(this);
1398
1398
  }
@@ -1413,7 +1413,7 @@ const fe = (t, e) => {
1413
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 = () => {
1414
1414
  const t = new URLSearchParams(window.location.search).get(ee.mp_debug);
1415
1415
  return t === "true" || t === "1";
1416
- }, as = (t = 8) => Re(t), Ft = (t = 8) => Re(t), fs = (t = 8) => Re(t), Ve = "abcdefghijklmnopqrstuvwxyz0123456789", Re = (t = 8) => {
1416
+ }, as = (t = 8) => Re(t), Jt = (t = 8) => Re(t), fs = (t = 8) => Re(t), Ve = "abcdefghijklmnopqrstuvwxyz0123456789", Re = (t = 8) => {
1417
1417
  for (var e = "", s = Ve.length, n = 0; n < t; n++)
1418
1418
  e += Ve.charAt(Math.floor(Math.random() * s));
1419
1419
  return e;
@@ -1425,16 +1425,16 @@ const fe = (t, e) => {
1425
1425
  s && (i = `${i}; background: #${s}`), n = `%c${n}`, window.console.log(n, i);
1426
1426
  } else
1427
1427
  window.console.log(n);
1428
- }, rt = (t) => Bt(Jt(t)), Jt = (t) => {
1428
+ }, rt = (t) => Wt(Bt(t)), Bt = (t) => {
1429
1429
  var e = 0;
1430
1430
  for (let s = 0; s < t.length; s++)
1431
1431
  e = t.charCodeAt(s) + ((e << 5) - e);
1432
1432
  return e;
1433
- }, Bt = (t) => {
1433
+ }, Wt = (t) => {
1434
1434
  var e = (t & 16777215).toString(16).toUpperCase();
1435
1435
  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()) {
1436
+ }, he = () => document.readyState == "complete" || document.readyState == "interactive", Ae = async () => he() ? Promise.resolve() : new Promise((t) => {
1437
+ if (he()) {
1438
1438
  t();
1439
1439
  return;
1440
1440
  }
@@ -1442,7 +1442,7 @@ const fe = (t, e) => {
1442
1442
  window.addEventListener("load", () => {
1443
1443
  e || (e = !0, t());
1444
1444
  }), setTimeout(() => {
1445
- !e && le() && (e = !0, t());
1445
+ !e && he() && (e = !0, t());
1446
1446
  }, 200);
1447
1447
  }), us = async (t) => {
1448
1448
  const e = nt(t);
@@ -1468,7 +1468,7 @@ var R;
1468
1468
  })(R || (R = {}));
1469
1469
  class P extends Se.EventEmitter {
1470
1470
  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 = Vt(), 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) {
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) {
1472
1472
  this.log("Not an iframe, metaframe code disabled");
1473
1473
  return;
1474
1474
  }
@@ -1620,7 +1620,7 @@ class P extends Se.EventEmitter {
1620
1620
  }
1621
1621
  }
1622
1622
  }
1623
- P.version = ft;
1623
+ P.version = ut;
1624
1624
  P.ERROR = R.Error;
1625
1625
  P.CONNECTED = R.Connected;
1626
1626
  P.INPUT = R.Input;
@@ -1628,7 +1628,7 @@ P.INPUTS = R.Inputs;
1628
1628
  P.MESSAGE = R.Message;
1629
1629
  P.deserializeInputs = Q;
1630
1630
  P.serializeInputs = ue;
1631
- class Wt extends Se.EventEmitter {
1631
+ class Ht extends Se.EventEmitter {
1632
1632
  constructor(e, s, n, i, a, r = !1) {
1633
1633
  if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._cachedEventInputsUpdate = {
1634
1634
  iframeId: void 0,
@@ -1649,9 +1649,9 @@ class Wt 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();
@@ -1834,8 +1834,8 @@ const ke = () => M({
1834
1834
  inputs: {},
1835
1835
  outputs: {}
1836
1836
  }
1837
- }, (t) => t), ls = (t) => H(t), Ht = (t, e) => !e || e === "*" || t === e ? !0 : e.endsWith("*") ? t.startsWith(e.slice(0, -1)) : e.startsWith("*") ? t.endsWith(e.slice(1)) : !1, qt = "bcbcbc";
1838
- class L extends kt {
1837
+ }, (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
+ class L extends Ft {
1839
1839
  static async from(e, s) {
1840
1840
  if (e == null)
1841
1841
  throw "Metapage definition cannot be null";
@@ -1849,7 +1849,7 @@ class L extends kt {
1849
1849
  return n.setDefinition(e);
1850
1850
  }
1851
1851
  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 : Ft(), this._consoleBackgroundColor = e && e.color ? e.color : qt, 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(() => {
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(() => {
1853
1853
  this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
1854
1854
  });
1855
1855
  }
@@ -1882,7 +1882,9 @@ class L extends kt {
1882
1882
  async setDefinition(e, s) {
1883
1883
  if (!e.version)
1884
1884
  throw "Metapage definition must have a version";
1885
- const n = await Dt(e);
1885
+ const n = await jt(e);
1886
+ if (this.isDisposed())
1887
+ return this;
1886
1888
  n.metaframes && Object.keys(n.metaframes).forEach((a) => {
1887
1889
  var r = n.metaframes[a];
1888
1890
  if (typeof r != "object")
@@ -1957,7 +1959,7 @@ class L extends kt {
1957
1959
  throw this.emitErrorMessage(`Existing metaframe for id=${e}`), `Existing metaframe for id=${e}`;
1958
1960
  if (!s.url)
1959
1961
  throw this.emitErrorMessage(`Metaframe definition missing url id=${e}`), `Metaframe definition missing url id=${e}`;
1960
- var n = new Wt(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
1962
+ var n = new Ht(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
1961
1963
  return this._metaframes = M(this._metaframes, (i) => {
1962
1964
  i[e] = n;
1963
1965
  }), n.addListener(g.Error, (i) => {
@@ -1987,7 +1989,7 @@ class L extends kt {
1987
1989
  var i = [];
1988
1990
  n[e][s] = i, Object.keys(this._inputMap).forEach((a) => {
1989
1991
  a !== e && this._inputMap[a].forEach((r) => {
1990
- if (r.metaframe === e && Ht(s, r.source)) {
1992
+ if (r.metaframe === e && qt(s, r.source)) {
1991
1993
  var o = r.target;
1992
1994
  (!r.target || r.target.startsWith("*") || r.target === "") && (o = s), i.push({ metaframe: a, pipe: o });
1993
1995
  }
@@ -2117,14 +2119,14 @@ class L extends kt {
2117
2119
  var n = this._metaframes[o];
2118
2120
  this.setOutputStateOnlyMetaframeInputMap(o, u), n.setOutputs(u);
2119
2121
  var i = !1;
2120
- const c = Object.keys(u), l = {};
2121
- c.forEach((h, m) => {
2122
- const y = this.getInputsFromOutput(o, h);
2122
+ const c = Object.keys(u), h = {};
2123
+ c.forEach((l, m) => {
2124
+ const y = this.getInputsFromOutput(o, l);
2123
2125
  y.length > 0 && y.forEach((w) => {
2124
- l[w.metaframe] || (l[w.metaframe] = {}), l[w.metaframe][w.pipe] = u[h], i = !0;
2126
+ h[w.metaframe] || (h[w.metaframe] = {}), h[w.metaframe][w.pipe] = u[l], i = !0;
2125
2127
  });
2126
- }), i && (this.setInputStateOnlyMetapageInstanceInputs(l), Object.keys(l).forEach((h) => {
2127
- this._metaframes[h].setInputs(l[h]);
2128
+ }), i && (this.setInputStateOnlyMetapageInstanceInputs(h), Object.keys(h).forEach((l) => {
2129
+ this._metaframes[l].setInputs(h[l]);
2128
2130
  })), this.listenerCount(g.State) > 0 && this.emit(g.State, this._state), this.debug && n.ack({ jsonrpc: r, state: this._state });
2129
2131
  } else
2130
2132
  this.error(`missing metaframe=${o}`);
@@ -2138,9 +2140,9 @@ class L extends kt {
2138
2140
  break;
2139
2141
  case D.HashParamsUpdate:
2140
2142
  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;
2143
+ const c = r.params, h = new URL(f.url);
2144
+ h.hash = c.hash, f.url = h.href, this._definition = M(this._definition, (l) => {
2145
+ l.metaframes[c.metaframe].url = h.href;
2144
2146
  }), this._emitDefinitionEvent();
2145
2147
  }
2146
2148
  break;
@@ -2165,15 +2167,22 @@ L.OUTPUTS = g.Outputs;
2165
2167
  L.STATE = g.State;
2166
2168
  L.deserializeInputs = Q;
2167
2169
  L.serializeInputs = ue;
2168
- const Gt = Qe(fetch), hs = async (t, e) => {
2170
+ const at = Qe(fetch), ls = async (t, e) => {
2169
2171
  const s = new URL(t);
2170
- s.pathname = s.pathname + (s.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json");
2171
- const i = await (await Gt(s.href, {
2172
+ s.pathname = s.pathname + (s.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
2173
+ const i = await (await at(s.href, {
2172
2174
  redirect: "follow",
2173
2175
  retries: 3,
2174
2176
  retryDelay: 1e3
2175
2177
  })).json();
2176
2178
  return await Ze(i, e);
2179
+ }, ps = async (t, e) => {
2180
+ const s = new URL(t);
2181
+ return s.pathname = s.pathname + (s.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json"), await (await at(s.href, {
2182
+ redirect: "follow",
2183
+ retries: 3,
2184
+ retryDelay: 1e3
2185
+ })).json();
2177
2186
  };
2178
2187
  export {
2179
2188
  it as INITIAL_NULL_METAPAGE_DEFINITION,
@@ -2194,40 +2203,41 @@ export {
2194
2203
  L as Metapage,
2195
2204
  g as MetapageEvents,
2196
2205
  ee as MetapageHashParams,
2197
- Wt as MetapageIFrameRpcClient,
2198
- kt as MetapageShared,
2206
+ Ht as MetapageIFrameRpcClient,
2207
+ Ft as MetapageShared,
2199
2208
  _e as MetapageVersionCurrent,
2200
- Ce as MetapageVersionsAll,
2209
+ je as MetapageVersionsAll,
2201
2210
  Zt as PARSE_ERROR,
2202
- ft as VERSION_METAFRAME,
2211
+ ut as VERSION_METAFRAME,
2203
2212
  Fe as VERSION_METAPAGE,
2204
2213
  et as convertMetaframeJsonToCurrentVersion,
2205
- Dt as convertMetapageDefinitionToCurrentVersion,
2214
+ jt as convertMetapageDefinitionToCurrentVersion,
2206
2215
  Ze as convertMetapageDefinitionToVersion,
2207
2216
  Q as deserializeInputs,
2208
2217
  Re as generateId,
2209
2218
  as as generateMetaframeId,
2210
- Ft as generateMetapageId,
2219
+ Jt as generateMetapageId,
2211
2220
  fs as generateNonce,
2212
- ls as getLibraryVersionMatching,
2221
+ hs as getLibraryVersionMatching,
2213
2222
  H as getMatchingMetapageVersion,
2214
- hs as getMetaframeDefinitionFromUrl,
2223
+ ps as getMetaframeDefinitionFromUrl,
2224
+ ls as getMetapageDefinitionFromUrl,
2215
2225
  rs as getUrlParam,
2216
2226
  os as getUrlParamDebug,
2217
- Jt as hashCode,
2218
- Bt as intToRGB,
2227
+ Bt as hashCode,
2228
+ Wt as intToRGB,
2219
2229
  be as isDebugFromUrlsParams,
2220
- Vt as isIframe,
2230
+ kt as isIframe,
2221
2231
  is as isJsonRpcId,
2222
- le as isPageLoaded,
2232
+ he as isPageLoaded,
2223
2233
  Ee as log,
2224
- Ht as matchPipe,
2234
+ qt as matchPipe,
2225
2235
  fe as merge,
2226
2236
  us as metapageAllSha256Hash,
2227
2237
  cs as metapageOnlyEssentailSha256Hash,
2228
2238
  Ae as pageLoaded,
2229
- xt as possiblyDeserializeDatarefToValue,
2230
- zt as possiblySerializeValueToDataref,
2239
+ Nt as possiblyDeserializeDatarefToValue,
2240
+ xt as possiblySerializeValueToDataref,
2231
2241
  ue as serializeInputs,
2232
2242
  rt as stringToRgb
2233
2243
  };