jvs-ppt-ui 0.0.7 → 0.0.9

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.
@@ -1,477 +0,0 @@
1
- //#region node_modules/html-to-image/es/util.js
2
- function e(e, t) {
3
- if (e.match(/^[a-z]+:\/\//i)) return e;
4
- if (e.match(/^\/\//)) return window.location.protocol + e;
5
- if (e.match(/^[a-z]+:/i)) return e;
6
- let n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
7
- return n.head.appendChild(r), n.body.appendChild(i), t && (r.href = t), i.href = e, i.href;
8
- }
9
- var t = (() => {
10
- let e = 0, t = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
11
- return () => (e += 1, `u${t()}${e}`);
12
- })();
13
- function n(e) {
14
- let t = [];
15
- for (let n = 0, r = e.length; n < r; n++) t.push(e[n]);
16
- return t;
17
- }
18
- var r = null;
19
- function i(e = {}) {
20
- return r || (e.includeStyleProperties ? (r = e.includeStyleProperties, r) : (r = n(window.getComputedStyle(document.documentElement)), r));
21
- }
22
- function a(e, t) {
23
- let n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
24
- return n ? parseFloat(n.replace("px", "")) : 0;
25
- }
26
- function o(e) {
27
- let t = a(e, "border-left-width"), n = a(e, "border-right-width");
28
- return e.clientWidth + t + n;
29
- }
30
- function s(e) {
31
- let t = a(e, "border-top-width"), n = a(e, "border-bottom-width");
32
- return e.clientHeight + t + n;
33
- }
34
- function c(e, t = {}) {
35
- return {
36
- width: t.width || o(e),
37
- height: t.height || s(e)
38
- };
39
- }
40
- function ee() {
41
- let e, t;
42
- try {
43
- t = process;
44
- } catch {}
45
- let n = t && t.env ? t.env.devicePixelRatio : null;
46
- return n && (e = parseInt(n, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
47
- }
48
- var l = 16384;
49
- function te(e) {
50
- (e.width > l || e.height > l) && (e.width > l && e.height > l ? e.width > e.height ? (e.height *= l / e.width, e.width = l) : (e.width *= l / e.height, e.height = l) : e.width > l ? (e.height *= l / e.width, e.width = l) : (e.width *= l / e.height, e.height = l));
51
- }
52
- function u(e, t = {}) {
53
- return e.toBlob ? new Promise((n) => {
54
- e.toBlob(n, t.type ? t.type : "image/png", t.quality ? t.quality : 1);
55
- }) : new Promise((n) => {
56
- let r = window.atob(e.toDataURL(t.type ? t.type : void 0, t.quality ? t.quality : void 0).split(",")[1]), i = r.length, a = new Uint8Array(i);
57
- for (let e = 0; e < i; e += 1) a[e] = r.charCodeAt(e);
58
- n(new Blob([a], { type: t.type ? t.type : "image/png" }));
59
- });
60
- }
61
- function d(e) {
62
- return new Promise((t, n) => {
63
- let r = new Image();
64
- r.onload = () => {
65
- r.decode().then(() => {
66
- requestAnimationFrame(() => t(r));
67
- });
68
- }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = e;
69
- });
70
- }
71
- async function f(e) {
72
- return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
73
- }
74
- async function p(e, t, n) {
75
- let r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
76
- return i.setAttribute("width", `${t}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${t} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(e), f(i);
77
- }
78
- var m = (e, t) => {
79
- if (e instanceof t) return !0;
80
- let n = Object.getPrototypeOf(e);
81
- return n === null ? !1 : n.constructor.name === t.name || m(n, t);
82
- };
83
- //#endregion
84
- //#region node_modules/html-to-image/es/clone-pseudos.js
85
- function ne(e) {
86
- let t = e.getPropertyValue("content");
87
- return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
88
- }
89
- function re(e, t) {
90
- return i(t).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
91
- }
92
- function ie(e, t, n, r) {
93
- let i = `.${e}:${t}`, a = n.cssText ? ne(n) : re(n, r);
94
- return document.createTextNode(`${i}{${a}}`);
95
- }
96
- function h(e, n, r, i) {
97
- let a = window.getComputedStyle(e, r), o = a.getPropertyValue("content");
98
- if (o === "" || o === "none") return;
99
- let s = t();
100
- try {
101
- n.className = `${n.className} ${s}`;
102
- } catch {
103
- return;
104
- }
105
- let c = document.createElement("style");
106
- c.appendChild(ie(s, r, a, i)), n.appendChild(c);
107
- }
108
- function ae(e, t, n) {
109
- h(e, t, ":before", n), h(e, t, ":after", n);
110
- }
111
- //#endregion
112
- //#region node_modules/html-to-image/es/mimes.js
113
- var g = "application/font-woff", _ = "image/jpeg", v = {
114
- woff: g,
115
- woff2: g,
116
- ttf: "application/font-truetype",
117
- eot: "application/vnd.ms-fontobject",
118
- png: "image/png",
119
- jpg: _,
120
- jpeg: _,
121
- gif: "image/gif",
122
- tiff: "image/tiff",
123
- svg: "image/svg+xml",
124
- webp: "image/webp"
125
- };
126
- function y(e) {
127
- let t = /\.([^./]*?)$/g.exec(e);
128
- return t ? t[1] : "";
129
- }
130
- function b(e) {
131
- return v[y(e).toLowerCase()] || "";
132
- }
133
- //#endregion
134
- //#region node_modules/html-to-image/es/dataurl.js
135
- function oe(e) {
136
- return e.split(/,/)[1];
137
- }
138
- function x(e) {
139
- return e.search(/^(data:)/) !== -1;
140
- }
141
- function S(e, t) {
142
- return `data:${t};base64,${e}`;
143
- }
144
- async function C(e, t, n) {
145
- let r = await fetch(e, t);
146
- if (r.status === 404) throw Error(`Resource "${r.url}" not found`);
147
- let i = await r.blob();
148
- return new Promise((e, t) => {
149
- let a = new FileReader();
150
- a.onerror = t, a.onloadend = () => {
151
- try {
152
- e(n({
153
- res: r,
154
- result: a.result
155
- }));
156
- } catch (e) {
157
- t(e);
158
- }
159
- }, a.readAsDataURL(i);
160
- });
161
- }
162
- var w = {};
163
- function se(e, t, n) {
164
- let r = e.replace(/\?.*/, "");
165
- return n && (r = e), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
166
- }
167
- async function T(e, t, n) {
168
- let r = se(e, t, n.includeQueryParams);
169
- if (w[r] != null) return w[r];
170
- n.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
171
- let i;
172
- try {
173
- i = S(await C(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", oe(n))), t);
174
- } catch (t) {
175
- i = n.imagePlaceholder || "";
176
- let r = `Failed to fetch resource: ${e}`;
177
- t && (r = typeof t == "string" ? t : t.message), r && console.warn(r);
178
- }
179
- return w[r] = i, i;
180
- }
181
- //#endregion
182
- //#region node_modules/html-to-image/es/clone-node.js
183
- async function ce(e) {
184
- let t = e.toDataURL();
185
- return t === "data:," ? e.cloneNode(!1) : d(t);
186
- }
187
- async function le(e, t) {
188
- if (e.currentSrc) {
189
- let t = document.createElement("canvas"), n = t.getContext("2d");
190
- return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), d(t.toDataURL());
191
- }
192
- let n = e.poster;
193
- return d(await T(n, b(n), t));
194
- }
195
- async function ue(e, t) {
196
- try {
197
- if (e?.contentDocument?.body) return await N(e.contentDocument.body, t, !0);
198
- } catch {}
199
- return e.cloneNode(!1);
200
- }
201
- async function de(e, t) {
202
- return m(e, HTMLCanvasElement) ? ce(e) : m(e, HTMLVideoElement) ? le(e, t) : m(e, HTMLIFrameElement) ? ue(e, t) : e.cloneNode(E(e));
203
- }
204
- var fe = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", E = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
205
- async function D(e, t, r) {
206
- if (E(t)) return t;
207
- let i = [];
208
- return i = fe(e) && e.assignedNodes ? n(e.assignedNodes()) : m(e, HTMLIFrameElement) && e.contentDocument?.body ? n(e.contentDocument.body.childNodes) : n((e.shadowRoot ?? e).childNodes), i.length === 0 || m(e, HTMLVideoElement) || await i.reduce((e, n) => e.then(() => N(n, r)).then((e) => {
209
- e && t.appendChild(e);
210
- }), Promise.resolve()), t;
211
- }
212
- function O(e, t, n) {
213
- let r = t.style;
214
- if (!r) return;
215
- let a = window.getComputedStyle(e);
216
- a.cssText ? (r.cssText = a.cssText, r.transformOrigin = a.transformOrigin) : i(n).forEach((n) => {
217
- let i = a.getPropertyValue(n);
218
- n === "font-size" && i.endsWith("px") && (i = `${Math.floor(parseFloat(i.substring(0, i.length - 2))) - .1}px`), m(e, HTMLIFrameElement) && n === "display" && i === "inline" && (i = "block"), n === "d" && t.getAttribute("d") && (i = `path(${t.getAttribute("d")})`), r.setProperty(n, i, a.getPropertyPriority(n));
219
- });
220
- }
221
- function k(e, t) {
222
- m(e, HTMLTextAreaElement) && (t.innerHTML = e.value), m(e, HTMLInputElement) && t.setAttribute("value", e.value);
223
- }
224
- function A(e, t) {
225
- if (m(e, HTMLSelectElement)) {
226
- let n = t, r = Array.from(n.children).find((t) => e.value === t.getAttribute("value"));
227
- r && r.setAttribute("selected", "");
228
- }
229
- }
230
- function j(e, t, n) {
231
- return m(t, Element) && (O(e, t, n), ae(e, t, n), k(e, t), A(e, t)), t;
232
- }
233
- async function M(e, t) {
234
- let n = e.querySelectorAll ? e.querySelectorAll("use") : [];
235
- if (n.length === 0) return e;
236
- let r = {};
237
- for (let i = 0; i < n.length; i++) {
238
- let a = n[i].getAttribute("xlink:href");
239
- if (a) {
240
- let n = e.querySelector(a), i = document.querySelector(a);
241
- !n && i && !r[a] && (r[a] = await N(i, t, !0));
242
- }
243
- }
244
- let i = Object.values(r);
245
- if (i.length) {
246
- let t = "http://www.w3.org/1999/xhtml", n = document.createElementNS(t, "svg");
247
- n.setAttribute("xmlns", t), n.style.position = "absolute", n.style.width = "0", n.style.height = "0", n.style.overflow = "hidden", n.style.display = "none";
248
- let r = document.createElementNS(t, "defs");
249
- n.appendChild(r);
250
- for (let e = 0; e < i.length; e++) r.appendChild(i[e]);
251
- e.appendChild(n);
252
- }
253
- return e;
254
- }
255
- async function N(e, t, n) {
256
- return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => de(e, t)).then((n) => D(e, n, t)).then((n) => j(e, n, t)).then((e) => M(e, t));
257
- }
258
- //#endregion
259
- //#region node_modules/html-to-image/es/embed-resources.js
260
- var P = /url\((['"]?)([^'"]+?)\1\)/g, F = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, I = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
261
- function L(e) {
262
- let t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
263
- return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
264
- }
265
- function R(e) {
266
- let t = [];
267
- return e.replace(P, (e, n, r) => (t.push(r), e)), t.filter((e) => !x(e));
268
- }
269
- async function z(t, n, r, i, a) {
270
- try {
271
- let o = r ? e(n, r) : n, s = b(n), c;
272
- return c = a ? S(await a(o), s) : await T(o, s, i), t.replace(L(n), `$1${c}$3`);
273
- } catch {}
274
- return t;
275
- }
276
- function B(e, { preferredFontFormat: t }) {
277
- return t ? e.replace(I, (e) => {
278
- for (;;) {
279
- let [n, , r] = F.exec(e) || [];
280
- if (!r) return "";
281
- if (r === t) return `src: ${n};`;
282
- }
283
- }) : e;
284
- }
285
- function V(e) {
286
- return e.search(P) !== -1;
287
- }
288
- async function H(e, t, n) {
289
- if (!V(e)) return e;
290
- let r = B(e, n);
291
- return R(r).reduce((e, r) => e.then((e) => z(e, r, t, n)), Promise.resolve(r));
292
- }
293
- //#endregion
294
- //#region node_modules/html-to-image/es/embed-images.js
295
- async function U(e, t, n) {
296
- let r = t.style?.getPropertyValue(e);
297
- if (r) {
298
- let i = await H(r, null, n);
299
- return t.style.setProperty(e, i, t.style.getPropertyPriority(e)), !0;
300
- }
301
- return !1;
302
- }
303
- async function pe(e, t) {
304
- await U("background", e, t) || await U("background-image", e, t), await U("mask", e, t) || await U("-webkit-mask", e, t) || await U("mask-image", e, t) || await U("-webkit-mask-image", e, t);
305
- }
306
- async function me(e, t) {
307
- let n = m(e, HTMLImageElement);
308
- if (!(n && !x(e.src)) && !(m(e, SVGImageElement) && !x(e.href.baseVal))) return;
309
- let r = n ? e.src : e.href.baseVal, i = await T(r, b(r), t);
310
- await new Promise((r, a) => {
311
- e.onload = r, e.onerror = t.onImageErrorHandler ? (...e) => {
312
- try {
313
- r(t.onImageErrorHandler(...e));
314
- } catch (e) {
315
- a(e);
316
- }
317
- } : a;
318
- let o = e;
319
- o.decode &&= r, o.loading === "lazy" && (o.loading = "eager"), n ? (e.srcset = "", e.src = i) : e.href.baseVal = i;
320
- });
321
- }
322
- async function he(e, t) {
323
- let r = n(e.childNodes).map((e) => W(e, t));
324
- await Promise.all(r).then(() => e);
325
- }
326
- async function W(e, t) {
327
- m(e, Element) && (await pe(e, t), await me(e, t), await he(e, t));
328
- }
329
- //#endregion
330
- //#region node_modules/html-to-image/es/apply-style.js
331
- function ge(e, t) {
332
- let { style: n } = e;
333
- t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.width && (n.width = `${t.width}px`), t.height && (n.height = `${t.height}px`);
334
- let r = t.style;
335
- return r != null && Object.keys(r).forEach((e) => {
336
- n[e] = r[e];
337
- }), e;
338
- }
339
- //#endregion
340
- //#region node_modules/html-to-image/es/embed-webfonts.js
341
- var G = {};
342
- async function K(e) {
343
- let t = G[e];
344
- return t ?? (t = {
345
- url: e,
346
- cssText: await (await fetch(e)).text()
347
- }, G[e] = t, t);
348
- }
349
- async function q(e, t) {
350
- let n = e.cssText, r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (i) => {
351
- let a = i.replace(r, "$1");
352
- return a.startsWith("https://") || (a = new URL(a, e.url).href), C(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
353
- });
354
- return Promise.all(i).then(() => n);
355
- }
356
- function J(e) {
357
- if (e == null) return [];
358
- let t = [], n = e.replace(/(\/\*[\s\S]*?\*\/)/gi, ""), r = /* @__PURE__ */ RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
359
- for (;;) {
360
- let e = r.exec(n);
361
- if (e === null) break;
362
- t.push(e[0]);
363
- }
364
- n = n.replace(r, "");
365
- let i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, a = /* @__PURE__ */ RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", "gi");
366
- for (;;) {
367
- let e = i.exec(n);
368
- if (e === null) {
369
- if (e = a.exec(n), e === null) break;
370
- i.lastIndex = a.lastIndex;
371
- } else a.lastIndex = i.lastIndex;
372
- t.push(e[0]);
373
- }
374
- return t;
375
- }
376
- async function _e(e, t) {
377
- let r = [], i = [];
378
- return e.forEach((r) => {
379
- if ("cssRules" in r) try {
380
- n(r.cssRules || []).forEach((e, n) => {
381
- if (e.type === CSSRule.IMPORT_RULE) {
382
- let a = n + 1, o = e.href, s = K(o).then((e) => q(e, t)).then((e) => J(e).forEach((e) => {
383
- try {
384
- r.insertRule(e, e.startsWith("@import") ? a += 1 : r.cssRules.length);
385
- } catch (t) {
386
- console.error("Error inserting rule from remote css", {
387
- rule: e,
388
- error: t
389
- });
390
- }
391
- })).catch((e) => {
392
- console.error("Error loading remote css", e.toString());
393
- });
394
- i.push(s);
395
- }
396
- });
397
- } catch (n) {
398
- let a = e.find((e) => e.href == null) || document.styleSheets[0];
399
- r.href != null && i.push(K(r.href).then((e) => q(e, t)).then((e) => J(e).forEach((e) => {
400
- a.insertRule(e, a.cssRules.length);
401
- })).catch((e) => {
402
- console.error("Error loading remote stylesheet", e);
403
- })), console.error("Error inlining remote css file", n);
404
- }
405
- }), Promise.all(i).then(() => (e.forEach((e) => {
406
- if ("cssRules" in e) try {
407
- n(e.cssRules || []).forEach((e) => {
408
- r.push(e);
409
- });
410
- } catch (t) {
411
- console.error(`Error while reading CSS rules from ${e.href}`, t);
412
- }
413
- }), r));
414
- }
415
- function ve(e) {
416
- return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => V(e.style.getPropertyValue("src")));
417
- }
418
- async function ye(e, t) {
419
- if (e.ownerDocument == null) throw Error("Provided element is not within a Document");
420
- return ve(await _e(n(e.ownerDocument.styleSheets), t));
421
- }
422
- function Y(e) {
423
- return e.trim().replace(/["']/g, "");
424
- }
425
- function be(e) {
426
- let t = /* @__PURE__ */ new Set();
427
- function n(e) {
428
- (e.style.fontFamily || getComputedStyle(e).fontFamily).split(",").forEach((e) => {
429
- t.add(Y(e));
430
- }), Array.from(e.children).forEach((e) => {
431
- e instanceof HTMLElement && n(e);
432
- });
433
- }
434
- return n(e), t;
435
- }
436
- async function X(e, t) {
437
- let n = await ye(e, t), r = be(e);
438
- return (await Promise.all(n.filter((e) => r.has(Y(e.style.fontFamily))).map((e) => {
439
- let n = e.parentStyleSheet ? e.parentStyleSheet.href : null;
440
- return H(e.cssText, n, t);
441
- }))).join("\n");
442
- }
443
- async function xe(e, t) {
444
- let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await X(e, t) : t.fontEmbedCSS;
445
- if (n) {
446
- let t = document.createElement("style"), r = document.createTextNode(n);
447
- t.appendChild(r), e.firstChild ? e.insertBefore(t, e.firstChild) : e.appendChild(t);
448
- }
449
- }
450
- //#endregion
451
- //#region node_modules/html-to-image/es/index.js
452
- async function Z(e, t = {}) {
453
- let { width: n, height: r } = c(e, t), i = await N(e, t, !0);
454
- return await xe(i, t), await W(i, t), ge(i, t), await p(i, n, r);
455
- }
456
- async function Q(e, t = {}) {
457
- let { width: n, height: r } = c(e, t), i = await d(await Z(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || ee(), l = t.canvasWidth || n, u = t.canvasHeight || r;
458
- return a.width = l * s, a.height = u * s, t.skipAutoScale || te(a), a.style.width = `${l}`, a.style.height = `${u}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, a.width, a.height)), o.drawImage(i, 0, 0, a.width, a.height), a;
459
- }
460
- async function Se(e, t = {}) {
461
- let { width: n, height: r } = c(e, t);
462
- return (await Q(e, t)).getContext("2d").getImageData(0, 0, n, r).data;
463
- }
464
- async function Ce(e, t = {}) {
465
- return (await Q(e, t)).toDataURL();
466
- }
467
- async function $(e, t = {}) {
468
- return (await Q(e, t)).toDataURL("image/jpeg", t.quality || 1);
469
- }
470
- async function we(e, t = {}) {
471
- return await u(await Q(e, t));
472
- }
473
- async function Te(e, t = {}) {
474
- return X(e, t);
475
- }
476
- //#endregion
477
- export { Te as getFontEmbedCSS, we as toBlob, Q as toCanvas, $ as toJpeg, Se as toPixelData, Ce as toPng, Z as toSvg };