@supportwire/messenger-js-sdk 1.0.26
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 +80 -0
- package/dist/index-bfV4xNqW-CRQbrL80.js +1092 -0
- package/dist/index-bfV4xNqW-CRQbrL80.js.map +1 -0
- package/dist/index-bfV4xNqW-ChZOGalc.cjs +162 -0
- package/dist/index-bfV4xNqW-ChZOGalc.cjs.map +1 -0
- package/dist/index.cjs +921 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +149 -0
- package/dist/index.js +2646 -0
- package/dist/index.js.map +1 -0
- package/dist/snapdom-6yvsn_Iv-6uiY9rZc.js +3373 -0
- package/dist/snapdom-6yvsn_Iv-6uiY9rZc.js.map +1 -0
- package/dist/snapdom-6yvsn_Iv-OVmChxqF.cjs +9 -0
- package/dist/snapdom-6yvsn_Iv-OVmChxqF.cjs.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,3373 @@
|
|
|
1
|
+
var In = Object.defineProperty, On = Object.defineProperties, Un = Object.getOwnPropertyDescriptors, ve = Object.getOwnPropertySymbols, jn = Object.prototype.hasOwnProperty, _n = Object.prototype.propertyIsEnumerable, Se = (t, e, n) => e in t ? In(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, O = (t, e) => {
|
|
2
|
+
for (var n in e || (e = {}))
|
|
3
|
+
jn.call(e, n) && Se(t, n, e[n]);
|
|
4
|
+
if (ve)
|
|
5
|
+
for (var n of ve(e))
|
|
6
|
+
_n.call(e, n) && Se(t, n, e[n]);
|
|
7
|
+
return t;
|
|
8
|
+
}, J = (t, e) => On(t, Un(e)), Hn = Object.defineProperty, nt = (t, e) => () => (t && (e = t(t = 0)), e), Pt = (t, e) => {
|
|
9
|
+
for (var n in e) Hn(t, n, { get: e[n], enumerable: !0 });
|
|
10
|
+
};
|
|
11
|
+
function Dn(t) {
|
|
12
|
+
if (t === !0) return "soft";
|
|
13
|
+
if (t === !1) return "disabled";
|
|
14
|
+
if (typeof t == "string") {
|
|
15
|
+
let e = t.toLowerCase().trim();
|
|
16
|
+
if (e === "auto") return "auto";
|
|
17
|
+
if (e === "full") return "full";
|
|
18
|
+
if (e === "soft" || e === "disabled") return e;
|
|
19
|
+
}
|
|
20
|
+
return "soft";
|
|
21
|
+
}
|
|
22
|
+
function Bn(t = "soft") {
|
|
23
|
+
switch (k.session.__counterEpoch = (k.session.__counterEpoch || 0) + 1, t) {
|
|
24
|
+
case "auto": {
|
|
25
|
+
k.session.styleMap = /* @__PURE__ */ new Map(), k.session.nodeMap = /* @__PURE__ */ new Map();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
case "soft": {
|
|
29
|
+
k.session.styleMap = /* @__PURE__ */ new Map(), k.session.nodeMap = /* @__PURE__ */ new Map(), k.session.styleCache = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
case "full":
|
|
33
|
+
return;
|
|
34
|
+
case "disabled": {
|
|
35
|
+
k.session.styleMap = /* @__PURE__ */ new Map(), k.session.nodeMap = /* @__PURE__ */ new Map(), k.session.styleCache = /* @__PURE__ */ new WeakMap(), k.computedStyle = /* @__PURE__ */ new WeakMap(), k.baseStyle = new rt(50), k.defaultStyle = new rt(30), k.image = new rt(100), k.background = new rt(100), k.resource = new rt(150), k.font = /* @__PURE__ */ new Set();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
default: {
|
|
39
|
+
k.session.styleMap = /* @__PURE__ */ new Map(), k.session.nodeMap = /* @__PURE__ */ new Map(), k.session.styleCache = /* @__PURE__ */ new WeakMap();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
var rt, k, it = nt(() => {
|
|
45
|
+
rt = class extends Map {
|
|
46
|
+
constructor(t = 100, ...e) {
|
|
47
|
+
super(...e), this._maxSize = t;
|
|
48
|
+
}
|
|
49
|
+
set(t, e) {
|
|
50
|
+
if (this.size >= this._maxSize && !this.has(t)) {
|
|
51
|
+
let n = this.keys().next().value;
|
|
52
|
+
n !== void 0 && this.delete(n);
|
|
53
|
+
}
|
|
54
|
+
return super.set(t, e);
|
|
55
|
+
}
|
|
56
|
+
}, k = { image: new rt(100), background: new rt(100), resource: new rt(150), defaultStyle: new rt(30), baseStyle: new rt(50), computedStyle: /* @__PURE__ */ new WeakMap(), measureHints: /* @__PURE__ */ new WeakMap(), font: /* @__PURE__ */ new Set(), session: { styleMap: /* @__PURE__ */ new Map(), styleCache: /* @__PURE__ */ new WeakMap(), nodeMap: /* @__PURE__ */ new Map() } };
|
|
57
|
+
});
|
|
58
|
+
function de(t) {
|
|
59
|
+
let e = t.match(/url\((['"]?)(.*?)(\1)\)/);
|
|
60
|
+
if (!e) return null;
|
|
61
|
+
let n = e[2].trim();
|
|
62
|
+
return n.startsWith("#") ? null : n;
|
|
63
|
+
}
|
|
64
|
+
function Vn(t) {
|
|
65
|
+
if (!t || t === "none") return "";
|
|
66
|
+
let e = t.replace(/translate[XY]?\([^)]*\)/g, "");
|
|
67
|
+
return e = e.replace(/matrix\(([^)]+)\)/g, (n, r) => {
|
|
68
|
+
let l = r.split(",").map((i) => i.trim());
|
|
69
|
+
return l.length !== 6 ? `matrix(${r})` : (l[4] = "0", l[5] = "0", `matrix(${l.join(", ")})`);
|
|
70
|
+
}), e = e.replace(/matrix3d\(([^)]+)\)/g, (n, r) => {
|
|
71
|
+
let l = r.split(",").map((i) => i.trim());
|
|
72
|
+
return l.length !== 16 ? `matrix3d(${r})` : (l[12] = "0", l[13] = "0", `matrix3d(${l.join(", ")})`);
|
|
73
|
+
}), e.trim().replace(/\s{2,}/g, " ");
|
|
74
|
+
}
|
|
75
|
+
function Bt(t) {
|
|
76
|
+
if (/%[0-9A-Fa-f]{2}/.test(t)) return t;
|
|
77
|
+
try {
|
|
78
|
+
return encodeURI(t);
|
|
79
|
+
} catch {
|
|
80
|
+
return t;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function qn(t, e) {
|
|
84
|
+
var n;
|
|
85
|
+
if (!t || /^(data|blob|about|#)/i.test(t.trim())) return t;
|
|
86
|
+
try {
|
|
87
|
+
let r = e || typeof document < "u" && (document.baseURI || ((n = document.location) == null ? void 0 : n.href)) || "http://localhost/";
|
|
88
|
+
return new URL(t, r).href;
|
|
89
|
+
} catch {
|
|
90
|
+
return t;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
var qt = nt(() => {
|
|
94
|
+
});
|
|
95
|
+
function zn(t = "[snapDOM]", { ttlMs: e = 5 * 6e4, maxEntries: n = 12 } = {}) {
|
|
96
|
+
let r = /* @__PURE__ */ new Map(), l = 0;
|
|
97
|
+
function i(o, a, s) {
|
|
98
|
+
if (l >= n) return;
|
|
99
|
+
let c = Date.now();
|
|
100
|
+
(r.get(a) || 0) > c || (r.set(a, c + e), l++, o === "warn" && console && console.warn ? console.warn(`${t} ${s}`) : console && console.error && console.error(`${t} ${s}`));
|
|
101
|
+
}
|
|
102
|
+
return { warnOnce(o, a) {
|
|
103
|
+
i("warn", o, a);
|
|
104
|
+
}, errorOnce(o, a) {
|
|
105
|
+
i("error", o, a);
|
|
106
|
+
}, reset() {
|
|
107
|
+
r.clear(), l = 0;
|
|
108
|
+
} };
|
|
109
|
+
}
|
|
110
|
+
function Xn(t) {
|
|
111
|
+
return /^data:|^blob:|^about:blank$/i.test(t);
|
|
112
|
+
}
|
|
113
|
+
function Yn(t, e) {
|
|
114
|
+
try {
|
|
115
|
+
let n = typeof location < "u" && location.href ? location.href : "http://localhost/", r = e.includes("{url}") ? e.split("{url}")[0] : e, l = new URL(r || ".", n), i = new URL(t, n);
|
|
116
|
+
if (i.origin === l.origin) return !0;
|
|
117
|
+
let o = i.searchParams;
|
|
118
|
+
if (o && (o.has("url") || o.has("target"))) return !0;
|
|
119
|
+
} catch {
|
|
120
|
+
}
|
|
121
|
+
return !1;
|
|
122
|
+
}
|
|
123
|
+
function Gn(t, e) {
|
|
124
|
+
if (!e || Xn(t) || Yn(t, e)) return !1;
|
|
125
|
+
try {
|
|
126
|
+
let n = typeof location < "u" && location.href ? location.href : "http://localhost/", r = new URL(t, n);
|
|
127
|
+
return typeof location < "u" ? r.origin !== location.origin : !0;
|
|
128
|
+
} catch {
|
|
129
|
+
return !!e;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function Jn(t, e) {
|
|
133
|
+
if (!e) return t;
|
|
134
|
+
if (e.includes("{url}")) return e.replace("{urlRaw}", Bt(t)).replace("{url}", encodeURIComponent(t));
|
|
135
|
+
if (/[?&]url=?$/.test(e)) return `${e}${encodeURIComponent(t)}`;
|
|
136
|
+
if (e.endsWith("?")) return `${e}url=${encodeURIComponent(t)}`;
|
|
137
|
+
if (e.endsWith("/")) return `${e}${Bt(t)}`;
|
|
138
|
+
let n = e.includes("?") ? "&" : "?";
|
|
139
|
+
return `${e}${n}url=${encodeURIComponent(t)}`;
|
|
140
|
+
}
|
|
141
|
+
function Ce(t) {
|
|
142
|
+
return new Promise((e, n) => {
|
|
143
|
+
let r = new FileReader();
|
|
144
|
+
r.onload = () => e(String(r.result || "")), r.onerror = () => n(new Error("read_failed")), r.readAsDataURL(t);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function Kn(t, e) {
|
|
148
|
+
var n, r;
|
|
149
|
+
return [e.as || "blob", (n = e.timeout) != null ? n : 3e3, e.useProxy || "", (r = e.errorTTL) != null ? r : 8e3, t].join("|");
|
|
150
|
+
}
|
|
151
|
+
async function lt(t, e = {}) {
|
|
152
|
+
var n, r, l;
|
|
153
|
+
let i = (n = e.as) != null ? n : "blob", o = (r = e.timeout) != null ? r : 3e3, a = e.useProxy || "", s = (l = e.errorTTL) != null ? l : 8e3, c = e.headers || {}, h = !!e.silent;
|
|
154
|
+
if (/^data:/i.test(t)) try {
|
|
155
|
+
if (i === "text") return { ok: !0, data: String(t), status: 200, url: t, fromCache: !1 };
|
|
156
|
+
if (i === "dataURL") return { ok: !0, data: String(t), status: 200, url: t, fromCache: !1, mime: String(t).slice(5).split(";")[0] || "" };
|
|
157
|
+
let [, g = "", w = ""] = String(t).match(/^data:([^,]*),(.*)$/) || [], S = /;base64/i.test(g) ? atob(w) : decodeURIComponent(w), b = new Uint8Array([...S].map((v) => v.charCodeAt(0))), C = new Blob([b], { type: (g || "").split(";")[0] || "" });
|
|
158
|
+
return { ok: !0, data: C, status: 200, url: t, fromCache: !1, mime: C.type || "" };
|
|
159
|
+
} catch {
|
|
160
|
+
return { ok: !1, data: null, status: 0, url: t, fromCache: !1, reason: "special_url_error" };
|
|
161
|
+
}
|
|
162
|
+
if (/^blob:/i.test(t)) try {
|
|
163
|
+
let g = await fetch(t);
|
|
164
|
+
if (!g.ok) return { ok: !1, data: null, status: g.status, url: t, fromCache: !1, reason: "http_error" };
|
|
165
|
+
let w = await g.blob(), S = w.type || g.headers.get("content-type") || "";
|
|
166
|
+
return i === "dataURL" ? { ok: !0, data: await Ce(w), status: g.status, url: t, fromCache: !1, mime: S } : i === "text" ? { ok: !0, data: await w.text(), status: g.status, url: t, fromCache: !1, mime: S } : { ok: !0, data: w, status: g.status, url: t, fromCache: !1, mime: S };
|
|
167
|
+
} catch {
|
|
168
|
+
return { ok: !1, data: null, status: 0, url: t, fromCache: !1, reason: "network" };
|
|
169
|
+
}
|
|
170
|
+
if (/^about:blank$/i.test(t)) return i === "dataURL" ? { ok: !0, data: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", status: 200, url: t, fromCache: !1, mime: "image/png" } : { ok: !0, data: i === "text" ? "" : new Blob([]), status: 200, url: t, fromCache: !1 };
|
|
171
|
+
let u = Kn(t, { as: i, timeout: o, useProxy: a, errorTTL: s }), d = At.get(u);
|
|
172
|
+
if (d && d.until > Date.now()) return J(O({}, d.result), { fromCache: !0 });
|
|
173
|
+
d && At.delete(u);
|
|
174
|
+
let p = Ot.get(u);
|
|
175
|
+
if (p) return p;
|
|
176
|
+
let m = Gn(t, a) ? Jn(t, a) : t, f = e.credentials;
|
|
177
|
+
if (!f) try {
|
|
178
|
+
let g = typeof location < "u" && location.href ? location.href : "http://localhost/", w = new URL(t, g);
|
|
179
|
+
f = typeof location < "u" && w.origin === location.origin ? "include" : "omit";
|
|
180
|
+
} catch {
|
|
181
|
+
f = "omit";
|
|
182
|
+
}
|
|
183
|
+
let y = new AbortController(), x = setTimeout(() => y.abort("timeout"), o), $ = (async () => {
|
|
184
|
+
var g, w;
|
|
185
|
+
try {
|
|
186
|
+
let S = await fetch(m, { signal: y.signal, credentials: f, headers: c });
|
|
187
|
+
if (!S.ok) {
|
|
188
|
+
let v = { ok: !1, data: null, status: S.status, url: m, fromCache: !1, reason: "http_error" };
|
|
189
|
+
if (s > 0 && At.set(u, { until: Date.now() + s, result: v }), !h) {
|
|
190
|
+
let F = `${S.status} ${S.statusText || ""}`.trim();
|
|
191
|
+
Zt.warnOnce(`http:${S.status}:${i}:${new URL(t, (g = location?.href) != null ? g : "http://localhost/").origin}`, `HTTP error ${F} while fetching ${i} ${t}`);
|
|
192
|
+
}
|
|
193
|
+
return e.onError && e.onError(v), v;
|
|
194
|
+
}
|
|
195
|
+
if (i === "text") return { ok: !0, data: await S.text(), status: S.status, url: m, fromCache: !1 };
|
|
196
|
+
let b = await S.blob(), C = b.type || S.headers.get("content-type") || "";
|
|
197
|
+
return i === "dataURL" ? { ok: !0, data: await Ce(b), status: S.status, url: m, fromCache: !1, mime: C } : { ok: !0, data: b, status: S.status, url: m, fromCache: !1, mime: C };
|
|
198
|
+
} catch (S) {
|
|
199
|
+
let b = S && typeof S == "object" && "name" in S && S.name === "AbortError" ? String(S.message || "").includes("timeout") ? "timeout" : "abort" : "network", C = { ok: !1, data: null, status: 0, url: m, fromCache: !1, reason: b };
|
|
200
|
+
if (!/^blob:/i.test(t) && s > 0 && At.set(u, { until: Date.now() + s, result: C }), !h) {
|
|
201
|
+
let v = `${b}:${i}:${new URL(t, (w = location?.href) != null ? w : "http://localhost/").origin}`, F = b === "timeout" ? `Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}` : b === "abort" ? `Request aborted while fetching ${i} ${t}` : `Network/CORS issue while fetching ${i} ${t}. A proxy may be required`;
|
|
202
|
+
Zt.errorOnce(v, F);
|
|
203
|
+
}
|
|
204
|
+
return e.onError && e.onError(C), C;
|
|
205
|
+
} finally {
|
|
206
|
+
clearTimeout(x), Ot.delete(u);
|
|
207
|
+
}
|
|
208
|
+
})();
|
|
209
|
+
return Ot.set(u, $), $;
|
|
210
|
+
}
|
|
211
|
+
var Zt, Ot, At, $t = nt(() => {
|
|
212
|
+
qt(), Zt = zn("[snapDOM]", { ttlMs: 3 * 6e4, maxEntries: 10 }), Ot = /* @__PURE__ */ new Map(), At = /* @__PURE__ */ new Map();
|
|
213
|
+
});
|
|
214
|
+
async function Xe(t, e = {}) {
|
|
215
|
+
if (/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t) || t.trim() === "none") return t;
|
|
216
|
+
let n = de(t);
|
|
217
|
+
if (!n) return t;
|
|
218
|
+
let r = qn(n), l = Bt(r);
|
|
219
|
+
if (k.background.has(l)) {
|
|
220
|
+
let i = k.background.get(l);
|
|
221
|
+
return i ? `url("${i}")` : "none";
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
let i = await lt(l, { as: "dataURL", useProxy: e.useProxy });
|
|
225
|
+
return i.ok ? (k.background.set(l, i.data), `url("${i.data}")`) : (k.background.set(l, null), "none");
|
|
226
|
+
} catch {
|
|
227
|
+
return k.background.set(l, null), "none";
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
var Qn = nt(() => {
|
|
231
|
+
it(), qt(), $t();
|
|
232
|
+
});
|
|
233
|
+
function Zn(t) {
|
|
234
|
+
if (t = String(t).toLowerCase(), me.has(t)) {
|
|
235
|
+
let i = {};
|
|
236
|
+
return k.defaultStyle.set(t, i), i;
|
|
237
|
+
}
|
|
238
|
+
if (k.defaultStyle.has(t)) return k.defaultStyle.get(t);
|
|
239
|
+
let e = document.getElementById("snapdom-sandbox");
|
|
240
|
+
e || (e = document.createElement("div"), e.id = "snapdom-sandbox", e.setAttribute("data-snapdom-sandbox", "true"), e.setAttribute("aria-hidden", "true"), e.style.position = "absolute", e.style.left = "-9999px", e.style.top = "-9999px", e.style.width = "0px", e.style.height = "0px", e.style.overflow = "hidden", document.body.appendChild(e));
|
|
241
|
+
let n = document.createElement(t);
|
|
242
|
+
n.style.all = "initial", e.appendChild(n);
|
|
243
|
+
let r = getComputedStyle(n), l = {};
|
|
244
|
+
for (let i of r) {
|
|
245
|
+
if (fe(i)) continue;
|
|
246
|
+
let o = r.getPropertyValue(i);
|
|
247
|
+
l[i] = o;
|
|
248
|
+
}
|
|
249
|
+
return e.removeChild(n), k.defaultStyle.set(t, l), l;
|
|
250
|
+
}
|
|
251
|
+
function fe(t) {
|
|
252
|
+
let e = String(t).toLowerCase();
|
|
253
|
+
return !!(Ke.has(e) || Je.test(e) || Ge.test(e));
|
|
254
|
+
}
|
|
255
|
+
function te(t, e) {
|
|
256
|
+
if (e = String(e || "").toLowerCase(), me.has(e)) return "";
|
|
257
|
+
let n = [], r = Zn(e), l = (t.display || "").toLowerCase() === "inline" || (/* @__PURE__ */ new Set(["span", "small", "em", "strong", "b", "i", "u", "s", "code", "cite", "mark", "sub", "sup"])).has(e);
|
|
258
|
+
for (let [i, o] of Object.entries(t)) {
|
|
259
|
+
if (fe(i) || l && (i === "width" || i === "min-width" || i === "max-width")) continue;
|
|
260
|
+
let a = r[i];
|
|
261
|
+
o && o !== a && n.push(`${i}:${o}`);
|
|
262
|
+
}
|
|
263
|
+
return n.sort(), n.join(";");
|
|
264
|
+
}
|
|
265
|
+
function tr(t) {
|
|
266
|
+
let e = /* @__PURE__ */ new Set();
|
|
267
|
+
return t.nodeType !== Node.ELEMENT_NODE && t.nodeType !== Node.DOCUMENT_FRAGMENT_NODE ? [] : (t.tagName && e.add(t.tagName.toLowerCase()), typeof t.querySelectorAll == "function" && t.querySelectorAll("*").forEach((n) => e.add(n.tagName.toLowerCase())), Array.from(e));
|
|
268
|
+
}
|
|
269
|
+
function er(t) {
|
|
270
|
+
let e = /* @__PURE__ */ new Map();
|
|
271
|
+
for (let r of t) {
|
|
272
|
+
let l = k.defaultStyle.get(r);
|
|
273
|
+
if (!l) continue;
|
|
274
|
+
let i = Object.entries(l).map(([o, a]) => `${o}:${a};`).sort().join("");
|
|
275
|
+
i && (e.has(i) || e.set(i, []), e.get(i).push(r));
|
|
276
|
+
}
|
|
277
|
+
let n = "";
|
|
278
|
+
for (let [r, l] of e.entries()) n += `${l.join(",")} { ${r} }
|
|
279
|
+
`;
|
|
280
|
+
return n;
|
|
281
|
+
}
|
|
282
|
+
function nr(t) {
|
|
283
|
+
let e = Array.from(new Set(t.values())).filter(Boolean).sort(), n = /* @__PURE__ */ new Map(), r = 1;
|
|
284
|
+
for (let l of e) n.set(l, `c${r++}`);
|
|
285
|
+
return n;
|
|
286
|
+
}
|
|
287
|
+
function rr(t) {
|
|
288
|
+
var e;
|
|
289
|
+
try {
|
|
290
|
+
let n = t?.ownerDocument;
|
|
291
|
+
if (!n) return typeof window < "u" ? window : null;
|
|
292
|
+
let r = n.defaultView;
|
|
293
|
+
if (r && typeof r.getComputedStyle == "function") return r;
|
|
294
|
+
if (typeof window < "u" && window.frames) for (let l = 0; l < window.frames.length; l++) try {
|
|
295
|
+
if (((e = window.frames[l]) == null ? void 0 : e.document) === n) return window.frames[l];
|
|
296
|
+
} catch {
|
|
297
|
+
}
|
|
298
|
+
} catch {
|
|
299
|
+
}
|
|
300
|
+
return typeof window < "u" ? window : null;
|
|
301
|
+
}
|
|
302
|
+
function ft(t, e = null) {
|
|
303
|
+
let n = () => {
|
|
304
|
+
let i = { length: 0, getPropertyValue: () => "", item: () => "" };
|
|
305
|
+
return i[Symbol.iterator] = function* () {
|
|
306
|
+
}, i;
|
|
307
|
+
};
|
|
308
|
+
if (!(t instanceof Element)) {
|
|
309
|
+
let i = typeof window < "u" ? window : null;
|
|
310
|
+
if (i && typeof i.getComputedStyle == "function") try {
|
|
311
|
+
return i.getComputedStyle(t, e) || n();
|
|
312
|
+
} catch {
|
|
313
|
+
return n();
|
|
314
|
+
}
|
|
315
|
+
return n();
|
|
316
|
+
}
|
|
317
|
+
let r = k.computedStyle.get(t);
|
|
318
|
+
r || (r = /* @__PURE__ */ new Map(), k.computedStyle.set(t, r));
|
|
319
|
+
let l = r.get(e);
|
|
320
|
+
if (!l) {
|
|
321
|
+
let i = rr(t), o = null;
|
|
322
|
+
try {
|
|
323
|
+
o = i && typeof i.getComputedStyle == "function" ? i.getComputedStyle(t, e) : null;
|
|
324
|
+
} catch {
|
|
325
|
+
}
|
|
326
|
+
if (!o && typeof window < "u" && typeof window.getComputedStyle == "function") try {
|
|
327
|
+
t.ownerDocument === document && (o = window.getComputedStyle(t, e));
|
|
328
|
+
} catch {
|
|
329
|
+
}
|
|
330
|
+
l = o || n(), r.set(e, l);
|
|
331
|
+
}
|
|
332
|
+
return l;
|
|
333
|
+
}
|
|
334
|
+
function Me(t) {
|
|
335
|
+
let e = {};
|
|
336
|
+
for (let n of t) e[n] = t.getPropertyValue(n);
|
|
337
|
+
return e;
|
|
338
|
+
}
|
|
339
|
+
function ee(t) {
|
|
340
|
+
let e = [], n = 0, r = 0;
|
|
341
|
+
for (let l = 0; l < t.length; l++) {
|
|
342
|
+
let i = t[l];
|
|
343
|
+
i === "(" && n++, i === ")" && n--, i === "," && n === 0 && (e.push(t.slice(r, l).trim()), r = l + 1);
|
|
344
|
+
}
|
|
345
|
+
return e.push(t.slice(r).trim()), e;
|
|
346
|
+
}
|
|
347
|
+
var Ye, me, Ge, Je, Ke, Qe = nt(() => {
|
|
348
|
+
it(), Ye = /* @__PURE__ */ new Set(["meta", "script", "noscript", "title", "link", "template"]), me = /* @__PURE__ */ new Set(["meta", "link", "style", "title", "noscript", "script", "template", "g", "defs", "use", "marker", "mask", "clipPath", "pattern", "path", "polygon", "polyline", "line", "circle", "ellipse", "rect", "filter", "lineargradient", "radialgradient", "stop"]), Ge = /(?:^|-)(animation|transition)(?:-|$)/i, Je = /^(--.+|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i, Ke = /* @__PURE__ */ new Set(["cursor", "pointer-events", "touch-action", "user-select", "print-color-adjust", "speak", "reading-flow", "reading-order", "anchor-name", "anchor-scope", "container-name", "container-type", "timeline-scope", "zoom"]);
|
|
349
|
+
});
|
|
350
|
+
function Ct(t, { fast: e = !1 } = {}) {
|
|
351
|
+
if (e) return t();
|
|
352
|
+
"requestIdleCallback" in window ? requestIdleCallback(t, { timeout: 50 }) : setTimeout(t, 1);
|
|
353
|
+
}
|
|
354
|
+
function lr() {
|
|
355
|
+
if (typeof navigator > "u") return !1;
|
|
356
|
+
if (navigator.userAgentData) return navigator.userAgentData.platform === "iOS";
|
|
357
|
+
let t = navigator.userAgent || "", e = /iPhone|iPad|iPod/.test(t), n = navigator.maxTouchPoints > 2 && /Macintosh/.test(t);
|
|
358
|
+
return e || n;
|
|
359
|
+
}
|
|
360
|
+
function xt() {
|
|
361
|
+
if (typeof navigator > "u") return !1;
|
|
362
|
+
let t = navigator.userAgent || "", e = t.toLowerCase(), n = e.includes("safari") && !e.includes("chrome") && !e.includes("crios") && !e.includes("fxios") && !e.includes("android"), r = /applewebkit/i.test(t), l = /mobile/i.test(t), i = !/safari/i.test(t), o = r && l && i, a = /(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t), s = /(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e), c = /ipad|iphone|ipod/.test(e) && r;
|
|
363
|
+
return n || o || a || s || c;
|
|
364
|
+
}
|
|
365
|
+
function ir() {
|
|
366
|
+
if (typeof navigator > "u") return !1;
|
|
367
|
+
let t = (navigator.userAgent || "").toLowerCase();
|
|
368
|
+
return t.includes("firefox") || t.includes("fxios");
|
|
369
|
+
}
|
|
370
|
+
var Rt = nt(() => {
|
|
371
|
+
});
|
|
372
|
+
function V(t, e, n) {
|
|
373
|
+
let r = t && typeof t == "object" && (t.options || t);
|
|
374
|
+
r && r.debug && (n !== void 0 ? console.warn("[snapdom]", e, n) : console.warn("[snapdom]", e));
|
|
375
|
+
}
|
|
376
|
+
var Ze = nt(() => {
|
|
377
|
+
}), st = nt(() => {
|
|
378
|
+
Qn(), Qe(), Rt(), qt(), Ze();
|
|
379
|
+
}), tn = {};
|
|
380
|
+
Pt(tn, { toCanvas: () => zt });
|
|
381
|
+
function or(t) {
|
|
382
|
+
return typeof t == "string" && /^data:image\/svg\+xml/i.test(t);
|
|
383
|
+
}
|
|
384
|
+
function ar(t) {
|
|
385
|
+
let e = t.indexOf(",");
|
|
386
|
+
return e >= 0 ? decodeURIComponent(t.slice(e + 1)) : "";
|
|
387
|
+
}
|
|
388
|
+
function sr(t) {
|
|
389
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`;
|
|
390
|
+
}
|
|
391
|
+
function ur(t) {
|
|
392
|
+
let e = [], n = "", r = 0;
|
|
393
|
+
for (let l = 0; l < t.length; l++) {
|
|
394
|
+
let i = t[l];
|
|
395
|
+
i === "(" && r++, i === ")" && (r = Math.max(0, r - 1)), i === ";" && r === 0 ? (e.push(n), n = "") : n += i;
|
|
396
|
+
}
|
|
397
|
+
return n.trim() && e.push(n), e.map((l) => l.trim()).filter(Boolean);
|
|
398
|
+
}
|
|
399
|
+
function cr(t) {
|
|
400
|
+
let e = [], n = "", r = 0;
|
|
401
|
+
for (let i = 0; i < t.length; i++) {
|
|
402
|
+
let o = t[i];
|
|
403
|
+
o === "(" && r++, o === ")" && (r = Math.max(0, r - 1)), o === "," && r === 0 ? (e.push(n.trim()), n = "") : n += o;
|
|
404
|
+
}
|
|
405
|
+
n.trim() && e.push(n.trim());
|
|
406
|
+
let l = [];
|
|
407
|
+
for (let i of e) {
|
|
408
|
+
if (/\binset\b/i.test(i)) continue;
|
|
409
|
+
let o = i.match(/-?\d+(?:\.\d+)?px/gi) || [], [a = "0px", s = "0px", c = "0px"] = o, h = i.replace(/-?\d+(?:\.\d+)?px/gi, "").replace(/\binset\b/ig, "").trim().replace(/\s{2,}/g, " "), u = !!h && h !== ",";
|
|
410
|
+
l.push(`drop-shadow(${a} ${s} ${c}${u ? ` ${h}` : ""})`);
|
|
411
|
+
}
|
|
412
|
+
return l.join(" ");
|
|
413
|
+
}
|
|
414
|
+
function en(t) {
|
|
415
|
+
let e = ur(t), n = null, r = null, l = null, i = [];
|
|
416
|
+
for (let a of e) {
|
|
417
|
+
let s = a.indexOf(":");
|
|
418
|
+
if (s < 0) continue;
|
|
419
|
+
let c = a.slice(0, s).trim().toLowerCase(), h = a.slice(s + 1).trim();
|
|
420
|
+
c === "box-shadow" ? l = h : c === "filter" ? n = h : c === "-webkit-filter" ? r = h : i.push([c, h]);
|
|
421
|
+
}
|
|
422
|
+
if (l) {
|
|
423
|
+
let a = cr(l);
|
|
424
|
+
a && (n = n ? `${n} ${a}` : a, r = r ? `${r} ${a}` : a);
|
|
425
|
+
}
|
|
426
|
+
let o = [...i];
|
|
427
|
+
return n && o.push(["filter", n]), r && o.push(["-webkit-filter", r]), o.map(([a, s]) => `${a}:${s}`).join(";");
|
|
428
|
+
}
|
|
429
|
+
function dr(t) {
|
|
430
|
+
return t.replace(/([^{}]+)\{([^}]*)\}/g, (e, n, r) => `${n}{${en(r)}}`);
|
|
431
|
+
}
|
|
432
|
+
function fr(t) {
|
|
433
|
+
return t = t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi, (e, n) => e.replace(n, dr(n))), t = t.replace(/style=(['"])([\s\S]*?)\1/gi, (e, n, r) => `style=${n}${en(r)}${n}`), t;
|
|
434
|
+
}
|
|
435
|
+
function mr(t) {
|
|
436
|
+
if (!xt() || !or(t)) return t;
|
|
437
|
+
try {
|
|
438
|
+
let e = ar(t), n = fr(e);
|
|
439
|
+
return sr(n);
|
|
440
|
+
} catch {
|
|
441
|
+
return t;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
async function zt(t, e) {
|
|
445
|
+
let { width: n, height: r, scale: l = 1, dpr: i = 1, meta: o = {}, backgroundColor: a } = e;
|
|
446
|
+
t = mr(t);
|
|
447
|
+
let s = new Image();
|
|
448
|
+
s.loading = "eager", s.decoding = "sync", s.crossOrigin = "anonymous", s.src = t, await s.decode();
|
|
449
|
+
let c = s.naturalWidth, h = s.naturalHeight, u = Number.isFinite(o.w0) ? o.w0 : c, d = Number.isFinite(o.h0) ? o.h0 : h, p, m, f = Number.isFinite(n), y = Number.isFinite(r);
|
|
450
|
+
if (f && y) p = Math.max(1, n), m = Math.max(1, r);
|
|
451
|
+
else if (f) {
|
|
452
|
+
let g = n / Math.max(1, u);
|
|
453
|
+
p = n, m = d * g;
|
|
454
|
+
} else if (y) {
|
|
455
|
+
let g = r / Math.max(1, d);
|
|
456
|
+
m = r, p = u * g;
|
|
457
|
+
} else p = c, m = h;
|
|
458
|
+
p = p * l, m = m * l;
|
|
459
|
+
let x = document.createElement("canvas");
|
|
460
|
+
x.width = p * i, x.height = m * i, x.style.width = `${p}px`, x.style.height = `${m}px`;
|
|
461
|
+
let $ = x.getContext("2d");
|
|
462
|
+
return i !== 1 && $.scale(i, i), a && ($.save(), $.fillStyle = a, $.fillRect(0, 0, p, m), $.restore()), $.drawImage(s, 0, 0, p, m), x;
|
|
463
|
+
}
|
|
464
|
+
var Xt = nt(() => {
|
|
465
|
+
Rt();
|
|
466
|
+
}), Ut = {};
|
|
467
|
+
Pt(Ut, { rasterize: () => nn });
|
|
468
|
+
async function nn(t, e) {
|
|
469
|
+
let n = await zt(t, e), r = new Image();
|
|
470
|
+
return r.src = n.toDataURL(`image/${e.format}`, e.quality), await r.decode(), r.style.width = `${n.width / e.dpr}px`, r.style.height = `${n.height / e.dpr}px`, r;
|
|
471
|
+
}
|
|
472
|
+
var jt = nt(() => {
|
|
473
|
+
Xt();
|
|
474
|
+
}), ne = {};
|
|
475
|
+
Pt(ne, { toImg: () => $e, toSvg: () => $e });
|
|
476
|
+
async function $e(t, e) {
|
|
477
|
+
let { scale: n = 1, width: r, height: l, meta: i = {} } = e, o = Number.isFinite(r), a = Number.isFinite(l), s = Number.isFinite(n) && n !== 1 || o || a;
|
|
478
|
+
if (xt() && s) return await nn(t, J(O({}, e), { format: "png", quality: 1, meta: i }));
|
|
479
|
+
let c = new Image();
|
|
480
|
+
if (c.decoding = "sync", c.loading = "eager", c.src = t, await c.decode(), o && a) c.style.width = `${r}px`, c.style.height = `${l}px`;
|
|
481
|
+
else if (o) {
|
|
482
|
+
let h = Number.isFinite(i.w0) ? i.w0 : c.naturalWidth, u = Number.isFinite(i.h0) ? i.h0 : c.naturalHeight, d = r / Math.max(1, h);
|
|
483
|
+
c.style.width = `${r}px`, c.style.height = `${Math.round(u * d)}px`;
|
|
484
|
+
} else if (a) {
|
|
485
|
+
let h = Number.isFinite(i.w0) ? i.w0 : c.naturalWidth, u = Number.isFinite(i.h0) ? i.h0 : c.naturalHeight, d = l / Math.max(1, u);
|
|
486
|
+
c.style.height = `${l}px`, c.style.width = `${Math.round(h * d)}px`;
|
|
487
|
+
} else {
|
|
488
|
+
let h = Math.round(c.naturalWidth * n), u = Math.round(c.naturalHeight * n);
|
|
489
|
+
if (c.style.width = `${h}px`, c.style.height = `${u}px`, typeof t == "string" && t.startsWith("data:image/svg+xml")) try {
|
|
490
|
+
let d = decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/, `width="${h}"`).replace(/height="[^"]*"/, `height="${u}"`);
|
|
491
|
+
t = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`, c.src = t;
|
|
492
|
+
} catch (d) {
|
|
493
|
+
V(e, "SVG width/height patch in toImg failed", d);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return c;
|
|
497
|
+
}
|
|
498
|
+
var ke = nt(() => {
|
|
499
|
+
st(), jt();
|
|
500
|
+
}), rn = {};
|
|
501
|
+
Pt(rn, { toBlob: () => ln });
|
|
502
|
+
async function ln(t, e) {
|
|
503
|
+
let n = e.type;
|
|
504
|
+
if (n === "svg") {
|
|
505
|
+
let l = decodeURIComponent(t.split(",")[1]);
|
|
506
|
+
return new Blob([l], { type: "image/svg+xml" });
|
|
507
|
+
}
|
|
508
|
+
let r = await zt(t, e);
|
|
509
|
+
return new Promise((l) => r.toBlob((i) => l(i), `image/${n}`, e.quality));
|
|
510
|
+
}
|
|
511
|
+
var on = nt(() => {
|
|
512
|
+
Xt();
|
|
513
|
+
}), an = {};
|
|
514
|
+
Pt(an, { download: () => hr });
|
|
515
|
+
async function Ae(t, e) {
|
|
516
|
+
var n;
|
|
517
|
+
let r = new File([t], e, { type: t.type });
|
|
518
|
+
if (!((n = navigator.canShare) != null && n.call(navigator, { files: [r] }))) return !1;
|
|
519
|
+
try {
|
|
520
|
+
await navigator.share({ files: [r], title: e });
|
|
521
|
+
} catch (l) {
|
|
522
|
+
if (l.name !== "AbortError") return !1;
|
|
523
|
+
}
|
|
524
|
+
return !0;
|
|
525
|
+
}
|
|
526
|
+
async function hr(t, e) {
|
|
527
|
+
let n = /* @__PURE__ */ new Set(["png", "jpeg", "jpg", "webp", "svg"]), r = (e?.type || "").toLowerCase(), l = n.has(r) ? r : "", i = (e?.format || l || "").toLowerCase(), o = i === "jpg" ? "jpeg" : i || "png", a = e?.filename || `snapdom.${o}`, s = J(O({}, e || {}), { format: o, type: o });
|
|
528
|
+
s.dpr = 1;
|
|
529
|
+
let c = lr();
|
|
530
|
+
if (o === "svg") {
|
|
531
|
+
let d = await ln(t, J(O({}, s), { type: "svg" }));
|
|
532
|
+
if (c && await Ae(d, a)) return;
|
|
533
|
+
let p = URL.createObjectURL(d), m = document.createElement("a");
|
|
534
|
+
m.href = p, m.download = a, document.body.appendChild(m), m.click(), URL.revokeObjectURL(p), m.remove();
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
let h = await zt(t, s);
|
|
538
|
+
if (c) {
|
|
539
|
+
let d = `image/${o}`, p = await new Promise((m) => h.toBlob(m, d, e?.quality));
|
|
540
|
+
if (p && await Ae(p, a)) return;
|
|
541
|
+
}
|
|
542
|
+
let u = document.createElement("a");
|
|
543
|
+
u.href = h.toDataURL(`image/${o}`, e?.quality), u.download = a, document.body.appendChild(u), u.click(), u.remove();
|
|
544
|
+
}
|
|
545
|
+
var pr = nt(() => {
|
|
546
|
+
on(), Xt(), Rt();
|
|
547
|
+
});
|
|
548
|
+
st();
|
|
549
|
+
st();
|
|
550
|
+
it();
|
|
551
|
+
var Ee = /* @__PURE__ */ new WeakMap(), Lt = /* @__PURE__ */ new Map(), gr = 2e3, re = 0;
|
|
552
|
+
function Et() {
|
|
553
|
+
re++, Lt.size > gr && Lt.clear();
|
|
554
|
+
}
|
|
555
|
+
var Fe = !1;
|
|
556
|
+
function yr(t = document.documentElement) {
|
|
557
|
+
var e, n;
|
|
558
|
+
if (!Fe) {
|
|
559
|
+
Fe = !0;
|
|
560
|
+
try {
|
|
561
|
+
new MutationObserver(() => Et()).observe(t, { subtree: !0, childList: !0, characterData: !0, attributes: !0 });
|
|
562
|
+
} catch {
|
|
563
|
+
}
|
|
564
|
+
try {
|
|
565
|
+
new MutationObserver(() => Et()).observe(document.head, { subtree: !0, childList: !0, characterData: !0, attributes: !0 });
|
|
566
|
+
} catch {
|
|
567
|
+
}
|
|
568
|
+
try {
|
|
569
|
+
let r = document.fonts;
|
|
570
|
+
r && ((e = r.addEventListener) == null || e.call(r, "loadingdone", Et), (n = r.ready) == null || n.then(() => Et()).catch(() => {
|
|
571
|
+
}));
|
|
572
|
+
} catch {
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function wr(t, e = {}) {
|
|
577
|
+
let n = {}, r = t.getPropertyValue("visibility"), l = e.excludeStyleProps;
|
|
578
|
+
for (let u = 0; u < t.length; u++) {
|
|
579
|
+
let d = t[u];
|
|
580
|
+
if (fe(d) || l && (l instanceof RegExp && l.test(d) || typeof l == "function" && l(d))) continue;
|
|
581
|
+
let p = t.getPropertyValue(d);
|
|
582
|
+
(d === "background-image" || d === "content") && p.includes("url(") && !p.includes("data:") && (p = "none"), n[d] = p;
|
|
583
|
+
}
|
|
584
|
+
let i = ["text-decoration-line", "text-decoration-color", "text-decoration-style", "text-decoration-thickness", "text-underline-offset", "text-decoration-skip-ink"];
|
|
585
|
+
for (let u of i) if (!n[u]) try {
|
|
586
|
+
let d = t.getPropertyValue(u);
|
|
587
|
+
d && (n[u] = d);
|
|
588
|
+
} catch {
|
|
589
|
+
}
|
|
590
|
+
let o = ["-webkit-text-stroke", "-webkit-text-stroke-width", "-webkit-text-stroke-color", "paint-order"];
|
|
591
|
+
for (let u of o) if (!n[u]) try {
|
|
592
|
+
let d = t.getPropertyValue(u);
|
|
593
|
+
d && (n[u] = d);
|
|
594
|
+
} catch {
|
|
595
|
+
}
|
|
596
|
+
if (e.embedFonts) {
|
|
597
|
+
let u = ["font-feature-settings", "font-variation-settings", "font-kerning", "font-variant", "font-variant-ligatures", "font-optical-sizing"];
|
|
598
|
+
for (let d of u) if (!n[d]) try {
|
|
599
|
+
let p = t.getPropertyValue(d);
|
|
600
|
+
p && (n[d] = p);
|
|
601
|
+
} catch {
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
r === "hidden" && (n.opacity = "0");
|
|
605
|
+
try {
|
|
606
|
+
(n["content-visibility"] || t.getPropertyValue("content-visibility")) === "hidden" && (n.visibility = "hidden");
|
|
607
|
+
} catch {
|
|
608
|
+
}
|
|
609
|
+
let a = parseFloat(t.getPropertyValue("border-top-width") || 0) || 0, s = parseFloat(t.getPropertyValue("border-right-width") || 0) || 0, c = parseFloat(t.getPropertyValue("border-bottom-width") || 0) || 0, h = parseFloat(t.getPropertyValue("border-left-width") || 0) || 0;
|
|
610
|
+
if (a === 0 && s === 0 && c === 0 && h === 0) {
|
|
611
|
+
let u = (t.getPropertyValue("border-image-source") || "").trim(), d = u && u !== "none", p = ["border", "border-top", "border-right", "border-bottom", "border-left", "border-width", "border-style", "border-color", "border-top-width", "border-top-style", "border-top-color", "border-right-width", "border-right-style", "border-right-color", "border-bottom-width", "border-bottom-style", "border-bottom-color", "border-left-width", "border-left-style", "border-left-color", "border-block", "border-block-width", "border-block-style", "border-block-color", "border-inline", "border-inline-width", "border-inline-style", "border-inline-color"];
|
|
612
|
+
for (let m of p) delete n[m];
|
|
613
|
+
d || (n.border = "none");
|
|
614
|
+
}
|
|
615
|
+
return n;
|
|
616
|
+
}
|
|
617
|
+
var Le = /* @__PURE__ */ new WeakMap();
|
|
618
|
+
function br(t) {
|
|
619
|
+
let e = Le.get(t);
|
|
620
|
+
return e || (e = Object.entries(t).sort((n, r) => n[0] < r[0] ? -1 : n[0] > r[0] ? 1 : 0).map(([n, r]) => `${n}:${r}`).join(";"), Le.set(t, e), e);
|
|
621
|
+
}
|
|
622
|
+
function xr(t, e = null, n = {}) {
|
|
623
|
+
let r = Ee.get(t);
|
|
624
|
+
if (r && r.epoch === re) return r.snapshot;
|
|
625
|
+
let l = e || getComputedStyle(t), i = wr(l, n);
|
|
626
|
+
return Ar(t, l, i), Ee.set(t, { epoch: re, snapshot: i }), i;
|
|
627
|
+
}
|
|
628
|
+
function vr(t, e) {
|
|
629
|
+
return t && t.session && t.persist ? t : t && (t.styleMap || t.styleCache || t.nodeMap) ? { session: t, persist: { snapshotKeyCache: Lt, defaultStyle: k.defaultStyle, baseStyle: k.baseStyle, image: k.image, resource: k.resource, background: k.background, font: k.font }, options: e || {} } : { session: k.session, persist: { snapshotKeyCache: Lt, defaultStyle: k.defaultStyle, baseStyle: k.baseStyle, image: k.image, resource: k.resource, background: k.background, font: k.font }, options: t || e || {} };
|
|
630
|
+
}
|
|
631
|
+
function Sr(t, e, n) {
|
|
632
|
+
if (!(!t.style || t.style.length === 0)) for (let r = 0; r < t.style.length; r++) {
|
|
633
|
+
let l = t.style[r], i = n.getPropertyValue(l);
|
|
634
|
+
i && e.style.setProperty(l, i);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
async function bt(t, e, n, r) {
|
|
638
|
+
var l, i;
|
|
639
|
+
if (t.tagName === "STYLE") return;
|
|
640
|
+
let o = vr(n, r), a = o.options && o.options.cache || "auto";
|
|
641
|
+
a !== "disabled" && yr(document.documentElement), a === "disabled" && !o.session.__bumpedForDisabled && (Et(), Lt.clear(), o.session.__bumpedForDisabled = !0);
|
|
642
|
+
let { session: s, persist: c } = o;
|
|
643
|
+
if (!s.styleCache.has(t)) {
|
|
644
|
+
let m = null;
|
|
645
|
+
try {
|
|
646
|
+
m = getComputedStyle(t);
|
|
647
|
+
} catch {
|
|
648
|
+
}
|
|
649
|
+
s.styleCache.set(t, m || getComputedStyle(document.documentElement));
|
|
650
|
+
}
|
|
651
|
+
let h = s.styleCache.get(t);
|
|
652
|
+
(l = t.getAttribute) != null && l.call(t, "style") && Sr(t, e, h);
|
|
653
|
+
let u = xr(t, h, o.options), d = br(u), p = c.snapshotKeyCache.get(d);
|
|
654
|
+
if (!p) {
|
|
655
|
+
let m = ((i = t.tagName) == null ? void 0 : i.toLowerCase()) || "div";
|
|
656
|
+
p = te(u, m), c.snapshotKeyCache.set(d, p);
|
|
657
|
+
}
|
|
658
|
+
s.styleMap.set(e, p);
|
|
659
|
+
}
|
|
660
|
+
function Cr(t) {
|
|
661
|
+
return t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof HTMLVideoElement || t instanceof HTMLIFrameElement || t instanceof SVGElement || t instanceof HTMLObjectElement || t instanceof HTMLEmbedElement;
|
|
662
|
+
}
|
|
663
|
+
function Mr(t) {
|
|
664
|
+
return t.backgroundImage && t.backgroundImage !== "none" || t.backgroundColor && t.backgroundColor !== "rgba(0, 0, 0, 0)" && t.backgroundColor !== "transparent" || (parseFloat(t.borderTopWidth) || 0) > 0 || (parseFloat(t.borderBottomWidth) || 0) > 0 || (parseFloat(t.paddingTop) || 0) > 0 || (parseFloat(t.paddingBottom) || 0) > 0 ? !0 : (t.overflowBlock || t.overflowY || "visible") !== "visible";
|
|
665
|
+
}
|
|
666
|
+
function $r(t) {
|
|
667
|
+
let e = t.parentElement;
|
|
668
|
+
if (!e) return !1;
|
|
669
|
+
let n = getComputedStyle(e).display || "";
|
|
670
|
+
return n.includes("flex") || n.includes("grid");
|
|
671
|
+
}
|
|
672
|
+
function kr(t, e) {
|
|
673
|
+
if (t.textContent && /\S/.test(t.textContent)) return !0;
|
|
674
|
+
let n = t.firstElementChild, r = t.lastElementChild;
|
|
675
|
+
if (n && n.tagName === "BR" || r && r.tagName === "BR") return !0;
|
|
676
|
+
let l = t.scrollHeight;
|
|
677
|
+
if (l === 0) return !1;
|
|
678
|
+
let i = parseFloat(e.paddingTop) || 0, o = parseFloat(e.paddingBottom) || 0;
|
|
679
|
+
return l > i + o;
|
|
680
|
+
}
|
|
681
|
+
function Ar(t, e, n) {
|
|
682
|
+
if (t instanceof HTMLElement && t.style && t.style.height) return;
|
|
683
|
+
let r = t.tagName && t.tagName.toLowerCase();
|
|
684
|
+
if (!r || !["div", "section", "article", "main", "aside", "header", "footer", "nav"].includes(r)) return;
|
|
685
|
+
let l = parseFloat(e.height);
|
|
686
|
+
if (Number.isFinite(l) && t.scrollHeight > 0 && Math.abs(l - t.scrollHeight) > 2 || e.aspectRatio && e.aspectRatio !== "none" && e.aspectRatio !== "auto") return;
|
|
687
|
+
let i = e.display || "";
|
|
688
|
+
if (i.includes("flex") || i.includes("grid") || Cr(t)) return;
|
|
689
|
+
let o = e.position;
|
|
690
|
+
if (o === "absolute" || o === "fixed" || o === "sticky" || e.transform !== "none" || Mr(e) || $r(t)) return;
|
|
691
|
+
let a = e.overflowX || e.overflow || "visible", s = e.overflowY || e.overflow || "visible";
|
|
692
|
+
if (a !== "visible" || s !== "visible") return;
|
|
693
|
+
let c = e.clip;
|
|
694
|
+
c && c !== "auto" && c !== "rect(auto, auto, auto, auto)" || e.visibility === "hidden" || e.opacity === "0" || kr(t, e) && (delete n.height, delete n["block-size"]);
|
|
695
|
+
}
|
|
696
|
+
Qe();
|
|
697
|
+
var sn = ["fill", "stroke", "color", "background-color", "stop-color"], Ne = /* @__PURE__ */ new Map();
|
|
698
|
+
function Er(t, e) {
|
|
699
|
+
let n = e + "::" + t.toLowerCase(), r = Ne.get(n);
|
|
700
|
+
if (r) return r;
|
|
701
|
+
let l = document, i = e === "http://www.w3.org/2000/svg" ? l.createElementNS(e, t) : l.createElement(t), o = l.createElement("div");
|
|
702
|
+
o.style.cssText = "position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;", o.appendChild(i), l.documentElement.appendChild(o);
|
|
703
|
+
let a = getComputedStyle(i), s = {};
|
|
704
|
+
for (let c of sn) s[c] = a.getPropertyValue(c) || "";
|
|
705
|
+
return o.remove(), Ne.set(n, s), s;
|
|
706
|
+
}
|
|
707
|
+
function Fr(t, e) {
|
|
708
|
+
var n, r, l;
|
|
709
|
+
if (!(t instanceof Element) || !(e instanceof Element)) return;
|
|
710
|
+
let i = (n = t.getAttribute) == null ? void 0 : n.call(t, "style"), o = !!(i && i.includes("var("));
|
|
711
|
+
if (!o && (r = t.attributes) != null && r.length) {
|
|
712
|
+
let s = t.attributes;
|
|
713
|
+
for (let c = 0; c < s.length; c++) {
|
|
714
|
+
let h = s[c];
|
|
715
|
+
if (h && typeof h.value == "string" && h.value.includes("var(")) {
|
|
716
|
+
o = !0;
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
let a = null;
|
|
722
|
+
if (o) try {
|
|
723
|
+
a = getComputedStyle(t);
|
|
724
|
+
} catch {
|
|
725
|
+
}
|
|
726
|
+
if (o) {
|
|
727
|
+
let s = t.style;
|
|
728
|
+
if (s && s.length) {
|
|
729
|
+
let c = /* @__PURE__ */ new Set();
|
|
730
|
+
for (let h = 0; h < s.length; h++) {
|
|
731
|
+
let u = s[h];
|
|
732
|
+
if (c.has(u)) continue;
|
|
733
|
+
c.add(u);
|
|
734
|
+
let d = s.getPropertyValue(u);
|
|
735
|
+
if (!d || !d.includes("var(")) continue;
|
|
736
|
+
let p = a && a.getPropertyValue(u);
|
|
737
|
+
if (p) try {
|
|
738
|
+
e.style.setProperty(u, p.trim(), s.getPropertyPriority(u));
|
|
739
|
+
} catch {
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
if (o && (l = t.attributes) != null && l.length) {
|
|
745
|
+
let s = t.attributes;
|
|
746
|
+
for (let c = 0; c < s.length; c++) {
|
|
747
|
+
let h = s[c];
|
|
748
|
+
if (!h || typeof h.value != "string" || !h.value.includes("var(")) continue;
|
|
749
|
+
let u = h.name, d = a && a.getPropertyValue(u);
|
|
750
|
+
if (d) try {
|
|
751
|
+
e.style.setProperty(u, d.trim());
|
|
752
|
+
} catch {
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
if (!o) {
|
|
757
|
+
if (!a) try {
|
|
758
|
+
a = getComputedStyle(t);
|
|
759
|
+
} catch {
|
|
760
|
+
a = null;
|
|
761
|
+
}
|
|
762
|
+
if (!a) return;
|
|
763
|
+
let s = t.namespaceURI || "html", c = Er(t.tagName, s);
|
|
764
|
+
for (let h of sn) {
|
|
765
|
+
let u = a.getPropertyValue(h) || "", d = c[h] || "";
|
|
766
|
+
if (u && u !== d) try {
|
|
767
|
+
e.style.setProperty(h, u.trim());
|
|
768
|
+
} catch {
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
st();
|
|
774
|
+
st();
|
|
775
|
+
it();
|
|
776
|
+
$t();
|
|
777
|
+
function Kt(t, e, n) {
|
|
778
|
+
return Promise.all(t.map((r) => new Promise((l) => {
|
|
779
|
+
function i() {
|
|
780
|
+
Ct((o) => {
|
|
781
|
+
!(o && typeof o.timeRemaining == "function") || o.timeRemaining() > 0 ? e(r, l) : i();
|
|
782
|
+
}, { fast: n });
|
|
783
|
+
}
|
|
784
|
+
i();
|
|
785
|
+
})));
|
|
786
|
+
}
|
|
787
|
+
function Lr(t) {
|
|
788
|
+
return t = t.trim(), !t || /:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t) ? t : `${t}:not([data-sd-slotted])`;
|
|
789
|
+
}
|
|
790
|
+
function Nr(t, e, n = !0) {
|
|
791
|
+
return t.split(",").map((r) => r.trim()).filter(Boolean).map((r) => {
|
|
792
|
+
if (r.startsWith(":where(") || r.startsWith("@")) return r;
|
|
793
|
+
let l = n ? Lr(r) : r;
|
|
794
|
+
return `:where(${e} ${l})`;
|
|
795
|
+
}).join(", ");
|
|
796
|
+
}
|
|
797
|
+
function Pr(t, e) {
|
|
798
|
+
return t ? (t = t.replace(/:host\(([^)]+)\)/g, (n, r) => `:where(${e}:is(${r.trim()}))`), t = t.replace(/:host\b/g, `:where(${e})`), t = t.replace(/:host-context\(([^)]+)\)/g, (n, r) => `:where(:where(${r.trim()}) ${e})`), t = t.replace(/::slotted\(([^)]+)\)/g, (n, r) => `:where(${e} ${r.trim()})`), t = t.replace(/(^|})(\s*)([^@}{]+){/g, (n, r, l, i) => {
|
|
799
|
+
let o = Nr(i, e, !0);
|
|
800
|
+
return `${r}${l}${o}{`;
|
|
801
|
+
}), t) : "";
|
|
802
|
+
}
|
|
803
|
+
function Rr(t) {
|
|
804
|
+
return t.shadowScopeSeq = (t.shadowScopeSeq || 0) + 1, `s${t.shadowScopeSeq}`;
|
|
805
|
+
}
|
|
806
|
+
function Tr(t) {
|
|
807
|
+
let e = "";
|
|
808
|
+
try {
|
|
809
|
+
t.querySelectorAll("style").forEach((r) => {
|
|
810
|
+
e += (r.textContent || "") + `
|
|
811
|
+
`;
|
|
812
|
+
});
|
|
813
|
+
let n = t.adoptedStyleSheets || [];
|
|
814
|
+
for (let r of n) try {
|
|
815
|
+
if (r && r.cssRules) for (let l of r.cssRules) e += l.cssText + `
|
|
816
|
+
`;
|
|
817
|
+
} catch {
|
|
818
|
+
}
|
|
819
|
+
} catch {
|
|
820
|
+
}
|
|
821
|
+
return e;
|
|
822
|
+
}
|
|
823
|
+
function Wr(t, e, n) {
|
|
824
|
+
if (!e) return;
|
|
825
|
+
let r = document.createElement("style");
|
|
826
|
+
r.setAttribute("data-sd", n), r.textContent = e, t.insertBefore(r, t.firstChild || null);
|
|
827
|
+
}
|
|
828
|
+
function Ir(t, e) {
|
|
829
|
+
try {
|
|
830
|
+
let n = t.currentSrc || t.src || "";
|
|
831
|
+
if (!n) return;
|
|
832
|
+
e.setAttribute("src", n), e.removeAttribute("srcset"), e.removeAttribute("sizes"), e.loading = "eager", e.decoding = "sync";
|
|
833
|
+
} catch {
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function Or(t) {
|
|
837
|
+
let e = /* @__PURE__ */ new Set();
|
|
838
|
+
if (!t) return e;
|
|
839
|
+
let n = /var\(\s*(--[A-Za-z0-9_-]+)\b/g, r;
|
|
840
|
+
for (; r = n.exec(t); ) e.add(r[1]);
|
|
841
|
+
return e;
|
|
842
|
+
}
|
|
843
|
+
function Ur(t, e) {
|
|
844
|
+
try {
|
|
845
|
+
let n = getComputedStyle(t).getPropertyValue(e).trim();
|
|
846
|
+
if (n) return n;
|
|
847
|
+
} catch {
|
|
848
|
+
}
|
|
849
|
+
try {
|
|
850
|
+
let n = getComputedStyle(document.documentElement).getPropertyValue(e).trim();
|
|
851
|
+
if (n) return n;
|
|
852
|
+
} catch {
|
|
853
|
+
}
|
|
854
|
+
return "";
|
|
855
|
+
}
|
|
856
|
+
function jr(t, e, n) {
|
|
857
|
+
let r = [];
|
|
858
|
+
for (let l of e) {
|
|
859
|
+
let i = Ur(t, l);
|
|
860
|
+
i && r.push(`${l}: ${i};`);
|
|
861
|
+
}
|
|
862
|
+
return r.length ? `${n}{${r.join("")}}
|
|
863
|
+
` : "";
|
|
864
|
+
}
|
|
865
|
+
function _r(t) {
|
|
866
|
+
t && (t.nodeType === Node.ELEMENT_NODE && t.setAttribute("data-sd-slotted", ""), t.querySelectorAll && t.querySelectorAll("*").forEach((e) => e.setAttribute("data-sd-slotted", "")));
|
|
867
|
+
}
|
|
868
|
+
async function Hr(t, e = 3) {
|
|
869
|
+
let n = () => {
|
|
870
|
+
var i;
|
|
871
|
+
try {
|
|
872
|
+
return t.contentDocument || ((i = t.contentWindow) == null ? void 0 : i.document) || null;
|
|
873
|
+
} catch {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
}, r = n(), l = 0;
|
|
877
|
+
for (; l < e && (!r || !r.body && !r.documentElement); ) await new Promise((i) => setTimeout(i, 0)), r = n(), l++;
|
|
878
|
+
return r && (r.body || r.documentElement) ? r : null;
|
|
879
|
+
}
|
|
880
|
+
function Dr(t) {
|
|
881
|
+
let e = t.getBoundingClientRect(), n = 0, r = 0, l = 0, i = 0;
|
|
882
|
+
try {
|
|
883
|
+
let s = getComputedStyle(t);
|
|
884
|
+
n = parseFloat(s.borderLeftWidth) || 0, r = parseFloat(s.borderRightWidth) || 0, l = parseFloat(s.borderTopWidth) || 0, i = parseFloat(s.borderBottomWidth) || 0;
|
|
885
|
+
} catch {
|
|
886
|
+
}
|
|
887
|
+
let o = Math.max(0, Math.round(e.width - (n + r))), a = Math.max(0, Math.round(e.height - (l + i)));
|
|
888
|
+
return { contentWidth: o, contentHeight: a, rect: e };
|
|
889
|
+
}
|
|
890
|
+
function at(t) {
|
|
891
|
+
let e = 0, n = 0;
|
|
892
|
+
if (t.offsetWidth > 0 && (e = t.offsetWidth), t.offsetHeight > 0 && (n = t.offsetHeight), e === 0 || n === 0) try {
|
|
893
|
+
let r = getComputedStyle(t);
|
|
894
|
+
if (e === 0) {
|
|
895
|
+
let l = parseFloat(r.width);
|
|
896
|
+
!isNaN(l) && l > 0 && (e = l);
|
|
897
|
+
}
|
|
898
|
+
if (n === 0) {
|
|
899
|
+
let l = parseFloat(r.height);
|
|
900
|
+
!isNaN(l) && l > 0 && (n = l);
|
|
901
|
+
}
|
|
902
|
+
} catch {
|
|
903
|
+
}
|
|
904
|
+
if (e === 0 || n === 0) try {
|
|
905
|
+
if (e === 0) {
|
|
906
|
+
let r = parseFloat(t.getAttribute("width"));
|
|
907
|
+
!isNaN(r) && r > 0 && (e = r);
|
|
908
|
+
}
|
|
909
|
+
if (n === 0) {
|
|
910
|
+
let r = parseFloat(t.getAttribute("height"));
|
|
911
|
+
!isNaN(r) && r > 0 && (n = r);
|
|
912
|
+
}
|
|
913
|
+
} catch {
|
|
914
|
+
}
|
|
915
|
+
if ((e === 0 || n === 0) && (t.naturalWidth || t.naturalHeight)) try {
|
|
916
|
+
e === 0 && t.naturalWidth > 0 && (e = t.naturalWidth), n === 0 && t.naturalHeight > 0 && (n = t.naturalHeight);
|
|
917
|
+
} catch {
|
|
918
|
+
}
|
|
919
|
+
return { width: e, height: n };
|
|
920
|
+
}
|
|
921
|
+
function Br(t, e, n) {
|
|
922
|
+
let r = t.createElement("style");
|
|
923
|
+
return r.setAttribute("data-sd-iframe-pin", ""), r.textContent = `html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`, (t.head || t.documentElement).appendChild(r), () => {
|
|
924
|
+
try {
|
|
925
|
+
r.remove();
|
|
926
|
+
} catch {
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
async function Vr(t, e, n) {
|
|
931
|
+
let r = await Hr(t, 3);
|
|
932
|
+
if (!r) throw new Error("iframe document not accessible/ready");
|
|
933
|
+
let { contentWidth: l, contentHeight: i, rect: o } = Dr(t), a = n?.snap;
|
|
934
|
+
if (!a && typeof window < "u" && window.snapdom && (a = window.snapdom), !a || typeof a.toPng != "function") throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");
|
|
935
|
+
let s = J(O({}, n), { scale: 1 }), c = Br(r, l, i), h;
|
|
936
|
+
try {
|
|
937
|
+
h = await a.toPng(r.documentElement, s);
|
|
938
|
+
} finally {
|
|
939
|
+
c();
|
|
940
|
+
}
|
|
941
|
+
h.style.display = "block", h.style.width = `${l}px`, h.style.height = `${i}px`;
|
|
942
|
+
let u = document.createElement("div");
|
|
943
|
+
return e.nodeMap.set(u, t), bt(t, u, e, n), u.style.overflow = "hidden", u.style.display = "block", u.style.width || (u.style.width = `${Math.round(o.width)}px`), u.style.height || (u.style.height = `${Math.round(o.height)}px`), u.appendChild(h), u;
|
|
944
|
+
}
|
|
945
|
+
function qr(t) {
|
|
946
|
+
let { width: e, height: n } = at(t), r = t.getBoundingClientRect(), l;
|
|
947
|
+
try {
|
|
948
|
+
l = window.getComputedStyle(t);
|
|
949
|
+
} catch {
|
|
950
|
+
}
|
|
951
|
+
let i = l ? parseFloat(l.width) : NaN, o = l ? parseFloat(l.height) : NaN, a = Math.round(e || r.width || 0), s = Math.round(n || r.height || 0), c = Number.isFinite(i) && i > 0 ? Math.round(i) : Math.max(12, a || 16), h = Number.isFinite(o) && o > 0 ? Math.round(o) : Math.max(12, s || 16), u = (t.type || "text").toLowerCase() === "checkbox", d = !!t.checked, p = !!t.indeterminate, m = Math.max(Math.min(c, h), 12), f = "middle";
|
|
952
|
+
try {
|
|
953
|
+
l && l.verticalAlign && (f = l.verticalAlign);
|
|
954
|
+
} catch {
|
|
955
|
+
}
|
|
956
|
+
let y = document.createElement("div");
|
|
957
|
+
y.setAttribute("data-snapdom-input-replacement", t.type || "checkbox"), y.style.cssText = `display:inline-block;width:${m}px;height:${m}px;vertical-align:${f};flex-shrink:0;line-height:0;`;
|
|
958
|
+
let x = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
959
|
+
x.setAttribute("width", String(m)), x.setAttribute("height", String(m)), x.setAttribute("viewBox", `0 0 ${m} ${m}`), y.appendChild(x);
|
|
960
|
+
function $() {
|
|
961
|
+
let g = "#0a6ed1";
|
|
962
|
+
try {
|
|
963
|
+
l && (g = l.accentColor || l.color || g);
|
|
964
|
+
} catch {
|
|
965
|
+
}
|
|
966
|
+
let w = 2, S = w / 2, b = m - w;
|
|
967
|
+
if (x.innerHTML = "", u) {
|
|
968
|
+
let C = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
969
|
+
if (C.setAttribute("x", String(S)), C.setAttribute("y", String(S)), C.setAttribute("width", String(b)), C.setAttribute("height", String(b)), C.setAttribute("rx", "2"), C.setAttribute("ry", "2"), C.setAttribute("fill", d ? g : "none"), C.setAttribute("stroke", g), C.setAttribute("stroke-width", String(w)), x.appendChild(C), d) {
|
|
970
|
+
let v = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
971
|
+
v.setAttribute("d", `M ${S + 2} ${m / 2} L ${m / 2 - 1} ${m - S - 2} L ${m - S - 2} ${S + 2}`), v.setAttribute("stroke", "white"), v.setAttribute("stroke-width", String(Math.max(1.5, w))), v.setAttribute("fill", "none"), v.setAttribute("stroke-linecap", "round"), v.setAttribute("stroke-linejoin", "round"), x.appendChild(v);
|
|
972
|
+
} else if (p) {
|
|
973
|
+
let v = document.createElementNS("http://www.w3.org/2000/svg", "rect"), F = Math.max(6, b - 4);
|
|
974
|
+
v.setAttribute("x", String((m - F) / 2)), v.setAttribute("y", String((m - w) / 2)), v.setAttribute("width", String(F)), v.setAttribute("height", String(w)), v.setAttribute("fill", g), v.setAttribute("rx", "1"), x.appendChild(v);
|
|
975
|
+
}
|
|
976
|
+
} else {
|
|
977
|
+
let C = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
978
|
+
if (C.setAttribute("cx", String(m / 2)), C.setAttribute("cy", String(m / 2)), C.setAttribute("r", String((m - w) / 2)), C.setAttribute("fill", d ? g : "none"), C.setAttribute("stroke", g), C.setAttribute("stroke-width", String(w)), x.appendChild(C), d) {
|
|
979
|
+
let v = document.createElementNS("http://www.w3.org/2000/svg", "circle"), F = Math.max(2, (m - w * 2) * 0.35);
|
|
980
|
+
v.setAttribute("cx", String(m / 2)), v.setAttribute("cy", String(m / 2)), v.setAttribute("r", String(F)), v.setAttribute("fill", "white"), x.appendChild(v);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
y.style.setProperty("width", `${m}px`, "important"), y.style.setProperty("height", `${m}px`, "important"), y.style.setProperty("min-width", `${m}px`, "important"), y.style.setProperty("min-height", `${m}px`, "important");
|
|
984
|
+
}
|
|
985
|
+
return $(), { el: y, applyVisual: $ };
|
|
986
|
+
}
|
|
987
|
+
var kt = new rt(80);
|
|
988
|
+
async function Ft(t) {
|
|
989
|
+
var e;
|
|
990
|
+
if ((e = k.resource) != null && e.has(t)) return k.resource.get(t);
|
|
991
|
+
if (kt.has(t)) return kt.get(t);
|
|
992
|
+
let n = (async () => {
|
|
993
|
+
var r;
|
|
994
|
+
let l = await lt(t, { as: "dataURL", silent: !0 });
|
|
995
|
+
if (!l.ok || typeof l.data != "string") throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);
|
|
996
|
+
return (r = k.resource) == null || r.set(t, l.data), l.data;
|
|
997
|
+
})();
|
|
998
|
+
kt.set(t, n);
|
|
999
|
+
try {
|
|
1000
|
+
let r = await n;
|
|
1001
|
+
return kt.set(t, r), r;
|
|
1002
|
+
} catch (r) {
|
|
1003
|
+
throw kt.delete(t), r;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
var zr = /\bblob:[^)"'\s]+/g;
|
|
1007
|
+
async function Pe(t) {
|
|
1008
|
+
if (!t || t.indexOf("blob:") === -1) return t;
|
|
1009
|
+
let e = Array.from(new Set(t.match(zr) || []));
|
|
1010
|
+
if (e.length === 0) return t;
|
|
1011
|
+
let n = t;
|
|
1012
|
+
for (let r of e) try {
|
|
1013
|
+
let l = await Ft(r);
|
|
1014
|
+
n = n.split(r).join(l);
|
|
1015
|
+
} catch {
|
|
1016
|
+
}
|
|
1017
|
+
return n;
|
|
1018
|
+
}
|
|
1019
|
+
function It(t) {
|
|
1020
|
+
return typeof t == "string" && t.startsWith("blob:");
|
|
1021
|
+
}
|
|
1022
|
+
function Xr(t) {
|
|
1023
|
+
return (t || "").split(",").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
1024
|
+
let n = e.match(/^(\S+)(\s+.+)?$/);
|
|
1025
|
+
return n ? { url: n[1], desc: n[2] || "" } : null;
|
|
1026
|
+
}).filter(Boolean);
|
|
1027
|
+
}
|
|
1028
|
+
function Yr(t) {
|
|
1029
|
+
return t.map((e) => e.desc ? `${e.url} ${e.desc.trim()}` : e.url).join(", ");
|
|
1030
|
+
}
|
|
1031
|
+
async function Gr(t, e = null) {
|
|
1032
|
+
var n, r;
|
|
1033
|
+
if (!t) return;
|
|
1034
|
+
let l = e, i = t.querySelectorAll ? t.querySelectorAll("img") : [];
|
|
1035
|
+
for (let h of i) try {
|
|
1036
|
+
let u = h.getAttribute("src") || h.currentSrc || "";
|
|
1037
|
+
if (It(u)) {
|
|
1038
|
+
let p = await Ft(u);
|
|
1039
|
+
h.setAttribute("src", p);
|
|
1040
|
+
}
|
|
1041
|
+
let d = h.getAttribute("srcset");
|
|
1042
|
+
if (d && d.includes("blob:")) {
|
|
1043
|
+
let p = Xr(d), m = !1;
|
|
1044
|
+
for (let f of p) if (It(f.url)) try {
|
|
1045
|
+
f.url = await Ft(f.url), m = !0;
|
|
1046
|
+
} catch (y) {
|
|
1047
|
+
V(l, "blobUrlToDataUrl for srcset item failed", y);
|
|
1048
|
+
}
|
|
1049
|
+
m && h.setAttribute("srcset", Yr(p));
|
|
1050
|
+
}
|
|
1051
|
+
} catch (u) {
|
|
1052
|
+
V(l, "resolveBlobUrls for img failed", u);
|
|
1053
|
+
}
|
|
1054
|
+
let o = t.querySelectorAll ? t.querySelectorAll("image") : [];
|
|
1055
|
+
for (let h of o) try {
|
|
1056
|
+
let u = "http://www.w3.org/1999/xlink", d = h.getAttribute("href") || ((n = h.getAttributeNS) == null ? void 0 : n.call(h, u, "href"));
|
|
1057
|
+
if (It(d)) {
|
|
1058
|
+
let p = await Ft(d);
|
|
1059
|
+
h.setAttribute("href", p), (r = h.removeAttributeNS) == null || r.call(h, u, "href");
|
|
1060
|
+
}
|
|
1061
|
+
} catch (u) {
|
|
1062
|
+
V(l, "resolveBlobUrls for SVG image href failed", u);
|
|
1063
|
+
}
|
|
1064
|
+
let a = t.querySelectorAll ? t.querySelectorAll("[style*='blob:']") : [];
|
|
1065
|
+
for (let h of a) try {
|
|
1066
|
+
let u = h.getAttribute("style");
|
|
1067
|
+
if (u && u.includes("blob:")) {
|
|
1068
|
+
let d = await Pe(u);
|
|
1069
|
+
h.setAttribute("style", d);
|
|
1070
|
+
}
|
|
1071
|
+
} catch (u) {
|
|
1072
|
+
V(l, "replaceBlobUrls in inline style failed", u);
|
|
1073
|
+
}
|
|
1074
|
+
let s = t.querySelectorAll ? t.querySelectorAll("style") : [];
|
|
1075
|
+
for (let h of s) try {
|
|
1076
|
+
let u = h.textContent || "";
|
|
1077
|
+
u.includes("blob:") && (h.textContent = await Pe(u));
|
|
1078
|
+
} catch (u) {
|
|
1079
|
+
V(l, "replaceBlobUrls in style tag failed", u);
|
|
1080
|
+
}
|
|
1081
|
+
let c = ["poster"];
|
|
1082
|
+
for (let h of c) {
|
|
1083
|
+
let u = t.querySelectorAll ? t.querySelectorAll(`[${h}^='blob:']`) : [];
|
|
1084
|
+
for (let d of u) try {
|
|
1085
|
+
let p = d.getAttribute(h);
|
|
1086
|
+
It(p) && d.setAttribute(h, await Ft(p));
|
|
1087
|
+
} catch (p) {
|
|
1088
|
+
V(l, `resolveBlobUrls for ${h} failed`, p);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
Rt();
|
|
1093
|
+
async function _t(t, e, n) {
|
|
1094
|
+
var r, l, i, o, a, s, c, h, u;
|
|
1095
|
+
if (!t) throw new Error("Invalid node");
|
|
1096
|
+
let d = /* @__PURE__ */ new Set(), p = null, m = null;
|
|
1097
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
1098
|
+
let g = (t.localName || t.tagName || "").toLowerCase();
|
|
1099
|
+
if (t.id === "snapdom-sandbox" || t.hasAttribute("data-snapdom-sandbox") || Ye.has(g)) return null;
|
|
1100
|
+
if (g === "foreignobject" && (l = (r = t.parentElement) == null ? void 0 : r.closest) != null && l.call(r, "foreignObject")) return V(e, "Nested <foreignObject> skipped (SVG spec limitation — not rendered by browsers)"), null;
|
|
1101
|
+
}
|
|
1102
|
+
if (t.nodeType === Node.TEXT_NODE || t.nodeType !== Node.ELEMENT_NODE) return t.cloneNode(!0);
|
|
1103
|
+
if (t.getAttribute("data-capture") === "exclude") {
|
|
1104
|
+
if (n.excludeMode === "hide") {
|
|
1105
|
+
let g = document.createElement("div"), { width: w, height: S } = at(t), b = w || t.getBoundingClientRect().width || 0, C = S || t.getBoundingClientRect().height || 0;
|
|
1106
|
+
return g.style.cssText = `display:inline-block;width:${b}px;height:${C}px;visibility:hidden;`, g;
|
|
1107
|
+
} else if (n.excludeMode === "remove") return null;
|
|
1108
|
+
}
|
|
1109
|
+
if (n.exclude && Array.isArray(n.exclude)) for (let g of n.exclude) try {
|
|
1110
|
+
if ((i = t.matches) != null && i.call(t, g)) {
|
|
1111
|
+
if (n.excludeMode === "hide") {
|
|
1112
|
+
let w = document.createElement("div"), { width: S, height: b } = at(t), C = S || t.getBoundingClientRect().width || 0, v = b || t.getBoundingClientRect().height || 0;
|
|
1113
|
+
return w.style.cssText = `display:inline-block;width:${C}px;height:${v}px;visibility:hidden;`, w;
|
|
1114
|
+
} else if (n.excludeMode === "remove") return null;
|
|
1115
|
+
}
|
|
1116
|
+
} catch (w) {
|
|
1117
|
+
console.warn(`Invalid selector in exclude option: ${g}`, w);
|
|
1118
|
+
}
|
|
1119
|
+
if (typeof n.filter == "function") try {
|
|
1120
|
+
if (!n.filter(t)) {
|
|
1121
|
+
if (n.filterMode === "hide") {
|
|
1122
|
+
let g = document.createElement("div"), { width: w, height: S } = at(t), b = w || t.getBoundingClientRect().width || 0, C = S || t.getBoundingClientRect().height || 0;
|
|
1123
|
+
return g.style.cssText = `display:inline-block;width:${b}px;height:${C}px;visibility:hidden;`, g;
|
|
1124
|
+
} else if (n.filterMode === "remove") return null;
|
|
1125
|
+
}
|
|
1126
|
+
} catch (g) {
|
|
1127
|
+
console.warn("Error in filter function:", g);
|
|
1128
|
+
}
|
|
1129
|
+
if (t.tagName === "IFRAME") {
|
|
1130
|
+
let g = !1;
|
|
1131
|
+
try {
|
|
1132
|
+
g = !!(t.contentDocument || (o = t.contentWindow) != null && o.document);
|
|
1133
|
+
} catch (w) {
|
|
1134
|
+
V(e, "iframe same-origin probe failed", w);
|
|
1135
|
+
}
|
|
1136
|
+
if (g) try {
|
|
1137
|
+
return await Vr(t, e, n);
|
|
1138
|
+
} catch (w) {
|
|
1139
|
+
console.warn("[SnapDOM] iframe rasterization failed, fallback:", w);
|
|
1140
|
+
}
|
|
1141
|
+
if (g || console.warn("[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.", t), n.placeholders) {
|
|
1142
|
+
let { width: w, height: S } = at(t), b = document.createElement("div");
|
|
1143
|
+
return b.style.cssText = `width:${w}px;height:${S}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`, bt(t, b, e, n), b;
|
|
1144
|
+
} else {
|
|
1145
|
+
let { width: w, height: S } = at(t), b = document.createElement("div");
|
|
1146
|
+
return b.style.cssText = `display:inline-block;width:${w}px;height:${S}px;visibility:hidden;`, bt(t, b, e, n), b;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
if (t.getAttribute("data-capture") === "placeholder") {
|
|
1150
|
+
let g = t.cloneNode(!1);
|
|
1151
|
+
e.nodeMap.set(g, t), bt(t, g, e, n);
|
|
1152
|
+
let w = document.createElement("div");
|
|
1153
|
+
return w.textContent = t.getAttribute("data-placeholder-text") || "", w.style.cssText = "color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;", g.appendChild(w), g;
|
|
1154
|
+
}
|
|
1155
|
+
if (t.tagName === "CANVAS") {
|
|
1156
|
+
let g = "";
|
|
1157
|
+
try {
|
|
1158
|
+
let C = t.getContext("2d", { willReadFrequently: !0 });
|
|
1159
|
+
try {
|
|
1160
|
+
C && C.getImageData(0, 0, 1, 1);
|
|
1161
|
+
} catch {
|
|
1162
|
+
}
|
|
1163
|
+
if (await new Promise((v) => requestAnimationFrame(v)), g = t.toDataURL("image/png"), !g || g === "data:,") {
|
|
1164
|
+
try {
|
|
1165
|
+
C && C.getImageData(0, 0, 1, 1);
|
|
1166
|
+
} catch {
|
|
1167
|
+
}
|
|
1168
|
+
if (await new Promise((v) => requestAnimationFrame(v)), g = t.toDataURL("image/png"), !g || g === "data:,") {
|
|
1169
|
+
let v = document.createElement("canvas");
|
|
1170
|
+
v.width = t.width, v.height = t.height;
|
|
1171
|
+
let F = v.getContext("2d");
|
|
1172
|
+
F && (F.drawImage(t, 0, 0), g = v.toDataURL("image/png"));
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
} catch (C) {
|
|
1176
|
+
V(e, "Canvas toDataURL failed, using empty/fallback", C);
|
|
1177
|
+
}
|
|
1178
|
+
let w = document.createElement("img");
|
|
1179
|
+
try {
|
|
1180
|
+
w.decoding = "sync", w.loading = "eager";
|
|
1181
|
+
} catch (C) {
|
|
1182
|
+
V(e, "img decoding/loading hints failed", C);
|
|
1183
|
+
}
|
|
1184
|
+
g && (w.src = g), w.width = t.width, w.height = t.height;
|
|
1185
|
+
let { width: S, height: b } = at(t);
|
|
1186
|
+
return S > 0 && (w.style.width = `${S}px`), b > 0 && (w.style.height = `${b}px`), e.nodeMap.set(w, t), bt(t, w, e, n), w;
|
|
1187
|
+
}
|
|
1188
|
+
if (t.tagName === "VIDEO") {
|
|
1189
|
+
let g = "";
|
|
1190
|
+
try {
|
|
1191
|
+
let C = document.createElement("canvas");
|
|
1192
|
+
C.width = t.videoWidth || t.offsetWidth || 320, C.height = t.videoHeight || t.offsetHeight || 240;
|
|
1193
|
+
let v = C.getContext("2d");
|
|
1194
|
+
v && (v.drawImage(t, 0, 0, C.width, C.height), g = C.toDataURL("image/png"), (!g || g === "data:,") && (g = ""));
|
|
1195
|
+
} catch (C) {
|
|
1196
|
+
V(e, "Video frame capture failed, using poster fallback", C);
|
|
1197
|
+
}
|
|
1198
|
+
let w = document.createElement("img");
|
|
1199
|
+
try {
|
|
1200
|
+
w.decoding = "sync", w.loading = "eager";
|
|
1201
|
+
} catch {
|
|
1202
|
+
}
|
|
1203
|
+
g ? w.src = g : t.poster && (w.src = t.poster), w.width = t.videoWidth || t.offsetWidth || 0, w.height = t.videoHeight || t.offsetHeight || 0;
|
|
1204
|
+
let { width: S, height: b } = at(t);
|
|
1205
|
+
return S > 0 && (w.style.width = `${S}px`), b > 0 && (w.style.height = `${b}px`), w.style.objectFit = "contain", e.nodeMap.set(w, t), bt(t, w, e, n), w;
|
|
1206
|
+
}
|
|
1207
|
+
let f;
|
|
1208
|
+
try {
|
|
1209
|
+
if (f = t.cloneNode(!1), (a = f.attributes) == null ? void 0 : a.length) try {
|
|
1210
|
+
for (let g of f.attributes) /[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(g.value) && f.setAttribute(g.name, g.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g, ""));
|
|
1211
|
+
} catch {
|
|
1212
|
+
}
|
|
1213
|
+
if (Fr(t, f), e.nodeMap.set(f, t), t.tagName === "IMG") {
|
|
1214
|
+
Ir(t, f);
|
|
1215
|
+
try {
|
|
1216
|
+
let { width: g, height: w } = at(t), S = Math.round(g || 0), b = Math.round(w || 0);
|
|
1217
|
+
S && (f.dataset.snapdomWidth = String(S)), b && (f.dataset.snapdomHeight = String(b));
|
|
1218
|
+
} catch (g) {
|
|
1219
|
+
V(e, "getUnscaledDimensions for IMG failed", g);
|
|
1220
|
+
}
|
|
1221
|
+
try {
|
|
1222
|
+
let g = t.getAttribute("style") || "", w = window.getComputedStyle(t), S = (U) => {
|
|
1223
|
+
let B = g.match(new RegExp(`${U}\\s*:\\s*([^;]+)`, "i")), W = B ? B[1].trim() : w.getPropertyValue(U);
|
|
1224
|
+
return /%|auto/i.test(String(W || ""));
|
|
1225
|
+
}, b = parseInt(f.dataset.snapdomWidth || "0", 10), C = parseInt(f.dataset.snapdomHeight || "0", 10), v = S("width") || !b, F = S("height") || !C;
|
|
1226
|
+
v && b && (f.style.width = `${b}px`), F && C && (f.style.height = `${C}px`);
|
|
1227
|
+
let E = w.getPropertyValue("object-fit"), D = w.getPropertyValue("object-position");
|
|
1228
|
+
E && E !== "fill" ? (f.style.objectFit = E, D && (f.style.objectPosition = D)) : (b && (f.style.minWidth = `${b}px`), C && (f.style.minHeight = `${C}px`));
|
|
1229
|
+
} catch (g) {
|
|
1230
|
+
V(e, "IMG dimension freeze failed", g);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
} catch (g) {
|
|
1234
|
+
throw console.error("[Snapdom] Failed to clone node:", t, g), g;
|
|
1235
|
+
}
|
|
1236
|
+
let y = null;
|
|
1237
|
+
if (t instanceof HTMLTextAreaElement) {
|
|
1238
|
+
let { width: g, height: w } = at(t), S = g || t.getBoundingClientRect().width || 0, b = w || t.getBoundingClientRect().height || 0;
|
|
1239
|
+
S && (f.style.width = `${S}px`), b && (f.style.height = `${b}px`);
|
|
1240
|
+
}
|
|
1241
|
+
if (t instanceof HTMLInputElement) {
|
|
1242
|
+
let g = (t.type || "text").toLowerCase();
|
|
1243
|
+
if ((g === "checkbox" || g === "radio") && ir()) {
|
|
1244
|
+
let { el: w, applyVisual: S } = qr(t);
|
|
1245
|
+
e.nodeMap.set(w, t), y = S, f = w;
|
|
1246
|
+
} else f.value = t.value, f.setAttribute("value", t.value), t.checked !== void 0 && (f.checked = t.checked, t.checked && f.setAttribute("checked", ""), t.indeterminate && (f.indeterminate = t.indeterminate));
|
|
1247
|
+
}
|
|
1248
|
+
if ((t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement) && !t.value && t.placeholder) try {
|
|
1249
|
+
let g = window.getComputedStyle(t, "::placeholder"), w = g && g.color;
|
|
1250
|
+
if (w && w !== "rgba(0, 0, 0, 0)") {
|
|
1251
|
+
let S = "snapdom-ph-" + (Math.random() * 1e6 | 0);
|
|
1252
|
+
f.classList.add(S);
|
|
1253
|
+
let b = document.createElement("style");
|
|
1254
|
+
b.textContent = `.${S}::placeholder{color:${w}!important;opacity:${g.opacity || "1"}!important;}`, f.prepend(b);
|
|
1255
|
+
}
|
|
1256
|
+
} catch {
|
|
1257
|
+
}
|
|
1258
|
+
if (t instanceof HTMLSelectElement && (p = t.value), t instanceof HTMLTextAreaElement && (m = t.value), t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) {
|
|
1259
|
+
t.disabled && f.setAttribute("disabled", ""), t.required && f.setAttribute("required", ""), t.readOnly && f.setAttribute("readonly", "");
|
|
1260
|
+
let g = t;
|
|
1261
|
+
g.min !== void 0 && g.min !== "" && f.setAttribute("min", g.min), g.max !== void 0 && g.max !== "" && f.setAttribute("max", g.max), g.pattern !== void 0 && g.pattern !== "" && f.setAttribute("pattern", g.pattern);
|
|
1262
|
+
let w = t.getAttribute("aria-invalid");
|
|
1263
|
+
w !== null && f.setAttribute("aria-invalid", w);
|
|
1264
|
+
}
|
|
1265
|
+
if (bt(t, f, e, n), y && y(), t instanceof SVGElement) {
|
|
1266
|
+
let g = ["fill", "stroke", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "opacity", "fill-opacity", "stroke-opacity", "fill-rule", "clip-rule", "marker", "marker-start", "marker-mid", "marker-end", "visibility", "display"];
|
|
1267
|
+
try {
|
|
1268
|
+
let w = window.getComputedStyle(t);
|
|
1269
|
+
for (let S of g) {
|
|
1270
|
+
let b = w.getPropertyValue(S);
|
|
1271
|
+
b && f.style.setProperty(S, b);
|
|
1272
|
+
}
|
|
1273
|
+
} catch {
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
if (t.shadowRoot) {
|
|
1277
|
+
let g = function(U, B) {
|
|
1278
|
+
if (U.nodeType === Node.ELEMENT_NODE && U.tagName === "STYLE") return B(null);
|
|
1279
|
+
_t(U, e, n).then((W) => {
|
|
1280
|
+
B(W || null);
|
|
1281
|
+
}).catch(() => {
|
|
1282
|
+
B(null);
|
|
1283
|
+
});
|
|
1284
|
+
};
|
|
1285
|
+
try {
|
|
1286
|
+
let U = t.shadowRoot.querySelectorAll("slot");
|
|
1287
|
+
for (let B of U) {
|
|
1288
|
+
let W = [];
|
|
1289
|
+
try {
|
|
1290
|
+
W = ((s = B.assignedNodes) == null ? void 0 : s.call(B, { flatten: !0 })) || ((c = B.assignedNodes) == null ? void 0 : c.call(B)) || [];
|
|
1291
|
+
} catch {
|
|
1292
|
+
W = ((h = B.assignedNodes) == null ? void 0 : h.call(B)) || [];
|
|
1293
|
+
}
|
|
1294
|
+
for (let I of W) d.add(I);
|
|
1295
|
+
}
|
|
1296
|
+
} catch {
|
|
1297
|
+
}
|
|
1298
|
+
let w = Rr(e), S = `[data-sd="${w}"]`;
|
|
1299
|
+
try {
|
|
1300
|
+
f.setAttribute("data-sd", w);
|
|
1301
|
+
} catch {
|
|
1302
|
+
}
|
|
1303
|
+
let b = Tr(t.shadowRoot), C = Pr(b, S), v = Or(b), F = jr(t, v, S);
|
|
1304
|
+
Wr(f, F + C, w);
|
|
1305
|
+
let E = document.createDocumentFragment(), D = await Kt(Array.from(t.shadowRoot.childNodes), g, n.fast);
|
|
1306
|
+
E.append(...D.filter((U) => !!U)), f.appendChild(E);
|
|
1307
|
+
}
|
|
1308
|
+
if (t.tagName === "SLOT") {
|
|
1309
|
+
let g = function(v, F) {
|
|
1310
|
+
_t(v, e, n).then((E) => {
|
|
1311
|
+
E && _r(E), F(E || null);
|
|
1312
|
+
}).catch(() => {
|
|
1313
|
+
F(null);
|
|
1314
|
+
});
|
|
1315
|
+
}, w = ((u = t.assignedNodes) == null ? void 0 : u.call(t, { flatten: !0 })) || [], S = w.length > 0 ? w : Array.from(t.childNodes), b = document.createDocumentFragment(), C = await Kt(Array.from(S), g, n.fast);
|
|
1316
|
+
return b.append(...C.filter((v) => !!v)), b;
|
|
1317
|
+
}
|
|
1318
|
+
function x(g, w) {
|
|
1319
|
+
if (d.has(g)) return w(null);
|
|
1320
|
+
_t(g, e, n).then((S) => {
|
|
1321
|
+
w(S || null);
|
|
1322
|
+
}).catch(() => {
|
|
1323
|
+
w(null);
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
let $ = await Kt(Array.from(t.childNodes), x, n.fast);
|
|
1327
|
+
if (f.append(...$.filter((g) => !!g)), p !== null && f instanceof HTMLSelectElement) {
|
|
1328
|
+
f.value = p;
|
|
1329
|
+
for (let g of f.options) g.value === p ? g.setAttribute("selected", "") : g.removeAttribute("selected");
|
|
1330
|
+
}
|
|
1331
|
+
return m !== null && f instanceof HTMLTextAreaElement && (f.textContent = m), f;
|
|
1332
|
+
}
|
|
1333
|
+
st();
|
|
1334
|
+
qt();
|
|
1335
|
+
it();
|
|
1336
|
+
var Jr = [/font\s*awesome/i, /material\s*icons/i, /ionicons/i, /glyphicons/i, /feather/i, /bootstrap\s*icons/i, /remix\s*icons/i, /heroicons/i, /layui/i, /lucide/i], vt = Object.assign({ materialIconsFilled: "https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2", materialIconsOutlined: "https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2", materialIconsRound: "https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2", materialIconsSharp: "https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2" }, typeof window < "u" && window.__SNAPDOM_ICON_FONTS__ || {}), le = [];
|
|
1337
|
+
function Kr(t) {
|
|
1338
|
+
let e = Array.isArray(t) ? t : [t];
|
|
1339
|
+
for (let n of e) n instanceof RegExp ? le.push(n) : typeof n == "string" ? le.push(new RegExp(n, "i")) : console.warn("[snapdom] Ignored invalid iconFont value:", n);
|
|
1340
|
+
}
|
|
1341
|
+
function dt(t) {
|
|
1342
|
+
let e = typeof t == "string" ? t : "", n = [...Jr, ...le];
|
|
1343
|
+
for (let r of n) if (r instanceof RegExp && r.test(e)) return !0;
|
|
1344
|
+
return !!(/icon/i.test(e) || /glyph/i.test(e) || /symbols/i.test(e) || /feather/i.test(e) || /fontawesome/i.test(e));
|
|
1345
|
+
}
|
|
1346
|
+
function Qr(t = "") {
|
|
1347
|
+
let e = String(t).toLowerCase();
|
|
1348
|
+
return /\bmaterial\s*icons\b/.test(e) || /\bmaterial\s*symbols\b/.test(e);
|
|
1349
|
+
}
|
|
1350
|
+
var Re = /* @__PURE__ */ new Map();
|
|
1351
|
+
function Zr(t = "") {
|
|
1352
|
+
let e = /* @__PURE__ */ Object.create(null), n = String(t || ""), r = /['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g, l;
|
|
1353
|
+
for (; l = r.exec(n); ) e[l[1].toUpperCase()] = Number(l[2]);
|
|
1354
|
+
return e;
|
|
1355
|
+
}
|
|
1356
|
+
async function tl(t, e, n) {
|
|
1357
|
+
var r;
|
|
1358
|
+
let l = String(t || ""), i = l.toLowerCase(), o = String(e || "").toLowerCase();
|
|
1359
|
+
if (/\bmaterial\s*icons\b/.test(i) && !/\bsymbols\b/.test(i)) return { familyForMeasure: l, familyForCanvas: l };
|
|
1360
|
+
if (!/\bmaterial\s*symbols\b/.test(i)) return { familyForMeasure: l, familyForCanvas: l };
|
|
1361
|
+
let a = n && ((r = n.FILL) != null ? r : n.fill), s = "outlined";
|
|
1362
|
+
/\brounded\b/.test(o) || /\bround\b/.test(o) ? s = "rounded" : /\bsharp\b/.test(o) ? s = "sharp" : /\boutlined\b/.test(o) && (s = "outlined");
|
|
1363
|
+
let c = a === 1, h = null;
|
|
1364
|
+
if (c && (s === "outlined" && vt.materialIconsFilled ? h = { url: vt.materialIconsFilled, alias: "snapdom-mi-filled" } : s === "rounded" && vt.materialIconsRound ? h = { url: vt.materialIconsRound, alias: "snapdom-mi-round" } : s === "sharp" && vt.materialIconsSharp && (h = { url: vt.materialIconsSharp, alias: "snapdom-mi-sharp" })), !h) return { familyForMeasure: l, familyForCanvas: l };
|
|
1365
|
+
if (!Re.has(h.alias)) try {
|
|
1366
|
+
let d = new FontFace(h.alias, `url(${h.url})`, { style: "normal", weight: "400" });
|
|
1367
|
+
document.fonts.add(d), await d.load(), Re.set(h.alias, !0);
|
|
1368
|
+
} catch {
|
|
1369
|
+
return { familyForMeasure: l, familyForCanvas: l };
|
|
1370
|
+
}
|
|
1371
|
+
let u = `"${h.alias}"`;
|
|
1372
|
+
return { familyForMeasure: u, familyForCanvas: u };
|
|
1373
|
+
}
|
|
1374
|
+
async function el(t = "Material Icons", e = 24) {
|
|
1375
|
+
try {
|
|
1376
|
+
await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g, "")}"`), document.fonts.ready]);
|
|
1377
|
+
} catch {
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
function nl(t) {
|
|
1381
|
+
var e, n;
|
|
1382
|
+
let r = ((e = t.getPropertyValue("-webkit-text-fill-color")) == null ? void 0 : e.trim()) || "", l = /^transparent$/i.test(r) || /rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(r);
|
|
1383
|
+
if (r && !l && r.toLowerCase() !== "currentcolor") return r;
|
|
1384
|
+
let i = (n = t.color) == null ? void 0 : n.trim();
|
|
1385
|
+
return i && i !== "inherit" ? i : "#000";
|
|
1386
|
+
}
|
|
1387
|
+
async function rl(t, { family: e = "Material Icons", weight: n = "normal", fontSize: r = 32, color: l = "#000", variation: i = "", className: o = "" } = {}) {
|
|
1388
|
+
let a = String(e || "").replace(/^['"]+|['"]+$/g, ""), s = window.devicePixelRatio || 1, c = Zr(i), { familyForMeasure: h, familyForCanvas: u } = await tl(a, o, c);
|
|
1389
|
+
await el(u.replace(/^["']+|["']+$/g, ""), r);
|
|
1390
|
+
let d = document.createElement("span");
|
|
1391
|
+
d.textContent = t, d.style.position = "absolute", d.style.visibility = "hidden", d.style.left = "-99999px", d.style.whiteSpace = "nowrap", d.style.fontFamily = h, d.style.fontWeight = String(n || "normal"), d.style.fontSize = `${r}px`, d.style.lineHeight = "1", d.style.margin = "0", d.style.padding = "0", d.style.fontFeatureSettings = "'liga' 1", d.style.fontVariantLigatures = "normal", d.style.color = l, document.body.appendChild(d);
|
|
1392
|
+
let p = d.getBoundingClientRect(), m = Math.max(1, Math.ceil(p.width)), f = Math.max(1, Math.ceil(p.height));
|
|
1393
|
+
document.body.removeChild(d);
|
|
1394
|
+
let y = document.createElement("canvas");
|
|
1395
|
+
y.width = m * s, y.height = f * s;
|
|
1396
|
+
let x = y.getContext("2d");
|
|
1397
|
+
x.scale(s, s), x.font = `${n ? `${n} ` : ""}${r}px ${u}`, x.textAlign = "left", x.textBaseline = "top", x.fillStyle = l;
|
|
1398
|
+
try {
|
|
1399
|
+
x.fontKerning = "normal";
|
|
1400
|
+
} catch {
|
|
1401
|
+
}
|
|
1402
|
+
return x.fillText(t, 0, 0), { dataUrl: y.toDataURL(), width: m, height: f };
|
|
1403
|
+
}
|
|
1404
|
+
async function ll(t, e) {
|
|
1405
|
+
if (!(t instanceof Element)) return 0;
|
|
1406
|
+
let n = '.material-icons, [class*="material-symbols"]', r = Array.from(t.querySelectorAll(n)).filter((o) => o && o.textContent && o.textContent.trim());
|
|
1407
|
+
if (r.length === 0) return 0;
|
|
1408
|
+
let l = e instanceof Element ? Array.from(e.querySelectorAll(n)).filter((o) => o && o.textContent && o.textContent.trim()) : [], i = 0;
|
|
1409
|
+
for (let o = 0; o < r.length; o++) {
|
|
1410
|
+
let a = r[o], s = l[o] || null;
|
|
1411
|
+
try {
|
|
1412
|
+
let c = getComputedStyle(s || a), h = c.fontFamily || "Material Icons";
|
|
1413
|
+
if (!Qr(h)) continue;
|
|
1414
|
+
let u = (s || a).textContent.trim();
|
|
1415
|
+
if (!u) continue;
|
|
1416
|
+
let d = parseInt(c.fontSize, 10) || 24, p = c.fontWeight && c.fontWeight !== "normal" ? c.fontWeight : "normal", m = nl(c), f = c.fontVariationSettings && c.fontVariationSettings !== "normal" ? c.fontVariationSettings : "", y = (s || a).className || "", { dataUrl: x, width: $, height: g } = await rl(u, { family: h, weight: p, fontSize: d, color: m, variation: f, className: y });
|
|
1417
|
+
a.textContent = "";
|
|
1418
|
+
let w = a.ownerDocument.createElement("img");
|
|
1419
|
+
w.src = x, w.alt = u, w.style.height = `${d}px`, w.style.width = `${Math.max(1, Math.round($ / g * d))}px`, w.style.objectFit = "contain", w.style.verticalAlign = getComputedStyle(a).verticalAlign || "baseline", a.appendChild(w), i++;
|
|
1420
|
+
} catch {
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
return i;
|
|
1424
|
+
}
|
|
1425
|
+
$t();
|
|
1426
|
+
async function il(t, e, n, r = 32, l = "#000") {
|
|
1427
|
+
e = e.replace(/^['"]+|['"]+$/g, "");
|
|
1428
|
+
let i = window.devicePixelRatio || 1;
|
|
1429
|
+
try {
|
|
1430
|
+
await document.fonts.ready;
|
|
1431
|
+
} catch {
|
|
1432
|
+
}
|
|
1433
|
+
let o = document.createElement("span");
|
|
1434
|
+
o.textContent = t, o.style.position = "absolute", o.style.visibility = "hidden", o.style.fontFamily = `"${e}"`, o.style.fontWeight = n || "normal", o.style.fontSize = `${r}px`, o.style.lineHeight = "1", o.style.whiteSpace = "nowrap", o.style.padding = "0", o.style.margin = "0", document.body.appendChild(o);
|
|
1435
|
+
let a = o.getBoundingClientRect(), s = Math.ceil(a.width), c = Math.ceil(a.height);
|
|
1436
|
+
document.body.removeChild(o);
|
|
1437
|
+
let h = document.createElement("canvas");
|
|
1438
|
+
h.width = Math.max(1, s * i), h.height = Math.max(1, c * i);
|
|
1439
|
+
let u = h.getContext("2d");
|
|
1440
|
+
return u.scale(i, i), u.font = n ? `${n} ${r}px "${e}"` : `${r}px "${e}"`, u.textAlign = "left", u.textBaseline = "top", u.fillStyle = l, u.fillText(t, 0, 0), { dataUrl: h.toDataURL(), width: s, height: c };
|
|
1441
|
+
}
|
|
1442
|
+
var un = /* @__PURE__ */ new Set(["serif", "sans-serif", "monospace", "cursive", "fantasy", "system-ui", "emoji", "math", "fangsong", "ui-serif", "ui-sans-serif", "ui-monospace", "ui-rounded"]), ol = ["katex", "mathjax", "mathml"];
|
|
1443
|
+
function he(t) {
|
|
1444
|
+
if (!t) return "";
|
|
1445
|
+
for (let e of t.split(",")) {
|
|
1446
|
+
let n = e.trim().replace(/^['"]+|['"]+$/g, "");
|
|
1447
|
+
if (n && !un.has(n.toLowerCase())) return n;
|
|
1448
|
+
}
|
|
1449
|
+
return "";
|
|
1450
|
+
}
|
|
1451
|
+
function al(t) {
|
|
1452
|
+
if (!t) return [];
|
|
1453
|
+
let e = [];
|
|
1454
|
+
for (let n of t.split(",")) {
|
|
1455
|
+
let r = n.trim().replace(/^['"]+|['"]+$/g, "");
|
|
1456
|
+
r && (un.has(r.toLowerCase()) || e.push(r));
|
|
1457
|
+
}
|
|
1458
|
+
return e;
|
|
1459
|
+
}
|
|
1460
|
+
function Ht(t) {
|
|
1461
|
+
let e = String(t ?? "400").trim().toLowerCase();
|
|
1462
|
+
if (e === "normal") return 400;
|
|
1463
|
+
if (e === "bold") return 700;
|
|
1464
|
+
let n = parseInt(e, 10);
|
|
1465
|
+
return Number.isFinite(n) ? Math.min(900, Math.max(100, n)) : 400;
|
|
1466
|
+
}
|
|
1467
|
+
function Dt(t) {
|
|
1468
|
+
let e = String(t ?? "normal").trim().toLowerCase();
|
|
1469
|
+
return e.startsWith("italic") ? "italic" : e.startsWith("oblique") ? "oblique" : "normal";
|
|
1470
|
+
}
|
|
1471
|
+
function sl(t) {
|
|
1472
|
+
let e = String(t ?? "100%").match(/(\d+(?:\.\d+)?)\s*%/);
|
|
1473
|
+
return e ? Math.max(50, Math.min(200, parseFloat(e[1]))) : 100;
|
|
1474
|
+
}
|
|
1475
|
+
function ul(t) {
|
|
1476
|
+
let e = String(t || "400").trim(), n = e.match(/^(\d{2,3})\s+(\d{2,3})$/);
|
|
1477
|
+
if (n) {
|
|
1478
|
+
let l = Ht(n[1]), i = Ht(n[2]);
|
|
1479
|
+
return { min: Math.min(l, i), max: Math.max(l, i) };
|
|
1480
|
+
}
|
|
1481
|
+
let r = Ht(e);
|
|
1482
|
+
return { min: r, max: r };
|
|
1483
|
+
}
|
|
1484
|
+
function cl(t) {
|
|
1485
|
+
let e = String(t || "normal").trim().toLowerCase();
|
|
1486
|
+
return e === "italic" ? { kind: "italic" } : e.startsWith("oblique") ? { kind: "oblique" } : { kind: "normal" };
|
|
1487
|
+
}
|
|
1488
|
+
function dl(t) {
|
|
1489
|
+
let e = String(t || "100%").trim(), n = e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);
|
|
1490
|
+
if (n) {
|
|
1491
|
+
let i = parseFloat(n[1]), o = parseFloat(n[2]);
|
|
1492
|
+
return { min: Math.min(i, o), max: Math.max(i, o) };
|
|
1493
|
+
}
|
|
1494
|
+
let r = e.match(/(\d+(?:\.\d+)?)\s*%/), l = r ? parseFloat(r[1]) : 100;
|
|
1495
|
+
return { min: l, max: l };
|
|
1496
|
+
}
|
|
1497
|
+
function fl(t) {
|
|
1498
|
+
return !t || typeof t != "string" ? "" : t.replace(/\s+(variable|vf|v[0-9]+)$/i, "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
1499
|
+
}
|
|
1500
|
+
function ml(t, e, n = []) {
|
|
1501
|
+
if (!t) return !1;
|
|
1502
|
+
try {
|
|
1503
|
+
let r = new URL(t, location.href);
|
|
1504
|
+
if (r.origin === location.origin) return !0;
|
|
1505
|
+
let l = r.host.toLowerCase();
|
|
1506
|
+
if (["fonts.googleapis.com", "fonts.gstatic.com", "use.typekit.net", "p.typekit.net", "kit.fontawesome.com", "use.fontawesome.com", "cdn.jsdelivr.net", "unpkg.com", "cdnjs.cloudflare.com", "esm.sh"].some((o) => l.endsWith(o)) || n.some((o) => l === o.toLowerCase() || l.endsWith("." + o.toLowerCase()))) return !0;
|
|
1507
|
+
let i = (r.pathname + r.search).toLowerCase();
|
|
1508
|
+
if (/\bfont(s)?\b/.test(i) || /\.woff2?(\b|$)/.test(i) || ol.some((o) => i.includes(o))) return !0;
|
|
1509
|
+
for (let o of e) {
|
|
1510
|
+
let a = o.toLowerCase().replace(/\s+/g, "+"), s = o.toLowerCase().replace(/\s+/g, "-"), c = fl(o);
|
|
1511
|
+
if (i.includes(a) || i.includes(s) || c && i.includes(c)) return !0;
|
|
1512
|
+
}
|
|
1513
|
+
return !1;
|
|
1514
|
+
} catch {
|
|
1515
|
+
return !1;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
function hl(t) {
|
|
1519
|
+
var e;
|
|
1520
|
+
let n = /* @__PURE__ */ new Set();
|
|
1521
|
+
for (let r of t || []) {
|
|
1522
|
+
let l = (e = String(r).split("__")[0]) == null ? void 0 : e.trim();
|
|
1523
|
+
l && n.add(l);
|
|
1524
|
+
}
|
|
1525
|
+
return n;
|
|
1526
|
+
}
|
|
1527
|
+
function Te(t, e) {
|
|
1528
|
+
return t && t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g, (n, r, l) => {
|
|
1529
|
+
let i = (l || "").trim();
|
|
1530
|
+
if (!i || /^data:|^blob:|^https?:|^file:|^about:/i.test(i)) return n;
|
|
1531
|
+
let o = i;
|
|
1532
|
+
try {
|
|
1533
|
+
o = new URL(i, e || location.href).href;
|
|
1534
|
+
} catch {
|
|
1535
|
+
}
|
|
1536
|
+
return `url("${o}")`;
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
var ie = /@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g, Vt = 4;
|
|
1540
|
+
async function pl(t, e, n) {
|
|
1541
|
+
if (!t) return t;
|
|
1542
|
+
let r = /* @__PURE__ */ new Set();
|
|
1543
|
+
function l(a, s) {
|
|
1544
|
+
try {
|
|
1545
|
+
return new URL(a, s || location.href).href;
|
|
1546
|
+
} catch {
|
|
1547
|
+
return a;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
async function i(a, s, c = 0) {
|
|
1551
|
+
if (c > Vt) return console.warn(`[snapDOM] @import depth exceeded (${Vt}) at ${s}`), a;
|
|
1552
|
+
let h = "", u = 0, d;
|
|
1553
|
+
for (; d = ie.exec(a); ) {
|
|
1554
|
+
h += a.slice(u, d.index), u = ie.lastIndex;
|
|
1555
|
+
let p = (d[2] || d[4] || "").trim(), m = l(p, s);
|
|
1556
|
+
if (r.has(m)) {
|
|
1557
|
+
console.warn(`[snapDOM] Skipping circular @import: ${m}`);
|
|
1558
|
+
continue;
|
|
1559
|
+
}
|
|
1560
|
+
r.add(m);
|
|
1561
|
+
let f = "";
|
|
1562
|
+
try {
|
|
1563
|
+
let y = await lt(m, { as: "text", useProxy: n, silent: !0 });
|
|
1564
|
+
y.ok && typeof y.data == "string" && (f = y.data);
|
|
1565
|
+
} catch {
|
|
1566
|
+
}
|
|
1567
|
+
f ? (f = Te(f, m), f = await i(f, m, c + 1), h += `
|
|
1568
|
+
/* inlined: ${m} */
|
|
1569
|
+
${f}
|
|
1570
|
+
`) : h += d[0];
|
|
1571
|
+
}
|
|
1572
|
+
return h += a.slice(u), h;
|
|
1573
|
+
}
|
|
1574
|
+
let o = Te(t, e || location.href);
|
|
1575
|
+
return o = await i(o, e || location.href, 0), o;
|
|
1576
|
+
}
|
|
1577
|
+
var cn = /url\((["']?)([^"')]+)\1\)/g, gl = /@font-face[^{}]*\{[^}]*\}/g;
|
|
1578
|
+
function dn(t) {
|
|
1579
|
+
if (!t) return [];
|
|
1580
|
+
let e = [], n = t.split(",").map((r) => r.trim()).filter(Boolean);
|
|
1581
|
+
for (let r of n) {
|
|
1582
|
+
let l = r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);
|
|
1583
|
+
if (!l) continue;
|
|
1584
|
+
let i = l[1], o = l[2], a = (s) => {
|
|
1585
|
+
if (!s.includes("?")) return parseInt(s, 16);
|
|
1586
|
+
let c = parseInt(s.replace(/\?/g, "0"), 16), h = parseInt(s.replace(/\?/g, "F"), 16);
|
|
1587
|
+
return [c, h];
|
|
1588
|
+
};
|
|
1589
|
+
if (o) {
|
|
1590
|
+
let s = a(i), c = a(o), h = Array.isArray(s) ? s[0] : s, u = Array.isArray(c) ? c[1] : c;
|
|
1591
|
+
e.push([Math.min(h, u), Math.max(h, u)]);
|
|
1592
|
+
} else {
|
|
1593
|
+
let s = a(i);
|
|
1594
|
+
Array.isArray(s) ? e.push([s[0], s[1]]) : e.push([s, s]);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
return e;
|
|
1598
|
+
}
|
|
1599
|
+
function fn(t, e) {
|
|
1600
|
+
if (!e.length || !t || t.size === 0) return !0;
|
|
1601
|
+
for (let n of t) for (let [r, l] of e) if (n >= r && n <= l) return !0;
|
|
1602
|
+
return !1;
|
|
1603
|
+
}
|
|
1604
|
+
function pe(t, e) {
|
|
1605
|
+
let n = [];
|
|
1606
|
+
if (!t) return n;
|
|
1607
|
+
for (let r of t.matchAll(cn)) {
|
|
1608
|
+
let l = (r[2] || "").trim();
|
|
1609
|
+
if (!(!l || l.startsWith("data:"))) {
|
|
1610
|
+
if (!/^https?:/i.test(l)) try {
|
|
1611
|
+
l = new URL(l, e || location.href).href;
|
|
1612
|
+
} catch {
|
|
1613
|
+
}
|
|
1614
|
+
n.push(l);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
return n;
|
|
1618
|
+
}
|
|
1619
|
+
async function mn(t, e, n = "") {
|
|
1620
|
+
var r, l, i, o, a;
|
|
1621
|
+
let s = t;
|
|
1622
|
+
for (let c of t.matchAll(cn)) {
|
|
1623
|
+
let h = de(c[0]);
|
|
1624
|
+
if (!h) continue;
|
|
1625
|
+
let u = h;
|
|
1626
|
+
if (!u.startsWith("http") && !u.startsWith("data:")) try {
|
|
1627
|
+
u = new URL(u, e || location.href).href;
|
|
1628
|
+
} catch {
|
|
1629
|
+
}
|
|
1630
|
+
if (!dt(u)) {
|
|
1631
|
+
if ((r = k.resource) != null && r.has(u)) {
|
|
1632
|
+
(l = k.font) == null || l.add(u), s = s.replace(c[0], `url(${k.resource.get(u)})`);
|
|
1633
|
+
continue;
|
|
1634
|
+
}
|
|
1635
|
+
if (!((i = k.font) != null && i.has(u))) try {
|
|
1636
|
+
let d = await lt(u, { as: "dataURL", useProxy: n, silent: !0 });
|
|
1637
|
+
if (d.ok && typeof d.data == "string") {
|
|
1638
|
+
let p = d.data;
|
|
1639
|
+
(o = k.resource) == null || o.set(u, p), (a = k.font) == null || a.add(u), s = s.replace(c[0], `url(${p})`);
|
|
1640
|
+
}
|
|
1641
|
+
} catch {
|
|
1642
|
+
console.warn("[snapDOM] Failed to fetch font resource:", u);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
return s;
|
|
1647
|
+
}
|
|
1648
|
+
function yl(t) {
|
|
1649
|
+
if (!t.length) return null;
|
|
1650
|
+
let e = (o, a) => t.some(([s, c]) => !(c < o || s > a)), n = e(0, 255) || e(305, 305), r = e(256, 591) || e(7680, 7935), l = e(880, 1023), i = e(1024, 1279);
|
|
1651
|
+
return e(7840, 7929) || e(258, 259) || e(416, 417) || e(431, 432) ? "vietnamese" : i ? "cyrillic" : l ? "greek" : r ? "latin-ext" : n ? "latin" : null;
|
|
1652
|
+
}
|
|
1653
|
+
function We(t = {}) {
|
|
1654
|
+
let e = new Set((t.families || []).map((l) => String(l).toLowerCase())), n = new Set((t.domains || []).map((l) => String(l).toLowerCase())), r = new Set((t.subsets || []).map((l) => String(l).toLowerCase()));
|
|
1655
|
+
return (l, i) => {
|
|
1656
|
+
if (e.size && e.has(l.family.toLowerCase())) return !0;
|
|
1657
|
+
if (n.size) for (let o of l.srcUrls) try {
|
|
1658
|
+
if (n.has(new URL(o).host.toLowerCase())) return !0;
|
|
1659
|
+
} catch {
|
|
1660
|
+
}
|
|
1661
|
+
if (r.size) {
|
|
1662
|
+
let o = yl(i);
|
|
1663
|
+
if (o && r.has(o)) return !0;
|
|
1664
|
+
}
|
|
1665
|
+
return !1;
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
function wl(t) {
|
|
1669
|
+
var e, n, r, l, i, o;
|
|
1670
|
+
if (!t) return t;
|
|
1671
|
+
let a = /@font-face[^{}]*\{[^}]*\}/gi, s = /* @__PURE__ */ new Set(), c = [];
|
|
1672
|
+
for (let u of t.match(a) || []) {
|
|
1673
|
+
let d = ((e = u.match(/font-family:\s*([^;]+);/i)) == null ? void 0 : e[1]) || "", p = he(d), m = (((n = u.match(/font-weight:\s*([^;]+);/i)) == null ? void 0 : n[1]) || "400").trim(), f = (((r = u.match(/font-style:\s*([^;]+);/i)) == null ? void 0 : r[1]) || "normal").trim(), y = (((l = u.match(/font-stretch:\s*([^;]+);/i)) == null ? void 0 : l[1]) || "100%").trim(), x = (((i = u.match(/unicode-range:\s*([^;]+);/i)) == null ? void 0 : i[1]) || "").trim(), $ = (((o = u.match(/src\s*:\s*([^;}]+)[;}]/i)) == null ? void 0 : o[1]) || "").trim(), g = pe($, location.href), w = g.length ? g.map((b) => String(b).toLowerCase()).sort().join("|") : $.toLowerCase(), S = [String(p || "").toLowerCase(), m, f, y, x.toLowerCase(), w].join("|");
|
|
1674
|
+
s.has(S) || (s.add(S), c.push(u));
|
|
1675
|
+
}
|
|
1676
|
+
if (c.length === 0) return t;
|
|
1677
|
+
let h = 0;
|
|
1678
|
+
return t.replace(a, () => c[h++] || "");
|
|
1679
|
+
}
|
|
1680
|
+
function bl(t, e, n, r, l) {
|
|
1681
|
+
let i = Array.from(t || []).sort().join("|"), o = e ? JSON.stringify({ families: (e.families || []).map((h) => String(h).toLowerCase()).sort(), domains: (e.domains || []).map((h) => String(h).toLowerCase()).sort(), subsets: (e.subsets || []).map((h) => String(h).toLowerCase()).sort() }) : "", a = (n || []).map((h) => `${(h.family || "").toLowerCase()}::${h.weight || "normal"}::${h.style || "normal"}::${h.src || ""}`).sort().join("|"), s = r || "", c = (l || []).map((h) => String(h).toLowerCase()).sort().join("|");
|
|
1682
|
+
return `fonts-embed-css::req=${i}::ex=${o}::lf=${a}::px=${s}::fd=${c}`;
|
|
1683
|
+
}
|
|
1684
|
+
async function hn(t, e, n, r) {
|
|
1685
|
+
let l;
|
|
1686
|
+
try {
|
|
1687
|
+
l = t.cssRules || [];
|
|
1688
|
+
} catch {
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
let i = (o, a) => {
|
|
1692
|
+
try {
|
|
1693
|
+
return new URL(o, a || location.href).href;
|
|
1694
|
+
} catch {
|
|
1695
|
+
return o;
|
|
1696
|
+
}
|
|
1697
|
+
};
|
|
1698
|
+
for (let o of l) {
|
|
1699
|
+
if (o.type === CSSRule.IMPORT_RULE && o.styleSheet) {
|
|
1700
|
+
let a = o.href ? i(o.href, e) : e;
|
|
1701
|
+
if (r.depth >= Vt) {
|
|
1702
|
+
console.warn(`[snapDOM] CSSOM import depth exceeded (${Vt}) at ${a}`);
|
|
1703
|
+
continue;
|
|
1704
|
+
}
|
|
1705
|
+
if (a && r.visitedSheets.has(a)) {
|
|
1706
|
+
console.warn(`[snapDOM] Skipping circular CSSOM import: ${a}`);
|
|
1707
|
+
continue;
|
|
1708
|
+
}
|
|
1709
|
+
a && r.visitedSheets.add(a);
|
|
1710
|
+
let s = J(O({}, r), { depth: (r.depth || 0) + 1 });
|
|
1711
|
+
await hn(o.styleSheet, a, n, s);
|
|
1712
|
+
continue;
|
|
1713
|
+
}
|
|
1714
|
+
if (o.type === CSSRule.FONT_FACE_RULE) {
|
|
1715
|
+
let a = (o.style.getPropertyValue("font-family") || "").trim(), s = he(a);
|
|
1716
|
+
if (!s || dt(s)) continue;
|
|
1717
|
+
let c = (o.style.getPropertyValue("font-weight") || "400").trim(), h = (o.style.getPropertyValue("font-style") || "normal").trim(), u = (o.style.getPropertyValue("font-stretch") || "100%").trim(), d = (o.style.getPropertyValue("src") || "").trim(), p = (o.style.getPropertyValue("unicode-range") || "").trim();
|
|
1718
|
+
if (!r.faceMatchesRequired(s, h, c, u)) continue;
|
|
1719
|
+
let m = dn(p);
|
|
1720
|
+
if (!fn(r.usedCodepoints, m)) continue;
|
|
1721
|
+
let f = { family: s, weightSpec: c, styleSpec: h, stretchSpec: u, unicodeRange: p, srcRaw: d, srcUrls: pe(d, e || location.href), href: e || location.href };
|
|
1722
|
+
if (r.simpleExcluder && r.simpleExcluder(f, m)) continue;
|
|
1723
|
+
if (/url\(/i.test(d)) {
|
|
1724
|
+
let y = await mn(d, e || location.href, r.useProxy);
|
|
1725
|
+
await n(`@font-face{font-family:${s};src:${y};font-style:${h};font-weight:${c};font-stretch:${u};${p ? `unicode-range:${p};` : ""}}`);
|
|
1726
|
+
} else await n(`@font-face{font-family:${s};src:${d};font-style:${h};font-weight:${c};font-stretch:${u};${p ? `unicode-range:${p};` : ""}}`);
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
async function xl({ required: t, usedCodepoints: e, exclude: n = void 0, localFonts: r = [], useProxy: l = "", fontStylesheetDomains: i = [] } = {}) {
|
|
1731
|
+
var o, a, s, c, h, u, d, p, m, f, y, x, $, g, w, S, b, C;
|
|
1732
|
+
t instanceof Set || (t = /* @__PURE__ */ new Set()), e instanceof Set || (e = /* @__PURE__ */ new Set());
|
|
1733
|
+
let v = /* @__PURE__ */ new Map();
|
|
1734
|
+
for (let M of t) {
|
|
1735
|
+
let [P, T, _, A] = String(M).split("__");
|
|
1736
|
+
if (!P) continue;
|
|
1737
|
+
let N = v.get(P) || [];
|
|
1738
|
+
N.push({ w: parseInt(T, 10), s: _, st: parseInt(A, 10) }), v.set(P, N);
|
|
1739
|
+
}
|
|
1740
|
+
function F(M, P, T, _) {
|
|
1741
|
+
if (!v.has(M)) return !1;
|
|
1742
|
+
let A = v.get(M), N = ul(T), j = cl(P), R = dl(_), X = N.min !== N.max, Y = N.min, Z = (H) => j.kind === "normal" && H === "normal" || j.kind !== "normal" && (H === "italic" || H === "oblique"), tt = !1;
|
|
1743
|
+
for (let H of A) {
|
|
1744
|
+
let G = X ? H.w >= N.min && H.w <= N.max : H.w === Y, K = Z(Dt(H.s)), ht = H.st >= R.min && H.st <= R.max;
|
|
1745
|
+
if (G && K && ht) {
|
|
1746
|
+
tt = !0;
|
|
1747
|
+
break;
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
if (tt) return !0;
|
|
1751
|
+
if (!X) for (let H of A) {
|
|
1752
|
+
let G = Z(Dt(H.s)), K = H.st >= R.min && H.st <= R.max;
|
|
1753
|
+
if (Math.abs(Y - H.w) <= 300 && G && K) return !0;
|
|
1754
|
+
}
|
|
1755
|
+
if (!X && j.kind === "normal" && A.some((H) => Dt(H.s) !== "normal")) for (let H of A) {
|
|
1756
|
+
let G = Math.abs(Y - H.w) <= 300, K = H.st >= R.min && H.st <= R.max;
|
|
1757
|
+
if (G && K) return !0;
|
|
1758
|
+
}
|
|
1759
|
+
return !1;
|
|
1760
|
+
}
|
|
1761
|
+
let E = We(n), D = bl(t, n, r, l, i);
|
|
1762
|
+
if ((o = k.resource) != null && o.has(D)) return k.resource.get(D);
|
|
1763
|
+
let U = hl(t), B = [], W = ie;
|
|
1764
|
+
for (let M of document.querySelectorAll("style")) {
|
|
1765
|
+
let P = M.textContent || "";
|
|
1766
|
+
for (let T of P.matchAll(W)) {
|
|
1767
|
+
let _ = (T[2] || T[4] || "").trim();
|
|
1768
|
+
!_ || dt(_) || document.querySelector(`link[rel="stylesheet"][href="${_}"]`) || B.push(_);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
B.length && await Promise.all(B.map((M) => new Promise((P) => {
|
|
1772
|
+
if (document.querySelector(`link[rel="stylesheet"][href="${M}"]`)) return P(null);
|
|
1773
|
+
let T = document.createElement("link");
|
|
1774
|
+
T.rel = "stylesheet", T.href = M, T.setAttribute("data-snapdom", "injected-import"), T.onload = () => P(T), T.onerror = () => P(null), document.head.appendChild(T);
|
|
1775
|
+
})));
|
|
1776
|
+
let I = "", z = Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter((M) => !!M.href);
|
|
1777
|
+
for (let M of z) try {
|
|
1778
|
+
if (dt(M.href)) continue;
|
|
1779
|
+
let P = "", T = !1;
|
|
1780
|
+
try {
|
|
1781
|
+
T = new URL(M.href, location.href).origin === location.origin;
|
|
1782
|
+
} catch {
|
|
1783
|
+
}
|
|
1784
|
+
if (!T) {
|
|
1785
|
+
let A = Array.isArray(i) ? i : [];
|
|
1786
|
+
if (!ml(M.href, U, A)) continue;
|
|
1787
|
+
}
|
|
1788
|
+
if (T) {
|
|
1789
|
+
let A = Array.from(document.styleSheets).find((N) => N.href === M.href);
|
|
1790
|
+
if (A) try {
|
|
1791
|
+
let N = A.cssRules || [];
|
|
1792
|
+
P = Array.from(N).map((j) => j.cssText).join("");
|
|
1793
|
+
} catch {
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
if (!P) {
|
|
1797
|
+
let A = await lt(M.href, { as: "text", useProxy: l });
|
|
1798
|
+
if (A != null && A.ok && typeof A.data == "string" && (P = A.data), dt(M.href)) continue;
|
|
1799
|
+
}
|
|
1800
|
+
P = await pl(P, M.href, l);
|
|
1801
|
+
let _ = "";
|
|
1802
|
+
for (let A of P.match(gl) || []) {
|
|
1803
|
+
let N = (((a = A.match(/font-family:\s*([^;]+);/i)) == null ? void 0 : a[1]) || "").trim(), j = he(N);
|
|
1804
|
+
if (!j || dt(j)) continue;
|
|
1805
|
+
let R = (((s = A.match(/font-weight:\s*([^;]+);/i)) == null ? void 0 : s[1]) || "400").trim(), X = (((c = A.match(/font-style:\s*([^;]+);/i)) == null ? void 0 : c[1]) || "normal").trim(), Y = (((h = A.match(/font-stretch:\s*([^;]+);/i)) == null ? void 0 : h[1]) || "100%").trim(), Z = (((u = A.match(/unicode-range:\s*([^;]+);/i)) == null ? void 0 : u[1]) || "").trim(), tt = (((d = A.match(/src\s*:\s*([^;}]+)[;}]/i)) == null ? void 0 : d[1]) || "").trim(), H = pe(tt, M.href);
|
|
1806
|
+
if (!F(j, X, R, Y)) continue;
|
|
1807
|
+
let G = dn(Z);
|
|
1808
|
+
if (!fn(e, G)) continue;
|
|
1809
|
+
let K = { family: j, weightSpec: R, styleSpec: X, stretchSpec: Y, unicodeRange: Z, srcRaw: tt, srcUrls: H, href: M.href };
|
|
1810
|
+
if (n && E(K, G)) continue;
|
|
1811
|
+
let ht = /url\(/i.test(tt) ? await mn(A, M.href, l) : A;
|
|
1812
|
+
_ += ht;
|
|
1813
|
+
}
|
|
1814
|
+
_.trim() && (I += _);
|
|
1815
|
+
} catch {
|
|
1816
|
+
console.warn("[snapDOM] Failed to process stylesheet:", M.href);
|
|
1817
|
+
}
|
|
1818
|
+
let mt = { requiredIndex: v, usedCodepoints: e, faceMatchesRequired: F, simpleExcluder: n ? We(n) : null, useProxy: l, visitedSheets: /* @__PURE__ */ new Set(), depth: 0 };
|
|
1819
|
+
for (let M of document.styleSheets) if (!(M.href && z.some((P) => P.href === M.href))) try {
|
|
1820
|
+
let P = M.href || location.origin + "/";
|
|
1821
|
+
P && mt.visitedSheets.add(P), await hn(M, P, async (T) => {
|
|
1822
|
+
I += T;
|
|
1823
|
+
}, mt);
|
|
1824
|
+
} catch {
|
|
1825
|
+
}
|
|
1826
|
+
try {
|
|
1827
|
+
for (let M of document.fonts || []) {
|
|
1828
|
+
if (!M || !M.family || M.status !== "loaded" || !M._snapdomSrc) continue;
|
|
1829
|
+
let P = String(M.family).replace(/^['"]+|['"]+$/g, "");
|
|
1830
|
+
if (dt(P) || !v.has(P) || n != null && n.families && n.families.some((_) => String(_).toLowerCase() === P.toLowerCase())) continue;
|
|
1831
|
+
let T = M._snapdomSrc;
|
|
1832
|
+
if (!String(T).startsWith("data:")) {
|
|
1833
|
+
if ((p = k.resource) != null && p.has(M._snapdomSrc)) T = k.resource.get(M._snapdomSrc), (m = k.font) == null || m.add(M._snapdomSrc);
|
|
1834
|
+
else if (!((f = k.font) != null && f.has(M._snapdomSrc))) try {
|
|
1835
|
+
let _ = await lt(M._snapdomSrc, { as: "dataURL", useProxy: l, silent: !0 });
|
|
1836
|
+
if (_.ok && typeof _.data == "string") T = _.data, (y = k.resource) == null || y.set(M._snapdomSrc, T), (x = k.font) == null || x.add(M._snapdomSrc);
|
|
1837
|
+
else continue;
|
|
1838
|
+
} catch {
|
|
1839
|
+
console.warn("[snapDOM] Failed to fetch dynamic font src:", M._snapdomSrc);
|
|
1840
|
+
continue;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
I += `@font-face{font-family:'${P}';src:url(${T});font-style:${M.style || "normal"};font-weight:${M.weight || "normal"};}`;
|
|
1844
|
+
}
|
|
1845
|
+
} catch {
|
|
1846
|
+
}
|
|
1847
|
+
for (let M of r) {
|
|
1848
|
+
if (!M || typeof M != "object") continue;
|
|
1849
|
+
let P = String(M.family || "").replace(/^['"]+|['"]+$/g, "");
|
|
1850
|
+
if (!P || dt(P) || !v.has(P) || n != null && n.families && n.families.some((R) => String(R).toLowerCase() === P.toLowerCase())) continue;
|
|
1851
|
+
let T = M.weight != null ? String(M.weight) : "normal", _ = M.style != null ? String(M.style) : "normal", A = M.stretchPct != null ? `${M.stretchPct}%` : "100%", N = String(M.src || ""), j = N;
|
|
1852
|
+
if (!j.startsWith("data:")) {
|
|
1853
|
+
if (($ = k.resource) != null && $.has(N)) j = k.resource.get(N), (g = k.font) == null || g.add(N);
|
|
1854
|
+
else if (!((w = k.font) != null && w.has(N))) try {
|
|
1855
|
+
let R = await lt(N, { as: "dataURL", useProxy: l, silent: !0 });
|
|
1856
|
+
if (R.ok && typeof R.data == "string") j = R.data, (S = k.resource) == null || S.set(N, j), (b = k.font) == null || b.add(N);
|
|
1857
|
+
else continue;
|
|
1858
|
+
} catch {
|
|
1859
|
+
console.warn("[snapDOM] Failed to fetch localFonts src:", N);
|
|
1860
|
+
continue;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
I += `@font-face{font-family:'${P}';src:url(${j});font-style:${_};font-weight:${T};font-stretch:${A};}`;
|
|
1864
|
+
}
|
|
1865
|
+
return I && (I = wl(I), (C = k.resource) == null || C.set(D, I)), I;
|
|
1866
|
+
}
|
|
1867
|
+
function pn(t) {
|
|
1868
|
+
let e = /* @__PURE__ */ new Set();
|
|
1869
|
+
if (!t) return e;
|
|
1870
|
+
let n = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, null), r = (o) => {
|
|
1871
|
+
let a = al(o.fontFamily);
|
|
1872
|
+
if (a.length) for (let s of a) {
|
|
1873
|
+
let c = (h, u, d) => `${s}__${Ht(h)}__${Dt(u)}__${sl(d)}`;
|
|
1874
|
+
e.add(c(o.fontWeight, o.fontStyle, o.fontStretch));
|
|
1875
|
+
}
|
|
1876
|
+
};
|
|
1877
|
+
r(getComputedStyle(t));
|
|
1878
|
+
let l = getComputedStyle(t, "::before");
|
|
1879
|
+
l && l.content && l.content !== "none" && r(l);
|
|
1880
|
+
let i = getComputedStyle(t, "::after");
|
|
1881
|
+
for (i && i.content && i.content !== "none" && r(i); n.nextNode(); ) {
|
|
1882
|
+
let o = n.currentNode, a = getComputedStyle(o);
|
|
1883
|
+
r(a);
|
|
1884
|
+
let s = getComputedStyle(o, "::before");
|
|
1885
|
+
s && s.content && s.content !== "none" && r(s);
|
|
1886
|
+
let c = getComputedStyle(o, "::after");
|
|
1887
|
+
c && c.content && c.content !== "none" && r(c);
|
|
1888
|
+
}
|
|
1889
|
+
return e;
|
|
1890
|
+
}
|
|
1891
|
+
function vl(t) {
|
|
1892
|
+
var e;
|
|
1893
|
+
let n = /* @__PURE__ */ new Set(), r = (i) => {
|
|
1894
|
+
if (i) for (let o of i) n.add(o.codePointAt(0));
|
|
1895
|
+
}, l = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null);
|
|
1896
|
+
for (; l.nextNode(); ) {
|
|
1897
|
+
let i = l.currentNode;
|
|
1898
|
+
if (i.nodeType === Node.TEXT_NODE) r(i.nodeValue || "");
|
|
1899
|
+
else if (i.nodeType === Node.ELEMENT_NODE) {
|
|
1900
|
+
let o = i;
|
|
1901
|
+
for (let a of ["::before", "::after"]) {
|
|
1902
|
+
let s = (e = getComputedStyle(o, a)) == null ? void 0 : e.getPropertyValue("content");
|
|
1903
|
+
if (!(!s || s === "none")) if (/^"/.test(s) || /^'/.test(s)) r(s.slice(1, -1));
|
|
1904
|
+
else {
|
|
1905
|
+
let c = s.match(/\\[0-9A-Fa-f]{1,6}/g);
|
|
1906
|
+
if (c) for (let h of c) try {
|
|
1907
|
+
n.add(parseInt(h.slice(1), 16));
|
|
1908
|
+
} catch {
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
return n;
|
|
1915
|
+
}
|
|
1916
|
+
async function gn(t, e = 2) {
|
|
1917
|
+
try {
|
|
1918
|
+
await document.fonts.ready;
|
|
1919
|
+
} catch {
|
|
1920
|
+
}
|
|
1921
|
+
let n = Array.from(t || []).filter(Boolean);
|
|
1922
|
+
if (n.length === 0) return;
|
|
1923
|
+
let r = () => {
|
|
1924
|
+
let l = document.createElement("div");
|
|
1925
|
+
l.style.cssText = "position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";
|
|
1926
|
+
for (let i of n) {
|
|
1927
|
+
let o = document.createElement("span");
|
|
1928
|
+
o.textContent = "AaBbGg1234ÁÉÍÓÚçñ—∞", o.style.fontFamily = `"${i}"`, o.style.fontWeight = "700", o.style.fontStyle = "italic", o.style.fontSize = "32px", o.style.lineHeight = "1", o.style.whiteSpace = "nowrap", o.style.margin = "0", o.style.padding = "0", l.appendChild(o);
|
|
1929
|
+
}
|
|
1930
|
+
document.body.appendChild(l), l.offsetWidth, document.body.removeChild(l);
|
|
1931
|
+
};
|
|
1932
|
+
for (let l = 0; l < Math.max(1, e); l++) r(), await new Promise((i) => requestAnimationFrame(() => requestAnimationFrame(i)));
|
|
1933
|
+
}
|
|
1934
|
+
it();
|
|
1935
|
+
function Sl(t) {
|
|
1936
|
+
return /\bcounter\s*\(|\bcounters\s*\(/.test(t || "");
|
|
1937
|
+
}
|
|
1938
|
+
function Cl(t) {
|
|
1939
|
+
return (t || "").replace(/"([^"]*)"/g, "$1");
|
|
1940
|
+
}
|
|
1941
|
+
function Ie(t, e = !1) {
|
|
1942
|
+
let n = "", r = Math.max(1, t);
|
|
1943
|
+
for (; r > 0; ) r--, n = String.fromCharCode(97 + r % 26) + n, r = Math.floor(r / 26);
|
|
1944
|
+
return e ? n.toUpperCase() : n;
|
|
1945
|
+
}
|
|
1946
|
+
function Oe(t, e = !0) {
|
|
1947
|
+
let n = [[1e3, "M"], [900, "CM"], [500, "D"], [400, "CD"], [100, "C"], [90, "XC"], [50, "L"], [40, "XL"], [10, "X"], [9, "IX"], [5, "V"], [4, "IV"], [1, "I"]], r = Math.max(1, Math.min(3999, t)), l = "";
|
|
1948
|
+
for (let [i, o] of n) for (; r >= i; ) l += o, r -= i;
|
|
1949
|
+
return e ? l : l.toLowerCase();
|
|
1950
|
+
}
|
|
1951
|
+
function Ue(t, e) {
|
|
1952
|
+
switch ((e || "decimal").toLowerCase()) {
|
|
1953
|
+
case "decimal":
|
|
1954
|
+
return String(t);
|
|
1955
|
+
case "decimal-leading-zero": {
|
|
1956
|
+
let n = Math.abs(t);
|
|
1957
|
+
return (t < 0 ? "-" : "") + (n < 10 ? "0" : "") + String(n);
|
|
1958
|
+
}
|
|
1959
|
+
case "lower-alpha":
|
|
1960
|
+
return Ie(t, !1);
|
|
1961
|
+
case "upper-alpha":
|
|
1962
|
+
return Ie(t, !0);
|
|
1963
|
+
case "lower-roman":
|
|
1964
|
+
return Oe(t, !1);
|
|
1965
|
+
case "upper-roman":
|
|
1966
|
+
return Oe(t, !0);
|
|
1967
|
+
default:
|
|
1968
|
+
return String(t);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
function Ml(t) {
|
|
1972
|
+
let e = () => {
|
|
1973
|
+
var d, p;
|
|
1974
|
+
return (p = (d = k?.session) == null ? void 0 : d.__counterEpoch) != null ? p : 0;
|
|
1975
|
+
}, n = e(), r = /* @__PURE__ */ new WeakMap(), l = t instanceof Document ? t.documentElement : t, i = (d) => d && d.tagName === "LI", o = (d) => {
|
|
1976
|
+
let p = 0, m = d?.parentElement;
|
|
1977
|
+
if (!m) return 0;
|
|
1978
|
+
for (let f of m.children) {
|
|
1979
|
+
if (f === d) break;
|
|
1980
|
+
f.tagName === "LI" && p++;
|
|
1981
|
+
}
|
|
1982
|
+
return p;
|
|
1983
|
+
}, a = (d) => {
|
|
1984
|
+
let p = /* @__PURE__ */ new Map();
|
|
1985
|
+
for (let [m, f] of d) p.set(m, f.slice());
|
|
1986
|
+
return p;
|
|
1987
|
+
}, s = (d, p, m) => {
|
|
1988
|
+
var f, y, x;
|
|
1989
|
+
let $ = a(d), g;
|
|
1990
|
+
try {
|
|
1991
|
+
g = ((f = m.style) == null ? void 0 : f.counterReset) || getComputedStyle(m).counterReset;
|
|
1992
|
+
} catch {
|
|
1993
|
+
}
|
|
1994
|
+
if (g && g !== "none") for (let b of g.split(",")) {
|
|
1995
|
+
let C = b.trim().split(/\s+/), v = C[0], F = Number.isFinite(Number(C[1])) ? Number(C[1]) : 0;
|
|
1996
|
+
if (!v) continue;
|
|
1997
|
+
let E = p.get(v);
|
|
1998
|
+
if (E && E.length) {
|
|
1999
|
+
let D = E.slice();
|
|
2000
|
+
D.push(F), $.set(v, D);
|
|
2001
|
+
} else $.set(v, [F]);
|
|
2002
|
+
}
|
|
2003
|
+
let w;
|
|
2004
|
+
try {
|
|
2005
|
+
w = ((y = m.style) == null ? void 0 : y.counterSet) || getComputedStyle(m).counterSet;
|
|
2006
|
+
} catch {
|
|
2007
|
+
}
|
|
2008
|
+
if (w && w !== "none") for (let b of w.split(",")) {
|
|
2009
|
+
let C = b.trim().split(/\s+/), v = C[0], F = Number.isFinite(Number(C[1])) ? Number(C[1]) : 0;
|
|
2010
|
+
if (!v) continue;
|
|
2011
|
+
let E = $.get(v) || [];
|
|
2012
|
+
E.length === 0 && E.push(0), E[E.length - 1] = F, $.set(v, E);
|
|
2013
|
+
}
|
|
2014
|
+
let S;
|
|
2015
|
+
try {
|
|
2016
|
+
S = ((x = m.style) == null ? void 0 : x.counterIncrement) || getComputedStyle(m).counterIncrement;
|
|
2017
|
+
} catch {
|
|
2018
|
+
}
|
|
2019
|
+
if (S && S !== "none") for (let b of S.split(",")) {
|
|
2020
|
+
let C = b.trim().split(/\s+/), v = C[0], F = Number.isFinite(Number(C[1])) ? Number(C[1]) : 1;
|
|
2021
|
+
if (!v) continue;
|
|
2022
|
+
let E = $.get(v) || [];
|
|
2023
|
+
E.length === 0 && E.push(0), E[E.length - 1] += F, $.set(v, E);
|
|
2024
|
+
}
|
|
2025
|
+
try {
|
|
2026
|
+
if (getComputedStyle(m).display === "list-item" && i(m)) {
|
|
2027
|
+
let b = m.parentElement, C = 1;
|
|
2028
|
+
if (b && b.tagName === "OL") {
|
|
2029
|
+
let F = b.getAttribute("start"), E = Number.isFinite(Number(F)) ? Number(F) : 1, D = o(m), U = m.getAttribute("value");
|
|
2030
|
+
C = Number.isFinite(Number(U)) ? Number(U) : E + D;
|
|
2031
|
+
} else C = 1 + o(m);
|
|
2032
|
+
let v = $.get("list-item") || [];
|
|
2033
|
+
v.length === 0 && v.push(0), v[v.length - 1] = C, $.set("list-item", v);
|
|
2034
|
+
}
|
|
2035
|
+
} catch {
|
|
2036
|
+
}
|
|
2037
|
+
return $;
|
|
2038
|
+
}, c = (d, p, m) => {
|
|
2039
|
+
let f = s(m, p, d);
|
|
2040
|
+
r.set(d, f);
|
|
2041
|
+
let y = f;
|
|
2042
|
+
for (let $ of d.children) y = c($, f, y);
|
|
2043
|
+
let x = /* @__PURE__ */ new Map();
|
|
2044
|
+
for (let [$, g] of m) {
|
|
2045
|
+
let w = g.length, S = y.get($);
|
|
2046
|
+
x.set($, S && S.length ? S.slice(0, w) : g.slice());
|
|
2047
|
+
}
|
|
2048
|
+
for (let [$, g] of y) !x.has($) && g.length && !p.has($) && x.set($, g.slice(0, 1));
|
|
2049
|
+
return x;
|
|
2050
|
+
}, h = /* @__PURE__ */ new Map();
|
|
2051
|
+
c(l, h, h);
|
|
2052
|
+
function u() {
|
|
2053
|
+
let d = e();
|
|
2054
|
+
if (d !== n) {
|
|
2055
|
+
n = d;
|
|
2056
|
+
let p = /* @__PURE__ */ new Map();
|
|
2057
|
+
c(l, p, p);
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
return { get(d, p) {
|
|
2061
|
+
var m;
|
|
2062
|
+
u();
|
|
2063
|
+
let f = (m = r.get(d)) == null ? void 0 : m.get(p);
|
|
2064
|
+
return f && f.length ? f[f.length - 1] : 0;
|
|
2065
|
+
}, getStack(d, p) {
|
|
2066
|
+
var m;
|
|
2067
|
+
u();
|
|
2068
|
+
let f = (m = r.get(d)) == null ? void 0 : m.get(p);
|
|
2069
|
+
return f ? f.slice() : [];
|
|
2070
|
+
} };
|
|
2071
|
+
}
|
|
2072
|
+
function $l(t, e, n) {
|
|
2073
|
+
if (!t || t === "none") return t;
|
|
2074
|
+
try {
|
|
2075
|
+
let r = /\b(counter|counters)\s*\(([^)]+)\)/g, l = t.replace(r, (i, o, a) => {
|
|
2076
|
+
var s, c, h, u;
|
|
2077
|
+
let d = String(a).split(",").map((p) => p.trim());
|
|
2078
|
+
if (o === "counter") {
|
|
2079
|
+
let p = (s = d[0]) == null ? void 0 : s.replace(/^["']|["']$/g, ""), m = (d[1] || "decimal").toLowerCase(), f = n.get(e, p);
|
|
2080
|
+
return Ue(f, m);
|
|
2081
|
+
} else {
|
|
2082
|
+
let p = (c = d[0]) == null ? void 0 : c.replace(/^["']|["']$/g, ""), m = (u = (h = d[1]) == null ? void 0 : h.replace(/^["']|["']$/g, "")) != null ? u : "", f = (d[2] || "decimal").toLowerCase(), y = n.getStack(e, p);
|
|
2083
|
+
return y.length ? y.map((x) => Ue(x, f)).join(m) : "";
|
|
2084
|
+
}
|
|
2085
|
+
});
|
|
2086
|
+
return Cl(l);
|
|
2087
|
+
} catch {
|
|
2088
|
+
return "- ";
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
$t();
|
|
2092
|
+
it();
|
|
2093
|
+
var St = /* @__PURE__ */ new WeakMap(), je = 1e3;
|
|
2094
|
+
function kl(t, e) {
|
|
2095
|
+
let n = yn(t);
|
|
2096
|
+
return e ? (e.__pseudoPreflightFp !== n && (e.__pseudoPreflight = He(t), e.__pseudoPreflightFp = n), !!e.__pseudoPreflight) : He(t);
|
|
2097
|
+
}
|
|
2098
|
+
function oe(t) {
|
|
2099
|
+
try {
|
|
2100
|
+
return t && t.cssRules ? t.cssRules : null;
|
|
2101
|
+
} catch {
|
|
2102
|
+
return null;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
function yn(t) {
|
|
2106
|
+
let e = t.querySelectorAll('style,link[rel~="stylesheet"]'), n = `n:${e.length}|`, r = 0;
|
|
2107
|
+
for (let i = 0; i < e.length; i++) {
|
|
2108
|
+
let o = e[i];
|
|
2109
|
+
if (o.tagName === "STYLE") {
|
|
2110
|
+
let a = o.textContent ? o.textContent.length : 0;
|
|
2111
|
+
n += `S${a}|`;
|
|
2112
|
+
let s = o.sheet, c = s ? oe(s) : null;
|
|
2113
|
+
c && (r += c.length);
|
|
2114
|
+
} else {
|
|
2115
|
+
let a = o.getAttribute("href") || "", s = o.getAttribute("media") || "all";
|
|
2116
|
+
n += `L${a}|m:${s}|`;
|
|
2117
|
+
let c = o.sheet, h = c ? oe(c) : null;
|
|
2118
|
+
h && (r += h.length);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
let l = t.adoptedStyleSheets;
|
|
2122
|
+
return n += `ass:${Array.isArray(l) ? l.length : 0}|tr:${r}`, n;
|
|
2123
|
+
}
|
|
2124
|
+
function _e(t, e, n) {
|
|
2125
|
+
let r = oe(t);
|
|
2126
|
+
if (!r) return !1;
|
|
2127
|
+
for (let l = 0; l < r.length; l++) {
|
|
2128
|
+
if (n.budget <= 0) return !1;
|
|
2129
|
+
let i = r[l], o = i && i.cssText ? i.cssText : "";
|
|
2130
|
+
n.budget--;
|
|
2131
|
+
for (let a of e) if (o.includes(a)) return !0;
|
|
2132
|
+
if (i && i.cssRules && i.cssRules.length) for (let a = 0; a < i.cssRules.length && n.budget > 0; a++) {
|
|
2133
|
+
let s = i.cssRules[a], c = s && s.cssText ? s.cssText : "";
|
|
2134
|
+
n.budget--;
|
|
2135
|
+
for (let h of e) if (c.includes(h)) return !0;
|
|
2136
|
+
}
|
|
2137
|
+
if (n.budget <= 0) return !1;
|
|
2138
|
+
}
|
|
2139
|
+
return !1;
|
|
2140
|
+
}
|
|
2141
|
+
function He(t = document) {
|
|
2142
|
+
let e = yn(t), n = St.get(t);
|
|
2143
|
+
if (n && n.fingerprint === e) return n.result;
|
|
2144
|
+
let r = ["::before", "::after", "::first-letter", ":before", ":after", ":first-letter", "counter(", "counters(", "counter-increment", "counter-reset"], l = t.querySelectorAll("style");
|
|
2145
|
+
for (let o = 0; o < l.length; o++) {
|
|
2146
|
+
let a = l[o].textContent || "";
|
|
2147
|
+
for (let s of r) if (a.includes(s)) return St.set(t, { fingerprint: e, result: !0 }), !0;
|
|
2148
|
+
}
|
|
2149
|
+
let i = t.adoptedStyleSheets;
|
|
2150
|
+
if (Array.isArray(i) && i.length) {
|
|
2151
|
+
let o = { budget: je };
|
|
2152
|
+
try {
|
|
2153
|
+
for (let a of i) if (_e(a, r, o)) return St.set(t, { fingerprint: e, result: !0 }), !0;
|
|
2154
|
+
} catch {
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
{
|
|
2158
|
+
let o = t.querySelectorAll('style,link[rel~="stylesheet"]'), a = { budget: je };
|
|
2159
|
+
for (let s = 0; s < o.length && a.budget > 0; s++) {
|
|
2160
|
+
let c = o[s], h = null;
|
|
2161
|
+
if (c.tagName, h = c.sheet || null, h && _e(h, r, a)) return St.set(t, { fingerprint: e, result: !0 }), !0;
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
return t.querySelector('[style*="counter("], [style*="counters("]') ? (St.set(t, { fingerprint: e, result: !0 }), !0) : (St.set(t, { fingerprint: e, result: !1 }), !1);
|
|
2165
|
+
}
|
|
2166
|
+
var Mt = /* @__PURE__ */ new WeakMap(), De = -1;
|
|
2167
|
+
function Al(t) {
|
|
2168
|
+
return (t || "").replace(/"([^"]*)"/g, "$1");
|
|
2169
|
+
}
|
|
2170
|
+
function El(t) {
|
|
2171
|
+
if (!t) return "";
|
|
2172
|
+
let e = [], n = /"([^"]*)"/g, r;
|
|
2173
|
+
for (; r = n.exec(t); ) e.push(r[1]);
|
|
2174
|
+
return e.length ? e.join("") : Al(t);
|
|
2175
|
+
}
|
|
2176
|
+
function ae(t, e) {
|
|
2177
|
+
let n = t.parentElement, r = n ? Mt.get(n) : null;
|
|
2178
|
+
return r ? { get(l, i) {
|
|
2179
|
+
let o = e.get(l, i), a = r.get(i);
|
|
2180
|
+
return typeof a == "number" ? Math.max(o, a) : o;
|
|
2181
|
+
}, getStack(l, i) {
|
|
2182
|
+
let o = e.getStack(l, i);
|
|
2183
|
+
if (!o.length) return o;
|
|
2184
|
+
let a = r.get(i);
|
|
2185
|
+
if (typeof a == "number") {
|
|
2186
|
+
let s = o.slice();
|
|
2187
|
+
return s[s.length - 1] = Math.max(s[s.length - 1], a), s;
|
|
2188
|
+
}
|
|
2189
|
+
return o;
|
|
2190
|
+
} } : e;
|
|
2191
|
+
}
|
|
2192
|
+
function se(t, e, n) {
|
|
2193
|
+
let r = /* @__PURE__ */ new Map();
|
|
2194
|
+
function l(s) {
|
|
2195
|
+
let c = [];
|
|
2196
|
+
if (!s || s === "none") return c;
|
|
2197
|
+
for (let h of String(s).split(",")) {
|
|
2198
|
+
let u = h.trim().split(/\s+/), d = u[0], p = Number.isFinite(Number(u[1])) ? Number(u[1]) : void 0;
|
|
2199
|
+
d && c.push({ name: d, num: p });
|
|
2200
|
+
}
|
|
2201
|
+
return c;
|
|
2202
|
+
}
|
|
2203
|
+
let i = l(e?.counterReset), o = l(e?.counterIncrement);
|
|
2204
|
+
function a(s) {
|
|
2205
|
+
if (r.has(s)) return r.get(s).slice();
|
|
2206
|
+
let c = n.getStack(t, s);
|
|
2207
|
+
c = c.length ? c.slice() : [];
|
|
2208
|
+
let h = i.find((d) => d.name === s);
|
|
2209
|
+
if (h) {
|
|
2210
|
+
let d = Number.isFinite(h.num) ? h.num : 0;
|
|
2211
|
+
c = c.length ? [...c, d] : [d];
|
|
2212
|
+
}
|
|
2213
|
+
let u = o.find((d) => d.name === s);
|
|
2214
|
+
if (u) {
|
|
2215
|
+
let d = Number.isFinite(u.num) ? u.num : 1;
|
|
2216
|
+
c.length === 0 && (c = [0]), c[c.length - 1] += d;
|
|
2217
|
+
}
|
|
2218
|
+
return r.set(s, c.slice()), c;
|
|
2219
|
+
}
|
|
2220
|
+
return { get(s, c) {
|
|
2221
|
+
let h = a(c);
|
|
2222
|
+
return h.length ? h[h.length - 1] : 0;
|
|
2223
|
+
}, getStack(s, c) {
|
|
2224
|
+
return a(c);
|
|
2225
|
+
}, __incs: o };
|
|
2226
|
+
}
|
|
2227
|
+
function Fl(t, e, n) {
|
|
2228
|
+
let r;
|
|
2229
|
+
try {
|
|
2230
|
+
r = ft(t, e);
|
|
2231
|
+
} catch {
|
|
2232
|
+
}
|
|
2233
|
+
let l = r?.content;
|
|
2234
|
+
if (!l || l === "none" || l === "normal") return { text: "", incs: [] };
|
|
2235
|
+
let i = ae(t, n), o = se(t, r, i), a = Sl(l) ? $l(l, t, o) : l;
|
|
2236
|
+
return { text: El(a), incs: o.__incs || [] };
|
|
2237
|
+
}
|
|
2238
|
+
async function ue(t, e, n, r) {
|
|
2239
|
+
var l, i, o, a, s;
|
|
2240
|
+
if (!(t instanceof Element) || !(e instanceof Element)) return;
|
|
2241
|
+
let c = t.ownerDocument || document;
|
|
2242
|
+
if (!kl(c, n)) return;
|
|
2243
|
+
let h = (i = (l = k?.session) == null ? void 0 : l.__counterEpoch) != null ? i : 0;
|
|
2244
|
+
if (De !== h && (Mt = /* @__PURE__ */ new WeakMap(), n && (n.__counterCtx = null), De = h), !n.__counterCtx) try {
|
|
2245
|
+
n.__counterCtx = Ml(t.ownerDocument || document);
|
|
2246
|
+
} catch (p) {
|
|
2247
|
+
V(n, "buildCounterContext failed", p);
|
|
2248
|
+
}
|
|
2249
|
+
let u = n.__counterCtx;
|
|
2250
|
+
for (let p of ["::before", "::after", "::first-letter"]) try {
|
|
2251
|
+
let m = ft(t, p);
|
|
2252
|
+
if (!m || m.content === "none" && m.backgroundImage === "none" && m.backgroundColor === "transparent" && (m.borderStyle === "none" || parseFloat(m.borderWidth) === 0) && (!m.transform || m.transform === "none") && m.display === "inline") continue;
|
|
2253
|
+
if (p === "::first-letter") {
|
|
2254
|
+
let A = ft(t);
|
|
2255
|
+
if (!(m.color !== A.color || m.fontSize !== A.fontSize || m.fontWeight !== A.fontWeight || m.fontFamily !== A.fontFamily || m.fontStyle !== A.fontStyle || m.textTransform !== A.textTransform || m.float !== A.float || m.paddingTop !== A.paddingTop || m.paddingRight !== A.paddingRight || m.paddingBottom !== A.paddingBottom || m.paddingLeft !== A.paddingLeft || m.marginTop !== A.marginTop || m.marginRight !== A.marginRight || m.marginBottom !== A.marginBottom || m.marginLeft !== A.marginLeft)) continue;
|
|
2256
|
+
let N = Array.from(e.childNodes).find((G) => {
|
|
2257
|
+
var K;
|
|
2258
|
+
return G.nodeType === Node.TEXT_NODE && ((K = G.textContent) == null ? void 0 : K.trim().length) > 0;
|
|
2259
|
+
});
|
|
2260
|
+
if (!N) continue;
|
|
2261
|
+
let j = N.textContent, R = (o = j.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)) == null ? void 0 : o[0], X = j.slice(R?.length || 0);
|
|
2262
|
+
if (!R || /[\uD800-\uDFFF]/.test(R)) continue;
|
|
2263
|
+
let Y = document.createElement("span");
|
|
2264
|
+
Y.textContent = R, Y.dataset.snapdomPseudo = "::first-letter";
|
|
2265
|
+
let Z = Me(m), tt = te(Z, "span");
|
|
2266
|
+
n.styleMap.set(Y, tt);
|
|
2267
|
+
let H = document.createTextNode(X);
|
|
2268
|
+
e.replaceChild(H, N), e.insertBefore(Y, H);
|
|
2269
|
+
continue;
|
|
2270
|
+
}
|
|
2271
|
+
let f = (a = m.content) != null ? a : "", y = f === "" || f === "none" || f === "normal", { text: x, incs: $ } = Fl(t, p, u), g = m.backgroundImage, w = m.backgroundColor, S = m.fontFamily, b = parseInt(m.fontSize) || 32, C = parseInt(m.fontWeight) || !1, v = m.color || "#000", F = m.borderStyle, E = parseFloat(m.borderWidth), D = m.transform, U = dt(S), B = !y && x !== "", W = g && g !== "none", I = w && w !== "transparent" && w !== "rgba(0, 0, 0, 0)", z = F && F !== "none" && E > 0, mt = D && D !== "none";
|
|
2272
|
+
if (!(B || W || I || z || mt)) {
|
|
2273
|
+
if ($ && $.length && t.parentElement) {
|
|
2274
|
+
let A = Mt.get(t.parentElement) || /* @__PURE__ */ new Map();
|
|
2275
|
+
for (let { name: N } of $) {
|
|
2276
|
+
if (!N) continue;
|
|
2277
|
+
let j = ae(t, u), R = se(t, ft(t, p), j).get(t, N);
|
|
2278
|
+
A.set(N, R);
|
|
2279
|
+
}
|
|
2280
|
+
Mt.set(t.parentElement, A);
|
|
2281
|
+
}
|
|
2282
|
+
continue;
|
|
2283
|
+
}
|
|
2284
|
+
let M = document.createElement("span");
|
|
2285
|
+
M.dataset.snapdomPseudo = p, M.style.pointerEvents = "none";
|
|
2286
|
+
let P = Me(m), T = te(P, "span");
|
|
2287
|
+
if (n.styleMap.set(M, T), U && x && x.length === 1) {
|
|
2288
|
+
let { dataUrl: A, width: N, height: j } = await il(x, S, C, b, v), R = document.createElement("img");
|
|
2289
|
+
R.src = A, R.style = `height:${b}px;width:${N / j * b}px;object-fit:contain;`, M.appendChild(R), e.dataset.snapdomHasIcon = "true";
|
|
2290
|
+
} else if (x && x.startsWith("url(")) {
|
|
2291
|
+
let A = de(x);
|
|
2292
|
+
if (A != null && A.trim()) try {
|
|
2293
|
+
let N = await lt(Bt(A), { as: "dataURL", useProxy: r.useProxy });
|
|
2294
|
+
if (N != null && N.ok && typeof N.data == "string") {
|
|
2295
|
+
let j = document.createElement("img");
|
|
2296
|
+
j.src = N.data, j.style = `width:${b}px;height:auto;object-fit:contain;`, M.appendChild(j);
|
|
2297
|
+
}
|
|
2298
|
+
} catch (N) {
|
|
2299
|
+
console.error(`[snapdom] Error in pseudo ${p} for`, t, N);
|
|
2300
|
+
}
|
|
2301
|
+
} else !U && B && (M.textContent = x);
|
|
2302
|
+
M.style.backgroundImage = "none", "maskImage" in M.style && (M.style.maskImage = "none"), "webkitMaskImage" in M.style && (M.style.webkitMaskImage = "none");
|
|
2303
|
+
try {
|
|
2304
|
+
M.style.backgroundRepeat = m.backgroundRepeat, M.style.backgroundSize = m.backgroundSize, m.backgroundPositionX && m.backgroundPositionY ? (M.style.backgroundPositionX = m.backgroundPositionX, M.style.backgroundPositionY = m.backgroundPositionY) : M.style.backgroundPosition = m.backgroundPosition, M.style.backgroundOrigin = m.backgroundOrigin, M.style.backgroundClip = m.backgroundClip, M.style.backgroundAttachment = m.backgroundAttachment, M.style.backgroundBlendMode = m.backgroundBlendMode;
|
|
2305
|
+
} catch {
|
|
2306
|
+
}
|
|
2307
|
+
if (W) try {
|
|
2308
|
+
let A = ee(g), N = await Promise.all(A.map(Xe));
|
|
2309
|
+
M.style.backgroundImage = N.join(", ");
|
|
2310
|
+
} catch (A) {
|
|
2311
|
+
console.warn(`[snapdom] Failed to inline background-image for ${p}`, A);
|
|
2312
|
+
}
|
|
2313
|
+
I && (M.style.backgroundColor = w);
|
|
2314
|
+
let _ = M.childNodes.length > 0 || ((s = M.textContent) == null ? void 0 : s.trim()) !== "" || W || I || z || mt;
|
|
2315
|
+
if ($ && $.length && t.parentElement) {
|
|
2316
|
+
let A = Mt.get(t.parentElement) || /* @__PURE__ */ new Map(), N = ae(t, u), j = se(t, ft(t, p), N);
|
|
2317
|
+
for (let { name: R } of $) {
|
|
2318
|
+
if (!R) continue;
|
|
2319
|
+
let X = j.get(t, R);
|
|
2320
|
+
A.set(R, X);
|
|
2321
|
+
}
|
|
2322
|
+
Mt.set(t.parentElement, A);
|
|
2323
|
+
}
|
|
2324
|
+
if (!_) continue;
|
|
2325
|
+
p === "::before" ? (e.dataset.snapdomHasBefore = "1", e.insertBefore(M, e.firstChild)) : (e.dataset.snapdomHasAfter = "1", e.appendChild(M));
|
|
2326
|
+
} catch (m) {
|
|
2327
|
+
console.warn(`[snapdom] Failed to capture ${p} for`, t, m);
|
|
2328
|
+
}
|
|
2329
|
+
let d = Array.from(e.children).filter((p) => !p.dataset.snapdomPseudo);
|
|
2330
|
+
if (n.nodeMap) for (let p of d) {
|
|
2331
|
+
let m = n.nodeMap.get(p);
|
|
2332
|
+
m instanceof Element && await ue(m, p, n, r);
|
|
2333
|
+
}
|
|
2334
|
+
else {
|
|
2335
|
+
let p = Array.from(t.children);
|
|
2336
|
+
for (let m = 0; m < Math.min(p.length, d.length); m++) await ue(p[m], d[m], n, r);
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
function Ll(t, e) {
|
|
2340
|
+
var n, r;
|
|
2341
|
+
if (!t || !(t instanceof Element)) return;
|
|
2342
|
+
let l = t.ownerDocument || document, i = l, o = t instanceof SVGSVGElement ? [t] : Array.from(t.querySelectorAll("svg"));
|
|
2343
|
+
if (o.length === 0) return;
|
|
2344
|
+
let a = /url\(\s*#([^)]+)\)/g, s = ["fill", "stroke", "filter", "clip-path", "mask", "marker", "marker-start", "marker-mid", "marker-end"], c = (b) => window.CSS && CSS.escape ? CSS.escape(b) : b.replace(/[^a-zA-Z0-9_-]/g, "\\$&"), h = "http://www.w3.org/1999/xlink", u = (b) => {
|
|
2345
|
+
if (!b || !b.getAttribute) return null;
|
|
2346
|
+
let C = b.getAttribute("href") || b.getAttribute("xlink:href") || (typeof b.getAttributeNS == "function" ? b.getAttributeNS(h, "href") : null);
|
|
2347
|
+
if (C) return C;
|
|
2348
|
+
let v = b.attributes;
|
|
2349
|
+
if (!v) return null;
|
|
2350
|
+
for (let F = 0; F < v.length; F++) {
|
|
2351
|
+
let E = v[F];
|
|
2352
|
+
if (!E || !E.name) continue;
|
|
2353
|
+
if (E.name === "href") return E.value;
|
|
2354
|
+
let D = E.name.indexOf(":");
|
|
2355
|
+
if (D !== -1 && E.name.slice(D + 1) === "href") return E.value;
|
|
2356
|
+
}
|
|
2357
|
+
return null;
|
|
2358
|
+
}, d = new Set(Array.from(t.querySelectorAll("[id]")).map((b) => b.id)), p = /* @__PURE__ */ new Set(), m = !1, f = (b, C = null) => {
|
|
2359
|
+
if (!b) return;
|
|
2360
|
+
a.lastIndex = 0;
|
|
2361
|
+
let v;
|
|
2362
|
+
for (; v = a.exec(b); ) {
|
|
2363
|
+
m = !0;
|
|
2364
|
+
let F = (v[1] || "").trim();
|
|
2365
|
+
F && (d.has(F) || (p.add(F), C && !C.has(F) && C.add(F)));
|
|
2366
|
+
}
|
|
2367
|
+
}, y = (b) => {
|
|
2368
|
+
let C = b.querySelectorAll("use");
|
|
2369
|
+
for (let F of C) {
|
|
2370
|
+
let E = u(F);
|
|
2371
|
+
if (!E || !E.startsWith("#")) continue;
|
|
2372
|
+
m = !0;
|
|
2373
|
+
let D = E.slice(1).trim();
|
|
2374
|
+
D && !d.has(D) && p.add(D);
|
|
2375
|
+
}
|
|
2376
|
+
let v = b.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');
|
|
2377
|
+
for (let F of v) {
|
|
2378
|
+
f(F.getAttribute("style") || "");
|
|
2379
|
+
for (let E of s) f(F.getAttribute(E));
|
|
2380
|
+
}
|
|
2381
|
+
};
|
|
2382
|
+
for (let b of o) y(b);
|
|
2383
|
+
if (!m) return;
|
|
2384
|
+
let x = t.querySelector("svg.inline-defs-container");
|
|
2385
|
+
x || (x = l.createElementNS("http://www.w3.org/2000/svg", "svg"), x.classList.add("inline-defs-container"), x.setAttribute("aria-hidden", "true"), x.setAttribute("style", "position:absolute;width:0;height:0;overflow:hidden"), t.insertBefore(x, t.firstChild || null));
|
|
2386
|
+
let $ = x.querySelector("defs") || null, g = (b) => {
|
|
2387
|
+
if (!b || d.has(b)) return null;
|
|
2388
|
+
let C = c(b), v = (F) => {
|
|
2389
|
+
let E = i.querySelector(F);
|
|
2390
|
+
return E && !t.contains(E) ? E : null;
|
|
2391
|
+
};
|
|
2392
|
+
return v(`svg defs > *#${C}`) || v(`svg > symbol#${C}`) || v(`*#${C}`);
|
|
2393
|
+
};
|
|
2394
|
+
if (!p.size) return;
|
|
2395
|
+
let w = new Set(p), S = /* @__PURE__ */ new Set();
|
|
2396
|
+
for (; w.size; ) {
|
|
2397
|
+
let b = w.values().next().value;
|
|
2398
|
+
if (w.delete(b), !b || d.has(b) || S.has(b)) continue;
|
|
2399
|
+
let C = g(b);
|
|
2400
|
+
if (!C) {
|
|
2401
|
+
S.add(b);
|
|
2402
|
+
continue;
|
|
2403
|
+
}
|
|
2404
|
+
$ || ($ = l.createElementNS("http://www.w3.org/2000/svg", "defs"), x.appendChild($));
|
|
2405
|
+
let v = C.cloneNode(!0);
|
|
2406
|
+
v.id || v.setAttribute("id", b), $.appendChild(v), S.add(b), d.add(b);
|
|
2407
|
+
let F = [v, ...v.querySelectorAll("*")];
|
|
2408
|
+
for (let E of F) {
|
|
2409
|
+
let D = u(E);
|
|
2410
|
+
if (D && D.startsWith("#")) {
|
|
2411
|
+
let B = D.slice(1).trim();
|
|
2412
|
+
B && !d.has(B) && !S.has(B) && w.add(B);
|
|
2413
|
+
}
|
|
2414
|
+
let U = ((n = E.getAttribute) == null ? void 0 : n.call(E, "style")) || "";
|
|
2415
|
+
U && f(U, w);
|
|
2416
|
+
for (let B of s) {
|
|
2417
|
+
let W = (r = E.getAttribute) == null ? void 0 : r.call(E, B);
|
|
2418
|
+
W && f(W, w);
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
it();
|
|
2424
|
+
function Nl(t, e) {
|
|
2425
|
+
var n;
|
|
2426
|
+
if (!t || !e) return;
|
|
2427
|
+
let r = t.scrollTop || 0;
|
|
2428
|
+
if (!r) return;
|
|
2429
|
+
getComputedStyle(e).position === "static" && (e.style.position = "relative");
|
|
2430
|
+
let l = t.getBoundingClientRect(), i = t.clientHeight, o = "data-snap-ph", a = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
|
|
2431
|
+
for (; a.nextNode(); ) {
|
|
2432
|
+
let s = a.currentNode, c = getComputedStyle(s), h = c.position;
|
|
2433
|
+
if (h !== "sticky" && h !== "-webkit-sticky") continue;
|
|
2434
|
+
let u = Be(c.top), d = Be(c.bottom);
|
|
2435
|
+
if (u == null && d == null) continue;
|
|
2436
|
+
let p = Pl(s, t), m = Rl(e, p, o);
|
|
2437
|
+
if (!m) continue;
|
|
2438
|
+
let f = s.getBoundingClientRect(), y = f.width, x = f.height, $ = f.left - l.left;
|
|
2439
|
+
if (!(y > 0 && x > 0) || !Number.isFinite($)) continue;
|
|
2440
|
+
let g = u != null ? u + r : r + (i - x - d);
|
|
2441
|
+
if (!Number.isFinite(g)) continue;
|
|
2442
|
+
let w = Number.parseInt(c.zIndex, 10), S = Number.isFinite(w), b = S ? Math.max(w, 1) + 1 : 2, C = S ? w - 1 : 0, v = m.cloneNode(!1);
|
|
2443
|
+
v.setAttribute(o, "1"), v.style.position = "sticky", v.style.left = `${$}px`, v.style.top = `${g}px`, v.style.width = `${y}px`, v.style.height = `${x}px`, v.style.visibility = "hidden", v.style.zIndex = String(C), v.style.overflow = "hidden", v.style.background = "transparent", v.style.boxShadow = "none", v.style.filter = "none", (n = m.parentElement) == null || n.insertBefore(v, m), m.style.position = "absolute", m.style.left = `${$}px`, m.style.top = `${g}px`, m.style.bottom = "auto", m.style.zIndex = String(b), m.style.pointerEvents = "none";
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
function Be(t) {
|
|
2447
|
+
if (!t || t === "auto") return null;
|
|
2448
|
+
let e = Number.parseFloat(t);
|
|
2449
|
+
return Number.isFinite(e) ? e : null;
|
|
2450
|
+
}
|
|
2451
|
+
function Pl(t, e) {
|
|
2452
|
+
let n = [];
|
|
2453
|
+
for (let r = t; r && r !== e; ) {
|
|
2454
|
+
let l = r.parentElement;
|
|
2455
|
+
if (!l) break;
|
|
2456
|
+
n.push(Array.prototype.indexOf.call(l.children, r)), r = l;
|
|
2457
|
+
}
|
|
2458
|
+
return n.reverse();
|
|
2459
|
+
}
|
|
2460
|
+
function Rl(t, e, n) {
|
|
2461
|
+
let r = t;
|
|
2462
|
+
for (let l = 0; l < e.length; l++) if (r = Tl(r, n)[e[l]], !r) return null;
|
|
2463
|
+
return r instanceof HTMLElement ? r : null;
|
|
2464
|
+
}
|
|
2465
|
+
function Tl(t, e) {
|
|
2466
|
+
let n = [], r = t.children;
|
|
2467
|
+
for (let l = 0; l < r.length; l++) {
|
|
2468
|
+
let i = r[l];
|
|
2469
|
+
i.hasAttribute(e) || n.push(i);
|
|
2470
|
+
}
|
|
2471
|
+
return n;
|
|
2472
|
+
}
|
|
2473
|
+
function Wl(t) {
|
|
2474
|
+
let e = getComputedStyle(t), n = e.outlineStyle, r = e.outlineWidth, l = e.borderStyle, i = e.borderWidth, o = n !== "none" && parseFloat(r) > 0, a = l === "none" || parseFloat(i) === 0;
|
|
2475
|
+
o && a && (t.style.border = `${r} solid transparent`);
|
|
2476
|
+
}
|
|
2477
|
+
function Il(t) {
|
|
2478
|
+
let e = [];
|
|
2479
|
+
try {
|
|
2480
|
+
let n = t.querySelectorAll("*");
|
|
2481
|
+
for (let r of n) {
|
|
2482
|
+
if (!(r instanceof HTMLElement)) continue;
|
|
2483
|
+
let l = r.style.contentVisibility || "", i = getComputedStyle(r), o = i.contentVisibility || i.getPropertyValue("content-visibility") || "";
|
|
2484
|
+
(o === "auto" || o === "hidden") && (e.push({ el: r, original: l }), r.style.contentVisibility = "visible");
|
|
2485
|
+
}
|
|
2486
|
+
if (t instanceof HTMLElement) {
|
|
2487
|
+
let r = getComputedStyle(t), l = r.contentVisibility || r.getPropertyValue("content-visibility") || "";
|
|
2488
|
+
(l === "auto" || l === "hidden") && (e.push({ el: t, original: t.style.contentVisibility || "" }), t.style.contentVisibility = "visible");
|
|
2489
|
+
}
|
|
2490
|
+
} catch {
|
|
2491
|
+
}
|
|
2492
|
+
return () => {
|
|
2493
|
+
for (let { el: n, original: r } of e) try {
|
|
2494
|
+
n.style.contentVisibility = r;
|
|
2495
|
+
} catch {
|
|
2496
|
+
}
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
async function Ol(t, e = {}) {
|
|
2500
|
+
var n, r;
|
|
2501
|
+
let l = { styleMap: k.session.styleMap, styleCache: k.session.styleCache, nodeMap: k.session.nodeMap, options: e }, i, o = "", a = "";
|
|
2502
|
+
Wl(t);
|
|
2503
|
+
let s = Il(t);
|
|
2504
|
+
try {
|
|
2505
|
+
Ll(t);
|
|
2506
|
+
} catch (u) {
|
|
2507
|
+
console.warn("inlineExternal defs or symbol failed:", u);
|
|
2508
|
+
}
|
|
2509
|
+
try {
|
|
2510
|
+
i = await _t(t, l, e);
|
|
2511
|
+
} catch (u) {
|
|
2512
|
+
throw console.warn("deepClone failed:", u), u;
|
|
2513
|
+
} finally {
|
|
2514
|
+
s();
|
|
2515
|
+
}
|
|
2516
|
+
try {
|
|
2517
|
+
await ue(t, i, l, e);
|
|
2518
|
+
} catch (u) {
|
|
2519
|
+
console.warn("inlinePseudoElements failed:", u);
|
|
2520
|
+
}
|
|
2521
|
+
await Gr(i, l);
|
|
2522
|
+
try {
|
|
2523
|
+
let u = i.querySelectorAll("style[data-sd]");
|
|
2524
|
+
for (let d of u) a += d.textContent || "", d.remove();
|
|
2525
|
+
} catch (u) {
|
|
2526
|
+
V(l, "Failed to extract shadow CSS from style[data-sd]", u);
|
|
2527
|
+
}
|
|
2528
|
+
let c = nr(l.styleMap);
|
|
2529
|
+
o = Array.from(c.entries()).map(([u, d]) => `.${d}{${u}}`).join(""), o = a + "[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}" + o;
|
|
2530
|
+
for (let [u, d] of l.styleMap.entries()) {
|
|
2531
|
+
if (u.tagName === "STYLE") continue;
|
|
2532
|
+
if (u.getRootNode && u.getRootNode() instanceof ShadowRoot) {
|
|
2533
|
+
u.setAttribute("style", d.replace(/;/g, "; "));
|
|
2534
|
+
continue;
|
|
2535
|
+
}
|
|
2536
|
+
let p = c.get(d);
|
|
2537
|
+
p && u.classList.add(p);
|
|
2538
|
+
let m = (n = u.style) == null ? void 0 : n.backgroundImage, f = (r = u.dataset) == null ? void 0 : r.snapdomHasIcon;
|
|
2539
|
+
m && m !== "none" && (u.style.backgroundImage = m), f && (u.style.verticalAlign = "middle", u.style.display = "inline");
|
|
2540
|
+
}
|
|
2541
|
+
for (let [u, d] of l.nodeMap.entries()) {
|
|
2542
|
+
let p = d.scrollLeft, m = d.scrollTop;
|
|
2543
|
+
if ((p || m) && u instanceof HTMLElement) {
|
|
2544
|
+
u.style.overflow = "hidden", u.style.scrollbarWidth = "none", u.style.msOverflowStyle = "none";
|
|
2545
|
+
try {
|
|
2546
|
+
let y = u.querySelectorAll("*");
|
|
2547
|
+
for (let x of y) {
|
|
2548
|
+
if (!(x instanceof HTMLElement)) continue;
|
|
2549
|
+
let $ = x.style.position;
|
|
2550
|
+
if ($ === "fixed" || $ === "absolute") {
|
|
2551
|
+
let g = parseFloat(x.style.top) || 0, w = parseFloat(x.style.left) || 0;
|
|
2552
|
+
x.style.top = `${g + m}px`, x.style.left = `${w + p}px`, $ === "fixed" && (x.style.position = "absolute");
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
} catch {
|
|
2556
|
+
}
|
|
2557
|
+
let f = document.createElement("div");
|
|
2558
|
+
for (f.style.transform = `translate(${-p}px, ${-m}px)`, f.style.willChange = "transform", f.style.display = "inline-block", f.style.width = "100%"; u.firstChild; ) f.appendChild(u.firstChild);
|
|
2559
|
+
u.appendChild(f);
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
let h = i instanceof HTMLElement && i.firstElementChild instanceof HTMLElement ? i.firstElementChild : i;
|
|
2563
|
+
if (Nl(t, h), t === l.nodeMap.get(i)) {
|
|
2564
|
+
let u = l.styleCache.get(t) || ft(t);
|
|
2565
|
+
l.styleCache.set(t, u);
|
|
2566
|
+
let d = Vn(u.transform);
|
|
2567
|
+
i.style.margin = "0", i.style.top = "auto", i.style.left = "auto", i.style.right = "auto", i.style.bottom = "auto", i.style.animation = "none", i.style.transition = "none", i.style.willChange = "auto", i.style.float = "none", i.style.clear = "none", i.style.transform = d || "";
|
|
2568
|
+
}
|
|
2569
|
+
for (let [u, d] of l.nodeMap.entries()) d.tagName === "PRE" && (u.style.marginTop = "0", u.style.marginBlockStart = "0");
|
|
2570
|
+
return { clone: i, classCSS: o, styleCache: l.styleCache };
|
|
2571
|
+
}
|
|
2572
|
+
$t();
|
|
2573
|
+
var wn = "http://www.w3.org/1999/xlink";
|
|
2574
|
+
function Ul(t) {
|
|
2575
|
+
return t.getAttribute("href") || t.getAttribute("xlink:href") || (typeof t.getAttributeNS == "function" ? t.getAttributeNS(wn, "href") : null);
|
|
2576
|
+
}
|
|
2577
|
+
function jl(t) {
|
|
2578
|
+
var e, n, r, l;
|
|
2579
|
+
let i = parseInt(((e = t.dataset) == null ? void 0 : e.snapdomWidth) || "", 10) || 0, o = parseInt(((n = t.dataset) == null ? void 0 : n.snapdomHeight) || "", 10) || 0, a = parseInt(t.getAttribute("width") || "", 10) || 0, s = parseInt(t.getAttribute("height") || "", 10) || 0, c = parseFloat(((r = t.style) == null ? void 0 : r.width) || "") || 0, h = parseFloat(((l = t.style) == null ? void 0 : l.height) || "") || 0, u = i || c || a || t.width || t.naturalWidth || 100, d = o || h || s || t.height || t.naturalHeight || 100;
|
|
2580
|
+
return { width: u, height: d };
|
|
2581
|
+
}
|
|
2582
|
+
async function _l(t, e = {}) {
|
|
2583
|
+
let n = Array.from(t.querySelectorAll("img")), r = async (o) => {
|
|
2584
|
+
if (!o.getAttribute("src")) {
|
|
2585
|
+
let d = o.currentSrc || o.src || "";
|
|
2586
|
+
d && o.setAttribute("src", d);
|
|
2587
|
+
}
|
|
2588
|
+
o.removeAttribute("srcset"), o.removeAttribute("sizes");
|
|
2589
|
+
let a = o.src || "";
|
|
2590
|
+
if (!a) return;
|
|
2591
|
+
let s = await lt(a, { as: "dataURL", useProxy: e.useProxy });
|
|
2592
|
+
if (s.ok && typeof s.data == "string" && s.data.startsWith("data:")) {
|
|
2593
|
+
o.src = s.data, o.width || (o.width = o.naturalWidth || 100), o.height || (o.height = o.naturalHeight || 100);
|
|
2594
|
+
return;
|
|
2595
|
+
}
|
|
2596
|
+
let { width: c, height: h } = jl(o), { fallbackURL: u } = e || {};
|
|
2597
|
+
if (u) try {
|
|
2598
|
+
let d = typeof u == "function" ? await u({ width: c, height: h, src: a, element: o }) : u;
|
|
2599
|
+
if (d) {
|
|
2600
|
+
let p = await lt(d, { as: "dataURL", useProxy: e.useProxy });
|
|
2601
|
+
if (p != null && p.ok && typeof p.data == "string") {
|
|
2602
|
+
o.src = p.data, o.width || (o.width = c), o.height || (o.height = h);
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
} catch {
|
|
2607
|
+
}
|
|
2608
|
+
if (e.placeholders !== !1) {
|
|
2609
|
+
let d = document.createElement("div");
|
|
2610
|
+
d.style.cssText = [`width:${c}px`, `height:${h}px`, "background:#ccc", "display:inline-block", "text-align:center", `line-height:${h}px`, "color:#666", "font-size:12px", "overflow:hidden"].join(";"), d.textContent = "img", o.replaceWith(d);
|
|
2611
|
+
} else {
|
|
2612
|
+
let d = document.createElement("div");
|
|
2613
|
+
d.style.cssText = `display:inline-block;width:${c}px;height:${h}px;visibility:hidden;`, o.replaceWith(d);
|
|
2614
|
+
}
|
|
2615
|
+
};
|
|
2616
|
+
for (let o = 0; o < n.length; o += 4) {
|
|
2617
|
+
let a = n.slice(o, o + 4).map(r);
|
|
2618
|
+
await Promise.allSettled(a);
|
|
2619
|
+
}
|
|
2620
|
+
let l = Array.from(t.querySelectorAll("image")), i = async (o) => {
|
|
2621
|
+
let a = Ul(o);
|
|
2622
|
+
if (!a || a.startsWith("data:") || a.startsWith("blob:")) return;
|
|
2623
|
+
let s = await lt(a, { as: "dataURL", useProxy: e.useProxy });
|
|
2624
|
+
s.ok && typeof s.data == "string" && s.data.startsWith("data:") && (o.setAttribute("href", s.data), o.removeAttribute("xlink:href"), typeof o.removeAttributeNS == "function" && o.removeAttributeNS(wn, "href"));
|
|
2625
|
+
};
|
|
2626
|
+
for (let o = 0; o < l.length; o += 4) {
|
|
2627
|
+
let a = l.slice(o, o + 4).map(i);
|
|
2628
|
+
await Promise.allSettled(a);
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
st();
|
|
2632
|
+
async function Hl(t, e, n, r = {}) {
|
|
2633
|
+
let l = [[t, e]], i = ["background-image", "mask", "mask-image", "-webkit-mask", "-webkit-mask-image", "mask-source", "mask-box-image-source", "mask-border-source", "-webkit-mask-box-image-source", "border-image", "border-image-source"], o = ["mask-position", "mask-size", "mask-repeat", "-webkit-mask-position", "-webkit-mask-size", "-webkit-mask-repeat", "mask-origin", "mask-clip", "-webkit-mask-origin", "-webkit-mask-clip", "-webkit-mask-position-x", "-webkit-mask-position-y"], a = ["background-position", "background-position-x", "background-position-y", "background-size", "background-repeat", "background-origin", "background-clip", "background-attachment", "background-blend-mode"], s = ["border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat"];
|
|
2634
|
+
for (; l.length; ) {
|
|
2635
|
+
let [c, h] = l.shift();
|
|
2636
|
+
if (!h) continue;
|
|
2637
|
+
let u = n.get(c) || ft(c);
|
|
2638
|
+
n.has(c) || n.set(c, u);
|
|
2639
|
+
let d = (() => {
|
|
2640
|
+
let f = u.getPropertyValue("border-image"), y = u.getPropertyValue("border-image-source");
|
|
2641
|
+
return f && f !== "none" || y && y !== "none";
|
|
2642
|
+
})();
|
|
2643
|
+
for (let f of a) {
|
|
2644
|
+
let y = u.getPropertyValue(f);
|
|
2645
|
+
y && h.style.setProperty(f, y);
|
|
2646
|
+
}
|
|
2647
|
+
for (let f of i) {
|
|
2648
|
+
let y = u.getPropertyValue(f);
|
|
2649
|
+
if (f === "background-image" && (!y || y === "none")) {
|
|
2650
|
+
let g = u.getPropertyValue("background");
|
|
2651
|
+
g && /url\s*\(/.test(g) && (y = ee(g).filter((w) => /url\s*\(/.test(w)).join(", ") || y);
|
|
2652
|
+
}
|
|
2653
|
+
if (!y || y === "none") continue;
|
|
2654
|
+
let x = ee(y), $ = await Promise.all(x.map((g) => Xe(g, r)));
|
|
2655
|
+
$.some((g) => g && g !== "none" && !/^url\(undefined/.test(g)) && h.style.setProperty(f, $.join(", "));
|
|
2656
|
+
}
|
|
2657
|
+
for (let f of o) {
|
|
2658
|
+
let y = u.getPropertyValue(f);
|
|
2659
|
+
!y || y === "initial" || h.style.setProperty(f, y);
|
|
2660
|
+
}
|
|
2661
|
+
if (d) for (let f of s) {
|
|
2662
|
+
let y = u.getPropertyValue(f);
|
|
2663
|
+
!y || y === "initial" || h.style.setProperty(f, y);
|
|
2664
|
+
}
|
|
2665
|
+
let p = c.shadowRoot ? Array.from(c.shadowRoot.children).filter((f) => f.tagName !== "STYLE") : Array.from(c.children), m = Array.from(h.children).filter((f) => {
|
|
2666
|
+
var y, x;
|
|
2667
|
+
return !((y = f.dataset) != null && y.snapdomPseudo || f.tagName === "STYLE" && (x = f.dataset) != null && x.sd);
|
|
2668
|
+
});
|
|
2669
|
+
for (let f = 0; f < Math.min(p.length, m.length); f++) l.push([p[f], m[f]]);
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
st();
|
|
2673
|
+
it();
|
|
2674
|
+
function Dl(t) {
|
|
2675
|
+
if (!t) return () => {
|
|
2676
|
+
};
|
|
2677
|
+
let e = [];
|
|
2678
|
+
function n(r) {
|
|
2679
|
+
let l = Bl(r);
|
|
2680
|
+
l && e.push(l);
|
|
2681
|
+
for (let i of r.children || []) n(i);
|
|
2682
|
+
}
|
|
2683
|
+
return n(t), () => e.forEach((r) => r());
|
|
2684
|
+
}
|
|
2685
|
+
function Bl(t) {
|
|
2686
|
+
var e;
|
|
2687
|
+
if (!t) return () => {
|
|
2688
|
+
};
|
|
2689
|
+
let n = Vl(t);
|
|
2690
|
+
if (n <= 0) return () => {
|
|
2691
|
+
};
|
|
2692
|
+
if (!Xl(t)) return () => {
|
|
2693
|
+
};
|
|
2694
|
+
let r = getComputedStyle(t), l = Math.round(ql(r) * n + zl(r)), i = (e = t.textContent) != null ? e : "", o = i;
|
|
2695
|
+
if (t.scrollHeight <= l + 0.5) return () => {
|
|
2696
|
+
};
|
|
2697
|
+
let a = 0, s = i.length, c = -1;
|
|
2698
|
+
for (; a <= s; ) {
|
|
2699
|
+
let h = a + s >> 1;
|
|
2700
|
+
t.textContent = i.slice(0, h) + "…", t.scrollHeight <= l + 0.5 ? (c = h, a = h + 1) : s = h - 1;
|
|
2701
|
+
}
|
|
2702
|
+
return t.textContent = (c >= 0 ? i.slice(0, c) : "") + "…", () => {
|
|
2703
|
+
t.textContent = o;
|
|
2704
|
+
};
|
|
2705
|
+
}
|
|
2706
|
+
function Vl(t) {
|
|
2707
|
+
let e = getComputedStyle(t), n = e.getPropertyValue("-webkit-line-clamp") || e.getPropertyValue("line-clamp");
|
|
2708
|
+
n = (n || "").trim();
|
|
2709
|
+
let r = parseInt(n, 10);
|
|
2710
|
+
return Number.isFinite(r) && r > 0 ? r : 0;
|
|
2711
|
+
}
|
|
2712
|
+
function ql(t) {
|
|
2713
|
+
let e = (t.lineHeight || "").trim(), n = parseFloat(t.fontSize) || 16;
|
|
2714
|
+
return !e || e === "normal" ? Math.round(n * 1.2) : e.endsWith("px") ? parseFloat(e) : /^\d+(\.\d+)?$/.test(e) ? Math.round(parseFloat(e) * n) : e.endsWith("%") ? Math.round(parseFloat(e) / 100 * n) : Math.round(n * 1.2);
|
|
2715
|
+
}
|
|
2716
|
+
function zl(t) {
|
|
2717
|
+
return (parseFloat(t.paddingTop) || 0) + (parseFloat(t.paddingBottom) || 0);
|
|
2718
|
+
}
|
|
2719
|
+
function Xl(t) {
|
|
2720
|
+
return t.childElementCount > 0 ? !1 : Array.from(t.childNodes).some((e) => e.nodeType === Node.TEXT_NODE);
|
|
2721
|
+
}
|
|
2722
|
+
var Nt = [];
|
|
2723
|
+
function bn(t) {
|
|
2724
|
+
if (!t) return null;
|
|
2725
|
+
if (Array.isArray(t)) {
|
|
2726
|
+
let [e, n] = t;
|
|
2727
|
+
return typeof e == "function" ? e(n) : e;
|
|
2728
|
+
}
|
|
2729
|
+
if (typeof t == "object" && "plugin" in t) {
|
|
2730
|
+
let { plugin: e, options: n } = t;
|
|
2731
|
+
return typeof e == "function" ? e(n) : e;
|
|
2732
|
+
}
|
|
2733
|
+
return typeof t == "function" ? t() : t;
|
|
2734
|
+
}
|
|
2735
|
+
function Yl(...t) {
|
|
2736
|
+
let e = t.flat();
|
|
2737
|
+
for (let n of e) {
|
|
2738
|
+
let r = bn(n);
|
|
2739
|
+
r && (Nt.some((l) => l && l.name && r.name && l.name === r.name) || Nt.push(r));
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
function xn(t) {
|
|
2743
|
+
return (t && Array.isArray(t.plugins) ? t.plugins : Nt) || Nt;
|
|
2744
|
+
}
|
|
2745
|
+
async function wt(t, e, n) {
|
|
2746
|
+
let r = n, l = xn(e);
|
|
2747
|
+
for (let i of l) {
|
|
2748
|
+
let o = i && typeof i[t] == "function" ? i[t] : null;
|
|
2749
|
+
if (!o) continue;
|
|
2750
|
+
let a = await o(e, r);
|
|
2751
|
+
typeof a < "u" && (r = a);
|
|
2752
|
+
}
|
|
2753
|
+
return r;
|
|
2754
|
+
}
|
|
2755
|
+
async function Gl(t, e, n) {
|
|
2756
|
+
let r = [], l = xn(e);
|
|
2757
|
+
for (let i of l) {
|
|
2758
|
+
let o = i && typeof i[t] == "function" ? i[t] : null;
|
|
2759
|
+
if (!o) continue;
|
|
2760
|
+
let a = await o(e, n);
|
|
2761
|
+
typeof a < "u" && r.push(a);
|
|
2762
|
+
}
|
|
2763
|
+
return r;
|
|
2764
|
+
}
|
|
2765
|
+
function Jl(t) {
|
|
2766
|
+
let e = [];
|
|
2767
|
+
if (Array.isArray(t)) for (let n of t) {
|
|
2768
|
+
let r = bn(n);
|
|
2769
|
+
if (!r || !r.name) continue;
|
|
2770
|
+
let l = e.findIndex((i) => i && i.name === r.name);
|
|
2771
|
+
l >= 0 && e.splice(l, 1), e.push(r);
|
|
2772
|
+
}
|
|
2773
|
+
for (let n of Nt) n && n.name && !e.some((r) => r.name === n.name) && e.push(n);
|
|
2774
|
+
return Object.freeze(e);
|
|
2775
|
+
}
|
|
2776
|
+
function Kl(t, e, n = !1) {
|
|
2777
|
+
return !t || t.plugins && !n || (t.plugins = Jl(e)), t;
|
|
2778
|
+
}
|
|
2779
|
+
st();
|
|
2780
|
+
function Ql(t, e, n = {}) {
|
|
2781
|
+
if (!t || !e || !e.style) return;
|
|
2782
|
+
let r = getComputedStyle(t);
|
|
2783
|
+
try {
|
|
2784
|
+
e.style.boxShadow = "none";
|
|
2785
|
+
} catch (i) {
|
|
2786
|
+
V(n, "stripRootShadows boxShadow", i);
|
|
2787
|
+
}
|
|
2788
|
+
try {
|
|
2789
|
+
e.style.textShadow = "none";
|
|
2790
|
+
} catch (i) {
|
|
2791
|
+
V(n, "stripRootShadows textShadow", i);
|
|
2792
|
+
}
|
|
2793
|
+
try {
|
|
2794
|
+
e.style.outline = "none";
|
|
2795
|
+
} catch (i) {
|
|
2796
|
+
V(n, "stripRootShadows outline", i);
|
|
2797
|
+
}
|
|
2798
|
+
let l = (r.filter || "").replace(/\bblur\([^()]*\)\s*/gi, "").replace(/\bdrop-shadow\([^()]*\)\s*/gi, "").trim().replace(/\s+/g, " ");
|
|
2799
|
+
try {
|
|
2800
|
+
e.style.filter = l.length ? l : "none";
|
|
2801
|
+
} catch (i) {
|
|
2802
|
+
V(n, "stripRootShadows filter", i);
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
function Zl(t) {
|
|
2806
|
+
let e = document.createTreeWalker(t, NodeFilter.SHOW_COMMENT), n = [];
|
|
2807
|
+
for (; e.nextNode(); ) n.push(e.currentNode);
|
|
2808
|
+
for (let r of n) r.remove();
|
|
2809
|
+
}
|
|
2810
|
+
function ti(t, e = {}) {
|
|
2811
|
+
let { stripFrameworkDirectives: n = !0 } = e, r = /* @__PURE__ */ new Set(["xml", "xlink"]), l = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
|
|
2812
|
+
for (; l.nextNode(); ) {
|
|
2813
|
+
let i = l.currentNode;
|
|
2814
|
+
for (let o of Array.from(i.attributes)) {
|
|
2815
|
+
let a = o.name;
|
|
2816
|
+
if (a.includes("@")) {
|
|
2817
|
+
i.removeAttribute(a);
|
|
2818
|
+
continue;
|
|
2819
|
+
}
|
|
2820
|
+
if (a.includes(":")) {
|
|
2821
|
+
let s = a.split(":", 1)[0];
|
|
2822
|
+
if (!r.has(s)) {
|
|
2823
|
+
i.removeAttribute(a);
|
|
2824
|
+
continue;
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
if (n && (a.startsWith("x-") || a.startsWith("v-") || a.startsWith(":") || a.startsWith("on:") || a.startsWith("bind:") || a.startsWith("let:") || a.startsWith("class:"))) {
|
|
2828
|
+
i.removeAttribute(a);
|
|
2829
|
+
continue;
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
function ei(t, e = {}) {
|
|
2835
|
+
t && (ti(t, e), Zl(t));
|
|
2836
|
+
}
|
|
2837
|
+
function ni(t) {
|
|
2838
|
+
var e;
|
|
2839
|
+
try {
|
|
2840
|
+
let n = ((e = t.getAttribute) == null ? void 0 : e.call(t, "style")) || "";
|
|
2841
|
+
return /\b(height|width|block-size|inline-size)\s*:/.test(n);
|
|
2842
|
+
} catch {
|
|
2843
|
+
return !1;
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
function ri(t) {
|
|
2847
|
+
return t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof HTMLVideoElement || t instanceof HTMLIFrameElement || t instanceof SVGElement || t instanceof HTMLObjectElement || t instanceof HTMLEmbedElement;
|
|
2848
|
+
}
|
|
2849
|
+
function li(t, e) {
|
|
2850
|
+
if (!(t instanceof Element) || ni(t) || ri(t)) return !1;
|
|
2851
|
+
let n = e.position;
|
|
2852
|
+
if (n === "absolute" || n === "fixed" || n === "sticky") return !1;
|
|
2853
|
+
let r = e.display || "";
|
|
2854
|
+
return !(r.includes("flex") || r.includes("grid") || r.startsWith("table") || e.transform && e.transform !== "none");
|
|
2855
|
+
}
|
|
2856
|
+
function ii(t, e, n = /* @__PURE__ */ new Map()) {
|
|
2857
|
+
function r(l, i) {
|
|
2858
|
+
if (!(l instanceof Element) || !(i instanceof Element)) return;
|
|
2859
|
+
let o = l.childElementCount > i.childElementCount, a = n.get(l) || getComputedStyle(l);
|
|
2860
|
+
if (n.has(l) || n.set(l, a), o && li(l, a)) {
|
|
2861
|
+
i.style.height || (i.style.height = "auto"), i.style.width || (i.style.width = "auto"), i.style.removeProperty("block-size"), i.style.removeProperty("inline-size"), i.style.minHeight || (i.style.minHeight = "0"), i.style.minWidth || (i.style.minWidth = "0"), i.style.maxHeight || (i.style.maxHeight = "none"), i.style.maxWidth || (i.style.maxWidth = "none");
|
|
2862
|
+
let h = a.overflowY || a.overflowBlock || "visible", u = a.overflowX || a.overflowInline || "visible";
|
|
2863
|
+
(h !== "visible" || u !== "visible") && (i.style.overflow = "visible");
|
|
2864
|
+
}
|
|
2865
|
+
let s = Array.from(l.children), c = Array.from(i.children);
|
|
2866
|
+
for (let h = 0; h < Math.min(s.length, c.length); h++) r(s[h], c[h]);
|
|
2867
|
+
}
|
|
2868
|
+
r(t, e);
|
|
2869
|
+
}
|
|
2870
|
+
function oi(t) {
|
|
2871
|
+
let e = getComputedStyle(t);
|
|
2872
|
+
return !(e.display === "none" || e.position === "absolute" || e.position === "fixed");
|
|
2873
|
+
}
|
|
2874
|
+
function ai(t, e) {
|
|
2875
|
+
if (!(t instanceof Element)) return !1;
|
|
2876
|
+
if (t.getAttribute("data-capture") === "exclude" && e?.excludeMode === "remove") return !0;
|
|
2877
|
+
if (Array.isArray(e?.exclude)) for (let n of e.exclude) try {
|
|
2878
|
+
if (t.matches(n)) return e.excludeMode === "remove";
|
|
2879
|
+
} catch (r) {
|
|
2880
|
+
V(e, "exclude selector match failed", r);
|
|
2881
|
+
}
|
|
2882
|
+
return !1;
|
|
2883
|
+
}
|
|
2884
|
+
function si(t, e) {
|
|
2885
|
+
let n = getComputedStyle(t), r = t.getBoundingClientRect(), l = 1 / 0, i = -1 / 0, o = !1, a = Array.from(t.children);
|
|
2886
|
+
for (let p of a) {
|
|
2887
|
+
if (ai(p, e) || !oi(p)) continue;
|
|
2888
|
+
let m = p.getBoundingClientRect(), f = m.top - r.top, y = m.bottom - r.top;
|
|
2889
|
+
y <= f || (f < l && (l = f), y > i && (i = y), o = !0);
|
|
2890
|
+
}
|
|
2891
|
+
let s = o ? Math.max(0, i - l) : 0, c = parseFloat(n.borderTopWidth) || 0, h = parseFloat(n.borderBottomWidth) || 0, u = parseFloat(n.paddingTop) || 0, d = parseFloat(n.paddingBottom) || 0;
|
|
2892
|
+
return c + h + u + d + s;
|
|
2893
|
+
}
|
|
2894
|
+
var L = (t, e = 3) => Number.isFinite(t) ? Math.round(t * 10 ** e) / 10 ** e : t, ui = /::-webkit-scrollbar(-[a-z]+)?\b/i;
|
|
2895
|
+
function ce(t, e = /* @__PURE__ */ new Set()) {
|
|
2896
|
+
let n = "";
|
|
2897
|
+
if (!t) return n;
|
|
2898
|
+
for (let r = 0; r < t.length; r++) {
|
|
2899
|
+
let l = t[r];
|
|
2900
|
+
try {
|
|
2901
|
+
if (l.type === CSSRule.IMPORT_RULE && l.styleSheet) {
|
|
2902
|
+
n += ce(l.styleSheet.cssRules, e);
|
|
2903
|
+
continue;
|
|
2904
|
+
}
|
|
2905
|
+
if (l.type === CSSRule.MEDIA_RULE && l.cssRules) {
|
|
2906
|
+
let i = ce(l.cssRules, e);
|
|
2907
|
+
i && (n += `@media ${l.conditionText}{${i}}`);
|
|
2908
|
+
continue;
|
|
2909
|
+
}
|
|
2910
|
+
if (l.type === CSSRule.STYLE_RULE) {
|
|
2911
|
+
let i = l.selectorText || "";
|
|
2912
|
+
if (ui.test(i)) {
|
|
2913
|
+
let o = l.cssText;
|
|
2914
|
+
o && !e.has(o) && (e.add(o), n += o);
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
} catch {
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
return n;
|
|
2921
|
+
}
|
|
2922
|
+
function ci(t) {
|
|
2923
|
+
if (!t || !t.styleSheets) return "";
|
|
2924
|
+
let e = /* @__PURE__ */ new Set(), n = "";
|
|
2925
|
+
for (let r of Array.from(t.styleSheets)) try {
|
|
2926
|
+
let l = r.cssRules;
|
|
2927
|
+
l && (n += ce(l, e));
|
|
2928
|
+
} catch {
|
|
2929
|
+
}
|
|
2930
|
+
return n;
|
|
2931
|
+
}
|
|
2932
|
+
function di(t) {
|
|
2933
|
+
var e;
|
|
2934
|
+
let n = t.boxShadow || "";
|
|
2935
|
+
if (!n || n === "none") return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
2936
|
+
let r = n.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map((s) => s.trim()), l = 0, i = 0, o = 0, a = 0;
|
|
2937
|
+
for (let s of r) {
|
|
2938
|
+
let c = ((e = s.match(/-?\d+(\.\d+)?px/g)) == null ? void 0 : e.map((y) => parseFloat(y))) || [];
|
|
2939
|
+
if (c.length < 2) continue;
|
|
2940
|
+
let [h, u, d = 0, p = 0] = c, m = Math.abs(h) + d + p, f = Math.abs(u) + d + p;
|
|
2941
|
+
i = Math.max(i, m + Math.max(h, 0)), a = Math.max(a, m + Math.max(-h, 0)), o = Math.max(o, f + Math.max(u, 0)), l = Math.max(l, f + Math.max(-u, 0));
|
|
2942
|
+
}
|
|
2943
|
+
return { top: Math.ceil(l), right: Math.ceil(i), bottom: Math.ceil(o), left: Math.ceil(a) };
|
|
2944
|
+
}
|
|
2945
|
+
function fi(t) {
|
|
2946
|
+
let e = (t.filter || "").match(/blur\(\s*([0-9.]+)px\s*\)/), n = e ? Math.ceil(parseFloat(e[1]) || 0) : 0;
|
|
2947
|
+
return { top: n, right: n, bottom: n, left: n };
|
|
2948
|
+
}
|
|
2949
|
+
function mi(t) {
|
|
2950
|
+
if ((t.outlineStyle || "none") === "none") return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
2951
|
+
let e = Math.ceil(parseFloat(t.outlineWidth || "0") || 0), n = parseFloat(t.outlineOffset || "0") || 0, r = e + Math.max(0, Math.ceil(n));
|
|
2952
|
+
return { top: r, right: r, bottom: r, left: r };
|
|
2953
|
+
}
|
|
2954
|
+
function hi(t) {
|
|
2955
|
+
var e;
|
|
2956
|
+
let n = `${t.filter || ""} ${t.webkitFilter || ""}`.trim();
|
|
2957
|
+
if (!n || n === "none") return { bleed: { top: 0, right: 0, bottom: 0, left: 0 }, has: !1 };
|
|
2958
|
+
let r = n.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi) || [], l = 0, i = 0, o = 0, a = 0, s = !1;
|
|
2959
|
+
for (let c of r) {
|
|
2960
|
+
s = !0;
|
|
2961
|
+
let h = ((e = c.match(/-?\d+(?:\.\d+)?px/gi)) == null ? void 0 : e.map((y) => parseFloat(y))) || [], [u = 0, d = 0, p = 0] = h, m = Math.abs(u) + p, f = Math.abs(d) + p;
|
|
2962
|
+
i = Math.max(i, m + Math.max(u, 0)), a = Math.max(a, m + Math.max(-u, 0)), o = Math.max(o, f + Math.max(d, 0)), l = Math.max(l, f + Math.max(-d, 0));
|
|
2963
|
+
}
|
|
2964
|
+
return { bleed: { top: L(l), right: L(i), bottom: L(o), left: L(a) }, has: s };
|
|
2965
|
+
}
|
|
2966
|
+
function pi(t, e) {
|
|
2967
|
+
if (!t || !e || !e.style) return null;
|
|
2968
|
+
let n = getComputedStyle(t);
|
|
2969
|
+
try {
|
|
2970
|
+
e.style.transformOrigin = "0 0";
|
|
2971
|
+
} catch {
|
|
2972
|
+
}
|
|
2973
|
+
try {
|
|
2974
|
+
"translate" in e.style && (e.style.translate = "none"), "rotate" in e.style && (e.style.rotate = "none");
|
|
2975
|
+
} catch {
|
|
2976
|
+
}
|
|
2977
|
+
let r = n.transform || "none";
|
|
2978
|
+
if (r === "none") try {
|
|
2979
|
+
let a = vn(t);
|
|
2980
|
+
if (a.a === 1 && a.b === 0 && a.c === 0 && a.d === 1) return e.style.transform = "none", { a: 1, b: 0, c: 0, d: 1 };
|
|
2981
|
+
} catch {
|
|
2982
|
+
}
|
|
2983
|
+
function l(a, s, c, h) {
|
|
2984
|
+
let u = Math.sqrt(a * a + s * s) || 0, d = 0, p = 0;
|
|
2985
|
+
if (u > 0) {
|
|
2986
|
+
let m = a / u, f = s / u;
|
|
2987
|
+
d = m * c + f * h;
|
|
2988
|
+
let y = c - m * d, x = h - f * d;
|
|
2989
|
+
p = Math.sqrt(y * y + x * x) || 0, p > 0 ? d = d / p : d = 0;
|
|
2990
|
+
}
|
|
2991
|
+
return { a: u, b: 0, c: d * p, d: p };
|
|
2992
|
+
}
|
|
2993
|
+
let i = r.match(/^matrix\(\s*([^)]+)\)$/i);
|
|
2994
|
+
if (i) {
|
|
2995
|
+
let a = i[1].split(",").map((s) => parseFloat(s.trim()));
|
|
2996
|
+
if (a.length === 6 && a.every(Number.isFinite)) {
|
|
2997
|
+
let [s, c, h, u] = a, d = l(s, c, h, u);
|
|
2998
|
+
try {
|
|
2999
|
+
e.style.transform = `matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`;
|
|
3000
|
+
} catch {
|
|
3001
|
+
}
|
|
3002
|
+
return d;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
let o = r.match(/^matrix3d\(\s*([^)]+)\)$/i);
|
|
3006
|
+
if (o) {
|
|
3007
|
+
let a = o[1].split(",").map((s) => parseFloat(s.trim()));
|
|
3008
|
+
if (a.length === 16 && a.every(Number.isFinite)) {
|
|
3009
|
+
let s = a[0], c = a[1], h = a[4], u = a[5], d = l(s, c, h, u);
|
|
3010
|
+
try {
|
|
3011
|
+
e.style.transform = `matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`;
|
|
3012
|
+
} catch {
|
|
3013
|
+
}
|
|
3014
|
+
return d;
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
try {
|
|
3018
|
+
let a = new DOMMatrix(r), s = l(a.a, a.b, a.c, a.d);
|
|
3019
|
+
try {
|
|
3020
|
+
e.style.transform = `matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, 0, 0)`;
|
|
3021
|
+
} catch {
|
|
3022
|
+
}
|
|
3023
|
+
return s;
|
|
3024
|
+
} catch {
|
|
3025
|
+
return null;
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
function Ve(t, e, n, r, l) {
|
|
3029
|
+
let i = n.a, o = n.b, a = n.c, s = n.d, c = n.e || 0, h = n.f || 0;
|
|
3030
|
+
function u(x, $) {
|
|
3031
|
+
let g = x - r, w = $ - l, S = i * g + a * w, b = o * g + s * w;
|
|
3032
|
+
return S += r + c, b += l + h, [S, b];
|
|
3033
|
+
}
|
|
3034
|
+
let d = [u(0, 0), u(t, 0), u(0, e), u(t, e)], p = 1 / 0, m = 1 / 0, f = -1 / 0, y = -1 / 0;
|
|
3035
|
+
for (let [x, $] of d) x < p && (p = x), $ < m && (m = $), x > f && (f = x), $ > y && (y = $);
|
|
3036
|
+
return { minX: p, minY: m, maxX: f, maxY: y, width: f - p, height: y - m };
|
|
3037
|
+
}
|
|
3038
|
+
function gi(t, e, n) {
|
|
3039
|
+
let r = (t.transformOrigin || "0 0").trim().split(/\s+/), [l, i] = [r[0] || "0", r[1] || "0"], o = (a, s) => {
|
|
3040
|
+
let c = a.toLowerCase();
|
|
3041
|
+
return c === "left" || c === "top" ? 0 : c === "center" ? s / 2 : c === "right" || c === "bottom" ? s : c.endsWith("px") ? parseFloat(c) || 0 : c.endsWith("%") ? (parseFloat(c) || 0) * s / 100 : /^-?\d+(\.\d+)?$/.test(c) && parseFloat(c) || 0;
|
|
3042
|
+
};
|
|
3043
|
+
return { ox: o(l, e), oy: o(i, n) };
|
|
3044
|
+
}
|
|
3045
|
+
function yi(t) {
|
|
3046
|
+
var e, n, r, l, i, o, a, s;
|
|
3047
|
+
let c = { rotate: "0deg", scale: null, translate: null }, h = typeof t.computedStyleMap == "function" ? t.computedStyleMap() : null;
|
|
3048
|
+
if (h) {
|
|
3049
|
+
let d = (y) => {
|
|
3050
|
+
try {
|
|
3051
|
+
return typeof h.has == "function" && !h.has(y) || typeof h.get != "function" ? null : h.get(y);
|
|
3052
|
+
} catch {
|
|
3053
|
+
return null;
|
|
3054
|
+
}
|
|
3055
|
+
}, p = d("rotate");
|
|
3056
|
+
if (p) if (p.angle) {
|
|
3057
|
+
let y = p.angle;
|
|
3058
|
+
c.rotate = y.unit === "rad" ? y.value * 180 / Math.PI + "deg" : y.value + y.unit;
|
|
3059
|
+
} else p.unit ? c.rotate = p.unit === "rad" ? p.value * 180 / Math.PI + "deg" : p.value + p.unit : c.rotate = String(p);
|
|
3060
|
+
else {
|
|
3061
|
+
let y = getComputedStyle(t);
|
|
3062
|
+
c.rotate = y.rotate && y.rotate !== "none" ? y.rotate : "0deg";
|
|
3063
|
+
}
|
|
3064
|
+
let m = d("scale");
|
|
3065
|
+
if (m) {
|
|
3066
|
+
let y = "x" in m && ((e = m.x) == null ? void 0 : e.value) != null ? m.x.value : Array.isArray(m) ? (n = m[0]) == null ? void 0 : n.value : Number(m) || 1, x = "y" in m && ((r = m.y) == null ? void 0 : r.value) != null ? m.y.value : Array.isArray(m) ? (l = m[1]) == null ? void 0 : l.value : y;
|
|
3067
|
+
c.scale = `${y} ${x}`;
|
|
3068
|
+
} else {
|
|
3069
|
+
let y = getComputedStyle(t);
|
|
3070
|
+
c.scale = y.scale && y.scale !== "none" ? y.scale : null;
|
|
3071
|
+
}
|
|
3072
|
+
let f = d("translate");
|
|
3073
|
+
if (f) {
|
|
3074
|
+
let y = "x" in f && "value" in f.x ? f.x.value : Array.isArray(f) ? (i = f[0]) == null ? void 0 : i.value : 0, x = "y" in f && "value" in f.y ? f.y.value : Array.isArray(f) ? (o = f[1]) == null ? void 0 : o.value : 0, $ = "x" in f && (a = f.x) != null && a.unit ? f.x.unit : "px", g = "y" in f && (s = f.y) != null && s.unit ? f.y.unit : "px";
|
|
3075
|
+
c.translate = `${y}${$} ${x}${g}`;
|
|
3076
|
+
} else {
|
|
3077
|
+
let y = getComputedStyle(t);
|
|
3078
|
+
c.translate = y.translate && y.translate !== "none" ? y.translate : null;
|
|
3079
|
+
}
|
|
3080
|
+
return c;
|
|
3081
|
+
}
|
|
3082
|
+
let u = getComputedStyle(t);
|
|
3083
|
+
return c.rotate = u.rotate && u.rotate !== "none" ? u.rotate : "0deg", c.scale = u.scale && u.scale !== "none" ? u.scale : null, c.translate = u.translate && u.translate !== "none" ? u.translate : null, c;
|
|
3084
|
+
}
|
|
3085
|
+
var Qt = null;
|
|
3086
|
+
function wi() {
|
|
3087
|
+
if (Qt) return Qt;
|
|
3088
|
+
let t = document.createElement("div");
|
|
3089
|
+
return t.id = "snapdom-measure-slot", t.setAttribute("aria-hidden", "true"), Object.assign(t.style, { position: "absolute", left: "-99999px", top: "0px", width: "0px", height: "0px", overflow: "hidden", opacity: "0", pointerEvents: "none", contain: "size layout style" }), document.documentElement.appendChild(t), Qt = t, t;
|
|
3090
|
+
}
|
|
3091
|
+
function bi(t) {
|
|
3092
|
+
let e = wi(), n = document.createElement("div");
|
|
3093
|
+
n.style.transformOrigin = "0 0", t.baseTransform && (n.style.transform = t.baseTransform), t.rotate && (n.style.rotate = t.rotate), t.scale && (n.style.scale = t.scale), t.translate && (n.style.translate = t.translate), e.appendChild(n);
|
|
3094
|
+
let r = vn(n);
|
|
3095
|
+
return e.removeChild(n), r;
|
|
3096
|
+
}
|
|
3097
|
+
function xi(t) {
|
|
3098
|
+
let e = getComputedStyle(t), n = e.transform || "none";
|
|
3099
|
+
if (n !== "none" && !/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n)) return !0;
|
|
3100
|
+
let r = e.rotate && e.rotate !== "none" && e.rotate !== "0deg", l = e.scale && e.scale !== "none" && e.scale !== "1", i = e.translate && e.translate !== "none" && e.translate !== "0px 0px";
|
|
3101
|
+
return !!(r || l || i);
|
|
3102
|
+
}
|
|
3103
|
+
function vn(t) {
|
|
3104
|
+
let e = getComputedStyle(t).transform;
|
|
3105
|
+
if (!e || e === "none") return new DOMMatrix();
|
|
3106
|
+
try {
|
|
3107
|
+
return new DOMMatrix(e);
|
|
3108
|
+
} catch {
|
|
3109
|
+
return new WebKitCSSMatrix(e);
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
async function Sn(t, e) {
|
|
3113
|
+
var n, r;
|
|
3114
|
+
if (!t) throw new Error("Element cannot be null or undefined");
|
|
3115
|
+
Bn(e.cache);
|
|
3116
|
+
let l = e.fast, i = e.outerTransforms !== !1, o = !!e.outerShadows, a = { element: t, options: e, plugins: e.plugins }, s, c, h, u = "", d = "", p, m, f = null;
|
|
3117
|
+
await wt("beforeSnap", a), await wt("beforeClone", a);
|
|
3118
|
+
let y = Dl(a.element);
|
|
3119
|
+
try {
|
|
3120
|
+
({ clone: s, classCSS: c, styleCache: h } = await Ol(a.element, a.options)), !i && s && (f = pi(a.element, s)), !o && s && Ql(a.element, s, a.options);
|
|
3121
|
+
} finally {
|
|
3122
|
+
y();
|
|
3123
|
+
}
|
|
3124
|
+
if (a = O({ clone: s, classCSS: c, styleCache: h }, a), await wt("afterClone", a), ei(a.clone), ((n = a.options) == null ? void 0 : n.excludeMode) === "remove") try {
|
|
3125
|
+
ii(a.element, a.clone, a.styleCache);
|
|
3126
|
+
} catch (S) {
|
|
3127
|
+
console.warn("[snapdom] shrink pass failed:", S);
|
|
3128
|
+
}
|
|
3129
|
+
try {
|
|
3130
|
+
await ll(a.clone, a.element);
|
|
3131
|
+
} catch {
|
|
3132
|
+
}
|
|
3133
|
+
await new Promise((S) => {
|
|
3134
|
+
Ct(async () => {
|
|
3135
|
+
await _l(a.clone, a.options), S();
|
|
3136
|
+
}, { fast: l });
|
|
3137
|
+
}), await new Promise((S) => {
|
|
3138
|
+
Ct(async () => {
|
|
3139
|
+
await Hl(a.element, a.clone, a.styleCache, a.options), S();
|
|
3140
|
+
}, { fast: l });
|
|
3141
|
+
}), e.embedFonts && await new Promise((S) => {
|
|
3142
|
+
Ct(async () => {
|
|
3143
|
+
let b = pn(a.element), C = vl(a.element);
|
|
3144
|
+
if (xt()) {
|
|
3145
|
+
let v = new Set(Array.from(b).map((F) => String(F).split("__")[0]).filter(Boolean));
|
|
3146
|
+
await gn(v, 1);
|
|
3147
|
+
}
|
|
3148
|
+
u = await xl({ required: b, usedCodepoints: C, exclude: a.options.excludeFonts, useProxy: a.options.useProxy, fontStylesheetDomains: a.options.fontStylesheetDomains }), S();
|
|
3149
|
+
}, { fast: l });
|
|
3150
|
+
});
|
|
3151
|
+
let x = tr(a.clone).sort(), $ = x.join(",");
|
|
3152
|
+
k.baseStyle.has($) ? d = k.baseStyle.get($) : await new Promise((S) => {
|
|
3153
|
+
Ct(() => {
|
|
3154
|
+
d = er(x), k.baseStyle.set($, d), S();
|
|
3155
|
+
}, { fast: l });
|
|
3156
|
+
});
|
|
3157
|
+
let g = ci(((r = a.element) == null ? void 0 : r.ownerDocument) || document);
|
|
3158
|
+
a = O({ fontsCSS: u, baseCSS: d, scrollbarCSS: g }, a), await wt("beforeRender", a), await new Promise((S) => {
|
|
3159
|
+
Ct(() => {
|
|
3160
|
+
var b, C, v, F, E, D;
|
|
3161
|
+
let U = ft(a.element), B = a.element.getBoundingClientRect(), W = Math.max(1, L(a.element.offsetWidth || parseFloat(U.width) || B.width || 1)), I = Math.max(1, L(a.element.offsetHeight || parseFloat(U.height) || B.height || 1)), z = a.element.ownerDocument || document;
|
|
3162
|
+
if (a.element === z.body || a.element === z.documentElement) {
|
|
3163
|
+
let Q = Math.max(a.element.scrollHeight || 0, ((b = z.documentElement) == null ? void 0 : b.scrollHeight) || 0, ((C = z.body) == null ? void 0 : C.scrollHeight) || 0), et = Math.max(a.element.scrollWidth || 0, ((v = z.documentElement) == null ? void 0 : v.scrollWidth) || 0, ((F = z.body) == null ? void 0 : F.scrollWidth) || 0);
|
|
3164
|
+
Q > 0 && (I = Math.max(I, L(Q))), et > 0 && (W = Math.max(W, L(et)));
|
|
3165
|
+
try {
|
|
3166
|
+
let ot = (a.scrollbarCSS || "").length + (a.baseCSS || "").length + (a.fontsCSS || "").length + (a.classCSS || "").length, ut = k.measureHints.get(a.element);
|
|
3167
|
+
if (ut && ut.cssLen === ot && ut.w0 === W) ut.csh > 0 && (I = Math.max(I, L(ut.csh))), ut.csw > 0 && (W = Math.max(W, L(ut.csw)));
|
|
3168
|
+
else {
|
|
3169
|
+
let ct = z.createElement("div");
|
|
3170
|
+
ct.style.cssText = "position:absolute!important;left:-9999px!important;top:0!important;width:" + W + "px!important;overflow:visible!important;visibility:hidden!important;";
|
|
3171
|
+
let Wt = z.createElement("style");
|
|
3172
|
+
Wt.textContent = (a.scrollbarCSS || "") + a.baseCSS + a.fontsCSS + "svg{overflow:visible;} foreignObject{overflow:visible;}" + a.classCSS, ct.appendChild(Wt), ct.appendChild(a.clone.cloneNode(!0)), z.body.appendChild(ct);
|
|
3173
|
+
let yt = ct.scrollHeight, Jt = ct.scrollWidth;
|
|
3174
|
+
z.body.removeChild(ct), k.measureHints.set(a.element, { cssLen: ot, w0: W, csh: yt, csw: Jt }), yt > 0 && (I = Math.max(I, L(yt))), Jt > 0 && (W = Math.max(W, L(Jt)));
|
|
3175
|
+
}
|
|
3176
|
+
} catch {
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
if (((E = a.options) == null ? void 0 : E.excludeMode) === "remove") {
|
|
3180
|
+
let Q = si(a.element, a.options);
|
|
3181
|
+
Number.isFinite(Q) && Q > 0 && (I = Math.max(1, Math.min(I, L(Q + 1))));
|
|
3182
|
+
}
|
|
3183
|
+
let mt = (Q, et = NaN) => {
|
|
3184
|
+
let ot = typeof Q == "string" ? parseFloat(Q) : Q;
|
|
3185
|
+
return Number.isFinite(ot) ? ot : et;
|
|
3186
|
+
}, M = mt(a.options.width), P = mt(a.options.height), T = W, _ = I, A = Number.isFinite(M), N = Number.isFinite(P), j = I > 0 ? W / I : 1;
|
|
3187
|
+
A && N ? (T = Math.max(1, L(M)), _ = Math.max(1, L(P))) : A ? (T = Math.max(1, L(M)), _ = Math.max(1, L(T / (j || 1)))) : N ? (_ = Math.max(1, L(P)), T = Math.max(1, L(_ * (j || 1)))) : (T = W, _ = I);
|
|
3188
|
+
let R = 0, X = 0, Y = W, Z = I;
|
|
3189
|
+
if (!i && f && Number.isFinite(f.a)) {
|
|
3190
|
+
let Q = { a: f.a, b: f.b || 0, c: f.c || 0, d: f.d || 1, e: 0, f: 0 }, et = Ve(W, I, Q, 0, 0);
|
|
3191
|
+
R = L(et.minX), X = L(et.minY), Y = L(et.maxX), Z = L(et.maxY);
|
|
3192
|
+
} else if (i && qe(a.element)) {
|
|
3193
|
+
let Q = U.transform && U.transform !== "none" ? U.transform : "", et = yi(a.element), ot = bi({ baseTransform: Q, rotate: et.rotate || "0deg", scale: et.scale, translate: et.translate }), { ox: ut, oy: ct } = gi(U, W, I), Wt = ot.is2D ? ot : new DOMMatrix(ot.toString()), yt = Ve(W, I, Wt, ut, ct);
|
|
3194
|
+
R = L(yt.minX), X = L(yt.minY), Y = L(yt.maxX), Z = L(yt.maxY);
|
|
3195
|
+
}
|
|
3196
|
+
let tt = di(U), H = fi(U), G = mi(U), K = hi(U), ht = o ? { top: L(tt.top + H.top + G.top + K.bleed.top), right: L(tt.right + H.right + G.right + K.bleed.right), bottom: L(tt.bottom + H.bottom + G.bottom + K.bleed.bottom), left: L(tt.left + H.left + G.left + K.bleed.left) } : { top: 0, right: 0, bottom: 0, left: 0 };
|
|
3197
|
+
R = L(R - ht.left), X = L(X - ht.top), Y = L(Y + ht.right), Z = L(Z + ht.bottom);
|
|
3198
|
+
let ge = Math.max(1, L(Y - R)), ye = Math.max(1, L(Z - X)), Mn = A || N ? L(T / W) : 1, $n = N || A ? L(_ / I) : 1, kn = Math.max(1, L(ge * Mn)), An = Math.max(1, L(ye * $n)), we = "http://www.w3.org/2000/svg", En = xt() && qe(a.element) ? 1 : 0, pt = L(En + (i ? 0 : 1)), gt = document.createElementNS(we, "foreignObject"), Fn = L(R), Ln = L(X);
|
|
3199
|
+
gt.setAttribute("x", String(L(-(Fn - pt)))), gt.setAttribute("y", String(L(-(Ln - pt)))), gt.setAttribute("width", String(L(W + pt * 2))), gt.setAttribute("height", String(L(I + pt * 2))), gt.style.overflow = "visible";
|
|
3200
|
+
let be = document.createElement("style"), Nn = 'svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject *{min-width:0;} foreignObject pre,foreignObject [style*="white-space"]{white-space:inherit;}';
|
|
3201
|
+
be.textContent = (a.scrollbarCSS || "") + a.baseCSS + a.fontsCSS + Nn + a.classCSS, gt.appendChild(be);
|
|
3202
|
+
let Tt = document.createElement("div");
|
|
3203
|
+
Tt.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"), Tt.style.cssText = `all:initial;box-sizing:border-box;display:block;overflow:visible;width:${L(W)}px;height:${L(I)}px`, Tt.appendChild(a.clone), gt.appendChild(Tt);
|
|
3204
|
+
let Pn = new XMLSerializer().serializeToString(gt), Yt = L(ge + pt * 2), Gt = L(ye + pt * 2), xe = A || N;
|
|
3205
|
+
e.meta = { w0: W, h0: I, vbW: Yt, vbH: Gt, targetW: T, targetH: _ };
|
|
3206
|
+
let Rn = xt() && xe ? Yt : L(kn + pt * 2), Tn = xt() && xe ? Gt : L(An + pt * 2), Wn = parseFloat((D = ft(z.documentElement)) == null ? void 0 : D.fontSize) || 16;
|
|
3207
|
+
m = `<svg xmlns="${we}" width="${Rn}" height="${Tn}" viewBox="0 0 ${Yt} ${Gt}" font-size="${Wn}px">` + Pn + "</svg>", p = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`, a = O({ svgString: m, dataURL: p }, a), S();
|
|
3208
|
+
}, { fast: l });
|
|
3209
|
+
}), await wt("afterRender", a);
|
|
3210
|
+
let w = document.getElementById("snapdom-sandbox");
|
|
3211
|
+
return w && w.style.position === "absolute" && w.remove(), a.dataURL;
|
|
3212
|
+
}
|
|
3213
|
+
function qe(t) {
|
|
3214
|
+
return xi(t);
|
|
3215
|
+
}
|
|
3216
|
+
it();
|
|
3217
|
+
function vi(t = {}) {
|
|
3218
|
+
var e, n, r, l, i, o, a, s, c, h, u, d, p, m, f, y, x, $, g, w, S, b;
|
|
3219
|
+
let C = (e = t.format) != null ? e : "png";
|
|
3220
|
+
C === "jpg" && (C = "jpeg");
|
|
3221
|
+
let v = Dn(t.cache);
|
|
3222
|
+
return { debug: (n = t.debug) != null ? n : !1, fast: (r = t.fast) != null ? r : !0, scale: (l = t.scale) != null ? l : 1, exclude: (i = t.exclude) != null ? i : [], excludeMode: (o = t.excludeMode) != null ? o : "hide", filter: (a = t.filter) != null ? a : null, filterMode: (s = t.filterMode) != null ? s : "hide", placeholders: t.placeholders !== !1, embedFonts: (c = t.embedFonts) != null ? c : !1, iconFonts: Array.isArray(t.iconFonts) ? t.iconFonts : t.iconFonts ? [t.iconFonts] : [], localFonts: Array.isArray(t.localFonts) ? t.localFonts : [], excludeFonts: (h = t.excludeFonts) != null ? h : void 0, fontStylesheetDomains: Array.isArray(t.fontStylesheetDomains) ? t.fontStylesheetDomains : [], fallbackURL: (u = t.fallbackURL) != null ? u : void 0, cache: v, useProxy: typeof t.useProxy == "string" ? t.useProxy : "", width: (d = t.width) != null ? d : null, height: (p = t.height) != null ? p : null, format: C, type: (m = t.type) != null ? m : "svg", quality: (f = t.quality) != null ? f : 0.92, dpr: (y = t.dpr) != null ? y : window.devicePixelRatio || 1, backgroundColor: (x = t.backgroundColor) != null ? x : ["jpeg", "webp"].includes(C) ? "#ffffff" : null, filename: ($ = t.filename) != null ? $ : "snapDOM", outerTransforms: (g = t.outerTransforms) != null ? g : !0, outerShadows: (w = t.outerShadows) != null ? w : !1, safariWarmupAttempts: Math.min(3, Math.max(1, ((S = t.safariWarmupAttempts) != null ? S : 3) | 0)), excludeStyleProps: (b = t.excludeStyleProps) != null ? b : null };
|
|
3223
|
+
}
|
|
3224
|
+
Rt();
|
|
3225
|
+
Ze();
|
|
3226
|
+
st();
|
|
3227
|
+
$t();
|
|
3228
|
+
it();
|
|
3229
|
+
function Si(...t) {
|
|
3230
|
+
return Yl(...t), q;
|
|
3231
|
+
}
|
|
3232
|
+
var q = Object.assign(Mi, { plugins: Si }), Cn = /* @__PURE__ */ Symbol("snapdom.internal"), Ci = /* @__PURE__ */ Symbol("snapdom.internal.silent"), ze = !1;
|
|
3233
|
+
async function Mi(t, e) {
|
|
3234
|
+
var n;
|
|
3235
|
+
if (!t) throw new Error("Element cannot be null or undefined");
|
|
3236
|
+
let r = vi(e);
|
|
3237
|
+
if (Kl(r, e && e.plugins), xt() && (r.embedFonts === !0 || ki(t))) {
|
|
3238
|
+
if (r.embedFonts) try {
|
|
3239
|
+
let i = pn(t), o = new Set([...i].map((a) => String(a).split("__")[0]).filter(Boolean));
|
|
3240
|
+
await gn(o, 1);
|
|
3241
|
+
} catch {
|
|
3242
|
+
}
|
|
3243
|
+
let l = (n = r.safariWarmupAttempts) != null ? n : 3;
|
|
3244
|
+
for (let i = 0; i < l; i++) try {
|
|
3245
|
+
await $i(t, e);
|
|
3246
|
+
} catch {
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
return r.iconFonts && r.iconFonts.length > 0 && Kr(r.iconFonts), r.snap || (r.snap = { toPng: (l, i) => q.toPng(l, i), toSvg: (l, i) => q.toSvg(l, i) }), q.capture(t, r, Cn);
|
|
3250
|
+
}
|
|
3251
|
+
q.capture = async (t, e, n) => {
|
|
3252
|
+
if (n !== Cn) throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");
|
|
3253
|
+
let r = await Sn(t, e), l = { img: async (f, y) => {
|
|
3254
|
+
let { toImg: x } = await Promise.resolve().then(() => (ke(), ne));
|
|
3255
|
+
return x(r, O(O({}, f), y || {}));
|
|
3256
|
+
}, svg: async (f, y) => {
|
|
3257
|
+
let { toSvg: x } = await Promise.resolve().then(() => (ke(), ne));
|
|
3258
|
+
return x(r, O(O({}, f), y || {}));
|
|
3259
|
+
}, canvas: async (f, y) => {
|
|
3260
|
+
let { toCanvas: x } = await Promise.resolve().then(() => (Xt(), tn));
|
|
3261
|
+
return x(r, O(O({}, f), y || {}));
|
|
3262
|
+
}, blob: async (f, y) => {
|
|
3263
|
+
let { toBlob: x } = await Promise.resolve().then(() => (on(), rn));
|
|
3264
|
+
return x(r, O(O({}, f), y || {}));
|
|
3265
|
+
}, png: async (f, y) => {
|
|
3266
|
+
let { rasterize: x } = await Promise.resolve().then(() => (jt(), Ut));
|
|
3267
|
+
return x(r, J(O(O({}, f), y || {}), { format: "png" }));
|
|
3268
|
+
}, jpeg: async (f, y) => {
|
|
3269
|
+
let { rasterize: x } = await Promise.resolve().then(() => (jt(), Ut));
|
|
3270
|
+
return x(r, J(O(O({}, f), y || {}), { format: "jpeg" }));
|
|
3271
|
+
}, webp: async (f, y) => {
|
|
3272
|
+
let { rasterize: x } = await Promise.resolve().then(() => (jt(), Ut));
|
|
3273
|
+
return x(r, J(O(O({}, f), y || {}), { format: "webp" }));
|
|
3274
|
+
}, download: async (f, y) => {
|
|
3275
|
+
let { download: x } = await Promise.resolve().then(() => (pr(), an));
|
|
3276
|
+
return x(r, O(O({}, f), y || {}));
|
|
3277
|
+
} }, i = {};
|
|
3278
|
+
for (let f of ["img", "svg", "canvas", "blob", "png", "jpeg", "webp"]) i[f] = async (y) => l[f](e, J(O({}, y || {}), { [Ci]: !0 }));
|
|
3279
|
+
i.jpg = i.jpeg;
|
|
3280
|
+
let o = J(O({}, e), { export: { url: r }, exports: i }), a = await Gl("defineExports", o), s = Object.assign({}, ...a.filter((f) => f && typeof f == "object")), c = O(O({}, l), s);
|
|
3281
|
+
c.jpeg && !c.jpg && (c.jpg = (f, y) => c.jpeg(f, y));
|
|
3282
|
+
function h(f, y) {
|
|
3283
|
+
let x = O(O({}, e), y || {});
|
|
3284
|
+
return (f === "jpeg" || f === "jpg") && (x.backgroundColor == null || x.backgroundColor === "transparent") && (x.backgroundColor = "#ffffff"), x;
|
|
3285
|
+
}
|
|
3286
|
+
let u = !1, d = Promise.resolve();
|
|
3287
|
+
async function p(f, y) {
|
|
3288
|
+
let x = async () => {
|
|
3289
|
+
let $ = c[f];
|
|
3290
|
+
if (!$) throw new Error(`[snapdom] Unknown export type: ${f}`);
|
|
3291
|
+
let g = h(f, y), w = J(O({}, e), { export: { type: f, options: g, url: r } });
|
|
3292
|
+
await wt("beforeExport", w);
|
|
3293
|
+
let S = await $(w, g);
|
|
3294
|
+
return await wt("afterExport", w, S), u || (u = !0, await wt("afterSnap", e)), S;
|
|
3295
|
+
};
|
|
3296
|
+
return d = d.then(x);
|
|
3297
|
+
}
|
|
3298
|
+
let m = { url: r, toRaw: () => r, to: (f, y) => p(f, y), toImg: (f) => p("img", f), toSvg: (f) => p("svg", f), toCanvas: (f) => p("canvas", f), toBlob: (f) => p("blob", f), toPng: (f) => p("png", f), toJpg: (f) => p("jpg", f), toWebp: (f) => p("webp", f), download: (f) => p("download", f) };
|
|
3299
|
+
for (let f of Object.keys(c)) {
|
|
3300
|
+
let y = "to" + f.charAt(0).toUpperCase() + f.slice(1);
|
|
3301
|
+
m[y] || (m[y] = (x) => p(f, x));
|
|
3302
|
+
}
|
|
3303
|
+
return m;
|
|
3304
|
+
};
|
|
3305
|
+
q.toRaw = (t, e) => q(t, e).then((n) => n.toRaw());
|
|
3306
|
+
q.toImg = (t, e) => q(t, e).then((n) => n.toImg());
|
|
3307
|
+
q.toSvg = (t, e) => q(t, e).then((n) => n.toSvg());
|
|
3308
|
+
q.toCanvas = (t, e) => q(t, e).then((n) => n.toCanvas());
|
|
3309
|
+
q.toBlob = (t, e) => q(t, e).then((n) => n.toBlob());
|
|
3310
|
+
q.toPng = (t, e) => q(t, J(O({}, e), { format: "png" })).then((n) => n.toPng());
|
|
3311
|
+
q.toJpg = (t, e) => q(t, J(O({}, e), { format: "jpeg" })).then((n) => n.toJpg());
|
|
3312
|
+
q.toWebp = (t, e) => q(t, J(O({}, e), { format: "webp" })).then((n) => n.toWebp());
|
|
3313
|
+
q.download = (t, e) => q(t, e).then((n) => n.download());
|
|
3314
|
+
async function $i(t, e) {
|
|
3315
|
+
if (ze) return;
|
|
3316
|
+
let n = J(O({}, e), { fast: !0, embedFonts: !0, scale: 0.2 }), r;
|
|
3317
|
+
try {
|
|
3318
|
+
r = await Sn(t, n);
|
|
3319
|
+
} catch (l) {
|
|
3320
|
+
V(e, "safariWarmup pre-capture failed", l);
|
|
3321
|
+
}
|
|
3322
|
+
await new Promise((l) => requestAnimationFrame(() => requestAnimationFrame(l))), r && await new Promise((l) => {
|
|
3323
|
+
let i = new Image();
|
|
3324
|
+
try {
|
|
3325
|
+
i.decoding = "sync", i.loading = "eager";
|
|
3326
|
+
} catch (o) {
|
|
3327
|
+
V(e, "safariWarmup img hints failed", o);
|
|
3328
|
+
}
|
|
3329
|
+
i.style.cssText = "position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;", i.src = r, document.body.appendChild(i), (async () => {
|
|
3330
|
+
try {
|
|
3331
|
+
typeof i.decode == "function" && await i.decode();
|
|
3332
|
+
} catch (a) {
|
|
3333
|
+
V(e, "safariWarmup img.decode failed", a);
|
|
3334
|
+
}
|
|
3335
|
+
let o = performance.now();
|
|
3336
|
+
for (; !(i.complete && i.naturalWidth > 0) && performance.now() - o < 900; ) await new Promise((a) => setTimeout(a, 200));
|
|
3337
|
+
await new Promise((a) => requestAnimationFrame(a));
|
|
3338
|
+
try {
|
|
3339
|
+
let a = document.createElement("canvas");
|
|
3340
|
+
a.width = Math.max(1, i.naturalWidth || 10), a.height = Math.max(1, i.naturalHeight || 10);
|
|
3341
|
+
let s = a.getContext("2d");
|
|
3342
|
+
s && s.drawImage(i, 0, 0);
|
|
3343
|
+
} catch {
|
|
3344
|
+
}
|
|
3345
|
+
await new Promise((a) => requestAnimationFrame(a));
|
|
3346
|
+
try {
|
|
3347
|
+
i.remove();
|
|
3348
|
+
} catch (a) {
|
|
3349
|
+
V(e, "safariWarmup img.remove failed", a);
|
|
3350
|
+
}
|
|
3351
|
+
l();
|
|
3352
|
+
})();
|
|
3353
|
+
}), t.querySelectorAll("canvas").forEach((l) => {
|
|
3354
|
+
try {
|
|
3355
|
+
let i = l.getContext("2d", { willReadFrequently: !0 });
|
|
3356
|
+
i && i.getImageData(0, 0, 1, 1);
|
|
3357
|
+
} catch (i) {
|
|
3358
|
+
V(e, "safariWarmup canvas poke failed", i);
|
|
3359
|
+
}
|
|
3360
|
+
}), ze = !0;
|
|
3361
|
+
}
|
|
3362
|
+
function ki(t) {
|
|
3363
|
+
let e = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT);
|
|
3364
|
+
for (; e.nextNode(); ) {
|
|
3365
|
+
let n = e.currentNode, r = getComputedStyle(n), l = r.backgroundImage && r.backgroundImage !== "none", i = r.maskImage && r.maskImage !== "none" || r.webkitMaskImage && r.webkitMaskImage !== "none";
|
|
3366
|
+
if (l || i || n.tagName === "CANVAS") return !0;
|
|
3367
|
+
}
|
|
3368
|
+
return !1;
|
|
3369
|
+
}
|
|
3370
|
+
export {
|
|
3371
|
+
q as snapdom
|
|
3372
|
+
};
|
|
3373
|
+
//# sourceMappingURL=snapdom-6yvsn_Iv-6uiY9rZc.js.map
|