artifactuse 0.1.21 → 0.1.23
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 +91 -2
- package/dist/core/detector.d.ts +27 -0
- package/dist/core/editor.d.ts +13 -0
- package/dist/core/index.d.ts +31 -0
- package/dist/{index-ZmmxlD3v.js → index-BR2-i8NP.js} +1553 -1185
- package/dist/index.js +89 -88
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +739 -699
- package/dist/styles/components/panel.css +30 -2
- package/dist/svelte/index.d.ts +171 -0
- package/dist/svelte/index.js +1844 -1761
- package/dist/vue/index.d.ts +114 -0
- package/dist/vue/index.js +1375 -1304
- package/dist/vue2/composables.d.ts +114 -0
- package/dist/vue2/index.js +822 -124
- package/package.json +33 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
var jr = Object.defineProperty;
|
|
2
|
+
var Zr = (e, t, r) => t in e ? jr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var E = (e, t, r) => Zr(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
const ze = {
|
|
5
5
|
CODE: "code",
|
|
6
6
|
FORM: "form",
|
|
7
7
|
SOCIAL: "social"
|
|
8
|
-
},
|
|
8
|
+
}, qr = [
|
|
9
9
|
// Code languages
|
|
10
10
|
"html",
|
|
11
11
|
"htm",
|
|
@@ -31,7 +31,7 @@ const xe = {
|
|
|
31
31
|
// Structured artifacts
|
|
32
32
|
"form",
|
|
33
33
|
"social"
|
|
34
|
-
],
|
|
34
|
+
], Hr = [
|
|
35
35
|
// Visual editors (always panel)
|
|
36
36
|
"video",
|
|
37
37
|
"videoeditor",
|
|
@@ -55,13 +55,16 @@ const xe = {
|
|
|
55
55
|
// Structured artifacts (form can be panel based on complexity)
|
|
56
56
|
"form"
|
|
57
57
|
];
|
|
58
|
-
function
|
|
59
|
-
return
|
|
58
|
+
function Dr(e = "artifact") {
|
|
59
|
+
return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
return
|
|
61
|
+
function or(e) {
|
|
62
|
+
return qr.includes(e == null ? void 0 : e.toLowerCase());
|
|
63
|
+
}
|
|
64
|
+
function Or(e) {
|
|
65
|
+
return Hr.includes(e == null ? void 0 : e.toLowerCase());
|
|
63
66
|
}
|
|
64
|
-
function
|
|
67
|
+
function Br(e) {
|
|
65
68
|
return {
|
|
66
69
|
// Code languages
|
|
67
70
|
html: "HTML",
|
|
@@ -116,10 +119,11 @@ function Er(e) {
|
|
|
116
119
|
drawing: "Drawing",
|
|
117
120
|
// Structured artifacts
|
|
118
121
|
form: "Form",
|
|
119
|
-
social: "Social Preview"
|
|
122
|
+
social: "Social Preview",
|
|
123
|
+
txt: "Plain Text"
|
|
120
124
|
}[e == null ? void 0 : e.toLowerCase()] || (e == null ? void 0 : e.toUpperCase()) || "Code";
|
|
121
125
|
}
|
|
122
|
-
function
|
|
126
|
+
function Ws(e) {
|
|
123
127
|
return {
|
|
124
128
|
html: "html",
|
|
125
129
|
htm: "html",
|
|
@@ -161,7 +165,43 @@ function Is(e) {
|
|
|
161
165
|
social: "json"
|
|
162
166
|
}[e == null ? void 0 : e.toLowerCase()] || "txt";
|
|
163
167
|
}
|
|
164
|
-
function
|
|
168
|
+
function Fr(e) {
|
|
169
|
+
return {
|
|
170
|
+
html: "html",
|
|
171
|
+
htm: "html",
|
|
172
|
+
css: "css",
|
|
173
|
+
js: "javascript",
|
|
174
|
+
mjs: "javascript",
|
|
175
|
+
ts: "typescript",
|
|
176
|
+
jsx: "jsx",
|
|
177
|
+
tsx: "tsx",
|
|
178
|
+
vue: "vue",
|
|
179
|
+
py: "python",
|
|
180
|
+
java: "java",
|
|
181
|
+
cs: "csharp",
|
|
182
|
+
cpp: "cpp",
|
|
183
|
+
c: "c",
|
|
184
|
+
h: "c",
|
|
185
|
+
go: "go",
|
|
186
|
+
rs: "rust",
|
|
187
|
+
rb: "ruby",
|
|
188
|
+
php: "php",
|
|
189
|
+
swift: "swift",
|
|
190
|
+
kt: "kotlin",
|
|
191
|
+
scala: "scala",
|
|
192
|
+
sql: "sql",
|
|
193
|
+
sh: "bash",
|
|
194
|
+
json: "json",
|
|
195
|
+
xml: "xml",
|
|
196
|
+
yaml: "yaml",
|
|
197
|
+
yml: "yaml",
|
|
198
|
+
md: "markdown",
|
|
199
|
+
svg: "svg",
|
|
200
|
+
diff: "diff",
|
|
201
|
+
patch: "patch"
|
|
202
|
+
}[e == null ? void 0 : e.toLowerCase()] || null;
|
|
203
|
+
}
|
|
204
|
+
function Xs(e) {
|
|
165
205
|
return {
|
|
166
206
|
html: '<path d="M12 17.56l4.07-1.13.55-6.1H9.38l-.16-1.7h7.78l.16-1.7H6.85l.48 5.1h6.3l-.25 2.9-2.38.63-2.38-.63-.15-1.7H6.76l.3 3.2L12 17.56M4.07 3h15.86L18.5 19.2 12 21l-6.5-1.8L4.07 3z"/>',
|
|
167
207
|
htm: '<path d="M12 17.56l4.07-1.13.55-6.1H9.38l-.16-1.7h7.78l.16-1.7H6.85l.48 5.1h6.3l-.25 2.9-2.38.63-2.38-.63-.15-1.7H6.76l.3 3.2L12 17.56M4.07 3h15.86L18.5 19.2 12 21l-6.5-1.8L4.07 3z"/>',
|
|
@@ -195,20 +235,20 @@ function js(e) {
|
|
|
195
235
|
social: '<path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"/>'
|
|
196
236
|
}[e == null ? void 0 : e.toLowerCase()] || '<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>';
|
|
197
237
|
}
|
|
198
|
-
function
|
|
238
|
+
function Ks(e) {
|
|
199
239
|
if (e === 0) return "0 Bytes";
|
|
200
240
|
const t = 1024, r = ["Bytes", "KB", "MB", "GB"], a = Math.floor(Math.log(e) / Math.log(t));
|
|
201
241
|
return parseFloat((e / Math.pow(t, a)).toFixed(2)) + " " + r[a];
|
|
202
242
|
}
|
|
203
|
-
function
|
|
243
|
+
function cr(e) {
|
|
204
244
|
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&").replace(/ /g, `
|
|
205
245
|
`).replace(/ /g, "\r").replace(/	/g, " ").replace(/ /g, " ");
|
|
206
246
|
}
|
|
207
|
-
function
|
|
247
|
+
function Vr(e) {
|
|
208
248
|
const t = JSON.stringify(e);
|
|
209
249
|
return typeof btoa == "function" ? btoa(unescape(encodeURIComponent(t))) : typeof Buffer < "u" ? Buffer.from(t, "utf-8").toString("base64") : t.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
210
250
|
}
|
|
211
|
-
function
|
|
251
|
+
function Nr(e, t) {
|
|
212
252
|
const r = t == null ? void 0 : t.toLowerCase();
|
|
213
253
|
if (r === "form" || r === "social")
|
|
214
254
|
try {
|
|
@@ -233,26 +273,26 @@ function Cr(e, t) {
|
|
|
233
273
|
if (r === "python" || r === "py") {
|
|
234
274
|
const c = e.match(/class\s+([A-Z][a-zA-Z0-9_]+)/);
|
|
235
275
|
if (c) return c[1];
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
276
|
+
const d = e.match(/def\s+([a-z_][a-zA-Z0-9_]+)\s*\(/);
|
|
277
|
+
if (d && d[1] !== "main") return d[1];
|
|
238
278
|
}
|
|
239
279
|
const l = e.match(/<title>([^<]+)<\/title>/i);
|
|
240
|
-
return l ? l[1].trim() : e.includes("<template>") && e.includes("<script>") ? "Vue Component" : e.includes("import React") || e.includes('from "react"') ? "React Component" : e.includes("<!DOCTYPE html>") || e.includes("<html") ? "HTML Document" : e.includes("@app.route") || e.includes("Flask") ? "Flask App" : e.includes("express()") ? "Express Server" : e.includes("CREATE TABLE") ? "SQL Schema" : e.includes("SELECT") && e.includes("FROM") ? "SQL Query" : `${
|
|
280
|
+
return l ? l[1].trim() : e.includes("<template>") && e.includes("<script>") ? "Vue Component" : e.includes("import React") || e.includes('from "react"') ? "React Component" : e.includes("<!DOCTYPE html>") || e.includes("<html") ? "HTML Document" : e.includes("@app.route") || e.includes("Flask") ? "Flask App" : e.includes("express()") ? "Express Server" : e.includes("CREATE TABLE") ? "SQL Schema" : e.includes("SELECT") && e.includes("FROM") ? "SQL Query" : `${Br(t)} Code`;
|
|
241
281
|
}
|
|
242
|
-
function
|
|
243
|
-
const r =
|
|
282
|
+
function Ur(e, t = "panel") {
|
|
283
|
+
const r = Vr(e);
|
|
244
284
|
return `<div class="${`artifactuse-placeholder artifactuse-${t}`}" data-artifact-id="${e.id}" data-artifact-type="${e.type}" data-artifact="${r}"></div>`;
|
|
245
285
|
}
|
|
246
|
-
function
|
|
286
|
+
function lr(e) {
|
|
247
287
|
try {
|
|
248
288
|
return JSON.parse(e);
|
|
249
289
|
} catch {
|
|
250
290
|
return null;
|
|
251
291
|
}
|
|
252
292
|
}
|
|
253
|
-
function
|
|
293
|
+
function Gr(e) {
|
|
254
294
|
var s;
|
|
255
|
-
const t =
|
|
295
|
+
const t = lr(e);
|
|
256
296
|
if (!t || t.display === "inline") return !0;
|
|
257
297
|
if (t.display === "panel" || t.variant === "wizard") return !1;
|
|
258
298
|
if (t.variant === "buttons") return !0;
|
|
@@ -261,74 +301,74 @@ function Ir(e) {
|
|
|
261
301
|
const a = ["multiselect", "rating", "color", "range"];
|
|
262
302
|
return !(r.some((n) => a.includes(n.type)) || r.filter((n) => n.type !== "buttons" && n.type !== "divider" && n.type !== "heading").length > 4 || r.some((n) => n.type === "textarea" && (n.rows || 3) > 4));
|
|
263
303
|
}
|
|
264
|
-
function
|
|
304
|
+
function Wr(e, t) {
|
|
265
305
|
const r = e == null ? void 0 : e.toLowerCase();
|
|
266
|
-
return r === "social" ? !0 : r === "form" ?
|
|
306
|
+
return r === "social" ? !0 : r === "form" ? Gr(t) : !1;
|
|
267
307
|
}
|
|
268
|
-
function
|
|
308
|
+
function Xr(e) {
|
|
269
309
|
const t = e == null ? void 0 : e.toLowerCase();
|
|
270
|
-
return t === "form" ?
|
|
310
|
+
return t === "form" ? ze.FORM : t === "social" ? ze.SOCIAL : ze.CODE;
|
|
271
311
|
}
|
|
272
|
-
function
|
|
273
|
-
const s = t == null ? void 0 : t.toLowerCase(), n =
|
|
312
|
+
function be(e, t, r, a) {
|
|
313
|
+
const s = t == null ? void 0 : t.toLowerCase(), n = Xr(s), o = Wr(s, e);
|
|
274
314
|
return {
|
|
275
315
|
id: `${r}-${n}-${a}`,
|
|
276
316
|
messageId: r,
|
|
277
317
|
type: n,
|
|
278
318
|
language: s,
|
|
279
|
-
title:
|
|
319
|
+
title: Nr(e, s),
|
|
280
320
|
code: e,
|
|
281
321
|
isInline: o,
|
|
282
|
-
isPreviewable:
|
|
283
|
-
isPanelArtifact:
|
|
322
|
+
isPreviewable: or(s),
|
|
323
|
+
isPanelArtifact: Or(s),
|
|
284
324
|
size: e.length,
|
|
285
325
|
lineCount: e.split(`
|
|
286
326
|
`).length,
|
|
287
327
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
288
328
|
};
|
|
289
329
|
}
|
|
290
|
-
function
|
|
330
|
+
function Qs(e, t) {
|
|
291
331
|
const r = [], a = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
|
|
292
332
|
let s, n = 0;
|
|
293
333
|
for (; (s = a.exec(e)) !== null; ) {
|
|
294
|
-
const o = s[1], i =
|
|
334
|
+
const o = s[1], i = cr(s[2]);
|
|
295
335
|
let l = o.toLowerCase();
|
|
296
|
-
if ((["xml", "markup", "html", "htm"].includes(l) || !l) && (i.trim().startsWith("<svg") || i.includes("<svg ") || i.includes("<svg>")) && (l = "svg"), (l === "form" || l === "social") && !
|
|
297
|
-
r.push(
|
|
336
|
+
if ((["xml", "markup", "html", "htm"].includes(l) || !l) && (i.trim().startsWith("<svg") || i.includes("<svg ") || i.includes("<svg>")) && (l = "svg"), (l === "form" || l === "social") && !lr(i)) {
|
|
337
|
+
r.push(be(i, "json", t, n)), n++;
|
|
298
338
|
continue;
|
|
299
339
|
}
|
|
300
|
-
r.push(
|
|
340
|
+
r.push(be(i, l, t, n)), n++;
|
|
301
341
|
}
|
|
302
342
|
return r;
|
|
303
343
|
}
|
|
304
|
-
function
|
|
344
|
+
function Kr(e, t, r = {}) {
|
|
305
345
|
const {
|
|
306
346
|
minLines: a = 3,
|
|
307
347
|
minLength: s = 50,
|
|
308
348
|
extractAll: n = !1
|
|
309
349
|
} = r, o = [], i = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
|
|
310
350
|
let l = 0;
|
|
311
|
-
const c = e.replace(i, (
|
|
312
|
-
const
|
|
351
|
+
const c = e.replace(i, (d, p, u) => {
|
|
352
|
+
const f = cr(u).trim(), w = f.split(`
|
|
313
353
|
`).length;
|
|
314
|
-
let
|
|
315
|
-
(["xml", "markup", "html", "htm"].includes(
|
|
316
|
-
const
|
|
317
|
-
let
|
|
318
|
-
if (n ?
|
|
319
|
-
const
|
|
320
|
-
l++, o.push(
|
|
354
|
+
let h = p.toLowerCase();
|
|
355
|
+
(["xml", "markup", "html", "htm"].includes(h) || !h) && f.trim().startsWith("<svg") && (h = "svg");
|
|
356
|
+
const m = or(h);
|
|
357
|
+
let g = !1;
|
|
358
|
+
if (n ? g = !0 : h === "diff" || h === "patch" ? g = w > 10 : m ? g = !0 : g = f.length >= s && w >= a, g) {
|
|
359
|
+
const b = be(f, h, t, l);
|
|
360
|
+
l++, o.push(b);
|
|
321
361
|
let v = "panel";
|
|
322
|
-
return
|
|
362
|
+
return b.isInline && (v = b.type === "social" ? "inline-social" : "inline-form"), Ur(b, v);
|
|
323
363
|
}
|
|
324
|
-
return l++,
|
|
364
|
+
return l++, d;
|
|
325
365
|
});
|
|
326
366
|
return {
|
|
327
367
|
artifacts: o,
|
|
328
368
|
html: c
|
|
329
369
|
};
|
|
330
370
|
}
|
|
331
|
-
function
|
|
371
|
+
function Qr() {
|
|
332
372
|
let e = {
|
|
333
373
|
artifacts: [],
|
|
334
374
|
activeArtifactId: null,
|
|
@@ -339,62 +379,62 @@ function Hr() {
|
|
|
339
379
|
};
|
|
340
380
|
const t = /* @__PURE__ */ new Set();
|
|
341
381
|
function r() {
|
|
342
|
-
t.forEach((
|
|
382
|
+
t.forEach((y) => {
|
|
343
383
|
try {
|
|
344
|
-
|
|
384
|
+
y(e);
|
|
345
385
|
} catch ($) {
|
|
346
386
|
console.error("Artifactuse state subscriber error:", $);
|
|
347
387
|
}
|
|
348
388
|
});
|
|
349
389
|
}
|
|
350
|
-
function a(
|
|
351
|
-
return t.add(
|
|
352
|
-
t.delete(
|
|
390
|
+
function a(y) {
|
|
391
|
+
return t.add(y), y(e), () => {
|
|
392
|
+
t.delete(y);
|
|
353
393
|
};
|
|
354
394
|
}
|
|
355
395
|
function s() {
|
|
356
396
|
return { ...e };
|
|
357
397
|
}
|
|
358
|
-
function n(
|
|
359
|
-
const $ = e.artifacts.findIndex((
|
|
398
|
+
function n(y) {
|
|
399
|
+
const $ = e.artifacts.findIndex((A) => A.id === y.id);
|
|
360
400
|
if ($ === -1)
|
|
361
401
|
e = {
|
|
362
402
|
...e,
|
|
363
|
-
artifacts: [...e.artifacts,
|
|
403
|
+
artifacts: [...e.artifacts, y]
|
|
364
404
|
};
|
|
365
405
|
else {
|
|
366
|
-
const
|
|
367
|
-
|
|
406
|
+
const A = [...e.artifacts];
|
|
407
|
+
A[$] = { ...A[$], ...y }, e = {
|
|
368
408
|
...e,
|
|
369
|
-
artifacts:
|
|
409
|
+
artifacts: A
|
|
370
410
|
};
|
|
371
411
|
}
|
|
372
412
|
r();
|
|
373
413
|
}
|
|
374
|
-
function o(
|
|
375
|
-
|
|
414
|
+
function o(y) {
|
|
415
|
+
y.forEach(n);
|
|
376
416
|
}
|
|
377
|
-
function i(
|
|
417
|
+
function i(y) {
|
|
378
418
|
e = {
|
|
379
419
|
...e,
|
|
380
|
-
artifacts: e.artifacts.filter(($) => $.id !==
|
|
381
|
-
activeArtifactId: e.activeArtifactId ===
|
|
382
|
-
isPanelOpen: e.activeArtifactId ===
|
|
420
|
+
artifacts: e.artifacts.filter(($) => $.id !== y),
|
|
421
|
+
activeArtifactId: e.activeArtifactId === y ? null : e.activeArtifactId,
|
|
422
|
+
isPanelOpen: e.activeArtifactId === y ? !1 : e.isPanelOpen
|
|
383
423
|
}, r();
|
|
384
424
|
}
|
|
385
|
-
function l(
|
|
386
|
-
return e.artifacts.find(($) => $.id ===
|
|
425
|
+
function l(y) {
|
|
426
|
+
return e.artifacts.find(($) => $.id === y) || null;
|
|
387
427
|
}
|
|
388
428
|
function c() {
|
|
389
429
|
return e.activeArtifactId ? l(e.activeArtifactId) : null;
|
|
390
430
|
}
|
|
391
|
-
function
|
|
392
|
-
const $ = l(
|
|
393
|
-
|
|
431
|
+
function d(y) {
|
|
432
|
+
const $ = l(y);
|
|
433
|
+
let A = ($ == null ? void 0 : $.isPreviewable) === !1 ? "code" : "preview";
|
|
434
|
+
$ != null && $.tabs && !$.tabs.includes(A) && (A = $.tabs[0]), e = {
|
|
394
435
|
...e,
|
|
395
|
-
activeArtifactId:
|
|
396
|
-
|
|
397
|
-
viewMode: ($ == null ? void 0 : $.isPreviewable) === !1 ? "code" : "preview"
|
|
436
|
+
activeArtifactId: y,
|
|
437
|
+
viewMode: A
|
|
398
438
|
}, r();
|
|
399
439
|
}
|
|
400
440
|
function p() {
|
|
@@ -403,39 +443,39 @@ function Hr() {
|
|
|
403
443
|
activeArtifactId: null
|
|
404
444
|
}, r();
|
|
405
445
|
}
|
|
406
|
-
function y
|
|
446
|
+
function u(y) {
|
|
407
447
|
e = {
|
|
408
448
|
...e,
|
|
409
|
-
isPanelOpen:
|
|
410
|
-
isFullscreen:
|
|
449
|
+
isPanelOpen: y,
|
|
450
|
+
isFullscreen: y ? e.isFullscreen : !1
|
|
411
451
|
}, r();
|
|
412
452
|
}
|
|
413
|
-
function
|
|
414
|
-
if (!["preview", "code", "split"].includes(
|
|
415
|
-
console.warn(`Invalid view mode: ${
|
|
453
|
+
function f(y) {
|
|
454
|
+
if (!["preview", "code", "split", "edit"].includes(y)) {
|
|
455
|
+
console.warn(`Invalid view mode: ${y}`);
|
|
416
456
|
return;
|
|
417
457
|
}
|
|
418
458
|
e = {
|
|
419
459
|
...e,
|
|
420
|
-
viewMode:
|
|
460
|
+
viewMode: y
|
|
421
461
|
}, r();
|
|
422
462
|
}
|
|
423
|
-
function w(
|
|
463
|
+
function w(y) {
|
|
424
464
|
e = {
|
|
425
465
|
...e,
|
|
426
|
-
isFullscreen:
|
|
466
|
+
isFullscreen: y
|
|
427
467
|
}, r();
|
|
428
468
|
}
|
|
429
|
-
function
|
|
430
|
-
return e.artifacts.filter(($) => $.messageId ===
|
|
469
|
+
function h(y) {
|
|
470
|
+
return e.artifacts.filter(($) => $.messageId === y);
|
|
431
471
|
}
|
|
432
|
-
function
|
|
433
|
-
return e.artifacts.filter(($) => $.type ===
|
|
472
|
+
function m(y) {
|
|
473
|
+
return e.artifacts.filter(($) => $.type === y);
|
|
434
474
|
}
|
|
435
|
-
function
|
|
475
|
+
function g() {
|
|
436
476
|
return e.artifacts.length;
|
|
437
477
|
}
|
|
438
|
-
function
|
|
478
|
+
function b() {
|
|
439
479
|
e = {
|
|
440
480
|
artifacts: [],
|
|
441
481
|
activeArtifactId: null,
|
|
@@ -444,19 +484,19 @@ function Hr() {
|
|
|
444
484
|
isFullscreen: !1
|
|
445
485
|
}, r();
|
|
446
486
|
}
|
|
447
|
-
function v(
|
|
487
|
+
function v(y) {
|
|
448
488
|
const $ = r;
|
|
449
|
-
let
|
|
489
|
+
let A = !1;
|
|
450
490
|
const S = () => {
|
|
451
|
-
|
|
491
|
+
A = !0;
|
|
452
492
|
};
|
|
453
493
|
try {
|
|
454
494
|
Object.defineProperty(window, "__artifactuse_notify__", {
|
|
455
495
|
value: S,
|
|
456
496
|
configurable: !0
|
|
457
|
-
}),
|
|
497
|
+
}), y();
|
|
458
498
|
} finally {
|
|
459
|
-
delete window.__artifactuse_notify__,
|
|
499
|
+
delete window.__artifactuse_notify__, A && $();
|
|
460
500
|
}
|
|
461
501
|
}
|
|
462
502
|
return {
|
|
@@ -469,158 +509,158 @@ function Hr() {
|
|
|
469
509
|
removeArtifact: i,
|
|
470
510
|
getArtifact: l,
|
|
471
511
|
getActiveArtifact: c,
|
|
472
|
-
getArtifactsByMessageId:
|
|
473
|
-
getArtifactsByType:
|
|
474
|
-
getArtifactCount:
|
|
512
|
+
getArtifactsByMessageId: h,
|
|
513
|
+
getArtifactsByType: m,
|
|
514
|
+
getArtifactCount: g,
|
|
475
515
|
// Panel state
|
|
476
|
-
setActiveArtifact:
|
|
516
|
+
setActiveArtifact: d,
|
|
477
517
|
clearActiveArtifact: p,
|
|
478
|
-
setPanelOpen:
|
|
479
|
-
setViewMode:
|
|
518
|
+
setPanelOpen: u,
|
|
519
|
+
setViewMode: f,
|
|
480
520
|
setFullscreen: w,
|
|
481
521
|
// Utilities
|
|
482
|
-
clear:
|
|
522
|
+
clear: b,
|
|
483
523
|
batch: v
|
|
484
524
|
};
|
|
485
525
|
}
|
|
486
|
-
function
|
|
526
|
+
function st(e) {
|
|
487
527
|
try {
|
|
488
528
|
return new URL(e).hostname;
|
|
489
529
|
} catch {
|
|
490
530
|
return null;
|
|
491
531
|
}
|
|
492
532
|
}
|
|
493
|
-
function
|
|
533
|
+
function Jr(e = []) {
|
|
494
534
|
const t = Array.isArray(e) ? e : [e].filter(Boolean), r = new Set(t), a = /* @__PURE__ */ new Map();
|
|
495
535
|
let s = null, n = !1, o = !1;
|
|
496
536
|
const i = [];
|
|
497
|
-
function l(
|
|
537
|
+
function l(R) {
|
|
498
538
|
if (r.size === 0)
|
|
499
539
|
return console.warn("Artifactuse bridge: No allowed origins configured, accepting all messages"), !0;
|
|
500
|
-
const
|
|
501
|
-
if (!
|
|
502
|
-
for (const
|
|
503
|
-
const
|
|
504
|
-
if (
|
|
540
|
+
const T = st(R);
|
|
541
|
+
if (!T) return !1;
|
|
542
|
+
for (const z of r) {
|
|
543
|
+
const Z = st(z);
|
|
544
|
+
if (Z && Z === T || z === T)
|
|
505
545
|
return !0;
|
|
506
546
|
}
|
|
507
547
|
return !1;
|
|
508
548
|
}
|
|
509
|
-
function c(
|
|
510
|
-
var
|
|
511
|
-
if (((
|
|
512
|
-
((
|
|
549
|
+
function c(R) {
|
|
550
|
+
var k, M, x;
|
|
551
|
+
if (((k = R.data) == null ? void 0 : k.type) === "artifactuse" && (console.log("[Bridge] Message from:", R.origin, "action:", (M = R.data) == null ? void 0 : M.action), console.log("[Bridge] Allowed origins:", u())), !l(R.origin)) {
|
|
552
|
+
((x = R.data) == null ? void 0 : x.type) === "artifactuse" && console.warn("[Bridge] Origin NOT allowed:", R.origin);
|
|
513
553
|
return;
|
|
514
554
|
}
|
|
515
|
-
const { type:
|
|
516
|
-
if (
|
|
517
|
-
if (
|
|
555
|
+
const { type: T, action: z, data: Z, requestId: D } = R.data || {};
|
|
556
|
+
if (T !== "artifactuse") return;
|
|
557
|
+
if (z === "ready" || z === "panel:ready") {
|
|
518
558
|
console.log("[Bridge] panel:ready received, setting isReady=true"), n = !0, o = !0, w();
|
|
519
559
|
return;
|
|
520
560
|
}
|
|
521
|
-
(a.get(
|
|
561
|
+
(a.get(z) || []).forEach((j) => {
|
|
522
562
|
try {
|
|
523
|
-
|
|
524
|
-
} catch (
|
|
525
|
-
console.error(`Artifactuse bridge handler error (${
|
|
563
|
+
j(Z, D);
|
|
564
|
+
} catch (I) {
|
|
565
|
+
console.error(`Artifactuse bridge handler error (${z}):`, I);
|
|
526
566
|
}
|
|
527
|
-
}), (a.get("*") || []).forEach((
|
|
567
|
+
}), (a.get("*") || []).forEach((j) => {
|
|
528
568
|
try {
|
|
529
|
-
|
|
530
|
-
} catch (
|
|
531
|
-
console.error("Artifactuse bridge wildcard handler error:",
|
|
569
|
+
j({ action: z, data: Z, requestId: D });
|
|
570
|
+
} catch (I) {
|
|
571
|
+
console.error("Artifactuse bridge wildcard handler error:", I);
|
|
532
572
|
}
|
|
533
573
|
});
|
|
534
574
|
}
|
|
535
575
|
window.addEventListener("message", c);
|
|
536
|
-
function
|
|
537
|
-
|
|
576
|
+
function d(R) {
|
|
577
|
+
R && typeof R == "string" && r.add(R);
|
|
538
578
|
}
|
|
539
|
-
function p(
|
|
540
|
-
|
|
579
|
+
function p(R) {
|
|
580
|
+
R && typeof R == "string" && r.delete(R);
|
|
541
581
|
}
|
|
542
|
-
function
|
|
582
|
+
function u() {
|
|
543
583
|
return [...r];
|
|
544
584
|
}
|
|
545
|
-
function
|
|
546
|
-
console.log("[Bridge] setIframe called, current isReady:", n, "readySignalReceived:", o, "same iframe:", s ===
|
|
585
|
+
function f(R) {
|
|
586
|
+
console.log("[Bridge] setIframe called, current isReady:", n, "readySignalReceived:", o, "same iframe:", s === R), s !== R && (s = R, o ? (console.log("[Bridge] Ready signal was already received, keeping isReady=true"), n = !0) : n = !1), console.log("[Bridge] setIframe done, isReady:", n, "pendingMessages:", i.length), w();
|
|
547
587
|
}
|
|
548
588
|
function w() {
|
|
549
|
-
console.log("[Bridge] flushPendingMessages: isReady=", n, "hasIframe=", !!(s != null && s.contentWindow), "pending=", i.length), n && (s != null && s.contentWindow) && i.length > 0 && (console.log("[Bridge] Flushing", i.length, "pending messages"), i.forEach((
|
|
589
|
+
console.log("[Bridge] flushPendingMessages: isReady=", n, "hasIframe=", !!(s != null && s.contentWindow), "pending=", i.length), n && (s != null && s.contentWindow) && i.length > 0 && (console.log("[Bridge] Flushing", i.length, "pending messages"), i.forEach((R) => h(R)), i.length = 0);
|
|
550
590
|
}
|
|
551
|
-
function
|
|
591
|
+
function h(R, T = "*") {
|
|
552
592
|
if (!(s != null && s.contentWindow))
|
|
553
593
|
return console.warn("Artifactuse: No panel iframe available"), !1;
|
|
554
594
|
try {
|
|
555
|
-
return s.contentWindow.postMessage(
|
|
556
|
-
} catch (
|
|
557
|
-
return console.error("Artifactuse bridge send error:",
|
|
595
|
+
return s.contentWindow.postMessage(R, T), !0;
|
|
596
|
+
} catch (z) {
|
|
597
|
+
return console.error("Artifactuse bridge send error:", z), !1;
|
|
558
598
|
}
|
|
559
599
|
}
|
|
560
|
-
function
|
|
561
|
-
const
|
|
600
|
+
function m(R, T, z = null, Z = "*") {
|
|
601
|
+
const D = {
|
|
562
602
|
type: "artifactuse",
|
|
563
|
-
action:
|
|
564
|
-
data:
|
|
565
|
-
requestId:
|
|
603
|
+
action: R,
|
|
604
|
+
data: T,
|
|
605
|
+
requestId: z || nt(),
|
|
566
606
|
timestamp: Date.now()
|
|
567
607
|
};
|
|
568
|
-
return n ? (
|
|
569
|
-
}
|
|
570
|
-
function
|
|
571
|
-
return new Promise((
|
|
572
|
-
const
|
|
573
|
-
v(`${
|
|
574
|
-
},
|
|
575
|
-
|
|
608
|
+
return n ? (h(D, Z), D.requestId) : (i.push(D), D.requestId);
|
|
609
|
+
}
|
|
610
|
+
function g(R, T, z = 3e4) {
|
|
611
|
+
return new Promise((Z, D) => {
|
|
612
|
+
const U = nt(), J = setTimeout(() => {
|
|
613
|
+
v(`${R}:response`, k), D(new Error(`Artifactuse bridge request timeout: ${R}`));
|
|
614
|
+
}, z), k = (M, x) => {
|
|
615
|
+
x === U && (clearTimeout(J), v(`${R}:response`, k), Z(M));
|
|
576
616
|
};
|
|
577
|
-
|
|
617
|
+
b(`${R}:response`, k), m(R, T, U);
|
|
578
618
|
});
|
|
579
619
|
}
|
|
580
|
-
function
|
|
581
|
-
return a.has(
|
|
620
|
+
function b(R, T) {
|
|
621
|
+
return a.has(R) || a.set(R, []), a.get(R).push(T), () => v(R, T);
|
|
582
622
|
}
|
|
583
|
-
function v(
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
586
|
-
const
|
|
587
|
-
|
|
623
|
+
function v(R, T) {
|
|
624
|
+
const z = a.get(R);
|
|
625
|
+
if (z) {
|
|
626
|
+
const Z = z.indexOf(T);
|
|
627
|
+
Z > -1 && z.splice(Z, 1);
|
|
588
628
|
}
|
|
589
629
|
}
|
|
590
|
-
function
|
|
591
|
-
return
|
|
630
|
+
function y(R) {
|
|
631
|
+
return m("load:artifact", R);
|
|
592
632
|
}
|
|
593
|
-
function $(
|
|
594
|
-
return
|
|
633
|
+
function $(R, T) {
|
|
634
|
+
return m("update:artifact", { artifactId: R, updates: T });
|
|
595
635
|
}
|
|
596
|
-
function
|
|
597
|
-
return
|
|
636
|
+
function A() {
|
|
637
|
+
return g("save", {});
|
|
598
638
|
}
|
|
599
|
-
function S(
|
|
600
|
-
return
|
|
639
|
+
function S(R = "default") {
|
|
640
|
+
return g("export", { format: R });
|
|
601
641
|
}
|
|
602
|
-
function
|
|
603
|
-
return
|
|
642
|
+
function C(R, T) {
|
|
643
|
+
return m("ai:response", R, T);
|
|
604
644
|
}
|
|
605
|
-
function
|
|
645
|
+
function q() {
|
|
606
646
|
window.removeEventListener("message", c), a.clear(), r.clear(), s = null, n = !1, o = !1, i.length = 0;
|
|
607
647
|
}
|
|
608
648
|
return {
|
|
609
|
-
setIframe:
|
|
610
|
-
send:
|
|
611
|
-
request:
|
|
612
|
-
on:
|
|
649
|
+
setIframe: f,
|
|
650
|
+
send: m,
|
|
651
|
+
request: g,
|
|
652
|
+
on: b,
|
|
613
653
|
off: v,
|
|
614
|
-
loadArtifact:
|
|
654
|
+
loadArtifact: y,
|
|
615
655
|
updateArtifact: $,
|
|
616
|
-
requestSave:
|
|
656
|
+
requestSave: A,
|
|
617
657
|
requestExport: S,
|
|
618
|
-
sendAIResponse:
|
|
619
|
-
destroy:
|
|
658
|
+
sendAIResponse: C,
|
|
659
|
+
destroy: q,
|
|
620
660
|
// Origin management
|
|
621
|
-
addAllowedOrigin:
|
|
661
|
+
addAllowedOrigin: d,
|
|
622
662
|
removeAllowedOrigin: p,
|
|
623
|
-
getAllowedOrigins:
|
|
663
|
+
getAllowedOrigins: u,
|
|
624
664
|
// State
|
|
625
665
|
get isReady() {
|
|
626
666
|
return n;
|
|
@@ -630,10 +670,10 @@ function Dr(e = []) {
|
|
|
630
670
|
}
|
|
631
671
|
};
|
|
632
672
|
}
|
|
633
|
-
function
|
|
673
|
+
function nt() {
|
|
634
674
|
return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
635
675
|
}
|
|
636
|
-
function
|
|
676
|
+
function Yr(e) {
|
|
637
677
|
if (!e) return null;
|
|
638
678
|
if (typeof e == "string" && e.includes(","))
|
|
639
679
|
return e.trim();
|
|
@@ -643,22 +683,22 @@ function Or(e) {
|
|
|
643
683
|
const r = parseInt(t.slice(0, 2), 16), a = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16);
|
|
644
684
|
return `${r}, ${a}, ${s}`;
|
|
645
685
|
}
|
|
646
|
-
function
|
|
647
|
-
return e ?
|
|
686
|
+
function ea(e) {
|
|
687
|
+
return e ? Yr(e) : null;
|
|
648
688
|
}
|
|
649
|
-
function
|
|
689
|
+
function fe(e) {
|
|
650
690
|
if (!e || typeof e != "object") return {};
|
|
651
691
|
const t = {};
|
|
652
692
|
for (const [r, a] of Object.entries(e))
|
|
653
693
|
if (r === "gradientOpacity" || typeof a == "number")
|
|
654
694
|
t[r] = a;
|
|
655
695
|
else {
|
|
656
|
-
const s =
|
|
696
|
+
const s = ea(a);
|
|
657
697
|
s && (t[r] = s);
|
|
658
698
|
}
|
|
659
699
|
return t;
|
|
660
700
|
}
|
|
661
|
-
const
|
|
701
|
+
const it = {
|
|
662
702
|
// Dark theme
|
|
663
703
|
dark: {
|
|
664
704
|
primary: "99, 102, 241",
|
|
@@ -728,15 +768,15 @@ const Je = {
|
|
|
728
768
|
gradientOpacity: "0.25"
|
|
729
769
|
}
|
|
730
770
|
};
|
|
731
|
-
function
|
|
771
|
+
function ta(e = "auto", t = {}) {
|
|
732
772
|
let r = e, a = {
|
|
733
|
-
dark: { ...
|
|
734
|
-
light: { ...
|
|
773
|
+
dark: { ...it.dark },
|
|
774
|
+
light: { ...it.light }
|
|
735
775
|
};
|
|
736
|
-
t.dark && (a.dark = { ...a.dark, ...
|
|
776
|
+
t.dark && (a.dark = { ...a.dark, ...fe(t.dark) }), t.light && (a.light = { ...a.light, ...fe(t.light) });
|
|
737
777
|
const s = { ...t };
|
|
738
778
|
if (delete s.dark, delete s.light, Object.keys(s).length > 0) {
|
|
739
|
-
const w =
|
|
779
|
+
const w = fe(s);
|
|
740
780
|
a.dark = { ...a.dark, ...w }, a.light = { ...a.light, ...w };
|
|
741
781
|
}
|
|
742
782
|
function n() {
|
|
@@ -747,14 +787,14 @@ function Vr(e = "auto", t = {}) {
|
|
|
747
787
|
}
|
|
748
788
|
function i() {
|
|
749
789
|
const w = o();
|
|
750
|
-
return Object.entries(w).map(([
|
|
790
|
+
return Object.entries(w).map(([h, m]) => `--artifactuse-${ae(h)}: ${m};`).join(`
|
|
751
791
|
`);
|
|
752
792
|
}
|
|
753
793
|
function l(w = document.documentElement) {
|
|
754
|
-
const
|
|
755
|
-
Object.entries(
|
|
756
|
-
w.style.setProperty(`--artifactuse-${
|
|
757
|
-
}), w.setAttribute("data-artifactuse-theme",
|
|
794
|
+
const h = o(), m = n();
|
|
795
|
+
Object.entries(h).forEach(([g, b]) => {
|
|
796
|
+
w.style.setProperty(`--artifactuse-${ae(g)}`, b);
|
|
797
|
+
}), w.setAttribute("data-artifactuse-theme", m), w.classList.remove("artifactuse-dark", "artifactuse-light"), w.classList.add(`artifactuse-${m}`);
|
|
758
798
|
}
|
|
759
799
|
function c(w) {
|
|
760
800
|
if (!["dark", "light", "auto"].includes(w)) {
|
|
@@ -763,38 +803,38 @@ function Vr(e = "auto", t = {}) {
|
|
|
763
803
|
}
|
|
764
804
|
r = w, l();
|
|
765
805
|
}
|
|
766
|
-
function
|
|
806
|
+
function d() {
|
|
767
807
|
const w = n();
|
|
768
808
|
c(w === "dark" ? "light" : "dark");
|
|
769
809
|
}
|
|
770
|
-
function p(w,
|
|
771
|
-
const
|
|
772
|
-
|
|
810
|
+
function p(w, h = null) {
|
|
811
|
+
const m = fe(w);
|
|
812
|
+
h ? a[h] = { ...a[h], ...m } : (a.dark = { ...a.dark, ...m }, a.light = { ...a.light, ...m }), l();
|
|
773
813
|
}
|
|
774
|
-
function
|
|
775
|
-
const
|
|
776
|
-
r === "auto" && (l(), w && w(
|
|
814
|
+
function u(w) {
|
|
815
|
+
const h = window.matchMedia("(prefers-color-scheme: dark)"), m = (g) => {
|
|
816
|
+
r === "auto" && (l(), w && w(g.matches ? "dark" : "light"));
|
|
777
817
|
};
|
|
778
|
-
return
|
|
779
|
-
|
|
818
|
+
return h.addEventListener("change", m), () => {
|
|
819
|
+
h.removeEventListener("change", m);
|
|
780
820
|
};
|
|
781
821
|
}
|
|
782
|
-
function
|
|
822
|
+
function f() {
|
|
783
823
|
return `
|
|
784
824
|
:root,
|
|
785
825
|
[data-artifactuse-theme="dark"] {
|
|
786
|
-
${Object.entries(a.dark).map(([w,
|
|
826
|
+
${Object.entries(a.dark).map(([w, h]) => `--artifactuse-${ae(w)}: ${h};`).join(`
|
|
787
827
|
`)}
|
|
788
828
|
}
|
|
789
829
|
|
|
790
830
|
[data-artifactuse-theme="light"] {
|
|
791
|
-
${Object.entries(a.light).map(([w,
|
|
831
|
+
${Object.entries(a.light).map(([w, h]) => `--artifactuse-${ae(w)}: ${h};`).join(`
|
|
792
832
|
`)}
|
|
793
833
|
}
|
|
794
834
|
|
|
795
835
|
@media (prefers-color-scheme: light) {
|
|
796
836
|
:root:not([data-artifactuse-theme]) {
|
|
797
|
-
${Object.entries(a.light).map(([w,
|
|
837
|
+
${Object.entries(a.light).map(([w, h]) => `--artifactuse-${ae(w)}: ${h};`).join(`
|
|
798
838
|
`)}
|
|
799
839
|
}
|
|
800
840
|
}
|
|
@@ -813,37 +853,37 @@ function Vr(e = "auto", t = {}) {
|
|
|
813
853
|
getResolvedTheme: n,
|
|
814
854
|
getColors: o,
|
|
815
855
|
getCSSVariables: i,
|
|
816
|
-
getCSS:
|
|
856
|
+
getCSS: f,
|
|
817
857
|
apply: l,
|
|
818
858
|
set: c,
|
|
819
|
-
toggle:
|
|
859
|
+
toggle: d,
|
|
820
860
|
setColors: p,
|
|
821
|
-
watchSystemTheme:
|
|
861
|
+
watchSystemTheme: u
|
|
822
862
|
};
|
|
823
863
|
}
|
|
824
|
-
function
|
|
864
|
+
function ae(e) {
|
|
825
865
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
826
866
|
}
|
|
827
|
-
const
|
|
828
|
-
function
|
|
867
|
+
const Fe = "artifactuse_auth", ur = "https://app.artifactuse.com", ue = "https://api.artifactuse.com";
|
|
868
|
+
function Ae() {
|
|
829
869
|
if (typeof window > "u" || !window.localStorage)
|
|
830
870
|
return null;
|
|
831
871
|
try {
|
|
832
|
-
const e = localStorage.getItem(
|
|
872
|
+
const e = localStorage.getItem(Fe);
|
|
833
873
|
return e ? JSON.parse(e) : null;
|
|
834
874
|
} catch {
|
|
835
875
|
return null;
|
|
836
876
|
}
|
|
837
877
|
}
|
|
838
|
-
function
|
|
878
|
+
function ra(e) {
|
|
839
879
|
if (!(typeof window > "u" || !window.localStorage))
|
|
840
880
|
try {
|
|
841
|
-
localStorage.setItem(
|
|
881
|
+
localStorage.setItem(Fe, JSON.stringify(e));
|
|
842
882
|
} catch {
|
|
843
883
|
}
|
|
844
884
|
}
|
|
845
|
-
async function
|
|
846
|
-
const { apiUrl: r =
|
|
885
|
+
async function aa(e, t = {}) {
|
|
886
|
+
const { apiUrl: r = ue } = t, a = await fetch(`${r}/v1/project/share`, {
|
|
847
887
|
method: "POST",
|
|
848
888
|
headers: {
|
|
849
889
|
"Content-Type": "application/json"
|
|
@@ -860,8 +900,8 @@ async function Nr(e, t = {}) {
|
|
|
860
900
|
}
|
|
861
901
|
return a.json();
|
|
862
902
|
}
|
|
863
|
-
async function
|
|
864
|
-
const { apiUrl: r =
|
|
903
|
+
async function sa(e, t = {}) {
|
|
904
|
+
const { apiUrl: r = ue, getStoredAuthData: a = Ae } = t, s = a();
|
|
865
905
|
if (!(s != null && s.token))
|
|
866
906
|
throw new Error("Authentication required. Please sign in first.");
|
|
867
907
|
const n = await fetch(`${r}/v1/project/save`, {
|
|
@@ -882,11 +922,11 @@ async function Ur(e, t = {}) {
|
|
|
882
922
|
}
|
|
883
923
|
return n.json();
|
|
884
924
|
}
|
|
885
|
-
function
|
|
925
|
+
function na(e = {}) {
|
|
886
926
|
const {
|
|
887
|
-
appUrl: t =
|
|
888
|
-
setStoredAuthData: r =
|
|
889
|
-
getStoredAuthData: a =
|
|
927
|
+
appUrl: t = ur,
|
|
928
|
+
setStoredAuthData: r = ra,
|
|
929
|
+
getStoredAuthData: a = Ae
|
|
890
930
|
} = e;
|
|
891
931
|
return new Promise((s, n) => {
|
|
892
932
|
const o = window.location.origin, i = `${t}/sdk/auth?origin=${encodeURIComponent(o)}`, l = window.open(
|
|
@@ -899,25 +939,25 @@ function Gr(e = {}) {
|
|
|
899
939
|
return;
|
|
900
940
|
}
|
|
901
941
|
const c = (p) => {
|
|
902
|
-
var
|
|
903
|
-
if (p.origin === t && ((
|
|
942
|
+
var u;
|
|
943
|
+
if (p.origin === t && ((u = p.data) == null ? void 0 : u.type) === "sdk-auth") {
|
|
904
944
|
window.removeEventListener("message", c);
|
|
905
|
-
const { token:
|
|
906
|
-
|
|
945
|
+
const { token: f, user: w } = p.data;
|
|
946
|
+
f ? (r({ token: f, user: w }), s({ token: f, user: w })) : n(new Error("Authentication failed"));
|
|
907
947
|
}
|
|
908
948
|
};
|
|
909
949
|
window.addEventListener("message", c);
|
|
910
|
-
const
|
|
950
|
+
const d = setInterval(() => {
|
|
911
951
|
if (l.closed) {
|
|
912
|
-
clearInterval(
|
|
952
|
+
clearInterval(d), window.removeEventListener("message", c);
|
|
913
953
|
const p = a();
|
|
914
954
|
p != null && p.token ? s(p) : n(new Error("Authentication cancelled"));
|
|
915
955
|
}
|
|
916
956
|
}, 500);
|
|
917
957
|
});
|
|
918
958
|
}
|
|
919
|
-
async function
|
|
920
|
-
const { apiUrl: t =
|
|
959
|
+
async function ia(e = {}) {
|
|
960
|
+
const { apiUrl: t = ue, language: r, getStoredAuthData: a = Ae } = e, s = a();
|
|
921
961
|
if (!(s != null && s.token))
|
|
922
962
|
throw new Error("Authentication required. Please sign in first.");
|
|
923
963
|
const n = new URLSearchParams();
|
|
@@ -935,8 +975,8 @@ async function Xr(e = {}) {
|
|
|
935
975
|
}
|
|
936
976
|
return o.json();
|
|
937
977
|
}
|
|
938
|
-
async function
|
|
939
|
-
const { apiUrl: a =
|
|
978
|
+
async function oa(e, t, r = {}) {
|
|
979
|
+
const { apiUrl: a = ue, getStoredAuthData: s = Ae } = r, n = s();
|
|
940
980
|
if (!(n != null && n.token))
|
|
941
981
|
throw new Error("Authentication required. Please sign in first.");
|
|
942
982
|
const o = await fetch(`${a}/v1/project/update`, {
|
|
@@ -957,11 +997,11 @@ async function Wr(e, t, r = {}) {
|
|
|
957
997
|
}
|
|
958
998
|
return o.json();
|
|
959
999
|
}
|
|
960
|
-
function
|
|
1000
|
+
function ca(e = {}) {
|
|
961
1001
|
const {
|
|
962
|
-
apiUrl: t =
|
|
963
|
-
appUrl: r =
|
|
964
|
-
storageKey: a =
|
|
1002
|
+
apiUrl: t = ue,
|
|
1003
|
+
appUrl: r = ur,
|
|
1004
|
+
storageKey: a = Fe,
|
|
965
1005
|
enabled: s = !0,
|
|
966
1006
|
allowAnonymous: n = !0,
|
|
967
1007
|
expiryDays: o = 30
|
|
@@ -969,16 +1009,16 @@ function Kr(e = {}) {
|
|
|
969
1009
|
function i() {
|
|
970
1010
|
if (typeof window > "u" || !window.localStorage) return null;
|
|
971
1011
|
try {
|
|
972
|
-
const
|
|
973
|
-
return
|
|
1012
|
+
const d = localStorage.getItem(a);
|
|
1013
|
+
return d ? JSON.parse(d) : null;
|
|
974
1014
|
} catch {
|
|
975
1015
|
return null;
|
|
976
1016
|
}
|
|
977
1017
|
}
|
|
978
|
-
function l(
|
|
1018
|
+
function l(d) {
|
|
979
1019
|
if (!(typeof window > "u" || !window.localStorage))
|
|
980
1020
|
try {
|
|
981
|
-
localStorage.setItem(a, JSON.stringify(
|
|
1021
|
+
localStorage.setItem(a, JSON.stringify(d));
|
|
982
1022
|
} catch {
|
|
983
1023
|
}
|
|
984
1024
|
}
|
|
@@ -997,75 +1037,387 @@ function Kr(e = {}) {
|
|
|
997
1037
|
appUrl: r,
|
|
998
1038
|
// State helpers
|
|
999
1039
|
isAuthenticated: () => {
|
|
1000
|
-
var
|
|
1001
|
-
return ((
|
|
1040
|
+
var d;
|
|
1041
|
+
return ((d = i()) == null ? void 0 : d.token) != null;
|
|
1002
1042
|
},
|
|
1003
1043
|
getStoredEmail: () => {
|
|
1004
|
-
var
|
|
1005
|
-
return ((p = (
|
|
1044
|
+
var d, p;
|
|
1045
|
+
return ((p = (d = i()) == null ? void 0 : d.user) == null ? void 0 : p.email) || "";
|
|
1006
1046
|
},
|
|
1007
1047
|
getStoredAuthData: i,
|
|
1008
1048
|
setStoredAuthData: l,
|
|
1009
1049
|
clearStoredAuthData: c,
|
|
1010
1050
|
signOut: c,
|
|
1011
1051
|
// API methods
|
|
1012
|
-
share: (
|
|
1013
|
-
save: (
|
|
1014
|
-
listArtifacts: (
|
|
1015
|
-
updateArtifact: (
|
|
1016
|
-
openAuthPopup: () =>
|
|
1052
|
+
share: (d) => aa(d, { apiUrl: t }),
|
|
1053
|
+
save: (d) => sa(d, { apiUrl: t, getStoredAuthData: i }),
|
|
1054
|
+
listArtifacts: (d) => ia({ apiUrl: t, language: d, getStoredAuthData: i }),
|
|
1055
|
+
updateArtifact: (d, p) => oa(d, p, { apiUrl: t, getStoredAuthData: i }),
|
|
1056
|
+
openAuthPopup: () => na({ appUrl: r, setStoredAuthData: l, getStoredAuthData: i })
|
|
1017
1057
|
};
|
|
1018
1058
|
}
|
|
1019
|
-
function
|
|
1059
|
+
function la(e = {}) {
|
|
1060
|
+
const t = e.modules || null;
|
|
1061
|
+
let r = e.theme || "dark";
|
|
1062
|
+
function a() {
|
|
1063
|
+
return !!(t != null && t.state && (t != null && t.view));
|
|
1064
|
+
}
|
|
1065
|
+
function s(p) {
|
|
1066
|
+
return p.theme({
|
|
1067
|
+
"&": {
|
|
1068
|
+
backgroundColor: "#1e1e1e",
|
|
1069
|
+
color: "#e4e4e7",
|
|
1070
|
+
height: "100%"
|
|
1071
|
+
},
|
|
1072
|
+
".cm-content": {
|
|
1073
|
+
caretColor: "var(--accent, #60a5fa)",
|
|
1074
|
+
fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',
|
|
1075
|
+
fontSize: "13px",
|
|
1076
|
+
lineHeight: "1.6",
|
|
1077
|
+
padding: "12px 0"
|
|
1078
|
+
},
|
|
1079
|
+
".cm-cursor, .cm-dropCursor": {
|
|
1080
|
+
borderLeftColor: "var(--accent, #60a5fa)",
|
|
1081
|
+
borderLeftWidth: "2px"
|
|
1082
|
+
},
|
|
1083
|
+
".cm-selectionBackground, ::selection": {
|
|
1084
|
+
backgroundColor: "rgba(99, 102, 241, 0.3) !important"
|
|
1085
|
+
},
|
|
1086
|
+
".cm-focused .cm-selectionBackground": {
|
|
1087
|
+
backgroundColor: "rgba(99, 102, 241, 0.3)"
|
|
1088
|
+
},
|
|
1089
|
+
".cm-activeLine": {
|
|
1090
|
+
backgroundColor: "rgba(255, 255, 255, 0.03)"
|
|
1091
|
+
},
|
|
1092
|
+
".cm-activeLineGutter": {
|
|
1093
|
+
backgroundColor: "rgba(255, 255, 255, 0.05)"
|
|
1094
|
+
},
|
|
1095
|
+
".cm-gutters": {
|
|
1096
|
+
backgroundColor: "transparent",
|
|
1097
|
+
color: "#52525b",
|
|
1098
|
+
border: "none",
|
|
1099
|
+
paddingRight: "8px"
|
|
1100
|
+
},
|
|
1101
|
+
".cm-lineNumbers .cm-gutterElement": {
|
|
1102
|
+
padding: "0 8px 0 16px",
|
|
1103
|
+
minWidth: "40px"
|
|
1104
|
+
},
|
|
1105
|
+
".cm-foldGutter .cm-gutterElement": {
|
|
1106
|
+
padding: "0 4px",
|
|
1107
|
+
cursor: "pointer",
|
|
1108
|
+
color: "#71717a"
|
|
1109
|
+
},
|
|
1110
|
+
".cm-foldGutter .cm-gutterElement:hover": {
|
|
1111
|
+
color: "#a1a1aa"
|
|
1112
|
+
},
|
|
1113
|
+
".cm-matchingBracket": {
|
|
1114
|
+
backgroundColor: "rgba(99, 102, 241, 0.25)",
|
|
1115
|
+
outline: "1px solid rgba(99, 102, 241, 0.5)"
|
|
1116
|
+
},
|
|
1117
|
+
".cm-tooltip": {
|
|
1118
|
+
backgroundColor: "#27272a",
|
|
1119
|
+
border: "1px solid #3f3f46",
|
|
1120
|
+
borderRadius: "6px"
|
|
1121
|
+
},
|
|
1122
|
+
".cm-tooltip-autocomplete": {
|
|
1123
|
+
"& > ul": {
|
|
1124
|
+
fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'
|
|
1125
|
+
},
|
|
1126
|
+
"& > ul > li": {
|
|
1127
|
+
padding: "4px 8px"
|
|
1128
|
+
},
|
|
1129
|
+
"& > ul > li[aria-selected]": {
|
|
1130
|
+
backgroundColor: "rgba(99, 102, 241, 0.2)"
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
".cm-scroller": {
|
|
1134
|
+
overflow: "auto"
|
|
1135
|
+
}
|
|
1136
|
+
}, { dark: !0 });
|
|
1137
|
+
}
|
|
1138
|
+
function n(p) {
|
|
1139
|
+
return p.theme({
|
|
1140
|
+
"&": {
|
|
1141
|
+
backgroundColor: "#ffffff",
|
|
1142
|
+
color: "#27272a",
|
|
1143
|
+
height: "100%"
|
|
1144
|
+
},
|
|
1145
|
+
".cm-content": {
|
|
1146
|
+
caretColor: "var(--accent, #3b82f6)",
|
|
1147
|
+
fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',
|
|
1148
|
+
fontSize: "13px",
|
|
1149
|
+
lineHeight: "1.6",
|
|
1150
|
+
padding: "12px 0"
|
|
1151
|
+
},
|
|
1152
|
+
".cm-cursor, .cm-dropCursor": {
|
|
1153
|
+
borderLeftColor: "var(--accent, #3b82f6)",
|
|
1154
|
+
borderLeftWidth: "2px"
|
|
1155
|
+
},
|
|
1156
|
+
".cm-selectionBackground, ::selection": {
|
|
1157
|
+
backgroundColor: "rgba(59, 130, 246, 0.2) !important"
|
|
1158
|
+
},
|
|
1159
|
+
".cm-focused .cm-selectionBackground": {
|
|
1160
|
+
backgroundColor: "rgba(59, 130, 246, 0.2)"
|
|
1161
|
+
},
|
|
1162
|
+
".cm-activeLine": {
|
|
1163
|
+
backgroundColor: "rgba(0, 0, 0, 0.03)"
|
|
1164
|
+
},
|
|
1165
|
+
".cm-activeLineGutter": {
|
|
1166
|
+
backgroundColor: "rgba(0, 0, 0, 0.05)"
|
|
1167
|
+
},
|
|
1168
|
+
".cm-gutters": {
|
|
1169
|
+
backgroundColor: "transparent",
|
|
1170
|
+
color: "#a1a1aa",
|
|
1171
|
+
border: "none",
|
|
1172
|
+
paddingRight: "8px"
|
|
1173
|
+
},
|
|
1174
|
+
".cm-lineNumbers .cm-gutterElement": {
|
|
1175
|
+
padding: "0 8px 0 16px",
|
|
1176
|
+
minWidth: "40px"
|
|
1177
|
+
},
|
|
1178
|
+
".cm-foldGutter .cm-gutterElement": {
|
|
1179
|
+
padding: "0 4px",
|
|
1180
|
+
cursor: "pointer",
|
|
1181
|
+
color: "#a1a1aa"
|
|
1182
|
+
},
|
|
1183
|
+
".cm-foldGutter .cm-gutterElement:hover": {
|
|
1184
|
+
color: "#71717a"
|
|
1185
|
+
},
|
|
1186
|
+
".cm-matchingBracket": {
|
|
1187
|
+
backgroundColor: "rgba(59, 130, 246, 0.15)",
|
|
1188
|
+
outline: "1px solid rgba(59, 130, 246, 0.4)"
|
|
1189
|
+
},
|
|
1190
|
+
".cm-tooltip": {
|
|
1191
|
+
backgroundColor: "#ffffff",
|
|
1192
|
+
border: "1px solid #e4e4e7",
|
|
1193
|
+
borderRadius: "6px",
|
|
1194
|
+
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
|
|
1195
|
+
},
|
|
1196
|
+
".cm-tooltip-autocomplete": {
|
|
1197
|
+
"& > ul": {
|
|
1198
|
+
fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'
|
|
1199
|
+
},
|
|
1200
|
+
"& > ul > li": {
|
|
1201
|
+
padding: "4px 8px"
|
|
1202
|
+
},
|
|
1203
|
+
"& > ul > li[aria-selected]": {
|
|
1204
|
+
backgroundColor: "rgba(59, 130, 246, 0.1)"
|
|
1205
|
+
}
|
|
1206
|
+
},
|
|
1207
|
+
".cm-scroller": {
|
|
1208
|
+
overflow: "auto"
|
|
1209
|
+
}
|
|
1210
|
+
}, { dark: !1 });
|
|
1211
|
+
}
|
|
1212
|
+
function o(p, u, f) {
|
|
1213
|
+
return f ? p.define([
|
|
1214
|
+
{ tag: u.keyword, color: "#c084fc" },
|
|
1215
|
+
{ tag: u.operator, color: "#94a3b8" },
|
|
1216
|
+
{ tag: u.special(u.variableName), color: "#67e8f9" },
|
|
1217
|
+
{ tag: u.typeName, color: "#fbbf24" },
|
|
1218
|
+
{ tag: u.atom, color: "#fb923c" },
|
|
1219
|
+
{ tag: u.number, color: "#fb923c" },
|
|
1220
|
+
{ tag: u.definition(u.variableName), color: "#67e8f9" },
|
|
1221
|
+
{ tag: u.string, color: "#86efac" },
|
|
1222
|
+
{ tag: u.special(u.string), color: "#86efac" },
|
|
1223
|
+
{ tag: u.comment, color: "#6b7280", fontStyle: "italic" },
|
|
1224
|
+
{ tag: u.variableName, color: "#e4e4e7" },
|
|
1225
|
+
{ tag: u.tagName, color: "#f87171" },
|
|
1226
|
+
{ tag: u.bracket, color: "#a1a1aa" },
|
|
1227
|
+
{ tag: u.meta, color: "#fbbf24" },
|
|
1228
|
+
{ tag: u.link, color: "#60a5fa", textDecoration: "underline" },
|
|
1229
|
+
{ tag: u.heading, fontWeight: "bold", color: "#f472b6" },
|
|
1230
|
+
{ tag: u.emphasis, fontStyle: "italic" },
|
|
1231
|
+
{ tag: u.strong, fontWeight: "bold" },
|
|
1232
|
+
{ tag: u.strikethrough, textDecoration: "line-through" },
|
|
1233
|
+
{ tag: u.className, color: "#fbbf24" },
|
|
1234
|
+
{ tag: u.propertyName, color: "#60a5fa" },
|
|
1235
|
+
{ tag: u.function(u.variableName), color: "#60a5fa" },
|
|
1236
|
+
{ tag: u.function(u.propertyName), color: "#60a5fa" },
|
|
1237
|
+
{ tag: u.bool, color: "#fb923c" },
|
|
1238
|
+
{ tag: u.null, color: "#fb923c" },
|
|
1239
|
+
{ tag: u.regexp, color: "#f87171" }
|
|
1240
|
+
]) : p.define([
|
|
1241
|
+
{ tag: u.keyword, color: "#7c3aed" },
|
|
1242
|
+
{ tag: u.operator, color: "#64748b" },
|
|
1243
|
+
{ tag: u.special(u.variableName), color: "#0891b2" },
|
|
1244
|
+
{ tag: u.typeName, color: "#d97706" },
|
|
1245
|
+
{ tag: u.atom, color: "#ea580c" },
|
|
1246
|
+
{ tag: u.number, color: "#ea580c" },
|
|
1247
|
+
{ tag: u.definition(u.variableName), color: "#0891b2" },
|
|
1248
|
+
{ tag: u.string, color: "#16a34a" },
|
|
1249
|
+
{ tag: u.special(u.string), color: "#16a34a" },
|
|
1250
|
+
{ tag: u.comment, color: "#9ca3af", fontStyle: "italic" },
|
|
1251
|
+
{ tag: u.variableName, color: "#27272a" },
|
|
1252
|
+
{ tag: u.tagName, color: "#dc2626" },
|
|
1253
|
+
{ tag: u.bracket, color: "#71717a" },
|
|
1254
|
+
{ tag: u.meta, color: "#d97706" },
|
|
1255
|
+
{ tag: u.link, color: "#2563eb", textDecoration: "underline" },
|
|
1256
|
+
{ tag: u.heading, fontWeight: "bold", color: "#db2777" },
|
|
1257
|
+
{ tag: u.emphasis, fontStyle: "italic" },
|
|
1258
|
+
{ tag: u.strong, fontWeight: "bold" },
|
|
1259
|
+
{ tag: u.strikethrough, textDecoration: "line-through" },
|
|
1260
|
+
{ tag: u.className, color: "#d97706" },
|
|
1261
|
+
{ tag: u.propertyName, color: "#2563eb" },
|
|
1262
|
+
{ tag: u.function(u.variableName), color: "#2563eb" },
|
|
1263
|
+
{ tag: u.function(u.propertyName), color: "#2563eb" },
|
|
1264
|
+
{ tag: u.bool, color: "#ea580c" },
|
|
1265
|
+
{ tag: u.null, color: "#ea580c" },
|
|
1266
|
+
{ tag: u.regexp, color: "#dc2626" }
|
|
1267
|
+
]);
|
|
1268
|
+
}
|
|
1269
|
+
function i(p) {
|
|
1270
|
+
const u = p == null ? void 0 : p.toLowerCase();
|
|
1271
|
+
return (u === "javascript" || u === "js" || u === "jsx" || u === "tsx" || u === "typescript" || u === "ts") && t.langJavascript ? t.langJavascript.javascript() : (u === "python" || u === "py") && t.langPython ? t.langPython.python() : [];
|
|
1272
|
+
}
|
|
1273
|
+
function l(p) {
|
|
1274
|
+
return r === "auto" ? p === "dark" : r === "dark";
|
|
1275
|
+
}
|
|
1276
|
+
function c(p, u = {}) {
|
|
1277
|
+
var tt, rt;
|
|
1278
|
+
if (!a())
|
|
1279
|
+
return console.warn("Artifactuse: CodeMirror modules not provided. Editor not available."), null;
|
|
1280
|
+
const { EditorState: f } = t.state, {
|
|
1281
|
+
EditorView: w,
|
|
1282
|
+
keymap: h,
|
|
1283
|
+
lineNumbers: m,
|
|
1284
|
+
highlightActiveLineGutter: g,
|
|
1285
|
+
highlightSpecialChars: b,
|
|
1286
|
+
drawSelection: v,
|
|
1287
|
+
dropCursor: y,
|
|
1288
|
+
rectangularSelection: $,
|
|
1289
|
+
crosshairCursor: A,
|
|
1290
|
+
highlightActiveLine: S
|
|
1291
|
+
} = t.view, { defaultKeymap: C, history: q, historyKeymap: R, indentWithTab: T } = t.commands, {
|
|
1292
|
+
indentOnInput: z,
|
|
1293
|
+
syntaxHighlighting: Z,
|
|
1294
|
+
bracketMatching: D,
|
|
1295
|
+
foldGutter: U,
|
|
1296
|
+
foldKeymap: J,
|
|
1297
|
+
HighlightStyle: k
|
|
1298
|
+
} = t.language, {
|
|
1299
|
+
closeBrackets: M,
|
|
1300
|
+
closeBracketsKeymap: x,
|
|
1301
|
+
autocompletion: j,
|
|
1302
|
+
completionKeymap: I
|
|
1303
|
+
} = t.autocomplete, P = ((tt = t.lezerHighlight) == null ? void 0 : tt.tags) || ((rt = t.language) == null ? void 0 : rt.tags), Y = l(u.sdkTheme), Pr = Y ? s(w) : n(w), et = [
|
|
1304
|
+
m(),
|
|
1305
|
+
g(),
|
|
1306
|
+
b(),
|
|
1307
|
+
q(),
|
|
1308
|
+
U({
|
|
1309
|
+
openText: "▾",
|
|
1310
|
+
closedText: "▸"
|
|
1311
|
+
}),
|
|
1312
|
+
v(),
|
|
1313
|
+
y(),
|
|
1314
|
+
f.allowMultipleSelections.of(!0),
|
|
1315
|
+
z(),
|
|
1316
|
+
...P ? [Z(o(k, P, Y))] : [],
|
|
1317
|
+
D(),
|
|
1318
|
+
M(),
|
|
1319
|
+
j(),
|
|
1320
|
+
$(),
|
|
1321
|
+
A(),
|
|
1322
|
+
S(),
|
|
1323
|
+
h.of([
|
|
1324
|
+
...x,
|
|
1325
|
+
...C,
|
|
1326
|
+
...R,
|
|
1327
|
+
...J,
|
|
1328
|
+
...I,
|
|
1329
|
+
T
|
|
1330
|
+
]),
|
|
1331
|
+
i(u.language),
|
|
1332
|
+
Pr
|
|
1333
|
+
];
|
|
1334
|
+
u.onChange && et.push(
|
|
1335
|
+
w.updateListener.of((re) => {
|
|
1336
|
+
re.docChanged && u.onChange(re.state.doc.toString());
|
|
1337
|
+
})
|
|
1338
|
+
);
|
|
1339
|
+
const Ir = f.create({
|
|
1340
|
+
doc: u.code || "",
|
|
1341
|
+
extensions: et
|
|
1342
|
+
}), te = new w({
|
|
1343
|
+
state: Ir,
|
|
1344
|
+
parent: p
|
|
1345
|
+
});
|
|
1346
|
+
return {
|
|
1347
|
+
view: te,
|
|
1348
|
+
getCode() {
|
|
1349
|
+
return te.state.doc.toString();
|
|
1350
|
+
},
|
|
1351
|
+
setCode(re) {
|
|
1352
|
+
const at = te.state.doc.toString();
|
|
1353
|
+
at !== re && te.dispatch({
|
|
1354
|
+
changes: { from: 0, to: at.length, insert: re }
|
|
1355
|
+
});
|
|
1356
|
+
},
|
|
1357
|
+
destroy() {
|
|
1358
|
+
te.destroy();
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
function d(p) {
|
|
1363
|
+
r = p;
|
|
1364
|
+
}
|
|
1365
|
+
return {
|
|
1366
|
+
isAvailable: a,
|
|
1367
|
+
create: c,
|
|
1368
|
+
setTheme: d
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
function Ve() {
|
|
1020
1372
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1021
1373
|
}
|
|
1022
|
-
var
|
|
1023
|
-
function
|
|
1024
|
-
|
|
1374
|
+
var Q = Ve();
|
|
1375
|
+
function dr(e) {
|
|
1376
|
+
Q = e;
|
|
1025
1377
|
}
|
|
1026
|
-
var
|
|
1027
|
-
function
|
|
1378
|
+
var le = { exec: () => null };
|
|
1379
|
+
function L(e, t = "") {
|
|
1028
1380
|
let r = typeof e == "string" ? e : e.source, a = { replace: (s, n) => {
|
|
1029
1381
|
let o = typeof n == "string" ? n : n.source;
|
|
1030
|
-
return o = o.replace(
|
|
1382
|
+
return o = o.replace(H.caret, "$1"), r = r.replace(s, o), a;
|
|
1031
1383
|
}, getRegex: () => new RegExp(r, t) };
|
|
1032
1384
|
return a;
|
|
1033
1385
|
}
|
|
1034
|
-
var
|
|
1386
|
+
var ua = (() => {
|
|
1035
1387
|
try {
|
|
1036
1388
|
return !!new RegExp("(?<=1)(?<!1)");
|
|
1037
1389
|
} catch {
|
|
1038
1390
|
return !1;
|
|
1039
1391
|
}
|
|
1040
|
-
})(),
|
|
1041
|
-
]`).replace("lheading",
|
|
1392
|
+
})(), H = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e) => new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}#`), htmlBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i") }, da = /^(?:[ \t]*(?:\n|$))+/, pa = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, fa = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, de = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ha = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Ne = /(?:[*+-]|\d{1,9}[.)])/, pr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, fr = L(pr).replace(/bull/g, Ne).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ga = L(pr).replace(/bull/g, Ne).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Ue = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ma = /^[^\n]+/, Ge = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ba = L(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ge).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), wa = L(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Ne).getRegex(), Re = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", We = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ya = L("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", We).replace("tag", Re).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), hr = L(Ue).replace("hr", de).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Re).getRegex(), va = L(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", hr).getRegex(), Xe = { blockquote: va, code: pa, def: ba, fences: fa, heading: ha, hr: de, html: ya, lheading: fr, list: wa, newline: da, paragraph: hr, table: le, text: ma }, ot = L("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", de).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Re).getRegex(), ka = { ...Xe, lheading: ga, table: ot, paragraph: L(Ue).replace("hr", de).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ot).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Re).getRegex() }, xa = { ...Xe, html: L(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", We).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: le, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: L(Ue).replace("hr", de).replace("heading", ` *#{1,6} *[^
|
|
1393
|
+
]`).replace("lheading", fr).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, $a = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Aa = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, gr = /^( {2,}|\\)\n(?!\s*$)/, Ra = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Se = /[\p{P}\p{S}]/u, Ke = /[\s\p{P}\p{S}]/u, mr = /[^\s\p{P}\p{S}]/u, Sa = L(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Ke).getRegex(), br = /(?!~)[\p{P}\p{S}]/u, za = /(?!~)[\s\p{P}\p{S}]/u, Ca = /(?:[^\s\p{P}\p{S}]|~)/u, La = L(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ua ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), wr = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Ma = L(wr, "u").replace(/punct/g, Se).getRegex(), _a = L(wr, "u").replace(/punct/g, br).getRegex(), yr = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ea = L(yr, "gu").replace(/notPunctSpace/g, mr).replace(/punctSpace/g, Ke).replace(/punct/g, Se).getRegex(), Ta = L(yr, "gu").replace(/notPunctSpace/g, Ca).replace(/punctSpace/g, za).replace(/punct/g, br).getRegex(), Pa = L("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, mr).replace(/punctSpace/g, Ke).replace(/punct/g, Se).getRegex(), Ia = L(/\\(punct)/, "gu").replace(/punct/g, Se).getRegex(), ja = L(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Za = L(We).replace("(?:-->|$)", "-->").getRegex(), qa = L("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Za).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), we = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ha = L(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", we).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), vr = L(/^!?\[(label)\]\[(ref)\]/).replace("label", we).replace("ref", Ge).getRegex(), kr = L(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ge).getRegex(), Da = L("reflink|nolink(?!\\()", "g").replace("reflink", vr).replace("nolink", kr).getRegex(), ct = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Qe = { _backpedal: le, anyPunctuation: Ia, autolink: ja, blockSkip: La, br: gr, code: Aa, del: le, emStrongLDelim: Ma, emStrongRDelimAst: Ea, emStrongRDelimUnd: Pa, escape: $a, link: Ha, nolink: kr, punctuation: Sa, reflink: vr, reflinkSearch: Da, tag: qa, text: Ra, url: le }, Oa = { ...Qe, link: L(/^!?\[(label)\]\((.*?)\)/).replace("label", we).getRegex(), reflink: L(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", we).getRegex() }, _e = { ...Qe, emStrongRDelimAst: Ta, emStrongLDelim: _a, url: L(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ct).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: L(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ct).getRegex() }, Ba = { ..._e, br: L(gr).replace("{2,}", "*").getRegex(), text: L(_e.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, he = { normal: Xe, gfm: ka, pedantic: xa }, se = { normal: Qe, gfm: _e, breaks: Ba, pedantic: Oa }, Fa = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, lt = (e) => Fa[e];
|
|
1042
1394
|
function V(e, t) {
|
|
1043
1395
|
if (t) {
|
|
1044
|
-
if (
|
|
1045
|
-
} else if (
|
|
1396
|
+
if (H.escapeTest.test(e)) return e.replace(H.escapeReplace, lt);
|
|
1397
|
+
} else if (H.escapeTestNoEncode.test(e)) return e.replace(H.escapeReplaceNoEncode, lt);
|
|
1046
1398
|
return e;
|
|
1047
1399
|
}
|
|
1048
|
-
function
|
|
1400
|
+
function ut(e) {
|
|
1049
1401
|
try {
|
|
1050
|
-
e = encodeURI(e).replace(
|
|
1402
|
+
e = encodeURI(e).replace(H.percentDecode, "%");
|
|
1051
1403
|
} catch {
|
|
1052
1404
|
return null;
|
|
1053
1405
|
}
|
|
1054
1406
|
return e;
|
|
1055
1407
|
}
|
|
1056
|
-
function
|
|
1408
|
+
function dt(e, t) {
|
|
1057
1409
|
var n;
|
|
1058
|
-
let r = e.replace(
|
|
1059
|
-
let c = !1,
|
|
1060
|
-
for (; --
|
|
1410
|
+
let r = e.replace(H.findPipe, (o, i, l) => {
|
|
1411
|
+
let c = !1, d = i;
|
|
1412
|
+
for (; --d >= 0 && l[d] === "\\"; ) c = !c;
|
|
1061
1413
|
return c ? "|" : " |";
|
|
1062
|
-
}), a = r.split(
|
|
1414
|
+
}), a = r.split(H.splitPipe), s = 0;
|
|
1063
1415
|
if (a[0].trim() || a.shift(), a.length > 0 && !((n = a.at(-1)) != null && n.trim()) && a.pop(), t) if (a.length > t) a.splice(t);
|
|
1064
1416
|
else for (; a.length < t; ) a.push("");
|
|
1065
|
-
for (; s < a.length; s++) a[s] = a[s].trim().replace(
|
|
1417
|
+
for (; s < a.length; s++) a[s] = a[s].trim().replace(H.slashPipe, "|");
|
|
1066
1418
|
return a;
|
|
1067
1419
|
}
|
|
1068
|
-
function
|
|
1420
|
+
function ne(e, t, r) {
|
|
1069
1421
|
let a = e.length;
|
|
1070
1422
|
if (a === 0) return "";
|
|
1071
1423
|
let s = 0;
|
|
@@ -1073,7 +1425,7 @@ function ee(e, t, r) {
|
|
|
1073
1425
|
s++;
|
|
1074
1426
|
return e.slice(0, a - s);
|
|
1075
1427
|
}
|
|
1076
|
-
function
|
|
1428
|
+
function Va(e, t) {
|
|
1077
1429
|
if (e.indexOf(t[1]) === -1) return -1;
|
|
1078
1430
|
let r = 0;
|
|
1079
1431
|
for (let a = 0; a < e.length; a++) if (e[a] === "\\") a++;
|
|
@@ -1081,13 +1433,13 @@ function Ea(e, t) {
|
|
|
1081
1433
|
else if (e[a] === t[1] && (r--, r < 0)) return a;
|
|
1082
1434
|
return r > 0 ? -2 : -1;
|
|
1083
1435
|
}
|
|
1084
|
-
function
|
|
1436
|
+
function pt(e, t, r, a, s) {
|
|
1085
1437
|
let n = t.href, o = t.title || null, i = e[1].replace(s.other.outputLinkReplace, "$1");
|
|
1086
1438
|
a.state.inLink = !0;
|
|
1087
1439
|
let l = { type: e[0].charAt(0) === "!" ? "image" : "link", raw: r, href: n, title: o, text: i, tokens: a.inlineTokens(i) };
|
|
1088
1440
|
return a.state.inLink = !1, l;
|
|
1089
1441
|
}
|
|
1090
|
-
function
|
|
1442
|
+
function Na(e, t, r) {
|
|
1091
1443
|
let a = e.match(r.other.indentCodeCompensation);
|
|
1092
1444
|
if (a === null) return t;
|
|
1093
1445
|
let s = a[1];
|
|
@@ -1100,12 +1452,12 @@ function Ta(e, t, r) {
|
|
|
1100
1452
|
}).join(`
|
|
1101
1453
|
`);
|
|
1102
1454
|
}
|
|
1103
|
-
var
|
|
1455
|
+
var ye = class {
|
|
1104
1456
|
constructor(e) {
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
this.options = e ||
|
|
1457
|
+
E(this, "options");
|
|
1458
|
+
E(this, "rules");
|
|
1459
|
+
E(this, "lexer");
|
|
1460
|
+
this.options = e || Q;
|
|
1109
1461
|
}
|
|
1110
1462
|
space(e) {
|
|
1111
1463
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -1115,14 +1467,14 @@ var fe = class {
|
|
|
1115
1467
|
let t = this.rules.block.code.exec(e);
|
|
1116
1468
|
if (t) {
|
|
1117
1469
|
let r = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
1118
|
-
return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? r :
|
|
1470
|
+
return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : ne(r, `
|
|
1119
1471
|
`) };
|
|
1120
1472
|
}
|
|
1121
1473
|
}
|
|
1122
1474
|
fences(e) {
|
|
1123
1475
|
let t = this.rules.block.fences.exec(e);
|
|
1124
1476
|
if (t) {
|
|
1125
|
-
let r = t[0], a =
|
|
1477
|
+
let r = t[0], a = Na(r, t[3] || "", this.rules);
|
|
1126
1478
|
return { type: "code", raw: r, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: a };
|
|
1127
1479
|
}
|
|
1128
1480
|
}
|
|
@@ -1131,7 +1483,7 @@ var fe = class {
|
|
|
1131
1483
|
if (t) {
|
|
1132
1484
|
let r = t[2].trim();
|
|
1133
1485
|
if (this.rules.other.endingHash.test(r)) {
|
|
1134
|
-
let a =
|
|
1486
|
+
let a = ne(r, "#");
|
|
1135
1487
|
(this.options.pedantic || !a || this.rules.other.endingSpaceChar.test(a)) && (r = a.trim());
|
|
1136
1488
|
}
|
|
1137
1489
|
return { type: "heading", raw: t[0], depth: t[1].length, text: r, tokens: this.lexer.inline(r) };
|
|
@@ -1139,13 +1491,13 @@ var fe = class {
|
|
|
1139
1491
|
}
|
|
1140
1492
|
hr(e) {
|
|
1141
1493
|
let t = this.rules.block.hr.exec(e);
|
|
1142
|
-
if (t) return { type: "hr", raw:
|
|
1494
|
+
if (t) return { type: "hr", raw: ne(t[0], `
|
|
1143
1495
|
`) };
|
|
1144
1496
|
}
|
|
1145
1497
|
blockquote(e) {
|
|
1146
1498
|
let t = this.rules.block.blockquote.exec(e);
|
|
1147
1499
|
if (t) {
|
|
1148
|
-
let r =
|
|
1500
|
+
let r = ne(t[0], `
|
|
1149
1501
|
`).split(`
|
|
1150
1502
|
`), a = "", s = "", n = [];
|
|
1151
1503
|
for (; r.length > 0; ) {
|
|
@@ -1155,26 +1507,26 @@ var fe = class {
|
|
|
1155
1507
|
else break;
|
|
1156
1508
|
r = r.slice(l);
|
|
1157
1509
|
let c = i.join(`
|
|
1158
|
-
`),
|
|
1510
|
+
`), d = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1159
1511
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1160
1512
|
a = a ? `${a}
|
|
1161
1513
|
${c}` : c, s = s ? `${s}
|
|
1162
|
-
${
|
|
1514
|
+
${d}` : d;
|
|
1163
1515
|
let p = this.lexer.state.top;
|
|
1164
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
1165
|
-
let
|
|
1166
|
-
if ((
|
|
1167
|
-
if ((
|
|
1168
|
-
let
|
|
1516
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(d, n, !0), this.lexer.state.top = p, r.length === 0) break;
|
|
1517
|
+
let u = n.at(-1);
|
|
1518
|
+
if ((u == null ? void 0 : u.type) === "code") break;
|
|
1519
|
+
if ((u == null ? void 0 : u.type) === "blockquote") {
|
|
1520
|
+
let f = u, w = f.raw + `
|
|
1169
1521
|
` + r.join(`
|
|
1170
|
-
`),
|
|
1171
|
-
n[n.length - 1] =
|
|
1522
|
+
`), h = this.blockquote(w);
|
|
1523
|
+
n[n.length - 1] = h, a = a.substring(0, a.length - f.raw.length) + h.raw, s = s.substring(0, s.length - f.text.length) + h.text;
|
|
1172
1524
|
break;
|
|
1173
|
-
} else if ((
|
|
1174
|
-
let
|
|
1525
|
+
} else if ((u == null ? void 0 : u.type) === "list") {
|
|
1526
|
+
let f = u, w = f.raw + `
|
|
1175
1527
|
` + r.join(`
|
|
1176
|
-
`),
|
|
1177
|
-
n[n.length - 1] =
|
|
1528
|
+
`), h = this.list(w);
|
|
1529
|
+
n[n.length - 1] = h, a = a.substring(0, a.length - u.raw.length) + h.raw, s = s.substring(0, s.length - f.raw.length) + h.raw, r = w.substring(n.at(-1).raw.length).split(`
|
|
1178
1530
|
`);
|
|
1179
1531
|
continue;
|
|
1180
1532
|
}
|
|
@@ -1190,59 +1542,59 @@ ${u}` : u;
|
|
|
1190
1542
|
s = n ? `\\d{1,9}\\${s.slice(-1)}` : `\\${s}`, this.options.pedantic && (s = n ? s : "[*+-]");
|
|
1191
1543
|
let i = this.rules.other.listItemRegex(s), l = !1;
|
|
1192
1544
|
for (; e; ) {
|
|
1193
|
-
let
|
|
1545
|
+
let d = !1, p = "", u = "";
|
|
1194
1546
|
if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
1195
1547
|
p = t[0], e = e.substring(p.length);
|
|
1196
|
-
let
|
|
1197
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
1198
|
-
`, 1)[0],
|
|
1199
|
-
if (this.options.pedantic ? (
|
|
1200
|
-
`, e = e.substring(w.length + 1),
|
|
1201
|
-
let
|
|
1548
|
+
let f = t[2].split(`
|
|
1549
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (g) => " ".repeat(3 * g.length)), w = e.split(`
|
|
1550
|
+
`, 1)[0], h = !f.trim(), m = 0;
|
|
1551
|
+
if (this.options.pedantic ? (m = 2, u = f.trimStart()) : h ? m = t[1].length + 1 : (m = t[2].search(this.rules.other.nonSpaceChar), m = m > 4 ? 1 : m, u = f.slice(m), m += t[1].length), h && this.rules.other.blankLine.test(w) && (p += w + `
|
|
1552
|
+
`, e = e.substring(w.length + 1), d = !0), !d) {
|
|
1553
|
+
let g = this.rules.other.nextBulletRegex(m), b = this.rules.other.hrRegex(m), v = this.rules.other.fencesBeginRegex(m), y = this.rules.other.headingBeginRegex(m), $ = this.rules.other.htmlBeginRegex(m);
|
|
1202
1554
|
for (; e; ) {
|
|
1203
|
-
let
|
|
1555
|
+
let A = e.split(`
|
|
1204
1556
|
`, 1)[0], S;
|
|
1205
|
-
if (w =
|
|
1206
|
-
if (S.search(this.rules.other.nonSpaceChar) >=
|
|
1207
|
-
` + S.slice(
|
|
1557
|
+
if (w = A, this.options.pedantic ? (w = w.replace(this.rules.other.listReplaceNesting, " "), S = w) : S = w.replace(this.rules.other.tabCharGlobal, " "), v.test(w) || y.test(w) || $.test(w) || g.test(w) || b.test(w)) break;
|
|
1558
|
+
if (S.search(this.rules.other.nonSpaceChar) >= m || !w.trim()) u += `
|
|
1559
|
+
` + S.slice(m);
|
|
1208
1560
|
else {
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
1561
|
+
if (h || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(f) || y.test(f) || b.test(f)) break;
|
|
1562
|
+
u += `
|
|
1211
1563
|
` + w;
|
|
1212
1564
|
}
|
|
1213
|
-
!
|
|
1214
|
-
`, e = e.substring(
|
|
1565
|
+
!h && !w.trim() && (h = !0), p += A + `
|
|
1566
|
+
`, e = e.substring(A.length + 1), f = S.slice(m);
|
|
1215
1567
|
}
|
|
1216
1568
|
}
|
|
1217
|
-
o.loose || (l ? o.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (l = !0)), o.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(
|
|
1569
|
+
o.loose || (l ? o.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (l = !0)), o.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(u), loose: !1, text: u, tokens: [] }), o.raw += p;
|
|
1218
1570
|
}
|
|
1219
1571
|
let c = o.items.at(-1);
|
|
1220
1572
|
if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
|
|
1221
1573
|
else return;
|
|
1222
1574
|
o.raw = o.raw.trimEnd();
|
|
1223
|
-
for (let
|
|
1224
|
-
if (this.lexer.state.top = !1,
|
|
1225
|
-
if (
|
|
1226
|
-
|
|
1227
|
-
for (let
|
|
1228
|
-
this.lexer.inlineQueue[
|
|
1575
|
+
for (let d of o.items) {
|
|
1576
|
+
if (this.lexer.state.top = !1, d.tokens = this.lexer.blockTokens(d.text, []), d.task) {
|
|
1577
|
+
if (d.text = d.text.replace(this.rules.other.listReplaceTask, ""), ((r = d.tokens[0]) == null ? void 0 : r.type) === "text" || ((a = d.tokens[0]) == null ? void 0 : a.type) === "paragraph") {
|
|
1578
|
+
d.tokens[0].raw = d.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), d.tokens[0].text = d.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
1579
|
+
for (let u = this.lexer.inlineQueue.length - 1; u >= 0; u--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)) {
|
|
1580
|
+
this.lexer.inlineQueue[u].src = this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask, "");
|
|
1229
1581
|
break;
|
|
1230
1582
|
}
|
|
1231
1583
|
}
|
|
1232
|
-
let p = this.rules.other.listTaskCheckbox.exec(
|
|
1584
|
+
let p = this.rules.other.listTaskCheckbox.exec(d.raw);
|
|
1233
1585
|
if (p) {
|
|
1234
|
-
let
|
|
1235
|
-
|
|
1586
|
+
let u = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
1587
|
+
d.checked = u.checked, o.loose ? d.tokens[0] && ["paragraph", "text"].includes(d.tokens[0].type) && "tokens" in d.tokens[0] && d.tokens[0].tokens ? (d.tokens[0].raw = u.raw + d.tokens[0].raw, d.tokens[0].text = u.raw + d.tokens[0].text, d.tokens[0].tokens.unshift(u)) : d.tokens.unshift({ type: "paragraph", raw: u.raw, text: u.raw, tokens: [u] }) : d.tokens.unshift(u);
|
|
1236
1588
|
}
|
|
1237
1589
|
}
|
|
1238
1590
|
if (!o.loose) {
|
|
1239
|
-
let p =
|
|
1240
|
-
o.loose =
|
|
1591
|
+
let p = d.tokens.filter((f) => f.type === "space"), u = p.length > 0 && p.some((f) => this.rules.other.anyLine.test(f.raw));
|
|
1592
|
+
o.loose = u;
|
|
1241
1593
|
}
|
|
1242
1594
|
}
|
|
1243
|
-
if (o.loose) for (let
|
|
1244
|
-
|
|
1245
|
-
for (let p of
|
|
1595
|
+
if (o.loose) for (let d of o.items) {
|
|
1596
|
+
d.loose = !0;
|
|
1597
|
+
for (let p of d.tokens) p.type === "text" && (p.type = "paragraph");
|
|
1246
1598
|
}
|
|
1247
1599
|
return o;
|
|
1248
1600
|
}
|
|
@@ -1262,12 +1614,12 @@ ${u}` : u;
|
|
|
1262
1614
|
var o;
|
|
1263
1615
|
let t = this.rules.block.table.exec(e);
|
|
1264
1616
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
1265
|
-
let r =
|
|
1617
|
+
let r = dt(t[1]), a = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = (o = t[3]) != null && o.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1266
1618
|
`) : [], n = { type: "table", raw: t[0], header: [], align: [], rows: [] };
|
|
1267
1619
|
if (r.length === a.length) {
|
|
1268
1620
|
for (let i of a) this.rules.other.tableAlignRight.test(i) ? n.align.push("right") : this.rules.other.tableAlignCenter.test(i) ? n.align.push("center") : this.rules.other.tableAlignLeft.test(i) ? n.align.push("left") : n.align.push(null);
|
|
1269
1621
|
for (let i = 0; i < r.length; i++) n.header.push({ text: r[i], tokens: this.lexer.inline(r[i]), header: !0, align: n.align[i] });
|
|
1270
|
-
for (let i of s) n.rows.push(
|
|
1622
|
+
for (let i of s) n.rows.push(dt(i, n.header.length).map((l, c) => ({ text: l, tokens: this.lexer.inline(l), header: !1, align: n.align[c] })));
|
|
1271
1623
|
return n;
|
|
1272
1624
|
}
|
|
1273
1625
|
}
|
|
@@ -1301,10 +1653,10 @@ ${u}` : u;
|
|
|
1301
1653
|
let r = t[2].trim();
|
|
1302
1654
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
|
|
1303
1655
|
if (!this.rules.other.endAngleBracket.test(r)) return;
|
|
1304
|
-
let n =
|
|
1656
|
+
let n = ne(r.slice(0, -1), "\\");
|
|
1305
1657
|
if ((r.length - n.length) % 2 === 0) return;
|
|
1306
1658
|
} else {
|
|
1307
|
-
let n =
|
|
1659
|
+
let n = Va(t[2], "()");
|
|
1308
1660
|
if (n === -2) return;
|
|
1309
1661
|
if (n > -1) {
|
|
1310
1662
|
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + n;
|
|
@@ -1316,7 +1668,7 @@ ${u}` : u;
|
|
|
1316
1668
|
let n = this.rules.other.pedanticHrefTitle.exec(a);
|
|
1317
1669
|
n && (a = n[1], s = n[3]);
|
|
1318
1670
|
} else s = t[3] ? t[3].slice(1, -1) : "";
|
|
1319
|
-
return a = a.trim(), this.rules.other.startAngleBracket.test(a) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? a = a.slice(1) : a = a.slice(1, -1)),
|
|
1671
|
+
return a = a.trim(), this.rules.other.startAngleBracket.test(a) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? a = a.slice(1) : a = a.slice(1, -1)), pt(t, { href: a && a.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
1320
1672
|
}
|
|
1321
1673
|
}
|
|
1322
1674
|
reflink(e, t) {
|
|
@@ -1327,7 +1679,7 @@ ${u}` : u;
|
|
|
1327
1679
|
let n = r[0].charAt(0);
|
|
1328
1680
|
return { type: "text", raw: n, text: n };
|
|
1329
1681
|
}
|
|
1330
|
-
return
|
|
1682
|
+
return pt(r, s, r[0], this.lexer, this.rules);
|
|
1331
1683
|
}
|
|
1332
1684
|
}
|
|
1333
1685
|
emStrong(e, t, r = "") {
|
|
@@ -1345,13 +1697,13 @@ ${u}` : u;
|
|
|
1345
1697
|
}
|
|
1346
1698
|
if (i -= o, i > 0) continue;
|
|
1347
1699
|
o = Math.min(o, o + i + l);
|
|
1348
|
-
let
|
|
1700
|
+
let d = [...a[0]][0].length, p = e.slice(0, s + a.index + d + o);
|
|
1349
1701
|
if (Math.min(s, o) % 2) {
|
|
1350
|
-
let
|
|
1351
|
-
return { type: "em", raw: p, text:
|
|
1702
|
+
let f = p.slice(1, -1);
|
|
1703
|
+
return { type: "em", raw: p, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
1352
1704
|
}
|
|
1353
|
-
let
|
|
1354
|
-
return { type: "strong", raw: p, text:
|
|
1705
|
+
let u = p.slice(2, -2);
|
|
1706
|
+
return { type: "strong", raw: p, text: u, tokens: this.lexer.inlineTokens(u) };
|
|
1355
1707
|
}
|
|
1356
1708
|
}
|
|
1357
1709
|
}
|
|
@@ -1400,28 +1752,28 @@ ${u}` : u;
|
|
|
1400
1752
|
return { type: "text", raw: t[0], text: t[0], escaped: r };
|
|
1401
1753
|
}
|
|
1402
1754
|
}
|
|
1403
|
-
},
|
|
1755
|
+
}, B = class Ee {
|
|
1404
1756
|
constructor(t) {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t ||
|
|
1411
|
-
let r = { other:
|
|
1412
|
-
this.options.pedantic ? (r.block =
|
|
1757
|
+
E(this, "tokens");
|
|
1758
|
+
E(this, "options");
|
|
1759
|
+
E(this, "state");
|
|
1760
|
+
E(this, "inlineQueue");
|
|
1761
|
+
E(this, "tokenizer");
|
|
1762
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Q, this.options.tokenizer = this.options.tokenizer || new ye(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1763
|
+
let r = { other: H, block: he.normal, inline: se.normal };
|
|
1764
|
+
this.options.pedantic ? (r.block = he.pedantic, r.inline = se.pedantic) : this.options.gfm && (r.block = he.gfm, this.options.breaks ? r.inline = se.breaks : r.inline = se.gfm), this.tokenizer.rules = r;
|
|
1413
1765
|
}
|
|
1414
1766
|
static get rules() {
|
|
1415
|
-
return { block:
|
|
1767
|
+
return { block: he, inline: se };
|
|
1416
1768
|
}
|
|
1417
1769
|
static lex(t, r) {
|
|
1418
|
-
return new
|
|
1770
|
+
return new Ee(r).lex(t);
|
|
1419
1771
|
}
|
|
1420
1772
|
static lexInline(t, r) {
|
|
1421
|
-
return new
|
|
1773
|
+
return new Ee(r).inlineTokens(t);
|
|
1422
1774
|
}
|
|
1423
1775
|
lex(t) {
|
|
1424
|
-
t = t.replace(
|
|
1776
|
+
t = t.replace(H.carriageReturn, `
|
|
1425
1777
|
`), this.blockTokens(t, this.tokens);
|
|
1426
1778
|
for (let r = 0; r < this.inlineQueue.length; r++) {
|
|
1427
1779
|
let a = this.inlineQueue[r];
|
|
@@ -1431,7 +1783,7 @@ ${u}` : u;
|
|
|
1431
1783
|
}
|
|
1432
1784
|
blockTokens(t, r = [], a = !1) {
|
|
1433
1785
|
var s, n, o;
|
|
1434
|
-
for (this.options.pedantic && (t = t.replace(
|
|
1786
|
+
for (this.options.pedantic && (t = t.replace(H.tabCharGlobal, " ").replace(H.spaceLine, "")); t; ) {
|
|
1435
1787
|
let i;
|
|
1436
1788
|
if ((n = (s = this.options.extensions) == null ? void 0 : s.block) != null && n.some((c) => (i = c.call({ lexer: this }, t, r)) ? (t = t.substring(i.raw.length), r.push(i), !0) : !1)) continue;
|
|
1437
1789
|
if (i = this.tokenizer.space(t)) {
|
|
@@ -1493,9 +1845,9 @@ ${u}` : u;
|
|
|
1493
1845
|
}
|
|
1494
1846
|
let l = t;
|
|
1495
1847
|
if ((o = this.options.extensions) != null && o.startBlock) {
|
|
1496
|
-
let c = 1 / 0,
|
|
1497
|
-
this.options.extensions.startBlock.forEach((
|
|
1498
|
-
p =
|
|
1848
|
+
let c = 1 / 0, d = t.slice(1), p;
|
|
1849
|
+
this.options.extensions.startBlock.forEach((u) => {
|
|
1850
|
+
p = u.call({ lexer: this }, d), typeof p == "number" && p >= 0 && (c = Math.min(c, p));
|
|
1499
1851
|
}), c < 1 / 0 && c >= 0 && (l = t.substring(0, c + 1));
|
|
1500
1852
|
}
|
|
1501
1853
|
if (this.state.top && (i = this.tokenizer.paragraph(l))) {
|
|
@@ -1529,11 +1881,11 @@ ${u}` : u;
|
|
|
1529
1881
|
return this.inlineQueue.push({ src: t, tokens: r }), r;
|
|
1530
1882
|
}
|
|
1531
1883
|
inlineTokens(t, r = []) {
|
|
1532
|
-
var l, c,
|
|
1884
|
+
var l, c, d, p, u;
|
|
1533
1885
|
let a = t, s = null;
|
|
1534
1886
|
if (this.tokens.links) {
|
|
1535
|
-
let
|
|
1536
|
-
if (
|
|
1887
|
+
let f = Object.keys(this.tokens.links);
|
|
1888
|
+
if (f.length > 0) for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(a)) != null; ) f.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (a = a.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
1537
1889
|
}
|
|
1538
1890
|
for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(a)) != null; ) a = a.slice(0, s.index) + "++" + a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1539
1891
|
let n;
|
|
@@ -1542,85 +1894,85 @@ ${u}` : u;
|
|
|
1542
1894
|
let o = !1, i = "";
|
|
1543
1895
|
for (; t; ) {
|
|
1544
1896
|
o || (i = ""), o = !1;
|
|
1545
|
-
let
|
|
1546
|
-
if ((p = (
|
|
1547
|
-
if (
|
|
1548
|
-
t = t.substring(
|
|
1897
|
+
let f;
|
|
1898
|
+
if ((p = (d = this.options.extensions) == null ? void 0 : d.inline) != null && p.some((h) => (f = h.call({ lexer: this }, t, r)) ? (t = t.substring(f.raw.length), r.push(f), !0) : !1)) continue;
|
|
1899
|
+
if (f = this.tokenizer.escape(t)) {
|
|
1900
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1549
1901
|
continue;
|
|
1550
1902
|
}
|
|
1551
|
-
if (
|
|
1552
|
-
t = t.substring(
|
|
1903
|
+
if (f = this.tokenizer.tag(t)) {
|
|
1904
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1553
1905
|
continue;
|
|
1554
1906
|
}
|
|
1555
|
-
if (
|
|
1556
|
-
t = t.substring(
|
|
1907
|
+
if (f = this.tokenizer.link(t)) {
|
|
1908
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1557
1909
|
continue;
|
|
1558
1910
|
}
|
|
1559
|
-
if (
|
|
1560
|
-
t = t.substring(
|
|
1561
|
-
let
|
|
1562
|
-
|
|
1911
|
+
if (f = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
1912
|
+
t = t.substring(f.raw.length);
|
|
1913
|
+
let h = r.at(-1);
|
|
1914
|
+
f.type === "text" && (h == null ? void 0 : h.type) === "text" ? (h.raw += f.raw, h.text += f.text) : r.push(f);
|
|
1563
1915
|
continue;
|
|
1564
1916
|
}
|
|
1565
|
-
if (
|
|
1566
|
-
t = t.substring(
|
|
1917
|
+
if (f = this.tokenizer.emStrong(t, a, i)) {
|
|
1918
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1567
1919
|
continue;
|
|
1568
1920
|
}
|
|
1569
|
-
if (
|
|
1570
|
-
t = t.substring(
|
|
1921
|
+
if (f = this.tokenizer.codespan(t)) {
|
|
1922
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1571
1923
|
continue;
|
|
1572
1924
|
}
|
|
1573
|
-
if (
|
|
1574
|
-
t = t.substring(
|
|
1925
|
+
if (f = this.tokenizer.br(t)) {
|
|
1926
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1575
1927
|
continue;
|
|
1576
1928
|
}
|
|
1577
|
-
if (
|
|
1578
|
-
t = t.substring(
|
|
1929
|
+
if (f = this.tokenizer.del(t)) {
|
|
1930
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1579
1931
|
continue;
|
|
1580
1932
|
}
|
|
1581
|
-
if (
|
|
1582
|
-
t = t.substring(
|
|
1933
|
+
if (f = this.tokenizer.autolink(t)) {
|
|
1934
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1583
1935
|
continue;
|
|
1584
1936
|
}
|
|
1585
|
-
if (!this.state.inLink && (
|
|
1586
|
-
t = t.substring(
|
|
1937
|
+
if (!this.state.inLink && (f = this.tokenizer.url(t))) {
|
|
1938
|
+
t = t.substring(f.raw.length), r.push(f);
|
|
1587
1939
|
continue;
|
|
1588
1940
|
}
|
|
1589
1941
|
let w = t;
|
|
1590
|
-
if ((
|
|
1591
|
-
let
|
|
1592
|
-
this.options.extensions.startInline.forEach((
|
|
1593
|
-
|
|
1594
|
-
}),
|
|
1942
|
+
if ((u = this.options.extensions) != null && u.startInline) {
|
|
1943
|
+
let h = 1 / 0, m = t.slice(1), g;
|
|
1944
|
+
this.options.extensions.startInline.forEach((b) => {
|
|
1945
|
+
g = b.call({ lexer: this }, m), typeof g == "number" && g >= 0 && (h = Math.min(h, g));
|
|
1946
|
+
}), h < 1 / 0 && h >= 0 && (w = t.substring(0, h + 1));
|
|
1595
1947
|
}
|
|
1596
|
-
if (
|
|
1597
|
-
t = t.substring(
|
|
1598
|
-
let
|
|
1599
|
-
(
|
|
1948
|
+
if (f = this.tokenizer.inlineText(w)) {
|
|
1949
|
+
t = t.substring(f.raw.length), f.raw.slice(-1) !== "_" && (i = f.raw.slice(-1)), o = !0;
|
|
1950
|
+
let h = r.at(-1);
|
|
1951
|
+
(h == null ? void 0 : h.type) === "text" ? (h.raw += f.raw, h.text += f.text) : r.push(f);
|
|
1600
1952
|
continue;
|
|
1601
1953
|
}
|
|
1602
1954
|
if (t) {
|
|
1603
|
-
let
|
|
1955
|
+
let h = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
1604
1956
|
if (this.options.silent) {
|
|
1605
|
-
console.error(
|
|
1957
|
+
console.error(h);
|
|
1606
1958
|
break;
|
|
1607
|
-
} else throw new Error(
|
|
1959
|
+
} else throw new Error(h);
|
|
1608
1960
|
}
|
|
1609
1961
|
}
|
|
1610
1962
|
return r;
|
|
1611
1963
|
}
|
|
1612
|
-
},
|
|
1964
|
+
}, ve = class {
|
|
1613
1965
|
constructor(e) {
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
this.options = e ||
|
|
1966
|
+
E(this, "options");
|
|
1967
|
+
E(this, "parser");
|
|
1968
|
+
this.options = e || Q;
|
|
1617
1969
|
}
|
|
1618
1970
|
space(e) {
|
|
1619
1971
|
return "";
|
|
1620
1972
|
}
|
|
1621
1973
|
code({ text: e, lang: t, escaped: r }) {
|
|
1622
1974
|
var n;
|
|
1623
|
-
let a = (n = (t || "").match(
|
|
1975
|
+
let a = (n = (t || "").match(H.notSpaceStart)) == null ? void 0 : n[0], s = e.replace(H.endingNewline, "") + `
|
|
1624
1976
|
`;
|
|
1625
1977
|
return a ? '<pre><code class="language-' + V(a) + '">' + (r ? s : V(s, !0)) + `</code></pre>
|
|
1626
1978
|
` : "<pre><code>" + (r ? s : V(s, !0)) + `</code></pre>
|
|
@@ -1710,7 +2062,7 @@ ${e}</tr>
|
|
|
1710
2062
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1711
2063
|
}
|
|
1712
2064
|
link({ href: e, title: t, tokens: r }) {
|
|
1713
|
-
let a = this.parser.parseInline(r), s =
|
|
2065
|
+
let a = this.parser.parseInline(r), s = ut(e);
|
|
1714
2066
|
if (s === null) return a;
|
|
1715
2067
|
e = s;
|
|
1716
2068
|
let n = '<a href="' + e + '"';
|
|
@@ -1718,7 +2070,7 @@ ${e}</tr>
|
|
|
1718
2070
|
}
|
|
1719
2071
|
image({ href: e, title: t, text: r, tokens: a }) {
|
|
1720
2072
|
a && (r = this.parser.parseInline(a, this.parser.textRenderer));
|
|
1721
|
-
let s =
|
|
2073
|
+
let s = ut(e);
|
|
1722
2074
|
if (s === null) return V(r);
|
|
1723
2075
|
e = s;
|
|
1724
2076
|
let n = `<img src="${e}" alt="${r}"`;
|
|
@@ -1727,7 +2079,7 @@ ${e}</tr>
|
|
|
1727
2079
|
text(e) {
|
|
1728
2080
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : V(e.text);
|
|
1729
2081
|
}
|
|
1730
|
-
},
|
|
2082
|
+
}, Je = class {
|
|
1731
2083
|
strong({ text: e }) {
|
|
1732
2084
|
return e;
|
|
1733
2085
|
}
|
|
@@ -1758,18 +2110,18 @@ ${e}</tr>
|
|
|
1758
2110
|
checkbox({ raw: e }) {
|
|
1759
2111
|
return e;
|
|
1760
2112
|
}
|
|
1761
|
-
},
|
|
2113
|
+
}, F = class Te {
|
|
1762
2114
|
constructor(t) {
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
this.options = t ||
|
|
2115
|
+
E(this, "options");
|
|
2116
|
+
E(this, "renderer");
|
|
2117
|
+
E(this, "textRenderer");
|
|
2118
|
+
this.options = t || Q, this.options.renderer = this.options.renderer || new ve(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Je();
|
|
1767
2119
|
}
|
|
1768
2120
|
static parse(t, r) {
|
|
1769
|
-
return new
|
|
2121
|
+
return new Te(r).parse(t);
|
|
1770
2122
|
}
|
|
1771
2123
|
static parseInline(t, r) {
|
|
1772
|
-
return new
|
|
2124
|
+
return new Te(r).parseInline(t);
|
|
1773
2125
|
}
|
|
1774
2126
|
parse(t) {
|
|
1775
2127
|
var a, s;
|
|
@@ -1909,11 +2261,11 @@ ${e}</tr>
|
|
|
1909
2261
|
}
|
|
1910
2262
|
return a;
|
|
1911
2263
|
}
|
|
1912
|
-
},
|
|
2264
|
+
}, me, oe = (me = class {
|
|
1913
2265
|
constructor(e) {
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
this.options = e ||
|
|
2266
|
+
E(this, "options");
|
|
2267
|
+
E(this, "block");
|
|
2268
|
+
this.options = e || Q;
|
|
1917
2269
|
}
|
|
1918
2270
|
preprocess(e) {
|
|
1919
2271
|
return e;
|
|
@@ -1928,23 +2280,23 @@ ${e}</tr>
|
|
|
1928
2280
|
return e;
|
|
1929
2281
|
}
|
|
1930
2282
|
provideLexer() {
|
|
1931
|
-
return this.block ?
|
|
2283
|
+
return this.block ? B.lex : B.lexInline;
|
|
1932
2284
|
}
|
|
1933
2285
|
provideParser() {
|
|
1934
|
-
return this.block ?
|
|
2286
|
+
return this.block ? F.parse : F.parseInline;
|
|
1935
2287
|
}
|
|
1936
|
-
},
|
|
2288
|
+
}, E(me, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), E(me, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), me), Ua = class {
|
|
1937
2289
|
constructor(...e) {
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
2290
|
+
E(this, "defaults", Ve());
|
|
2291
|
+
E(this, "options", this.setOptions);
|
|
2292
|
+
E(this, "parse", this.parseMarkdown(!0));
|
|
2293
|
+
E(this, "parseInline", this.parseMarkdown(!1));
|
|
2294
|
+
E(this, "Parser", F);
|
|
2295
|
+
E(this, "Renderer", ve);
|
|
2296
|
+
E(this, "TextRenderer", Je);
|
|
2297
|
+
E(this, "Lexer", B);
|
|
2298
|
+
E(this, "Tokenizer", ye);
|
|
2299
|
+
E(this, "Hooks", oe);
|
|
1948
2300
|
this.use(...e);
|
|
1949
2301
|
}
|
|
1950
2302
|
walkTokens(e, t) {
|
|
@@ -1992,51 +2344,51 @@ ${e}</tr>
|
|
|
1992
2344
|
}
|
|
1993
2345
|
"childTokens" in s && s.childTokens && (t.childTokens[s.name] = s.childTokens);
|
|
1994
2346
|
}), a.extensions = t), r.renderer) {
|
|
1995
|
-
let s = this.defaults.renderer || new
|
|
2347
|
+
let s = this.defaults.renderer || new ve(this.defaults);
|
|
1996
2348
|
for (let n in r.renderer) {
|
|
1997
2349
|
if (!(n in s)) throw new Error(`renderer '${n}' does not exist`);
|
|
1998
2350
|
if (["options", "parser"].includes(n)) continue;
|
|
1999
2351
|
let o = n, i = r.renderer[o], l = s[o];
|
|
2000
2352
|
s[o] = (...c) => {
|
|
2001
|
-
let
|
|
2002
|
-
return
|
|
2353
|
+
let d = i.apply(s, c);
|
|
2354
|
+
return d === !1 && (d = l.apply(s, c)), d || "";
|
|
2003
2355
|
};
|
|
2004
2356
|
}
|
|
2005
2357
|
a.renderer = s;
|
|
2006
2358
|
}
|
|
2007
2359
|
if (r.tokenizer) {
|
|
2008
|
-
let s = this.defaults.tokenizer || new
|
|
2360
|
+
let s = this.defaults.tokenizer || new ye(this.defaults);
|
|
2009
2361
|
for (let n in r.tokenizer) {
|
|
2010
2362
|
if (!(n in s)) throw new Error(`tokenizer '${n}' does not exist`);
|
|
2011
2363
|
if (["options", "rules", "lexer"].includes(n)) continue;
|
|
2012
2364
|
let o = n, i = r.tokenizer[o], l = s[o];
|
|
2013
2365
|
s[o] = (...c) => {
|
|
2014
|
-
let
|
|
2015
|
-
return
|
|
2366
|
+
let d = i.apply(s, c);
|
|
2367
|
+
return d === !1 && (d = l.apply(s, c)), d;
|
|
2016
2368
|
};
|
|
2017
2369
|
}
|
|
2018
2370
|
a.tokenizer = s;
|
|
2019
2371
|
}
|
|
2020
2372
|
if (r.hooks) {
|
|
2021
|
-
let s = this.defaults.hooks || new
|
|
2373
|
+
let s = this.defaults.hooks || new oe();
|
|
2022
2374
|
for (let n in r.hooks) {
|
|
2023
2375
|
if (!(n in s)) throw new Error(`hook '${n}' does not exist`);
|
|
2024
2376
|
if (["options", "block"].includes(n)) continue;
|
|
2025
2377
|
let o = n, i = r.hooks[o], l = s[o];
|
|
2026
|
-
|
|
2027
|
-
if (this.defaults.async &&
|
|
2378
|
+
oe.passThroughHooks.has(n) ? s[o] = (c) => {
|
|
2379
|
+
if (this.defaults.async && oe.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
2028
2380
|
let p = await i.call(s, c);
|
|
2029
2381
|
return l.call(s, p);
|
|
2030
2382
|
})();
|
|
2031
|
-
let
|
|
2032
|
-
return l.call(s,
|
|
2383
|
+
let d = i.call(s, c);
|
|
2384
|
+
return l.call(s, d);
|
|
2033
2385
|
} : s[o] = (...c) => {
|
|
2034
2386
|
if (this.defaults.async) return (async () => {
|
|
2035
2387
|
let p = await i.apply(s, c);
|
|
2036
2388
|
return p === !1 && (p = await l.apply(s, c)), p;
|
|
2037
2389
|
})();
|
|
2038
|
-
let
|
|
2039
|
-
return
|
|
2390
|
+
let d = i.apply(s, c);
|
|
2391
|
+
return d === !1 && (d = l.apply(s, c)), d;
|
|
2040
2392
|
};
|
|
2041
2393
|
}
|
|
2042
2394
|
a.hooks = s;
|
|
@@ -2055,10 +2407,10 @@ ${e}</tr>
|
|
|
2055
2407
|
return this.defaults = { ...this.defaults, ...e }, this;
|
|
2056
2408
|
}
|
|
2057
2409
|
lexer(e, t) {
|
|
2058
|
-
return
|
|
2410
|
+
return B.lex(e, t ?? this.defaults);
|
|
2059
2411
|
}
|
|
2060
2412
|
parser(e, t) {
|
|
2061
|
-
return
|
|
2413
|
+
return F.parse(e, t ?? this.defaults);
|
|
2062
2414
|
}
|
|
2063
2415
|
parseMarkdown(e) {
|
|
2064
2416
|
return (t, r) => {
|
|
@@ -2067,16 +2419,16 @@ ${e}</tr>
|
|
|
2067
2419
|
if (typeof t > "u" || t === null) return n(new Error("marked(): input parameter is undefined or null"));
|
|
2068
2420
|
if (typeof t != "string") return n(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
2069
2421
|
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
2070
|
-
let o = s.hooks ? await s.hooks.preprocess(t) : t, i = await (s.hooks ? await s.hooks.provideLexer() : e ?
|
|
2422
|
+
let o = s.hooks ? await s.hooks.preprocess(t) : t, i = await (s.hooks ? await s.hooks.provideLexer() : e ? B.lex : B.lexInline)(o, s), l = s.hooks ? await s.hooks.processAllTokens(i) : i;
|
|
2071
2423
|
s.walkTokens && await Promise.all(this.walkTokens(l, s.walkTokens));
|
|
2072
|
-
let c = await (s.hooks ? await s.hooks.provideParser() : e ?
|
|
2424
|
+
let c = await (s.hooks ? await s.hooks.provideParser() : e ? F.parse : F.parseInline)(l, s);
|
|
2073
2425
|
return s.hooks ? await s.hooks.postprocess(c) : c;
|
|
2074
2426
|
})().catch(n);
|
|
2075
2427
|
try {
|
|
2076
2428
|
s.hooks && (t = s.hooks.preprocess(t));
|
|
2077
|
-
let o = (s.hooks ? s.hooks.provideLexer() : e ?
|
|
2429
|
+
let o = (s.hooks ? s.hooks.provideLexer() : e ? B.lex : B.lexInline)(t, s);
|
|
2078
2430
|
s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
|
|
2079
|
-
let i = (s.hooks ? s.hooks.provideParser() : e ?
|
|
2431
|
+
let i = (s.hooks ? s.hooks.provideParser() : e ? F.parse : F.parseInline)(o, s);
|
|
2080
2432
|
return s.hooks && (i = s.hooks.postprocess(i)), i;
|
|
2081
2433
|
} catch (o) {
|
|
2082
2434
|
return n(o);
|
|
@@ -2094,40 +2446,40 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
2094
2446
|
throw r;
|
|
2095
2447
|
};
|
|
2096
2448
|
}
|
|
2097
|
-
}, X = new
|
|
2098
|
-
function
|
|
2449
|
+
}, X = new Ua();
|
|
2450
|
+
function _(e, t) {
|
|
2099
2451
|
return X.parse(e, t);
|
|
2100
2452
|
}
|
|
2101
|
-
|
|
2102
|
-
return X.setOptions(e),
|
|
2453
|
+
_.options = _.setOptions = function(e) {
|
|
2454
|
+
return X.setOptions(e), _.defaults = X.defaults, dr(_.defaults), _;
|
|
2103
2455
|
};
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
return X.use(...e),
|
|
2456
|
+
_.getDefaults = Ve;
|
|
2457
|
+
_.defaults = Q;
|
|
2458
|
+
_.use = function(...e) {
|
|
2459
|
+
return X.use(...e), _.defaults = X.defaults, dr(_.defaults), _;
|
|
2108
2460
|
};
|
|
2109
|
-
|
|
2461
|
+
_.walkTokens = function(e, t) {
|
|
2110
2462
|
return X.walkTokens(e, t);
|
|
2111
2463
|
};
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
const
|
|
2130
|
-
function
|
|
2464
|
+
_.parseInline = X.parseInline;
|
|
2465
|
+
_.Parser = F;
|
|
2466
|
+
_.parser = F.parse;
|
|
2467
|
+
_.Renderer = ve;
|
|
2468
|
+
_.TextRenderer = Je;
|
|
2469
|
+
_.Lexer = B;
|
|
2470
|
+
_.lexer = B.lex;
|
|
2471
|
+
_.Tokenizer = ye;
|
|
2472
|
+
_.Hooks = oe;
|
|
2473
|
+
_.parse = _;
|
|
2474
|
+
_.options;
|
|
2475
|
+
_.setOptions;
|
|
2476
|
+
_.use;
|
|
2477
|
+
_.walkTokens;
|
|
2478
|
+
_.parseInline;
|
|
2479
|
+
F.parse;
|
|
2480
|
+
B.lex;
|
|
2481
|
+
const Ga = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
|
|
2482
|
+
function Wa(e) {
|
|
2131
2483
|
const t = [];
|
|
2132
2484
|
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (n) => {
|
|
2133
2485
|
const o = `__IMG_PROTECTED_${t.length}__`;
|
|
@@ -2142,31 +2494,31 @@ function Ia(e) {
|
|
|
2142
2494
|
const o = `__IMG_PROTECTED_${t.length}__`;
|
|
2143
2495
|
return t.push(n), o;
|
|
2144
2496
|
});
|
|
2145
|
-
const r =
|
|
2497
|
+
const r = Ga.join("|"), a = new RegExp(
|
|
2146
2498
|
`<a[^>]*href="(https?:\\/\\/[^"]+\\.(?:${r})(?:\\?[^"]*)?)"[^>]*>([^<]*)<\\/a>`,
|
|
2147
2499
|
"gi"
|
|
2148
2500
|
);
|
|
2149
2501
|
e = e.replace(a, (n, o, i) => {
|
|
2150
2502
|
const l = i && !i.match(/^(view|see|open|click|image|photo|picture)$/i) ? i : "";
|
|
2151
|
-
return
|
|
2503
|
+
return Pe(o, l, l);
|
|
2152
2504
|
});
|
|
2153
2505
|
const s = new RegExp(
|
|
2154
2506
|
`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(?:${r})(\\?[^\\s<>"]*)?)(?!["'])`,
|
|
2155
2507
|
"gi"
|
|
2156
2508
|
);
|
|
2157
|
-
e = e.replace(s, (n, o) =>
|
|
2509
|
+
e = e.replace(s, (n, o) => Pe(o, "", ""));
|
|
2158
2510
|
for (let n = t.length - 1; n >= 0; n--)
|
|
2159
2511
|
e = e.replace(`__IMG_PROTECTED_${n}__`, t[n]);
|
|
2160
2512
|
return e;
|
|
2161
2513
|
}
|
|
2162
|
-
function
|
|
2514
|
+
function Pe(e, t, r) {
|
|
2163
2515
|
const a = t || r || "";
|
|
2164
2516
|
let s = "artifactuse-image";
|
|
2165
2517
|
e.includes("large2x") || e.includes("large") || r != null && r.toLowerCase().includes("hero") ? s = "artifactuse-hero-image" : e.includes("small") || e.includes("tiny") ? s = "artifactuse-inline-image" : (r != null && r.toLowerCase().includes("aerial") || r != null && r.toLowerCase().includes("view")) && (s = "artifactuse-hero-image");
|
|
2166
2518
|
let n = '<div class="artifactuse-image-container">';
|
|
2167
2519
|
return n += `<img src="${e}" alt="${r || ""}" class="${s}" data-lightbox="true" data-caption="${a}" loading="lazy" />`, a && (n += `<div class="artifactuse-image-caption">${a}</div>`), n += "</div>", n;
|
|
2168
2520
|
}
|
|
2169
|
-
function
|
|
2521
|
+
function Xa(e) {
|
|
2170
2522
|
const t = e.split(`
|
|
2171
2523
|
`), r = [];
|
|
2172
2524
|
let a = [], s = !1;
|
|
@@ -2176,9 +2528,9 @@ function ja(e) {
|
|
|
2176
2528
|
s || (s = !0, a = []);
|
|
2177
2529
|
let i = "", l = n, c = 0;
|
|
2178
2530
|
for (; l < t.length; ) {
|
|
2179
|
-
const
|
|
2180
|
-
if (i +=
|
|
2181
|
-
`, c += (
|
|
2531
|
+
const d = t[l];
|
|
2532
|
+
if (i += d + `
|
|
2533
|
+
`, c += (d.match(/<div/g) || []).length, c -= (d.match(/<\/div>/g) || []).length, c === 0) break;
|
|
2182
2534
|
l++;
|
|
2183
2535
|
}
|
|
2184
2536
|
a.push(i.trim()), n = l;
|
|
@@ -2187,98 +2539,98 @@ function ja(e) {
|
|
|
2187
2539
|
r.push(t[n]);
|
|
2188
2540
|
} else {
|
|
2189
2541
|
if (s && a.length >= 2) {
|
|
2190
|
-
const i =
|
|
2542
|
+
const i = ft(a);
|
|
2191
2543
|
r.push(i);
|
|
2192
2544
|
} else s && a.length === 1 && r.push(a[0]);
|
|
2193
2545
|
s = !1, a = [], r.push(t[n]);
|
|
2194
2546
|
}
|
|
2195
2547
|
}
|
|
2196
2548
|
if (s && a.length >= 2) {
|
|
2197
|
-
const n =
|
|
2549
|
+
const n = ft(a);
|
|
2198
2550
|
r.push(n);
|
|
2199
2551
|
} else s && a.length === 1 && r.push(a[0]);
|
|
2200
2552
|
return r.join(`
|
|
2201
2553
|
`);
|
|
2202
2554
|
}
|
|
2203
|
-
function
|
|
2555
|
+
function ft(e) {
|
|
2204
2556
|
return `<div class="artifactuse-image-gallery">
|
|
2205
2557
|
${e.map((r) => r.replace("artifactuse-image-container", "artifactuse-gallery-item").replace("artifactuse-image-caption", "artifactuse-gallery-caption").replace("artifactuse-image", "artifactuse-gallery-image").replace("artifactuse-hero-image", "artifactuse-gallery-image").replace("artifactuse-inline-image", "artifactuse-gallery-image")).join(`
|
|
2206
2558
|
`)}
|
|
2207
2559
|
</div>`;
|
|
2208
2560
|
}
|
|
2209
|
-
const
|
|
2210
|
-
function
|
|
2561
|
+
const xr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
|
|
2562
|
+
function Ka(e) {
|
|
2211
2563
|
if (!e) return !1;
|
|
2212
|
-
const t =
|
|
2564
|
+
const t = xr.join("|");
|
|
2213
2565
|
return !!(new RegExp(`\\.(${t})(\\?.*)?$`, "i").test(e) || /(?:youtube\.com\/watch\?v=|youtu\.be\/)[a-zA-Z0-9_-]+/.test(e) || /vimeo\.com\/\d+/.test(e) || /loom\.com\/share\/[a-zA-Z0-9]+/.test(e) || /dailymotion\.com\/video\/[a-zA-Z0-9]+/.test(e));
|
|
2214
2566
|
}
|
|
2215
|
-
function
|
|
2567
|
+
function Qa(e) {
|
|
2216
2568
|
if (!e) return null;
|
|
2217
2569
|
let t = e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);
|
|
2218
2570
|
if (t) return { type: "youtube", id: t[1] };
|
|
2219
2571
|
if (t = e.match(/vimeo\.com\/(\d+)/), t) return { type: "vimeo", id: t[1] };
|
|
2220
2572
|
if (t = e.match(/loom\.com\/share\/([a-zA-Z0-9]+)/), t) return { type: "loom", id: t[1] };
|
|
2221
2573
|
if (t = e.match(/dailymotion\.com\/video\/([a-zA-Z0-9]+)/), t) return { type: "dailymotion", id: t[1] };
|
|
2222
|
-
const r =
|
|
2574
|
+
const r = xr.join("|");
|
|
2223
2575
|
return new RegExp(`\\.(${r})(\\?.*)?$`, "i").test(e) ? { type: "direct", id: e } : null;
|
|
2224
2576
|
}
|
|
2225
|
-
function
|
|
2226
|
-
const t =
|
|
2577
|
+
function Ja(e) {
|
|
2578
|
+
const t = Qa(e);
|
|
2227
2579
|
if (!t) return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
|
|
2228
2580
|
switch (t.type) {
|
|
2229
2581
|
case "youtube":
|
|
2230
|
-
return
|
|
2582
|
+
return je(t.id);
|
|
2231
2583
|
case "vimeo":
|
|
2232
|
-
return
|
|
2584
|
+
return Ze(t.id);
|
|
2233
2585
|
case "loom":
|
|
2234
|
-
return
|
|
2586
|
+
return qe(t.id);
|
|
2235
2587
|
case "dailymotion":
|
|
2236
|
-
return
|
|
2588
|
+
return He(t.id);
|
|
2237
2589
|
case "direct":
|
|
2238
|
-
return
|
|
2590
|
+
return Ie(t.id);
|
|
2239
2591
|
default:
|
|
2240
2592
|
return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
|
|
2241
2593
|
}
|
|
2242
2594
|
}
|
|
2243
|
-
function
|
|
2595
|
+
function Ya(e) {
|
|
2244
2596
|
const t = [];
|
|
2245
|
-
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (
|
|
2597
|
+
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (f) => {
|
|
2246
2598
|
const w = `__PROTECTED_${t.length}__`;
|
|
2247
|
-
return t.push(
|
|
2248
|
-
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (
|
|
2599
|
+
return t.push(f), w;
|
|
2600
|
+
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (f) => {
|
|
2249
2601
|
const w = `__PROTECTED_${t.length}__`;
|
|
2250
|
-
return t.push(
|
|
2251
|
-
}), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (
|
|
2602
|
+
return t.push(f), w;
|
|
2603
|
+
}), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (f) => {
|
|
2252
2604
|
const w = `__PROTECTED_${t.length}__`;
|
|
2253
|
-
return t.push(
|
|
2605
|
+
return t.push(f), w;
|
|
2254
2606
|
});
|
|
2255
2607
|
const r = /\[([^\]]+)\]\((https:\/\/www\.pexels\.com\/video\/[^)]+)\)\s*(?:<\/p>)?\s*(?:<p>)?\s*(?:Preview image:\s*)?!\[([^\]]*)\]\((https:\/\/images\.pexels\.com\/videos\/[^)]+)\)/gi;
|
|
2256
|
-
e = e.replace(r, (
|
|
2608
|
+
e = e.replace(r, (f, w, h, m, g) => ts(w, h, g, m));
|
|
2257
2609
|
const a = /<a[^>]*href="(https?:\/\/[^"]+\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
|
|
2258
|
-
e = e.replace(a, (
|
|
2610
|
+
e = e.replace(a, (f, w) => Ie(w));
|
|
2259
2611
|
const s = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
|
|
2260
|
-
e = e.replace(s, (
|
|
2612
|
+
e = e.replace(s, (f, w) => Ie(w));
|
|
2261
2613
|
const n = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2262
|
-
e = e.replace(n, (
|
|
2614
|
+
e = e.replace(n, (f, w, h) => je(h));
|
|
2263
2615
|
const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2264
|
-
e = e.replace(o, (
|
|
2616
|
+
e = e.replace(o, (f, w, h) => je(h));
|
|
2265
2617
|
const i = /<a[^>]*href="(https?:\/\/(?:www\.)?vimeo\.com\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2266
|
-
e = e.replace(i, (
|
|
2618
|
+
e = e.replace(i, (f, w, h) => Ze(h));
|
|
2267
2619
|
const l = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?vimeo\\.com\\/(\\d+))(?!["'])`, "gi");
|
|
2268
|
-
e = e.replace(l, (
|
|
2620
|
+
e = e.replace(l, (f, w, h) => Ze(h));
|
|
2269
2621
|
const c = /<a[^>]*href="(https?:\/\/(?:www\.)?loom\.com\/share\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2270
|
-
e = e.replace(c, (
|
|
2271
|
-
const
|
|
2272
|
-
e = e.replace(
|
|
2622
|
+
e = e.replace(c, (f, w, h) => qe(h));
|
|
2623
|
+
const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?loom\\.com\\/share\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2624
|
+
e = e.replace(d, (f, w, h) => qe(h));
|
|
2273
2625
|
const p = /<a[^>]*href="(https?:\/\/(?:www\.)?dailymotion\.com\/video\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2274
|
-
e = e.replace(p, (
|
|
2275
|
-
const
|
|
2276
|
-
e = e.replace(
|
|
2277
|
-
for (let
|
|
2278
|
-
e = e.replace(`__PROTECTED_${
|
|
2626
|
+
e = e.replace(p, (f, w, h) => He(h));
|
|
2627
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?dailymotion\\.com\\/video\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2628
|
+
e = e.replace(u, (f, w, h) => He(h));
|
|
2629
|
+
for (let f = t.length - 1; f >= 0; f--)
|
|
2630
|
+
e = e.replace(`__PROTECTED_${f}__`, t[f]);
|
|
2279
2631
|
return e;
|
|
2280
2632
|
}
|
|
2281
|
-
function
|
|
2633
|
+
function es(e) {
|
|
2282
2634
|
const t = e.split("?")[0].split(".").pop().toLowerCase();
|
|
2283
2635
|
return {
|
|
2284
2636
|
mp4: "video/mp4",
|
|
@@ -2291,34 +2643,34 @@ function Oa(e) {
|
|
|
2291
2643
|
wmv: "video/x-ms-wmv"
|
|
2292
2644
|
}[t] || "video/mp4";
|
|
2293
2645
|
}
|
|
2294
|
-
function
|
|
2295
|
-
const t =
|
|
2646
|
+
function Ie(e) {
|
|
2647
|
+
const t = es(e);
|
|
2296
2648
|
return `<div class="artifactuse-video-wrapper"><video controls preload="metadata" class="artifactuse-video"><source src="${e}" type="${t}">Your browser does not support the video tag.</video></div>`;
|
|
2297
2649
|
}
|
|
2298
|
-
function
|
|
2650
|
+
function ts(e, t, r, a) {
|
|
2299
2651
|
return `<div class="artifactuse-video-preview-container"><div class="artifactuse-video-preview-wrapper" data-video-url="${t}"><img src="${r}" alt="${a}" class="artifactuse-video-preview-image" loading="lazy" /><div class="artifactuse-video-play-overlay"><svg class="artifactuse-play-icon" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></div><div class="artifactuse-video-info-overlay"><h4 class="artifactuse-video-title">${e}</h4><p class="artifactuse-video-alt">${a}</p></div></div><div class="artifactuse-video-actions"><a href="${t}" target="_blank" rel="noopener" class="artifactuse-video-link">Watch on Pexels</a></div></div>`;
|
|
2300
2652
|
}
|
|
2301
|
-
function
|
|
2653
|
+
function je(e) {
|
|
2302
2654
|
const t = `https://i.ytimg.com/vi/${e}/hqdefault.jpg`, a = `this.parentElement.innerHTML='<iframe src=\\'${`https://www.youtube.com/embed/${e}?autoplay=1`}\\' frameborder=\\'0\\' allow=\\'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
|
|
2303
2655
|
return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="youtube" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play YouTube video" onclick="${a}"><img src="${t}" alt="YouTube video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" /><div class="artifactuse-video-play-button artifactuse-youtube-play"><svg viewBox="0 0 68 48" width="68" height="48"><path class="artifactuse-youtube-play-bg" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"/><path d="M 45,24 27,14 27,34" fill="#fff"/></svg></div></button></div>`;
|
|
2304
2656
|
}
|
|
2305
|
-
function
|
|
2657
|
+
function Ze(e) {
|
|
2306
2658
|
const t = `https://player.vimeo.com/video/${e}?autoplay=1`, r = `https://vumbnail.com/${e}.jpg`, a = `this.parentElement.innerHTML='<iframe src=\\'${t}\\' frameborder=\\'0\\' allow=\\'autoplay; fullscreen; picture-in-picture\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
|
|
2307
2659
|
return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="vimeo" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play Vimeo video" onclick="${a}"><img src="${r}" alt="Vimeo video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" onerror="this.style.display='none'" /><div class="artifactuse-video-play-button artifactuse-vimeo-play"><svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="31" fill="#1ab7ea"/><path d="M26 20 L26 44 L46 32 Z" fill="#fff"/></svg></div></button></div>`;
|
|
2308
2660
|
}
|
|
2309
|
-
function
|
|
2661
|
+
function qe(e) {
|
|
2310
2662
|
const t = `https://www.loom.com/embed/${e}?autoplay=1`, r = `https://cdn.loom.com/sessions/thumbnails/${e}-with-play.gif`, a = `this.parentElement.innerHTML='<iframe src=\\'${t}\\' frameborder=\\'0\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
|
|
2311
2663
|
return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="loom" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play Loom video" onclick="${a}"><img src="${r}" alt="Loom video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" onerror="this.style.display='none'" /><div class="artifactuse-video-play-button artifactuse-loom-play"><svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="31" fill="#625df5"/><path d="M26 20 L26 44 L46 32 Z" fill="#fff"/></svg></div></button></div>`;
|
|
2312
2664
|
}
|
|
2313
|
-
function
|
|
2665
|
+
function He(e) {
|
|
2314
2666
|
const t = `https://www.dailymotion.com/embed/video/${e}?autoplay=1`, r = `https://www.dailymotion.com/thumbnail/video/${e}`, a = `this.parentElement.innerHTML='<iframe src=\\'${t}\\' frameborder=\\'0\\' allow=\\'autoplay; fullscreen; picture-in-picture\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
|
|
2315
2667
|
return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="dailymotion" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play Dailymotion video" onclick="${a}"><img src="${r}" alt="Dailymotion video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" onerror="this.style.display='none'" /><div class="artifactuse-video-play-button artifactuse-dailymotion-play"><svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="31" fill="#0066dc"/><path d="M26 20 L26 44 L46 32 Z" fill="#fff"/></svg></div></button></div>`;
|
|
2316
2668
|
}
|
|
2317
|
-
function
|
|
2669
|
+
function rs(e) {
|
|
2318
2670
|
let t = e.replace(/<\/p>/g, "").replace(/<p>/g, "").replace(/<br\s*\/?>/g, "").replace(/<strong>.*?<\/strong>/g, "").replace(/<em>.*?<\/em>/g, "").replace(/<b>.*?<\/b>/g, "").replace(/<i>.*?<\/i>/g, "").replace(/\n/g, "").replace(/\s+/g, "").trim();
|
|
2319
2671
|
return /<(?!\/)[^>]+>/.test(t) ? !1 : t.length < 200;
|
|
2320
2672
|
}
|
|
2321
|
-
function
|
|
2673
|
+
function Ce(e) {
|
|
2322
2674
|
let t = e.match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
|
|
2323
2675
|
if (t) {
|
|
2324
2676
|
const r = t[1].trim(), a = r.replace(/<[^>]*>/g, "").trim();
|
|
@@ -2332,23 +2684,23 @@ function $e(e) {
|
|
|
2332
2684
|
}
|
|
2333
2685
|
return "";
|
|
2334
2686
|
}
|
|
2335
|
-
function
|
|
2687
|
+
function as(e) {
|
|
2336
2688
|
const t = /<div class="artifactuse-video-(wrapper|preview-container)/g, r = [];
|
|
2337
2689
|
let a;
|
|
2338
2690
|
for (; (a = t.exec(e)) !== null; ) {
|
|
2339
2691
|
const l = a.index;
|
|
2340
|
-
let c = 0,
|
|
2692
|
+
let c = 0, d = l;
|
|
2341
2693
|
for (let p = l; p < e.length; p++)
|
|
2342
2694
|
if (e.substring(p, p + 4) === "<div")
|
|
2343
2695
|
c++;
|
|
2344
2696
|
else if (e.substring(p, p + 6) === "</div>" && (c--, c === 0)) {
|
|
2345
|
-
|
|
2697
|
+
d = p + 6;
|
|
2346
2698
|
break;
|
|
2347
2699
|
}
|
|
2348
2700
|
r.push({
|
|
2349
2701
|
start: l,
|
|
2350
|
-
end:
|
|
2351
|
-
html: e.substring(l,
|
|
2702
|
+
end: d,
|
|
2703
|
+
html: e.substring(l, d)
|
|
2352
2704
|
});
|
|
2353
2705
|
}
|
|
2354
2706
|
if (r.length < 2)
|
|
@@ -2356,16 +2708,16 @@ function Fa(e) {
|
|
|
2356
2708
|
const s = [];
|
|
2357
2709
|
let n = [{
|
|
2358
2710
|
...r[0],
|
|
2359
|
-
caption:
|
|
2711
|
+
caption: Ce(e.substring(0, r[0].start))
|
|
2360
2712
|
}];
|
|
2361
2713
|
for (let l = 1; l < r.length; l++) {
|
|
2362
|
-
const c = r[l - 1],
|
|
2363
|
-
|
|
2364
|
-
...
|
|
2365
|
-
caption:
|
|
2714
|
+
const c = r[l - 1], d = r[l], p = e.substring(c.end, d.start);
|
|
2715
|
+
rs(p) ? n.push({
|
|
2716
|
+
...d,
|
|
2717
|
+
caption: Ce(p)
|
|
2366
2718
|
}) : (s.push([...n]), n = [{
|
|
2367
|
-
...
|
|
2368
|
-
caption:
|
|
2719
|
+
...d,
|
|
2720
|
+
caption: Ce(e.substring(c.end, d.start))
|
|
2369
2721
|
}]);
|
|
2370
2722
|
}
|
|
2371
2723
|
s.push(n);
|
|
@@ -2373,19 +2725,19 @@ function Fa(e) {
|
|
|
2373
2725
|
for (const l of s) {
|
|
2374
2726
|
if (l.length === 0) continue;
|
|
2375
2727
|
const c = l[0];
|
|
2376
|
-
let
|
|
2377
|
-
const
|
|
2378
|
-
if (
|
|
2379
|
-
o +=
|
|
2728
|
+
let d = c.start;
|
|
2729
|
+
const u = e.substring(i, c.start).match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
|
|
2730
|
+
if (u && (d = c.start - u[0].length, l[0].caption = u[1].trim()), o += e.substring(i, d), l.length >= 2)
|
|
2731
|
+
o += ss(l);
|
|
2380
2732
|
else {
|
|
2381
|
-
const
|
|
2382
|
-
|
|
2733
|
+
const f = l[0];
|
|
2734
|
+
f.caption ? o += `<div class="artifactuse-video-container">${f.html}<div class="artifactuse-video-caption">${f.caption}</div></div>` : o += f.html;
|
|
2383
2735
|
}
|
|
2384
2736
|
i = l[l.length - 1].end;
|
|
2385
2737
|
}
|
|
2386
2738
|
return o += e.substring(i), o = o.replace(/<p>\s*<\/p>/g, ""), o;
|
|
2387
2739
|
}
|
|
2388
|
-
function
|
|
2740
|
+
function ss(e) {
|
|
2389
2741
|
return `<div class="artifactuse-video-gallery">
|
|
2390
2742
|
${e.map(({ html: r, caption: a }) => {
|
|
2391
2743
|
let s = r.replace(
|
|
@@ -2400,75 +2752,75 @@ ${e.map(({ html: r, caption: a }) => {
|
|
|
2400
2752
|
`)}
|
|
2401
2753
|
</div>`;
|
|
2402
2754
|
}
|
|
2403
|
-
function
|
|
2755
|
+
function ns() {
|
|
2404
2756
|
return `audio-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
2405
2757
|
}
|
|
2406
|
-
function
|
|
2758
|
+
function is(e, t = {}) {
|
|
2407
2759
|
const r = t.theme || "dark", a = [];
|
|
2408
|
-
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (
|
|
2760
|
+
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (A) => {
|
|
2409
2761
|
const S = `__PROTECTED_${a.length}__`;
|
|
2410
|
-
return a.push(
|
|
2411
|
-
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (
|
|
2762
|
+
return a.push(A), S;
|
|
2763
|
+
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (A) => {
|
|
2412
2764
|
const S = `__PROTECTED_${a.length}__`;
|
|
2413
|
-
return a.push(
|
|
2414
|
-
}), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (
|
|
2765
|
+
return a.push(A), S;
|
|
2766
|
+
}), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (A) => {
|
|
2415
2767
|
const S = `__PROTECTED_${a.length}__`;
|
|
2416
|
-
return a.push(
|
|
2768
|
+
return a.push(A), S;
|
|
2417
2769
|
});
|
|
2418
2770
|
const s = /<a[^>]*href="(https?:\/\/[^"]+\.(mp3|wav|flac|aac|ogg|m4a|wma)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
|
|
2419
|
-
e = e.replace(s, (
|
|
2771
|
+
e = e.replace(s, (A, S) => ht(S));
|
|
2420
2772
|
const n = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp3|wav|flac|aac|ogg|m4a|wma)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
|
|
2421
|
-
e = e.replace(n, (
|
|
2773
|
+
e = e.replace(n, (A, S) => ht(S));
|
|
2422
2774
|
const o = /<a[^>]*href="(https?:\/\/(?:www\.)?soundcloud\.com\/[^"]+)"[^>]*>[^<]*<\/a>/gi;
|
|
2423
|
-
e = e.replace(o, (
|
|
2775
|
+
e = e.replace(o, (A, S) => gt(S));
|
|
2424
2776
|
const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?soundcloud\\.com\\/[^\\s<>"]+)(?!["'])`, "gi");
|
|
2425
|
-
e = e.replace(i, (
|
|
2777
|
+
e = e.replace(i, (A, S) => gt(S));
|
|
2426
2778
|
const l = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/track\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2427
|
-
e = e.replace(l, (
|
|
2779
|
+
e = e.replace(l, (A, S, C) => O("track", C, r));
|
|
2428
2780
|
const c = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/track\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2429
|
-
e = e.replace(c, (
|
|
2430
|
-
const
|
|
2431
|
-
e = e.replace(
|
|
2781
|
+
e = e.replace(c, (A, S, C) => O("track", C, r));
|
|
2782
|
+
const d = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/album\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2783
|
+
e = e.replace(d, (A, S, C) => O("album", C, r));
|
|
2432
2784
|
const p = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/album\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2433
|
-
e = e.replace(p, (
|
|
2434
|
-
const
|
|
2435
|
-
e = e.replace(
|
|
2436
|
-
const
|
|
2437
|
-
e = e.replace(
|
|
2785
|
+
e = e.replace(p, (A, S, C) => O("album", C, r));
|
|
2786
|
+
const u = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/playlist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2787
|
+
e = e.replace(u, (A, S, C) => O("playlist", C, r));
|
|
2788
|
+
const f = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/playlist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2789
|
+
e = e.replace(f, (A, S, C) => O("playlist", C, r));
|
|
2438
2790
|
const w = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/artist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2439
|
-
e = e.replace(w, (
|
|
2440
|
-
const
|
|
2441
|
-
e = e.replace(
|
|
2442
|
-
const
|
|
2443
|
-
e = e.replace(
|
|
2444
|
-
const
|
|
2445
|
-
e = e.replace(
|
|
2446
|
-
const
|
|
2447
|
-
e = e.replace(
|
|
2791
|
+
e = e.replace(w, (A, S, C) => O("artist", C, r));
|
|
2792
|
+
const h = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/artist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2793
|
+
e = e.replace(h, (A, S, C) => O("artist", C, r));
|
|
2794
|
+
const m = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/episode\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2795
|
+
e = e.replace(m, (A, S, C) => O("episode", C, r));
|
|
2796
|
+
const g = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/episode\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2797
|
+
e = e.replace(g, (A, S, C) => O("episode", C, r));
|
|
2798
|
+
const b = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/show\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2799
|
+
e = e.replace(b, (A, S, C) => O("show", C, r));
|
|
2448
2800
|
const v = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/show\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2449
|
-
e = e.replace(v, (
|
|
2450
|
-
const
|
|
2451
|
-
e = e.replace(
|
|
2801
|
+
e = e.replace(v, (A, S, C) => O("show", C, r));
|
|
2802
|
+
const y = /<a[^>]*href="(https?:\/\/music\.apple\.com\/([a-z]{2})\/([a-z-]+)\/[^\/]+\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2803
|
+
e = e.replace(y, (A, S, C, q, R) => mt(C, q, R));
|
|
2452
2804
|
const $ = new RegExp(`(?<!["'=])(https?:\\/\\/music\\.apple\\.com\\/([a-z]{2})\\/([a-z-]+)\\/[^\\/\\s]+\\/(\\d+))(?!["'])`, "gi");
|
|
2453
|
-
e = e.replace($, (
|
|
2454
|
-
for (let
|
|
2455
|
-
e = e.replace(`__PROTECTED_${
|
|
2805
|
+
e = e.replace($, (A, S, C, q, R) => mt(C, q, R));
|
|
2806
|
+
for (let A = a.length - 1; A >= 0; A--)
|
|
2807
|
+
e = e.replace(`__PROTECTED_${A}__`, a[A]);
|
|
2456
2808
|
return e;
|
|
2457
2809
|
}
|
|
2458
|
-
function
|
|
2810
|
+
function os(e) {
|
|
2459
2811
|
const t = e.match(/\.([a-zA-Z0-9]+)(?:\?|$)/);
|
|
2460
2812
|
return t ? t[1].toUpperCase() : "AUDIO";
|
|
2461
2813
|
}
|
|
2462
|
-
function
|
|
2814
|
+
function ie(e) {
|
|
2463
2815
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2464
2816
|
}
|
|
2465
|
-
function
|
|
2466
|
-
const t =
|
|
2817
|
+
function ht(e) {
|
|
2818
|
+
const t = ns(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = os(e);
|
|
2467
2819
|
return `
|
|
2468
|
-
<div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${
|
|
2820
|
+
<div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${ie(e)}">
|
|
2469
2821
|
<!-- Hidden audio element -->
|
|
2470
2822
|
<audio preload="metadata" class="artifactuse-audio-element">
|
|
2471
|
-
<source src="${
|
|
2823
|
+
<source src="${ie(e)}" type="audio/mpeg">
|
|
2472
2824
|
</audio>
|
|
2473
2825
|
|
|
2474
2826
|
<!-- Header -->
|
|
@@ -2481,7 +2833,7 @@ function it(e) {
|
|
|
2481
2833
|
</svg>
|
|
2482
2834
|
</div>
|
|
2483
2835
|
<div class="artifactuse-audio-meta">
|
|
2484
|
-
<span class="artifactuse-audio-filename" title="${
|
|
2836
|
+
<span class="artifactuse-audio-filename" title="${ie(r)}">${ie(r)}</span>
|
|
2485
2837
|
<span class="artifactuse-audio-format">${a}</span>
|
|
2486
2838
|
</div>
|
|
2487
2839
|
<span class="artifactuse-audio-duration">--:--</span>
|
|
@@ -2542,7 +2894,7 @@ function it(e) {
|
|
|
2542
2894
|
</div>
|
|
2543
2895
|
|
|
2544
2896
|
<!-- Download -->
|
|
2545
|
-
<a href="${
|
|
2897
|
+
<a href="${ie(e)}" download class="artifactuse-audio-btn artifactuse-audio-download-btn" aria-label="Download">
|
|
2546
2898
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2547
2899
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
2548
2900
|
<polyline points="7 10 12 15 17 10"></polyline>
|
|
@@ -2554,7 +2906,7 @@ function it(e) {
|
|
|
2554
2906
|
</div>
|
|
2555
2907
|
`;
|
|
2556
2908
|
}
|
|
2557
|
-
function
|
|
2909
|
+
function gt(e) {
|
|
2558
2910
|
return `
|
|
2559
2911
|
<div class="artifactuse-soundcloud-wrapper">
|
|
2560
2912
|
<iframe
|
|
@@ -2566,7 +2918,7 @@ function ot(e) {
|
|
|
2566
2918
|
</div>
|
|
2567
2919
|
`;
|
|
2568
2920
|
}
|
|
2569
|
-
function
|
|
2921
|
+
function O(e, t, r = "dark") {
|
|
2570
2922
|
const s = {
|
|
2571
2923
|
track: 152,
|
|
2572
2924
|
album: 352,
|
|
@@ -2589,7 +2941,7 @@ function D(e, t, r = "dark") {
|
|
|
2589
2941
|
</div>
|
|
2590
2942
|
`;
|
|
2591
2943
|
}
|
|
2592
|
-
function
|
|
2944
|
+
function mt(e, t, r) {
|
|
2593
2945
|
return `
|
|
2594
2946
|
<div class="artifactuse-apple-music-wrapper">
|
|
2595
2947
|
<iframe
|
|
@@ -2603,18 +2955,18 @@ function ct(e, t, r) {
|
|
|
2603
2955
|
</div>
|
|
2604
2956
|
`;
|
|
2605
2957
|
}
|
|
2606
|
-
const
|
|
2607
|
-
function
|
|
2958
|
+
const K = /* @__PURE__ */ new Map(), Le = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
2959
|
+
function cs(e = document) {
|
|
2608
2960
|
e.querySelectorAll(".artifactuse-audio-player:not([data-initialized])").forEach((r) => {
|
|
2609
|
-
|
|
2961
|
+
ls(r);
|
|
2610
2962
|
});
|
|
2611
2963
|
}
|
|
2612
|
-
function
|
|
2964
|
+
function ls(e) {
|
|
2613
2965
|
const t = e.dataset.playerId, r = e.dataset.audioSrc;
|
|
2614
2966
|
if (!t || !r) return;
|
|
2615
|
-
const a = e.querySelector(".artifactuse-audio-element"), s = e.querySelector(".artifactuse-audio-play-btn"), n = e.querySelector(".artifactuse-audio-icon-play"), o = e.querySelector(".artifactuse-audio-icon-pause"), i = e.querySelector(".artifactuse-audio-current"), l = e.querySelector(".artifactuse-audio-duration"), c = e.querySelector(".artifactuse-audio-waveform"),
|
|
2967
|
+
const a = e.querySelector(".artifactuse-audio-element"), s = e.querySelector(".artifactuse-audio-play-btn"), n = e.querySelector(".artifactuse-audio-icon-play"), o = e.querySelector(".artifactuse-audio-icon-pause"), i = e.querySelector(".artifactuse-audio-current"), l = e.querySelector(".artifactuse-audio-duration"), c = e.querySelector(".artifactuse-audio-waveform"), d = e.querySelector(".artifactuse-audio-waveform-canvas"), p = e.querySelector(".artifactuse-audio-waveform-progress"), u = e.querySelector(".artifactuse-audio-waveform-hover"), f = e.querySelector(".artifactuse-audio-mute-btn"), w = e.querySelector(".artifactuse-audio-icon-volume"), h = e.querySelector(".artifactuse-audio-icon-muted"), m = e.querySelector(".artifactuse-audio-volume-slider"), g = e.querySelector(".artifactuse-audio-speed-btn");
|
|
2616
2968
|
if (!a) return;
|
|
2617
|
-
const
|
|
2969
|
+
const b = {
|
|
2618
2970
|
isPlaying: !1,
|
|
2619
2971
|
isMuted: !1,
|
|
2620
2972
|
volume: 1,
|
|
@@ -2623,41 +2975,41 @@ function Ka(e) {
|
|
|
2623
2975
|
currentTime: 0,
|
|
2624
2976
|
waveformData: null
|
|
2625
2977
|
};
|
|
2626
|
-
|
|
2627
|
-
|
|
2978
|
+
K.set(t, { playerEl: e, audio: a, state: b }), us(d, t), s == null || s.addEventListener("click", () => {
|
|
2979
|
+
b.isPlaying ? kt(t) : vt(t);
|
|
2628
2980
|
}), a.addEventListener("loadedmetadata", () => {
|
|
2629
|
-
|
|
2981
|
+
b.duration = a.duration, l.textContent = yt(a.duration);
|
|
2630
2982
|
}), a.addEventListener("timeupdate", () => {
|
|
2631
|
-
|
|
2983
|
+
b.currentTime = a.currentTime, i.textContent = yt(a.currentTime);
|
|
2632
2984
|
const v = a.currentTime / a.duration * 100;
|
|
2633
2985
|
p.style.width = `${v}%`;
|
|
2634
2986
|
}), a.addEventListener("ended", () => {
|
|
2635
|
-
|
|
2987
|
+
b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing"), p.style.width = "0%";
|
|
2636
2988
|
}), a.addEventListener("play", () => {
|
|
2637
|
-
|
|
2989
|
+
b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), ds(t);
|
|
2638
2990
|
}), a.addEventListener("pause", () => {
|
|
2639
|
-
|
|
2991
|
+
b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing");
|
|
2640
2992
|
}), c == null || c.addEventListener("click", (v) => {
|
|
2641
|
-
const
|
|
2993
|
+
const y = c.getBoundingClientRect(), S = (v.clientX - y.left) / y.width * a.duration;
|
|
2642
2994
|
isNaN(S) || (a.currentTime = S);
|
|
2643
2995
|
}), c == null || c.addEventListener("mousemove", (v) => {
|
|
2644
|
-
const
|
|
2645
|
-
|
|
2996
|
+
const y = c.getBoundingClientRect(), A = (v.clientX - y.left) / y.width * 100;
|
|
2997
|
+
u.style.width = `${A}%`;
|
|
2646
2998
|
}), c == null || c.addEventListener("mouseleave", () => {
|
|
2647
|
-
|
|
2648
|
-
}),
|
|
2649
|
-
|
|
2650
|
-
}),
|
|
2651
|
-
const
|
|
2652
|
-
|
|
2653
|
-
}),
|
|
2654
|
-
const
|
|
2655
|
-
|
|
2999
|
+
u.style.width = "0%";
|
|
3000
|
+
}), f == null || f.addEventListener("click", () => {
|
|
3001
|
+
b.isMuted = !b.isMuted, a.muted = b.isMuted, w.style.display = b.isMuted ? "none" : "", h.style.display = b.isMuted ? "" : "none", b.isMuted ? m.value = 0 : m.value = b.volume * 100;
|
|
3002
|
+
}), m == null || m.addEventListener("input", (v) => {
|
|
3003
|
+
const y = parseInt(v.target.value, 10) / 100;
|
|
3004
|
+
b.volume = y, a.volume = y, y === 0 ? (b.isMuted = !0, w.style.display = "none", h.style.display = "") : (b.isMuted = !1, a.muted = !1, w.style.display = "", h.style.display = "none");
|
|
3005
|
+
}), g == null || g.addEventListener("click", () => {
|
|
3006
|
+
const y = (Le.indexOf(b.playbackRate) + 1) % Le.length;
|
|
3007
|
+
b.playbackRate = Le[y], a.playbackRate = b.playbackRate, g.querySelector("span").textContent = `${b.playbackRate}x`;
|
|
2656
3008
|
}), e.addEventListener("keydown", (v) => {
|
|
2657
3009
|
switch (v.key) {
|
|
2658
3010
|
case " ":
|
|
2659
3011
|
case "k":
|
|
2660
|
-
v.preventDefault(),
|
|
3012
|
+
v.preventDefault(), b.isPlaying ? kt(t) : vt(t);
|
|
2661
3013
|
break;
|
|
2662
3014
|
case "ArrowLeft":
|
|
2663
3015
|
v.preventDefault(), a.currentTime = Math.max(0, a.currentTime - 5);
|
|
@@ -2666,30 +3018,30 @@ function Ka(e) {
|
|
|
2666
3018
|
v.preventDefault(), a.currentTime = Math.min(a.duration, a.currentTime + 5);
|
|
2667
3019
|
break;
|
|
2668
3020
|
case "ArrowUp":
|
|
2669
|
-
v.preventDefault(),
|
|
3021
|
+
v.preventDefault(), b.volume = Math.min(1, b.volume + 0.1), a.volume = b.volume, m.value = b.volume * 100;
|
|
2670
3022
|
break;
|
|
2671
3023
|
case "ArrowDown":
|
|
2672
|
-
v.preventDefault(),
|
|
3024
|
+
v.preventDefault(), b.volume = Math.max(0, b.volume - 0.1), a.volume = b.volume, m.value = b.volume * 100;
|
|
2673
3025
|
break;
|
|
2674
3026
|
case "m":
|
|
2675
|
-
v.preventDefault(),
|
|
3027
|
+
v.preventDefault(), f == null || f.click();
|
|
2676
3028
|
break;
|
|
2677
3029
|
}
|
|
2678
3030
|
}), e.setAttribute("data-initialized", "true"), e.setAttribute("tabindex", "0");
|
|
2679
3031
|
}
|
|
2680
|
-
function
|
|
3032
|
+
function us(e, t) {
|
|
2681
3033
|
if (!e) return;
|
|
2682
3034
|
const r = e.getContext("2d"), a = window.devicePixelRatio || 1, s = e.parentElement.getBoundingClientRect();
|
|
2683
3035
|
e.width = s.width * a, e.height = s.height * a, e.style.width = `${s.width}px`, e.style.height = `${s.height}px`, r.scale(a, a);
|
|
2684
|
-
const n = s.width, o = s.height, i = Math.floor(n / 4), l =
|
|
2685
|
-
|
|
2686
|
-
const
|
|
2687
|
-
e.width =
|
|
2688
|
-
const p = Math.floor(
|
|
2689
|
-
|
|
3036
|
+
const n = s.width, o = s.height, i = Math.floor(n / 4), l = bt(i, t);
|
|
3037
|
+
wt(r, l, n, o), new ResizeObserver(() => {
|
|
3038
|
+
const d = e.parentElement.getBoundingClientRect();
|
|
3039
|
+
e.width = d.width * a, e.height = d.height * a, e.style.width = `${d.width}px`, e.style.height = `${d.height}px`, r.scale(a, a);
|
|
3040
|
+
const p = Math.floor(d.width / 4), u = bt(p, t);
|
|
3041
|
+
wt(r, u, d.width, d.height);
|
|
2690
3042
|
}).observe(e.parentElement);
|
|
2691
3043
|
}
|
|
2692
|
-
function
|
|
3044
|
+
function bt(e, t) {
|
|
2693
3045
|
const r = [];
|
|
2694
3046
|
let a = 0;
|
|
2695
3047
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -2706,98 +3058,98 @@ function lt(e, t) {
|
|
|
2706
3058
|
}
|
|
2707
3059
|
return r;
|
|
2708
3060
|
}
|
|
2709
|
-
function
|
|
3061
|
+
function wt(e, t, r, a) {
|
|
2710
3062
|
e.clearRect(0, 0, r, a);
|
|
2711
3063
|
const s = 2, o = s + 2, i = a / 2, c = getComputedStyle(document.documentElement).getPropertyValue("--artifactuse-text-muted").trim() || "107, 114, 128";
|
|
2712
|
-
e.fillStyle = `rgba(${c}, 0.4)`, t.forEach((
|
|
2713
|
-
const
|
|
2714
|
-
e.beginPath(), e.roundRect(
|
|
3064
|
+
e.fillStyle = `rgba(${c}, 0.4)`, t.forEach((d, p) => {
|
|
3065
|
+
const u = p * o, f = d * (a * 0.8), w = f / 2, h = s / 2;
|
|
3066
|
+
e.beginPath(), e.roundRect(u, i - w, s, f, h), e.fill();
|
|
2715
3067
|
});
|
|
2716
3068
|
}
|
|
2717
|
-
function
|
|
3069
|
+
function yt(e) {
|
|
2718
3070
|
if (!e || isNaN(e)) return "0:00";
|
|
2719
3071
|
const t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), a = Math.floor(e % 60);
|
|
2720
3072
|
return t > 0 ? `${t}:${r.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}` : `${r}:${a.toString().padStart(2, "0")}`;
|
|
2721
3073
|
}
|
|
2722
|
-
function
|
|
2723
|
-
const t =
|
|
3074
|
+
function vt(e) {
|
|
3075
|
+
const t = K.get(e);
|
|
2724
3076
|
t && t.audio.play();
|
|
2725
3077
|
}
|
|
2726
|
-
function
|
|
2727
|
-
const t =
|
|
3078
|
+
function kt(e) {
|
|
3079
|
+
const t = K.get(e);
|
|
2728
3080
|
t && t.audio.pause();
|
|
2729
3081
|
}
|
|
2730
|
-
function
|
|
2731
|
-
|
|
3082
|
+
function ds(e) {
|
|
3083
|
+
K.forEach((t, r) => {
|
|
2732
3084
|
r !== e && t.state.isPlaying && t.audio.pause();
|
|
2733
3085
|
});
|
|
2734
3086
|
}
|
|
2735
|
-
function
|
|
2736
|
-
const t =
|
|
2737
|
-
t && (t.audio.pause(), t.audio.src = "",
|
|
3087
|
+
function ps(e) {
|
|
3088
|
+
const t = K.get(e);
|
|
3089
|
+
t && (t.audio.pause(), t.audio.src = "", K.delete(e));
|
|
2738
3090
|
}
|
|
2739
|
-
function
|
|
2740
|
-
|
|
2741
|
-
|
|
3091
|
+
function fs() {
|
|
3092
|
+
K.forEach((e, t) => {
|
|
3093
|
+
ps(t);
|
|
2742
3094
|
});
|
|
2743
3095
|
}
|
|
2744
|
-
function
|
|
3096
|
+
function hs(e) {
|
|
2745
3097
|
const t = [];
|
|
2746
|
-
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (
|
|
2747
|
-
const
|
|
2748
|
-
return t.push(
|
|
2749
|
-
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (
|
|
2750
|
-
const
|
|
2751
|
-
return t.push(
|
|
2752
|
-
}), e = e.replace(/<iframe[^>]*>[\s\S]*?<\/iframe>/gi, (
|
|
2753
|
-
const
|
|
2754
|
-
return t.push(
|
|
3098
|
+
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (m) => {
|
|
3099
|
+
const g = `__PROTECTED_MAP_${t.length}__`;
|
|
3100
|
+
return t.push(m), g;
|
|
3101
|
+
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (m) => {
|
|
3102
|
+
const g = `__PROTECTED_MAP_${t.length}__`;
|
|
3103
|
+
return t.push(m), g;
|
|
3104
|
+
}), e = e.replace(/<iframe[^>]*>[\s\S]*?<\/iframe>/gi, (m) => {
|
|
3105
|
+
const g = `__PROTECTED_MAP_${t.length}__`;
|
|
3106
|
+
return t.push(m), g;
|
|
2755
3107
|
});
|
|
2756
3108
|
const r = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/embed\?pb=[^"]+)"[^>]*>[^<]*<\/a>/gi;
|
|
2757
|
-
e = e.replace(r, (
|
|
2758
|
-
const
|
|
2759
|
-
return t.push(
|
|
3109
|
+
e = e.replace(r, (m, g) => {
|
|
3110
|
+
const b = `__PROTECTED_MAP_${t.length}__`;
|
|
3111
|
+
return t.push(xt(g)), b;
|
|
2760
3112
|
});
|
|
2761
3113
|
const a = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/embed\\?pb=[^\\s<>"]+)(?!["'])`, "gi");
|
|
2762
|
-
e = e.replace(a, (
|
|
2763
|
-
const
|
|
2764
|
-
return t.push(
|
|
3114
|
+
e = e.replace(a, (m, g) => {
|
|
3115
|
+
const b = `__PROTECTED_MAP_${t.length}__`;
|
|
3116
|
+
return t.push(xt(g)), b;
|
|
2765
3117
|
});
|
|
2766
3118
|
const s = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/place\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2767
|
-
e = e.replace(s, (
|
|
3119
|
+
e = e.replace(s, (m, g, b) => N(decodeURIComponent(b.replace(/\+/g, " "))));
|
|
2768
3120
|
const n = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/place\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
|
|
2769
|
-
e = e.replace(n, (
|
|
3121
|
+
e = e.replace(n, (m, g, b) => N(decodeURIComponent(b.replace(/\+/g, " "))));
|
|
2770
3122
|
const o = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/@([0-9.-]+),([0-9.-]+),([0-9]+)z[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2771
|
-
e = e.replace(o, (
|
|
3123
|
+
e = e.replace(o, (m, g, b, v, y) => De(b, v, y));
|
|
2772
3124
|
const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/@([0-9.-]+),([0-9.-]+),([0-9]+)z)(?!["'])`, "gi");
|
|
2773
|
-
e = e.replace(i, (
|
|
3125
|
+
e = e.replace(i, (m, g, b, v, y) => De(b, v, y));
|
|
2774
3126
|
const l = /<a[^>]*href="(https?:\/\/maps\.google\.com\/\?q=([^\s"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2775
|
-
e = e.replace(l, (
|
|
3127
|
+
e = e.replace(l, (m, g, b) => N(decodeURIComponent(b)));
|
|
2776
3128
|
const c = new RegExp(`(?<!["'=])(https?:\\/\\/maps\\.google\\.com\\/\\?q=([^\\s"&]+))(?!["'])`, "gi");
|
|
2777
|
-
e = e.replace(c, (
|
|
2778
|
-
const
|
|
2779
|
-
e = e.replace(
|
|
3129
|
+
e = e.replace(c, (m, g, b) => N(decodeURIComponent(b)));
|
|
3130
|
+
const d = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3131
|
+
e = e.replace(d, (m, g, b) => N(decodeURIComponent(b.replace(/\+/g, " "))));
|
|
2780
3132
|
const p = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
|
|
2781
|
-
e = e.replace(p, (
|
|
2782
|
-
const
|
|
2783
|
-
e = e.replace(
|
|
2784
|
-
const
|
|
2785
|
-
e = e.replace(
|
|
3133
|
+
e = e.replace(p, (m, g, b) => N(decodeURIComponent(b.replace(/\+/g, " "))));
|
|
3134
|
+
const u = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/\?[^"]*query=([^"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3135
|
+
e = e.replace(u, (m, g, b) => N(decodeURIComponent(b.replace(/\+/g, " "))));
|
|
3136
|
+
const f = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/\\?[^\\s"]*query=([^\\s"&]+))(?!["'])`, "gi");
|
|
3137
|
+
e = e.replace(f, (m, g, b) => N(decodeURIComponent(b.replace(/\+/g, " "))));
|
|
2786
3138
|
const w = /<a[^>]*href="(https?:\/\/(?:www\.)?openstreetmap\.org\/[^"]*mlat=([0-9.-]+)[^"]*mlon=([0-9.-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2787
|
-
e = e.replace(w, (
|
|
2788
|
-
const
|
|
2789
|
-
return
|
|
3139
|
+
e = e.replace(w, (m, g, b, v) => {
|
|
3140
|
+
const y = g.match(/#map=(\d+)/), $ = y ? y[1] : 15;
|
|
3141
|
+
return $t(b, v, $);
|
|
2790
3142
|
});
|
|
2791
|
-
const
|
|
2792
|
-
e = e.replace(
|
|
2793
|
-
const
|
|
2794
|
-
return
|
|
3143
|
+
const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?openstreetmap\\.org\\/[^\\s]*mlat=([0-9.-]+)[^\\s]*mlon=([0-9.-]+))(?!["'])`, "gi");
|
|
3144
|
+
e = e.replace(h, (m, g, b, v) => {
|
|
3145
|
+
const y = g.match(/#map=(\d+)/), $ = y ? y[1] : 15;
|
|
3146
|
+
return $t(b, v, $);
|
|
2795
3147
|
});
|
|
2796
|
-
for (let
|
|
2797
|
-
e = e.replace(`__PROTECTED_MAP_${
|
|
3148
|
+
for (let m = t.length - 1; m >= 0; m--)
|
|
3149
|
+
e = e.replace(`__PROTECTED_MAP_${m}__`, t[m]);
|
|
2798
3150
|
return e;
|
|
2799
3151
|
}
|
|
2800
|
-
function
|
|
3152
|
+
function xt(e) {
|
|
2801
3153
|
const t = e.match(/pb=([^&]+)/);
|
|
2802
3154
|
if (t) {
|
|
2803
3155
|
const r = decodeURIComponent(t[1]), a = r.match(/!3d(-?[\d.]+).*?!2d(-?[\d.]+)/), s = r.match(/!2d(-?[\d.]+).*?!3d(-?[\d.]+)/);
|
|
@@ -2809,7 +3161,7 @@ function ht(e) {
|
|
|
2809
3161
|
const c = parseFloat(i[1]);
|
|
2810
3162
|
c > 1e4 ? l = 10 : c > 5e3 ? l = 12 : c > 1e3 ? l = 14 : c > 500 ? l = 16 : l = 18;
|
|
2811
3163
|
}
|
|
2812
|
-
return
|
|
3164
|
+
return De(n, o, l);
|
|
2813
3165
|
}
|
|
2814
3166
|
}
|
|
2815
3167
|
return `
|
|
@@ -2825,7 +3177,7 @@ function ht(e) {
|
|
|
2825
3177
|
</div>
|
|
2826
3178
|
`;
|
|
2827
3179
|
}
|
|
2828
|
-
function
|
|
3180
|
+
function N(e) {
|
|
2829
3181
|
const t = encodeURIComponent(e);
|
|
2830
3182
|
return `
|
|
2831
3183
|
<div class="artifactuse-map-wrapper">
|
|
@@ -2850,7 +3202,7 @@ function F(e) {
|
|
|
2850
3202
|
</div>
|
|
2851
3203
|
`;
|
|
2852
3204
|
}
|
|
2853
|
-
function
|
|
3205
|
+
function De(e, t, r) {
|
|
2854
3206
|
return `
|
|
2855
3207
|
<div class="artifactuse-map-wrapper">
|
|
2856
3208
|
<iframe
|
|
@@ -2869,7 +3221,7 @@ function je(e, t, r) {
|
|
|
2869
3221
|
</div>
|
|
2870
3222
|
`;
|
|
2871
3223
|
}
|
|
2872
|
-
function
|
|
3224
|
+
function $t(e, t, r = 15) {
|
|
2873
3225
|
return `
|
|
2874
3226
|
<div class="artifactuse-map-wrapper">
|
|
2875
3227
|
<iframe
|
|
@@ -2885,41 +3237,41 @@ function gt(e, t, r = 15) {
|
|
|
2885
3237
|
</div>
|
|
2886
3238
|
`;
|
|
2887
3239
|
}
|
|
2888
|
-
function
|
|
3240
|
+
function gs(e, t = {}) {
|
|
2889
3241
|
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2890
|
-
e = e.replace(a, (v,
|
|
3242
|
+
e = e.replace(a, (v, y, $, A) => At($, A, r));
|
|
2891
3243
|
const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:twitter\\.com|x\\.com)\\/([a-zA-Z0-9_]+)\\/status\\/(\\d+))(?!["'])`, "gi");
|
|
2892
|
-
e = e.replace(s, (v,
|
|
3244
|
+
e = e.replace(s, (v, y, $, A) => At($, A, r));
|
|
2893
3245
|
const n = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/p\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2894
|
-
e = e.replace(n, (v,
|
|
3246
|
+
e = e.replace(n, (v, y, $) => Rt($));
|
|
2895
3247
|
const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/p\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2896
|
-
e = e.replace(o, (v,
|
|
3248
|
+
e = e.replace(o, (v, y, $) => Rt($));
|
|
2897
3249
|
const i = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/reel\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2898
|
-
e = e.replace(i, (v,
|
|
3250
|
+
e = e.replace(i, (v, y, $) => St($));
|
|
2899
3251
|
const l = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/reel\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2900
|
-
e = e.replace(l, (v,
|
|
3252
|
+
e = e.replace(l, (v, y, $) => St($));
|
|
2901
3253
|
const c = /<a[^>]*href="(https?:\/\/(?:www\.)?tiktok\.com\/@([a-zA-Z0-9_.]+)\/video\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2902
|
-
e = e.replace(c, (v,
|
|
2903
|
-
const
|
|
2904
|
-
e = e.replace(
|
|
3254
|
+
e = e.replace(c, (v, y, $, A) => zt(A));
|
|
3255
|
+
const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?tiktok\\.com\\/@([a-zA-Z0-9_.]+)\\/video\\/(\\d+))(?!["'])`, "gi");
|
|
3256
|
+
e = e.replace(d, (v, y, $, A) => zt(A));
|
|
2905
3257
|
const p = /<a[^>]*href="(https?:\/\/(?:www\.)?linkedin\.com\/(?:posts|feed\/update)\/([a-zA-Z0-9_:-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2906
|
-
e = e.replace(p, (v,
|
|
2907
|
-
const
|
|
2908
|
-
e = e.replace(
|
|
2909
|
-
const
|
|
2910
|
-
e = e.replace(
|
|
3258
|
+
e = e.replace(p, (v, y, $) => Ct($, y));
|
|
3259
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?linkedin\\.com\\/(?:posts|feed\\/update)\\/([a-zA-Z0-9_:-]+))(?!["'])`, "gi");
|
|
3260
|
+
e = e.replace(u, (v, y, $) => Ct($, y));
|
|
3261
|
+
const f = /<a[^>]*href="(https?:\/\/(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3262
|
+
e = e.replace(f, (v, y, $, A) => Lt($, A, y));
|
|
2911
3263
|
const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?reddit\\.com\\/r\\/([a-zA-Z0-9_]+)\\/comments\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2912
|
-
e = e.replace(w, (v,
|
|
2913
|
-
const
|
|
2914
|
-
e = e.replace(
|
|
2915
|
-
const
|
|
2916
|
-
e = e.replace(
|
|
2917
|
-
const
|
|
2918
|
-
e = e.replace(
|
|
2919
|
-
const
|
|
2920
|
-
return e = e.replace(
|
|
2921
|
-
}
|
|
2922
|
-
function
|
|
3264
|
+
e = e.replace(w, (v, y, $, A) => Lt($, A, y));
|
|
3265
|
+
const h = /<a[^>]*href="(https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/posts\/\d+[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3266
|
+
e = e.replace(h, (v, y) => Mt(y));
|
|
3267
|
+
const m = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?facebook\\.com\\/[a-zA-Z0-9.]+\\/posts\\/\\d+)(?!["'])`, "gi");
|
|
3268
|
+
e = e.replace(m, (v, y) => Mt(y));
|
|
3269
|
+
const g = /<a[^>]*href="(https?:\/\/(?:www\.)?pinterest\.com\/pin\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3270
|
+
e = e.replace(g, (v, y, $) => _t($));
|
|
3271
|
+
const b = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?pinterest\\.com\\/pin\\/(\\d+))(?!["'])`, "gi");
|
|
3272
|
+
return e = e.replace(b, (v, y, $) => _t($)), e;
|
|
3273
|
+
}
|
|
3274
|
+
function At(e, t, r = "dark") {
|
|
2923
3275
|
return `
|
|
2924
3276
|
<div class="artifactuse-twitter-wrapper">
|
|
2925
3277
|
<blockquote class="twitter-tweet" data-dnt="true" data-theme="${r}">
|
|
@@ -2929,7 +3281,7 @@ function mt(e, t, r = "dark") {
|
|
|
2929
3281
|
</div>
|
|
2930
3282
|
`;
|
|
2931
3283
|
}
|
|
2932
|
-
function
|
|
3284
|
+
function Rt(e) {
|
|
2933
3285
|
return `
|
|
2934
3286
|
<div class="artifactuse-instagram-wrapper">
|
|
2935
3287
|
<iframe
|
|
@@ -2943,7 +3295,7 @@ function wt(e) {
|
|
|
2943
3295
|
</div>
|
|
2944
3296
|
`;
|
|
2945
3297
|
}
|
|
2946
|
-
function
|
|
3298
|
+
function St(e) {
|
|
2947
3299
|
return `
|
|
2948
3300
|
<div class="artifactuse-instagram-wrapper">
|
|
2949
3301
|
<iframe
|
|
@@ -2957,7 +3309,7 @@ function bt(e) {
|
|
|
2957
3309
|
</div>
|
|
2958
3310
|
`;
|
|
2959
3311
|
}
|
|
2960
|
-
function
|
|
3312
|
+
function zt(e) {
|
|
2961
3313
|
return `
|
|
2962
3314
|
<div class="artifactuse-tiktok-wrapper">
|
|
2963
3315
|
<iframe
|
|
@@ -2970,7 +3322,7 @@ function yt(e) {
|
|
|
2970
3322
|
</div>
|
|
2971
3323
|
`;
|
|
2972
3324
|
}
|
|
2973
|
-
function
|
|
3325
|
+
function Ct(e, t) {
|
|
2974
3326
|
return `
|
|
2975
3327
|
<div class="artifactuse-linkedin-wrapper">
|
|
2976
3328
|
<iframe
|
|
@@ -2986,7 +3338,7 @@ function vt(e, t) {
|
|
|
2986
3338
|
</div>
|
|
2987
3339
|
`;
|
|
2988
3340
|
}
|
|
2989
|
-
function
|
|
3341
|
+
function Lt(e, t, r) {
|
|
2990
3342
|
return `
|
|
2991
3343
|
<div class="artifactuse-reddit-wrapper">
|
|
2992
3344
|
<iframe
|
|
@@ -3001,7 +3353,7 @@ function kt(e, t, r) {
|
|
|
3001
3353
|
</div>
|
|
3002
3354
|
`;
|
|
3003
3355
|
}
|
|
3004
|
-
function
|
|
3356
|
+
function Mt(e) {
|
|
3005
3357
|
return `
|
|
3006
3358
|
<div class="artifactuse-facebook-wrapper">
|
|
3007
3359
|
<iframe
|
|
@@ -3019,7 +3371,7 @@ function xt(e) {
|
|
|
3019
3371
|
</div>
|
|
3020
3372
|
`;
|
|
3021
3373
|
}
|
|
3022
|
-
function
|
|
3374
|
+
function _t(e) {
|
|
3023
3375
|
return `
|
|
3024
3376
|
<div class="artifactuse-pinterest-wrapper">
|
|
3025
3377
|
<a data-pin-do="embedPin" data-pin-width="large" href="https://www.pinterest.com/pin/${e}/"></a>
|
|
@@ -3027,13 +3379,13 @@ function $t(e) {
|
|
|
3027
3379
|
</div>
|
|
3028
3380
|
`;
|
|
3029
3381
|
}
|
|
3030
|
-
function
|
|
3382
|
+
function ms(e) {
|
|
3031
3383
|
const t = /<a[^>]*href="(https?:\/\/[^"]+\.pdf(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
|
|
3032
|
-
e = e.replace(t, (a, s) =>
|
|
3384
|
+
e = e.replace(t, (a, s) => Et(s));
|
|
3033
3385
|
const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.pdf(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
|
|
3034
|
-
return e = e.replace(r, (a, s) =>
|
|
3386
|
+
return e = e.replace(r, (a, s) => Et(s)), e;
|
|
3035
3387
|
}
|
|
3036
|
-
function
|
|
3388
|
+
function Et(e) {
|
|
3037
3389
|
return `
|
|
3038
3390
|
<div class="artifactuse-pdf-wrapper">
|
|
3039
3391
|
<div class="artifactuse-pdf-header">
|
|
@@ -3057,25 +3409,25 @@ function At(e) {
|
|
|
3057
3409
|
</div>
|
|
3058
3410
|
`;
|
|
3059
3411
|
}
|
|
3060
|
-
function
|
|
3412
|
+
function bs(e) {
|
|
3061
3413
|
const t = /<a[^>]*href="(https?:\/\/docs\.google\.com\/document\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3062
|
-
e = e.replace(t, (c,
|
|
3414
|
+
e = e.replace(t, (c, d, p) => ee(p, "document"));
|
|
3063
3415
|
const r = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/document\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3064
|
-
e = e.replace(r, (c,
|
|
3416
|
+
e = e.replace(r, (c, d, p) => ee(p, "document"));
|
|
3065
3417
|
const a = /<a[^>]*href="(https?:\/\/docs\.google\.com\/spreadsheets\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3066
|
-
e = e.replace(a, (c,
|
|
3418
|
+
e = e.replace(a, (c, d, p) => ee(p, "spreadsheets"));
|
|
3067
3419
|
const s = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/spreadsheets\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3068
|
-
e = e.replace(s, (c,
|
|
3420
|
+
e = e.replace(s, (c, d, p) => ee(p, "spreadsheets"));
|
|
3069
3421
|
const n = /<a[^>]*href="(https?:\/\/docs\.google\.com\/presentation\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3070
|
-
e = e.replace(n, (c,
|
|
3422
|
+
e = e.replace(n, (c, d, p) => ee(p, "presentation"));
|
|
3071
3423
|
const o = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/presentation\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3072
|
-
e = e.replace(o, (c,
|
|
3424
|
+
e = e.replace(o, (c, d, p) => ee(p, "presentation"));
|
|
3073
3425
|
const i = /<a[^>]*href="(https?:\/\/docs\.google\.com\/forms\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3074
|
-
e = e.replace(i, (c,
|
|
3426
|
+
e = e.replace(i, (c, d, p) => Tt(p));
|
|
3075
3427
|
const l = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/forms\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3076
|
-
return e = e.replace(l, (c,
|
|
3428
|
+
return e = e.replace(l, (c, d, p) => Tt(p)), e;
|
|
3077
3429
|
}
|
|
3078
|
-
function
|
|
3430
|
+
function ee(e, t) {
|
|
3079
3431
|
const r = {
|
|
3080
3432
|
document: "Google Doc",
|
|
3081
3433
|
spreadsheets: "Google Sheet",
|
|
@@ -3106,7 +3458,7 @@ function Q(e, t) {
|
|
|
3106
3458
|
</div>
|
|
3107
3459
|
`;
|
|
3108
3460
|
}
|
|
3109
|
-
function
|
|
3461
|
+
function Tt(e) {
|
|
3110
3462
|
return `
|
|
3111
3463
|
<div class="artifactuse-google-form-wrapper">
|
|
3112
3464
|
<iframe
|
|
@@ -3117,13 +3469,13 @@ function Rt(e) {
|
|
|
3117
3469
|
</div>
|
|
3118
3470
|
`;
|
|
3119
3471
|
}
|
|
3120
|
-
function
|
|
3472
|
+
function ws(e) {
|
|
3121
3473
|
const t = /<a[^>]*href="(https?:\/\/[^"]+\.(docx?|xlsx?|pptx?)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
|
|
3122
|
-
e = e.replace(t, (a, s) =>
|
|
3474
|
+
e = e.replace(t, (a, s) => Pt(s));
|
|
3123
3475
|
const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(docx?|xlsx?|pptx?)(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
|
|
3124
|
-
return e = e.replace(r, (a, s) =>
|
|
3476
|
+
return e = e.replace(r, (a, s) => Pt(s)), e;
|
|
3125
3477
|
}
|
|
3126
|
-
function
|
|
3478
|
+
function Pt(e) {
|
|
3127
3479
|
const t = encodeURIComponent(e), r = e.split("/").pop().split("?")[0], a = r.split(".").pop().toLowerCase();
|
|
3128
3480
|
return `
|
|
3129
3481
|
<div class="artifactuse-office-wrapper">
|
|
@@ -3149,43 +3501,43 @@ function St(e) {
|
|
|
3149
3501
|
</div>
|
|
3150
3502
|
`;
|
|
3151
3503
|
}
|
|
3152
|
-
function
|
|
3504
|
+
function ys(e) {
|
|
3153
3505
|
return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
3154
3506
|
}
|
|
3155
|
-
function
|
|
3507
|
+
function vs(e, t = {}) {
|
|
3156
3508
|
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/gist\.github\.com\/([a-zA-Z0-9_-]+)\/([a-f0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3157
|
-
e = e.replace(a, (
|
|
3509
|
+
e = e.replace(a, (h, m, g, b) => It(g, b));
|
|
3158
3510
|
const s = new RegExp(`(?<!["'=])(https?:\\/\\/gist\\.github\\.com\\/([a-zA-Z0-9_-]+)\\/([a-f0-9]+))(?!["'])`, "gi");
|
|
3159
|
-
e = e.replace(s, (
|
|
3511
|
+
e = e.replace(s, (h, m, g, b) => It(g, b));
|
|
3160
3512
|
const n = /<a[^>]*href="(https?:\/\/codepen\.io\/([a-zA-Z0-9_-]+)\/(?:pen|full|details)\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3161
|
-
e = e.replace(n, (
|
|
3513
|
+
e = e.replace(n, (h, m, g, b) => jt(g, b, r));
|
|
3162
3514
|
const o = new RegExp(`(?<!["'=])(https?:\\/\\/codepen\\.io\\/([a-zA-Z0-9_-]+)\\/(?:pen|full|details)\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
3163
|
-
e = e.replace(o, (
|
|
3515
|
+
e = e.replace(o, (h, m, g, b) => jt(g, b, r));
|
|
3164
3516
|
const i = /<a[^>]*href="(https?:\/\/codesandbox\.io\/(?:s|embed)\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3165
|
-
e = e.replace(i, (
|
|
3517
|
+
e = e.replace(i, (h, m, g) => Zt(g, r));
|
|
3166
3518
|
const l = new RegExp(`(?<!["'=])(https?:\\/\\/codesandbox\\.io\\/(?:s|embed)\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
|
|
3167
|
-
e = e.replace(l, (
|
|
3519
|
+
e = e.replace(l, (h, m, g) => Zt(g, r));
|
|
3168
3520
|
const c = /<a[^>]*href="(https?:\/\/jsfiddle\.net\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3169
|
-
e = e.replace(c, (
|
|
3170
|
-
const
|
|
3171
|
-
e = e.replace(
|
|
3521
|
+
e = e.replace(c, (h, m, g, b) => qt(g, b, r));
|
|
3522
|
+
const d = new RegExp(`(?<!["'=])(https?:\\/\\/jsfiddle\\.net\\/([a-zA-Z0-9_]+)\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
3523
|
+
e = e.replace(d, (h, m, g, b) => qt(g, b, r));
|
|
3172
3524
|
const p = /<a[^>]*href="(https?:\/\/stackblitz\.com\/(?:edit|embed)\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3173
|
-
e = e.replace(p, (
|
|
3174
|
-
const
|
|
3175
|
-
e = e.replace(
|
|
3176
|
-
const
|
|
3177
|
-
e = e.replace(
|
|
3525
|
+
e = e.replace(p, (h, m, g) => Ht(g, r));
|
|
3526
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/stackblitz\\.com\\/(?:edit|embed)\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
|
|
3527
|
+
e = e.replace(u, (h, m, g) => Ht(g, r));
|
|
3528
|
+
const f = /<a[^>]*href="(https?:\/\/replit\.com\/@([a-zA-Z0-9_]+)\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3529
|
+
e = e.replace(f, (h, m, g, b) => Dt(g, b, r));
|
|
3178
3530
|
const w = new RegExp(`(?<!["'=])(https?:\\/\\/replit\\.com\\/@([a-zA-Z0-9_]+)\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3179
|
-
return e = e.replace(w, (
|
|
3531
|
+
return e = e.replace(w, (h, m, g, b) => Dt(g, b, r)), e;
|
|
3180
3532
|
}
|
|
3181
|
-
function
|
|
3533
|
+
function It(e, t) {
|
|
3182
3534
|
return `
|
|
3183
|
-
<div class="artifactuse-gist-wrapper" id="${
|
|
3535
|
+
<div class="artifactuse-gist-wrapper" id="${ys("gist")}">
|
|
3184
3536
|
<script src="https://gist.github.com/${e}/${t}.js"><\/script>
|
|
3185
3537
|
</div>
|
|
3186
3538
|
`;
|
|
3187
3539
|
}
|
|
3188
|
-
function
|
|
3540
|
+
function jt(e, t, r = "dark") {
|
|
3189
3541
|
return `
|
|
3190
3542
|
<div class="artifactuse-codepen-wrapper">
|
|
3191
3543
|
<iframe
|
|
@@ -3202,7 +3554,7 @@ function _t(e, t, r = "dark") {
|
|
|
3202
3554
|
</div>
|
|
3203
3555
|
`;
|
|
3204
3556
|
}
|
|
3205
|
-
function
|
|
3557
|
+
function Zt(e, t = "dark") {
|
|
3206
3558
|
return `
|
|
3207
3559
|
<div class="artifactuse-codesandbox-wrapper">
|
|
3208
3560
|
<iframe
|
|
@@ -3216,7 +3568,7 @@ function Lt(e, t = "dark") {
|
|
|
3216
3568
|
</div>
|
|
3217
3569
|
`;
|
|
3218
3570
|
}
|
|
3219
|
-
function
|
|
3571
|
+
function qt(e, t, r = "dark") {
|
|
3220
3572
|
return `
|
|
3221
3573
|
<div class="artifactuse-jsfiddle-wrapper">
|
|
3222
3574
|
<iframe
|
|
@@ -3231,7 +3583,7 @@ function Mt(e, t, r = "dark") {
|
|
|
3231
3583
|
</div>
|
|
3232
3584
|
`;
|
|
3233
3585
|
}
|
|
3234
|
-
function
|
|
3586
|
+
function Ht(e, t = "dark") {
|
|
3235
3587
|
return `
|
|
3236
3588
|
<div class="artifactuse-stackblitz-wrapper">
|
|
3237
3589
|
<iframe
|
|
@@ -3243,7 +3595,7 @@ function Et(e, t = "dark") {
|
|
|
3243
3595
|
</div>
|
|
3244
3596
|
`;
|
|
3245
3597
|
}
|
|
3246
|
-
function
|
|
3598
|
+
function Dt(e, t, r = "dark") {
|
|
3247
3599
|
return `
|
|
3248
3600
|
<div class="artifactuse-replit-wrapper">
|
|
3249
3601
|
<iframe
|
|
@@ -3255,25 +3607,25 @@ function Tt(e, t, r = "dark") {
|
|
|
3255
3607
|
</div>
|
|
3256
3608
|
`;
|
|
3257
3609
|
}
|
|
3258
|
-
function
|
|
3610
|
+
function ks(e) {
|
|
3259
3611
|
const t = /<a[^>]*href="(https?:\/\/public\.tableau\.com\/(?:views|profile)\/([^\s"]+))"[^>]*>[^<]*<\/a>/gi;
|
|
3260
|
-
e = e.replace(t, (c,
|
|
3612
|
+
e = e.replace(t, (c, d, p) => Ot(p));
|
|
3261
3613
|
const r = new RegExp(`(?<!["'=])(https?:\\/\\/public\\.tableau\\.com\\/(?:views|profile)\\/([^\\s<>"]+))(?!["'])`, "gi");
|
|
3262
|
-
e = e.replace(r, (c,
|
|
3614
|
+
e = e.replace(r, (c, d, p) => Ot(p));
|
|
3263
3615
|
const a = /<a[^>]*href="(https?:\/\/(?:public\.)?flourish\.studio\/visualisation\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3264
|
-
e = e.replace(a, (c,
|
|
3616
|
+
e = e.replace(a, (c, d, p) => Bt(p));
|
|
3265
3617
|
const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:public\\.)?flourish\\.studio\\/visualisation\\/(\\d+))(?!["'])`, "gi");
|
|
3266
|
-
e = e.replace(s, (c,
|
|
3618
|
+
e = e.replace(s, (c, d, p) => Bt(p));
|
|
3267
3619
|
const n = /<a[^>]*href="(https?:\/\/datawrapper\.dwcdn\.net\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3268
|
-
e = e.replace(n, (c,
|
|
3620
|
+
e = e.replace(n, (c, d, p) => Ft(p));
|
|
3269
3621
|
const o = new RegExp(`(?<!["'=])(https?:\\/\\/datawrapper\\.dwcdn\\.net\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
3270
|
-
e = e.replace(o, (c,
|
|
3622
|
+
e = e.replace(o, (c, d, p) => Ft(p));
|
|
3271
3623
|
const i = /<a[^>]*href="(https?:\/\/(?:e\.)?infogram\.com\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3272
|
-
e = e.replace(i, (c,
|
|
3624
|
+
e = e.replace(i, (c, d, p) => Vt(p));
|
|
3273
3625
|
const l = new RegExp(`(?<!["'=])(https?:\\/\\/(?:e\\.)?infogram\\.com\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3274
|
-
return e = e.replace(l, (c,
|
|
3626
|
+
return e = e.replace(l, (c, d, p) => Vt(p)), e;
|
|
3275
3627
|
}
|
|
3276
|
-
function
|
|
3628
|
+
function Ot(e) {
|
|
3277
3629
|
return `
|
|
3278
3630
|
<div class="artifactuse-tableau-wrapper">
|
|
3279
3631
|
<iframe
|
|
@@ -3285,7 +3637,7 @@ function Ct(e) {
|
|
|
3285
3637
|
</div>
|
|
3286
3638
|
`;
|
|
3287
3639
|
}
|
|
3288
|
-
function
|
|
3640
|
+
function Bt(e) {
|
|
3289
3641
|
return `
|
|
3290
3642
|
<div class="artifactuse-flourish-wrapper">
|
|
3291
3643
|
<iframe
|
|
@@ -3297,7 +3649,7 @@ function Pt(e) {
|
|
|
3297
3649
|
</div>
|
|
3298
3650
|
`;
|
|
3299
3651
|
}
|
|
3300
|
-
function
|
|
3652
|
+
function Ft(e) {
|
|
3301
3653
|
return `
|
|
3302
3654
|
<div class="artifactuse-datawrapper-wrapper">
|
|
3303
3655
|
<iframe
|
|
@@ -3309,7 +3661,7 @@ function It(e) {
|
|
|
3309
3661
|
</div>
|
|
3310
3662
|
`;
|
|
3311
3663
|
}
|
|
3312
|
-
function
|
|
3664
|
+
function Vt(e) {
|
|
3313
3665
|
return `
|
|
3314
3666
|
<div class="artifactuse-infogram-wrapper">
|
|
3315
3667
|
<iframe
|
|
@@ -3322,33 +3674,33 @@ function jt(e) {
|
|
|
3322
3674
|
</div>
|
|
3323
3675
|
`;
|
|
3324
3676
|
}
|
|
3325
|
-
function
|
|
3677
|
+
function xs(e, t = {}) {
|
|
3326
3678
|
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/sketchfab\.com\/(?:3d-)?models\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3327
|
-
e = e.replace(a, (
|
|
3679
|
+
e = e.replace(a, (h, m, g) => Nt(g, r));
|
|
3328
3680
|
const s = new RegExp(`(?<!["'=])(https?:\\/\\/sketchfab\\.com\\/(?:3d-)?models\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
|
|
3329
|
-
e = e.replace(s, (
|
|
3681
|
+
e = e.replace(s, (h, m, g) => Nt(g, r));
|
|
3330
3682
|
const n = /<a[^>]*href="(https?:\/\/(?:www\.)?figma\.com\/(?:file|design)\/([a-zA-Z0-9]+)(?:\/[^?\s"]*)?(?:\?node-id=([^&\s"]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3331
|
-
e = e.replace(n, (
|
|
3683
|
+
e = e.replace(n, (h, m, g, b) => Ut(g, b));
|
|
3332
3684
|
const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?figma\\.com\\/(?:file|design)\\/([a-zA-Z0-9]+)(?:\\/[^?\\s]*)?(?:\\?node-id=([^&\\s]+))?)(?!["'])`, "gi");
|
|
3333
|
-
e = e.replace(o, (
|
|
3685
|
+
e = e.replace(o, (h, m, g, b) => Ut(g, b));
|
|
3334
3686
|
const i = /<a[^>]*href="(https?:\/\/(?:www\.)?figma\.com\/proto\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3335
|
-
e = e.replace(i, (
|
|
3687
|
+
e = e.replace(i, (h, m, g) => Gt(g, m));
|
|
3336
3688
|
const l = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?figma\\.com\\/proto\\/([a-zA-Z0-9]+)[^\\s]*)(?!["'])`, "gi");
|
|
3337
|
-
e = e.replace(l, (
|
|
3689
|
+
e = e.replace(l, (h, m, g) => Gt(g, m));
|
|
3338
3690
|
const c = /<a[^>]*href="(https?:\/\/(?:www\.)?canva\.com\/design\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3339
|
-
e = e.replace(c, (
|
|
3340
|
-
const
|
|
3341
|
-
e = e.replace(
|
|
3691
|
+
e = e.replace(c, (h, m, g) => Wt(g, m));
|
|
3692
|
+
const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?canva\\.com\\/design\\/([a-zA-Z0-9_-]+)[^\\s]*)(?!["'])`, "gi");
|
|
3693
|
+
e = e.replace(d, (h, m, g) => Wt(g, m));
|
|
3342
3694
|
const p = /<a[^>]*href="(https?:\/\/dribbble\.com\/shots\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3343
|
-
e = e.replace(p, (
|
|
3344
|
-
const
|
|
3345
|
-
e = e.replace(
|
|
3346
|
-
const
|
|
3347
|
-
e = e.replace(
|
|
3695
|
+
e = e.replace(p, (h, m, g) => Xt(g));
|
|
3696
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/dribbble\\.com\\/shots\\/(\\d+))(?!["'])`, "gi");
|
|
3697
|
+
e = e.replace(u, (h, m, g) => Xt(g));
|
|
3698
|
+
const f = /<a[^>]*href="(https?:\/\/(?:www\.)?behance\.net\/gallery\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3699
|
+
e = e.replace(f, (h, m, g) => Kt(g, m));
|
|
3348
3700
|
const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?behance\\.net\\/gallery\\/(\\d+)[^\\s]*)(?!["'])`, "gi");
|
|
3349
|
-
return e = e.replace(w, (
|
|
3701
|
+
return e = e.replace(w, (h, m, g) => Kt(g, m)), e;
|
|
3350
3702
|
}
|
|
3351
|
-
function
|
|
3703
|
+
function Nt(e, t = "dark") {
|
|
3352
3704
|
return `
|
|
3353
3705
|
<div class="artifactuse-sketchfab-wrapper">
|
|
3354
3706
|
<iframe
|
|
@@ -3363,7 +3715,7 @@ function Zt(e, t = "dark") {
|
|
|
3363
3715
|
</div>
|
|
3364
3716
|
`;
|
|
3365
3717
|
}
|
|
3366
|
-
function
|
|
3718
|
+
function Ut(e, t) {
|
|
3367
3719
|
const r = t ? `&node-id=${t}` : "";
|
|
3368
3720
|
return `
|
|
3369
3721
|
<div class="artifactuse-figma-wrapper">
|
|
@@ -3376,7 +3728,7 @@ function qt(e, t) {
|
|
|
3376
3728
|
</div>
|
|
3377
3729
|
`;
|
|
3378
3730
|
}
|
|
3379
|
-
function
|
|
3731
|
+
function Gt(e, t) {
|
|
3380
3732
|
return `
|
|
3381
3733
|
<div class="artifactuse-figma-wrapper">
|
|
3382
3734
|
<iframe
|
|
@@ -3388,7 +3740,7 @@ function Ht(e, t) {
|
|
|
3388
3740
|
</div>
|
|
3389
3741
|
`;
|
|
3390
3742
|
}
|
|
3391
|
-
function
|
|
3743
|
+
function Wt(e, t) {
|
|
3392
3744
|
return `
|
|
3393
3745
|
<div class="artifactuse-canva-wrapper">
|
|
3394
3746
|
<div class="artifactuse-canva-preview">
|
|
@@ -3405,7 +3757,7 @@ function Dt(e, t) {
|
|
|
3405
3757
|
</div>
|
|
3406
3758
|
`;
|
|
3407
3759
|
}
|
|
3408
|
-
function
|
|
3760
|
+
function Xt(e) {
|
|
3409
3761
|
return `
|
|
3410
3762
|
<div class="artifactuse-dribbble-wrapper">
|
|
3411
3763
|
<iframe
|
|
@@ -3417,7 +3769,7 @@ function Ot(e) {
|
|
|
3417
3769
|
</div>
|
|
3418
3770
|
`;
|
|
3419
3771
|
}
|
|
3420
|
-
function
|
|
3772
|
+
function Kt(e, t) {
|
|
3421
3773
|
return `
|
|
3422
3774
|
<div class="artifactuse-behance-wrapper">
|
|
3423
3775
|
<iframe
|
|
@@ -3432,37 +3784,37 @@ function Bt(e, t) {
|
|
|
3432
3784
|
</div>
|
|
3433
3785
|
`;
|
|
3434
3786
|
}
|
|
3435
|
-
function
|
|
3787
|
+
function $s(e, t = {}) {
|
|
3436
3788
|
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:[a-zA-Z0-9-]+\.)?typeform\.com\/to\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3437
|
-
e = e.replace(a, (
|
|
3789
|
+
e = e.replace(a, (g, b, v) => Qt(v));
|
|
3438
3790
|
const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:[a-zA-Z0-9-]+\\.)?typeform\\.com\\/to\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
3439
|
-
e = e.replace(s, (
|
|
3791
|
+
e = e.replace(s, (g, b, v) => Qt(v));
|
|
3440
3792
|
const n = /<a[^>]*href="(https?:\/\/calendly\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3441
|
-
e = e.replace(n, (
|
|
3793
|
+
e = e.replace(n, (g, b, v, y) => Jt(v, y));
|
|
3442
3794
|
const o = new RegExp(`(?<!["'=])(https?:\\/\\/calendly\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
|
|
3443
|
-
e = e.replace(o, (
|
|
3795
|
+
e = e.replace(o, (g, b, v, y) => Jt(v, y));
|
|
3444
3796
|
const i = /<a[^>]*href="(https?:\/\/calendar\.google\.com\/calendar\/appointments\/schedules\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3445
|
-
e = e.replace(i, (
|
|
3797
|
+
e = e.replace(i, (g, b, v) => Yt(v));
|
|
3446
3798
|
const l = new RegExp(`(?<!["'=])(https?:\\/\\/calendar\\.google\\.com\\/calendar\\/appointments\\/schedules\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3447
|
-
e = e.replace(l, (
|
|
3799
|
+
e = e.replace(l, (g, b, v) => Yt(v));
|
|
3448
3800
|
const c = /<a[^>]*href="(https?:\/\/cal\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3449
|
-
e = e.replace(c, (
|
|
3450
|
-
const
|
|
3451
|
-
e = e.replace(
|
|
3801
|
+
e = e.replace(c, (g, b, v, y) => er(v, y, r));
|
|
3802
|
+
const d = new RegExp(`(?<!["'=])(https?:\\/\\/cal\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
|
|
3803
|
+
e = e.replace(d, (g, b, v, y) => er(v, y, r));
|
|
3452
3804
|
const p = /<a[^>]*href="(https?:\/\/(?:www\.)?notion\.so\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3453
|
-
e = e.replace(p, (
|
|
3454
|
-
const
|
|
3455
|
-
e = e.replace(
|
|
3456
|
-
const
|
|
3457
|
-
e = e.replace(
|
|
3805
|
+
e = e.replace(p, (g, b, v) => tr(v));
|
|
3806
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?notion\\.so\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
|
|
3807
|
+
e = e.replace(u, (g, b, v) => tr(v));
|
|
3808
|
+
const f = /<a[^>]*href="(https?:\/\/airtable\.com\/(?:embed\/)?([a-zA-Z0-9]+)(?:\/([a-zA-Z0-9]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3809
|
+
e = e.replace(f, (g, b, v, y) => rr(v, y));
|
|
3458
3810
|
const w = new RegExp(`(?<!["'=])(https?:\\/\\/airtable\\.com\\/(?:embed\\/)?([a-zA-Z0-9]+)(?:\\/([a-zA-Z0-9]+))?)(?!["'])`, "gi");
|
|
3459
|
-
e = e.replace(w, (
|
|
3460
|
-
const
|
|
3461
|
-
e = e.replace(
|
|
3462
|
-
const
|
|
3463
|
-
return e = e.replace(
|
|
3811
|
+
e = e.replace(w, (g, b, v, y) => rr(v, y));
|
|
3812
|
+
const h = /<a[^>]*href="(https?:\/\/miro\.com\/app\/board\/([a-zA-Z0-9_=-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3813
|
+
e = e.replace(h, (g, b, v) => ar(v));
|
|
3814
|
+
const m = new RegExp(`(?<!["'=])(https?:\\/\\/miro\\.com\\/app\\/board\\/([a-zA-Z0-9_=-]+))(?!["'])`, "gi");
|
|
3815
|
+
return e = e.replace(m, (g, b, v) => ar(v)), e;
|
|
3464
3816
|
}
|
|
3465
|
-
function
|
|
3817
|
+
function Qt(e) {
|
|
3466
3818
|
return `
|
|
3467
3819
|
<div class="artifactuse-typeform-wrapper">
|
|
3468
3820
|
<iframe
|
|
@@ -3473,7 +3825,7 @@ function Vt(e) {
|
|
|
3473
3825
|
</div>
|
|
3474
3826
|
`;
|
|
3475
3827
|
}
|
|
3476
|
-
function
|
|
3828
|
+
function Jt(e, t = "") {
|
|
3477
3829
|
return `
|
|
3478
3830
|
<div class="artifactuse-calendly-wrapper">
|
|
3479
3831
|
<iframe
|
|
@@ -3484,7 +3836,7 @@ function Ft(e, t = "") {
|
|
|
3484
3836
|
</div>
|
|
3485
3837
|
`;
|
|
3486
3838
|
}
|
|
3487
|
-
function
|
|
3839
|
+
function Yt(e) {
|
|
3488
3840
|
return `
|
|
3489
3841
|
<div class="artifactuse-google-calendar-wrapper">
|
|
3490
3842
|
<iframe
|
|
@@ -3495,7 +3847,7 @@ function Nt(e) {
|
|
|
3495
3847
|
</div>
|
|
3496
3848
|
`;
|
|
3497
3849
|
}
|
|
3498
|
-
function
|
|
3850
|
+
function er(e, t = "", r = "dark") {
|
|
3499
3851
|
return `
|
|
3500
3852
|
<div class="artifactuse-calcom-wrapper">
|
|
3501
3853
|
<iframe
|
|
@@ -3506,7 +3858,7 @@ function Ut(e, t = "", r = "dark") {
|
|
|
3506
3858
|
</div>
|
|
3507
3859
|
`;
|
|
3508
3860
|
}
|
|
3509
|
-
function
|
|
3861
|
+
function tr(e) {
|
|
3510
3862
|
return `
|
|
3511
3863
|
<div class="artifactuse-notion-wrapper">
|
|
3512
3864
|
<iframe
|
|
@@ -3518,7 +3870,7 @@ function Gt(e) {
|
|
|
3518
3870
|
</div>
|
|
3519
3871
|
`;
|
|
3520
3872
|
}
|
|
3521
|
-
function
|
|
3873
|
+
function rr(e, t) {
|
|
3522
3874
|
return `
|
|
3523
3875
|
<div class="artifactuse-airtable-wrapper">
|
|
3524
3876
|
<iframe
|
|
@@ -3529,7 +3881,7 @@ function Xt(e, t) {
|
|
|
3529
3881
|
</div>
|
|
3530
3882
|
`;
|
|
3531
3883
|
}
|
|
3532
|
-
function
|
|
3884
|
+
function ar(e) {
|
|
3533
3885
|
return `
|
|
3534
3886
|
<div class="artifactuse-miro-wrapper">
|
|
3535
3887
|
<iframe
|
|
@@ -3541,37 +3893,37 @@ function Wt(e) {
|
|
|
3541
3893
|
</div>
|
|
3542
3894
|
`;
|
|
3543
3895
|
}
|
|
3544
|
-
let
|
|
3545
|
-
function
|
|
3896
|
+
let G = null, ke = !1, Ye = !1;
|
|
3897
|
+
function $r(e) {
|
|
3546
3898
|
const t = /<pre><code class="language-mermaid">([\s\S]*?)<\/code><\/pre>/gi;
|
|
3547
3899
|
return e = e.replace(t, (r, a) => {
|
|
3548
|
-
const s =
|
|
3549
|
-
return
|
|
3900
|
+
const s = As(a).trim();
|
|
3901
|
+
return Rs(s);
|
|
3550
3902
|
}), e;
|
|
3551
3903
|
}
|
|
3552
|
-
function
|
|
3904
|
+
function As(e) {
|
|
3553
3905
|
return e.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ");
|
|
3554
3906
|
}
|
|
3555
|
-
function
|
|
3556
|
-
const t =
|
|
3907
|
+
function Rs(e) {
|
|
3908
|
+
const t = Ar(e);
|
|
3557
3909
|
return `
|
|
3558
3910
|
<div class="artifactuse-mermaid-container" data-mermaid-id="${`mermaid-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`}" data-mermaid-diagram="${t}">
|
|
3559
3911
|
<div class="artifactuse-mermaid-loading">Loading diagram...</div>
|
|
3560
3912
|
</div>
|
|
3561
3913
|
`;
|
|
3562
3914
|
}
|
|
3563
|
-
function
|
|
3915
|
+
function Ar(e) {
|
|
3564
3916
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
3565
3917
|
}
|
|
3566
|
-
function
|
|
3918
|
+
function Rr(e) {
|
|
3567
3919
|
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
3568
3920
|
}
|
|
3569
|
-
function
|
|
3570
|
-
return typeof mermaid > "u" ?
|
|
3571
|
-
console.error("Failed to load Mermaid library:", t),
|
|
3572
|
-
})) : (
|
|
3921
|
+
function Sr(e = {}) {
|
|
3922
|
+
return typeof mermaid > "u" ? ke ? (console.warn("Mermaid loading previously failed. Diagram rendering disabled."), Promise.resolve()) : (console.debug("Mermaid library not loaded. Attempting to load..."), zs().then(() => (console.log("Mermaid loaded, rendering diagrams..."), sr(e), xe())).catch((t) => {
|
|
3923
|
+
console.error("Failed to load Mermaid library:", t), ke = !0, Ss();
|
|
3924
|
+
})) : (Ye || sr(e), xe());
|
|
3573
3925
|
}
|
|
3574
|
-
function
|
|
3926
|
+
function sr(e = {}) {
|
|
3575
3927
|
if (typeof mermaid > "u") return;
|
|
3576
3928
|
const r = {
|
|
3577
3929
|
dark: "dark",
|
|
@@ -3599,9 +3951,9 @@ function Kt(e = {}) {
|
|
|
3599
3951
|
theme: r
|
|
3600
3952
|
// Ensure theme is not overridden by spread
|
|
3601
3953
|
};
|
|
3602
|
-
mermaid.initialize(a),
|
|
3954
|
+
mermaid.initialize(a), Ye = !0;
|
|
3603
3955
|
}
|
|
3604
|
-
async function
|
|
3956
|
+
async function xe() {
|
|
3605
3957
|
if (typeof mermaid > "u") {
|
|
3606
3958
|
console.warn("renderAllMermaid called but Mermaid is not available");
|
|
3607
3959
|
return;
|
|
@@ -3609,7 +3961,7 @@ async function me() {
|
|
|
3609
3961
|
const e = document.querySelectorAll(".artifactuse-mermaid-container");
|
|
3610
3962
|
for (const t of e) {
|
|
3611
3963
|
if (t.dataset.rendered === "true") continue;
|
|
3612
|
-
const r =
|
|
3964
|
+
const r = Rr(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
|
|
3613
3965
|
try {
|
|
3614
3966
|
if (await mermaid.parse(r)) {
|
|
3615
3967
|
const { svg: n } = await mermaid.render(a, r);
|
|
@@ -3619,78 +3971,78 @@ async function me() {
|
|
|
3619
3971
|
console.error("Mermaid rendering error:", s), t.innerHTML = `
|
|
3620
3972
|
<div class="artifactuse-mermaid-error">
|
|
3621
3973
|
<div class="artifactuse-mermaid-error-title">Diagram Error</div>
|
|
3622
|
-
<pre class="artifactuse-mermaid-error-message">${
|
|
3974
|
+
<pre class="artifactuse-mermaid-error-message">${Oe(s.message || "Invalid diagram syntax")}</pre>
|
|
3623
3975
|
<details class="artifactuse-mermaid-error-details">
|
|
3624
3976
|
<summary>View source</summary>
|
|
3625
|
-
<pre>${
|
|
3977
|
+
<pre>${Oe(r)}</pre>
|
|
3626
3978
|
</details>
|
|
3627
3979
|
</div>
|
|
3628
3980
|
`, t.dataset.rendered = "true", t.classList.add("artifactuse-mermaid-error-container");
|
|
3629
3981
|
}
|
|
3630
3982
|
}
|
|
3631
3983
|
}
|
|
3632
|
-
function
|
|
3984
|
+
function Ss() {
|
|
3633
3985
|
document.querySelectorAll(".artifactuse-mermaid-container").forEach((e) => {
|
|
3634
3986
|
if (e.dataset.rendered === "true") return;
|
|
3635
|
-
const t =
|
|
3987
|
+
const t = Rr(e.dataset.mermaidDiagram);
|
|
3636
3988
|
e.innerHTML = `
|
|
3637
3989
|
<div class="artifactuse-mermaid-fallback">
|
|
3638
3990
|
<div class="artifactuse-mermaid-fallback-title">Mermaid Diagram</div>
|
|
3639
|
-
<pre class="artifactuse-mermaid-fallback-source">${
|
|
3991
|
+
<pre class="artifactuse-mermaid-fallback-source">${Oe(t)}</pre>
|
|
3640
3992
|
</div>
|
|
3641
3993
|
`, e.dataset.rendered = "true", e.classList.add("artifactuse-mermaid-fallback-container");
|
|
3642
3994
|
});
|
|
3643
3995
|
}
|
|
3644
|
-
function
|
|
3996
|
+
function Oe(e) {
|
|
3645
3997
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3646
3998
|
}
|
|
3647
|
-
function
|
|
3648
|
-
return
|
|
3999
|
+
function zs() {
|
|
4000
|
+
return G || (typeof mermaid < "u" ? Promise.resolve() : (G = new Promise((e, t) => {
|
|
3649
4001
|
const r = setTimeout(() => {
|
|
3650
|
-
|
|
4002
|
+
G = null, t(new Error("Mermaid loading timed out after 15 seconds"));
|
|
3651
4003
|
}, 15e3), a = document.createElement("script");
|
|
3652
4004
|
a.src = "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js", a.crossOrigin = "anonymous", a.onload = () => {
|
|
3653
4005
|
clearTimeout(r), console.log("Mermaid script loaded successfully"), e();
|
|
3654
4006
|
}, a.onerror = (s) => {
|
|
3655
|
-
clearTimeout(r),
|
|
4007
|
+
clearTimeout(r), G = null, console.error("Mermaid script failed to load:", s), t(new Error("Failed to load Mermaid script from CDN"));
|
|
3656
4008
|
}, document.head.appendChild(a);
|
|
3657
|
-
}),
|
|
4009
|
+
}), G));
|
|
3658
4010
|
}
|
|
3659
|
-
function
|
|
3660
|
-
|
|
4011
|
+
function Js() {
|
|
4012
|
+
G = null, ke = !1, Ye = !1;
|
|
3661
4013
|
}
|
|
3662
|
-
function
|
|
4014
|
+
function Ys() {
|
|
3663
4015
|
return typeof mermaid < "u";
|
|
3664
4016
|
}
|
|
3665
|
-
function
|
|
3666
|
-
return
|
|
4017
|
+
function en() {
|
|
4018
|
+
return ke;
|
|
3667
4019
|
}
|
|
3668
|
-
function
|
|
4020
|
+
function tn(e, t = {}) {
|
|
3669
4021
|
if (!e) return Promise.resolve();
|
|
3670
4022
|
let r = e.innerHTML;
|
|
3671
|
-
return r =
|
|
4023
|
+
return r = $r(r), e.innerHTML = r, Sr(t);
|
|
3672
4024
|
}
|
|
3673
|
-
async function
|
|
4025
|
+
async function rn(e) {
|
|
3674
4026
|
const t = document.querySelector(`[data-mermaid-id="${e}"]`);
|
|
3675
|
-
t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await
|
|
4027
|
+
t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await xe());
|
|
3676
4028
|
}
|
|
3677
|
-
async function
|
|
4029
|
+
async function an(e, t) {
|
|
3678
4030
|
const r = document.querySelector(`[data-mermaid-id="${e}"]`);
|
|
3679
|
-
r && (r.dataset.mermaidDiagram =
|
|
4031
|
+
r && (r.dataset.mermaidDiagram = Ar(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await xe());
|
|
3680
4032
|
}
|
|
3681
|
-
function
|
|
4033
|
+
function Cs(e) {
|
|
3682
4034
|
const t = /<table([^>]*)>([\s\S]*?)<\/table>/gi;
|
|
3683
4035
|
let r = 0;
|
|
3684
4036
|
return e = e.replace(t, (a, s, n) => {
|
|
3685
4037
|
const o = `artifactuse-table-${r++}`;
|
|
3686
|
-
return
|
|
4038
|
+
return Ls(o, s, n);
|
|
3687
4039
|
}), e;
|
|
3688
4040
|
}
|
|
3689
|
-
function
|
|
4041
|
+
function Ls(e, t, r) {
|
|
3690
4042
|
const a = /<thead/i.test(r) || /<th/i.test(r), s = (r.match(/<tr/gi) || []).length;
|
|
3691
4043
|
if (!a || s < 3)
|
|
3692
4044
|
return `<table${t} class="artifactuse-table">${r}</table>`;
|
|
3693
|
-
const n =
|
|
4045
|
+
const n = Ms(r);
|
|
3694
4046
|
return `
|
|
3695
4047
|
<div class="artifactuse-table-container" data-table-id="${e}">
|
|
3696
4048
|
<div class="artifactuse-table-controls">
|
|
@@ -3733,7 +4085,7 @@ function ms(e, t, r) {
|
|
|
3733
4085
|
</div>
|
|
3734
4086
|
`;
|
|
3735
4087
|
}
|
|
3736
|
-
function
|
|
4088
|
+
function Ms(e) {
|
|
3737
4089
|
let t = 0;
|
|
3738
4090
|
return e = e.replace(/<th(\s[^>]*)?>([\s\S]*?)<\/th>/gi, (r, a, s) => {
|
|
3739
4091
|
const n = t++;
|
|
@@ -3752,7 +4104,7 @@ function ws(e) {
|
|
|
3752
4104
|
`;
|
|
3753
4105
|
}), e;
|
|
3754
4106
|
}
|
|
3755
|
-
function
|
|
4107
|
+
function _s(e) {
|
|
3756
4108
|
const t = e.querySelectorAll("tr"), r = [];
|
|
3757
4109
|
return t.forEach((a) => {
|
|
3758
4110
|
const s = a.querySelectorAll("th, td"), n = [];
|
|
@@ -3764,11 +4116,11 @@ function bs(e) {
|
|
|
3764
4116
|
}), r.join(`
|
|
3765
4117
|
`);
|
|
3766
4118
|
}
|
|
3767
|
-
function
|
|
4119
|
+
function Es(e, t = "table-data.csv") {
|
|
3768
4120
|
const r = new Blob([e], { type: "text/csv;charset=utf-8;" }), a = URL.createObjectURL(r), s = document.createElement("a");
|
|
3769
4121
|
s.href = a, s.download = t, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(a);
|
|
3770
4122
|
}
|
|
3771
|
-
function
|
|
4123
|
+
function Ts(e) {
|
|
3772
4124
|
const t = e.querySelectorAll("tr"), r = [];
|
|
3773
4125
|
return t.forEach((a) => {
|
|
3774
4126
|
const s = a.querySelectorAll("th, td"), n = [];
|
|
@@ -3778,20 +4130,20 @@ function vs(e) {
|
|
|
3778
4130
|
}), r.join(`
|
|
3779
4131
|
`);
|
|
3780
4132
|
}
|
|
3781
|
-
function
|
|
4133
|
+
function Ps(e, t, r = !0) {
|
|
3782
4134
|
const a = e.querySelector("tbody") || e, s = Array.from(a.querySelectorAll("tr")).filter((n) => !n.querySelector("th"));
|
|
3783
4135
|
s.sort((n, o) => {
|
|
3784
4136
|
const i = n.cells[t], l = o.cells[t];
|
|
3785
4137
|
if (!i || !l) return 0;
|
|
3786
|
-
let c = i.textContent.trim(),
|
|
3787
|
-
const p = parseFloat(c.replace(/[,$%]/g, "")),
|
|
3788
|
-
if (!isNaN(p) && !isNaN(
|
|
3789
|
-
return r ? p -
|
|
3790
|
-
const
|
|
3791
|
-
return !isNaN(
|
|
4138
|
+
let c = i.textContent.trim(), d = l.textContent.trim();
|
|
4139
|
+
const p = parseFloat(c.replace(/[,$%]/g, "")), u = parseFloat(d.replace(/[,$%]/g, ""));
|
|
4140
|
+
if (!isNaN(p) && !isNaN(u))
|
|
4141
|
+
return r ? p - u : u - p;
|
|
4142
|
+
const f = new Date(c), w = new Date(d);
|
|
4143
|
+
return !isNaN(f.getTime()) && !isNaN(w.getTime()) ? r ? f - w : w - f : r ? c.localeCompare(d) : d.localeCompare(c);
|
|
3792
4144
|
}), s.forEach((n) => a.appendChild(n));
|
|
3793
4145
|
}
|
|
3794
|
-
function
|
|
4146
|
+
function Is(e, t) {
|
|
3795
4147
|
const r = e.querySelectorAll("tbody tr, tr:not(:first-child)"), a = t.toLowerCase().trim();
|
|
3796
4148
|
let s = 0;
|
|
3797
4149
|
return r.forEach((n) => {
|
|
@@ -3803,13 +4155,13 @@ function xs(e, t) {
|
|
|
3803
4155
|
n.style.display = i ? "" : "none", i && s++;
|
|
3804
4156
|
}), s;
|
|
3805
4157
|
}
|
|
3806
|
-
function
|
|
4158
|
+
function js() {
|
|
3807
4159
|
document.querySelectorAll("[data-table-search]").forEach((e) => {
|
|
3808
4160
|
const t = e.dataset.tableSearch, r = document.getElementById(t), a = document.querySelector(`[data-table-count="${t}"]`);
|
|
3809
4161
|
if (r) {
|
|
3810
4162
|
const s = r.querySelectorAll("tbody tr, tr:not(:first-child)"), n = Array.from(s).filter((o) => !o.querySelector("th")).length;
|
|
3811
4163
|
a && (a.textContent = `${n} rows`), e.addEventListener("input", (o) => {
|
|
3812
|
-
const i =
|
|
4164
|
+
const i = Is(r, o.target.value);
|
|
3813
4165
|
a && (a.textContent = o.target.value ? `${i} of ${n} rows` : `${n} rows`);
|
|
3814
4166
|
});
|
|
3815
4167
|
}
|
|
@@ -3818,21 +4170,21 @@ function $s() {
|
|
|
3818
4170
|
const t = e.closest("table"), r = parseInt(e.dataset.sortCol), s = e.dataset.sortDir !== "asc";
|
|
3819
4171
|
t.querySelectorAll(".artifactuse-sortable-header").forEach((n) => {
|
|
3820
4172
|
n.dataset.sortDir = "", n.classList.remove("sort-asc", "sort-desc");
|
|
3821
|
-
}), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"),
|
|
4173
|
+
}), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), Ps(t, r, s);
|
|
3822
4174
|
});
|
|
3823
4175
|
}), document.querySelectorAll("[data-table-export]").forEach((e) => {
|
|
3824
4176
|
e.addEventListener("click", () => {
|
|
3825
4177
|
const t = e.dataset.tableExport, r = document.getElementById(t);
|
|
3826
4178
|
if (r) {
|
|
3827
|
-
const a =
|
|
3828
|
-
|
|
4179
|
+
const a = _s(r);
|
|
4180
|
+
Es(a, `${t}.csv`);
|
|
3829
4181
|
}
|
|
3830
4182
|
});
|
|
3831
4183
|
}), document.querySelectorAll("[data-table-copy]").forEach((e) => {
|
|
3832
4184
|
e.addEventListener("click", async () => {
|
|
3833
4185
|
const t = e.dataset.tableCopy, r = document.getElementById(t);
|
|
3834
4186
|
if (r) {
|
|
3835
|
-
const a =
|
|
4187
|
+
const a = Ts(r);
|
|
3836
4188
|
try {
|
|
3837
4189
|
await navigator.clipboard.writeText(a);
|
|
3838
4190
|
const s = e.querySelector("span"), n = s ? s.textContent : "";
|
|
@@ -3846,52 +4198,52 @@ function $s() {
|
|
|
3846
4198
|
});
|
|
3847
4199
|
});
|
|
3848
4200
|
}
|
|
3849
|
-
let
|
|
3850
|
-
function
|
|
3851
|
-
return e =
|
|
4201
|
+
let W = null, $e = !1;
|
|
4202
|
+
function zr(e) {
|
|
4203
|
+
return e = Zs(e), e = e.replace(/\$\$([\s\S]*?)\$\$/g, (t, r) => ce(r.trim(), !0)), e = e.replace(/\\\[([\s\S]*?)\\\]/g, (t, r) => ce(r.trim(), !0)), e = e.replace(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+?)\\$(?!\\$)", "g"), (t, r) => ce(r.trim(), !1)), e = e.replace(/\\\(([\s\S]*?)\\\)/g, (t, r) => ce(r.trim(), !1)), e;
|
|
3852
4204
|
}
|
|
3853
|
-
function
|
|
4205
|
+
function Zs(e) {
|
|
3854
4206
|
const t = /<pre><code class="language-(math|latex)">([\s\S]*?)<\/code><\/pre>/gi;
|
|
3855
4207
|
return e = e.replace(t, (r, a, s) => {
|
|
3856
|
-
const n =
|
|
3857
|
-
return
|
|
4208
|
+
const n = qs(s).trim();
|
|
4209
|
+
return ce(n, !0);
|
|
3858
4210
|
}), e;
|
|
3859
4211
|
}
|
|
3860
|
-
function
|
|
4212
|
+
function qs(e) {
|
|
3861
4213
|
return e.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ");
|
|
3862
4214
|
}
|
|
3863
|
-
function
|
|
3864
|
-
const r =
|
|
4215
|
+
function ce(e, t = !1) {
|
|
4216
|
+
const r = Hs(e);
|
|
3865
4217
|
return `<span class="artifactuse-math-container ${t ? "artifactuse-math-display" : "artifactuse-math-inline"}" data-tex="${r}" data-display="${t ? "true" : "false"}"></span>`;
|
|
3866
4218
|
}
|
|
3867
|
-
function
|
|
4219
|
+
function Hs(e) {
|
|
3868
4220
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
3869
4221
|
}
|
|
3870
|
-
function
|
|
4222
|
+
function Cr(e) {
|
|
3871
4223
|
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
3872
4224
|
}
|
|
3873
|
-
function
|
|
3874
|
-
return typeof katex > "u" ?
|
|
3875
|
-
console.log("KaTeX loaded, rendering math..."),
|
|
4225
|
+
function Lr() {
|
|
4226
|
+
return typeof katex > "u" ? $e ? (console.warn("KaTeX loading previously failed. Math rendering disabled."), Promise.resolve()) : (console.debug("KaTeX library not loaded. Attempting to load..."), Os().then(() => {
|
|
4227
|
+
console.log("KaTeX loaded, rendering math..."), nr();
|
|
3876
4228
|
}).catch((e) => {
|
|
3877
|
-
console.error("Failed to load KaTeX library:", e),
|
|
3878
|
-
})) : (
|
|
4229
|
+
console.error("Failed to load KaTeX library:", e), $e = !0, Ds();
|
|
4230
|
+
})) : (nr(), Promise.resolve());
|
|
3879
4231
|
}
|
|
3880
|
-
function
|
|
4232
|
+
function Ds() {
|
|
3881
4233
|
document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
|
|
3882
4234
|
if (e.dataset.rendered === "true") return;
|
|
3883
|
-
const t =
|
|
3884
|
-
e.innerHTML = `<code class="artifactuse-math-fallback" title="Math rendering unavailable">${
|
|
4235
|
+
const t = Cr(e.dataset.tex);
|
|
4236
|
+
e.innerHTML = `<code class="artifactuse-math-fallback" title="Math rendering unavailable">${Be(t)}</code>`, e.dataset.rendered = "true", e.classList.add("artifactuse-math-fallback-container");
|
|
3885
4237
|
});
|
|
3886
4238
|
}
|
|
3887
|
-
function
|
|
4239
|
+
function nr() {
|
|
3888
4240
|
if (typeof katex > "u") {
|
|
3889
4241
|
console.warn("renderAllMath called but KaTeX is not available");
|
|
3890
4242
|
return;
|
|
3891
4243
|
}
|
|
3892
4244
|
document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
|
|
3893
4245
|
if (e.dataset.rendered === "true") return;
|
|
3894
|
-
const t =
|
|
4246
|
+
const t = Cr(e.dataset.tex), r = e.dataset.display === "true";
|
|
3895
4247
|
try {
|
|
3896
4248
|
katex.render(t, e, {
|
|
3897
4249
|
displayMode: r,
|
|
@@ -3912,17 +4264,17 @@ function Qt() {
|
|
|
3912
4264
|
}
|
|
3913
4265
|
}), e.dataset.rendered = "true";
|
|
3914
4266
|
} catch (a) {
|
|
3915
|
-
console.error("KaTeX rendering error:", a), e.innerHTML = `<span class="artifactuse-math-error" title="${
|
|
4267
|
+
console.error("KaTeX rendering error:", a), e.innerHTML = `<span class="artifactuse-math-error" title="${Be(a.message)}">${Be(t)}</span>`, e.dataset.rendered = "true";
|
|
3916
4268
|
}
|
|
3917
4269
|
});
|
|
3918
4270
|
}
|
|
3919
|
-
function
|
|
4271
|
+
function Be(e) {
|
|
3920
4272
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3921
4273
|
}
|
|
3922
|
-
function
|
|
3923
|
-
return
|
|
4274
|
+
function Os() {
|
|
4275
|
+
return W || (typeof katex < "u" ? Promise.resolve() : (W = new Promise((e, t) => {
|
|
3924
4276
|
const r = setTimeout(() => {
|
|
3925
|
-
|
|
4277
|
+
W = null, t(new Error("KaTeX loading timed out after 10 seconds"));
|
|
3926
4278
|
}, 1e4), a = document.createElement("link");
|
|
3927
4279
|
a.rel = "stylesheet", a.href = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css", a.crossOrigin = "anonymous", a.onerror = () => {
|
|
3928
4280
|
console.warn("KaTeX CSS failed to load, math may not render correctly");
|
|
@@ -3931,25 +4283,25 @@ function _s() {
|
|
|
3931
4283
|
s.src = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js", s.crossOrigin = "anonymous", s.onload = () => {
|
|
3932
4284
|
clearTimeout(r), console.log("KaTeX script loaded successfully"), e();
|
|
3933
4285
|
}, s.onerror = (n) => {
|
|
3934
|
-
clearTimeout(r),
|
|
4286
|
+
clearTimeout(r), W = null, console.error("KaTeX script failed to load:", n), t(new Error("Failed to load KaTeX script from CDN"));
|
|
3935
4287
|
}, document.head.appendChild(s);
|
|
3936
|
-
}),
|
|
4288
|
+
}), W));
|
|
3937
4289
|
}
|
|
3938
|
-
function
|
|
3939
|
-
|
|
4290
|
+
function sn() {
|
|
4291
|
+
W = null, $e = !1;
|
|
3940
4292
|
}
|
|
3941
|
-
function
|
|
4293
|
+
function nn() {
|
|
3942
4294
|
return typeof katex < "u";
|
|
3943
4295
|
}
|
|
3944
|
-
function
|
|
3945
|
-
return
|
|
4296
|
+
function on() {
|
|
4297
|
+
return $e;
|
|
3946
4298
|
}
|
|
3947
|
-
function
|
|
4299
|
+
function cn(e) {
|
|
3948
4300
|
if (!e) return Promise.resolve();
|
|
3949
4301
|
let t = e.innerHTML;
|
|
3950
|
-
return t =
|
|
4302
|
+
return t = zr(t), e.innerHTML = t, Lr();
|
|
3951
4303
|
}
|
|
3952
|
-
const
|
|
4304
|
+
const ln = {
|
|
3953
4305
|
// Fractions
|
|
3954
4306
|
fraction: (e, t) => `\\frac{${e}}{${t}}`,
|
|
3955
4307
|
// Square root
|
|
@@ -3982,11 +4334,11 @@ const Ws = {
|
|
|
3982
4334
|
derivative: (e, t) => `\\frac{d${e}}{d${t}}`,
|
|
3983
4335
|
partialDerivative: (e, t) => `\\frac{\\partial ${e}}{\\partial ${t}}`
|
|
3984
4336
|
};
|
|
3985
|
-
function
|
|
4337
|
+
function pe() {
|
|
3986
4338
|
return typeof window < "u" && window.Prism;
|
|
3987
4339
|
}
|
|
3988
|
-
function
|
|
3989
|
-
if (!
|
|
4340
|
+
function Mr(e) {
|
|
4341
|
+
if (!pe()) {
|
|
3990
4342
|
console.warn("Artifactuse: Prism.js not found. Install and include Prism.js for syntax highlighting.");
|
|
3991
4343
|
return;
|
|
3992
4344
|
}
|
|
@@ -3994,24 +4346,24 @@ function xr(e) {
|
|
|
3994
4346
|
if (!t) return;
|
|
3995
4347
|
t.querySelectorAll("pre code").forEach((a) => {
|
|
3996
4348
|
if (a.classList.contains("prism-highlighted")) return;
|
|
3997
|
-
const s =
|
|
4349
|
+
const s = Bs(a);
|
|
3998
4350
|
s && (a.className.includes(`language-${s}`) || a.classList.add(`language-${s}`), window.Prism.highlightElement(a), a.classList.add("prism-highlighted"));
|
|
3999
4351
|
});
|
|
4000
4352
|
}
|
|
4001
|
-
function
|
|
4002
|
-
|
|
4353
|
+
function un(e, t) {
|
|
4354
|
+
pe() && (t && !e.className.includes(`language-${t}`) && e.classList.add(`language-${t}`), window.Prism.highlightElement(e), e.classList.add("prism-highlighted"));
|
|
4003
4355
|
}
|
|
4004
|
-
function
|
|
4005
|
-
if (!
|
|
4356
|
+
function dn(e, t) {
|
|
4357
|
+
if (!pe()) return ir(e);
|
|
4006
4358
|
const r = window.Prism.languages[t];
|
|
4007
|
-
return r ? window.Prism.highlight(e, r, t) :
|
|
4359
|
+
return r ? window.Prism.highlight(e, r, t) : ir(e);
|
|
4008
4360
|
}
|
|
4009
|
-
function
|
|
4361
|
+
function Bs(e) {
|
|
4010
4362
|
const t = e.className.split(/\s+/);
|
|
4011
4363
|
for (const s of t) {
|
|
4012
4364
|
const n = s.match(/^(?:language-|lang-)(.+)$/);
|
|
4013
4365
|
if (n)
|
|
4014
|
-
return
|
|
4366
|
+
return Me(n[1]);
|
|
4015
4367
|
}
|
|
4016
4368
|
const r = e.closest("pre");
|
|
4017
4369
|
if (r) {
|
|
@@ -4019,13 +4371,13 @@ function Ls(e) {
|
|
|
4019
4371
|
for (const n of s) {
|
|
4020
4372
|
const o = n.match(/^(?:language-|lang-)(.+)$/);
|
|
4021
4373
|
if (o)
|
|
4022
|
-
return
|
|
4374
|
+
return Me(o[1]);
|
|
4023
4375
|
}
|
|
4024
4376
|
}
|
|
4025
4377
|
const a = e.dataset.language || (r == null ? void 0 : r.dataset.language);
|
|
4026
|
-
return a ?
|
|
4378
|
+
return a ? Me(a) : null;
|
|
4027
4379
|
}
|
|
4028
|
-
function
|
|
4380
|
+
function Me(e) {
|
|
4029
4381
|
const t = {
|
|
4030
4382
|
js: "javascript",
|
|
4031
4383
|
ts: "typescript",
|
|
@@ -4051,11 +4403,11 @@ function Re(e) {
|
|
|
4051
4403
|
}, r = e.toLowerCase();
|
|
4052
4404
|
return t[r] || r;
|
|
4053
4405
|
}
|
|
4054
|
-
function
|
|
4406
|
+
function ir(e) {
|
|
4055
4407
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
4056
4408
|
}
|
|
4057
|
-
function
|
|
4058
|
-
if (!
|
|
4409
|
+
function pn(e) {
|
|
4410
|
+
if (!pe())
|
|
4059
4411
|
return console.warn("Artifactuse: Prism.js not found. Auto-highlighting disabled."), null;
|
|
4060
4412
|
const t = new MutationObserver((r) => {
|
|
4061
4413
|
let a = !1;
|
|
@@ -4067,42 +4419,42 @@ function Js(e) {
|
|
|
4067
4419
|
break;
|
|
4068
4420
|
}
|
|
4069
4421
|
}
|
|
4070
|
-
a &&
|
|
4422
|
+
a && Mr(e);
|
|
4071
4423
|
});
|
|
4072
4424
|
return t.observe(e, {
|
|
4073
4425
|
childList: !0,
|
|
4074
4426
|
subtree: !0
|
|
4075
4427
|
}), t;
|
|
4076
4428
|
}
|
|
4077
|
-
function
|
|
4078
|
-
return
|
|
4429
|
+
function fn() {
|
|
4430
|
+
return pe() ? Object.keys(window.Prism.languages).filter(
|
|
4079
4431
|
(e) => typeof window.Prism.languages[e] == "object"
|
|
4080
4432
|
) : [];
|
|
4081
4433
|
}
|
|
4082
|
-
function
|
|
4434
|
+
function ge(e) {
|
|
4083
4435
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
4084
4436
|
}
|
|
4085
|
-
function
|
|
4437
|
+
function Fs() {
|
|
4086
4438
|
const e = {
|
|
4087
4439
|
image(a) {
|
|
4088
4440
|
const s = typeof a == "string" ? a : a.href, n = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
|
|
4089
|
-
return
|
|
4441
|
+
return Pe(s || "", n || "", o || "");
|
|
4090
4442
|
}
|
|
4091
4443
|
}, t = {
|
|
4092
4444
|
link(a) {
|
|
4093
4445
|
const s = typeof a == "string" ? a : a.href, n = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
|
|
4094
|
-
if (
|
|
4095
|
-
return
|
|
4096
|
-
const i = n ? ` title="${
|
|
4097
|
-
return `<a href="${
|
|
4446
|
+
if (Ka(s))
|
|
4447
|
+
return Ja(s);
|
|
4448
|
+
const i = n ? ` title="${ge(n)}"` : "";
|
|
4449
|
+
return `<a href="${ge(s || "")}" target="_blank" rel="noopener noreferrer"${i}>${o || ""}</a>`;
|
|
4098
4450
|
}
|
|
4099
4451
|
}, r = {
|
|
4100
4452
|
code(a) {
|
|
4101
|
-
const s = typeof a == "string" ? a : a.text, o = (typeof a == "string" ? arguments[1] : a.lang) || "", i =
|
|
4102
|
-
return o ? `<pre><code class="language-${
|
|
4453
|
+
const s = typeof a == "string" ? a : a.text, o = (typeof a == "string" ? arguments[1] : a.lang) || "", i = ge(s || "");
|
|
4454
|
+
return o ? `<pre><code class="language-${ge(o)}">${i}</code></pre>` : `<pre><code>${i}</code></pre>`;
|
|
4103
4455
|
}
|
|
4104
4456
|
};
|
|
4105
|
-
|
|
4457
|
+
_.use({
|
|
4106
4458
|
renderer: {
|
|
4107
4459
|
...e,
|
|
4108
4460
|
...t,
|
|
@@ -4112,8 +4464,8 @@ function Ms() {
|
|
|
4112
4464
|
breaks: !0
|
|
4113
4465
|
});
|
|
4114
4466
|
}
|
|
4115
|
-
|
|
4116
|
-
const
|
|
4467
|
+
Fs();
|
|
4468
|
+
const _r = {
|
|
4117
4469
|
// Structured artifact types
|
|
4118
4470
|
form: "form-panel",
|
|
4119
4471
|
// Visual editors
|
|
@@ -4130,6 +4482,8 @@ const $r = {
|
|
|
4130
4482
|
// Diff/patches
|
|
4131
4483
|
diff: "diff-panel",
|
|
4132
4484
|
patch: "diff-panel",
|
|
4485
|
+
// Plain text
|
|
4486
|
+
txt: "code-panel",
|
|
4133
4487
|
// Programming languages
|
|
4134
4488
|
javascript: "code-panel",
|
|
4135
4489
|
js: "code-panel",
|
|
@@ -4146,7 +4500,7 @@ const $r = {
|
|
|
4146
4500
|
md: "html-panel",
|
|
4147
4501
|
// Diagrams
|
|
4148
4502
|
mermaid: "mermaid-panel"
|
|
4149
|
-
},
|
|
4503
|
+
}, Vs = {
|
|
4150
4504
|
// CDN URL for panel artifacts (video editor, canvas, etc.)
|
|
4151
4505
|
cdnUrl: "https://cdn.artifactuse.com",
|
|
4152
4506
|
// Theme: 'dark' | 'light' | 'auto'
|
|
@@ -4216,7 +4570,7 @@ const $r = {
|
|
|
4216
4570
|
expiryDays: 30
|
|
4217
4571
|
}
|
|
4218
4572
|
};
|
|
4219
|
-
function
|
|
4573
|
+
function Er(e, t) {
|
|
4220
4574
|
if (e == null)
|
|
4221
4575
|
return null;
|
|
4222
4576
|
try {
|
|
@@ -4231,7 +4585,7 @@ function Ar(e, t) {
|
|
|
4231
4585
|
}
|
|
4232
4586
|
return null;
|
|
4233
4587
|
}
|
|
4234
|
-
function
|
|
4588
|
+
function Ns(e, t) {
|
|
4235
4589
|
const r = /* @__PURE__ */ new Set();
|
|
4236
4590
|
try {
|
|
4237
4591
|
r.add(new URL(t).origin);
|
|
@@ -4239,43 +4593,43 @@ function Ts(e, t) {
|
|
|
4239
4593
|
console.warn("Artifactuse: Invalid default CDN URL:", t);
|
|
4240
4594
|
}
|
|
4241
4595
|
for (const a of Object.values(e)) {
|
|
4242
|
-
const s =
|
|
4596
|
+
const s = Er(a, t);
|
|
4243
4597
|
s && r.add(s);
|
|
4244
4598
|
}
|
|
4245
4599
|
return [...r];
|
|
4246
4600
|
}
|
|
4247
|
-
function
|
|
4248
|
-
const r = {
|
|
4601
|
+
function Us(e, t) {
|
|
4602
|
+
const r = { ..._r };
|
|
4249
4603
|
if (e.panels)
|
|
4250
4604
|
for (const [l, c] of Object.entries(e.panels))
|
|
4251
4605
|
if (Array.isArray(l))
|
|
4252
|
-
l.forEach((
|
|
4253
|
-
const p =
|
|
4606
|
+
l.forEach((d) => {
|
|
4607
|
+
const p = d == null ? void 0 : d.toLowerCase();
|
|
4254
4608
|
p && (r[p] = c);
|
|
4255
4609
|
});
|
|
4256
4610
|
else {
|
|
4257
|
-
const
|
|
4258
|
-
|
|
4611
|
+
const d = l == null ? void 0 : l.toLowerCase();
|
|
4612
|
+
d && (r[d] = c);
|
|
4259
4613
|
}
|
|
4260
4614
|
function a(l, c = {}) {
|
|
4261
|
-
const
|
|
4262
|
-
if (!
|
|
4263
|
-
const p = r[
|
|
4615
|
+
const d = l == null ? void 0 : l.toLowerCase();
|
|
4616
|
+
if (!d) return null;
|
|
4617
|
+
const p = r[d];
|
|
4264
4618
|
if (p === null || p === void 0) return null;
|
|
4265
|
-
let
|
|
4619
|
+
let u;
|
|
4266
4620
|
if (typeof p == "string")
|
|
4267
|
-
p.startsWith("http://") || p.startsWith("https://") ?
|
|
4621
|
+
p.startsWith("http://") || p.startsWith("https://") ? u = p : u = `${e.cdnUrl}/${p}`;
|
|
4268
4622
|
else if (typeof p == "object" && p.path)
|
|
4269
|
-
|
|
4623
|
+
u = `${p.cdn || e.cdnUrl}/${p.path}`;
|
|
4270
4624
|
else
|
|
4271
4625
|
return null;
|
|
4272
|
-
|
|
4273
|
-
const
|
|
4274
|
-
c.theme &&
|
|
4275
|
-
|
|
4626
|
+
u.endsWith("/") || (u += "");
|
|
4627
|
+
const f = new URLSearchParams();
|
|
4628
|
+
c.theme && f.set("theme", c.theme), c.accent && f.set("accent", c.accent), c.params && Object.entries(c.params).forEach(([h, m]) => {
|
|
4629
|
+
f.set(h, m);
|
|
4276
4630
|
});
|
|
4277
|
-
const w =
|
|
4278
|
-
return w ? `${
|
|
4631
|
+
const w = f.toString();
|
|
4632
|
+
return w ? `${u}?${w}` : u;
|
|
4279
4633
|
}
|
|
4280
4634
|
function s(l) {
|
|
4281
4635
|
const c = l == null ? void 0 : l.toLowerCase();
|
|
@@ -4285,16 +4639,16 @@ function Cs(e, t) {
|
|
|
4285
4639
|
return Object.keys(r).filter((l) => r[l] !== null);
|
|
4286
4640
|
}
|
|
4287
4641
|
function o(l, c) {
|
|
4288
|
-
(Array.isArray(l) ? l : [l]).forEach((
|
|
4289
|
-
const
|
|
4290
|
-
|
|
4642
|
+
(Array.isArray(l) ? l : [l]).forEach((u) => {
|
|
4643
|
+
const f = u == null ? void 0 : u.toLowerCase();
|
|
4644
|
+
f && (r[f] = c);
|
|
4291
4645
|
});
|
|
4292
|
-
const p =
|
|
4646
|
+
const p = Er(c, e.cdnUrl);
|
|
4293
4647
|
p && t && t.addAllowedOrigin(p);
|
|
4294
4648
|
}
|
|
4295
4649
|
function i(l) {
|
|
4296
|
-
(Array.isArray(l) ? l : [l]).forEach((
|
|
4297
|
-
const p =
|
|
4650
|
+
(Array.isArray(l) ? l : [l]).forEach((d) => {
|
|
4651
|
+
const p = d == null ? void 0 : d.toLowerCase();
|
|
4298
4652
|
p && (r[p] = null);
|
|
4299
4653
|
});
|
|
4300
4654
|
}
|
|
@@ -4310,104 +4664,113 @@ function Cs(e, t) {
|
|
|
4310
4664
|
}
|
|
4311
4665
|
};
|
|
4312
4666
|
}
|
|
4313
|
-
function
|
|
4314
|
-
const t =
|
|
4315
|
-
function
|
|
4316
|
-
let
|
|
4667
|
+
function hn(e = {}) {
|
|
4668
|
+
const t = Tr(Vs, e), r = Qr(), a = { ..._r, ...t.panels }, s = Ns(a, t.cdnUrl), n = Jr(s), o = ta(t.theme, t.colors || {}), i = Us(t, n), l = ca(t.sharing), c = la(t.editor);
|
|
4669
|
+
function d(k, M) {
|
|
4670
|
+
let x = _.parse(k);
|
|
4317
4671
|
const j = [], I = { theme: o.resolved };
|
|
4318
4672
|
if (t.processors.codeBlocks) {
|
|
4319
|
-
const
|
|
4320
|
-
|
|
4673
|
+
const P = Kr(x, M, t.codeExtraction);
|
|
4674
|
+
x = P.html, j.push(...P.artifacts);
|
|
4321
4675
|
}
|
|
4322
|
-
return t.processors.images && (
|
|
4323
|
-
r.addArtifact(
|
|
4676
|
+
return t.processors.images && (x = Wa(x)), t.processors.imageGalleries && (x = Xa(x)), t.processors.videos && (x = Ya(x)), t.processors.videoGalleries && (x = as(x)), t.processors.audio && (x = is(x, I)), t.processors.maps && (x = hs(x)), t.processors.social && (x = gs(x, I)), t.processors.documents && (x = ms(x), x = bs(x), x = ws(x)), t.processors.codeEmbeds && (x = vs(x, I)), t.processors.dataViz && (x = ks(x)), t.processors.design && (x = xs(x, I)), t.processors.interactive && (x = $s(x, I)), t.processors.tables && (x = Cs(x)), t.processors.math && (x = zr(x)), t.processors.mermaid && (x = $r(x)), j.forEach((P) => {
|
|
4677
|
+
r.addArtifact(P);
|
|
4324
4678
|
}), {
|
|
4325
|
-
html:
|
|
4679
|
+
html: x,
|
|
4326
4680
|
artifacts: j
|
|
4327
4681
|
};
|
|
4328
4682
|
}
|
|
4329
|
-
async function
|
|
4330
|
-
const
|
|
4331
|
-
t.processors.math &&
|
|
4683
|
+
async function p(k = document) {
|
|
4684
|
+
const M = [], x = { theme: o.resolved };
|
|
4685
|
+
t.processors.math && M.push(Lr()), t.processors.mermaid && M.push(Sr(x)), t.processors.tables && js(), t.processors.audio && cs(k), t.syntaxHighlight && Mr(k), await Promise.all(M);
|
|
4332
4686
|
}
|
|
4333
|
-
function
|
|
4687
|
+
function u(k) {
|
|
4334
4688
|
if (k.isInline) {
|
|
4335
4689
|
console.warn("Attempted to open inline artifact in panel:", k.id);
|
|
4336
4690
|
return;
|
|
4337
4691
|
}
|
|
4338
|
-
r.setActiveArtifact(k.id), r.setPanelOpen(!0),
|
|
4692
|
+
r.setActiveArtifact(k.id), r.setPanelOpen(!0), z("artifact:opened", k);
|
|
4339
4693
|
}
|
|
4340
|
-
function
|
|
4341
|
-
|
|
4694
|
+
function f(k, M, x = {}) {
|
|
4695
|
+
const j = k.split(".").pop(), I = x.language || Fr(j) || j, P = x.title || k;
|
|
4696
|
+
return w(M, I, { ...x, title: P });
|
|
4342
4697
|
}
|
|
4343
|
-
function
|
|
4698
|
+
function w(k, M, x = {}) {
|
|
4699
|
+
const j = x.messageId || Dr("open"), I = y({ type: M, language: M }) ? M : "txt", P = be(k, I, j, 0);
|
|
4700
|
+
return P.title = x.title || P.title, P.isInline = !1, x.tabs && (P.tabs = x.tabs), x.panelUrl && (P.panelUrl = x.panelUrl), r.addArtifact(P), u(P), x.viewMode ? r.setViewMode(x.viewMode) : x.tabs && r.setViewMode(x.tabs[0]), P;
|
|
4701
|
+
}
|
|
4702
|
+
function h() {
|
|
4703
|
+
r.setPanelOpen(!1), r.setFullscreen(!1), z("panel:closed");
|
|
4704
|
+
}
|
|
4705
|
+
function m() {
|
|
4344
4706
|
const k = !r.getState().isPanelOpen;
|
|
4345
|
-
r.clearActiveArtifact(), r.setPanelOpen(k), k || r.setFullscreen(!1),
|
|
4707
|
+
r.clearActiveArtifact(), r.setPanelOpen(k), k || r.setFullscreen(!1), z("panel:toggled", { isOpen: k });
|
|
4346
4708
|
}
|
|
4347
|
-
function
|
|
4709
|
+
function g() {
|
|
4348
4710
|
const k = !r.getState().isFullscreen;
|
|
4349
|
-
r.setFullscreen(k),
|
|
4711
|
+
r.setFullscreen(k), z("fullscreen:toggled", { isFullscreen: k });
|
|
4350
4712
|
}
|
|
4351
|
-
function
|
|
4352
|
-
r.setViewMode(k),
|
|
4713
|
+
function b(k) {
|
|
4714
|
+
r.setViewMode(k), z("viewMode:changed", { mode: k });
|
|
4353
4715
|
}
|
|
4354
|
-
function
|
|
4716
|
+
function v(k, M = {}) {
|
|
4355
4717
|
if (!k) return null;
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4718
|
+
if (k.panelUrl) return k.panelUrl;
|
|
4719
|
+
const { type: x, language: j } = k, I = {
|
|
4720
|
+
theme: M.theme || o.resolved
|
|
4721
|
+
}, P = o.colors;
|
|
4722
|
+
P != null && P.primary && (I.accent = P.primary);
|
|
4723
|
+
let Y = i.resolve(x, I);
|
|
4724
|
+
return !Y && j && (Y = i.resolve(j, I)), Y;
|
|
4725
|
+
}
|
|
4726
|
+
function y(k) {
|
|
4364
4727
|
return k ? i.has(k.type) || i.has(k.language) : !1;
|
|
4365
4728
|
}
|
|
4366
|
-
function
|
|
4367
|
-
i.register(k,
|
|
4729
|
+
function $(k, M) {
|
|
4730
|
+
i.register(k, M);
|
|
4368
4731
|
}
|
|
4369
|
-
function
|
|
4732
|
+
function A(k) {
|
|
4370
4733
|
i.unregister(k);
|
|
4371
4734
|
}
|
|
4372
|
-
function
|
|
4735
|
+
function S() {
|
|
4373
4736
|
return i.getTypes();
|
|
4374
4737
|
}
|
|
4375
|
-
function
|
|
4376
|
-
n.send(k,
|
|
4738
|
+
function C(k, M) {
|
|
4739
|
+
n.send(k, M);
|
|
4377
4740
|
}
|
|
4378
|
-
const
|
|
4379
|
-
function
|
|
4380
|
-
return
|
|
4381
|
-
var
|
|
4382
|
-
(
|
|
4741
|
+
const q = /* @__PURE__ */ new Map();
|
|
4742
|
+
function R(k, M) {
|
|
4743
|
+
return q.has(k) || q.set(k, /* @__PURE__ */ new Set()), q.get(k).add(M), () => {
|
|
4744
|
+
var x;
|
|
4745
|
+
(x = q.get(k)) == null || x.delete(M);
|
|
4383
4746
|
};
|
|
4384
4747
|
}
|
|
4385
|
-
function
|
|
4386
|
-
var
|
|
4387
|
-
(
|
|
4748
|
+
function T(k, M) {
|
|
4749
|
+
var x;
|
|
4750
|
+
(x = q.get(k)) == null || x.delete(M);
|
|
4388
4751
|
}
|
|
4389
|
-
function
|
|
4390
|
-
var
|
|
4391
|
-
(
|
|
4752
|
+
function z(k, M) {
|
|
4753
|
+
var x;
|
|
4754
|
+
(x = q.get(k)) == null || x.forEach((j) => {
|
|
4392
4755
|
try {
|
|
4393
|
-
j(
|
|
4756
|
+
j(M);
|
|
4394
4757
|
} catch (I) {
|
|
4395
4758
|
console.error(`Artifactuse event handler error (${k}):`, I);
|
|
4396
4759
|
}
|
|
4397
4760
|
});
|
|
4398
4761
|
}
|
|
4399
|
-
n.on("ai:request", (k) =>
|
|
4400
|
-
function
|
|
4762
|
+
n.on("ai:request", (k) => z("ai:request", k)), n.on("save:request", (k) => z("save:request", k)), n.on("export:complete", (k) => z("export:complete", k)), n.on("form:submit", (k) => z("form:submit", k)), n.on("form:cancel", (k) => z("form:cancel", k)), n.on("form:step", (k) => z("form:step", k)), n.on("social:copy", (k) => z("social:copy", k));
|
|
4763
|
+
function Z() {
|
|
4401
4764
|
o.apply();
|
|
4402
4765
|
}
|
|
4403
|
-
function
|
|
4766
|
+
function D(k) {
|
|
4404
4767
|
o.set(k);
|
|
4405
4768
|
}
|
|
4406
|
-
function
|
|
4769
|
+
function U() {
|
|
4407
4770
|
return o.resolved;
|
|
4408
4771
|
}
|
|
4409
|
-
function
|
|
4410
|
-
n.destroy(),
|
|
4772
|
+
function J() {
|
|
4773
|
+
n.destroy(), q.clear(), r.clear(), fs();
|
|
4411
4774
|
}
|
|
4412
4775
|
return {
|
|
4413
4776
|
// Config
|
|
@@ -4417,41 +4780,45 @@ function en(e = {}) {
|
|
|
4417
4780
|
getState: () => r.getState(),
|
|
4418
4781
|
subscribe: r.subscribe,
|
|
4419
4782
|
// Processing
|
|
4420
|
-
processMessage:
|
|
4421
|
-
initializeContent:
|
|
4783
|
+
processMessage: d,
|
|
4784
|
+
initializeContent: p,
|
|
4422
4785
|
// Panel control
|
|
4423
|
-
openArtifact:
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4786
|
+
openArtifact: u,
|
|
4787
|
+
openFile: f,
|
|
4788
|
+
openCode: w,
|
|
4789
|
+
closePanel: h,
|
|
4790
|
+
togglePanel: m,
|
|
4791
|
+
toggleFullscreen: g,
|
|
4792
|
+
setViewMode: b,
|
|
4793
|
+
getPanelUrl: v,
|
|
4794
|
+
sendToPanel: C,
|
|
4430
4795
|
// Panel management (new)
|
|
4431
|
-
hasPanel:
|
|
4432
|
-
registerPanel:
|
|
4433
|
-
unregisterPanel:
|
|
4434
|
-
getPanelTypes:
|
|
4796
|
+
hasPanel: y,
|
|
4797
|
+
registerPanel: $,
|
|
4798
|
+
unregisterPanel: A,
|
|
4799
|
+
getPanelTypes: S,
|
|
4435
4800
|
panelResolver: i,
|
|
4436
4801
|
// Expose for advanced use
|
|
4437
4802
|
// Theme
|
|
4438
4803
|
theme: o,
|
|
4439
|
-
applyTheme:
|
|
4440
|
-
setTheme:
|
|
4441
|
-
getTheme:
|
|
4804
|
+
applyTheme: Z,
|
|
4805
|
+
setTheme: D,
|
|
4806
|
+
getTheme: U,
|
|
4442
4807
|
// Events
|
|
4443
|
-
on:
|
|
4444
|
-
off:
|
|
4445
|
-
emit:
|
|
4808
|
+
on: R,
|
|
4809
|
+
off: T,
|
|
4810
|
+
emit: z,
|
|
4811
|
+
// Editor (CodeMirror integration)
|
|
4812
|
+
editor: c,
|
|
4446
4813
|
// Bridge (for advanced use)
|
|
4447
4814
|
bridge: n,
|
|
4448
4815
|
// Sharing
|
|
4449
4816
|
share: l,
|
|
4450
4817
|
// Cleanup
|
|
4451
|
-
destroy:
|
|
4818
|
+
destroy: J
|
|
4452
4819
|
};
|
|
4453
4820
|
}
|
|
4454
|
-
function
|
|
4821
|
+
function Tr(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
4455
4822
|
if (!t) return e;
|
|
4456
4823
|
if (!e) return t;
|
|
4457
4824
|
if (typeof t == "object" && t !== null) {
|
|
@@ -4472,7 +4839,7 @@ function Rr(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
|
4472
4839
|
continue;
|
|
4473
4840
|
}
|
|
4474
4841
|
if (typeof n == "object" && n.constructor === Object) {
|
|
4475
|
-
a[s] =
|
|
4842
|
+
a[s] = Tr(e[s] || {}, n, r);
|
|
4476
4843
|
continue;
|
|
4477
4844
|
}
|
|
4478
4845
|
a[s] = n;
|
|
@@ -4481,120 +4848,121 @@ function Rr(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
|
4481
4848
|
return a;
|
|
4482
4849
|
}
|
|
4483
4850
|
export {
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4851
|
+
ee as $,
|
|
4852
|
+
Ze as A,
|
|
4853
|
+
qe as B,
|
|
4854
|
+
He as C,
|
|
4855
|
+
_r as D,
|
|
4856
|
+
is as E,
|
|
4857
|
+
ht as F,
|
|
4858
|
+
gt as G,
|
|
4859
|
+
O as H,
|
|
4860
|
+
mt as I,
|
|
4861
|
+
cs as J,
|
|
4862
|
+
fs as K,
|
|
4863
|
+
hs as L,
|
|
4864
|
+
N as M,
|
|
4865
|
+
De as N,
|
|
4866
|
+
$t as O,
|
|
4867
|
+
gs as P,
|
|
4868
|
+
At as Q,
|
|
4869
|
+
Rt as R,
|
|
4870
|
+
St as S,
|
|
4871
|
+
zt as T,
|
|
4872
|
+
Ct as U,
|
|
4873
|
+
Lt as V,
|
|
4874
|
+
Mt as W,
|
|
4875
|
+
_t as X,
|
|
4876
|
+
ms as Y,
|
|
4877
|
+
Et as Z,
|
|
4878
|
+
bs as _,
|
|
4879
|
+
Xs as a,
|
|
4880
|
+
Tt as a0,
|
|
4881
|
+
ws as a1,
|
|
4882
|
+
Pt as a2,
|
|
4883
|
+
vs as a3,
|
|
4884
|
+
It as a4,
|
|
4885
|
+
jt as a5,
|
|
4886
|
+
Zt as a6,
|
|
4887
|
+
qt as a7,
|
|
4888
|
+
Ht as a8,
|
|
4889
|
+
Dt as a9,
|
|
4890
|
+
en as aA,
|
|
4891
|
+
tn as aB,
|
|
4892
|
+
rn as aC,
|
|
4893
|
+
an as aD,
|
|
4894
|
+
Cs as aE,
|
|
4895
|
+
Ls as aF,
|
|
4896
|
+
_s as aG,
|
|
4897
|
+
Es as aH,
|
|
4898
|
+
Ts as aI,
|
|
4899
|
+
Ps as aJ,
|
|
4900
|
+
Is as aK,
|
|
4901
|
+
js as aL,
|
|
4902
|
+
zr as aM,
|
|
4903
|
+
ce as aN,
|
|
4904
|
+
Lr as aO,
|
|
4905
|
+
Os as aP,
|
|
4906
|
+
sn as aQ,
|
|
4907
|
+
nn as aR,
|
|
4908
|
+
on as aS,
|
|
4909
|
+
cn as aT,
|
|
4910
|
+
ln as aU,
|
|
4911
|
+
Mr as aV,
|
|
4912
|
+
un as aW,
|
|
4913
|
+
dn as aX,
|
|
4914
|
+
Bs as aY,
|
|
4915
|
+
pn as aZ,
|
|
4916
|
+
fn as a_,
|
|
4917
|
+
ks as aa,
|
|
4918
|
+
Ot as ab,
|
|
4919
|
+
Bt as ac,
|
|
4920
|
+
Ft as ad,
|
|
4921
|
+
Vt as ae,
|
|
4922
|
+
xs as af,
|
|
4923
|
+
Nt as ag,
|
|
4924
|
+
Ut as ah,
|
|
4925
|
+
Gt as ai,
|
|
4926
|
+
Wt as aj,
|
|
4927
|
+
Xt as ak,
|
|
4928
|
+
Kt as al,
|
|
4929
|
+
$s as am,
|
|
4930
|
+
Qt as an,
|
|
4931
|
+
Jt as ao,
|
|
4932
|
+
Yt as ap,
|
|
4933
|
+
er as aq,
|
|
4934
|
+
tr as ar,
|
|
4935
|
+
rr as as,
|
|
4936
|
+
ar as at,
|
|
4937
|
+
$r as au,
|
|
4938
|
+
Rs as av,
|
|
4939
|
+
Sr as aw,
|
|
4940
|
+
zs as ax,
|
|
4941
|
+
Js as ay,
|
|
4942
|
+
Ys as az,
|
|
4943
|
+
Ws as b,
|
|
4944
|
+
hn as c,
|
|
4945
|
+
Wr as d,
|
|
4946
|
+
Kr as e,
|
|
4947
|
+
Ks as f,
|
|
4948
|
+
Br as g,
|
|
4949
|
+
Qr as h,
|
|
4950
|
+
pe as i,
|
|
4951
|
+
Jr as j,
|
|
4952
|
+
ta as k,
|
|
4953
|
+
la as l,
|
|
4954
|
+
Wa as m,
|
|
4955
|
+
Me as n,
|
|
4956
|
+
Xa as o,
|
|
4957
|
+
Qs as p,
|
|
4958
|
+
ft as q,
|
|
4959
|
+
Pe as r,
|
|
4960
|
+
Ya as s,
|
|
4961
|
+
Ka as t,
|
|
4962
|
+
Ja as u,
|
|
4963
|
+
Ie as v,
|
|
4964
|
+
as as w,
|
|
4965
|
+
ss as x,
|
|
4966
|
+
ts as y,
|
|
4967
|
+
je as z
|
|
4600
4968
|
};
|