@inpageedit/core 0.14.1 → 0.14.3
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 +5 -4
- package/dist/{BasePlugin-YOi2_vUo.js → BasePlugin-DD7l-5Xw.js} +2 -2
- package/dist/{BasePlugin-YOi2_vUo.js.map → BasePlugin-DD7l-5Xw.js.map} +1 -1
- package/dist/{PluginPrefSync-jTNlRQE-.js → PluginPrefSync-CbFuuC19.js} +3 -3
- package/dist/{PluginPrefSync-jTNlRQE-.js.map → PluginPrefSync-CbFuuC19.js.map} +1 -1
- package/dist/{PluginStoreApp-CGNxKXAN.js → PluginStoreApp-qiSVtnBy.js} +2 -2
- package/dist/{PluginStoreApp-CGNxKXAN.js.map → PluginStoreApp-qiSVtnBy.js.map} +1 -1
- package/dist/Preferences-C10tZMl1.js +2701 -0
- package/dist/Preferences-C10tZMl1.js.map +1 -0
- package/dist/{index-3NZkG2a3.js → index-BXNyXvre.js} +3 -3
- package/dist/{index-3NZkG2a3.js.map → index-BXNyXvre.js.map} +1 -1
- package/dist/{index-Bb0FiU2c.js → index-BanevHQ2.js} +21 -17
- package/dist/index-BanevHQ2.js.map +1 -0
- package/dist/index-BjDTD66_.js +491 -0
- package/dist/index-BjDTD66_.js.map +1 -0
- package/dist/{index-D97lUU3h.js → index-BpQ6VGMz.js} +55 -55
- package/dist/index-BpQ6VGMz.js.map +1 -0
- package/dist/{index-D-fW3ESK.js → index-CnR6CqkM.js} +2 -2
- package/dist/{index-D-fW3ESK.js.map → index-CnR6CqkM.js.map} +1 -1
- package/dist/{index-DELHsLHS.js → index-DKCZDN-Q.js} +4 -4
- package/dist/{index-DELHsLHS.js.map → index-DKCZDN-Q.js.map} +1 -1
- package/dist/{index-BBNseJXG.js → index-DVOc6fB6.js} +3 -3
- package/dist/{index-BBNseJXG.js.map → index-DVOc6fB6.js.map} +1 -1
- package/dist/{index-D6zFqL2u.js → index-De25v1_Q.js} +3 -3
- package/dist/{index-D6zFqL2u.js.map → index-De25v1_Q.js.map} +1 -1
- package/dist/{index-BrYKe18j.js → index-DensW9qt.js} +3 -3
- package/dist/{index-BrYKe18j.js.map → index-DensW9qt.js.map} +1 -1
- package/dist/{index-DTHY5rAO.js → index-DrIf5j8O.js} +156 -127
- package/dist/index-DrIf5j8O.js.map +1 -0
- package/dist/index-MgXERLzL.js +3090 -0
- package/dist/index-MgXERLzL.js.map +1 -0
- package/dist/{index-DmLoihN1.js → index-WfXtYVMt.js} +134 -131
- package/dist/index-WfXtYVMt.js.map +1 -0
- package/dist/index.d.ts +38 -6
- package/dist/index.js +5 -5
- package/dist/models/index.js +7 -503
- package/dist/models/index.js.map +1 -1
- package/dist/plugins/index.js +10 -10
- package/dist/services/index.js +1 -1
- package/lib/index.umd.js +11 -11
- package/lib/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/dist/Preferences-BF2fcXrn.js +0 -1539
- package/dist/Preferences-BF2fcXrn.js.map +0 -1
- package/dist/index-Bb0FiU2c.js.map +0 -1
- package/dist/index-BgkZW91u.js +0 -4245
- package/dist/index-BgkZW91u.js.map +0 -1
- package/dist/index-D97lUU3h.js.map +0 -1
- package/dist/index-DTHY5rAO.js.map +0 -1
- package/dist/index-DmLoihN1.js.map +0 -1
|
@@ -1,1539 +0,0 @@
|
|
|
1
|
-
const ke = () => {
|
|
2
|
-
let e, t;
|
|
3
|
-
return { promise: new Promise((n, c) => {
|
|
4
|
-
e = n, t = c;
|
|
5
|
-
}), resolve: e, reject: t };
|
|
6
|
-
};
|
|
7
|
-
Promise.withResolvers || (Promise.withResolvers = ke);
|
|
8
|
-
var ve = Object.defineProperty, w = (e, t) => ve(e, "name", { value: t, configurable: !0 });
|
|
9
|
-
function Oe() {
|
|
10
|
-
}
|
|
11
|
-
w(Oe, "noop");
|
|
12
|
-
function $(e) {
|
|
13
|
-
return e == null;
|
|
14
|
-
}
|
|
15
|
-
w($, "isNullable");
|
|
16
|
-
function Se(e) {
|
|
17
|
-
return !$(e);
|
|
18
|
-
}
|
|
19
|
-
w(Se, "isNonNullable");
|
|
20
|
-
function J(e) {
|
|
21
|
-
return e && typeof e == "object" && !Array.isArray(e);
|
|
22
|
-
}
|
|
23
|
-
w(J, "isPlainObject");
|
|
24
|
-
function fe(e, t) {
|
|
25
|
-
return Object.fromEntries(Object.entries(e).filter(([r, n]) => t(r, n)));
|
|
26
|
-
}
|
|
27
|
-
w(fe, "filterKeys");
|
|
28
|
-
function C(e, t) {
|
|
29
|
-
return Object.fromEntries(Object.entries(e).map(([r, n]) => [r, t(n, r)]));
|
|
30
|
-
}
|
|
31
|
-
w(C, "mapValues");
|
|
32
|
-
function ae(e, t, r) {
|
|
33
|
-
if (!t) return { ...e };
|
|
34
|
-
const n = {};
|
|
35
|
-
for (const c of t)
|
|
36
|
-
(r || e[c] !== void 0) && (n[c] = e[c]);
|
|
37
|
-
return n;
|
|
38
|
-
}
|
|
39
|
-
w(ae, "pick");
|
|
40
|
-
function je(e, t) {
|
|
41
|
-
if (!t) return { ...e };
|
|
42
|
-
const r = { ...e };
|
|
43
|
-
for (const n of t)
|
|
44
|
-
Reflect.deleteProperty(r, n);
|
|
45
|
-
return r;
|
|
46
|
-
}
|
|
47
|
-
w(je, "omit");
|
|
48
|
-
function A(e, t, r) {
|
|
49
|
-
return Object.defineProperty(e, t, { writable: !0, value: r, enumerable: !1 });
|
|
50
|
-
}
|
|
51
|
-
w(A, "defineProperty");
|
|
52
|
-
function $e(e, t) {
|
|
53
|
-
return t.every((r) => e.includes(r));
|
|
54
|
-
}
|
|
55
|
-
w($e, "contain");
|
|
56
|
-
function _e(e, t) {
|
|
57
|
-
return e.filter((r) => t.includes(r));
|
|
58
|
-
}
|
|
59
|
-
w(_e, "intersection");
|
|
60
|
-
function Ae(e, t) {
|
|
61
|
-
return e.filter((r) => !t.includes(r));
|
|
62
|
-
}
|
|
63
|
-
w(Ae, "difference");
|
|
64
|
-
function Re(e, t) {
|
|
65
|
-
return Array.from(/* @__PURE__ */ new Set([...e, ...t]));
|
|
66
|
-
}
|
|
67
|
-
w(Re, "union");
|
|
68
|
-
function Pe(e) {
|
|
69
|
-
return [...new Set(e)];
|
|
70
|
-
}
|
|
71
|
-
w(Pe, "deduplicate");
|
|
72
|
-
function N(e, t) {
|
|
73
|
-
const r = e?.indexOf(t);
|
|
74
|
-
return r >= 0 ? (e.splice(r, 1), !0) : !1;
|
|
75
|
-
}
|
|
76
|
-
w(N, "remove");
|
|
77
|
-
function Ee(e) {
|
|
78
|
-
return Array.isArray(e) ? e : $(e) ? [] : [e];
|
|
79
|
-
}
|
|
80
|
-
w(Ee, "makeArray");
|
|
81
|
-
function I(e, t) {
|
|
82
|
-
return arguments.length === 1 ? (r) => I(e, r) : e in globalThis && t instanceof globalThis[e] || Object.prototype.toString.call(t).slice(8, -1) === e;
|
|
83
|
-
}
|
|
84
|
-
w(I, "is");
|
|
85
|
-
function M(e) {
|
|
86
|
-
return I("ArrayBuffer", e) || I("SharedArrayBuffer", e);
|
|
87
|
-
}
|
|
88
|
-
w(M, "isArrayBufferLike");
|
|
89
|
-
function ue(e) {
|
|
90
|
-
return M(e) || ArrayBuffer.isView(e);
|
|
91
|
-
}
|
|
92
|
-
w(ue, "isArrayBufferSource");
|
|
93
|
-
var E;
|
|
94
|
-
((e) => {
|
|
95
|
-
e.is = M, e.isSource = ue;
|
|
96
|
-
function t(a) {
|
|
97
|
-
return ArrayBuffer.isView(a) ? a.buffer.slice(a.byteOffset, a.byteOffset + a.byteLength) : a;
|
|
98
|
-
}
|
|
99
|
-
e.fromSource = t, w(t, "fromSource");
|
|
100
|
-
function r(a) {
|
|
101
|
-
if (typeof Buffer < "u")
|
|
102
|
-
return Buffer.from(a).toString("base64");
|
|
103
|
-
let y = "";
|
|
104
|
-
const d = new Uint8Array(a);
|
|
105
|
-
for (let b = 0; b < d.byteLength; b++)
|
|
106
|
-
y += String.fromCharCode(d[b]);
|
|
107
|
-
return btoa(y);
|
|
108
|
-
}
|
|
109
|
-
e.toBase64 = r, w(r, "toBase64");
|
|
110
|
-
function n(a) {
|
|
111
|
-
return typeof Buffer < "u" ? t(Buffer.from(a, "base64")) : Uint8Array.from(atob(a), (y) => y.charCodeAt(0));
|
|
112
|
-
}
|
|
113
|
-
e.fromBase64 = n, w(n, "fromBase64");
|
|
114
|
-
function c(a) {
|
|
115
|
-
return typeof Buffer < "u" ? Buffer.from(a).toString("hex") : Array.from(new Uint8Array(a), (y) => y.toString(16).padStart(2, "0")).join("");
|
|
116
|
-
}
|
|
117
|
-
e.toHex = c, w(c, "toHex");
|
|
118
|
-
function i(a) {
|
|
119
|
-
if (typeof Buffer < "u") return t(Buffer.from(a, "hex"));
|
|
120
|
-
const y = a.length % 2 === 0 ? a : a.slice(0, a.length - 1), d = [];
|
|
121
|
-
for (let b = 0; b < y.length; b += 2)
|
|
122
|
-
d.push(parseInt(`${y[b]}${y[b + 1]}`, 16));
|
|
123
|
-
return Uint8Array.from(d).buffer;
|
|
124
|
-
}
|
|
125
|
-
e.fromHex = i, w(i, "fromHex");
|
|
126
|
-
})(E || (E = {}));
|
|
127
|
-
E.fromBase64;
|
|
128
|
-
E.toBase64;
|
|
129
|
-
E.fromHex;
|
|
130
|
-
E.toHex;
|
|
131
|
-
function V(e, t = /* @__PURE__ */ new Map()) {
|
|
132
|
-
if (!e || typeof e != "object") return e;
|
|
133
|
-
if (I("Date", e)) return new Date(e.valueOf());
|
|
134
|
-
if (I("RegExp", e)) return new RegExp(e.source, e.flags);
|
|
135
|
-
if (M(e)) return e.slice(0);
|
|
136
|
-
if (ArrayBuffer.isView(e)) return e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
|
|
137
|
-
const r = t.get(e);
|
|
138
|
-
if (r) return r;
|
|
139
|
-
if (Array.isArray(e)) {
|
|
140
|
-
const c = [];
|
|
141
|
-
return t.set(e, c), e.forEach((i, a) => {
|
|
142
|
-
c[a] = Reflect.apply(V, null, [i, t]);
|
|
143
|
-
}), c;
|
|
144
|
-
}
|
|
145
|
-
const n = Object.create(Object.getPrototypeOf(e));
|
|
146
|
-
t.set(e, n);
|
|
147
|
-
for (const c of Reflect.ownKeys(e)) {
|
|
148
|
-
const i = { ...Reflect.getOwnPropertyDescriptor(e, c) };
|
|
149
|
-
"value" in i && (i.value = Reflect.apply(V, null, [i.value, t])), Reflect.defineProperty(n, c, i);
|
|
150
|
-
}
|
|
151
|
-
return n;
|
|
152
|
-
}
|
|
153
|
-
w(V, "clone");
|
|
154
|
-
function B(e, t, r) {
|
|
155
|
-
if (e === t || !r && $(e) && $(t)) return !0;
|
|
156
|
-
if (typeof e != typeof t || typeof e != "object" || !e || !t) return !1;
|
|
157
|
-
function n(c, i) {
|
|
158
|
-
return c(e) ? c(t) ? i(e, t) : !1 : c(t) ? !1 : void 0;
|
|
159
|
-
}
|
|
160
|
-
return w(n, "check"), n(Array.isArray, (c, i) => c.length === i.length && c.every((a, y) => B(a, i[y]))) ?? n(I("Date"), (c, i) => c.valueOf() === i.valueOf()) ?? n(I("RegExp"), (c, i) => c.source === i.source && c.flags === i.flags) ?? n(M, (c, i) => {
|
|
161
|
-
if (c.byteLength !== i.byteLength) return !1;
|
|
162
|
-
const a = new Uint8Array(c), y = new Uint8Array(i);
|
|
163
|
-
for (let d = 0; d < a.length; d++)
|
|
164
|
-
if (a[d] !== y[d]) return !1;
|
|
165
|
-
return !0;
|
|
166
|
-
}) ?? Object.keys({ ...e, ...t }).every((c) => B(e[c], t[c], r));
|
|
167
|
-
}
|
|
168
|
-
w(B, "deepEqual");
|
|
169
|
-
function De(e) {
|
|
170
|
-
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
171
|
-
}
|
|
172
|
-
w(De, "capitalize");
|
|
173
|
-
function Ce(e) {
|
|
174
|
-
return e.charAt(0).toLowerCase() + e.slice(1);
|
|
175
|
-
}
|
|
176
|
-
w(Ce, "uncapitalize");
|
|
177
|
-
function Ne(e) {
|
|
178
|
-
return e.replace(/[_-][a-z]/g, (t) => t.slice(1).toUpperCase());
|
|
179
|
-
}
|
|
180
|
-
w(Ne, "camelCase");
|
|
181
|
-
function X(e, t, r) {
|
|
182
|
-
const n = [];
|
|
183
|
-
let c = 0;
|
|
184
|
-
for (let i = 0; i < e.length; i++) {
|
|
185
|
-
const a = e.charCodeAt(i);
|
|
186
|
-
if (a >= 65 && a <= 90) {
|
|
187
|
-
if (c === 1) {
|
|
188
|
-
const y = e.charCodeAt(i + 1);
|
|
189
|
-
y >= 97 && y <= 122 && n.push(r), n.push(a + 32);
|
|
190
|
-
} else
|
|
191
|
-
c !== 0 && n.push(r), n.push(a + 32);
|
|
192
|
-
c = 1;
|
|
193
|
-
} else a >= 97 && a <= 122 ? (n.push(a), c = 2) : t.includes(a) ? (c !== 0 && n.push(r), c = 0) : n.push(a);
|
|
194
|
-
}
|
|
195
|
-
return String.fromCharCode(...n);
|
|
196
|
-
}
|
|
197
|
-
w(X, "tokenize");
|
|
198
|
-
function Ie(e) {
|
|
199
|
-
return X(e, [45, 95], 45);
|
|
200
|
-
}
|
|
201
|
-
w(Ie, "paramCase");
|
|
202
|
-
function Be(e) {
|
|
203
|
-
return X(e, [45, 95], 95);
|
|
204
|
-
}
|
|
205
|
-
w(Be, "snakeCase");
|
|
206
|
-
function Fe(e) {
|
|
207
|
-
return typeof e != "string" ? `[${e.toString()}]` : /^[a-z_$][\w$]*$/i.test(e) ? `.${e}` : `[${JSON.stringify(e)}]`;
|
|
208
|
-
}
|
|
209
|
-
w(Fe, "formatProperty");
|
|
210
|
-
function le(e) {
|
|
211
|
-
return e.replace(/\/$/, "");
|
|
212
|
-
}
|
|
213
|
-
w(le, "trimSlash");
|
|
214
|
-
function Ue(e) {
|
|
215
|
-
return e.startsWith("/") || (e = "/" + e), le(e);
|
|
216
|
-
}
|
|
217
|
-
w(Ue, "sanitize");
|
|
218
|
-
var se;
|
|
219
|
-
((e) => {
|
|
220
|
-
e.millisecond = 1, e.second = 1e3, e.minute = e.second * 60, e.hour = e.minute * 60, e.day = e.hour * 24, e.week = e.day * 7;
|
|
221
|
-
let t = (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
222
|
-
function r(x) {
|
|
223
|
-
t = x;
|
|
224
|
-
}
|
|
225
|
-
e.setTimezoneOffset = r, w(r, "setTimezoneOffset");
|
|
226
|
-
function n() {
|
|
227
|
-
return t;
|
|
228
|
-
}
|
|
229
|
-
e.getTimezoneOffset = n, w(n, "getTimezoneOffset");
|
|
230
|
-
function c(x = /* @__PURE__ */ new Date(), k) {
|
|
231
|
-
return typeof x == "number" && (x = new Date(x)), k === void 0 && (k = t), Math.floor((x.valueOf() / e.minute - k) / 1440);
|
|
232
|
-
}
|
|
233
|
-
e.getDateNumber = c, w(c, "getDateNumber");
|
|
234
|
-
function i(x, k) {
|
|
235
|
-
const F = new Date(x * e.day);
|
|
236
|
-
return k === void 0 && (k = t), new Date(+F + k * e.minute);
|
|
237
|
-
}
|
|
238
|
-
e.fromDateNumber = i, w(i, "fromDateNumber");
|
|
239
|
-
const a = /\d+(?:\.\d+)?/.source, y = new RegExp(`^${[
|
|
240
|
-
"w(?:eek(?:s)?)?",
|
|
241
|
-
"d(?:ay(?:s)?)?",
|
|
242
|
-
"h(?:our(?:s)?)?",
|
|
243
|
-
"m(?:in(?:ute)?(?:s)?)?",
|
|
244
|
-
"s(?:ec(?:ond)?(?:s)?)?"
|
|
245
|
-
].map((x) => `(${a}${x})?`).join("")}$`);
|
|
246
|
-
function d(x) {
|
|
247
|
-
const k = y.exec(x);
|
|
248
|
-
return k ? (parseFloat(k[1]) * e.week || 0) + (parseFloat(k[2]) * e.day || 0) + (parseFloat(k[3]) * e.hour || 0) + (parseFloat(k[4]) * e.minute || 0) + (parseFloat(k[5]) * e.second || 0) : 0;
|
|
249
|
-
}
|
|
250
|
-
e.parseTime = d, w(d, "parseTime");
|
|
251
|
-
function b(x) {
|
|
252
|
-
const k = d(x);
|
|
253
|
-
return k ? x = Date.now() + k : /^\d{1,2}(:\d{1,2}){1,2}$/.test(x) ? x = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${x}` : /^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(x) && (x = `${(/* @__PURE__ */ new Date()).getFullYear()}-${x}`), x ? new Date(x) : /* @__PURE__ */ new Date();
|
|
254
|
-
}
|
|
255
|
-
e.parseDate = b, w(b, "parseDate");
|
|
256
|
-
function j(x) {
|
|
257
|
-
const k = Math.abs(x);
|
|
258
|
-
return k >= e.day - e.hour / 2 ? Math.round(x / e.day) + "d" : k >= e.hour - e.minute / 2 ? Math.round(x / e.hour) + "h" : k >= e.minute - e.second / 2 ? Math.round(x / e.minute) + "m" : k >= e.second ? Math.round(x / e.second) + "s" : x + "ms";
|
|
259
|
-
}
|
|
260
|
-
e.format = j, w(j, "format");
|
|
261
|
-
function O(x, k = 2) {
|
|
262
|
-
return x.toString().padStart(k, "0");
|
|
263
|
-
}
|
|
264
|
-
e.toDigits = O, w(O, "toDigits");
|
|
265
|
-
function R(x, k = /* @__PURE__ */ new Date()) {
|
|
266
|
-
return x.replace("yyyy", k.getFullYear().toString()).replace("yy", k.getFullYear().toString().slice(2)).replace("MM", O(k.getMonth() + 1)).replace("dd", O(k.getDate())).replace("hh", O(k.getHours())).replace("mm", O(k.getMinutes())).replace("ss", O(k.getSeconds())).replace("SSS", O(k.getMilliseconds(), 3));
|
|
267
|
-
}
|
|
268
|
-
e.template = R, w(R, "template");
|
|
269
|
-
})(se || (se = {}));
|
|
270
|
-
var ze = Object.defineProperty, g = (e, t) => ze(e, "name", { value: t, configurable: !0 }), h = {
|
|
271
|
-
// internal symbols
|
|
272
|
-
shadow: Symbol.for("cordis.shadow"),
|
|
273
|
-
receiver: Symbol.for("cordis.receiver"),
|
|
274
|
-
original: Symbol.for("cordis.original"),
|
|
275
|
-
// context symbols
|
|
276
|
-
store: Symbol.for("cordis.store"),
|
|
277
|
-
events: Symbol.for("cordis.events"),
|
|
278
|
-
static: Symbol.for("cordis.static"),
|
|
279
|
-
filter: Symbol.for("cordis.filter"),
|
|
280
|
-
expose: Symbol.for("cordis.expose"),
|
|
281
|
-
isolate: Symbol.for("cordis.isolate"),
|
|
282
|
-
internal: Symbol.for("cordis.internal"),
|
|
283
|
-
intercept: Symbol.for("cordis.intercept"),
|
|
284
|
-
// service symbols
|
|
285
|
-
setup: Symbol.for("cordis.setup"),
|
|
286
|
-
invoke: Symbol.for("cordis.invoke"),
|
|
287
|
-
extend: Symbol.for("cordis.extend"),
|
|
288
|
-
tracker: Symbol.for("cordis.tracker"),
|
|
289
|
-
provide: Symbol.for("cordis.provide"),
|
|
290
|
-
immediate: Symbol.for("cordis.immediate")
|
|
291
|
-
}, Le = function* () {
|
|
292
|
-
}.constructor, oe = async function* () {
|
|
293
|
-
}.constructor;
|
|
294
|
-
function ee(e) {
|
|
295
|
-
return !(!e.prototype || e instanceof Le || oe !== Function && e instanceof oe);
|
|
296
|
-
}
|
|
297
|
-
g(ee, "isConstructor");
|
|
298
|
-
function q(e, t) {
|
|
299
|
-
const r = e.Config || e.schema;
|
|
300
|
-
return r && e.schema !== !1 && (t = r(t)), t ?? {};
|
|
301
|
-
}
|
|
302
|
-
g(q, "resolveConfig");
|
|
303
|
-
function he(e) {
|
|
304
|
-
return [Map, Set, Date, Promise].some((t) => e instanceof t);
|
|
305
|
-
}
|
|
306
|
-
g(he, "isUnproxyable");
|
|
307
|
-
function te(e, t) {
|
|
308
|
-
if (e === Object.prototype) return t;
|
|
309
|
-
const r = Object.create(te(Object.getPrototypeOf(e), t));
|
|
310
|
-
for (const n of Reflect.ownKeys(e))
|
|
311
|
-
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
|
|
312
|
-
return r;
|
|
313
|
-
}
|
|
314
|
-
g(te, "joinPrototype");
|
|
315
|
-
function re(e) {
|
|
316
|
-
return e && (typeof e == "object" || typeof e == "function");
|
|
317
|
-
}
|
|
318
|
-
g(re, "isObject");
|
|
319
|
-
function D(e, t, r) {
|
|
320
|
-
if (!re(t)) return t;
|
|
321
|
-
if (Object.hasOwn(t, h.shadow))
|
|
322
|
-
return Object.getPrototypeOf(t);
|
|
323
|
-
const n = t[h.tracker];
|
|
324
|
-
return n ? G(e, t, n, r) : t;
|
|
325
|
-
}
|
|
326
|
-
g(D, "getTraceable");
|
|
327
|
-
function L(e, t) {
|
|
328
|
-
return t ? new Proxy(e, {
|
|
329
|
-
get: /* @__PURE__ */ g((r, n, c) => n in t && n !== "constructor" ? Reflect.get(t, n, c) : Reflect.get(r, n, c), "get"),
|
|
330
|
-
set: /* @__PURE__ */ g((r, n, c, i) => n in t && n !== "constructor" ? Reflect.set(t, n, c, i) : Reflect.set(r, n, c, i), "set")
|
|
331
|
-
}) : e;
|
|
332
|
-
}
|
|
333
|
-
g(L, "withProps");
|
|
334
|
-
function H(e, t, r) {
|
|
335
|
-
return L(e, Object.defineProperty(/* @__PURE__ */ Object.create(null), t, {
|
|
336
|
-
value: r,
|
|
337
|
-
writable: !1
|
|
338
|
-
}));
|
|
339
|
-
}
|
|
340
|
-
g(H, "withProp");
|
|
341
|
-
function W(e, t, r, n) {
|
|
342
|
-
if (!r) return n;
|
|
343
|
-
const c = Reflect.getOwnPropertyDescriptor(t, r)?.value;
|
|
344
|
-
return c ? H(n, r, e.extend({ [h.shadow]: c })) : n;
|
|
345
|
-
}
|
|
346
|
-
g(W, "createShadow");
|
|
347
|
-
function pe(e, t, r, n) {
|
|
348
|
-
return new Proxy(t, {
|
|
349
|
-
apply: /* @__PURE__ */ g((c, i, a) => (i === r && (i = n), a = a.map((y) => typeof y != "function" || y[h.original] ? y : new Proxy(y, {
|
|
350
|
-
get: /* @__PURE__ */ g((d, b, j) => {
|
|
351
|
-
if (b === h.original) return d;
|
|
352
|
-
const O = Reflect.get(d, b, j);
|
|
353
|
-
return b === "toString" && O === Function.prototype.toString ? function(...R) {
|
|
354
|
-
return Reflect.apply(O, this === j ? d : this, R);
|
|
355
|
-
} : O;
|
|
356
|
-
}, "get"),
|
|
357
|
-
apply: /* @__PURE__ */ g((d, b, j) => Reflect.apply(d, D(e, b), j.map((O) => D(e, O))), "apply"),
|
|
358
|
-
construct: /* @__PURE__ */ g((d, b, j) => Reflect.construct(d, b.map((O) => D(e, O)), j), "construct")
|
|
359
|
-
})), D(e, Reflect.apply(c, i, a))), "apply")
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
g(pe, "createShadowMethod");
|
|
363
|
-
function G(e, t, r, n) {
|
|
364
|
-
e[h.shadow] && (e = Object.getPrototypeOf(e));
|
|
365
|
-
const c = new Proxy(t, {
|
|
366
|
-
get: /* @__PURE__ */ g((i, a, y) => {
|
|
367
|
-
if (a === h.original) return i;
|
|
368
|
-
if (a === r.property) return e;
|
|
369
|
-
if (typeof a == "symbol")
|
|
370
|
-
return Reflect.get(i, a, y);
|
|
371
|
-
if (r.associate && e[h.internal][`${r.associate}.${a}`])
|
|
372
|
-
return Reflect.get(e, `${r.associate}.${a}`, H(e, h.receiver, y));
|
|
373
|
-
const d = W(e, i, r.property, y), b = Reflect.get(i, a, d), j = b?.[h.tracker];
|
|
374
|
-
return j ? G(e, b, j) : !n && typeof b == "function" ? pe(e, b, y, d) : b;
|
|
375
|
-
}, "get"),
|
|
376
|
-
set: /* @__PURE__ */ g((i, a, y, d) => {
|
|
377
|
-
if (a === h.original || a === r.property) return !1;
|
|
378
|
-
if (typeof a == "symbol")
|
|
379
|
-
return Reflect.set(i, a, y, d);
|
|
380
|
-
if (r.associate && e[h.internal][`${r.associate}.${a}`])
|
|
381
|
-
return Reflect.set(e, `${r.associate}.${a}`, y, H(e, h.receiver, d));
|
|
382
|
-
const b = W(e, i, r.property, d);
|
|
383
|
-
return Reflect.set(i, a, y, b);
|
|
384
|
-
}, "set"),
|
|
385
|
-
apply: /* @__PURE__ */ g((i, a, y) => ne(c, i, a, y), "apply")
|
|
386
|
-
});
|
|
387
|
-
return c;
|
|
388
|
-
}
|
|
389
|
-
g(G, "createTraceable");
|
|
390
|
-
function ne(e, t, r, n) {
|
|
391
|
-
return t[h.invoke] ? t[h.invoke].apply(e, n) : Reflect.apply(t, r, n);
|
|
392
|
-
}
|
|
393
|
-
g(ne, "applyTraceable");
|
|
394
|
-
function Y(e, t, r) {
|
|
395
|
-
const n = /* @__PURE__ */ g(function(...c) {
|
|
396
|
-
const i = G(n.ctx, n, r);
|
|
397
|
-
return ne(i, n, this, c);
|
|
398
|
-
}, "self");
|
|
399
|
-
return A(n, "name", e), Object.setPrototypeOf(n, t);
|
|
400
|
-
}
|
|
401
|
-
g(Y, "createCallable");
|
|
402
|
-
var Me = class U {
|
|
403
|
-
constructor(t) {
|
|
404
|
-
this.ctx = t, A(this, h.tracker, {
|
|
405
|
-
associate: "reflect",
|
|
406
|
-
property: "ctx"
|
|
407
|
-
}), this._mixin("reflect", ["get", "set", "provide", "accessor", "mixin", "alias"]), this._mixin("scope", ["config", "runtime", "effect", "collect", "accept", "decline"]), this._mixin("registry", ["using", "inject", "plugin"]), this._mixin("lifecycle", ["on", "once", "parallel", "emit", "serial", "bail", "start", "stop"]);
|
|
408
|
-
}
|
|
409
|
-
static {
|
|
410
|
-
g(this, "ReflectService");
|
|
411
|
-
}
|
|
412
|
-
static resolveInject(t, r) {
|
|
413
|
-
let n = t[h.internal][r];
|
|
414
|
-
for (; n?.type === "alias"; )
|
|
415
|
-
r = n.name, n = t[h.internal][r];
|
|
416
|
-
return [r, n];
|
|
417
|
-
}
|
|
418
|
-
static checkInject(t, r, n) {
|
|
419
|
-
if (t = t[h.shadow] ?? t, ["prototype", "then", "registry", "lifecycle"].includes(r) || r[0] === "$" || r[0] === "_" || !t.runtime.plugin || t.bail(t, "internal/inject", r)) return;
|
|
420
|
-
const c = n.stack.split(`
|
|
421
|
-
`);
|
|
422
|
-
c.splice(1, 1), n.stack = c.join(`
|
|
423
|
-
`), t.emit(t, "internal/warning", n);
|
|
424
|
-
}
|
|
425
|
-
static handler = {
|
|
426
|
-
get: /* @__PURE__ */ g((t, r, n) => {
|
|
427
|
-
if (typeof r != "string") return Reflect.get(t, r, n);
|
|
428
|
-
if (Reflect.has(t, r))
|
|
429
|
-
return D(n, Reflect.get(t, r, n), !0);
|
|
430
|
-
const [c, i] = U.resolveInject(t, r), a = new Error(`property ${c} is not registered, declare it as \`inject\` to suppress this warning`);
|
|
431
|
-
return i ? i.type === "accessor" ? i.get.call(n, n[h.receiver]) : (i.builtin || U.checkInject(n, c, a), n.reflect.get(c)) : (U.checkInject(n, c, a), Reflect.get(t, c, n));
|
|
432
|
-
}, "get"),
|
|
433
|
-
set: /* @__PURE__ */ g((t, r, n, c) => {
|
|
434
|
-
if (typeof r != "string") return Reflect.set(t, r, n, c);
|
|
435
|
-
const [i, a] = U.resolveInject(t, r);
|
|
436
|
-
return a ? a.type === "accessor" ? a.set ? a.set.call(c, n, c[h.receiver]) : !1 : (c.reflect.set(i, n), !0) : Reflect.set(t, i, n, c);
|
|
437
|
-
}, "set"),
|
|
438
|
-
has: /* @__PURE__ */ g((t, r) => {
|
|
439
|
-
if (typeof r != "string") return Reflect.has(t, r);
|
|
440
|
-
if (Reflect.has(t, r)) return !0;
|
|
441
|
-
const [, n] = U.resolveInject(t, r);
|
|
442
|
-
return !!n;
|
|
443
|
-
}, "has")
|
|
444
|
-
};
|
|
445
|
-
get(t) {
|
|
446
|
-
if (this.ctx[h.internal][t]?.type !== "service") return;
|
|
447
|
-
const n = this.ctx[h.isolate][t], c = this.ctx[h.store][n]?.value;
|
|
448
|
-
return D(this.ctx, c);
|
|
449
|
-
}
|
|
450
|
-
set(t, r) {
|
|
451
|
-
this.provide(t);
|
|
452
|
-
const n = this.ctx[h.isolate][t], c = this.ctx[h.store][n]?.value;
|
|
453
|
-
r ??= void 0;
|
|
454
|
-
let i = /* @__PURE__ */ g(() => {
|
|
455
|
-
}, "dispose");
|
|
456
|
-
if (c === r) return i;
|
|
457
|
-
if (!$(r) && !$(c))
|
|
458
|
-
throw new Error(`service ${t} has been registered`);
|
|
459
|
-
const a = this.ctx;
|
|
460
|
-
$(r) || (i = a.effect(() => () => {
|
|
461
|
-
a.set(t, void 0);
|
|
462
|
-
})), he(r) && a.emit(a, "internal/warning", new Error(`service ${t} is an unproxyable object, which may lead to unexpected behavior`));
|
|
463
|
-
const y = Object.create(a);
|
|
464
|
-
return y[h.filter] = (d) => a[h.isolate][t] === d[h.isolate][t], a.emit(y, "internal/before-service", t, r), a[h.store][n] = { value: r, source: a }, a.emit(y, "internal/service", t, c), i;
|
|
465
|
-
}
|
|
466
|
-
provide(t, r, n) {
|
|
467
|
-
const c = this.ctx.root[h.internal];
|
|
468
|
-
if (t in c) return;
|
|
469
|
-
const i = Symbol(t);
|
|
470
|
-
c[t] = { type: "service", builtin: n }, this.ctx.root[h.isolate][t] = i, re(r) && (this.ctx[h.store][i] = { value: r, source: null }, A(r, h.tracker, {
|
|
471
|
-
associate: t,
|
|
472
|
-
property: "ctx"
|
|
473
|
-
}));
|
|
474
|
-
}
|
|
475
|
-
_accessor(t, r) {
|
|
476
|
-
const n = this.ctx.root[h.internal];
|
|
477
|
-
return t in n ? () => {
|
|
478
|
-
} : (n[t] = { type: "accessor", ...r }, () => delete this.ctx.root[h.isolate][t]);
|
|
479
|
-
}
|
|
480
|
-
accessor(t, r) {
|
|
481
|
-
this.ctx.scope.effect(() => this._accessor(t, r));
|
|
482
|
-
}
|
|
483
|
-
alias(t, r) {
|
|
484
|
-
const n = this.ctx.root[h.internal];
|
|
485
|
-
if (!(t in n))
|
|
486
|
-
for (const c of r)
|
|
487
|
-
n[c] ||= { type: "alias", name: t };
|
|
488
|
-
}
|
|
489
|
-
_mixin(t, r) {
|
|
490
|
-
const n = Array.isArray(r) ? r.map((a) => [a, a]) : Object.entries(r), c = typeof t == "string" ? (a) => a[t] : () => t, i = n.map(([a, y]) => this._accessor(y, {
|
|
491
|
-
get(d) {
|
|
492
|
-
const b = c(this);
|
|
493
|
-
if ($(b)) return b;
|
|
494
|
-
const j = d ? L(d, b) : b, O = Reflect.get(b, a, j);
|
|
495
|
-
return typeof O != "function" ? O : O.bind(j ?? b);
|
|
496
|
-
},
|
|
497
|
-
set(d, b) {
|
|
498
|
-
const j = c(this), O = b ? L(b, j) : j;
|
|
499
|
-
return Reflect.set(j, a, d, O);
|
|
500
|
-
}
|
|
501
|
-
}));
|
|
502
|
-
return () => i.forEach((a) => a());
|
|
503
|
-
}
|
|
504
|
-
mixin(t, r) {
|
|
505
|
-
this.ctx.scope.effect(() => this._mixin(t, r));
|
|
506
|
-
}
|
|
507
|
-
trace(t) {
|
|
508
|
-
return D(this.ctx, t);
|
|
509
|
-
}
|
|
510
|
-
bind(t) {
|
|
511
|
-
return new Proxy(t, {
|
|
512
|
-
apply: /* @__PURE__ */ g((r, n, c) => r.apply(this.trace(n), c.map((i) => this.trace(i))), "apply")
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
}, Q = Me;
|
|
516
|
-
function Z(e) {
|
|
517
|
-
return e !== null && e !== !1 && e !== void 0;
|
|
518
|
-
}
|
|
519
|
-
g(Z, "isBailed");
|
|
520
|
-
var qe = class {
|
|
521
|
-
constructor(e) {
|
|
522
|
-
this.ctx = e, A(this, h.tracker, {
|
|
523
|
-
associate: "lifecycle",
|
|
524
|
-
property: "ctx"
|
|
525
|
-
}), A(this.on("internal/listener", function(r, n, c) {
|
|
526
|
-
const i = c.prepend ? "unshift" : "push";
|
|
527
|
-
if (r === "ready")
|
|
528
|
-
return this.lifecycle.isActive ? (this.scope.ensure(async () => n()), () => !1) : void 0;
|
|
529
|
-
if (r === "dispose")
|
|
530
|
-
return this.scope.disposables[i](n), A(n, "name", "event <dispose>"), () => N(this.scope.disposables, n);
|
|
531
|
-
if (r === "fork")
|
|
532
|
-
return this.scope.runtime.forkables[i](n), this.scope.collect("event <fork>", () => N(this.scope.runtime.forkables, n));
|
|
533
|
-
}), P.static, e.scope);
|
|
534
|
-
for (const r of ["info", "error", "warning"])
|
|
535
|
-
A(this.on(`internal/${r}`, (n, ...c) => {
|
|
536
|
-
this._hooks[`internal/${r}`].length > 1;
|
|
537
|
-
}), P.static, e.scope);
|
|
538
|
-
A(this.on("internal/before-service", function(r) {
|
|
539
|
-
for (const n of this.registry.values()) {
|
|
540
|
-
if (!n.inject[r]?.required) continue;
|
|
541
|
-
const c = n.isReusable ? n.children : [n];
|
|
542
|
-
for (const i of c)
|
|
543
|
-
this[h.filter](i.ctx) && (i.updateStatus(), i.reset());
|
|
544
|
-
}
|
|
545
|
-
}, { global: !0 }), P.static, e.scope), A(this.on("internal/service", function(r) {
|
|
546
|
-
for (const n of this.registry.values()) {
|
|
547
|
-
if (!n.inject[r]?.required) continue;
|
|
548
|
-
const c = n.isReusable ? n.children : [n];
|
|
549
|
-
for (const i of c)
|
|
550
|
-
this[h.filter](i.ctx) && i.start();
|
|
551
|
-
}
|
|
552
|
-
}, { global: !0 }), P.static, e.scope);
|
|
553
|
-
const t = /* @__PURE__ */ g((r, n) => {
|
|
554
|
-
if (!r.runtime.plugin) return !1;
|
|
555
|
-
for (const c in r.runtime.inject)
|
|
556
|
-
if (n === Q.resolveInject(r.ctx, c)[0]) return !0;
|
|
557
|
-
return t(r.parent.scope, n);
|
|
558
|
-
}, "checkInject");
|
|
559
|
-
A(this.on("internal/inject", function(r) {
|
|
560
|
-
return t(this.scope, r);
|
|
561
|
-
}, { global: !0 }), P.static, e.scope);
|
|
562
|
-
}
|
|
563
|
-
static {
|
|
564
|
-
g(this, "Lifecycle");
|
|
565
|
-
}
|
|
566
|
-
isActive = !1;
|
|
567
|
-
_tasks = /* @__PURE__ */ new Set();
|
|
568
|
-
_hooks = {};
|
|
569
|
-
async flush() {
|
|
570
|
-
for (; this._tasks.size; )
|
|
571
|
-
await Promise.all(Array.from(this._tasks));
|
|
572
|
-
}
|
|
573
|
-
filterHooks(e, t) {
|
|
574
|
-
return t = D(this.ctx, t), e.slice().filter((r) => {
|
|
575
|
-
const n = t?.[P.filter];
|
|
576
|
-
return r.global || !n || n.call(t, r.ctx);
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
*dispatch(e, t) {
|
|
580
|
-
const r = typeof t[0] == "object" || typeof t[0] == "function" ? t.shift() : null, n = t.shift();
|
|
581
|
-
n !== "internal/event" && this.emit("internal/event", e, n, t, r);
|
|
582
|
-
for (const c of this.filterHooks(this._hooks[n] || [], r))
|
|
583
|
-
yield c.callback.apply(r, t);
|
|
584
|
-
}
|
|
585
|
-
async parallel(...e) {
|
|
586
|
-
await Promise.all(this.dispatch("emit", e));
|
|
587
|
-
}
|
|
588
|
-
emit(...e) {
|
|
589
|
-
Array.from(this.dispatch("emit", e));
|
|
590
|
-
}
|
|
591
|
-
async serial(...e) {
|
|
592
|
-
for await (const t of this.dispatch("serial", e))
|
|
593
|
-
if (Z(t)) return t;
|
|
594
|
-
}
|
|
595
|
-
bail(...e) {
|
|
596
|
-
for (const t of this.dispatch("bail", e))
|
|
597
|
-
if (Z(t)) return t;
|
|
598
|
-
}
|
|
599
|
-
register(e, t, r, n) {
|
|
600
|
-
const c = n.prepend ? "unshift" : "push";
|
|
601
|
-
return t[c]({ ctx: this.ctx, callback: r, ...n }), this.ctx.state.collect(e, () => this.unregister(t, r));
|
|
602
|
-
}
|
|
603
|
-
unregister(e, t) {
|
|
604
|
-
const r = e.findIndex((n) => n.callback === t);
|
|
605
|
-
if (r >= 0)
|
|
606
|
-
return e.splice(r, 1), !0;
|
|
607
|
-
}
|
|
608
|
-
on(e, t, r) {
|
|
609
|
-
typeof r != "object" && (r = { prepend: r }), this.ctx.scope.assertActive(), t = this.ctx.reflect.bind(t);
|
|
610
|
-
const n = this.bail(this.ctx, "internal/listener", e, t, r);
|
|
611
|
-
if (n) return n;
|
|
612
|
-
const c = this._hooks[e] ||= [], i = typeof e == "string" ? `event <${e}>` : "event (Symbol)";
|
|
613
|
-
return this.register(i, c, t, r);
|
|
614
|
-
}
|
|
615
|
-
once(e, t, r) {
|
|
616
|
-
const n = this.on(e, function(...c) {
|
|
617
|
-
return n(), t.apply(this, c);
|
|
618
|
-
}, r);
|
|
619
|
-
return n;
|
|
620
|
-
}
|
|
621
|
-
async start() {
|
|
622
|
-
this.isActive = !0;
|
|
623
|
-
const e = this._hooks.ready || [];
|
|
624
|
-
for (; e.length; ) {
|
|
625
|
-
const { ctx: t, callback: r } = e.shift();
|
|
626
|
-
t.scope.ensure(async () => r());
|
|
627
|
-
}
|
|
628
|
-
await this.flush();
|
|
629
|
-
}
|
|
630
|
-
async stop() {
|
|
631
|
-
this.isActive = !1, this.ctx.scope.reset();
|
|
632
|
-
}
|
|
633
|
-
}, Je = qe, Ve = /* @__PURE__ */ ((e) => (e[e.PENDING = 0] = "PENDING", e[e.LOADING = 1] = "LOADING", e[e.ACTIVE = 2] = "ACTIVE", e[e.FAILED = 3] = "FAILED", e[e.DISPOSED = 4] = "DISPOSED", e))(Ve || {}), T = class ye extends Error {
|
|
634
|
-
constructor(t, r) {
|
|
635
|
-
super(r ?? ye.Code[t]), this.code = t;
|
|
636
|
-
}
|
|
637
|
-
static {
|
|
638
|
-
g(this, "CordisError");
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
((e) => {
|
|
642
|
-
e.Code = {
|
|
643
|
-
INACTIVE_EFFECT: "cannot create effect on inactive context"
|
|
644
|
-
};
|
|
645
|
-
})(T || (T = {}));
|
|
646
|
-
var de = class {
|
|
647
|
-
constructor(e, t) {
|
|
648
|
-
this.parent = e, this.config = t, this.uid = e.registry ? e.registry.counter : 0, this.ctx = this.context = e.extend({ scope: this }), this.proxy = new Proxy({}, {
|
|
649
|
-
get: /* @__PURE__ */ g((r, n) => Reflect.get(this.config, n), "get")
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
static {
|
|
653
|
-
g(this, "EffectScope");
|
|
654
|
-
}
|
|
655
|
-
uid;
|
|
656
|
-
ctx;
|
|
657
|
-
disposables = [];
|
|
658
|
-
error;
|
|
659
|
-
status = 0;
|
|
660
|
-
isActive = !1;
|
|
661
|
-
// Same as `this.ctx`, but with a more specific type.
|
|
662
|
-
context;
|
|
663
|
-
proxy;
|
|
664
|
-
acceptors = [];
|
|
665
|
-
tasks = /* @__PURE__ */ new Set();
|
|
666
|
-
hasError = !1;
|
|
667
|
-
get _config() {
|
|
668
|
-
return this.runtime.isReactive ? this.proxy : this.config;
|
|
669
|
-
}
|
|
670
|
-
assertActive() {
|
|
671
|
-
if (!(this.uid !== null || this.isActive))
|
|
672
|
-
throw new T("INACTIVE_EFFECT");
|
|
673
|
-
}
|
|
674
|
-
effect(e, t) {
|
|
675
|
-
this.assertActive();
|
|
676
|
-
const r = ee(e) ? new e(this.ctx, t) : e(this.ctx, t);
|
|
677
|
-
let n = !1;
|
|
678
|
-
const c = typeof r == "function" ? r : r.dispose.bind(r), i = /* @__PURE__ */ g((...a) => {
|
|
679
|
-
if (!n)
|
|
680
|
-
return n = !0, N(this.disposables, i), c(...a);
|
|
681
|
-
}, "wrapped");
|
|
682
|
-
return this.disposables.push(i), typeof r == "function" ? i : (r.dispose = i, r);
|
|
683
|
-
}
|
|
684
|
-
collect(e, t) {
|
|
685
|
-
const r = A(() => (N(this.disposables, r), t()), "name", e);
|
|
686
|
-
return this.disposables.push(r), r;
|
|
687
|
-
}
|
|
688
|
-
restart() {
|
|
689
|
-
this.reset(), this.error = null, this.hasError = !1, this.status = 0, this.start();
|
|
690
|
-
}
|
|
691
|
-
_getStatus() {
|
|
692
|
-
return this.uid === null ? 4 : this.hasError ? 3 : this.tasks.size ? 1 : this.ready ? 2 : 0;
|
|
693
|
-
}
|
|
694
|
-
updateStatus(e) {
|
|
695
|
-
const t = this.status;
|
|
696
|
-
e?.(), this.status = this._getStatus(), t !== this.status && this.context.emit("internal/status", this, t);
|
|
697
|
-
}
|
|
698
|
-
ensure(e) {
|
|
699
|
-
const t = e().catch((r) => {
|
|
700
|
-
this.context.emit(this.ctx, "internal/error", r), this.cancel(r);
|
|
701
|
-
}).finally(() => {
|
|
702
|
-
this.updateStatus(() => this.tasks.delete(t)), this.context.events._tasks.delete(t);
|
|
703
|
-
});
|
|
704
|
-
this.updateStatus(() => this.tasks.add(t)), this.context.events._tasks.add(t);
|
|
705
|
-
}
|
|
706
|
-
cancel(e) {
|
|
707
|
-
this.error = e, this.updateStatus(() => this.hasError = !0), this.reset();
|
|
708
|
-
}
|
|
709
|
-
get ready() {
|
|
710
|
-
return Object.entries(this.runtime.inject).every(([e, t]) => !t.required || !$(this.ctx.get(e)));
|
|
711
|
-
}
|
|
712
|
-
reset() {
|
|
713
|
-
this.isActive = !1, this.disposables = this.disposables.splice(0).filter((e) => {
|
|
714
|
-
if (this.uid !== null && e[P.static] === this) return !0;
|
|
715
|
-
(async () => e())().catch((t) => {
|
|
716
|
-
this.context.emit(this.ctx, "internal/error", t);
|
|
717
|
-
});
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
init(e) {
|
|
721
|
-
this.config ? this.start() : this.cancel(e);
|
|
722
|
-
}
|
|
723
|
-
start() {
|
|
724
|
-
if (!this.ready || this.isActive || this.uid === null) return !0;
|
|
725
|
-
this.isActive = !0, this.updateStatus(() => this.hasError = !1);
|
|
726
|
-
}
|
|
727
|
-
accept(...e) {
|
|
728
|
-
const r = { keys: Array.isArray(e[0]) ? e.shift() : null, callback: e[0], ...e[1] };
|
|
729
|
-
return this.effect(() => (this.acceptors.push(r), r.immediate && r.callback?.(this.config), () => N(this.acceptors, r)));
|
|
730
|
-
}
|
|
731
|
-
decline(e) {
|
|
732
|
-
return this.accept(e, () => !0);
|
|
733
|
-
}
|
|
734
|
-
checkUpdate(e, t) {
|
|
735
|
-
if (t || !this.config) return [!0, !0];
|
|
736
|
-
if (t === !1) return [!1, !1];
|
|
737
|
-
const r = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ g((d) => {
|
|
738
|
-
const b = r[d] ??= !B(this.config[d], e[d]);
|
|
739
|
-
return i ||= b, b;
|
|
740
|
-
}, "checkPropertyUpdate"), c = /* @__PURE__ */ new Set();
|
|
741
|
-
let i = !1, a = !1, y = this.runtime.isReactive || null;
|
|
742
|
-
for (const { keys: d, callback: b, passive: j } of this.acceptors) {
|
|
743
|
-
if (!d)
|
|
744
|
-
y ||= !j;
|
|
745
|
-
else if (j)
|
|
746
|
-
d?.forEach((R) => c.add(R));
|
|
747
|
-
else {
|
|
748
|
-
let R = !1;
|
|
749
|
-
for (const x of d)
|
|
750
|
-
R ||= n(x);
|
|
751
|
-
if (!R) continue;
|
|
752
|
-
}
|
|
753
|
-
b?.(e) && (a = !0);
|
|
754
|
-
}
|
|
755
|
-
for (const d in { ...this.config, ...e })
|
|
756
|
-
if (y !== !1 && !(d in r) && !c.has(d)) {
|
|
757
|
-
const b = n(d);
|
|
758
|
-
y === null && (a ||= b);
|
|
759
|
-
}
|
|
760
|
-
return [i, a];
|
|
761
|
-
}
|
|
762
|
-
}, He = class extends de {
|
|
763
|
-
constructor(e, t, r, n) {
|
|
764
|
-
super(e, r), this.runtime = t, this.dispose = A(e.scope.collect(`fork <${e.runtime.name}>`, () => {
|
|
765
|
-
this.uid = null, this.reset(), this.context.emit("internal/fork", this);
|
|
766
|
-
const c = N(t.disposables, this.dispose);
|
|
767
|
-
return N(t.children, this) && !t.children.length && e.registry.delete(t.plugin), c;
|
|
768
|
-
}), P.static, t), t.children.push(this), t.disposables.push(this.dispose), this.context.emit("internal/fork", this), this.init(n);
|
|
769
|
-
}
|
|
770
|
-
static {
|
|
771
|
-
g(this, "ForkScope");
|
|
772
|
-
}
|
|
773
|
-
dispose;
|
|
774
|
-
start() {
|
|
775
|
-
if (super.start()) return !0;
|
|
776
|
-
for (const e of this.runtime.forkables)
|
|
777
|
-
this.ensure(async () => e(this.context, this._config));
|
|
778
|
-
}
|
|
779
|
-
update(e, t) {
|
|
780
|
-
const r = this.config, n = this.runtime.isForkable ? this : this.runtime;
|
|
781
|
-
if (n.config !== r) return;
|
|
782
|
-
let c;
|
|
783
|
-
try {
|
|
784
|
-
c = q(this.runtime.plugin, e);
|
|
785
|
-
} catch (y) {
|
|
786
|
-
return this.context.emit("internal/error", y), this.cancel(y);
|
|
787
|
-
}
|
|
788
|
-
const [i, a] = n.checkUpdate(c, t);
|
|
789
|
-
this.context.emit("internal/before-update", this, e), this.config = c, n.config = c, i && this.context.emit("internal/update", this, r), a && n.restart();
|
|
790
|
-
}
|
|
791
|
-
}, ce = class extends de {
|
|
792
|
-
constructor(e, t, r, n) {
|
|
793
|
-
super(e, r), this.plugin = t, t ? (this.setup(), this.init(n)) : (this.name = "root", this.isActive = !0);
|
|
794
|
-
}
|
|
795
|
-
static {
|
|
796
|
-
g(this, "MainScope");
|
|
797
|
-
}
|
|
798
|
-
value;
|
|
799
|
-
runtime = this;
|
|
800
|
-
schema;
|
|
801
|
-
name;
|
|
802
|
-
inject = /* @__PURE__ */ Object.create(null);
|
|
803
|
-
forkables = [];
|
|
804
|
-
children = [];
|
|
805
|
-
isReusable = !1;
|
|
806
|
-
isReactive = !1;
|
|
807
|
-
get isForkable() {
|
|
808
|
-
return this.forkables.length > 0;
|
|
809
|
-
}
|
|
810
|
-
fork(e, t, r) {
|
|
811
|
-
return new He(e, this, t, r);
|
|
812
|
-
}
|
|
813
|
-
dispose() {
|
|
814
|
-
return this.uid = null, this.reset(), this.context.emit("internal/runtime", this), !0;
|
|
815
|
-
}
|
|
816
|
-
setup() {
|
|
817
|
-
const { name: e } = this.plugin;
|
|
818
|
-
e && e !== "apply" && (this.name = e), this.schema = this.plugin.Config || this.plugin.schema, this.inject = K.resolve(this.plugin.using || this.plugin.inject), this.isReusable = this.plugin.reusable, this.isReactive = this.plugin.reactive, this.context.emit("internal/runtime", this), this.isReusable && this.forkables.push(this.apply);
|
|
819
|
-
}
|
|
820
|
-
apply = /* @__PURE__ */ g((e, t) => {
|
|
821
|
-
if (typeof this.plugin != "function")
|
|
822
|
-
return this.plugin.apply(e, t);
|
|
823
|
-
if (ee(this.plugin)) {
|
|
824
|
-
const r = new this.plugin(e, t), n = r[P.expose];
|
|
825
|
-
return n && e.set(n, r), r.fork && this.forkables.push(r.fork.bind(r)), r;
|
|
826
|
-
} else
|
|
827
|
-
return this.plugin(e, t);
|
|
828
|
-
}, "apply");
|
|
829
|
-
reset() {
|
|
830
|
-
super.reset();
|
|
831
|
-
for (const e of this.children)
|
|
832
|
-
e.reset();
|
|
833
|
-
}
|
|
834
|
-
start() {
|
|
835
|
-
if (super.start()) return !0;
|
|
836
|
-
!this.isReusable && this.plugin && this.ensure(async () => this.value = this.apply(this.ctx, this._config));
|
|
837
|
-
for (const e of this.children)
|
|
838
|
-
e.start();
|
|
839
|
-
}
|
|
840
|
-
update(e, t) {
|
|
841
|
-
if (this.isForkable) {
|
|
842
|
-
const y = new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);
|
|
843
|
-
this.context.emit(this.ctx, "internal/warning", y);
|
|
844
|
-
}
|
|
845
|
-
const r = this.config;
|
|
846
|
-
let n;
|
|
847
|
-
try {
|
|
848
|
-
n = q(this.runtime.plugin || this.context.constructor, e);
|
|
849
|
-
} catch (y) {
|
|
850
|
-
return this.context.emit("internal/error", y), this.cancel(y);
|
|
851
|
-
}
|
|
852
|
-
const [c, i] = this.checkUpdate(n, t), a = this.children.find((y) => y.config === r);
|
|
853
|
-
this.config = n, a && (this.context.emit("internal/before-update", a, e), a.config = n, c && this.context.emit("internal/update", a, r)), i && this.restart();
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
function me(e) {
|
|
857
|
-
return e && typeof e == "object" && typeof e.apply == "function";
|
|
858
|
-
}
|
|
859
|
-
g(me, "isApplicable");
|
|
860
|
-
function K(e) {
|
|
861
|
-
return function(t, r) {
|
|
862
|
-
if (r.kind === "class")
|
|
863
|
-
t.inject = e;
|
|
864
|
-
else if (r.kind === "method")
|
|
865
|
-
r.addInitializer(function() {
|
|
866
|
-
const n = this[h.tracker]?.property;
|
|
867
|
-
if (!n) throw new Error("missing context tracker");
|
|
868
|
-
this[n].inject(e, (c) => {
|
|
869
|
-
t.call(L(this, { [n]: c }));
|
|
870
|
-
});
|
|
871
|
-
});
|
|
872
|
-
else
|
|
873
|
-
throw new Error("@Inject can only be used on class or class methods");
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
g(K, "Inject");
|
|
877
|
-
((e) => {
|
|
878
|
-
function t(r) {
|
|
879
|
-
if (!r) return {};
|
|
880
|
-
if (Array.isArray(r))
|
|
881
|
-
return Object.fromEntries(r.map((a) => [a, { required: !0 }]));
|
|
882
|
-
const { required: n, optional: c, ...i } = r;
|
|
883
|
-
return Array.isArray(n) && Object.assign(i, Object.fromEntries(n.map((a) => [a, { required: !0 }]))), Array.isArray(c) && Object.assign(i, Object.fromEntries(c.map((a) => [a, { required: !1 }]))), i;
|
|
884
|
-
}
|
|
885
|
-
e.resolve = t, g(t, "resolve");
|
|
886
|
-
})(K || (K = {}));
|
|
887
|
-
var Ke = class {
|
|
888
|
-
constructor(e, t) {
|
|
889
|
-
this.ctx = e, A(this, h.tracker, {
|
|
890
|
-
associate: "registry",
|
|
891
|
-
property: "ctx"
|
|
892
|
-
}), this.context = e;
|
|
893
|
-
const r = new ce(e, null, t);
|
|
894
|
-
e.scope = r, r.ctx = e, this.set(null, r);
|
|
895
|
-
}
|
|
896
|
-
static {
|
|
897
|
-
g(this, "Registry");
|
|
898
|
-
}
|
|
899
|
-
_counter = 0;
|
|
900
|
-
_internal = /* @__PURE__ */ new Map();
|
|
901
|
-
context;
|
|
902
|
-
get counter() {
|
|
903
|
-
return ++this._counter;
|
|
904
|
-
}
|
|
905
|
-
get size() {
|
|
906
|
-
return this._internal.size;
|
|
907
|
-
}
|
|
908
|
-
resolve(e, t = !1) {
|
|
909
|
-
if (e === null || typeof e == "function") return e;
|
|
910
|
-
if (me(e)) return e.apply;
|
|
911
|
-
if (t) throw new Error('invalid plugin, expect function or object with an "apply" method, received ' + typeof e);
|
|
912
|
-
}
|
|
913
|
-
get(e) {
|
|
914
|
-
const t = this.resolve(e);
|
|
915
|
-
return t && this._internal.get(t);
|
|
916
|
-
}
|
|
917
|
-
has(e) {
|
|
918
|
-
const t = this.resolve(e);
|
|
919
|
-
return !!t && this._internal.has(t);
|
|
920
|
-
}
|
|
921
|
-
set(e, t) {
|
|
922
|
-
const r = this.resolve(e);
|
|
923
|
-
this._internal.set(r, t);
|
|
924
|
-
}
|
|
925
|
-
delete(e) {
|
|
926
|
-
const t = this.resolve(e), r = t && this._internal.get(t);
|
|
927
|
-
if (r)
|
|
928
|
-
return this._internal.delete(t), r.dispose(), r;
|
|
929
|
-
}
|
|
930
|
-
keys() {
|
|
931
|
-
return this._internal.keys();
|
|
932
|
-
}
|
|
933
|
-
values() {
|
|
934
|
-
return this._internal.values();
|
|
935
|
-
}
|
|
936
|
-
entries() {
|
|
937
|
-
return this._internal.entries();
|
|
938
|
-
}
|
|
939
|
-
forEach(e) {
|
|
940
|
-
return this._internal.forEach(e);
|
|
941
|
-
}
|
|
942
|
-
using(e, t) {
|
|
943
|
-
return this.inject(e, t);
|
|
944
|
-
}
|
|
945
|
-
inject(e, t) {
|
|
946
|
-
return this.plugin({ inject: e, apply: t, name: t.name });
|
|
947
|
-
}
|
|
948
|
-
plugin(e, t, r) {
|
|
949
|
-
if (this.resolve(e, !0), this.ctx.scope.assertActive(), !r)
|
|
950
|
-
try {
|
|
951
|
-
t = q(e, t);
|
|
952
|
-
} catch (c) {
|
|
953
|
-
this.context.emit(this.ctx, "internal/error", c), r = c, t = null;
|
|
954
|
-
}
|
|
955
|
-
let n = this.get(e);
|
|
956
|
-
return n ? (n.isForkable || this.context.emit(this.ctx, "internal/warning", new Error(`duplicate plugin detected: ${e.name}`)), n.fork(this.ctx, t, r)) : (n = new ce(this.ctx, e, t, r), this.set(e, n), n.fork(this.ctx, t, r));
|
|
957
|
-
}
|
|
958
|
-
}, Ge = Ke, P = class z {
|
|
959
|
-
static {
|
|
960
|
-
g(this, "Context");
|
|
961
|
-
}
|
|
962
|
-
static store = h.store;
|
|
963
|
-
static events = h.events;
|
|
964
|
-
static static = h.static;
|
|
965
|
-
static filter = h.filter;
|
|
966
|
-
static expose = h.expose;
|
|
967
|
-
static isolate = h.isolate;
|
|
968
|
-
static internal = h.internal;
|
|
969
|
-
static intercept = h.intercept;
|
|
970
|
-
static origin = "ctx";
|
|
971
|
-
static current = "ctx";
|
|
972
|
-
static is(t) {
|
|
973
|
-
return !!t?.[z.is];
|
|
974
|
-
}
|
|
975
|
-
static {
|
|
976
|
-
z.is[Symbol.toPrimitive] = () => Symbol.for("cordis.is"), z.prototype[z.is] = !0;
|
|
977
|
-
}
|
|
978
|
-
/** @deprecated use `Service.traceable` instead */
|
|
979
|
-
static associate(t, r) {
|
|
980
|
-
return t;
|
|
981
|
-
}
|
|
982
|
-
constructor(t) {
|
|
983
|
-
t = q(this.constructor, t), this[h.store] = /* @__PURE__ */ Object.create(null), this[h.isolate] = /* @__PURE__ */ Object.create(null), this[h.internal] = /* @__PURE__ */ Object.create(null), this[h.intercept] = /* @__PURE__ */ Object.create(null);
|
|
984
|
-
const r = new Proxy(this, Q.handler);
|
|
985
|
-
r.root = r, r.reflect = new Q(r), r.registry = new Ge(r, t), r.lifecycle = new Je(r);
|
|
986
|
-
const n = /* @__PURE__ */ g((c) => {
|
|
987
|
-
if (c) {
|
|
988
|
-
n(Object.getPrototypeOf(c));
|
|
989
|
-
for (const i of Object.getOwnPropertyNames(c)) {
|
|
990
|
-
const a = c[i].prototype?.constructor;
|
|
991
|
-
a && (r[c[i].key] = new a(r, t), A(r[c[i].key], "ctx", r));
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
}, "attach");
|
|
995
|
-
return n(this[h.internal]), r;
|
|
996
|
-
}
|
|
997
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
998
|
-
return `Context <${this.name}>`;
|
|
999
|
-
}
|
|
1000
|
-
get name() {
|
|
1001
|
-
let t = this.runtime;
|
|
1002
|
-
for (; t && !t.name; )
|
|
1003
|
-
t = t.parent.runtime;
|
|
1004
|
-
return t?.name;
|
|
1005
|
-
}
|
|
1006
|
-
get events() {
|
|
1007
|
-
return this.lifecycle;
|
|
1008
|
-
}
|
|
1009
|
-
/** @deprecated */
|
|
1010
|
-
get state() {
|
|
1011
|
-
return this.scope;
|
|
1012
|
-
}
|
|
1013
|
-
extend(t = {}) {
|
|
1014
|
-
const r = Reflect.getOwnPropertyDescriptor(this, h.shadow)?.value, n = Object.assign(Object.create(D(this, this)), t);
|
|
1015
|
-
return r ? Object.assign(Object.create(n), { [h.shadow]: r }) : n;
|
|
1016
|
-
}
|
|
1017
|
-
isolate(t, r) {
|
|
1018
|
-
const n = Object.create(this[h.isolate]);
|
|
1019
|
-
return n[t] = r ?? Symbol(t), this.extend({ [h.isolate]: n });
|
|
1020
|
-
}
|
|
1021
|
-
intercept(t, r) {
|
|
1022
|
-
const n = Object.create(this[h.intercept]);
|
|
1023
|
-
return n[t] = r, this.extend({ [h.intercept]: n });
|
|
1024
|
-
}
|
|
1025
|
-
};
|
|
1026
|
-
P.prototype[P.internal] = /* @__PURE__ */ Object.create(null);
|
|
1027
|
-
var Xe = class be {
|
|
1028
|
-
static {
|
|
1029
|
-
g(this, "Service");
|
|
1030
|
-
}
|
|
1031
|
-
static setup = h.setup;
|
|
1032
|
-
static invoke = h.invoke;
|
|
1033
|
-
static extend = h.extend;
|
|
1034
|
-
static tracker = h.tracker;
|
|
1035
|
-
static provide = h.provide;
|
|
1036
|
-
static immediate = h.immediate;
|
|
1037
|
-
start() {
|
|
1038
|
-
}
|
|
1039
|
-
stop() {
|
|
1040
|
-
}
|
|
1041
|
-
ctx;
|
|
1042
|
-
name;
|
|
1043
|
-
config;
|
|
1044
|
-
constructor(...t) {
|
|
1045
|
-
let r, n, c, i;
|
|
1046
|
-
P.is(t[0]) ? (r = t[0], typeof t[1] == "string" ? (n = t[1], c = t[2]) : i = t[1]) : i = t[0], n ??= this.constructor[h.provide], c ??= this.constructor[h.immediate];
|
|
1047
|
-
let a = this;
|
|
1048
|
-
const y = {
|
|
1049
|
-
associate: n,
|
|
1050
|
-
property: "ctx"
|
|
1051
|
-
};
|
|
1052
|
-
return a[h.invoke] && (a = Y(n, te(Object.getPrototypeOf(this), Function.prototype), y)), r ? a.ctx = r : a[h.setup](), a.name = n, a.config = i, A(a, h.tracker, y), a.ctx.provide(n), a.ctx.runtime.name = n, c && (r ? a[h.expose] = n : a.ctx.set(n, a)), a.ctx.on("ready", async () => {
|
|
1053
|
-
await Promise.resolve(), await a.start(), c || a.ctx.set(n, a);
|
|
1054
|
-
}), a.ctx.on("dispose", () => a.stop()), a;
|
|
1055
|
-
}
|
|
1056
|
-
[h.filter](t) {
|
|
1057
|
-
return t[h.isolate][this.name] === this.ctx[h.isolate][this.name];
|
|
1058
|
-
}
|
|
1059
|
-
[h.setup]() {
|
|
1060
|
-
this.ctx = new P();
|
|
1061
|
-
}
|
|
1062
|
-
[h.extend](t) {
|
|
1063
|
-
let r;
|
|
1064
|
-
return this[be.invoke] ? r = Y(this.name, this, this[h.tracker]) : r = Object.create(this), Object.assign(r, t);
|
|
1065
|
-
}
|
|
1066
|
-
static [Symbol.hasInstance](t) {
|
|
1067
|
-
let r = t.constructor;
|
|
1068
|
-
for (; r; ) {
|
|
1069
|
-
if (r = r.prototype?.constructor, r === this) return !0;
|
|
1070
|
-
r = Object.getPrototypeOf(r);
|
|
1071
|
-
}
|
|
1072
|
-
return !1;
|
|
1073
|
-
}
|
|
1074
|
-
}, We = Object.defineProperty, Ye = Object.getOwnPropertyNames, v = (e, t) => We(e, "name", { value: t, configurable: !0 }), Qe = (e, t) => function() {
|
|
1075
|
-
return t || (0, e[Ye(e)[0]])((t = { exports: {} }).exports, t), t.exports;
|
|
1076
|
-
}, Ze = Qe({
|
|
1077
|
-
"src/index.ts"(e, t) {
|
|
1078
|
-
var r = Symbol.for("schemastery"), n = Symbol.for("ValidationError");
|
|
1079
|
-
globalThis.__schemastery_index__ ??= 0;
|
|
1080
|
-
var c = class extends TypeError {
|
|
1081
|
-
constructor(o, s) {
|
|
1082
|
-
let f = "$";
|
|
1083
|
-
for (const u of s.path || [])
|
|
1084
|
-
typeof u == "string" ? f += "." + u : typeof u == "number" ? f += "[" + u + "]" : typeof u == "symbol" && (f += `[Symbol(${u.toString()})]`);
|
|
1085
|
-
f.startsWith(".") && (f = f.slice(1)), super((f === "$" ? "" : `${f} `) + o), this.options = s;
|
|
1086
|
-
}
|
|
1087
|
-
static {
|
|
1088
|
-
v(this, "ValidationError");
|
|
1089
|
-
}
|
|
1090
|
-
name = "ValidationError";
|
|
1091
|
-
static is(o) {
|
|
1092
|
-
return !!o?.[n];
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
Object.defineProperty(c.prototype, n, {
|
|
1096
|
-
value: !0
|
|
1097
|
-
});
|
|
1098
|
-
var i = /* @__PURE__ */ v(function(o) {
|
|
1099
|
-
const s = /* @__PURE__ */ v(function(f, u = {}) {
|
|
1100
|
-
return i.resolve(f, s, u)[0];
|
|
1101
|
-
}, "schema");
|
|
1102
|
-
if (o.refs) {
|
|
1103
|
-
const f = C(o.refs, (l) => new i(l)), u = /* @__PURE__ */ v((l) => f[l], "getRef");
|
|
1104
|
-
for (const l in f) {
|
|
1105
|
-
const p = f[l];
|
|
1106
|
-
p.sKey = u(p.sKey), p.inner = u(p.inner), p.list = p.list && p.list.map(u), p.dict = p.dict && C(p.dict, u);
|
|
1107
|
-
}
|
|
1108
|
-
return f[o.uid];
|
|
1109
|
-
}
|
|
1110
|
-
if (Object.assign(s, o), typeof s.callback == "string")
|
|
1111
|
-
try {
|
|
1112
|
-
s.callback = new Function("return " + s.callback)();
|
|
1113
|
-
} catch {
|
|
1114
|
-
}
|
|
1115
|
-
return Object.defineProperty(s, "uid", { value: globalThis.__schemastery_index__++ }), Object.setPrototypeOf(s, i.prototype), s.meta ||= {}, s.toString = s.toString.bind(s), s;
|
|
1116
|
-
}, "Schema");
|
|
1117
|
-
i.prototype = Object.create(Function.prototype), i.prototype[r] = !0, i.ValidationError = c;
|
|
1118
|
-
var a;
|
|
1119
|
-
i.prototype.toJSON = /* @__PURE__ */ v(function() {
|
|
1120
|
-
if (a)
|
|
1121
|
-
return a[this.uid] ??= JSON.parse(JSON.stringify({ ...this })), this.uid;
|
|
1122
|
-
a = { [this.uid]: { ...this } }, a[this.uid] = JSON.parse(JSON.stringify({ ...this }));
|
|
1123
|
-
const s = { uid: this.uid, refs: a };
|
|
1124
|
-
return a = void 0, s;
|
|
1125
|
-
}, "toJSON"), i.prototype.set = /* @__PURE__ */ v(function(s, f) {
|
|
1126
|
-
return this.dict[s] = f, this;
|
|
1127
|
-
}, "set"), i.prototype.push = /* @__PURE__ */ v(function(s) {
|
|
1128
|
-
return this.list.push(s), this;
|
|
1129
|
-
}, "push");
|
|
1130
|
-
function y(o, s) {
|
|
1131
|
-
const f = typeof o == "string" ? { "": o } : { ...o };
|
|
1132
|
-
for (const u in s) {
|
|
1133
|
-
const l = s[u];
|
|
1134
|
-
l?.$description || l?.$desc ? f[u] = l.$description || l.$desc : typeof l == "string" && (f[u] = l);
|
|
1135
|
-
}
|
|
1136
|
-
return f;
|
|
1137
|
-
}
|
|
1138
|
-
v(y, "mergeDesc");
|
|
1139
|
-
function d(o) {
|
|
1140
|
-
return o?.$value ?? o?.$inner;
|
|
1141
|
-
}
|
|
1142
|
-
v(d, "getInner");
|
|
1143
|
-
function b(o) {
|
|
1144
|
-
return fe(o ?? {}, (s) => !s.startsWith("$"));
|
|
1145
|
-
}
|
|
1146
|
-
v(b, "extractKeys"), i.prototype.i18n = /* @__PURE__ */ v(function(s) {
|
|
1147
|
-
const f = i(this), u = y(f.meta.description, s);
|
|
1148
|
-
return Object.keys(u).length && (f.meta.description = u), f.dict && (f.dict = C(f.dict, (l, p) => l.i18n(C(s, (m) => d(m)?.[p] ?? m?.[p])))), f.list && (f.list = f.list.map((l, p) => l.i18n(C(s, (m = {}) => Array.isArray(d(m)) ? d(m)[p] : Array.isArray(m) ? m[p] : b(m))))), f.inner && (f.inner = f.inner.i18n(C(s, (l) => d(l) ? d(l) : b(l)))), f.sKey && (f.sKey = f.sKey.i18n(C(s, (l) => l?.$key))), f;
|
|
1149
|
-
}, "i18n"), i.prototype.extra = /* @__PURE__ */ v(function(s, f) {
|
|
1150
|
-
const u = i(this);
|
|
1151
|
-
return u.meta = { ...u.meta, [s]: f }, u;
|
|
1152
|
-
}, "extra");
|
|
1153
|
-
for (const o of ["required", "disabled", "collapse", "hidden", "loose"])
|
|
1154
|
-
Object.assign(i.prototype, {
|
|
1155
|
-
[o](s = !0) {
|
|
1156
|
-
const f = i(this);
|
|
1157
|
-
return f.meta = { ...f.meta, [o]: s }, f;
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
1160
|
-
i.prototype.deprecated = /* @__PURE__ */ v(function() {
|
|
1161
|
-
const s = i(this);
|
|
1162
|
-
return s.meta.badges ||= [], s.meta.badges.push({ text: "deprecated", type: "danger" }), s;
|
|
1163
|
-
}, "deprecated"), i.prototype.experimental = /* @__PURE__ */ v(function() {
|
|
1164
|
-
const s = i(this);
|
|
1165
|
-
return s.meta.badges ||= [], s.meta.badges.push({ text: "experimental", type: "warning" }), s;
|
|
1166
|
-
}, "experimental"), i.prototype.pattern = /* @__PURE__ */ v(function(s) {
|
|
1167
|
-
const f = i(this), u = ae(s, ["source", "flags"]);
|
|
1168
|
-
return f.meta = { ...f.meta, pattern: u }, f;
|
|
1169
|
-
}, "pattern"), i.prototype.simplify = /* @__PURE__ */ v(function(s) {
|
|
1170
|
-
if (B(s, this.meta.default, this.type === "dict")) return null;
|
|
1171
|
-
if ($(s)) return s;
|
|
1172
|
-
if (this.type === "object" || this.type === "dict") {
|
|
1173
|
-
const f = {};
|
|
1174
|
-
for (const u in s) {
|
|
1175
|
-
const p = (this.type === "object" ? this.dict[u] : this.inner)?.simplify(s[u]);
|
|
1176
|
-
(this.type === "dict" || !$(p)) && (f[u] = p);
|
|
1177
|
-
}
|
|
1178
|
-
return B(f, this.meta.default, this.type === "dict") ? null : f;
|
|
1179
|
-
} else if (this.type === "array" || this.type === "tuple") {
|
|
1180
|
-
const f = [];
|
|
1181
|
-
return s.forEach((u, l) => {
|
|
1182
|
-
const p = this.type === "array" ? this.inner : this.list[l], m = p ? p.simplify(u) : u;
|
|
1183
|
-
f.push(m);
|
|
1184
|
-
}), f;
|
|
1185
|
-
} else if (this.type === "intersect") {
|
|
1186
|
-
const f = {};
|
|
1187
|
-
for (const u of this.list)
|
|
1188
|
-
Object.assign(f, u.simplify(s));
|
|
1189
|
-
return f;
|
|
1190
|
-
} else if (this.type === "union")
|
|
1191
|
-
for (const f of this.list)
|
|
1192
|
-
try {
|
|
1193
|
-
return i.resolve(s, f, {}), f.simplify(s);
|
|
1194
|
-
} catch {
|
|
1195
|
-
}
|
|
1196
|
-
return s;
|
|
1197
|
-
}, "simplify"), i.prototype.toString = /* @__PURE__ */ v(function(s) {
|
|
1198
|
-
return ie[this.type]?.(this, s) ?? `Schema<${this.type}>`;
|
|
1199
|
-
}, "toString"), i.prototype.role = /* @__PURE__ */ v(function(o, s) {
|
|
1200
|
-
const f = i(this);
|
|
1201
|
-
return f.meta = { ...f.meta, role: o, extra: s }, f;
|
|
1202
|
-
}, "role");
|
|
1203
|
-
for (const o of ["default", "link", "comment", "description", "max", "min", "step"])
|
|
1204
|
-
Object.assign(i.prototype, {
|
|
1205
|
-
[o](s) {
|
|
1206
|
-
const f = i(this);
|
|
1207
|
-
return f.meta = { ...f.meta, [o]: s }, f;
|
|
1208
|
-
}
|
|
1209
|
-
});
|
|
1210
|
-
var j = {};
|
|
1211
|
-
i.extend = /* @__PURE__ */ v(function(s, f) {
|
|
1212
|
-
j[s] = f;
|
|
1213
|
-
}, "extend"), i.resolve = /* @__PURE__ */ v(function(s, f, u = {}, l = !1) {
|
|
1214
|
-
if (!f) return [s];
|
|
1215
|
-
if (u.ignore?.(s, f)) return [s];
|
|
1216
|
-
if ($(s) && f.type !== "lazy") {
|
|
1217
|
-
if (f.meta.required) throw new c("missing required value", u);
|
|
1218
|
-
let m = f, S = f.meta.default;
|
|
1219
|
-
for (; m?.type === "intersect" && $(S); )
|
|
1220
|
-
m = m.list[0], S = m?.meta.default;
|
|
1221
|
-
if ($(S)) return [s];
|
|
1222
|
-
s = V(S);
|
|
1223
|
-
}
|
|
1224
|
-
const p = j[f.type];
|
|
1225
|
-
if (!p) throw new c(`unsupported type "${f.type}"`, u);
|
|
1226
|
-
try {
|
|
1227
|
-
return p(s, f, u, l);
|
|
1228
|
-
} catch (m) {
|
|
1229
|
-
if (!f.meta.loose) throw m;
|
|
1230
|
-
return [f.meta.default];
|
|
1231
|
-
}
|
|
1232
|
-
}, "resolve"), i.from = /* @__PURE__ */ v(function(s) {
|
|
1233
|
-
if ($(s))
|
|
1234
|
-
return i.any();
|
|
1235
|
-
if (["string", "number", "boolean"].includes(typeof s))
|
|
1236
|
-
return i.const(s).required();
|
|
1237
|
-
if (s[r])
|
|
1238
|
-
return s;
|
|
1239
|
-
if (typeof s == "function")
|
|
1240
|
-
switch (s) {
|
|
1241
|
-
case String:
|
|
1242
|
-
return i.string().required();
|
|
1243
|
-
case Number:
|
|
1244
|
-
return i.number().required();
|
|
1245
|
-
case Boolean:
|
|
1246
|
-
return i.boolean().required();
|
|
1247
|
-
case Function:
|
|
1248
|
-
return i.function().required();
|
|
1249
|
-
default:
|
|
1250
|
-
return i.is(s).required();
|
|
1251
|
-
}
|
|
1252
|
-
else
|
|
1253
|
-
throw new TypeError(`cannot infer schema from ${s}`);
|
|
1254
|
-
}, "from"), i.lazy = /* @__PURE__ */ v(function(s) {
|
|
1255
|
-
const f = /* @__PURE__ */ v(() => (u.inner[r] || (u.inner = u.builder(), u.inner.meta = { ...u.meta, ...u.inner.meta }), u.inner.toJSON()), "toJSON"), u = new i({ type: "lazy", builder: s, inner: { toJSON: f } });
|
|
1256
|
-
return u;
|
|
1257
|
-
}, "lazy"), i.natural = /* @__PURE__ */ v(function() {
|
|
1258
|
-
return i.number().step(1).min(0);
|
|
1259
|
-
}, "natural"), i.percent = /* @__PURE__ */ v(function() {
|
|
1260
|
-
return i.number().step(0.01).min(0).max(1).role("slider");
|
|
1261
|
-
}, "percent"), i.date = /* @__PURE__ */ v(function() {
|
|
1262
|
-
return i.union([
|
|
1263
|
-
i.is(Date),
|
|
1264
|
-
i.transform(i.string().role("datetime"), (s, f) => {
|
|
1265
|
-
const u = new Date(s);
|
|
1266
|
-
if (isNaN(+u)) throw new c(`invalid date "${s}"`, f);
|
|
1267
|
-
return u;
|
|
1268
|
-
}, !0)
|
|
1269
|
-
]);
|
|
1270
|
-
}, "date"), i.regExp = /* @__PURE__ */ v(function(s = "") {
|
|
1271
|
-
return i.union([
|
|
1272
|
-
i.is(RegExp),
|
|
1273
|
-
i.transform(i.string().role("regexp", { flag: s }), (f, u) => {
|
|
1274
|
-
try {
|
|
1275
|
-
return new RegExp(f, s);
|
|
1276
|
-
} catch (l) {
|
|
1277
|
-
throw new c(l.message, u);
|
|
1278
|
-
}
|
|
1279
|
-
}, !0)
|
|
1280
|
-
]);
|
|
1281
|
-
}, "regExp"), i.arrayBuffer = /* @__PURE__ */ v(function(s) {
|
|
1282
|
-
return i.union([
|
|
1283
|
-
i.is(ArrayBuffer),
|
|
1284
|
-
i.is(SharedArrayBuffer),
|
|
1285
|
-
i.transform(i.any(), (f, u) => {
|
|
1286
|
-
if (E.isSource(f)) return E.fromSource(f);
|
|
1287
|
-
throw new c(`expected ArrayBufferSource but got ${f}`, u);
|
|
1288
|
-
}, !0),
|
|
1289
|
-
...s ? [i.transform(i.string(), (f, u) => {
|
|
1290
|
-
try {
|
|
1291
|
-
return s === "base64" ? E.fromBase64(f) : E.fromHex(f);
|
|
1292
|
-
} catch (l) {
|
|
1293
|
-
throw new c(l.message, u);
|
|
1294
|
-
}
|
|
1295
|
-
}, !0)] : []
|
|
1296
|
-
]);
|
|
1297
|
-
}, "arrayBuffer"), i.extend("lazy", (o, s, f, u) => (s.inner[r] || (s.inner = s.builder(), s.inner.meta = { ...s.meta, ...s.inner.meta }), i.resolve(o, s.inner, f, u))), i.extend("any", (o) => [o]), i.extend("never", (o, s, f) => {
|
|
1298
|
-
throw new c(`expected nullable but got ${o}`, f);
|
|
1299
|
-
}), i.extend("const", (o, { value: s }, f) => {
|
|
1300
|
-
if (B(o, s)) return [s];
|
|
1301
|
-
throw new c(`expected ${s} but got ${o}`, f);
|
|
1302
|
-
});
|
|
1303
|
-
function O(o, s, f, u, l = !1) {
|
|
1304
|
-
const { max: p = 1 / 0, min: m = -1 / 0 } = s;
|
|
1305
|
-
if (o > p) throw new c(`expected ${f} <= ${p} but got ${o}`, u);
|
|
1306
|
-
if (o < m && !l) throw new c(`expected ${f} >= ${m} but got ${o}`, u);
|
|
1307
|
-
}
|
|
1308
|
-
v(O, "checkWithinRange"), i.extend("string", (o, { meta: s }, f) => {
|
|
1309
|
-
if (typeof o != "string") throw new c(`expected string but got ${o}`, f);
|
|
1310
|
-
if (s.pattern) {
|
|
1311
|
-
const u = new RegExp(s.pattern.source, s.pattern.flags);
|
|
1312
|
-
if (!u.test(o)) throw new c(`expect string to match regexp ${u}`, f);
|
|
1313
|
-
}
|
|
1314
|
-
return O(o.length, s, "string length", f), [o];
|
|
1315
|
-
});
|
|
1316
|
-
function R(o, s) {
|
|
1317
|
-
const f = o.toString();
|
|
1318
|
-
if (f.includes("e")) return o * Math.pow(10, s);
|
|
1319
|
-
const u = f.indexOf(".");
|
|
1320
|
-
if (u === -1) return o * Math.pow(10, s);
|
|
1321
|
-
const l = f.slice(u + 1), p = f.slice(0, u);
|
|
1322
|
-
return l.length <= s ? +(p + l.padEnd(s, "0")) : +(p + l.slice(0, s) + "." + l.slice(s));
|
|
1323
|
-
}
|
|
1324
|
-
v(R, "decimalShift");
|
|
1325
|
-
function x(o, s, f) {
|
|
1326
|
-
if (f = Math.abs(f), !/^\d+\.\d+$/.test(f.toString()))
|
|
1327
|
-
return (o - s) % f === 0;
|
|
1328
|
-
const u = f.toString().indexOf("."), l = f.toString().slice(u + 1).length;
|
|
1329
|
-
return Math.abs(R(o, l) - R(s, l)) % R(f, l) === 0;
|
|
1330
|
-
}
|
|
1331
|
-
v(x, "isMultipleOf"), i.extend("number", (o, { meta: s }, f) => {
|
|
1332
|
-
if (typeof o != "number") throw new c(`expected number but got ${o}`, f);
|
|
1333
|
-
O(o, s, "number", f);
|
|
1334
|
-
const { step: u } = s;
|
|
1335
|
-
if (u && !x(o, s.min ?? 0, u))
|
|
1336
|
-
throw new c(`expected number multiple of ${u} but got ${o}`, f);
|
|
1337
|
-
return [o];
|
|
1338
|
-
}), i.extend("boolean", (o, s, f) => {
|
|
1339
|
-
if (typeof o == "boolean") return [o];
|
|
1340
|
-
throw new c(`expected boolean but got ${o}`, f);
|
|
1341
|
-
}), i.extend("bitset", (o, { bits: s, meta: f }, u) => {
|
|
1342
|
-
let l = 0, p = [];
|
|
1343
|
-
if (typeof o == "number") {
|
|
1344
|
-
l = o;
|
|
1345
|
-
for (const m in s)
|
|
1346
|
-
o & s[m] && p.push(m);
|
|
1347
|
-
} else if (Array.isArray(o)) {
|
|
1348
|
-
p = o;
|
|
1349
|
-
for (const m of p) {
|
|
1350
|
-
if (typeof m != "string") throw new c(`expected string but got ${m}`, u);
|
|
1351
|
-
m in s && (l |= s[m]);
|
|
1352
|
-
}
|
|
1353
|
-
} else
|
|
1354
|
-
throw new c(`expected number or array but got ${o}`, u);
|
|
1355
|
-
return l === f.default ? [l] : [l, p];
|
|
1356
|
-
}), i.extend("function", (o, s, f) => {
|
|
1357
|
-
if (typeof o == "function") return [o];
|
|
1358
|
-
throw new c(`expected function but got ${o}`, f);
|
|
1359
|
-
}), i.extend("is", (o, { constructor: s }, f) => {
|
|
1360
|
-
if (typeof s == "function") {
|
|
1361
|
-
if (o instanceof s) return [o];
|
|
1362
|
-
throw new c(`expected ${s.name} but got ${o}`, f);
|
|
1363
|
-
} else {
|
|
1364
|
-
if ($(o))
|
|
1365
|
-
throw new c(`expected ${s} but got ${o}`, f);
|
|
1366
|
-
let u = Object.getPrototypeOf(o);
|
|
1367
|
-
for (; u; ) {
|
|
1368
|
-
if (u.constructor?.name === s) return [o];
|
|
1369
|
-
u = Object.getPrototypeOf(u);
|
|
1370
|
-
}
|
|
1371
|
-
throw new c(`expected ${s} but got ${o}`, f);
|
|
1372
|
-
}
|
|
1373
|
-
});
|
|
1374
|
-
function k(o, s, f, u) {
|
|
1375
|
-
try {
|
|
1376
|
-
const [l, p] = i.resolve(o[s], f, {
|
|
1377
|
-
...u,
|
|
1378
|
-
path: [...u.path || [], s]
|
|
1379
|
-
});
|
|
1380
|
-
return p !== void 0 && (o[s] = p), l;
|
|
1381
|
-
} catch (l) {
|
|
1382
|
-
if (!u?.autofix) throw l;
|
|
1383
|
-
return delete o[s], f.meta.default;
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
v(k, "property"), i.extend("array", (o, { inner: s, meta: f }, u) => {
|
|
1387
|
-
if (!Array.isArray(o)) throw new c(`expected array but got ${o}`, u);
|
|
1388
|
-
return O(o.length, f, "array length", u, !$(s.meta.default)), [o.map((l, p) => k(o, p, s, u))];
|
|
1389
|
-
}), i.extend("dict", (o, { inner: s, sKey: f }, u, l) => {
|
|
1390
|
-
if (!J(o)) throw new c(`expected object but got ${o}`, u);
|
|
1391
|
-
const p = {};
|
|
1392
|
-
for (const m in o) {
|
|
1393
|
-
let S;
|
|
1394
|
-
try {
|
|
1395
|
-
S = i.resolve(m, f, u)[0];
|
|
1396
|
-
} catch (xe) {
|
|
1397
|
-
if (l) continue;
|
|
1398
|
-
throw xe;
|
|
1399
|
-
}
|
|
1400
|
-
p[S] = k(o, m, s, u), o[S] = o[m], m !== S && delete o[m];
|
|
1401
|
-
}
|
|
1402
|
-
return [p];
|
|
1403
|
-
}), i.extend("tuple", (o, { list: s }, f, u) => {
|
|
1404
|
-
if (!Array.isArray(o)) throw new c(`expected array but got ${o}`, f);
|
|
1405
|
-
const l = s.map((p, m) => k(o, m, p, f));
|
|
1406
|
-
return u ? [l] : (l.push(...o.slice(s.length)), [l]);
|
|
1407
|
-
});
|
|
1408
|
-
function F(o, s) {
|
|
1409
|
-
for (const f in s)
|
|
1410
|
-
f in o || (o[f] = s[f]);
|
|
1411
|
-
}
|
|
1412
|
-
v(F, "merge"), i.extend("object", (o, { dict: s }, f, u) => {
|
|
1413
|
-
if (!J(o)) throw new c(`expected object but got ${o}`, f);
|
|
1414
|
-
const l = {};
|
|
1415
|
-
for (const p in s) {
|
|
1416
|
-
const m = k(o, p, s[p], f);
|
|
1417
|
-
(!$(m) || p in o) && (l[p] = m);
|
|
1418
|
-
}
|
|
1419
|
-
return u || F(l, o), [l];
|
|
1420
|
-
}), i.extend("union", (o, { list: s, toString: f }, u, l) => {
|
|
1421
|
-
for (const p of s)
|
|
1422
|
-
try {
|
|
1423
|
-
return i.resolve(o, p, u, l);
|
|
1424
|
-
} catch {
|
|
1425
|
-
}
|
|
1426
|
-
throw new c(`expected ${f()} but got ${JSON.stringify(o)}`, u);
|
|
1427
|
-
}), i.extend("intersect", (o, { list: s, toString: f }, u, l) => {
|
|
1428
|
-
if (!s.length) return [o];
|
|
1429
|
-
let p;
|
|
1430
|
-
for (const m of s) {
|
|
1431
|
-
const S = i.resolve(o, m, u, !0)[0];
|
|
1432
|
-
if (!$(S))
|
|
1433
|
-
if ($(p))
|
|
1434
|
-
p = S;
|
|
1435
|
-
else {
|
|
1436
|
-
if (typeof p != typeof S)
|
|
1437
|
-
throw new c(`expected ${f()} but got ${JSON.stringify(o)}`, u);
|
|
1438
|
-
if (typeof S == "object")
|
|
1439
|
-
F(p ??= {}, S);
|
|
1440
|
-
else if (p !== S)
|
|
1441
|
-
throw new c(`expected ${f()} but got ${JSON.stringify(o)}`, u);
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
return !l && J(o) && F(p, o), [p];
|
|
1445
|
-
}), i.extend("transform", (o, { inner: s, callback: f, preserve: u }, l) => {
|
|
1446
|
-
const [p, m = o] = i.resolve(o, s, l, !0);
|
|
1447
|
-
return u ? [f(p)] : [f(p), f(m)];
|
|
1448
|
-
});
|
|
1449
|
-
var ie = {};
|
|
1450
|
-
function _(o, s, f) {
|
|
1451
|
-
ie[o] = f, Object.assign(i, {
|
|
1452
|
-
[o](...u) {
|
|
1453
|
-
const l = new i({ type: o });
|
|
1454
|
-
return s.forEach((p, m) => {
|
|
1455
|
-
switch (p) {
|
|
1456
|
-
case "sKey":
|
|
1457
|
-
l.sKey = u[m] ?? i.string();
|
|
1458
|
-
break;
|
|
1459
|
-
case "inner":
|
|
1460
|
-
l.inner = i.from(u[m]);
|
|
1461
|
-
break;
|
|
1462
|
-
case "list":
|
|
1463
|
-
l.list = u[m].map(i.from);
|
|
1464
|
-
break;
|
|
1465
|
-
case "dict":
|
|
1466
|
-
l.dict = C(u[m], i.from);
|
|
1467
|
-
break;
|
|
1468
|
-
case "bits": {
|
|
1469
|
-
l.bits = {};
|
|
1470
|
-
for (const S in u[m])
|
|
1471
|
-
typeof u[m][S] == "number" && (l.bits[S] = u[m][S]);
|
|
1472
|
-
break;
|
|
1473
|
-
}
|
|
1474
|
-
case "callback": {
|
|
1475
|
-
const S = l.callback = u[m];
|
|
1476
|
-
S.toJSON ||= () => S.toString();
|
|
1477
|
-
break;
|
|
1478
|
-
}
|
|
1479
|
-
case "constructor": {
|
|
1480
|
-
const S = l.constructor = u[m];
|
|
1481
|
-
typeof S == "function" && (S.toJSON ||= () => S.name);
|
|
1482
|
-
break;
|
|
1483
|
-
}
|
|
1484
|
-
default:
|
|
1485
|
-
l[p] = u[m];
|
|
1486
|
-
}
|
|
1487
|
-
}), o === "object" || o === "dict" ? l.meta.default = {} : o === "array" || o === "tuple" ? l.meta.default = [] : o === "bitset" && (l.meta.default = 0), l;
|
|
1488
|
-
}
|
|
1489
|
-
});
|
|
1490
|
-
}
|
|
1491
|
-
v(_, "defineMethod"), _("is", ["constructor"], ({ constructor: o }) => typeof o == "function" ? o.name : o), _("any", [], () => "any"), _("never", [], () => "never"), _("const", ["value"], ({ value: o }) => typeof o == "string" ? JSON.stringify(o) : o), _("string", [], () => "string"), _("number", [], () => "number"), _("boolean", [], () => "boolean"), _("bitset", ["bits"], () => "bitset"), _("function", [], () => "function"), _("array", ["inner"], ({ inner: o }) => `${o.toString(!0)}[]`), _("dict", ["inner", "sKey"], ({ inner: o, sKey: s }) => `{ [key: ${s.toString()}]: ${o.toString()} }`), _("tuple", ["list"], ({ list: o }) => `[${o.map((s) => s.toString()).join(", ")}]`), _("object", ["dict"], ({ dict: o }) => Object.keys(o).length === 0 ? "{}" : `{ ${Object.entries(o).map(([s, f]) => `${s}${f.meta.required ? "" : "?"}: ${f.toString()}`).join(", ")} }`), _("union", ["list"], ({ list: o }, s) => {
|
|
1492
|
-
const f = o.map(({ toString: u }) => u()).join(" | ");
|
|
1493
|
-
return s ? `(${f})` : f;
|
|
1494
|
-
}), _("intersect", ["list"], ({ list: o }) => `${o.map((s) => s.toString(!0)).join(" & ")}`), _("transform", ["inner", "callback", "preserve"], ({ inner: o }, s) => o.toString(s)), t.exports = i;
|
|
1495
|
-
}
|
|
1496
|
-
});
|
|
1497
|
-
const et = Ze(), ge = (e) => typeof e == "function";
|
|
1498
|
-
async function tt(e) {
|
|
1499
|
-
return ge(e) ? await e() : e;
|
|
1500
|
-
}
|
|
1501
|
-
function rt(e) {
|
|
1502
|
-
return ge(e) ? e() : e;
|
|
1503
|
-
}
|
|
1504
|
-
var Te = /* @__PURE__ */ ((e) => (e.ANALYTICS_API_BASE = "https://analytics.ipe.wiki/api/v6", e.ANALYTICS_DASH_URL = "https://analytics.ipe.wiki", e.GITHUB_URL = "https://github.com/inpageedit/inpageedit-next", e.GITHUB_OWNER = "inpageedit", e.GITHUB_REPO = "inpageedit-next", e.HOME_URL = "https://www.ipe.wiki/", e.UPDATE_LOGS_URL = "https://www.ipe.wiki/changelogs/", e.PLUGIN_REGISTRY_URL = "https://registry.ipe.wiki/registry.v1.json", e.I18N_INDEX_URL = "https://registry.ipe.wiki/i18n/index.json", e.QQ_GROUP_ID = "1026023666", e))(Te || {});
|
|
1505
|
-
function we(e) {
|
|
1506
|
-
return e.charAt(0).toLowerCase() + e.slice(1);
|
|
1507
|
-
}
|
|
1508
|
-
function nt(e) {
|
|
1509
|
-
return we(e).replace(/_/g, "-").replace(/.[A-Z]+/g, (t) => t[0] + "-" + t.slice(1).toLowerCase());
|
|
1510
|
-
}
|
|
1511
|
-
function it(e) {
|
|
1512
|
-
return we(e).replace(/-/g, "_").replace(/.[A-Z]+/g, (t) => t[0] + "_" + t.slice(1).toLowerCase());
|
|
1513
|
-
}
|
|
1514
|
-
function st(e) {
|
|
1515
|
-
return function(t) {
|
|
1516
|
-
return t.PreferencesSchema = e, t;
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
export {
|
|
1520
|
-
T as C,
|
|
1521
|
-
Te as E,
|
|
1522
|
-
He as F,
|
|
1523
|
-
K as I,
|
|
1524
|
-
ce as M,
|
|
1525
|
-
st as R,
|
|
1526
|
-
et as S,
|
|
1527
|
-
de as a,
|
|
1528
|
-
Ve as b,
|
|
1529
|
-
Xe as c,
|
|
1530
|
-
ke as d,
|
|
1531
|
-
Je as e,
|
|
1532
|
-
it as f,
|
|
1533
|
-
rt as g,
|
|
1534
|
-
tt as h,
|
|
1535
|
-
P as i,
|
|
1536
|
-
nt as p,
|
|
1537
|
-
h as s
|
|
1538
|
-
};
|
|
1539
|
-
//# sourceMappingURL=Preferences-BF2fcXrn.js.map
|