@popcorn245/cornfield-components 0.48.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/_corn-default-tokens-BpIL6q5N.js +4110 -0
- package/dist/chunks/corn-map-CMNEW1lH.js +2703 -0
- package/dist/chunks/rolldown-runtime-CGnMp29N.js +10 -0
- package/dist/chunks/runtime-DFu6W5g-.js +2186 -0
- package/dist/chunks/scope-CmIkJ1qf.js +847 -0
- package/dist/corn-map.js +1 -1
- package/dist/corn-scope.js +83 -0
- package/dist/index.js +4 -3
- package/dist/manifest.json +42 -17
- package/dist/tokens.css +4 -2
- package/dist/types/components.d.ts +78 -0
- package/dist/types/corn-scope.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/version.json +1 -1
- package/package.json +5 -1
- package/dist/chunks/corn-map-D6uJOnYp.js +0 -6391
- package/dist/chunks/runtime-D89gVy_w.js +0 -2192
|
@@ -0,0 +1,847 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-CGnMp29N.js";
|
|
2
|
+
import { at as t, dt as n, ft as r, i, mt as a, n as o, ot as s, pt as c, r as l, rt as u, s as d, st as f, u as p, w as m } from "./_corn-default-tokens-BpIL6q5N.js";
|
|
3
|
+
// ../explorer/engine/layers.js
|
|
4
|
+
var h = (e) => e.match && e.match.type ? [].concat(e.match.type) : [], g = {
|
|
5
|
+
flow: "#fb923c",
|
|
6
|
+
runs: "#5eead4"
|
|
7
|
+
}, _ = (e) => {
|
|
8
|
+
let t = h(e)[0];
|
|
9
|
+
return t && f[t] ? f[t].color : g[e.key];
|
|
10
|
+
}, v = /* @__PURE__ */ new Set([
|
|
11
|
+
"stack",
|
|
12
|
+
"machine",
|
|
13
|
+
"container",
|
|
14
|
+
"device",
|
|
15
|
+
"house",
|
|
16
|
+
"persona"
|
|
17
|
+
]), y = t.map((e) => ({
|
|
18
|
+
...e,
|
|
19
|
+
color: _(e)
|
|
20
|
+
})), b = "cornfield:layers", x = /^[a-z][a-z0-9-]{0,40}$/, S = (e) => e.slot("layers", () => ({
|
|
21
|
+
changes: {},
|
|
22
|
+
storeKey: b
|
|
23
|
+
}));
|
|
24
|
+
function ee(e, t) {
|
|
25
|
+
S(e).storeKey = t;
|
|
26
|
+
}
|
|
27
|
+
var C = "\\d{1,3}(?:\\.\\d+)?%?";
|
|
28
|
+
RegExp(`^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\\(\\s*${C}(?:\\s*,\\s*|\\s+)${C}(?:\\s*,\\s*|\\s+)${C}(?:\\s*[,/]\\s*(?:\\d*\\.)?\\d+%?)?\\s*\\))$`, "i");
|
|
29
|
+
function w(e) {
|
|
30
|
+
let t = S(e).storeKey;
|
|
31
|
+
if (!t) return {};
|
|
32
|
+
try {
|
|
33
|
+
let n = JSON.parse(e.store.get(t) || "{}");
|
|
34
|
+
return !n || typeof n != "object" || Array.isArray(n) ? {} : Object.fromEntries(Object.entries(n).filter(([e, t]) => x.test(e) && typeof t == "boolean"));
|
|
35
|
+
} catch {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function te(e, t) {
|
|
40
|
+
let { state: n } = e, r = s(t);
|
|
41
|
+
n.projectLayers = r.add, n.layerOrder = r.order;
|
|
42
|
+
let i = {};
|
|
43
|
+
for (let e of y) i[e.key] = !v.has(e.key);
|
|
44
|
+
for (let e of r.add) i[e.key] = !0;
|
|
45
|
+
for (let e of r.off) i[e] = !1;
|
|
46
|
+
n.layerDefaults = i;
|
|
47
|
+
let a = S(e);
|
|
48
|
+
a.changes = w(e);
|
|
49
|
+
for (let [e, t] of Object.entries(i)) n.activeLayers[e] = t;
|
|
50
|
+
for (let [e, t] of Object.entries(a.changes)) n.activeLayers[e] = t;
|
|
51
|
+
T(e);
|
|
52
|
+
}
|
|
53
|
+
function ne(e) {
|
|
54
|
+
let { state: t } = e, n = /* @__PURE__ */ new Set(), r = [];
|
|
55
|
+
t.nodes.forEach((e) => {
|
|
56
|
+
if (typeof e.kind != "string" || !e.kind) return;
|
|
57
|
+
let t = `${e.type}\u0000${e.kind}`;
|
|
58
|
+
n.has(t) || (n.add(t), r.push([e.type, e.kind]));
|
|
59
|
+
}), m(e).setSubjects({
|
|
60
|
+
kinds: r,
|
|
61
|
+
layers: t.projectLayers.map((e) => e.key)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function re(e) {
|
|
65
|
+
let t = e.slot("layers-draw", () => ({ drawing: !1 }));
|
|
66
|
+
t.drawing = !0;
|
|
67
|
+
try {
|
|
68
|
+
ne(e);
|
|
69
|
+
} finally {
|
|
70
|
+
t.drawing = !1;
|
|
71
|
+
}
|
|
72
|
+
e.emit("layers:redraw");
|
|
73
|
+
}
|
|
74
|
+
function T(e) {
|
|
75
|
+
e.touchScene(), e.emit("layers"), re(e), e.map && (e.map.render(), e.map.ensureFlowLoop());
|
|
76
|
+
}
|
|
77
|
+
// ../explorer/engine/connection.js
|
|
78
|
+
function E(e, t, n) {
|
|
79
|
+
return e.base && ie(e, t) ? {
|
|
80
|
+
credentials: "include",
|
|
81
|
+
...n
|
|
82
|
+
} : n;
|
|
83
|
+
}
|
|
84
|
+
function ie(e, t) {
|
|
85
|
+
if (!e.base) return !1;
|
|
86
|
+
try {
|
|
87
|
+
return new URL(e.url(String(t)), e.base).origin === new URL(e.base).origin;
|
|
88
|
+
} catch {
|
|
89
|
+
return !1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// ../explorer/engine/source.js
|
|
93
|
+
var D = "/cornfield/config.json", O = "/topology.json", ae = "/cornfield/theme.css", oe = "/auth/start";
|
|
94
|
+
Object.freeze([
|
|
95
|
+
"loading",
|
|
96
|
+
"ready",
|
|
97
|
+
"sign-in",
|
|
98
|
+
"not-allowed",
|
|
99
|
+
"offline",
|
|
100
|
+
"server",
|
|
101
|
+
"address",
|
|
102
|
+
"version"
|
|
103
|
+
]);
|
|
104
|
+
var se = /[\u0000- \u007f\\]/;
|
|
105
|
+
function ce(e) {
|
|
106
|
+
if (typeof e != "string" || !e.trim()) return {
|
|
107
|
+
ok: !1,
|
|
108
|
+
problem: "is empty"
|
|
109
|
+
};
|
|
110
|
+
let t = e.trim();
|
|
111
|
+
if (se.test(t)) return {
|
|
112
|
+
ok: !1,
|
|
113
|
+
problem: "has a space, a control character or a backslash"
|
|
114
|
+
};
|
|
115
|
+
let n;
|
|
116
|
+
try {
|
|
117
|
+
n = new URL(t);
|
|
118
|
+
} catch {
|
|
119
|
+
return {
|
|
120
|
+
ok: !1,
|
|
121
|
+
problem: "is not an address (an http or https address, as the server is opened in a browser)"
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return n.protocol !== "https:" && n.protocol !== "http:" ? {
|
|
125
|
+
ok: !1,
|
|
126
|
+
problem: "is not http or https"
|
|
127
|
+
} : /^https?:\/\/[^/?#]/i.test(t) ? n.username || n.password ? {
|
|
128
|
+
ok: !1,
|
|
129
|
+
problem: "has a user name or password"
|
|
130
|
+
} : t.includes("?") || t.includes("#") ? {
|
|
131
|
+
ok: !1,
|
|
132
|
+
problem: "has a query or a fragment"
|
|
133
|
+
} : {
|
|
134
|
+
ok: !0,
|
|
135
|
+
base: n.origin + n.pathname.replace(/\/+$/, ""),
|
|
136
|
+
origin: n.origin
|
|
137
|
+
} : {
|
|
138
|
+
ok: !1,
|
|
139
|
+
problem: "has no host"
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
var k = (e) => {
|
|
143
|
+
let t = /^\s*v?(\d{1,9})\.(\d{1,9})\.(\d{1,9})(?:[-+][0-9A-Za-z.-]{1,64})?\s*$/.exec(String(e ?? ""));
|
|
144
|
+
return t ? [
|
|
145
|
+
Number(t[1]),
|
|
146
|
+
Number(t[2]),
|
|
147
|
+
Number(t[3])
|
|
148
|
+
] : null;
|
|
149
|
+
};
|
|
150
|
+
function le(e, t) {
|
|
151
|
+
let n = k(e), r = k(t);
|
|
152
|
+
return !n || !r ? "unknown" : n[0] === r[0] ? n[1] === r[1] ? n[2] === r[2] ? "same" : "patch" : "minor" : "major";
|
|
153
|
+
}
|
|
154
|
+
function ue(e, t) {
|
|
155
|
+
let n = "";
|
|
156
|
+
if (typeof t == "string" && /^https?:\/\//i.test(t)) try {
|
|
157
|
+
let e = new URL(t);
|
|
158
|
+
e.username = "", e.password = "", n = `?returnTo=${encodeURIComponent(e.href)}`;
|
|
159
|
+
} catch {
|
|
160
|
+
n = "";
|
|
161
|
+
}
|
|
162
|
+
return `${e}${oe}${n}`;
|
|
163
|
+
}
|
|
164
|
+
var A = class extends Error {
|
|
165
|
+
constructor(e, t, { status: n = 0, cause: r } = {}) {
|
|
166
|
+
super(t), this.name = "SourceError", this.kind = e, this.status = n, r !== void 0 && (this.cause = r);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
function j(e, t, n, r) {
|
|
170
|
+
let i = { ...E(e, t, n) };
|
|
171
|
+
return r && (i.signal = r), Object.keys(i).length ? i : void 0;
|
|
172
|
+
}
|
|
173
|
+
async function M(e, t, n, r, i = t) {
|
|
174
|
+
let a;
|
|
175
|
+
try {
|
|
176
|
+
let i = j(e, t, n, r);
|
|
177
|
+
a = i ? await e.fetch(t, i) : await e.fetch(t);
|
|
178
|
+
} catch (e) {
|
|
179
|
+
throw new A("network", e && e.message ? e.message : String(e), { cause: e });
|
|
180
|
+
}
|
|
181
|
+
if (a.status === 401 || a.status === 403) throw new A("auth", `GET ${i} answered ${a.status} ${a.statusText}`.trim(), { status: a.status });
|
|
182
|
+
if (!a.ok) throw new A("server", `GET ${i} answered ${a.status} ${a.statusText}`.trim(), { status: a.status });
|
|
183
|
+
return a;
|
|
184
|
+
}
|
|
185
|
+
async function N(e, { signal: t } = {}) {
|
|
186
|
+
let n = await M(e, D, { cache: "no-store" }, t), r;
|
|
187
|
+
try {
|
|
188
|
+
r = await n.json();
|
|
189
|
+
} catch (e) {
|
|
190
|
+
throw new A("server", `${D} is not JSON`, {
|
|
191
|
+
status: n.status,
|
|
192
|
+
cause: e
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (!r || typeof r != "object" || Array.isArray(r)) throw new A("server", `${D} is not a config`, { status: n.status });
|
|
196
|
+
return r;
|
|
197
|
+
}
|
|
198
|
+
async function P(e, t = O, { signal: n } = {}) {
|
|
199
|
+
let r = await M(e, t + (t.includes("?") ? "&v=" : "?v=") + Date.now(), void 0, n, t), i;
|
|
200
|
+
try {
|
|
201
|
+
i = await r.json();
|
|
202
|
+
} catch (e) {
|
|
203
|
+
throw new A("server", `${t} is not JSON`, {
|
|
204
|
+
status: r.status,
|
|
205
|
+
cause: e
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (!i || !Array.isArray(i.nodes) || i.nodes.length === 0) throw new A("server", `${t} has no nodes`, { status: r.status });
|
|
209
|
+
return i;
|
|
210
|
+
}
|
|
211
|
+
function F(e, t) {
|
|
212
|
+
t && typeof t == "object" && (n(e, t.strings), m(e).applyTheme(t.theme), te(e, t.layers));
|
|
213
|
+
}
|
|
214
|
+
function I(e, { version: t = "", pageUrl: r = () => "", onConfig: i = () => {} } = {}) {
|
|
215
|
+
let a = !1, o = null, s = null, c = 0, l = {
|
|
216
|
+
topology: null,
|
|
217
|
+
config: null,
|
|
218
|
+
strings: null
|
|
219
|
+
}, u = {
|
|
220
|
+
topology: null,
|
|
221
|
+
config: null,
|
|
222
|
+
state: () => o,
|
|
223
|
+
notice: null,
|
|
224
|
+
say(t) {
|
|
225
|
+
a || (t.state === "version" ? u.notice = t : o = t, e.emit("source", t));
|
|
226
|
+
},
|
|
227
|
+
provide({ topology: e, config: t, strings: n } = {}) {
|
|
228
|
+
a || (n !== void 0 && (l.strings = n, d(u.config)), t !== void 0 && (l.config = t, t ? f(t) : u.fetchedConfig && f(u.fetchedConfig)), e !== void 0 && (l.topology = e, u.topology = e || u.fetchedTopology || null, u.topology && u.say({ state: "ready" })));
|
|
229
|
+
},
|
|
230
|
+
fetchedConfig: null,
|
|
231
|
+
fetchedTopology: null,
|
|
232
|
+
async load() {
|
|
233
|
+
if (a || !e.base) return;
|
|
234
|
+
if (l.config && l.topology) {
|
|
235
|
+
u.topology = l.topology, u.say({ state: "ready" });
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
s && s.abort(), s = new AbortController();
|
|
239
|
+
let { signal: t } = s, n = ++c, r = () => !a && n === c && !t.aborted;
|
|
240
|
+
u.say({ state: "loading" });
|
|
241
|
+
try {
|
|
242
|
+
if (!l.config) {
|
|
243
|
+
let n = await N(e, { signal: t });
|
|
244
|
+
if (!r()) return;
|
|
245
|
+
u.fetchedConfig = n, f(n);
|
|
246
|
+
}
|
|
247
|
+
if (l.topology) u.topology = l.topology;
|
|
248
|
+
else {
|
|
249
|
+
let n = await P(e, O, { signal: t });
|
|
250
|
+
if (!r()) return;
|
|
251
|
+
u.fetchedTopology = n, u.topology = n;
|
|
252
|
+
}
|
|
253
|
+
u.say({ state: "ready" });
|
|
254
|
+
} catch (e) {
|
|
255
|
+
if (!r()) return;
|
|
256
|
+
let n = await p(e, t);
|
|
257
|
+
r() && u.say(n);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
function d(t) {
|
|
262
|
+
n(e, l.strings || t && t.strings);
|
|
263
|
+
}
|
|
264
|
+
function f(n) {
|
|
265
|
+
u.config = n, F(e, n), l.strings && d(n);
|
|
266
|
+
let r = le(t, n.version);
|
|
267
|
+
t && (r === "minor" || r === "major") && u.say({
|
|
268
|
+
state: "version",
|
|
269
|
+
server: String(n.version).trim(),
|
|
270
|
+
package: t,
|
|
271
|
+
drift: r
|
|
272
|
+
}), i(n);
|
|
273
|
+
}
|
|
274
|
+
async function p(t, n) {
|
|
275
|
+
if (!(t instanceof A)) return {
|
|
276
|
+
state: "server",
|
|
277
|
+
status: 0,
|
|
278
|
+
message: t && t.message ? t.message : String(t)
|
|
279
|
+
};
|
|
280
|
+
if (t.kind === "auth") return {
|
|
281
|
+
state: "sign-in",
|
|
282
|
+
status: t.status,
|
|
283
|
+
signIn: ue(e.base, r())
|
|
284
|
+
};
|
|
285
|
+
if (t.kind === "server") return {
|
|
286
|
+
state: "server",
|
|
287
|
+
status: t.status,
|
|
288
|
+
message: t.message
|
|
289
|
+
};
|
|
290
|
+
if (e.win && e.win.navigator && e.win.navigator.onLine === !1) return { state: "offline" };
|
|
291
|
+
try {
|
|
292
|
+
await e.fetch(ae, {
|
|
293
|
+
method: "HEAD",
|
|
294
|
+
mode: "no-cors",
|
|
295
|
+
credentials: "omit",
|
|
296
|
+
signal: n
|
|
297
|
+
});
|
|
298
|
+
} catch {
|
|
299
|
+
return { state: "offline" };
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
state: "not-allowed",
|
|
303
|
+
origin: L(r())
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
return R(e).source = u, e.own(() => {
|
|
307
|
+
a = !0, s && s.abort(), R(e).source = null;
|
|
308
|
+
}), u;
|
|
309
|
+
}
|
|
310
|
+
function L(e) {
|
|
311
|
+
try {
|
|
312
|
+
return /^https?:/i.test(e) ? new URL(e).origin : "";
|
|
313
|
+
} catch {
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
var R = (e) => e.slot("source", () => ({ source: null })), z = (e) => R(e).source, B = 524288, V = 4096, H = /^--corn-[a-z0-9]+(?:-[a-z0-9]+)*$/, U = /^[a-z0-9][a-z0-9-]{0,31}$/, de = "/cornfield/theme.css", fe = (e) => `/cornfield/theme/${e}.css`, pe = (e) => String(e).replace(/\s+/g, ""), me = (e) => {
|
|
318
|
+
let t = /^:where\((.*)\)$/.exec(e);
|
|
319
|
+
return t ? t[1] : e;
|
|
320
|
+
};
|
|
321
|
+
function he(e) {
|
|
322
|
+
let t = [], n = 0, r = 0, i = String(e);
|
|
323
|
+
for (let e = 0; e <= i.length; e++) {
|
|
324
|
+
let a = i[e];
|
|
325
|
+
a === "(" || a === "[" ? n++ : a === ")" || a === "]" ? n-- : (a === "," && !n || e === i.length) && (t.push(me(pe(i.slice(r, e)))), r = e + 1);
|
|
326
|
+
}
|
|
327
|
+
return t.filter(Boolean);
|
|
328
|
+
}
|
|
329
|
+
function ge(e, t, n = null) {
|
|
330
|
+
let r = e.startsWith(":root") ? ":root" : e.startsWith("html") ? "html" : null;
|
|
331
|
+
if (!r) return null;
|
|
332
|
+
let i = e.slice(r.length), a = n ? `[data-theme-name="${n}"]` : null;
|
|
333
|
+
if (a) {
|
|
334
|
+
if (i.includes(a)) i = i.replace(a, "");
|
|
335
|
+
else return null;
|
|
336
|
+
} else if (/\[data-theme-name=/.test(i)) return null;
|
|
337
|
+
return i === "" ? t || "base" : i === "[data-theme=\"light\"]" ? "light" : i === "[data-theme=\"dark\"]" ? "dark" : i === ":not([data-theme=\"dark\"])" && t === "light" ? "light" : i === ":not([data-theme=\"light\"])" && t === "dark" ? "dark" : null;
|
|
338
|
+
}
|
|
339
|
+
var _e = /^data:image\/(?:png|gif|webp|avif|svg\+xml)[;,]/i, W = /(?<![\w-])(?:url|src|image|(?:-webkit-)?image-set)\(/i, ve = /(?<![\w-])(url|src)\(\s*(?:"([^"]*)"|'([^']*)'|([^)\s"']*))\s*\)/gi, G = /"([^"]*)"|'([^']*)'/g;
|
|
340
|
+
function K(e) {
|
|
341
|
+
return String(e).replace(/\\([0-9a-f]{1,6})\s?|\\([^\n])/gi, (e, t, n) => {
|
|
342
|
+
if (t) {
|
|
343
|
+
let e = parseInt(t, 16);
|
|
344
|
+
return e > 0 && e <= 1114111 ? String.fromCodePoint(e) : "�";
|
|
345
|
+
}
|
|
346
|
+
return n;
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function q(e, t) {
|
|
350
|
+
if (_e.test(e)) return e;
|
|
351
|
+
try {
|
|
352
|
+
let n = new URL(t), r = e.startsWith("/") && !e.startsWith("//") ? new URL(n.pathname.replace(/\/+$/, "") + e, n) : new URL(e, `${t}/`);
|
|
353
|
+
return r.protocol !== "https:" && r.protocol !== "http:" || r.origin !== n.origin ? null : r.href;
|
|
354
|
+
} catch {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
function J(e, t) {
|
|
359
|
+
let n = String(e), r = K(n);
|
|
360
|
+
if (!W.test(r)) return n;
|
|
361
|
+
if (r !== n && W.test(r.replace(G, "\"\"")) || !t) return null;
|
|
362
|
+
let i = !0, a = n.replace(ve, (e, n, r, a, o) => {
|
|
363
|
+
let s = q(r ?? a ?? o ?? "", t);
|
|
364
|
+
return s === null ? (i = !1, "") : `${n.toLowerCase()}("${s.replace(/["\\\n]/g, (e) => encodeURIComponent(e))}")`;
|
|
365
|
+
}), o = (a.replace(/(?<![\w-])(?:url|src)\("[^"]*"\)/gi, "").match(new RegExp(W.source, "gi")) || []).filter((e) => !/image-set\($/i.test(e));
|
|
366
|
+
return !i || o.length || /(?:-webkit-)?image-set\(/i.test(a) && (a = a.replace(/((?:-webkit-)?image-set\()([^]*)$/i, (e, n, r) => n + r.replace(G, (e, n, r) => {
|
|
367
|
+
let a = q(n ?? r ?? "", t);
|
|
368
|
+
return a === null ? (i = !1, "\"\"") : `"${a.replace(/["\\\n]/g, (e) => encodeURIComponent(e))}"`;
|
|
369
|
+
})), !i) ? null : a;
|
|
370
|
+
}
|
|
371
|
+
function ye(e, t) {
|
|
372
|
+
let n = J(e, t);
|
|
373
|
+
return n !== null && n === e;
|
|
374
|
+
}
|
|
375
|
+
function Y(e, { name: t = null, base: n = "" } = {}) {
|
|
376
|
+
let r = {
|
|
377
|
+
base: /* @__PURE__ */ new Map(),
|
|
378
|
+
light: /* @__PURE__ */ new Map(),
|
|
379
|
+
dark: /* @__PURE__ */ new Map()
|
|
380
|
+
}, i = (e, i) => {
|
|
381
|
+
let a = he(e.selectorText).map((e) => ge(e, i, t)).find(Boolean);
|
|
382
|
+
if (!a) return;
|
|
383
|
+
let o = e.style;
|
|
384
|
+
for (let e = 0; e < o.length; e++) {
|
|
385
|
+
let t = o[e];
|
|
386
|
+
if (!H.test(t)) continue;
|
|
387
|
+
let i = o.getPropertyValue(t).trim();
|
|
388
|
+
!i || i.length > V || (n || W.test(K(i))) && (i = n ? J(i, n) : null, i === null) || r[a].set(t, i);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
for (let t of Array.from(e.cssRules || [])) if (t.selectorText !== void 0) i(t, null);
|
|
392
|
+
else if (t.media && t.cssRules) {
|
|
393
|
+
let e = /^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(t.media.mediaText.trim());
|
|
394
|
+
if (e) for (let n of Array.from(t.cssRules)) n.selectorText !== void 0 && i(n, e[1]);
|
|
395
|
+
}
|
|
396
|
+
return r;
|
|
397
|
+
}
|
|
398
|
+
function be(e, t) {
|
|
399
|
+
let n = /* @__PURE__ */ new Map();
|
|
400
|
+
for (let r of e) {
|
|
401
|
+
for (let [e, t] of r.base) n.set(e, t);
|
|
402
|
+
for (let [e, i] of r[t]) n.set(e, i);
|
|
403
|
+
}
|
|
404
|
+
return n;
|
|
405
|
+
}
|
|
406
|
+
function xe(e) {
|
|
407
|
+
let t = {
|
|
408
|
+
base: /* @__PURE__ */ new Map(),
|
|
409
|
+
light: /* @__PURE__ */ new Map(),
|
|
410
|
+
dark: /* @__PURE__ */ new Map()
|
|
411
|
+
};
|
|
412
|
+
for (let n of Object.keys(t)) for (let [r, i] of e[n]) /var\(/.test(i) && t[n].set(r, i);
|
|
413
|
+
return t;
|
|
414
|
+
}
|
|
415
|
+
async function Se(e, t, n = "the answer") {
|
|
416
|
+
let r = () => /* @__PURE__ */ Error(`${n} is larger than ${t} characters`), i = Number(e.headers && e.headers.get ? e.headers.get("content-length") : NaN);
|
|
417
|
+
if (Number.isFinite(i) && i > t * 4) throw r();
|
|
418
|
+
if (!e.body || typeof e.body.getReader != "function") {
|
|
419
|
+
let n = await e.text();
|
|
420
|
+
if (n.length > t) throw r();
|
|
421
|
+
return n;
|
|
422
|
+
}
|
|
423
|
+
let a = e.body.getReader(), o = new TextDecoder(), s = "";
|
|
424
|
+
for (;;) {
|
|
425
|
+
let { done: e, value: n } = await a.read();
|
|
426
|
+
if (e) break;
|
|
427
|
+
if (s += o.decode(n, { stream: !0 }), s.length > t) throw a.cancel().catch(() => {}), r();
|
|
428
|
+
}
|
|
429
|
+
if (s += o.decode(), s.length > t) throw r();
|
|
430
|
+
return s;
|
|
431
|
+
}
|
|
432
|
+
function Ce(e, { defaults: t = "" } = {}) {
|
|
433
|
+
let n = e.win, r = !1, i = null, a = null, o = /* @__PURE__ */ new Set(), s = null, c = [], l = [], u = null, d = "dark", f = "none", p = () => {
|
|
434
|
+
!a && n && typeof n.CSSStyleSheet == "function" && "replaceSync" in n.CSSStyleSheet.prototype && (a = new n.CSSStyleSheet());
|
|
435
|
+
}, m = () => {
|
|
436
|
+
if (u || !t) return u;
|
|
437
|
+
try {
|
|
438
|
+
let e = new n.CSSStyleSheet();
|
|
439
|
+
e.replaceSync(t), u = xe(Y(e));
|
|
440
|
+
} catch {
|
|
441
|
+
u = null;
|
|
442
|
+
}
|
|
443
|
+
return u;
|
|
444
|
+
}, h = () => {
|
|
445
|
+
if (!s) return;
|
|
446
|
+
for (let e of c) s.style.removeProperty(e);
|
|
447
|
+
if (c = [], !l.length) return;
|
|
448
|
+
let e = [], t = m();
|
|
449
|
+
t && e.push(t), e.push(...l);
|
|
450
|
+
let n = be(e, d);
|
|
451
|
+
for (let [e, t] of n) s.style.setProperty(e, t), c.push(e);
|
|
452
|
+
}, g = (t, n = {}) => {
|
|
453
|
+
f = t, e.emit("theme", {
|
|
454
|
+
state: t,
|
|
455
|
+
...n
|
|
456
|
+
});
|
|
457
|
+
}, _ = async (t, n) => {
|
|
458
|
+
let r = await e.fetch(t, {
|
|
459
|
+
credentials: "omit",
|
|
460
|
+
signal: n
|
|
461
|
+
});
|
|
462
|
+
if (!r.ok) throw Error(`GET ${t} answered ${r.status}`);
|
|
463
|
+
return Se(r, B, t);
|
|
464
|
+
}, v = {
|
|
465
|
+
state: () => f,
|
|
466
|
+
sheet: () => a,
|
|
467
|
+
async load(t) {
|
|
468
|
+
if (r || !e.base) return;
|
|
469
|
+
i && i.abort(), i = new AbortController();
|
|
470
|
+
let { signal: o } = i;
|
|
471
|
+
g("loading");
|
|
472
|
+
try {
|
|
473
|
+
let i = t && t.theme && typeof t.theme.default == "string" && U.test(t.theme.default) ? t.theme.default : null, [s, c] = await Promise.all([_(de, o).catch((e) => {
|
|
474
|
+
if (o.aborted) throw e;
|
|
475
|
+
return null;
|
|
476
|
+
}), i ? _(fe(i), o).catch((e) => {
|
|
477
|
+
if (o.aborted) throw e;
|
|
478
|
+
return null;
|
|
479
|
+
}) : Promise.resolve(null)]);
|
|
480
|
+
if (r || o.aborted) return;
|
|
481
|
+
if (s === null && c === null) {
|
|
482
|
+
g("failed");
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
if (p(), !a) {
|
|
486
|
+
g("failed", { reason: "constructable stylesheets are not available" });
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
a.replaceSync([s, c].filter((e) => e !== null).join("\n")), X(a, e.base), l = [];
|
|
490
|
+
let u = (t, r) => {
|
|
491
|
+
let i = new n.CSSStyleSheet();
|
|
492
|
+
return i.replaceSync(t), Y(i, {
|
|
493
|
+
name: r,
|
|
494
|
+
base: e.base
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
s !== null && l.push(u(s, null)), c !== null && l.push(u(c, i)), h(), g("ready");
|
|
498
|
+
} catch (e) {
|
|
499
|
+
if (r || o.aborted) return;
|
|
500
|
+
g("failed", { reason: e && e.message ? e.message : String(e) });
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
adopt(t) {
|
|
504
|
+
if (!t || !("adoptedStyleSheets" in t)) return () => {};
|
|
505
|
+
o.add(t);
|
|
506
|
+
let n = () => {
|
|
507
|
+
a && !t.adoptedStyleSheets.includes(a) && (t.adoptedStyleSheets = [...t.adoptedStyleSheets, a]);
|
|
508
|
+
};
|
|
509
|
+
n();
|
|
510
|
+
let r = e.on("theme", n);
|
|
511
|
+
return () => {
|
|
512
|
+
r(), o.delete(t), a && t.adoptedStyleSheets.includes(a) && (t.adoptedStyleSheets = t.adoptedStyleSheets.filter((e) => e !== a));
|
|
513
|
+
};
|
|
514
|
+
},
|
|
515
|
+
tokensOn(e) {
|
|
516
|
+
v.release(), s = e, h();
|
|
517
|
+
},
|
|
518
|
+
setMode(e) {
|
|
519
|
+
let t = e === "light" ? "light" : "dark";
|
|
520
|
+
t !== d && (d = t, h());
|
|
521
|
+
},
|
|
522
|
+
release() {
|
|
523
|
+
if (s) for (let e of c) s.style.removeProperty(e);
|
|
524
|
+
c = [], s = null;
|
|
525
|
+
},
|
|
526
|
+
unload() {
|
|
527
|
+
i && i.abort();
|
|
528
|
+
for (let e of o) a && e.adoptedStyleSheets.includes(a) && (e.adoptedStyleSheets = e.adoptedStyleSheets.filter((e) => e !== a));
|
|
529
|
+
a && a.replaceSync(""), a = null, l = [], h(), g("none");
|
|
530
|
+
},
|
|
531
|
+
destroy() {
|
|
532
|
+
r = !0, i && i.abort(), v.release();
|
|
533
|
+
for (let e of [...o]) a && e.adoptedStyleSheets.includes(a) && (e.adoptedStyleSheets = e.adoptedStyleSheets.filter((e) => e !== a));
|
|
534
|
+
o.clear(), a = null, l = [];
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
return v;
|
|
538
|
+
}
|
|
539
|
+
function X(e, t) {
|
|
540
|
+
let n = (e) => {
|
|
541
|
+
let r = e.cssRules;
|
|
542
|
+
for (let i = r.length - 1; i >= 0; i--) {
|
|
543
|
+
let a = r[i];
|
|
544
|
+
if (a.cssRules && n(a), a.style) {
|
|
545
|
+
let e = a.style;
|
|
546
|
+
for (let n of Array.from({ length: e.length }, (t, n) => e[n])) {
|
|
547
|
+
let r = e.getPropertyValue(n);
|
|
548
|
+
if (!W.test(K(r))) continue;
|
|
549
|
+
let i = J(r, t);
|
|
550
|
+
i === null ? e.removeProperty(n) : i !== r && e.setProperty(n, i, e.getPropertyPriority(n));
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
let o = a.cssText;
|
|
554
|
+
o && W.test(K(o)) && !ye(o, t) && (typeof a.keyText == "string" && typeof e.deleteRule == "function" && e.findRule ? e.deleteRule(a.keyText) : e.deleteRule(i));
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
n(e);
|
|
558
|
+
}
|
|
559
|
+
// ../explorer/pieces/status.js
|
|
560
|
+
var we = Object.freeze({
|
|
561
|
+
loading: "running",
|
|
562
|
+
"sign-in": "waiting",
|
|
563
|
+
"not-allowed": "failure",
|
|
564
|
+
offline: "stopped",
|
|
565
|
+
server: "failure",
|
|
566
|
+
address: "failure",
|
|
567
|
+
"second-map": "failure"
|
|
568
|
+
});
|
|
569
|
+
function Z(e, t) {
|
|
570
|
+
switch (t.state) {
|
|
571
|
+
case "loading": return {
|
|
572
|
+
title: r(e, "sourceLoading"),
|
|
573
|
+
text: ""
|
|
574
|
+
};
|
|
575
|
+
case "sign-in": return t.status === 403 ? {
|
|
576
|
+
title: r(e, "sourceNotMaintainer"),
|
|
577
|
+
text: r(e, "sourceNotMaintainerText"),
|
|
578
|
+
link: t.signIn
|
|
579
|
+
} : {
|
|
580
|
+
title: r(e, "sourceSignedOut"),
|
|
581
|
+
text: r(e, "sourceSignInText"),
|
|
582
|
+
link: t.signIn
|
|
583
|
+
};
|
|
584
|
+
case "not-allowed": return {
|
|
585
|
+
title: r(e, "sourceNotListed"),
|
|
586
|
+
text: r(e, "sourceNotListedHint"),
|
|
587
|
+
origin: t.origin,
|
|
588
|
+
retry: !0
|
|
589
|
+
};
|
|
590
|
+
case "offline": return {
|
|
591
|
+
title: r(e, "sourceOffline"),
|
|
592
|
+
text: r(e, "sourceOfflineText"),
|
|
593
|
+
retry: !0
|
|
594
|
+
};
|
|
595
|
+
case "server": return {
|
|
596
|
+
title: r(e, "errorTitle"),
|
|
597
|
+
text: t.message || "",
|
|
598
|
+
retry: !0
|
|
599
|
+
};
|
|
600
|
+
case "address": return {
|
|
601
|
+
title: r(e, "sourceBadAddress"),
|
|
602
|
+
text: t.problem || ""
|
|
603
|
+
};
|
|
604
|
+
case "second-map": return {
|
|
605
|
+
title: r(e, "sourceSecondMap"),
|
|
606
|
+
text: ""
|
|
607
|
+
};
|
|
608
|
+
default: return null;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
var Te = (e) => typeof e == "string" && /^https?:\/\/[^\s\\]+$/i.test(e) ? e : "";
|
|
612
|
+
function Ee(e, t) {
|
|
613
|
+
let n = Z(e, t);
|
|
614
|
+
if (!n) return "";
|
|
615
|
+
let i = n.link ? Te(n.link) : "", a = [`<p data-corn="source-title">${c(n.title)}</p>`];
|
|
616
|
+
return n.text && a.push(`<p data-corn="source-text">${c(n.text)}</p>`), n.origin && a.push(`<p data-corn="source-text"><code data-corn="source-origin">${c(n.origin)}</code></p>`), i && a.push(`<a data-corn="source-sign-in" data-corn-kind="primary" href="${c(i)}" target="_top" rel="noopener">${c(r(e, "sourceSignIn"))}</a>`), n.retry && a.push(`<button type="button" data-corn="source-retry" data-corn-kind="secondary">${c(r(e, "retry"))}</button>`), a.join("");
|
|
617
|
+
}
|
|
618
|
+
function De(e, t) {
|
|
619
|
+
let n = Z(e, t);
|
|
620
|
+
return n ? [
|
|
621
|
+
n.title,
|
|
622
|
+
n.text,
|
|
623
|
+
n.origin
|
|
624
|
+
].filter(Boolean).join(". ") : "";
|
|
625
|
+
}
|
|
626
|
+
function Oe(e, t, { onRetry: n = () => {}, focusMap: i = () => {}, follow: a = !0 } = {}) {
|
|
627
|
+
let o = t.doc, s = () => {
|
|
628
|
+
let t = e.getRootNode();
|
|
629
|
+
return t && t.activeElement || null;
|
|
630
|
+
}, c = (e) => {
|
|
631
|
+
let t = o.createElement("template");
|
|
632
|
+
return t.innerHTML = p(e), t.content.firstElementChild;
|
|
633
|
+
}, l = c("<div data-corn=\"source-status\" hidden></div>"), u = c("<p data-corn=\"source-notice\" hidden></p>"), d = c("<p data-corn=\"source-announcer\" class=\"hx-sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"></p>");
|
|
634
|
+
e.append(l, u, d);
|
|
635
|
+
let f = null, m = !1, h = (e) => {
|
|
636
|
+
if (m || !e) return;
|
|
637
|
+
let n = Z(t, e), r = l.contains(s());
|
|
638
|
+
if (!n) {
|
|
639
|
+
l.hidden = !0, l.textContent = "", f = e.state, r && i();
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
l.innerHTML = p(Ee(t, e)), l.setAttribute("data-corn-state", we[e.state]), l.hidden = !1;
|
|
643
|
+
let a = f !== e.state || e.state === "server";
|
|
644
|
+
f = e.state, a && (d.textContent = De(t, e)), r && (l.setAttribute("tabindex", "-1"), l.focus());
|
|
645
|
+
}, g = (e) => {
|
|
646
|
+
m || (e ? (u.textContent = `${r(t, "sourceVersion")} (${e.package} / ${e.server})`, u.hidden = !1, d.textContent = `${d.textContent ? `${d.textContent}. ` : ""}${u.textContent}`) : (u.hidden = !0, u.textContent = ""));
|
|
647
|
+
}, _ = t.listen(l, "click", (e) => {
|
|
648
|
+
let t = e.target && e.target.closest ? e.target.closest("[data-corn=\"source-retry\"]") : null;
|
|
649
|
+
t && l.contains(t) && (e.preventDefault(), n());
|
|
650
|
+
}), v = a ? t.on("source", (e) => {
|
|
651
|
+
e.state === "version" ? g(e) : h(e);
|
|
652
|
+
}) : () => {}, y = a ? z(t) : null;
|
|
653
|
+
if (y) {
|
|
654
|
+
let e = y.state();
|
|
655
|
+
e && e.state !== "ready" && h(e), y.notice && g(y.notice);
|
|
656
|
+
}
|
|
657
|
+
return {
|
|
658
|
+
refuse(e = "second-map") {
|
|
659
|
+
h({ state: e });
|
|
660
|
+
},
|
|
661
|
+
destroy() {
|
|
662
|
+
m || (m = !0, v(), _(), l.remove(), u.remove(), d.remove());
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
// ../explorer/pieces/scope.js
|
|
667
|
+
var ke = /* @__PURE__ */ e({ mountScope: () => $ }), Q = [
|
|
668
|
+
"light",
|
|
669
|
+
"dark",
|
|
670
|
+
"auto"
|
|
671
|
+
];
|
|
672
|
+
function $(e, t = {}) {
|
|
673
|
+
let n = {
|
|
674
|
+
src: t.src,
|
|
675
|
+
theme: t.theme,
|
|
676
|
+
useTheme: !!t.useTheme,
|
|
677
|
+
topology: t.topology,
|
|
678
|
+
config: t.config,
|
|
679
|
+
strings: t.strings
|
|
680
|
+
}, r = t.pageUrl || (() => ""), s = /* @__PURE__ */ new Set(), c = null, f = null, p = null, m = !1, h = !1, g = (e) => {
|
|
681
|
+
if (h || !c || !e.detail || typeof e.detail.claim != "function") return;
|
|
682
|
+
e.stopPropagation();
|
|
683
|
+
let t = {
|
|
684
|
+
el: e.detail.el,
|
|
685
|
+
inst: c,
|
|
686
|
+
scope: w,
|
|
687
|
+
release: () => s.delete(t)
|
|
688
|
+
};
|
|
689
|
+
s.add(t), e.detail.claim(t);
|
|
690
|
+
};
|
|
691
|
+
e.addEventListener(l, g);
|
|
692
|
+
function _() {
|
|
693
|
+
let t = new Set(Ae(e));
|
|
694
|
+
for (let e of [...s]) s.delete(e), e.el && t.add(e.el);
|
|
695
|
+
for (let e of t) e.isConnected !== !1 && e.dispatchEvent(new Event(o));
|
|
696
|
+
}
|
|
697
|
+
function v() {
|
|
698
|
+
let e = Q.includes(n.theme) ? n.theme : "auto";
|
|
699
|
+
if (e === "light" || e === "dark") return e;
|
|
700
|
+
let t = c.doc && c.doc.documentElement, r = t ? t.getAttribute("data-theme") : null;
|
|
701
|
+
if (r === "light" || r === "dark") return r;
|
|
702
|
+
let i = c.win && c.win.matchMedia ? c.win.matchMedia("(prefers-color-scheme: light)") : null;
|
|
703
|
+
return u("system", !!(i && i.matches));
|
|
704
|
+
}
|
|
705
|
+
function y() {
|
|
706
|
+
p && p.setMode(v()), c && c.emit("scope:theme");
|
|
707
|
+
}
|
|
708
|
+
function b() {
|
|
709
|
+
let s = n.src === void 0 || n.src === null || n.src === "" ? null : ce(n.src);
|
|
710
|
+
c = a({
|
|
711
|
+
root: e,
|
|
712
|
+
base: s && s.ok ? s.base : ""
|
|
713
|
+
}), ee(c, null);
|
|
714
|
+
let l = i(c);
|
|
715
|
+
l.host = e, l.theme = Q.includes(n.theme) ? n.theme : "auto";
|
|
716
|
+
let u = Ce(c, { defaults: t.tokens || "" });
|
|
717
|
+
p = u, l.serverTheme = u, u.tokensOn(e), c.own(() => u.destroy()), f = I(c, {
|
|
718
|
+
version: t.version || "",
|
|
719
|
+
pageUrl: r,
|
|
720
|
+
onConfig: (e) => {
|
|
721
|
+
n.useTheme && u.load(e);
|
|
722
|
+
}
|
|
723
|
+
}), l.source = f, l.mountStatus = Oe, m = !1, c.on("source", x), c.on("theme", S);
|
|
724
|
+
let d = [];
|
|
725
|
+
c.on("piece:refused", (e) => {
|
|
726
|
+
e.host && !d.includes(e.host) && d.push(e.host), t.onError && t.onError({
|
|
727
|
+
kind: e.reason,
|
|
728
|
+
message: e.message
|
|
729
|
+
});
|
|
730
|
+
});
|
|
731
|
+
let g = c;
|
|
732
|
+
c.on("attach:released", () => {
|
|
733
|
+
Promise.resolve().then(() => {
|
|
734
|
+
if (!(h || c !== g)) for (; d.length;) {
|
|
735
|
+
let e = d.shift();
|
|
736
|
+
if (e.isConnected) {
|
|
737
|
+
e.dispatchEvent(new Event(o));
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
});
|
|
743
|
+
let _ = c.win && c.win.MutationObserver && c.doc && c.doc.documentElement ? new c.win.MutationObserver(y) : null;
|
|
744
|
+
_ && (_.observe(c.doc.documentElement, {
|
|
745
|
+
attributes: !0,
|
|
746
|
+
attributeFilter: ["data-theme"]
|
|
747
|
+
}), c.own(() => _.disconnect()));
|
|
748
|
+
let b = c.win && c.win.matchMedia ? c.win.matchMedia("(prefers-color-scheme: light)") : null;
|
|
749
|
+
b && b.addEventListener && (b.addEventListener("change", y), c.own(() => b.removeEventListener("change", y))), p.setMode(v()), s && !s.ok && f.say({
|
|
750
|
+
state: "address",
|
|
751
|
+
problem: s.problem
|
|
752
|
+
}), f.provide({
|
|
753
|
+
topology: n.topology || void 0,
|
|
754
|
+
config: n.config || void 0,
|
|
755
|
+
strings: n.strings || void 0
|
|
756
|
+
}), s && s.ok && f.load();
|
|
757
|
+
}
|
|
758
|
+
function x(e) {
|
|
759
|
+
if (!h) switch (e.state) {
|
|
760
|
+
case "ready":
|
|
761
|
+
m || (m = !0, t.onReady && t.onReady());
|
|
762
|
+
break;
|
|
763
|
+
case "sign-in":
|
|
764
|
+
t.onAuth && t.onAuth({
|
|
765
|
+
status: e.status,
|
|
766
|
+
signIn: e.signIn
|
|
767
|
+
});
|
|
768
|
+
break;
|
|
769
|
+
case "not-allowed":
|
|
770
|
+
t.onError && t.onError({
|
|
771
|
+
kind: "not-listed",
|
|
772
|
+
message: e.origin
|
|
773
|
+
});
|
|
774
|
+
break;
|
|
775
|
+
case "offline":
|
|
776
|
+
t.onError && t.onError({ kind: "offline" });
|
|
777
|
+
break;
|
|
778
|
+
case "server":
|
|
779
|
+
t.onError && t.onError({
|
|
780
|
+
kind: "server",
|
|
781
|
+
message: e.message
|
|
782
|
+
});
|
|
783
|
+
break;
|
|
784
|
+
case "address":
|
|
785
|
+
t.onError && t.onError({
|
|
786
|
+
kind: "address",
|
|
787
|
+
message: e.problem
|
|
788
|
+
});
|
|
789
|
+
break;
|
|
790
|
+
case "version": t.onError && t.onError({
|
|
791
|
+
kind: "version",
|
|
792
|
+
message: `${e.package} / ${e.server}`
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
function S(e) {
|
|
797
|
+
!h && e.state === "failed" && t.onError && t.onError({
|
|
798
|
+
kind: "theme",
|
|
799
|
+
message: e.reason
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
function C() {
|
|
803
|
+
_(), c && c.destroy(), c = null, f = null, p = null;
|
|
804
|
+
}
|
|
805
|
+
let w = {
|
|
806
|
+
update(e = {}) {
|
|
807
|
+
if (h) return;
|
|
808
|
+
let t = !1;
|
|
809
|
+
if ("src" in e && e.src !== n.src && (n.src = e.src, t = !0), "theme" in e && e.theme !== n.theme && (n.theme = e.theme, i(c).theme = Q.includes(n.theme) ? n.theme : "auto", y()), "useTheme" in e && !!e.useTheme !== n.useTheme && (n.useTheme = !!e.useTheme, n.useTheme ? f.config && p.load(f.config) : p.unload()), t) {
|
|
810
|
+
let e = c;
|
|
811
|
+
p.destroy(), b(), _(), e.destroy();
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
let r = {};
|
|
815
|
+
for (let t of [
|
|
816
|
+
"topology",
|
|
817
|
+
"config",
|
|
818
|
+
"strings"
|
|
819
|
+
]) t in e && e[t] !== n[t] && (n[t] = e[t], r[t] = e[t] === void 0 ? null : e[t]);
|
|
820
|
+
Object.keys(r).length && f.provide(r);
|
|
821
|
+
},
|
|
822
|
+
destroy() {
|
|
823
|
+
h || (e.removeEventListener(l, g), C(), h = !0, s.clear());
|
|
824
|
+
},
|
|
825
|
+
get instance() {
|
|
826
|
+
return c;
|
|
827
|
+
},
|
|
828
|
+
get source() {
|
|
829
|
+
return f;
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
return t.tokens && d(e.getRootNode(), t.tokens), b(), _(), w;
|
|
833
|
+
}
|
|
834
|
+
function Ae(e) {
|
|
835
|
+
let t = [], n = (e) => {
|
|
836
|
+
for (let r of e.children || []) {
|
|
837
|
+
let e = r.localName || "";
|
|
838
|
+
if (e.startsWith("corn-")) {
|
|
839
|
+
if (e === "corn-scope") continue;
|
|
840
|
+
t.push(r);
|
|
841
|
+
}
|
|
842
|
+
r.shadowRoot && n(r.shadowRoot), n(r);
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
return n(e), t;
|
|
846
|
+
}
|
|
847
|
+
export { ke as n, $ as t };
|