@metapages/metapage 1.0.21 → 1.1.0

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,40 +1,40 @@
1
- const Le = ["0.3", "0.4", "0.5", "0.6", "1"], Ue = ["0.2", "0.3", "1"], Me = "1", le = "1", on = "metaframe.json", an = "metapage/definition", fn = "metapage/state", Je = Ue[Ue.length - 1], ct = Le[Le.length - 1], lt = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Te = (t) => {
2
- if (typeof t != "string")
1
+ const St = ["0.3", "0.4", "0.5", "0.6", "1"], Ot = ["0.2", "0.3", "1"], ft = "1", Ge = "1", Fs = "metaframe.json", zs = "metapage/definition", Gs = "metapage/state", zt = Ot[Ot.length - 1], _n = St[St.length - 1], gn = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Et = (e) => {
2
+ if (typeof e != "string")
3
3
  throw new TypeError("Invalid argument expected string");
4
- const e = t.match(lt);
5
- if (!e)
6
- throw new Error(`Invalid argument not valid semver ('${t}' received)`);
7
- return e.shift(), e;
8
- }, $e = (t) => t === "*" || t === "x" || t === "X", ze = (t) => {
9
- const e = parseInt(t, 10);
10
- return isNaN(e) ? t : e;
11
- }, ht = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], pt = (t, e) => {
12
- if ($e(t) || $e(e))
4
+ const t = e.match(gn);
5
+ if (!t)
6
+ throw new Error(`Invalid argument not valid semver ('${e}' received)`);
7
+ return t.shift(), t;
8
+ }, Mt = (e) => e === "*" || e === "x" || e === "X", It = (e) => {
9
+ const t = parseInt(e, 10);
10
+ return isNaN(t) ? e : t;
11
+ }, bn = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], vn = (e, t) => {
12
+ if (Mt(e) || Mt(t))
13
13
  return 0;
14
- const [n, s] = ht(ze(t), ze(e));
14
+ const [n, s] = bn(It(e), It(t));
15
15
  return n > s ? 1 : n < s ? -1 : 0;
16
- }, xe = (t, e) => {
17
- for (let n = 0; n < Math.max(t.length, e.length); n++) {
18
- const s = pt(t[n] || "0", e[n] || "0");
16
+ }, Ct = (e, t) => {
17
+ for (let n = 0; n < Math.max(e.length, t.length); n++) {
18
+ const s = vn(e[n] || "0", t[n] || "0");
19
19
  if (s !== 0)
20
20
  return s;
21
21
  }
22
22
  return 0;
23
- }, E = (t, e) => {
24
- const n = Te(t), s = Te(e), i = n.pop(), a = s.pop(), r = xe(n, s);
25
- return r !== 0 ? r : i && a ? xe(i.split("."), a.split(".")) : i || a ? i ? -1 : 1 : 0;
23
+ }, V = (e, t) => {
24
+ const n = Et(e), s = Et(t), i = n.pop(), o = s.pop(), r = Ct(n, s);
25
+ return r !== 0 ? r : i && o ? Ct(i.split("."), o.split(".")) : i || o ? i ? -1 : 1 : 0;
26
26
  };
27
- var dt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
28
- function We(t) {
29
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
27
+ var wn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
28
+ function lt(e) {
29
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
30
30
  }
31
- var He = { exports: {} };
32
- (function(t, e) {
31
+ var Gt = { exports: {} };
32
+ (function(e, t) {
33
33
  (function(n, s) {
34
- t.exports = s();
35
- })(dt, function() {
36
- var n = function(a, r) {
37
- if (r = r || {}, typeof a != "function")
34
+ e.exports = s();
35
+ })(wn, function() {
36
+ var n = function(o, r) {
37
+ if (r = r || {}, typeof o != "function")
38
38
  throw new i("fetch must be a function");
39
39
  if (typeof r != "object")
40
40
  throw new i("defaults must be an object");
@@ -44,615 +44,615 @@ var He = { exports: {} };
44
44
  throw new i("retryDelay must be a positive integer or a function returning a positive integer");
45
45
  if (r.retryOn !== void 0 && !Array.isArray(r.retryOn) && typeof r.retryOn != "function")
46
46
  throw new i("retryOn property expects an array or function");
47
- var o = {
47
+ var a = {
48
48
  retries: 3,
49
49
  retryDelay: 1e3,
50
50
  retryOn: []
51
51
  };
52
- return r = Object.assign(o, r), function(u, c) {
53
- var l = r.retries, d = r.retryDelay, m = r.retryOn;
52
+ return r = Object.assign(a, r), function(f, c) {
53
+ var d = r.retries, g = r.retryDelay, w = r.retryOn;
54
54
  if (c && c.retries !== void 0)
55
55
  if (s(c.retries))
56
- l = c.retries;
56
+ d = c.retries;
57
57
  else
58
58
  throw new i("retries must be a positive integer");
59
59
  if (c && c.retryDelay !== void 0)
60
60
  if (s(c.retryDelay) || typeof c.retryDelay == "function")
61
- d = c.retryDelay;
61
+ g = c.retryDelay;
62
62
  else
63
63
  throw new i("retryDelay must be a positive integer or a function returning a positive integer");
64
64
  if (c && c.retryOn)
65
65
  if (Array.isArray(c.retryOn) || typeof c.retryOn == "function")
66
- m = c.retryOn;
66
+ w = c.retryOn;
67
67
  else
68
68
  throw new i("retryOn property expects an array or function");
69
- return new Promise(function(_, M) {
70
- var h = function(v) {
71
- var w = typeof Request < "u" && u instanceof Request ? u.clone() : u;
72
- a(w, c).then(function(S) {
73
- if (Array.isArray(m) && m.indexOf(S.status) === -1)
74
- _(S);
75
- else if (typeof m == "function")
69
+ return new Promise(function(y, O) {
70
+ var v = function(b) {
71
+ var S = typeof Request < "u" && f instanceof Request ? f.clone() : f;
72
+ o(S, c).then(function(M) {
73
+ if (Array.isArray(w) && w.indexOf(M.status) === -1)
74
+ y(M);
75
+ else if (typeof w == "function")
76
76
  try {
77
- return Promise.resolve(m(v, null, S)).then(function(p) {
78
- p ? O(v, null, S) : _(S);
79
- }).catch(M);
80
- } catch (p) {
81
- M(p);
77
+ return Promise.resolve(w(b, null, M)).then(function(R) {
78
+ R ? x(b, null, M) : y(M);
79
+ }).catch(O);
80
+ } catch (R) {
81
+ O(R);
82
82
  }
83
83
  else
84
- v < l ? O(v, null, S) : _(S);
85
- }).catch(function(S) {
86
- if (typeof m == "function")
84
+ b < d ? x(b, null, M) : y(M);
85
+ }).catch(function(M) {
86
+ if (typeof w == "function")
87
87
  try {
88
- Promise.resolve(m(v, S, null)).then(function(p) {
89
- p ? O(v, S, null) : M(S);
90
- }).catch(function(p) {
91
- M(p);
88
+ Promise.resolve(w(b, M, null)).then(function(R) {
89
+ R ? x(b, M, null) : O(M);
90
+ }).catch(function(R) {
91
+ O(R);
92
92
  });
93
- } catch (p) {
94
- M(p);
93
+ } catch (R) {
94
+ O(R);
95
95
  }
96
96
  else
97
- v < l ? O(v, S, null) : M(S);
97
+ b < d ? x(b, M, null) : O(M);
98
98
  });
99
99
  };
100
- function O(v, w, S) {
101
- var p = typeof d == "function" ? d(v, w, S) : d;
100
+ function x(b, S, M) {
101
+ var R = typeof g == "function" ? g(b, S, M) : g;
102
102
  setTimeout(function() {
103
- h(++v);
104
- }, p);
103
+ v(++b);
104
+ }, R);
105
105
  }
106
- h(0);
106
+ v(0);
107
107
  });
108
108
  };
109
109
  };
110
- function s(a) {
111
- return Number.isInteger(a) && a >= 0;
110
+ function s(o) {
111
+ return Number.isInteger(o) && o >= 0;
112
112
  }
113
- function i(a) {
114
- this.name = "ArgumentError", this.message = a;
113
+ function i(o) {
114
+ this.name = "ArgumentError", this.message = o;
115
115
  }
116
116
  return n;
117
117
  });
118
- })(He);
119
- var mt = He.exports;
120
- const Oe = /* @__PURE__ */ We(mt), I = {
118
+ })(Gt);
119
+ var Rn = Gt.exports;
120
+ const pt = /* @__PURE__ */ lt(Rn), U = {
121
121
  Remove: "remove",
122
122
  Replace: "replace",
123
123
  Add: "add"
124
- }, qe = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), yt = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ae = Symbol.iterator, C = {
124
+ }, Vt = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), An = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Ne = Symbol.iterator, Y = {
125
125
  mutable: "mutable",
126
126
  immutable: "immutable"
127
- }, Ie = {};
128
- function ee(t, e) {
129
- return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
127
+ }, ht = {};
128
+ function Me(e, t) {
129
+ return e instanceof Map ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
130
130
  }
131
- function ke(t, e) {
132
- if (e in t) {
133
- let n = Reflect.getPrototypeOf(t);
131
+ function $t(e, t) {
132
+ if (t in e) {
133
+ let n = Reflect.getPrototypeOf(e);
134
134
  for (; n; ) {
135
- const s = Reflect.getOwnPropertyDescriptor(n, e);
135
+ const s = Reflect.getOwnPropertyDescriptor(n, t);
136
136
  if (s)
137
137
  return s;
138
138
  n = Reflect.getPrototypeOf(n);
139
139
  }
140
140
  }
141
141
  }
142
- function D(t) {
143
- var e;
144
- return (e = t.copy) !== null && e !== void 0 ? e : t.original;
142
+ function q(e) {
143
+ var t;
144
+ return (t = e.copy) !== null && t !== void 0 ? t : e.original;
145
145
  }
146
- function H(t) {
147
- return !!b(t);
146
+ function ge(e) {
147
+ return !!$(e);
148
148
  }
149
- function b(t) {
150
- return typeof t != "object" ? null : t == null ? void 0 : t[qe];
149
+ function $(e) {
150
+ return typeof e != "object" ? null : e == null ? void 0 : e[Vt];
151
151
  }
152
- function Se(t) {
153
- var e;
154
- const n = b(t);
155
- return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
152
+ function dt(e) {
153
+ var t;
154
+ const n = $(e);
155
+ return n ? (t = n.copy) !== null && t !== void 0 ? t : n.original : e;
156
156
  }
157
- function P(t, e) {
158
- if (!t || typeof t != "object")
157
+ function ee(e, t) {
158
+ if (!e || typeof e != "object")
159
159
  return !1;
160
160
  let n;
161
- return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, C)) === C.immutable || typeof n == "function");
161
+ return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!(t != null && t.mark) && ((n = t.mark(e, Y)) === Y.immutable || typeof n == "function");
162
162
  }
163
- function Ge(t, e = []) {
164
- if (Object.hasOwnProperty.call(t, "key")) {
165
- const n = t.parent.copy, s = b(F(n, t.key));
166
- if (s !== null && (s == null ? void 0 : s.original) !== t.original)
163
+ function Kt(e, t = []) {
164
+ if (Object.hasOwnProperty.call(e, "key")) {
165
+ const n = e.parent.copy, s = $(le(n, e.key));
166
+ if (s !== null && (s == null ? void 0 : s.original) !== e.original)
167
167
  return null;
168
- const i = t.parent.type === 3, a = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
169
- if (!(i && n.size > a || ee(n, a)))
168
+ const i = e.parent.type === 3, o = i ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
169
+ if (!(i && n.size > o || Me(n, o)))
170
170
  return null;
171
- e.push(a);
171
+ t.push(o);
172
172
  }
173
- if (t.parent)
174
- return Ge(t.parent, e);
175
- e.reverse();
173
+ if (e.parent)
174
+ return Kt(e.parent, t);
175
+ t.reverse();
176
176
  try {
177
- _t(t.copy, e);
177
+ Sn(e.copy, t);
178
178
  } catch {
179
179
  return null;
180
180
  }
181
- return e;
181
+ return t;
182
182
  }
183
- function q(t) {
184
- return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
183
+ function be(e) {
184
+ return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
185
185
  }
186
- function F(t, e) {
187
- return q(t) === 2 ? t.get(e) : t[e];
186
+ function le(e, t) {
187
+ return be(e) === 2 ? e.get(t) : e[t];
188
188
  }
189
- function ie(t, e, n) {
190
- q(t) === 2 ? t.set(e, n) : t[e] = n;
189
+ function xe(e, t, n) {
190
+ be(e) === 2 ? e.set(t, n) : e[t] = n;
191
191
  }
192
- function pe(t, e) {
193
- const n = b(t);
194
- return (n ? D(n) : t)[e];
192
+ function qe(e, t) {
193
+ const n = $(e);
194
+ return (n ? q(n) : e)[t];
195
195
  }
196
- function k(t, e) {
197
- return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
196
+ function fe(e, t) {
197
+ return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
198
198
  }
199
- function me(t) {
200
- if (t)
201
- for (; t.finalities.revoke.length > 0; )
202
- t.finalities.revoke.pop()();
199
+ function nt(e) {
200
+ if (e)
201
+ for (; e.finalities.revoke.length > 0; )
202
+ e.finalities.revoke.pop()();
203
203
  }
204
- function W(t, e) {
205
- return e ? t : [""].concat(t).map((n) => {
204
+ function _e(e, t) {
205
+ return t ? e : [""].concat(e).map((n) => {
206
206
  const s = `${n}`;
207
207
  return s.indexOf("/") === -1 && s.indexOf("~") === -1 ? s : s.replace(/~/g, "~0").replace(/\//g, "~1");
208
208
  }).join("/");
209
209
  }
210
- function _t(t, e) {
211
- for (let n = 0; n < e.length - 1; n += 1) {
212
- const s = e[n];
213
- if (t = F(q(t) === 3 ? Array.from(t) : t, s), typeof t != "object")
214
- throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
210
+ function Sn(e, t) {
211
+ for (let n = 0; n < t.length - 1; n += 1) {
212
+ const s = t[n];
213
+ if (e = le(be(e) === 3 ? Array.from(e) : e, s), typeof e != "object")
214
+ throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
215
215
  }
216
- return t;
216
+ return e;
217
217
  }
218
- function gt(t) {
219
- const e = Object.create(Object.getPrototypeOf(t));
220
- return Reflect.ownKeys(t).forEach((n) => {
221
- let s = Reflect.getOwnPropertyDescriptor(t, n);
218
+ function On(e) {
219
+ const t = Object.create(Object.getPrototypeOf(e));
220
+ return Reflect.ownKeys(e).forEach((n) => {
221
+ let s = Reflect.getOwnPropertyDescriptor(e, n);
222
222
  if (s.enumerable && s.configurable && s.writable) {
223
- e[n] = t[n];
223
+ t[n] = e[n];
224
224
  return;
225
225
  }
226
226
  s.writable || (s.writable = !0, s.configurable = !0), (s.get || s.set) && (s = {
227
227
  configurable: !0,
228
228
  writable: !0,
229
229
  enumerable: s.enumerable,
230
- value: t[n]
231
- }), Reflect.defineProperty(e, n, s);
232
- }), e;
230
+ value: e[n]
231
+ }), Reflect.defineProperty(t, n, s);
232
+ }), t;
233
233
  }
234
- const bt = Object.prototype.propertyIsEnumerable;
235
- function Ke(t, e) {
234
+ const En = Object.prototype.propertyIsEnumerable;
235
+ function Wt(e, t) {
236
236
  let n;
237
- if (Array.isArray(t))
238
- return Array.prototype.concat.call(t);
239
- if (t instanceof Set)
240
- return new Set(t.values());
241
- if (t instanceof Map)
242
- return new Map(t);
243
- if (e != null && e.mark && (n = e.mark(t, C), n !== void 0) && n !== C.mutable) {
244
- if (n === C.immutable)
245
- return gt(t);
237
+ if (Array.isArray(e))
238
+ return Array.prototype.concat.call(e);
239
+ if (e instanceof Set)
240
+ return new Set(e.values());
241
+ if (e instanceof Map)
242
+ return new Map(e);
243
+ if (t != null && t.mark && (n = t.mark(e, Y), n !== void 0) && n !== Y.mutable) {
244
+ if (n === Y.immutable)
245
+ return On(e);
246
246
  if (typeof n == "function") {
247
- if (e.enablePatches || e.enableAutoFreeze)
247
+ if (t.enablePatches || t.enableAutoFreeze)
248
248
  throw new Error("You can't use mark and patches or auto freeze together.");
249
249
  return n();
250
250
  }
251
251
  throw new Error(`Unsupported mark result: ${n}`);
252
- } else if (typeof t == "object" && Object.getPrototypeOf(t) === Object.prototype) {
252
+ } else if (typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype) {
253
253
  const s = {};
254
- return Object.keys(t).forEach((i) => {
255
- s[i] = t[i];
256
- }), Object.getOwnPropertySymbols(t).forEach((i) => {
257
- bt.call(t, i) && (s[i] = t[i]);
254
+ return Object.keys(e).forEach((i) => {
255
+ s[i] = e[i];
256
+ }), Object.getOwnPropertySymbols(e).forEach((i) => {
257
+ En.call(e, i) && (s[i] = e[i]);
258
258
  }), s;
259
259
  } else
260
260
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
261
261
  }
262
- function A(t) {
263
- t.copy || (t.copy = Ke(t.original, t.options));
262
+ function J(e) {
263
+ e.copy || (e.copy = Wt(e.original, e.options));
264
264
  }
265
- function Q(t) {
266
- if (!P(t))
267
- return Se(t);
268
- if (Array.isArray(t))
269
- return t.map(Q);
270
- if (t instanceof Map)
271
- return new Map(Array.from(t.entries()).map(([n, s]) => [n, Q(s)]));
272
- if (t instanceof Set)
273
- return new Set(Array.from(t).map(Q));
274
- const e = Object.create(Object.getPrototypeOf(t));
275
- for (const n in t)
276
- e[n] = Q(t[n]);
277
- return e;
265
+ function Se(e) {
266
+ if (!ee(e))
267
+ return dt(e);
268
+ if (Array.isArray(e))
269
+ return e.map(Se);
270
+ if (e instanceof Map)
271
+ return new Map(Array.from(e.entries()).map(([n, s]) => [n, Se(s)]));
272
+ if (e instanceof Set)
273
+ return new Set(Array.from(e).map(Se));
274
+ const t = Object.create(Object.getPrototypeOf(e));
275
+ for (const n in e)
276
+ t[n] = Se(e[n]);
277
+ return t;
278
278
  }
279
- function fe(t) {
280
- return H(t) ? Q(t) : t;
279
+ function je(e) {
280
+ return ge(e) ? Se(e) : e;
281
281
  }
282
- function T(t) {
283
- var e;
284
- t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && T(t.parent));
282
+ function re(e) {
283
+ var t;
284
+ e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && re(e.parent));
285
285
  }
286
- function Fe() {
286
+ function xt() {
287
287
  throw new Error("Cannot modify frozen object");
288
288
  }
289
- function G(t, e, n, s, i) {
289
+ function we(e, t, n, s, i) {
290
290
  {
291
291
  n = n ?? /* @__PURE__ */ new WeakMap(), s = s ?? [], i = i ?? [];
292
- const r = n.has(t) ? n.get(t) : t;
292
+ const r = n.has(e) ? n.get(e) : e;
293
293
  if (s.length > 0) {
294
- const o = s.indexOf(r);
295
- if (r && typeof r == "object" && o !== -1)
296
- throw s[0] === r ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, o).map((f, u) => {
297
- if (typeof f == "symbol")
298
- return `[${f.toString()}]`;
299
- const c = s[u];
300
- return typeof f == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(f) : f;
294
+ const a = s.indexOf(r);
295
+ if (r && typeof r == "object" && a !== -1)
296
+ throw s[0] === r ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, a).map((u, f) => {
297
+ if (typeof u == "symbol")
298
+ return `[${u.toString()}]`;
299
+ const c = s[f];
300
+ return typeof u == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(u) : u;
301
301
  }).join("/")}`);
302
- s.push(r), i.push(e);
302
+ s.push(r), i.push(t);
303
303
  } else
304
304
  s.push(r);
305
305
  }
306
- if (Object.isFrozen(t) || H(t)) {
306
+ if (Object.isFrozen(e) || ge(e)) {
307
307
  s.pop(), i.pop();
308
308
  return;
309
309
  }
310
- switch (q(t)) {
310
+ switch (be(e)) {
311
311
  case 2:
312
- for (const [o, f] of t)
313
- G(o, o, n, s, i), G(f, o, n, s, i);
314
- t.set = t.clear = t.delete = Fe;
312
+ for (const [a, u] of e)
313
+ we(a, a, n, s, i), we(u, a, n, s, i);
314
+ e.set = e.clear = e.delete = xt;
315
315
  break;
316
316
  case 3:
317
- for (const o of t)
318
- G(o, o, n, s, i);
319
- t.add = t.clear = t.delete = Fe;
317
+ for (const a of e)
318
+ we(a, a, n, s, i);
319
+ e.add = e.clear = e.delete = xt;
320
320
  break;
321
321
  case 1:
322
- Object.freeze(t);
322
+ Object.freeze(e);
323
323
  let r = 0;
324
- for (const o of t)
325
- G(o, r, n, s, i), r += 1;
324
+ for (const a of e)
325
+ we(a, r, n, s, i), r += 1;
326
326
  break;
327
327
  default:
328
- Object.freeze(t), Object.keys(t).forEach((o) => {
329
- const f = t[o];
330
- G(f, o, n, s, i);
328
+ Object.freeze(e), Object.keys(e).forEach((a) => {
329
+ const u = e[a];
330
+ we(u, a, n, s, i);
331
331
  });
332
332
  }
333
333
  s.pop(), i.pop();
334
334
  }
335
- function Re(t, e) {
336
- const n = q(t);
335
+ function mt(e, t) {
336
+ const n = be(e);
337
337
  if (n === 0)
338
- Reflect.ownKeys(t).forEach((s) => {
339
- e(s, t[s], t);
338
+ Reflect.ownKeys(e).forEach((s) => {
339
+ t(s, e[s], e);
340
340
  });
341
341
  else if (n === 1) {
342
342
  let s = 0;
343
- for (const i of t)
344
- e(s, i, t), s += 1;
343
+ for (const i of e)
344
+ t(s, i, e), s += 1;
345
345
  } else
346
- t.forEach((s, i) => e(i, s, t));
346
+ e.forEach((s, i) => t(i, s, e));
347
347
  }
348
- function Ye(t, e, n) {
349
- if (H(t) || !P(t, n) || e.has(t) || Object.isFrozen(t))
348
+ function Jt(e, t, n) {
349
+ if (ge(e) || !ee(e, n) || t.has(e) || Object.isFrozen(e))
350
350
  return;
351
- const s = t instanceof Set, i = s ? /* @__PURE__ */ new Map() : void 0;
352
- if (e.add(t), Re(t, (a, r) => {
353
- var o;
354
- if (H(r)) {
355
- const f = b(r);
356
- A(f);
357
- const u = !((o = f.assignedMap) === null || o === void 0) && o.size || f.operated ? f.copy : f.original;
358
- ie(s ? i : t, a, u);
351
+ const s = e instanceof Set, i = s ? /* @__PURE__ */ new Map() : void 0;
352
+ if (t.add(e), mt(e, (o, r) => {
353
+ var a;
354
+ if (ge(r)) {
355
+ const u = $(r);
356
+ J(u);
357
+ const f = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
358
+ xe(s ? i : e, o, f);
359
359
  } else
360
- Ye(r, e, n);
360
+ Jt(r, t, n);
361
361
  }), i) {
362
- const a = t, r = Array.from(a);
363
- a.clear(), r.forEach((o) => {
364
- a.add(i.has(o) ? i.get(o) : o);
362
+ const o = e, r = Array.from(o);
363
+ o.clear(), r.forEach((a) => {
364
+ o.add(i.has(a) ? i.get(a) : a);
365
365
  });
366
366
  }
367
367
  }
368
- function wt(t, e) {
369
- const n = t.type === 3 ? t.setMap : t.copy;
370
- t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && Ye(F(n, e), t.finalities.handledSet, t.options);
368
+ function Mn(e, t) {
369
+ const n = e.type === 3 ? e.setMap : e.copy;
370
+ e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && Jt(le(n, t), e.finalities.handledSet, e.options);
371
371
  }
372
- function ye(t) {
373
- t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
374
- t.copy.add(Se(e));
372
+ function st(e) {
373
+ e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
374
+ e.copy.add(dt(t));
375
375
  }));
376
376
  }
377
- function _e(t, e, n, s) {
378
- if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
377
+ function it(e, t, n, s) {
378
+ if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
379
379
  if (n && s) {
380
- const a = Ge(t);
381
- a && e(t, a, n, s);
380
+ const o = Kt(e);
381
+ o && t(e, o, n, s);
382
382
  }
383
- t.finalized = !0;
383
+ e.finalized = !0;
384
384
  }
385
385
  }
386
- function Ee(t, e, n, s) {
387
- const i = b(n);
388
- i && (i.callbacks || (i.callbacks = []), i.callbacks.push((a, r) => {
389
- var o;
390
- const f = t.type === 3 ? t.setMap : t.copy;
391
- if (k(F(f, e), n)) {
392
- let u = i.original;
393
- i.copy && (u = i.copy), ye(t), _e(t, s, 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)), ie(f, e, u);
394
- }
395
- }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), P(n, t.options) && t.finalities.draft.push(() => {
396
- const a = t.type === 3 ? t.setMap : t.copy;
397
- k(F(a, e), n) && wt(t, e);
386
+ function yt(e, t, n, s) {
387
+ const i = $(n);
388
+ i && (i.callbacks || (i.callbacks = []), i.callbacks.push((o, r) => {
389
+ var a;
390
+ const u = e.type === 3 ? e.setMap : e.copy;
391
+ if (fe(le(u, t), n)) {
392
+ let f = i.original;
393
+ i.copy && (f = i.copy), st(e), it(e, s, o, r), e.options.enableAutoFreeze && (e.options.updatedValues = (a = e.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(f, i.original)), xe(u, t, f);
394
+ }
395
+ }), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), ee(n, e.options) && e.finalities.draft.push(() => {
396
+ const o = e.type === 3 ? e.setMap : e.copy;
397
+ fe(le(o, t), n) && Mn(e, t);
398
398
  });
399
399
  }
400
- function vt(t, e, n, s, i) {
401
- let { original: a, assignedMap: r, options: o } = t, f = t.copy;
402
- f.length < a.length && ([a, f] = [f, a], [n, s] = [s, n]);
403
- for (let u = 0; u < a.length; u += 1)
404
- if (r.get(u.toString()) && f[u] !== a[u]) {
405
- const c = e.concat([u]), l = W(c, i);
400
+ function In(e, t, n, s, i) {
401
+ let { original: o, assignedMap: r, options: a } = e, u = e.copy;
402
+ u.length < o.length && ([o, u] = [u, o], [n, s] = [s, n]);
403
+ for (let f = 0; f < o.length; f += 1)
404
+ if (r.get(f.toString()) && u[f] !== o[f]) {
405
+ const c = t.concat([f]), d = _e(c, i);
406
406
  n.push({
407
- op: I.Replace,
408
- path: l,
407
+ op: U.Replace,
408
+ path: d,
409
409
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
410
- value: fe(f[u])
410
+ value: je(u[f])
411
411
  }), s.push({
412
- op: I.Replace,
413
- path: l,
412
+ op: U.Replace,
413
+ path: d,
414
414
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
415
- value: fe(a[u])
415
+ value: je(o[f])
416
416
  });
417
417
  }
418
- for (let u = a.length; u < f.length; u += 1) {
419
- const c = e.concat([u]), l = W(c, i);
418
+ for (let f = o.length; f < u.length; f += 1) {
419
+ const c = t.concat([f]), d = _e(c, i);
420
420
  n.push({
421
- op: I.Add,
422
- path: l,
421
+ op: U.Add,
422
+ path: d,
423
423
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
424
- value: fe(f[u])
424
+ value: je(u[f])
425
425
  });
426
426
  }
427
- if (a.length < f.length) {
428
- const { arrayLengthAssignment: u = !0 } = o.enablePatches;
429
- if (u) {
430
- const c = e.concat(["length"]), l = W(c, i);
427
+ if (o.length < u.length) {
428
+ const { arrayLengthAssignment: f = !0 } = a.enablePatches;
429
+ if (f) {
430
+ const c = t.concat(["length"]), d = _e(c, i);
431
431
  s.push({
432
- op: I.Replace,
433
- path: l,
434
- value: a.length
432
+ op: U.Replace,
433
+ path: d,
434
+ value: o.length
435
435
  });
436
436
  } else
437
- for (let c = f.length; a.length < c; c -= 1) {
438
- const l = e.concat([c - 1]), d = W(l, i);
437
+ for (let c = u.length; o.length < c; c -= 1) {
438
+ const d = t.concat([c - 1]), g = _e(d, i);
439
439
  s.push({
440
- op: I.Remove,
441
- path: d
440
+ op: U.Remove,
441
+ path: g
442
442
  });
443
443
  }
444
444
  }
445
445
  }
446
- function Mt({ original: t, copy: e, assignedMap: n }, s, i, a, r) {
447
- n.forEach((o, f) => {
448
- const u = F(t, f), c = fe(F(e, f)), l = o ? ee(t, f) ? I.Replace : I.Add : I.Remove;
449
- if (k(u, c) && l === I.Replace)
446
+ function Cn({ original: e, copy: t, assignedMap: n }, s, i, o, r) {
447
+ n.forEach((a, u) => {
448
+ const f = le(e, u), c = je(le(t, u)), d = a ? Me(e, u) ? U.Replace : U.Add : U.Remove;
449
+ if (fe(f, c) && d === U.Replace)
450
450
  return;
451
- const d = s.concat(f), m = W(d, r);
452
- 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 });
451
+ const g = s.concat(u), w = _e(g, r);
452
+ i.push(d === U.Remove ? { op: d, path: w } : { op: d, path: w, value: c }), o.push(d === U.Add ? { op: U.Remove, path: w } : d === U.Remove ? { op: U.Add, path: w, value: f } : { op: U.Replace, path: w, value: f });
453
453
  });
454
454
  }
455
- function Ot({ original: t, copy: e }, n, s, i, a) {
455
+ function $n({ original: e, copy: t }, n, s, i, o) {
456
456
  let r = 0;
457
- t.forEach((o) => {
458
- if (!e.has(o)) {
459
- const f = n.concat([r]), u = W(f, a);
457
+ e.forEach((a) => {
458
+ if (!t.has(a)) {
459
+ const u = n.concat([r]), f = _e(u, o);
460
460
  s.push({
461
- op: I.Remove,
462
- path: u,
463
- value: o
461
+ op: U.Remove,
462
+ path: f,
463
+ value: a
464
464
  }), i.unshift({
465
- op: I.Add,
466
- path: u,
467
- value: o
465
+ op: U.Add,
466
+ path: f,
467
+ value: a
468
468
  });
469
469
  }
470
470
  r += 1;
471
- }), r = 0, e.forEach((o) => {
472
- if (!t.has(o)) {
473
- const f = n.concat([r]), u = W(f, a);
471
+ }), r = 0, t.forEach((a) => {
472
+ if (!e.has(a)) {
473
+ const u = n.concat([r]), f = _e(u, o);
474
474
  s.push({
475
- op: I.Add,
476
- path: u,
477
- value: o
475
+ op: U.Add,
476
+ path: f,
477
+ value: a
478
478
  }), i.unshift({
479
- op: I.Remove,
480
- path: u,
481
- value: o
479
+ op: U.Remove,
480
+ path: f,
481
+ value: a
482
482
  });
483
483
  }
484
484
  r += 1;
485
485
  });
486
486
  }
487
- function ne(t, e, n, s) {
488
- const { pathAsArray: i = !0 } = t.options.enablePatches;
489
- switch (t.type) {
487
+ function Ce(e, t, n, s) {
488
+ const { pathAsArray: i = !0 } = e.options.enablePatches;
489
+ switch (e.type) {
490
490
  case 0:
491
491
  case 2:
492
- return Mt(t, e, n, s, i);
492
+ return Cn(e, t, n, s, i);
493
493
  case 1:
494
- return vt(t, e, n, s, i);
494
+ return In(e, t, n, s, i);
495
495
  case 3:
496
- return Ot(t, e, n, s, i);
496
+ return $n(e, t, n, s, i);
497
497
  }
498
498
  }
499
- let It = !1;
500
- const ue = (t, e, n = !1) => {
501
- if (typeof t == "object" && t !== null && (!P(t, e) || n) && !It)
499
+ let xn = !1;
500
+ const Ue = (e, t, n = !1) => {
501
+ if (typeof e == "object" && e !== null && (!ee(e, t) || n) && !xn)
502
502
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
503
- }, ge = {
503
+ }, rt = {
504
504
  get size() {
505
- return D(b(this)).size;
505
+ return q($(this)).size;
506
506
  },
507
- has(t) {
508
- return D(b(this)).has(t);
507
+ has(e) {
508
+ return q($(this)).has(e);
509
509
  },
510
- set(t, e) {
511
- const n = b(this), s = D(n);
512
- return (!s.has(t) || !k(s.get(t), e)) && (A(n), T(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Ee(n, t, e, ne)), this;
510
+ set(e, t) {
511
+ const n = $(this), s = q(n);
512
+ return (!s.has(e) || !fe(s.get(e), t)) && (J(n), re(n), n.assignedMap.set(e, !0), n.copy.set(e, t), yt(n, e, t, Ce)), this;
513
513
  },
514
- delete(t) {
515
- if (!this.has(t))
514
+ delete(e) {
515
+ if (!this.has(e))
516
516
  return !1;
517
- const e = b(this);
518
- return A(e), T(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
517
+ const t = $(this);
518
+ return J(t), re(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
519
519
  },
520
520
  clear() {
521
- const t = b(this);
521
+ const e = $(this);
522
522
  if (this.size) {
523
- A(t), T(t), t.assignedMap = /* @__PURE__ */ new Map();
524
- for (const [e] of t.original)
525
- t.assignedMap.set(e, !1);
526
- t.copy.clear();
523
+ J(e), re(e), e.assignedMap = /* @__PURE__ */ new Map();
524
+ for (const [t] of e.original)
525
+ e.assignedMap.set(t, !1);
526
+ e.copy.clear();
527
527
  }
528
528
  },
529
- forEach(t, e) {
530
- const n = b(this);
531
- D(n).forEach((s, i) => {
532
- t.call(e, this.get(i), i, this);
529
+ forEach(e, t) {
530
+ const n = $(this);
531
+ q(n).forEach((s, i) => {
532
+ e.call(t, this.get(i), i, this);
533
533
  });
534
534
  },
535
- get(t) {
536
- var e, n;
537
- const s = b(this), i = D(s).get(t), a = ((n = (e = s.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, C)) === C.mutable;
538
- if (s.options.strict && ue(i, s.options, a), a || s.finalized || !P(i, s.options) || i !== s.original.get(t))
535
+ get(e) {
536
+ var t, n;
537
+ const s = $(this), i = q(s).get(e), o = ((n = (t = s.options).mark) === null || n === void 0 ? void 0 : n.call(t, i, Y)) === Y.mutable;
538
+ if (s.options.strict && Ue(i, s.options, o), o || s.finalized || !ee(i, s.options) || i !== s.original.get(e))
539
539
  return i;
540
- const r = Ie.createDraft({
540
+ const r = ht.createDraft({
541
541
  original: i,
542
542
  parentDraft: s,
543
- key: t,
543
+ key: e,
544
544
  finalities: s.finalities,
545
545
  options: s.options
546
546
  });
547
- return A(s), s.copy.set(t, r), r;
547
+ return J(s), s.copy.set(e, r), r;
548
548
  },
549
549
  keys() {
550
- return D(b(this)).keys();
550
+ return q($(this)).keys();
551
551
  },
552
552
  values() {
553
- const t = this.keys();
553
+ const e = this.keys();
554
554
  return {
555
- [ae]: () => this.values(),
555
+ [Ne]: () => this.values(),
556
556
  next: () => {
557
- const e = t.next();
558
- return e.done ? e : {
557
+ const t = e.next();
558
+ return t.done ? t : {
559
559
  done: !1,
560
- value: this.get(e.value)
560
+ value: this.get(t.value)
561
561
  };
562
562
  }
563
563
  };
564
564
  },
565
565
  entries() {
566
- const t = this.keys();
566
+ const e = this.keys();
567
567
  return {
568
- [ae]: () => this.entries(),
568
+ [Ne]: () => this.entries(),
569
569
  next: () => {
570
- const e = t.next();
571
- if (e.done)
572
- return e;
573
- const n = this.get(e.value);
570
+ const t = e.next();
571
+ if (t.done)
572
+ return t;
573
+ const n = this.get(t.value);
574
574
  return {
575
575
  done: !1,
576
- value: [e.value, n]
576
+ value: [t.value, n]
577
577
  };
578
578
  }
579
579
  };
580
580
  },
581
- [ae]() {
581
+ [Ne]() {
582
582
  return this.entries();
583
583
  }
584
- }, St = Reflect.ownKeys(ge), Ne = (t, e, { isValuesIterator: n }) => () => {
584
+ }, Ln = Reflect.ownKeys(rt), Lt = (e, t, { isValuesIterator: n }) => () => {
585
585
  var s, i;
586
- const a = e.next();
587
- if (a.done)
588
- return a;
589
- const r = a.value;
590
- let o = t.setMap.get(r);
591
- const f = b(o), u = ((i = (s = t.options).mark) === null || i === void 0 ? void 0 : i.call(s, o, C)) === C.mutable;
592
- if (t.options.strict && ue(r, t.options, u), !u && !f && P(r, t.options) && !t.finalized && t.original.has(r)) {
593
- const c = Ie.createDraft({
586
+ const o = t.next();
587
+ if (o.done)
588
+ return o;
589
+ const r = o.value;
590
+ let a = e.setMap.get(r);
591
+ const u = $(a), f = ((i = (s = e.options).mark) === null || i === void 0 ? void 0 : i.call(s, a, Y)) === Y.mutable;
592
+ if (e.options.strict && Ue(r, e.options, f), !f && !u && ee(r, e.options) && !e.finalized && e.original.has(r)) {
593
+ const c = ht.createDraft({
594
594
  original: r,
595
- parentDraft: t,
595
+ parentDraft: e,
596
596
  key: r,
597
- finalities: t.finalities,
598
- options: t.options
597
+ finalities: e.finalities,
598
+ options: e.options
599
599
  });
600
- t.setMap.set(r, c), o = c;
600
+ e.setMap.set(r, c), a = c;
601
601
  } else
602
- f && (o = f.proxy);
602
+ u && (a = u.proxy);
603
603
  return {
604
604
  done: !1,
605
- value: n ? o : [o, o]
605
+ value: n ? a : [a, a]
606
606
  };
607
- }, be = {
607
+ }, ot = {
608
608
  get size() {
609
- return b(this).setMap.size;
609
+ return $(this).setMap.size;
610
610
  },
611
- has(t) {
612
- const e = b(this);
613
- if (e.setMap.has(t))
611
+ has(e) {
612
+ const t = $(this);
613
+ if (t.setMap.has(e))
614
614
  return !0;
615
- A(e);
616
- const n = b(t);
617
- return !!(n && e.setMap.has(n.original));
615
+ J(t);
616
+ const n = $(e);
617
+ return !!(n && t.setMap.has(n.original));
618
618
  },
619
- add(t) {
620
- const e = b(this);
621
- return this.has(t) || (A(e), T(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Ee(e, t, t, ne)), this;
619
+ add(e) {
620
+ const t = $(this);
621
+ return this.has(e) || (J(t), re(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), yt(t, e, e, Ce)), this;
622
622
  },
623
- delete(t) {
624
- if (!this.has(t))
623
+ delete(e) {
624
+ if (!this.has(e))
625
625
  return !1;
626
- const e = b(this);
627
- A(e), T(e);
628
- const n = b(t);
629
- return n && e.setMap.has(n.original) ? (e.assignedMap.set(n.original, !1), e.setMap.delete(n.original)) : (!n && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
626
+ const t = $(this);
627
+ J(t), re(t);
628
+ const n = $(e);
629
+ return n && t.setMap.has(n.original) ? (t.assignedMap.set(n.original, !1), t.setMap.delete(n.original)) : (!n && t.setMap.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.setMap.delete(e));
630
630
  },
631
631
  clear() {
632
632
  if (!this.size)
633
633
  return;
634
- const t = b(this);
635
- A(t), T(t);
636
- for (const e of t.original)
637
- t.assignedMap.set(e, !1);
638
- t.setMap.clear();
634
+ const e = $(this);
635
+ J(e), re(e);
636
+ for (const t of e.original)
637
+ e.assignedMap.set(t, !1);
638
+ e.setMap.clear();
639
639
  },
640
640
  values() {
641
- const t = b(this);
642
- A(t);
643
- const e = t.setMap.keys();
641
+ const e = $(this);
642
+ J(e);
643
+ const t = e.setMap.keys();
644
644
  return {
645
645
  [Symbol.iterator]: () => this.values(),
646
- next: Ne(t, e, { isValuesIterator: !0 })
646
+ next: Lt(e, t, { isValuesIterator: !0 })
647
647
  };
648
648
  },
649
649
  entries() {
650
- const t = b(this);
651
- A(t);
652
- const e = t.setMap.keys();
650
+ const e = $(this);
651
+ J(e);
652
+ const t = e.setMap.keys();
653
653
  return {
654
654
  [Symbol.iterator]: () => this.entries(),
655
- next: Ne(t, e, {
655
+ next: Lt(e, t, {
656
656
  isValuesIterator: !1
657
657
  })
658
658
  };
@@ -660,99 +660,99 @@ const ue = (t, e, n = !1) => {
660
660
  keys() {
661
661
  return this.values();
662
662
  },
663
- [ae]() {
663
+ [Ne]() {
664
664
  return this.values();
665
665
  },
666
- forEach(t, e) {
666
+ forEach(e, t) {
667
667
  const n = this.values();
668
668
  let s = n.next();
669
669
  for (; !s.done; )
670
- t.call(e, s.value, s.value, this), s = n.next();
670
+ e.call(t, s.value, s.value, this), s = n.next();
671
671
  }
672
- }, Rt = Reflect.ownKeys(be), Xe = /* @__PURE__ */ new WeakSet(), Qe = {
673
- get(t, e, n) {
672
+ }, Tn = Reflect.ownKeys(ot), Xt = /* @__PURE__ */ new WeakSet(), qt = {
673
+ get(e, t, n) {
674
674
  var s, i;
675
- const a = (s = t.copy) === null || s === void 0 ? void 0 : s[e];
676
- if (a && Xe.has(a))
677
- return a;
678
- if (e === qe)
679
- return t;
675
+ const o = (s = e.copy) === null || s === void 0 ? void 0 : s[t];
676
+ if (o && Xt.has(o))
677
+ return o;
678
+ if (t === Vt)
679
+ return e;
680
680
  let r;
681
- if (t.options.mark) {
682
- const u = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
683
- if (r = t.options.mark(u, C), r === C.mutable)
684
- return t.options.strict && ue(u, t.options, !0), u;
685
- }
686
- const o = D(t);
687
- if (o instanceof Map && St.includes(e)) {
688
- if (e === "size")
689
- return Object.getOwnPropertyDescriptor(ge, "size").get.call(t.proxy);
690
- const u = ge[e];
691
- if (u)
692
- return u.bind(t.proxy);
693
- }
694
- if (o instanceof Set && Rt.includes(e)) {
695
- if (e === "size")
696
- return Object.getOwnPropertyDescriptor(be, "size").get.call(t.proxy);
697
- const u = be[e];
698
- if (u)
699
- return u.bind(t.proxy);
700
- }
701
- if (!ee(o, e)) {
702
- const u = ke(o, e);
703
- return u ? "value" in u ? u.value : (
681
+ if (e.options.mark) {
682
+ const f = t === "size" && (e.original instanceof Map || e.original instanceof Set) ? Reflect.get(e.original, t) : Reflect.get(e.original, t, n);
683
+ if (r = e.options.mark(f, Y), r === Y.mutable)
684
+ return e.options.strict && Ue(f, e.options, !0), f;
685
+ }
686
+ const a = q(e);
687
+ if (a instanceof Map && Ln.includes(t)) {
688
+ if (t === "size")
689
+ return Object.getOwnPropertyDescriptor(rt, "size").get.call(e.proxy);
690
+ const f = rt[t];
691
+ if (f)
692
+ return f.bind(e.proxy);
693
+ }
694
+ if (a instanceof Set && Tn.includes(t)) {
695
+ if (t === "size")
696
+ return Object.getOwnPropertyDescriptor(ot, "size").get.call(e.proxy);
697
+ const f = ot[t];
698
+ if (f)
699
+ return f.bind(e.proxy);
700
+ }
701
+ if (!Me(a, t)) {
702
+ const f = $t(a, t);
703
+ return f ? "value" in f ? f.value : (
704
704
  // !case: support for getter
705
- (i = u.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
705
+ (i = f.get) === null || i === void 0 ? void 0 : i.call(e.proxy)
706
706
  ) : void 0;
707
707
  }
708
- const f = o[e];
709
- if (t.options.strict && ue(f, t.options), t.finalized || !P(f, t.options))
710
- return f;
711
- if (f === pe(t.original, e)) {
712
- if (A(t), t.copy[e] = Ae({
713
- original: t.original[e],
714
- parentDraft: t,
715
- key: t.type === 1 ? Number(e) : e,
716
- finalities: t.finalities,
717
- options: t.options
708
+ const u = a[t];
709
+ if (e.options.strict && Ue(u, e.options), e.finalized || !ee(u, e.options))
710
+ return u;
711
+ if (u === qe(e.original, t)) {
712
+ if (J(e), e.copy[t] = _t({
713
+ original: e.original[t],
714
+ parentDraft: e,
715
+ key: e.type === 1 ? Number(t) : t,
716
+ finalities: e.finalities,
717
+ options: e.options
718
718
  }), typeof r == "function") {
719
- const u = b(t.copy[e]);
720
- return A(u), T(u), u.copy;
719
+ const f = $(e.copy[t]);
720
+ return J(f), re(f), f.copy;
721
721
  }
722
- return t.copy[e];
722
+ return e.copy[t];
723
723
  }
724
- return f;
724
+ return u;
725
725
  },
726
- set(t, e, n) {
726
+ set(e, t, n) {
727
727
  var s;
728
- if (t.type === 3 || t.type === 2)
728
+ if (e.type === 3 || e.type === 2)
729
729
  throw new Error("Map/Set draft does not support any property assignment.");
730
730
  let i;
731
- if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
731
+ if (e.type === 1 && t !== "length" && !(Number.isInteger(i = Number(t)) && i >= 0 && (t === 0 || i === 0 || String(i) === String(t))))
732
732
  throw new Error("Only supports setting array indices and the 'length' property.");
733
- const a = ke(D(t), e);
734
- if (a != null && a.set)
735
- return a.set.call(t.proxy, n), !0;
736
- const r = pe(D(t), e), o = b(r);
737
- return o && k(o.original, n) ? (t.copy[e] = n, t.assignedMap = (s = t.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (k(n, r) && (n !== void 0 || ee(t.original, e)) || (A(t), T(t), ee(t.original, e) && k(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Ee(t, e, n, ne)), !0);
733
+ const o = $t(q(e), t);
734
+ if (o != null && o.set)
735
+ return o.set.call(e.proxy, n), !0;
736
+ const r = qe(q(e), t), a = $(r);
737
+ return a && fe(a.original, n) ? (e.copy[t] = n, e.assignedMap = (s = e.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (fe(n, r) && (n !== void 0 || Me(e.original, t)) || (J(e), re(e), Me(e.original, t) && fe(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, yt(e, t, n, Ce)), !0);
738
738
  },
739
- has(t, e) {
740
- return e in D(t);
739
+ has(e, t) {
740
+ return t in q(e);
741
741
  },
742
- ownKeys(t) {
743
- return Reflect.ownKeys(D(t));
742
+ ownKeys(e) {
743
+ return Reflect.ownKeys(q(e));
744
744
  },
745
- getOwnPropertyDescriptor(t, e) {
746
- const n = D(t), s = Reflect.getOwnPropertyDescriptor(n, e);
745
+ getOwnPropertyDescriptor(e, t) {
746
+ const n = q(e), s = Reflect.getOwnPropertyDescriptor(n, t);
747
747
  return s && {
748
748
  writable: !0,
749
- configurable: t.type !== 1 || e !== "length",
749
+ configurable: e.type !== 1 || t !== "length",
750
750
  enumerable: s.enumerable,
751
- value: n[e]
751
+ value: n[t]
752
752
  };
753
753
  },
754
- getPrototypeOf(t) {
755
- return Reflect.getPrototypeOf(t.original);
754
+ getPrototypeOf(e) {
755
+ return Reflect.getPrototypeOf(e.original);
756
756
  },
757
757
  setPrototypeOf() {
758
758
  throw new Error("Cannot call 'setPrototypeOf()' on drafts");
@@ -760,702 +760,702 @@ const ue = (t, e, n = !1) => {
760
760
  defineProperty() {
761
761
  throw new Error("Cannot call 'defineProperty()' on drafts");
762
762
  },
763
- deleteProperty(t, e) {
763
+ deleteProperty(e, t) {
764
764
  var n;
765
- return t.type === 1 ? Qe.set.call(this, t, e, void 0, t.proxy) : (pe(t.original, e) !== void 0 || e in t.original ? (A(t), T(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
765
+ return e.type === 1 ? qt.set.call(this, e, t, void 0, e.proxy) : (qe(e.original, t) !== void 0 || t in e.original ? (J(e), re(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
766
766
  }
767
767
  };
768
- function Ae(t) {
769
- const { original: e, parentDraft: n, key: s, finalities: i, options: a } = t, r = q(e), o = {
768
+ function _t(e) {
769
+ const { original: t, parentDraft: n, key: s, finalities: i, options: o } = e, r = be(t), a = {
770
770
  type: r,
771
771
  finalized: !1,
772
772
  parent: n,
773
- original: e,
773
+ original: t,
774
774
  copy: null,
775
775
  proxy: null,
776
776
  finalities: i,
777
- options: a,
777
+ options: o,
778
778
  // Mapping of draft Set items to their corresponding draft values.
779
- setMap: r === 3 ? new Map(e.entries()) : void 0
779
+ setMap: r === 3 ? new Map(t.entries()) : void 0
780
780
  };
781
- (s || "key" in t) && (o.key = s);
782
- const { proxy: f, revoke: u } = Proxy.revocable(r === 1 ? Object.assign([], o) : o, Qe);
783
- if (i.revoke.push(u), Xe.add(f), o.proxy = f, n) {
781
+ (s || "key" in e) && (a.key = s);
782
+ const { proxy: u, revoke: f } = Proxy.revocable(r === 1 ? Object.assign([], a) : a, qt);
783
+ if (i.revoke.push(f), Xt.add(u), a.proxy = u, n) {
784
784
  const c = n;
785
- c.finalities.draft.push((l, d) => {
786
- var m, _;
787
- const M = b(f);
788
- let h = c.type === 3 ? c.setMap : c.copy;
789
- const O = F(h, s), v = b(O);
790
- if (v) {
791
- let w = v.original;
792
- v.operated && (w = Se(O)), ye(v), _e(v, ne, l, d), c.options.enableAutoFreeze && (c.options.updatedValues = (m = c.options.updatedValues) !== null && m !== void 0 ? m : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(w, v.original)), ie(h, s, w);
785
+ c.finalities.draft.push((d, g) => {
786
+ var w, y;
787
+ const O = $(u);
788
+ let v = c.type === 3 ? c.setMap : c.copy;
789
+ const x = le(v, s), b = $(x);
790
+ if (b) {
791
+ let S = b.original;
792
+ b.operated && (S = dt(x)), st(b), it(b, Ce, d, g), c.options.enableAutoFreeze && (c.options.updatedValues = (w = c.options.updatedValues) !== null && w !== void 0 ? w : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(S, b.original)), xe(v, s, S);
793
793
  }
794
- (_ = M.callbacks) === null || _ === void 0 || _.forEach((w) => {
795
- w(l, d);
794
+ (y = O.callbacks) === null || y === void 0 || y.forEach((S) => {
795
+ S(d, g);
796
796
  });
797
797
  });
798
798
  } else {
799
- const c = b(f);
800
- c.finalities.draft.push((l, d) => {
801
- ye(c), _e(c, ne, l, d);
799
+ const c = $(u);
800
+ c.finalities.draft.push((d, g) => {
801
+ st(c), it(c, Ce, d, g);
802
802
  });
803
803
  }
804
- return f;
804
+ return u;
805
805
  }
806
- Ie.createDraft = Ae;
807
- function Et(t, e, n, s, i) {
808
- var a;
809
- const r = b(t), o = (a = r == null ? void 0 : r.original) !== null && a !== void 0 ? a : t, f = !!e.length;
806
+ ht.createDraft = _t;
807
+ function Dn(e, t, n, s, i) {
808
+ var o;
809
+ const r = $(e), a = (o = r == null ? void 0 : r.original) !== null && o !== void 0 ? o : e, u = !!t.length;
810
810
  if (r != null && r.operated)
811
811
  for (; r.finalities.draft.length > 0; )
812
812
  r.finalities.draft.pop()(n, s);
813
- const u = f ? e[0] : r ? r.operated ? r.copy : r.original : t;
814
- return r && me(r), i && G(u, u, r == null ? void 0 : r.options.updatedValues), [
815
- u,
816
- n && f ? [{ op: I.Replace, path: [], value: e[0] }] : n,
817
- s && f ? [{ op: I.Replace, path: [], value: o }] : s
813
+ const f = u ? t[0] : r ? r.operated ? r.copy : r.original : e;
814
+ return r && nt(r), i && we(f, f, r == null ? void 0 : r.options.updatedValues), [
815
+ f,
816
+ n && u ? [{ op: U.Replace, path: [], value: t[0] }] : n,
817
+ s && u ? [{ op: U.Replace, path: [], value: a }] : s
818
818
  ];
819
819
  }
820
- function At(t, e) {
820
+ function Pn(e, t) {
821
821
  var n;
822
822
  const s = {
823
823
  draft: [],
824
824
  revoke: [],
825
825
  handledSet: /* @__PURE__ */ new WeakSet()
826
826
  };
827
- let i, a;
828
- e.enablePatches && (i = [], a = []);
829
- const o = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, C)) === C.mutable || !P(t, e) ? t : Ae({
830
- original: t,
827
+ let i, o;
828
+ t.enablePatches && (i = [], o = []);
829
+ const a = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, Y)) === Y.mutable || !ee(e, t) ? e : _t({
830
+ original: e,
831
831
  parentDraft: null,
832
832
  finalities: s,
833
- options: e
833
+ options: t
834
834
  });
835
835
  return [
836
- o,
837
- (f = []) => {
838
- const [u, c, l] = Et(o, f, i, a, e.enableAutoFreeze);
839
- return e.enablePatches ? [u, c, l] : u;
836
+ a,
837
+ (u = []) => {
838
+ const [f, c, d] = Dn(a, u, i, o, t.enableAutoFreeze);
839
+ return t.enablePatches ? [f, c, d] : f;
840
840
  }
841
841
  ];
842
842
  }
843
- function we(t) {
844
- const { rootDraft: e, value: n, useRawReturn: s = !1, isRoot: i = !0 } = t;
845
- Re(n, (a, r, o) => {
846
- const f = b(r);
847
- if (f && e && f.finalities === e.finalities) {
848
- t.isContainDraft = !0;
849
- const u = f.original;
850
- if (o instanceof Set) {
851
- const c = Array.from(o);
852
- o.clear(), c.forEach((l) => o.add(a === l ? u : l));
843
+ function at(e) {
844
+ const { rootDraft: t, value: n, useRawReturn: s = !1, isRoot: i = !0 } = e;
845
+ mt(n, (o, r, a) => {
846
+ const u = $(r);
847
+ if (u && t && u.finalities === t.finalities) {
848
+ e.isContainDraft = !0;
849
+ const f = u.original;
850
+ if (a instanceof Set) {
851
+ const c = Array.from(a);
852
+ a.clear(), c.forEach((d) => a.add(o === d ? f : d));
853
853
  } else
854
- ie(o, a, u);
854
+ xe(a, o, f);
855
855
  } else
856
- typeof r == "object" && r !== null && (t.value = r, t.isRoot = !1, we(t));
857
- }), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), s && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
856
+ typeof r == "object" && r !== null && (e.value = r, e.isRoot = !1, at(e));
857
+ }), i && (e.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), s && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
858
858
  }
859
- function Ze(t) {
860
- const e = b(t);
861
- if (!P(t, e == null ? void 0 : e.options))
862
- return t;
863
- const n = q(t);
864
- if (e && !e.operated)
865
- return e.original;
859
+ function Qt(e) {
860
+ const t = $(e);
861
+ if (!ee(e, t == null ? void 0 : t.options))
862
+ return e;
863
+ const n = be(e);
864
+ if (t && !t.operated)
865
+ return t.original;
866
866
  let s;
867
867
  function i() {
868
- s = n === 2 ? new Map(t) : n === 3 ? Array.from(e.setMap.values()) : Ke(t, e == null ? void 0 : e.options);
868
+ s = n === 2 ? new Map(e) : n === 3 ? Array.from(t.setMap.values()) : Wt(e, t == null ? void 0 : t.options);
869
869
  }
870
- if (e) {
871
- e.finalized = !0;
870
+ if (t) {
871
+ t.finalized = !0;
872
872
  try {
873
873
  i();
874
874
  } finally {
875
- e.finalized = !1;
875
+ t.finalized = !1;
876
876
  }
877
877
  } else
878
- s = t;
879
- return Re(s, (a, r) => {
880
- if (e && k(F(e.original, a), r))
878
+ s = e;
879
+ return mt(s, (o, r) => {
880
+ if (t && fe(le(t.original, o), r))
881
881
  return;
882
- const o = Ze(r);
883
- o !== r && (s === t && i(), ie(s, a, o));
882
+ const a = Qt(r);
883
+ a !== r && (s === e && i(), xe(s, o, a));
884
884
  }), n === 3 ? new Set(s) : s;
885
885
  }
886
- function Ve(t) {
887
- if (!H(t))
888
- throw new Error(`current() is only used for Draft, parameter: ${t}`);
889
- return Ze(t);
886
+ function Tt(e) {
887
+ if (!ge(e))
888
+ throw new Error(`current() is only used for Draft, parameter: ${e}`);
889
+ return Qt(e);
890
890
  }
891
- const Dt = (t) => {
892
- if (t !== void 0 && Object.prototype.toString.call(t) !== "[object Object]")
893
- throw new Error(`Invalid options: ${String(t)}, 'options' should be an object.`);
894
- return function e(n, s, i) {
895
- var a, r, o;
891
+ const Hn = (e) => {
892
+ if (e !== void 0 && Object.prototype.toString.call(e) !== "[object Object]")
893
+ throw new Error(`Invalid options: ${String(e)}, 'options' should be an object.`);
894
+ return function t(n, s, i) {
895
+ var o, r, a;
896
896
  if (typeof n == "function" && typeof s != "function")
897
- return function(p, ...$) {
898
- return e(p, (N) => n.call(this, N, ...$), s);
897
+ return function(R, ...P) {
898
+ return t(R, (A) => n.call(this, A, ...P), s);
899
899
  };
900
- const f = n, u = s;
900
+ const u = n, f = s;
901
901
  let c = i;
902
902
  if (typeof s != "function" && (c = s), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
903
903
  throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
904
- c = Object.assign(Object.assign({}, t), c);
905
- const l = H(f) ? Ve(f) : f, d = Array.isArray(c.mark) ? (p, $) => {
906
- for (const N of c.mark) {
907
- if (typeof N != "function")
908
- throw new Error(`Invalid mark: ${N}, 'mark' should be a function.`);
909
- const X = N(p, $);
910
- if (X)
911
- return X;
904
+ c = Object.assign(Object.assign({}, e), c);
905
+ const d = ge(u) ? Tt(u) : u, g = Array.isArray(c.mark) ? (R, P) => {
906
+ for (const A of c.mark) {
907
+ if (typeof A != "function")
908
+ throw new Error(`Invalid mark: ${A}, 'mark' should be a function.`);
909
+ const L = A(R, P);
910
+ if (L)
911
+ return L;
912
912
  }
913
- } : c.mark, m = (a = c.enablePatches) !== null && a !== void 0 ? a : !1, _ = (r = c.strict) !== null && r !== void 0 ? r : !1, h = {
914
- enableAutoFreeze: (o = c.enableAutoFreeze) !== null && o !== void 0 ? o : !1,
915
- mark: d,
916
- strict: _,
917
- enablePatches: m
913
+ } : c.mark, w = (o = c.enablePatches) !== null && o !== void 0 ? o : !1, y = (r = c.strict) !== null && r !== void 0 ? r : !1, v = {
914
+ enableAutoFreeze: (a = c.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
915
+ mark: g,
916
+ strict: y,
917
+ enablePatches: w
918
918
  };
919
- if (!P(l, h) && typeof l == "object" && l !== null)
919
+ if (!ee(d, v) && typeof d == "object" && d !== null)
920
920
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
921
- const [O, v] = At(l, h);
921
+ const [x, b] = Pn(d, v);
922
922
  if (typeof s != "function") {
923
- if (!P(l, h))
923
+ if (!ee(d, v))
924
924
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
925
- return [O, v];
925
+ return [x, b];
926
926
  }
927
- let w;
927
+ let S;
928
928
  try {
929
- w = u(O);
930
- } catch (p) {
931
- throw me(b(O)), p;
932
- }
933
- const S = (p) => {
934
- const $ = b(O);
935
- if (!H(p)) {
936
- if (p !== void 0 && !k(p, O) && ($ != null && $.operated))
929
+ S = f(x);
930
+ } catch (R) {
931
+ throw nt($(x)), R;
932
+ }
933
+ const M = (R) => {
934
+ const P = $(x);
935
+ if (!ge(R)) {
936
+ if (R !== void 0 && !fe(R, x) && (P != null && P.operated))
937
937
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
938
- const X = p == null ? void 0 : p[yt];
939
- if (X) {
940
- const ut = X[0];
941
- return h.strict && typeof p == "object" && p !== null && we({
942
- rootDraft: $,
943
- value: p,
938
+ const L = R == null ? void 0 : R[An];
939
+ if (L) {
940
+ const z = L[0];
941
+ return v.strict && typeof R == "object" && R !== null && at({
942
+ rootDraft: P,
943
+ value: R,
944
944
  useRawReturn: !0
945
- }), v([ut]);
945
+ }), b([z]);
946
946
  }
947
- if (p !== void 0)
948
- return typeof p == "object" && p !== null && we({ rootDraft: $, value: p }), v([p]);
947
+ if (R !== void 0)
948
+ return typeof R == "object" && R !== null && at({ rootDraft: P, value: R }), b([R]);
949
949
  }
950
- if (p === O || p === void 0)
951
- return v([]);
952
- const N = b(p);
953
- if (h === N.options) {
954
- if (N.operated)
950
+ if (R === x || R === void 0)
951
+ return b([]);
952
+ const A = $(R);
953
+ if (v === A.options) {
954
+ if (A.operated)
955
955
  throw new Error("Cannot return a modified child draft.");
956
- return v([Ve(p)]);
956
+ return b([Tt(R)]);
957
957
  }
958
- return v([p]);
958
+ return b([R]);
959
959
  };
960
- return w instanceof Promise ? w.then(S, (p) => {
961
- throw me(b(O)), p;
962
- }) : S(w);
960
+ return S instanceof Promise ? S.then(M, (R) => {
961
+ throw nt($(x)), R;
962
+ }) : M(S);
963
963
  };
964
- }, g = Dt();
964
+ }, C = Hn();
965
965
  Object.prototype.constructor.toString();
966
- const jt = Oe(fetch), et = async (t, e) => {
967
- if (!t)
966
+ const kn = pt(fetch), Yt = async (e, t) => {
967
+ if (!e)
968
968
  throw "Metapage definition null";
969
- if (!t.version)
969
+ if (!e.version)
970
970
  throw 'Missing "version" key in metapage definition';
971
- if (!e)
971
+ if (!t)
972
972
  throw 'Missing "version" argument';
973
- if (E(e, le) > 0)
973
+ if (V(t, Ge) > 0)
974
974
  try {
975
- return await (await jt(`https://module.metapage.io/conversion/metapage/${e}`, {
975
+ return await (await kn(`https://module.metapage.io/conversion/metapage/${t}`, {
976
976
  redirect: "follow",
977
977
  retries: 3,
978
978
  retryDelay: 1e3,
979
979
  method: "POST",
980
- body: JSON.stringify(t),
980
+ body: JSON.stringify(e),
981
981
  headers: {
982
982
  "Content-Type": "application/json"
983
983
  }
984
984
  })).json();
985
985
  } catch (s) {
986
- throw `Error converting metapage definition to version ${e}: ${s}`;
986
+ throw `Error converting metapage definition to version ${t}: ${s}`;
987
987
  }
988
- return Pt(t, e);
989
- }, Ct = async (t) => et(t, le), Pt = (t, e) => {
990
- if (!t)
988
+ return jn(e, t);
989
+ }, Nn = async (e) => Yt(e, Ge), jn = (e, t) => {
990
+ if (!e)
991
991
  throw "Metapage definition null";
992
- if (!t.version)
992
+ if (!e.version)
993
993
  throw 'Missing "version" key in metapage definition';
994
- let n = K(t.version);
995
- if (n === e)
996
- return t;
997
- let s = t;
998
- for (; n !== e; )
994
+ let n = Re(e.version);
995
+ if (n === t)
996
+ return e;
997
+ let s = e;
998
+ for (; n !== t; )
999
999
  switch (n) {
1000
1000
  case "0.2": {
1001
- if (E(e, n) > 0)
1002
- s = Lt(s), n = K(s.version);
1001
+ if (V(t, n) > 0)
1002
+ s = Un(s), n = Re(s.version);
1003
1003
  else
1004
- throw `Cannot convert from version ${n} to ${e}`;
1004
+ throw `Cannot convert from version ${n} to ${t}`;
1005
1005
  break;
1006
1006
  }
1007
1007
  case "0.3": {
1008
- E(e, n) > 0 ? (s = Tt(s), n = K(s.version)) : (s = Ut(s), n = K(s.version));
1008
+ V(t, n) > 0 ? (s = Fn(s), n = Re(s.version)) : (s = Bn(s), n = Re(s.version));
1009
1009
  break;
1010
1010
  }
1011
1011
  case "1": {
1012
- if (E(e, n) > 0)
1013
- throw `Cannot convert from version ${n} to ${e}, 1 is the latest version`;
1014
- s = $t(s), n = K(s.version);
1012
+ if (V(t, n) > 0)
1013
+ throw `Cannot convert from version ${n} to ${t}, 1 is the latest version`;
1014
+ s = zn(s), n = Re(s.version);
1015
1015
  break;
1016
1016
  }
1017
1017
  default:
1018
- throw `Unknow version ${n} to ${e}`;
1018
+ throw `Unknow version ${n} to ${t}`;
1019
1019
  }
1020
1020
  return s;
1021
- }, Lt = (t) => g(t, (e) => {
1022
- e.version = "0.3";
1023
- }), Ut = (t) => g(t, (e) => {
1024
- e.version = "0.2";
1025
- }), Tt = (t) => g(t, (e) => {
1026
- const n = e;
1021
+ }, Un = (e) => C(e, (t) => {
1022
+ t.version = "0.3";
1023
+ }), Bn = (e) => C(e, (t) => {
1024
+ t.version = "0.2";
1025
+ }), Fn = (e) => C(e, (t) => {
1026
+ const n = t;
1027
1027
  delete n.plugins, n.version = "1";
1028
- }), $t = (t) => g(t, (e) => (e.version = "0.3", e)), K = (t) => {
1029
- if (t === "latest")
1030
- return le;
1031
- if (E(t, "0.2") < 0)
1032
- throw `Unknown version: ${t}`;
1033
- if (E(t, "0.2") <= 0 && E(t, "0.3") < 0)
1028
+ }), zn = (e) => C(e, (t) => (t.version = "0.3", t)), Re = (e) => {
1029
+ if (e === "latest")
1030
+ return Ge;
1031
+ if (V(e, "0.2") < 0)
1032
+ throw `Unknown version: ${e}`;
1033
+ if (V(e, "0.2") <= 0 && V(e, "0.3") < 0)
1034
1034
  return "0.2";
1035
- if (E(t, "0.3") <= 0)
1035
+ if (V(e, "0.3") <= 0)
1036
1036
  return "0.3";
1037
- if (t === "1")
1037
+ if (e === "1")
1038
1038
  return "1";
1039
- throw `Unknown version: ${t}`;
1040
- }, zt = Oe(fetch), tt = async (t, e) => {
1041
- if (!t)
1039
+ throw `Unknown version: ${e}`;
1040
+ }, Gn = pt(fetch), Zt = async (e, t) => {
1041
+ if (!e)
1042
1042
  throw "Metapage definition null";
1043
- if (!t.version)
1043
+ if (!e.version)
1044
1044
  throw 'Missing "version" key in metapage definition';
1045
- if (!e)
1045
+ if (!t)
1046
1046
  throw 'Missing "version" argument';
1047
- if (E(e, Me) > 0)
1047
+ if (V(t, ft) > 0)
1048
1048
  try {
1049
- return await (await zt(`https://module.metapage.io/conversion/metaframe/${e}`, {
1049
+ return await (await Gn(`https://module.metapage.io/conversion/metaframe/${t}`, {
1050
1050
  redirect: "follow",
1051
1051
  retries: 3,
1052
1052
  retryDelay: 1e3,
1053
1053
  method: "POST",
1054
- body: JSON.stringify(t),
1054
+ body: JSON.stringify(e),
1055
1055
  headers: {
1056
1056
  "Content-Type": "application/json"
1057
1057
  }
1058
1058
  })).json();
1059
1059
  } catch (s) {
1060
- throw `Error converting metapage definition to version ${e}: ${s}`;
1060
+ throw `Error converting metapage definition to version ${t}: ${s}`;
1061
1061
  }
1062
- return kt(t, e);
1063
- }, xt = async (t) => tt(t, Me), kt = (t, e) => {
1064
- if (!t)
1062
+ return Kn(e, t);
1063
+ }, Vn = async (e) => Zt(e, ft), Kn = (e, t) => {
1064
+ if (!e)
1065
1065
  throw "Metaframe definition null";
1066
- if (!t.version)
1066
+ if (!e.version)
1067
1067
  throw 'Missing "version" key in metaframe definition';
1068
- let n = z(t.version);
1069
- if (n === e)
1070
- return t;
1071
- let s = t;
1072
- for (; n !== e; )
1068
+ let n = ae(e.version);
1069
+ if (n === t)
1070
+ return e;
1071
+ let s = e;
1072
+ for (; n !== t; )
1073
1073
  switch (n) {
1074
1074
  case "0.3": {
1075
- if (E(e, n) > 0)
1076
- s = Vt(s), n = z(s.version);
1075
+ if (V(t, n) > 0)
1076
+ s = Xn(s), n = ae(s.version);
1077
1077
  else
1078
- throw `Cannot convert from version ${n} to ${e}`;
1078
+ throw `Cannot convert from version ${n} to ${t}`;
1079
1079
  break;
1080
1080
  }
1081
1081
  case "0.4": {
1082
- E(e, n) > 0 ? (s = Bt(s), n = z(s.version)) : (s = Nt(s), n = z(s.version));
1082
+ V(t, n) > 0 ? (s = qn(s), n = ae(s.version)) : (s = Jn(s), n = ae(s.version));
1083
1083
  break;
1084
1084
  }
1085
1085
  case "0.5": {
1086
- E(e, n) > 0 ? (s = qt(s), n = z(s.version)) : (s = Jt(s), n = z(s.version));
1086
+ V(t, n) > 0 ? (s = es(s), n = ae(s.version)) : (s = Qn(s), n = ae(s.version));
1087
1087
  break;
1088
1088
  }
1089
1089
  case "0.6": {
1090
- E(e, n) > 0 ? (s = Wt(s), n = z(s.version)) : (s = Gt(s), n = z(s.version));
1090
+ V(t, n) > 0 ? (s = Yn(s), n = ae(s.version)) : (s = ts(s), n = ae(s.version));
1091
1091
  break;
1092
1092
  }
1093
1093
  case "1": {
1094
- if (E(e, n) > 0)
1095
- throw `Cannot convert from version ${n} to ${e}, 1 is the latest version`;
1096
- s = Ht(s), n = z(s.version);
1094
+ if (V(t, n) > 0)
1095
+ throw `Cannot convert from version ${n} to ${t}, 1 is the latest version`;
1096
+ s = Zn(s), n = ae(s.version);
1097
1097
  break;
1098
1098
  }
1099
1099
  default:
1100
- throw `Unknow version ${n} to ${e}`;
1100
+ throw `Unknow version ${n} to ${t}`;
1101
1101
  }
1102
1102
  return s;
1103
- }, Ft = async (t, e) => {
1104
- if (t)
1105
- return xt(t);
1106
- }, Nt = (t) => g(t, (e) => {
1107
- e.version = "0.3", delete e.allow;
1108
- }), Vt = (t) => g(t, (e) => {
1109
- e.version = "0.4";
1110
- }), Bt = (t) => g(t, (e) => {
1111
- if (e.version = "0.5", !(e != null && e.metadata))
1103
+ }, Wn = async (e, t) => {
1104
+ if (e)
1105
+ return Vn(e);
1106
+ }, Jn = (e) => C(e, (t) => {
1107
+ t.version = "0.3", delete t.allow;
1108
+ }), Xn = (e) => C(e, (t) => {
1109
+ t.version = "0.4";
1110
+ }), qn = (e) => C(e, (t) => {
1111
+ if (t.version = "0.5", !(t != null && t.metadata))
1112
1112
  return;
1113
- const n = e.metadata.title;
1114
- delete e.metadata.title, e.metadata.name = n;
1115
- const s = e.metadata.descriptionUrl;
1116
- delete e.metadata.descriptionUrl, e.metadata.description = s;
1117
- const i = e.metadata.keywords;
1118
- delete e.metadata.keywords, e.metadata.tags = i;
1119
- }), Jt = (t) => g(t, (e) => {
1120
- if (e.version = "0.4", !(e != null && e.metadata))
1113
+ const n = t.metadata.title;
1114
+ delete t.metadata.title, t.metadata.name = n;
1115
+ const s = t.metadata.descriptionUrl;
1116
+ delete t.metadata.descriptionUrl, t.metadata.description = s;
1117
+ const i = t.metadata.keywords;
1118
+ delete t.metadata.keywords, t.metadata.tags = i;
1119
+ }), Qn = (e) => C(e, (t) => {
1120
+ if (t.version = "0.4", !(t != null && t.metadata))
1121
1121
  return;
1122
- const n = e.metadata.name;
1123
- delete e.metadata.name, e.metadata.title = n;
1124
- const s = e.metadata.description;
1125
- delete e.metadata.description, e.metadata.descriptionUrl = s;
1126
- const i = e.metadata.tags;
1127
- delete e.metadata.tags, e.metadata.keywords = i;
1128
- }), Wt = (t) => g(t, (e) => {
1122
+ const n = t.metadata.name;
1123
+ delete t.metadata.name, t.metadata.title = n;
1124
+ const s = t.metadata.description;
1125
+ delete t.metadata.description, t.metadata.descriptionUrl = s;
1126
+ const i = t.metadata.tags;
1127
+ delete t.metadata.tags, t.metadata.keywords = i;
1128
+ }), Yn = (e) => C(e, (t) => {
1129
1129
  var n;
1130
- e.version = "1", (n = e == null ? void 0 : e.metadata) != null && n.operations && delete e.metadata.operations;
1131
- }), Ht = (t) => g(t, (e) => {
1130
+ t.version = "1", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
1131
+ }), Zn = (e) => C(e, (t) => {
1132
1132
  var n;
1133
- e.version = "0.6", (n = e == null ? void 0 : e.metadata) != null && n.operations && delete e.metadata.operations;
1134
- }), qt = (t) => g(t, (e) => {
1133
+ t.version = "0.6", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
1134
+ }), es = (e) => C(e, (t) => {
1135
1135
  var n;
1136
- e.version = "0.6", (n = e == null ? void 0 : e.metadata) != null && n.operations && delete e.metadata.operations;
1137
- }), Gt = (t) => g(t, (e) => {
1136
+ t.version = "0.6", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
1137
+ }), ts = (e) => C(e, (t) => {
1138
1138
  var n;
1139
- e.version = "0.5", (n = e == null ? void 0 : e.metadata) != null && n.operations && delete e.metadata.operations;
1140
- }), z = (t) => {
1141
- if (t === "latest")
1142
- return Me;
1143
- if (E(t, "0.3") < 0)
1144
- throw `Unknown version: ${t}`;
1145
- if (E(t, "0.3") <= 0)
1139
+ t.version = "0.5", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
1140
+ }), ae = (e) => {
1141
+ if (e === "latest")
1142
+ return ft;
1143
+ if (V(e, "0.3") < 0)
1144
+ throw `Unknown version: ${e}`;
1145
+ if (V(e, "0.3") <= 0)
1146
1146
  return "0.3";
1147
- if (E(t, "0.4") <= 0)
1147
+ if (V(e, "0.4") <= 0)
1148
1148
  return "0.4";
1149
- if (E(t, "0.5") <= 0)
1149
+ if (V(e, "0.5") <= 0)
1150
1150
  return "0.5";
1151
- if (E(t, "0.6") <= 0)
1151
+ if (V(e, "0.6") <= 0)
1152
1152
  return "0.6";
1153
- if (t === "1")
1153
+ if (e === "1")
1154
1154
  return "1";
1155
- throw `Unknown version: ${t}`;
1155
+ throw `Unknown version: ${e}`;
1156
1156
  };
1157
- var Y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Z = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
1158
- for (var re = 0; re < Y.length; re++)
1159
- Z[Y.charCodeAt(re)] = re;
1160
- var oe = function(t) {
1161
- var e = new Uint8Array(t), n, s = e.length, i = "";
1157
+ var Ae = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Oe = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
1158
+ for (var He = 0; He < Ae.length; He++)
1159
+ Oe[Ae.charCodeAt(He)] = He;
1160
+ var ke = function(e) {
1161
+ var t = new Uint8Array(e), n, s = t.length, i = "";
1162
1162
  for (n = 0; n < s; n += 3)
1163
- i += Y[e[n] >> 2], i += Y[(e[n] & 3) << 4 | e[n + 1] >> 4], i += Y[(e[n + 1] & 15) << 2 | e[n + 2] >> 6], i += Y[e[n + 2] & 63];
1163
+ i += Ae[t[n] >> 2], i += Ae[(t[n] & 3) << 4 | t[n + 1] >> 4], i += Ae[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], i += Ae[t[n + 2] & 63];
1164
1164
  return s % 3 === 2 ? i = i.substring(0, i.length - 1) + "=" : s % 3 === 1 && (i = i.substring(0, i.length - 2) + "=="), i;
1165
- }, B = function(t) {
1166
- var e = t.length * 0.75, n = t.length, s, i = 0, a, r, o, f;
1167
- t[t.length - 1] === "=" && (e--, t[t.length - 2] === "=" && e--);
1168
- var u = new ArrayBuffer(e), c = new Uint8Array(u);
1165
+ }, de = function(e) {
1166
+ var t = e.length * 0.75, n = e.length, s, i = 0, o, r, a, u;
1167
+ e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
1168
+ var f = new ArrayBuffer(t), c = new Uint8Array(f);
1169
1169
  for (s = 0; s < n; s += 4)
1170
- a = Z[t.charCodeAt(s)], r = Z[t.charCodeAt(s + 1)], o = Z[t.charCodeAt(s + 2)], f = Z[t.charCodeAt(s + 3)], c[i++] = a << 2 | r >> 4, c[i++] = (r & 15) << 4 | o >> 2, c[i++] = (o & 3) << 6 | f & 63;
1171
- return u;
1170
+ o = Oe[e.charCodeAt(s)], r = Oe[e.charCodeAt(s + 1)], a = Oe[e.charCodeAt(s + 2)], u = Oe[e.charCodeAt(s + 3)], c[i++] = o << 2 | r >> 4, c[i++] = (r & 15) << 4 | a >> 2, c[i++] = (a & 3) << 6 | u & 63;
1171
+ return f;
1172
1172
  };
1173
- const he = async (t) => g(t, async (e) => {
1174
- for (const n of Object.keys(t)) {
1175
- const s = await Kt(t[n]);
1176
- return e[n] = s, e;
1177
- }
1178
- }), te = async (t) => g(t, async (e) => {
1179
- for (const n of Object.keys(t)) {
1180
- const s = await nt(t[n]);
1181
- return e[n] = s, e;
1182
- }
1183
- }), un = async (t, e, n) => {
1184
- if (t = nt(t), n = n || {}, n.type || (n.type = "application/octet-stream"), t instanceof ArrayBuffer)
1185
- return new File([t], e, n);
1186
- if (t instanceof File || t instanceof Blob) {
1187
- const i = await t.arrayBuffer();
1188
- return t instanceof File && (n.type = t.type), new File([i], e, n);
1189
- }
1190
- 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) {
1191
- const i = t;
1192
- return new File([i.buffer], e, n);
1193
- }
1194
- if (typeof t == "string") {
1195
- var s = new Blob([t], { type: "text/plain" });
1196
- n.type = "text/plain", new File([s], e, n);
1197
- }
1198
- if (typeof t == "object") {
1199
- const i = new Blob([JSON.stringify(t)], {
1173
+ const Ve = async (e) => C(e, async (t) => {
1174
+ for (const n of Object.keys(e)) {
1175
+ const s = await ns(e[n]);
1176
+ return t[n] = s, t;
1177
+ }
1178
+ }), Ie = async (e) => C(e, async (t) => {
1179
+ for (const n of Object.keys(e)) {
1180
+ const s = await en(e[n]);
1181
+ return t[n] = s, t;
1182
+ }
1183
+ }), Vs = async (e, t, n) => {
1184
+ if (e = en(e), n = n || {}, n.type || (n.type = "application/octet-stream"), e instanceof ArrayBuffer)
1185
+ return new File([e], t, n);
1186
+ if (e instanceof File || e instanceof Blob) {
1187
+ const i = await e.arrayBuffer();
1188
+ return e instanceof File && (n.type = e.type), new File([i], t, n);
1189
+ }
1190
+ if (e instanceof Int8Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray || e instanceof Int16Array || e instanceof Uint16Array || e instanceof Int32Array || e instanceof Uint32Array || e instanceof Float32Array || e instanceof Float64Array) {
1191
+ const i = e;
1192
+ return new File([i.buffer], t, n);
1193
+ }
1194
+ if (typeof e == "string") {
1195
+ var s = new Blob([e], { type: "text/plain" });
1196
+ n.type = "text/plain", new File([s], t, n);
1197
+ }
1198
+ if (typeof e == "object") {
1199
+ const i = new Blob([JSON.stringify(e)], {
1200
1200
  type: "application/json"
1201
1201
  });
1202
- n.type = "application/json", new File([i], e, n);
1202
+ n.type = "application/json", new File([i], t, n);
1203
1203
  }
1204
- var s = new Blob([t], { type: "text/plain" });
1205
- return n.type = "text/plain", new File([s], e, n);
1206
- }, Kt = async (t) => {
1207
- 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) {
1208
- const e = t, n = {
1204
+ var s = new Blob([e], { type: "text/plain" });
1205
+ return n.type = "text/plain", new File([s], t, n);
1206
+ }, ns = async (e) => {
1207
+ if (e instanceof Int8Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray || e instanceof Int16Array || e instanceof Uint16Array || e instanceof Int32Array || e instanceof Uint32Array || e instanceof Float32Array || e instanceof Float64Array) {
1208
+ const t = e, n = {
1209
1209
  _s: !0,
1210
- _c: t.constructor.name,
1211
- value: oe(e.buffer),
1212
- byteLength: e.byteLength,
1213
- byteOffset: e.byteOffset,
1214
- size: e.byteLength
1210
+ _c: e.constructor.name,
1211
+ value: ke(t.buffer),
1212
+ byteLength: t.byteLength,
1213
+ byteOffset: t.byteOffset,
1214
+ size: t.byteLength
1215
1215
  };
1216
1216
  return Promise.resolve(n);
1217
- } else if (t instanceof File) {
1218
- const e = t, n = await e.arrayBuffer();
1217
+ } else if (e instanceof File) {
1218
+ const t = e, n = await t.arrayBuffer();
1219
1219
  return {
1220
1220
  _s: !0,
1221
1221
  _c: File.name,
1222
- value: oe(n),
1223
- name: e.name,
1224
- fileType: e.type,
1225
- lastModified: e.lastModified,
1222
+ value: ke(n),
1223
+ name: t.name,
1224
+ fileType: t.type,
1225
+ lastModified: t.lastModified,
1226
1226
  size: n.byteLength
1227
1227
  };
1228
- } else if (t instanceof Blob) {
1229
- const e = t, n = await e.arrayBuffer();
1228
+ } else if (e instanceof Blob) {
1229
+ const t = e, n = await t.arrayBuffer();
1230
1230
  return {
1231
1231
  _s: !0,
1232
1232
  _c: Blob.name,
1233
- value: oe(n),
1234
- fileType: e.type,
1233
+ value: ke(n),
1234
+ fileType: t.type,
1235
1235
  size: n.byteLength
1236
1236
  };
1237
- } else if (t instanceof ArrayBuffer) {
1238
- const e = t, n = {
1237
+ } else if (e instanceof ArrayBuffer) {
1238
+ const t = e, n = {
1239
1239
  _s: !0,
1240
1240
  _c: ArrayBuffer.name,
1241
- value: oe(e),
1242
- size: e.byteLength
1241
+ value: ke(t),
1242
+ size: t.byteLength
1243
1243
  };
1244
1244
  return Promise.resolve(n);
1245
1245
  }
1246
- return Promise.resolve(t);
1247
- }, nt = (t) => {
1248
- if (!(t && typeof t == "object" && t._s === !0))
1249
- return t;
1250
- const e = t, n = e._c;
1246
+ return Promise.resolve(e);
1247
+ }, en = (e) => {
1248
+ if (!(e && typeof e == "object" && e._s === !0))
1249
+ return e;
1250
+ const t = e, n = t._c;
1251
1251
  if (n === Blob.name) {
1252
- const r = t;
1253
- return new Blob([B(e.value)], {
1252
+ const r = e;
1253
+ return new Blob([de(t.value)], {
1254
1254
  type: r.fileType
1255
1255
  });
1256
1256
  } else if (n === File.name) {
1257
- const r = t;
1258
- return new File([B(e.value)], r.name, {
1257
+ const r = e;
1258
+ return new File([de(t.value)], r.name, {
1259
1259
  type: r.fileType,
1260
1260
  lastModified: r.lastModified
1261
1261
  });
1262
1262
  } else if (n === ArrayBuffer.name)
1263
- return B(e.value);
1264
- const s = t, i = B(s.value), a = s._c;
1263
+ return de(t.value);
1264
+ const s = e, i = de(s.value), o = s._c;
1265
1265
  try {
1266
- return new globalThis[a](i);
1266
+ return new globalThis[o](i);
1267
1267
  } catch {
1268
1268
  }
1269
- return t;
1270
- }, cn = (t) => {
1271
- if (!(t && typeof t == "object" && t._s === !0))
1269
+ return e;
1270
+ }, Ks = (e) => {
1271
+ if (!(e && typeof e == "object" && e._s === !0))
1272
1272
  return;
1273
- const e = t, n = e._c;
1273
+ const t = e, n = t._c;
1274
1274
  if (n === Blob.name) {
1275
- const r = t, o = new Blob([B(e.value)], {
1275
+ const r = e, a = new Blob([de(t.value)], {
1276
1276
  type: r.fileType
1277
1277
  });
1278
- return new File([o], "file", {
1279
- type: o.type
1278
+ return new File([a], "file", {
1279
+ type: a.type
1280
1280
  });
1281
1281
  } else if (n === File.name) {
1282
- const r = t;
1283
- return new File([B(e.value)], r.name, {
1282
+ const r = e;
1283
+ return new File([de(t.value)], r.name, {
1284
1284
  type: r.fileType,
1285
1285
  lastModified: r.lastModified
1286
1286
  });
1287
1287
  } else if (n === ArrayBuffer.name) {
1288
- const r = B(e.value);
1288
+ const r = de(t.value);
1289
1289
  return new File([r], "file", {
1290
1290
  type: "application/octet-stream"
1291
1291
  });
1292
1292
  }
1293
- const s = t, i = B(s.value), a = s._c;
1293
+ const s = e, i = de(s.value), o = s._c;
1294
1294
  try {
1295
- const r = new globalThis[a](i);
1295
+ const r = new globalThis[o](i);
1296
1296
  return new File([r], "file", {
1297
1297
  type: "application/octet-stream"
1298
1298
  });
1299
1299
  } catch {
1300
1300
  }
1301
1301
  };
1302
- var y;
1303
- (function(t) {
1304
- t.Inputs = "inputs", t.Outputs = "outputs", t.State = "state", t.Definition = "definition", t.Error = "error", t.UrlHashUpdate = "urlhashupdate", t.Message = "Message";
1305
- })(y || (y = {}));
1306
- var j;
1307
- (function(t) {
1308
- t.InputsUpdate = "InputsUpdate", t.OutputsUpdate = "OutputsUpdate", t.SetupIframeClientRequest = "SetupIframeClientRequest", t.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", t.HashParamsUpdate = "HashParamsUpdate";
1309
- })(j || (j = {}));
1310
- var x;
1311
- (function(t) {
1312
- t.InputsUpdate = "InputsUpdate", t.MessageAck = "MessageAck", t.SetupIframeServerResponse = "SetupIframeServerResponse";
1313
- })(x || (x = {}));
1314
- const ln = -32700, hn = -32600, pn = -32601, dn = -32602, mn = -32603;
1315
- function yn(t) {
1316
- switch (typeof t) {
1302
+ var E;
1303
+ (function(e) {
1304
+ e.Inputs = "inputs", e.Outputs = "outputs", e.State = "state", e.Definition = "definition", e.Error = "error", e.UrlHashUpdate = "urlhashupdate", e.Message = "Message";
1305
+ })(E || (E = {}));
1306
+ var Q;
1307
+ (function(e) {
1308
+ e.InputsUpdate = "InputsUpdate", e.OutputsUpdate = "OutputsUpdate", e.SetupIframeClientRequest = "SetupIframeClientRequest", e.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", e.HashParamsUpdate = "HashParamsUpdate";
1309
+ })(Q || (Q = {}));
1310
+ var ce;
1311
+ (function(e) {
1312
+ e.InputsUpdate = "InputsUpdate", e.MessageAck = "MessageAck", e.SetupIframeServerResponse = "SetupIframeServerResponse";
1313
+ })(ce || (ce = {}));
1314
+ const Ws = -32700, Js = -32600, Xs = -32601, qs = -32602, Qs = -32603;
1315
+ function Ys(e) {
1316
+ switch (typeof e) {
1317
1317
  case "string":
1318
1318
  return !0;
1319
1319
  case "number":
1320
- return t % 1 != 0;
1320
+ return e % 1 != 0;
1321
1321
  case "object":
1322
- return t === null ? (console.warn("Use of null ID in JSONRPC 2.0 is discouraged."), !0) : !1;
1322
+ return e === null ? (console.warn("Use of null ID in JSONRPC 2.0 is discouraged."), !0) : !1;
1323
1323
  default:
1324
1324
  return !1;
1325
1325
  }
1326
1326
  }
1327
- var st = { exports: {} };
1328
- (function(t) {
1329
- var e = Object.prototype.hasOwnProperty, n = "~";
1327
+ var tn = { exports: {} };
1328
+ (function(e) {
1329
+ var t = Object.prototype.hasOwnProperty, n = "~";
1330
1330
  function s() {
1331
1331
  }
1332
1332
  Object.create && (s.prototype = /* @__PURE__ */ Object.create(null), new s().__proto__ || (n = !1));
1333
- function i(f, u, c) {
1334
- this.fn = f, this.context = u, this.once = c || !1;
1333
+ function i(u, f, c) {
1334
+ this.fn = u, this.context = f, this.once = c || !1;
1335
1335
  }
1336
- function a(f, u, c, l, d) {
1336
+ function o(u, f, c, d, g) {
1337
1337
  if (typeof c != "function")
1338
1338
  throw new TypeError("The listener must be a function");
1339
- var m = new i(c, l || f, d), _ = n ? n + u : u;
1340
- return f._events[_] ? f._events[_].fn ? f._events[_] = [f._events[_], m] : f._events[_].push(m) : (f._events[_] = m, f._eventsCount++), f;
1339
+ var w = new i(c, d || u, g), y = n ? n + f : f;
1340
+ return u._events[y] ? u._events[y].fn ? u._events[y] = [u._events[y], w] : u._events[y].push(w) : (u._events[y] = w, u._eventsCount++), u;
1341
1341
  }
1342
- function r(f, u) {
1343
- --f._eventsCount === 0 ? f._events = new s() : delete f._events[u];
1342
+ function r(u, f) {
1343
+ --u._eventsCount === 0 ? u._events = new s() : delete u._events[f];
1344
1344
  }
1345
- function o() {
1345
+ function a() {
1346
1346
  this._events = new s(), this._eventsCount = 0;
1347
1347
  }
1348
- o.prototype.eventNames = function() {
1349
- var u = [], c, l;
1348
+ a.prototype.eventNames = function() {
1349
+ var f = [], c, d;
1350
1350
  if (this._eventsCount === 0)
1351
- return u;
1352
- for (l in c = this._events)
1353
- e.call(c, l) && u.push(n ? l.slice(1) : l);
1354
- return Object.getOwnPropertySymbols ? u.concat(Object.getOwnPropertySymbols(c)) : u;
1355
- }, o.prototype.listeners = function(u) {
1356
- var c = n ? n + u : u, l = this._events[c];
1357
- if (!l)
1351
+ return f;
1352
+ for (d in c = this._events)
1353
+ t.call(c, d) && f.push(n ? d.slice(1) : d);
1354
+ return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(c)) : f;
1355
+ }, a.prototype.listeners = function(f) {
1356
+ var c = n ? n + f : f, d = this._events[c];
1357
+ if (!d)
1358
1358
  return [];
1359
- if (l.fn)
1360
- return [l.fn];
1361
- for (var d = 0, m = l.length, _ = new Array(m); d < m; d++)
1362
- _[d] = l[d].fn;
1363
- return _;
1364
- }, o.prototype.listenerCount = function(u) {
1365
- var c = n ? n + u : u, l = this._events[c];
1366
- return l ? l.fn ? 1 : l.length : 0;
1367
- }, o.prototype.emit = function(u, c, l, d, m, _) {
1368
- var M = n ? n + u : u;
1369
- if (!this._events[M])
1359
+ if (d.fn)
1360
+ return [d.fn];
1361
+ for (var g = 0, w = d.length, y = new Array(w); g < w; g++)
1362
+ y[g] = d[g].fn;
1363
+ return y;
1364
+ }, a.prototype.listenerCount = function(f) {
1365
+ var c = n ? n + f : f, d = this._events[c];
1366
+ return d ? d.fn ? 1 : d.length : 0;
1367
+ }, a.prototype.emit = function(f, c, d, g, w, y) {
1368
+ var O = n ? n + f : f;
1369
+ if (!this._events[O])
1370
1370
  return !1;
1371
- var h = this._events[M], O = arguments.length, v, w;
1372
- if (h.fn) {
1373
- switch (h.once && this.removeListener(u, h.fn, void 0, !0), O) {
1371
+ var v = this._events[O], x = arguments.length, b, S;
1372
+ if (v.fn) {
1373
+ switch (v.once && this.removeListener(f, v.fn, void 0, !0), x) {
1374
1374
  case 1:
1375
- return h.fn.call(h.context), !0;
1375
+ return v.fn.call(v.context), !0;
1376
1376
  case 2:
1377
- return h.fn.call(h.context, c), !0;
1377
+ return v.fn.call(v.context, c), !0;
1378
1378
  case 3:
1379
- return h.fn.call(h.context, c, l), !0;
1379
+ return v.fn.call(v.context, c, d), !0;
1380
1380
  case 4:
1381
- return h.fn.call(h.context, c, l, d), !0;
1381
+ return v.fn.call(v.context, c, d, g), !0;
1382
1382
  case 5:
1383
- return h.fn.call(h.context, c, l, d, m), !0;
1383
+ return v.fn.call(v.context, c, d, g, w), !0;
1384
1384
  case 6:
1385
- return h.fn.call(h.context, c, l, d, m, _), !0;
1385
+ return v.fn.call(v.context, c, d, g, w, y), !0;
1386
1386
  }
1387
- for (w = 1, v = new Array(O - 1); w < O; w++)
1388
- v[w - 1] = arguments[w];
1389
- h.fn.apply(h.context, v);
1387
+ for (S = 1, b = new Array(x - 1); S < x; S++)
1388
+ b[S - 1] = arguments[S];
1389
+ v.fn.apply(v.context, b);
1390
1390
  } else {
1391
- var S = h.length, p;
1392
- for (w = 0; w < S; w++)
1393
- switch (h[w].once && this.removeListener(u, h[w].fn, void 0, !0), O) {
1391
+ var M = v.length, R;
1392
+ for (S = 0; S < M; S++)
1393
+ switch (v[S].once && this.removeListener(f, v[S].fn, void 0, !0), x) {
1394
1394
  case 1:
1395
- h[w].fn.call(h[w].context);
1395
+ v[S].fn.call(v[S].context);
1396
1396
  break;
1397
1397
  case 2:
1398
- h[w].fn.call(h[w].context, c);
1398
+ v[S].fn.call(v[S].context, c);
1399
1399
  break;
1400
1400
  case 3:
1401
- h[w].fn.call(h[w].context, c, l);
1401
+ v[S].fn.call(v[S].context, c, d);
1402
1402
  break;
1403
1403
  case 4:
1404
- h[w].fn.call(h[w].context, c, l, d);
1404
+ v[S].fn.call(v[S].context, c, d, g);
1405
1405
  break;
1406
1406
  default:
1407
- if (!v)
1408
- for (p = 1, v = new Array(O - 1); p < O; p++)
1409
- v[p - 1] = arguments[p];
1410
- h[w].fn.apply(h[w].context, v);
1407
+ if (!b)
1408
+ for (R = 1, b = new Array(x - 1); R < x; R++)
1409
+ b[R - 1] = arguments[R];
1410
+ v[S].fn.apply(v[S].context, b);
1411
1411
  }
1412
1412
  }
1413
1413
  return !0;
1414
- }, o.prototype.on = function(u, c, l) {
1415
- return a(this, u, c, l, !1);
1416
- }, o.prototype.once = function(u, c, l) {
1417
- return a(this, u, c, l, !0);
1418
- }, o.prototype.removeListener = function(u, c, l, d) {
1419
- var m = n ? n + u : u;
1420
- if (!this._events[m])
1414
+ }, a.prototype.on = function(f, c, d) {
1415
+ return o(this, f, c, d, !1);
1416
+ }, a.prototype.once = function(f, c, d) {
1417
+ return o(this, f, c, d, !0);
1418
+ }, a.prototype.removeListener = function(f, c, d, g) {
1419
+ var w = n ? n + f : f;
1420
+ if (!this._events[w])
1421
1421
  return this;
1422
1422
  if (!c)
1423
- return r(this, m), this;
1424
- var _ = this._events[m];
1425
- if (_.fn)
1426
- _.fn === c && (!d || _.once) && (!l || _.context === l) && r(this, m);
1423
+ return r(this, w), this;
1424
+ var y = this._events[w];
1425
+ if (y.fn)
1426
+ y.fn === c && (!g || y.once) && (!d || y.context === d) && r(this, w);
1427
1427
  else {
1428
- for (var M = 0, h = [], O = _.length; M < O; M++)
1429
- (_[M].fn !== c || d && !_[M].once || l && _[M].context !== l) && h.push(_[M]);
1430
- h.length ? this._events[m] = h.length === 1 ? h[0] : h : r(this, m);
1428
+ for (var O = 0, v = [], x = y.length; O < x; O++)
1429
+ (y[O].fn !== c || g && !y[O].once || d && y[O].context !== d) && v.push(y[O]);
1430
+ v.length ? this._events[w] = v.length === 1 ? v[0] : v : r(this, w);
1431
1431
  }
1432
1432
  return this;
1433
- }, o.prototype.removeAllListeners = function(u) {
1433
+ }, a.prototype.removeAllListeners = function(f) {
1434
1434
  var c;
1435
- return u ? (c = n ? n + u : u, this._events[c] && r(this, c)) : (this._events = new s(), this._eventsCount = 0), this;
1436
- }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = n, o.EventEmitter = o, t.exports = o;
1437
- })(st);
1438
- var De = st.exports, Yt = function(t, e) {
1439
- e || (e = {}), typeof e == "function" && (e = { cmp: e });
1440
- var n = typeof e.cycles == "boolean" ? e.cycles : !1, s = e.cmp && function(a) {
1435
+ return f ? (c = n ? n + f : f, this._events[c] && r(this, c)) : (this._events = new s(), this._eventsCount = 0), this;
1436
+ }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = n, a.EventEmitter = a, e.exports = a;
1437
+ })(tn);
1438
+ var gt = tn.exports, ss = function(e, t) {
1439
+ t || (t = {}), typeof t == "function" && (t = { cmp: t });
1440
+ var n = typeof t.cycles == "boolean" ? t.cycles : !1, s = t.cmp && function(o) {
1441
1441
  return function(r) {
1442
- return function(o, f) {
1443
- var u = { key: o, value: r[o] }, c = { key: f, value: r[f] };
1444
- return a(u, c);
1442
+ return function(a, u) {
1443
+ var f = { key: a, value: r[a] }, c = { key: u, value: r[u] };
1444
+ return o(f, c);
1445
1445
  };
1446
1446
  };
1447
- }(e.cmp), i = [];
1448
- return function a(r) {
1447
+ }(t.cmp), i = [];
1448
+ return function o(r) {
1449
1449
  if (r && r.toJSON && typeof r.toJSON == "function" && (r = r.toJSON()), r !== void 0) {
1450
1450
  if (typeof r == "number")
1451
1451
  return isFinite(r) ? "" + r : "null";
1452
1452
  if (typeof r != "object")
1453
1453
  return JSON.stringify(r);
1454
- var o, f;
1454
+ var a, u;
1455
1455
  if (Array.isArray(r)) {
1456
- for (f = "[", o = 0; o < r.length; o++)
1457
- o && (f += ","), f += a(r[o]) || "null";
1458
- return f + "]";
1456
+ for (u = "[", a = 0; a < r.length; a++)
1457
+ a && (u += ","), u += o(r[a]) || "null";
1458
+ return u + "]";
1459
1459
  }
1460
1460
  if (r === null)
1461
1461
  return "null";
@@ -1464,221 +1464,221 @@ var De = st.exports, Yt = function(t, e) {
1464
1464
  return JSON.stringify("__cycle__");
1465
1465
  throw new TypeError("Converting circular structure to JSON");
1466
1466
  }
1467
- var u = i.push(r) - 1, c = Object.keys(r).sort(s && s(r));
1468
- for (f = "", o = 0; o < c.length; o++) {
1469
- var l = c[o], d = a(r[l]);
1470
- d && (f && (f += ","), f += JSON.stringify(l) + ":" + d);
1467
+ var f = i.push(r) - 1, c = Object.keys(r).sort(s && s(r));
1468
+ for (u = "", a = 0; a < c.length; a++) {
1469
+ var d = c[a], g = o(r[d]);
1470
+ g && (u && (u += ","), u += JSON.stringify(d) + ":" + g);
1471
1471
  }
1472
- return i.splice(u, 1), "{" + f + "}";
1472
+ return i.splice(f, 1), "{" + u + "}";
1473
1473
  }
1474
- }(t);
1474
+ }(e);
1475
1475
  };
1476
- const it = /* @__PURE__ */ We(Yt);
1477
- var se;
1478
- (function(t) {
1479
- t.mp_debug = "mp_debug";
1480
- })(se || (se = {}));
1481
- const Xt = () => {
1476
+ const nn = /* @__PURE__ */ lt(ss);
1477
+ var $e;
1478
+ (function(e) {
1479
+ e.mp_debug = "mp_debug";
1480
+ })($e || ($e = {}));
1481
+ const is = () => {
1482
1482
  try {
1483
1483
  return window !== window.top;
1484
1484
  } catch {
1485
1485
  return !1;
1486
1486
  }
1487
- }, rt = {
1488
- version: le,
1487
+ }, sn = {
1488
+ version: Ge,
1489
1489
  metaframes: {}
1490
1490
  };
1491
- class Qt extends De.EventEmitter {
1491
+ class rs extends gt.EventEmitter {
1492
1492
  constructor() {
1493
- super(), this._definition = rt, this.getDefinition = this.getDefinition.bind(this);
1493
+ super(), this._definition = sn, this.getDefinition = this.getDefinition.bind(this);
1494
1494
  }
1495
- error(e) {
1495
+ error(t) {
1496
1496
  throw "Subclass should implement";
1497
1497
  }
1498
1498
  getDefinition() {
1499
1499
  return this._definition;
1500
1500
  }
1501
1501
  }
1502
- const ce = (t, e) => e ? g(t, (n) => {
1503
- Object.keys(e).forEach((s) => {
1504
- e[s] === void 0 ? delete n[s] : n[s] = e[s];
1502
+ const Be = (e, t) => t ? C(e, (n) => {
1503
+ Object.keys(t).forEach((s) => {
1504
+ t[s] === void 0 ? delete n[s] : n[s] = t[s];
1505
1505
  });
1506
- }) : t, _n = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, gn = () => new URLSearchParams(window.location.search).has(se.mp_debug), ve = () => {
1507
- const t = new URLSearchParams(window.location.search).get(se.mp_debug);
1508
- return t === "true" || t === "1";
1509
- }, bn = (t = 8) => je(t), Zt = (t = 8) => je(t), wn = (t = 8) => je(t), Be = "abcdefghijklmnopqrstuvwxyz0123456789", je = (t = 8) => {
1510
- for (var e = "", n = Be.length, s = 0; s < t; s++)
1511
- e += Be.charAt(Math.floor(Math.random() * n));
1512
- return e;
1513
- }, Ce = (t, e, n) => {
1514
- e = e || "000", e && e.trim() == "" && (e = void 0);
1506
+ }) : e, Zs = (e) => window.location.search ? new URLSearchParams(window.location.search).get(e) : null, ei = () => new URLSearchParams(window.location.search).has($e.mp_debug), ut = () => {
1507
+ const e = new URLSearchParams(window.location.search).get($e.mp_debug);
1508
+ return e === "true" || e === "1";
1509
+ }, ti = (e = 8) => bt(e), os = (e = 8) => bt(e), ni = (e = 8) => bt(e), Dt = "abcdefghijklmnopqrstuvwxyz0123456789", bt = (e = 8) => {
1510
+ for (var t = "", n = Dt.length, s = 0; s < e; s++)
1511
+ t += Dt.charAt(Math.floor(Math.random() * n));
1512
+ return t;
1513
+ }, vt = (e, t, n) => {
1514
+ t = t || "000", t && t.trim() == "" && (t = void 0);
1515
1515
  let s;
1516
- if (typeof t == "string" ? s = t : typeof t == "number" ? s = t + "" : s = JSON.stringify(t, null, " "), e && e.trim() != "") {
1517
- var i = `color: #${e}`;
1516
+ if (typeof e == "string" ? s = e : typeof e == "number" ? s = e + "" : s = JSON.stringify(e, null, " "), t && t.trim() != "") {
1517
+ var i = `color: #${t}`;
1518
1518
  n && (i = `${i}; background: #${n}`), s = `%c${s}`, window.console.log(s, i);
1519
1519
  } else
1520
1520
  window.console.log(s);
1521
- }, ot = (t) => tn(en(t)), en = (t) => {
1522
- var e = 0;
1523
- for (let n = 0; n < t.length; n++)
1524
- e = t.charCodeAt(n) + ((e << 5) - e);
1525
- return e;
1526
- }, tn = (t) => {
1527
- var e = (t & 16777215).toString(16).toUpperCase();
1528
- return "00000".substring(0, 6 - e.length) + e;
1529
- }, de = () => document.readyState == "complete" || document.readyState == "interactive", Pe = async () => de() ? Promise.resolve() : new Promise((t) => {
1530
- if (de()) {
1531
- t();
1521
+ }, rn = (e) => us(as(e)), as = (e) => {
1522
+ var t = 0;
1523
+ for (let n = 0; n < e.length; n++)
1524
+ t = e.charCodeAt(n) + ((t << 5) - t);
1525
+ return t;
1526
+ }, us = (e) => {
1527
+ var t = (e & 16777215).toString(16).toUpperCase();
1528
+ return "00000".substring(0, 6 - t.length) + t;
1529
+ }, Qe = () => document.readyState == "complete" || document.readyState == "interactive", wt = async () => Qe() ? Promise.resolve() : new Promise((e) => {
1530
+ if (Qe()) {
1531
+ e();
1532
1532
  return;
1533
1533
  }
1534
- let e = !1;
1534
+ let t = !1;
1535
1535
  window.addEventListener("load", () => {
1536
- e || (e = !0, t());
1536
+ t || (t = !0, e());
1537
1537
  }), setTimeout(() => {
1538
- !e && de() && (e = !0, t());
1538
+ !t && Qe() && (t = !0, e());
1539
1539
  }, 200);
1540
- }), vn = async (t) => {
1541
- const e = it(t);
1542
- return await at(e);
1543
- }, Mn = async (t) => {
1544
- const e = it({
1545
- version: t.version,
1546
- metaframes: t.metaframes
1540
+ }), si = async (e) => {
1541
+ const t = nn(e);
1542
+ return await on(t);
1543
+ }, ii = async (e) => {
1544
+ const t = nn({
1545
+ version: e.version,
1546
+ metaframes: e.metaframes
1547
1547
  });
1548
- return await at(e);
1548
+ return await on(t);
1549
1549
  };
1550
- async function at(t) {
1551
- const n = new TextEncoder().encode(t), s = await crypto.subtle.digest("SHA-256", n);
1550
+ async function on(e) {
1551
+ const n = new TextEncoder().encode(e), s = await crypto.subtle.digest("SHA-256", n);
1552
1552
  return btoa(String.fromCharCode(...new Uint8Array(s)));
1553
1553
  }
1554
- var V;
1555
- (function(t) {
1556
- t.WaitingForPageLoad = "WaitingForPageLoad", t.SentSetupIframeClientRequest = "SentSetupIframeClientRequest", t.Ready = "Ready";
1557
- })(V || (V = {}));
1558
- var R;
1559
- (function(t) {
1560
- t.Connected = "connected", t.Error = "error", t.Input = "input", t.Inputs = "inputs", t.Message = "message";
1561
- })(R || (R = {}));
1562
- class L extends De.EventEmitter {
1563
- constructor(e) {
1564
- if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = V.WaitingForPageLoad, this._messageSendCount = 0, this.debug = ve(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = ve(), this._isIframe = Xt(), 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) {
1554
+ var he;
1555
+ (function(e) {
1556
+ e.WaitingForPageLoad = "WaitingForPageLoad", e.SentSetupIframeClientRequest = "SentSetupIframeClientRequest", e.Ready = "Ready";
1557
+ })(he || (he = {}));
1558
+ var F;
1559
+ (function(e) {
1560
+ e.Connected = "connected", e.Error = "error", e.Input = "input", e.Inputs = "inputs", e.Message = "message";
1561
+ })(F || (F = {}));
1562
+ class te extends gt.EventEmitter {
1563
+ constructor(t) {
1564
+ if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = he.WaitingForPageLoad, this._messageSendCount = 0, this.debug = ut(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = ut(), this._isIframe = is(), 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) {
1565
1565
  this.log("Not an iframe, metaframe code disabled");
1566
1566
  return;
1567
1567
  }
1568
1568
  const n = this;
1569
- Pe().then(() => {
1570
- this.log("pageLoaded"), window.addEventListener("message", this.onMessage), n.sendRpc(j.SetupIframeClientRequest, {
1571
- version: L.version
1572
- }), n._state = V.SentSetupIframeClientRequest;
1573
- }), e && e.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
1574
- }
1575
- _resolveSetupIframeServerResponse(e) {
1576
- if (this._state === V.WaitingForPageLoad)
1569
+ wt().then(() => {
1570
+ this.log("pageLoaded"), window.addEventListener("message", this.onMessage), n.sendRpc(Q.SetupIframeClientRequest, {
1571
+ version: te.version
1572
+ }), n._state = he.SentSetupIframeClientRequest;
1573
+ }), t && t.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
1574
+ }
1575
+ _resolveSetupIframeServerResponse(t) {
1576
+ if (this._state === he.WaitingForPageLoad)
1577
1577
  throw "Got message but page has not finished loading, we should never get in this state";
1578
- (async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = ot(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 te(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = V.Ready, this.sendRpc(j.SetupIframeServerResponseAck, {
1579
- version: L.version
1580
- }), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(R.Inputs, this._inputPipeValues), Object.keys(this._inputPipeValues).forEach((n) => this.emit(R.Input, n, this._inputPipeValues[n]))), this.emit(R.Inputs, this._inputPipeValues), this.emit(R.Connected)))();
1578
+ (async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = t.version, this.color = rn(this.id), this._parentId = t.parentId, this.log(`metapage[${this._parentId}](v${this._parentVersion ? this._parentVersion : "unknown"}) registered`), t.state && t.state.inputs && (this.isInputOutputBlobSerialization ? this._inputPipeValues = await Ie(t.state.inputs) : this._inputPipeValues = t.state.inputs), this._state = he.Ready, this.sendRpc(Q.SetupIframeServerResponseAck, {
1579
+ version: te.version
1580
+ }), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(F.Inputs, this._inputPipeValues), Object.keys(this._inputPipeValues).forEach((n) => this.emit(F.Input, n, this._inputPipeValues[n]))), this.emit(F.Inputs, this._inputPipeValues), this.emit(F.Connected)))();
1581
1581
  }
1582
1582
  async connected() {
1583
- if (this._state !== V.Ready)
1584
- return new Promise((e, n) => {
1583
+ if (this._state !== he.Ready)
1584
+ return new Promise((t, n) => {
1585
1585
  let s;
1586
- s = this.addListenerReturnDisposer(R.Connected, () => {
1587
- e(), s();
1586
+ s = this.addListenerReturnDisposer(F.Connected, () => {
1587
+ t(), s();
1588
1588
  });
1589
1589
  });
1590
1590
  }
1591
- addListenerReturnDisposer(e, n) {
1592
- return super.addListener(e, n), () => {
1593
- super.removeListener(e, n);
1591
+ addListenerReturnDisposer(t, n) {
1592
+ return super.addListener(t, n), () => {
1593
+ super.removeListener(t, n);
1594
1594
  };
1595
1595
  }
1596
- log(e, n, s) {
1597
- this.debug && this.logInternal(e, n || this.color);
1596
+ log(t, n, s) {
1597
+ this.debug && this.logInternal(t, n || this.color);
1598
1598
  }
1599
- warn(e) {
1600
- this.debug && this.logInternal(e, "000", this.color);
1599
+ warn(t) {
1600
+ this.debug && this.logInternal(t, "000", this.color);
1601
1601
  }
1602
- error(e) {
1603
- this.logInternal(e, this.color, "f00");
1602
+ error(t) {
1603
+ this.logInternal(t, this.color, "f00");
1604
1604
  }
1605
- logInternal(e, n, s) {
1605
+ logInternal(t, n, s) {
1606
1606
  let i;
1607
- typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), n = n && n + "", i = (this.id ? `Metaframe[${this.id}] ` : "") + `${i}`, Ce(i, n, s);
1607
+ typeof t == "string" ? i = t : typeof t == "number" ? i = t + "" : i = JSON.stringify(t), n = n && n + "", i = (this.id ? `Metaframe[${this.id}] ` : "") + `${i}`, vt(i, n, s);
1608
1608
  }
1609
1609
  dispose() {
1610
1610
  super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this.disableNotifyOnHashUrlChange(), this._inputPipeValues = void 0, this._outputPipeValues = void 0;
1611
1611
  }
1612
- addListener(e, n) {
1613
- return super.addListener(e, n), e === R.Inputs && window.setTimeout(() => {
1612
+ addListener(t, n) {
1613
+ return super.addListener(t, n), t === F.Inputs && window.setTimeout(() => {
1614
1614
  this._inputPipeValues && n(this._inputPipeValues);
1615
1615
  }, 0), this;
1616
1616
  }
1617
- onInput(e, n) {
1618
- return this.addListenerReturnDisposer(R.Input, (s, i) => {
1619
- e === s && n(i);
1617
+ onInput(t, n) {
1618
+ return this.addListenerReturnDisposer(F.Input, (s, i) => {
1619
+ t === s && n(i);
1620
1620
  });
1621
1621
  }
1622
- onInputs(e) {
1623
- return this.addListenerReturnDisposer(R.Inputs, e);
1622
+ onInputs(t) {
1623
+ return this.addListenerReturnDisposer(F.Inputs, t);
1624
1624
  }
1625
- setInput(e, n) {
1625
+ setInput(t, n) {
1626
1626
  var s = {};
1627
- s[e] = n, this.setInputs(s);
1627
+ s[t] = n, this.setInputs(s);
1628
1628
  }
1629
- async setInputs(e) {
1630
- this.isInputOutputBlobSerialization && (e = await te(e)), this.sendRpc(j.InputsUpdate, e);
1629
+ async setInputs(t) {
1630
+ this.isInputOutputBlobSerialization && (t = await Ie(t)), this.sendRpc(Q.InputsUpdate, t);
1631
1631
  }
1632
- async setInternalInputsAndNotify(e) {
1633
- this.isInputOutputBlobSerialization && (e = await te(e));
1634
- const n = e;
1635
- if (this._inputPipeValues = ce(this._inputPipeValues, e), this._inputPipeValues !== n) {
1636
- Object.keys(e).forEach((s) => {
1632
+ async setInternalInputsAndNotify(t) {
1633
+ this.isInputOutputBlobSerialization && (t = await Ie(t));
1634
+ const n = t;
1635
+ if (this._inputPipeValues = Be(this._inputPipeValues, t), this._inputPipeValues !== n) {
1636
+ Object.keys(t).forEach((s) => {
1637
1637
  try {
1638
- this.emit(R.Input, s, e[s]);
1638
+ this.emit(F.Input, s, t[s]);
1639
1639
  } catch (i) {
1640
- console.error(`Error emitting input ${s}: ${i}`), this.emit(R.Error, `Error emitting input ${s}: ${i}`);
1640
+ console.error(`Error emitting input ${s}: ${i}`), this.emit(F.Error, `Error emitting input ${s}: ${i}`);
1641
1641
  }
1642
1642
  });
1643
1643
  try {
1644
- this.emit(R.Inputs, e);
1644
+ this.emit(F.Inputs, t);
1645
1645
  } catch (s) {
1646
- console.error(`Error emitting inputs: ${s}`), this.emit(R.Error, `Error emitting inputs: ${s}`);
1646
+ console.error(`Error emitting inputs: ${s}`), this.emit(F.Error, `Error emitting inputs: ${s}`);
1647
1647
  }
1648
1648
  }
1649
1649
  }
1650
- getInput(e) {
1651
- return console.assert(!!e), this._inputPipeValues[e];
1650
+ getInput(t) {
1651
+ return console.assert(!!t), this._inputPipeValues[t];
1652
1652
  }
1653
1653
  getInputs() {
1654
1654
  return this._inputPipeValues;
1655
1655
  }
1656
- setOutput(e, n) {
1657
- console.assert(!!e);
1656
+ setOutput(t, n) {
1657
+ console.assert(!!t);
1658
1658
  var s = {};
1659
- s[e] = n, this.setOutputs(s);
1659
+ s[t] = n, this.setOutputs(s);
1660
1660
  }
1661
- async setOutputs(e) {
1662
- this.isInputOutputBlobSerialization && (e = await he(e));
1663
- const n = e;
1664
- this._outputPipeValues = ce(this._outputPipeValues, e), this._outputPipeValues !== n && this.sendRpc(j.OutputsUpdate, e);
1661
+ async setOutputs(t) {
1662
+ this.isInputOutputBlobSerialization && (t = await Ve(t));
1663
+ const n = t;
1664
+ this._outputPipeValues = Be(this._outputPipeValues, t), this._outputPipeValues !== n && this.sendRpc(Q.OutputsUpdate, t);
1665
1665
  }
1666
1666
  disableNotifyOnHashUrlChange() {
1667
1667
  window.removeEventListener("hashchange", this._onHashUrlChange);
1668
1668
  }
1669
- _onHashUrlChange(e) {
1669
+ _onHashUrlChange(t) {
1670
1670
  const n = {
1671
1671
  hash: window.location.hash,
1672
1672
  metaframe: this.id
1673
1673
  };
1674
- this.sendRpc(j.HashParamsUpdate, n);
1674
+ this.sendRpc(Q.HashParamsUpdate, n);
1675
1675
  }
1676
- sendRpc(e, n) {
1676
+ sendRpc(t, n) {
1677
1677
  if (this._isIframe) {
1678
1678
  const s = {
1679
1679
  jsonrpc: "2.0",
1680
1680
  id: ++this._messageSendCount,
1681
- method: e,
1681
+ method: t,
1682
1682
  params: n,
1683
1683
  iframeId: this.id,
1684
1684
  parentId: this._parentId
@@ -1687,46 +1687,935 @@ class L extends De.EventEmitter {
1687
1687
  } else
1688
1688
  this.log("Cannot send JSON-RPC window message: there is no window.parent which means we are not an iframe");
1689
1689
  }
1690
- onMessage(e) {
1691
- if (typeof e.data == "object") {
1692
- let s = e.data;
1690
+ onMessage(t) {
1691
+ if (typeof t.data == "object") {
1692
+ let s = t.data;
1693
1693
  if (s.jsonrpc === "2.0") {
1694
1694
  var n = s.method;
1695
- if (!(n == x.SetupIframeServerResponse || s.parentId == this._parentId && s.iframeId == this.id)) {
1695
+ if (!(n == ce.SetupIframeServerResponse || s.parentId == this._parentId && s.iframeId == this.id)) {
1696
1696
  this.log(`window.message: received message but jsonrpc.parentId=${s.parentId} _parentId=${this._parentId} jsonrpc.iframeId=${s.iframeId} id=${this.id}`);
1697
1697
  return;
1698
1698
  }
1699
1699
  switch (n) {
1700
- case x.SetupIframeServerResponse:
1700
+ case ce.SetupIframeServerResponse:
1701
1701
  this._resolveSetupIframeServerResponse(s.params);
1702
1702
  break;
1703
- case x.InputsUpdate:
1704
- if (this._state !== V.Ready)
1703
+ case ce.InputsUpdate:
1704
+ if (this._state !== he.Ready)
1705
1705
  throw "Got InputsUpdate but metaframe is not MetaframeLoadingState.Ready";
1706
1706
  this.setInternalInputsAndNotify(s.params.inputs);
1707
1707
  break;
1708
- case x.MessageAck:
1708
+ case ce.MessageAck:
1709
1709
  this.debug && this.log(`ACK: ${JSON.stringify(s)}`);
1710
1710
  break;
1711
1711
  default:
1712
1712
  this.debug && this.log(`window.message: unknown JSON-RPC method: ${JSON.stringify(s)}`);
1713
1713
  break;
1714
1714
  }
1715
- this.emit(R.Message, s);
1715
+ this.emit(F.Message, s);
1716
1716
  }
1717
1717
  }
1718
1718
  }
1719
1719
  }
1720
- L.version = ct;
1721
- L.ERROR = R.Error;
1722
- L.CONNECTED = R.Connected;
1723
- L.INPUT = R.Input;
1724
- L.INPUTS = R.Inputs;
1725
- L.MESSAGE = R.Message;
1726
- L.deserializeInputs = te;
1727
- L.serializeInputs = he;
1728
- class nn extends De.EventEmitter {
1729
- constructor(e, n, s, i, a, r = !1) {
1720
+ te.version = _n;
1721
+ te.ERROR = F.Error;
1722
+ te.CONNECTED = F.Connected;
1723
+ te.INPUT = F.Input;
1724
+ te.INPUTS = F.Inputs;
1725
+ te.MESSAGE = F.Message;
1726
+ te.deserializeInputs = Ie;
1727
+ te.serializeInputs = Ve;
1728
+ var Ke = {};
1729
+ const ie = "\\\\/", Pt = `[^${ie}]`, ue = "\\.", cs = "\\+", fs = "\\?", We = "\\/", ls = "(?=.)", an = "[^/]", Rt = `(?:${We}|$)`, un = `(?:^|${We})`, At = `${ue}{1,2}${Rt}`, ps = `(?!${ue})`, hs = `(?!${un}${At})`, ds = `(?!${ue}{0,1}${Rt})`, ms = `(?!${At})`, ys = `[^.${We}]`, _s = `${an}*?`, gs = "/", cn = {
1730
+ DOT_LITERAL: ue,
1731
+ PLUS_LITERAL: cs,
1732
+ QMARK_LITERAL: fs,
1733
+ SLASH_LITERAL: We,
1734
+ ONE_CHAR: ls,
1735
+ QMARK: an,
1736
+ END_ANCHOR: Rt,
1737
+ DOTS_SLASH: At,
1738
+ NO_DOT: ps,
1739
+ NO_DOTS: hs,
1740
+ NO_DOT_SLASH: ds,
1741
+ NO_DOTS_SLASH: ms,
1742
+ QMARK_NO_DOT: ys,
1743
+ STAR: _s,
1744
+ START_ANCHOR: un,
1745
+ SEP: gs
1746
+ }, bs = {
1747
+ ...cn,
1748
+ SLASH_LITERAL: `[${ie}]`,
1749
+ QMARK: Pt,
1750
+ STAR: `${Pt}*?`,
1751
+ DOTS_SLASH: `${ue}{1,2}(?:[${ie}]|$)`,
1752
+ NO_DOT: `(?!${ue})`,
1753
+ NO_DOTS: `(?!(?:^|[${ie}])${ue}{1,2}(?:[${ie}]|$))`,
1754
+ NO_DOT_SLASH: `(?!${ue}{0,1}(?:[${ie}]|$))`,
1755
+ NO_DOTS_SLASH: `(?!${ue}{1,2}(?:[${ie}]|$))`,
1756
+ QMARK_NO_DOT: `[^.${ie}]`,
1757
+ START_ANCHOR: `(?:^|[${ie}])`,
1758
+ END_ANCHOR: `(?:[${ie}]|$)`,
1759
+ SEP: "\\"
1760
+ }, vs = {
1761
+ alnum: "a-zA-Z0-9",
1762
+ alpha: "a-zA-Z",
1763
+ ascii: "\\x00-\\x7F",
1764
+ blank: " \\t",
1765
+ cntrl: "\\x00-\\x1F\\x7F",
1766
+ digit: "0-9",
1767
+ graph: "\\x21-\\x7E",
1768
+ lower: "a-z",
1769
+ print: "\\x20-\\x7E ",
1770
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
1771
+ space: " \\t\\r\\n\\v\\f",
1772
+ upper: "A-Z",
1773
+ word: "A-Za-z0-9_",
1774
+ xdigit: "A-Fa-f0-9"
1775
+ };
1776
+ var Je = {
1777
+ MAX_LENGTH: 1024 * 64,
1778
+ POSIX_REGEX_SOURCE: vs,
1779
+ // regular expressions
1780
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
1781
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
1782
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
1783
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
1784
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
1785
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
1786
+ // Replace globs with equivalent patterns to reduce parsing time.
1787
+ REPLACEMENTS: {
1788
+ "***": "*",
1789
+ "**/**": "**",
1790
+ "**/**/**": "**"
1791
+ },
1792
+ // Digits
1793
+ CHAR_0: 48,
1794
+ /* 0 */
1795
+ CHAR_9: 57,
1796
+ /* 9 */
1797
+ // Alphabet chars.
1798
+ CHAR_UPPERCASE_A: 65,
1799
+ /* A */
1800
+ CHAR_LOWERCASE_A: 97,
1801
+ /* a */
1802
+ CHAR_UPPERCASE_Z: 90,
1803
+ /* Z */
1804
+ CHAR_LOWERCASE_Z: 122,
1805
+ /* z */
1806
+ CHAR_LEFT_PARENTHESES: 40,
1807
+ /* ( */
1808
+ CHAR_RIGHT_PARENTHESES: 41,
1809
+ /* ) */
1810
+ CHAR_ASTERISK: 42,
1811
+ /* * */
1812
+ // Non-alphabetic chars.
1813
+ CHAR_AMPERSAND: 38,
1814
+ /* & */
1815
+ CHAR_AT: 64,
1816
+ /* @ */
1817
+ CHAR_BACKWARD_SLASH: 92,
1818
+ /* \ */
1819
+ CHAR_CARRIAGE_RETURN: 13,
1820
+ /* \r */
1821
+ CHAR_CIRCUMFLEX_ACCENT: 94,
1822
+ /* ^ */
1823
+ CHAR_COLON: 58,
1824
+ /* : */
1825
+ CHAR_COMMA: 44,
1826
+ /* , */
1827
+ CHAR_DOT: 46,
1828
+ /* . */
1829
+ CHAR_DOUBLE_QUOTE: 34,
1830
+ /* " */
1831
+ CHAR_EQUAL: 61,
1832
+ /* = */
1833
+ CHAR_EXCLAMATION_MARK: 33,
1834
+ /* ! */
1835
+ CHAR_FORM_FEED: 12,
1836
+ /* \f */
1837
+ CHAR_FORWARD_SLASH: 47,
1838
+ /* / */
1839
+ CHAR_GRAVE_ACCENT: 96,
1840
+ /* ` */
1841
+ CHAR_HASH: 35,
1842
+ /* # */
1843
+ CHAR_HYPHEN_MINUS: 45,
1844
+ /* - */
1845
+ CHAR_LEFT_ANGLE_BRACKET: 60,
1846
+ /* < */
1847
+ CHAR_LEFT_CURLY_BRACE: 123,
1848
+ /* { */
1849
+ CHAR_LEFT_SQUARE_BRACKET: 91,
1850
+ /* [ */
1851
+ CHAR_LINE_FEED: 10,
1852
+ /* \n */
1853
+ CHAR_NO_BREAK_SPACE: 160,
1854
+ /* \u00A0 */
1855
+ CHAR_PERCENT: 37,
1856
+ /* % */
1857
+ CHAR_PLUS: 43,
1858
+ /* + */
1859
+ CHAR_QUESTION_MARK: 63,
1860
+ /* ? */
1861
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
1862
+ /* > */
1863
+ CHAR_RIGHT_CURLY_BRACE: 125,
1864
+ /* } */
1865
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
1866
+ /* ] */
1867
+ CHAR_SEMICOLON: 59,
1868
+ /* ; */
1869
+ CHAR_SINGLE_QUOTE: 39,
1870
+ /* ' */
1871
+ CHAR_SPACE: 32,
1872
+ /* */
1873
+ CHAR_TAB: 9,
1874
+ /* \t */
1875
+ CHAR_UNDERSCORE: 95,
1876
+ /* _ */
1877
+ CHAR_VERTICAL_LINE: 124,
1878
+ /* | */
1879
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
1880
+ /* \uFEFF */
1881
+ /**
1882
+ * Create EXTGLOB_CHARS
1883
+ */
1884
+ extglobChars(e) {
1885
+ return {
1886
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${e.STAR})` },
1887
+ "?": { type: "qmark", open: "(?:", close: ")?" },
1888
+ "+": { type: "plus", open: "(?:", close: ")+" },
1889
+ "*": { type: "star", open: "(?:", close: ")*" },
1890
+ "@": { type: "at", open: "(?:", close: ")" }
1891
+ };
1892
+ },
1893
+ /**
1894
+ * Create GLOB_CHARS
1895
+ */
1896
+ globChars(e) {
1897
+ return e === !0 ? bs : cn;
1898
+ }
1899
+ };
1900
+ (function(e) {
1901
+ const {
1902
+ REGEX_BACKSLASH: t,
1903
+ REGEX_REMOVE_BACKSLASH: n,
1904
+ REGEX_SPECIAL_CHARS: s,
1905
+ REGEX_SPECIAL_CHARS_GLOBAL: i
1906
+ } = Je;
1907
+ e.isObject = (o) => o !== null && typeof o == "object" && !Array.isArray(o), e.hasRegexChars = (o) => s.test(o), e.isRegexChar = (o) => o.length === 1 && e.hasRegexChars(o), e.escapeRegex = (o) => o.replace(i, "\\$1"), e.toPosixSlashes = (o) => o.replace(t, "/"), e.removeBackslashes = (o) => o.replace(n, (r) => r === "\\" ? "" : r), e.supportsLookbehinds = () => {
1908
+ const o = process.version.slice(1).split(".").map(Number);
1909
+ return o.length === 3 && o[0] >= 9 || o[0] === 8 && o[1] >= 10;
1910
+ }, e.escapeLast = (o, r, a) => {
1911
+ const u = o.lastIndexOf(r, a);
1912
+ return u === -1 ? o : o[u - 1] === "\\" ? e.escapeLast(o, r, u - 1) : `${o.slice(0, u)}\\${o.slice(u)}`;
1913
+ }, e.removePrefix = (o, r = {}) => {
1914
+ let a = o;
1915
+ return a.startsWith("./") && (a = a.slice(2), r.prefix = "./"), a;
1916
+ }, e.wrapOutput = (o, r = {}, a = {}) => {
1917
+ const u = a.contains ? "" : "^", f = a.contains ? "" : "$";
1918
+ let c = `${u}(?:${o})${f}`;
1919
+ return r.negated === !0 && (c = `(?:^(?!${c}).*$)`), c;
1920
+ }, e.basename = (o, { windows: r } = {}) => r ? o.replace(/[\\/]$/, "").replace(/.*[\\/]/, "") : o.replace(/\/$/, "").replace(/.*\//, "");
1921
+ })(Ke);
1922
+ const Ht = Ke, {
1923
+ CHAR_ASTERISK: Ye,
1924
+ /* * */
1925
+ CHAR_AT: ws,
1926
+ /* @ */
1927
+ CHAR_BACKWARD_SLASH: Ee,
1928
+ /* \ */
1929
+ CHAR_COMMA: Rs,
1930
+ /* , */
1931
+ CHAR_DOT: Ze,
1932
+ /* . */
1933
+ CHAR_EXCLAMATION_MARK: kt,
1934
+ /* ! */
1935
+ CHAR_FORWARD_SLASH: fn,
1936
+ /* / */
1937
+ CHAR_LEFT_CURLY_BRACE: et,
1938
+ /* { */
1939
+ CHAR_LEFT_PARENTHESES: tt,
1940
+ /* ( */
1941
+ CHAR_LEFT_SQUARE_BRACKET: As,
1942
+ /* [ */
1943
+ CHAR_PLUS: Ss,
1944
+ /* + */
1945
+ CHAR_QUESTION_MARK: Nt,
1946
+ /* ? */
1947
+ CHAR_RIGHT_CURLY_BRACE: Os,
1948
+ /* } */
1949
+ CHAR_RIGHT_PARENTHESES: jt,
1950
+ /* ) */
1951
+ CHAR_RIGHT_SQUARE_BRACKET: Es
1952
+ /* ] */
1953
+ } = Je, Ut = (e) => e === fn || e === Ee, Bt = (e) => {
1954
+ e.isPrefix !== !0 && (e.depth = e.isGlobstar ? 1 / 0 : 1);
1955
+ }, Ms = (e, t) => {
1956
+ const n = t || {}, s = e.length - 1, i = n.parts === !0 || n.scanToEnd === !0, o = [], r = [], a = [];
1957
+ let u = e, f = -1, c = 0, d = 0, g = !1, w = !1, y = !1, O = !1, v = !1, x = !1, b = !1, S = !1, M = !1, R = 0, P, A, L = { value: "", depth: 0, isGlob: !1 };
1958
+ const z = () => f >= s, h = () => u.charCodeAt(f + 1), k = () => (P = A, u.charCodeAt(++f));
1959
+ for (; f < s; ) {
1960
+ A = k();
1961
+ let K;
1962
+ if (A === Ee) {
1963
+ b = L.backslashes = !0, A = k(), A === et && (x = !0);
1964
+ continue;
1965
+ }
1966
+ if (x === !0 || A === et) {
1967
+ for (R++; z() !== !0 && (A = k()); ) {
1968
+ if (A === Ee) {
1969
+ b = L.backslashes = !0, k();
1970
+ continue;
1971
+ }
1972
+ if (A === et) {
1973
+ R++;
1974
+ continue;
1975
+ }
1976
+ if (x !== !0 && A === Ze && (A = k()) === Ze) {
1977
+ if (g = L.isBrace = !0, y = L.isGlob = !0, M = !0, i === !0)
1978
+ continue;
1979
+ break;
1980
+ }
1981
+ if (x !== !0 && A === Rs) {
1982
+ if (g = L.isBrace = !0, y = L.isGlob = !0, M = !0, i === !0)
1983
+ continue;
1984
+ break;
1985
+ }
1986
+ if (A === Os && (R--, R === 0)) {
1987
+ x = !1, g = L.isBrace = !0, M = !0;
1988
+ break;
1989
+ }
1990
+ }
1991
+ if (i === !0)
1992
+ continue;
1993
+ break;
1994
+ }
1995
+ if (A === fn) {
1996
+ if (o.push(f), r.push(L), L = { value: "", depth: 0, isGlob: !1 }, M === !0)
1997
+ continue;
1998
+ if (P === Ze && f === c + 1) {
1999
+ c += 2;
2000
+ continue;
2001
+ }
2002
+ d = f + 1;
2003
+ continue;
2004
+ }
2005
+ if (n.noext !== !0 && (A === Ss || A === ws || A === Ye || A === Nt || A === kt) === !0 && h() === tt) {
2006
+ if (y = L.isGlob = !0, O = L.isExtglob = !0, M = !0, i === !0) {
2007
+ for (; z() !== !0 && (A = k()); ) {
2008
+ if (A === Ee) {
2009
+ b = L.backslashes = !0, A = k();
2010
+ continue;
2011
+ }
2012
+ if (A === jt) {
2013
+ y = L.isGlob = !0, M = !0;
2014
+ break;
2015
+ }
2016
+ }
2017
+ continue;
2018
+ }
2019
+ break;
2020
+ }
2021
+ if (A === Ye) {
2022
+ if (P === Ye && (v = L.isGlobstar = !0), y = L.isGlob = !0, M = !0, i === !0)
2023
+ continue;
2024
+ break;
2025
+ }
2026
+ if (A === Nt) {
2027
+ if (y = L.isGlob = !0, M = !0, i === !0)
2028
+ continue;
2029
+ break;
2030
+ }
2031
+ if (A === As)
2032
+ for (; z() !== !0 && (K = k()); ) {
2033
+ if (K === Ee) {
2034
+ b = L.backslashes = !0, k();
2035
+ continue;
2036
+ }
2037
+ if (K === Es) {
2038
+ if (w = L.isBracket = !0, y = L.isGlob = !0, M = !0, i === !0)
2039
+ continue;
2040
+ break;
2041
+ }
2042
+ }
2043
+ if (n.nonegate !== !0 && A === kt && f === c) {
2044
+ S = L.negated = !0, c++;
2045
+ continue;
2046
+ }
2047
+ if (n.noparen !== !0 && A === tt) {
2048
+ if (y = L.isGlob = !0, i === !0) {
2049
+ for (; z() !== !0 && (A = k()); ) {
2050
+ if (A === tt) {
2051
+ b = L.backslashes = !0, A = k();
2052
+ continue;
2053
+ }
2054
+ if (A === jt) {
2055
+ M = !0;
2056
+ break;
2057
+ }
2058
+ }
2059
+ continue;
2060
+ }
2061
+ break;
2062
+ }
2063
+ if (y === !0) {
2064
+ if (M = !0, i === !0)
2065
+ continue;
2066
+ break;
2067
+ }
2068
+ }
2069
+ n.noext === !0 && (O = !1, y = !1);
2070
+ let H = u, pe = "", l = "";
2071
+ c > 0 && (pe = u.slice(0, c), u = u.slice(c), d -= c), H && y === !0 && d > 0 ? (H = u.slice(0, d), l = u.slice(d)) : y === !0 ? (H = "", l = u) : H = u, H && H !== "" && H !== "/" && H !== u && Ut(H.charCodeAt(H.length - 1)) && (H = H.slice(0, -1)), n.unescape === !0 && (l && (l = Ht.removeBackslashes(l)), H && b === !0 && (H = Ht.removeBackslashes(H)));
2072
+ const p = {
2073
+ prefix: pe,
2074
+ input: e,
2075
+ start: c,
2076
+ base: H,
2077
+ glob: l,
2078
+ isBrace: g,
2079
+ isBracket: w,
2080
+ isGlob: y,
2081
+ isExtglob: O,
2082
+ isGlobstar: v,
2083
+ negated: S
2084
+ };
2085
+ if (n.tokens === !0 && (p.maxDepth = 0, Ut(A) || r.push(L), p.tokens = r), n.parts === !0 || n.tokens === !0) {
2086
+ let K;
2087
+ for (let D = 0; D < o.length; D++) {
2088
+ const se = K ? K + 1 : c, oe = o[D], X = e.slice(se, oe);
2089
+ n.tokens && (D === 0 && c !== 0 ? (r[D].isPrefix = !0, r[D].value = pe) : r[D].value = X, Bt(r[D]), p.maxDepth += r[D].depth), (D !== 0 || X !== "") && a.push(X), K = oe;
2090
+ }
2091
+ if (K && K + 1 < e.length) {
2092
+ const D = e.slice(K + 1);
2093
+ a.push(D), n.tokens && (r[r.length - 1].value = D, Bt(r[r.length - 1]), p.maxDepth += r[r.length - 1].depth);
2094
+ }
2095
+ p.slashes = o, p.parts = a;
2096
+ }
2097
+ return p;
2098
+ };
2099
+ var Is = Ms;
2100
+ const Fe = Je, Z = Ke, {
2101
+ MAX_LENGTH: ze,
2102
+ POSIX_REGEX_SOURCE: Cs,
2103
+ REGEX_NON_SPECIAL_CHARS: $s,
2104
+ REGEX_SPECIAL_CHARS_BACKREF: xs,
2105
+ REPLACEMENTS: ln
2106
+ } = Fe, Ls = (e, t) => {
2107
+ if (typeof t.expandRange == "function")
2108
+ return t.expandRange(...e, t);
2109
+ e.sort();
2110
+ const n = `[${e.join("-")}]`;
2111
+ try {
2112
+ new RegExp(n);
2113
+ } catch {
2114
+ return e.map((i) => Z.escapeRegex(i)).join("..");
2115
+ }
2116
+ return n;
2117
+ }, ve = (e, t) => `Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`, pn = (e, t) => {
2118
+ if (typeof e != "string")
2119
+ throw new TypeError("Expected a string");
2120
+ e = ln[e] || e;
2121
+ const n = { ...t }, s = typeof n.maxLength == "number" ? Math.min(ze, n.maxLength) : ze;
2122
+ let i = e.length;
2123
+ if (i > s)
2124
+ throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);
2125
+ const o = { type: "bos", value: "", output: n.prepend || "" }, r = [o], a = n.capture ? "" : "?:", u = Fe.globChars(n.windows), f = Fe.extglobChars(u), {
2126
+ DOT_LITERAL: c,
2127
+ PLUS_LITERAL: d,
2128
+ SLASH_LITERAL: g,
2129
+ ONE_CHAR: w,
2130
+ DOTS_SLASH: y,
2131
+ NO_DOT: O,
2132
+ NO_DOT_SLASH: v,
2133
+ NO_DOTS_SLASH: x,
2134
+ QMARK: b,
2135
+ QMARK_NO_DOT: S,
2136
+ STAR: M,
2137
+ START_ANCHOR: R
2138
+ } = u, P = (_) => `(${a}(?:(?!${R}${_.dot ? y : c}).)*?)`, A = n.dot ? "" : O, L = n.dot ? b : S;
2139
+ let z = n.bash === !0 ? P(n) : M;
2140
+ n.capture && (z = `(${z})`), typeof n.noext == "boolean" && (n.noextglob = n.noext);
2141
+ const h = {
2142
+ input: e,
2143
+ index: -1,
2144
+ start: 0,
2145
+ dot: n.dot === !0,
2146
+ consumed: "",
2147
+ output: "",
2148
+ prefix: "",
2149
+ backtrack: !1,
2150
+ negated: !1,
2151
+ brackets: 0,
2152
+ braces: 0,
2153
+ parens: 0,
2154
+ quotes: 0,
2155
+ globstar: !1,
2156
+ tokens: r
2157
+ };
2158
+ e = Z.removePrefix(e, h), i = e.length;
2159
+ const k = [], H = [], pe = [];
2160
+ let l = o, p;
2161
+ const K = () => h.index === i - 1, D = h.peek = (_ = 1) => e[h.index + _], se = h.advance = () => e[++h.index], oe = () => e.slice(h.index + 1), X = (_ = "", N = 0) => {
2162
+ h.consumed += _, h.index += N;
2163
+ }, Le = (_) => {
2164
+ h.output += _.output != null ? _.output : _.value, X(_.value);
2165
+ }, mn = () => {
2166
+ let _ = 1;
2167
+ for (; D() === "!" && (D(2) !== "(" || D(3) === "?"); )
2168
+ se(), h.start++, _++;
2169
+ return _ % 2 === 0 ? !1 : (h.negated = !0, h.start++, !0);
2170
+ }, Te = (_) => {
2171
+ h[_]++, pe.push(_);
2172
+ }, me = (_) => {
2173
+ h[_]--, pe.pop();
2174
+ }, I = (_) => {
2175
+ if (l.type === "globstar") {
2176
+ const N = h.braces > 0 && (_.type === "comma" || _.type === "brace"), m = _.extglob === !0 || k.length && (_.type === "pipe" || _.type === "paren");
2177
+ _.type !== "slash" && _.type !== "paren" && !N && !m && (h.output = h.output.slice(0, -l.output.length), l.type = "star", l.value = "*", l.output = z, h.output += l.output);
2178
+ }
2179
+ if (k.length && _.type !== "paren" && !f[_.value] && (k[k.length - 1].inner += _.value), (_.value || _.output) && Le(_), l && l.type === "text" && _.type === "text") {
2180
+ l.value += _.value, l.output = (l.output || "") + _.value;
2181
+ return;
2182
+ }
2183
+ _.prev = l, r.push(_), l = _;
2184
+ }, De = (_, N) => {
2185
+ const m = { ...f[N], conditions: 1, inner: "" };
2186
+ m.prev = l, m.parens = h.parens, m.output = h.output;
2187
+ const T = (n.capture ? "(" : "") + m.open;
2188
+ Te("parens"), I({ type: _, value: N, output: h.output ? "" : w }), I({ type: "paren", extglob: !0, value: se(), output: T }), k.push(m);
2189
+ }, yn = (_) => {
2190
+ let N = _.close + (n.capture ? ")" : "");
2191
+ if (_.type === "negate") {
2192
+ let m = z;
2193
+ _.inner && _.inner.length > 1 && _.inner.includes("/") && (m = P(n)), (m !== z || K() || /^\)+$/.test(oe())) && (N = _.close = `)$))${m}`), _.prev.type === "bos" && K() && (h.negatedExtglob = !0);
2194
+ }
2195
+ I({ type: "paren", extglob: !0, value: p, output: N }), me("parens");
2196
+ };
2197
+ if (n.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(e)) {
2198
+ let _ = !1, N = e.replace(xs, (m, T, j, W, G, Xe) => W === "\\" ? (_ = !0, m) : W === "?" ? T ? T + W + (G ? b.repeat(G.length) : "") : Xe === 0 ? L + (G ? b.repeat(G.length) : "") : b.repeat(j.length) : W === "." ? c.repeat(j.length) : W === "*" ? T ? T + W + (G ? z : "") : z : T ? m : `\\${m}`);
2199
+ return _ === !0 && (n.unescape === !0 ? N = N.replace(/\\/g, "") : N = N.replace(/\\+/g, (m) => m.length % 2 === 0 ? "\\\\" : m ? "\\" : "")), N === e && n.contains === !0 ? (h.output = e, h) : (h.output = Z.wrapOutput(N, h, t), h);
2200
+ }
2201
+ for (; !K(); ) {
2202
+ if (p = se(), p === "\0")
2203
+ continue;
2204
+ if (p === "\\") {
2205
+ const m = D();
2206
+ if (m === "/" && n.bash !== !0 || m === "." || m === ";")
2207
+ continue;
2208
+ if (!m) {
2209
+ p += "\\", I({ type: "text", value: p });
2210
+ continue;
2211
+ }
2212
+ const T = /^\\+/.exec(oe());
2213
+ let j = 0;
2214
+ if (T && T[0].length > 2 && (j = T[0].length, h.index += j, j % 2 !== 0 && (p += "\\")), n.unescape === !0 ? p = se() || "" : p += se() || "", h.brackets === 0) {
2215
+ I({ type: "text", value: p });
2216
+ continue;
2217
+ }
2218
+ }
2219
+ if (h.brackets > 0 && (p !== "]" || l.value === "[" || l.value === "[^")) {
2220
+ if (n.posix !== !1 && p === ":") {
2221
+ const m = l.value.slice(1);
2222
+ if (m.includes("[") && (l.posix = !0, m.includes(":"))) {
2223
+ const T = l.value.lastIndexOf("["), j = l.value.slice(0, T), W = l.value.slice(T + 2), G = Cs[W];
2224
+ if (G) {
2225
+ l.value = j + G, h.backtrack = !0, se(), !o.output && r.indexOf(l) === 1 && (o.output = w);
2226
+ continue;
2227
+ }
2228
+ }
2229
+ }
2230
+ (p === "[" && D() !== ":" || p === "-" && D() === "]") && (p = `\\${p}`), p === "]" && (l.value === "[" || l.value === "[^") && (p = `\\${p}`), n.posix === !0 && p === "!" && l.value === "[" && (p = "^"), l.value += p, Le({ value: p });
2231
+ continue;
2232
+ }
2233
+ if (h.quotes === 1 && p !== '"') {
2234
+ p = Z.escapeRegex(p), l.value += p, Le({ value: p });
2235
+ continue;
2236
+ }
2237
+ if (p === '"') {
2238
+ h.quotes = h.quotes === 1 ? 0 : 1, n.keepQuotes === !0 && I({ type: "text", value: p });
2239
+ continue;
2240
+ }
2241
+ if (p === "(") {
2242
+ Te("parens"), I({ type: "paren", value: p });
2243
+ continue;
2244
+ }
2245
+ if (p === ")") {
2246
+ if (h.parens === 0 && n.strictBrackets === !0)
2247
+ throw new SyntaxError(ve("opening", "("));
2248
+ const m = k[k.length - 1];
2249
+ if (m && h.parens === m.parens + 1) {
2250
+ yn(k.pop());
2251
+ continue;
2252
+ }
2253
+ I({ type: "paren", value: p, output: h.parens ? ")" : "\\)" }), me("parens");
2254
+ continue;
2255
+ }
2256
+ if (p === "[") {
2257
+ if (n.nobracket === !0 || !oe().includes("]")) {
2258
+ if (n.nobracket !== !0 && n.strictBrackets === !0)
2259
+ throw new SyntaxError(ve("closing", "]"));
2260
+ p = `\\${p}`;
2261
+ } else
2262
+ Te("brackets");
2263
+ I({ type: "bracket", value: p });
2264
+ continue;
2265
+ }
2266
+ if (p === "]") {
2267
+ if (n.nobracket === !0 || l && l.type === "bracket" && l.value.length === 1) {
2268
+ I({ type: "text", value: p, output: `\\${p}` });
2269
+ continue;
2270
+ }
2271
+ if (h.brackets === 0) {
2272
+ if (n.strictBrackets === !0)
2273
+ throw new SyntaxError(ve("opening", "["));
2274
+ I({ type: "text", value: p, output: `\\${p}` });
2275
+ continue;
2276
+ }
2277
+ me("brackets");
2278
+ const m = l.value.slice(1);
2279
+ if (l.posix !== !0 && m[0] === "^" && !m.includes("/") && (p = `/${p}`), l.value += p, Le({ value: p }), n.literalBrackets === !1 || Z.hasRegexChars(m))
2280
+ continue;
2281
+ const T = Z.escapeRegex(l.value);
2282
+ if (h.output = h.output.slice(0, -l.value.length), n.literalBrackets === !0) {
2283
+ h.output += T, l.value = T;
2284
+ continue;
2285
+ }
2286
+ l.value = `(${a}${T}|${l.value})`, h.output += l.value;
2287
+ continue;
2288
+ }
2289
+ if (p === "{" && n.nobrace !== !0) {
2290
+ Te("braces");
2291
+ const m = {
2292
+ type: "brace",
2293
+ value: p,
2294
+ output: "(",
2295
+ outputIndex: h.output.length,
2296
+ tokensIndex: h.tokens.length
2297
+ };
2298
+ H.push(m), I(m);
2299
+ continue;
2300
+ }
2301
+ if (p === "}") {
2302
+ const m = H[H.length - 1];
2303
+ if (n.nobrace === !0 || !m) {
2304
+ I({ type: "text", value: p, output: p });
2305
+ continue;
2306
+ }
2307
+ let T = ")";
2308
+ if (m.dots === !0) {
2309
+ const j = r.slice(), W = [];
2310
+ for (let G = j.length - 1; G >= 0 && (r.pop(), j[G].type !== "brace"); G--)
2311
+ j[G].type !== "dots" && W.unshift(j[G].value);
2312
+ T = Ls(W, n), h.backtrack = !0;
2313
+ }
2314
+ if (m.comma !== !0 && m.dots !== !0) {
2315
+ const j = h.output.slice(0, m.outputIndex), W = h.tokens.slice(m.tokensIndex);
2316
+ m.value = m.output = "\\{", p = T = "\\}", h.output = j;
2317
+ for (const G of W)
2318
+ h.output += G.output || G.value;
2319
+ }
2320
+ I({ type: "brace", value: p, output: T }), me("braces"), H.pop();
2321
+ continue;
2322
+ }
2323
+ if (p === "|") {
2324
+ k.length > 0 && k[k.length - 1].conditions++, I({ type: "text", value: p });
2325
+ continue;
2326
+ }
2327
+ if (p === ",") {
2328
+ let m = p;
2329
+ const T = H[H.length - 1];
2330
+ T && pe[pe.length - 1] === "braces" && (T.comma = !0, m = "|"), I({ type: "comma", value: p, output: m });
2331
+ continue;
2332
+ }
2333
+ if (p === "/") {
2334
+ if (l.type === "dot" && h.index === h.start + 1) {
2335
+ h.start = h.index + 1, h.consumed = "", h.output = "", r.pop(), l = o;
2336
+ continue;
2337
+ }
2338
+ I({ type: "slash", value: p, output: g });
2339
+ continue;
2340
+ }
2341
+ if (p === ".") {
2342
+ if (h.braces > 0 && l.type === "dot") {
2343
+ l.value === "." && (l.output = c);
2344
+ const m = H[H.length - 1];
2345
+ l.type = "dots", l.output += p, l.value += p, m.dots = !0;
2346
+ continue;
2347
+ }
2348
+ if (h.braces + h.parens === 0 && l.type !== "bos" && l.type !== "slash") {
2349
+ I({ type: "text", value: p, output: c });
2350
+ continue;
2351
+ }
2352
+ I({ type: "dot", value: p, output: c });
2353
+ continue;
2354
+ }
2355
+ if (p === "?") {
2356
+ if (!(l && l.value === "(") && n.noextglob !== !0 && D() === "(" && D(2) !== "?") {
2357
+ De("qmark", p);
2358
+ continue;
2359
+ }
2360
+ if (l && l.type === "paren") {
2361
+ const T = D();
2362
+ let j = p;
2363
+ if (T === "<" && !Z.supportsLookbehinds())
2364
+ throw new Error("Node.js v10 or higher is required for regex lookbehinds");
2365
+ (l.value === "(" && !/[!=<:]/.test(T) || T === "<" && !/<([!=]|\w+>)/.test(oe())) && (j = `\\${p}`), I({ type: "text", value: p, output: j });
2366
+ continue;
2367
+ }
2368
+ if (n.dot !== !0 && (l.type === "slash" || l.type === "bos")) {
2369
+ I({ type: "qmark", value: p, output: S });
2370
+ continue;
2371
+ }
2372
+ I({ type: "qmark", value: p, output: b });
2373
+ continue;
2374
+ }
2375
+ if (p === "!") {
2376
+ if (n.noextglob !== !0 && D() === "(" && (D(2) !== "?" || !/[!=<:]/.test(D(3)))) {
2377
+ De("negate", p);
2378
+ continue;
2379
+ }
2380
+ if (n.nonegate !== !0 && h.index === 0) {
2381
+ mn();
2382
+ continue;
2383
+ }
2384
+ }
2385
+ if (p === "+") {
2386
+ if (n.noextglob !== !0 && D() === "(" && D(2) !== "?") {
2387
+ De("plus", p);
2388
+ continue;
2389
+ }
2390
+ if (l && l.value === "(" || n.regex === !1) {
2391
+ I({ type: "plus", value: p, output: d });
2392
+ continue;
2393
+ }
2394
+ if (l && (l.type === "bracket" || l.type === "paren" || l.type === "brace") || h.parens > 0) {
2395
+ I({ type: "plus", value: p });
2396
+ continue;
2397
+ }
2398
+ I({ type: "plus", value: d });
2399
+ continue;
2400
+ }
2401
+ if (p === "@") {
2402
+ if (n.noextglob !== !0 && D() === "(" && D(2) !== "?") {
2403
+ I({ type: "at", extglob: !0, value: p, output: "" });
2404
+ continue;
2405
+ }
2406
+ I({ type: "text", value: p });
2407
+ continue;
2408
+ }
2409
+ if (p !== "*") {
2410
+ (p === "$" || p === "^") && (p = `\\${p}`);
2411
+ const m = $s.exec(oe());
2412
+ m && (p += m[0], h.index += m[0].length), I({ type: "text", value: p });
2413
+ continue;
2414
+ }
2415
+ if (l && (l.type === "globstar" || l.star === !0)) {
2416
+ l.type = "star", l.star = !0, l.value += p, l.output = z, h.backtrack = !0, h.globstar = !0, X(p);
2417
+ continue;
2418
+ }
2419
+ let _ = oe();
2420
+ if (n.noextglob !== !0 && /^\([^?]/.test(_)) {
2421
+ De("star", p);
2422
+ continue;
2423
+ }
2424
+ if (l.type === "star") {
2425
+ if (n.noglobstar === !0) {
2426
+ X(p);
2427
+ continue;
2428
+ }
2429
+ const m = l.prev, T = m.prev, j = m.type === "slash" || m.type === "bos", W = T && (T.type === "star" || T.type === "globstar");
2430
+ if (n.bash === !0 && (!j || _[0] && _[0] !== "/")) {
2431
+ I({ type: "star", value: p, output: "" });
2432
+ continue;
2433
+ }
2434
+ const G = h.braces > 0 && (m.type === "comma" || m.type === "brace"), Xe = k.length && (m.type === "pipe" || m.type === "paren");
2435
+ if (!j && m.type !== "paren" && !G && !Xe) {
2436
+ I({ type: "star", value: p, output: "" });
2437
+ continue;
2438
+ }
2439
+ for (; _.slice(0, 3) === "/**"; ) {
2440
+ const Pe = e[h.index + 4];
2441
+ if (Pe && Pe !== "/")
2442
+ break;
2443
+ _ = _.slice(3), X("/**", 3);
2444
+ }
2445
+ if (m.type === "bos" && K()) {
2446
+ l.type = "globstar", l.value += p, l.output = P(n), h.output = l.output, h.globstar = !0, X(p);
2447
+ continue;
2448
+ }
2449
+ if (m.type === "slash" && m.prev.type !== "bos" && !W && K()) {
2450
+ h.output = h.output.slice(0, -(m.output + l.output).length), m.output = `(?:${m.output}`, l.type = "globstar", l.output = P(n) + (n.strictSlashes ? ")" : "|$)"), l.value += p, h.globstar = !0, h.output += m.output + l.output, X(p);
2451
+ continue;
2452
+ }
2453
+ if (m.type === "slash" && m.prev.type !== "bos" && _[0] === "/") {
2454
+ const Pe = _[1] !== void 0 ? "|$" : "";
2455
+ h.output = h.output.slice(0, -(m.output + l.output).length), m.output = `(?:${m.output}`, l.type = "globstar", l.output = `${P(n)}${g}|${g}${Pe})`, l.value += p, h.output += m.output + l.output, h.globstar = !0, X(p + se()), I({ type: "slash", value: "/", output: "" });
2456
+ continue;
2457
+ }
2458
+ if (m.type === "bos" && _[0] === "/") {
2459
+ l.type = "globstar", l.value += p, l.output = `(?:^|${g}|${P(n)}${g})`, h.output = l.output, h.globstar = !0, X(p + se()), I({ type: "slash", value: "/", output: "" });
2460
+ continue;
2461
+ }
2462
+ h.output = h.output.slice(0, -l.output.length), l.type = "globstar", l.output = P(n), l.value += p, h.output += l.output, h.globstar = !0, X(p);
2463
+ continue;
2464
+ }
2465
+ const N = { type: "star", value: p, output: z };
2466
+ if (n.bash === !0) {
2467
+ N.output = ".*?", (l.type === "bos" || l.type === "slash") && (N.output = A + N.output), I(N);
2468
+ continue;
2469
+ }
2470
+ if (l && (l.type === "bracket" || l.type === "paren") && n.regex === !0) {
2471
+ N.output = p, I(N);
2472
+ continue;
2473
+ }
2474
+ (h.index === h.start || l.type === "slash" || l.type === "dot") && (l.type === "dot" ? (h.output += v, l.output += v) : n.dot === !0 ? (h.output += x, l.output += x) : (h.output += A, l.output += A), D() !== "*" && (h.output += w, l.output += w)), I(N);
2475
+ }
2476
+ for (; h.brackets > 0; ) {
2477
+ if (n.strictBrackets === !0)
2478
+ throw new SyntaxError(ve("closing", "]"));
2479
+ h.output = Z.escapeLast(h.output, "["), me("brackets");
2480
+ }
2481
+ for (; h.parens > 0; ) {
2482
+ if (n.strictBrackets === !0)
2483
+ throw new SyntaxError(ve("closing", ")"));
2484
+ h.output = Z.escapeLast(h.output, "("), me("parens");
2485
+ }
2486
+ for (; h.braces > 0; ) {
2487
+ if (n.strictBrackets === !0)
2488
+ throw new SyntaxError(ve("closing", "}"));
2489
+ h.output = Z.escapeLast(h.output, "{"), me("braces");
2490
+ }
2491
+ if (n.strictSlashes !== !0 && (l.type === "star" || l.type === "bracket") && I({ type: "maybe_slash", value: "", output: `${g}?` }), h.backtrack === !0) {
2492
+ h.output = "";
2493
+ for (const _ of h.tokens)
2494
+ h.output += _.output != null ? _.output : _.value, _.suffix && (h.output += _.suffix);
2495
+ }
2496
+ return h;
2497
+ };
2498
+ pn.fastpaths = (e, t) => {
2499
+ const n = { ...t }, s = typeof n.maxLength == "number" ? Math.min(ze, n.maxLength) : ze, i = e.length;
2500
+ if (i > s)
2501
+ throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);
2502
+ e = ln[e] || e;
2503
+ const {
2504
+ DOT_LITERAL: o,
2505
+ SLASH_LITERAL: r,
2506
+ ONE_CHAR: a,
2507
+ DOTS_SLASH: u,
2508
+ NO_DOT: f,
2509
+ NO_DOTS: c,
2510
+ NO_DOTS_SLASH: d,
2511
+ STAR: g,
2512
+ START_ANCHOR: w
2513
+ } = Fe.globChars(n.windows), y = n.dot ? c : f, O = n.dot ? d : f, v = n.capture ? "" : "?:", x = { negated: !1, prefix: "" };
2514
+ let b = n.bash === !0 ? ".*?" : g;
2515
+ n.capture && (b = `(${b})`);
2516
+ const S = (A) => A.noglobstar === !0 ? b : `(${v}(?:(?!${w}${A.dot ? u : o}).)*?)`, M = (A) => {
2517
+ switch (A) {
2518
+ case "*":
2519
+ return `${y}${a}${b}`;
2520
+ case ".*":
2521
+ return `${o}${a}${b}`;
2522
+ case "*.*":
2523
+ return `${y}${b}${o}${a}${b}`;
2524
+ case "*/*":
2525
+ return `${y}${b}${r}${a}${O}${b}`;
2526
+ case "**":
2527
+ return y + S(n);
2528
+ case "**/*":
2529
+ return `(?:${y}${S(n)}${r})?${O}${a}${b}`;
2530
+ case "**/*.*":
2531
+ return `(?:${y}${S(n)}${r})?${O}${b}${o}${a}${b}`;
2532
+ case "**/.*":
2533
+ return `(?:${y}${S(n)}${r})?${o}${a}${b}`;
2534
+ default: {
2535
+ const L = /^(.*?)\.(\w+)$/.exec(A);
2536
+ if (!L)
2537
+ return;
2538
+ const z = M(L[1]);
2539
+ return z ? z + o + L[2] : void 0;
2540
+ }
2541
+ }
2542
+ }, R = Z.removePrefix(e, x);
2543
+ let P = M(R);
2544
+ return P && n.strictSlashes !== !0 && (P += `${r}?`), P;
2545
+ };
2546
+ var Ts = pn;
2547
+ const Ds = Is, ct = Ts, hn = Ke, Ps = Je, Hs = (e) => e && typeof e == "object" && !Array.isArray(e), B = (e, t, n = !1) => {
2548
+ if (Array.isArray(e)) {
2549
+ const c = e.map((g) => B(g, t, n));
2550
+ return (g) => {
2551
+ for (const w of c) {
2552
+ const y = w(g);
2553
+ if (y)
2554
+ return y;
2555
+ }
2556
+ return !1;
2557
+ };
2558
+ }
2559
+ const s = Hs(e) && e.tokens && e.input;
2560
+ if (e === "" || typeof e != "string" && !s)
2561
+ throw new TypeError("Expected pattern to be a non-empty string");
2562
+ const i = t || {}, o = i.windows, r = s ? B.compileRe(e, t) : B.makeRe(e, t, !1, !0), a = r.state;
2563
+ delete r.state;
2564
+ let u = () => !1;
2565
+ if (i.ignore) {
2566
+ const c = { ...t, ignore: null, onMatch: null, onResult: null };
2567
+ u = B(i.ignore, c, n);
2568
+ }
2569
+ const f = (c, d = !1) => {
2570
+ const { isMatch: g, match: w, output: y } = B.test(c, r, t, { glob: e, posix: o }), O = { glob: e, state: a, regex: r, posix: o, input: c, output: y, match: w, isMatch: g };
2571
+ return typeof i.onResult == "function" && i.onResult(O), g === !1 ? (O.isMatch = !1, d ? O : !1) : u(c) ? (typeof i.onIgnore == "function" && i.onIgnore(O), O.isMatch = !1, d ? O : !1) : (typeof i.onMatch == "function" && i.onMatch(O), d ? O : !0);
2572
+ };
2573
+ return n && (f.state = a), f;
2574
+ };
2575
+ B.test = (e, t, n, { glob: s, posix: i } = {}) => {
2576
+ if (typeof e != "string")
2577
+ throw new TypeError("Expected input to be a string");
2578
+ if (e === "")
2579
+ return { isMatch: !1, output: "" };
2580
+ const o = n || {}, r = o.format || (i ? hn.toPosixSlashes : null);
2581
+ let a = e === s, u = a && r ? r(e) : e;
2582
+ return a === !1 && (u = r ? r(e) : e, a = u === s), (a === !1 || o.capture === !0) && (o.matchBase === !0 || o.basename === !0 ? a = B.matchBase(e, t, n, i) : a = t.exec(u)), { isMatch: !!a, match: a, output: u };
2583
+ };
2584
+ B.matchBase = (e, t, n) => (t instanceof RegExp ? t : B.makeRe(t, n)).test(hn.basename(e));
2585
+ B.isMatch = (e, t, n) => B(t, n)(e);
2586
+ B.parse = (e, t) => Array.isArray(e) ? e.map((n) => B.parse(n, t)) : ct(e, { ...t, fastpaths: !1 });
2587
+ B.scan = (e, t) => Ds(e, t);
2588
+ B.compileRe = (e, t, n = !1, s = !1) => {
2589
+ if (n === !0)
2590
+ return e.output;
2591
+ const i = t || {}, o = i.contains ? "" : "^", r = i.contains ? "" : "$";
2592
+ let a = `${o}(?:${e.output})${r}`;
2593
+ e && e.negated === !0 && (a = `^(?!${a}).*$`);
2594
+ const u = B.toRegex(a, t);
2595
+ return s === !0 && (u.state = e), u;
2596
+ };
2597
+ B.makeRe = (e, t, n = !1, s = !1) => {
2598
+ if (!e || typeof e != "string")
2599
+ throw new TypeError("Expected a non-empty string");
2600
+ const i = t || {};
2601
+ let o = { negated: !1, fastpaths: !0 }, r = "", a;
2602
+ return e.startsWith("./") && (e = e.slice(2), r = o.prefix = "./"), i.fastpaths !== !1 && (e[0] === "." || e[0] === "*") && (a = ct.fastpaths(e, t)), a === void 0 ? (o = ct(e, t), o.prefix = r + (o.prefix || "")) : o.output = a, B.compileRe(o, t, n, s);
2603
+ };
2604
+ B.toRegex = (e, t) => {
2605
+ try {
2606
+ const n = t || {};
2607
+ return new RegExp(e, n.flags || (n.nocase ? "i" : ""));
2608
+ } catch (n) {
2609
+ if (t && t.debug === !0)
2610
+ throw n;
2611
+ return /$^/;
2612
+ }
2613
+ };
2614
+ B.constants = Ps;
2615
+ var ks = B, Ns = ks;
2616
+ const Ft = /* @__PURE__ */ lt(Ns);
2617
+ class js extends gt.EventEmitter {
2618
+ constructor(t, n, s, i, o, r = !1) {
1730
2619
  if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._cachedEventInputsUpdate = {
1731
2620
  iframeId: void 0,
1732
2621
  inputs: void 0
@@ -1738,192 +2627,192 @@ class nn extends De.EventEmitter {
1738
2627
  n = n.substring(1);
1739
2628
  n = window.location.protocol + "//" + window.location.hostname + (window.location.port && window.location.port != "" ? ":" + window.location.port : "") + "/" + n;
1740
2629
  }
1741
- if (this.url = n, this._metapage = e, this._debug = r, r) {
1742
- var o = new URL(this.url);
1743
- o.searchParams.set(se.mp_debug, "true"), this.url = o.href;
1744
- }
1745
- this.id = s, this._parentId = i, this._color = ot(this.id), this._consoleBackgroundColor = a, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
1746
- const f = this;
1747
- this.iframe = new Promise((u) => {
1748
- Pe().then(async () => {
1749
- var c, l, d, m;
1750
- if (f._iframe) {
1751
- if ((m = (d = (l = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : l.metaframes) == null ? void 0 : d[this.id]) != null && m.allow)
1752
- f._iframe.allow = this._metapage._definition.metaframes[this.id].allow;
2630
+ if (this.url = n, this._metapage = t, this._debug = r, r) {
2631
+ var a = new URL(this.url);
2632
+ a.searchParams.set($e.mp_debug, "true"), this.url = a.href;
2633
+ }
2634
+ this.id = s, this._parentId = i, this._color = rn(this.id), this._consoleBackgroundColor = o, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
2635
+ const u = this;
2636
+ this.iframe = new Promise((f) => {
2637
+ wt().then(async () => {
2638
+ var c, d, g, w;
2639
+ if (u._iframe) {
2640
+ if ((w = (g = (d = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : d.metaframes) == null ? void 0 : g[this.id]) != null && w.allow)
2641
+ u._iframe.allow = this._metapage._definition.metaframes[this.id].allow;
1753
2642
  else {
1754
- const _ = await f.getDefinition();
1755
- if (!f._iframe)
2643
+ const y = await u.getDefinition();
2644
+ if (!u._iframe)
1756
2645
  return;
1757
- _ && _.allow && (f._iframe.allow = _.allow);
2646
+ y && y.allow && (u._iframe.allow = y.allow);
1758
2647
  }
1759
- f._iframe.src = this.url, u(f._iframe);
2648
+ u._iframe.src = this.url, f(u._iframe);
1760
2649
  }
1761
2650
  });
1762
2651
  }), this.ack = this.ack.bind(this), this.dispose = this.dispose.bind(this), this.getDefinition = this.getDefinition.bind(this), this.getDefinitionUrl = this.getDefinitionUrl.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.onOutput = this.onOutput.bind(this), this.onOutputs = this.onOutputs.bind(this), this.register = this.register.bind(this), this.registered = this.registered.bind(this), this.sendInputs = this.sendInputs.bind(this), this.sendOrBufferPostMessage = this.sendOrBufferPostMessage.bind(this), this.sendRpc = this.sendRpc.bind(this), this.sendRpcInternal = this.sendRpcInternal.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setMetapage = this.setMetapage.bind(this), this.setOutput = this.setOutput.bind(this), this.setOutputs = this.setOutputs.bind(this), this.addListenerReturnDisposer = this.addListenerReturnDisposer.bind(this), this.isDisposed = this.isDisposed.bind(this);
1763
2652
  }
1764
- addListenerReturnDisposer(e, n) {
1765
- return super.addListener(e, n), () => {
1766
- super.removeListener(e, n);
2653
+ addListenerReturnDisposer(t, n) {
2654
+ return super.addListener(t, n), () => {
2655
+ super.removeListener(t, n);
1767
2656
  };
1768
2657
  }
1769
- setMetapage(e) {
1770
- return this._metapage = e, this;
2658
+ setMetapage(t) {
2659
+ return this._metapage = t, this;
1771
2660
  }
1772
2661
  getDefinitionUrl() {
1773
- var e = new URL(this.url);
1774
- return e.pathname = e.pathname + (e.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json"), e.href;
2662
+ var t = new URL(this.url);
2663
+ return t.pathname = t.pathname + (t.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json"), t.href;
1775
2664
  }
1776
2665
  async getDefinition() {
1777
2666
  if (this._definition)
1778
2667
  return this._definition;
1779
- var e = this.getDefinitionUrl();
2668
+ var t = this.getDefinitionUrl();
1780
2669
  try {
1781
- const n = await window.fetch(e, {
2670
+ const n = await window.fetch(t, {
1782
2671
  signal: AbortSignal.timeout(6e3)
1783
2672
  });
1784
2673
  if (n.ok) {
1785
- const s = await n.json(), i = await Ft(s);
2674
+ const s = await n.json(), i = await Wn(s);
1786
2675
  return this._definition = i, this._definition;
1787
2676
  } else
1788
- this.emit(y.Error, `Failed to fetch: ${e}
2677
+ this.emit(E.Error, `Failed to fetch: ${t}
1789
2678
  Status: ${n.status}
1790
2679
  Status text: ${n.statusText}`);
1791
2680
  } catch (n) {
1792
- this.emit(y.Error, `Failed to fetch or convert: ${e}
2681
+ this.emit(E.Error, `Failed to fetch or convert: ${t}
1793
2682
  Error: ${n}`);
1794
2683
  }
1795
2684
  }
1796
- setInput(e, n) {
1797
- console.assert(!!e);
2685
+ setInput(t, n) {
2686
+ console.assert(!!t);
1798
2687
  var s = {};
1799
- s[e] = n, this.setInputs(s);
2688
+ s[t] = n, this.setInputs(s);
1800
2689
  }
1801
- setInputs(e) {
1802
- this.log({ m: "MetapageIFrameRpcClient", inputs: e });
1803
- const n = e;
1804
- if (this.inputs = ce(this.inputs, e), this.inputs === n)
2690
+ setInputs(t) {
2691
+ this.log({ m: "MetapageIFrameRpcClient", inputs: t });
2692
+ const n = t;
2693
+ if (this.inputs = Be(this.inputs, t), this.inputs === n)
1805
2694
  return this;
1806
- if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(y.Inputs, this.inputs), this._metapage.listenerCount(y.Inputs) > 0) {
2695
+ if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(t), this.emit(E.Inputs, this.inputs), this._metapage.listenerCount(E.Inputs) > 0) {
1807
2696
  var s = {};
1808
- s[this.id] = e, this._metapage.emit(y.Inputs, s);
2697
+ s[this.id] = t, this._metapage.emit(E.Inputs, s);
1809
2698
  }
1810
2699
  return this;
1811
2700
  }
1812
- setOutput(e, n) {
1813
- console.assert(!!e);
2701
+ setOutput(t, n) {
2702
+ console.assert(!!t);
1814
2703
  var s = {};
1815
- s[e] = n, this.setOutputs(s);
2704
+ s[t] = n, this.setOutputs(s);
1816
2705
  }
1817
- setOutputs(e) {
1818
- const n = e;
1819
- if (this.outputs = ce(this.outputs, e), this.outputs === n)
2706
+ setOutputs(t) {
2707
+ const n = t;
2708
+ if (this.outputs = Be(this.outputs, t), this.outputs === n)
1820
2709
  return this;
1821
- if (this.emit(y.Outputs, e), this._metapage.listenerCount(y.Outputs) > 0) {
2710
+ if (this.emit(E.Outputs, t), this._metapage.listenerCount(E.Outputs) > 0) {
1822
2711
  var s = {};
1823
- s[this.id] = this.outputs, this._metapage.emit(y.Outputs, s);
2712
+ s[this.id] = this.outputs, this._metapage.emit(E.Outputs, s);
1824
2713
  }
1825
2714
  }
1826
- onInputs(e) {
1827
- return this.addListenerReturnDisposer(y.Inputs, e);
2715
+ onInputs(t) {
2716
+ return this.addListenerReturnDisposer(E.Inputs, t);
1828
2717
  }
1829
- onInput(e, n) {
2718
+ onInput(t, n) {
1830
2719
  var s = function(i) {
1831
- i.hasOwnProperty(e) && n(i[e]);
2720
+ i.hasOwnProperty(t) && n(i[t]);
1832
2721
  };
1833
- return this.addListenerReturnDisposer(y.Inputs, s);
2722
+ return this.addListenerReturnDisposer(E.Inputs, s);
1834
2723
  }
1835
- onOutputs(e) {
1836
- return this.addListenerReturnDisposer(y.Outputs, e);
2724
+ onOutputs(t) {
2725
+ return this.addListenerReturnDisposer(E.Outputs, t);
1837
2726
  }
1838
- onOutput(e, n) {
2727
+ onOutput(t, n) {
1839
2728
  var s = function(i) {
1840
- i.hasOwnProperty(e) && n(i[e]);
2729
+ i.hasOwnProperty(t) && n(i[t]);
1841
2730
  };
1842
- return this.addListenerReturnDisposer(y.Outputs, s);
2731
+ return this.addListenerReturnDisposer(E.Outputs, s);
1843
2732
  }
1844
2733
  isDisposed() {
1845
2734
  return this.inputs === void 0;
1846
2735
  }
1847
2736
  dispose() {
1848
2737
  for (super.removeAllListeners(); this._disposables && this._disposables.length > 0; ) {
1849
- const e = this._disposables.pop();
1850
- e && e();
2738
+ const t = this._disposables.pop();
2739
+ t && t();
1851
2740
  }
1852
2741
  this._rpcListeners = void 0, this.inputs = void 0, this.outputs = void 0, this._iframe && this._iframe.parentNode && this._iframe.parentNode.removeChild(this._iframe), this._iframe = void 0, this._bufferMessages = void 0, this._bufferTimeout && (window.clearInterval(this._bufferTimeout), this._bufferTimeout = void 0), this._metapage = void 0;
1853
2742
  }
1854
2743
  register() {
1855
- var e = {
2744
+ var t = {
1856
2745
  iframeId: this.id,
1857
2746
  parentId: this._parentId,
1858
2747
  state: {
1859
2748
  inputs: this.inputs
1860
2749
  },
1861
- version: Je
2750
+ version: zt
1862
2751
  };
1863
- this.sendRpcInternal(x.SetupIframeServerResponse, e);
2752
+ this.sendRpcInternal(ce.SetupIframeServerResponse, t);
1864
2753
  }
1865
- registered(e) {
2754
+ registered(t) {
1866
2755
  if (this.log({ m: "MetapageIFrameRpcClient.registered", inputs: this.inputs }), !this._loaded) {
1867
- if (!e)
2756
+ if (!t)
1868
2757
  throw "Cannot register without a version";
1869
- for (this.version = e, this._loaded = !0; this._onLoaded && this._onLoaded.length > 0; )
2758
+ for (this.version = t, this._loaded = !0; this._onLoaded && this._onLoaded.length > 0; )
1870
2759
  this._onLoaded.pop()();
1871
2760
  this._sendInputsAfterRegistration && this.sendInputs(this.inputs);
1872
2761
  }
1873
2762
  }
1874
- async sendInputs(e) {
1875
- e && (e = await he(e), !this.isDisposed() && this.sendRpc(x.InputsUpdate, {
1876
- inputs: e,
2763
+ async sendInputs(t) {
2764
+ t && (t = await Ve(t), !this.isDisposed() && this.sendRpc(ce.InputsUpdate, {
2765
+ inputs: t,
1877
2766
  parentId: this._parentId
1878
2767
  }));
1879
2768
  }
1880
- sendRpc(e, n) {
2769
+ sendRpc(t, n) {
1881
2770
  var s, i;
1882
2771
  if ((s = this == null ? void 0 : this._iframe) != null && s.parentNode && this._loaded)
1883
- this.sendRpcInternal(e, n);
2772
+ this.sendRpcInternal(t, n);
1884
2773
  else {
1885
2774
  (i = this == null ? void 0 : this._metapage) == null || i.error("sending rpc later");
1886
- const a = this;
2775
+ const o = this;
1887
2776
  this == null || this._onLoaded.push(() => {
1888
- a.sendRpcInternal(e, n);
2777
+ o.sendRpcInternal(t, n);
1889
2778
  });
1890
2779
  }
1891
2780
  }
1892
- ack(e) {
2781
+ ack(t) {
1893
2782
  if (this.log("⚒ ⚒ ⚒ calling ack"), this._debug) {
1894
2783
  this.log("⚒ ⚒ ⚒ sending ack from client to frame");
1895
2784
  var n = {
1896
- message: e
2785
+ message: t
1897
2786
  };
1898
- this.sendRpc(x.MessageAck, n);
2787
+ this.sendRpc(ce.MessageAck, n);
1899
2788
  } else
1900
2789
  this.log("⚒ ⚒ ⚒ NOT sending ack from client to frame since not debug mode");
1901
2790
  }
1902
- log(e) {
1903
- this._debug && this.logInternal(e);
2791
+ log(t) {
2792
+ this._debug && this.logInternal(t);
1904
2793
  }
1905
- logInternal(e) {
2794
+ logInternal(t) {
1906
2795
  let n;
1907
- typeof e == "string" ? n = e : typeof e == "string" ? n = e + "" : n = JSON.stringify(e), Ce(`Metapage[${this._parentId}] Metaframe[${this.id}] ${n}`, this._color, this._consoleBackgroundColor);
2796
+ typeof t == "string" ? n = t : typeof t == "string" ? n = t + "" : n = JSON.stringify(t), vt(`Metapage[${this._parentId}] Metaframe[${this.id}] ${n}`, this._color, this._consoleBackgroundColor);
1908
2797
  }
1909
- sendRpcInternal(e, n) {
2798
+ sendRpcInternal(t, n) {
1910
2799
  const s = {
1911
2800
  id: "_",
1912
2801
  iframeId: this.id,
1913
2802
  jsonrpc: "2.0",
1914
- method: e,
2803
+ method: t,
1915
2804
  params: n,
1916
2805
  parentId: this._parentId
1917
2806
  };
1918
2807
  this._iframe ? this.sendOrBufferPostMessage(s) : this._metapage ? this._metapage.error(`Cannot send to child iframe messageJSON=${JSON.stringify(s).substring(0, 200)}`) : console.error(`Cannot send to child iframe messageJSON=${JSON.stringify(s).substring(0, 200)}`);
1919
2808
  }
1920
- sendOrBufferPostMessage(e) {
2809
+ sendOrBufferPostMessage(t) {
1921
2810
  if (this._iframe && this._iframe.contentWindow)
1922
- this._iframe.contentWindow.postMessage(e, this.url);
2811
+ this._iframe.contentWindow.postMessage(t, this.url);
1923
2812
  else if (this._bufferMessages)
1924
- this._bufferMessages.push(e);
2813
+ this._bufferMessages.push(t);
1925
2814
  else {
1926
- this._bufferMessages = [e];
2815
+ this._bufferMessages = [t];
1927
2816
  const n = this;
1928
2817
  this._bufferTimeout = window.setInterval(function() {
1929
2818
  n._iframe && n._iframe.contentWindow && (n._bufferMessages.forEach((s) => n._iframe.contentWindow.postMessage(s, n.url)), window.clearInterval(n._bufferTimeout), n._bufferTimeout = void 0, n._bufferMessages = void 0);
@@ -1931,49 +2820,49 @@ Error: ${n}`);
1931
2820
  }
1932
2821
  }
1933
2822
  }
1934
- const J = g({
2823
+ const ye = C({
1935
2824
  metaframes: {
1936
2825
  inputs: {},
1937
2826
  outputs: {}
1938
2827
  }
1939
- }, (t) => t), On = (t) => K(t), sn = (t, e) => !e || e === "*" || t === e ? !0 : e.endsWith("*") ? t.startsWith(e.slice(0, -1)) : e.startsWith("*") ? t.endsWith(e.slice(1)) : !1, rn = "bcbcbc";
1940
- class U extends Qt {
1941
- static async from(e, n) {
1942
- if (e == null)
2828
+ }, (e) => e), ri = (e) => Re(e), Us = (e, t, n) => (!t || t === "*") && (!n || n === "*") || e === t ? !0 : Ft.isMatch(e, t) ? !!(!n || n === "*" || n.endsWith("/") || Ft.isMatch(e, n)) : !1, Bs = "bcbcbc";
2829
+ class ne extends rs {
2830
+ static async from(t, n) {
2831
+ if (t == null)
1943
2832
  throw "Metapage definition cannot be null";
1944
- if (typeof e == "string")
2833
+ if (typeof t == "string")
1945
2834
  try {
1946
- e = JSON.parse(e);
2835
+ t = JSON.parse(t);
1947
2836
  } catch {
1948
2837
  throw "Cannot parse into JSON:\n${metaPageDef}";
1949
2838
  }
1950
- var s = new U();
1951
- return s.setDefinition(e);
2839
+ var s = new ne();
2840
+ return s.setDefinition(t);
1952
2841
  }
1953
- constructor(e) {
1954
- super(), this._state = J, this._metaframes = g({}, (n) => n), this.debug = ve(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = g({}, (n) => n), this._inputMap = {}, this._id = e && e.id ? e.id : Zt(), this._consoleBackgroundColor = e && e.color ? e.color : rn, 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), Pe().then(() => {
2842
+ constructor(t) {
2843
+ super(), this._state = ye, this._metaframes = C({}, (n) => n), this.debug = ut(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (n) => n), this._inputMap = {}, this._id = t && t.id ? t.id : os(), this._consoleBackgroundColor = t && t.color ? t.color : Bs, 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), wt().then(() => {
1955
2844
  this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
1956
2845
  });
1957
2846
  }
1958
2847
  isDisposed() {
1959
2848
  return this._metaframes === void 0;
1960
2849
  }
1961
- addListenerReturnDisposer(e, n) {
1962
- return super.addListener(e, n), () => {
1963
- super.removeListener(e, n);
2850
+ addListenerReturnDisposer(t, n) {
2851
+ return super.addListener(t, n), () => {
2852
+ super.removeListener(t, n);
1964
2853
  };
1965
2854
  }
1966
2855
  setDebugFromUrlParams() {
1967
- const e = new URL(window.location.href);
1968
- return this.debug = ["debug", "mp_debug"].reduce((n, s) => n || e.searchParams.get(s) === "true" || e.searchParams.get(s) === "1", !1), this;
2856
+ const t = new URL(window.location.href);
2857
+ return this.debug = ["debug", "mp_debug"].reduce((n, s) => n || t.searchParams.get(s) === "true" || t.searchParams.get(s) === "1", !1), this;
1969
2858
  }
1970
2859
  getState() {
1971
2860
  return this._state;
1972
2861
  }
1973
- setState(e) {
1974
- this._state = g(e, (n) => n), this.getMetaframeIds().forEach((n) => {
2862
+ setState(t) {
2863
+ this._state = C(t, (n) => n), this.getMetaframeIds().forEach((n) => {
1975
2864
  this.getMetaframe(n).setInputs(this._state.metaframes.inputs[n]), this.getMetaframe(n).setOutputs(this._state.metaframes.outputs[n]);
1976
- }), this.listenerCount(y.State) > 0 && J !== this._state && this.emit(y.State, this._state);
2865
+ }), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state);
1977
2866
  }
1978
2867
  getStateMetaframes() {
1979
2868
  return this._state.metaframes;
@@ -1981,61 +2870,61 @@ class U extends Qt {
1981
2870
  getDefinition() {
1982
2871
  return this._definition;
1983
2872
  }
1984
- async setDefinition(e, n) {
1985
- if (!e.version)
2873
+ async setDefinition(t, n) {
2874
+ if (!t.version)
1986
2875
  throw "Metapage definition must have a version";
1987
- const s = await Ct(e);
2876
+ const s = await Nn(t);
1988
2877
  if (this.isDisposed())
1989
2878
  return this;
1990
- s.metaframes && Object.keys(s.metaframes).forEach((a) => {
1991
- var r = s.metaframes[a];
2879
+ s.metaframes && Object.keys(s.metaframes).forEach((o) => {
2880
+ var r = s.metaframes[o];
1992
2881
  if (typeof r != "object")
1993
- throw this.emitErrorMessage(`Metaframe "${a}" is not an object`), `Metaframe "${a}" is not an object`;
2882
+ throw this.emitErrorMessage(`Metaframe "${o}" is not an object`), `Metaframe "${o}" is not an object`;
1994
2883
  if (!r.url)
1995
- throw this.emitErrorMessage(`Metaframe "${a}" missing field: url`), `Metaframe "${a}" missing field: url`;
2884
+ throw this.emitErrorMessage(`Metaframe "${o}" missing field: url`), `Metaframe "${o}" missing field: url`;
1996
2885
  });
1997
2886
  const i = this._definition;
1998
- return this._definition = s, Object.keys(this._metaframes).forEach((a) => {
1999
- (!s.metaframes || !s.metaframes[a]) && this.removeMetaframe(a);
2000
- }), n && (this._state = g(n, (a) => a)), s.metaframes && Object.keys(s.metaframes).forEach((a) => {
2001
- if (!this._metaframes.hasOwnProperty(a)) {
2002
- const r = s.metaframes[a];
2003
- this.addMetaframe(a, r);
2887
+ return this._definition = s, Object.keys(this._metaframes).forEach((o) => {
2888
+ (!s.metaframes || !s.metaframes[o]) && this.removeMetaframe(o);
2889
+ }), n && (this._state = C(n, (o) => o)), s.metaframes && Object.keys(s.metaframes).forEach((o) => {
2890
+ if (!this._metaframes.hasOwnProperty(o)) {
2891
+ const r = s.metaframes[o];
2892
+ this.addMetaframe(o, r);
2004
2893
  }
2005
- }), i !== rt && window.setTimeout(() => {
2006
- !this.isDisposed() && s === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(y.State) > 0 && J !== this._state && this.emit(y.State, this._state));
2894
+ }), i !== sn && window.setTimeout(() => {
2895
+ !this.isDisposed() && s === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state));
2007
2896
  }, 0), this;
2008
2897
  }
2009
2898
  _emitDefinitionEvent() {
2010
- if (this.listenerCount(y.Definition) > 0) {
2011
- const e = {
2899
+ if (this.listenerCount(E.Definition) > 0) {
2900
+ const t = {
2012
2901
  definition: this._definition,
2013
2902
  metaframes: this._metaframes
2014
2903
  };
2015
- this.emit(y.Definition, e);
2904
+ this.emit(E.Definition, t);
2016
2905
  }
2017
2906
  }
2018
- addPipe(e, n) {
2019
- this._inputMap = g(this._inputMap, (s) => {
2020
- s[e] || (s[e] = []), s[e].push(n);
2907
+ addPipe(t, n) {
2908
+ this._inputMap = C(this._inputMap, (s) => {
2909
+ s[t] || (s[t] = []), s[t].push(n);
2021
2910
  });
2022
2911
  }
2023
- removeMetaframe(e) {
2024
- this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = g(this._metaframes, (n) => {
2025
- delete n[e];
2026
- }), this._state = g(this._state, (n) => {
2027
- delete n.metaframes.inputs[e], delete n.metaframes.outputs[e];
2028
- }), this._inputMap = g(this._inputMap, (n) => {
2029
- delete n[e], Object.keys(n).forEach((s) => {
2912
+ removeMetaframe(t) {
2913
+ this._metaframes[t] && (this._metaframes[t].dispose(), this._metaframes = C(this._metaframes, (n) => {
2914
+ delete n[t];
2915
+ }), this._state = C(this._state, (n) => {
2916
+ delete n.metaframes.inputs[t], delete n.metaframes.outputs[t];
2917
+ }), this._inputMap = C(this._inputMap, (n) => {
2918
+ delete n[t], Object.keys(n).forEach((s) => {
2030
2919
  const i = n[s];
2031
- let a = 0;
2032
- for (; a <= i.length; )
2033
- i[a] && i[a].metaframe === e ? i.splice(a, 1) : a++;
2920
+ let o = 0;
2921
+ for (; o <= i.length; )
2922
+ i[o] && i[o].metaframe === t ? i.splice(o, 1) : o++;
2034
2923
  });
2035
- }), this._cachedInputLookupMap = g({}, (n) => n));
2924
+ }), this._cachedInputLookupMap = C({}, (n) => n));
2036
2925
  }
2037
2926
  removeAll() {
2038
- Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = g({}, (e) => e), this._state = J, this._inputMap = g({}, (e) => e), this._cachedInputLookupMap = g({}, (e) => e);
2927
+ Object.keys(this._metaframes).forEach((t) => this._metaframes[t].dispose()), this._metaframes = C({}, (t) => t), this._state = ye, this._inputMap = C({}, (t) => t), this._cachedInputLookupMap = C({}, (t) => t);
2039
2928
  }
2040
2929
  metaframes() {
2041
2930
  return this.getMetaframes();
@@ -2049,86 +2938,86 @@ class U extends Qt {
2049
2938
  getMetaframes() {
2050
2939
  return this._metaframes;
2051
2940
  }
2052
- getMetaframe(e) {
2053
- return this == null ? void 0 : this._metaframes[e];
2941
+ getMetaframe(t) {
2942
+ return this == null ? void 0 : this._metaframes[t];
2054
2943
  }
2055
- addMetaframe(e, n) {
2056
- if (!e)
2944
+ addMetaframe(t, n) {
2945
+ if (!t)
2057
2946
  throw "addMetaframe missing metaframeId";
2058
2947
  if (!n)
2059
2948
  throw "addMetaframe missing definition";
2060
- if (this._metaframes[e])
2061
- throw this.emitErrorMessage(`Existing metaframe for id=${e}`), `Existing metaframe for id=${e}`;
2949
+ if (this._metaframes[t])
2950
+ throw this.emitErrorMessage(`Existing metaframe for id=${t}`), `Existing metaframe for id=${t}`;
2062
2951
  if (!n.url)
2063
- throw this.emitErrorMessage(`Metaframe definition missing url id=${e}`), `Metaframe definition missing url id=${e}`;
2064
- var s = new nn(this, n.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
2065
- return this._metaframes = g(this._metaframes, (i) => {
2066
- i[e] = s;
2067
- }), s.addListener(y.Error, (i) => {
2068
- this.emit(y.Error, {
2952
+ throw this.emitErrorMessage(`Metaframe definition missing url id=${t}`), `Metaframe definition missing url id=${t}`;
2953
+ var s = new js(this, n.url, t, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
2954
+ return this._metaframes = C(this._metaframes, (i) => {
2955
+ i[t] = s;
2956
+ }), s.addListener(E.Error, (i) => {
2957
+ this.emit(E.Error, {
2069
2958
  metaframeId: s.id,
2070
2959
  metaframeUrl: s.url,
2071
2960
  error: i
2072
2961
  });
2073
- }), n.inputs && n.inputs.forEach((i) => this.addPipe(e, i)), s.setInputs(this._state.metaframes.inputs[e]), s;
2962
+ }), n.inputs && n.inputs.forEach((i) => this.addPipe(t, i)), s.setInputs(this._state.metaframes.inputs[t]), s;
2074
2963
  }
2075
2964
  dispose() {
2076
- this.log("disposing"), super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this._metaframes && Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._id = void 0, this._metaframes = void 0, this._state = void 0, this._cachedInputLookupMap = void 0, this._inputMap = void 0;
2965
+ this.log("disposing"), super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this._metaframes && Object.keys(this._metaframes).forEach((t) => this._metaframes[t].dispose()), this._id = void 0, this._metaframes = void 0, this._state = void 0, this._cachedInputLookupMap = void 0, this._inputMap = void 0;
2077
2966
  }
2078
- log(e, n, s) {
2079
- this.debug && this.logInternal(e, n, s);
2967
+ log(t, n, s) {
2968
+ this.debug && this.logInternal(t, n, s);
2080
2969
  }
2081
- error(e) {
2082
- this.logInternal(e, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${e}`);
2970
+ error(t) {
2971
+ this.logInternal(t, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${t}`);
2083
2972
  }
2084
- emitErrorMessage(e) {
2085
- this.emit(y.Error, e);
2973
+ emitErrorMessage(t) {
2974
+ this.emit(E.Error, t);
2086
2975
  }
2087
- getInputsFromOutput(e, n) {
2088
- return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = g(this._cachedInputLookupMap, (s) => {
2089
- s[e] = g({}, (i) => i);
2090
- })), this._cachedInputLookupMap[e][n] || (this._cachedInputLookupMap = g(this._cachedInputLookupMap, (s) => {
2976
+ getInputsFromOutput(t, n) {
2977
+ return this._cachedInputLookupMap[t] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (s) => {
2978
+ s[t] = C({}, (i) => i);
2979
+ })), this._cachedInputLookupMap[t][n] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (s) => {
2091
2980
  var i = [];
2092
- s[e][n] = i, Object.keys(this._inputMap).forEach((a) => {
2093
- a !== e && this._inputMap[a].forEach((r) => {
2094
- if (r.metaframe === e && sn(n, r.source)) {
2095
- var o = r.target;
2096
- (!r.target || r.target.startsWith("*") || r.target === "") && (o = n), i.push({ metaframe: a, pipe: o });
2981
+ s[t][n] = i, Object.keys(this._inputMap).forEach((o) => {
2982
+ o !== t && this._inputMap[o].forEach((r) => {
2983
+ if (r.metaframe === t && Us(n, r.source || "*", r.target || "*")) {
2984
+ var a = r.target;
2985
+ !r.target || r.target.startsWith("*") || r.target === "" ? a = n : a.endsWith("/") && (a = a + n), i.push({ metaframe: o, pipe: a });
2097
2986
  }
2098
2987
  });
2099
2988
  });
2100
- })), this._cachedInputLookupMap[e][n];
2989
+ })), this._cachedInputLookupMap[t][n];
2101
2990
  }
2102
- isValidJSONRpcMessage(e) {
2103
- if (e.jsonrpc !== "2.0")
2991
+ isValidJSONRpcMessage(t) {
2992
+ if (t.jsonrpc !== "2.0")
2104
2993
  return !1;
2105
- switch (e.method) {
2106
- case j.SetupIframeClientRequest:
2994
+ switch (t.method) {
2995
+ case Q.SetupIframeClientRequest:
2107
2996
  return !0;
2108
2997
  default:
2109
- var s = e.iframeId;
2110
- return !(s && !(e.parentId === this._id && this._metaframes[s]));
2998
+ var s = t.iframeId;
2999
+ return !(s && !(t.parentId === this._id && this._metaframes[s]));
2111
3000
  }
2112
3001
  }
2113
- setInput(e, n, s) {
2114
- var i, a;
2115
- typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof n == "string" ? this.setInputStateOnlyMetaframeInputValue(e, n, s) : this.setInputStateOnlyMetaframeInputMap(e, n || {}), this.setMetaframeClientInputAndSentClientEvent(e, n, s), (this.listenerCount(y.State) > 0 || this.listenerCount(y.Inputs) > 0) && J !== this._state && (this.emit(y.State, this._state), this.emit(y.Inputs, (a = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : a.inputs));
3002
+ setInput(t, n, s) {
3003
+ var i, o;
3004
+ typeof t == "object" ? this.setInputStateOnlyMetapageInstanceInputs(t) : typeof n == "string" ? this.setInputStateOnlyMetaframeInputValue(t, n, s) : this.setInputStateOnlyMetaframeInputMap(t, n || {}), this.setMetaframeClientInputAndSentClientEvent(t, n, s), (this.listenerCount(E.State) > 0 || this.listenerCount(E.Inputs) > 0) && ye !== this._state && (this.emit(E.State, this._state), this.emit(E.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
2116
3005
  }
2117
- setMetaframeClientInputAndSentClientEvent(e, n, s) {
2118
- if (typeof e == "object") {
3006
+ setMetaframeClientInputAndSentClientEvent(t, n, s) {
3007
+ if (typeof t == "object") {
2119
3008
  if (n || s)
2120
3009
  throw "bad arguments, see API docs";
2121
- const i = e;
2122
- Object.keys(i).forEach((a) => {
2123
- var r = a, o = i[r];
2124
- if (typeof o != "object")
3010
+ const i = t;
3011
+ Object.keys(i).forEach((o) => {
3012
+ var r = o, a = i[r];
3013
+ if (typeof a != "object")
2125
3014
  throw "bad arguments, see API docs";
2126
- var f = this._metaframes[r];
2127
- f ? f.setInputs(o) : this.error("No iframe id=$metaframeId");
3015
+ var u = this._metaframes[r];
3016
+ u ? u.setInputs(a) : this.error("No iframe id=$metaframeId");
2128
3017
  });
2129
- } else if (typeof e == "string") {
2130
- const i = this._metaframes[e];
2131
- if (i == null && this.error(`No iframe id=${e}`), typeof n == "string")
3018
+ } else if (typeof t == "string") {
3019
+ const i = this._metaframes[t];
3020
+ if (i == null && this.error(`No iframe id=${t}`), typeof n == "string")
2132
3021
  i.setInput(n, s);
2133
3022
  else if (typeof n == "object")
2134
3023
  i.setInputs(n);
@@ -2137,218 +3026,218 @@ class U extends Qt {
2137
3026
  } else
2138
3027
  throw "bad arguments, see API docs";
2139
3028
  }
2140
- setInputs(e, n, s) {
2141
- this.setInput(e, n, s);
3029
+ setInputs(t, n, s) {
3030
+ this.setInput(t, n, s);
2142
3031
  }
2143
- setOutputStateOnlyMetapageInstanceInputs(e) {
2144
- this._setStateOnlyMetaframes(!1, e);
3032
+ setOutputStateOnlyMetapageInstanceInputs(t) {
3033
+ this._setStateOnlyMetaframes(!1, t);
2145
3034
  }
2146
- setOutputStateOnlyMetaframeInputValue(e, n, s) {
2147
- this._setStateOnlyMetaframeInputValue(!1, e, n, s);
3035
+ setOutputStateOnlyMetaframeInputValue(t, n, s) {
3036
+ this._setStateOnlyMetaframeInputValue(!1, t, n, s);
2148
3037
  }
2149
- setOutputStateOnlyMetaframeInputMap(e, n) {
2150
- this._setStateOnlyMetaframeInputMap(!1, e, n);
3038
+ setOutputStateOnlyMetaframeInputMap(t, n) {
3039
+ this._setStateOnlyMetaframeInputMap(!1, t, n);
2151
3040
  }
2152
- setInputStateOnlyMetapageInstanceInputs(e) {
2153
- this._setStateOnlyMetaframes(!0, e);
3041
+ setInputStateOnlyMetapageInstanceInputs(t) {
3042
+ this._setStateOnlyMetaframes(!0, t);
2154
3043
  }
2155
- setInputStateOnlyMetaframeInputValue(e, n, s) {
2156
- this._setStateOnlyMetaframeInputValue(!0, e, n, s);
3044
+ setInputStateOnlyMetaframeInputValue(t, n, s) {
3045
+ this._setStateOnlyMetaframeInputValue(!0, t, n, s);
2157
3046
  }
2158
- setInputStateOnlyMetaframeInputMap(e, n) {
2159
- this._setStateOnlyMetaframeInputMap(!0, e, n);
3047
+ setInputStateOnlyMetaframeInputMap(t, n) {
3048
+ this._setStateOnlyMetaframeInputMap(!0, t, n);
2160
3049
  }
2161
- _setStateOnlyMetaframeInputValue(e, n, s, i) {
2162
- this._state = g(this._state, (a) => {
3050
+ _setStateOnlyMetaframeInputValue(t, n, s, i) {
3051
+ this._state = C(this._state, (o) => {
2163
3052
  if (!this._metaframes.hasOwnProperty(n))
2164
3053
  throw `No metaframe: ${n}`;
2165
- a.metaframes || (a.metaframes = { inputs: {}, outputs: {} }), e ? a.metaframes.inputs || (a.metaframes.inputs = {}) : a.metaframes.outputs || (a.metaframes.outputs = {});
2166
- let o = e ? a.metaframes.inputs : a.metaframes.outputs;
2167
- o = o || {}, o[n] = o[n] ? o[n] : {}, i === void 0 ? delete o[n][s] : o[n][s] = i;
3054
+ o.metaframes || (o.metaframes = { inputs: {}, outputs: {} }), t ? o.metaframes.inputs || (o.metaframes.inputs = {}) : o.metaframes.outputs || (o.metaframes.outputs = {});
3055
+ let a = t ? o.metaframes.inputs : o.metaframes.outputs;
3056
+ a = a || {}, a[n] = a[n] ? a[n] : {}, i === void 0 ? delete a[n][s] : a[n][s] = i;
2168
3057
  });
2169
3058
  }
2170
- _setStateOnlyMetaframeInputMap(e, n, s) {
2171
- !s || Object.keys(s).length === 0 || (this._state = g(this._state, (i) => {
3059
+ _setStateOnlyMetaframeInputMap(t, n, s) {
3060
+ !s || Object.keys(s).length === 0 || (this._state = C(this._state, (i) => {
2172
3061
  if (!this._metaframes.hasOwnProperty(n))
2173
3062
  throw `No metaframe: ${n}`;
2174
- let r = e ? i.metaframes.inputs : i.metaframes.outputs;
2175
- r[n] = r[n] ? r[n] : {}, Object.keys(s).forEach((o) => {
2176
- s[o] === void 0 ? delete r[n][o] : r[n][o] = s[o];
3063
+ let r = t ? i.metaframes.inputs : i.metaframes.outputs;
3064
+ r[n] = r[n] ? r[n] : {}, Object.keys(s).forEach((a) => {
3065
+ s[a] === void 0 ? delete r[n][a] : r[n][a] = s[a];
2177
3066
  });
2178
3067
  }));
2179
3068
  }
2180
- _setStateOnlyMetaframes(e, n) {
2181
- !n || Object.keys(n).length === 0 || (this._state = g(this._state, (s) => {
3069
+ _setStateOnlyMetaframes(t, n) {
3070
+ !n || Object.keys(n).length === 0 || (this._state = C(this._state, (s) => {
2182
3071
  Object.keys(n).forEach((i) => {
2183
- var a = n[i];
2184
- if (typeof a != "object")
3072
+ var o = n[i];
3073
+ if (typeof o != "object")
2185
3074
  throw "Object values must be objects";
2186
3075
  if (!this._metaframes.hasOwnProperty(i))
2187
3076
  throw "No metaframe: ${metaframeId}";
2188
- const o = e ? s.metaframes.inputs : s.metaframes.outputs;
2189
- o[i] = o[i] ? o[i] : {}, Object.keys(a).forEach((f) => {
2190
- a[f] === void 0 ? delete o[i][f] : o[i][f] = a[f];
3077
+ const a = t ? s.metaframes.inputs : s.metaframes.outputs;
3078
+ a[i] = a[i] ? a[i] : {}, Object.keys(o).forEach((u) => {
3079
+ o[u] === void 0 ? delete a[i][u] : a[i][u] = o[u];
2191
3080
  });
2192
3081
  });
2193
3082
  }));
2194
3083
  }
2195
- onMessage(e) {
2196
- if (typeof e.data == "object") {
2197
- const r = e.data;
3084
+ onMessage(t) {
3085
+ if (typeof t.data == "object") {
3086
+ const r = t.data;
2198
3087
  if (!this.isValidJSONRpcMessage(r))
2199
3088
  return;
2200
3089
  var n = r.method;
2201
- const o = r.iframeId;
2202
- if (!o)
3090
+ const a = r.iframeId;
3091
+ if (!a)
2203
3092
  return;
2204
- const f = this.getMetaframe(o);
2205
- if (!f) {
2206
- this.error(`💥 onMessage no metaframe id=${o}`);
3093
+ const u = this.getMetaframe(a);
3094
+ if (!u) {
3095
+ this.error(`💥 onMessage no metaframe id=${a}`);
2207
3096
  return;
2208
3097
  }
2209
3098
  switch (r._messageCount = ++this._internalReceivedMessageCounter, this.debug && this.log(`processing ${JSON.stringify(r, null, " ").substring(0, 500)}`), n) {
2210
- case j.SetupIframeClientRequest:
2211
- f && f.register();
3099
+ case Q.SetupIframeClientRequest:
3100
+ u && u.register();
2212
3101
  break;
2213
- case j.SetupIframeServerResponseAck:
2214
- if (f) {
3102
+ case Q.SetupIframeServerResponseAck:
3103
+ if (u) {
2215
3104
  const c = r.params;
2216
- f.registered(c.version);
3105
+ u.registered(c.version);
2217
3106
  }
2218
3107
  break;
2219
- case j.OutputsUpdate:
2220
- const u = r.params;
2221
- if (this._metaframes[o]) {
2222
- var s = this._metaframes[o];
2223
- this.setOutputStateOnlyMetaframeInputMap(o, u), s.setOutputs(u);
3108
+ case Q.OutputsUpdate:
3109
+ const f = r.params;
3110
+ if (this._metaframes[a]) {
3111
+ var s = this._metaframes[a];
3112
+ this.setOutputStateOnlyMetaframeInputMap(a, f), s.setOutputs(f);
2224
3113
  var i = !1;
2225
- const c = Object.keys(u), l = {};
2226
- c.forEach((d, m) => {
2227
- const _ = this.getInputsFromOutput(o, d);
2228
- _.length > 0 && _.forEach((M) => {
2229
- l[M.metaframe] || (l[M.metaframe] = {}), l[M.metaframe][M.pipe] = u[d], i = !0;
3114
+ const c = Object.keys(f), d = {};
3115
+ c.forEach((g, w) => {
3116
+ const y = this.getInputsFromOutput(a, g);
3117
+ y.length > 0 && y.forEach((O) => {
3118
+ d[O.metaframe] || (d[O.metaframe] = {}), d[O.metaframe][O.pipe] = f[g], i = !0;
2230
3119
  });
2231
- }), i && (this.setInputStateOnlyMetapageInstanceInputs(l), Object.keys(l).forEach((d) => {
2232
- this._metaframes[d].setInputs(l[d]);
2233
- })), this.listenerCount(y.State) > 0 && J !== this._state && this.emit(y.State, this._state), this.debug && s.ack({ jsonrpc: r, state: this._state });
3120
+ }), i && (this.setInputStateOnlyMetapageInstanceInputs(d), Object.keys(d).forEach((g) => {
3121
+ this._metaframes[g].setInputs(d[g]);
3122
+ })), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state), this.debug && s.ack({ jsonrpc: r, state: this._state });
2234
3123
  } else
2235
- this.error(`missing metaframe=${o}`);
3124
+ this.error(`missing metaframe=${a}`);
2236
3125
  break;
2237
- case j.InputsUpdate:
2238
- var a = r.params;
2239
- this.debug && this.log(`inputs ${JSON.stringify(a)} from ${o}`), this._metaframes[o] ? (this.setInputStateOnlyMetaframeInputMap(o, a), this._metaframes[o].setInputs(a), this.listenerCount(y.State) > 0 && J !== this._state && this.emit(y.State, this._state), this.debug && this._metaframes[o].ack({
3126
+ case Q.InputsUpdate:
3127
+ var o = r.params;
3128
+ this.debug && this.log(`inputs ${JSON.stringify(o)} from ${a}`), this._metaframes[a] ? (this.setInputStateOnlyMetaframeInputMap(a, o), this._metaframes[a].setInputs(o), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state), this.debug && this._metaframes[a].ack({
2240
3129
  jsonrpc: r,
2241
3130
  state: this._state
2242
- })) : (console.error(`InputsUpdate failed no metaframe id: "${o}"`), this.error(`InputsUpdate failed no metaframe id: "${o}"`));
3131
+ })) : (console.error(`InputsUpdate failed no metaframe id: "${a}"`), this.error(`InputsUpdate failed no metaframe id: "${a}"`));
2243
3132
  break;
2244
- case j.HashParamsUpdate:
2245
- if (f) {
2246
- const c = r.params, l = new URL(f.url);
2247
- l.hash = c.hash, f.url = l.href, this._definition = g(this._definition, (d) => {
2248
- d.metaframes[c.metaframe].url = l.href;
3133
+ case Q.HashParamsUpdate:
3134
+ if (u) {
3135
+ const c = r.params, d = new URL(u.url);
3136
+ d.hash = c.hash, u.url = d.href, this._definition = C(this._definition, (g) => {
3137
+ g.metaframes[c.metaframe].url = d.href;
2249
3138
  }), this._emitDefinitionEvent();
2250
3139
  }
2251
3140
  break;
2252
3141
  default:
2253
3142
  this.debug && this.log(`Unknown RPC method: "${n}"`);
2254
3143
  }
2255
- this.listenerCount(y.Message) > 0 && this.emit(y.Message, r);
3144
+ this.listenerCount(E.Message) > 0 && this.emit(E.Message, r);
2256
3145
  }
2257
3146
  }
2258
- logInternal(e, n, s) {
3147
+ logInternal(t, n, s) {
2259
3148
  s = s || this._consoleBackgroundColor;
2260
3149
  let i;
2261
- typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), i = this._id ? `Metapage[${this._id}] ${i}` : i, Ce(i, n, s);
3150
+ typeof t == "string" ? i = t : typeof t == "number" ? i = t + "" : i = JSON.stringify(t), i = this._id ? `Metapage[${this._id}] ${i}` : i, vt(i, n, s);
2262
3151
  }
2263
3152
  }
2264
- U.version = Je;
2265
- U.DEFINITION = y.Definition;
2266
- U.ERROR = y.Error;
2267
- U.INPUTS = y.Inputs;
2268
- U.MESSAGE = y.Message;
2269
- U.OUTPUTS = y.Outputs;
2270
- U.STATE = y.State;
2271
- U.deserializeInputs = te;
2272
- U.serializeInputs = he;
2273
- const ft = Oe(fetch), In = async (t, e) => {
2274
- const n = new URL(t);
3153
+ ne.version = zt;
3154
+ ne.DEFINITION = E.Definition;
3155
+ ne.ERROR = E.Error;
3156
+ ne.INPUTS = E.Inputs;
3157
+ ne.MESSAGE = E.Message;
3158
+ ne.OUTPUTS = E.Outputs;
3159
+ ne.STATE = E.State;
3160
+ ne.deserializeInputs = Ie;
3161
+ ne.serializeInputs = Ve;
3162
+ const dn = pt(fetch), oi = async (e, t) => {
3163
+ const n = new URL(e);
2275
3164
  n.pathname = n.pathname + (n.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
2276
- const i = await (await ft(n.href, {
3165
+ const i = await (await dn(n.href, {
2277
3166
  redirect: "follow",
2278
3167
  retries: 3,
2279
3168
  retryDelay: 1e3
2280
3169
  })).json();
2281
- return await et(i, e || "1");
2282
- }, Sn = async (t, e) => {
2283
- const n = new URL(t);
3170
+ return await Yt(i, t || "1");
3171
+ }, ai = async (e, t) => {
3172
+ const n = new URL(e);
2284
3173
  n.pathname = n.pathname + (n.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json");
2285
- const i = await (await ft(n.href, {
3174
+ const i = await (await dn(n.href, {
2286
3175
  redirect: "follow",
2287
3176
  retries: 3,
2288
3177
  retryDelay: 1e3
2289
3178
  })).json();
2290
- return await tt(i, e || "1");
3179
+ return await Zt(i, t || "1");
2291
3180
  };
2292
3181
  export {
2293
- rt as INITIAL_NULL_METAPAGE_DEFINITION,
2294
- mn as INTERNAL_ERROR,
2295
- dn as INVALID_PARAMS,
2296
- hn as INVALID_REQUEST,
2297
- j as JsonRpcMethodsFromChild,
2298
- x as JsonRpcMethodsFromParent,
2299
- on as METAFRAME_JSON_FILE,
2300
- an as METAPAGE_KEY_DEFINITION,
2301
- fn as METAPAGE_KEY_STATE,
2302
- pn as METHOD_NOT_FOUND,
2303
- L as Metaframe,
2304
- R as MetaframeEvents,
2305
- V as MetaframeLoadingState,
2306
- Me as MetaframeVersionCurrent,
2307
- Le as MetaframeVersionsAll,
2308
- U as Metapage,
2309
- y as MetapageEvents,
2310
- se as MetapageHashParams,
2311
- nn as MetapageIFrameRpcClient,
2312
- Qt as MetapageShared,
2313
- le as MetapageVersionCurrent,
2314
- Ue as MetapageVersionsAll,
2315
- ln as PARSE_ERROR,
2316
- ct as VERSION_METAFRAME,
2317
- Je as VERSION_METAPAGE,
2318
- xt as convertMetaframeDefinitionToCurrentVersion,
2319
- tt as convertMetaframeDefinitionToVersion,
2320
- Ft as convertMetaframeJsonToCurrentVersion,
2321
- Ct as convertMetapageDefinitionToCurrentVersion,
2322
- et as convertMetapageDefinitionToVersion,
2323
- te as deserializeInputs,
2324
- je as generateId,
2325
- bn as generateMetaframeId,
2326
- Zt as generateMetapageId,
2327
- wn as generateNonce,
2328
- On as getLibraryVersionMatching,
2329
- z as getMatchingMetaframeVersion,
2330
- K as getMatchingMetapageVersion,
2331
- Sn as getMetaframeDefinitionFromUrl,
2332
- In as getMetapageDefinitionFromUrl,
2333
- _n as getUrlParam,
2334
- gn as getUrlParamDebug,
2335
- en as hashCode,
2336
- tn as intToRGB,
2337
- ve as isDebugFromUrlsParams,
2338
- Xt as isIframe,
2339
- yn as isJsonRpcId,
2340
- de as isPageLoaded,
2341
- Ce as log,
2342
- sn as matchPipe,
2343
- ce as merge,
2344
- vn as metapageAllSha256Hash,
2345
- Mn as metapageOnlyEssentailSha256Hash,
2346
- Pe as pageLoaded,
2347
- cn as possiblyDeserializeDatarefToFile,
2348
- nt as possiblyDeserializeDatarefToValue,
2349
- Kt as possiblySerializeValueToDataref,
2350
- he as serializeInputs,
2351
- ot as stringToRgb,
2352
- un as valueToFile
3182
+ sn as INITIAL_NULL_METAPAGE_DEFINITION,
3183
+ Qs as INTERNAL_ERROR,
3184
+ qs as INVALID_PARAMS,
3185
+ Js as INVALID_REQUEST,
3186
+ Q as JsonRpcMethodsFromChild,
3187
+ ce as JsonRpcMethodsFromParent,
3188
+ Fs as METAFRAME_JSON_FILE,
3189
+ zs as METAPAGE_KEY_DEFINITION,
3190
+ Gs as METAPAGE_KEY_STATE,
3191
+ Xs as METHOD_NOT_FOUND,
3192
+ te as Metaframe,
3193
+ F as MetaframeEvents,
3194
+ he as MetaframeLoadingState,
3195
+ ft as MetaframeVersionCurrent,
3196
+ St as MetaframeVersionsAll,
3197
+ ne as Metapage,
3198
+ E as MetapageEvents,
3199
+ $e as MetapageHashParams,
3200
+ js as MetapageIFrameRpcClient,
3201
+ rs as MetapageShared,
3202
+ Ge as MetapageVersionCurrent,
3203
+ Ot as MetapageVersionsAll,
3204
+ Ws as PARSE_ERROR,
3205
+ _n as VERSION_METAFRAME,
3206
+ zt as VERSION_METAPAGE,
3207
+ Vn as convertMetaframeDefinitionToCurrentVersion,
3208
+ Zt as convertMetaframeDefinitionToVersion,
3209
+ Wn as convertMetaframeJsonToCurrentVersion,
3210
+ Nn as convertMetapageDefinitionToCurrentVersion,
3211
+ Yt as convertMetapageDefinitionToVersion,
3212
+ Ie as deserializeInputs,
3213
+ bt as generateId,
3214
+ ti as generateMetaframeId,
3215
+ os as generateMetapageId,
3216
+ ni as generateNonce,
3217
+ ri as getLibraryVersionMatching,
3218
+ ae as getMatchingMetaframeVersion,
3219
+ Re as getMatchingMetapageVersion,
3220
+ ai as getMetaframeDefinitionFromUrl,
3221
+ oi as getMetapageDefinitionFromUrl,
3222
+ Zs as getUrlParam,
3223
+ ei as getUrlParamDebug,
3224
+ as as hashCode,
3225
+ us as intToRGB,
3226
+ ut as isDebugFromUrlsParams,
3227
+ is as isIframe,
3228
+ Ys as isJsonRpcId,
3229
+ Qe as isPageLoaded,
3230
+ vt as log,
3231
+ Us as matchPipe,
3232
+ Be as merge,
3233
+ si as metapageAllSha256Hash,
3234
+ ii as metapageOnlyEssentailSha256Hash,
3235
+ wt as pageLoaded,
3236
+ Ks as possiblyDeserializeDatarefToFile,
3237
+ en as possiblyDeserializeDatarefToValue,
3238
+ ns as possiblySerializeValueToDataref,
3239
+ Ve as serializeInputs,
3240
+ rn as stringToRgb,
3241
+ Vs as valueToFile
2353
3242
  };
2354
3243
  //# sourceMappingURL=index.js.map