likec4 1.24.0 → 1.24.1
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/__app__/src/chunks/{-index-overview-fhfhEsGb.js → -index-overview-u7lEihT1.js} +4 -4
- package/__app__/src/chunks/{index-B1tnNgDX.js → index-C6pszJh8.js} +164 -160
- package/__app__/src/chunks/{likec4-DgZMMrvs.js → likec4-DRDnYFvy.js} +841 -839
- package/__app__/src/chunks/{main-DiEdSc7f.js → main-CSfHpw_A.js} +7217 -7001
- package/__app__/src/chunks/{mantine-Dy50iVbn.js → mantine-Z8I_Wyle.js} +48 -48
- package/__app__/src/chunks/{tanstack-router-B97XgOdm.js → tanstack-router-MjA2OK6n.js} +1 -1
- package/__app__/src/main.js +1 -1
- package/__app__/src/style.css +1 -1
- package/dist/cli/index.mjs +18 -18
- package/dist/index.d.mts +190 -193
- package/dist/index.d.ts +190 -193
- package/dist/index.mjs +1 -1
- package/dist/shared/{likec4.DNjEPXYD.mjs → likec4.D4N3up-s.mjs} +1411 -1409
- package/package.json +22 -23
- package/react/index.d.ts +6 -0
- package/react/index.js +1070 -861
- package/react/style.css +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as t, jsxs as u, Fragment as z } from "react/jsx-runtime";
|
|
2
2
|
import { useOverviewGraph as L } from "virtual:likec4/overview-graph";
|
|
3
3
|
import { nonexhaustive as R } from "@likec4/core";
|
|
4
|
-
import { u as V } from "./tanstack-router-
|
|
5
|
-
import { B as G, H as v, P as g, u as $, a as K, i as U, b as A, c as X } from "./likec4-
|
|
4
|
+
import { u as V } from "./tanstack-router-MjA2OK6n.js";
|
|
5
|
+
import { B as G, H as v, P as g, u as $, a as K, i as U, b as A, c as X } from "./likec4-DRDnYFvy.js";
|
|
6
6
|
import { memo as k, useRef as Y, useMemo as B } from "react";
|
|
7
|
-
import { c as b, I as q, n as S, u as j, i as J } from "./main-
|
|
8
|
-
import { P as O, c as I, G as C, T as F, a as y, C as Q, b as W, d as ee, I as te, B as P, u as se } from "./mantine-
|
|
7
|
+
import { c as b, I as q, n as S, u as j, i as J } from "./main-CSfHpw_A.js";
|
|
8
|
+
import { P as O, c as I, G as C, T as F, a as y, C as Q, b as W, d as ee, I as te, B as P, u as se } from "./mantine-Z8I_Wyle.js";
|
|
9
9
|
import { usePreviewUrl as ae } from "virtual:likec4/previews";
|
|
10
10
|
/**
|
|
11
11
|
* @license @tabler/icons-react v3.29.0 - MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function W(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
@@ -8,7 +8,7 @@ function O(t, e) {
|
|
|
8
8
|
const r = document.implementation.createHTMLDocument(), n = r.createElement("base"), s = r.createElement("a");
|
|
9
9
|
return r.head.appendChild(n), r.body.appendChild(s), e && (n.href = e), s.href = t, s.href;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const q = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
13
13
|
const e = () => (
|
|
14
14
|
// eslint-disable-next-line no-bitwise
|
|
@@ -16,29 +16,33 @@ const _ = /* @__PURE__ */ (() => {
|
|
|
16
16
|
);
|
|
17
17
|
return () => (t += 1, `u${e()}${t}`);
|
|
18
18
|
})();
|
|
19
|
-
function
|
|
19
|
+
function m(t) {
|
|
20
20
|
const e = [];
|
|
21
21
|
for (let r = 0, n = t.length; r < n; r++)
|
|
22
22
|
e.push(t[r]);
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
let g = null;
|
|
26
|
+
function I(t = {}) {
|
|
27
|
+
return g || (t.includeStyleProperties ? (g = t.includeStyleProperties, g) : (g = m(window.getComputedStyle(document.documentElement)), g));
|
|
28
|
+
}
|
|
29
|
+
function y(t, e) {
|
|
26
30
|
const n = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
|
|
27
31
|
return n ? parseFloat(n.replace("px", "")) : 0;
|
|
28
32
|
}
|
|
29
|
-
function
|
|
30
|
-
const e =
|
|
33
|
+
function B(t) {
|
|
34
|
+
const e = y(t, "border-left-width"), r = y(t, "border-right-width");
|
|
31
35
|
return t.clientWidth + e + r;
|
|
32
36
|
}
|
|
33
|
-
function
|
|
34
|
-
const e =
|
|
37
|
+
function j(t) {
|
|
38
|
+
const e = y(t, "border-top-width"), r = y(t, "border-bottom-width");
|
|
35
39
|
return t.clientHeight + e + r;
|
|
36
40
|
}
|
|
37
|
-
function
|
|
38
|
-
const r = e.width ||
|
|
41
|
+
function k(t, e = {}) {
|
|
42
|
+
const r = e.width || B(t), n = e.height || j(t);
|
|
39
43
|
return { width: r, height: n };
|
|
40
44
|
}
|
|
41
|
-
function
|
|
45
|
+
function z() {
|
|
42
46
|
let t, e;
|
|
43
47
|
try {
|
|
44
48
|
e = process;
|
|
@@ -48,10 +52,10 @@ function B() {
|
|
|
48
52
|
return r && (t = parseInt(r, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
49
53
|
}
|
|
50
54
|
const u = 16384;
|
|
51
|
-
function
|
|
55
|
+
function G(t) {
|
|
52
56
|
(t.width > u || t.height > u) && (t.width > u && t.height > u ? t.width > t.height ? (t.height *= u / t.width, t.width = u) : (t.width *= u / t.height, t.height = u) : t.width > u ? (t.height *= u / t.width, t.width = u) : (t.width *= u / t.height, t.height = u));
|
|
53
57
|
}
|
|
54
|
-
function
|
|
58
|
+
function X(t, e = {}) {
|
|
55
59
|
return t.toBlob ? new Promise((r) => {
|
|
56
60
|
t.toBlob(r, e.type ? e.type : "image/png", e.quality ? e.quality : 1);
|
|
57
61
|
}) : new Promise((r) => {
|
|
@@ -63,7 +67,7 @@ function z(t, e = {}) {
|
|
|
63
67
|
}));
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
|
-
function
|
|
70
|
+
function w(t) {
|
|
67
71
|
return new Promise((e, r) => {
|
|
68
72
|
const n = new Image();
|
|
69
73
|
n.onload = () => {
|
|
@@ -73,12 +77,12 @@ function y(t) {
|
|
|
73
77
|
}, n.onerror = r, n.crossOrigin = "anonymous", n.decoding = "async", n.src = t;
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
|
-
async function
|
|
80
|
+
async function K(t) {
|
|
77
81
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
|
|
78
82
|
}
|
|
79
|
-
async function
|
|
83
|
+
async function J(t, e, r) {
|
|
80
84
|
const n = "http://www.w3.org/2000/svg", s = document.createElementNS(n, "svg"), i = document.createElementNS(n, "foreignObject");
|
|
81
|
-
return s.setAttribute("width", `${e}`), s.setAttribute("height", `${r}`), s.setAttribute("viewBox", `0 0 ${e} ${r}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), s.appendChild(i), i.appendChild(t),
|
|
85
|
+
return s.setAttribute("width", `${e}`), s.setAttribute("height", `${r}`), s.setAttribute("viewBox", `0 0 ${e} ${r}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), s.appendChild(i), i.appendChild(t), K(s);
|
|
82
86
|
}
|
|
83
87
|
const l = (t, e) => {
|
|
84
88
|
if (t instanceof e)
|
|
@@ -86,67 +90,67 @@ const l = (t, e) => {
|
|
|
86
90
|
const r = Object.getPrototypeOf(t);
|
|
87
91
|
return r === null ? !1 : r.constructor.name === e.name || l(r, e);
|
|
88
92
|
};
|
|
89
|
-
function
|
|
93
|
+
function Q(t) {
|
|
90
94
|
const e = t.getPropertyValue("content");
|
|
91
95
|
return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
|
|
92
96
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
95
|
-
const
|
|
96
|
-
return `${
|
|
97
|
+
function Y(t, e) {
|
|
98
|
+
return I(e).map((r) => {
|
|
99
|
+
const n = t.getPropertyValue(r), s = t.getPropertyPriority(r);
|
|
100
|
+
return `${r}: ${n}${s ? " !important" : ""};`;
|
|
97
101
|
}).join(" ");
|
|
98
102
|
}
|
|
99
|
-
function
|
|
100
|
-
const
|
|
101
|
-
return document.createTextNode(`${
|
|
103
|
+
function Z(t, e, r, n) {
|
|
104
|
+
const s = `.${t}:${e}`, i = r.cssText ? Q(r) : Y(r, n);
|
|
105
|
+
return document.createTextNode(`${s}{${i}}`);
|
|
102
106
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
107
|
+
function C(t, e, r, n) {
|
|
108
|
+
const s = window.getComputedStyle(t, r), i = s.getPropertyValue("content");
|
|
109
|
+
if (i === "" || i === "none")
|
|
106
110
|
return;
|
|
107
|
-
const
|
|
111
|
+
const c = q();
|
|
108
112
|
try {
|
|
109
|
-
e.className = `${e.className} ${
|
|
113
|
+
e.className = `${e.className} ${c}`;
|
|
110
114
|
} catch {
|
|
111
115
|
return;
|
|
112
116
|
}
|
|
113
|
-
const
|
|
114
|
-
|
|
117
|
+
const a = document.createElement("style");
|
|
118
|
+
a.appendChild(Z(c, r, s, n)), e.appendChild(a);
|
|
115
119
|
}
|
|
116
|
-
function
|
|
117
|
-
|
|
120
|
+
function N(t, e, r) {
|
|
121
|
+
C(t, e, ":before", r), C(t, e, ":after", r);
|
|
118
122
|
}
|
|
119
|
-
const
|
|
120
|
-
woff:
|
|
121
|
-
woff2:
|
|
123
|
+
const P = "application/font-woff", $ = "image/jpeg", tt = {
|
|
124
|
+
woff: P,
|
|
125
|
+
woff2: P,
|
|
122
126
|
ttf: "application/font-truetype",
|
|
123
127
|
eot: "application/vnd.ms-fontobject",
|
|
124
128
|
png: "image/png",
|
|
125
|
-
jpg:
|
|
126
|
-
jpeg:
|
|
129
|
+
jpg: $,
|
|
130
|
+
jpeg: $,
|
|
127
131
|
gif: "image/gif",
|
|
128
132
|
tiff: "image/tiff",
|
|
129
133
|
svg: "image/svg+xml",
|
|
130
134
|
webp: "image/webp"
|
|
131
135
|
};
|
|
132
|
-
function
|
|
136
|
+
function et(t) {
|
|
133
137
|
const e = /\.([^./]*?)$/g.exec(t);
|
|
134
138
|
return e ? e[1] : "";
|
|
135
139
|
}
|
|
136
|
-
function
|
|
137
|
-
const e =
|
|
138
|
-
return
|
|
140
|
+
function x(t) {
|
|
141
|
+
const e = et(t).toLowerCase();
|
|
142
|
+
return tt[e] || "";
|
|
139
143
|
}
|
|
140
|
-
function
|
|
144
|
+
function rt(t) {
|
|
141
145
|
return t.split(/,/)[1];
|
|
142
146
|
}
|
|
143
|
-
function
|
|
147
|
+
function E(t) {
|
|
144
148
|
return t.search(/^(data:)/) !== -1;
|
|
145
149
|
}
|
|
146
|
-
function
|
|
150
|
+
function nt(t, e) {
|
|
147
151
|
return `data:${e};base64,${t}`;
|
|
148
152
|
}
|
|
149
|
-
async function
|
|
153
|
+
async function D(t, e, r) {
|
|
150
154
|
const n = await fetch(t, e);
|
|
151
155
|
if (n.status === 404)
|
|
152
156
|
throw new Error(`Resource "${n.url}" not found`);
|
|
@@ -162,86 +166,86 @@ async function I(t, e, r) {
|
|
|
162
166
|
}, a.readAsDataURL(s);
|
|
163
167
|
});
|
|
164
168
|
}
|
|
165
|
-
const
|
|
166
|
-
function
|
|
169
|
+
const S = {};
|
|
170
|
+
function it(t, e, r) {
|
|
167
171
|
let n = t.replace(/\?.*/, "");
|
|
168
172
|
return r && (n = t), /ttf|otf|eot|woff2?/i.test(n) && (n = n.replace(/.*\//, "")), e ? `[${e}]${n}` : n;
|
|
169
173
|
}
|
|
170
|
-
async function
|
|
171
|
-
const n =
|
|
172
|
-
if (
|
|
173
|
-
return
|
|
174
|
+
async function R(t, e, r) {
|
|
175
|
+
const n = it(t, e, r.includeQueryParams);
|
|
176
|
+
if (S[n] != null)
|
|
177
|
+
return S[n];
|
|
174
178
|
r.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
175
179
|
let s;
|
|
176
180
|
try {
|
|
177
|
-
const i = await
|
|
178
|
-
s =
|
|
181
|
+
const i = await D(t, r.fetchRequestInit, ({ res: c, result: a }) => (e || (e = c.headers.get("Content-Type") || ""), rt(a)));
|
|
182
|
+
s = nt(i, e);
|
|
179
183
|
} catch (i) {
|
|
180
184
|
s = r.imagePlaceholder || "";
|
|
181
185
|
let c = `Failed to fetch resource: ${t}`;
|
|
182
186
|
i && (c = typeof i == "string" ? i : i.message), c && console.warn(c);
|
|
183
187
|
}
|
|
184
|
-
return
|
|
188
|
+
return S[n] = s, s;
|
|
185
189
|
}
|
|
186
|
-
async function
|
|
190
|
+
async function st(t) {
|
|
187
191
|
const e = t.toDataURL();
|
|
188
|
-
return e === "data:," ? t.cloneNode(!1) :
|
|
192
|
+
return e === "data:," ? t.cloneNode(!1) : w(e);
|
|
189
193
|
}
|
|
190
|
-
async function
|
|
194
|
+
async function ct(t, e) {
|
|
191
195
|
if (t.currentSrc) {
|
|
192
196
|
const i = document.createElement("canvas"), c = i.getContext("2d");
|
|
193
197
|
i.width = t.clientWidth, i.height = t.clientHeight, c?.drawImage(t, 0, 0, i.width, i.height);
|
|
194
198
|
const a = i.toDataURL();
|
|
195
|
-
return
|
|
199
|
+
return w(a);
|
|
196
200
|
}
|
|
197
|
-
const r = t.poster, n =
|
|
198
|
-
return
|
|
201
|
+
const r = t.poster, n = x(r), s = await R(r, n, e);
|
|
202
|
+
return w(s);
|
|
199
203
|
}
|
|
200
|
-
async function
|
|
201
|
-
var
|
|
204
|
+
async function at(t, e) {
|
|
205
|
+
var r;
|
|
202
206
|
try {
|
|
203
|
-
if (!((
|
|
204
|
-
return await
|
|
207
|
+
if (!((r = t?.contentDocument) === null || r === void 0) && r.body)
|
|
208
|
+
return await p(t.contentDocument.body, e, !0);
|
|
205
209
|
} catch {
|
|
206
210
|
}
|
|
207
211
|
return t.cloneNode(!1);
|
|
208
212
|
}
|
|
209
|
-
async function
|
|
210
|
-
return l(t, HTMLCanvasElement) ?
|
|
213
|
+
async function ot(t, e) {
|
|
214
|
+
return l(t, HTMLCanvasElement) ? st(t) : l(t, HTMLVideoElement) ? ct(t, e) : l(t, HTMLIFrameElement) ? at(t, e) : t.cloneNode(U(t));
|
|
211
215
|
}
|
|
212
|
-
const
|
|
213
|
-
async function
|
|
216
|
+
const lt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", U = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
217
|
+
async function ut(t, e, r) {
|
|
214
218
|
var n, s;
|
|
215
|
-
if (
|
|
219
|
+
if (U(e))
|
|
216
220
|
return e;
|
|
217
221
|
let i = [];
|
|
218
|
-
return
|
|
222
|
+
return lt(t) && t.assignedNodes ? i = m(t.assignedNodes()) : l(t, HTMLIFrameElement) && (!((n = t.contentDocument) === null || n === void 0) && n.body) ? i = m(t.contentDocument.body.childNodes) : i = m(((s = t.shadowRoot) !== null && s !== void 0 ? s : t).childNodes), i.length === 0 || l(t, HTMLVideoElement) || await i.reduce((c, a) => c.then(() => p(a, r)).then((o) => {
|
|
219
223
|
o && e.appendChild(o);
|
|
220
224
|
}), Promise.resolve()), e;
|
|
221
225
|
}
|
|
222
|
-
function
|
|
223
|
-
const
|
|
224
|
-
if (!
|
|
226
|
+
function ft(t, e, r) {
|
|
227
|
+
const n = e.style;
|
|
228
|
+
if (!n)
|
|
225
229
|
return;
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
let
|
|
229
|
-
|
|
230
|
+
const s = window.getComputedStyle(t);
|
|
231
|
+
s.cssText ? (n.cssText = s.cssText, n.transformOrigin = s.transformOrigin) : I(r).forEach((i) => {
|
|
232
|
+
let c = s.getPropertyValue(i);
|
|
233
|
+
i === "font-size" && c.endsWith("px") && (c = `${Math.floor(parseFloat(c.substring(0, c.length - 2))) - 0.1}px`), l(t, HTMLIFrameElement) && i === "display" && c === "inline" && (c = "block"), i === "d" && e.getAttribute("d") && (c = `path(${e.getAttribute("d")})`), n.setProperty(i, c, s.getPropertyPriority(i));
|
|
230
234
|
});
|
|
231
235
|
}
|
|
232
|
-
function
|
|
236
|
+
function ht(t, e) {
|
|
233
237
|
l(t, HTMLTextAreaElement) && (e.innerHTML = t.value), l(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
234
238
|
}
|
|
235
|
-
function
|
|
239
|
+
function mt(t, e) {
|
|
236
240
|
if (l(t, HTMLSelectElement)) {
|
|
237
241
|
const r = e, n = Array.from(r.children).find((s) => t.value === s.getAttribute("value"));
|
|
238
242
|
n && n.setAttribute("selected", "");
|
|
239
243
|
}
|
|
240
244
|
}
|
|
241
|
-
function
|
|
242
|
-
return l(e, Element) && (
|
|
245
|
+
function gt(t, e, r) {
|
|
246
|
+
return l(e, Element) && (ft(t, e, r), N(t, e, r), ht(t, e), mt(t, e)), e;
|
|
243
247
|
}
|
|
244
|
-
async function
|
|
248
|
+
async function dt(t, e) {
|
|
245
249
|
const r = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
246
250
|
if (r.length === 0)
|
|
247
251
|
return t;
|
|
@@ -250,7 +254,7 @@ async function mt(t, e) {
|
|
|
250
254
|
const a = r[i].getAttribute("xlink:href");
|
|
251
255
|
if (a) {
|
|
252
256
|
const o = t.querySelector(a), f = document.querySelector(a);
|
|
253
|
-
!o && f && !n[a] && (n[a] = await
|
|
257
|
+
!o && f && !n[a] && (n[a] = await p(f, e, !0));
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
260
|
const s = Object.values(n);
|
|
@@ -265,31 +269,31 @@ async function mt(t, e) {
|
|
|
265
269
|
}
|
|
266
270
|
return t;
|
|
267
271
|
}
|
|
268
|
-
async function
|
|
269
|
-
return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) =>
|
|
272
|
+
async function p(t, e, r) {
|
|
273
|
+
return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => ot(n, e)).then((n) => ut(t, n, e)).then((n) => gt(t, n, e)).then((n) => dt(n, e));
|
|
270
274
|
}
|
|
271
|
-
const
|
|
272
|
-
function
|
|
275
|
+
const v = /url\((['"]?)([^'"]+?)\1\)/g, yt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, wt = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
276
|
+
function pt(t) {
|
|
273
277
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
274
278
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
275
279
|
}
|
|
276
|
-
function
|
|
280
|
+
function bt(t) {
|
|
277
281
|
const e = [];
|
|
278
|
-
return t.replace(
|
|
282
|
+
return t.replace(v, (r, n, s) => (e.push(s), r)), e.filter((r) => !E(r));
|
|
279
283
|
}
|
|
280
|
-
async function
|
|
284
|
+
async function St(t, e, r, n, s) {
|
|
281
285
|
try {
|
|
282
|
-
const i = r ?
|
|
286
|
+
const i = r ? W(e, r) : e, c = x(e);
|
|
283
287
|
let a;
|
|
284
|
-
return s || (a = await
|
|
288
|
+
return s || (a = await R(i, c, n)), t.replace(pt(e), `$1${a}$3`);
|
|
285
289
|
} catch {
|
|
286
290
|
}
|
|
287
291
|
return t;
|
|
288
292
|
}
|
|
289
|
-
function
|
|
290
|
-
return e ? t.replace(
|
|
293
|
+
function Et(t, { preferredFontFormat: e }) {
|
|
294
|
+
return e ? t.replace(wt, (r) => {
|
|
291
295
|
for (; ; ) {
|
|
292
|
-
const [n, , s] =
|
|
296
|
+
const [n, , s] = yt.exec(r) || [];
|
|
293
297
|
if (!s)
|
|
294
298
|
return "";
|
|
295
299
|
if (s === e)
|
|
@@ -297,32 +301,32 @@ function bt(t, { preferredFontFormat: e }) {
|
|
|
297
301
|
}
|
|
298
302
|
}) : t;
|
|
299
303
|
}
|
|
300
|
-
function
|
|
301
|
-
return t.search(
|
|
304
|
+
function H(t) {
|
|
305
|
+
return t.search(v) !== -1;
|
|
302
306
|
}
|
|
303
|
-
async function
|
|
304
|
-
if (!
|
|
307
|
+
async function V(t, e, r) {
|
|
308
|
+
if (!H(t))
|
|
305
309
|
return t;
|
|
306
|
-
const n =
|
|
307
|
-
return
|
|
310
|
+
const n = Et(t, r);
|
|
311
|
+
return bt(n).reduce((i, c) => i.then((a) => St(a, c, e, r)), Promise.resolve(n));
|
|
308
312
|
}
|
|
309
|
-
async function
|
|
313
|
+
async function d(t, e, r) {
|
|
310
314
|
var n;
|
|
311
315
|
const s = (n = e.style) === null || n === void 0 ? void 0 : n.getPropertyValue(t);
|
|
312
316
|
if (s) {
|
|
313
|
-
const i = await
|
|
317
|
+
const i = await V(s, null, r);
|
|
314
318
|
return e.style.setProperty(t, i, e.style.getPropertyPriority(t)), !0;
|
|
315
319
|
}
|
|
316
320
|
return !1;
|
|
317
321
|
}
|
|
318
|
-
async function
|
|
319
|
-
await
|
|
322
|
+
async function xt(t, e) {
|
|
323
|
+
await d("background", t, e) || await d("background-image", t, e), await d("mask", t, e) || await d("-webkit-mask", t, e) || await d("mask-image", t, e) || await d("-webkit-mask-image", t, e);
|
|
320
324
|
}
|
|
321
|
-
async function
|
|
325
|
+
async function Rt(t, e) {
|
|
322
326
|
const r = l(t, HTMLImageElement);
|
|
323
|
-
if (!(r && !
|
|
327
|
+
if (!(r && !E(t.src)) && !(l(t, SVGImageElement) && !E(t.href.baseVal)))
|
|
324
328
|
return;
|
|
325
|
-
const n = r ? t.src : t.href.baseVal, s = await
|
|
329
|
+
const n = r ? t.src : t.href.baseVal, s = await R(n, x(n), e);
|
|
326
330
|
await new Promise((i, c) => {
|
|
327
331
|
t.onload = i, t.onerror = e.onImageErrorHandler ? (...o) => {
|
|
328
332
|
try {
|
|
@@ -335,14 +339,14 @@ async function Et(t, e) {
|
|
|
335
339
|
a.decode && (a.decode = i), a.loading === "lazy" && (a.loading = "eager"), r ? (t.srcset = "", t.src = s) : t.href.baseVal = s;
|
|
336
340
|
});
|
|
337
341
|
}
|
|
338
|
-
async function
|
|
339
|
-
const n =
|
|
342
|
+
async function Ct(t, e) {
|
|
343
|
+
const n = m(t.childNodes).map((s) => M(s, e));
|
|
340
344
|
await Promise.all(n).then(() => t);
|
|
341
345
|
}
|
|
342
|
-
async function
|
|
343
|
-
l(t, Element) && (await
|
|
346
|
+
async function M(t, e) {
|
|
347
|
+
l(t, Element) && (await xt(t, e), await Rt(t, e), await Ct(t, e));
|
|
344
348
|
}
|
|
345
|
-
function
|
|
349
|
+
function Pt(t, e) {
|
|
346
350
|
const { style: r } = t;
|
|
347
351
|
e.backgroundColor && (r.backgroundColor = e.backgroundColor), e.width && (r.width = `${e.width}px`), e.height && (r.height = `${e.height}px`);
|
|
348
352
|
const n = e.style;
|
|
@@ -350,23 +354,23 @@ function Rt(t, e) {
|
|
|
350
354
|
r[s] = n[s];
|
|
351
355
|
}), t;
|
|
352
356
|
}
|
|
353
|
-
const
|
|
354
|
-
async function
|
|
355
|
-
let e =
|
|
357
|
+
const T = {};
|
|
358
|
+
async function F(t) {
|
|
359
|
+
let e = T[t];
|
|
356
360
|
if (e != null)
|
|
357
361
|
return e;
|
|
358
362
|
const n = await (await fetch(t)).text();
|
|
359
|
-
return e = { url: t, cssText: n },
|
|
363
|
+
return e = { url: t, cssText: n }, T[t] = e, e;
|
|
360
364
|
}
|
|
361
|
-
async function
|
|
365
|
+
async function L(t, e) {
|
|
362
366
|
let r = t.cssText;
|
|
363
367
|
const n = /url\(["']?([^"')]+)["']?\)/g, i = (r.match(/url\([^)]+\)/g) || []).map(async (c) => {
|
|
364
368
|
let a = c.replace(n, "$1");
|
|
365
|
-
return a.startsWith("https://") || (a = new URL(a, t.url).href),
|
|
369
|
+
return a.startsWith("https://") || (a = new URL(a, t.url).href), D(a, e.fetchRequestInit, ({ result: o }) => (r = r.replace(c, `url(${o})`), [c, o]));
|
|
366
370
|
});
|
|
367
371
|
return Promise.all(i).then(() => r);
|
|
368
372
|
}
|
|
369
|
-
function
|
|
373
|
+
function A(t) {
|
|
370
374
|
if (t == null)
|
|
371
375
|
return [];
|
|
372
376
|
const e = [], r = /(\/\*[\s\S]*?\*\/)/gi;
|
|
@@ -392,33 +396,33 @@ function L(t) {
|
|
|
392
396
|
}
|
|
393
397
|
return e;
|
|
394
398
|
}
|
|
395
|
-
async function
|
|
399
|
+
async function $t(t, e) {
|
|
396
400
|
const r = [], n = [];
|
|
397
401
|
return t.forEach((s) => {
|
|
398
402
|
if ("cssRules" in s)
|
|
399
403
|
try {
|
|
400
|
-
|
|
404
|
+
m(s.cssRules || []).forEach((i, c) => {
|
|
401
405
|
if (i.type === CSSRule.IMPORT_RULE) {
|
|
402
406
|
let a = c + 1;
|
|
403
|
-
const o = i.href, f =
|
|
407
|
+
const o = i.href, f = F(o).then((h) => L(h, e)).then((h) => A(h).forEach((b) => {
|
|
404
408
|
try {
|
|
405
|
-
s.insertRule(
|
|
406
|
-
} catch (
|
|
409
|
+
s.insertRule(b, b.startsWith("@import") ? a += 1 : s.cssRules.length);
|
|
410
|
+
} catch (_) {
|
|
407
411
|
console.error("Error inserting rule from remote css", {
|
|
408
|
-
rule:
|
|
409
|
-
error:
|
|
412
|
+
rule: b,
|
|
413
|
+
error: _
|
|
410
414
|
});
|
|
411
415
|
}
|
|
412
|
-
})).catch((
|
|
413
|
-
console.error("Error loading remote css",
|
|
416
|
+
})).catch((h) => {
|
|
417
|
+
console.error("Error loading remote css", h.toString());
|
|
414
418
|
});
|
|
415
419
|
n.push(f);
|
|
416
420
|
}
|
|
417
421
|
});
|
|
418
422
|
} catch (i) {
|
|
419
423
|
const c = t.find((a) => a.href == null) || document.styleSheets[0];
|
|
420
|
-
s.href != null && n.push(
|
|
421
|
-
c.insertRule(o,
|
|
424
|
+
s.href != null && n.push(F(s.href).then((a) => L(a, e)).then((a) => A(a).forEach((o) => {
|
|
425
|
+
c.insertRule(o, c.cssRules.length);
|
|
422
426
|
})).catch((a) => {
|
|
423
427
|
console.error("Error loading remote stylesheet", a);
|
|
424
428
|
})), console.error("Error inlining remote css file", i);
|
|
@@ -426,7 +430,7 @@ async function Ct(t, e) {
|
|
|
426
430
|
}), Promise.all(n).then(() => (t.forEach((s) => {
|
|
427
431
|
if ("cssRules" in s)
|
|
428
432
|
try {
|
|
429
|
-
|
|
433
|
+
m(s.cssRules || []).forEach((i) => {
|
|
430
434
|
r.push(i);
|
|
431
435
|
});
|
|
432
436
|
} catch (i) {
|
|
@@ -434,58 +438,58 @@ async function Ct(t, e) {
|
|
|
434
438
|
}
|
|
435
439
|
}), r));
|
|
436
440
|
}
|
|
437
|
-
function
|
|
438
|
-
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
441
|
+
function Tt(t) {
|
|
442
|
+
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => H(e.style.getPropertyValue("src")));
|
|
439
443
|
}
|
|
440
|
-
async function
|
|
444
|
+
async function Ft(t, e) {
|
|
441
445
|
if (t.ownerDocument == null)
|
|
442
446
|
throw new Error("Provided element is not within a Document");
|
|
443
|
-
const r =
|
|
444
|
-
return
|
|
447
|
+
const r = m(t.ownerDocument.styleSheets), n = await $t(r, e);
|
|
448
|
+
return Tt(n);
|
|
445
449
|
}
|
|
446
|
-
function
|
|
450
|
+
function O(t) {
|
|
447
451
|
return t.trim().replace(/["']/g, "");
|
|
448
452
|
}
|
|
449
|
-
function
|
|
453
|
+
function Lt(t) {
|
|
450
454
|
const e = /* @__PURE__ */ new Set();
|
|
451
455
|
function r(n) {
|
|
452
456
|
(n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((i) => {
|
|
453
|
-
e.add(
|
|
457
|
+
e.add(O(i));
|
|
454
458
|
}), Array.from(n.children).forEach((i) => {
|
|
455
459
|
i instanceof HTMLElement && r(i);
|
|
456
460
|
});
|
|
457
461
|
}
|
|
458
462
|
return r(t), e;
|
|
459
463
|
}
|
|
460
|
-
async function
|
|
461
|
-
const r = await
|
|
462
|
-
return (await Promise.all(r.filter((i) => n.has(
|
|
464
|
+
async function At(t, e) {
|
|
465
|
+
const r = await Ft(t, e), n = Lt(t);
|
|
466
|
+
return (await Promise.all(r.filter((i) => n.has(O(i.style.fontFamily))).map((i) => {
|
|
463
467
|
const c = i.parentStyleSheet ? i.parentStyleSheet.href : null;
|
|
464
|
-
return
|
|
468
|
+
return V(i.cssText, c, e);
|
|
465
469
|
}))).join(`
|
|
466
470
|
`);
|
|
467
471
|
}
|
|
468
|
-
async function
|
|
469
|
-
const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await
|
|
472
|
+
async function It(t, e) {
|
|
473
|
+
const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await At(t, e);
|
|
470
474
|
if (r) {
|
|
471
475
|
const n = document.createElement("style"), s = document.createTextNode(r);
|
|
472
476
|
n.appendChild(s), t.firstChild ? t.insertBefore(n, t.firstChild) : t.appendChild(n);
|
|
473
477
|
}
|
|
474
478
|
}
|
|
475
|
-
async function
|
|
476
|
-
const { width: r, height: n } =
|
|
477
|
-
return await
|
|
478
|
-
}
|
|
479
|
-
async function It(t, e = {}) {
|
|
480
|
-
const { width: r, height: n } = A(t, e), s = await At(t, e), i = await y(s), c = document.createElement("canvas"), a = c.getContext("2d"), o = e.pixelRatio || B(), f = e.canvasWidth || r, m = e.canvasHeight || n;
|
|
481
|
-
return c.width = f * o, c.height = m * o, e.skipAutoScale || j(c), c.style.width = `${f}`, c.style.height = `${m}`, e.backgroundColor && (a.fillStyle = e.backgroundColor, a.fillRect(0, 0, c.width, c.height)), a.drawImage(i, 0, 0, c.width, c.height), c;
|
|
479
|
+
async function kt(t, e = {}) {
|
|
480
|
+
const { width: r, height: n } = k(t, e), s = await p(t, e, !0);
|
|
481
|
+
return await It(s, e), await M(s, e), Pt(s, e), await J(s, r, n);
|
|
482
482
|
}
|
|
483
483
|
async function Dt(t, e = {}) {
|
|
484
|
-
const r = await
|
|
485
|
-
return
|
|
484
|
+
const { width: r, height: n } = k(t, e), s = await kt(t, e), i = await w(s), c = document.createElement("canvas"), a = c.getContext("2d"), o = e.pixelRatio || z(), f = e.canvasWidth || r, h = e.canvasHeight || n;
|
|
485
|
+
return c.width = f * o, c.height = h * o, e.skipAutoScale || G(c), c.style.width = `${f}`, c.style.height = `${h}`, e.backgroundColor && (a.fillStyle = e.backgroundColor, a.fillRect(0, 0, c.width, c.height)), a.drawImage(i, 0, 0, c.width, c.height), c;
|
|
486
|
+
}
|
|
487
|
+
async function Ut(t, e = {}) {
|
|
488
|
+
const r = await Dt(t, e);
|
|
489
|
+
return await X(r);
|
|
486
490
|
}
|
|
487
491
|
export {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
492
|
+
Ut as toBlob,
|
|
493
|
+
Dt as toCanvas,
|
|
494
|
+
kt as toSvg
|
|
491
495
|
};
|