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