@metapages/metapage 0.16.2 → 1.0.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.
Files changed (65) hide show
  1. package/dist/index.js +1434 -2430
  2. package/dist/index.js.map +1 -1
  3. package/dist/metapage/Constants.d.ts +2 -2
  4. package/dist/metapage/Constants.d.ts.map +1 -1
  5. package/dist/metapage/Metaframe.d.ts +4 -16
  6. package/dist/metapage/Metaframe.d.ts.map +1 -1
  7. package/dist/metapage/Metapage.d.ts +29 -42
  8. package/dist/metapage/Metapage.d.ts.map +1 -1
  9. package/dist/metapage/MetapageIFrameRpcClient.d.ts +3 -8
  10. package/dist/metapage/MetapageIFrameRpcClient.d.ts.map +1 -1
  11. package/dist/metapage/MetapageTools.d.ts +9 -7
  12. package/dist/metapage/MetapageTools.d.ts.map +1 -1
  13. package/dist/metapage/Shared.d.ts +6 -6
  14. package/dist/metapage/Shared.d.ts.map +1 -1
  15. package/dist/metapage/{v0_4/jsonrpc.d.ts → jsonrpc.d.ts} +2 -11
  16. package/dist/metapage/jsonrpc.d.ts.map +1 -0
  17. package/dist/metapage/v0_0_1/all.d.ts +1 -1
  18. package/dist/metapage/v0_0_1/all.d.ts.map +1 -1
  19. package/dist/metapage/v0_1_0/all.d.ts +1 -1
  20. package/dist/metapage/v0_1_0/all.d.ts.map +1 -1
  21. package/dist/metapage/v0_2/all.d.ts +1 -1
  22. package/dist/metapage/v0_2/all.d.ts.map +1 -1
  23. package/dist/metapage/v0_4/core.d.ts +1 -1
  24. package/dist/metapage/v0_4/core.d.ts.map +1 -1
  25. package/dist/metapage/v0_4/index.d.ts +2 -2
  26. package/dist/metapage/v0_4/index.d.ts.map +1 -1
  27. package/dist/metapage/v0_4/metaframe.d.ts +1 -1
  28. package/dist/metapage/v0_4/metaframe.d.ts.map +1 -1
  29. package/dist/metapage/v0_4/metapage.d.ts +1 -1
  30. package/dist/metapage/v0_4/metapage.d.ts.map +1 -1
  31. package/dist/metapage/v1/core.d.ts +6 -0
  32. package/dist/metapage/v1/core.d.ts.map +1 -0
  33. package/dist/metapage/v1/events.d.ts +22 -0
  34. package/dist/metapage/v1/events.d.ts.map +1 -0
  35. package/dist/metapage/v1/index.d.ts +7 -0
  36. package/dist/metapage/v1/index.d.ts.map +1 -0
  37. package/dist/metapage/v1/metaframe.d.ts +86 -0
  38. package/dist/metapage/v1/metaframe.d.ts.map +1 -0
  39. package/dist/metapage/v1/metapage.d.ts +32 -0
  40. package/dist/metapage/v1/metapage.d.ts.map +1 -0
  41. package/dist/metapage/{v0_4/versions.d.ts → versions.d.ts} +2 -2
  42. package/dist/metapage/versions.d.ts.map +1 -0
  43. package/package.json +2 -8
  44. package/src/metapage/Constants.ts +10 -1
  45. package/src/metapage/Metaframe.ts +8 -77
  46. package/src/metapage/Metapage.ts +289 -612
  47. package/src/metapage/MetapageIFrameRpcClient.ts +9 -40
  48. package/src/metapage/MetapageTools.ts +115 -88
  49. package/src/metapage/Shared.ts +10 -9
  50. package/src/metapage/{v0_4/jsonrpc.ts → jsonrpc.ts} +2 -16
  51. package/src/metapage/v0_0_1/all.ts +1 -1
  52. package/src/metapage/v0_1_0/all.ts +1 -1
  53. package/src/metapage/v0_2/all.ts +1 -1
  54. package/src/metapage/v0_4/core.ts +1 -1
  55. package/src/metapage/v0_4/index.ts +2 -2
  56. package/src/metapage/v0_4/metaframe.ts +1 -1
  57. package/src/metapage/v0_4/metapage.ts +1 -1
  58. package/src/metapage/v1/core.ts +5 -0
  59. package/src/metapage/v1/events.ts +28 -0
  60. package/src/metapage/v1/index.ts +6 -0
  61. package/src/metapage/v1/metaframe.ts +135 -0
  62. package/src/metapage/v1/metapage.ts +43 -0
  63. package/src/metapage/{v0_4/versions.ts → versions.ts} +4 -4
  64. package/dist/metapage/v0_4/jsonrpc.d.ts.map +0 -1
  65. package/dist/metapage/v0_4/versions.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,539 +1,539 @@
1
- const q = {
1
+ const M = {
2
2
  Remove: "remove",
3
3
  Replace: "replace",
4
4
  Add: "add"
5
- }, De = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Xe = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Tt = Symbol.iterator, rt = {
5
+ }, Ht = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), he = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), rt = Symbol.iterator, C = {
6
6
  mutable: "mutable",
7
7
  immutable: "immutable"
8
- }, re = {};
9
- function At(e, t) {
10
- return e instanceof Map ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
8
+ }, It = {};
9
+ function G(t, e) {
10
+ return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
11
11
  }
12
- function be(e, t) {
13
- if (t in e) {
14
- let n = Reflect.getPrototypeOf(e);
15
- for (; n; ) {
16
- const i = Reflect.getOwnPropertyDescriptor(n, t);
17
- if (i)
18
- return i;
19
- n = Reflect.getPrototypeOf(n);
12
+ function Lt(t, e) {
13
+ if (e in t) {
14
+ let s = Reflect.getPrototypeOf(t);
15
+ for (; s; ) {
16
+ const n = Reflect.getOwnPropertyDescriptor(s, e);
17
+ if (n)
18
+ return n;
19
+ s = Reflect.getPrototypeOf(s);
20
20
  }
21
21
  }
22
22
  }
23
- function st(e) {
24
- var t;
25
- return (t = e.copy) !== null && t !== void 0 ? t : e.original;
23
+ function E(t) {
24
+ var e;
25
+ return (e = t.copy) !== null && e !== void 0 ? e : t.original;
26
26
  }
27
- function wt(e) {
28
- return !!$(e);
27
+ function N(t) {
28
+ return !!g(t);
29
29
  }
30
- function $(e) {
31
- return typeof e != "object" ? null : e == null ? void 0 : e[De];
30
+ function g(t) {
31
+ return typeof t != "object" ? null : t == null ? void 0 : t[Ht];
32
32
  }
33
- function oe(e) {
34
- var t;
35
- const n = $(e);
36
- return n ? (t = n.copy) !== null && t !== void 0 ? t : n.original : e;
33
+ function St(t) {
34
+ var e;
35
+ const s = g(t);
36
+ return s ? (e = s.copy) !== null && e !== void 0 ? e : s.original : t;
37
37
  }
38
- function ut(e, t) {
39
- if (!e || typeof e != "object")
38
+ function j(t, e) {
39
+ if (!t || typeof t != "object")
40
40
  return !1;
41
- let n;
42
- return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!(t != null && t.mark) && ((n = t.mark(e, rt)) === rt.immutable || typeof n == "function");
41
+ let s;
42
+ return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((s = e.mark(t, C)) === C.immutable || typeof s == "function");
43
43
  }
44
- function Le(e, t = []) {
45
- if (Object.hasOwnProperty.call(e, "key")) {
46
- const n = e.parent.copy, i = $(mt(n, e.key));
47
- if (i !== null && (i == null ? void 0 : i.original) !== e.original)
44
+ function qt(t, e = []) {
45
+ if (Object.hasOwnProperty.call(t, "key")) {
46
+ const s = t.parent.copy, n = g(V(s, t.key));
47
+ if (n !== null && (n == null ? void 0 : n.original) !== t.original)
48
48
  return null;
49
- const o = e.parent.type === 3, c = o ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
50
- if (!(o && n.size > c || At(n, c)))
49
+ const i = t.parent.type === 3, a = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
50
+ if (!(i && s.size > a || G(s, a)))
51
51
  return null;
52
- t.push(c);
52
+ e.push(a);
53
53
  }
54
- if (e.parent)
55
- return Le(e.parent, t);
56
- t.reverse();
54
+ if (t.parent)
55
+ return qt(t.parent, e);
56
+ e.reverse();
57
57
  try {
58
- Qe(e.copy, t);
58
+ le(t.copy, e);
59
59
  } catch {
60
60
  return null;
61
61
  }
62
- return t;
62
+ return e;
63
63
  }
64
- function _t(e) {
65
- return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
64
+ function F(t) {
65
+ return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
66
66
  }
67
- function mt(e, t) {
68
- return _t(e) === 2 ? e.get(t) : e[t];
67
+ function V(t, e) {
68
+ return F(t) === 2 ? t.get(e) : t[e];
69
69
  }
70
- function Dt(e, t, n) {
71
- _t(e) === 2 ? e.set(t, n) : e[t] = n;
70
+ function tt(t, e, s) {
71
+ F(t) === 2 ? t.set(e, s) : t[e] = s;
72
72
  }
73
- function Ht(e, t) {
74
- const n = $(e);
75
- return (n ? st(n) : e)[t];
73
+ function pt(t, e) {
74
+ const s = g(t);
75
+ return (s ? E(s) : t)[e];
76
76
  }
77
- function dt(e, t) {
78
- return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
77
+ function z(t, e) {
78
+ return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
79
79
  }
80
- function Gt(e) {
81
- if (e)
82
- for (; e.finalities.revoke.length > 0; )
83
- e.finalities.revoke.pop()();
80
+ function mt(t) {
81
+ if (t)
82
+ for (; t.finalities.revoke.length > 0; )
83
+ t.finalities.revoke.pop()();
84
84
  }
85
- function bt(e, t) {
86
- return t ? e : [""].concat(e).map((n) => {
87
- const i = `${n}`;
88
- return i.indexOf("/") === -1 && i.indexOf("~") === -1 ? i : i.replace(/~/g, "~0").replace(/\//g, "~1");
85
+ function k(t, e) {
86
+ return e ? t : [""].concat(t).map((s) => {
87
+ const n = `${s}`;
88
+ return n.indexOf("/") === -1 && n.indexOf("~") === -1 ? n : n.replace(/~/g, "~0").replace(/\//g, "~1");
89
89
  }).join("/");
90
90
  }
91
- function Qe(e, t) {
92
- for (let n = 0; n < t.length - 1; n += 1) {
93
- const i = t[n];
94
- if (e = mt(_t(e) === 3 ? Array.from(e) : e, i), typeof e != "object")
95
- throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
91
+ function le(t, e) {
92
+ for (let s = 0; s < e.length - 1; s += 1) {
93
+ const n = e[s];
94
+ if (t = V(F(t) === 3 ? Array.from(t) : t, n), typeof t != "object")
95
+ throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
96
96
  }
97
- return e;
97
+ return t;
98
98
  }
99
- function Ze(e) {
100
- const t = Object.create(Object.getPrototypeOf(e));
101
- return Reflect.ownKeys(e).forEach((n) => {
102
- let i = Reflect.getOwnPropertyDescriptor(e, n);
103
- if (i.enumerable && i.configurable && i.writable) {
104
- t[n] = e[n];
99
+ function pe(t) {
100
+ const e = Object.create(Object.getPrototypeOf(t));
101
+ return Reflect.ownKeys(t).forEach((s) => {
102
+ let n = Reflect.getOwnPropertyDescriptor(t, s);
103
+ if (n.enumerable && n.configurable && n.writable) {
104
+ e[s] = t[s];
105
105
  return;
106
106
  }
107
- i.writable || (i.writable = !0, i.configurable = !0), (i.get || i.set) && (i = {
107
+ n.writable || (n.writable = !0, n.configurable = !0), (n.get || n.set) && (n = {
108
108
  configurable: !0,
109
109
  writable: !0,
110
- enumerable: i.enumerable,
111
- value: e[n]
112
- }), Reflect.defineProperty(t, n, i);
113
- }), t;
110
+ enumerable: n.enumerable,
111
+ value: t[s]
112
+ }), Reflect.defineProperty(e, s, n);
113
+ }), e;
114
114
  }
115
- const tn = Object.prototype.propertyIsEnumerable;
116
- function Ue(e, t) {
117
- let n;
118
- if (Array.isArray(e))
119
- return Array.prototype.concat.call(e);
120
- if (e instanceof Set)
121
- return new Set(e.values());
122
- if (e instanceof Map)
123
- return new Map(e);
124
- if (t != null && t.mark && (n = t.mark(e, rt), n !== void 0) && n !== rt.mutable) {
125
- if (n === rt.immutable)
126
- return Ze(e);
127
- if (typeof n == "function") {
128
- if (t.enablePatches || t.enableAutoFreeze)
115
+ const de = Object.prototype.propertyIsEnumerable;
116
+ function Kt(t, e) {
117
+ let s;
118
+ if (Array.isArray(t))
119
+ return Array.prototype.concat.call(t);
120
+ if (t instanceof Set)
121
+ return new Set(t.values());
122
+ if (t instanceof Map)
123
+ return new Map(t);
124
+ if (e != null && e.mark && (s = e.mark(t, C), s !== void 0) && s !== C.mutable) {
125
+ if (s === C.immutable)
126
+ return pe(t);
127
+ if (typeof s == "function") {
128
+ if (e.enablePatches || e.enableAutoFreeze)
129
129
  throw new Error("You can't use mark and patches or auto freeze together.");
130
- return n();
130
+ return s();
131
131
  }
132
- throw new Error(`Unsupported mark result: ${n}`);
133
- } else if (typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype) {
134
- const i = {};
135
- return Object.keys(e).forEach((o) => {
136
- i[o] = e[o];
137
- }), Object.getOwnPropertySymbols(e).forEach((o) => {
138
- tn.call(e, o) && (i[o] = e[o]);
139
- }), i;
132
+ throw new Error(`Unsupported mark result: ${s}`);
133
+ } else if (typeof t == "object" && Object.getPrototypeOf(t) === Object.prototype) {
134
+ const n = {};
135
+ return Object.keys(t).forEach((i) => {
136
+ n[i] = t[i];
137
+ }), Object.getOwnPropertySymbols(t).forEach((i) => {
138
+ de.call(t, i) && (n[i] = t[i]);
139
+ }), n;
140
140
  } else
141
141
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
142
142
  }
143
- function et(e) {
144
- e.copy || (e.copy = Ue(e.original, e.options));
143
+ function R(t) {
144
+ t.copy || (t.copy = Kt(t.original, t.options));
145
145
  }
146
- function Ot(e) {
147
- if (!ut(e))
148
- return oe(e);
149
- if (Array.isArray(e))
150
- return e.map(Ot);
151
- if (e instanceof Map)
152
- return new Map(Array.from(e.entries()).map(([n, i]) => [n, Ot(i)]));
153
- if (e instanceof Set)
154
- return new Set(Array.from(e).map(Ot));
155
- const t = Object.create(Object.getPrototypeOf(e));
156
- for (const n in e)
157
- t[n] = Ot(e[n]);
158
- return t;
146
+ function q(t) {
147
+ if (!j(t))
148
+ return St(t);
149
+ if (Array.isArray(t))
150
+ return t.map(q);
151
+ if (t instanceof Map)
152
+ return new Map(Array.from(t.entries()).map(([s, n]) => [s, q(n)]));
153
+ if (t instanceof Set)
154
+ return new Set(Array.from(t).map(q));
155
+ const e = Object.create(Object.getPrototypeOf(t));
156
+ for (const s in t)
157
+ e[s] = q(t[s]);
158
+ return e;
159
159
  }
160
- function Nt(e) {
161
- return wt(e) ? Ot(e) : e;
160
+ function ot(t) {
161
+ return N(t) ? q(t) : t;
162
162
  }
163
- function lt(e) {
164
- var t;
165
- e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && lt(e.parent));
163
+ function L(t) {
164
+ var e;
165
+ t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && L(t.parent));
166
166
  }
167
- function we() {
167
+ function Ut() {
168
168
  throw new Error("Cannot modify frozen object");
169
169
  }
170
- function It(e, t, n, i, o) {
170
+ function J(t, e, s, n, i) {
171
171
  {
172
- n = n ?? /* @__PURE__ */ new WeakMap(), i = i ?? [], o = o ?? [];
173
- const f = n.has(e) ? n.get(e) : e;
174
- if (i.length > 0) {
175
- const h = i.indexOf(f);
176
- if (f && typeof f == "object" && h !== -1)
177
- throw i[0] === f ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${o.slice(0, h).map((g, y) => {
178
- if (typeof g == "symbol")
179
- return `[${g.toString()}]`;
180
- const b = i[y];
181
- return typeof g == "object" && (b instanceof Map || b instanceof Set) ? Array.from(b.keys()).indexOf(g) : g;
172
+ s = s ?? /* @__PURE__ */ new WeakMap(), n = n ?? [], i = i ?? [];
173
+ const r = s.has(t) ? s.get(t) : t;
174
+ if (n.length > 0) {
175
+ const o = n.indexOf(r);
176
+ if (r && typeof r == "object" && o !== -1)
177
+ throw n[0] === r ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, o).map((u, f) => {
178
+ if (typeof u == "symbol")
179
+ return `[${u.toString()}]`;
180
+ const c = n[f];
181
+ return typeof u == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(u) : u;
182
182
  }).join("/")}`);
183
- i.push(f), o.push(t);
183
+ n.push(r), i.push(e);
184
184
  } else
185
- i.push(f);
185
+ n.push(r);
186
186
  }
187
- if (Object.isFrozen(e) || wt(e)) {
188
- i.pop(), o.pop();
187
+ if (Object.isFrozen(t) || N(t)) {
188
+ n.pop(), i.pop();
189
189
  return;
190
190
  }
191
- switch (_t(e)) {
191
+ switch (F(t)) {
192
192
  case 2:
193
- for (const [h, g] of e)
194
- It(h, h, n, i, o), It(g, h, n, i, o);
195
- e.set = e.clear = e.delete = we;
193
+ for (const [o, u] of t)
194
+ J(o, o, s, n, i), J(u, o, s, n, i);
195
+ t.set = t.clear = t.delete = Ut;
196
196
  break;
197
197
  case 3:
198
- for (const h of e)
199
- It(h, h, n, i, o);
200
- e.add = e.clear = e.delete = we;
198
+ for (const o of t)
199
+ J(o, o, s, n, i);
200
+ t.add = t.clear = t.delete = Ut;
201
201
  break;
202
202
  case 1:
203
- Object.freeze(e);
204
- let f = 0;
205
- for (const h of e)
206
- It(h, f, n, i, o), f += 1;
203
+ Object.freeze(t);
204
+ let r = 0;
205
+ for (const o of t)
206
+ J(o, r, s, n, i), r += 1;
207
207
  break;
208
208
  default:
209
- Object.freeze(e), Object.keys(e).forEach((h) => {
210
- const g = e[h];
211
- It(g, h, n, i, o);
209
+ Object.freeze(t), Object.keys(t).forEach((o) => {
210
+ const u = t[o];
211
+ J(u, o, s, n, i);
212
212
  });
213
213
  }
214
- i.pop(), o.pop();
214
+ n.pop(), i.pop();
215
215
  }
216
- function ae(e, t) {
217
- const n = _t(e);
218
- if (n === 0)
219
- Reflect.ownKeys(e).forEach((i) => {
220
- t(i, e[i], e);
216
+ function Rt(t, e) {
217
+ const s = F(t);
218
+ if (s === 0)
219
+ Reflect.ownKeys(t).forEach((n) => {
220
+ e(n, t[n], t);
221
221
  });
222
- else if (n === 1) {
223
- let i = 0;
224
- for (const o of e)
225
- t(i, o, e), i += 1;
222
+ else if (s === 1) {
223
+ let n = 0;
224
+ for (const i of t)
225
+ e(n, i, t), n += 1;
226
226
  } else
227
- e.forEach((i, o) => t(o, i, e));
227
+ t.forEach((n, i) => e(i, n, t));
228
228
  }
229
- function xe(e, t, n) {
230
- if (wt(e) || !ut(e, n) || t.has(e) || Object.isFrozen(e))
229
+ function Gt(t, e, s) {
230
+ if (N(t) || !j(t, s) || e.has(t) || Object.isFrozen(t))
231
231
  return;
232
- const i = e instanceof Set, o = i ? /* @__PURE__ */ new Map() : void 0;
233
- if (t.add(e), ae(e, (c, f) => {
234
- var h;
235
- if (wt(f)) {
236
- const g = $(f);
237
- et(g);
238
- const y = !((h = g.assignedMap) === null || h === void 0) && h.size || g.operated ? g.copy : g.original;
239
- Dt(i ? o : e, c, y);
232
+ const n = t instanceof Set, i = n ? /* @__PURE__ */ new Map() : void 0;
233
+ if (e.add(t), Rt(t, (a, r) => {
234
+ var o;
235
+ if (N(r)) {
236
+ const u = g(r);
237
+ R(u);
238
+ const f = !((o = u.assignedMap) === null || o === void 0) && o.size || u.operated ? u.copy : u.original;
239
+ tt(n ? i : t, a, f);
240
240
  } else
241
- xe(f, t, n);
242
- }), o) {
243
- const c = e, f = Array.from(c);
244
- c.clear(), f.forEach((h) => {
245
- c.add(o.has(h) ? o.get(h) : h);
241
+ Gt(r, e, s);
242
+ }), i) {
243
+ const a = t, r = Array.from(a);
244
+ a.clear(), r.forEach((o) => {
245
+ a.add(i.has(o) ? i.get(o) : o);
246
246
  });
247
247
  }
248
248
  }
249
- function en(e, t) {
250
- const n = e.type === 3 ? e.setMap : e.copy;
251
- e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && xe(mt(n, t), e.finalities.handledSet, e.options);
249
+ function me(t, e) {
250
+ const s = t.type === 3 ? t.setMap : t.copy;
251
+ t.finalities.revoke.length > 1 && t.assignedMap.get(e) && s && Gt(V(s, e), t.finalities.handledSet, t.options);
252
252
  }
253
- function Xt(e) {
254
- e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
255
- e.copy.add(oe(t));
253
+ function gt(t) {
254
+ t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
255
+ t.copy.add(St(e));
256
256
  }));
257
257
  }
258
- function Qt(e, t, n, i) {
259
- if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
260
- if (n && i) {
261
- const c = Le(e);
262
- c && t(e, c, n, i);
258
+ function yt(t, e, s, n) {
259
+ if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
260
+ if (s && n) {
261
+ const a = qt(t);
262
+ a && e(t, a, s, n);
263
263
  }
264
- e.finalized = !0;
264
+ t.finalized = !0;
265
265
  }
266
266
  }
267
- function ue(e, t, n, i) {
268
- const o = $(n);
269
- o && (o.callbacks || (o.callbacks = []), o.callbacks.push((c, f) => {
270
- var h;
271
- const g = e.type === 3 ? e.setMap : e.copy;
272
- if (dt(mt(g, t), n)) {
273
- let y = o.original;
274
- o.copy && (y = o.copy), Xt(e), Qt(e, i, c, f), e.options.enableAutoFreeze && (e.options.updatedValues = (h = e.options.updatedValues) !== null && h !== void 0 ? h : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(y, o.original)), Dt(g, t, y);
267
+ function Et(t, e, s, n) {
268
+ const i = g(s);
269
+ i && (i.callbacks || (i.callbacks = []), i.callbacks.push((a, r) => {
270
+ var o;
271
+ const u = t.type === 3 ? t.setMap : t.copy;
272
+ if (z(V(u, e), s)) {
273
+ let f = i.original;
274
+ i.copy && (f = i.copy), gt(t), yt(t, n, a, r), t.options.enableAutoFreeze && (t.options.updatedValues = (o = t.options.updatedValues) !== null && o !== void 0 ? o : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(f, i.original)), tt(u, e, f);
275
275
  }
276
- }), e.options.enableAutoFreeze && o.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), ut(n, e.options) && e.finalities.draft.push(() => {
277
- const c = e.type === 3 ? e.setMap : e.copy;
278
- dt(mt(c, t), n) && en(e, t);
276
+ }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), j(s, t.options) && t.finalities.draft.push(() => {
277
+ const a = t.type === 3 ? t.setMap : t.copy;
278
+ z(V(a, e), s) && me(t, e);
279
279
  });
280
280
  }
281
- function nn(e, t, n, i, o) {
282
- let { original: c, assignedMap: f, options: h } = e, g = e.copy;
283
- g.length < c.length && ([c, g] = [g, c], [n, i] = [i, n]);
284
- for (let y = 0; y < c.length; y += 1)
285
- if (f.get(y.toString()) && g[y] !== c[y]) {
286
- const b = t.concat([y]), O = bt(b, o);
287
- n.push({
288
- op: q.Replace,
289
- path: O,
281
+ function ge(t, e, s, n, i) {
282
+ let { original: a, assignedMap: r, options: o } = t, u = t.copy;
283
+ u.length < a.length && ([a, u] = [u, a], [s, n] = [n, s]);
284
+ for (let f = 0; f < a.length; f += 1)
285
+ if (r.get(f.toString()) && u[f] !== a[f]) {
286
+ const c = e.concat([f]), h = k(c, i);
287
+ s.push({
288
+ op: M.Replace,
289
+ path: h,
290
290
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
291
- value: Nt(g[y])
292
- }), i.push({
293
- op: q.Replace,
294
- path: O,
291
+ value: ot(u[f])
292
+ }), n.push({
293
+ op: M.Replace,
294
+ path: h,
295
295
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
296
- value: Nt(c[y])
296
+ value: ot(a[f])
297
297
  });
298
298
  }
299
- for (let y = c.length; y < g.length; y += 1) {
300
- const b = t.concat([y]), O = bt(b, o);
301
- n.push({
302
- op: q.Add,
303
- path: O,
299
+ for (let f = a.length; f < u.length; f += 1) {
300
+ const c = e.concat([f]), h = k(c, i);
301
+ s.push({
302
+ op: M.Add,
303
+ path: h,
304
304
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
305
- value: Nt(g[y])
305
+ value: ot(u[f])
306
306
  });
307
307
  }
308
- if (c.length < g.length) {
309
- const { arrayLengthAssignment: y = !0 } = h.enablePatches;
310
- if (y) {
311
- const b = t.concat(["length"]), O = bt(b, o);
312
- i.push({
313
- op: q.Replace,
314
- path: O,
315
- value: c.length
308
+ if (a.length < u.length) {
309
+ const { arrayLengthAssignment: f = !0 } = o.enablePatches;
310
+ if (f) {
311
+ const c = e.concat(["length"]), h = k(c, i);
312
+ n.push({
313
+ op: M.Replace,
314
+ path: h,
315
+ value: a.length
316
316
  });
317
317
  } else
318
- for (let b = g.length; c.length < b; b -= 1) {
319
- const O = t.concat([b - 1]), U = bt(O, o);
320
- i.push({
321
- op: q.Remove,
322
- path: U
318
+ for (let c = u.length; a.length < c; c -= 1) {
319
+ const h = e.concat([c - 1]), l = k(h, i);
320
+ n.push({
321
+ op: M.Remove,
322
+ path: l
323
323
  });
324
324
  }
325
325
  }
326
326
  }
327
- function sn({ original: e, copy: t, assignedMap: n }, i, o, c, f) {
328
- n.forEach((h, g) => {
329
- const y = mt(e, g), b = Nt(mt(t, g)), O = h ? At(e, g) ? q.Replace : q.Add : q.Remove;
330
- if (dt(y, b) && O === q.Replace)
327
+ function ye({ original: t, copy: e, assignedMap: s }, n, i, a, r) {
328
+ s.forEach((o, u) => {
329
+ const f = V(t, u), c = ot(V(e, u)), h = o ? G(t, u) ? M.Replace : M.Add : M.Remove;
330
+ if (z(f, c) && h === M.Replace)
331
331
  return;
332
- const U = i.concat(g), B = bt(U, f);
333
- o.push(O === q.Remove ? { op: O, path: B } : { op: O, path: B, value: b }), c.push(O === q.Add ? { op: q.Remove, path: B } : O === q.Remove ? { op: q.Add, path: B, value: y } : { op: q.Replace, path: B, value: y });
332
+ const l = n.concat(u), y = k(l, r);
333
+ i.push(h === M.Remove ? { op: h, path: y } : { op: h, path: y, value: c }), a.push(h === M.Add ? { op: M.Remove, path: y } : h === M.Remove ? { op: M.Add, path: y, value: f } : { op: M.Replace, path: y, value: f });
334
334
  });
335
335
  }
336
- function rn({ original: e, copy: t }, n, i, o, c) {
337
- let f = 0;
338
- e.forEach((h) => {
339
- if (!t.has(h)) {
340
- const g = n.concat([f]), y = bt(g, c);
341
- i.push({
342
- op: q.Remove,
343
- path: y,
344
- value: h
345
- }), o.unshift({
346
- op: q.Add,
347
- path: y,
348
- value: h
336
+ function be({ original: t, copy: e }, s, n, i, a) {
337
+ let r = 0;
338
+ t.forEach((o) => {
339
+ if (!e.has(o)) {
340
+ const u = s.concat([r]), f = k(u, a);
341
+ n.push({
342
+ op: M.Remove,
343
+ path: f,
344
+ value: o
345
+ }), i.unshift({
346
+ op: M.Add,
347
+ path: f,
348
+ value: o
349
349
  });
350
350
  }
351
- f += 1;
352
- }), f = 0, t.forEach((h) => {
353
- if (!e.has(h)) {
354
- const g = n.concat([f]), y = bt(g, c);
355
- i.push({
356
- op: q.Add,
357
- path: y,
358
- value: h
359
- }), o.unshift({
360
- op: q.Remove,
361
- path: y,
362
- value: h
351
+ r += 1;
352
+ }), r = 0, e.forEach((o) => {
353
+ if (!t.has(o)) {
354
+ const u = s.concat([r]), f = k(u, a);
355
+ n.push({
356
+ op: M.Add,
357
+ path: f,
358
+ value: o
359
+ }), i.unshift({
360
+ op: M.Remove,
361
+ path: f,
362
+ value: o
363
363
  });
364
364
  }
365
- f += 1;
365
+ r += 1;
366
366
  });
367
367
  }
368
- function jt(e, t, n, i) {
369
- const { pathAsArray: o = !0 } = e.options.enablePatches;
370
- switch (e.type) {
368
+ function Q(t, e, s, n) {
369
+ const { pathAsArray: i = !0 } = t.options.enablePatches;
370
+ switch (t.type) {
371
371
  case 0:
372
372
  case 2:
373
- return sn(e, t, n, i, o);
373
+ return ye(t, e, s, n, i);
374
374
  case 1:
375
- return nn(e, t, n, i, o);
375
+ return ge(t, e, s, n, i);
376
376
  case 3:
377
- return rn(e, t, n, i, o);
377
+ return be(t, e, s, n, i);
378
378
  }
379
379
  }
380
- let on = !1;
381
- const $t = (e, t, n = !1) => {
382
- if (typeof e == "object" && e !== null && (!ut(e, t) || n) && !on)
380
+ let _e = !1;
381
+ const ut = (t, e, s = !1) => {
382
+ if (typeof t == "object" && t !== null && (!j(t, e) || s) && !_e)
383
383
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
384
- }, Zt = {
384
+ }, bt = {
385
385
  get size() {
386
- return st($(this)).size;
386
+ return E(g(this)).size;
387
387
  },
388
- has(e) {
389
- return st($(this)).has(e);
388
+ has(t) {
389
+ return E(g(this)).has(t);
390
390
  },
391
- set(e, t) {
392
- const n = $(this), i = st(n);
393
- return (!i.has(e) || !dt(i.get(e), t)) && (et(n), lt(n), n.assignedMap.set(e, !0), n.copy.set(e, t), ue(n, e, t, jt)), this;
391
+ set(t, e) {
392
+ const s = g(this), n = E(s);
393
+ return (!n.has(t) || !z(n.get(t), e)) && (R(s), L(s), s.assignedMap.set(t, !0), s.copy.set(t, e), Et(s, t, e, Q)), this;
394
394
  },
395
- delete(e) {
396
- if (!this.has(e))
395
+ delete(t) {
396
+ if (!this.has(t))
397
397
  return !1;
398
- const t = $(this);
399
- return et(t), lt(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
398
+ const e = g(this);
399
+ return R(e), L(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
400
400
  },
401
401
  clear() {
402
- const e = $(this);
402
+ const t = g(this);
403
403
  if (this.size) {
404
- et(e), lt(e), e.assignedMap = /* @__PURE__ */ new Map();
405
- for (const [t] of e.original)
406
- e.assignedMap.set(t, !1);
407
- e.copy.clear();
404
+ R(t), L(t), t.assignedMap = /* @__PURE__ */ new Map();
405
+ for (const [e] of t.original)
406
+ t.assignedMap.set(e, !1);
407
+ t.copy.clear();
408
408
  }
409
409
  },
410
- forEach(e, t) {
411
- const n = $(this);
412
- st(n).forEach((i, o) => {
413
- e.call(t, this.get(o), o, this);
410
+ forEach(t, e) {
411
+ const s = g(this);
412
+ E(s).forEach((n, i) => {
413
+ t.call(e, this.get(i), i, this);
414
414
  });
415
415
  },
416
- get(e) {
417
- var t, n;
418
- const i = $(this), o = st(i).get(e), c = ((n = (t = i.options).mark) === null || n === void 0 ? void 0 : n.call(t, o, rt)) === rt.mutable;
419
- if (i.options.strict && $t(o, i.options, c), c || i.finalized || !ut(o, i.options) || o !== i.original.get(e))
420
- return o;
421
- const f = re.createDraft({
422
- original: o,
423
- parentDraft: i,
424
- key: e,
425
- finalities: i.finalities,
426
- options: i.options
416
+ get(t) {
417
+ var e, s;
418
+ const n = g(this), i = E(n).get(t), a = ((s = (e = n.options).mark) === null || s === void 0 ? void 0 : s.call(e, i, C)) === C.mutable;
419
+ if (n.options.strict && ut(i, n.options, a), a || n.finalized || !j(i, n.options) || i !== n.original.get(t))
420
+ return i;
421
+ const r = It.createDraft({
422
+ original: i,
423
+ parentDraft: n,
424
+ key: t,
425
+ finalities: n.finalities,
426
+ options: n.options
427
427
  });
428
- return et(i), i.copy.set(e, f), f;
428
+ return R(n), n.copy.set(t, r), r;
429
429
  },
430
430
  keys() {
431
- return st($(this)).keys();
431
+ return E(g(this)).keys();
432
432
  },
433
433
  values() {
434
- const e = this.keys();
434
+ const t = this.keys();
435
435
  return {
436
- [Tt]: () => this.values(),
436
+ [rt]: () => this.values(),
437
437
  next: () => {
438
- const t = e.next();
439
- return t.done ? t : {
438
+ const e = t.next();
439
+ return e.done ? e : {
440
440
  done: !1,
441
- value: this.get(t.value)
441
+ value: this.get(e.value)
442
442
  };
443
443
  }
444
444
  };
445
445
  },
446
446
  entries() {
447
- const e = this.keys();
447
+ const t = this.keys();
448
448
  return {
449
- [Tt]: () => this.entries(),
449
+ [rt]: () => this.entries(),
450
450
  next: () => {
451
- const t = e.next();
452
- if (t.done)
453
- return t;
454
- const n = this.get(t.value);
451
+ const e = t.next();
452
+ if (e.done)
453
+ return e;
454
+ const s = this.get(e.value);
455
455
  return {
456
456
  done: !1,
457
- value: [t.value, n]
457
+ value: [e.value, s]
458
458
  };
459
459
  }
460
460
  };
461
461
  },
462
- [Tt]() {
462
+ [rt]() {
463
463
  return this.entries();
464
464
  }
465
- }, an = Reflect.ownKeys(Zt), _e = (e, t, { isValuesIterator: n }) => () => {
466
- var i, o;
467
- const c = t.next();
468
- if (c.done)
469
- return c;
470
- const f = c.value;
471
- let h = e.setMap.get(f);
472
- const g = $(h), y = ((o = (i = e.options).mark) === null || o === void 0 ? void 0 : o.call(i, h, rt)) === rt.mutable;
473
- if (e.options.strict && $t(f, e.options, y), !y && !g && ut(f, e.options) && !e.finalized && e.original.has(f)) {
474
- const b = re.createDraft({
475
- original: f,
476
- parentDraft: e,
477
- key: f,
478
- finalities: e.finalities,
479
- options: e.options
465
+ }, ve = Reflect.ownKeys(bt), $t = (t, e, { isValuesIterator: s }) => () => {
466
+ var n, i;
467
+ const a = e.next();
468
+ if (a.done)
469
+ return a;
470
+ const r = a.value;
471
+ let o = t.setMap.get(r);
472
+ const u = g(o), f = ((i = (n = t.options).mark) === null || i === void 0 ? void 0 : i.call(n, o, C)) === C.mutable;
473
+ if (t.options.strict && ut(r, t.options, f), !f && !u && j(r, t.options) && !t.finalized && t.original.has(r)) {
474
+ const c = It.createDraft({
475
+ original: r,
476
+ parentDraft: t,
477
+ key: r,
478
+ finalities: t.finalities,
479
+ options: t.options
480
480
  });
481
- e.setMap.set(f, b), h = b;
481
+ t.setMap.set(r, c), o = c;
482
482
  } else
483
- g && (h = g.proxy);
483
+ u && (o = u.proxy);
484
484
  return {
485
485
  done: !1,
486
- value: n ? h : [h, h]
486
+ value: s ? o : [o, o]
487
487
  };
488
- }, te = {
488
+ }, _t = {
489
489
  get size() {
490
- return $(this).setMap.size;
490
+ return g(this).setMap.size;
491
491
  },
492
- has(e) {
493
- const t = $(this);
494
- if (t.setMap.has(e))
492
+ has(t) {
493
+ const e = g(this);
494
+ if (e.setMap.has(t))
495
495
  return !0;
496
- et(t);
497
- const n = $(e);
498
- return !!(n && t.setMap.has(n.original));
496
+ R(e);
497
+ const s = g(t);
498
+ return !!(s && e.setMap.has(s.original));
499
499
  },
500
- add(e) {
501
- const t = $(this);
502
- return this.has(e) || (et(t), lt(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), ue(t, e, e, jt)), this;
500
+ add(t) {
501
+ const e = g(this);
502
+ return this.has(t) || (R(e), L(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Et(e, t, t, Q)), this;
503
503
  },
504
- delete(e) {
505
- if (!this.has(e))
504
+ delete(t) {
505
+ if (!this.has(t))
506
506
  return !1;
507
- const t = $(this);
508
- et(t), lt(t);
509
- const n = $(e);
510
- 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));
507
+ const e = g(this);
508
+ R(e), L(e);
509
+ const s = g(t);
510
+ return s && e.setMap.has(s.original) ? (e.assignedMap.set(s.original, !1), e.setMap.delete(s.original)) : (!s && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
511
511
  },
512
512
  clear() {
513
513
  if (!this.size)
514
514
  return;
515
- const e = $(this);
516
- et(e), lt(e);
517
- for (const t of e.original)
518
- e.assignedMap.set(t, !1);
519
- e.setMap.clear();
515
+ const t = g(this);
516
+ R(t), L(t);
517
+ for (const e of t.original)
518
+ t.assignedMap.set(e, !1);
519
+ t.setMap.clear();
520
520
  },
521
521
  values() {
522
- const e = $(this);
523
- et(e);
524
- const t = e.setMap.keys();
522
+ const t = g(this);
523
+ R(t);
524
+ const e = t.setMap.keys();
525
525
  return {
526
526
  [Symbol.iterator]: () => this.values(),
527
- next: _e(e, t, { isValuesIterator: !0 })
527
+ next: $t(t, e, { isValuesIterator: !0 })
528
528
  };
529
529
  },
530
530
  entries() {
531
- const e = $(this);
532
- et(e);
533
- const t = e.setMap.keys();
531
+ const t = g(this);
532
+ R(t);
533
+ const e = t.setMap.keys();
534
534
  return {
535
535
  [Symbol.iterator]: () => this.entries(),
536
- next: _e(e, t, {
536
+ next: $t(t, e, {
537
537
  isValuesIterator: !1
538
538
  })
539
539
  };
@@ -541,99 +541,99 @@ const $t = (e, t, n = !1) => {
541
541
  keys() {
542
542
  return this.values();
543
543
  },
544
- [Tt]() {
544
+ [rt]() {
545
545
  return this.values();
546
546
  },
547
- forEach(e, t) {
548
- const n = this.values();
549
- let i = n.next();
550
- for (; !i.done; )
551
- e.call(t, i.value, i.value, this), i = n.next();
552
- }
553
- }, un = Reflect.ownKeys(te), Be = /* @__PURE__ */ new WeakSet(), ke = {
554
- get(e, t, n) {
555
- var i, o;
556
- const c = (i = e.copy) === null || i === void 0 ? void 0 : i[t];
557
- if (c && Be.has(c))
558
- return c;
559
- if (t === De)
560
- return e;
561
- let f;
562
- if (e.options.mark) {
563
- const y = t === "size" && (e.original instanceof Map || e.original instanceof Set) ? Reflect.get(e.original, t) : Reflect.get(e.original, t, n);
564
- if (f = e.options.mark(y, rt), f === rt.mutable)
565
- return e.options.strict && $t(y, e.options, !0), y;
547
+ forEach(t, e) {
548
+ const s = this.values();
549
+ let n = s.next();
550
+ for (; !n.done; )
551
+ t.call(e, n.value, n.value, this), n = s.next();
552
+ }
553
+ }, we = Reflect.ownKeys(_t), Yt = /* @__PURE__ */ new WeakSet(), Xt = {
554
+ get(t, e, s) {
555
+ var n, i;
556
+ const a = (n = t.copy) === null || n === void 0 ? void 0 : n[e];
557
+ if (a && Yt.has(a))
558
+ return a;
559
+ if (e === Ht)
560
+ return t;
561
+ let r;
562
+ if (t.options.mark) {
563
+ const f = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, s);
564
+ if (r = t.options.mark(f, C), r === C.mutable)
565
+ return t.options.strict && ut(f, t.options, !0), f;
566
566
  }
567
- const h = st(e);
568
- if (h instanceof Map && an.includes(t)) {
569
- if (t === "size")
570
- return Object.getOwnPropertyDescriptor(Zt, "size").get.call(e.proxy);
571
- const y = Zt[t];
572
- if (y)
573
- return y.bind(e.proxy);
567
+ const o = E(t);
568
+ if (o instanceof Map && ve.includes(e)) {
569
+ if (e === "size")
570
+ return Object.getOwnPropertyDescriptor(bt, "size").get.call(t.proxy);
571
+ const f = bt[e];
572
+ if (f)
573
+ return f.bind(t.proxy);
574
574
  }
575
- if (h instanceof Set && un.includes(t)) {
576
- if (t === "size")
577
- return Object.getOwnPropertyDescriptor(te, "size").get.call(e.proxy);
578
- const y = te[t];
579
- if (y)
580
- return y.bind(e.proxy);
575
+ if (o instanceof Set && we.includes(e)) {
576
+ if (e === "size")
577
+ return Object.getOwnPropertyDescriptor(_t, "size").get.call(t.proxy);
578
+ const f = _t[e];
579
+ if (f)
580
+ return f.bind(t.proxy);
581
581
  }
582
- if (!At(h, t)) {
583
- const y = be(h, t);
584
- return y ? "value" in y ? y.value : (
582
+ if (!G(o, e)) {
583
+ const f = Lt(o, e);
584
+ return f ? "value" in f ? f.value : (
585
585
  // !case: support for getter
586
- (o = y.get) === null || o === void 0 ? void 0 : o.call(e.proxy)
586
+ (i = f.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
587
587
  ) : void 0;
588
588
  }
589
- const g = h[t];
590
- if (e.options.strict && $t(g, e.options), e.finalized || !ut(g, e.options))
591
- return g;
592
- if (g === Ht(e.original, t)) {
593
- if (et(e), e.copy[t] = fe({
594
- original: e.original[t],
595
- parentDraft: e,
596
- key: e.type === 1 ? Number(t) : t,
597
- finalities: e.finalities,
598
- options: e.options
599
- }), typeof f == "function") {
600
- const y = $(e.copy[t]);
601
- return et(y), lt(y), y.copy;
589
+ const u = o[e];
590
+ if (t.options.strict && ut(u, t.options), t.finalized || !j(u, t.options))
591
+ return u;
592
+ if (u === pt(t.original, e)) {
593
+ if (R(t), t.copy[e] = At({
594
+ original: t.original[e],
595
+ parentDraft: t,
596
+ key: t.type === 1 ? Number(e) : e,
597
+ finalities: t.finalities,
598
+ options: t.options
599
+ }), typeof r == "function") {
600
+ const f = g(t.copy[e]);
601
+ return R(f), L(f), f.copy;
602
602
  }
603
- return e.copy[t];
603
+ return t.copy[e];
604
604
  }
605
- return g;
605
+ return u;
606
606
  },
607
- set(e, t, n) {
608
- var i;
609
- if (e.type === 3 || e.type === 2)
607
+ set(t, e, s) {
608
+ var n;
609
+ if (t.type === 3 || t.type === 2)
610
610
  throw new Error("Map/Set draft does not support any property assignment.");
611
- let o;
612
- if (e.type === 1 && t !== "length" && !(Number.isInteger(o = Number(t)) && o >= 0 && (t === 0 || o === 0 || String(o) === String(t))))
611
+ let i;
612
+ if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
613
613
  throw new Error("Only supports setting array indices and the 'length' property.");
614
- const c = be(st(e), t);
615
- if (c != null && c.set)
616
- return c.set.call(e.proxy, n), !0;
617
- const f = Ht(st(e), t), h = $(f);
618
- return h && dt(h.original, n) ? (e.copy[t] = n, e.assignedMap = (i = e.assignedMap) !== null && i !== void 0 ? i : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (dt(n, f) && (n !== void 0 || At(e.original, t)) || (et(e), lt(e), At(e.original, t) && dt(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, ue(e, t, n, jt)), !0);
614
+ const a = Lt(E(t), e);
615
+ if (a != null && a.set)
616
+ return a.set.call(t.proxy, s), !0;
617
+ const r = pt(E(t), e), o = g(r);
618
+ return o && z(o.original, s) ? (t.copy[e] = s, t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (z(s, r) && (s !== void 0 || G(t.original, e)) || (R(t), L(t), G(t.original, e) && z(s, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = s, Et(t, e, s, Q)), !0);
619
619
  },
620
- has(e, t) {
621
- return t in st(e);
620
+ has(t, e) {
621
+ return e in E(t);
622
622
  },
623
- ownKeys(e) {
624
- return Reflect.ownKeys(st(e));
623
+ ownKeys(t) {
624
+ return Reflect.ownKeys(E(t));
625
625
  },
626
- getOwnPropertyDescriptor(e, t) {
627
- const n = st(e), i = Reflect.getOwnPropertyDescriptor(n, t);
628
- return i && {
626
+ getOwnPropertyDescriptor(t, e) {
627
+ const s = E(t), n = Reflect.getOwnPropertyDescriptor(s, e);
628
+ return n && {
629
629
  writable: !0,
630
- configurable: e.type !== 1 || t !== "length",
631
- enumerable: i.enumerable,
632
- value: n[t]
630
+ configurable: t.type !== 1 || e !== "length",
631
+ enumerable: n.enumerable,
632
+ value: s[e]
633
633
  };
634
634
  },
635
- getPrototypeOf(e) {
636
- return Reflect.getPrototypeOf(e.original);
635
+ getPrototypeOf(t) {
636
+ return Reflect.getPrototypeOf(t.original);
637
637
  },
638
638
  setPrototypeOf() {
639
639
  throw new Error("Cannot call 'setPrototypeOf()' on drafts");
@@ -641,1841 +641,969 @@ const $t = (e, t, n = !1) => {
641
641
  defineProperty() {
642
642
  throw new Error("Cannot call 'defineProperty()' on drafts");
643
643
  },
644
- deleteProperty(e, t) {
645
- var n;
646
- return e.type === 1 ? ke.set.call(this, e, t, void 0, e.proxy) : (Ht(e.original, t) !== void 0 || t in e.original ? (et(e), lt(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);
644
+ deleteProperty(t, e) {
645
+ var s;
646
+ return t.type === 1 ? Xt.set.call(this, t, e, void 0, t.proxy) : (pt(t.original, e) !== void 0 || e in t.original ? (R(t), L(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (s = t.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
647
647
  }
648
648
  };
649
- function fe(e) {
650
- const { original: t, parentDraft: n, key: i, finalities: o, options: c } = e, f = _t(t), h = {
651
- type: f,
649
+ function At(t) {
650
+ const { original: e, parentDraft: s, key: n, finalities: i, options: a } = t, r = F(e), o = {
651
+ type: r,
652
652
  finalized: !1,
653
- parent: n,
654
- original: t,
653
+ parent: s,
654
+ original: e,
655
655
  copy: null,
656
656
  proxy: null,
657
- finalities: o,
658
- options: c,
657
+ finalities: i,
658
+ options: a,
659
659
  // Mapping of draft Set items to their corresponding draft values.
660
- setMap: f === 3 ? new Map(t.entries()) : void 0
660
+ setMap: r === 3 ? new Map(e.entries()) : void 0
661
661
  };
662
- (i || "key" in e) && (h.key = i);
663
- const { proxy: g, revoke: y } = Proxy.revocable(f === 1 ? Object.assign([], h) : h, ke);
664
- if (o.revoke.push(y), Be.add(g), h.proxy = g, n) {
665
- const b = n;
666
- b.finalities.draft.push((O, U) => {
667
- var B, I;
668
- const L = $(g);
669
- let d = b.type === 3 ? b.setMap : b.copy;
670
- const S = mt(d, i), R = $(S);
671
- if (R) {
672
- let E = R.original;
673
- R.operated && (E = oe(S)), Xt(R), Qt(R, jt, O, U), b.options.enableAutoFreeze && (b.options.updatedValues = (B = b.options.updatedValues) !== null && B !== void 0 ? B : /* @__PURE__ */ new WeakMap(), b.options.updatedValues.set(E, R.original)), Dt(d, i, E);
662
+ (n || "key" in t) && (o.key = n);
663
+ const { proxy: u, revoke: f } = Proxy.revocable(r === 1 ? Object.assign([], o) : o, Xt);
664
+ if (i.revoke.push(f), Yt.add(u), o.proxy = u, s) {
665
+ const c = s;
666
+ c.finalities.draft.push((h, l) => {
667
+ var y, m;
668
+ const I = g(u);
669
+ let p = c.type === 3 ? c.setMap : c.copy;
670
+ const S = V(p, n), w = g(S);
671
+ if (w) {
672
+ let _ = w.original;
673
+ w.operated && (_ = St(S)), gt(w), yt(w, Q, h, l), c.options.enableAutoFreeze && (c.options.updatedValues = (y = c.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(_, w.original)), tt(p, n, _);
674
674
  }
675
- (I = L.callbacks) === null || I === void 0 || I.forEach((E) => {
676
- E(O, U);
675
+ (m = I.callbacks) === null || m === void 0 || m.forEach((_) => {
676
+ _(h, l);
677
677
  });
678
678
  });
679
679
  } else {
680
- const b = $(g);
681
- b.finalities.draft.push((O, U) => {
682
- Xt(b), Qt(b, jt, O, U);
680
+ const c = g(u);
681
+ c.finalities.draft.push((h, l) => {
682
+ gt(c), yt(c, Q, h, l);
683
683
  });
684
684
  }
685
- return g;
685
+ return u;
686
686
  }
687
- re.createDraft = fe;
688
- function fn(e, t, n, i, o) {
689
- var c;
690
- const f = $(e), h = (c = f == null ? void 0 : f.original) !== null && c !== void 0 ? c : e, g = !!t.length;
691
- if (f != null && f.operated)
692
- for (; f.finalities.draft.length > 0; )
693
- f.finalities.draft.pop()(n, i);
694
- const y = g ? t[0] : f ? f.operated ? f.copy : f.original : e;
695
- return f && Gt(f), o && It(y, y, f == null ? void 0 : f.options.updatedValues), [
696
- y,
697
- n && g ? [{ op: q.Replace, path: [], value: t[0] }] : n,
698
- i && g ? [{ op: q.Replace, path: [], value: h }] : i
687
+ It.createDraft = At;
688
+ function Me(t, e, s, n, i) {
689
+ var a;
690
+ const r = g(t), o = (a = r == null ? void 0 : r.original) !== null && a !== void 0 ? a : t, u = !!e.length;
691
+ if (r != null && r.operated)
692
+ for (; r.finalities.draft.length > 0; )
693
+ r.finalities.draft.pop()(s, n);
694
+ const f = u ? e[0] : r ? r.operated ? r.copy : r.original : t;
695
+ return r && mt(r), i && J(f, f, r == null ? void 0 : r.options.updatedValues), [
696
+ f,
697
+ s && u ? [{ op: M.Replace, path: [], value: e[0] }] : s,
698
+ n && u ? [{ op: M.Replace, path: [], value: o }] : n
699
699
  ];
700
700
  }
701
- function ln(e, t) {
702
- var n;
703
- const i = {
701
+ function Oe(t, e) {
702
+ var s;
703
+ const n = {
704
704
  draft: [],
705
705
  revoke: [],
706
706
  handledSet: /* @__PURE__ */ new WeakSet()
707
707
  };
708
- let o, c;
709
- t.enablePatches && (o = [], c = []);
710
- const h = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, rt)) === rt.mutable || !ut(e, t) ? e : fe({
711
- original: e,
708
+ let i, a;
709
+ e.enablePatches && (i = [], a = []);
710
+ const o = ((s = e.mark) === null || s === void 0 ? void 0 : s.call(e, t, C)) === C.mutable || !j(t, e) ? t : At({
711
+ original: t,
712
712
  parentDraft: null,
713
- finalities: i,
714
- options: t
713
+ finalities: n,
714
+ options: e
715
715
  });
716
716
  return [
717
- h,
718
- (g = []) => {
719
- const [y, b, O] = fn(h, g, o, c, t.enableAutoFreeze);
720
- return t.enablePatches ? [y, b, O] : y;
717
+ o,
718
+ (u = []) => {
719
+ const [f, c, h] = Me(o, u, i, a, e.enableAutoFreeze);
720
+ return e.enablePatches ? [f, c, h] : f;
721
721
  }
722
722
  ];
723
723
  }
724
- function ee(e) {
725
- const { rootDraft: t, value: n, useRawReturn: i = !1, isRoot: o = !0 } = e;
726
- ae(n, (c, f, h) => {
727
- const g = $(f);
728
- if (g && t && g.finalities === t.finalities) {
729
- e.isContainDraft = !0;
730
- const y = g.original;
731
- if (h instanceof Set) {
732
- const b = Array.from(h);
733
- h.clear(), b.forEach((O) => h.add(c === O ? y : O));
724
+ function vt(t) {
725
+ const { rootDraft: e, value: s, useRawReturn: n = !1, isRoot: i = !0 } = t;
726
+ Rt(s, (a, r, o) => {
727
+ const u = g(r);
728
+ if (u && e && u.finalities === e.finalities) {
729
+ t.isContainDraft = !0;
730
+ const f = u.original;
731
+ if (o instanceof Set) {
732
+ const c = Array.from(o);
733
+ o.clear(), c.forEach((h) => o.add(a === h ? f : h));
734
734
  } else
735
- Dt(h, c, y);
735
+ tt(o, a, f);
736
736
  } else
737
- typeof f == "object" && f !== null && (e.value = f, e.isRoot = !1, ee(e));
738
- }), o && (e.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), i && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
737
+ typeof r == "object" && r !== null && (t.value = r, t.isRoot = !1, vt(t));
738
+ }), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), n && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
739
739
  }
740
- function Te(e) {
741
- const t = $(e);
742
- if (!ut(e, t == null ? void 0 : t.options))
743
- return e;
744
- const n = _t(e);
745
- if (t && !t.operated)
746
- return t.original;
747
- let i;
748
- function o() {
749
- i = n === 2 ? new Map(e) : n === 3 ? Array.from(t.setMap.values()) : Ue(e, t == null ? void 0 : t.options);
740
+ function Qt(t) {
741
+ const e = g(t);
742
+ if (!j(t, e == null ? void 0 : e.options))
743
+ return t;
744
+ const s = F(t);
745
+ if (e && !e.operated)
746
+ return e.original;
747
+ let n;
748
+ function i() {
749
+ n = s === 2 ? new Map(t) : s === 3 ? Array.from(e.setMap.values()) : Kt(t, e == null ? void 0 : e.options);
750
750
  }
751
- if (t) {
752
- t.finalized = !0;
751
+ if (e) {
752
+ e.finalized = !0;
753
753
  try {
754
- o();
754
+ i();
755
755
  } finally {
756
- t.finalized = !1;
756
+ e.finalized = !1;
757
757
  }
758
758
  } else
759
- i = e;
760
- return ae(i, (c, f) => {
761
- if (t && dt(mt(t.original, c), f))
759
+ n = t;
760
+ return Rt(n, (a, r) => {
761
+ if (e && z(V(e.original, a), r))
762
762
  return;
763
- const h = Te(f);
764
- h !== f && (i === e && o(), Dt(i, c, h));
765
- }), n === 3 ? new Set(i) : i;
763
+ const o = Qt(r);
764
+ o !== r && (n === t && i(), tt(n, a, o));
765
+ }), s === 3 ? new Set(n) : n;
766
766
  }
767
- function ve(e) {
768
- if (!wt(e))
769
- throw new Error(`current() is only used for Draft, parameter: ${e}`);
770
- return Te(e);
767
+ function zt(t) {
768
+ if (!N(t))
769
+ throw new Error(`current() is only used for Draft, parameter: ${t}`);
770
+ return Qt(t);
771
771
  }
772
- const cn = (e) => {
773
- if (e !== void 0 && Object.prototype.toString.call(e) !== "[object Object]")
774
- throw new Error(`Invalid options: ${String(e)}, 'options' should be an object.`);
775
- return function t(n, i, o) {
776
- var c, f, h;
777
- if (typeof n == "function" && typeof i != "function")
778
- return function(j, ...m) {
779
- return t(j, (v) => n.call(this, v, ...m), i);
772
+ const Ie = (t) => {
773
+ if (t !== void 0 && Object.prototype.toString.call(t) !== "[object Object]")
774
+ throw new Error(`Invalid options: ${String(t)}, 'options' should be an object.`);
775
+ return function e(s, n, i) {
776
+ var a, r, o;
777
+ if (typeof s == "function" && typeof n != "function")
778
+ return function(b, ...U) {
779
+ return e(b, (x) => s.call(this, x, ...U), n);
780
780
  };
781
- const g = n, y = i;
782
- let b = o;
783
- if (typeof i != "function" && (b = i), b !== void 0 && Object.prototype.toString.call(b) !== "[object Object]")
784
- throw new Error(`Invalid options: ${b}, 'options' should be an object.`);
785
- b = Object.assign(Object.assign({}, e), b);
786
- const O = wt(g) ? ve(g) : g, U = Array.isArray(b.mark) ? (j, m) => {
787
- for (const v of b.mark) {
788
- if (typeof v != "function")
789
- throw new Error(`Invalid mark: ${v}, 'mark' should be a function.`);
790
- const a = v(j, m);
791
- if (a)
792
- return a;
781
+ const u = s, f = n;
782
+ let c = i;
783
+ if (typeof n != "function" && (c = n), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
784
+ throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
785
+ c = Object.assign(Object.assign({}, t), c);
786
+ const h = N(u) ? zt(u) : u, l = Array.isArray(c.mark) ? (b, U) => {
787
+ for (const x of c.mark) {
788
+ if (typeof x != "function")
789
+ throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
790
+ const H = x(b, U);
791
+ if (H)
792
+ return H;
793
793
  }
794
- } : b.mark, B = (c = b.enablePatches) !== null && c !== void 0 ? c : !1, I = (f = b.strict) !== null && f !== void 0 ? f : !1, d = {
795
- enableAutoFreeze: (h = b.enableAutoFreeze) !== null && h !== void 0 ? h : !1,
796
- mark: U,
797
- strict: I,
798
- enablePatches: B
794
+ } : c.mark, y = (a = c.enablePatches) !== null && a !== void 0 ? a : !1, m = (r = c.strict) !== null && r !== void 0 ? r : !1, p = {
795
+ enableAutoFreeze: (o = c.enableAutoFreeze) !== null && o !== void 0 ? o : !1,
796
+ mark: l,
797
+ strict: m,
798
+ enablePatches: y
799
799
  };
800
- if (!ut(O, d) && typeof O == "object" && O !== null)
800
+ if (!j(h, p) && typeof h == "object" && h !== null)
801
801
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
802
- const [S, R] = ln(O, d);
803
- if (typeof i != "function") {
804
- if (!ut(O, d))
802
+ const [S, w] = Oe(h, p);
803
+ if (typeof n != "function") {
804
+ if (!j(h, p))
805
805
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
806
- return [S, R];
806
+ return [S, w];
807
807
  }
808
- let E;
808
+ let _;
809
809
  try {
810
- E = y(S);
811
- } catch (j) {
812
- throw Gt($(S)), j;
810
+ _ = f(S);
811
+ } catch (b) {
812
+ throw mt(g(S)), b;
813
813
  }
814
- const P = (j) => {
815
- const m = $(S);
816
- if (!wt(j)) {
817
- if (j !== void 0 && !dt(j, S) && (m != null && m.operated))
814
+ const et = (b) => {
815
+ const U = g(S);
816
+ if (!N(b)) {
817
+ if (b !== void 0 && !z(b, S) && (U != null && U.operated))
818
818
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
819
- const a = j == null ? void 0 : j[Xe];
820
- if (a) {
821
- const l = a[0];
822
- return d.strict && typeof j == "object" && j !== null && ee({
823
- rootDraft: m,
824
- value: j,
819
+ const H = b == null ? void 0 : b[he];
820
+ if (H) {
821
+ const ce = H[0];
822
+ return p.strict && typeof b == "object" && b !== null && vt({
823
+ rootDraft: U,
824
+ value: b,
825
825
  useRawReturn: !0
826
- }), R([l]);
826
+ }), w([ce]);
827
827
  }
828
- if (j !== void 0)
829
- return typeof j == "object" && j !== null && ee({ rootDraft: m, value: j }), R([j]);
828
+ if (b !== void 0)
829
+ return typeof b == "object" && b !== null && vt({ rootDraft: U, value: b }), w([b]);
830
830
  }
831
- if (j === S || j === void 0)
832
- return R([]);
833
- const v = $(j);
834
- if (d === v.options) {
835
- if (v.operated)
831
+ if (b === S || b === void 0)
832
+ return w([]);
833
+ const x = g(b);
834
+ if (p === x.options) {
835
+ if (x.operated)
836
836
  throw new Error("Cannot return a modified child draft.");
837
- return R([ve(j)]);
837
+ return w([zt(b)]);
838
838
  }
839
- return R([j]);
839
+ return w([b]);
840
840
  };
841
- return E instanceof Promise ? E.then(P, (j) => {
842
- throw Gt($(S)), j;
843
- }) : P(E);
841
+ return _ instanceof Promise ? _.then(et, (b) => {
842
+ throw mt(g(S)), b;
843
+ }) : et(_);
844
844
  };
845
- }, Z = cn();
845
+ }, v = Ie();
846
846
  Object.prototype.constructor.toString();
847
- function hn(e) {
848
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
849
- }
850
- function Ut(e) {
851
- throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
852
- }
853
- var Ne = { exports: {} };
854
- (function(e, t) {
855
- (function(n) {
856
- e.exports = n();
857
- })(function() {
858
- return function n(i, o, c) {
859
- function f(y, b) {
860
- if (!o[y]) {
861
- if (!i[y]) {
862
- var O = typeof Ut == "function" && Ut;
863
- if (!b && O)
864
- return O(y, !0);
865
- if (h)
866
- return h(y, !0);
867
- throw new Error("Cannot find module '" + y + "'");
868
- }
869
- b = o[y] = { exports: {} }, i[y][0].call(b.exports, function(U) {
870
- var B = i[y][1][U];
871
- return f(B || U);
872
- }, b, b.exports, n, i, o, c);
873
- }
874
- return o[y].exports;
875
- }
876
- for (var h = typeof Ut == "function" && Ut, g = 0; g < c.length; g++)
877
- f(c[g]);
878
- return f;
879
- }({ 1: [function(n, i, o) {
880
- (function(c, f, h, g, y, b, O, U, B) {
881
- var I = n("crypto");
882
- function L(m, v) {
883
- v = R(m, v);
884
- var a;
885
- return (a = v.algorithm !== "passthrough" ? I.createHash(v.algorithm) : new j()).write === void 0 && (a.write = a.update, a.end = a.update), P(v, a).dispatch(m), a.update || a.end(""), a.digest ? a.digest(v.encoding === "buffer" ? void 0 : v.encoding) : (m = a.read(), v.encoding !== "buffer" ? m.toString(v.encoding) : m);
886
- }
887
- (o = i.exports = L).sha1 = function(m) {
888
- return L(m);
889
- }, o.keys = function(m) {
890
- return L(m, { excludeValues: !0, algorithm: "sha1", encoding: "hex" });
891
- }, o.MD5 = function(m) {
892
- return L(m, { algorithm: "md5", encoding: "hex" });
893
- }, o.keysMD5 = function(m) {
894
- return L(m, { algorithm: "md5", encoding: "hex", excludeValues: !0 });
895
- };
896
- var d = I.getHashes ? I.getHashes().slice() : ["sha1", "md5"], S = (d.push("passthrough"), ["buffer", "hex", "binary", "base64"]);
897
- function R(m, v) {
898
- var a = {};
899
- if (a.algorithm = (v = v || {}).algorithm || "sha1", a.encoding = v.encoding || "hex", a.excludeValues = !!v.excludeValues, a.algorithm = a.algorithm.toLowerCase(), a.encoding = a.encoding.toLowerCase(), a.ignoreUnknown = v.ignoreUnknown === !0, a.respectType = v.respectType !== !1, a.respectFunctionNames = v.respectFunctionNames !== !1, a.respectFunctionProperties = v.respectFunctionProperties !== !1, a.unorderedArrays = v.unorderedArrays === !0, a.unorderedSets = v.unorderedSets !== !1, a.unorderedObjects = v.unorderedObjects !== !1, a.replacer = v.replacer || void 0, a.excludeKeys = v.excludeKeys || void 0, m === void 0)
900
- throw new Error("Object argument required.");
901
- for (var l = 0; l < d.length; ++l)
902
- d[l].toLowerCase() === a.algorithm.toLowerCase() && (a.algorithm = d[l]);
903
- if (d.indexOf(a.algorithm) === -1)
904
- throw new Error('Algorithm "' + a.algorithm + '" not supported. supported values: ' + d.join(", "));
905
- if (S.indexOf(a.encoding) === -1 && a.algorithm !== "passthrough")
906
- throw new Error('Encoding "' + a.encoding + '" not supported. supported values: ' + S.join(", "));
907
- return a;
908
- }
909
- function E(m) {
910
- if (typeof m == "function")
911
- return /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(m)) != null;
912
- }
913
- function P(m, v, a) {
914
- a = a || [];
915
- function l(r) {
916
- return v.update ? v.update(r, "utf8") : v.write(r, "utf8");
917
- }
918
- return { dispatch: function(r) {
919
- return this["_" + ((r = m.replacer ? m.replacer(r) : r) === null ? "null" : typeof r)](r);
920
- }, _object: function(r) {
921
- var w, _ = Object.prototype.toString.call(r), N = /\[object (.*)\]/i.exec(_);
922
- if (N = (N = N ? N[1] : "unknown:[" + _ + "]").toLowerCase(), 0 <= (_ = a.indexOf(r)))
923
- return this.dispatch("[CIRCULAR:" + _ + "]");
924
- if (a.push(r), h !== void 0 && h.isBuffer && h.isBuffer(r))
925
- return l("buffer:"), l(r);
926
- if (N === "object" || N === "function" || N === "asyncfunction")
927
- return _ = Object.keys(r), m.unorderedObjects && (_ = _.sort()), m.respectType === !1 || E(r) || _.splice(0, 0, "prototype", "__proto__", "constructor"), m.excludeKeys && (_ = _.filter(function(T) {
928
- return !m.excludeKeys(T);
929
- })), l("object:" + _.length + ":"), w = this, _.forEach(function(T) {
930
- w.dispatch(T), l(":"), m.excludeValues || w.dispatch(r[T]), l(",");
931
- });
932
- if (!this["_" + N]) {
933
- if (m.ignoreUnknown)
934
- return l("[" + N + "]");
935
- throw new Error('Unknown object type "' + N + '"');
936
- }
937
- this["_" + N](r);
938
- }, _array: function(r, T) {
939
- T = T !== void 0 ? T : m.unorderedArrays !== !1;
940
- var _ = this;
941
- if (l("array:" + r.length + ":"), !T || r.length <= 1)
942
- return r.forEach(function(z) {
943
- return _.dispatch(z);
944
- });
945
- var N = [], T = r.map(function(z) {
946
- var x = new j(), J = a.slice();
947
- return P(m, x, J).dispatch(z), N = N.concat(J.slice(a.length)), x.read().toString();
948
- });
949
- return a = a.concat(N), T.sort(), this._array(T, !1);
950
- }, _date: function(r) {
951
- return l("date:" + r.toJSON());
952
- }, _symbol: function(r) {
953
- return l("symbol:" + r.toString());
954
- }, _error: function(r) {
955
- return l("error:" + r.toString());
956
- }, _boolean: function(r) {
957
- return l("bool:" + r.toString());
958
- }, _string: function(r) {
959
- l("string:" + r.length + ":"), l(r.toString());
960
- }, _function: function(r) {
961
- l("fn:"), E(r) ? this.dispatch("[native]") : this.dispatch(r.toString()), m.respectFunctionNames !== !1 && this.dispatch("function-name:" + String(r.name)), m.respectFunctionProperties && this._object(r);
962
- }, _number: function(r) {
963
- return l("number:" + r.toString());
964
- }, _xml: function(r) {
965
- return l("xml:" + r.toString());
966
- }, _null: function() {
967
- return l("Null");
968
- }, _undefined: function() {
969
- return l("Undefined");
970
- }, _regexp: function(r) {
971
- return l("regex:" + r.toString());
972
- }, _uint8array: function(r) {
973
- return l("uint8array:"), this.dispatch(Array.prototype.slice.call(r));
974
- }, _uint8clampedarray: function(r) {
975
- return l("uint8clampedarray:"), this.dispatch(Array.prototype.slice.call(r));
976
- }, _int8array: function(r) {
977
- return l("int8array:"), this.dispatch(Array.prototype.slice.call(r));
978
- }, _uint16array: function(r) {
979
- return l("uint16array:"), this.dispatch(Array.prototype.slice.call(r));
980
- }, _int16array: function(r) {
981
- return l("int16array:"), this.dispatch(Array.prototype.slice.call(r));
982
- }, _uint32array: function(r) {
983
- return l("uint32array:"), this.dispatch(Array.prototype.slice.call(r));
984
- }, _int32array: function(r) {
985
- return l("int32array:"), this.dispatch(Array.prototype.slice.call(r));
986
- }, _float32array: function(r) {
987
- return l("float32array:"), this.dispatch(Array.prototype.slice.call(r));
988
- }, _float64array: function(r) {
989
- return l("float64array:"), this.dispatch(Array.prototype.slice.call(r));
990
- }, _arraybuffer: function(r) {
991
- return l("arraybuffer:"), this.dispatch(new Uint8Array(r));
992
- }, _url: function(r) {
993
- return l("url:" + r.toString());
994
- }, _map: function(r) {
995
- return l("map:"), r = Array.from(r), this._array(r, m.unorderedSets !== !1);
996
- }, _set: function(r) {
997
- return l("set:"), r = Array.from(r), this._array(r, m.unorderedSets !== !1);
998
- }, _file: function(r) {
999
- return l("file:"), this.dispatch([r.name, r.size, r.type, r.lastModfied]);
1000
- }, _blob: function() {
1001
- if (m.ignoreUnknown)
1002
- return l("[blob]");
1003
- throw Error(`Hashing Blob objects is currently not supported
1004
- (see https://github.com/puleos/object-hash/issues/26)
1005
- Use "options.replacer" or "options.ignoreUnknown"
1006
- `);
1007
- }, _domwindow: function() {
1008
- return l("domwindow");
1009
- }, _bigint: function(r) {
1010
- return l("bigint:" + r.toString());
1011
- }, _process: function() {
1012
- return l("process");
1013
- }, _timer: function() {
1014
- return l("timer");
1015
- }, _pipe: function() {
1016
- return l("pipe");
1017
- }, _tcp: function() {
1018
- return l("tcp");
1019
- }, _udp: function() {
1020
- return l("udp");
1021
- }, _tty: function() {
1022
- return l("tty");
1023
- }, _statwatcher: function() {
1024
- return l("statwatcher");
1025
- }, _securecontext: function() {
1026
- return l("securecontext");
1027
- }, _connection: function() {
1028
- return l("connection");
1029
- }, _zlib: function() {
1030
- return l("zlib");
1031
- }, _context: function() {
1032
- return l("context");
1033
- }, _nodescript: function() {
1034
- return l("nodescript");
1035
- }, _httpparser: function() {
1036
- return l("httpparser");
1037
- }, _dataview: function() {
1038
- return l("dataview");
1039
- }, _signal: function() {
1040
- return l("signal");
1041
- }, _fsevent: function() {
1042
- return l("fsevent");
1043
- }, _tlswrap: function() {
1044
- return l("tlswrap");
1045
- } };
1046
- }
1047
- function j() {
1048
- return { buf: "", write: function(m) {
1049
- this.buf += m;
1050
- }, end: function(m) {
1051
- this.buf += m;
1052
- }, read: function() {
1053
- return this.buf;
1054
- } };
1055
- }
1056
- o.writeToStream = function(m, v, a) {
1057
- return a === void 0 && (a = v, v = {}), P(v = R(m, v), a).dispatch(m);
1058
- };
1059
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/fake_9a5aa49d.js", "/");
1060
- }, { buffer: 3, crypto: 5, lYpoI2: 11 }], 2: [function(n, i, o) {
1061
- (function(c, f, h, g, y, b, O, U, B) {
1062
- (function(I) {
1063
- var L = typeof Uint8Array < "u" ? Uint8Array : Array, d = "+".charCodeAt(0), S = "/".charCodeAt(0), R = "0".charCodeAt(0), E = "a".charCodeAt(0), P = "A".charCodeAt(0), j = "-".charCodeAt(0), m = "_".charCodeAt(0);
1064
- function v(a) {
1065
- return a = a.charCodeAt(0), a === d || a === j ? 62 : a === S || a === m ? 63 : a < R ? -1 : a < R + 10 ? a - R + 26 + 26 : a < P + 26 ? a - P : a < E + 26 ? a - E + 26 : void 0;
1066
- }
1067
- I.toByteArray = function(a) {
1068
- var l, r;
1069
- if (0 < a.length % 4)
1070
- throw new Error("Invalid string. Length must be a multiple of 4");
1071
- var w = a.length, w = a.charAt(w - 2) === "=" ? 2 : a.charAt(w - 1) === "=" ? 1 : 0, _ = new L(3 * a.length / 4 - w), N = 0 < w ? a.length - 4 : a.length, T = 0;
1072
- function z(x) {
1073
- _[T++] = x;
1074
- }
1075
- for (l = 0; l < N; l += 4, 0)
1076
- z((16711680 & (r = v(a.charAt(l)) << 18 | v(a.charAt(l + 1)) << 12 | v(a.charAt(l + 2)) << 6 | v(a.charAt(l + 3)))) >> 16), z((65280 & r) >> 8), z(255 & r);
1077
- return w == 2 ? z(255 & (r = v(a.charAt(l)) << 2 | v(a.charAt(l + 1)) >> 4)) : w == 1 && (z((r = v(a.charAt(l)) << 10 | v(a.charAt(l + 1)) << 4 | v(a.charAt(l + 2)) >> 2) >> 8 & 255), z(255 & r)), _;
1078
- }, I.fromByteArray = function(a) {
1079
- var l, r, w, _, N = a.length % 3, T = "";
1080
- function z(x) {
1081
- return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(x);
1082
- }
1083
- for (l = 0, w = a.length - N; l < w; l += 3)
1084
- r = (a[l] << 16) + (a[l + 1] << 8) + a[l + 2], T += z((_ = r) >> 18 & 63) + z(_ >> 12 & 63) + z(_ >> 6 & 63) + z(63 & _);
1085
- switch (N) {
1086
- case 1:
1087
- T = (T += z((r = a[a.length - 1]) >> 2)) + z(r << 4 & 63) + "==";
1088
- break;
1089
- case 2:
1090
- T = (T = (T += z((r = (a[a.length - 2] << 8) + a[a.length - 1]) >> 10)) + z(r >> 4 & 63)) + z(r << 2 & 63) + "=";
1091
- }
1092
- return T;
1093
- };
1094
- })(o === void 0 ? this.base64js = {} : o);
1095
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js", "/node_modules/gulp-browserify/node_modules/base64-js/lib");
1096
- }, { buffer: 3, lYpoI2: 11 }], 3: [function(n, i, o) {
1097
- (function(c, f, d, g, y, b, O, U, B) {
1098
- var I = n("base64-js"), L = n("ieee754");
1099
- function d(s, u, p) {
1100
- if (!(this instanceof d))
1101
- return new d(s, u, p);
1102
- var A, M, D, F, Y = typeof s;
1103
- if (u === "base64" && Y == "string")
1104
- for (s = (F = s).trim ? F.trim() : F.replace(/^\s+|\s+$/g, ""); s.length % 4 != 0; )
1105
- s += "=";
1106
- if (Y == "number")
1107
- A = Q(s);
1108
- else if (Y == "string")
1109
- A = d.byteLength(s, u);
1110
- else {
1111
- if (Y != "object")
1112
- throw new Error("First argument needs to be a number, array or string.");
1113
- A = Q(s.length);
1114
- }
1115
- if (d._useTypedArrays ? M = d._augment(new Uint8Array(A)) : ((M = this).length = A, M._isBuffer = !0), d._useTypedArrays && typeof s.byteLength == "number")
1116
- M._set(s);
1117
- else if (W(F = s) || d.isBuffer(F) || F && typeof F == "object" && typeof F.length == "number")
1118
- for (D = 0; D < A; D++)
1119
- d.isBuffer(s) ? M[D] = s.readUInt8(D) : M[D] = s[D];
1120
- else if (Y == "string")
1121
- M.write(s, 0, u);
1122
- else if (Y == "number" && !d._useTypedArrays && !p)
1123
- for (D = 0; D < A; D++)
1124
- M[D] = 0;
1125
- return M;
1126
- }
1127
- function S(s, u, p, A) {
1128
- return d._charsWritten = Lt(function(M) {
1129
- for (var D = [], F = 0; F < M.length; F++)
1130
- D.push(255 & M.charCodeAt(F));
1131
- return D;
1132
- }(u), s, p, A);
1133
- }
1134
- function R(s, u, p, A) {
1135
- return d._charsWritten = Lt(function(M) {
1136
- for (var D, F, Y = [], G = 0; G < M.length; G++)
1137
- F = M.charCodeAt(G), D = F >> 8, F = F % 256, Y.push(F), Y.push(D);
1138
- return Y;
1139
- }(u), s, p, A);
1140
- }
1141
- function E(s, u, p) {
1142
- var A = "";
1143
- p = Math.min(s.length, p);
1144
- for (var M = u; M < p; M++)
1145
- A += String.fromCharCode(s[M]);
1146
- return A;
1147
- }
1148
- function P(s, u, p, D) {
1149
- D || (C(typeof p == "boolean", "missing or invalid endian"), C(u != null, "missing offset"), C(u + 1 < s.length, "Trying to read beyond buffer length"));
1150
- var M, D = s.length;
1151
- if (!(D <= u))
1152
- return p ? (M = s[u], u + 1 < D && (M |= s[u + 1] << 8)) : (M = s[u] << 8, u + 1 < D && (M |= s[u + 1])), M;
1153
- }
1154
- function j(s, u, p, D) {
1155
- D || (C(typeof p == "boolean", "missing or invalid endian"), C(u != null, "missing offset"), C(u + 3 < s.length, "Trying to read beyond buffer length"));
1156
- var M, D = s.length;
1157
- if (!(D <= u))
1158
- return p ? (u + 2 < D && (M = s[u + 2] << 16), u + 1 < D && (M |= s[u + 1] << 8), M |= s[u], u + 3 < D && (M += s[u + 3] << 24 >>> 0)) : (u + 1 < D && (M = s[u + 1] << 16), u + 2 < D && (M |= s[u + 2] << 8), u + 3 < D && (M |= s[u + 3]), M += s[u] << 24 >>> 0), M;
1159
- }
1160
- function m(s, u, p, A) {
1161
- if (A || (C(typeof p == "boolean", "missing or invalid endian"), C(u != null, "missing offset"), C(u + 1 < s.length, "Trying to read beyond buffer length")), !(s.length <= u))
1162
- return A = P(s, u, p, !0), 32768 & A ? -1 * (65535 - A + 1) : A;
1163
- }
1164
- function v(s, u, p, A) {
1165
- if (A || (C(typeof p == "boolean", "missing or invalid endian"), C(u != null, "missing offset"), C(u + 3 < s.length, "Trying to read beyond buffer length")), !(s.length <= u))
1166
- return A = j(s, u, p, !0), 2147483648 & A ? -1 * (4294967295 - A + 1) : A;
1167
- }
1168
- function a(s, u, p, A) {
1169
- return A || (C(typeof p == "boolean", "missing or invalid endian"), C(u + 3 < s.length, "Trying to read beyond buffer length")), L.read(s, u, p, 23, 4);
1170
- }
1171
- function l(s, u, p, A) {
1172
- return A || (C(typeof p == "boolean", "missing or invalid endian"), C(u + 7 < s.length, "Trying to read beyond buffer length")), L.read(s, u, p, 52, 8);
1173
- }
1174
- function r(s, u, p, A, M) {
1175
- if (M || (C(u != null, "missing value"), C(typeof A == "boolean", "missing or invalid endian"), C(p != null, "missing offset"), C(p + 1 < s.length, "trying to write beyond buffer length"), Yt(u, 65535)), M = s.length, !(M <= p))
1176
- for (var D = 0, F = Math.min(M - p, 2); D < F; D++)
1177
- s[p + D] = (u & 255 << 8 * (A ? D : 1 - D)) >>> 8 * (A ? D : 1 - D);
1178
- }
1179
- function w(s, u, p, A, M) {
1180
- if (M || (C(u != null, "missing value"), C(typeof A == "boolean", "missing or invalid endian"), C(p != null, "missing offset"), C(p + 3 < s.length, "trying to write beyond buffer length"), Yt(u, 4294967295)), M = s.length, !(M <= p))
1181
- for (var D = 0, F = Math.min(M - p, 4); D < F; D++)
1182
- s[p + D] = u >>> 8 * (A ? D : 3 - D) & 255;
1183
- }
1184
- function _(s, u, p, A, M) {
1185
- M || (C(u != null, "missing value"), C(typeof A == "boolean", "missing or invalid endian"), C(p != null, "missing offset"), C(p + 1 < s.length, "Trying to write beyond buffer length"), qt(u, 32767, -32768)), s.length <= p || r(s, 0 <= u ? u : 65535 + u + 1, p, A, M);
1186
- }
1187
- function N(s, u, p, A, M) {
1188
- M || (C(u != null, "missing value"), C(typeof A == "boolean", "missing or invalid endian"), C(p != null, "missing offset"), C(p + 3 < s.length, "Trying to write beyond buffer length"), qt(u, 2147483647, -2147483648)), s.length <= p || w(s, 0 <= u ? u : 4294967295 + u + 1, p, A, M);
1189
- }
1190
- function T(s, u, p, A, M) {
1191
- M || (C(u != null, "missing value"), C(typeof A == "boolean", "missing or invalid endian"), C(p != null, "missing offset"), C(p + 3 < s.length, "Trying to write beyond buffer length"), ge(u, 34028234663852886e22, -34028234663852886e22)), s.length <= p || L.write(s, u, p, A, 23, 4);
1192
- }
1193
- function z(s, u, p, A, M) {
1194
- M || (C(u != null, "missing value"), C(typeof A == "boolean", "missing or invalid endian"), C(p != null, "missing offset"), C(p + 7 < s.length, "Trying to write beyond buffer length"), ge(u, 17976931348623157e292, -17976931348623157e292)), s.length <= p || L.write(s, u, p, A, 52, 8);
1195
- }
1196
- o.Buffer = d, o.SlowBuffer = d, o.INSPECT_MAX_BYTES = 50, d.poolSize = 8192, d._useTypedArrays = function() {
1197
- try {
1198
- var s = new ArrayBuffer(0), u = new Uint8Array(s);
1199
- return u.foo = function() {
1200
- return 42;
1201
- }, u.foo() === 42 && typeof u.subarray == "function";
1202
- } catch {
1203
- return !1;
1204
- }
1205
- }(), d.isEncoding = function(s) {
1206
- switch (String(s).toLowerCase()) {
1207
- case "hex":
1208
- case "utf8":
1209
- case "utf-8":
1210
- case "ascii":
1211
- case "binary":
1212
- case "base64":
1213
- case "raw":
1214
- case "ucs2":
1215
- case "ucs-2":
1216
- case "utf16le":
1217
- case "utf-16le":
1218
- return !0;
1219
- default:
1220
- return !1;
1221
- }
1222
- }, d.isBuffer = function(s) {
1223
- return !(s == null || !s._isBuffer);
1224
- }, d.byteLength = function(s, u) {
1225
- var p;
1226
- switch (s += "", u || "utf8") {
1227
- case "hex":
1228
- p = s.length / 2;
1229
- break;
1230
- case "utf8":
1231
- case "utf-8":
1232
- p = ht(s).length;
1233
- break;
1234
- case "ascii":
1235
- case "binary":
1236
- case "raw":
1237
- p = s.length;
1238
- break;
1239
- case "base64":
1240
- p = de(s).length;
1241
- break;
1242
- case "ucs2":
1243
- case "ucs-2":
1244
- case "utf16le":
1245
- case "utf-16le":
1246
- p = 2 * s.length;
1247
- break;
1248
- default:
1249
- throw new Error("Unknown encoding");
1250
- }
1251
- return p;
1252
- }, d.concat = function(s, u) {
1253
- if (C(W(s), `Usage: Buffer.concat(list, [totalLength])
1254
- list should be an Array.`), s.length === 0)
1255
- return new d(0);
1256
- if (s.length === 1)
1257
- return s[0];
1258
- if (typeof u != "number")
1259
- for (M = u = 0; M < s.length; M++)
1260
- u += s[M].length;
1261
- for (var p = new d(u), A = 0, M = 0; M < s.length; M++) {
1262
- var D = s[M];
1263
- D.copy(p, A), A += D.length;
1264
- }
1265
- return p;
1266
- }, d.prototype.write = function(s, u, p, A) {
1267
- isFinite(u) ? isFinite(p) || (A = p, p = void 0) : (G = A, A = u, u = p, p = G), u = Number(u) || 0;
1268
- var M, D, F, Y, G = this.length - u;
1269
- switch ((!p || G < (p = Number(p))) && (p = G), A = String(A || "utf8").toLowerCase()) {
1270
- case "hex":
1271
- M = function(at, nt, it, X) {
1272
- it = Number(it) || 0;
1273
- var H = at.length - it;
1274
- (!X || H < (X = Number(X))) && (X = H), C((H = nt.length) % 2 == 0, "Invalid hex string"), H / 2 < X && (X = H / 2);
1275
- for (var vt = 0; vt < X; vt++) {
1276
- var ye = parseInt(nt.substr(2 * vt, 2), 16);
1277
- C(!isNaN(ye), "Invalid hex string"), at[it + vt] = ye;
1278
- }
1279
- return d._charsWritten = 2 * vt, vt;
1280
- }(this, s, u, p);
1281
- break;
1282
- case "utf8":
1283
- case "utf-8":
1284
- D = this, F = u, Y = p, M = d._charsWritten = Lt(ht(s), D, F, Y);
1285
- break;
1286
- case "ascii":
1287
- case "binary":
1288
- M = S(this, s, u, p);
1289
- break;
1290
- case "base64":
1291
- D = this, F = u, Y = p, M = d._charsWritten = Lt(de(s), D, F, Y);
1292
- break;
1293
- case "ucs2":
1294
- case "ucs-2":
1295
- case "utf16le":
1296
- case "utf-16le":
1297
- M = R(this, s, u, p);
1298
- break;
1299
- default:
1300
- throw new Error("Unknown encoding");
1301
- }
1302
- return M;
1303
- }, d.prototype.toString = function(s, u, p) {
1304
- var A, M, D, F, Y = this;
1305
- if (s = String(s || "utf8").toLowerCase(), u = Number(u) || 0, (p = p !== void 0 ? Number(p) : Y.length) === u)
1306
- return "";
1307
- switch (s) {
1308
- case "hex":
1309
- A = function(G, at, nt) {
1310
- var it = G.length;
1311
- (!at || at < 0) && (at = 0), (!nt || nt < 0 || it < nt) && (nt = it);
1312
- for (var X = "", H = at; H < nt; H++)
1313
- X += V(G[H]);
1314
- return X;
1315
- }(Y, u, p);
1316
- break;
1317
- case "utf8":
1318
- case "utf-8":
1319
- A = function(G, at, nt) {
1320
- var it = "", X = "";
1321
- nt = Math.min(G.length, nt);
1322
- for (var H = at; H < nt; H++)
1323
- G[H] <= 127 ? (it += me(X) + String.fromCharCode(G[H]), X = "") : X += "%" + G[H].toString(16);
1324
- return it + me(X);
1325
- }(Y, u, p);
1326
- break;
1327
- case "ascii":
1328
- case "binary":
1329
- A = E(Y, u, p);
1330
- break;
1331
- case "base64":
1332
- M = Y, F = p, A = (D = u) === 0 && F === M.length ? I.fromByteArray(M) : I.fromByteArray(M.slice(D, F));
1333
- break;
1334
- case "ucs2":
1335
- case "ucs-2":
1336
- case "utf16le":
1337
- case "utf-16le":
1338
- A = function(G, at, nt) {
1339
- for (var it = G.slice(at, nt), X = "", H = 0; H < it.length; H += 2)
1340
- X += String.fromCharCode(it[H] + 256 * it[H + 1]);
1341
- return X;
1342
- }(Y, u, p);
1343
- break;
1344
- default:
1345
- throw new Error("Unknown encoding");
1346
- }
1347
- return A;
1348
- }, d.prototype.toJSON = function() {
1349
- return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) };
1350
- }, d.prototype.copy = function(s, u, p, A) {
1351
- if (u = u || 0, (A = A || A === 0 ? A : this.length) !== (p = p || 0) && s.length !== 0 && this.length !== 0) {
1352
- C(p <= A, "sourceEnd < sourceStart"), C(0 <= u && u < s.length, "targetStart out of bounds"), C(0 <= p && p < this.length, "sourceStart out of bounds"), C(0 <= A && A <= this.length, "sourceEnd out of bounds"), A > this.length && (A = this.length);
1353
- var M = (A = s.length - u < A - p ? s.length - u + p : A) - p;
1354
- if (M < 100 || !d._useTypedArrays)
1355
- for (var D = 0; D < M; D++)
1356
- s[D + u] = this[D + p];
1357
- else
1358
- s._set(this.subarray(p, p + M), u);
1359
- }
1360
- }, d.prototype.slice = function(s, u) {
1361
- var p = this.length;
1362
- if (s = J(s, p, 0), u = J(u, p, p), d._useTypedArrays)
1363
- return d._augment(this.subarray(s, u));
1364
- for (var A = u - s, M = new d(A, void 0, !0), D = 0; D < A; D++)
1365
- M[D] = this[D + s];
1366
- return M;
1367
- }, d.prototype.get = function(s) {
1368
- return console.log(".get() is deprecated. Access using array indexes instead."), this.readUInt8(s);
1369
- }, d.prototype.set = function(s, u) {
1370
- return console.log(".set() is deprecated. Access using array indexes instead."), this.writeUInt8(s, u);
1371
- }, d.prototype.readUInt8 = function(s, u) {
1372
- if (u || (C(s != null, "missing offset"), C(s < this.length, "Trying to read beyond buffer length")), !(s >= this.length))
1373
- return this[s];
1374
- }, d.prototype.readUInt16LE = function(s, u) {
1375
- return P(this, s, !0, u);
1376
- }, d.prototype.readUInt16BE = function(s, u) {
1377
- return P(this, s, !1, u);
1378
- }, d.prototype.readUInt32LE = function(s, u) {
1379
- return j(this, s, !0, u);
1380
- }, d.prototype.readUInt32BE = function(s, u) {
1381
- return j(this, s, !1, u);
1382
- }, d.prototype.readInt8 = function(s, u) {
1383
- if (u || (C(s != null, "missing offset"), C(s < this.length, "Trying to read beyond buffer length")), !(s >= this.length))
1384
- return 128 & this[s] ? -1 * (255 - this[s] + 1) : this[s];
1385
- }, d.prototype.readInt16LE = function(s, u) {
1386
- return m(this, s, !0, u);
1387
- }, d.prototype.readInt16BE = function(s, u) {
1388
- return m(this, s, !1, u);
1389
- }, d.prototype.readInt32LE = function(s, u) {
1390
- return v(this, s, !0, u);
1391
- }, d.prototype.readInt32BE = function(s, u) {
1392
- return v(this, s, !1, u);
1393
- }, d.prototype.readFloatLE = function(s, u) {
1394
- return a(this, s, !0, u);
1395
- }, d.prototype.readFloatBE = function(s, u) {
1396
- return a(this, s, !1, u);
1397
- }, d.prototype.readDoubleLE = function(s, u) {
1398
- return l(this, s, !0, u);
1399
- }, d.prototype.readDoubleBE = function(s, u) {
1400
- return l(this, s, !1, u);
1401
- }, d.prototype.writeUInt8 = function(s, u, p) {
1402
- p || (C(s != null, "missing value"), C(u != null, "missing offset"), C(u < this.length, "trying to write beyond buffer length"), Yt(s, 255)), u >= this.length || (this[u] = s);
1403
- }, d.prototype.writeUInt16LE = function(s, u, p) {
1404
- r(this, s, u, !0, p);
1405
- }, d.prototype.writeUInt16BE = function(s, u, p) {
1406
- r(this, s, u, !1, p);
1407
- }, d.prototype.writeUInt32LE = function(s, u, p) {
1408
- w(this, s, u, !0, p);
1409
- }, d.prototype.writeUInt32BE = function(s, u, p) {
1410
- w(this, s, u, !1, p);
1411
- }, d.prototype.writeInt8 = function(s, u, p) {
1412
- p || (C(s != null, "missing value"), C(u != null, "missing offset"), C(u < this.length, "Trying to write beyond buffer length"), qt(s, 127, -128)), u >= this.length || (0 <= s ? this.writeUInt8(s, u, p) : this.writeUInt8(255 + s + 1, u, p));
1413
- }, d.prototype.writeInt16LE = function(s, u, p) {
1414
- _(this, s, u, !0, p);
1415
- }, d.prototype.writeInt16BE = function(s, u, p) {
1416
- _(this, s, u, !1, p);
1417
- }, d.prototype.writeInt32LE = function(s, u, p) {
1418
- N(this, s, u, !0, p);
1419
- }, d.prototype.writeInt32BE = function(s, u, p) {
1420
- N(this, s, u, !1, p);
1421
- }, d.prototype.writeFloatLE = function(s, u, p) {
1422
- T(this, s, u, !0, p);
1423
- }, d.prototype.writeFloatBE = function(s, u, p) {
1424
- T(this, s, u, !1, p);
1425
- }, d.prototype.writeDoubleLE = function(s, u, p) {
1426
- z(this, s, u, !0, p);
1427
- }, d.prototype.writeDoubleBE = function(s, u, p) {
1428
- z(this, s, u, !1, p);
1429
- }, d.prototype.fill = function(s, u, p) {
1430
- if (u = u || 0, p = p || this.length, C(typeof (s = typeof (s = s || 0) == "string" ? s.charCodeAt(0) : s) == "number" && !isNaN(s), "value is not a number"), C(u <= p, "end < start"), p !== u && this.length !== 0) {
1431
- C(0 <= u && u < this.length, "start out of bounds"), C(0 <= p && p <= this.length, "end out of bounds");
1432
- for (var A = u; A < p; A++)
1433
- this[A] = s;
1434
- }
1435
- }, d.prototype.inspect = function() {
1436
- for (var s = [], u = this.length, p = 0; p < u; p++)
1437
- if (s[p] = V(this[p]), p === o.INSPECT_MAX_BYTES) {
1438
- s[p + 1] = "...";
1439
- break;
1440
- }
1441
- return "<Buffer " + s.join(" ") + ">";
1442
- }, d.prototype.toArrayBuffer = function() {
1443
- if (typeof Uint8Array > "u")
1444
- throw new Error("Buffer.toArrayBuffer not supported in this browser");
1445
- if (d._useTypedArrays)
1446
- return new d(this).buffer;
1447
- for (var s = new Uint8Array(this.length), u = 0, p = s.length; u < p; u += 1)
1448
- s[u] = this[u];
1449
- return s.buffer;
1450
- };
1451
- var x = d.prototype;
1452
- function J(s, u, p) {
1453
- return typeof s != "number" ? p : u <= (s = ~~s) ? u : 0 <= s || 0 <= (s += u) ? s : 0;
1454
- }
1455
- function Q(s) {
1456
- return (s = ~~Math.ceil(+s)) < 0 ? 0 : s;
1457
- }
1458
- function W(s) {
1459
- return (Array.isArray || function(u) {
1460
- return Object.prototype.toString.call(u) === "[object Array]";
1461
- })(s);
1462
- }
1463
- function V(s) {
1464
- return s < 16 ? "0" + s.toString(16) : s.toString(16);
1465
- }
1466
- function ht(s) {
1467
- for (var u = [], p = 0; p < s.length; p++) {
1468
- var A = s.charCodeAt(p);
1469
- if (A <= 127)
1470
- u.push(s.charCodeAt(p));
1471
- else
1472
- for (var M = p, D = (55296 <= A && A <= 57343 && p++, encodeURIComponent(s.slice(M, p + 1)).substr(1).split("%")), F = 0; F < D.length; F++)
1473
- u.push(parseInt(D[F], 16));
1474
- }
1475
- return u;
1476
- }
1477
- function de(s) {
1478
- return I.toByteArray(s);
1479
- }
1480
- function Lt(s, u, p, A) {
1481
- for (var M = 0; M < A && !(M + p >= u.length || M >= s.length); M++)
1482
- u[M + p] = s[M];
1483
- return M;
1484
- }
1485
- function me(s) {
1486
- try {
1487
- return decodeURIComponent(s);
1488
- } catch {
1489
- return String.fromCharCode(65533);
1490
- }
1491
- }
1492
- function Yt(s, u) {
1493
- C(typeof s == "number", "cannot write a non-number as a number"), C(0 <= s, "specified a negative value for writing an unsigned value"), C(s <= u, "value is larger than maximum value for type"), C(Math.floor(s) === s, "value has a fractional component");
1494
- }
1495
- function qt(s, u, p) {
1496
- C(typeof s == "number", "cannot write a non-number as a number"), C(s <= u, "value larger than maximum allowed value"), C(p <= s, "value smaller than minimum allowed value"), C(Math.floor(s) === s, "value has a fractional component");
1497
- }
1498
- function ge(s, u, p) {
1499
- C(typeof s == "number", "cannot write a non-number as a number"), C(s <= u, "value larger than maximum allowed value"), C(p <= s, "value smaller than minimum allowed value");
1500
- }
1501
- function C(s, u) {
1502
- if (!s)
1503
- throw new Error(u || "Failed assertion");
1504
- }
1505
- d._augment = function(s) {
1506
- return s._isBuffer = !0, s._get = s.get, s._set = s.set, s.get = x.get, s.set = x.set, s.write = x.write, s.toString = x.toString, s.toLocaleString = x.toString, s.toJSON = x.toJSON, s.copy = x.copy, s.slice = x.slice, s.readUInt8 = x.readUInt8, s.readUInt16LE = x.readUInt16LE, s.readUInt16BE = x.readUInt16BE, s.readUInt32LE = x.readUInt32LE, s.readUInt32BE = x.readUInt32BE, s.readInt8 = x.readInt8, s.readInt16LE = x.readInt16LE, s.readInt16BE = x.readInt16BE, s.readInt32LE = x.readInt32LE, s.readInt32BE = x.readInt32BE, s.readFloatLE = x.readFloatLE, s.readFloatBE = x.readFloatBE, s.readDoubleLE = x.readDoubleLE, s.readDoubleBE = x.readDoubleBE, s.writeUInt8 = x.writeUInt8, s.writeUInt16LE = x.writeUInt16LE, s.writeUInt16BE = x.writeUInt16BE, s.writeUInt32LE = x.writeUInt32LE, s.writeUInt32BE = x.writeUInt32BE, s.writeInt8 = x.writeInt8, s.writeInt16LE = x.writeInt16LE, s.writeInt16BE = x.writeInt16BE, s.writeInt32LE = x.writeInt32LE, s.writeInt32BE = x.writeInt32BE, s.writeFloatLE = x.writeFloatLE, s.writeFloatBE = x.writeFloatBE, s.writeDoubleLE = x.writeDoubleLE, s.writeDoubleBE = x.writeDoubleBE, s.fill = x.fill, s.inspect = x.inspect, s.toArrayBuffer = x.toArrayBuffer, s;
1507
- };
1508
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/buffer/index.js", "/node_modules/gulp-browserify/node_modules/buffer");
1509
- }, { "base64-js": 2, buffer: 3, ieee754: 10, lYpoI2: 11 }], 4: [function(n, i, o) {
1510
- (function(c, f, I, g, y, b, O, U, B) {
1511
- var I = n("buffer").Buffer, L = 4, d = new I(L);
1512
- d.fill(0), i.exports = { hash: function(S, R, E, P) {
1513
- for (var j = R(function(r, w) {
1514
- r.length % L != 0 && (_ = r.length + (L - r.length % L), r = I.concat([r, d], _));
1515
- for (var _, N = [], T = w ? r.readInt32BE : r.readInt32LE, z = 0; z < r.length; z += L)
1516
- N.push(T.call(r, z));
1517
- return N;
1518
- }(S = I.isBuffer(S) ? S : new I(S), P), 8 * S.length), R = P, m = new I(E), v = R ? m.writeInt32BE : m.writeInt32LE, a = 0; a < j.length; a++)
1519
- v.call(m, j[a], 4 * a, !0);
1520
- return m;
1521
- } };
1522
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1523
- }, { buffer: 3, lYpoI2: 11 }], 5: [function(n, i, o) {
1524
- (function(c, f, I, g, y, b, O, U, B) {
1525
- var I = n("buffer").Buffer, L = n("./sha"), d = n("./sha256"), S = n("./rng"), R = { sha1: L, sha256: d, md5: n("./md5") }, E = 64, P = new I(E);
1526
- function j(r, w) {
1527
- var _ = R[r = r || "sha1"], N = [];
1528
- return _ || m("algorithm:", r, "is not yet supported"), { update: function(T) {
1529
- return I.isBuffer(T) || (T = new I(T)), N.push(T), T.length, this;
1530
- }, digest: function(T) {
1531
- var z = I.concat(N), z = w ? function(x, J, Q) {
1532
- I.isBuffer(J) || (J = new I(J)), I.isBuffer(Q) || (Q = new I(Q)), J.length > E ? J = x(J) : J.length < E && (J = I.concat([J, P], E));
1533
- for (var W = new I(E), V = new I(E), ht = 0; ht < E; ht++)
1534
- W[ht] = 54 ^ J[ht], V[ht] = 92 ^ J[ht];
1535
- return Q = x(I.concat([W, Q])), x(I.concat([V, Q]));
1536
- }(_, w, z) : _(z);
1537
- return N = null, T ? z.toString(T) : z;
1538
- } };
1539
- }
1540
- function m() {
1541
- var r = [].slice.call(arguments).join(" ");
1542
- throw new Error([r, "we accept pull requests", "http://github.com/dominictarr/crypto-browserify"].join(`
1543
- `));
1544
- }
1545
- P.fill(0), o.createHash = function(r) {
1546
- return j(r);
1547
- }, o.createHmac = j, o.randomBytes = function(r, w) {
1548
- if (!w || !w.call)
1549
- return new I(S(r));
1550
- try {
1551
- w.call(this, void 0, new I(S(r)));
1552
- } catch (_) {
1553
- w(_);
1554
- }
1555
- };
1556
- var v, a = ["createCredentials", "createCipher", "createCipheriv", "createDecipher", "createDecipheriv", "createSign", "createVerify", "createDiffieHellman", "pbkdf2"], l = function(r) {
1557
- o[r] = function() {
1558
- m("sorry,", r, "is not implemented yet");
1559
- };
1560
- };
1561
- for (v in a)
1562
- l(a[v]);
1563
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1564
- }, { "./md5": 6, "./rng": 7, "./sha": 8, "./sha256": 9, buffer: 3, lYpoI2: 11 }], 6: [function(n, i, o) {
1565
- (function(c, f, h, g, y, b, O, U, B) {
1566
- var I = n("./helpers");
1567
- function L(m, v) {
1568
- m[v >> 5] |= 128 << v % 32, m[14 + (v + 64 >>> 9 << 4)] = v;
1569
- for (var a = 1732584193, l = -271733879, r = -1732584194, w = 271733878, _ = 0; _ < m.length; _ += 16) {
1570
- var N = a, T = l, z = r, x = w, a = S(a, l, r, w, m[_ + 0], 7, -680876936), w = S(w, a, l, r, m[_ + 1], 12, -389564586), r = S(r, w, a, l, m[_ + 2], 17, 606105819), l = S(l, r, w, a, m[_ + 3], 22, -1044525330);
1571
- a = S(a, l, r, w, m[_ + 4], 7, -176418897), w = S(w, a, l, r, m[_ + 5], 12, 1200080426), r = S(r, w, a, l, m[_ + 6], 17, -1473231341), l = S(l, r, w, a, m[_ + 7], 22, -45705983), a = S(a, l, r, w, m[_ + 8], 7, 1770035416), w = S(w, a, l, r, m[_ + 9], 12, -1958414417), r = S(r, w, a, l, m[_ + 10], 17, -42063), l = S(l, r, w, a, m[_ + 11], 22, -1990404162), a = S(a, l, r, w, m[_ + 12], 7, 1804603682), w = S(w, a, l, r, m[_ + 13], 12, -40341101), r = S(r, w, a, l, m[_ + 14], 17, -1502002290), a = R(a, l = S(l, r, w, a, m[_ + 15], 22, 1236535329), r, w, m[_ + 1], 5, -165796510), w = R(w, a, l, r, m[_ + 6], 9, -1069501632), r = R(r, w, a, l, m[_ + 11], 14, 643717713), l = R(l, r, w, a, m[_ + 0], 20, -373897302), a = R(a, l, r, w, m[_ + 5], 5, -701558691), w = R(w, a, l, r, m[_ + 10], 9, 38016083), r = R(r, w, a, l, m[_ + 15], 14, -660478335), l = R(l, r, w, a, m[_ + 4], 20, -405537848), a = R(a, l, r, w, m[_ + 9], 5, 568446438), w = R(w, a, l, r, m[_ + 14], 9, -1019803690), r = R(r, w, a, l, m[_ + 3], 14, -187363961), l = R(l, r, w, a, m[_ + 8], 20, 1163531501), a = R(a, l, r, w, m[_ + 13], 5, -1444681467), w = R(w, a, l, r, m[_ + 2], 9, -51403784), r = R(r, w, a, l, m[_ + 7], 14, 1735328473), a = E(a, l = R(l, r, w, a, m[_ + 12], 20, -1926607734), r, w, m[_ + 5], 4, -378558), w = E(w, a, l, r, m[_ + 8], 11, -2022574463), r = E(r, w, a, l, m[_ + 11], 16, 1839030562), l = E(l, r, w, a, m[_ + 14], 23, -35309556), a = E(a, l, r, w, m[_ + 1], 4, -1530992060), w = E(w, a, l, r, m[_ + 4], 11, 1272893353), r = E(r, w, a, l, m[_ + 7], 16, -155497632), l = E(l, r, w, a, m[_ + 10], 23, -1094730640), a = E(a, l, r, w, m[_ + 13], 4, 681279174), w = E(w, a, l, r, m[_ + 0], 11, -358537222), r = E(r, w, a, l, m[_ + 3], 16, -722521979), l = E(l, r, w, a, m[_ + 6], 23, 76029189), a = E(a, l, r, w, m[_ + 9], 4, -640364487), w = E(w, a, l, r, m[_ + 12], 11, -421815835), r = E(r, w, a, l, m[_ + 15], 16, 530742520), a = P(a, l = E(l, r, w, a, m[_ + 2], 23, -995338651), r, w, m[_ + 0], 6, -198630844), w = P(w, a, l, r, m[_ + 7], 10, 1126891415), r = P(r, w, a, l, m[_ + 14], 15, -1416354905), l = P(l, r, w, a, m[_ + 5], 21, -57434055), a = P(a, l, r, w, m[_ + 12], 6, 1700485571), w = P(w, a, l, r, m[_ + 3], 10, -1894986606), r = P(r, w, a, l, m[_ + 10], 15, -1051523), l = P(l, r, w, a, m[_ + 1], 21, -2054922799), a = P(a, l, r, w, m[_ + 8], 6, 1873313359), w = P(w, a, l, r, m[_ + 15], 10, -30611744), r = P(r, w, a, l, m[_ + 6], 15, -1560198380), l = P(l, r, w, a, m[_ + 13], 21, 1309151649), a = P(a, l, r, w, m[_ + 4], 6, -145523070), w = P(w, a, l, r, m[_ + 11], 10, -1120210379), r = P(r, w, a, l, m[_ + 2], 15, 718787259), l = P(l, r, w, a, m[_ + 9], 21, -343485551), a = j(a, N), l = j(l, T), r = j(r, z), w = j(w, x);
1572
- }
1573
- return Array(a, l, r, w);
1574
- }
1575
- function d(m, v, a, l, r, w) {
1576
- return j((v = j(j(v, m), j(l, w))) << r | v >>> 32 - r, a);
1577
- }
1578
- function S(m, v, a, l, r, w, _) {
1579
- return d(v & a | ~v & l, m, v, r, w, _);
1580
- }
1581
- function R(m, v, a, l, r, w, _) {
1582
- return d(v & l | a & ~l, m, v, r, w, _);
1583
- }
1584
- function E(m, v, a, l, r, w, _) {
1585
- return d(v ^ a ^ l, m, v, r, w, _);
1586
- }
1587
- function P(m, v, a, l, r, w, _) {
1588
- return d(a ^ (v | ~l), m, v, r, w, _);
1589
- }
1590
- function j(m, v) {
1591
- var a = (65535 & m) + (65535 & v);
1592
- return (m >> 16) + (v >> 16) + (a >> 16) << 16 | 65535 & a;
1593
- }
1594
- i.exports = function(m) {
1595
- return I.hash(m, L, 16);
1596
- };
1597
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1598
- }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 7: [function(n, i, o) {
1599
- (function(c, f, h, g, y, b, O, U, B) {
1600
- i.exports = function(I) {
1601
- for (var L, d = new Array(I), S = 0; S < I; S++)
1602
- !(3 & S) && (L = 4294967296 * Math.random()), d[S] = L >>> ((3 & S) << 3) & 255;
1603
- return d;
1604
- };
1605
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1606
- }, { buffer: 3, lYpoI2: 11 }], 8: [function(n, i, o) {
1607
- (function(c, f, h, g, y, b, O, U, B) {
1608
- var I = n("./helpers");
1609
- function L(R, E) {
1610
- R[E >> 5] |= 128 << 24 - E % 32, R[15 + (E + 64 >> 9 << 4)] = E;
1611
- for (var P, j, m, v = Array(80), a = 1732584193, l = -271733879, r = -1732584194, w = 271733878, _ = -1009589776, N = 0; N < R.length; N += 16) {
1612
- for (var T = a, z = l, x = r, J = w, Q = _, W = 0; W < 80; W++) {
1613
- v[W] = W < 16 ? R[N + W] : S(v[W - 3] ^ v[W - 8] ^ v[W - 14] ^ v[W - 16], 1);
1614
- var V = d(d(S(a, 5), (V = l, j = r, m = w, (P = W) < 20 ? V & j | ~V & m : !(P < 40) && P < 60 ? V & j | V & m | j & m : V ^ j ^ m)), d(d(_, v[W]), (P = W) < 20 ? 1518500249 : P < 40 ? 1859775393 : P < 60 ? -1894007588 : -899497514)), _ = w, w = r, r = S(l, 30), l = a, a = V;
1615
- }
1616
- a = d(a, T), l = d(l, z), r = d(r, x), w = d(w, J), _ = d(_, Q);
1617
- }
1618
- return Array(a, l, r, w, _);
1619
- }
1620
- function d(R, E) {
1621
- var P = (65535 & R) + (65535 & E);
1622
- return (R >> 16) + (E >> 16) + (P >> 16) << 16 | 65535 & P;
1623
- }
1624
- function S(R, E) {
1625
- return R << E | R >>> 32 - E;
1626
- }
1627
- i.exports = function(R) {
1628
- return I.hash(R, L, 20, !0);
1629
- };
1630
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1631
- }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 9: [function(n, i, o) {
1632
- (function(c, f, h, g, y, b, O, U, B) {
1633
- function I(E, P) {
1634
- var j = (65535 & E) + (65535 & P);
1635
- return (E >> 16) + (P >> 16) + (j >> 16) << 16 | 65535 & j;
1636
- }
1637
- function L(E, P) {
1638
- var j, m = new Array(1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298), v = new Array(1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225), a = new Array(64);
1639
- E[P >> 5] |= 128 << 24 - P % 32, E[15 + (P + 64 >> 9 << 4)] = P;
1640
- for (var l, r, w = 0; w < E.length; w += 16) {
1641
- for (var _ = v[0], N = v[1], T = v[2], z = v[3], x = v[4], J = v[5], Q = v[6], W = v[7], V = 0; V < 64; V++)
1642
- a[V] = V < 16 ? E[V + w] : I(I(I((r = a[V - 2], S(r, 17) ^ S(r, 19) ^ R(r, 10)), a[V - 7]), (r = a[V - 15], S(r, 7) ^ S(r, 18) ^ R(r, 3))), a[V - 16]), j = I(I(I(I(W, S(r = x, 6) ^ S(r, 11) ^ S(r, 25)), x & J ^ ~x & Q), m[V]), a[V]), l = I(S(l = _, 2) ^ S(l, 13) ^ S(l, 22), _ & N ^ _ & T ^ N & T), W = Q, Q = J, J = x, x = I(z, j), z = T, T = N, N = _, _ = I(j, l);
1643
- v[0] = I(_, v[0]), v[1] = I(N, v[1]), v[2] = I(T, v[2]), v[3] = I(z, v[3]), v[4] = I(x, v[4]), v[5] = I(J, v[5]), v[6] = I(Q, v[6]), v[7] = I(W, v[7]);
1644
- }
1645
- return v;
1646
- }
1647
- var d = n("./helpers"), S = function(E, P) {
1648
- return E >>> P | E << 32 - P;
1649
- }, R = function(E, P) {
1650
- return E >>> P;
1651
- };
1652
- i.exports = function(E) {
1653
- return d.hash(E, L, 32, !0);
1654
- };
1655
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1656
- }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 10: [function(n, i, o) {
1657
- (function(c, f, h, g, y, b, O, U, B) {
1658
- o.read = function(I, L, d, S, w) {
1659
- var E, P, j = 8 * w - S - 1, m = (1 << j) - 1, v = m >> 1, a = -7, l = d ? w - 1 : 0, r = d ? -1 : 1, w = I[L + l];
1660
- for (l += r, E = w & (1 << -a) - 1, w >>= -a, a += j; 0 < a; E = 256 * E + I[L + l], l += r, a -= 8)
1661
- ;
1662
- for (P = E & (1 << -a) - 1, E >>= -a, a += S; 0 < a; P = 256 * P + I[L + l], l += r, a -= 8)
1663
- ;
1664
- if (E === 0)
1665
- E = 1 - v;
1666
- else {
1667
- if (E === m)
1668
- return P ? NaN : 1 / 0 * (w ? -1 : 1);
1669
- P += Math.pow(2, S), E -= v;
1670
- }
1671
- return (w ? -1 : 1) * P * Math.pow(2, E - S);
1672
- }, o.write = function(I, L, d, S, R, _) {
1673
- var P, j, m = 8 * _ - R - 1, v = (1 << m) - 1, a = v >> 1, l = R === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, r = S ? 0 : _ - 1, w = S ? 1 : -1, _ = L < 0 || L === 0 && 1 / L < 0 ? 1 : 0;
1674
- for (L = Math.abs(L), isNaN(L) || L === 1 / 0 ? (j = isNaN(L) ? 1 : 0, P = v) : (P = Math.floor(Math.log(L) / Math.LN2), L * (S = Math.pow(2, -P)) < 1 && (P--, S *= 2), 2 <= (L += 1 <= P + a ? l / S : l * Math.pow(2, 1 - a)) * S && (P++, S /= 2), v <= P + a ? (j = 0, P = v) : 1 <= P + a ? (j = (L * S - 1) * Math.pow(2, R), P += a) : (j = L * Math.pow(2, a - 1) * Math.pow(2, R), P = 0)); 8 <= R; I[d + r] = 255 & j, r += w, j /= 256, R -= 8)
1675
- ;
1676
- for (P = P << R | j, m += R; 0 < m; I[d + r] = 255 & P, r += w, P /= 256, m -= 8)
1677
- ;
1678
- I[d + r - w] |= 128 * _;
1679
- };
1680
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/ieee754/index.js", "/node_modules/gulp-browserify/node_modules/ieee754");
1681
- }, { buffer: 3, lYpoI2: 11 }], 11: [function(n, i, o) {
1682
- (function(c, f, h, g, y, b, O, U, B) {
1683
- var I, L, d;
1684
- function S() {
1685
- }
1686
- (c = i.exports = {}).nextTick = (L = typeof window < "u" && window.setImmediate, d = typeof window < "u" && window.postMessage && window.addEventListener, L ? function(R) {
1687
- return window.setImmediate(R);
1688
- } : d ? (I = [], window.addEventListener("message", function(R) {
1689
- var E = R.source;
1690
- E !== window && E !== null || R.data !== "process-tick" || (R.stopPropagation(), 0 < I.length && I.shift()());
1691
- }, !0), function(R) {
1692
- I.push(R), window.postMessage("process-tick", "*");
1693
- }) : function(R) {
1694
- setTimeout(R, 0);
1695
- }), c.title = "browser", c.browser = !0, c.env = {}, c.argv = [], c.on = S, c.addListener = S, c.once = S, c.off = S, c.removeListener = S, c.removeAllListeners = S, c.emit = S, c.binding = function(R) {
1696
- throw new Error("process.binding is not supported");
1697
- }, c.cwd = function() {
1698
- return "/";
1699
- }, c.chdir = function(R) {
1700
- throw new Error("process.chdir is not supported");
1701
- };
1702
- }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/process/browser.js", "/node_modules/gulp-browserify/node_modules/process");
1703
- }, { buffer: 3, lYpoI2: 11 }] }, {}, [1])(1);
1704
- });
1705
- })(Ne);
1706
- var Ie = Ne.exports;
1707
- const Ee = ["0.3", "0.4", "0.5", "0.6"], Se = ["0.2", "0.3"], xn = "0.6", Rt = "0.3";
1708
- var k;
1709
- (function(e) {
1710
- e.Inputs = "inputs", e.Outputs = "outputs", e.State = "state", e.Definition = "definition", e.DefinitionUpdateRequest = "definitionupdaterequest", e.Error = "error", e.UrlHashUpdate = "urlhashupdate", e.Message = "Message";
1711
- })(k || (k = {}));
1712
- var tt;
1713
- (function(e) {
1714
- e.InputsUpdate = "InputsUpdate", e.OutputsUpdate = "OutputsUpdate", e.SetupIframeClientRequest = "SetupIframeClientRequest", e.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", e.PluginRequest = "SetupIframeServerPluginRequestResponseAck", e.HashParamsUpdate = "HashParamsUpdate";
1715
- })(tt || (tt = {}));
1716
- var pt;
1717
- (function(e) {
1718
- e.InputsUpdate = "InputsUpdate", e.MessageAck = "MessageAck", e.SetupIframeServerResponse = "SetupIframeServerResponse";
1719
- })(pt || (pt = {}));
1720
- var ne;
1721
- (function(e) {
1722
- e.State = "metapage/state";
1723
- })(ne || (ne = {}));
1724
- const ct = "metapage/definition", yt = "metapage/state", ze = Se[Se.length - 1], pn = Ee[Ee.length - 1];
1725
- var Et = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Mt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
1726
- for (var xt = 0; xt < Et.length; xt++)
1727
- Mt[Et.charCodeAt(xt)] = xt;
1728
- var Bt = function(e) {
1729
- var t = new Uint8Array(e), n, i = t.length, o = "";
1730
- for (n = 0; n < i; n += 3)
1731
- o += Et[t[n] >> 2], o += Et[(t[n] & 3) << 4 | t[n + 1] >> 4], o += Et[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], o += Et[t[n + 2] & 63];
1732
- return i % 3 === 2 ? o = o.substring(0, o.length - 1) + "=" : i % 3 === 1 && (o = o.substring(0, o.length - 2) + "=="), o;
1733
- }, kt = function(e) {
1734
- var t = e.length * 0.75, n = e.length, i, o = 0, c, f, h, g;
1735
- e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
1736
- var y = new ArrayBuffer(t), b = new Uint8Array(y);
1737
- for (i = 0; i < n; i += 4)
1738
- c = Mt[e.charCodeAt(i)], f = Mt[e.charCodeAt(i + 1)], h = Mt[e.charCodeAt(i + 2)], g = Mt[e.charCodeAt(i + 3)], b[o++] = c << 2 | f >> 4, b[o++] = (f & 15) << 4 | h >> 2, b[o++] = (h & 3) << 6 | g & 63;
1739
- return y;
847
+ const Vt = ["0.3", "0.4", "0.5", "0.6", "1"], xt = ["0.2", "0.3", "1"], He = "1", Y = "1";
848
+ var Tt;
849
+ (function(t) {
850
+ t.Inputs = "inputs", t.Outputs = "outputs", t.State = "state", t.Definition = "definition", t.DefinitionUpdateRequest = "definitionupdaterequest", t.Error = "error", t.UrlHashUpdate = "urlhashupdate", t.Message = "Message";
851
+ })(Tt || (Tt = {}));
852
+ var A;
853
+ (function(t) {
854
+ t.InputsUpdate = "InputsUpdate", t.OutputsUpdate = "OutputsUpdate", t.SetupIframeClientRequest = "SetupIframeClientRequest", t.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", t.HashParamsUpdate = "HashParamsUpdate";
855
+ })(A || (A = {}));
856
+ var $;
857
+ (function(t) {
858
+ t.InputsUpdate = "InputsUpdate", t.MessageAck = "MessageAck", t.SetupIframeServerResponse = "SetupIframeServerResponse";
859
+ })($ || ($ = {}));
860
+ const Zt = xt[xt.length - 1], Se = Vt[Vt.length - 1];
861
+ var B = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", K = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
862
+ for (var st = 0; st < B.length; st++)
863
+ K[B.charCodeAt(st)] = st;
864
+ var nt = function(t) {
865
+ var e = new Uint8Array(t), s, n = e.length, i = "";
866
+ for (s = 0; s < n; s += 3)
867
+ i += B[e[s] >> 2], i += B[(e[s] & 3) << 4 | e[s + 1] >> 4], i += B[(e[s + 1] & 15) << 2 | e[s + 2] >> 6], i += B[e[s + 2] & 63];
868
+ return n % 3 === 2 ? i = i.substring(0, i.length - 1) + "=" : n % 3 === 1 && (i = i.substring(0, i.length - 2) + "=="), i;
869
+ }, it = function(t) {
870
+ var e = t.length * 0.75, s = t.length, n, i = 0, a, r, o, u;
871
+ t[t.length - 1] === "=" && (e--, t[t.length - 2] === "=" && e--);
872
+ var f = new ArrayBuffer(e), c = new Uint8Array(f);
873
+ for (n = 0; n < s; n += 4)
874
+ a = K[t.charCodeAt(n)], r = K[t.charCodeAt(n + 1)], o = K[t.charCodeAt(n + 2)], u = K[t.charCodeAt(n + 3)], c[i++] = a << 2 | r >> 4, c[i++] = (r & 15) << 4 | o >> 2, c[i++] = (o & 3) << 6 | u & 63;
875
+ return f;
1740
876
  };
1741
- const Jt = async (e) => {
1742
- for (const t of Object.keys(e)) {
1743
- const n = await dn(e[t]);
1744
- e[t] = n;
877
+ const ht = async (t) => {
878
+ for (const e of Object.keys(t)) {
879
+ const s = await Re(t[e]);
880
+ t[e] = s;
1745
881
  }
1746
- return e;
1747
- }, Pt = async (e) => {
1748
- for (const t of Object.keys(e)) {
1749
- const n = await mn(e[t]);
1750
- e[t] = n;
882
+ return t;
883
+ }, X = async (t) => {
884
+ for (const e of Object.keys(t)) {
885
+ const s = await Ee(t[e]);
886
+ t[e] = s;
1751
887
  }
1752
- return e;
1753
- }, dn = async (e) => {
1754
- 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) {
1755
- const t = e, n = {
888
+ return t;
889
+ }, Re = async (t) => {
890
+ 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) {
891
+ const e = t, s = {
1756
892
  _s: !0,
1757
- _c: e.constructor.name,
1758
- value: Bt(t.buffer),
1759
- byteLength: t.byteLength,
1760
- byteOffset: t.byteOffset,
1761
- size: t.byteLength
893
+ _c: t.constructor.name,
894
+ value: nt(e.buffer),
895
+ byteLength: e.byteLength,
896
+ byteOffset: e.byteOffset,
897
+ size: e.byteLength
1762
898
  };
1763
- return Promise.resolve(n);
1764
- } else if (e instanceof File) {
1765
- const t = e, n = await t.arrayBuffer();
899
+ return Promise.resolve(s);
900
+ } else if (t instanceof File) {
901
+ const e = t, s = await e.arrayBuffer();
1766
902
  return {
1767
903
  _s: !0,
1768
904
  _c: File.name,
1769
- value: Bt(n),
1770
- name: t.name,
1771
- fileType: t.type,
1772
- lastModified: t.lastModified,
1773
- size: n.byteLength
905
+ value: nt(s),
906
+ name: e.name,
907
+ fileType: e.type,
908
+ lastModified: e.lastModified,
909
+ size: s.byteLength
1774
910
  };
1775
- } else if (e instanceof Blob) {
1776
- const t = e, n = await t.arrayBuffer();
911
+ } else if (t instanceof Blob) {
912
+ const e = t, s = await e.arrayBuffer();
1777
913
  return {
1778
914
  _s: !0,
1779
915
  _c: Blob.name,
1780
- value: Bt(n),
1781
- fileType: t.type,
1782
- size: n.byteLength
916
+ value: nt(s),
917
+ fileType: e.type,
918
+ size: s.byteLength
1783
919
  };
1784
- } else if (e instanceof ArrayBuffer) {
1785
- const t = e, n = {
920
+ } else if (t instanceof ArrayBuffer) {
921
+ const e = t, s = {
1786
922
  _s: !0,
1787
923
  _c: ArrayBuffer.name,
1788
- value: Bt(t),
1789
- size: t.byteLength
924
+ value: nt(e),
925
+ size: e.byteLength
1790
926
  };
1791
- return Promise.resolve(n);
1792
- }
1793
- return Promise.resolve(e);
1794
- }, mn = (e) => {
1795
- if (!(e && typeof e == "object" && e._s === !0))
1796
- return e;
1797
- const t = e, n = t._c;
1798
- if (n === Blob.name) {
1799
- const f = e;
1800
- return new Blob([kt(t.value)], {
1801
- type: f.fileType
927
+ return Promise.resolve(s);
928
+ }
929
+ return Promise.resolve(t);
930
+ }, Ee = (t) => {
931
+ if (!(t && typeof t == "object" && t._s === !0))
932
+ return t;
933
+ const e = t, s = e._c;
934
+ if (s === Blob.name) {
935
+ const r = t;
936
+ return new Blob([it(e.value)], {
937
+ type: r.fileType
1802
938
  });
1803
- } else if (n === File.name) {
1804
- const f = e;
1805
- return new File([kt(t.value)], f.name, {
1806
- type: f.fileType,
1807
- lastModified: f.lastModified
939
+ } else if (s === File.name) {
940
+ const r = t;
941
+ return new File([it(e.value)], r.name, {
942
+ type: r.fileType,
943
+ lastModified: r.lastModified
1808
944
  });
1809
- } else if (n === ArrayBuffer.name)
1810
- return kt(t.value);
1811
- const i = e, o = kt(i.value), c = i._c;
945
+ } else if (s === ArrayBuffer.name)
946
+ return it(e.value);
947
+ const n = t, i = it(n.value), a = n._c;
1812
948
  try {
1813
- return new globalThis[c](o);
949
+ return new globalThis[a](i);
1814
950
  } catch {
1815
951
  }
1816
- return e;
952
+ return t;
1817
953
  };
1818
- var $e = { exports: {} };
1819
- (function(e) {
1820
- var t = Object.prototype.hasOwnProperty, n = "~";
1821
- function i() {
954
+ function Ae(t) {
955
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
956
+ }
957
+ var te = { exports: {} };
958
+ (function(t) {
959
+ var e = Object.prototype.hasOwnProperty, s = "~";
960
+ function n() {
1822
961
  }
1823
- Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (n = !1));
1824
- function o(g, y, b) {
1825
- this.fn = g, this.context = y, this.once = b || !1;
962
+ Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (s = !1));
963
+ function i(u, f, c) {
964
+ this.fn = u, this.context = f, this.once = c || !1;
1826
965
  }
1827
- function c(g, y, b, O, U) {
1828
- if (typeof b != "function")
966
+ function a(u, f, c, h, l) {
967
+ if (typeof c != "function")
1829
968
  throw new TypeError("The listener must be a function");
1830
- var B = new o(b, O || g, U), I = n ? n + y : y;
1831
- return g._events[I] ? g._events[I].fn ? g._events[I] = [g._events[I], B] : g._events[I].push(B) : (g._events[I] = B, g._eventsCount++), g;
969
+ var y = new i(c, h || u, l), m = s ? s + f : f;
970
+ return u._events[m] ? u._events[m].fn ? u._events[m] = [u._events[m], y] : u._events[m].push(y) : (u._events[m] = y, u._eventsCount++), u;
1832
971
  }
1833
- function f(g, y) {
1834
- --g._eventsCount === 0 ? g._events = new i() : delete g._events[y];
972
+ function r(u, f) {
973
+ --u._eventsCount === 0 ? u._events = new n() : delete u._events[f];
1835
974
  }
1836
- function h() {
1837
- this._events = new i(), this._eventsCount = 0;
975
+ function o() {
976
+ this._events = new n(), this._eventsCount = 0;
1838
977
  }
1839
- h.prototype.eventNames = function() {
1840
- var y = [], b, O;
978
+ o.prototype.eventNames = function() {
979
+ var f = [], c, h;
1841
980
  if (this._eventsCount === 0)
1842
- return y;
1843
- for (O in b = this._events)
1844
- t.call(b, O) && y.push(n ? O.slice(1) : O);
1845
- return Object.getOwnPropertySymbols ? y.concat(Object.getOwnPropertySymbols(b)) : y;
1846
- }, h.prototype.listeners = function(y) {
1847
- var b = n ? n + y : y, O = this._events[b];
1848
- if (!O)
981
+ return f;
982
+ for (h in c = this._events)
983
+ e.call(c, h) && f.push(s ? h.slice(1) : h);
984
+ return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(c)) : f;
985
+ }, o.prototype.listeners = function(f) {
986
+ var c = s ? s + f : f, h = this._events[c];
987
+ if (!h)
1849
988
  return [];
1850
- if (O.fn)
1851
- return [O.fn];
1852
- for (var U = 0, B = O.length, I = new Array(B); U < B; U++)
1853
- I[U] = O[U].fn;
1854
- return I;
1855
- }, h.prototype.listenerCount = function(y) {
1856
- var b = n ? n + y : y, O = this._events[b];
1857
- return O ? O.fn ? 1 : O.length : 0;
1858
- }, h.prototype.emit = function(y, b, O, U, B, I) {
1859
- var L = n ? n + y : y;
1860
- if (!this._events[L])
989
+ if (h.fn)
990
+ return [h.fn];
991
+ for (var l = 0, y = h.length, m = new Array(y); l < y; l++)
992
+ m[l] = h[l].fn;
993
+ return m;
994
+ }, o.prototype.listenerCount = function(f) {
995
+ var c = s ? s + f : f, h = this._events[c];
996
+ return h ? h.fn ? 1 : h.length : 0;
997
+ }, o.prototype.emit = function(f, c, h, l, y, m) {
998
+ var I = s ? s + f : f;
999
+ if (!this._events[I])
1861
1000
  return !1;
1862
- var d = this._events[L], S = arguments.length, R, E;
1863
- if (d.fn) {
1864
- switch (d.once && this.removeListener(y, d.fn, void 0, !0), S) {
1001
+ var p = this._events[I], S = arguments.length, w, _;
1002
+ if (p.fn) {
1003
+ switch (p.once && this.removeListener(f, p.fn, void 0, !0), S) {
1865
1004
  case 1:
1866
- return d.fn.call(d.context), !0;
1005
+ return p.fn.call(p.context), !0;
1867
1006
  case 2:
1868
- return d.fn.call(d.context, b), !0;
1007
+ return p.fn.call(p.context, c), !0;
1869
1008
  case 3:
1870
- return d.fn.call(d.context, b, O), !0;
1009
+ return p.fn.call(p.context, c, h), !0;
1871
1010
  case 4:
1872
- return d.fn.call(d.context, b, O, U), !0;
1011
+ return p.fn.call(p.context, c, h, l), !0;
1873
1012
  case 5:
1874
- return d.fn.call(d.context, b, O, U, B), !0;
1013
+ return p.fn.call(p.context, c, h, l, y), !0;
1875
1014
  case 6:
1876
- return d.fn.call(d.context, b, O, U, B, I), !0;
1015
+ return p.fn.call(p.context, c, h, l, y, m), !0;
1877
1016
  }
1878
- for (E = 1, R = new Array(S - 1); E < S; E++)
1879
- R[E - 1] = arguments[E];
1880
- d.fn.apply(d.context, R);
1017
+ for (_ = 1, w = new Array(S - 1); _ < S; _++)
1018
+ w[_ - 1] = arguments[_];
1019
+ p.fn.apply(p.context, w);
1881
1020
  } else {
1882
- var P = d.length, j;
1883
- for (E = 0; E < P; E++)
1884
- switch (d[E].once && this.removeListener(y, d[E].fn, void 0, !0), S) {
1021
+ var et = p.length, b;
1022
+ for (_ = 0; _ < et; _++)
1023
+ switch (p[_].once && this.removeListener(f, p[_].fn, void 0, !0), S) {
1885
1024
  case 1:
1886
- d[E].fn.call(d[E].context);
1025
+ p[_].fn.call(p[_].context);
1887
1026
  break;
1888
1027
  case 2:
1889
- d[E].fn.call(d[E].context, b);
1028
+ p[_].fn.call(p[_].context, c);
1890
1029
  break;
1891
1030
  case 3:
1892
- d[E].fn.call(d[E].context, b, O);
1031
+ p[_].fn.call(p[_].context, c, h);
1893
1032
  break;
1894
1033
  case 4:
1895
- d[E].fn.call(d[E].context, b, O, U);
1034
+ p[_].fn.call(p[_].context, c, h, l);
1896
1035
  break;
1897
1036
  default:
1898
- if (!R)
1899
- for (j = 1, R = new Array(S - 1); j < S; j++)
1900
- R[j - 1] = arguments[j];
1901
- d[E].fn.apply(d[E].context, R);
1037
+ if (!w)
1038
+ for (b = 1, w = new Array(S - 1); b < S; b++)
1039
+ w[b - 1] = arguments[b];
1040
+ p[_].fn.apply(p[_].context, w);
1902
1041
  }
1903
1042
  }
1904
1043
  return !0;
1905
- }, h.prototype.on = function(y, b, O) {
1906
- return c(this, y, b, O, !1);
1907
- }, h.prototype.once = function(y, b, O) {
1908
- return c(this, y, b, O, !0);
1909
- }, h.prototype.removeListener = function(y, b, O, U) {
1910
- var B = n ? n + y : y;
1911
- if (!this._events[B])
1044
+ }, o.prototype.on = function(f, c, h) {
1045
+ return a(this, f, c, h, !1);
1046
+ }, o.prototype.once = function(f, c, h) {
1047
+ return a(this, f, c, h, !0);
1048
+ }, o.prototype.removeListener = function(f, c, h, l) {
1049
+ var y = s ? s + f : f;
1050
+ if (!this._events[y])
1912
1051
  return this;
1913
- if (!b)
1914
- return f(this, B), this;
1915
- var I = this._events[B];
1916
- if (I.fn)
1917
- I.fn === b && (!U || I.once) && (!O || I.context === O) && f(this, B);
1052
+ if (!c)
1053
+ return r(this, y), this;
1054
+ var m = this._events[y];
1055
+ if (m.fn)
1056
+ m.fn === c && (!l || m.once) && (!h || m.context === h) && r(this, y);
1918
1057
  else {
1919
- for (var L = 0, d = [], S = I.length; L < S; L++)
1920
- (I[L].fn !== b || U && !I[L].once || O && I[L].context !== O) && d.push(I[L]);
1921
- d.length ? this._events[B] = d.length === 1 ? d[0] : d : f(this, B);
1058
+ for (var I = 0, p = [], S = m.length; I < S; I++)
1059
+ (m[I].fn !== c || l && !m[I].once || h && m[I].context !== h) && p.push(m[I]);
1060
+ p.length ? this._events[y] = p.length === 1 ? p[0] : p : r(this, y);
1922
1061
  }
1923
1062
  return this;
1924
- }, h.prototype.removeAllListeners = function(y) {
1925
- var b;
1926
- return y ? (b = n ? n + y : y, this._events[b] && f(this, b)) : (this._events = new i(), this._eventsCount = 0), this;
1927
- }, h.prototype.off = h.prototype.removeListener, h.prototype.addListener = h.prototype.on, h.prefixed = n, h.EventEmitter = h, e.exports = h;
1928
- })($e);
1929
- var le = $e.exports;
1930
- function Wt(e, t) {
1931
- const n = Ft(e), i = Ft(t), o = n.pop(), c = i.pop(), f = ie(n, i);
1932
- return f !== 0 ? f : o && c ? ie(o.split("."), c.split(".")) : o || c ? o ? -1 : 1 : 0;
1063
+ }, o.prototype.removeAllListeners = function(f) {
1064
+ var c;
1065
+ return f ? (c = s ? s + f : f, this._events[c] && r(this, c)) : (this._events = new n(), this._eventsCount = 0), this;
1066
+ }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = s, o.EventEmitter = o, t.exports = o;
1067
+ })(te);
1068
+ var Ct = te.exports;
1069
+ function lt(t, e) {
1070
+ const s = ft(t), n = ft(e), i = s.pop(), a = n.pop(), r = wt(s, n);
1071
+ return r !== 0 ? r : i && a ? wt(i.split("."), a.split(".")) : i || a ? i ? -1 : 1 : 0;
1933
1072
  }
1934
- const gn = (e) => typeof e == "string" && /^[v\d]/.test(e) && Fe.test(e), St = (e, t, n) => {
1935
- wn(n);
1936
- const i = Wt(e, t);
1937
- return Ve[n].includes(i);
1938
- }, yn = (e, t) => {
1939
- const n = t.match(/^([<>=~^]+)/), i = n ? n[1] : "=";
1940
- if (i !== "^" && i !== "~")
1941
- return St(e, t, i);
1942
- const [o, c, f] = Ft(e), [h, g, y] = Ft(t);
1943
- return zt(o, h) !== 0 ? !1 : i === "^" ? ie([c, f], [g, y]) >= 0 : zt(c, g) !== 0 ? !1 : zt(f, y) >= 0;
1073
+ const Ce = (t) => typeof t == "string" && /^[v\d]/.test(t) && ee.test(t), W = (t, e, s) => {
1074
+ Pe(s);
1075
+ const n = lt(t, e);
1076
+ return se[s].includes(n);
1077
+ }, je = (t, e) => {
1078
+ const s = e.match(/^([<>=~^]+)/), n = s ? s[1] : "=";
1079
+ if (n !== "^" && n !== "~")
1080
+ return W(t, e, n);
1081
+ const [i, a, r] = ft(t), [o, u, f] = ft(e);
1082
+ return at(i, o) !== 0 ? !1 : n === "^" ? wt([a, r], [u, f]) >= 0 : at(a, u) !== 0 ? !1 : at(r, f) >= 0;
1944
1083
  };
1945
- Wt.validate = gn;
1946
- Wt.compare = St;
1947
- Wt.satisfies = yn;
1948
- const Fe = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Ft = (e) => {
1949
- if (typeof e != "string")
1084
+ lt.validate = Ce;
1085
+ lt.compare = W;
1086
+ lt.satisfies = je;
1087
+ const ee = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, ft = (t) => {
1088
+ if (typeof t != "string")
1950
1089
  throw new TypeError("Invalid argument expected string");
1951
- const t = e.match(Fe);
1952
- if (!t)
1953
- throw new Error(`Invalid argument not valid semver ('${e}' received)`);
1954
- return t.shift(), t;
1955
- }, Oe = (e) => e === "*" || e === "x" || e === "X", Me = (e) => {
1956
- const t = parseInt(e, 10);
1957
- return isNaN(t) ? e : t;
1958
- }, bn = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], zt = (e, t) => {
1959
- if (Oe(e) || Oe(t))
1090
+ const e = t.match(ee);
1091
+ if (!e)
1092
+ throw new Error(`Invalid argument not valid semver ('${t}' received)`);
1093
+ return e.shift(), e;
1094
+ }, kt = (t) => t === "*" || t === "x" || t === "X", Nt = (t) => {
1095
+ const e = parseInt(t, 10);
1096
+ return isNaN(e) ? t : e;
1097
+ }, De = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], at = (t, e) => {
1098
+ if (kt(t) || kt(e))
1960
1099
  return 0;
1961
- const [n, i] = bn(Me(e), Me(t));
1962
- return n > i ? 1 : n < i ? -1 : 0;
1963
- }, ie = (e, t) => {
1964
- for (let n = 0; n < Math.max(e.length, t.length); n++) {
1965
- const i = zt(e[n] || 0, t[n] || 0);
1966
- if (i !== 0)
1967
- return i;
1100
+ const [s, n] = De(Nt(t), Nt(e));
1101
+ return s > n ? 1 : s < n ? -1 : 0;
1102
+ }, wt = (t, e) => {
1103
+ for (let s = 0; s < Math.max(t.length, e.length); s++) {
1104
+ const n = at(t[s] || 0, e[s] || 0);
1105
+ if (n !== 0)
1106
+ return n;
1968
1107
  }
1969
1108
  return 0;
1970
- }, Ve = {
1109
+ }, se = {
1971
1110
  ">": [1],
1972
1111
  ">=": [0, 1],
1973
1112
  "=": [0],
1974
1113
  "<=": [-1, 0],
1975
1114
  "<": [-1]
1976
- }, Ae = Object.keys(Ve), wn = (e) => {
1977
- if (typeof e != "string")
1115
+ }, Ft = Object.keys(se), Pe = (t) => {
1116
+ if (typeof t != "string")
1978
1117
  throw new TypeError(
1979
- `Invalid operator type, expected string but got ${typeof e}`
1118
+ `Invalid operator type, expected string but got ${typeof t}`
1980
1119
  );
1981
- if (Ae.indexOf(e) === -1)
1120
+ if (Ft.indexOf(t) === -1)
1982
1121
  throw new Error(
1983
- `Invalid operator, expected one of ${Ae.join("|")}`
1122
+ `Invalid operator, expected one of ${Ft.join("|")}`
1984
1123
  );
1985
1124
  };
1986
- var _n = function(e, t) {
1987
- t || (t = {}), typeof t == "function" && (t = { cmp: t });
1988
- var n = typeof t.cycles == "boolean" ? t.cycles : !1, i = t.cmp && function(c) {
1989
- return function(f) {
1990
- return function(h, g) {
1991
- var y = { key: h, value: f[h] }, b = { key: g, value: f[g] };
1992
- return c(y, b);
1125
+ var Le = function(t, e) {
1126
+ e || (e = {}), typeof e == "function" && (e = { cmp: e });
1127
+ var s = typeof e.cycles == "boolean" ? e.cycles : !1, n = e.cmp && function(a) {
1128
+ return function(r) {
1129
+ return function(o, u) {
1130
+ var f = { key: o, value: r[o] }, c = { key: u, value: r[u] };
1131
+ return a(f, c);
1993
1132
  };
1994
1133
  };
1995
- }(t.cmp), o = [];
1996
- return function c(f) {
1997
- if (f && f.toJSON && typeof f.toJSON == "function" && (f = f.toJSON()), f !== void 0) {
1998
- if (typeof f == "number")
1999
- return isFinite(f) ? "" + f : "null";
2000
- if (typeof f != "object")
2001
- return JSON.stringify(f);
2002
- var h, g;
2003
- if (Array.isArray(f)) {
2004
- for (g = "[", h = 0; h < f.length; h++)
2005
- h && (g += ","), g += c(f[h]) || "null";
2006
- return g + "]";
1134
+ }(e.cmp), i = [];
1135
+ return function a(r) {
1136
+ if (r && r.toJSON && typeof r.toJSON == "function" && (r = r.toJSON()), r !== void 0) {
1137
+ if (typeof r == "number")
1138
+ return isFinite(r) ? "" + r : "null";
1139
+ if (typeof r != "object")
1140
+ return JSON.stringify(r);
1141
+ var o, u;
1142
+ if (Array.isArray(r)) {
1143
+ for (u = "[", o = 0; o < r.length; o++)
1144
+ o && (u += ","), u += a(r[o]) || "null";
1145
+ return u + "]";
2007
1146
  }
2008
- if (f === null)
1147
+ if (r === null)
2009
1148
  return "null";
2010
- if (o.indexOf(f) !== -1) {
2011
- if (n)
1149
+ if (i.indexOf(r) !== -1) {
1150
+ if (s)
2012
1151
  return JSON.stringify("__cycle__");
2013
1152
  throw new TypeError("Converting circular structure to JSON");
2014
1153
  }
2015
- var y = o.push(f) - 1, b = Object.keys(f).sort(i && i(f));
2016
- for (g = "", h = 0; h < b.length; h++) {
2017
- var O = b[h], U = c(f[O]);
2018
- U && (g && (g += ","), g += JSON.stringify(O) + ":" + U);
1154
+ var f = i.push(r) - 1, c = Object.keys(r).sort(n && n(r));
1155
+ for (u = "", o = 0; o < c.length; o++) {
1156
+ var h = c[o], l = a(r[h]);
1157
+ l && (u && (u += ","), u += JSON.stringify(h) + ":" + l);
2019
1158
  }
2020
- return o.splice(y, 1), "{" + g + "}";
1159
+ return i.splice(f, 1), "{" + u + "}";
2021
1160
  }
2022
- }(e);
1161
+ }(t);
2023
1162
  };
2024
- const Je = /* @__PURE__ */ hn(_n);
2025
- var Ct;
2026
- (function(e) {
2027
- e.mp_debug = "mp_debug";
2028
- })(Ct || (Ct = {}));
2029
- const vn = () => {
1163
+ const ne = /* @__PURE__ */ Ae(Le);
1164
+ var Z;
1165
+ (function(t) {
1166
+ t.mp_debug = "mp_debug";
1167
+ })(Z || (Z = {}));
1168
+ const Ue = () => {
2030
1169
  try {
2031
1170
  return window !== window.top;
2032
1171
  } catch {
2033
1172
  return !1;
2034
1173
  }
2035
- }, We = {
2036
- version: Rt,
1174
+ }, ie = {
1175
+ version: Y,
2037
1176
  metaframes: {}
2038
1177
  };
2039
- class In extends le.EventEmitter {
1178
+ class $e extends Ct.EventEmitter {
2040
1179
  constructor() {
2041
- super(), this._definition = We, this.getDefinition = this.getDefinition.bind(this);
1180
+ super(), this._definition = ie, this.getDefinition = this.getDefinition.bind(this);
2042
1181
  }
2043
- error(t) {
1182
+ error(e) {
2044
1183
  throw "Subclass should implement";
2045
1184
  }
2046
1185
  getDefinition() {
2047
1186
  return this._definition;
2048
1187
  }
2049
1188
  }
2050
- const Ye = (e) => {
2051
- if (e === null)
1189
+ var d;
1190
+ (function(t) {
1191
+ t.Inputs = "inputs", t.Outputs = "outputs", t.State = "state", t.Definition = "definition", t.Error = "error", t.UrlHashUpdate = "urlhashupdate", t.Message = "Message";
1192
+ })(d || (d = {}));
1193
+ const Mt = (t) => {
1194
+ if (t === null)
2052
1195
  throw "Metapage definition cannot be null";
2053
- if (typeof e == "string")
1196
+ if (typeof t == "string")
2054
1197
  try {
2055
- e = JSON.parse(e);
1198
+ t = JSON.parse(t);
2056
1199
  } catch {
2057
1200
  throw `Cannot parse into JSON:
2058
- ${e}`;
1201
+ ${t}`;
2059
1202
  }
2060
- if (!e.version)
1203
+ if (!t.version)
2061
1204
  throw 'Missing "version" key in metapage definition';
2062
- let t;
2063
- switch (He(e.version)) {
1205
+ let e;
1206
+ switch (ae(t.version)) {
2064
1207
  case "0.2": {
2065
- t = Ye(On(e));
1208
+ e = Mt(xe(t));
2066
1209
  break;
2067
1210
  }
2068
1211
  case "0.3": {
2069
- t = e;
1212
+ e = Mt(Te(t));
1213
+ break;
1214
+ }
1215
+ case "1": {
1216
+ e = t;
2070
1217
  break;
2071
1218
  }
2072
1219
  default:
2073
- console.warn(`Metapage definition version=${e.version} but we only know up to version ${Rt}. Assuming the definition is compatible, but it's the future!`), t = e;
1220
+ console.warn(`Metapage definition version=${t.version} but we only know up to version ${Y}. Assuming the definition is compatible, but it's the future!`), e = t;
2074
1221
  break;
2075
1222
  }
2076
- return t;
2077
- }, qe = (e, t) => {
2078
- if (e)
2079
- switch (e.version) {
1223
+ return v(e, (s) => s);
1224
+ }, re = (t, e) => {
1225
+ if (t)
1226
+ switch (t.version) {
2080
1227
  case void 0:
2081
1228
  case "0.3":
2082
1229
  case "0.4":
2083
- return qe(En(e));
1230
+ return re(Jt(ze(t)));
2084
1231
  case "0.5":
2085
- return Sn(e);
1232
+ return Jt(t);
2086
1233
  case "0.6":
2087
- return e;
1234
+ return oe(t);
1235
+ case "1":
1236
+ return t;
2088
1237
  default:
2089
- if (t && t.errorIfUnknownVersion)
1238
+ if (e && e.errorIfUnknownVersion)
2090
1239
  throw `Unsupported metaframe version. Please upgrade to a new version: npm i @metapages/metapage@latest
2091
- ${JSON.stringify(e)}
1240
+ ${JSON.stringify(t)}
2092
1241
  ${window.location.href}`;
2093
1242
  return console.error(`Unsupported metaframe version. Not throwing an error because you might not be able to upgrade. Please upgrade to a new version: npm i @metapages/metapage@latest
2094
- ${JSON.stringify(e)}
2095
- ${window.location.href}`), e;
1243
+ ${JSON.stringify(t)}
1244
+ ${window.location.href}`), t;
2096
1245
  }
2097
- }, En = (e) => {
2098
- const { version: t, inputs: n, outputs: i, allow: o, metadata: c, ...f } = e, h = c, { title: g, author: y, image: b, descriptionUrl: O, keywords: U, iconUrl: B, ...I } = h, L = {
2099
- name: g,
2100
- author: y,
2101
- description: O,
2102
- image: b,
2103
- tags: U,
2104
- ...I
1246
+ }, ze = (t) => {
1247
+ const { version: e, inputs: s, outputs: n, allow: i, metadata: a, ...r } = t, o = a, { title: u, author: f, image: c, descriptionUrl: h, keywords: l, iconUrl: y, ...m } = o, I = {
1248
+ name: u,
1249
+ author: f,
1250
+ description: h,
1251
+ image: c,
1252
+ tags: l,
1253
+ ...m
2105
1254
  };
2106
1255
  return {
2107
1256
  version: "0.5",
2108
- inputs: n,
2109
- outputs: i,
2110
- allow: o,
2111
- metadata: L,
2112
- ...f
1257
+ inputs: s,
1258
+ outputs: n,
1259
+ allow: i,
1260
+ metadata: I,
1261
+ ...r
2113
1262
  };
2114
- }, Sn = (e) => {
2115
- const { metadata: t, ...n } = e, i = {
1263
+ }, oe = (t) => t, Jt = (t) => oe(Ve(t)), Ve = (t) => v(t, (e) => {
1264
+ const { metadata: s, ...n } = e, i = {
2116
1265
  ...n,
2117
1266
  version: "0.6"
2118
1267
  };
2119
- if (t) {
2120
- const { edit: o, ...c } = t, f = { ...c };
2121
- if (i.metadata = f, o && !(f && f.operations && f.operations.edit))
2122
- switch (f.operations || (f.operations = {}), o.type) {
1268
+ if (s) {
1269
+ const { edit: a, ...r } = s, o = { ...r };
1270
+ if (i.metadata = o, a && !(o && o.operations && o.operations.edit))
1271
+ switch (o.operations || (o.operations = {}), a.type) {
2123
1272
  case "metapage":
2124
- const h = o.value, g = {
1273
+ const u = a.value, f = {
2125
1274
  type: "metapage",
2126
- metapage: h.definition,
2127
- metaframe: h.key || "edit"
1275
+ metapage: u.definition,
1276
+ metaframe: u.key || "edit"
2128
1277
  };
2129
- f.operations.edit = g;
1278
+ o.operations.edit = f;
2130
1279
  break;
2131
1280
  case "metaframe":
2132
- const y = o.value, b = {
1281
+ const c = a.value, h = {
2133
1282
  type: "url",
2134
- url: y.url,
2135
- params: y.params ? y.params.map((O) => ({
2136
- to: O.to,
2137
- from: O.from,
2138
- toType: O.toType === "path" ? void 0 : O.toType
1283
+ url: c.url,
1284
+ params: c.params ? c.params.map((l) => ({
1285
+ to: l.to,
1286
+ from: l.from,
1287
+ toType: l.toType === "path" ? void 0 : l.toType
2139
1288
  })) : void 0
2140
1289
  };
2141
- f.operations.edit = b;
1290
+ o.operations.edit = h;
2142
1291
  break;
2143
1292
  default:
2144
- throw `Unsupported edit type: ${o.type} in metadata for metaframe ${JSON.stringify(t)}`;
1293
+ throw `Unsupported edit type: ${a.type} in metadata for metaframe ${JSON.stringify(s)}`;
2145
1294
  }
2146
1295
  }
2147
1296
  return i;
2148
- }, On = (e) => (e.version = "0.3", e), Vt = (e, t) => {
2149
- if (!t)
1297
+ }), xe = (t) => v(t, (e) => {
1298
+ e.version = "0.3";
1299
+ }), Te = (t) => v(t, (e) => {
1300
+ const s = e;
1301
+ delete s.plugins;
1302
+ }), ct = (t, e) => {
1303
+ if (!e)
2150
1304
  return !1;
2151
- let n = !1;
2152
- return Object.keys(t).forEach((i) => {
2153
- n = !0, t[i] === void 0 ? delete e[i] : e[i] = t[i];
2154
- }), n;
2155
- }, He = (e) => {
2156
- if (e === "latest")
2157
- return Rt;
2158
- if (St(e, "0.2", "<"))
2159
- throw `Unknown version: ${e}`;
2160
- return St(e, "0.2", ">=") && St(e, "0.3", "<") ? "0.2" : St(e, "0.3", ">=") ? "0.3" : (console.log(`Could not match version=${e} to any known version, assuming ${Rt}`), Rt);
2161
- }, Bn = (e) => window.location.search ? new URLSearchParams(window.location.search).get(e) : null, kn = () => new URLSearchParams(window.location.search).has(Ct.mp_debug), se = () => {
2162
- const e = new URLSearchParams(window.location.search).get(Ct.mp_debug);
2163
- return e === "true" || e === "1";
2164
- }, Mn = (e) => e.filter((n) => new URLSearchParams(window.location.search).has(n)).length > 0, Tn = (e = 8) => ce(e), An = (e = 8) => ce(e), Nn = (e = 8) => ce(e), Re = "abcdefghijklmnopqrstuvwxyz0123456789", ce = (e = 8) => {
2165
- for (var t = "", n = Re.length, i = 0; i < e; i++)
2166
- t += Re.charAt(Math.floor(Math.random() * n));
2167
- return t;
2168
- }, he = (e, t, n) => {
2169
- t = t || "000", t && t.trim() == "" && (t = void 0);
2170
- let i;
2171
- if (typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e, null, " "), t && t.trim() != "") {
2172
- var o = `color: #${t}`;
2173
- n && (o = `${o}; background: #${n}`), i = `%c${i}`, window.console.log(i, o);
1305
+ let s = !1;
1306
+ return Object.keys(e).forEach((n) => {
1307
+ s = !0, e[n] === void 0 ? delete t[n] : t[n] = e[n];
1308
+ }), s;
1309
+ }, ae = (t) => {
1310
+ if (t === "latest")
1311
+ return Y;
1312
+ if (W(t, "0.2", "<"))
1313
+ throw `Unknown version: ${t}`;
1314
+ return W(t, "0.2", ">=") && W(t, "0.3", "<") ? "0.2" : W(t, "0.3", "<=") ? "0.3" : t === "1" ? "1" : (console.log(`Could not match version=${t} to any known version, assuming ${Y}`), Y);
1315
+ }, qe = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, Ke = () => new URLSearchParams(window.location.search).has(Z.mp_debug), Ot = () => {
1316
+ const t = new URLSearchParams(window.location.search).get(Z.mp_debug);
1317
+ return t === "true" || t === "1";
1318
+ }, Ge = (t = 8) => jt(t), ke = (t = 8) => jt(t), Ye = (t = 8) => jt(t), Bt = "abcdefghijklmnopqrstuvwxyz0123456789", jt = (t = 8) => {
1319
+ for (var e = "", s = Bt.length, n = 0; n < t; n++)
1320
+ e += Bt.charAt(Math.floor(Math.random() * s));
1321
+ return e;
1322
+ }, Dt = (t, e, s) => {
1323
+ e = e || "000", e && e.trim() == "" && (e = void 0);
1324
+ let n;
1325
+ if (typeof t == "string" ? n = t : typeof t == "number" ? n = t + "" : n = JSON.stringify(t, null, " "), e && e.trim() != "") {
1326
+ var i = `color: #${e}`;
1327
+ s && (i = `${i}; background: #${s}`), n = `%c${n}`, window.console.log(n, i);
2174
1328
  } else
2175
- window.console.log(i);
2176
- }, Ke = (e) => Pn(Rn(e)), Rn = (e) => {
2177
- var t = 0;
2178
- for (let n = 0; n < e.length; n++)
2179
- t = e.charCodeAt(n) + ((t << 5) - t);
2180
- return t;
2181
- }, Pn = (e) => {
2182
- var t = (e & 16777215).toString(16).toUpperCase();
2183
- return "00000".substring(0, 6 - t.length) + t;
2184
- }, Kt = () => document.readyState == "complete" || document.readyState == "interactive", pe = async () => Kt() ? Promise.resolve() : new Promise((e) => {
2185
- if (Kt()) {
2186
- e();
1329
+ window.console.log(n);
1330
+ }, ue = (t) => Fe(Ne(t)), Ne = (t) => {
1331
+ var e = 0;
1332
+ for (let s = 0; s < t.length; s++)
1333
+ e = t.charCodeAt(s) + ((e << 5) - e);
1334
+ return e;
1335
+ }, Fe = (t) => {
1336
+ var e = (t & 16777215).toString(16).toUpperCase();
1337
+ return "00000".substring(0, 6 - e.length) + e;
1338
+ }, dt = () => document.readyState == "complete" || document.readyState == "interactive", Pt = async () => dt() ? Promise.resolve() : new Promise((t) => {
1339
+ if (dt()) {
1340
+ t();
2187
1341
  return;
2188
1342
  }
2189
- let t = !1;
1343
+ let e = !1;
2190
1344
  window.addEventListener("load", () => {
2191
- t || (t = !0, e());
1345
+ e || (e = !0, t());
2192
1346
  }), setTimeout(() => {
2193
- !t && Kt() && (t = !0, e());
1347
+ !e && dt() && (e = !0, t());
2194
1348
  }, 200);
2195
- }), zn = async (e) => {
2196
- const t = Je(e);
2197
- return await Ge(t);
2198
- }, $n = async (e) => {
2199
- const t = Je({
2200
- version: e.version,
2201
- metaframes: e.metaframes,
2202
- plugins: e.plugins
1349
+ }), Xe = async (t) => {
1350
+ const e = ne(t);
1351
+ return await fe(e);
1352
+ }, Qe = async (t) => {
1353
+ const e = ne({
1354
+ version: t.version,
1355
+ metaframes: t.metaframes
2203
1356
  });
2204
- return await Ge(t);
1357
+ return await fe(e);
2205
1358
  };
2206
- async function Ge(e) {
2207
- const n = new TextEncoder().encode(e), i = await crypto.subtle.digest("SHA-256", n);
2208
- return btoa(String.fromCharCode(...new Uint8Array(i)));
1359
+ async function fe(t) {
1360
+ const s = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", s);
1361
+ return btoa(String.fromCharCode(...new Uint8Array(n)));
2209
1362
  }
2210
- class Pe extends le.EventEmitter {
2211
- constructor(t, n, i, o, c, f = !1) {
2212
- if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._plugin = !1, this._cachedEventInputsUpdate = {
1363
+ class Je extends Ct.EventEmitter {
1364
+ constructor(e, s, n, i, a, r = !1) {
1365
+ if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._cachedEventInputsUpdate = {
2213
1366
  iframeId: void 0,
2214
1367
  inputs: void 0
2215
1368
  }, this._cachedEventOutputsUpdate = {
2216
1369
  iframeId: null,
2217
1370
  inputs: null
2218
- }, !n.startsWith("http")) {
2219
- for (; n.startsWith("/"); )
2220
- n = n.substring(1);
2221
- n = window.location.protocol + "//" + window.location.hostname + (window.location.port && window.location.port != "" ? ":" + window.location.port : "") + "/" + n;
1371
+ }, !s.startsWith("http")) {
1372
+ for (; s.startsWith("/"); )
1373
+ s = s.substring(1);
1374
+ s = window.location.protocol + "//" + window.location.hostname + (window.location.port && window.location.port != "" ? ":" + window.location.port : "") + "/" + s;
2222
1375
  }
2223
- if (this.url = n, this._metapage = t, this._debug = f, f) {
2224
- var h = new URL(this.url);
2225
- h.searchParams.set(Ct.mp_debug, "true"), this.url = h.href;
1376
+ if (this.url = s, this._metapage = e, this._debug = r, r) {
1377
+ var o = new URL(this.url);
1378
+ o.searchParams.set(Z.mp_debug, "true"), this.url = o.href;
2226
1379
  }
2227
- this.id = i, this._parentId = o, this._color = Ke(this.id), this._consoleBackgroundColor = c, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
2228
- const g = this;
2229
- this.iframe = new Promise((y) => {
2230
- pe().then(async () => {
2231
- var b, O, U, B;
2232
- if (g._iframe) {
2233
- if ((B = (U = (O = (b = this._metapage) == null ? void 0 : b._definition) == null ? void 0 : O.metaframes) == null ? void 0 : U[this.id]) != null && B.allow)
2234
- g._iframe.allow = this._metapage._definition.metaframes[this.id].allow;
1380
+ this.id = n, this._parentId = i, this._color = ue(this.id), this._consoleBackgroundColor = a, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
1381
+ const u = this;
1382
+ this.iframe = new Promise((f) => {
1383
+ Pt().then(async () => {
1384
+ var c, h, l, y;
1385
+ if (u._iframe) {
1386
+ if ((y = (l = (h = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : h.metaframes) == null ? void 0 : l[this.id]) != null && y.allow)
1387
+ u._iframe.allow = this._metapage._definition.metaframes[this.id].allow;
2235
1388
  else {
2236
- const I = await g.getDefinition();
2237
- if (!g._iframe)
1389
+ const m = await u.getDefinition();
1390
+ if (!u._iframe)
2238
1391
  return;
2239
- I && I.allow && (g._iframe.allow = I.allow);
1392
+ m && m.allow && (u._iframe.allow = m.allow);
2240
1393
  }
2241
- g._iframe.src = this.url, y(g._iframe);
1394
+ u._iframe.src = this.url, f(u._iframe);
2242
1395
  }
2243
1396
  });
2244
- }), 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.setPlugin = this.setPlugin.bind(this), this.hasPermissionsDefinition = this.hasPermissionsDefinition.bind(this), this.hasPermissionsState = this.hasPermissionsState.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.setPlugin = this.setPlugin.bind(this), this.addListenerReturnDisposer = this.addListenerReturnDisposer.bind(this), this.isDisposed = this.isDisposed.bind(this);
1397
+ }), 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);
2245
1398
  }
2246
- addListenerReturnDisposer(t, n) {
2247
- return super.addListener(t, n), () => {
2248
- super.removeListener(t, n);
1399
+ addListenerReturnDisposer(e, s) {
1400
+ return super.addListener(e, s), () => {
1401
+ super.removeListener(e, s);
2249
1402
  };
2250
1403
  }
2251
- setPlugin() {
2252
- if (this._loaded)
2253
- throw "Cannot setPlugin after MetapageIFrameRpcClient already loaded";
2254
- return this._plugin = !0, this;
2255
- }
2256
- setMetapage(t) {
2257
- return this._metapage = t, this;
2258
- }
2259
- hasPermissionsState() {
2260
- return this._definition !== void 0 && this._definition.inputs !== void 0 && this._definition.inputs[yt] !== void 0;
2261
- }
2262
- hasPermissionsDefinition() {
2263
- return this._definition !== void 0 && this._definition.inputs !== void 0 && this._definition.inputs[ct] !== void 0;
1404
+ setMetapage(e) {
1405
+ return this._metapage = e, this;
2264
1406
  }
2265
1407
  getDefinitionUrl() {
2266
- var t = new URL(this.url);
2267
- return t.pathname = t.pathname + (t.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json"), t.href;
1408
+ var e = new URL(this.url);
1409
+ return e.pathname = e.pathname + (e.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json"), e.href;
2268
1410
  }
2269
1411
  async getDefinition() {
2270
1412
  if (this._definition)
2271
1413
  return this._definition;
2272
- var t = this.getDefinitionUrl();
1414
+ var e = this.getDefinitionUrl();
2273
1415
  try {
2274
- const n = await window.fetch(t, {
1416
+ const s = await window.fetch(e, {
2275
1417
  signal: AbortSignal.timeout(6e3)
2276
1418
  });
2277
- if (n.ok) {
2278
- const i = await n.json(), o = qe(i);
2279
- return this._definition = o, this._definition;
1419
+ if (s.ok) {
1420
+ const n = await s.json(), i = re(n);
1421
+ return this._definition = i, this._definition;
2280
1422
  } else
2281
- this.emit(k.Error, `Failed to fetch: ${t}
2282
- Status: ${n.status}
2283
- Status text: ${n.statusText}`);
2284
- } catch (n) {
2285
- this.emit(k.Error, `Failed to fetch or convert: ${t}
2286
- Error: ${n}`);
1423
+ this.emit(d.Error, `Failed to fetch: ${e}
1424
+ Status: ${s.status}
1425
+ Status text: ${s.statusText}`);
1426
+ } catch (s) {
1427
+ this.emit(d.Error, `Failed to fetch or convert: ${e}
1428
+ Error: ${s}`);
2287
1429
  }
2288
1430
  }
2289
- setInput(t, n) {
2290
- console.assert(!!t);
2291
- var i = {};
2292
- i[t] = n, this.setInputs(i);
1431
+ setInput(e, s) {
1432
+ console.assert(!!e);
1433
+ var n = {};
1434
+ n[e] = s, this.setInputs(n);
2293
1435
  }
2294
- setInputs(t) {
2295
- if (this.log({ m: "MetapageIFrameRpcClient", inputs: t }), !Vt(this.inputs, t))
1436
+ setInputs(e) {
1437
+ if (this.log({ m: "MetapageIFrameRpcClient", inputs: e }), !ct(this.inputs, e))
2296
1438
  return this;
2297
- if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(t), this.emit(k.Inputs, this.inputs), this._metapage.listenerCount(k.Inputs) > 0) {
2298
- var n = {};
2299
- n[this.id] = t, this._metapage.emit(k.Inputs, n);
1439
+ if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(d.Inputs, this.inputs), this._metapage.listenerCount(d.Inputs) > 0) {
1440
+ var s = {};
1441
+ s[this.id] = e, this._metapage.emit(d.Inputs, s);
2300
1442
  }
2301
1443
  return this;
2302
1444
  }
2303
- setOutput(t, n) {
2304
- console.assert(!!t);
2305
- var i = {};
2306
- i[t] = n, this.setOutputs(i);
1445
+ setOutput(e, s) {
1446
+ console.assert(!!e);
1447
+ var n = {};
1448
+ n[e] = s, this.setOutputs(n);
2307
1449
  }
2308
- setOutputs(t) {
2309
- if (Vt(this.outputs, t) && (this.emit(k.Outputs, t), this._metapage.listenerCount(k.Outputs) > 0)) {
2310
- var n = {};
2311
- n[this.id] = this.outputs, this._metapage.emit(k.Outputs, n);
1450
+ setOutputs(e) {
1451
+ if (ct(this.outputs, e) && (this.emit(d.Outputs, e), this._metapage.listenerCount(d.Outputs) > 0)) {
1452
+ var s = {};
1453
+ s[this.id] = this.outputs, this._metapage.emit(d.Outputs, s);
2312
1454
  }
2313
1455
  }
2314
- onInputs(t) {
2315
- return this.addListenerReturnDisposer(k.Inputs, t);
1456
+ onInputs(e) {
1457
+ return this.addListenerReturnDisposer(d.Inputs, e);
2316
1458
  }
2317
- onInput(t, n) {
2318
- var i = function(o) {
2319
- o.hasOwnProperty(t) && n(o[t]);
1459
+ onInput(e, s) {
1460
+ var n = function(i) {
1461
+ i.hasOwnProperty(e) && s(i[e]);
2320
1462
  };
2321
- return this.addListenerReturnDisposer(k.Inputs, i);
1463
+ return this.addListenerReturnDisposer(d.Inputs, n);
2322
1464
  }
2323
- onOutputs(t) {
2324
- return this.addListenerReturnDisposer(k.Outputs, t);
1465
+ onOutputs(e) {
1466
+ return this.addListenerReturnDisposer(d.Outputs, e);
2325
1467
  }
2326
- onOutput(t, n) {
2327
- var i = function(o) {
2328
- o.hasOwnProperty(t) && n(o[t]);
1468
+ onOutput(e, s) {
1469
+ var n = function(i) {
1470
+ i.hasOwnProperty(e) && s(i[e]);
2329
1471
  };
2330
- return this.addListenerReturnDisposer(k.Outputs, i);
1472
+ return this.addListenerReturnDisposer(d.Outputs, n);
2331
1473
  }
2332
1474
  isDisposed() {
2333
1475
  return this.inputs === void 0;
2334
1476
  }
2335
1477
  dispose() {
2336
1478
  for (super.removeAllListeners(); this._disposables && this._disposables.length > 0; ) {
2337
- const t = this._disposables.pop();
2338
- t && t();
1479
+ const e = this._disposables.pop();
1480
+ e && e();
2339
1481
  }
2340
1482
  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;
2341
1483
  }
2342
1484
  register() {
2343
- var t = {
1485
+ var e = {
2344
1486
  iframeId: this.id,
2345
1487
  parentId: this._parentId,
2346
- plugin: this._plugin,
2347
1488
  state: {
2348
1489
  inputs: this.inputs
2349
1490
  },
2350
- version: ze
1491
+ version: Zt
2351
1492
  };
2352
- this.sendRpcInternal(pt.SetupIframeServerResponse, t);
1493
+ this.sendRpcInternal($.SetupIframeServerResponse, e);
2353
1494
  }
2354
- registered(t) {
1495
+ registered(e) {
2355
1496
  if (this.log({ m: "MetapageIFrameRpcClient.registered", inputs: this.inputs }), !this._loaded) {
2356
- if (!t)
1497
+ if (!e)
2357
1498
  throw "Cannot register without a version";
2358
- for (this.version = t, this._loaded = !0; this._onLoaded && this._onLoaded.length > 0; )
1499
+ for (this.version = e, this._loaded = !0; this._onLoaded && this._onLoaded.length > 0; )
2359
1500
  this._onLoaded.pop()();
2360
1501
  this._sendInputsAfterRegistration && this.sendInputs(this.inputs);
2361
1502
  }
2362
1503
  }
2363
- async sendInputs(t) {
2364
- t = await Jt(t), this.sendRpc(pt.InputsUpdate, {
2365
- inputs: t,
1504
+ async sendInputs(e) {
1505
+ e = await ht(e), this.sendRpc($.InputsUpdate, {
1506
+ inputs: e,
2366
1507
  parentId: this._parentId
2367
1508
  });
2368
1509
  }
2369
- sendRpc(t, n) {
2370
- var i, o;
2371
- if ((i = this == null ? void 0 : this._iframe) != null && i.parentNode && this._loaded)
2372
- this.sendRpcInternal(t, n);
1510
+ sendRpc(e, s) {
1511
+ var n, i;
1512
+ if ((n = this == null ? void 0 : this._iframe) != null && n.parentNode && this._loaded)
1513
+ this.sendRpcInternal(e, s);
2373
1514
  else {
2374
- (o = this == null ? void 0 : this._metapage) == null || o.error("sending rpc later");
2375
- const c = this;
1515
+ (i = this == null ? void 0 : this._metapage) == null || i.error("sending rpc later");
1516
+ const a = this;
2376
1517
  this == null || this._onLoaded.push(() => {
2377
- c.sendRpcInternal(t, n);
1518
+ a.sendRpcInternal(e, s);
2378
1519
  });
2379
1520
  }
2380
1521
  }
2381
- ack(t) {
1522
+ ack(e) {
2382
1523
  if (this.log("⚒ ⚒ ⚒ calling ack"), this._debug) {
2383
1524
  this.log("⚒ ⚒ ⚒ sending ack from client to frame");
2384
- var n = {
2385
- message: t
1525
+ var s = {
1526
+ message: e
2386
1527
  };
2387
- this.sendRpc(pt.MessageAck, n);
1528
+ this.sendRpc($.MessageAck, s);
2388
1529
  } else
2389
1530
  this.log("⚒ ⚒ ⚒ NOT sending ack from client to frame since not debug mode");
2390
1531
  }
2391
- log(t) {
2392
- this._debug && this.logInternal(t);
1532
+ log(e) {
1533
+ this._debug && this.logInternal(e);
2393
1534
  }
2394
- logInternal(t) {
2395
- let n;
2396
- typeof t == "string" ? n = t : typeof t == "string" ? n = t + "" : n = JSON.stringify(t), he(`Metapage[${this._parentId}] Metaframe[${this.id}] ${n}`, this._color, this._consoleBackgroundColor);
1535
+ logInternal(e) {
1536
+ let s;
1537
+ typeof e == "string" ? s = e : typeof e == "string" ? s = e + "" : s = JSON.stringify(e), Dt(`Metapage[${this._parentId}] Metaframe[${this.id}] ${s}`, this._color, this._consoleBackgroundColor);
2397
1538
  }
2398
- sendRpcInternal(t, n) {
2399
- const i = {
1539
+ sendRpcInternal(e, s) {
1540
+ const n = {
2400
1541
  id: "_",
2401
1542
  iframeId: this.id,
2402
1543
  jsonrpc: "2.0",
2403
- method: t,
2404
- params: n,
1544
+ method: e,
1545
+ params: s,
2405
1546
  parentId: this._parentId
2406
1547
  };
2407
- this._iframe ? this.sendOrBufferPostMessage(i) : this._metapage ? this._metapage.error(`Cannot send to child iframe messageJSON=${JSON.stringify(i).substring(0, 200)}`) : console.error(`Cannot send to child iframe messageJSON=${JSON.stringify(i).substring(0, 200)}`);
1548
+ this._iframe ? this.sendOrBufferPostMessage(n) : this._metapage ? this._metapage.error(`Cannot send to child iframe messageJSON=${JSON.stringify(n).substring(0, 200)}`) : console.error(`Cannot send to child iframe messageJSON=${JSON.stringify(n).substring(0, 200)}`);
2408
1549
  }
2409
- sendOrBufferPostMessage(t) {
1550
+ sendOrBufferPostMessage(e) {
2410
1551
  if (this._iframe && this._iframe.contentWindow)
2411
- this._iframe.contentWindow.postMessage(t, this.url);
1552
+ this._iframe.contentWindow.postMessage(e, this.url);
2412
1553
  else if (this._bufferMessages)
2413
- this._bufferMessages.push(t);
1554
+ this._bufferMessages.push(e);
2414
1555
  else {
2415
- this._bufferMessages = [t];
2416
- const n = this;
1556
+ this._bufferMessages = [e];
1557
+ const s = this;
2417
1558
  this._bufferTimeout = window.setInterval(function() {
2418
- n._iframe && n._iframe.contentWindow && (n._bufferMessages.forEach((i) => n._iframe.contentWindow.postMessage(i, n.url)), window.clearInterval(n._bufferTimeout), n._bufferTimeout = void 0, n._bufferMessages = void 0);
1559
+ s._iframe && s._iframe.contentWindow && (s._bufferMessages.forEach((n) => s._iframe.contentWindow.postMessage(n, s.url)), window.clearInterval(s._bufferTimeout), s._bufferTimeout = void 0, s._bufferMessages = void 0);
2419
1560
  }, 0);
2420
1561
  }
2421
1562
  }
2422
1563
  }
2423
- var je;
2424
- (function(e) {
2425
- e.all = "all", e.delta = "delta";
2426
- })(je || (je = {}));
2427
- const Ce = () => ({
1564
+ const Wt = () => v({
2428
1565
  metaframes: {
2429
1566
  inputs: {},
2430
1567
  outputs: {}
2431
- },
2432
- plugins: {
2433
- inputs: {},
2434
- outputs: {}
2435
1568
  }
2436
- }), Fn = (e) => He(e), jn = (e, t) => !t || t === "*" || e === t ? !0 : t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : t.startsWith("*") ? e.endsWith(t.slice(1)) : !1, Cn = "bcbcbc";
2437
- class ot extends In {
2438
- static from(t, n) {
2439
- if (t == null)
1569
+ }, (t) => t), Ze = (t) => ae(t), Be = (t, e) => !e || e === "*" || t === e ? !0 : e.endsWith("*") ? t.startsWith(e.slice(0, -1)) : e.startsWith("*") ? t.endsWith(e.slice(1)) : !1, We = "bcbcbc";
1570
+ class P extends $e {
1571
+ static from(e, s) {
1572
+ if (e == null)
2440
1573
  throw "Metapage definition cannot be null";
2441
- if (typeof t == "string")
1574
+ if (typeof e == "string")
2442
1575
  try {
2443
- t = JSON.parse(t);
1576
+ e = JSON.parse(e);
2444
1577
  } catch {
2445
1578
  throw "Cannot parse into JSON:\n${metaPageDef}";
2446
1579
  }
2447
- var i = new ot();
2448
- return i.setDefinition(t);
1580
+ var n = new P();
1581
+ return n.setDefinition(e);
2449
1582
  }
2450
- constructor(t) {
2451
- super(), this._state = Ce(), this._metaframes = {}, this._plugins = {}, this._pluginOrder = [], this.debug = se(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = {}, this._inputMap = {}, this._id = t && t.id ? t.id : An(), this._consoleBackgroundColor = t && t.color ? t.color : Cn, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.addPlugin = this.addPlugin.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframeOrPlugin = this.getMetaframeOrPlugin.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getPlugin = this.getPlugin.bind(this), this.getPluginIds = this.getPluginIds.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.pluginIds = this.pluginIds.bind(this), this.plugins = this.plugins.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.removePlugin = this.removePlugin.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.setInputStateOnly = this.setInputStateOnly.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setOutputStateOnly = this.setOutputStateOnly.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this.updatePluginsWithDefinition = this.updatePluginsWithDefinition.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), pe().then(() => {
1583
+ constructor(e) {
1584
+ super(), this._state = Wt(), this._metaframes = v({}, (s) => s), this.debug = Ot(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = v({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : ke(), this._consoleBackgroundColor = e && e.color ? e.color : We, 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), Pt().then(() => {
2452
1585
  this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
2453
1586
  });
2454
1587
  }
2455
1588
  isDisposed() {
2456
1589
  return this._metaframes === void 0;
2457
1590
  }
2458
- addListenerReturnDisposer(t, n) {
2459
- return super.addListener(t, n), () => {
2460
- super.removeListener(t, n);
1591
+ addListenerReturnDisposer(e, s) {
1592
+ return super.addListener(e, s), () => {
1593
+ super.removeListener(e, s);
2461
1594
  };
2462
1595
  }
2463
1596
  setDebugFromUrlParams() {
2464
- return this.debug = Mn(["MP_DEBUG", "DEBUG", "debug", "mp_debug"]), this;
1597
+ const e = new URL(window.location.href);
1598
+ return this.debug = ["debug", "mp_debug"].reduce((s, n) => s || e.searchParams.get(n) === "true" || e.searchParams.get(n) === "1", !1), this;
2465
1599
  }
2466
1600
  getState() {
2467
1601
  return this._state;
2468
1602
  }
2469
- setState(t) {
2470
- if (this._state = t, this.getMetaframeIds().forEach((n) => {
2471
- this.getMetaframe(n).setInputs(this._state.metaframes.inputs[n]), this.getMetaframe(n).setOutputs(this._state.metaframes.outputs[n]);
2472
- }), this.getPluginIds().forEach((n) => {
2473
- this.getPlugin(n).setInputs(this._state.plugins.inputs[n]), this.getPlugin(n).setOutputs(this._state.plugins.outputs[n]);
2474
- }), this.listenerCount(k.State) > 0) {
2475
- const n = Z(this._state, (i) => {
2476
- });
2477
- this.emit(k.State, n);
2478
- }
1603
+ setState(e) {
1604
+ this._state = v(e, (s) => s), this.getMetaframeIds().forEach((s) => {
1605
+ this.getMetaframe(s).setInputs(this._state.metaframes.inputs[s]), this.getMetaframe(s).setOutputs(this._state.metaframes.outputs[s]);
1606
+ }), this.listenerCount(d.State) > 0 && this.emit(d.State, this._state);
2479
1607
  }
2480
1608
  getStateMetaframes() {
2481
1609
  return this._state.metaframes;
@@ -2483,69 +1611,59 @@ class ot extends In {
2483
1611
  getDefinition() {
2484
1612
  return this._definition;
2485
1613
  }
2486
- setDefinition(t, n) {
2487
- if (!t.version)
1614
+ setDefinition(e, s) {
1615
+ if (!e.version)
2488
1616
  throw "Metapage definition must have a version";
2489
- const i = Ye(t);
2490
- i.metaframes && Object.keys(i.metaframes).forEach((c) => {
2491
- if (i.plugins && i.plugins.includes(c))
2492
- throw this.emitErrorMessage(`Plugin with url=${c} matches metaframe. Metaframe ids and plugin urls are not allowed to collide`), `Plugin with url=${c} matches metaframe. Metaframe ids and plugin urls are not allowed to collide`;
2493
- var f = i.metaframes[c];
2494
- if (typeof f != "object")
2495
- throw this.emitErrorMessage(`Metaframe "${c}" is not an object`), `Metaframe "${c}" is not an object`;
2496
- if (!f.url)
2497
- throw this.emitErrorMessage(`Metaframe "${c}" missing field: url`), `Metaframe "${c}" missing field: url`;
1617
+ const n = Mt(e);
1618
+ n.metaframes && Object.keys(n.metaframes).forEach((a) => {
1619
+ var r = n.metaframes[a];
1620
+ if (typeof r != "object")
1621
+ throw this.emitErrorMessage(`Metaframe "${a}" is not an object`), `Metaframe "${a}" is not an object`;
1622
+ if (!r.url)
1623
+ throw this.emitErrorMessage(`Metaframe "${a}" missing field: url`), `Metaframe "${a}" missing field: url`;
2498
1624
  });
2499
- const o = this._definition;
2500
- return this._definition = i, Object.keys(this._metaframes).forEach((c) => {
2501
- (!i.metaframes || !i.metaframes[c]) && this.removeMetaframe(c);
2502
- }), Object.keys(this._plugins).forEach((c) => {
2503
- i.plugins && !i.plugins.includes(c) && this.removePlugin(c);
2504
- }), this._pluginOrder = i.plugins ? i.plugins : [], n && (this._state = n), i.metaframes && Object.keys(i.metaframes).forEach((c) => {
2505
- if (!this._metaframes.hasOwnProperty(c)) {
2506
- const f = i.metaframes[c];
2507
- this.addMetaframe(c, f);
2508
- }
2509
- }), i.plugins && i.plugins.forEach((c) => {
2510
- this._plugins.hasOwnProperty(c) || this.addPlugin(c);
2511
- }), o !== We && window.setTimeout(() => {
2512
- if (!this.isDisposed() && i === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(k.State) > 0)) {
2513
- const c = Z(this._state, (f) => {
2514
- });
2515
- this.emit(k.State, c);
1625
+ const i = this._definition;
1626
+ return this._definition = n, Object.keys(this._metaframes).forEach((a) => {
1627
+ (!n.metaframes || !n.metaframes[a]) && this.removeMetaframe(a);
1628
+ }), s && (this._state = v(s, (a) => a)), n.metaframes && Object.keys(n.metaframes).forEach((a) => {
1629
+ if (!this._metaframes.hasOwnProperty(a)) {
1630
+ const r = n.metaframes[a];
1631
+ this.addMetaframe(a, r);
2516
1632
  }
1633
+ }), i !== ie && window.setTimeout(() => {
1634
+ !this.isDisposed() && n === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(d.State) > 0 && this.emit(d.State, this._state));
2517
1635
  }, 0), this;
2518
1636
  }
2519
1637
  _emitDefinitionEvent() {
2520
- if (this.listenerCount(k.Definition) > 0) {
2521
- const t = Z(this._definition, (c) => {
2522
- c.meta && delete c.meta.sha256;
2523
- }), n = Z(this._metaframes, (c) => {
2524
- }), i = Z(this._plugins, (c) => {
2525
- }), o = {
2526
- definition: t,
2527
- metaframes: n,
2528
- plugins: i
1638
+ if (this.listenerCount(d.Definition) > 0) {
1639
+ const e = {
1640
+ definition: this._definition,
1641
+ metaframes: this._metaframes
2529
1642
  };
2530
- this.emit(k.Definition, o);
1643
+ this.emit(d.Definition, e);
2531
1644
  }
2532
1645
  }
2533
- addPipe(t, n) {
2534
- this._inputMap[t] || (this._inputMap[t] = []), this._inputMap[t].push(n);
2535
- }
2536
- removeMetaframe(t) {
2537
- this._metaframes[t] && (this._metaframes[t].dispose(), delete this._metaframes[t], delete this._state.metaframes.inputs[t], delete this._state.metaframes.outputs[t], delete this._inputMap[t], Object.keys(this._inputMap).forEach((n) => {
2538
- const i = this._inputMap[n];
2539
- let o = 0;
2540
- for (; o <= i.length; )
2541
- i[o] && i[o].metaframe === t ? i.splice(o, 1) : o++;
2542
- }), this._cachedInputLookupMap = {});
1646
+ addPipe(e, s) {
1647
+ this._inputMap = v(this._inputMap, (n) => {
1648
+ n[e] || (n[e] = []), n[e].push(s);
1649
+ });
2543
1650
  }
2544
- removePlugin(t) {
2545
- this._plugins[t] && (this._plugins[t].dispose(), delete this._plugins[t], delete this._state.plugins.inputs[t], delete this._state.plugins.outputs[t]);
1651
+ removeMetaframe(e) {
1652
+ this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = v(this._metaframes, (s) => {
1653
+ delete s[e];
1654
+ }), this._state = v(this._state, (s) => {
1655
+ delete s.metaframes.inputs[e], delete s.metaframes.outputs[e];
1656
+ }), this._inputMap = v(this._inputMap, (s) => {
1657
+ delete s[e], Object.keys(s).forEach((n) => {
1658
+ const i = s[n];
1659
+ let a = 0;
1660
+ for (; a <= i.length; )
1661
+ i[a] && i[a].metaframe === e ? i.splice(a, 1) : a++;
1662
+ });
1663
+ }), this._cachedInputLookupMap = v({}, (s) => s));
2546
1664
  }
2547
1665
  removeAll() {
2548
- Object.keys(this._metaframes).forEach((t) => this._metaframes[t].dispose()), Object.keys(this._plugins).forEach((t) => this._plugins[t].dispose()), this._metaframes = {}, this._plugins = {}, this._state = Ce(), this._inputMap = {}, this._cachedInputLookupMap = {};
1666
+ Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = v({}, (e) => e), this._state = Wt(), this._inputMap = v({}, (e) => e), this._cachedInputLookupMap = v({}, (e) => e);
2549
1667
  }
2550
1668
  metaframes() {
2551
1669
  return this.getMetaframes();
@@ -2557,553 +1675,439 @@ class ot extends In {
2557
1675
  return Object.keys(this._metaframes);
2558
1676
  }
2559
1677
  getMetaframes() {
2560
- return Object.assign({}, this._metaframes);
2561
- }
2562
- plugins() {
2563
- return Object.assign({}, this._plugins);
2564
- }
2565
- pluginIds() {
2566
- return this.getPluginIds();
2567
- }
2568
- getPluginIds() {
2569
- return this._pluginOrder.slice(0);
1678
+ return this._metaframes;
2570
1679
  }
2571
- getMetaframe(t) {
2572
- return this == null ? void 0 : this._metaframes[t];
1680
+ getMetaframe(e) {
1681
+ return this == null ? void 0 : this._metaframes[e];
2573
1682
  }
2574
- getPlugin(t) {
2575
- var n;
2576
- return (n = this == null ? void 0 : this._plugins) == null ? void 0 : n[t];
2577
- }
2578
- addMetaframe(t, n) {
2579
- if (!t)
1683
+ addMetaframe(e, s) {
1684
+ if (!e)
2580
1685
  throw "addMetaframe missing metaframeId";
2581
- if (!n)
1686
+ if (!s)
2582
1687
  throw "addMetaframe missing definition";
2583
- if (this._metaframes[t])
2584
- throw this.emitErrorMessage(`Existing metaframe for id=${t}`), `Existing metaframe for id=${t}`;
2585
- if (!n.url)
2586
- throw this.emitErrorMessage(`Metaframe definition missing url id=${t}`), `Metaframe definition missing url id=${t}`;
2587
- var i = new Pe(this, n.url, t, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
2588
- return this._metaframes[t] = i, i.addListener(k.Error, (o) => {
2589
- this.emit(k.Error, {
2590
- metaframeId: i.id,
2591
- metaframeUrl: i.url,
2592
- error: o
1688
+ if (this._metaframes[e])
1689
+ throw this.emitErrorMessage(`Existing metaframe for id=${e}`), `Existing metaframe for id=${e}`;
1690
+ if (!s.url)
1691
+ throw this.emitErrorMessage(`Metaframe definition missing url id=${e}`), `Metaframe definition missing url id=${e}`;
1692
+ var n = new Je(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
1693
+ return this._metaframes = v(this._metaframes, (i) => {
1694
+ i[e] = n;
1695
+ }), n.addListener(d.Error, (i) => {
1696
+ this.emit(d.Error, {
1697
+ metaframeId: n.id,
1698
+ metaframeUrl: n.url,
1699
+ error: i
2593
1700
  });
2594
- }), n.inputs && n.inputs.forEach((o) => this.addPipe(t, o)), i.setInputs(this._state.metaframes.inputs[t]), i;
2595
- }
2596
- addPlugin(t) {
2597
- if (!t)
2598
- throw "Plugin missing url";
2599
- const n = new Pe(this, t, t, this._id, this._consoleBackgroundColor, this.debug).setInputs(this._state.plugins.inputs[t]).setMetapage(this).setPlugin();
2600
- return Dn(this, n), this._plugins[t] = n, n;
1701
+ }), s.inputs && s.inputs.forEach((i) => this.addPipe(e, i)), n.setInputs(this._state.metaframes.inputs[e]), n;
2601
1702
  }
2602
1703
  dispose() {
2603
- this.log("disposing"), super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this._metaframes && Object.keys(this._metaframes).forEach((t) => this._metaframes[t].dispose()), this._plugins && Object.keys(this._plugins).forEach((t) => this._plugins[t].dispose()), this._id = void 0, this._metaframes = void 0, this._plugins = void 0, this._state = void 0, this._cachedInputLookupMap = void 0, this._inputMap = void 0;
1704
+ 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;
2604
1705
  }
2605
- log(t, n, i) {
2606
- this.debug && this.logInternal(t, n, i);
1706
+ log(e, s, n) {
1707
+ this.debug && this.logInternal(e, s, n);
2607
1708
  }
2608
- error(t) {
2609
- this.logInternal(t, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${t}`);
1709
+ error(e) {
1710
+ this.logInternal(e, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${e}`);
2610
1711
  }
2611
- emitErrorMessage(t) {
2612
- this.emit(k.Error, t);
1712
+ emitErrorMessage(e) {
1713
+ this.emit(d.Error, e);
2613
1714
  }
2614
- getInputsFromOutput(t, n) {
2615
- if (this._cachedInputLookupMap[t] || (this._cachedInputLookupMap[t] = {}), !this._cachedInputLookupMap[t][n]) {
1715
+ getInputsFromOutput(e, s) {
1716
+ return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = v(this._cachedInputLookupMap, (n) => {
1717
+ n[e] = v({}, (i) => i);
1718
+ })), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap = v(this._cachedInputLookupMap, (n) => {
2616
1719
  var i = [];
2617
- this._cachedInputLookupMap[t][n] = i, Object.keys(this._inputMap).forEach((o) => {
2618
- o !== t && this._inputMap[o].forEach((c) => {
2619
- if (c.metaframe == t && jn(n, c.source)) {
2620
- var f = c.target;
2621
- (!c.target || c.target.startsWith("*") || c.target === "") && (f = n), i.push({ metaframe: o, pipe: f });
1720
+ n[e][s] = i, Object.keys(this._inputMap).forEach((a) => {
1721
+ a !== e && this._inputMap[a].forEach((r) => {
1722
+ if (r.metaframe === e && Be(s, r.source)) {
1723
+ var o = r.target;
1724
+ (!r.target || r.target.startsWith("*") || r.target === "") && (o = s), i.push({ metaframe: a, pipe: o });
2622
1725
  }
2623
1726
  });
2624
1727
  });
2625
- }
2626
- return this._cachedInputLookupMap[t][n];
1728
+ })), this._cachedInputLookupMap[e][s];
2627
1729
  }
2628
- isValidJSONRpcMessage(t) {
2629
- if (t.jsonrpc !== "2.0")
1730
+ isValidJSONRpcMessage(e) {
1731
+ if (e.jsonrpc !== "2.0")
2630
1732
  return !1;
2631
- switch (t.method) {
2632
- case tt.SetupIframeClientRequest:
1733
+ switch (e.method) {
1734
+ case A.SetupIframeClientRequest:
2633
1735
  return !0;
2634
1736
  default:
2635
- var i = t.iframeId;
2636
- return !(i && !(t.parentId === this._id && (this._metaframes[i] || this._plugins[i])));
1737
+ var n = e.iframeId;
1738
+ return !(n && !(e.parentId === this._id && this._metaframes[n]));
2637
1739
  }
2638
1740
  }
2639
- setInput(t, n, i) {
2640
- if (this.setInputStateOnly(t, n, i), this.setMetaframeClientInputAndSentClientEvent(t, n, i), this.listenerCount(k.State) > 0 || this.listenerCount(k.Inputs) > 0) {
2641
- const o = Z(this._state, (c) => {
2642
- });
2643
- this.emit(k.State, o), this.emit(k.Inputs, o);
2644
- }
1741
+ setInput(e, s, n) {
1742
+ typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount(d.State) > 0 || this.listenerCount(d.Inputs) > 0) && (this.emit(d.State, this._state), this.emit(d.Inputs, this._state));
2645
1743
  }
2646
- setMetaframeClientInputAndSentClientEvent(t, n, i) {
2647
- if (typeof t == "object") {
2648
- if (n || i)
1744
+ setMetaframeClientInputAndSentClientEvent(e, s, n) {
1745
+ if (typeof e == "object") {
1746
+ if (s || n)
2649
1747
  throw "bad arguments, see API docs";
2650
- const o = t;
2651
- Object.keys(o).forEach((c) => {
2652
- var f = c, h = o[f];
2653
- if (typeof h != "object")
1748
+ const i = e;
1749
+ Object.keys(i).forEach((a) => {
1750
+ var r = a, o = i[r];
1751
+ if (typeof o != "object")
2654
1752
  throw "bad arguments, see API docs";
2655
- var g = this._metaframes[f];
2656
- g ? g.setInputs(h) : this.error("No iframe id=$metaframeId");
1753
+ var u = this._metaframes[r];
1754
+ u ? u.setInputs(o) : this.error("No iframe id=$metaframeId");
2657
1755
  });
2658
- } else if (typeof t == "string") {
2659
- const o = this._metaframes[t];
2660
- if (o == null && this.error(`No iframe id=${t}`), typeof n == "string")
2661
- o.setInput(n, i);
2662
- else if (typeof n == "object")
2663
- o.setInputs(n);
1756
+ } else if (typeof e == "string") {
1757
+ const i = this._metaframes[e];
1758
+ if (i == null && this.error(`No iframe id=${e}`), typeof s == "string")
1759
+ i.setInput(s, n);
1760
+ else if (typeof s == "object")
1761
+ i.setInputs(s);
2664
1762
  else
2665
1763
  throw "bad arguments, see API docs";
2666
1764
  } else
2667
1765
  throw "bad arguments, see API docs";
2668
1766
  }
2669
- setInputs(t, n, i) {
2670
- this.setInput(t, n, i);
1767
+ setInputs(e, s, n) {
1768
+ this.setInput(e, s, n);
1769
+ }
1770
+ setOutputStateOnlyMetapageInstanceInputs(e) {
1771
+ this._setStateOnlyMetaframes(!1, e);
1772
+ }
1773
+ setOutputStateOnlyMetaframeInputValue(e, s, n) {
1774
+ this._setStateOnlyMetaframeInputValue(!1, e, s, n);
1775
+ }
1776
+ setOutputStateOnlyMetaframeInputMap(e, s) {
1777
+ this._setStateOnlyMetaframeInputMap(!1, e, s);
2671
1778
  }
2672
- setOutputStateOnly(t, n, i) {
2673
- this._setStateOnly(!1, t, n, i);
1779
+ setInputStateOnlyMetapageInstanceInputs(e) {
1780
+ this._setStateOnlyMetaframes(!0, e);
2674
1781
  }
2675
- setInputStateOnly(t, n, i) {
2676
- this._setStateOnly(!0, t, n, i);
1782
+ setInputStateOnlyMetaframeInputValue(e, s, n) {
1783
+ this._setStateOnlyMetaframeInputValue(!0, e, s, n);
2677
1784
  }
2678
- _setStateOnly(t, n, i, o) {
2679
- if (typeof n == "object") {
2680
- if (i || o)
2681
- throw "If first argument is an object, subsequent args should be undefined";
2682
- const c = n;
2683
- Object.keys(c).forEach((f) => {
2684
- var h = c[f];
2685
- if (typeof h != "object")
1785
+ setInputStateOnlyMetaframeInputMap(e, s) {
1786
+ this._setStateOnlyMetaframeInputMap(!0, e, s);
1787
+ }
1788
+ _setStateOnlyMetaframeInputValue(e, s, n, i) {
1789
+ this._state = v(this._state, (a) => {
1790
+ if (!this._metaframes.hasOwnProperty(s))
1791
+ throw `No metaframe: ${s}`;
1792
+ a.metaframes || (a.metaframes = { inputs: {}, outputs: {} }), e ? a.metaframes.inputs || (a.metaframes.inputs = {}) : a.metaframes.outputs || (a.metaframes.outputs = {});
1793
+ let o = e ? a.metaframes.inputs : a.metaframes.outputs;
1794
+ o = o || {}, o[s] = o[s] ? o[s] : {}, i === void 0 ? delete o[s][n] : o[s][n] = i;
1795
+ });
1796
+ }
1797
+ _setStateOnlyMetaframeInputMap(e, s, n) {
1798
+ !n || Object.keys(n).length === 0 || (this._state = v(this._state, (i) => {
1799
+ if (!this._metaframes.hasOwnProperty(s))
1800
+ throw `No metaframe: ${s}`;
1801
+ let r = e ? i.metaframes.inputs : i.metaframes.outputs;
1802
+ r[s] = r[s] ? r[s] : {}, Object.keys(n).forEach((o) => {
1803
+ n[o] === void 0 ? delete r[s][o] : r[s][o] = n[o];
1804
+ });
1805
+ }));
1806
+ }
1807
+ _setStateOnlyMetaframes(e, s) {
1808
+ !s || Object.keys(s).length === 0 || (this._state = v(this._state, (n) => {
1809
+ Object.keys(s).forEach((i) => {
1810
+ var a = s[i];
1811
+ if (typeof a != "object")
2686
1812
  throw "Object values must be objects";
2687
- const g = this._metaframes.hasOwnProperty(f);
2688
- if (!g && !this._plugins.hasOwnProperty(f))
2689
- throw "No metaframe or plugin: ${metaframeId}";
2690
- const y = g ? t ? this._state.metaframes.inputs : this._state.metaframes.outputs : t ? this._state.plugins.inputs : this._state.plugins.outputs;
2691
- y[f] = y[f] ? y[f] : {}, Object.keys(h).forEach((b) => {
2692
- h[b] === void 0 ? delete y[f][b] : y[f][b] = h[b];
1813
+ if (!this._metaframes.hasOwnProperty(i))
1814
+ throw "No metaframe: ${metaframeId}";
1815
+ const o = e ? n.metaframes.inputs : n.metaframes.outputs;
1816
+ o[i] = o[i] ? o[i] : {}, Object.keys(a).forEach((u) => {
1817
+ a[u] === void 0 ? delete o[i][u] : o[i][u] = a[u];
2693
1818
  });
2694
1819
  });
2695
- } else if (typeof n == "string") {
2696
- const c = n, f = this._metaframes.hasOwnProperty(c);
2697
- if (!f && !this._plugins.hasOwnProperty(c))
2698
- throw `No metaframe or plugin: ${c}`;
2699
- let h = f ? t ? this._state.metaframes.inputs : this._state.metaframes.outputs : t ? this._state.plugins.inputs : this._state.plugins.outputs;
2700
- if (typeof i == "string") {
2701
- h = { ...h }, h[c] = h[c] ? h[c] : {};
2702
- const g = i;
2703
- o === void 0 ? delete h[c][g] : h[c][g] = o;
2704
- } else if (typeof i == "object") {
2705
- h[c] = h[c] ? h[c] : {};
2706
- const g = i;
2707
- Object.keys(g).forEach((y) => {
2708
- g[y] === void 0 ? delete h[c][y] : h[c][y] = g[y];
2709
- });
2710
- } else
2711
- throw "Second argument must be a string or an object";
2712
- } else
2713
- throw "First argument must be a string or an object";
2714
- }
2715
- getMetaframeOrPlugin(t) {
2716
- var n = this._metaframes[t];
2717
- return n || (n = this._plugins[t]), n;
1820
+ }));
2718
1821
  }
2719
- onMessage(t) {
2720
- if (typeof t.data == "object") {
2721
- const f = t.data;
2722
- if (!this.isValidJSONRpcMessage(f))
1822
+ onMessage(e) {
1823
+ if (typeof e.data == "object") {
1824
+ const r = e.data;
1825
+ if (!this.isValidJSONRpcMessage(r))
2723
1826
  return;
2724
- var n = f.method;
2725
- const h = f.iframeId;
2726
- if (!h)
1827
+ var s = r.method;
1828
+ const o = r.iframeId;
1829
+ if (!o)
2727
1830
  return;
2728
- const g = this.getMetaframeOrPlugin(h), y = this._plugins[h];
2729
- f._messageCount = ++this._internalReceivedMessageCounter, this.debug && this.log(`processing ${JSON.stringify(f, null, " ").substr(0, 500)}`);
2730
- let b;
2731
- switch (n) {
2732
- case tt.SetupIframeClientRequest:
2733
- g && g.register();
1831
+ const u = this.getMetaframe(o);
1832
+ if (!u) {
1833
+ this.error(`💥 onMessage no metaframe id=${o}`);
1834
+ return;
1835
+ }
1836
+ switch (r._messageCount = ++this._internalReceivedMessageCounter, this.debug && this.log(`processing ${JSON.stringify(r, null, " ").substring(0, 500)}`), s) {
1837
+ case A.SetupIframeClientRequest:
1838
+ u && u.register();
2734
1839
  break;
2735
- case tt.SetupIframeServerResponseAck:
2736
- if (g) {
2737
- const U = f.params;
2738
- g.registered(U.version);
1840
+ case A.SetupIframeServerResponseAck:
1841
+ if (u) {
1842
+ const c = r.params;
1843
+ u.registered(c.version);
2739
1844
  }
2740
1845
  break;
2741
- case tt.OutputsUpdate:
2742
- const O = f.params;
2743
- if (this._metaframes[h]) {
2744
- var i = this._metaframes[h];
2745
- this.setOutputStateOnly(h, O), i.setOutputs(O), this.listenerCount(k.State) > 0 && (b || (b = Z(this._state, (I) => {
2746
- })), this.emit(k.State, b));
2747
- var o = !1;
2748
- const U = Object.keys(O), B = {};
2749
- U.forEach((I, L) => {
2750
- const d = this.getInputsFromOutput(h, I);
2751
- d.length > 0 && d.forEach((S) => {
2752
- B[S.metaframe] || (B[S.metaframe] = {}), B[S.metaframe][S.pipe] = O[I], this.setInputStateOnly(S.metaframe, S.pipe, O[I]), o = !0;
1846
+ case A.OutputsUpdate:
1847
+ const f = r.params;
1848
+ if (this._metaframes[o]) {
1849
+ var n = this._metaframes[o];
1850
+ this.setOutputStateOnlyMetaframeInputMap(o, f), n.setOutputs(f);
1851
+ var i = !1;
1852
+ const c = Object.keys(f), h = {};
1853
+ c.forEach((l, y) => {
1854
+ const m = this.getInputsFromOutput(o, l);
1855
+ m.length > 0 && m.forEach((I) => {
1856
+ h[I.metaframe] || (h[I.metaframe] = {}), h[I.metaframe][I.pipe] = f[l], i = !0;
2753
1857
  });
2754
- }), Object.keys(B).forEach((I) => {
2755
- this._metaframes[I].setInputs(B[I]);
2756
- }), o && this.listenerCount(k.State) > 0 && (b || (b = Z(this._state, (I) => {
2757
- })), this.emit(k.State, b)), this.debug && (b || (b = Z(this._state, (I) => {
2758
- })), i.ack({ jsonrpc: f, state: b }));
2759
- } else if (this._plugins[h]) {
2760
- const U = !O[yt] && !O[ct];
2761
- U && this.setOutputStateOnly(h, O), this._plugins[h].setOutputs(O), U && this.listenerCount(k.State) > 0 && (b || (b = Z(this._state, (B) => {
2762
- })), this.emit(k.State, b)), this.debug && (b || (b = Z(this._state, (B) => {
2763
- })), this._plugins[h].ack({
2764
- jsonrpc: f,
2765
- state: b
2766
- }));
2767
- } else
2768
- this.error("missing metaframe/plugin=$metaframeId");
2769
- break;
2770
- case tt.InputsUpdate:
2771
- var c = f.params;
2772
- if (this.debug && this.log(`inputs ${JSON.stringify(c)} from ${h}`), this._metaframes[h])
2773
- this.setInputStateOnly(h, c), this._metaframes[h].setInputs(c), this.listenerCount(k.State) > 0 && (b || (b = Z(this._state, (U) => {
2774
- })), this.emit(k.State, b)), this.debug && (b || (b = Z(this._state, (U) => {
2775
- })), this._metaframes[h].ack({
2776
- jsonrpc: f,
2777
- state: b
2778
- }));
2779
- else if (this._plugins[h]) {
2780
- const U = !c[yt] && !c[ct];
2781
- U && this.setInputStateOnly(h, c), this._plugins[h].setInputs(c), U && this.listenerCount(k.State) > 0 && (b || (b = Z(this._state, (B) => {
2782
- })), this.emit(k.State, b)), this.debug && (b || (b = Z(this._state, (B) => {
2783
- })), this._plugins[h].ack({
2784
- jsonrpc: f,
2785
- state: b
2786
- }));
1858
+ }), i && (this.setInputStateOnlyMetapageInstanceInputs(h), Object.keys(h).forEach((l) => {
1859
+ this._metaframes[l].setInputs(h[l]);
1860
+ })), this.listenerCount(d.State) > 0 && this.emit(d.State, this._state), this.debug && n.ack({ jsonrpc: r, state: this._state });
2787
1861
  } else
2788
- console.error(`InputsUpdate failed no metaframe or plugin id: "${h}"`), this.error(`InputsUpdate failed no metaframe or plugin id: "${h}"`);
1862
+ this.error(`missing metaframe=${o}`);
2789
1863
  break;
2790
- case tt.PluginRequest:
2791
- y && g && g.hasPermissionsState() && (g.setInput(yt, this._state), this.debug && g.ack({ jsonrpc: f, state: this._state }));
1864
+ case A.InputsUpdate:
1865
+ var a = r.params;
1866
+ this.debug && this.log(`inputs ${JSON.stringify(a)} from ${o}`), this._metaframes[o] ? (this.setInputStateOnlyMetaframeInputMap(o, a), this._metaframes[o].setInputs(a), this.listenerCount(d.State) > 0 && this.emit(d.State, this._state), this.debug && this._metaframes[o].ack({
1867
+ jsonrpc: r,
1868
+ state: this._state
1869
+ })) : (console.error(`InputsUpdate failed no metaframe id: "${o}"`), this.error(`InputsUpdate failed no metaframe id: "${o}"`));
2792
1870
  break;
2793
- case tt.HashParamsUpdate:
2794
- if (!y && g) {
2795
- const U = f.params, B = new URL(g.url);
2796
- B.hash = U.hash, g.url = B.href, this._definition = Z(this._definition, (I) => {
2797
- I.metaframes[U.metaframe].url = B.href;
1871
+ case A.HashParamsUpdate:
1872
+ if (u) {
1873
+ const c = r.params, h = new URL(u.url);
1874
+ h.hash = c.hash, u.url = h.href, this._definition = v(this._definition, (l) => {
1875
+ l.metaframes[c.metaframe].url = h.href;
2798
1876
  }), this._emitDefinitionEvent();
2799
1877
  }
2800
1878
  break;
2801
1879
  default:
2802
- this.debug && this.log(`Unknown RPC method: "${n}"`);
1880
+ this.debug && this.log(`Unknown RPC method: "${s}"`);
2803
1881
  }
2804
- this.listenerCount(k.Message) > 0 && this.emit(k.Message, f);
1882
+ this.listenerCount(d.Message) > 0 && this.emit(d.Message, r);
2805
1883
  }
2806
1884
  }
2807
- updatePluginsWithDefinition() {
2808
- Object.values(this._plugins).forEach((t) => {
2809
- t.hasPermissionsDefinition() && Ln(t);
2810
- });
2811
- }
2812
- logInternal(t, n, i) {
2813
- i = i || this._consoleBackgroundColor;
2814
- let o;
2815
- typeof t == "string" ? o = t : typeof t == "number" ? o = t + "" : o = JSON.stringify(t), o = this._id ? `Metapage[${this._id}] ${o}` : o, he(o, n, i);
1885
+ logInternal(e, s, n) {
1886
+ n = n || this._consoleBackgroundColor;
1887
+ let i;
1888
+ typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), i = this._id ? `Metapage[${this._id}] ${i}` : i, Dt(i, s, n);
2816
1889
  }
2817
1890
  }
2818
- ot.version = ze;
2819
- ot.DEFINITION = k.Definition;
2820
- ot.DEFINITION_UPDATE_REQUEST = k.DefinitionUpdateRequest;
2821
- ot.ERROR = k.Error;
2822
- ot.INPUTS = k.Inputs;
2823
- ot.MESSAGE = k.Message;
2824
- ot.OUTPUTS = k.Outputs;
2825
- ot.STATE = k.State;
2826
- ot.deserializeInputs = Pt;
2827
- ot.serializeInputs = Jt;
2828
- const Dn = async (e, t) => {
2829
- try {
2830
- const o = await t.getDefinition();
2831
- if (!o)
2832
- throw `${t.url}`;
2833
- if (t.isDisposed())
2834
- return;
2835
- if (t.hasPermissionsDefinition()) {
2836
- var n = e.addListenerReturnDisposer(k.Definition, (c) => {
2837
- t.setInput(ct, c.definition);
2838
- });
2839
- t._disposables.push(n);
2840
- var i = e.getDefinition();
2841
- if (i && (t.setInput(ct, i), o.outputs)) {
2842
- var n = t.onOutput(ct, (f) => {
2843
- e.listenerCount(k.DefinitionUpdateRequest) > 0 && Ie.sha1(f) !== Ie.sha1(i) && e.emit(k.DefinitionUpdateRequest, f);
2844
- });
2845
- t._disposables.push(n);
2846
- }
2847
- }
2848
- if (t.hasPermissionsState() && o.outputs) {
2849
- var n = t.onOutput(yt, (f) => {
2850
- e.setState(f);
2851
- });
2852
- t._disposables.push(n);
2853
- }
2854
- } catch (o) {
2855
- console.error(o), e.emit(k.Error, `Failed to get plugin definition from "${t.getDefinitionUrl()}", error=${o}`);
2856
- }
2857
- }, Ln = (e) => {
2858
- const t = e._metapage.getDefinition();
2859
- e.setInput(ct, t);
2860
- };
2861
- var gt;
2862
- (function(e) {
2863
- e.WaitingForPageLoad = "WaitingForPageLoad", e.SentSetupIframeClientRequest = "SentSetupIframeClientRequest", e.Ready = "Ready";
2864
- })(gt || (gt = {}));
2865
- var K;
2866
- (function(e) {
2867
- e.Connected = "connected", e.Error = "error", e.Input = "input", e.Inputs = "inputs", e.Message = "message";
2868
- })(K || (K = {}));
2869
- class ft extends le.EventEmitter {
2870
- constructor(t) {
2871
- if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = gt.WaitingForPageLoad, this._messageSendCount = 0, this.debug = se(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = se(), this._isIframe = vn(), 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) {
1891
+ P.version = Zt;
1892
+ P.DEFINITION = d.Definition;
1893
+ P.ERROR = d.Error;
1894
+ P.INPUTS = d.Inputs;
1895
+ P.MESSAGE = d.Message;
1896
+ P.OUTPUTS = d.Outputs;
1897
+ P.STATE = d.State;
1898
+ P.deserializeInputs = X;
1899
+ P.serializeInputs = ht;
1900
+ var T;
1901
+ (function(t) {
1902
+ t.WaitingForPageLoad = "WaitingForPageLoad", t.SentSetupIframeClientRequest = "SentSetupIframeClientRequest", t.Ready = "Ready";
1903
+ })(T || (T = {}));
1904
+ var O;
1905
+ (function(t) {
1906
+ t.Connected = "connected", t.Error = "error", t.Input = "input", t.Inputs = "inputs", t.Message = "message";
1907
+ })(O || (O = {}));
1908
+ class D extends Ct.EventEmitter {
1909
+ constructor(e) {
1910
+ if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = T.WaitingForPageLoad, this._messageSendCount = 0, this.debug = Ot(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = Ot(), this._isIframe = Ue(), 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) {
2872
1911
  this.log("Not an iframe, metaframe code disabled");
2873
1912
  return;
2874
1913
  }
2875
- const n = this;
2876
- pe().then(() => {
2877
- this.log("pageLoaded"), window.addEventListener("message", this.onMessage), n.sendRpc(tt.SetupIframeClientRequest, {
2878
- version: ft.version
2879
- }), n._state = gt.SentSetupIframeClientRequest;
2880
- }), t && t.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
2881
- }
2882
- _resolveSetupIframeServerResponse(t) {
2883
- if (this._state === gt.WaitingForPageLoad)
1914
+ const s = this;
1915
+ Pt().then(() => {
1916
+ this.log("pageLoaded"), window.addEventListener("message", this.onMessage), s.sendRpc(A.SetupIframeClientRequest, {
1917
+ version: D.version
1918
+ }), s._state = T.SentSetupIframeClientRequest;
1919
+ }), e && e.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
1920
+ }
1921
+ _resolveSetupIframeServerResponse(e) {
1922
+ if (this._state === T.WaitingForPageLoad)
2884
1923
  throw "Got message but page has not finished loading, we should never get in this state";
2885
- (async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = t.version, this.color = Ke(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 Pt(t.state.inputs) : this._inputPipeValues = t.state.inputs), this._state = gt.Ready, this.sendRpc(tt.SetupIframeServerResponseAck, {
2886
- version: ft.version
2887
- }), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(K.Inputs, this._inputPipeValues), Object.keys(this._inputPipeValues).forEach((n) => this.emit(K.Input, n, this._inputPipeValues[n]))), this.emit(K.Inputs, this._inputPipeValues), t.plugin && (this.plugin = new Un(this)), this.emit(K.Connected)))();
1924
+ (async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = ue(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 X(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = T.Ready, this.sendRpc(A.SetupIframeServerResponseAck, {
1925
+ version: D.version
1926
+ }), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(O.Inputs, this._inputPipeValues), Object.keys(this._inputPipeValues).forEach((s) => this.emit(O.Input, s, this._inputPipeValues[s]))), this.emit(O.Inputs, this._inputPipeValues), this.emit(O.Connected)))();
2888
1927
  }
2889
1928
  async connected() {
2890
- if (this._state !== gt.Ready)
2891
- return new Promise((t, n) => {
2892
- let i;
2893
- i = this.addListenerReturnDisposer(K.Connected, () => {
2894
- t(), i();
1929
+ if (this._state !== T.Ready)
1930
+ return new Promise((e, s) => {
1931
+ let n;
1932
+ n = this.addListenerReturnDisposer(O.Connected, () => {
1933
+ e(), n();
2895
1934
  });
2896
1935
  });
2897
1936
  }
2898
- addListenerReturnDisposer(t, n) {
2899
- return super.addListener(t, n), () => {
2900
- super.removeListener(t, n);
1937
+ addListenerReturnDisposer(e, s) {
1938
+ return super.addListener(e, s), () => {
1939
+ super.removeListener(e, s);
2901
1940
  };
2902
1941
  }
2903
- log(t, n, i) {
2904
- this.debug && this.logInternal(t, n || this.color);
1942
+ log(e, s, n) {
1943
+ this.debug && this.logInternal(e, s || this.color);
2905
1944
  }
2906
- warn(t) {
2907
- this.debug && this.logInternal(t, "000", this.color);
1945
+ warn(e) {
1946
+ this.debug && this.logInternal(e, "000", this.color);
2908
1947
  }
2909
- error(t) {
2910
- this.logInternal(t, this.color, "f00");
1948
+ error(e) {
1949
+ this.logInternal(e, this.color, "f00");
2911
1950
  }
2912
- logInternal(t, n, i) {
2913
- let o;
2914
- typeof t == "string" ? o = t : typeof t == "number" ? o = t + "" : o = JSON.stringify(t), n = n && n + "", o = (this.id ? `Metaframe[${this.id}] ` : "") + `${o}`, he(o, n, i);
1951
+ logInternal(e, s, n) {
1952
+ let i;
1953
+ typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), s = s && s + "", i = (this.id ? `Metaframe[${this.id}] ` : "") + `${i}`, Dt(i, s, n);
2915
1954
  }
2916
1955
  dispose() {
2917
1956
  super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this.disableNotifyOnHashUrlChange(), this._inputPipeValues = void 0, this._outputPipeValues = void 0;
2918
1957
  }
2919
- addListener(t, n) {
2920
- return super.addListener(t, n), t === K.Inputs && window.setTimeout(() => {
2921
- this._inputPipeValues && n(this._inputPipeValues);
1958
+ addListener(e, s) {
1959
+ return super.addListener(e, s), e === O.Inputs && window.setTimeout(() => {
1960
+ this._inputPipeValues && s(this._inputPipeValues);
2922
1961
  }, 0), this;
2923
1962
  }
2924
- onInput(t, n) {
2925
- return this.addListenerReturnDisposer(K.Input, (i, o) => {
2926
- t === i && n(o);
1963
+ onInput(e, s) {
1964
+ return this.addListenerReturnDisposer(O.Input, (n, i) => {
1965
+ e === n && s(i);
2927
1966
  });
2928
1967
  }
2929
- onInputs(t) {
2930
- return this.addListenerReturnDisposer(K.Inputs, t);
1968
+ onInputs(e) {
1969
+ return this.addListenerReturnDisposer(O.Inputs, e);
2931
1970
  }
2932
- setInput(t, n) {
2933
- var i = {};
2934
- i[t] = n, this.setInputs(i);
1971
+ setInput(e, s) {
1972
+ var n = {};
1973
+ n[e] = s, this.setInputs(n);
2935
1974
  }
2936
- async setInputs(t) {
2937
- this.isInputOutputBlobSerialization && (t = await Pt(t)), this.sendRpc(tt.InputsUpdate, t);
1975
+ async setInputs(e) {
1976
+ this.isInputOutputBlobSerialization && (e = await X(e)), this.sendRpc(A.InputsUpdate, e);
2938
1977
  }
2939
- async setInternalInputsAndNotify(t) {
2940
- if (this.isInputOutputBlobSerialization && (t = await Pt(t)), !!Vt(this._inputPipeValues, t)) {
2941
- Object.keys(t).forEach((n) => {
1978
+ async setInternalInputsAndNotify(e) {
1979
+ if (this.isInputOutputBlobSerialization && (e = await X(e)), !!ct(this._inputPipeValues, e)) {
1980
+ Object.keys(e).forEach((s) => {
2942
1981
  try {
2943
- this.emit(K.Input, n, t[n]);
2944
- } catch (i) {
2945
- console.error(`Error emitting input ${n}: ${i}`), this.emit(K.Error, `Error emitting input ${n}: ${i}`);
1982
+ this.emit(O.Input, s, e[s]);
1983
+ } catch (n) {
1984
+ console.error(`Error emitting input ${s}: ${n}`), this.emit(O.Error, `Error emitting input ${s}: ${n}`);
2946
1985
  }
2947
1986
  });
2948
1987
  try {
2949
- this.emit(K.Inputs, t);
2950
- } catch (n) {
2951
- console.error(`Error emitting inputs: ${n}`), this.emit(K.Error, `Error emitting inputs: ${n}`);
1988
+ this.emit(O.Inputs, e);
1989
+ } catch (s) {
1990
+ console.error(`Error emitting inputs: ${s}`), this.emit(O.Error, `Error emitting inputs: ${s}`);
2952
1991
  }
2953
1992
  }
2954
1993
  }
2955
- getInput(t) {
2956
- return console.assert(!!t), this._inputPipeValues[t];
1994
+ getInput(e) {
1995
+ return console.assert(!!e), this._inputPipeValues[e];
2957
1996
  }
2958
1997
  getInputs() {
2959
1998
  return this._inputPipeValues;
2960
1999
  }
2961
- setOutput(t, n) {
2962
- console.assert(!!t);
2963
- var i = {};
2964
- i[t] = n, this.setOutputs(i);
2000
+ setOutput(e, s) {
2001
+ console.assert(!!e);
2002
+ var n = {};
2003
+ n[e] = s, this.setOutputs(n);
2965
2004
  }
2966
- async setOutputs(t) {
2967
- this.isInputOutputBlobSerialization && (t = await Jt(t)), Vt(this._outputPipeValues, t) && this.sendRpc(tt.OutputsUpdate, t);
2005
+ async setOutputs(e) {
2006
+ this.isInputOutputBlobSerialization && (e = await ht(e)), ct(this._outputPipeValues, e) && this.sendRpc(A.OutputsUpdate, e);
2968
2007
  }
2969
2008
  disableNotifyOnHashUrlChange() {
2970
2009
  window.removeEventListener("hashchange", this._onHashUrlChange);
2971
2010
  }
2972
- _onHashUrlChange(t) {
2973
- const n = {
2011
+ _onHashUrlChange(e) {
2012
+ const s = {
2974
2013
  hash: window.location.hash,
2975
2014
  metaframe: this.id
2976
2015
  };
2977
- this.sendRpc(tt.HashParamsUpdate, n);
2016
+ this.sendRpc(A.HashParamsUpdate, s);
2978
2017
  }
2979
- sendRpc(t, n) {
2018
+ sendRpc(e, s) {
2980
2019
  if (this._isIframe) {
2981
- const i = {
2020
+ const n = {
2982
2021
  jsonrpc: "2.0",
2983
2022
  id: ++this._messageSendCount,
2984
- method: t,
2985
- params: n,
2023
+ method: e,
2024
+ params: s,
2986
2025
  iframeId: this.id,
2987
2026
  parentId: this._parentId
2988
2027
  };
2989
- window.parent && window.parent.postMessage(i, "*");
2028
+ window.parent && window.parent.postMessage(n, "*");
2990
2029
  } else
2991
2030
  this.log("Cannot send JSON-RPC window message: there is no window.parent which means we are not an iframe");
2992
2031
  }
2993
- onMessage(t) {
2994
- if (typeof t.data == "object") {
2995
- let i = t.data;
2996
- if (i.jsonrpc === "2.0") {
2997
- var n = i.method;
2998
- if (!(n == pt.SetupIframeServerResponse || i.parentId == this._parentId && i.iframeId == this.id)) {
2999
- this.log(`window.message: received message but jsonrpc.parentId=${i.parentId} _parentId=${this._parentId} jsonrpc.iframeId=${i.iframeId} id=${this.id}`);
2032
+ onMessage(e) {
2033
+ if (typeof e.data == "object") {
2034
+ let n = e.data;
2035
+ if (n.jsonrpc === "2.0") {
2036
+ var s = n.method;
2037
+ if (!(s == $.SetupIframeServerResponse || n.parentId == this._parentId && n.iframeId == this.id)) {
2038
+ this.log(`window.message: received message but jsonrpc.parentId=${n.parentId} _parentId=${this._parentId} jsonrpc.iframeId=${n.iframeId} id=${this.id}`);
3000
2039
  return;
3001
2040
  }
3002
- switch (n) {
3003
- case pt.SetupIframeServerResponse:
3004
- this._resolveSetupIframeServerResponse(i.params);
2041
+ switch (s) {
2042
+ case $.SetupIframeServerResponse:
2043
+ this._resolveSetupIframeServerResponse(n.params);
3005
2044
  break;
3006
- case pt.InputsUpdate:
3007
- if (this._state !== gt.Ready)
2045
+ case $.InputsUpdate:
2046
+ if (this._state !== T.Ready)
3008
2047
  throw "Got InputsUpdate but metaframe is not MetaframeLoadingState.Ready";
3009
- this.setInternalInputsAndNotify(i.params.inputs);
2048
+ this.setInternalInputsAndNotify(n.params.inputs);
3010
2049
  break;
3011
- case pt.MessageAck:
3012
- this.debug && this.log(`ACK: ${JSON.stringify(i)}`);
2050
+ case $.MessageAck:
2051
+ this.debug && this.log(`ACK: ${JSON.stringify(n)}`);
3013
2052
  break;
3014
2053
  default:
3015
- this.debug && this.log(`window.message: unknown JSON-RPC method: ${JSON.stringify(i)}`);
2054
+ this.debug && this.log(`window.message: unknown JSON-RPC method: ${JSON.stringify(n)}`);
3016
2055
  break;
3017
2056
  }
3018
- this.emit(K.Message, i);
2057
+ this.emit(O.Message, n);
3019
2058
  }
3020
2059
  }
3021
2060
  }
3022
2061
  }
3023
- ft.version = pn;
3024
- ft.ERROR = K.Error;
3025
- ft.CONNECTED = K.Connected;
3026
- ft.INPUT = K.Input;
3027
- ft.INPUTS = K.Inputs;
3028
- ft.MESSAGE = K.Message;
3029
- ft.deserializeInputs = Pt;
3030
- ft.serializeInputs = Jt;
3031
- class Un {
3032
- constructor(t) {
3033
- this._metaframe = t, this.requestState = this.requestState.bind(this), this.onState = this.onState.bind(this), this.getState = this.getState.bind(this), this.setState = this.setState.bind(this), this.onDefinition = this.onDefinition.bind(this), this.getDefinition = this.getDefinition.bind(this), this.setDefinition = this.setDefinition.bind(this);
3034
- }
3035
- requestState() {
3036
- var t = {
3037
- method: ne.State
3038
- };
3039
- this._metaframe.sendRpc(tt.PluginRequest, t);
3040
- }
3041
- onState(t) {
3042
- const n = this._metaframe.onInput(yt, t);
3043
- return this.getState() && t(this.getState()), n;
3044
- }
3045
- getState() {
3046
- return this._metaframe.getInput(yt);
3047
- }
3048
- setState(t) {
3049
- this._metaframe.setOutput(yt, t);
3050
- }
3051
- onDefinition(t) {
3052
- var n = this._metaframe.onInput(ct, t);
3053
- return this.getDefinition() && t(this.getDefinition()), n;
3054
- }
3055
- setDefinition(t) {
3056
- this._metaframe.setOutput(ct, t);
3057
- }
3058
- getDefinition() {
3059
- return this._metaframe.getInput(ct);
3060
- }
3061
- }
2062
+ D.version = Se;
2063
+ D.ERROR = O.Error;
2064
+ D.CONNECTED = O.Connected;
2065
+ D.INPUT = O.Input;
2066
+ D.INPUTS = O.Inputs;
2067
+ D.MESSAGE = O.Message;
2068
+ D.deserializeInputs = X;
2069
+ D.serializeInputs = ht;
3062
2070
  export {
3063
- ne as ApiPayloadPluginRequestMethod,
3064
- We as INITIAL_NULL_METAPAGE_DEFINITION,
3065
- tt as JsonRpcMethodsFromChild,
3066
- pt as JsonRpcMethodsFromParent,
3067
- ft as Metaframe,
3068
- K as MetaframeEvents,
3069
- gt as MetaframeLoadingState,
3070
- Un as MetaframePlugin,
3071
- xn as MetaframeVersionCurrent,
3072
- Ee as MetaframeVersionsAll,
3073
- ot as Metapage,
3074
- je as MetapageEventStateType,
3075
- k as MetapageEvents,
3076
- Ct as MetapageHashParams,
3077
- Pe as MetapageIFrameRpcClient,
3078
- In as MetapageShared,
3079
- Rt as MetapageVersionCurrent,
3080
- Se as MetapageVersionsAll,
3081
- qe as convertMetaframeJsonToCurrentVersion,
3082
- Ye as convertMetapageDefinitionToCurrentVersion,
3083
- Pt as deserializeInputs,
3084
- Mn as existsAnyUrlParam,
3085
- ce as generateId,
3086
- Tn as generateMetaframeId,
3087
- An as generateMetapageId,
3088
- Nn as generateNonce,
3089
- Fn as getLibraryVersionMatching,
3090
- He as getMatchingVersion,
3091
- Bn as getUrlParam,
3092
- kn as getUrlParamDebug,
3093
- Rn as hashCode,
3094
- Pn as intToRGB,
3095
- se as isDebugFromUrlsParams,
3096
- vn as isIframe,
3097
- Kt as isPageLoaded,
3098
- he as log,
3099
- jn as matchPipe,
3100
- Vt as merge,
3101
- zn as metapageAllSha256Hash,
3102
- $n as metapageOnlyEssentailSha256Hash,
3103
- pe as pageLoaded,
3104
- mn as possiblyDeserializeDatarefToValue,
3105
- dn as possiblySerializeValueToDataref,
3106
- Jt as serializeInputs,
3107
- Ke as stringToRgb
2071
+ ie as INITIAL_NULL_METAPAGE_DEFINITION,
2072
+ A as JsonRpcMethodsFromChild,
2073
+ $ as JsonRpcMethodsFromParent,
2074
+ D as Metaframe,
2075
+ O as MetaframeEvents,
2076
+ T as MetaframeLoadingState,
2077
+ He as MetaframeVersionCurrent,
2078
+ Vt as MetaframeVersionsAll,
2079
+ P as Metapage,
2080
+ Tt as MetapageEvents,
2081
+ Z as MetapageHashParams,
2082
+ Je as MetapageIFrameRpcClient,
2083
+ $e as MetapageShared,
2084
+ Y as MetapageVersionCurrent,
2085
+ xt as MetapageVersionsAll,
2086
+ re as convertMetaframeJsonToCurrentVersion,
2087
+ Mt as convertMetapageDefinitionToCurrentVersion,
2088
+ X as deserializeInputs,
2089
+ jt as generateId,
2090
+ Ge as generateMetaframeId,
2091
+ ke as generateMetapageId,
2092
+ Ye as generateNonce,
2093
+ Ze as getLibraryVersionMatching,
2094
+ ae as getMatchingVersion,
2095
+ qe as getUrlParam,
2096
+ Ke as getUrlParamDebug,
2097
+ Ne as hashCode,
2098
+ Fe as intToRGB,
2099
+ Ot as isDebugFromUrlsParams,
2100
+ Ue as isIframe,
2101
+ dt as isPageLoaded,
2102
+ Dt as log,
2103
+ Be as matchPipe,
2104
+ ct as merge,
2105
+ Xe as metapageAllSha256Hash,
2106
+ Qe as metapageOnlyEssentailSha256Hash,
2107
+ Pt as pageLoaded,
2108
+ Ee as possiblyDeserializeDatarefToValue,
2109
+ Re as possiblySerializeValueToDataref,
2110
+ ht as serializeInputs,
2111
+ ue as stringToRgb
3108
2112
  };
3109
2113
  //# sourceMappingURL=index.js.map