@metapages/metapage 1.8.25 → 1.8.27
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/README.md +13 -12
- package/dist/index.js +859 -841
- package/dist/index.js.map +1 -1
- package/dist/metapage/Constants.d.ts.map +1 -1
- package/dist/metapage/Metaframe.d.ts +8 -8
- package/dist/metapage/Metaframe.d.ts.map +1 -1
- package/dist/metapage/Metapage.d.ts +5 -5
- package/dist/metapage/Metapage.d.ts.map +1 -1
- package/dist/metapage/MetapageIFrameRpcClient.d.ts +8 -8
- package/dist/metapage/MetapageIFrameRpcClient.d.ts.map +1 -1
- package/dist/metapage/MetapageTools.d.ts +4 -4
- package/dist/metapage/MetapageTools.d.ts.map +1 -1
- package/dist/metapage/Shared.d.ts +4 -4
- package/dist/metapage/core.d.ts +2 -1
- package/dist/metapage/core.d.ts.map +1 -1
- package/dist/metapage/data.d.ts.map +1 -1
- package/dist/metapage/errors/MissingMetaframeJson.d.ts.map +1 -1
- package/dist/metapage/errors/RootMetapageError.d.ts.map +1 -1
- package/dist/metapage/jsonrpc.d.ts +4 -4
- package/dist/metapage/jsonrpc.d.ts.map +1 -1
- package/dist/metapage/metapageRenderer.d.ts +16 -2
- package/dist/metapage/metapageRenderer.d.ts.map +1 -1
- package/dist/metapage/v0_1_0/all.d.ts +1 -1
- package/dist/metapage/v0_1_0/all.d.ts.map +1 -1
- package/dist/metapage/v0_2/all.d.ts +1 -1
- package/dist/metapage/v0_2/all.d.ts.map +1 -1
- package/dist/metapage/v0_3/JsonRpcMethods.d.ts +3 -3
- package/dist/metapage/v0_3/JsonRpcMethods.d.ts.map +1 -1
- package/dist/metapage/v0_3/all.d.ts +2 -2
- package/dist/metapage/v0_3/all.d.ts.map +1 -1
- package/dist/metapage/v0_4/metaframe.d.ts +3 -3
- package/dist/metapage/v0_4/metaframe.d.ts.map +1 -1
- package/dist/metapage/v0_4/metapage.d.ts +3 -3
- package/dist/metapage/v0_4/metapage.d.ts.map +1 -1
- package/dist/metapage/v1/metaframe.d.ts +3 -3
- package/dist/metapage/v1/metapage.d.ts +3 -3
- package/dist/metapage/v2/metaframe.d.ts +3 -3
- package/dist/metapage/v2/metapage.d.ts +3 -3
- package/dist/metapage/versions.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/metapage/Constants.ts +5 -6
- package/src/metapage/Metaframe.ts +54 -62
- package/src/metapage/Metapage.ts +41 -41
- package/src/metapage/MetapageIFrameRpcClient.ts +20 -20
- package/src/metapage/MetapageTools.ts +15 -18
- package/src/metapage/README.md +5 -5
- package/src/metapage/Shared.ts +5 -5
- package/src/metapage/conversions-metaframe.ts +35 -35
- package/src/metapage/conversions-metapage.ts +25 -25
- package/src/metapage/core.ts +2 -1
- package/src/metapage/data.ts +38 -48
- package/src/metapage/errors/MissingMetaframeJson.ts +11 -12
- package/src/metapage/errors/RootMetapageError.ts +11 -12
- package/src/metapage/jsonrpc.ts +6 -12
- package/src/metapage/metapageRenderer.ts +110 -66
- package/src/metapage/metapageRendererExample.ts +1 -1
- package/src/metapage/util.ts +6 -6
- package/src/metapage/v0_1_0/all.ts +6 -6
- package/src/metapage/v0_2/all.ts +15 -13
- package/src/metapage/v0_3/JsonRpcMethods.ts +6 -10
- package/src/metapage/v0_3/all.ts +7 -10
- package/src/metapage/v0_4/README.md +1 -0
- package/src/metapage/v0_4/index.ts +0 -1
- package/src/metapage/v0_4/metaframe.ts +3 -6
- package/src/metapage/v0_4/metapage.ts +3 -6
- package/src/metapage/v1/index.ts +0 -1
- package/src/metapage/v1/metaframe.ts +3 -4
- package/src/metapage/v1/metapage.ts +3 -3
- package/src/metapage/v2/index.ts +0 -1
- package/src/metapage/v2/metaframe.ts +3 -4
- package/src/metapage/v2/metapage.ts +3 -3
- package/src/metapage/versions.ts +11 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
const Ct = [
|
|
1
|
+
const Ct = [
|
|
2
|
+
"0.3",
|
|
3
|
+
"0.4",
|
|
4
|
+
"0.5",
|
|
5
|
+
"0.6",
|
|
6
|
+
"1",
|
|
7
|
+
"2"
|
|
8
|
+
], $t = ["0.2", "0.3", "1", "2"], We = "2", Le = "2", Ii = "metaframe.json", Ci = "metapage/definition", $i = "metapage/state", Wt = $t[$t.length - 1], As = Ct[Ct.length - 1], Es = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, xt = (t) => {
|
|
2
9
|
if (typeof t != "string")
|
|
3
10
|
throw new TypeError("Invalid argument expected string");
|
|
4
11
|
const e = t.match(Es);
|
|
@@ -20,7 +27,7 @@ const Ct = ["0.3", "0.4", "0.5", "0.6", "1", "2"], $t = ["0.2", "0.3", "1", "2"]
|
|
|
20
27
|
return n;
|
|
21
28
|
}
|
|
22
29
|
return 0;
|
|
23
|
-
},
|
|
30
|
+
}, U = (t, e) => {
|
|
24
31
|
const s = xt(t), n = xt(e), i = s.pop(), o = n.pop(), r = Tt(s, n);
|
|
25
32
|
return r !== 0 ? r : i && o ? Tt(i.split("."), o.split(".")) : i || o ? i ? -1 : 1 : 0;
|
|
26
33
|
};
|
|
@@ -50,60 +57,60 @@ var Kt = { exports: {} };
|
|
|
50
57
|
retryOn: []
|
|
51
58
|
};
|
|
52
59
|
return r = Object.assign(a, r), function(l, c) {
|
|
53
|
-
var
|
|
60
|
+
var p = r.retries, m = r.retryDelay, _ = r.retryOn;
|
|
54
61
|
if (c && c.retries !== void 0)
|
|
55
62
|
if (n(c.retries))
|
|
56
|
-
|
|
63
|
+
p = c.retries;
|
|
57
64
|
else
|
|
58
65
|
throw new i("retries must be a positive integer");
|
|
59
66
|
if (c && c.retryDelay !== void 0)
|
|
60
67
|
if (n(c.retryDelay) || typeof c.retryDelay == "function")
|
|
61
|
-
|
|
68
|
+
m = c.retryDelay;
|
|
62
69
|
else
|
|
63
70
|
throw new i("retryDelay must be a positive integer or a function returning a positive integer");
|
|
64
71
|
if (c && c.retryOn)
|
|
65
72
|
if (Array.isArray(c.retryOn) || typeof c.retryOn == "function")
|
|
66
|
-
|
|
73
|
+
_ = c.retryOn;
|
|
67
74
|
else
|
|
68
75
|
throw new i("retryOn property expects an array or function");
|
|
69
|
-
return new Promise(function(
|
|
70
|
-
var
|
|
76
|
+
return new Promise(function(y, O) {
|
|
77
|
+
var R = function(w) {
|
|
71
78
|
var A = typeof Request < "u" && l instanceof Request ? l.clone() : l;
|
|
72
|
-
o(A, c).then(function(
|
|
73
|
-
if (Array.isArray(
|
|
74
|
-
|
|
75
|
-
else if (typeof
|
|
79
|
+
o(A, c).then(function(C) {
|
|
80
|
+
if (Array.isArray(_) && _.indexOf(C.status) === -1)
|
|
81
|
+
y(C);
|
|
82
|
+
else if (typeof _ == "function")
|
|
76
83
|
try {
|
|
77
|
-
return Promise.resolve(
|
|
78
|
-
|
|
79
|
-
}).catch(
|
|
80
|
-
} catch (
|
|
81
|
-
S
|
|
84
|
+
return Promise.resolve(_(w, null, C)).then(function(S) {
|
|
85
|
+
S ? $(w, null, C) : y(C);
|
|
86
|
+
}).catch(O);
|
|
87
|
+
} catch (S) {
|
|
88
|
+
O(S);
|
|
82
89
|
}
|
|
83
90
|
else
|
|
84
|
-
w <
|
|
85
|
-
}).catch(function(
|
|
86
|
-
if (typeof
|
|
91
|
+
w < p ? $(w, null, C) : y(C);
|
|
92
|
+
}).catch(function(C) {
|
|
93
|
+
if (typeof _ == "function")
|
|
87
94
|
try {
|
|
88
|
-
Promise.resolve(
|
|
89
|
-
|
|
90
|
-
}).catch(function(
|
|
91
|
-
S
|
|
95
|
+
Promise.resolve(_(w, C, null)).then(function(S) {
|
|
96
|
+
S ? $(w, C, null) : O(C);
|
|
97
|
+
}).catch(function(S) {
|
|
98
|
+
O(S);
|
|
92
99
|
});
|
|
93
|
-
} catch (
|
|
94
|
-
S
|
|
100
|
+
} catch (S) {
|
|
101
|
+
O(S);
|
|
95
102
|
}
|
|
96
103
|
else
|
|
97
|
-
w <
|
|
104
|
+
w < p ? $(w, C, null) : O(C);
|
|
98
105
|
});
|
|
99
106
|
};
|
|
100
|
-
function
|
|
101
|
-
var
|
|
107
|
+
function $(w, A, C) {
|
|
108
|
+
var S = typeof m == "function" ? m(w, A, C) : m;
|
|
102
109
|
setTimeout(function() {
|
|
103
|
-
|
|
104
|
-
},
|
|
110
|
+
R(++w);
|
|
111
|
+
}, S);
|
|
105
112
|
}
|
|
106
|
-
|
|
113
|
+
R(0);
|
|
107
114
|
});
|
|
108
115
|
};
|
|
109
116
|
};
|
|
@@ -117,11 +124,11 @@ var Kt = { exports: {} };
|
|
|
117
124
|
});
|
|
118
125
|
})(Kt);
|
|
119
126
|
var $s = Kt.exports;
|
|
120
|
-
const yt = /* @__PURE__ */ mt($s),
|
|
127
|
+
const yt = /* @__PURE__ */ mt($s), z = {
|
|
121
128
|
Remove: "remove",
|
|
122
129
|
Replace: "replace",
|
|
123
130
|
Add: "add"
|
|
124
|
-
}, Xt = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Be = Symbol.iterator,
|
|
131
|
+
}, Xt = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Be = Symbol.iterator, Y = {
|
|
125
132
|
mutable: "mutable",
|
|
126
133
|
immutable: "immutable"
|
|
127
134
|
}, gt = {};
|
|
@@ -139,30 +146,30 @@ function Dt(t, e) {
|
|
|
139
146
|
}
|
|
140
147
|
}
|
|
141
148
|
}
|
|
142
|
-
function
|
|
149
|
+
function Q(t) {
|
|
143
150
|
var e;
|
|
144
151
|
return (e = t.copy) !== null && e !== void 0 ? e : t.original;
|
|
145
152
|
}
|
|
146
153
|
function be(t) {
|
|
147
|
-
return !!
|
|
154
|
+
return !!P(t);
|
|
148
155
|
}
|
|
149
|
-
function
|
|
156
|
+
function P(t) {
|
|
150
157
|
return typeof t != "object" ? null : t == null ? void 0 : t[Xt];
|
|
151
158
|
}
|
|
152
159
|
function _t(t) {
|
|
153
160
|
var e;
|
|
154
|
-
const s =
|
|
161
|
+
const s = P(t);
|
|
155
162
|
return s ? (e = s.copy) !== null && e !== void 0 ? e : s.original : t;
|
|
156
163
|
}
|
|
157
164
|
function ne(t, e) {
|
|
158
165
|
if (!t || typeof t != "object")
|
|
159
166
|
return !1;
|
|
160
167
|
let s;
|
|
161
|
-
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((s = e.mark(t,
|
|
168
|
+
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((s = e.mark(t, Y)) === Y.immutable || typeof s == "function");
|
|
162
169
|
}
|
|
163
170
|
function qt(t, e = []) {
|
|
164
171
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
165
|
-
const s = t.parent.copy, n =
|
|
172
|
+
const s = t.parent.copy, n = P(pe(s, t.key));
|
|
166
173
|
if (n !== null && (n == null ? void 0 : n.original) !== t.original)
|
|
167
174
|
return null;
|
|
168
175
|
const i = t.parent.type === 3, o = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
@@ -180,18 +187,18 @@ function qt(t, e = []) {
|
|
|
180
187
|
}
|
|
181
188
|
return e;
|
|
182
189
|
}
|
|
183
|
-
function
|
|
190
|
+
function ve(t) {
|
|
184
191
|
return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
|
|
185
192
|
}
|
|
186
193
|
function pe(t, e) {
|
|
187
|
-
return
|
|
194
|
+
return ve(t) === 2 ? t.get(e) : t[e];
|
|
188
195
|
}
|
|
189
196
|
function Pe(t, e, s) {
|
|
190
|
-
|
|
197
|
+
ve(t) === 2 ? t.set(e, s) : t[e] = s;
|
|
191
198
|
}
|
|
192
199
|
function et(t, e) {
|
|
193
|
-
const s =
|
|
194
|
-
return (s ?
|
|
200
|
+
const s = P(t);
|
|
201
|
+
return (s ? Q(s) : t)[e];
|
|
195
202
|
}
|
|
196
203
|
function fe(t, e) {
|
|
197
204
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
@@ -210,7 +217,7 @@ function _e(t, e) {
|
|
|
210
217
|
function Ls(t, e) {
|
|
211
218
|
for (let s = 0; s < e.length - 1; s += 1) {
|
|
212
219
|
const n = e[s];
|
|
213
|
-
if (t = pe(
|
|
220
|
+
if (t = pe(ve(t) === 3 ? Array.from(t) : t, n), typeof t != "object")
|
|
214
221
|
throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
|
|
215
222
|
}
|
|
216
223
|
return t;
|
|
@@ -240,8 +247,8 @@ function Qt(t, e) {
|
|
|
240
247
|
return new Set(t.values());
|
|
241
248
|
if (t instanceof Map)
|
|
242
249
|
return new Map(t);
|
|
243
|
-
if (e != null && e.mark && (s = e.mark(t,
|
|
244
|
-
if (s ===
|
|
250
|
+
if (e != null && e.mark && (s = e.mark(t, Y), s !== void 0) && s !== Y.mutable) {
|
|
251
|
+
if (s === Y.immutable)
|
|
245
252
|
return Ps(t);
|
|
246
253
|
if (typeof s == "function") {
|
|
247
254
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
@@ -259,7 +266,7 @@ function Qt(t, e) {
|
|
|
259
266
|
} else
|
|
260
267
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
261
268
|
}
|
|
262
|
-
function
|
|
269
|
+
function X(t) {
|
|
263
270
|
t.copy || (t.copy = Qt(t.original, t.options));
|
|
264
271
|
}
|
|
265
272
|
function Ae(t) {
|
|
@@ -307,7 +314,7 @@ function Oe(t, e, s, n, i) {
|
|
|
307
314
|
n.pop(), i.pop();
|
|
308
315
|
return;
|
|
309
316
|
}
|
|
310
|
-
switch (
|
|
317
|
+
switch (ve(t)) {
|
|
311
318
|
case 2:
|
|
312
319
|
for (const [a, u] of t)
|
|
313
320
|
Oe(a, a, s, n, i), Oe(u, a, s, n, i);
|
|
@@ -333,7 +340,7 @@ function Oe(t, e, s, n, i) {
|
|
|
333
340
|
n.pop(), i.pop();
|
|
334
341
|
}
|
|
335
342
|
function bt(t, e) {
|
|
336
|
-
const s =
|
|
343
|
+
const s = ve(t);
|
|
337
344
|
if (s === 0)
|
|
338
345
|
Reflect.ownKeys(t).forEach((n) => {
|
|
339
346
|
e(n, t[n], t);
|
|
@@ -352,8 +359,8 @@ function Yt(t, e, s) {
|
|
|
352
359
|
if (e.add(t), bt(t, (o, r) => {
|
|
353
360
|
var a;
|
|
354
361
|
if (be(r)) {
|
|
355
|
-
const u =
|
|
356
|
-
|
|
362
|
+
const u = P(r);
|
|
363
|
+
X(u);
|
|
357
364
|
const l = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
358
365
|
Pe(n ? i : t, o, l);
|
|
359
366
|
} else
|
|
@@ -383,8 +390,8 @@ function ut(t, e, s, n) {
|
|
|
383
390
|
t.finalized = !0;
|
|
384
391
|
}
|
|
385
392
|
}
|
|
386
|
-
function
|
|
387
|
-
const i =
|
|
393
|
+
function vt(t, e, s, n) {
|
|
394
|
+
const i = P(s);
|
|
388
395
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((o, r) => {
|
|
389
396
|
var a;
|
|
390
397
|
const u = t.type === 3 ? t.setMap : t.copy;
|
|
@@ -402,24 +409,24 @@ function Ns(t, e, s, n, i) {
|
|
|
402
409
|
u.length < o.length && ([o, u] = [u, o], [s, n] = [n, s]);
|
|
403
410
|
for (let l = 0; l < o.length; l += 1)
|
|
404
411
|
if (r.get(l.toString()) && u[l] !== o[l]) {
|
|
405
|
-
const c = e.concat([l]),
|
|
412
|
+
const c = e.concat([l]), p = _e(c, i);
|
|
406
413
|
s.push({
|
|
407
|
-
op:
|
|
408
|
-
path:
|
|
414
|
+
op: z.Replace,
|
|
415
|
+
path: p,
|
|
409
416
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
410
417
|
value: Fe(u[l])
|
|
411
418
|
}), n.push({
|
|
412
|
-
op:
|
|
413
|
-
path:
|
|
419
|
+
op: z.Replace,
|
|
420
|
+
path: p,
|
|
414
421
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
415
422
|
value: Fe(o[l])
|
|
416
423
|
});
|
|
417
424
|
}
|
|
418
425
|
for (let l = o.length; l < u.length; l += 1) {
|
|
419
|
-
const c = e.concat([l]),
|
|
426
|
+
const c = e.concat([l]), p = _e(c, i);
|
|
420
427
|
s.push({
|
|
421
|
-
op:
|
|
422
|
-
path:
|
|
428
|
+
op: z.Add,
|
|
429
|
+
path: p,
|
|
423
430
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
424
431
|
value: Fe(u[l])
|
|
425
432
|
});
|
|
@@ -427,29 +434,29 @@ function Ns(t, e, s, n, i) {
|
|
|
427
434
|
if (o.length < u.length) {
|
|
428
435
|
const { arrayLengthAssignment: l = !0 } = a.enablePatches;
|
|
429
436
|
if (l) {
|
|
430
|
-
const c = e.concat(["length"]),
|
|
437
|
+
const c = e.concat(["length"]), p = _e(c, i);
|
|
431
438
|
n.push({
|
|
432
|
-
op:
|
|
433
|
-
path:
|
|
439
|
+
op: z.Replace,
|
|
440
|
+
path: p,
|
|
434
441
|
value: o.length
|
|
435
442
|
});
|
|
436
443
|
} else
|
|
437
444
|
for (let c = u.length; o.length < c; c -= 1) {
|
|
438
|
-
const
|
|
445
|
+
const p = e.concat([c - 1]), m = _e(p, i);
|
|
439
446
|
n.push({
|
|
440
|
-
op:
|
|
441
|
-
path:
|
|
447
|
+
op: z.Remove,
|
|
448
|
+
path: m
|
|
442
449
|
});
|
|
443
450
|
}
|
|
444
451
|
}
|
|
445
452
|
}
|
|
446
453
|
function ks({ original: t, copy: e, assignedMap: s }, n, i, o, r) {
|
|
447
454
|
s.forEach((a, u) => {
|
|
448
|
-
const l = pe(t, u), c = Fe(pe(e, u)),
|
|
449
|
-
if (fe(l, c) &&
|
|
455
|
+
const l = pe(t, u), c = Fe(pe(e, u)), p = a ? Ie(t, u) ? z.Replace : z.Add : z.Remove;
|
|
456
|
+
if (fe(l, c) && p === z.Replace)
|
|
450
457
|
return;
|
|
451
|
-
const
|
|
452
|
-
i.push(
|
|
458
|
+
const m = n.concat(u), _ = _e(m, r);
|
|
459
|
+
i.push(p === z.Remove ? { op: p, path: _ } : { op: p, path: _, value: c }), o.push(p === z.Add ? { op: z.Remove, path: _ } : p === z.Remove ? { op: z.Add, path: _, value: l } : { op: z.Replace, path: _, value: l });
|
|
453
460
|
});
|
|
454
461
|
}
|
|
455
462
|
function Hs({ original: t, copy: e }, s, n, i, o) {
|
|
@@ -458,11 +465,11 @@ function Hs({ original: t, copy: e }, s, n, i, o) {
|
|
|
458
465
|
if (!e.has(a)) {
|
|
459
466
|
const u = s.concat([r]), l = _e(u, o);
|
|
460
467
|
n.push({
|
|
461
|
-
op:
|
|
468
|
+
op: z.Remove,
|
|
462
469
|
path: l,
|
|
463
470
|
value: a
|
|
464
471
|
}), i.unshift({
|
|
465
|
-
op:
|
|
472
|
+
op: z.Add,
|
|
466
473
|
path: l,
|
|
467
474
|
value: a
|
|
468
475
|
});
|
|
@@ -472,11 +479,11 @@ function Hs({ original: t, copy: e }, s, n, i, o) {
|
|
|
472
479
|
if (!t.has(a)) {
|
|
473
480
|
const u = s.concat([r]), l = _e(u, o);
|
|
474
481
|
n.push({
|
|
475
|
-
op:
|
|
482
|
+
op: z.Add,
|
|
476
483
|
path: l,
|
|
477
484
|
value: a
|
|
478
485
|
}), i.unshift({
|
|
479
|
-
op:
|
|
486
|
+
op: z.Remove,
|
|
480
487
|
path: l,
|
|
481
488
|
value: a
|
|
482
489
|
});
|
|
@@ -502,39 +509,39 @@ const ze = (t, e, s = !1) => {
|
|
|
502
509
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
503
510
|
}, ct = {
|
|
504
511
|
get size() {
|
|
505
|
-
return
|
|
512
|
+
return Q(P(this)).size;
|
|
506
513
|
},
|
|
507
514
|
has(t) {
|
|
508
|
-
return
|
|
515
|
+
return Q(P(this)).has(t);
|
|
509
516
|
},
|
|
510
517
|
set(t, e) {
|
|
511
|
-
const s =
|
|
512
|
-
return (!n.has(t) || !fe(n.get(t), e)) && (
|
|
518
|
+
const s = P(this), n = Q(s);
|
|
519
|
+
return (!n.has(t) || !fe(n.get(t), e)) && (X(s), ue(s), s.assignedMap.set(t, !0), s.copy.set(t, e), vt(s, t, e, $e)), this;
|
|
513
520
|
},
|
|
514
521
|
delete(t) {
|
|
515
522
|
if (!this.has(t))
|
|
516
523
|
return !1;
|
|
517
|
-
const e =
|
|
518
|
-
return
|
|
524
|
+
const e = P(this);
|
|
525
|
+
return X(e), ue(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
|
|
519
526
|
},
|
|
520
527
|
clear() {
|
|
521
|
-
const t =
|
|
528
|
+
const t = P(this);
|
|
522
529
|
if (this.size) {
|
|
523
|
-
|
|
530
|
+
X(t), ue(t), t.assignedMap = /* @__PURE__ */ new Map();
|
|
524
531
|
for (const [e] of t.original)
|
|
525
532
|
t.assignedMap.set(e, !1);
|
|
526
533
|
t.copy.clear();
|
|
527
534
|
}
|
|
528
535
|
},
|
|
529
536
|
forEach(t, e) {
|
|
530
|
-
const s =
|
|
531
|
-
|
|
537
|
+
const s = P(this);
|
|
538
|
+
Q(s).forEach((n, i) => {
|
|
532
539
|
t.call(e, this.get(i), i, this);
|
|
533
540
|
});
|
|
534
541
|
},
|
|
535
542
|
get(t) {
|
|
536
543
|
var e, s;
|
|
537
|
-
const n =
|
|
544
|
+
const n = P(this), i = Q(n).get(t), o = ((s = (e = n.options).mark) === null || s === void 0 ? void 0 : s.call(e, i, Y)) === Y.mutable;
|
|
538
545
|
if (n.options.strict && ze(i, n.options, o), o || n.finalized || !ne(i, n.options) || i !== n.original.get(t))
|
|
539
546
|
return i;
|
|
540
547
|
const r = gt.createDraft({
|
|
@@ -544,10 +551,10 @@ const ze = (t, e, s = !1) => {
|
|
|
544
551
|
finalities: n.finalities,
|
|
545
552
|
options: n.options
|
|
546
553
|
});
|
|
547
|
-
return
|
|
554
|
+
return X(n), n.copy.set(t, r), r;
|
|
548
555
|
},
|
|
549
556
|
keys() {
|
|
550
|
-
return
|
|
557
|
+
return Q(P(this)).keys();
|
|
551
558
|
},
|
|
552
559
|
values() {
|
|
553
560
|
const t = this.keys();
|
|
@@ -588,7 +595,7 @@ const ze = (t, e, s = !1) => {
|
|
|
588
595
|
return o;
|
|
589
596
|
const r = o.value;
|
|
590
597
|
let a = t.setMap.get(r);
|
|
591
|
-
const u =
|
|
598
|
+
const u = P(a), l = ((i = (n = t.options).mark) === null || i === void 0 ? void 0 : i.call(n, a, Y)) === Y.mutable;
|
|
592
599
|
if (t.options.strict && ze(r, t.options, l), !l && !u && ne(r, t.options) && !t.finalized && t.original.has(r)) {
|
|
593
600
|
const c = gt.createDraft({
|
|
594
601
|
original: r,
|
|
@@ -606,40 +613,40 @@ const ze = (t, e, s = !1) => {
|
|
|
606
613
|
};
|
|
607
614
|
}, lt = {
|
|
608
615
|
get size() {
|
|
609
|
-
return
|
|
616
|
+
return P(this).setMap.size;
|
|
610
617
|
},
|
|
611
618
|
has(t) {
|
|
612
|
-
const e =
|
|
619
|
+
const e = P(this);
|
|
613
620
|
if (e.setMap.has(t))
|
|
614
621
|
return !0;
|
|
615
|
-
|
|
616
|
-
const s =
|
|
622
|
+
X(e);
|
|
623
|
+
const s = P(t);
|
|
617
624
|
return !!(s && e.setMap.has(s.original));
|
|
618
625
|
},
|
|
619
626
|
add(t) {
|
|
620
|
-
const e =
|
|
621
|
-
return this.has(t) || (
|
|
627
|
+
const e = P(this);
|
|
628
|
+
return this.has(t) || (X(e), ue(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), vt(e, t, t, $e)), this;
|
|
622
629
|
},
|
|
623
630
|
delete(t) {
|
|
624
631
|
if (!this.has(t))
|
|
625
632
|
return !1;
|
|
626
|
-
const e =
|
|
627
|
-
|
|
628
|
-
const s =
|
|
633
|
+
const e = P(this);
|
|
634
|
+
X(e), ue(e);
|
|
635
|
+
const s = P(t);
|
|
629
636
|
return s && e.setMap.has(s.original) ? (e.assignedMap.set(s.original, !1), e.setMap.delete(s.original)) : (!s && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
|
|
630
637
|
},
|
|
631
638
|
clear() {
|
|
632
639
|
if (!this.size)
|
|
633
640
|
return;
|
|
634
|
-
const t =
|
|
635
|
-
|
|
641
|
+
const t = P(this);
|
|
642
|
+
X(t), ue(t);
|
|
636
643
|
for (const e of t.original)
|
|
637
644
|
t.assignedMap.set(e, !1);
|
|
638
645
|
t.setMap.clear();
|
|
639
646
|
},
|
|
640
647
|
values() {
|
|
641
|
-
const t =
|
|
642
|
-
|
|
648
|
+
const t = P(this);
|
|
649
|
+
X(t);
|
|
643
650
|
const e = t.setMap.keys();
|
|
644
651
|
return {
|
|
645
652
|
[Symbol.iterator]: () => this.values(),
|
|
@@ -647,8 +654,8 @@ const ze = (t, e, s = !1) => {
|
|
|
647
654
|
};
|
|
648
655
|
},
|
|
649
656
|
entries() {
|
|
650
|
-
const t =
|
|
651
|
-
|
|
657
|
+
const t = P(this);
|
|
658
|
+
X(t);
|
|
652
659
|
const e = t.setMap.keys();
|
|
653
660
|
return {
|
|
654
661
|
[Symbol.iterator]: () => this.entries(),
|
|
@@ -680,10 +687,10 @@ const ze = (t, e, s = !1) => {
|
|
|
680
687
|
let r;
|
|
681
688
|
if (t.options.mark) {
|
|
682
689
|
const l = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, s);
|
|
683
|
-
if (r = t.options.mark(l,
|
|
690
|
+
if (r = t.options.mark(l, Y), r === Y.mutable)
|
|
684
691
|
return t.options.strict && ze(l, t.options, !0), l;
|
|
685
692
|
}
|
|
686
|
-
const a =
|
|
693
|
+
const a = Q(t);
|
|
687
694
|
if (a instanceof Map && Us.includes(e)) {
|
|
688
695
|
if (e === "size")
|
|
689
696
|
return Object.getOwnPropertyDescriptor(ct, "size").get.call(t.proxy);
|
|
@@ -709,15 +716,15 @@ const ze = (t, e, s = !1) => {
|
|
|
709
716
|
if (t.options.strict && ze(u, t.options), t.finalized || !ne(u, t.options))
|
|
710
717
|
return u;
|
|
711
718
|
if (u === et(t.original, e)) {
|
|
712
|
-
if (
|
|
719
|
+
if (X(t), t.copy[e] = wt({
|
|
713
720
|
original: t.original[e],
|
|
714
721
|
parentDraft: t,
|
|
715
722
|
key: t.type === 1 ? Number(e) : e,
|
|
716
723
|
finalities: t.finalities,
|
|
717
724
|
options: t.options
|
|
718
725
|
}), typeof r == "function") {
|
|
719
|
-
const l =
|
|
720
|
-
return
|
|
726
|
+
const l = P(t.copy[e]);
|
|
727
|
+
return X(l), ue(l), l.copy;
|
|
721
728
|
}
|
|
722
729
|
return t.copy[e];
|
|
723
730
|
}
|
|
@@ -730,20 +737,20 @@ const ze = (t, e, s = !1) => {
|
|
|
730
737
|
let i;
|
|
731
738
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
|
|
732
739
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
733
|
-
const o = Dt(
|
|
740
|
+
const o = Dt(Q(t), e);
|
|
734
741
|
if (o != null && o.set)
|
|
735
742
|
return o.set.call(t.proxy, s), !0;
|
|
736
|
-
const r = et(
|
|
737
|
-
return a && fe(a.original, s) ? (t.copy[e] = s, t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (fe(s, r) && (s !== void 0 || Ie(t.original, e)) || (
|
|
743
|
+
const r = et(Q(t), e), a = P(r);
|
|
744
|
+
return a && fe(a.original, s) ? (t.copy[e] = s, t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (fe(s, r) && (s !== void 0 || Ie(t.original, e)) || (X(t), ue(t), Ie(t.original, e) && fe(s, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = s, vt(t, e, s, $e)), !0);
|
|
738
745
|
},
|
|
739
746
|
has(t, e) {
|
|
740
|
-
return e in
|
|
747
|
+
return e in Q(t);
|
|
741
748
|
},
|
|
742
749
|
ownKeys(t) {
|
|
743
|
-
return Reflect.ownKeys(
|
|
750
|
+
return Reflect.ownKeys(Q(t));
|
|
744
751
|
},
|
|
745
752
|
getOwnPropertyDescriptor(t, e) {
|
|
746
|
-
const s =
|
|
753
|
+
const s = Q(t), n = Reflect.getOwnPropertyDescriptor(s, e);
|
|
747
754
|
return n && {
|
|
748
755
|
writable: !0,
|
|
749
756
|
configurable: t.type !== 1 || e !== "length",
|
|
@@ -762,11 +769,11 @@ const ze = (t, e, s = !1) => {
|
|
|
762
769
|
},
|
|
763
770
|
deleteProperty(t, e) {
|
|
764
771
|
var s;
|
|
765
|
-
return t.type === 1 ? es.set.call(this, t, e, void 0, t.proxy) : (et(t.original, e) !== void 0 || e in t.original ? (
|
|
772
|
+
return t.type === 1 ? es.set.call(this, t, e, void 0, t.proxy) : (et(t.original, e) !== void 0 || e in t.original ? (X(t), ue(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (s = t.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
766
773
|
}
|
|
767
774
|
};
|
|
768
|
-
function
|
|
769
|
-
const { original: e, parentDraft: s, key: n, finalities: i, options: o } = t, r =
|
|
775
|
+
function wt(t) {
|
|
776
|
+
const { original: e, parentDraft: s, key: n, finalities: i, options: o } = t, r = ve(e), a = {
|
|
770
777
|
type: r,
|
|
771
778
|
finalized: !1,
|
|
772
779
|
parent: s,
|
|
@@ -782,39 +789,39 @@ function vt(t) {
|
|
|
782
789
|
const { proxy: u, revoke: l } = Proxy.revocable(r === 1 ? Object.assign([], a) : a, es);
|
|
783
790
|
if (i.revoke.push(l), Zt.add(u), a.proxy = u, s) {
|
|
784
791
|
const c = s;
|
|
785
|
-
c.finalities.draft.push((
|
|
786
|
-
var
|
|
787
|
-
const
|
|
788
|
-
let
|
|
789
|
-
const
|
|
792
|
+
c.finalities.draft.push((p, m) => {
|
|
793
|
+
var _, y;
|
|
794
|
+
const O = P(u);
|
|
795
|
+
let R = c.type === 3 ? c.setMap : c.copy;
|
|
796
|
+
const $ = pe(R, n), w = P($);
|
|
790
797
|
if (w) {
|
|
791
798
|
let A = w.original;
|
|
792
|
-
w.operated && (A = _t(
|
|
799
|
+
w.operated && (A = _t($)), at(w), ut(w, $e, p, m), c.options.enableAutoFreeze && (c.options.updatedValues = (_ = c.options.updatedValues) !== null && _ !== void 0 ? _ : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(A, w.original)), Pe(R, n, A);
|
|
793
800
|
}
|
|
794
|
-
(
|
|
795
|
-
A(
|
|
801
|
+
(y = O.callbacks) === null || y === void 0 || y.forEach((A) => {
|
|
802
|
+
A(p, m);
|
|
796
803
|
});
|
|
797
804
|
});
|
|
798
805
|
} else {
|
|
799
|
-
const c =
|
|
800
|
-
c.finalities.draft.push((
|
|
801
|
-
at(c), ut(c, $e,
|
|
806
|
+
const c = P(u);
|
|
807
|
+
c.finalities.draft.push((p, m) => {
|
|
808
|
+
at(c), ut(c, $e, p, m);
|
|
802
809
|
});
|
|
803
810
|
}
|
|
804
811
|
return u;
|
|
805
812
|
}
|
|
806
|
-
gt.createDraft =
|
|
813
|
+
gt.createDraft = wt;
|
|
807
814
|
function Fs(t, e, s, n, i) {
|
|
808
815
|
var o;
|
|
809
|
-
const r =
|
|
816
|
+
const r = P(t), a = (o = r == null ? void 0 : r.original) !== null && o !== void 0 ? o : t, u = !!e.length;
|
|
810
817
|
if (r != null && r.operated)
|
|
811
818
|
for (; r.finalities.draft.length > 0; )
|
|
812
819
|
r.finalities.draft.pop()(s, n);
|
|
813
820
|
const l = u ? e[0] : r ? r.operated ? r.copy : r.original : t;
|
|
814
821
|
return r && ot(r), i && Oe(l, l, r == null ? void 0 : r.options.updatedValues), [
|
|
815
822
|
l,
|
|
816
|
-
s && u ? [{ op:
|
|
817
|
-
n && u ? [{ op:
|
|
823
|
+
s && u ? [{ op: z.Replace, path: [], value: e[0] }] : s,
|
|
824
|
+
n && u ? [{ op: z.Replace, path: [], value: a }] : n
|
|
818
825
|
];
|
|
819
826
|
}
|
|
820
827
|
function zs(t, e) {
|
|
@@ -826,7 +833,7 @@ function zs(t, e) {
|
|
|
826
833
|
};
|
|
827
834
|
let i, o;
|
|
828
835
|
e.enablePatches && (i = [], o = []);
|
|
829
|
-
const a = ((s = e.mark) === null || s === void 0 ? void 0 : s.call(e, t,
|
|
836
|
+
const a = ((s = e.mark) === null || s === void 0 ? void 0 : s.call(e, t, Y)) === Y.mutable || !ne(t, e) ? t : wt({
|
|
830
837
|
original: t,
|
|
831
838
|
parentDraft: null,
|
|
832
839
|
finalities: n,
|
|
@@ -835,21 +842,21 @@ function zs(t, e) {
|
|
|
835
842
|
return [
|
|
836
843
|
a,
|
|
837
844
|
(u = []) => {
|
|
838
|
-
const [l, c,
|
|
839
|
-
return e.enablePatches ? [l, c,
|
|
845
|
+
const [l, c, p] = Fs(a, u, i, o, e.enableAutoFreeze);
|
|
846
|
+
return e.enablePatches ? [l, c, p] : l;
|
|
840
847
|
}
|
|
841
848
|
];
|
|
842
849
|
}
|
|
843
850
|
function ft(t) {
|
|
844
851
|
const { rootDraft: e, value: s, useRawReturn: n = !1, isRoot: i = !0 } = t;
|
|
845
852
|
bt(s, (o, r, a) => {
|
|
846
|
-
const u =
|
|
853
|
+
const u = P(r);
|
|
847
854
|
if (u && e && u.finalities === e.finalities) {
|
|
848
855
|
t.isContainDraft = !0;
|
|
849
856
|
const l = u.original;
|
|
850
857
|
if (a instanceof Set) {
|
|
851
858
|
const c = Array.from(a);
|
|
852
|
-
a.clear(), c.forEach((
|
|
859
|
+
a.clear(), c.forEach((p) => a.add(o === p ? l : p));
|
|
853
860
|
} else
|
|
854
861
|
Pe(a, o, l);
|
|
855
862
|
} else
|
|
@@ -857,10 +864,10 @@ function ft(t) {
|
|
|
857
864
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), n && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
858
865
|
}
|
|
859
866
|
function ts(t) {
|
|
860
|
-
const e =
|
|
867
|
+
const e = P(t);
|
|
861
868
|
if (!ne(t, e == null ? void 0 : e.options))
|
|
862
869
|
return t;
|
|
863
|
-
const s =
|
|
870
|
+
const s = ve(t);
|
|
864
871
|
if (e && !e.operated)
|
|
865
872
|
return e.original;
|
|
866
873
|
let n;
|
|
@@ -888,91 +895,91 @@ function Ht(t) {
|
|
|
888
895
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
889
896
|
return ts(t);
|
|
890
897
|
}
|
|
891
|
-
const
|
|
898
|
+
const Gs = (t) => {
|
|
892
899
|
if (t !== void 0 && Object.prototype.toString.call(t) !== "[object Object]")
|
|
893
900
|
throw new Error(`Invalid options: ${String(t)}, 'options' should be an object.`);
|
|
894
901
|
return function e(s, n, i) {
|
|
895
902
|
var o, r, a;
|
|
896
903
|
if (typeof s == "function" && typeof n != "function")
|
|
897
|
-
return function(
|
|
898
|
-
return e(
|
|
904
|
+
return function(S, ...k) {
|
|
905
|
+
return e(S, (E) => s.call(this, E, ...k), n);
|
|
899
906
|
};
|
|
900
907
|
const u = s, l = n;
|
|
901
908
|
let c = i;
|
|
902
909
|
if (typeof n != "function" && (c = n), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
903
910
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
904
911
|
c = Object.assign(Object.assign({}, t), c);
|
|
905
|
-
const
|
|
906
|
-
for (const
|
|
907
|
-
if (typeof
|
|
908
|
-
throw new Error(`Invalid mark: ${
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
return
|
|
912
|
-
}
|
|
913
|
-
} : c.mark,
|
|
912
|
+
const p = be(u) ? Ht(u) : u, m = Array.isArray(c.mark) ? (S, k) => {
|
|
913
|
+
for (const E of c.mark) {
|
|
914
|
+
if (typeof E != "function")
|
|
915
|
+
throw new Error(`Invalid mark: ${E}, 'mark' should be a function.`);
|
|
916
|
+
const v = E(S, k);
|
|
917
|
+
if (v)
|
|
918
|
+
return v;
|
|
919
|
+
}
|
|
920
|
+
} : c.mark, _ = (o = c.enablePatches) !== null && o !== void 0 ? o : !1, y = (r = c.strict) !== null && r !== void 0 ? r : !1, R = {
|
|
914
921
|
enableAutoFreeze: (a = c.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
915
|
-
mark:
|
|
916
|
-
strict:
|
|
917
|
-
enablePatches:
|
|
922
|
+
mark: m,
|
|
923
|
+
strict: y,
|
|
924
|
+
enablePatches: _
|
|
918
925
|
};
|
|
919
|
-
if (!ne(
|
|
926
|
+
if (!ne(p, R) && typeof p == "object" && p !== null)
|
|
920
927
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
921
|
-
const [
|
|
928
|
+
const [$, w] = zs(p, R);
|
|
922
929
|
if (typeof n != "function") {
|
|
923
|
-
if (!ne(
|
|
930
|
+
if (!ne(p, R))
|
|
924
931
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
925
|
-
return [
|
|
932
|
+
return [$, w];
|
|
926
933
|
}
|
|
927
934
|
let A;
|
|
928
935
|
try {
|
|
929
|
-
A = l(
|
|
930
|
-
} catch (
|
|
931
|
-
throw ot(
|
|
932
|
-
}
|
|
933
|
-
const
|
|
934
|
-
const k =
|
|
935
|
-
if (!be(
|
|
936
|
-
if (
|
|
936
|
+
A = l($);
|
|
937
|
+
} catch (S) {
|
|
938
|
+
throw ot(P($)), S;
|
|
939
|
+
}
|
|
940
|
+
const C = (S) => {
|
|
941
|
+
const k = P($);
|
|
942
|
+
if (!be(S)) {
|
|
943
|
+
if (S !== void 0 && !fe(S, $) && (k != null && k.operated))
|
|
937
944
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
938
|
-
const
|
|
939
|
-
if (
|
|
940
|
-
const
|
|
941
|
-
return
|
|
945
|
+
const v = S == null ? void 0 : S[xs];
|
|
946
|
+
if (v) {
|
|
947
|
+
const x = v[0];
|
|
948
|
+
return R.strict && typeof S == "object" && S !== null && ft({
|
|
942
949
|
rootDraft: k,
|
|
943
|
-
value:
|
|
950
|
+
value: S,
|
|
944
951
|
useRawReturn: !0
|
|
945
|
-
}), w([
|
|
952
|
+
}), w([x]);
|
|
946
953
|
}
|
|
947
|
-
if (
|
|
948
|
-
return typeof
|
|
954
|
+
if (S !== void 0)
|
|
955
|
+
return typeof S == "object" && S !== null && ft({ rootDraft: k, value: S }), w([S]);
|
|
949
956
|
}
|
|
950
|
-
if (
|
|
957
|
+
if (S === $ || S === void 0)
|
|
951
958
|
return w([]);
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
954
|
-
if (
|
|
959
|
+
const E = P(S);
|
|
960
|
+
if (R === E.options) {
|
|
961
|
+
if (E.operated)
|
|
955
962
|
throw new Error("Cannot return a modified child draft.");
|
|
956
|
-
return w([Ht(
|
|
963
|
+
return w([Ht(S)]);
|
|
957
964
|
}
|
|
958
|
-
return w([
|
|
965
|
+
return w([S]);
|
|
959
966
|
};
|
|
960
|
-
return A instanceof Promise ? A.then(
|
|
961
|
-
throw ot(
|
|
962
|
-
}) :
|
|
967
|
+
return A instanceof Promise ? A.then(C, (S) => {
|
|
968
|
+
throw ot(P($)), S;
|
|
969
|
+
}) : C(A);
|
|
963
970
|
};
|
|
964
|
-
},
|
|
971
|
+
}, M = Gs();
|
|
965
972
|
Object.prototype.constructor.toString();
|
|
966
|
-
const
|
|
973
|
+
const Js = yt(fetch), ss = async (t, e) => {
|
|
967
974
|
if (!t)
|
|
968
975
|
throw "Metapage definition null";
|
|
969
|
-
if (t.version || (t =
|
|
976
|
+
if (t.version || (t = M(t, (n) => {
|
|
970
977
|
n.version = "0.3";
|
|
971
978
|
})), !e)
|
|
972
979
|
throw 'Missing "version" argument';
|
|
973
|
-
if (
|
|
980
|
+
if (U(e, Le) > 0)
|
|
974
981
|
try {
|
|
975
|
-
return await (await
|
|
982
|
+
return await (await Js(`https://module.metapage.io/conversion/metapage/v${e}`, {
|
|
976
983
|
redirect: "follow",
|
|
977
984
|
retries: 3,
|
|
978
985
|
retryDelay: 1e3,
|
|
@@ -998,22 +1005,22 @@ const Gs = yt(fetch), ss = async (t, e) => {
|
|
|
998
1005
|
for (; s !== e; )
|
|
999
1006
|
switch (s) {
|
|
1000
1007
|
case "0.2": {
|
|
1001
|
-
if (
|
|
1008
|
+
if (U(e, s) > 0)
|
|
1002
1009
|
n = Ks(n), s = he(n.version);
|
|
1003
1010
|
else
|
|
1004
1011
|
throw `Cannot convert from version ${s} to ${e}`;
|
|
1005
1012
|
break;
|
|
1006
1013
|
}
|
|
1007
1014
|
case "0.3": {
|
|
1008
|
-
|
|
1015
|
+
U(e, s) > 0 ? (n = qs(n), s = he(n.version)) : (n = Xs(n), s = he(n.version));
|
|
1009
1016
|
break;
|
|
1010
1017
|
}
|
|
1011
1018
|
case "1": {
|
|
1012
|
-
|
|
1019
|
+
U(e, s) > 0 ? (n = Zs(n), s = he(n.version)) : (n = Qs(n), s = he(n.version));
|
|
1013
1020
|
break;
|
|
1014
1021
|
}
|
|
1015
1022
|
case "2": {
|
|
1016
|
-
if (
|
|
1023
|
+
if (U(e, s) > 0)
|
|
1017
1024
|
throw `Cannot convert from version ${s} to ${e}, 1 is the latest version`;
|
|
1018
1025
|
n = Ys(n), s = he(n.version);
|
|
1019
1026
|
break;
|
|
@@ -1022,29 +1029,29 @@ const Gs = yt(fetch), ss = async (t, e) => {
|
|
|
1022
1029
|
throw `Unknow version ${s} to ${e}`;
|
|
1023
1030
|
}
|
|
1024
1031
|
return n;
|
|
1025
|
-
}, Ks = (t) =>
|
|
1032
|
+
}, Ks = (t) => M(t, (e) => {
|
|
1026
1033
|
e.version = "0.3";
|
|
1027
|
-
}), Xs = (t) =>
|
|
1034
|
+
}), Xs = (t) => M(t, (e) => {
|
|
1028
1035
|
e.version = "0.2";
|
|
1029
|
-
}), qs = (t) =>
|
|
1036
|
+
}), qs = (t) => M(t, (e) => {
|
|
1030
1037
|
const s = e;
|
|
1031
1038
|
delete s.plugins, s.version = "1";
|
|
1032
|
-
}), Qs = (t) =>
|
|
1039
|
+
}), Qs = (t) => M(t, (e) => (e.version = "0.3", e)), Ys = (t) => M(t, (e) => {
|
|
1033
1040
|
var s, n;
|
|
1034
1041
|
return e.version = "1", (s = e == null ? void 0 : e.meta) != null && s.tags && (e.meta.keywords = e.meta.tags, delete e.meta.tags), (n = e == null ? void 0 : e.meta) != null && n.authors && (e.meta.author = e.meta.authors[0], delete e.meta.authors), e;
|
|
1035
|
-
}), Zs = (t) =>
|
|
1042
|
+
}), Zs = (t) => M(t, (e) => {
|
|
1036
1043
|
var s, n;
|
|
1037
1044
|
return e.version = "2", (s = e == null ? void 0 : e.meta) != null && s.keywords && (e.meta.tags = e.meta.keywords, delete e.meta.keywords), (n = e == null ? void 0 : e.meta) != null && n.author && (e.meta.authors = [e.meta.author], delete e.meta.author), e;
|
|
1038
1045
|
}), he = (t) => {
|
|
1039
1046
|
if (t === "latest")
|
|
1040
1047
|
return Le;
|
|
1041
|
-
if (
|
|
1048
|
+
if (U(t, "0.2") < 0)
|
|
1042
1049
|
throw `Unknown version: ${t}`;
|
|
1043
|
-
if (
|
|
1050
|
+
if (U(t, "0.2") <= 0 && U(t, "0.3") < 0)
|
|
1044
1051
|
return "0.2";
|
|
1045
|
-
if (
|
|
1052
|
+
if (U(t, "0.3") <= 0)
|
|
1046
1053
|
return "0.3";
|
|
1047
|
-
if (
|
|
1054
|
+
if (U(t, "1") <= 0)
|
|
1048
1055
|
return "1";
|
|
1049
1056
|
if (t === "2")
|
|
1050
1057
|
return "2";
|
|
@@ -1056,7 +1063,7 @@ const Gs = yt(fetch), ss = async (t, e) => {
|
|
|
1056
1063
|
throw `Missing "version" key in metaframe definition: ${JSON.stringify(t)}`;
|
|
1057
1064
|
if (!e)
|
|
1058
1065
|
throw 'Missing "version" argument';
|
|
1059
|
-
if (
|
|
1066
|
+
if (U(e, We) > 0)
|
|
1060
1067
|
try {
|
|
1061
1068
|
return await (await en(`https://module.metapage.io/conversion/metaframe/v${e}`, {
|
|
1062
1069
|
redirect: "follow",
|
|
@@ -1075,7 +1082,7 @@ const Gs = yt(fetch), ss = async (t, e) => {
|
|
|
1075
1082
|
}, tn = async (t) => ns(t, We), sn = (t, e) => {
|
|
1076
1083
|
if (!t)
|
|
1077
1084
|
throw "Metaframe definition null";
|
|
1078
|
-
t.version || (t =
|
|
1085
|
+
t.version || (t = M(t, (i) => {
|
|
1079
1086
|
i.version = "0.3";
|
|
1080
1087
|
}));
|
|
1081
1088
|
let s = te(t.version);
|
|
@@ -1085,30 +1092,30 @@ const Gs = yt(fetch), ss = async (t, e) => {
|
|
|
1085
1092
|
for (; s !== e; )
|
|
1086
1093
|
switch (s) {
|
|
1087
1094
|
case "0.3": {
|
|
1088
|
-
if (
|
|
1095
|
+
if (U(e, s) > 0)
|
|
1089
1096
|
n = rn(n), s = te(n.version);
|
|
1090
1097
|
else
|
|
1091
1098
|
throw `Cannot convert from version ${s} to ${e}`;
|
|
1092
1099
|
break;
|
|
1093
1100
|
}
|
|
1094
1101
|
case "0.4": {
|
|
1095
|
-
|
|
1102
|
+
U(e, s) > 0 ? (n = on(n), s = te(n.version)) : (n = nn(n), s = te(n.version));
|
|
1096
1103
|
break;
|
|
1097
1104
|
}
|
|
1098
1105
|
case "0.5": {
|
|
1099
|
-
|
|
1106
|
+
U(e, s) > 0 ? (n = pn(n), s = te(n.version)) : (n = an(n), s = te(n.version));
|
|
1100
1107
|
break;
|
|
1101
1108
|
}
|
|
1102
1109
|
case "0.6": {
|
|
1103
|
-
|
|
1110
|
+
U(e, s) > 0 ? (n = un(n), s = te(n.version)) : (n = hn(n), s = te(n.version));
|
|
1104
1111
|
break;
|
|
1105
1112
|
}
|
|
1106
1113
|
case "1": {
|
|
1107
|
-
|
|
1114
|
+
U(e, s) > 0 ? (n = fn(n), s = te(n.version)) : (n = cn(n), s = te(n.version));
|
|
1108
1115
|
break;
|
|
1109
1116
|
}
|
|
1110
1117
|
case "2": {
|
|
1111
|
-
if (
|
|
1118
|
+
if (U(e, s) > 0)
|
|
1112
1119
|
throw `Cannot convert from version ${s} to ${e}`;
|
|
1113
1120
|
n = ln(n), s = te(n.version);
|
|
1114
1121
|
break;
|
|
@@ -1120,11 +1127,11 @@ const Gs = yt(fetch), ss = async (t, e) => {
|
|
|
1120
1127
|
}, pt = async (t, e) => {
|
|
1121
1128
|
if (t)
|
|
1122
1129
|
return tn(t);
|
|
1123
|
-
}, nn = (t) =>
|
|
1130
|
+
}, nn = (t) => M(t, (e) => {
|
|
1124
1131
|
e.version = "0.3", delete e.allow;
|
|
1125
|
-
}), rn = (t) =>
|
|
1132
|
+
}), rn = (t) => M(t, (e) => {
|
|
1126
1133
|
e.version = "0.4";
|
|
1127
|
-
}), on = (t) =>
|
|
1134
|
+
}), on = (t) => M(t, (e) => {
|
|
1128
1135
|
if (e.version = "0.5", !(e != null && e.metadata))
|
|
1129
1136
|
return;
|
|
1130
1137
|
const s = e.metadata.title;
|
|
@@ -1133,7 +1140,7 @@ const Gs = yt(fetch), ss = async (t, e) => {
|
|
|
1133
1140
|
delete e.metadata.descriptionUrl, e.metadata.description = n;
|
|
1134
1141
|
const i = e.metadata.keywords;
|
|
1135
1142
|
delete e.metadata.keywords, e.metadata.tags = i;
|
|
1136
|
-
}), an = (t) =>
|
|
1143
|
+
}), an = (t) => M(t, (e) => {
|
|
1137
1144
|
if (e.version = "0.4", !(e != null && e.metadata))
|
|
1138
1145
|
return;
|
|
1139
1146
|
const s = e.metadata.name;
|
|
@@ -1142,40 +1149,40 @@ const Gs = yt(fetch), ss = async (t, e) => {
|
|
|
1142
1149
|
delete e.metadata.description, e.metadata.descriptionUrl = n;
|
|
1143
1150
|
const i = e.metadata.tags;
|
|
1144
1151
|
delete e.metadata.tags, e.metadata.keywords = i;
|
|
1145
|
-
}), un = (t) =>
|
|
1152
|
+
}), un = (t) => M(t, (e) => {
|
|
1146
1153
|
var s;
|
|
1147
1154
|
e.version = "1", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
|
|
1148
|
-
}), cn = (t) =>
|
|
1155
|
+
}), cn = (t) => M(t, (e) => {
|
|
1149
1156
|
var s;
|
|
1150
1157
|
e.version = "0.6", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
|
|
1151
|
-
}), ln = (t) =>
|
|
1158
|
+
}), ln = (t) => M(t, (e) => {
|
|
1152
1159
|
var s, n;
|
|
1153
1160
|
return e.version = "1", (s = e == null ? void 0 : e.metadata) != null && s.authors && (e.metadata.author = (n = e == null ? void 0 : e.metadata) == null ? void 0 : n.authors[0], delete e.metadata.authors), e;
|
|
1154
|
-
}), fn = (t) =>
|
|
1161
|
+
}), fn = (t) => M(t, (e) => {
|
|
1155
1162
|
var s;
|
|
1156
1163
|
return e.version = "2", (s = e == null ? void 0 : e.metadata) != null && s.author && (e.metadata.authors = [
|
|
1157
1164
|
e.metadata.author
|
|
1158
1165
|
], delete e.metadata.author), e;
|
|
1159
|
-
}), pn = (t) =>
|
|
1166
|
+
}), pn = (t) => M(t, (e) => {
|
|
1160
1167
|
var s;
|
|
1161
1168
|
e.version = "0.6", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
|
|
1162
|
-
}), hn = (t) =>
|
|
1169
|
+
}), hn = (t) => M(t, (e) => {
|
|
1163
1170
|
var s;
|
|
1164
1171
|
e.version = "0.5", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
|
|
1165
1172
|
}), te = (t) => {
|
|
1166
1173
|
if (t === "latest")
|
|
1167
1174
|
return We;
|
|
1168
|
-
if (
|
|
1175
|
+
if (U(t, "0.3") < 0)
|
|
1169
1176
|
throw `Unknown version: ${t}`;
|
|
1170
|
-
if (
|
|
1177
|
+
if (U(t, "0.3") <= 0)
|
|
1171
1178
|
return "0.3";
|
|
1172
|
-
if (
|
|
1179
|
+
if (U(t, "0.4") <= 0)
|
|
1173
1180
|
return "0.4";
|
|
1174
|
-
if (
|
|
1181
|
+
if (U(t, "0.5") <= 0)
|
|
1175
1182
|
return "0.5";
|
|
1176
|
-
if (
|
|
1183
|
+
if (U(t, "0.6") <= 0)
|
|
1177
1184
|
return "0.6";
|
|
1178
|
-
if (
|
|
1185
|
+
if (U(t, "1") <= 0)
|
|
1179
1186
|
return "1";
|
|
1180
1187
|
if (t === "2")
|
|
1181
1188
|
return "2";
|
|
@@ -1197,17 +1204,17 @@ var Ue = function(t) {
|
|
|
1197
1204
|
o = Ee[t.charCodeAt(n)], r = Ee[t.charCodeAt(n + 1)], a = Ee[t.charCodeAt(n + 2)], u = Ee[t.charCodeAt(n + 3)], c[i++] = o << 2 | r >> 4, c[i++] = (r & 15) << 4 | a >> 2, c[i++] = (a & 3) << 6 | u & 63;
|
|
1198
1205
|
return l;
|
|
1199
1206
|
};
|
|
1200
|
-
const Ke = async (t) =>
|
|
1207
|
+
const Ke = async (t) => M(t, async (e) => {
|
|
1201
1208
|
for (const s of Object.keys(t)) {
|
|
1202
1209
|
const n = await dn(t[s]);
|
|
1203
1210
|
return e[s] = n, e;
|
|
1204
1211
|
}
|
|
1205
|
-
}), Ce = async (t) =>
|
|
1212
|
+
}), Ce = async (t) => M(t, async (e) => {
|
|
1206
1213
|
for (const s of Object.keys(t)) {
|
|
1207
1214
|
const n = await is(t[s]);
|
|
1208
1215
|
return e[s] = n, e;
|
|
1209
1216
|
}
|
|
1210
|
-
}),
|
|
1217
|
+
}), xi = async (t, e, s) => {
|
|
1211
1218
|
if (t = is(t), s = s || {}, s.type || (s.type = "application/octet-stream"), t instanceof ArrayBuffer)
|
|
1212
1219
|
return new File([t], e, s);
|
|
1213
1220
|
if (t instanceof File || t instanceof Blob) {
|
|
@@ -1294,7 +1301,7 @@ const Ke = async (t) => C(t, async (e) => {
|
|
|
1294
1301
|
} catch {
|
|
1295
1302
|
}
|
|
1296
1303
|
return t;
|
|
1297
|
-
},
|
|
1304
|
+
}, Li = (t) => {
|
|
1298
1305
|
if (!(t && typeof t == "object" && t._s === !0))
|
|
1299
1306
|
return;
|
|
1300
1307
|
const e = t, s = e._c;
|
|
@@ -1326,20 +1333,20 @@ const Ke = async (t) => C(t, async (e) => {
|
|
|
1326
1333
|
} catch {
|
|
1327
1334
|
}
|
|
1328
1335
|
};
|
|
1329
|
-
var
|
|
1336
|
+
var I;
|
|
1330
1337
|
(function(t) {
|
|
1331
1338
|
t.Inputs = "inputs", t.Outputs = "outputs", t.State = "state", t.Definition = "definition", t.Error = "error", t.Warning = "warning", t.UrlHashUpdate = "urlhashupdate", t.Message = "Message";
|
|
1332
|
-
})(
|
|
1333
|
-
var
|
|
1339
|
+
})(I || (I = {}));
|
|
1340
|
+
var K;
|
|
1334
1341
|
(function(t) {
|
|
1335
1342
|
t.InputsUpdate = "InputsUpdate", t.OutputsUpdate = "OutputsUpdate", t.SetupIframeClientRequest = "SetupIframeClientRequest", t.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", t.HashParamsUpdate = "HashParamsUpdate";
|
|
1336
|
-
})(
|
|
1343
|
+
})(K || (K = {}));
|
|
1337
1344
|
var me;
|
|
1338
1345
|
(function(t) {
|
|
1339
1346
|
t.InputsUpdate = "InputsUpdate", t.MessageAck = "MessageAck", t.SetupIframeServerResponse = "SetupIframeServerResponse";
|
|
1340
1347
|
})(me || (me = {}));
|
|
1341
|
-
const
|
|
1342
|
-
function
|
|
1348
|
+
const Pi = -32700, Ti = -32600, Di = -32601, Ni = -32602, ki = -32603;
|
|
1349
|
+
function Hi(t) {
|
|
1343
1350
|
switch (typeof t) {
|
|
1344
1351
|
case "string":
|
|
1345
1352
|
return !0;
|
|
@@ -1360,11 +1367,11 @@ var rs = { exports: {} };
|
|
|
1360
1367
|
function i(u, l, c) {
|
|
1361
1368
|
this.fn = u, this.context = l, this.once = c || !1;
|
|
1362
1369
|
}
|
|
1363
|
-
function o(u, l, c,
|
|
1370
|
+
function o(u, l, c, p, m) {
|
|
1364
1371
|
if (typeof c != "function")
|
|
1365
1372
|
throw new TypeError("The listener must be a function");
|
|
1366
|
-
var
|
|
1367
|
-
return u._events[
|
|
1373
|
+
var _ = new i(c, p || u, m), y = s ? s + l : l;
|
|
1374
|
+
return u._events[y] ? u._events[y].fn ? u._events[y] = [u._events[y], _] : u._events[y].push(_) : (u._events[y] = _, u._eventsCount++), u;
|
|
1368
1375
|
}
|
|
1369
1376
|
function r(u, l) {
|
|
1370
1377
|
--u._eventsCount === 0 ? u._events = new n() : delete u._events[l];
|
|
@@ -1373,88 +1380,88 @@ var rs = { exports: {} };
|
|
|
1373
1380
|
this._events = new n(), this._eventsCount = 0;
|
|
1374
1381
|
}
|
|
1375
1382
|
a.prototype.eventNames = function() {
|
|
1376
|
-
var l = [], c,
|
|
1383
|
+
var l = [], c, p;
|
|
1377
1384
|
if (this._eventsCount === 0)
|
|
1378
1385
|
return l;
|
|
1379
|
-
for (
|
|
1380
|
-
e.call(c,
|
|
1386
|
+
for (p in c = this._events)
|
|
1387
|
+
e.call(c, p) && l.push(s ? p.slice(1) : p);
|
|
1381
1388
|
return Object.getOwnPropertySymbols ? l.concat(Object.getOwnPropertySymbols(c)) : l;
|
|
1382
1389
|
}, a.prototype.listeners = function(l) {
|
|
1383
|
-
var c = s ? s + l : l,
|
|
1384
|
-
if (!
|
|
1390
|
+
var c = s ? s + l : l, p = this._events[c];
|
|
1391
|
+
if (!p)
|
|
1385
1392
|
return [];
|
|
1386
|
-
if (
|
|
1387
|
-
return [
|
|
1388
|
-
for (var
|
|
1389
|
-
m
|
|
1390
|
-
return
|
|
1393
|
+
if (p.fn)
|
|
1394
|
+
return [p.fn];
|
|
1395
|
+
for (var m = 0, _ = p.length, y = new Array(_); m < _; m++)
|
|
1396
|
+
y[m] = p[m].fn;
|
|
1397
|
+
return y;
|
|
1391
1398
|
}, a.prototype.listenerCount = function(l) {
|
|
1392
|
-
var c = s ? s + l : l,
|
|
1393
|
-
return
|
|
1394
|
-
}, a.prototype.emit = function(l, c,
|
|
1395
|
-
var
|
|
1396
|
-
if (!this._events[
|
|
1399
|
+
var c = s ? s + l : l, p = this._events[c];
|
|
1400
|
+
return p ? p.fn ? 1 : p.length : 0;
|
|
1401
|
+
}, a.prototype.emit = function(l, c, p, m, _, y) {
|
|
1402
|
+
var O = s ? s + l : l;
|
|
1403
|
+
if (!this._events[O])
|
|
1397
1404
|
return !1;
|
|
1398
|
-
var
|
|
1399
|
-
if (
|
|
1400
|
-
switch (
|
|
1405
|
+
var R = this._events[O], $ = arguments.length, w, A;
|
|
1406
|
+
if (R.fn) {
|
|
1407
|
+
switch (R.once && this.removeListener(l, R.fn, void 0, !0), $) {
|
|
1401
1408
|
case 1:
|
|
1402
|
-
return
|
|
1409
|
+
return R.fn.call(R.context), !0;
|
|
1403
1410
|
case 2:
|
|
1404
|
-
return
|
|
1411
|
+
return R.fn.call(R.context, c), !0;
|
|
1405
1412
|
case 3:
|
|
1406
|
-
return
|
|
1413
|
+
return R.fn.call(R.context, c, p), !0;
|
|
1407
1414
|
case 4:
|
|
1408
|
-
return
|
|
1415
|
+
return R.fn.call(R.context, c, p, m), !0;
|
|
1409
1416
|
case 5:
|
|
1410
|
-
return
|
|
1417
|
+
return R.fn.call(R.context, c, p, m, _), !0;
|
|
1411
1418
|
case 6:
|
|
1412
|
-
return
|
|
1419
|
+
return R.fn.call(R.context, c, p, m, _, y), !0;
|
|
1413
1420
|
}
|
|
1414
|
-
for (A = 1, w = new Array(
|
|
1421
|
+
for (A = 1, w = new Array($ - 1); A < $; A++)
|
|
1415
1422
|
w[A - 1] = arguments[A];
|
|
1416
|
-
|
|
1423
|
+
R.fn.apply(R.context, w);
|
|
1417
1424
|
} else {
|
|
1418
|
-
var
|
|
1419
|
-
for (A = 0; A <
|
|
1420
|
-
switch (
|
|
1425
|
+
var C = R.length, S;
|
|
1426
|
+
for (A = 0; A < C; A++)
|
|
1427
|
+
switch (R[A].once && this.removeListener(l, R[A].fn, void 0, !0), $) {
|
|
1421
1428
|
case 1:
|
|
1422
|
-
|
|
1429
|
+
R[A].fn.call(R[A].context);
|
|
1423
1430
|
break;
|
|
1424
1431
|
case 2:
|
|
1425
|
-
|
|
1432
|
+
R[A].fn.call(R[A].context, c);
|
|
1426
1433
|
break;
|
|
1427
1434
|
case 3:
|
|
1428
|
-
|
|
1435
|
+
R[A].fn.call(R[A].context, c, p);
|
|
1429
1436
|
break;
|
|
1430
1437
|
case 4:
|
|
1431
|
-
|
|
1438
|
+
R[A].fn.call(R[A].context, c, p, m);
|
|
1432
1439
|
break;
|
|
1433
1440
|
default:
|
|
1434
1441
|
if (!w)
|
|
1435
|
-
for (
|
|
1436
|
-
w[
|
|
1437
|
-
|
|
1442
|
+
for (S = 1, w = new Array($ - 1); S < $; S++)
|
|
1443
|
+
w[S - 1] = arguments[S];
|
|
1444
|
+
R[A].fn.apply(R[A].context, w);
|
|
1438
1445
|
}
|
|
1439
1446
|
}
|
|
1440
1447
|
return !0;
|
|
1441
|
-
}, a.prototype.on = function(l, c,
|
|
1442
|
-
return o(this, l, c,
|
|
1443
|
-
}, a.prototype.once = function(l, c,
|
|
1444
|
-
return o(this, l, c,
|
|
1445
|
-
}, a.prototype.removeListener = function(l, c,
|
|
1446
|
-
var
|
|
1447
|
-
if (!this._events[
|
|
1448
|
+
}, a.prototype.on = function(l, c, p) {
|
|
1449
|
+
return o(this, l, c, p, !1);
|
|
1450
|
+
}, a.prototype.once = function(l, c, p) {
|
|
1451
|
+
return o(this, l, c, p, !0);
|
|
1452
|
+
}, a.prototype.removeListener = function(l, c, p, m) {
|
|
1453
|
+
var _ = s ? s + l : l;
|
|
1454
|
+
if (!this._events[_])
|
|
1448
1455
|
return this;
|
|
1449
1456
|
if (!c)
|
|
1450
|
-
return r(this,
|
|
1451
|
-
var
|
|
1452
|
-
if (
|
|
1453
|
-
|
|
1457
|
+
return r(this, _), this;
|
|
1458
|
+
var y = this._events[_];
|
|
1459
|
+
if (y.fn)
|
|
1460
|
+
y.fn === c && (!m || y.once) && (!p || y.context === p) && r(this, _);
|
|
1454
1461
|
else {
|
|
1455
|
-
for (var
|
|
1456
|
-
(
|
|
1457
|
-
|
|
1462
|
+
for (var O = 0, R = [], $ = y.length; O < $; O++)
|
|
1463
|
+
(y[O].fn !== c || m && !y[O].once || p && y[O].context !== p) && R.push(y[O]);
|
|
1464
|
+
R.length ? this._events[_] = R.length === 1 ? R[0] : R : r(this, _);
|
|
1458
1465
|
}
|
|
1459
1466
|
return this;
|
|
1460
1467
|
}, a.prototype.removeAllListeners = function(l) {
|
|
@@ -1497,8 +1504,8 @@ var yn = function(t, e) {
|
|
|
1497
1504
|
}
|
|
1498
1505
|
var l = i.push(r) - 1, c = Object.keys(r).sort(n && n(r));
|
|
1499
1506
|
for (u = "", a = 0; a < c.length; a++) {
|
|
1500
|
-
var
|
|
1501
|
-
|
|
1507
|
+
var p = c[a], m = o(r[p]);
|
|
1508
|
+
m && (u && (u += ","), u += JSON.stringify(p) + ":" + m);
|
|
1502
1509
|
}
|
|
1503
1510
|
return i.splice(l, 1), "{" + u + "}";
|
|
1504
1511
|
}
|
|
@@ -1506,19 +1513,13 @@ var yn = function(t, e) {
|
|
|
1506
1513
|
};
|
|
1507
1514
|
const gn = /* @__PURE__ */ mn(yn), _n = (t) => os(gn(t)), bn = (t) => {
|
|
1508
1515
|
if (t && t.length > 0)
|
|
1509
|
-
|
|
1510
|
-
return JSON.parse(as(t));
|
|
1511
|
-
} catch {
|
|
1512
|
-
return JSON.parse(decodeURIComponent(atob(decodeURIComponent(t))));
|
|
1513
|
-
}
|
|
1516
|
+
return JSON.parse(as(t));
|
|
1514
1517
|
}, os = (t) => btoa(encodeURIComponent(t)), as = (t) => {
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
return decodeURIComponent(atob(decodeURIComponent(t)));
|
|
1519
|
-
}
|
|
1518
|
+
for (; t.endsWith("%3D"); )
|
|
1519
|
+
t = t.slice(0, -3);
|
|
1520
|
+
return decodeURIComponent(atob(t));
|
|
1520
1521
|
}, us = (t) => {
|
|
1521
|
-
const e =
|
|
1522
|
+
const e = new URL(t);
|
|
1522
1523
|
return cs(e.hash);
|
|
1523
1524
|
}, cs = (t) => {
|
|
1524
1525
|
let e = t;
|
|
@@ -1539,12 +1540,16 @@ const gn = /* @__PURE__ */ mn(yn), _n = (t) => os(gn(t)), bn = (t) => {
|
|
|
1539
1540
|
}).forEach(([o, r]) => {
|
|
1540
1541
|
i[o] = r;
|
|
1541
1542
|
}), Object.keys(i).forEach((o) => {
|
|
1542
|
-
|
|
1543
|
+
try {
|
|
1544
|
+
i[o] = decodeURIComponent(i[o]);
|
|
1545
|
+
} catch {
|
|
1546
|
+
i[o] = i[o];
|
|
1547
|
+
}
|
|
1543
1548
|
}), [n, i];
|
|
1544
1549
|
}, Te = (t, e) => {
|
|
1545
1550
|
const [s, n] = us(t);
|
|
1546
1551
|
return n[e];
|
|
1547
|
-
},
|
|
1552
|
+
}, vn = (t) => wn()[1][t], wn = () => us(window.location.href), Se = (t, e, s) => {
|
|
1548
1553
|
const n = window.location.hash.startsWith("#") ? window.location.hash.substring(1) : window.location.hash, i = On(n, t, e);
|
|
1549
1554
|
i !== n && (s != null && s.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"))));
|
|
1550
1555
|
}, On = (t, e, s) => {
|
|
@@ -1554,11 +1559,8 @@ const gn = /* @__PURE__ */ mn(yn), _n = (t) => os(gn(t)), bn = (t) => {
|
|
|
1554
1559
|
return t;
|
|
1555
1560
|
const r = Object.keys(i);
|
|
1556
1561
|
r.sort();
|
|
1557
|
-
const a = r.map((u, l) => {
|
|
1558
|
-
|
|
1559
|
-
return /^[A-Za-z0-9+/]+={0,2}$/.test(c) && c.length % 4, `${u}=${c}`;
|
|
1560
|
-
}).join("&");
|
|
1561
|
-
return !n && !a ? "" : `${n || ""}${a ? "?" + a : ""}`;
|
|
1562
|
+
const a = r.map((u, l) => `${u}=${encodeURIComponent(i[u])}`).join("&");
|
|
1563
|
+
return `${n}?${a}`;
|
|
1562
1564
|
}, Rt = (t, e) => {
|
|
1563
1565
|
const s = Te(t, e);
|
|
1564
1566
|
if (s && s !== "")
|
|
@@ -1616,8 +1618,8 @@ var Nn = function(t, e) {
|
|
|
1616
1618
|
}
|
|
1617
1619
|
var l = i.push(r) - 1, c = Object.keys(r).sort(n && n(r));
|
|
1618
1620
|
for (u = "", a = 0; a < c.length; a++) {
|
|
1619
|
-
var
|
|
1620
|
-
|
|
1621
|
+
var p = c[a], m = o(r[p]);
|
|
1622
|
+
m && (u && (u += ","), u += JSON.stringify(p) + ":" + m);
|
|
1621
1623
|
}
|
|
1622
1624
|
return i.splice(l, 1), "{" + u + "}";
|
|
1623
1625
|
}
|
|
@@ -1649,14 +1651,14 @@ class Hn extends Ot.EventEmitter {
|
|
|
1649
1651
|
return this._definition;
|
|
1650
1652
|
}
|
|
1651
1653
|
}
|
|
1652
|
-
const
|
|
1654
|
+
const Ge = (t, e) => e ? M(t, (s) => {
|
|
1653
1655
|
Object.keys(e).forEach((n) => {
|
|
1654
1656
|
e[n] === void 0 ? delete s[n] : s[n] = e[n];
|
|
1655
1657
|
});
|
|
1656
|
-
}) : t,
|
|
1658
|
+
}) : t, ji = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, Ui = () => new URLSearchParams(window.location.search).has(xe.mp_debug), ht = () => {
|
|
1657
1659
|
const t = new URLSearchParams(window.location.search).get(xe.mp_debug);
|
|
1658
1660
|
return t === "true" || t === "1";
|
|
1659
|
-
},
|
|
1661
|
+
}, Bi = (t = 8) => St(t), jn = (t = 8) => St(t), Fi = (t = 8) => St(t), jt = "abcdefghijklmnopqrstuvwxyz0123456789", St = (t = 8) => {
|
|
1660
1662
|
for (var e = "", s = jt.length, n = 0; n < t; n++)
|
|
1661
1663
|
e += jt.charAt(Math.floor(Math.random() * s));
|
|
1662
1664
|
return e;
|
|
@@ -1687,10 +1689,10 @@ const Je = (t, e) => e ? C(t, (s) => {
|
|
|
1687
1689
|
}), setTimeout(() => {
|
|
1688
1690
|
!e && tt() && (e = !0, t());
|
|
1689
1691
|
}, 200);
|
|
1690
|
-
}),
|
|
1692
|
+
}), zi = async (t) => {
|
|
1691
1693
|
const e = fs(t);
|
|
1692
1694
|
return await ds(e);
|
|
1693
|
-
},
|
|
1695
|
+
}, Gi = async (t) => {
|
|
1694
1696
|
const e = fs({
|
|
1695
1697
|
version: t.version,
|
|
1696
1698
|
metaframes: t.metaframes
|
|
@@ -1705,10 +1707,10 @@ var ae;
|
|
|
1705
1707
|
(function(t) {
|
|
1706
1708
|
t.WaitingForPageLoad = "WaitingForPageLoad", t.SentSetupIframeClientRequest = "SentSetupIframeClientRequest", t.Ready = "Ready";
|
|
1707
1709
|
})(ae || (ae = {}));
|
|
1708
|
-
var
|
|
1710
|
+
var F;
|
|
1709
1711
|
(function(t) {
|
|
1710
1712
|
t.Connected = "connected", t.Error = "error", t.Input = "input", t.Inputs = "inputs", t.Message = "message";
|
|
1711
|
-
})(
|
|
1713
|
+
})(F || (F = {}));
|
|
1712
1714
|
class ie extends Ot.EventEmitter {
|
|
1713
1715
|
constructor(e) {
|
|
1714
1716
|
if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = ae.WaitingForPageLoad, this._messageSendCount = 0, this.debug = ht(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = ht(), this._isIframe = kn(), 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) {
|
|
@@ -1717,7 +1719,7 @@ class ie extends Ot.EventEmitter {
|
|
|
1717
1719
|
}
|
|
1718
1720
|
const s = this;
|
|
1719
1721
|
Xe().then(() => {
|
|
1720
|
-
this.log("pageLoaded"), window.addEventListener("message", this.onMessage), s.sendRpc(
|
|
1722
|
+
this.log("pageLoaded"), window.addEventListener("message", this.onMessage), s.sendRpc(K.SetupIframeClientRequest, {
|
|
1721
1723
|
version: ie.version
|
|
1722
1724
|
}), s._state = ae.SentSetupIframeClientRequest;
|
|
1723
1725
|
}), e && e.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
|
|
@@ -1725,9 +1727,9 @@ class ie extends Ot.EventEmitter {
|
|
|
1725
1727
|
_resolveSetupIframeServerResponse(e) {
|
|
1726
1728
|
if (this._state === ae.WaitingForPageLoad)
|
|
1727
1729
|
throw "Got message but page has not finished loading, we should never get in this state";
|
|
1728
|
-
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = hs(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 = ae.Ready, this.sendRpc(
|
|
1730
|
+
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = hs(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 = ae.Ready, this.sendRpc(K.SetupIframeServerResponseAck, {
|
|
1729
1731
|
version: ie.version
|
|
1730
|
-
}), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(
|
|
1732
|
+
}), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(F.Inputs, this._inputPipeValues), this.listenerCount(F.Input) > 0 && Object.keys(this._inputPipeValues).forEach((s) => this.emit(F.Input, s, this._inputPipeValues[s]))), this.emit(F.Connected), this.sendRpc(K.OutputsUpdate, this._outputPipeValues)))();
|
|
1731
1733
|
}
|
|
1732
1734
|
isConnected() {
|
|
1733
1735
|
return this._state === ae.Ready;
|
|
@@ -1739,7 +1741,7 @@ class ie extends Ot.EventEmitter {
|
|
|
1739
1741
|
return;
|
|
1740
1742
|
}
|
|
1741
1743
|
let n;
|
|
1742
|
-
n = this.addListenerReturnDisposer(
|
|
1744
|
+
n = this.addListenerReturnDisposer(F.Connected, () => {
|
|
1743
1745
|
e(), n();
|
|
1744
1746
|
});
|
|
1745
1747
|
});
|
|
@@ -1766,40 +1768,40 @@ class ie extends Ot.EventEmitter {
|
|
|
1766
1768
|
super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this.disableNotifyOnHashUrlChange(), this._inputPipeValues = void 0, this._outputPipeValues = void 0;
|
|
1767
1769
|
}
|
|
1768
1770
|
addListener(e, s) {
|
|
1769
|
-
return super.addListener(e, s), e ===
|
|
1771
|
+
return super.addListener(e, s), e === F.Inputs && window.setTimeout(() => {
|
|
1770
1772
|
this._inputPipeValues && s(this._inputPipeValues);
|
|
1771
1773
|
}, 0), this;
|
|
1772
1774
|
}
|
|
1773
1775
|
onInput(e, s) {
|
|
1774
|
-
return this.addListenerReturnDisposer(
|
|
1776
|
+
return this.addListenerReturnDisposer(F.Input, (n, i) => {
|
|
1775
1777
|
e === n && s(i);
|
|
1776
1778
|
});
|
|
1777
1779
|
}
|
|
1778
1780
|
onInputs(e) {
|
|
1779
|
-
return this.addListenerReturnDisposer(
|
|
1781
|
+
return this.addListenerReturnDisposer(F.Inputs, e);
|
|
1780
1782
|
}
|
|
1781
1783
|
setInput(e, s) {
|
|
1782
1784
|
var n = {};
|
|
1783
1785
|
n[e] = s, this.setInputs(n);
|
|
1784
1786
|
}
|
|
1785
1787
|
async setInputs(e) {
|
|
1786
|
-
this.isInputOutputBlobSerialization && (e = await Ce(e)), this.sendRpc(
|
|
1788
|
+
this.isInputOutputBlobSerialization && (e = await Ce(e)), this.sendRpc(K.InputsUpdate, e);
|
|
1787
1789
|
}
|
|
1788
1790
|
async setInternalInputsAndNotify(e) {
|
|
1789
1791
|
this.isInputOutputBlobSerialization && (e = await Ce(e));
|
|
1790
1792
|
const s = e;
|
|
1791
|
-
if (this._inputPipeValues =
|
|
1793
|
+
if (this._inputPipeValues = Ge(this._inputPipeValues, e), this._inputPipeValues !== s) {
|
|
1792
1794
|
Object.keys(e).forEach((n) => {
|
|
1793
1795
|
try {
|
|
1794
|
-
this.emit(
|
|
1796
|
+
this.emit(F.Input, n, e[n]);
|
|
1795
1797
|
} catch (i) {
|
|
1796
|
-
console.error(`Error emitting input ${n}: ${i}`), this.emit(
|
|
1798
|
+
console.error(`Error emitting input ${n}: ${i}`), this.emit(F.Error, `Error emitting input ${n}: ${i}`);
|
|
1797
1799
|
}
|
|
1798
1800
|
});
|
|
1799
1801
|
try {
|
|
1800
|
-
this.emit(
|
|
1802
|
+
this.emit(F.Inputs, e);
|
|
1801
1803
|
} catch (n) {
|
|
1802
|
-
console.error(`Error emitting inputs: ${n}`), this.emit(
|
|
1804
|
+
console.error(`Error emitting inputs: ${n}`), this.emit(F.Error, `Error emitting inputs: ${n}`);
|
|
1803
1805
|
}
|
|
1804
1806
|
}
|
|
1805
1807
|
}
|
|
@@ -1817,7 +1819,7 @@ class ie extends Ot.EventEmitter {
|
|
|
1817
1819
|
async setOutputs(e) {
|
|
1818
1820
|
this.isInputOutputBlobSerialization && (e = await Ke(e));
|
|
1819
1821
|
const s = e;
|
|
1820
|
-
this._outputPipeValues =
|
|
1822
|
+
this._outputPipeValues = Ge(this._outputPipeValues, e), this._outputPipeValues !== s && this._state === ae.Ready && this.sendRpc(K.OutputsUpdate, e);
|
|
1821
1823
|
}
|
|
1822
1824
|
disableNotifyOnHashUrlChange() {
|
|
1823
1825
|
window.removeEventListener("hashchange", this._onHashUrlChange);
|
|
@@ -1827,7 +1829,7 @@ class ie extends Ot.EventEmitter {
|
|
|
1827
1829
|
hash: window.location.hash,
|
|
1828
1830
|
metaframe: this.id
|
|
1829
1831
|
};
|
|
1830
|
-
this.sendRpc(
|
|
1832
|
+
this.sendRpc(K.HashParamsUpdate, s);
|
|
1831
1833
|
}
|
|
1832
1834
|
sendRpc(e, s) {
|
|
1833
1835
|
if (this._isIframe) {
|
|
@@ -1868,7 +1870,7 @@ class ie extends Ot.EventEmitter {
|
|
|
1868
1870
|
this.debug && this.log(`window.message: unknown JSON-RPC method: ${JSON.stringify(n)}`);
|
|
1869
1871
|
break;
|
|
1870
1872
|
}
|
|
1871
|
-
this.listenerCount(
|
|
1873
|
+
this.listenerCount(F.Message) > 0 && this.emit(F.Message, n);
|
|
1872
1874
|
}
|
|
1873
1875
|
}
|
|
1874
1876
|
}
|
|
@@ -1876,7 +1878,7 @@ class ie extends Ot.EventEmitter {
|
|
|
1876
1878
|
Se(e, s);
|
|
1877
1879
|
}
|
|
1878
1880
|
getParameter(e) {
|
|
1879
|
-
return
|
|
1881
|
+
return vn(e);
|
|
1880
1882
|
}
|
|
1881
1883
|
setParameterBoolean(e, s) {
|
|
1882
1884
|
xn(e, s);
|
|
@@ -1913,24 +1915,24 @@ class ie extends Ot.EventEmitter {
|
|
|
1913
1915
|
}
|
|
1914
1916
|
}
|
|
1915
1917
|
ie.version = As;
|
|
1916
|
-
ie.ERROR =
|
|
1917
|
-
ie.CONNECTED =
|
|
1918
|
-
ie.INPUT =
|
|
1919
|
-
ie.INPUTS =
|
|
1920
|
-
ie.MESSAGE =
|
|
1918
|
+
ie.ERROR = F.Error;
|
|
1919
|
+
ie.CONNECTED = F.Connected;
|
|
1920
|
+
ie.INPUT = F.Input;
|
|
1921
|
+
ie.INPUTS = F.Inputs;
|
|
1922
|
+
ie.MESSAGE = F.Message;
|
|
1921
1923
|
ie.deserializeInputs = Ce;
|
|
1922
1924
|
ie.serializeInputs = Ke;
|
|
1923
1925
|
var qe = {};
|
|
1924
|
-
const oe = "\\\\/", Ut = `[^${oe}]`, le = "\\.", Fn = "\\+", zn = "\\?", Qe = "\\/",
|
|
1926
|
+
const oe = "\\\\/", Ut = `[^${oe}]`, le = "\\.", Fn = "\\+", zn = "\\?", Qe = "\\/", Gn = "(?=.)", ms = "[^/]", Et = `(?:${Qe}|$)`, ys = `(?:^|${Qe})`, Mt = `${le}{1,2}${Et}`, Jn = `(?!${le})`, Vn = `(?!${ys}${Mt})`, Wn = `(?!${le}{0,1}${Et})`, Kn = `(?!${Mt})`, Xn = `[^.${Qe}]`, qn = `${ms}*?`, Qn = "/", gs = {
|
|
1925
1927
|
DOT_LITERAL: le,
|
|
1926
1928
|
PLUS_LITERAL: Fn,
|
|
1927
1929
|
QMARK_LITERAL: zn,
|
|
1928
1930
|
SLASH_LITERAL: Qe,
|
|
1929
|
-
ONE_CHAR:
|
|
1931
|
+
ONE_CHAR: Gn,
|
|
1930
1932
|
QMARK: ms,
|
|
1931
1933
|
END_ANCHOR: Et,
|
|
1932
1934
|
DOTS_SLASH: Mt,
|
|
1933
|
-
NO_DOT:
|
|
1935
|
+
NO_DOT: Jn,
|
|
1934
1936
|
NO_DOTS: Vn,
|
|
1935
1937
|
NO_DOT_SLASH: Wn,
|
|
1936
1938
|
NO_DOTS_SLASH: Kn,
|
|
@@ -2141,45 +2143,45 @@ const Bt = qe, {
|
|
|
2141
2143
|
/* ? */
|
|
2142
2144
|
CHAR_RIGHT_CURLY_BRACE: ii,
|
|
2143
2145
|
/* } */
|
|
2144
|
-
CHAR_RIGHT_PARENTHESES:
|
|
2146
|
+
CHAR_RIGHT_PARENTHESES: Gt,
|
|
2145
2147
|
/* ) */
|
|
2146
2148
|
CHAR_RIGHT_SQUARE_BRACKET: ri
|
|
2147
2149
|
/* ] */
|
|
2148
|
-
} = Ye,
|
|
2150
|
+
} = Ye, Jt = (t) => t === _s || t === Me, Vt = (t) => {
|
|
2149
2151
|
t.isPrefix !== !0 && (t.depth = t.isGlobstar ? 1 / 0 : 1);
|
|
2150
2152
|
}, oi = (t, e) => {
|
|
2151
2153
|
const s = e || {}, n = t.length - 1, i = s.parts === !0 || s.scanToEnd === !0, o = [], r = [], a = [];
|
|
2152
|
-
let u = t, l = -1, c = 0,
|
|
2153
|
-
const
|
|
2154
|
+
let u = t, l = -1, c = 0, p = 0, m = !1, _ = !1, y = !1, O = !1, R = !1, $ = !1, w = !1, A = !1, C = !1, S = 0, k, E, v = { value: "", depth: 0, isGlob: !1 };
|
|
2155
|
+
const x = () => l >= n, d = () => u.charCodeAt(l + 1), T = () => (k = E, u.charCodeAt(++l));
|
|
2154
2156
|
for (; l < n; ) {
|
|
2155
|
-
|
|
2156
|
-
let
|
|
2157
|
-
if (
|
|
2158
|
-
w =
|
|
2157
|
+
E = T();
|
|
2158
|
+
let V;
|
|
2159
|
+
if (E === Me) {
|
|
2160
|
+
w = v.backslashes = !0, E = T(), E === it && ($ = !0);
|
|
2159
2161
|
continue;
|
|
2160
2162
|
}
|
|
2161
|
-
if (
|
|
2162
|
-
for (
|
|
2163
|
-
if (
|
|
2164
|
-
w =
|
|
2163
|
+
if ($ === !0 || E === it) {
|
|
2164
|
+
for (S++; x() !== !0 && (E = T()); ) {
|
|
2165
|
+
if (E === Me) {
|
|
2166
|
+
w = v.backslashes = !0, T();
|
|
2165
2167
|
continue;
|
|
2166
2168
|
}
|
|
2167
|
-
if (
|
|
2168
|
-
|
|
2169
|
+
if (E === it) {
|
|
2170
|
+
S++;
|
|
2169
2171
|
continue;
|
|
2170
2172
|
}
|
|
2171
|
-
if (
|
|
2172
|
-
if (
|
|
2173
|
+
if ($ !== !0 && E === nt && (E = T()) === nt) {
|
|
2174
|
+
if (m = v.isBrace = !0, y = v.isGlob = !0, C = !0, i === !0)
|
|
2173
2175
|
continue;
|
|
2174
2176
|
break;
|
|
2175
2177
|
}
|
|
2176
|
-
if (
|
|
2177
|
-
if (
|
|
2178
|
+
if ($ !== !0 && E === ti) {
|
|
2179
|
+
if (m = v.isBrace = !0, y = v.isGlob = !0, C = !0, i === !0)
|
|
2178
2180
|
continue;
|
|
2179
2181
|
break;
|
|
2180
2182
|
}
|
|
2181
|
-
if (
|
|
2182
|
-
|
|
2183
|
+
if (E === ii && (S--, S === 0)) {
|
|
2184
|
+
$ = !1, m = v.isBrace = !0, C = !0;
|
|
2183
2185
|
break;
|
|
2184
2186
|
}
|
|
2185
2187
|
}
|
|
@@ -2187,25 +2189,25 @@ const Bt = qe, {
|
|
|
2187
2189
|
continue;
|
|
2188
2190
|
break;
|
|
2189
2191
|
}
|
|
2190
|
-
if (
|
|
2191
|
-
if (o.push(l), r.push(
|
|
2192
|
+
if (E === _s) {
|
|
2193
|
+
if (o.push(l), r.push(v), v = { value: "", depth: 0, isGlob: !1 }, C === !0)
|
|
2192
2194
|
continue;
|
|
2193
2195
|
if (k === nt && l === c + 1) {
|
|
2194
2196
|
c += 2;
|
|
2195
2197
|
continue;
|
|
2196
2198
|
}
|
|
2197
|
-
|
|
2199
|
+
p = l + 1;
|
|
2198
2200
|
continue;
|
|
2199
2201
|
}
|
|
2200
|
-
if (s.noext !== !0 && (
|
|
2201
|
-
if (
|
|
2202
|
-
for (;
|
|
2203
|
-
if (
|
|
2204
|
-
w =
|
|
2202
|
+
if (s.noext !== !0 && (E === ni || E === ei || E === st || E === zt || E === Ft) === !0 && d() === rt) {
|
|
2203
|
+
if (y = v.isGlob = !0, O = v.isExtglob = !0, C = !0, i === !0) {
|
|
2204
|
+
for (; x() !== !0 && (E = T()); ) {
|
|
2205
|
+
if (E === Me) {
|
|
2206
|
+
w = v.backslashes = !0, E = T();
|
|
2205
2207
|
continue;
|
|
2206
2208
|
}
|
|
2207
|
-
if (
|
|
2208
|
-
|
|
2209
|
+
if (E === Gt) {
|
|
2210
|
+
y = v.isGlob = !0, C = !0;
|
|
2209
2211
|
break;
|
|
2210
2212
|
}
|
|
2211
2213
|
}
|
|
@@ -2213,41 +2215,41 @@ const Bt = qe, {
|
|
|
2213
2215
|
}
|
|
2214
2216
|
break;
|
|
2215
2217
|
}
|
|
2216
|
-
if (
|
|
2217
|
-
if (k === st && (
|
|
2218
|
+
if (E === st) {
|
|
2219
|
+
if (k === st && (R = v.isGlobstar = !0), y = v.isGlob = !0, C = !0, i === !0)
|
|
2218
2220
|
continue;
|
|
2219
2221
|
break;
|
|
2220
2222
|
}
|
|
2221
|
-
if (
|
|
2222
|
-
if (
|
|
2223
|
+
if (E === zt) {
|
|
2224
|
+
if (y = v.isGlob = !0, C = !0, i === !0)
|
|
2223
2225
|
continue;
|
|
2224
2226
|
break;
|
|
2225
2227
|
}
|
|
2226
|
-
if (
|
|
2227
|
-
for (;
|
|
2228
|
-
if (
|
|
2229
|
-
w =
|
|
2228
|
+
if (E === si)
|
|
2229
|
+
for (; x() !== !0 && (V = T()); ) {
|
|
2230
|
+
if (V === Me) {
|
|
2231
|
+
w = v.backslashes = !0, T();
|
|
2230
2232
|
continue;
|
|
2231
2233
|
}
|
|
2232
|
-
if (
|
|
2233
|
-
if (
|
|
2234
|
+
if (V === ri) {
|
|
2235
|
+
if (_ = v.isBracket = !0, y = v.isGlob = !0, C = !0, i === !0)
|
|
2234
2236
|
continue;
|
|
2235
2237
|
break;
|
|
2236
2238
|
}
|
|
2237
2239
|
}
|
|
2238
|
-
if (s.nonegate !== !0 &&
|
|
2239
|
-
A =
|
|
2240
|
+
if (s.nonegate !== !0 && E === Ft && l === c) {
|
|
2241
|
+
A = v.negated = !0, c++;
|
|
2240
2242
|
continue;
|
|
2241
2243
|
}
|
|
2242
|
-
if (s.noparen !== !0 &&
|
|
2243
|
-
if (
|
|
2244
|
-
for (;
|
|
2245
|
-
if (
|
|
2246
|
-
w =
|
|
2244
|
+
if (s.noparen !== !0 && E === rt) {
|
|
2245
|
+
if (y = v.isGlob = !0, i === !0) {
|
|
2246
|
+
for (; x() !== !0 && (E = T()); ) {
|
|
2247
|
+
if (E === rt) {
|
|
2248
|
+
w = v.backslashes = !0, E = T();
|
|
2247
2249
|
continue;
|
|
2248
2250
|
}
|
|
2249
|
-
if (
|
|
2250
|
-
|
|
2251
|
+
if (E === Gt) {
|
|
2252
|
+
C = !0;
|
|
2251
2253
|
break;
|
|
2252
2254
|
}
|
|
2253
2255
|
}
|
|
@@ -2255,50 +2257,50 @@ const Bt = qe, {
|
|
|
2255
2257
|
}
|
|
2256
2258
|
break;
|
|
2257
2259
|
}
|
|
2258
|
-
if (
|
|
2259
|
-
if (
|
|
2260
|
+
if (y === !0) {
|
|
2261
|
+
if (C = !0, i === !0)
|
|
2260
2262
|
continue;
|
|
2261
2263
|
break;
|
|
2262
2264
|
}
|
|
2263
2265
|
}
|
|
2264
|
-
s.noext === !0 && (
|
|
2265
|
-
let
|
|
2266
|
-
c > 0 && (
|
|
2267
|
-
const
|
|
2268
|
-
prefix:
|
|
2266
|
+
s.noext === !0 && (O = !1, y = !1);
|
|
2267
|
+
let H = u, Z = "", f = "";
|
|
2268
|
+
c > 0 && (Z = u.slice(0, c), u = u.slice(c), p -= c), H && y === !0 && p > 0 ? (H = u.slice(0, p), f = u.slice(p)) : y === !0 ? (H = "", f = u) : H = u, H && H !== "" && H !== "/" && H !== u && Jt(H.charCodeAt(H.length - 1)) && (H = H.slice(0, -1)), s.unescape === !0 && (f && (f = Bt.removeBackslashes(f)), H && w === !0 && (H = Bt.removeBackslashes(H)));
|
|
2269
|
+
const h = {
|
|
2270
|
+
prefix: Z,
|
|
2269
2271
|
input: t,
|
|
2270
2272
|
start: c,
|
|
2271
|
-
base:
|
|
2272
|
-
glob:
|
|
2273
|
-
isBrace:
|
|
2274
|
-
isBracket:
|
|
2275
|
-
isGlob:
|
|
2276
|
-
isExtglob:
|
|
2277
|
-
isGlobstar:
|
|
2273
|
+
base: H,
|
|
2274
|
+
glob: f,
|
|
2275
|
+
isBrace: m,
|
|
2276
|
+
isBracket: _,
|
|
2277
|
+
isGlob: y,
|
|
2278
|
+
isExtglob: O,
|
|
2279
|
+
isGlobstar: R,
|
|
2278
2280
|
negated: A
|
|
2279
2281
|
};
|
|
2280
|
-
if (s.tokens === !0 && (
|
|
2281
|
-
let
|
|
2282
|
+
if (s.tokens === !0 && (h.maxDepth = 0, Jt(E) || r.push(v), h.tokens = r), s.parts === !0 || s.tokens === !0) {
|
|
2283
|
+
let V;
|
|
2282
2284
|
for (let N = 0; N < o.length; N++) {
|
|
2283
|
-
const re =
|
|
2284
|
-
s.tokens && (N === 0 && c !== 0 ? (r[N].isPrefix = !0, r[N].value =
|
|
2285
|
+
const re = V ? V + 1 : c, ce = o[N], q = t.slice(re, ce);
|
|
2286
|
+
s.tokens && (N === 0 && c !== 0 ? (r[N].isPrefix = !0, r[N].value = Z) : r[N].value = q, Vt(r[N]), h.maxDepth += r[N].depth), (N !== 0 || q !== "") && a.push(q), V = ce;
|
|
2285
2287
|
}
|
|
2286
|
-
if (
|
|
2287
|
-
const N = t.slice(
|
|
2288
|
-
a.push(N), s.tokens && (r[r.length - 1].value = N, Vt(r[r.length - 1]),
|
|
2288
|
+
if (V && V + 1 < t.length) {
|
|
2289
|
+
const N = t.slice(V + 1);
|
|
2290
|
+
a.push(N), s.tokens && (r[r.length - 1].value = N, Vt(r[r.length - 1]), h.maxDepth += r[r.length - 1].depth);
|
|
2289
2291
|
}
|
|
2290
|
-
|
|
2292
|
+
h.slashes = o, h.parts = a;
|
|
2291
2293
|
}
|
|
2292
|
-
return
|
|
2294
|
+
return h;
|
|
2293
2295
|
};
|
|
2294
2296
|
var ai = oi;
|
|
2295
|
-
const
|
|
2297
|
+
const Je = Ye, se = qe, {
|
|
2296
2298
|
MAX_LENGTH: Ve,
|
|
2297
2299
|
POSIX_REGEX_SOURCE: ui,
|
|
2298
2300
|
REGEX_NON_SPECIAL_CHARS: ci,
|
|
2299
2301
|
REGEX_SPECIAL_CHARS_BACKREF: li,
|
|
2300
2302
|
REPLACEMENTS: bs
|
|
2301
|
-
} =
|
|
2303
|
+
} = Je, fi = (t, e) => {
|
|
2302
2304
|
if (typeof e.expandRange == "function")
|
|
2303
2305
|
return e.expandRange(...t, e);
|
|
2304
2306
|
t.sort();
|
|
@@ -2309,7 +2311,7 @@ const Ge = Ye, se = qe, {
|
|
|
2309
2311
|
return t.map((i) => se.escapeRegex(i)).join("..");
|
|
2310
2312
|
}
|
|
2311
2313
|
return s;
|
|
2312
|
-
},
|
|
2314
|
+
}, we = (t, e) => `Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`, vs = (t, e) => {
|
|
2313
2315
|
if (typeof t != "string")
|
|
2314
2316
|
throw new TypeError("Expected a string");
|
|
2315
2317
|
t = bs[t] || t;
|
|
@@ -2317,23 +2319,23 @@ const Ge = Ye, se = qe, {
|
|
|
2317
2319
|
let i = t.length;
|
|
2318
2320
|
if (i > n)
|
|
2319
2321
|
throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);
|
|
2320
|
-
const o = { type: "bos", value: "", output: s.prepend || "" }, r = [o], a = s.capture ? "" : "?:", u =
|
|
2322
|
+
const o = { type: "bos", value: "", output: s.prepend || "" }, r = [o], a = s.capture ? "" : "?:", u = Je.globChars(s.windows), l = Je.extglobChars(u), {
|
|
2321
2323
|
DOT_LITERAL: c,
|
|
2322
|
-
PLUS_LITERAL:
|
|
2323
|
-
SLASH_LITERAL:
|
|
2324
|
-
ONE_CHAR:
|
|
2325
|
-
DOTS_SLASH:
|
|
2326
|
-
NO_DOT:
|
|
2327
|
-
NO_DOT_SLASH:
|
|
2328
|
-
NO_DOTS_SLASH:
|
|
2324
|
+
PLUS_LITERAL: p,
|
|
2325
|
+
SLASH_LITERAL: m,
|
|
2326
|
+
ONE_CHAR: _,
|
|
2327
|
+
DOTS_SLASH: y,
|
|
2328
|
+
NO_DOT: O,
|
|
2329
|
+
NO_DOT_SLASH: R,
|
|
2330
|
+
NO_DOTS_SLASH: $,
|
|
2329
2331
|
QMARK: w,
|
|
2330
2332
|
QMARK_NO_DOT: A,
|
|
2331
|
-
STAR:
|
|
2332
|
-
START_ANCHOR:
|
|
2333
|
-
} = u, k = (
|
|
2334
|
-
let
|
|
2335
|
-
s.capture && (
|
|
2336
|
-
const
|
|
2333
|
+
STAR: C,
|
|
2334
|
+
START_ANCHOR: S
|
|
2335
|
+
} = u, k = (b) => `(${a}(?:(?!${S}${b.dot ? y : c}).)*?)`, E = s.dot ? "" : O, v = s.dot ? w : A;
|
|
2336
|
+
let x = s.bash === !0 ? k(s) : C;
|
|
2337
|
+
s.capture && (x = `(${x})`), typeof s.noext == "boolean" && (s.noextglob = s.noext);
|
|
2338
|
+
const d = {
|
|
2337
2339
|
input: t,
|
|
2338
2340
|
index: -1,
|
|
2339
2341
|
start: 0,
|
|
@@ -2350,347 +2352,347 @@ const Ge = Ye, se = qe, {
|
|
|
2350
2352
|
globstar: !1,
|
|
2351
2353
|
tokens: r
|
|
2352
2354
|
};
|
|
2353
|
-
t = se.removePrefix(t,
|
|
2354
|
-
const
|
|
2355
|
-
let
|
|
2356
|
-
const
|
|
2357
|
-
|
|
2358
|
-
}, De = (
|
|
2359
|
-
|
|
2355
|
+
t = se.removePrefix(t, d), i = t.length;
|
|
2356
|
+
const T = [], H = [], Z = [];
|
|
2357
|
+
let f = o, h;
|
|
2358
|
+
const V = () => d.index === i - 1, N = d.peek = (b = 1) => t[d.index + b], re = d.advance = () => t[++d.index], ce = () => t.slice(d.index + 1), q = (b = "", j = 0) => {
|
|
2359
|
+
d.consumed += b, d.index += j;
|
|
2360
|
+
}, De = (b) => {
|
|
2361
|
+
d.output += b.output != null ? b.output : b.value, q(b.value);
|
|
2360
2362
|
}, Rs = () => {
|
|
2361
|
-
let
|
|
2363
|
+
let b = 1;
|
|
2362
2364
|
for (; N() === "!" && (N(2) !== "(" || N(3) === "?"); )
|
|
2363
|
-
re(),
|
|
2364
|
-
return
|
|
2365
|
-
}, Ne = (
|
|
2366
|
-
|
|
2367
|
-
}, ye = (
|
|
2368
|
-
|
|
2369
|
-
},
|
|
2370
|
-
if (
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2373
|
-
}
|
|
2374
|
-
if (
|
|
2375
|
-
|
|
2365
|
+
re(), d.start++, b++;
|
|
2366
|
+
return b % 2 === 0 ? !1 : (d.negated = !0, d.start++, !0);
|
|
2367
|
+
}, Ne = (b) => {
|
|
2368
|
+
d[b]++, Z.push(b);
|
|
2369
|
+
}, ye = (b) => {
|
|
2370
|
+
d[b]--, Z.pop();
|
|
2371
|
+
}, L = (b) => {
|
|
2372
|
+
if (f.type === "globstar") {
|
|
2373
|
+
const j = d.braces > 0 && (b.type === "comma" || b.type === "brace"), g = b.extglob === !0 || T.length && (b.type === "pipe" || b.type === "paren");
|
|
2374
|
+
b.type !== "slash" && b.type !== "paren" && !j && !g && (d.output = d.output.slice(0, -f.output.length), f.type = "star", f.value = "*", f.output = x, d.output += f.output);
|
|
2375
|
+
}
|
|
2376
|
+
if (T.length && b.type !== "paren" && !l[b.value] && (T[T.length - 1].inner += b.value), (b.value || b.output) && De(b), f && f.type === "text" && b.type === "text") {
|
|
2377
|
+
f.value += b.value, f.output = (f.output || "") + b.value;
|
|
2376
2378
|
return;
|
|
2377
2379
|
}
|
|
2378
|
-
|
|
2379
|
-
}, ke = (
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2382
|
-
const D = (s.capture ? "(" : "") +
|
|
2383
|
-
Ne("parens"),
|
|
2384
|
-
}, Ss = (
|
|
2385
|
-
let
|
|
2386
|
-
if (
|
|
2387
|
-
let
|
|
2388
|
-
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2380
|
+
b.prev = f, r.push(b), f = b;
|
|
2381
|
+
}, ke = (b, j) => {
|
|
2382
|
+
const g = { ...l[j], conditions: 1, inner: "" };
|
|
2383
|
+
g.prev = f, g.parens = d.parens, g.output = d.output;
|
|
2384
|
+
const D = (s.capture ? "(" : "") + g.open;
|
|
2385
|
+
Ne("parens"), L({ type: b, value: j, output: d.output ? "" : _ }), L({ type: "paren", extglob: !0, value: re(), output: D }), T.push(g);
|
|
2386
|
+
}, Ss = (b) => {
|
|
2387
|
+
let j = b.close + (s.capture ? ")" : "");
|
|
2388
|
+
if (b.type === "negate") {
|
|
2389
|
+
let g = x;
|
|
2390
|
+
b.inner && b.inner.length > 1 && b.inner.includes("/") && (g = k(s)), (g !== x || V() || /^\)+$/.test(ce())) && (j = b.close = `)$))${g}`), b.prev.type === "bos" && V() && (d.negatedExtglob = !0);
|
|
2391
|
+
}
|
|
2392
|
+
L({ type: "paren", extglob: !0, value: h, output: j }), ye("parens");
|
|
2391
2393
|
};
|
|
2392
2394
|
if (s.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(t)) {
|
|
2393
|
-
let
|
|
2394
|
-
return
|
|
2395
|
+
let b = !1, j = t.replace(li, (g, D, B, W, J, Ze) => W === "\\" ? (b = !0, g) : W === "?" ? D ? D + W + (J ? w.repeat(J.length) : "") : Ze === 0 ? v + (J ? w.repeat(J.length) : "") : w.repeat(B.length) : W === "." ? c.repeat(B.length) : W === "*" ? D ? D + W + (J ? x : "") : x : D ? g : `\\${g}`);
|
|
2396
|
+
return b === !0 && (s.unescape === !0 ? j = j.replace(/\\/g, "") : j = j.replace(/\\+/g, (g) => g.length % 2 === 0 ? "\\\\" : g ? "\\" : "")), j === t && s.contains === !0 ? (d.output = t, d) : (d.output = se.wrapOutput(j, d, e), d);
|
|
2395
2397
|
}
|
|
2396
|
-
for (; !
|
|
2397
|
-
if (
|
|
2398
|
+
for (; !V(); ) {
|
|
2399
|
+
if (h = re(), h === "\0")
|
|
2398
2400
|
continue;
|
|
2399
|
-
if (
|
|
2400
|
-
const
|
|
2401
|
-
if (
|
|
2401
|
+
if (h === "\\") {
|
|
2402
|
+
const g = N();
|
|
2403
|
+
if (g === "/" && s.bash !== !0 || g === "." || g === ";")
|
|
2402
2404
|
continue;
|
|
2403
|
-
if (!
|
|
2404
|
-
|
|
2405
|
+
if (!g) {
|
|
2406
|
+
h += "\\", L({ type: "text", value: h });
|
|
2405
2407
|
continue;
|
|
2406
2408
|
}
|
|
2407
2409
|
const D = /^\\+/.exec(ce());
|
|
2408
|
-
let
|
|
2409
|
-
if (D && D[0].length > 2 && (
|
|
2410
|
-
|
|
2410
|
+
let B = 0;
|
|
2411
|
+
if (D && D[0].length > 2 && (B = D[0].length, d.index += B, B % 2 !== 0 && (h += "\\")), s.unescape === !0 ? h = re() || "" : h += re() || "", d.brackets === 0) {
|
|
2412
|
+
L({ type: "text", value: h });
|
|
2411
2413
|
continue;
|
|
2412
2414
|
}
|
|
2413
2415
|
}
|
|
2414
|
-
if (
|
|
2415
|
-
if (s.posix !== !1 &&
|
|
2416
|
-
const
|
|
2417
|
-
if (
|
|
2418
|
-
const D =
|
|
2419
|
-
if (
|
|
2420
|
-
|
|
2416
|
+
if (d.brackets > 0 && (h !== "]" || f.value === "[" || f.value === "[^")) {
|
|
2417
|
+
if (s.posix !== !1 && h === ":") {
|
|
2418
|
+
const g = f.value.slice(1);
|
|
2419
|
+
if (g.includes("[") && (f.posix = !0, g.includes(":"))) {
|
|
2420
|
+
const D = f.value.lastIndexOf("["), B = f.value.slice(0, D), W = f.value.slice(D + 2), J = ui[W];
|
|
2421
|
+
if (J) {
|
|
2422
|
+
f.value = B + J, d.backtrack = !0, re(), !o.output && r.indexOf(f) === 1 && (o.output = _);
|
|
2421
2423
|
continue;
|
|
2422
2424
|
}
|
|
2423
2425
|
}
|
|
2424
2426
|
}
|
|
2425
|
-
(
|
|
2427
|
+
(h === "[" && N() !== ":" || h === "-" && N() === "]") && (h = `\\${h}`), h === "]" && (f.value === "[" || f.value === "[^") && (h = `\\${h}`), s.posix === !0 && h === "!" && f.value === "[" && (h = "^"), f.value += h, De({ value: h });
|
|
2426
2428
|
continue;
|
|
2427
2429
|
}
|
|
2428
|
-
if (
|
|
2429
|
-
|
|
2430
|
+
if (d.quotes === 1 && h !== '"') {
|
|
2431
|
+
h = se.escapeRegex(h), f.value += h, De({ value: h });
|
|
2430
2432
|
continue;
|
|
2431
2433
|
}
|
|
2432
|
-
if (
|
|
2433
|
-
|
|
2434
|
+
if (h === '"') {
|
|
2435
|
+
d.quotes = d.quotes === 1 ? 0 : 1, s.keepQuotes === !0 && L({ type: "text", value: h });
|
|
2434
2436
|
continue;
|
|
2435
2437
|
}
|
|
2436
|
-
if (
|
|
2437
|
-
Ne("parens"),
|
|
2438
|
+
if (h === "(") {
|
|
2439
|
+
Ne("parens"), L({ type: "paren", value: h });
|
|
2438
2440
|
continue;
|
|
2439
2441
|
}
|
|
2440
|
-
if (
|
|
2441
|
-
if (
|
|
2442
|
-
throw new SyntaxError(
|
|
2443
|
-
const
|
|
2444
|
-
if (
|
|
2445
|
-
Ss(
|
|
2442
|
+
if (h === ")") {
|
|
2443
|
+
if (d.parens === 0 && s.strictBrackets === !0)
|
|
2444
|
+
throw new SyntaxError(we("opening", "("));
|
|
2445
|
+
const g = T[T.length - 1];
|
|
2446
|
+
if (g && d.parens === g.parens + 1) {
|
|
2447
|
+
Ss(T.pop());
|
|
2446
2448
|
continue;
|
|
2447
2449
|
}
|
|
2448
|
-
|
|
2450
|
+
L({ type: "paren", value: h, output: d.parens ? ")" : "\\)" }), ye("parens");
|
|
2449
2451
|
continue;
|
|
2450
2452
|
}
|
|
2451
|
-
if (
|
|
2453
|
+
if (h === "[") {
|
|
2452
2454
|
if (s.nobracket === !0 || !ce().includes("]")) {
|
|
2453
2455
|
if (s.nobracket !== !0 && s.strictBrackets === !0)
|
|
2454
|
-
throw new SyntaxError(
|
|
2455
|
-
|
|
2456
|
+
throw new SyntaxError(we("closing", "]"));
|
|
2457
|
+
h = `\\${h}`;
|
|
2456
2458
|
} else
|
|
2457
2459
|
Ne("brackets");
|
|
2458
|
-
|
|
2460
|
+
L({ type: "bracket", value: h });
|
|
2459
2461
|
continue;
|
|
2460
2462
|
}
|
|
2461
|
-
if (
|
|
2462
|
-
if (s.nobracket === !0 ||
|
|
2463
|
-
|
|
2463
|
+
if (h === "]") {
|
|
2464
|
+
if (s.nobracket === !0 || f && f.type === "bracket" && f.value.length === 1) {
|
|
2465
|
+
L({ type: "text", value: h, output: `\\${h}` });
|
|
2464
2466
|
continue;
|
|
2465
2467
|
}
|
|
2466
|
-
if (
|
|
2468
|
+
if (d.brackets === 0) {
|
|
2467
2469
|
if (s.strictBrackets === !0)
|
|
2468
|
-
throw new SyntaxError(
|
|
2469
|
-
|
|
2470
|
+
throw new SyntaxError(we("opening", "["));
|
|
2471
|
+
L({ type: "text", value: h, output: `\\${h}` });
|
|
2470
2472
|
continue;
|
|
2471
2473
|
}
|
|
2472
2474
|
ye("brackets");
|
|
2473
|
-
const
|
|
2474
|
-
if (
|
|
2475
|
+
const g = f.value.slice(1);
|
|
2476
|
+
if (f.posix !== !0 && g[0] === "^" && !g.includes("/") && (h = `/${h}`), f.value += h, De({ value: h }), s.literalBrackets === !1 || se.hasRegexChars(g))
|
|
2475
2477
|
continue;
|
|
2476
|
-
const D = se.escapeRegex(
|
|
2477
|
-
if (
|
|
2478
|
-
|
|
2478
|
+
const D = se.escapeRegex(f.value);
|
|
2479
|
+
if (d.output = d.output.slice(0, -f.value.length), s.literalBrackets === !0) {
|
|
2480
|
+
d.output += D, f.value = D;
|
|
2479
2481
|
continue;
|
|
2480
2482
|
}
|
|
2481
|
-
|
|
2483
|
+
f.value = `(${a}${D}|${f.value})`, d.output += f.value;
|
|
2482
2484
|
continue;
|
|
2483
2485
|
}
|
|
2484
|
-
if (
|
|
2486
|
+
if (h === "{" && s.nobrace !== !0) {
|
|
2485
2487
|
Ne("braces");
|
|
2486
|
-
const
|
|
2488
|
+
const g = {
|
|
2487
2489
|
type: "brace",
|
|
2488
|
-
value:
|
|
2490
|
+
value: h,
|
|
2489
2491
|
output: "(",
|
|
2490
|
-
outputIndex:
|
|
2491
|
-
tokensIndex:
|
|
2492
|
+
outputIndex: d.output.length,
|
|
2493
|
+
tokensIndex: d.tokens.length
|
|
2492
2494
|
};
|
|
2493
|
-
|
|
2495
|
+
H.push(g), L(g);
|
|
2494
2496
|
continue;
|
|
2495
2497
|
}
|
|
2496
|
-
if (
|
|
2497
|
-
const
|
|
2498
|
-
if (s.nobrace === !0 || !
|
|
2499
|
-
|
|
2498
|
+
if (h === "}") {
|
|
2499
|
+
const g = H[H.length - 1];
|
|
2500
|
+
if (s.nobrace === !0 || !g) {
|
|
2501
|
+
L({ type: "text", value: h, output: h });
|
|
2500
2502
|
continue;
|
|
2501
2503
|
}
|
|
2502
2504
|
let D = ")";
|
|
2503
|
-
if (
|
|
2504
|
-
const
|
|
2505
|
-
for (let
|
|
2506
|
-
|
|
2507
|
-
D = fi(
|
|
2508
|
-
}
|
|
2509
|
-
if (
|
|
2510
|
-
const
|
|
2511
|
-
|
|
2512
|
-
for (const
|
|
2513
|
-
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2505
|
+
if (g.dots === !0) {
|
|
2506
|
+
const B = r.slice(), W = [];
|
|
2507
|
+
for (let J = B.length - 1; J >= 0 && (r.pop(), B[J].type !== "brace"); J--)
|
|
2508
|
+
B[J].type !== "dots" && W.unshift(B[J].value);
|
|
2509
|
+
D = fi(W, s), d.backtrack = !0;
|
|
2510
|
+
}
|
|
2511
|
+
if (g.comma !== !0 && g.dots !== !0) {
|
|
2512
|
+
const B = d.output.slice(0, g.outputIndex), W = d.tokens.slice(g.tokensIndex);
|
|
2513
|
+
g.value = g.output = "\\{", h = D = "\\}", d.output = B;
|
|
2514
|
+
for (const J of W)
|
|
2515
|
+
d.output += J.output || J.value;
|
|
2516
|
+
}
|
|
2517
|
+
L({ type: "brace", value: h, output: D }), ye("braces"), H.pop();
|
|
2516
2518
|
continue;
|
|
2517
2519
|
}
|
|
2518
|
-
if (
|
|
2519
|
-
|
|
2520
|
+
if (h === "|") {
|
|
2521
|
+
T.length > 0 && T[T.length - 1].conditions++, L({ type: "text", value: h });
|
|
2520
2522
|
continue;
|
|
2521
2523
|
}
|
|
2522
|
-
if (
|
|
2523
|
-
let
|
|
2524
|
-
const D =
|
|
2525
|
-
D &&
|
|
2524
|
+
if (h === ",") {
|
|
2525
|
+
let g = h;
|
|
2526
|
+
const D = H[H.length - 1];
|
|
2527
|
+
D && Z[Z.length - 1] === "braces" && (D.comma = !0, g = "|"), L({ type: "comma", value: h, output: g });
|
|
2526
2528
|
continue;
|
|
2527
2529
|
}
|
|
2528
|
-
if (
|
|
2529
|
-
if (
|
|
2530
|
-
|
|
2530
|
+
if (h === "/") {
|
|
2531
|
+
if (f.type === "dot" && d.index === d.start + 1) {
|
|
2532
|
+
d.start = d.index + 1, d.consumed = "", d.output = "", r.pop(), f = o;
|
|
2531
2533
|
continue;
|
|
2532
2534
|
}
|
|
2533
|
-
|
|
2535
|
+
L({ type: "slash", value: h, output: m });
|
|
2534
2536
|
continue;
|
|
2535
2537
|
}
|
|
2536
|
-
if (
|
|
2537
|
-
if (
|
|
2538
|
-
|
|
2539
|
-
const
|
|
2540
|
-
|
|
2538
|
+
if (h === ".") {
|
|
2539
|
+
if (d.braces > 0 && f.type === "dot") {
|
|
2540
|
+
f.value === "." && (f.output = c);
|
|
2541
|
+
const g = H[H.length - 1];
|
|
2542
|
+
f.type = "dots", f.output += h, f.value += h, g.dots = !0;
|
|
2541
2543
|
continue;
|
|
2542
2544
|
}
|
|
2543
|
-
if (
|
|
2544
|
-
|
|
2545
|
+
if (d.braces + d.parens === 0 && f.type !== "bos" && f.type !== "slash") {
|
|
2546
|
+
L({ type: "text", value: h, output: c });
|
|
2545
2547
|
continue;
|
|
2546
2548
|
}
|
|
2547
|
-
|
|
2549
|
+
L({ type: "dot", value: h, output: c });
|
|
2548
2550
|
continue;
|
|
2549
2551
|
}
|
|
2550
|
-
if (
|
|
2551
|
-
if (!(
|
|
2552
|
-
ke("qmark",
|
|
2552
|
+
if (h === "?") {
|
|
2553
|
+
if (!(f && f.value === "(") && s.noextglob !== !0 && N() === "(" && N(2) !== "?") {
|
|
2554
|
+
ke("qmark", h);
|
|
2553
2555
|
continue;
|
|
2554
2556
|
}
|
|
2555
|
-
if (
|
|
2557
|
+
if (f && f.type === "paren") {
|
|
2556
2558
|
const D = N();
|
|
2557
|
-
let
|
|
2559
|
+
let B = h;
|
|
2558
2560
|
if (D === "<" && !se.supportsLookbehinds())
|
|
2559
2561
|
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
2560
|
-
(
|
|
2562
|
+
(f.value === "(" && !/[!=<:]/.test(D) || D === "<" && !/<([!=]|\w+>)/.test(ce())) && (B = `\\${h}`), L({ type: "text", value: h, output: B });
|
|
2561
2563
|
continue;
|
|
2562
2564
|
}
|
|
2563
|
-
if (s.dot !== !0 && (
|
|
2564
|
-
|
|
2565
|
+
if (s.dot !== !0 && (f.type === "slash" || f.type === "bos")) {
|
|
2566
|
+
L({ type: "qmark", value: h, output: A });
|
|
2565
2567
|
continue;
|
|
2566
2568
|
}
|
|
2567
|
-
|
|
2569
|
+
L({ type: "qmark", value: h, output: w });
|
|
2568
2570
|
continue;
|
|
2569
2571
|
}
|
|
2570
|
-
if (
|
|
2572
|
+
if (h === "!") {
|
|
2571
2573
|
if (s.noextglob !== !0 && N() === "(" && (N(2) !== "?" || !/[!=<:]/.test(N(3)))) {
|
|
2572
|
-
ke("negate",
|
|
2574
|
+
ke("negate", h);
|
|
2573
2575
|
continue;
|
|
2574
2576
|
}
|
|
2575
|
-
if (s.nonegate !== !0 &&
|
|
2577
|
+
if (s.nonegate !== !0 && d.index === 0) {
|
|
2576
2578
|
Rs();
|
|
2577
2579
|
continue;
|
|
2578
2580
|
}
|
|
2579
2581
|
}
|
|
2580
|
-
if (
|
|
2582
|
+
if (h === "+") {
|
|
2581
2583
|
if (s.noextglob !== !0 && N() === "(" && N(2) !== "?") {
|
|
2582
|
-
ke("plus",
|
|
2584
|
+
ke("plus", h);
|
|
2583
2585
|
continue;
|
|
2584
2586
|
}
|
|
2585
|
-
if (
|
|
2586
|
-
|
|
2587
|
+
if (f && f.value === "(" || s.regex === !1) {
|
|
2588
|
+
L({ type: "plus", value: h, output: p });
|
|
2587
2589
|
continue;
|
|
2588
2590
|
}
|
|
2589
|
-
if (
|
|
2590
|
-
|
|
2591
|
+
if (f && (f.type === "bracket" || f.type === "paren" || f.type === "brace") || d.parens > 0) {
|
|
2592
|
+
L({ type: "plus", value: h });
|
|
2591
2593
|
continue;
|
|
2592
2594
|
}
|
|
2593
|
-
|
|
2595
|
+
L({ type: "plus", value: p });
|
|
2594
2596
|
continue;
|
|
2595
2597
|
}
|
|
2596
|
-
if (
|
|
2598
|
+
if (h === "@") {
|
|
2597
2599
|
if (s.noextglob !== !0 && N() === "(" && N(2) !== "?") {
|
|
2598
|
-
|
|
2600
|
+
L({ type: "at", extglob: !0, value: h, output: "" });
|
|
2599
2601
|
continue;
|
|
2600
2602
|
}
|
|
2601
|
-
|
|
2603
|
+
L({ type: "text", value: h });
|
|
2602
2604
|
continue;
|
|
2603
2605
|
}
|
|
2604
|
-
if (
|
|
2605
|
-
(
|
|
2606
|
-
const
|
|
2607
|
-
|
|
2606
|
+
if (h !== "*") {
|
|
2607
|
+
(h === "$" || h === "^") && (h = `\\${h}`);
|
|
2608
|
+
const g = ci.exec(ce());
|
|
2609
|
+
g && (h += g[0], d.index += g[0].length), L({ type: "text", value: h });
|
|
2608
2610
|
continue;
|
|
2609
2611
|
}
|
|
2610
|
-
if (
|
|
2611
|
-
|
|
2612
|
+
if (f && (f.type === "globstar" || f.star === !0)) {
|
|
2613
|
+
f.type = "star", f.star = !0, f.value += h, f.output = x, d.backtrack = !0, d.globstar = !0, q(h);
|
|
2612
2614
|
continue;
|
|
2613
2615
|
}
|
|
2614
|
-
let
|
|
2615
|
-
if (s.noextglob !== !0 && /^\([^?]/.test(
|
|
2616
|
-
ke("star",
|
|
2616
|
+
let b = ce();
|
|
2617
|
+
if (s.noextglob !== !0 && /^\([^?]/.test(b)) {
|
|
2618
|
+
ke("star", h);
|
|
2617
2619
|
continue;
|
|
2618
2620
|
}
|
|
2619
|
-
if (
|
|
2621
|
+
if (f.type === "star") {
|
|
2620
2622
|
if (s.noglobstar === !0) {
|
|
2621
|
-
|
|
2623
|
+
q(h);
|
|
2622
2624
|
continue;
|
|
2623
2625
|
}
|
|
2624
|
-
const
|
|
2625
|
-
if (s.bash === !0 && (!
|
|
2626
|
-
|
|
2626
|
+
const g = f.prev, D = g.prev, B = g.type === "slash" || g.type === "bos", W = D && (D.type === "star" || D.type === "globstar");
|
|
2627
|
+
if (s.bash === !0 && (!B || b[0] && b[0] !== "/")) {
|
|
2628
|
+
L({ type: "star", value: h, output: "" });
|
|
2627
2629
|
continue;
|
|
2628
2630
|
}
|
|
2629
|
-
const
|
|
2630
|
-
if (!
|
|
2631
|
-
|
|
2631
|
+
const J = d.braces > 0 && (g.type === "comma" || g.type === "brace"), Ze = T.length && (g.type === "pipe" || g.type === "paren");
|
|
2632
|
+
if (!B && g.type !== "paren" && !J && !Ze) {
|
|
2633
|
+
L({ type: "star", value: h, output: "" });
|
|
2632
2634
|
continue;
|
|
2633
2635
|
}
|
|
2634
|
-
for (;
|
|
2635
|
-
const He = t[
|
|
2636
|
+
for (; b.slice(0, 3) === "/**"; ) {
|
|
2637
|
+
const He = t[d.index + 4];
|
|
2636
2638
|
if (He && He !== "/")
|
|
2637
2639
|
break;
|
|
2638
|
-
|
|
2640
|
+
b = b.slice(3), q("/**", 3);
|
|
2639
2641
|
}
|
|
2640
|
-
if (
|
|
2641
|
-
|
|
2642
|
+
if (g.type === "bos" && V()) {
|
|
2643
|
+
f.type = "globstar", f.value += h, f.output = k(s), d.output = f.output, d.globstar = !0, q(h);
|
|
2642
2644
|
continue;
|
|
2643
2645
|
}
|
|
2644
|
-
if (
|
|
2645
|
-
|
|
2646
|
+
if (g.type === "slash" && g.prev.type !== "bos" && !W && V()) {
|
|
2647
|
+
d.output = d.output.slice(0, -(g.output + f.output).length), g.output = `(?:${g.output}`, f.type = "globstar", f.output = k(s) + (s.strictSlashes ? ")" : "|$)"), f.value += h, d.globstar = !0, d.output += g.output + f.output, q(h);
|
|
2646
2648
|
continue;
|
|
2647
2649
|
}
|
|
2648
|
-
if (
|
|
2649
|
-
const He =
|
|
2650
|
-
|
|
2650
|
+
if (g.type === "slash" && g.prev.type !== "bos" && b[0] === "/") {
|
|
2651
|
+
const He = b[1] !== void 0 ? "|$" : "";
|
|
2652
|
+
d.output = d.output.slice(0, -(g.output + f.output).length), g.output = `(?:${g.output}`, f.type = "globstar", f.output = `${k(s)}${m}|${m}${He})`, f.value += h, d.output += g.output + f.output, d.globstar = !0, q(h + re()), L({ type: "slash", value: "/", output: "" });
|
|
2651
2653
|
continue;
|
|
2652
2654
|
}
|
|
2653
|
-
if (
|
|
2654
|
-
|
|
2655
|
+
if (g.type === "bos" && b[0] === "/") {
|
|
2656
|
+
f.type = "globstar", f.value += h, f.output = `(?:^|${m}|${k(s)}${m})`, d.output = f.output, d.globstar = !0, q(h + re()), L({ type: "slash", value: "/", output: "" });
|
|
2655
2657
|
continue;
|
|
2656
2658
|
}
|
|
2657
|
-
|
|
2659
|
+
d.output = d.output.slice(0, -f.output.length), f.type = "globstar", f.output = k(s), f.value += h, d.output += f.output, d.globstar = !0, q(h);
|
|
2658
2660
|
continue;
|
|
2659
2661
|
}
|
|
2660
|
-
const
|
|
2662
|
+
const j = { type: "star", value: h, output: x };
|
|
2661
2663
|
if (s.bash === !0) {
|
|
2662
|
-
|
|
2664
|
+
j.output = ".*?", (f.type === "bos" || f.type === "slash") && (j.output = E + j.output), L(j);
|
|
2663
2665
|
continue;
|
|
2664
2666
|
}
|
|
2665
|
-
if (
|
|
2666
|
-
|
|
2667
|
+
if (f && (f.type === "bracket" || f.type === "paren") && s.regex === !0) {
|
|
2668
|
+
j.output = h, L(j);
|
|
2667
2669
|
continue;
|
|
2668
2670
|
}
|
|
2669
|
-
(
|
|
2671
|
+
(d.index === d.start || f.type === "slash" || f.type === "dot") && (f.type === "dot" ? (d.output += R, f.output += R) : s.dot === !0 ? (d.output += $, f.output += $) : (d.output += E, f.output += E), N() !== "*" && (d.output += _, f.output += _)), L(j);
|
|
2670
2672
|
}
|
|
2671
|
-
for (;
|
|
2673
|
+
for (; d.brackets > 0; ) {
|
|
2672
2674
|
if (s.strictBrackets === !0)
|
|
2673
|
-
throw new SyntaxError(
|
|
2674
|
-
|
|
2675
|
+
throw new SyntaxError(we("closing", "]"));
|
|
2676
|
+
d.output = se.escapeLast(d.output, "["), ye("brackets");
|
|
2675
2677
|
}
|
|
2676
|
-
for (;
|
|
2678
|
+
for (; d.parens > 0; ) {
|
|
2677
2679
|
if (s.strictBrackets === !0)
|
|
2678
|
-
throw new SyntaxError(
|
|
2679
|
-
|
|
2680
|
+
throw new SyntaxError(we("closing", ")"));
|
|
2681
|
+
d.output = se.escapeLast(d.output, "("), ye("parens");
|
|
2680
2682
|
}
|
|
2681
|
-
for (;
|
|
2683
|
+
for (; d.braces > 0; ) {
|
|
2682
2684
|
if (s.strictBrackets === !0)
|
|
2683
|
-
throw new SyntaxError(
|
|
2684
|
-
|
|
2685
|
+
throw new SyntaxError(we("closing", "}"));
|
|
2686
|
+
d.output = se.escapeLast(d.output, "{"), ye("braces");
|
|
2685
2687
|
}
|
|
2686
|
-
if (s.strictSlashes !== !0 && (
|
|
2687
|
-
|
|
2688
|
-
for (const
|
|
2689
|
-
|
|
2688
|
+
if (s.strictSlashes !== !0 && (f.type === "star" || f.type === "bracket") && L({ type: "maybe_slash", value: "", output: `${m}?` }), d.backtrack === !0) {
|
|
2689
|
+
d.output = "";
|
|
2690
|
+
for (const b of d.tokens)
|
|
2691
|
+
d.output += b.output != null ? b.output : b.value, b.suffix && (d.output += b.suffix);
|
|
2690
2692
|
}
|
|
2691
|
-
return
|
|
2693
|
+
return d;
|
|
2692
2694
|
};
|
|
2693
|
-
|
|
2695
|
+
vs.fastpaths = (t, e) => {
|
|
2694
2696
|
const s = { ...e }, n = typeof s.maxLength == "number" ? Math.min(Ve, s.maxLength) : Ve, i = t.length;
|
|
2695
2697
|
if (i > n)
|
|
2696
2698
|
throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);
|
|
@@ -2702,51 +2704,51 @@ ws.fastpaths = (t, e) => {
|
|
|
2702
2704
|
DOTS_SLASH: u,
|
|
2703
2705
|
NO_DOT: l,
|
|
2704
2706
|
NO_DOTS: c,
|
|
2705
|
-
NO_DOTS_SLASH:
|
|
2706
|
-
STAR:
|
|
2707
|
-
START_ANCHOR:
|
|
2708
|
-
} =
|
|
2709
|
-
let w = s.bash === !0 ? ".*?" :
|
|
2707
|
+
NO_DOTS_SLASH: p,
|
|
2708
|
+
STAR: m,
|
|
2709
|
+
START_ANCHOR: _
|
|
2710
|
+
} = Je.globChars(s.windows), y = s.dot ? c : l, O = s.dot ? p : l, R = s.capture ? "" : "?:", $ = { negated: !1, prefix: "" };
|
|
2711
|
+
let w = s.bash === !0 ? ".*?" : m;
|
|
2710
2712
|
s.capture && (w = `(${w})`);
|
|
2711
|
-
const A = (
|
|
2712
|
-
switch (
|
|
2713
|
+
const A = (E) => E.noglobstar === !0 ? w : `(${R}(?:(?!${_}${E.dot ? u : o}).)*?)`, C = (E) => {
|
|
2714
|
+
switch (E) {
|
|
2713
2715
|
case "*":
|
|
2714
|
-
return `${
|
|
2716
|
+
return `${y}${a}${w}`;
|
|
2715
2717
|
case ".*":
|
|
2716
2718
|
return `${o}${a}${w}`;
|
|
2717
2719
|
case "*.*":
|
|
2718
|
-
return `${
|
|
2720
|
+
return `${y}${w}${o}${a}${w}`;
|
|
2719
2721
|
case "*/*":
|
|
2720
|
-
return `${
|
|
2722
|
+
return `${y}${w}${r}${a}${O}${w}`;
|
|
2721
2723
|
case "**":
|
|
2722
|
-
return
|
|
2724
|
+
return y + A(s);
|
|
2723
2725
|
case "**/*":
|
|
2724
|
-
return `(?:${
|
|
2726
|
+
return `(?:${y}${A(s)}${r})?${O}${a}${w}`;
|
|
2725
2727
|
case "**/*.*":
|
|
2726
|
-
return `(?:${
|
|
2728
|
+
return `(?:${y}${A(s)}${r})?${O}${w}${o}${a}${w}`;
|
|
2727
2729
|
case "**/.*":
|
|
2728
|
-
return `(?:${
|
|
2730
|
+
return `(?:${y}${A(s)}${r})?${o}${a}${w}`;
|
|
2729
2731
|
default: {
|
|
2730
|
-
const
|
|
2731
|
-
if (!
|
|
2732
|
+
const v = /^(.*?)\.(\w+)$/.exec(E);
|
|
2733
|
+
if (!v)
|
|
2732
2734
|
return;
|
|
2733
|
-
const
|
|
2734
|
-
return
|
|
2735
|
+
const x = C(v[1]);
|
|
2736
|
+
return x ? x + o + v[2] : void 0;
|
|
2735
2737
|
}
|
|
2736
2738
|
}
|
|
2737
|
-
},
|
|
2738
|
-
let k =
|
|
2739
|
+
}, S = se.removePrefix(t, $);
|
|
2740
|
+
let k = C(S);
|
|
2739
2741
|
return k && s.strictSlashes !== !0 && (k += `${r}?`), k;
|
|
2740
2742
|
};
|
|
2741
|
-
var pi =
|
|
2742
|
-
const hi = ai, dt = pi,
|
|
2743
|
+
var pi = vs;
|
|
2744
|
+
const hi = ai, dt = pi, ws = qe, di = Ye, mi = (t) => t && typeof t == "object" && !Array.isArray(t), G = (t, e, s = !1) => {
|
|
2743
2745
|
if (Array.isArray(t)) {
|
|
2744
|
-
const c = t.map((
|
|
2745
|
-
return (
|
|
2746
|
-
for (const
|
|
2747
|
-
const
|
|
2748
|
-
if (
|
|
2749
|
-
return
|
|
2746
|
+
const c = t.map((m) => G(m, e, s));
|
|
2747
|
+
return (m) => {
|
|
2748
|
+
for (const _ of c) {
|
|
2749
|
+
const y = _(m);
|
|
2750
|
+
if (y)
|
|
2751
|
+
return y;
|
|
2750
2752
|
}
|
|
2751
2753
|
return !1;
|
|
2752
2754
|
};
|
|
@@ -2761,9 +2763,9 @@ const hi = ai, dt = pi, vs = qe, di = Ye, mi = (t) => t && typeof t == "object"
|
|
|
2761
2763
|
const c = { ...e, ignore: null, onMatch: null, onResult: null };
|
|
2762
2764
|
u = G(i.ignore, c, s);
|
|
2763
2765
|
}
|
|
2764
|
-
const l = (c,
|
|
2765
|
-
const { isMatch:
|
|
2766
|
-
return typeof i.onResult == "function" && i.onResult(
|
|
2766
|
+
const l = (c, p = !1) => {
|
|
2767
|
+
const { isMatch: m, match: _, output: y } = G.test(c, r, e, { glob: t, posix: o }), O = { glob: t, state: a, regex: r, posix: o, input: c, output: y, match: _, isMatch: m };
|
|
2768
|
+
return typeof i.onResult == "function" && i.onResult(O), m === !1 ? (O.isMatch = !1, p ? O : !1) : u(c) ? (typeof i.onIgnore == "function" && i.onIgnore(O), O.isMatch = !1, p ? O : !1) : (typeof i.onMatch == "function" && i.onMatch(O), p ? O : !0);
|
|
2767
2769
|
};
|
|
2768
2770
|
return s && (l.state = a), l;
|
|
2769
2771
|
};
|
|
@@ -2772,11 +2774,11 @@ G.test = (t, e, s, { glob: n, posix: i } = {}) => {
|
|
|
2772
2774
|
throw new TypeError("Expected input to be a string");
|
|
2773
2775
|
if (t === "")
|
|
2774
2776
|
return { isMatch: !1, output: "" };
|
|
2775
|
-
const o = s || {}, r = o.format || (i ?
|
|
2777
|
+
const o = s || {}, r = o.format || (i ? ws.toPosixSlashes : null);
|
|
2776
2778
|
let a = t === n, u = a && r ? r(t) : t;
|
|
2777
2779
|
return a === !1 && (u = r ? r(t) : t, a = u === n), (a === !1 || o.capture === !0) && (o.matchBase === !0 || o.basename === !0 ? a = G.matchBase(t, e, s, i) : a = e.exec(u)), { isMatch: !!a, match: a, output: u };
|
|
2778
2780
|
};
|
|
2779
|
-
G.matchBase = (t, e, s) => (e instanceof RegExp ? e : G.makeRe(e, s)).test(
|
|
2781
|
+
G.matchBase = (t, e, s) => (e instanceof RegExp ? e : G.makeRe(e, s)).test(ws.basename(t));
|
|
2780
2782
|
G.isMatch = (t, e, s) => G(e, s)(t);
|
|
2781
2783
|
G.parse = (t, e) => Array.isArray(t) ? t.map((s) => G.parse(s, e)) : dt(t, { ...e, fastpaths: !1 });
|
|
2782
2784
|
G.scan = (t, e) => hi(t, e);
|
|
@@ -2817,7 +2819,7 @@ const _i = /* @__PURE__ */ mt(gi), Os = yt(fetch), bi = async (t, e) => {
|
|
|
2817
2819
|
retryDelay: 1e3
|
|
2818
2820
|
})).json();
|
|
2819
2821
|
return await ss(i, e || Le);
|
|
2820
|
-
},
|
|
2822
|
+
}, vi = async (t, e) => {
|
|
2821
2823
|
if (t.startsWith("data:") || t.startsWith("https://docs.google.com"))
|
|
2822
2824
|
return;
|
|
2823
2825
|
const s = new URL(t);
|
|
@@ -2842,7 +2844,7 @@ const _i = /* @__PURE__ */ mt(gi), Os = yt(fetch), bi = async (t, e) => {
|
|
|
2842
2844
|
return;
|
|
2843
2845
|
}
|
|
2844
2846
|
}, Ji = (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;
|
|
2845
|
-
class
|
|
2847
|
+
class wi extends Ot.EventEmitter {
|
|
2846
2848
|
constructor(e, s, n, i, o, r = !1) {
|
|
2847
2849
|
if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._cachedEventInputsUpdate = {
|
|
2848
2850
|
iframeId: void 0,
|
|
@@ -2863,21 +2865,21 @@ class vi extends Ot.EventEmitter {
|
|
|
2863
2865
|
const u = this;
|
|
2864
2866
|
this.iframe = new Promise((l) => {
|
|
2865
2867
|
Xe().then(async () => {
|
|
2866
|
-
var c,
|
|
2868
|
+
var c, p, m, _;
|
|
2867
2869
|
if (u._iframe) {
|
|
2868
|
-
if ((
|
|
2870
|
+
if ((_ = (m = (p = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : p.metaframes) == null ? void 0 : m[this.id]) != null && _.allow)
|
|
2869
2871
|
u._iframe.allow = this._metapage._definition.metaframes[this.id].allow, this._debug && this.log(`mf allow=${u._iframe.allow} from this._metapage?._definition`);
|
|
2870
2872
|
else {
|
|
2871
|
-
let
|
|
2872
|
-
if (
|
|
2873
|
+
let y = Rt(this.url, "definition");
|
|
2874
|
+
if (y = y && (y != null && y.version) ? await pt(y) : void 0, !u._iframe)
|
|
2873
2875
|
return;
|
|
2874
|
-
if (
|
|
2875
|
-
u._iframe.allow =
|
|
2876
|
+
if (y != null && y.allow)
|
|
2877
|
+
u._iframe.allow = y.allow;
|
|
2876
2878
|
else {
|
|
2877
|
-
let
|
|
2878
|
-
if (this._debug && this.log(`mf metaframeDef=${JSON.stringify(
|
|
2879
|
+
let O = await u.getDefinition();
|
|
2880
|
+
if (this._debug && this.log(`mf metaframeDef=${JSON.stringify(O)}`), O = O && (O != null && O.version) ? await pt(O) : void 0, this._debug && this.log(`mf metaframeDef=${JSON.stringify(O)}`), !u._iframe)
|
|
2879
2881
|
return;
|
|
2880
|
-
|
|
2882
|
+
O && O.allow && (u._iframe.allow = O.allow);
|
|
2881
2883
|
}
|
|
2882
2884
|
}
|
|
2883
2885
|
this._debug && this.log(`mf allow=${u._iframe.allow} from ${this.url}`), u._iframe.src = this.url, l(u._iframe);
|
|
@@ -2901,12 +2903,12 @@ class vi extends Ot.EventEmitter {
|
|
|
2901
2903
|
if (this._definition)
|
|
2902
2904
|
return this._definition;
|
|
2903
2905
|
try {
|
|
2904
|
-
const s = await
|
|
2906
|
+
const s = await vi(this.url);
|
|
2905
2907
|
if (s)
|
|
2906
2908
|
return this._definition = s, this._definition;
|
|
2907
2909
|
} catch (s) {
|
|
2908
2910
|
var e = this.getDefinitionUrl();
|
|
2909
|
-
this.emit(
|
|
2911
|
+
this.emit(I.Warning, `Failed to fetch or convert: ${e}
|
|
2910
2912
|
Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? void 0 : s.toString()}`);
|
|
2911
2913
|
}
|
|
2912
2914
|
}
|
|
@@ -2918,11 +2920,11 @@ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? v
|
|
|
2918
2920
|
setInputs(e) {
|
|
2919
2921
|
this.log({ m: "MetapageIFrameRpcClient", inputs: e });
|
|
2920
2922
|
const s = e;
|
|
2921
|
-
if (this.inputs =
|
|
2923
|
+
if (this.inputs = Ge(this.inputs, e), this.inputs === s)
|
|
2922
2924
|
return this;
|
|
2923
|
-
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(
|
|
2925
|
+
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(I.Inputs, this.inputs), this._metapage.listenerCount(I.Inputs) > 0) {
|
|
2924
2926
|
var n = {};
|
|
2925
|
-
n[this.id] = e, this._metapage.emit(
|
|
2927
|
+
n[this.id] = e, this._metapage.emit(I.Inputs, n);
|
|
2926
2928
|
}
|
|
2927
2929
|
return this;
|
|
2928
2930
|
}
|
|
@@ -2933,30 +2935,30 @@ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? v
|
|
|
2933
2935
|
}
|
|
2934
2936
|
setOutputs(e) {
|
|
2935
2937
|
const s = e;
|
|
2936
|
-
if (this.outputs =
|
|
2938
|
+
if (this.outputs = Ge(this.outputs, e), this.outputs === s)
|
|
2937
2939
|
return this;
|
|
2938
|
-
if (this.emit(
|
|
2940
|
+
if (this.emit(I.Outputs, e), this._metapage.listenerCount(I.Outputs) > 0) {
|
|
2939
2941
|
var n = {};
|
|
2940
|
-
n[this.id] = this.outputs, this._metapage.emit(
|
|
2942
|
+
n[this.id] = this.outputs, this._metapage.emit(I.Outputs, n);
|
|
2941
2943
|
}
|
|
2942
2944
|
}
|
|
2943
2945
|
onInputs(e) {
|
|
2944
|
-
return this.addListenerReturnDisposer(
|
|
2946
|
+
return this.addListenerReturnDisposer(I.Inputs, e);
|
|
2945
2947
|
}
|
|
2946
2948
|
onInput(e, s) {
|
|
2947
2949
|
var n = function(i) {
|
|
2948
2950
|
i.hasOwnProperty(e) && s(i[e]);
|
|
2949
2951
|
};
|
|
2950
|
-
return this.addListenerReturnDisposer(
|
|
2952
|
+
return this.addListenerReturnDisposer(I.Inputs, n);
|
|
2951
2953
|
}
|
|
2952
2954
|
onOutputs(e) {
|
|
2953
|
-
return this.addListenerReturnDisposer(
|
|
2955
|
+
return this.addListenerReturnDisposer(I.Outputs, e);
|
|
2954
2956
|
}
|
|
2955
2957
|
onOutput(e, s) {
|
|
2956
2958
|
var n = function(i) {
|
|
2957
2959
|
i.hasOwnProperty(e) && s(i[e]);
|
|
2958
2960
|
};
|
|
2959
|
-
return this.addListenerReturnDisposer(
|
|
2961
|
+
return this.addListenerReturnDisposer(I.Outputs, n);
|
|
2960
2962
|
}
|
|
2961
2963
|
isDisposed() {
|
|
2962
2964
|
return this.inputs === void 0;
|
|
@@ -3047,12 +3049,12 @@ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? v
|
|
|
3047
3049
|
}
|
|
3048
3050
|
}
|
|
3049
3051
|
}
|
|
3050
|
-
const ge =
|
|
3052
|
+
const ge = M({
|
|
3051
3053
|
metaframes: {
|
|
3052
3054
|
inputs: {},
|
|
3053
3055
|
outputs: {}
|
|
3054
3056
|
}
|
|
3055
|
-
}, (t) => t),
|
|
3057
|
+
}, (t) => t), Vi = (t) => he(t), Oi = (t, e) => !!(!e || e === "**" || t === e || _i.isMatch(t, e)), Ri = "bcbcbc";
|
|
3056
3058
|
class ee extends Hn {
|
|
3057
3059
|
static async from(e, s) {
|
|
3058
3060
|
if (e == null)
|
|
@@ -3067,7 +3069,7 @@ class ee extends Hn {
|
|
|
3067
3069
|
return n.setDefinition(e);
|
|
3068
3070
|
}
|
|
3069
3071
|
constructor(e) {
|
|
3070
|
-
super(), this._state = ge, this._metaframes =
|
|
3072
|
+
super(), this._state = ge, this._metaframes = M({}, (s) => s), this.debug = ht(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = M({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : jn(), this._consoleBackgroundColor = e && e.color ? e.color : Ri, 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.onMessageJsonRpc = this.onMessageJsonRpc.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.setOutputs = this.setOutputs.bind(this), this.onInputs = this.onInputs.bind(this), this.onOutputs = this.onOutputs.bind(this), this.onState = this.onState.bind(this), this.setMetaframeOutputs = this.setMetaframeOutputs.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), Xe().then(() => {
|
|
3071
3073
|
this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
|
|
3072
3074
|
});
|
|
3073
3075
|
}
|
|
@@ -3080,13 +3082,13 @@ class ee extends Hn {
|
|
|
3080
3082
|
};
|
|
3081
3083
|
}
|
|
3082
3084
|
onInputs(e) {
|
|
3083
|
-
return this.addListenerReturnDisposer(
|
|
3085
|
+
return this.addListenerReturnDisposer(I.Inputs, e);
|
|
3084
3086
|
}
|
|
3085
3087
|
onOutputs(e) {
|
|
3086
|
-
return this.addListenerReturnDisposer(
|
|
3088
|
+
return this.addListenerReturnDisposer(I.Outputs, e);
|
|
3087
3089
|
}
|
|
3088
3090
|
onState(e) {
|
|
3089
|
-
return this.addListenerReturnDisposer(
|
|
3091
|
+
return this.addListenerReturnDisposer(I.State, e);
|
|
3090
3092
|
}
|
|
3091
3093
|
setDebugFromUrlParams() {
|
|
3092
3094
|
const e = new URL(window.location.href);
|
|
@@ -3096,10 +3098,10 @@ class ee extends Hn {
|
|
|
3096
3098
|
return this._state;
|
|
3097
3099
|
}
|
|
3098
3100
|
setState(e) {
|
|
3099
|
-
this._state =
|
|
3101
|
+
this._state = M(e, (s) => s), this.getMetaframeIds().forEach((s) => {
|
|
3100
3102
|
var n, i;
|
|
3101
3103
|
(n = this.getMetaframe(s)) == null || n.setInputs(this._state.metaframes.inputs[s]), (i = this.getMetaframe(s)) == null || i.setOutputs(this._state.metaframes.outputs[s]);
|
|
3102
|
-
}), this.listenerCount(
|
|
3104
|
+
}), this.listenerCount(I.State) > 0 && ge !== this._state && this.emit(I.State, this._state);
|
|
3103
3105
|
}
|
|
3104
3106
|
getStateMetaframes() {
|
|
3105
3107
|
return this._state.metaframes;
|
|
@@ -3123,50 +3125,50 @@ class ee extends Hn {
|
|
|
3123
3125
|
const i = this._definition;
|
|
3124
3126
|
return this._definition = n, Object.keys(this._metaframes).forEach((o) => {
|
|
3125
3127
|
(!n.metaframes || !n.metaframes[o]) && this.removeMetaframe(o);
|
|
3126
|
-
}), s && (this._state =
|
|
3128
|
+
}), s && (this._state = M(s, (o) => o)), n.metaframes && Object.keys(n.metaframes).forEach((o) => {
|
|
3127
3129
|
if (!this._metaframes.hasOwnProperty(o)) {
|
|
3128
3130
|
const r = n.metaframes[o];
|
|
3129
3131
|
this.addMetaframe(o, r);
|
|
3130
3132
|
}
|
|
3131
3133
|
}), i !== ps && window.setTimeout(() => {
|
|
3132
|
-
!this.isDisposed() && n === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(
|
|
3134
|
+
!this.isDisposed() && n === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(I.State) > 0 && ge !== this._state && this.emit(I.State, this._state));
|
|
3133
3135
|
}, 0), this;
|
|
3134
3136
|
}
|
|
3135
3137
|
setMetadata(e) {
|
|
3136
|
-
this._definition =
|
|
3138
|
+
this._definition = M(this._definition, (s) => {
|
|
3137
3139
|
s.meta = e;
|
|
3138
3140
|
}), this._emitDefinitionEvent();
|
|
3139
3141
|
}
|
|
3140
3142
|
_emitDefinitionEvent() {
|
|
3141
|
-
if (this.listenerCount(
|
|
3143
|
+
if (this.listenerCount(I.Definition) > 0) {
|
|
3142
3144
|
const e = {
|
|
3143
3145
|
definition: this._definition,
|
|
3144
3146
|
metaframes: this._metaframes
|
|
3145
3147
|
};
|
|
3146
|
-
this.emit(
|
|
3148
|
+
this.emit(I.Definition, e);
|
|
3147
3149
|
}
|
|
3148
3150
|
}
|
|
3149
3151
|
addPipe(e, s) {
|
|
3150
|
-
this._inputMap =
|
|
3152
|
+
this._inputMap = M(this._inputMap, (n) => {
|
|
3151
3153
|
n[e] || (n[e] = []), n[e].push(s);
|
|
3152
3154
|
});
|
|
3153
3155
|
}
|
|
3154
3156
|
removeMetaframe(e) {
|
|
3155
|
-
this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes =
|
|
3157
|
+
this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = M(this._metaframes, (s) => {
|
|
3156
3158
|
delete s[e];
|
|
3157
|
-
}), this._state =
|
|
3159
|
+
}), this._state = M(this._state, (s) => {
|
|
3158
3160
|
delete s.metaframes.inputs[e], delete s.metaframes.outputs[e];
|
|
3159
|
-
}), this._inputMap =
|
|
3161
|
+
}), this._inputMap = M(this._inputMap, (s) => {
|
|
3160
3162
|
delete s[e], Object.keys(s).forEach((n) => {
|
|
3161
3163
|
const i = s[n];
|
|
3162
3164
|
let o = 0;
|
|
3163
3165
|
for (; o <= i.length; )
|
|
3164
3166
|
i[o] && i[o].metaframe === e ? i.splice(o, 1) : o++;
|
|
3165
3167
|
});
|
|
3166
|
-
}), this._cachedInputLookupMap =
|
|
3168
|
+
}), this._cachedInputLookupMap = M({}, (s) => s));
|
|
3167
3169
|
}
|
|
3168
3170
|
removeAll() {
|
|
3169
|
-
Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes =
|
|
3171
|
+
Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = M({}, (e) => e), this._state = ge, this._inputMap = M({}, (e) => e), this._cachedInputLookupMap = M({}, (e) => e);
|
|
3170
3172
|
}
|
|
3171
3173
|
metaframes() {
|
|
3172
3174
|
return this.getMetaframes();
|
|
@@ -3193,11 +3195,11 @@ class ee extends Hn {
|
|
|
3193
3195
|
throw this.emitErrorMessage(`Existing metaframe for id=${e}`), `Existing metaframe for id=${e}`;
|
|
3194
3196
|
if (!s.url)
|
|
3195
3197
|
throw this.emitErrorMessage(`Metaframe definition missing url id=${e}`), `Metaframe definition missing url id=${e}`;
|
|
3196
|
-
var n = new
|
|
3197
|
-
return this._metaframes =
|
|
3198
|
+
var n = new wi(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
|
|
3199
|
+
return this._metaframes = M(this._metaframes, (i) => {
|
|
3198
3200
|
i[e] = n;
|
|
3199
|
-
}), n.addListener(
|
|
3200
|
-
this.emit(
|
|
3201
|
+
}), n.addListener(I.Error, (i) => {
|
|
3202
|
+
this.emit(I.Error, {
|
|
3201
3203
|
metaframeId: n.id,
|
|
3202
3204
|
metaframeUrl: n.url,
|
|
3203
3205
|
error: i
|
|
@@ -3214,12 +3216,12 @@ class ee extends Hn {
|
|
|
3214
3216
|
this.logInternal(e, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${e}`);
|
|
3215
3217
|
}
|
|
3216
3218
|
emitErrorMessage(e) {
|
|
3217
|
-
this.emit(
|
|
3219
|
+
this.emit(I.Error, e);
|
|
3218
3220
|
}
|
|
3219
3221
|
getInputsFromOutput(e, s) {
|
|
3220
|
-
return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap =
|
|
3221
|
-
n[e] =
|
|
3222
|
-
})), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap =
|
|
3222
|
+
return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = M(this._cachedInputLookupMap, (n) => {
|
|
3223
|
+
n[e] = M({}, (i) => i);
|
|
3224
|
+
})), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap = M(this._cachedInputLookupMap, (n) => {
|
|
3223
3225
|
var i = [];
|
|
3224
3226
|
n[e][s] = i, Object.keys(this._inputMap).forEach((o) => {
|
|
3225
3227
|
o !== e && this._inputMap[o].forEach((r) => {
|
|
@@ -3235,7 +3237,7 @@ class ee extends Hn {
|
|
|
3235
3237
|
if (e.jsonrpc !== "2.0")
|
|
3236
3238
|
return !1;
|
|
3237
3239
|
switch (e.method) {
|
|
3238
|
-
case
|
|
3240
|
+
case K.SetupIframeClientRequest:
|
|
3239
3241
|
return !0;
|
|
3240
3242
|
default:
|
|
3241
3243
|
var n = e.iframeId;
|
|
@@ -3244,7 +3246,7 @@ class ee extends Hn {
|
|
|
3244
3246
|
}
|
|
3245
3247
|
setInput(e, s, n) {
|
|
3246
3248
|
var i, o;
|
|
3247
|
-
typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount(
|
|
3249
|
+
typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount(I.State) > 0 || this.listenerCount(I.Inputs) > 0) && ge !== this._state && (this.emit(I.State, this._state), this.emit(I.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
|
|
3248
3250
|
}
|
|
3249
3251
|
setMetaframeClientInputAndSentClientEvent(e, s, n) {
|
|
3250
3252
|
if (typeof e == "object") {
|
|
@@ -3291,7 +3293,7 @@ class ee extends Hn {
|
|
|
3291
3293
|
this._setStateOnlyMetaframeInputMap(!0, e, s);
|
|
3292
3294
|
}
|
|
3293
3295
|
_setStateOnlyMetaframeInputValue(e, s, n, i) {
|
|
3294
|
-
this._state =
|
|
3296
|
+
this._state = M(this._state, (o) => {
|
|
3295
3297
|
if (!this._metaframes.hasOwnProperty(s))
|
|
3296
3298
|
throw `No metaframe: ${s}`;
|
|
3297
3299
|
o.metaframes || (o.metaframes = { inputs: {}, outputs: {} }), e ? o.metaframes.inputs || (o.metaframes.inputs = {}) : o.metaframes.outputs || (o.metaframes.outputs = {});
|
|
@@ -3300,7 +3302,7 @@ class ee extends Hn {
|
|
|
3300
3302
|
});
|
|
3301
3303
|
}
|
|
3302
3304
|
_setStateOnlyMetaframeInputMap(e, s, n) {
|
|
3303
|
-
!n || Object.keys(n).length === 0 || (this._state =
|
|
3305
|
+
!n || Object.keys(n).length === 0 || (this._state = M(this._state, (i) => {
|
|
3304
3306
|
if (!this._metaframes.hasOwnProperty(s))
|
|
3305
3307
|
throw `No metaframe: ${s}`;
|
|
3306
3308
|
let r = e ? i.metaframes.inputs : i.metaframes.outputs;
|
|
@@ -3310,7 +3312,7 @@ class ee extends Hn {
|
|
|
3310
3312
|
}));
|
|
3311
3313
|
}
|
|
3312
3314
|
_setStateOnlyMetaframes(e, s) {
|
|
3313
|
-
!s || Object.keys(s).length === 0 || (this._state =
|
|
3315
|
+
!s || Object.keys(s).length === 0 || (this._state = M(this._state, (n) => {
|
|
3314
3316
|
Object.keys(s).forEach((i) => {
|
|
3315
3317
|
var o = s[i];
|
|
3316
3318
|
if (typeof o != "object")
|
|
@@ -3329,7 +3331,7 @@ class ee extends Hn {
|
|
|
3329
3331
|
iframeId: e,
|
|
3330
3332
|
parentId: this._id,
|
|
3331
3333
|
jsonrpc: "2.0",
|
|
3332
|
-
method:
|
|
3334
|
+
method: K.OutputsUpdate,
|
|
3333
3335
|
id: "_",
|
|
3334
3336
|
params: s
|
|
3335
3337
|
});
|
|
@@ -3355,16 +3357,16 @@ class ee extends Hn {
|
|
|
3355
3357
|
const i = this.getMetaframe(n);
|
|
3356
3358
|
if (i) {
|
|
3357
3359
|
switch (e._messageCount = ++this._internalReceivedMessageCounter, this.debug && this.log(`processing ${JSON.stringify(e, null, " ").substring(0, 500)}`), s) {
|
|
3358
|
-
case
|
|
3360
|
+
case K.SetupIframeClientRequest:
|
|
3359
3361
|
i.register();
|
|
3360
3362
|
break;
|
|
3361
|
-
case
|
|
3363
|
+
case K.SetupIframeServerResponseAck:
|
|
3362
3364
|
if (i) {
|
|
3363
3365
|
const l = e.params;
|
|
3364
3366
|
i.registered(l.version);
|
|
3365
3367
|
}
|
|
3366
3368
|
break;
|
|
3367
|
-
case
|
|
3369
|
+
case K.OutputsUpdate:
|
|
3368
3370
|
const u = e.params;
|
|
3369
3371
|
if (!u || Object.keys(u).length === 0)
|
|
3370
3372
|
break;
|
|
@@ -3373,36 +3375,36 @@ class ee extends Hn {
|
|
|
3373
3375
|
this.setOutputStateOnlyMetaframeInputMap(n, u), o.setOutputs(u);
|
|
3374
3376
|
var r = !1;
|
|
3375
3377
|
const l = Object.keys(u), c = {};
|
|
3376
|
-
l.forEach((
|
|
3377
|
-
const
|
|
3378
|
-
|
|
3379
|
-
c[
|
|
3378
|
+
l.forEach((p, m) => {
|
|
3379
|
+
const _ = this.getInputsFromOutput(n, p);
|
|
3380
|
+
_.length > 0 && _.forEach((y) => {
|
|
3381
|
+
c[y.metaframe] || (c[y.metaframe] = {}), c[y.metaframe][y.pipe] = u[p], r = !0;
|
|
3380
3382
|
});
|
|
3381
|
-
}), r && (this.setInputStateOnlyMetapageInstanceInputs(c), Object.keys(c).forEach((
|
|
3382
|
-
this._metaframes[
|
|
3383
|
-
})), this.listenerCount(
|
|
3383
|
+
}), r && (this.setInputStateOnlyMetapageInstanceInputs(c), Object.keys(c).forEach((p) => {
|
|
3384
|
+
this._metaframes[p].setInputs(c[p]);
|
|
3385
|
+
})), this.listenerCount(I.State) > 0 && ge !== this._state && this.emit(I.State, this._state), this.debug && o.ack({ jsonrpc: e, state: this._state });
|
|
3384
3386
|
} else
|
|
3385
3387
|
this.error(`missing metaframe=${n}`);
|
|
3386
3388
|
break;
|
|
3387
|
-
case
|
|
3389
|
+
case K.InputsUpdate:
|
|
3388
3390
|
var a = e.params;
|
|
3389
|
-
this.debug && this.log(`inputs ${JSON.stringify(a)} from ${n}`), this._metaframes[n] ? (this.setInputStateOnlyMetaframeInputMap(n, a), this._metaframes[n].setInputs(a), this.listenerCount(
|
|
3391
|
+
this.debug && this.log(`inputs ${JSON.stringify(a)} from ${n}`), this._metaframes[n] ? (this.setInputStateOnlyMetaframeInputMap(n, a), this._metaframes[n].setInputs(a), this.listenerCount(I.State) > 0 && ge !== this._state && this.emit(I.State, this._state), this.debug && this._metaframes[n].ack({
|
|
3390
3392
|
jsonrpc: e,
|
|
3391
3393
|
state: this._state
|
|
3392
3394
|
})) : (console.error(`InputsUpdate failed no metaframe id: "${n}"`), this.error(`InputsUpdate failed no metaframe id: "${n}"`));
|
|
3393
3395
|
break;
|
|
3394
|
-
case
|
|
3396
|
+
case K.HashParamsUpdate:
|
|
3395
3397
|
if (i) {
|
|
3396
3398
|
const l = e.params, c = new URL(i.url);
|
|
3397
|
-
c.hash = l.hash, i.url = c.href, this._definition =
|
|
3398
|
-
|
|
3399
|
+
c.hash = l.hash, i.url = c.href, this._definition = M(this._definition, (p) => {
|
|
3400
|
+
p.metaframes[l.metaframe].url = c.href;
|
|
3399
3401
|
}), this._emitDefinitionEvent();
|
|
3400
3402
|
}
|
|
3401
3403
|
break;
|
|
3402
3404
|
default:
|
|
3403
3405
|
this.debug && this.log(`Unknown RPC method: "${s}"`);
|
|
3404
3406
|
}
|
|
3405
|
-
this.listenerCount(
|
|
3407
|
+
this.listenerCount(I.Message) > 0 && this.emit(I.Message, e);
|
|
3406
3408
|
}
|
|
3407
3409
|
}
|
|
3408
3410
|
logInternal(e, s, n) {
|
|
@@ -3412,12 +3414,12 @@ class ee extends Hn {
|
|
|
3412
3414
|
}
|
|
3413
3415
|
}
|
|
3414
3416
|
ee.version = Wt;
|
|
3415
|
-
ee.DEFINITION =
|
|
3416
|
-
ee.ERROR =
|
|
3417
|
-
ee.INPUTS =
|
|
3418
|
-
ee.MESSAGE =
|
|
3419
|
-
ee.OUTPUTS =
|
|
3420
|
-
ee.STATE =
|
|
3417
|
+
ee.DEFINITION = I.Definition;
|
|
3418
|
+
ee.ERROR = I.Error;
|
|
3419
|
+
ee.INPUTS = I.Inputs;
|
|
3420
|
+
ee.MESSAGE = I.Message;
|
|
3421
|
+
ee.OUTPUTS = I.Outputs;
|
|
3422
|
+
ee.STATE = I.State;
|
|
3421
3423
|
ee.deserializeInputs = Ce;
|
|
3422
3424
|
ee.serializeInputs = Ke;
|
|
3423
3425
|
function It(t) {
|
|
@@ -3456,8 +3458,34 @@ function Si(t) {
|
|
|
3456
3458
|
}
|
|
3457
3459
|
return e;
|
|
3458
3460
|
}
|
|
3459
|
-
|
|
3460
|
-
var
|
|
3461
|
+
const Ai = (t) => {
|
|
3462
|
+
var l, c, p;
|
|
3463
|
+
const e = (c = (l = t == null ? void 0 : t.meta) == null ? void 0 : l.layouts) == null ? void 0 : c["react-grid-layout"], s = e == null ? void 0 : e.layout;
|
|
3464
|
+
if (!e || !s)
|
|
3465
|
+
throw new Error("No valid layout found in metapage definition");
|
|
3466
|
+
const n = /* @__PURE__ */ new Set(), i = s.map((m, _) => {
|
|
3467
|
+
const y = t.metaframes[m.i];
|
|
3468
|
+
return y && It(y.url) ? { index: _, y: m.y, id: m.i } : null;
|
|
3469
|
+
}).filter((m) => m !== null);
|
|
3470
|
+
if (i.length > 0) {
|
|
3471
|
+
const m = i.reduce((y, O) => O.y < y.y ? O : y), _ = ((p = s.find((y) => y.i === m.id)) == null ? void 0 : p.y) ?? 0;
|
|
3472
|
+
s.forEach((y) => {
|
|
3473
|
+
y.y >= _ && n.add(y.i);
|
|
3474
|
+
});
|
|
3475
|
+
}
|
|
3476
|
+
const o = Object.keys(t.metaframes).filter((m) => !n.has(m)), r = Object.keys(t.metaframes).filter((m) => n.has(m));
|
|
3477
|
+
let a = s.filter((m) => o.includes(m.i));
|
|
3478
|
+
a.sort((m, _) => m.y !== _.y ? m.y - _.y : m.x - _.x);
|
|
3479
|
+
const u = a.reduce((m, _) => Math.max(m, _.y + _.h), 0);
|
|
3480
|
+
return {
|
|
3481
|
+
visibleLayoutItems: a,
|
|
3482
|
+
hiddenMetaframeIds: new Set(r),
|
|
3483
|
+
visibleMetaframeIds: new Set(o),
|
|
3484
|
+
totalVisibleGridHeight: u
|
|
3485
|
+
};
|
|
3486
|
+
};
|
|
3487
|
+
async function Wi(t) {
|
|
3488
|
+
var C, S, k, E;
|
|
3461
3489
|
let { url: e, definition: s, onOutputs: n, rootDiv: i, options: o = {} } = t;
|
|
3462
3490
|
if (!e && !s)
|
|
3463
3491
|
throw new Error("Either url or definition must be provided");
|
|
@@ -3465,80 +3493,69 @@ async function Vi(t) {
|
|
|
3465
3493
|
throw new Error("Either url or definition must be provided, not both");
|
|
3466
3494
|
if (e && (s = await bi(e)), !s)
|
|
3467
3495
|
throw new Error("Failed to fetch metapage definition");
|
|
3468
|
-
s = Si(s), s = await
|
|
3496
|
+
s = Si(s), s = await Mi(s), await Xe();
|
|
3469
3497
|
const r = new ee();
|
|
3470
3498
|
r.debug = o.debug || !1;
|
|
3471
3499
|
try {
|
|
3472
3500
|
await r.setDefinition(JSON.parse(JSON.stringify(s)));
|
|
3473
|
-
} catch (
|
|
3474
|
-
throw r.dispose(), new Error(`Failed to set metapage definition: ${
|
|
3501
|
+
} catch (v) {
|
|
3502
|
+
throw r.dispose(), new Error(`Failed to set metapage definition: ${v}`);
|
|
3475
3503
|
}
|
|
3476
3504
|
const a = [];
|
|
3477
|
-
n && a.push(r.addListenerReturnDisposer(
|
|
3478
|
-
const u = (
|
|
3505
|
+
n && a.push(r.addListenerReturnDisposer(I.Outputs, n));
|
|
3506
|
+
const u = (S = (C = s == null ? void 0 : s.meta) == null ? void 0 : C.layouts) == null ? void 0 : S["react-grid-layout"], l = u == null ? void 0 : u.layout;
|
|
3479
3507
|
if (!u || !l)
|
|
3480
3508
|
throw new Error("No valid layout found in metapage definition");
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
return I && It(I.url) ? { index: M, y: f.y, id: f.i } : null;
|
|
3484
|
-
}).filter((f) => f !== null);
|
|
3485
|
-
if (d.length > 0) {
|
|
3486
|
-
const f = d.reduce((I, B) => B.y < I.y ? B : I), M = ((R = l.find((I) => I.i === f.id)) == null ? void 0 : R.y) ?? 0;
|
|
3487
|
-
l.forEach((I) => {
|
|
3488
|
-
I.y >= M && c.add(I.i);
|
|
3489
|
-
});
|
|
3490
|
-
}
|
|
3491
|
-
const g = r.getMetaframeIds().filter((f) => !c.has(f));
|
|
3492
|
-
let v = l.filter((f) => g.includes(f.i));
|
|
3493
|
-
if (v.length === 0)
|
|
3509
|
+
let { visibleLayoutItems: c, hiddenMetaframeIds: p, visibleMetaframeIds: m } = Ai(r.getDefinition());
|
|
3510
|
+
if (c.length === 0)
|
|
3494
3511
|
return {
|
|
3495
3512
|
metapage: r,
|
|
3496
|
-
setInputs: (
|
|
3497
|
-
r.isDisposed() || r.setInputs(
|
|
3513
|
+
setInputs: (v) => {
|
|
3514
|
+
r.isDisposed() || r.setInputs(v);
|
|
3498
3515
|
},
|
|
3499
|
-
setOutputs: (
|
|
3500
|
-
r.isDisposed() || r.setOutputs(
|
|
3516
|
+
setOutputs: (v) => {
|
|
3517
|
+
r.isDisposed() || r.setOutputs(v);
|
|
3501
3518
|
},
|
|
3502
3519
|
dispose: () => {
|
|
3503
|
-
a.forEach((
|
|
3520
|
+
a.forEach((v) => v()), r.dispose();
|
|
3504
3521
|
}
|
|
3505
3522
|
};
|
|
3506
|
-
|
|
3507
|
-
const
|
|
3523
|
+
c.sort((v, x) => v.y !== x.y ? v.y - x.y : v.x - x.x);
|
|
3524
|
+
const _ = {
|
|
3508
3525
|
display: "grid",
|
|
3509
3526
|
gridTemplateColumns: "repeat(1, 1fr)",
|
|
3510
3527
|
gridAutoRows: "1fr",
|
|
3511
|
-
gap: `${((
|
|
3528
|
+
gap: `${((k = u.props.margin) == null ? void 0 : k[0]) || 10}px`,
|
|
3512
3529
|
width: "100%",
|
|
3513
3530
|
height: "100%",
|
|
3514
3531
|
maxHeight: "100%",
|
|
3515
|
-
padding: ((
|
|
3532
|
+
padding: ((E = u.props.containerPadding) == null ? void 0 : E[0]) || 0,
|
|
3516
3533
|
minHeight: 0,
|
|
3517
3534
|
alignContent: "start",
|
|
3518
3535
|
alignItems: "start",
|
|
3519
3536
|
overflow: "hidden"
|
|
3520
|
-
},
|
|
3537
|
+
}, y = {
|
|
3521
3538
|
width: "100%",
|
|
3522
3539
|
height: "100%",
|
|
3523
3540
|
overflow: "hidden",
|
|
3524
3541
|
display: "flex",
|
|
3525
3542
|
flexDirection: "column"
|
|
3526
|
-
},
|
|
3527
|
-
Object.assign(
|
|
3528
|
-
const
|
|
3529
|
-
Object.assign(
|
|
3530
|
-
const
|
|
3531
|
-
for (const
|
|
3532
|
-
const
|
|
3533
|
-
if (!
|
|
3543
|
+
}, O = document.createElement("div");
|
|
3544
|
+
Object.assign(O.style, y);
|
|
3545
|
+
const R = document.createElement("div");
|
|
3546
|
+
Object.assign(R.style, _);
|
|
3547
|
+
const $ = [];
|
|
3548
|
+
for (const v of m) {
|
|
3549
|
+
const x = l.find((f) => f.i === v);
|
|
3550
|
+
if (!x)
|
|
3534
3551
|
continue;
|
|
3535
|
-
const
|
|
3536
|
-
if (!
|
|
3552
|
+
const d = r.getMetaframes()[v], T = await d.iframe;
|
|
3553
|
+
if (!d)
|
|
3537
3554
|
continue;
|
|
3538
|
-
|
|
3539
|
-
const
|
|
3540
|
-
gridColumn: `${
|
|
3541
|
-
gridRow: `${
|
|
3555
|
+
$.push(x);
|
|
3556
|
+
const H = {
|
|
3557
|
+
gridColumn: `${x.x + 1} / span ${x.w}`,
|
|
3558
|
+
gridRow: `${x.y + 1} / span ${x.h}`,
|
|
3542
3559
|
overflow: "hidden",
|
|
3543
3560
|
width: "100%",
|
|
3544
3561
|
height: "100%",
|
|
@@ -3546,66 +3563,66 @@ async function Vi(t) {
|
|
|
3546
3563
|
position: "relative",
|
|
3547
3564
|
alignSelf: "stretch",
|
|
3548
3565
|
justifySelf: "stretch"
|
|
3549
|
-
},
|
|
3550
|
-
Object.assign(
|
|
3551
|
-
}
|
|
3552
|
-
const
|
|
3553
|
-
Math.max(
|
|
3554
|
-
const
|
|
3555
|
-
|
|
3556
|
-
for (const
|
|
3557
|
-
const
|
|
3558
|
-
if (!
|
|
3566
|
+
}, Z = document.createElement("div");
|
|
3567
|
+
Object.assign(Z.style, H), Z.appendChild(T), R.appendChild(Z);
|
|
3568
|
+
}
|
|
3569
|
+
const w = Math.max(...$.map((v) => v.x + v.w));
|
|
3570
|
+
Math.max(...$.map((v) => v.y + v.h)), R.style.gridTemplateColumns = `repeat(${Math.max(1, w)}, 1fr)`;
|
|
3571
|
+
const A = document.createElement("div");
|
|
3572
|
+
A.style.position = "absolute", A.style.top = "-9999px", A.style.left = "-9999px", A.style.width = "1px", A.style.height = "1px", A.style.overflow = "hidden", A.style.pointerEvents = "none";
|
|
3573
|
+
for (const v of Object.keys(r.getMetaframes()).filter((x) => p.has(x))) {
|
|
3574
|
+
const x = r.getMetaframes()[v];
|
|
3575
|
+
if (!x)
|
|
3559
3576
|
continue;
|
|
3560
|
-
const
|
|
3561
|
-
|
|
3562
|
-
let
|
|
3563
|
-
|
|
3577
|
+
const d = document.createElement("div");
|
|
3578
|
+
d.setAttribute("data-metaframe-id", v), d.style.width = "100px", d.style.height = "100px";
|
|
3579
|
+
let T;
|
|
3580
|
+
x.iframe ? T = await x.iframe : (T = document.createElement("iframe"), T.src = x.url, T.style.border = "none", T.style.width = "100%", T.style.height = "100%"), d.appendChild(T), A.appendChild(d);
|
|
3564
3581
|
}
|
|
3565
|
-
return
|
|
3582
|
+
return O.appendChild(R), O.appendChild(A), i.appendChild(O), {
|
|
3566
3583
|
metapage: r,
|
|
3567
|
-
setInputs: (
|
|
3568
|
-
r.isDisposed() || r.setInputs(
|
|
3584
|
+
setInputs: (v) => {
|
|
3585
|
+
r.isDisposed() || r.setInputs(v);
|
|
3569
3586
|
},
|
|
3570
|
-
setOutputs: (
|
|
3571
|
-
r.isDisposed() || r.setOutputs(
|
|
3587
|
+
setOutputs: (v) => {
|
|
3588
|
+
r.isDisposed() || r.setOutputs(v);
|
|
3572
3589
|
},
|
|
3573
3590
|
dispose: () => {
|
|
3574
|
-
a.forEach((
|
|
3591
|
+
a.forEach((v) => v()), r.dispose(), O.parentNode && O.parentNode.removeChild(O);
|
|
3575
3592
|
}
|
|
3576
3593
|
};
|
|
3577
3594
|
}
|
|
3578
|
-
const
|
|
3595
|
+
const Ki = (t, e) => {
|
|
3579
3596
|
var r, a, u;
|
|
3580
3597
|
const s = (a = (r = t == null ? void 0 : t.meta) == null ? void 0 : r.layouts) == null ? void 0 : a["react-grid-layout"], n = s == null ? void 0 : s.layout;
|
|
3581
3598
|
if (!s || !n)
|
|
3582
3599
|
throw new Error("No valid layout found in metapage definition");
|
|
3583
3600
|
const i = /* @__PURE__ */ new Set(), o = n.map((l, c) => {
|
|
3584
|
-
var
|
|
3585
|
-
const
|
|
3586
|
-
return
|
|
3601
|
+
var m;
|
|
3602
|
+
const p = (m = t == null ? void 0 : t.metaframes) == null ? void 0 : m[l.i];
|
|
3603
|
+
return p && It(p.url) ? { index: c, y: l.y, id: l.i } : null;
|
|
3587
3604
|
}).filter((l) => l !== null);
|
|
3588
3605
|
if (o.length > 0) {
|
|
3589
|
-
const l = o.reduce((
|
|
3590
|
-
n.forEach((
|
|
3591
|
-
|
|
3606
|
+
const l = o.reduce((p, m) => m.y < p.y ? m : p), c = ((u = n.find((p) => p.i === l.id)) == null ? void 0 : u.y) ?? 0;
|
|
3607
|
+
n.forEach((p) => {
|
|
3608
|
+
p.y >= c && i.add(p.i);
|
|
3592
3609
|
});
|
|
3593
3610
|
}
|
|
3594
3611
|
return i.has(e);
|
|
3595
|
-
},
|
|
3612
|
+
}, Ei = (t) => {
|
|
3596
3613
|
var s;
|
|
3597
3614
|
if (!t)
|
|
3598
3615
|
return;
|
|
3599
3616
|
typeof t == "string" && (t.startsWith("/") && (t = "https://metapage.io" + t), t = new URL(t));
|
|
3600
3617
|
let e = (s = /\/m?f\/([0-9a-zA-Z-]{3,})\/?(metaframe\.json)?.*$/g.exec(t.pathname)) == null ? void 0 : s[1];
|
|
3601
3618
|
return e || (t.searchParams.get("mfk") ?? void 0);
|
|
3602
|
-
},
|
|
3619
|
+
}, Mi = async (t) => {
|
|
3603
3620
|
if (!(t != null && t.metaframes))
|
|
3604
3621
|
return t;
|
|
3605
3622
|
for (const [e, s] of Object.entries(t.metaframes)) {
|
|
3606
3623
|
if (!(s.url.startsWith("https://metapage.io/mf/") || s.url.startsWith("https://metapage.io/f/")))
|
|
3607
3624
|
continue;
|
|
3608
|
-
const n =
|
|
3625
|
+
const n = Ei(s.url);
|
|
3609
3626
|
if (!n)
|
|
3610
3627
|
continue;
|
|
3611
3628
|
const i = await fetch(`https://metapage.io/f/${n}/definition.json`).then((o) => o.json());
|
|
@@ -3615,28 +3632,28 @@ const Wi = (t, e) => {
|
|
|
3615
3632
|
};
|
|
3616
3633
|
export {
|
|
3617
3634
|
ps as INITIAL_NULL_METAPAGE_DEFINITION,
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3635
|
+
ki as INTERNAL_ERROR,
|
|
3636
|
+
Ni as INVALID_PARAMS,
|
|
3637
|
+
Ti as INVALID_REQUEST,
|
|
3638
|
+
K as JsonRpcMethodsFromChild,
|
|
3622
3639
|
me as JsonRpcMethodsFromParent,
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3640
|
+
Ii as METAFRAME_JSON_FILE,
|
|
3641
|
+
Ci as METAPAGE_KEY_DEFINITION,
|
|
3642
|
+
$i as METAPAGE_KEY_STATE,
|
|
3643
|
+
Di as METHOD_NOT_FOUND,
|
|
3627
3644
|
ie as Metaframe,
|
|
3628
|
-
|
|
3645
|
+
F as MetaframeEvents,
|
|
3629
3646
|
ae as MetaframeLoadingState,
|
|
3630
3647
|
We as MetaframeVersionCurrent,
|
|
3631
3648
|
Ct as MetaframeVersionsAll,
|
|
3632
3649
|
ee as Metapage,
|
|
3633
|
-
|
|
3650
|
+
I as MetapageEvents,
|
|
3634
3651
|
xe as MetapageHashParams,
|
|
3635
|
-
|
|
3652
|
+
wi as MetapageIFrameRpcClient,
|
|
3636
3653
|
Hn as MetapageShared,
|
|
3637
3654
|
Le as MetapageVersionCurrent,
|
|
3638
3655
|
$t as MetapageVersionsAll,
|
|
3639
|
-
|
|
3656
|
+
Pi as PARSE_ERROR,
|
|
3640
3657
|
As as VERSION_METAFRAME,
|
|
3641
3658
|
Wt as VERSION_METAPAGE,
|
|
3642
3659
|
tn as convertMetaframeDefinitionToCurrentVersion,
|
|
@@ -3646,37 +3663,38 @@ export {
|
|
|
3646
3663
|
ss as convertMetapageDefinitionToVersion,
|
|
3647
3664
|
Ce as deserializeInputs,
|
|
3648
3665
|
St as generateId,
|
|
3649
|
-
|
|
3666
|
+
Bi as generateMetaframeId,
|
|
3650
3667
|
jn as generateMetapageId,
|
|
3651
|
-
|
|
3652
|
-
|
|
3668
|
+
Fi as generateNonce,
|
|
3669
|
+
Vi as getLibraryVersionMatching,
|
|
3653
3670
|
te as getMatchingMetaframeVersion,
|
|
3654
3671
|
he as getMatchingMetapageVersion,
|
|
3655
|
-
|
|
3672
|
+
vi as getMetaframeDefinitionFromUrl,
|
|
3656
3673
|
bi as getMetapageDefinitionFromUrl,
|
|
3657
|
-
|
|
3658
|
-
|
|
3674
|
+
ji as getUrlParam,
|
|
3675
|
+
Ui as getUrlParamDebug,
|
|
3676
|
+
Ai as getVisibleGridLayoutData,
|
|
3659
3677
|
Un as hashCode,
|
|
3660
3678
|
Bn as intToRGB,
|
|
3661
3679
|
ht as isDebugFromUrlsParams,
|
|
3662
3680
|
Ji as isEmptyMetaframeDefinition,
|
|
3663
3681
|
kn as isIframe,
|
|
3664
|
-
|
|
3682
|
+
Hi as isJsonRpcId,
|
|
3665
3683
|
It as isMetaframeDivider,
|
|
3666
|
-
|
|
3684
|
+
Ki as isMetaframeHidden,
|
|
3667
3685
|
tt as isPageLoaded,
|
|
3668
3686
|
At as log,
|
|
3669
3687
|
Oi as matchPipe,
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3688
|
+
Ge as merge,
|
|
3689
|
+
zi as metapageAllSha256Hash,
|
|
3690
|
+
Gi as metapageOnlyEssentailSha256Hash,
|
|
3673
3691
|
Xe as pageLoaded,
|
|
3674
|
-
|
|
3692
|
+
Li as possiblyDeserializeDatarefToFile,
|
|
3675
3693
|
is as possiblyDeserializeDatarefToValue,
|
|
3676
3694
|
dn as possiblySerializeValueToDataref,
|
|
3677
|
-
|
|
3695
|
+
Wi as renderMetapage,
|
|
3678
3696
|
Ke as serializeInputs,
|
|
3679
3697
|
hs as stringToRgb,
|
|
3680
|
-
|
|
3698
|
+
xi as valueToFile
|
|
3681
3699
|
};
|
|
3682
3700
|
//# sourceMappingURL=index.js.map
|