artifactuse 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,108 @@
1
1
  var Dr = Object.defineProperty;
2
2
  var qr = (e, t, r) => t in e ? Dr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var V = (e, t, r) => qr(e, typeof t != "symbol" ? t + "" : t, r);
4
- const Ee = {
3
+ var I = (e, t, r) => qr(e, typeof t != "symbol" ? t + "" : t, r);
4
+ function ae() {
5
+ return typeof window < "u" && window.Prism;
6
+ }
7
+ function pr(e) {
8
+ if (!ae()) {
9
+ console.warn("Artifactuse: Prism.js not found. Install and include Prism.js for syntax highlighting.");
10
+ return;
11
+ }
12
+ const t = typeof e == "string" ? document.querySelector(e) : e;
13
+ if (!t) return;
14
+ t.querySelectorAll("pre code").forEach((a) => {
15
+ if (a.classList.contains("prism-highlighted")) return;
16
+ const s = Zr(a);
17
+ s && (a.className.includes(`language-${s}`) || a.classList.add(`language-${s}`), window.Prism.highlightElement(a), a.classList.add("prism-highlighted"));
18
+ });
19
+ }
20
+ function Qs(e, t) {
21
+ ae() && (t && !e.className.includes(`language-${t}`) && e.classList.add(`language-${t}`), window.Prism.highlightElement(e), e.classList.add("prism-highlighted"));
22
+ }
23
+ function ot(e, t) {
24
+ if (!ae()) return lt(e);
25
+ const r = window.Prism.languages[t];
26
+ return r ? window.Prism.highlight(e, r, t) : lt(e);
27
+ }
28
+ function Zr(e) {
29
+ const t = e.className.split(/\s+/);
30
+ for (const s of t) {
31
+ const n = s.match(/^(?:language-|lang-)(.+)$/);
32
+ if (n)
33
+ return ge(n[1]);
34
+ }
35
+ const r = e.closest("pre");
36
+ if (r) {
37
+ const s = r.className.split(/\s+/);
38
+ for (const n of s) {
39
+ const o = n.match(/^(?:language-|lang-)(.+)$/);
40
+ if (o)
41
+ return ge(o[1]);
42
+ }
43
+ }
44
+ const a = e.dataset.language || (r == null ? void 0 : r.dataset.language);
45
+ return a ? ge(a) : null;
46
+ }
47
+ function ge(e) {
48
+ const t = {
49
+ js: "javascript",
50
+ ts: "typescript",
51
+ py: "python",
52
+ rb: "ruby",
53
+ sh: "bash",
54
+ shell: "bash",
55
+ zsh: "bash",
56
+ yml: "yaml",
57
+ md: "markdown",
58
+ html: "markup",
59
+ xml: "markup",
60
+ svg: "markup",
61
+ vue: "markup",
62
+ jsx: "jsx",
63
+ tsx: "tsx",
64
+ "c++": "cpp",
65
+ "c#": "csharp",
66
+ cs: "csharp",
67
+ "f#": "fsharp",
68
+ "objective-c": "objectivec",
69
+ objc: "objectivec"
70
+ }, r = e.toLowerCase();
71
+ return t[r] || r;
72
+ }
73
+ function lt(e) {
74
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
75
+ }
76
+ function Ys(e) {
77
+ if (!ae())
78
+ return console.warn("Artifactuse: Prism.js not found. Auto-highlighting disabled."), null;
79
+ const t = new MutationObserver((r) => {
80
+ let a = !1;
81
+ for (const s of r)
82
+ if (s.type === "childList") {
83
+ for (const n of s.addedNodes)
84
+ if (n.nodeType === Node.ELEMENT_NODE && (n.matches("pre code") || n.querySelector("pre code"))) {
85
+ a = !0;
86
+ break;
87
+ }
88
+ }
89
+ a && pr(e);
90
+ });
91
+ return t.observe(e, {
92
+ childList: !0,
93
+ subtree: !0
94
+ }), t;
95
+ }
96
+ function en() {
97
+ return ae() ? Object.keys(window.Prism.languages).filter(
98
+ (e) => typeof window.Prism.languages[e] == "object"
99
+ ) : [];
100
+ }
101
+ const Pe = {
5
102
  CODE: "code",
6
103
  FORM: "form",
7
104
  SOCIAL: "social"
8
- }, Zr = [
105
+ }, Or = [
9
106
  // Code languages
10
107
  "html",
11
108
  "htm",
@@ -34,7 +131,7 @@ const Ee = {
34
131
  // Structured artifacts
35
132
  "form",
36
133
  "social"
37
- ], Or = [
134
+ ], Br = [
38
135
  // Visual editors (always panel)
39
136
  "video",
40
137
  "videoeditor",
@@ -61,16 +158,16 @@ const Ee = {
61
158
  // Structured artifacts (form can be panel based on complexity)
62
159
  "form"
63
160
  ];
64
- function Br(e = "artifact") {
161
+ function Fr(e = "artifact") {
65
162
  return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
66
163
  }
67
- function pr(e) {
68
- return Zr.includes(e == null ? void 0 : e.toLowerCase());
69
- }
70
- function Fr(e) {
164
+ function fr(e) {
71
165
  return Or.includes(e == null ? void 0 : e.toLowerCase());
72
166
  }
73
- function ot(e) {
167
+ function Nr(e) {
168
+ return Br.includes(e == null ? void 0 : e.toLowerCase());
169
+ }
170
+ function ct(e) {
74
171
  return {
75
172
  // Code languages
76
173
  html: "HTML",
@@ -166,7 +263,7 @@ function ot(e) {
166
263
  v: "V"
167
264
  }[e == null ? void 0 : e.toLowerCase()] || (e == null ? void 0 : e.toUpperCase()) || "Code";
168
265
  }
169
- function Qs(e) {
266
+ function tn(e) {
170
267
  return {
171
268
  html: "html",
172
269
  htm: "html",
@@ -245,7 +342,7 @@ function Qs(e) {
245
342
  v: "v"
246
343
  }[e == null ? void 0 : e.toLowerCase()] || "txt";
247
344
  }
248
- function Nr(e) {
345
+ function Ur(e) {
249
346
  return {
250
347
  html: "html",
251
348
  htm: "html",
@@ -307,7 +404,7 @@ function Nr(e) {
307
404
  v: "v"
308
405
  }[e == null ? void 0 : e.toLowerCase()] || null;
309
406
  }
310
- function Ys(e) {
407
+ function rn(e) {
311
408
  return {
312
409
  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"/>',
313
410
  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"/>',
@@ -405,28 +502,25 @@ function Ys(e) {
405
502
  text: '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/>'
406
503
  }[e == null ? void 0 : e.toLowerCase()] || '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/>';
407
504
  }
408
- function en(e) {
505
+ function an(e) {
409
506
  if (e === 0) return "0 Bytes";
410
507
  const t = 1024, r = ["Bytes", "KB", "MB", "GB"], a = Math.floor(Math.log(e) / Math.log(t));
411
508
  return parseFloat((e / Math.pow(t, a)).toFixed(2)) + " " + r[a];
412
509
  }
413
- function fr(e) {
510
+ function hr(e) {
414
511
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&").replace(/&#10;/g, `
415
512
  `).replace(/&#13;/g, "\r").replace(/&#9;/g, " ").replace(/&nbsp;/g, " ");
416
513
  }
417
- function lt(e) {
418
- return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
419
- }
420
- function Ur(e) {
514
+ function Gr(e) {
421
515
  const t = JSON.stringify(e);
422
516
  return typeof btoa == "function" ? btoa(unescape(encodeURIComponent(t))) : typeof Buffer < "u" ? Buffer.from(t, "utf-8").toString("base64") : t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
423
517
  }
424
- function Gr(e, t) {
518
+ function Wr(e, t) {
425
519
  const r = t == null ? void 0 : t.toLowerCase();
426
520
  if (r === "smartdiff")
427
521
  try {
428
522
  const l = JSON.parse(e);
429
- return l.language ? `${ot(l.language)} Diff` : "Smart Diff";
523
+ return l.language ? `${ct(l.language)} Diff` : "Smart Diff";
430
524
  } catch {
431
525
  return "Smart Diff";
432
526
  }
@@ -457,9 +551,9 @@ function Gr(e, t) {
457
551
  if (d && d[1] !== "main") return d[1];
458
552
  }
459
553
  const u = e.match(/<title>([^<]+)<\/title>/i);
460
- return u ? u[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" : `${ot(t)} Code`;
554
+ return u ? u[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" : `${ct(t)} Code`;
461
555
  }
462
- function Wr(e, t) {
556
+ function Xr(e, t) {
463
557
  const r = (e || "").split(`
464
558
  `), a = (t || "").split(`
465
559
  `), s = [], n = Math.max(r.length, a.length);
@@ -470,48 +564,48 @@ function Wr(e, t) {
470
564
  return s.join(`
471
565
  `);
472
566
  }
473
- function Xr(e, t, r, a) {
567
+ function Kr(e, t, r, a) {
474
568
  const s = a.maxLines || 15;
475
- function n(f, b) {
476
- if (b) return !1;
477
- const v = a.minClickableLines;
478
- if (v == null) return !1;
479
- const M = typeof v == "number" ? v : v.lines || 0, $ = typeof v == "object" && Array.isArray(v.ignoreLanguages) ? v.ignoreLanguages : [];
480
- return f < M && !$.includes(r);
481
- }
482
- function o(f, b) {
483
- const v = a.actionLabel;
484
- let M;
485
- return typeof v == "string" ? M = v : v && typeof v == "object" && (M = v[f] || v.default || null), M || (M = f === "diff" || f === "patch" || f === "smartdiff" ? "View full diff" : "View full code"), `${M} (${b} lines)`;
569
+ function n(v, x) {
570
+ if (x) return !1;
571
+ const M = a.minClickableLines;
572
+ if (M == null) return !1;
573
+ const A = typeof M == "number" ? M : M.lines || 0, S = typeof M == "object" && Array.isArray(M.ignoreLanguages) ? M.ignoreLanguages : [];
574
+ return v < A && !S.includes(r);
575
+ }
576
+ function o(v, x) {
577
+ const M = a.actionLabel;
578
+ let A;
579
+ return typeof M == "string" ? A = M : M && typeof M == "object" && (A = M[v] || M.default || null), A || (A = v === "diff" || v === "patch" || v === "smartdiff" ? "View full diff" : "View full code"), `${A} (${x} lines)`;
486
580
  }
487
581
  if (r === "smartdiff")
488
582
  try {
489
- const f = JSON.parse(t), v = Wr(f.oldCode, f.newCode).split(`
490
- `), M = v.slice(0, s), $ = M.map((I) => I[0] || " "), z = M.map((I) => I.slice(1)), S = lt(z.join(`
491
- `)), y = v.length > s, C = f.language || "plaintext", x = n(v.length, y), E = x ? " artifactuse-inline-preview--static" : "", T = x ? ' data-non-clickable="true"' : "", L = o("smartdiff", v.length);
492
- return `<div class="artifactuse-inline-preview${y ? " artifactuse-inline-preview--truncated" : ""}${E}" data-artifact-id="${e.id}" data-smartdiff="true" data-smartdiff-markers="${$.join(",")}"${T}><pre class="artifactuse-inline-preview__pre"><code class="language-${C}">${S}</code></pre>` + (y ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${L}</span></div>` : "") + "</div>";
583
+ const v = JSON.parse(t), M = Xr(v.oldCode, v.newCode).split(`
584
+ `), A = M.slice(0, s), S = A.map((B) => B[0] || " "), L = A.map((B) => B.slice(1)), $ = v.language || "plaintext", y = ge($), z = ot(L.join(`
585
+ `), y), j = ae() && window.Prism.languages[y], E = M.length > s, T = n(M.length, E), N = T ? " artifactuse-inline-preview--static" : "", X = T ? ' data-non-clickable="true"' : "", O = o("smartdiff", M.length);
586
+ return `<div class="artifactuse-inline-preview${E ? " artifactuse-inline-preview--truncated" : ""}${N}" data-artifact-id="${e.id}" data-smartdiff="true" data-smartdiff-markers="${S.join(",")}"${X}><pre class="artifactuse-inline-preview__pre${j ? " language-" + $ : ""}"><code class="language-${$}${j ? " prism-highlighted" : ""}">${z}</code></pre>` + (E ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${O}</span></div>` : "") + "</div>";
493
587
  } catch {
494
588
  }
495
589
  let i = t, u = r;
496
590
  const l = i.split(`
497
591
  `), d = l.slice(0, s).join(`
498
- `), p = lt(d), w = l.length > s, c = n(l.length, w), m = c ? " artifactuse-inline-preview--static" : "", h = c ? ' data-non-clickable="true"' : "", g = o(r, l.length);
499
- return `<div class="artifactuse-inline-preview${w ? " artifactuse-inline-preview--truncated" : ""}${m}" data-artifact-id="${e.id}"${h}><pre class="artifactuse-inline-preview__pre"><code class="language-${u}">${p}</code></pre>` + (w ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${g}</span></div>` : "") + "</div>";
592
+ `), p = ge(u), w = ot(d, p), c = ae() && window.Prism.languages[p], h = l.length > s, f = n(l.length, h), g = f ? " artifactuse-inline-preview--static" : "", m = f ? ' data-non-clickable="true"' : "", b = o(r, l.length);
593
+ return `<div class="artifactuse-inline-preview${h ? " artifactuse-inline-preview--truncated" : ""}${g}" data-artifact-id="${e.id}"${m}><pre class="artifactuse-inline-preview__pre${c ? " language-" + u : ""}"><code class="language-${u}${c ? " prism-highlighted" : ""}">${w}</code></pre>` + (h ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${b}</span></div>` : "") + "</div>";
500
594
  }
501
- function Kr(e, t = "panel") {
502
- const r = Ur(e);
595
+ function Jr(e, t = "panel") {
596
+ const r = Gr(e);
503
597
  return `<div class="${`artifactuse-placeholder artifactuse-${t}`}" data-artifact-id="${e.id}" data-artifact-type="${e.type}" data-artifact="${r}"></div>`;
504
598
  }
505
- function hr(e) {
599
+ function gr(e) {
506
600
  try {
507
601
  return JSON.parse(e);
508
602
  } catch {
509
603
  return null;
510
604
  }
511
605
  }
512
- function Jr(e) {
606
+ function Qr(e) {
513
607
  var s;
514
- const t = hr(e);
608
+ const t = gr(e);
515
609
  if (!t || t.display === "inline") return !0;
516
610
  if (t.display === "panel" || t.variant === "wizard") return !1;
517
611
  if (t.variant === "buttons") return !0;
@@ -520,47 +614,47 @@ function Jr(e) {
520
614
  const a = ["multiselect", "rating", "color", "range"];
521
615
  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));
522
616
  }
523
- function Qr(e, t) {
617
+ function Yr(e, t) {
524
618
  const r = e == null ? void 0 : e.toLowerCase();
525
- return r === "social" ? !0 : r === "form" ? Jr(t) : !1;
619
+ return r === "social" ? !0 : r === "form" ? Qr(t) : !1;
526
620
  }
527
- function Yr(e) {
621
+ function ea(e) {
528
622
  const t = e == null ? void 0 : e.toLowerCase();
529
- return t === "form" ? Ee.FORM : t === "social" ? Ee.SOCIAL : Ee.CODE;
623
+ return t === "form" ? Pe.FORM : t === "social" ? Pe.SOCIAL : Pe.CODE;
530
624
  }
531
- function Me(e, t, r, a) {
532
- const s = t == null ? void 0 : t.toLowerCase(), n = Yr(s), o = Qr(s, e);
625
+ function $e(e, t, r, a) {
626
+ const s = t == null ? void 0 : t.toLowerCase(), n = ea(s), o = Yr(s, e);
533
627
  return {
534
628
  id: `${r}-${n}-${a}`,
535
629
  messageId: r,
536
630
  type: n,
537
631
  language: s,
538
- title: Gr(e, s),
632
+ title: Wr(e, s),
539
633
  code: e,
540
634
  isInline: o,
541
- isPreviewable: pr(s),
542
- isPanelArtifact: Fr(s),
635
+ isPreviewable: fr(s),
636
+ isPanelArtifact: Nr(s),
543
637
  size: e.length,
544
638
  lineCount: e.split(`
545
639
  `).length,
546
640
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
547
641
  };
548
642
  }
549
- function tn(e, t) {
643
+ function sn(e, t) {
550
644
  const r = [], a = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
551
645
  let s, n = 0;
552
646
  for (; (s = a.exec(e)) !== null; ) {
553
- const o = s[1], i = fr(s[2]);
647
+ const o = s[1], i = hr(s[2]);
554
648
  let u = o.toLowerCase();
555
- if ((["xml", "markup", "html", "htm"].includes(u) || !u) && (i.trim().startsWith("<svg") || i.includes("<svg ") || i.includes("<svg>")) && (u = "svg"), (u === "form" || u === "social") && !hr(i)) {
556
- r.push(Me(i, "json", t, n)), n++;
649
+ if ((["xml", "markup", "html", "htm"].includes(u) || !u) && (i.trim().startsWith("<svg") || i.includes("<svg ") || i.includes("<svg>")) && (u = "svg"), (u === "form" || u === "social") && !gr(i)) {
650
+ r.push($e(i, "json", t, n)), n++;
557
651
  continue;
558
652
  }
559
- r.push(Me(i, u, t, n)), n++;
653
+ r.push($e(i, u, t, n)), n++;
560
654
  }
561
655
  return r;
562
656
  }
563
- function ea(e, t, r = {}) {
657
+ function ta(e, t, r = {}) {
564
658
  const {
565
659
  minLines: a = 3,
566
660
  minLength: s = 50,
@@ -577,30 +671,30 @@ function ea(e, t, r = {}) {
577
671
  return i ? i.languages === !0 ? !0 : Array.isArray(i.languages) ? i.languages.includes(g) : !1 : !1;
578
672
  }
579
673
  const w = [], c = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
580
- let m = 0;
581
- const h = e.replace(c, (g, f, b) => {
582
- const v = fr(b).trim(), M = v.split(`
674
+ let h = 0;
675
+ const f = e.replace(c, (g, m, b) => {
676
+ const v = hr(b).trim(), x = v.split(`
583
677
  `).length;
584
- let $ = f.toLowerCase();
585
- if ((["xml", "markup", "html", "htm"].includes($) || !$) && v.trim().startsWith("<svg") && ($ = "svg"), p($))
586
- return m++, g;
587
- const z = pr($);
678
+ let M = m.toLowerCase();
679
+ if ((["xml", "markup", "html", "htm"].includes(M) || !M) && v.trim().startsWith("<svg") && (M = "svg"), p(M))
680
+ return h++, g;
681
+ const A = fr(M);
588
682
  let S = !1;
589
- if (n ? S = !0 : $ === "diff" || $ === "patch" || $ === "smartdiff" ? S = M > 10 : z ? S = !0 : S = v.length >= s && M >= a, !S && d($) && (S = !0), S) {
590
- const y = Me(v, $, t, m);
591
- if (u && (y.tabs = u), l && (y.viewMode = l), m++, w.push(y), d($))
592
- return Xr(y, v, $, o);
593
- let C = "panel";
594
- return y.isInline && (C = y.type === "social" ? "inline-social" : "inline-form"), Kr(y, C);
683
+ if (n ? S = !0 : M === "diff" || M === "patch" || M === "smartdiff" ? S = x > 10 : A ? S = !0 : S = v.length >= s && x >= a, !S && d(M) && (S = !0), S) {
684
+ const L = $e(v, M, t, h);
685
+ if (u && (L.tabs = u), l && (L.viewMode = l), h++, w.push(L), d(M))
686
+ return Kr(L, v, M, o);
687
+ let $ = "panel";
688
+ return L.isInline && ($ = L.type === "social" ? "inline-social" : "inline-form"), Jr(L, $);
595
689
  }
596
- return m++, g;
690
+ return h++, g;
597
691
  });
598
692
  return {
599
693
  artifacts: w,
600
- html: h
694
+ html: f
601
695
  };
602
696
  }
603
- function ta() {
697
+ function ra() {
604
698
  let e = {
605
699
  artifacts: [],
606
700
  activeArtifactId: null,
@@ -611,70 +705,74 @@ function ta() {
611
705
  // Multi-tab support
612
706
  openTabs: [],
613
707
  // Array of artifact IDs open as tabs (ordered)
614
- tabViewModes: {}
708
+ tabViewModes: {},
615
709
  // { [artifactId]: 'preview' | 'code' | 'split' | 'edit' }
710
+ // Panel empty view
711
+ forceEmptyView: !1
712
+ // When true, panel shows empty state regardless of artifacts
616
713
  };
617
714
  const t = /* @__PURE__ */ new Set();
618
715
  function r() {
619
- t.forEach((y) => {
716
+ t.forEach(($) => {
620
717
  try {
621
- y(e);
622
- } catch (C) {
623
- console.error("Artifactuse state subscriber error:", C);
718
+ $(e);
719
+ } catch (y) {
720
+ console.error("Artifactuse state subscriber error:", y);
624
721
  }
625
722
  });
626
723
  }
627
- function a(y) {
628
- return t.add(y), y(e), () => {
629
- t.delete(y);
724
+ function a($) {
725
+ return t.add($), $(e), () => {
726
+ t.delete($);
630
727
  };
631
728
  }
632
729
  function s() {
633
730
  return { ...e };
634
731
  }
635
- function n(y) {
636
- const C = e.artifacts.findIndex((x) => x.id === y.id);
637
- if (C === -1)
732
+ function n($) {
733
+ const y = e.artifacts.findIndex((z) => z.id === $.id);
734
+ if (y === -1)
638
735
  e = {
639
736
  ...e,
640
- artifacts: [...e.artifacts, y]
737
+ artifacts: [...e.artifacts, $]
641
738
  };
642
739
  else {
643
- const x = [...e.artifacts];
644
- x[C] = { ...x[C], ...y }, e = {
740
+ const z = [...e.artifacts];
741
+ z[y] = { ...z[y], ...$ }, e = {
645
742
  ...e,
646
- artifacts: x
743
+ artifacts: z
647
744
  };
648
745
  }
649
746
  r();
650
747
  }
651
- function o(y) {
652
- y.forEach(n);
748
+ function o($) {
749
+ $.forEach(n);
653
750
  }
654
- function i(y) {
655
- const C = e.openTabs.filter((T) => T !== y), { [y]: x, ...E } = e.tabViewModes;
751
+ function i($) {
752
+ const y = e.openTabs.filter((E) => E !== $), { [$]: z, ...j } = e.tabViewModes;
656
753
  e = {
657
754
  ...e,
658
- artifacts: e.artifacts.filter((T) => T.id !== y),
659
- activeArtifactId: e.activeArtifactId === y ? null : e.activeArtifactId,
660
- isPanelOpen: e.activeArtifactId === y ? !1 : e.isPanelOpen,
661
- openTabs: C,
662
- tabViewModes: E
755
+ artifacts: e.artifacts.filter((E) => E.id !== $),
756
+ activeArtifactId: e.activeArtifactId === $ ? null : e.activeArtifactId,
757
+ isPanelOpen: e.activeArtifactId === $ ? !1 : e.isPanelOpen,
758
+ openTabs: y,
759
+ tabViewModes: j
663
760
  }, r();
664
761
  }
665
- function u(y) {
666
- return e.artifacts.find((C) => C.id === y) || null;
762
+ function u($) {
763
+ return e.artifacts.find((y) => y.id === $) || null;
667
764
  }
668
765
  function l() {
669
766
  return e.activeArtifactId ? u(e.activeArtifactId) : null;
670
767
  }
671
- function d(y) {
672
- const C = u(y);
673
- let x = e.tabViewModes[y];
674
- x || (x = (C == null ? void 0 : C.isPreviewable) === !1 ? "code" : "preview", C != null && C.tabs && !C.tabs.includes(x) && (x = C.tabs[0])), e = {
768
+ function d($) {
769
+ const y = u($);
770
+ let z = e.tabViewModes[$];
771
+ z || (z = (y == null ? void 0 : y.isPreviewable) === !1 ? "code" : "preview", y != null && y.tabs && !y.tabs.includes(z) && (z = y.tabs[0])), e = {
675
772
  ...e,
676
- activeArtifactId: y,
677
- viewMode: x
773
+ activeArtifactId: $,
774
+ viewMode: z,
775
+ forceEmptyView: !1
678
776
  }, r();
679
777
  }
680
778
  function p() {
@@ -683,80 +781,86 @@ function ta() {
683
781
  activeArtifactId: null
684
782
  }, r();
685
783
  }
686
- function w(y) {
784
+ function w($) {
687
785
  e = {
688
786
  ...e,
689
- isPanelOpen: y,
690
- isFullscreen: y ? e.isFullscreen : !1
787
+ isPanelOpen: $,
788
+ isFullscreen: $ ? e.isFullscreen : !1
691
789
  }, r();
692
790
  }
693
- function c(y) {
694
- if (!["preview", "code", "split", "edit"].includes(y)) {
695
- console.warn(`Invalid view mode: ${y}`);
791
+ function c($) {
792
+ if (!["preview", "code", "split", "edit"].includes($)) {
793
+ console.warn(`Invalid view mode: ${$}`);
696
794
  return;
697
795
  }
698
- const C = e.activeArtifactId ? { ...e.tabViewModes, [e.activeArtifactId]: y } : e.tabViewModes;
796
+ const y = e.activeArtifactId ? { ...e.tabViewModes, [e.activeArtifactId]: $ } : e.tabViewModes;
699
797
  e = {
700
798
  ...e,
701
- viewMode: y,
702
- tabViewModes: C
799
+ viewMode: $,
800
+ tabViewModes: y
703
801
  }, r();
704
802
  }
705
- function m(y) {
803
+ function h($) {
706
804
  e = {
707
805
  ...e,
708
- isFullscreen: y
806
+ isFullscreen: $
709
807
  }, r();
710
808
  }
711
- function h(y) {
712
- return e.artifacts.filter((C) => C.messageId === y);
809
+ function f($) {
810
+ e = {
811
+ ...e,
812
+ forceEmptyView: !!$
813
+ }, r();
814
+ }
815
+ function g($) {
816
+ return e.artifacts.filter((y) => y.messageId === $);
713
817
  }
714
- function g(y) {
715
- return e.artifacts.filter((C) => C.type === y);
818
+ function m($) {
819
+ return e.artifacts.filter((y) => y.type === $);
716
820
  }
717
- function f() {
821
+ function b() {
718
822
  return e.artifacts.length;
719
823
  }
720
- function b(y) {
721
- const C = u(y);
722
- if (!C) return;
723
- const E = e.openTabs.includes(y) ? e.openTabs : [...e.openTabs, y];
724
- let T = e.tabViewModes[y];
725
- T || (T = C.isPreviewable === !1 ? "code" : "preview", C.tabs && !C.tabs.includes(T) && (T = C.tabs[0])), e = {
824
+ function v($) {
825
+ const y = u($);
826
+ if (!y) return;
827
+ const j = e.openTabs.includes($) ? e.openTabs : [...e.openTabs, $];
828
+ let E = e.tabViewModes[$];
829
+ E || (E = y.isPreviewable === !1 ? "code" : "preview", y.tabs && !y.tabs.includes(E) && (E = y.tabs[0])), e = {
726
830
  ...e,
727
- openTabs: E,
728
- activeArtifactId: y,
729
- tabViewModes: { ...e.tabViewModes, [y]: T },
730
- viewMode: T
831
+ openTabs: j,
832
+ activeArtifactId: $,
833
+ tabViewModes: { ...e.tabViewModes, [$]: E },
834
+ viewMode: E
731
835
  }, r();
732
836
  }
733
- function v(y) {
734
- const C = e.openTabs.indexOf(y);
735
- if (C === -1) return;
736
- const x = e.openTabs.filter((G) => G !== y), { [y]: E, ...T } = e.tabViewModes;
737
- let L = e.activeArtifactId;
738
- e.activeArtifactId === y && (x.length === 0 ? L = null : C >= x.length ? L = x[x.length - 1] : L = x[C]);
739
- const I = L && T[L] || "preview";
837
+ function x($) {
838
+ const y = e.openTabs.indexOf($);
839
+ if (y === -1) return;
840
+ const z = e.openTabs.filter((X) => X !== $), { [$]: j, ...E } = e.tabViewModes;
841
+ let T = e.activeArtifactId;
842
+ e.activeArtifactId === $ && (z.length === 0 ? T = null : y >= z.length ? T = z[z.length - 1] : T = z[y]);
843
+ const N = T && E[T] || "preview";
740
844
  e = {
741
845
  ...e,
742
- openTabs: x,
743
- activeArtifactId: L,
744
- tabViewModes: T,
745
- viewMode: I
846
+ openTabs: z,
847
+ activeArtifactId: T,
848
+ tabViewModes: E,
849
+ viewMode: N
746
850
  }, r();
747
851
  }
748
- function M(y) {
749
- if (!u(y)) return;
750
- const x = e.tabViewModes[y] || e.viewMode;
852
+ function M($) {
853
+ if (!u($)) return;
854
+ const z = e.tabViewModes[$] || e.viewMode;
751
855
  e = {
752
856
  ...e,
753
- openTabs: [y],
754
- activeArtifactId: y,
755
- tabViewModes: { [y]: x },
756
- viewMode: x
857
+ openTabs: [$],
858
+ activeArtifactId: $,
859
+ tabViewModes: { [$]: z },
860
+ viewMode: z
757
861
  }, r();
758
862
  }
759
- function $() {
863
+ function A() {
760
864
  e = {
761
865
  ...e,
762
866
  openTabs: [],
@@ -764,7 +868,7 @@ function ta() {
764
868
  tabViewModes: {}
765
869
  }, r();
766
870
  }
767
- function z() {
871
+ function S() {
768
872
  e = {
769
873
  artifacts: [],
770
874
  activeArtifactId: null,
@@ -772,22 +876,23 @@ function ta() {
772
876
  viewMode: "preview",
773
877
  isFullscreen: !1,
774
878
  openTabs: [],
775
- tabViewModes: {}
879
+ tabViewModes: {},
880
+ forceEmptyView: !1
776
881
  }, r();
777
882
  }
778
- function S(y) {
779
- const C = r;
780
- let x = !1;
781
- const E = () => {
782
- x = !0;
883
+ function L($) {
884
+ const y = r;
885
+ let z = !1;
886
+ const j = () => {
887
+ z = !0;
783
888
  };
784
889
  try {
785
890
  Object.defineProperty(window, "__artifactuse_notify__", {
786
- value: E,
891
+ value: j,
787
892
  configurable: !0
788
- }), y();
893
+ }), $();
789
894
  } finally {
790
- delete window.__artifactuse_notify__, x && C();
895
+ delete window.__artifactuse_notify__, z && y();
791
896
  }
792
897
  }
793
898
  return {
@@ -800,159 +905,160 @@ function ta() {
800
905
  removeArtifact: i,
801
906
  getArtifact: u,
802
907
  getActiveArtifact: l,
803
- getArtifactsByMessageId: h,
804
- getArtifactsByType: g,
805
- getArtifactCount: f,
908
+ getArtifactsByMessageId: g,
909
+ getArtifactsByType: m,
910
+ getArtifactCount: b,
806
911
  // Panel state
807
912
  setActiveArtifact: d,
808
913
  clearActiveArtifact: p,
809
914
  setPanelOpen: w,
810
915
  setViewMode: c,
811
- setFullscreen: m,
916
+ setFullscreen: h,
917
+ setForceEmptyView: f,
812
918
  // Multi-tab
813
- openTab: b,
814
- closeTab: v,
919
+ openTab: v,
920
+ closeTab: x,
815
921
  closeOtherTabs: M,
816
- closeAllTabs: $,
922
+ closeAllTabs: A,
817
923
  // Utilities
818
- clear: z,
819
- batch: S
924
+ clear: S,
925
+ batch: L
820
926
  };
821
927
  }
822
- function ct(e) {
928
+ function ut(e) {
823
929
  try {
824
930
  return new URL(e).hostname;
825
931
  } catch {
826
932
  return null;
827
933
  }
828
934
  }
829
- function ra(e = []) {
935
+ function aa(e = []) {
830
936
  const t = Array.isArray(e) ? e : [e].filter(Boolean), r = new Set(t), a = /* @__PURE__ */ new Map();
831
937
  let s = null, n = !1, o = !1;
832
938
  const i = [];
833
- function u(x) {
939
+ function u(y) {
834
940
  if (r.size === 0)
835
941
  return console.warn("Artifactuse bridge: No allowed origins configured, accepting all messages"), !0;
836
- const E = ct(x);
837
- if (!E) return !1;
838
- for (const T of r) {
839
- const L = ct(T);
840
- if (L && L === E || T === E)
942
+ const z = ut(y);
943
+ if (!z) return !1;
944
+ for (const j of r) {
945
+ const E = ut(j);
946
+ if (E && E === z || j === z)
841
947
  return !0;
842
948
  }
843
949
  return !1;
844
950
  }
845
- function l(x) {
846
- var U, k, _;
847
- if (((U = x.data) == null ? void 0 : U.type) === "artifactuse" && (console.log("[Bridge] Message from:", x.origin, "action:", (k = x.data) == null ? void 0 : k.action), console.log("[Bridge] Allowed origins:", w())), !u(x.origin)) {
848
- ((_ = x.data) == null ? void 0 : _.type) === "artifactuse" && console.warn("[Bridge] Origin NOT allowed:", x.origin);
951
+ function l(y) {
952
+ var O, B, k;
953
+ if (((O = y.data) == null ? void 0 : O.type) === "artifactuse" && (console.log("[Bridge] Message from:", y.origin, "action:", (B = y.data) == null ? void 0 : B.action), console.log("[Bridge] Allowed origins:", w())), !u(y.origin)) {
954
+ ((k = y.data) == null ? void 0 : k.type) === "artifactuse" && console.warn("[Bridge] Origin NOT allowed:", y.origin);
849
955
  return;
850
956
  }
851
- const { type: E, action: T, data: L, requestId: I } = x.data || {};
852
- if (E !== "artifactuse") return;
853
- if (T === "ready" || T === "panel:ready") {
854
- console.log("[Bridge] panel:ready received, setting isReady=true"), n = !0, o = !0, m();
957
+ const { type: z, action: j, data: E, requestId: T } = y.data || {};
958
+ if (z !== "artifactuse") return;
959
+ if (j === "ready" || j === "panel:ready") {
960
+ console.log("[Bridge] panel:ready received, setting isReady=true"), n = !0, o = !0, h();
855
961
  return;
856
962
  }
857
- (a.get(T) || []).forEach((R) => {
963
+ (a.get(j) || []).forEach((P) => {
858
964
  try {
859
- R(L, I);
860
- } catch (A) {
861
- console.error(`Artifactuse bridge handler error (${T}):`, A);
965
+ P(E, T);
966
+ } catch (R) {
967
+ console.error(`Artifactuse bridge handler error (${j}):`, R);
862
968
  }
863
- }), (a.get("*") || []).forEach((R) => {
969
+ }), (a.get("*") || []).forEach((P) => {
864
970
  try {
865
- R({ action: T, data: L, requestId: I });
866
- } catch (A) {
867
- console.error("Artifactuse bridge wildcard handler error:", A);
971
+ P({ action: j, data: E, requestId: T });
972
+ } catch (R) {
973
+ console.error("Artifactuse bridge wildcard handler error:", R);
868
974
  }
869
975
  });
870
976
  }
871
977
  window.addEventListener("message", l);
872
- function d(x) {
873
- x && typeof x == "string" && r.add(x);
978
+ function d(y) {
979
+ y && typeof y == "string" && r.add(y);
874
980
  }
875
- function p(x) {
876
- x && typeof x == "string" && r.delete(x);
981
+ function p(y) {
982
+ y && typeof y == "string" && r.delete(y);
877
983
  }
878
984
  function w() {
879
985
  return [...r];
880
986
  }
881
- function c(x) {
882
- console.log("[Bridge] setIframe called, current isReady:", n, "readySignalReceived:", o, "same iframe:", s === x), s !== x && (s = x, 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), m();
987
+ function c(y) {
988
+ console.log("[Bridge] setIframe called, current isReady:", n, "readySignalReceived:", o, "same iframe:", s === y), s !== y && (s = y, 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), h();
883
989
  }
884
- function m() {
885
- 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((x) => h(x)), i.length = 0);
990
+ function h() {
991
+ 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((y) => f(y)), i.length = 0);
886
992
  }
887
- function h(x, E = "*") {
993
+ function f(y, z = "*") {
888
994
  if (!(s != null && s.contentWindow))
889
995
  return console.warn("Artifactuse: No panel iframe available"), !1;
890
996
  try {
891
- return s.contentWindow.postMessage(x, E), !0;
892
- } catch (T) {
893
- return console.error("Artifactuse bridge send error:", T), !1;
997
+ return s.contentWindow.postMessage(y, z), !0;
998
+ } catch (j) {
999
+ return console.error("Artifactuse bridge send error:", j), !1;
894
1000
  }
895
1001
  }
896
- function g(x, E, T = null, L = "*") {
897
- const I = {
1002
+ function g(y, z, j = null, E = "*") {
1003
+ const T = {
898
1004
  type: "artifactuse",
899
- action: x,
900
- data: E,
901
- requestId: T || ut(),
1005
+ action: y,
1006
+ data: z,
1007
+ requestId: j || dt(),
902
1008
  timestamp: Date.now()
903
1009
  };
904
- return n ? (h(I, L), I.requestId) : (i.push(I), I.requestId);
905
- }
906
- function f(x, E, T = 3e4) {
907
- return new Promise((L, I) => {
908
- const G = ut(), te = setTimeout(() => {
909
- v(`${x}:response`, U), I(new Error(`Artifactuse bridge request timeout: ${x}`));
910
- }, T), U = (k, _) => {
911
- _ === G && (clearTimeout(te), v(`${x}:response`, U), L(k));
1010
+ return n ? (f(T, E), T.requestId) : (i.push(T), T.requestId);
1011
+ }
1012
+ function m(y, z, j = 3e4) {
1013
+ return new Promise((E, T) => {
1014
+ const N = dt(), X = setTimeout(() => {
1015
+ v(`${y}:response`, O), T(new Error(`Artifactuse bridge request timeout: ${y}`));
1016
+ }, j), O = (B, k) => {
1017
+ k === N && (clearTimeout(X), v(`${y}:response`, O), E(B));
912
1018
  };
913
- b(`${x}:response`, U), g(x, E, G);
1019
+ b(`${y}:response`, O), g(y, z, N);
914
1020
  });
915
1021
  }
916
- function b(x, E) {
917
- return a.has(x) || a.set(x, []), a.get(x).push(E), () => v(x, E);
1022
+ function b(y, z) {
1023
+ return a.has(y) || a.set(y, []), a.get(y).push(z), () => v(y, z);
918
1024
  }
919
- function v(x, E) {
920
- const T = a.get(x);
921
- if (T) {
922
- const L = T.indexOf(E);
923
- L > -1 && T.splice(L, 1);
1025
+ function v(y, z) {
1026
+ const j = a.get(y);
1027
+ if (j) {
1028
+ const E = j.indexOf(z);
1029
+ E > -1 && j.splice(E, 1);
924
1030
  }
925
1031
  }
926
- function M(x) {
927
- return g("load:artifact", x);
1032
+ function x(y) {
1033
+ return g("load:artifact", y);
928
1034
  }
929
- function $(x, E) {
930
- return g("update:artifact", { artifactId: x, updates: E });
1035
+ function M(y, z) {
1036
+ return g("update:artifact", { artifactId: y, updates: z });
931
1037
  }
932
- function z() {
933
- return f("save", {});
1038
+ function A() {
1039
+ return m("save", {});
934
1040
  }
935
- function S(x = "default") {
936
- return f("export", { format: x });
1041
+ function S(y = "default") {
1042
+ return m("export", { format: y });
937
1043
  }
938
- function y(x, E) {
939
- return g("ai:response", x, E);
1044
+ function L(y, z) {
1045
+ return g("ai:response", y, z);
940
1046
  }
941
- function C() {
1047
+ function $() {
942
1048
  window.removeEventListener("message", l), a.clear(), r.clear(), s = null, n = !1, o = !1, i.length = 0;
943
1049
  }
944
1050
  return {
945
1051
  setIframe: c,
946
1052
  send: g,
947
- request: f,
1053
+ request: m,
948
1054
  on: b,
949
1055
  off: v,
950
- loadArtifact: M,
951
- updateArtifact: $,
952
- requestSave: z,
1056
+ loadArtifact: x,
1057
+ updateArtifact: M,
1058
+ requestSave: A,
953
1059
  requestExport: S,
954
- sendAIResponse: y,
955
- destroy: C,
1060
+ sendAIResponse: L,
1061
+ destroy: $,
956
1062
  // Origin management
957
1063
  addAllowedOrigin: d,
958
1064
  removeAllowedOrigin: p,
@@ -966,10 +1072,10 @@ function ra(e = []) {
966
1072
  }
967
1073
  };
968
1074
  }
969
- function ut() {
1075
+ function dt() {
970
1076
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
971
1077
  }
972
- function aa(e) {
1078
+ function sa(e) {
973
1079
  if (!e) return null;
974
1080
  if (typeof e == "string" && e.includes(","))
975
1081
  return e.trim();
@@ -979,22 +1085,22 @@ function aa(e) {
979
1085
  const r = parseInt(t.slice(0, 2), 16), a = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16);
980
1086
  return `${r}, ${a}, ${s}`;
981
1087
  }
982
- function sa(e) {
983
- return e ? aa(e) : null;
1088
+ function na(e) {
1089
+ return e ? sa(e) : null;
984
1090
  }
985
- function ve(e) {
1091
+ function ye(e) {
986
1092
  if (!e || typeof e != "object") return {};
987
1093
  const t = {};
988
1094
  for (const [r, a] of Object.entries(e))
989
1095
  if (r === "gradientOpacity" || typeof a == "number")
990
1096
  t[r] = a;
991
1097
  else {
992
- const s = sa(a);
1098
+ const s = na(a);
993
1099
  s && (t[r] = s);
994
1100
  }
995
1101
  return t;
996
1102
  }
997
- const dt = {
1103
+ const pt = {
998
1104
  // Dark theme
999
1105
  dark: {
1000
1106
  primary: "99, 102, 241",
@@ -1064,16 +1170,16 @@ const dt = {
1064
1170
  gradientOpacity: "0.25"
1065
1171
  }
1066
1172
  };
1067
- function na(e = "auto", t = {}) {
1173
+ function ia(e = "auto", t = {}) {
1068
1174
  let r = e, a = {
1069
- dark: { ...dt.dark },
1070
- light: { ...dt.light }
1175
+ dark: { ...pt.dark },
1176
+ light: { ...pt.light }
1071
1177
  };
1072
- t.dark && (a.dark = { ...a.dark, ...ve(t.dark) }), t.light && (a.light = { ...a.light, ...ve(t.light) });
1178
+ t.dark && (a.dark = { ...a.dark, ...ye(t.dark) }), t.light && (a.light = { ...a.light, ...ye(t.light) });
1073
1179
  const s = { ...t };
1074
1180
  if (delete s.dark, delete s.light, Object.keys(s).length > 0) {
1075
- const m = ve(s);
1076
- a.dark = { ...a.dark, ...m }, a.light = { ...a.light, ...m };
1181
+ const h = ye(s);
1182
+ a.dark = { ...a.dark, ...h }, a.light = { ...a.light, ...h };
1077
1183
  }
1078
1184
  function n() {
1079
1185
  return r === "auto" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : r;
@@ -1082,55 +1188,55 @@ function na(e = "auto", t = {}) {
1082
1188
  return a[n()];
1083
1189
  }
1084
1190
  function i() {
1085
- const m = o();
1086
- return Object.entries(m).map(([h, g]) => `--artifactuse-${le(h)}: ${g};`).join(`
1191
+ const h = o();
1192
+ return Object.entries(h).map(([f, g]) => `--artifactuse-${ce(f)}: ${g};`).join(`
1087
1193
  `);
1088
1194
  }
1089
- function u(m = document.documentElement) {
1090
- const h = o(), g = n();
1091
- Object.entries(h).forEach(([f, b]) => {
1092
- m.style.setProperty(`--artifactuse-${le(f)}`, b);
1093
- }), m.setAttribute("data-artifactuse-theme", g), m.classList.remove("artifactuse-dark", "artifactuse-light"), m.classList.add(`artifactuse-${g}`);
1195
+ function u(h = document.documentElement) {
1196
+ const f = o(), g = n();
1197
+ Object.entries(f).forEach(([m, b]) => {
1198
+ h.style.setProperty(`--artifactuse-${ce(m)}`, b);
1199
+ }), h.setAttribute("data-artifactuse-theme", g), h.classList.remove("artifactuse-dark", "artifactuse-light"), h.classList.add(`artifactuse-${g}`);
1094
1200
  }
1095
- function l(m) {
1096
- if (!["dark", "light", "auto"].includes(m)) {
1097
- console.warn(`Invalid theme: ${m}`);
1201
+ function l(h) {
1202
+ if (!["dark", "light", "auto"].includes(h)) {
1203
+ console.warn(`Invalid theme: ${h}`);
1098
1204
  return;
1099
1205
  }
1100
- r = m, u();
1206
+ r = h, u();
1101
1207
  }
1102
1208
  function d() {
1103
- const m = n();
1104
- l(m === "dark" ? "light" : "dark");
1209
+ const h = n();
1210
+ l(h === "dark" ? "light" : "dark");
1105
1211
  }
1106
- function p(m, h = null) {
1107
- const g = ve(m);
1108
- h ? a[h] = { ...a[h], ...g } : (a.dark = { ...a.dark, ...g }, a.light = { ...a.light, ...g }), u();
1212
+ function p(h, f = null) {
1213
+ const g = ye(h);
1214
+ f ? a[f] = { ...a[f], ...g } : (a.dark = { ...a.dark, ...g }, a.light = { ...a.light, ...g }), u();
1109
1215
  }
1110
- function w(m) {
1111
- const h = window.matchMedia("(prefers-color-scheme: dark)"), g = (f) => {
1112
- r === "auto" && (u(), m && m(f.matches ? "dark" : "light"));
1216
+ function w(h) {
1217
+ const f = window.matchMedia("(prefers-color-scheme: dark)"), g = (m) => {
1218
+ r === "auto" && (u(), h && h(m.matches ? "dark" : "light"));
1113
1219
  };
1114
- return h.addEventListener("change", g), () => {
1115
- h.removeEventListener("change", g);
1220
+ return f.addEventListener("change", g), () => {
1221
+ f.removeEventListener("change", g);
1116
1222
  };
1117
1223
  }
1118
1224
  function c() {
1119
1225
  return `
1120
1226
  :root,
1121
1227
  [data-artifactuse-theme="dark"] {
1122
- ${Object.entries(a.dark).map(([m, h]) => `--artifactuse-${le(m)}: ${h};`).join(`
1228
+ ${Object.entries(a.dark).map(([h, f]) => `--artifactuse-${ce(h)}: ${f};`).join(`
1123
1229
  `)}
1124
1230
  }
1125
1231
 
1126
1232
  [data-artifactuse-theme="light"] {
1127
- ${Object.entries(a.light).map(([m, h]) => `--artifactuse-${le(m)}: ${h};`).join(`
1233
+ ${Object.entries(a.light).map(([h, f]) => `--artifactuse-${ce(h)}: ${f};`).join(`
1128
1234
  `)}
1129
1235
  }
1130
1236
 
1131
1237
  @media (prefers-color-scheme: light) {
1132
1238
  :root:not([data-artifactuse-theme]) {
1133
- ${Object.entries(a.light).map(([m, h]) => `--artifactuse-${le(m)}: ${h};`).join(`
1239
+ ${Object.entries(a.light).map(([h, f]) => `--artifactuse-${ce(h)}: ${f};`).join(`
1134
1240
  `)}
1135
1241
  }
1136
1242
  }
@@ -1157,11 +1263,11 @@ function na(e = "auto", t = {}) {
1157
1263
  watchSystemTheme: w
1158
1264
  };
1159
1265
  }
1160
- function le(e) {
1266
+ function ce(e) {
1161
1267
  return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1162
1268
  }
1163
- const Xe = "artifactuse_auth", gr = "https://app.artifactuse.com", ge = "https://api.artifactuse.com";
1164
- function Le() {
1269
+ const Xe = "artifactuse_auth", mr = "https://app.artifactuse.com", we = "https://api.artifactuse.com";
1270
+ function Te() {
1165
1271
  if (typeof window > "u" || !window.localStorage)
1166
1272
  return null;
1167
1273
  try {
@@ -1171,15 +1277,15 @@ function Le() {
1171
1277
  return null;
1172
1278
  }
1173
1279
  }
1174
- function ia(e) {
1280
+ function oa(e) {
1175
1281
  if (!(typeof window > "u" || !window.localStorage))
1176
1282
  try {
1177
1283
  localStorage.setItem(Xe, JSON.stringify(e));
1178
1284
  } catch {
1179
1285
  }
1180
1286
  }
1181
- async function oa(e, t = {}) {
1182
- const { apiUrl: r = ge } = t, a = await fetch(`${r}/v1/project/share`, {
1287
+ async function la(e, t = {}) {
1288
+ const { apiUrl: r = we } = t, a = await fetch(`${r}/v1/project/share`, {
1183
1289
  method: "POST",
1184
1290
  headers: {
1185
1291
  "Content-Type": "application/json"
@@ -1196,8 +1302,8 @@ async function oa(e, t = {}) {
1196
1302
  }
1197
1303
  return a.json();
1198
1304
  }
1199
- async function la(e, t = {}) {
1200
- const { apiUrl: r = ge, getStoredAuthData: a = Le } = t, s = a();
1305
+ async function ca(e, t = {}) {
1306
+ const { apiUrl: r = we, getStoredAuthData: a = Te } = t, s = a();
1201
1307
  if (!(s != null && s.token))
1202
1308
  throw new Error("Authentication required. Please sign in first.");
1203
1309
  const n = await fetch(`${r}/v1/project/save`, {
@@ -1218,11 +1324,11 @@ async function la(e, t = {}) {
1218
1324
  }
1219
1325
  return n.json();
1220
1326
  }
1221
- function ca(e = {}) {
1327
+ function ua(e = {}) {
1222
1328
  const {
1223
- appUrl: t = gr,
1224
- setStoredAuthData: r = ia,
1225
- getStoredAuthData: a = Le
1329
+ appUrl: t = mr,
1330
+ setStoredAuthData: r = oa,
1331
+ getStoredAuthData: a = Te
1226
1332
  } = e;
1227
1333
  return new Promise((s, n) => {
1228
1334
  const o = window.location.origin, i = `${t}/sdk/auth?origin=${encodeURIComponent(o)}`, u = window.open(
@@ -1238,8 +1344,8 @@ function ca(e = {}) {
1238
1344
  var w;
1239
1345
  if (p.origin === t && ((w = p.data) == null ? void 0 : w.type) === "sdk-auth") {
1240
1346
  window.removeEventListener("message", l);
1241
- const { token: c, user: m } = p.data;
1242
- c ? (r({ token: c, user: m }), s({ token: c, user: m })) : n(new Error("Authentication failed"));
1347
+ const { token: c, user: h } = p.data;
1348
+ c ? (r({ token: c, user: h }), s({ token: c, user: h })) : n(new Error("Authentication failed"));
1243
1349
  }
1244
1350
  };
1245
1351
  window.addEventListener("message", l);
@@ -1252,8 +1358,8 @@ function ca(e = {}) {
1252
1358
  }, 500);
1253
1359
  });
1254
1360
  }
1255
- async function ua(e = {}) {
1256
- const { apiUrl: t = ge, language: r, getStoredAuthData: a = Le } = e, s = a();
1361
+ async function da(e = {}) {
1362
+ const { apiUrl: t = we, language: r, getStoredAuthData: a = Te } = e, s = a();
1257
1363
  if (!(s != null && s.token))
1258
1364
  throw new Error("Authentication required. Please sign in first.");
1259
1365
  const n = new URLSearchParams();
@@ -1271,8 +1377,8 @@ async function ua(e = {}) {
1271
1377
  }
1272
1378
  return o.json();
1273
1379
  }
1274
- async function da(e, t, r = {}) {
1275
- const { apiUrl: a = ge, getStoredAuthData: s = Le } = r, n = s();
1380
+ async function pa(e, t, r = {}) {
1381
+ const { apiUrl: a = we, getStoredAuthData: s = Te } = r, n = s();
1276
1382
  if (!(n != null && n.token))
1277
1383
  throw new Error("Authentication required. Please sign in first.");
1278
1384
  const o = await fetch(`${a}/v1/project/update`, {
@@ -1293,10 +1399,10 @@ async function da(e, t, r = {}) {
1293
1399
  }
1294
1400
  return o.json();
1295
1401
  }
1296
- function pa(e = {}) {
1402
+ function fa(e = {}) {
1297
1403
  const {
1298
- apiUrl: t = ge,
1299
- appUrl: r = gr,
1404
+ apiUrl: t = we,
1405
+ appUrl: r = mr,
1300
1406
  storageKey: a = Xe,
1301
1407
  enabled: s = !0,
1302
1408
  allowAnonymous: n = !0,
@@ -1345,14 +1451,14 @@ function pa(e = {}) {
1345
1451
  clearStoredAuthData: l,
1346
1452
  signOut: l,
1347
1453
  // API methods
1348
- share: (d) => oa(d, { apiUrl: t }),
1349
- save: (d) => la(d, { apiUrl: t, getStoredAuthData: i }),
1350
- listArtifacts: (d) => ua({ apiUrl: t, language: d, getStoredAuthData: i }),
1351
- updateArtifact: (d, p) => da(d, p, { apiUrl: t, getStoredAuthData: i }),
1352
- openAuthPopup: () => ca({ appUrl: r, setStoredAuthData: u, getStoredAuthData: i })
1454
+ share: (d) => la(d, { apiUrl: t }),
1455
+ save: (d) => ca(d, { apiUrl: t, getStoredAuthData: i }),
1456
+ listArtifacts: (d) => da({ apiUrl: t, language: d, getStoredAuthData: i }),
1457
+ updateArtifact: (d, p) => pa(d, p, { apiUrl: t, getStoredAuthData: i }),
1458
+ openAuthPopup: () => ua({ appUrl: r, setStoredAuthData: u, getStoredAuthData: i })
1353
1459
  };
1354
1460
  }
1355
- function fa(e = {}) {
1461
+ function ha(e = {}) {
1356
1462
  const t = e.modules || null;
1357
1463
  let r = e.theme || "dark";
1358
1464
  function a() {
@@ -1505,8 +1611,8 @@ function fa(e = {}) {
1505
1611
  }
1506
1612
  }, { dark: !1 });
1507
1613
  }
1508
- function o(w, c, m) {
1509
- return m ? w.define([
1614
+ function o(w, c, h) {
1615
+ return h ? w.define([
1510
1616
  { tag: c.keyword, color: "#c084fc" },
1511
1617
  { tag: c.operator, color: "#94a3b8" },
1512
1618
  { tag: c.special(c.variableName), color: "#67e8f9" },
@@ -1599,95 +1705,95 @@ function fa(e = {}) {
1599
1705
  function u(w) {
1600
1706
  const c = i[w == null ? void 0 : w.toLowerCase()];
1601
1707
  if (!c) return [];
1602
- const m = t[c.mod];
1603
- return !m || typeof m[c.fn] != "function" ? [] : c.opts ? m[c.fn](c.opts) : m[c.fn]();
1708
+ const h = t[c.mod];
1709
+ return !h || typeof h[c.fn] != "function" ? [] : c.opts ? h[c.fn](c.opts) : h[c.fn]();
1604
1710
  }
1605
1711
  function l(w) {
1606
1712
  return r === "auto" ? w === "dark" : r === "dark";
1607
1713
  }
1608
1714
  function d(w, c = {}) {
1609
- var be, ie;
1715
+ var U, ve;
1610
1716
  if (!a())
1611
1717
  return console.warn("Artifactuse: CodeMirror modules not provided. Editor not available."), null;
1612
- const { EditorState: m } = t.state, {
1613
- EditorView: h,
1718
+ const { EditorState: h } = t.state, {
1719
+ EditorView: f,
1614
1720
  keymap: g,
1615
- lineNumbers: f,
1721
+ lineNumbers: m,
1616
1722
  highlightActiveLineGutter: b,
1617
1723
  highlightSpecialChars: v,
1618
- drawSelection: M,
1619
- dropCursor: $,
1620
- rectangularSelection: z,
1724
+ drawSelection: x,
1725
+ dropCursor: M,
1726
+ rectangularSelection: A,
1621
1727
  crosshairCursor: S,
1622
- highlightActiveLine: y
1623
- } = t.view, { defaultKeymap: C, history: x, historyKeymap: E, indentWithTab: T } = t.commands, {
1624
- indentOnInput: L,
1625
- syntaxHighlighting: I,
1626
- bracketMatching: G,
1627
- foldGutter: te,
1628
- foldKeymap: U,
1629
- HighlightStyle: k
1728
+ highlightActiveLine: L
1729
+ } = t.view, { defaultKeymap: $, history: y, historyKeymap: z, indentWithTab: j } = t.commands, {
1730
+ indentOnInput: E,
1731
+ syntaxHighlighting: T,
1732
+ bracketMatching: N,
1733
+ foldGutter: X,
1734
+ foldKeymap: O,
1735
+ HighlightStyle: B
1630
1736
  } = t.language, {
1631
- closeBrackets: _,
1632
- closeBracketsKeymap: R,
1633
- autocompletion: A,
1634
- completionKeymap: D
1635
- } = t.autocomplete, P = ((be = t.lezerHighlight) == null ? void 0 : be.tags) || ((ie = t.language) == null ? void 0 : ie.tags), Z = l(c.sdkTheme), ne = Z ? s(h) : n(h), re = [
1636
- f(),
1737
+ closeBrackets: k,
1738
+ closeBracketsKeymap: P,
1739
+ autocompletion: R,
1740
+ completionKeymap: C
1741
+ } = t.autocomplete, D = ((U = t.lezerHighlight) == null ? void 0 : U.tags) || ((ve = t.language) == null ? void 0 : ve.tags), _ = l(c.sdkTheme), q = _ ? s(f) : n(f), J = [
1742
+ m(),
1637
1743
  b(),
1638
1744
  v(),
1639
- x(),
1640
- te({
1745
+ y(),
1746
+ X({
1641
1747
  openText: "▾",
1642
1748
  closedText: "▸"
1643
1749
  }),
1750
+ x(),
1644
1751
  M(),
1645
- $(),
1646
- m.allowMultipleSelections.of(!0),
1647
- L(),
1648
- ...P ? [I(o(k, P, Z))] : [],
1649
- G(),
1650
- _(),
1752
+ h.allowMultipleSelections.of(!0),
1753
+ E(),
1754
+ ...D ? [T(o(B, D, _))] : [],
1755
+ N(),
1756
+ k(),
1757
+ R(),
1651
1758
  A(),
1652
- z(),
1653
1759
  S(),
1654
- y(),
1760
+ L(),
1655
1761
  g.of([
1656
- ...R,
1762
+ ...P,
1763
+ ...$,
1764
+ ...z,
1765
+ ...O,
1657
1766
  ...C,
1658
- ...E,
1659
- ...U,
1660
- ...D,
1661
- T
1767
+ j
1662
1768
  ]),
1663
1769
  u(c.language),
1664
- ne
1770
+ q
1665
1771
  ];
1666
- c.onChange && re.push(
1667
- h.updateListener.of((oe) => {
1668
- oe.docChanged && c.onChange(oe.state.doc.toString());
1772
+ c.onChange && J.push(
1773
+ f.updateListener.of((Y) => {
1774
+ Y.docChanged && c.onChange(Y.state.doc.toString());
1669
1775
  })
1670
1776
  );
1671
- const ae = m.create({
1777
+ const le = h.create({
1672
1778
  doc: c.code || "",
1673
- extensions: re
1674
- }), O = new h({
1675
- state: ae,
1779
+ extensions: J
1780
+ }), K = new f({
1781
+ state: le,
1676
1782
  parent: w
1677
1783
  });
1678
1784
  return {
1679
- view: O,
1785
+ view: K,
1680
1786
  getCode() {
1681
- return O.state.doc.toString();
1787
+ return K.state.doc.toString();
1682
1788
  },
1683
- setCode(oe) {
1684
- const it = O.state.doc.toString();
1685
- it !== oe && O.dispatch({
1686
- changes: { from: 0, to: it.length, insert: oe }
1789
+ setCode(Y) {
1790
+ const it = K.state.doc.toString();
1791
+ it !== Y && K.dispatch({
1792
+ changes: { from: 0, to: it.length, insert: Y }
1687
1793
  });
1688
1794
  },
1689
1795
  destroy() {
1690
- O.destroy();
1796
+ K.destroy();
1691
1797
  }
1692
1798
  };
1693
1799
  }
@@ -1703,53 +1809,53 @@ function fa(e = {}) {
1703
1809
  function Ke() {
1704
1810
  return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
1705
1811
  }
1706
- var ee = Ke();
1707
- function mr(e) {
1708
- ee = e;
1812
+ var ie = Ke();
1813
+ function wr(e) {
1814
+ ie = e;
1709
1815
  }
1710
- var he = { exec: () => null };
1711
- function j(e, t = "") {
1816
+ var me = { exec: () => null };
1817
+ function H(e, t = "") {
1712
1818
  let r = typeof e == "string" ? e : e.source, a = { replace: (s, n) => {
1713
1819
  let o = typeof n == "string" ? n : n.source;
1714
- return o = o.replace(q.caret, "$1"), r = r.replace(s, o), a;
1820
+ return o = o.replace(Z.caret, "$1"), r = r.replace(s, o), a;
1715
1821
  }, getRegex: () => new RegExp(r, t) };
1716
1822
  return a;
1717
1823
  }
1718
- var ha = (() => {
1824
+ var ga = (() => {
1719
1825
  try {
1720
1826
  return !!new RegExp("(?<=1)(?<!1)");
1721
1827
  } catch {
1722
1828
  return !1;
1723
1829
  }
1724
- })(), q = { 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") }, ga = /^(?:[ \t]*(?:\n|$))+/, ma = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, wa = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, me = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ba = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, wr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, br = j(wr).replace(/bull/g, Je).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(), va = j(wr).replace(/bull/g, Je).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(), Qe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ya = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ka = j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), xa = j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Je).getRegex(), Te = "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", et = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ma = j("^ {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", et).replace("tag", Te).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), vr = j(Qe).replace("hr", me).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", Te).getRegex(), $a = j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", vr).getRegex(), tt = { blockquote: $a, code: ma, def: ka, fences: wa, heading: ba, hr: me, html: Ma, lheading: br, list: xa, newline: ga, paragraph: vr, table: he, text: ya }, pt = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", me).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", Te).getRegex(), za = { ...tt, lheading: va, table: pt, paragraph: j(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", pt).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", Te).getRegex() }, Aa = { ...tt, html: j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", et).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: he, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: j(Qe).replace("hr", me).replace("heading", ` *#{1,6} *[^
1725
- ]`).replace("lheading", br).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Sa = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ca = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, yr = /^( {2,}|\\)\n(?!\s*$)/, Ra = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, _e = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, kr = /[^\s\p{P}\p{S}]/u, La = j(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), xr = /(?!~)[\p{P}\p{S}]/u, Ta = /(?!~)[\s\p{P}\p{S}]/u, _a = /(?:[^\s\p{P}\p{S}]|~)/u, Ea = j(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ha ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Mr = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Pa = j(Mr, "u").replace(/punct/g, _e).getRegex(), ja = j(Mr, "u").replace(/punct/g, xr).getRegex(), $r = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ha = j($r, "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, _e).getRegex(), Va = j($r, "gu").replace(/notPunctSpace/g, _a).replace(/punctSpace/g, Ta).replace(/punct/g, xr).getRegex(), Ia = j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, _e).getRegex(), Da = j(/\\(punct)/, "gu").replace(/punct/g, _e).getRegex(), qa = j(/^<(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 = j(et).replace("(?:-->|$)", "-->").getRegex(), Oa = j("^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(), $e = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ba = j(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", $e).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), zr = j(/^!?\[(label)\]\[(ref)\]/).replace("label", $e).replace("ref", Ye).getRegex(), Ar = j(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Fa = j("reflink|nolink(?!\\()", "g").replace("reflink", zr).replace("nolink", Ar).getRegex(), ft = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: he, anyPunctuation: Da, autolink: qa, blockSkip: Ea, br: yr, code: Ca, del: he, emStrongLDelim: Pa, emStrongRDelimAst: Ha, emStrongRDelimUnd: Ia, escape: Sa, link: Ba, nolink: Ar, punctuation: La, reflink: zr, reflinkSearch: Fa, tag: Oa, text: Ra, url: he }, Na = { ...at, link: j(/^!?\[(label)\]\((.*?)\)/).replace("label", $e).getRegex(), reflink: j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", $e).getRegex() }, Ve = { ...at, emStrongRDelimAst: Va, emStrongLDelim: ja, url: j(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ft).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: j(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ft).getRegex() }, Ua = { ...Ve, br: j(yr).replace("{2,}", "*").getRegex(), text: j(Ve.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ye = { normal: tt, gfm: za, pedantic: Aa }, ce = { normal: at, gfm: Ve, breaks: Ua, pedantic: Na }, Ga = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ht = (e) => Ga[e];
1726
- function W(e, t) {
1830
+ })(), Z = { 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") }, ma = /^(?:[ \t]*(?:\n|$))+/, wa = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ba = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, be = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, va = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, br = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, vr = H(br).replace(/bull/g, Je).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(), ya = H(br).replace(/bull/g, Je).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(), Qe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ka = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, xa = H(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ma = H(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Je).getRegex(), _e = "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", et = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, $a = H("^ {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", et).replace("tag", _e).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), yr = H(Qe).replace("hr", be).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", _e).getRegex(), Aa = H(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", yr).getRegex(), tt = { blockquote: Aa, code: wa, def: xa, fences: ba, heading: va, hr: be, html: $a, lheading: vr, list: Ma, newline: ma, paragraph: yr, table: me, text: ka }, ft = H("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", be).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", _e).getRegex(), za = { ...tt, lheading: ya, table: ft, paragraph: H(Qe).replace("hr", be).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ft).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", _e).getRegex() }, Sa = { ...tt, html: H(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", et).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: me, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: H(Qe).replace("hr", be).replace("heading", ` *#{1,6} *[^
1831
+ ]`).replace("lheading", vr).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ca = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ra = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, kr = /^( {2,}|\\)\n(?!\s*$)/, La = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ee = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, xr = /[^\s\p{P}\p{S}]/u, Ta = H(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), Mr = /(?!~)[\p{P}\p{S}]/u, _a = /(?!~)[\s\p{P}\p{S}]/u, Ea = /(?:[^\s\p{P}\p{S}]|~)/u, Pa = H(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ga ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), $r = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, ja = H($r, "u").replace(/punct/g, Ee).getRegex(), Ha = H($r, "u").replace(/punct/g, Mr).getRegex(), Ar = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Va = H(Ar, "gu").replace(/notPunctSpace/g, xr).replace(/punctSpace/g, rt).replace(/punct/g, Ee).getRegex(), Ia = H(Ar, "gu").replace(/notPunctSpace/g, Ea).replace(/punctSpace/g, _a).replace(/punct/g, Mr).getRegex(), Da = H("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, xr).replace(/punctSpace/g, rt).replace(/punct/g, Ee).getRegex(), qa = H(/\\(punct)/, "gu").replace(/punct/g, Ee).getRegex(), Za = H(/^<(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(), Oa = H(et).replace("(?:-->|$)", "-->").getRegex(), Ba = H("^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", Oa).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ae = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Fa = H(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Ae).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), zr = H(/^!?\[(label)\]\[(ref)\]/).replace("label", Ae).replace("ref", Ye).getRegex(), Sr = H(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Na = H("reflink|nolink(?!\\()", "g").replace("reflink", zr).replace("nolink", Sr).getRegex(), ht = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: me, anyPunctuation: qa, autolink: Za, blockSkip: Pa, br: kr, code: Ra, del: me, emStrongLDelim: ja, emStrongRDelimAst: Va, emStrongRDelimUnd: Da, escape: Ca, link: Fa, nolink: Sr, punctuation: Ta, reflink: zr, reflinkSearch: Na, tag: Ba, text: La, url: me }, Ua = { ...at, link: H(/^!?\[(label)\]\((.*?)\)/).replace("label", Ae).getRegex(), reflink: H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ae).getRegex() }, Ve = { ...at, emStrongRDelimAst: Ia, emStrongLDelim: Ha, url: H(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ht).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: H(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ht).getRegex() }, Ga = { ...Ve, br: H(kr).replace("{2,}", "*").getRegex(), text: H(Ve.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ke = { normal: tt, gfm: za, pedantic: Sa }, ue = { normal: at, gfm: Ve, breaks: Ga, pedantic: Ua }, Wa = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, gt = (e) => Wa[e];
1832
+ function Q(e, t) {
1727
1833
  if (t) {
1728
- if (q.escapeTest.test(e)) return e.replace(q.escapeReplace, ht);
1729
- } else if (q.escapeTestNoEncode.test(e)) return e.replace(q.escapeReplaceNoEncode, ht);
1834
+ if (Z.escapeTest.test(e)) return e.replace(Z.escapeReplace, gt);
1835
+ } else if (Z.escapeTestNoEncode.test(e)) return e.replace(Z.escapeReplaceNoEncode, gt);
1730
1836
  return e;
1731
1837
  }
1732
- function gt(e) {
1838
+ function mt(e) {
1733
1839
  try {
1734
- e = encodeURI(e).replace(q.percentDecode, "%");
1840
+ e = encodeURI(e).replace(Z.percentDecode, "%");
1735
1841
  } catch {
1736
1842
  return null;
1737
1843
  }
1738
1844
  return e;
1739
1845
  }
1740
- function mt(e, t) {
1846
+ function wt(e, t) {
1741
1847
  var n;
1742
- let r = e.replace(q.findPipe, (o, i, u) => {
1848
+ let r = e.replace(Z.findPipe, (o, i, u) => {
1743
1849
  let l = !1, d = i;
1744
1850
  for (; --d >= 0 && u[d] === "\\"; ) l = !l;
1745
1851
  return l ? "|" : " |";
1746
- }), a = r.split(q.splitPipe), s = 0;
1852
+ }), a = r.split(Z.splitPipe), s = 0;
1747
1853
  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);
1748
1854
  else for (; a.length < t; ) a.push("");
1749
- for (; s < a.length; s++) a[s] = a[s].trim().replace(q.slashPipe, "|");
1855
+ for (; s < a.length; s++) a[s] = a[s].trim().replace(Z.slashPipe, "|");
1750
1856
  return a;
1751
1857
  }
1752
- function ue(e, t, r) {
1858
+ function de(e, t, r) {
1753
1859
  let a = e.length;
1754
1860
  if (a === 0) return "";
1755
1861
  let s = 0;
@@ -1757,7 +1863,7 @@ function ue(e, t, r) {
1757
1863
  s++;
1758
1864
  return e.slice(0, a - s);
1759
1865
  }
1760
- function Wa(e, t) {
1866
+ function Xa(e, t) {
1761
1867
  if (e.indexOf(t[1]) === -1) return -1;
1762
1868
  let r = 0;
1763
1869
  for (let a = 0; a < e.length; a++) if (e[a] === "\\") a++;
@@ -1765,13 +1871,13 @@ function Wa(e, t) {
1765
1871
  else if (e[a] === t[1] && (r--, r < 0)) return a;
1766
1872
  return r > 0 ? -2 : -1;
1767
1873
  }
1768
- function wt(e, t, r, a, s) {
1874
+ function bt(e, t, r, a, s) {
1769
1875
  let n = t.href, o = t.title || null, i = e[1].replace(s.other.outputLinkReplace, "$1");
1770
1876
  a.state.inLink = !0;
1771
1877
  let u = { type: e[0].charAt(0) === "!" ? "image" : "link", raw: r, href: n, title: o, text: i, tokens: a.inlineTokens(i) };
1772
1878
  return a.state.inLink = !1, u;
1773
1879
  }
1774
- function Xa(e, t, r) {
1880
+ function Ka(e, t, r) {
1775
1881
  let a = e.match(r.other.indentCodeCompensation);
1776
1882
  if (a === null) return t;
1777
1883
  let s = a[1];
@@ -1786,10 +1892,10 @@ function Xa(e, t, r) {
1786
1892
  }
1787
1893
  var ze = class {
1788
1894
  constructor(e) {
1789
- V(this, "options");
1790
- V(this, "rules");
1791
- V(this, "lexer");
1792
- this.options = e || ee;
1895
+ I(this, "options");
1896
+ I(this, "rules");
1897
+ I(this, "lexer");
1898
+ this.options = e || ie;
1793
1899
  }
1794
1900
  space(e) {
1795
1901
  let t = this.rules.block.newline.exec(e);
@@ -1799,14 +1905,14 @@ var ze = class {
1799
1905
  let t = this.rules.block.code.exec(e);
1800
1906
  if (t) {
1801
1907
  let r = t[0].replace(this.rules.other.codeRemoveIndent, "");
1802
- return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : ue(r, `
1908
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : de(r, `
1803
1909
  `) };
1804
1910
  }
1805
1911
  }
1806
1912
  fences(e) {
1807
1913
  let t = this.rules.block.fences.exec(e);
1808
1914
  if (t) {
1809
- let r = t[0], a = Xa(r, t[3] || "", this.rules);
1915
+ let r = t[0], a = Ka(r, t[3] || "", this.rules);
1810
1916
  return { type: "code", raw: r, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: a };
1811
1917
  }
1812
1918
  }
@@ -1815,7 +1921,7 @@ var ze = class {
1815
1921
  if (t) {
1816
1922
  let r = t[2].trim();
1817
1923
  if (this.rules.other.endingHash.test(r)) {
1818
- let a = ue(r, "#");
1924
+ let a = de(r, "#");
1819
1925
  (this.options.pedantic || !a || this.rules.other.endingSpaceChar.test(a)) && (r = a.trim());
1820
1926
  }
1821
1927
  return { type: "heading", raw: t[0], depth: t[1].length, text: r, tokens: this.lexer.inline(r) };
@@ -1823,13 +1929,13 @@ var ze = class {
1823
1929
  }
1824
1930
  hr(e) {
1825
1931
  let t = this.rules.block.hr.exec(e);
1826
- if (t) return { type: "hr", raw: ue(t[0], `
1932
+ if (t) return { type: "hr", raw: de(t[0], `
1827
1933
  `) };
1828
1934
  }
1829
1935
  blockquote(e) {
1830
1936
  let t = this.rules.block.blockquote.exec(e);
1831
1937
  if (t) {
1832
- let r = ue(t[0], `
1938
+ let r = de(t[0], `
1833
1939
  `).split(`
1834
1940
  `), a = "", s = "", n = [];
1835
1941
  for (; r.length > 0; ) {
@@ -1849,16 +1955,16 @@ ${d}` : d;
1849
1955
  let w = n.at(-1);
1850
1956
  if ((w == null ? void 0 : w.type) === "code") break;
1851
1957
  if ((w == null ? void 0 : w.type) === "blockquote") {
1852
- let c = w, m = c.raw + `
1958
+ let c = w, h = c.raw + `
1853
1959
  ` + r.join(`
1854
- `), h = this.blockquote(m);
1855
- n[n.length - 1] = h, a = a.substring(0, a.length - c.raw.length) + h.raw, s = s.substring(0, s.length - c.text.length) + h.text;
1960
+ `), f = this.blockquote(h);
1961
+ n[n.length - 1] = f, a = a.substring(0, a.length - c.raw.length) + f.raw, s = s.substring(0, s.length - c.text.length) + f.text;
1856
1962
  break;
1857
1963
  } else if ((w == null ? void 0 : w.type) === "list") {
1858
- let c = w, m = c.raw + `
1964
+ let c = w, h = c.raw + `
1859
1965
  ` + r.join(`
1860
- `), h = this.list(m);
1861
- n[n.length - 1] = h, a = a.substring(0, a.length - w.raw.length) + h.raw, s = s.substring(0, s.length - c.raw.length) + h.raw, r = m.substring(n.at(-1).raw.length).split(`
1966
+ `), f = this.list(h);
1967
+ n[n.length - 1] = f, a = a.substring(0, a.length - w.raw.length) + f.raw, s = s.substring(0, s.length - c.raw.length) + f.raw, r = h.substring(n.at(-1).raw.length).split(`
1862
1968
  `);
1863
1969
  continue;
1864
1970
  }
@@ -1878,24 +1984,24 @@ ${d}` : d;
1878
1984
  if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
1879
1985
  p = t[0], e = e.substring(p.length);
1880
1986
  let c = t[2].split(`
1881
- `, 1)[0].replace(this.rules.other.listReplaceTabs, (f) => " ".repeat(3 * f.length)), m = e.split(`
1882
- `, 1)[0], h = !c.trim(), g = 0;
1883
- if (this.options.pedantic ? (g = 2, w = c.trimStart()) : h ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, w = c.slice(g), g += t[1].length), h && this.rules.other.blankLine.test(m) && (p += m + `
1884
- `, e = e.substring(m.length + 1), d = !0), !d) {
1885
- let f = this.rules.other.nextBulletRegex(g), b = this.rules.other.hrRegex(g), v = this.rules.other.fencesBeginRegex(g), M = this.rules.other.headingBeginRegex(g), $ = this.rules.other.htmlBeginRegex(g);
1987
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (m) => " ".repeat(3 * m.length)), h = e.split(`
1988
+ `, 1)[0], f = !c.trim(), g = 0;
1989
+ if (this.options.pedantic ? (g = 2, w = c.trimStart()) : f ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, w = c.slice(g), g += t[1].length), f && this.rules.other.blankLine.test(h) && (p += h + `
1990
+ `, e = e.substring(h.length + 1), d = !0), !d) {
1991
+ let m = this.rules.other.nextBulletRegex(g), b = this.rules.other.hrRegex(g), v = this.rules.other.fencesBeginRegex(g), x = this.rules.other.headingBeginRegex(g), M = this.rules.other.htmlBeginRegex(g);
1886
1992
  for (; e; ) {
1887
- let z = e.split(`
1993
+ let A = e.split(`
1888
1994
  `, 1)[0], S;
1889
- if (m = z, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), S = m) : S = m.replace(this.rules.other.tabCharGlobal, " "), v.test(m) || M.test(m) || $.test(m) || f.test(m) || b.test(m)) break;
1890
- if (S.search(this.rules.other.nonSpaceChar) >= g || !m.trim()) w += `
1995
+ if (h = A, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), S = h) : S = h.replace(this.rules.other.tabCharGlobal, " "), v.test(h) || x.test(h) || M.test(h) || m.test(h) || b.test(h)) break;
1996
+ if (S.search(this.rules.other.nonSpaceChar) >= g || !h.trim()) w += `
1891
1997
  ` + S.slice(g);
1892
1998
  else {
1893
- if (h || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(c) || M.test(c) || b.test(c)) break;
1999
+ if (f || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(c) || x.test(c) || b.test(c)) break;
1894
2000
  w += `
1895
- ` + m;
2001
+ ` + h;
1896
2002
  }
1897
- !h && !m.trim() && (h = !0), p += z + `
1898
- `, e = e.substring(z.length + 1), c = S.slice(g);
2003
+ !f && !h.trim() && (f = !0), p += A + `
2004
+ `, e = e.substring(A.length + 1), c = S.slice(g);
1899
2005
  }
1900
2006
  }
1901
2007
  o.loose || (u ? o.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (u = !0)), o.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(w), loose: !1, text: w, tokens: [] }), o.raw += p;
@@ -1946,12 +2052,12 @@ ${d}` : d;
1946
2052
  var o;
1947
2053
  let t = this.rules.block.table.exec(e);
1948
2054
  if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
1949
- let r = mt(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(`
2055
+ let r = wt(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(`
1950
2056
  `) : [], n = { type: "table", raw: t[0], header: [], align: [], rows: [] };
1951
2057
  if (r.length === a.length) {
1952
2058
  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);
1953
2059
  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] });
1954
- for (let i of s) n.rows.push(mt(i, n.header.length).map((u, l) => ({ text: u, tokens: this.lexer.inline(u), header: !1, align: n.align[l] })));
2060
+ for (let i of s) n.rows.push(wt(i, n.header.length).map((u, l) => ({ text: u, tokens: this.lexer.inline(u), header: !1, align: n.align[l] })));
1955
2061
  return n;
1956
2062
  }
1957
2063
  }
@@ -1985,10 +2091,10 @@ ${d}` : d;
1985
2091
  let r = t[2].trim();
1986
2092
  if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
1987
2093
  if (!this.rules.other.endAngleBracket.test(r)) return;
1988
- let n = ue(r.slice(0, -1), "\\");
2094
+ let n = de(r.slice(0, -1), "\\");
1989
2095
  if ((r.length - n.length) % 2 === 0) return;
1990
2096
  } else {
1991
- let n = Wa(t[2], "()");
2097
+ let n = Xa(t[2], "()");
1992
2098
  if (n === -2) return;
1993
2099
  if (n > -1) {
1994
2100
  let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + n;
@@ -2000,7 +2106,7 @@ ${d}` : d;
2000
2106
  let n = this.rules.other.pedanticHrefTitle.exec(a);
2001
2107
  n && (a = n[1], s = n[3]);
2002
2108
  } else s = t[3] ? t[3].slice(1, -1) : "";
2003
- 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)), wt(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);
2109
+ 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)), bt(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);
2004
2110
  }
2005
2111
  }
2006
2112
  reflink(e, t) {
@@ -2011,7 +2117,7 @@ ${d}` : d;
2011
2117
  let n = r[0].charAt(0);
2012
2118
  return { type: "text", raw: n, text: n };
2013
2119
  }
2014
- return wt(r, s, r[0], this.lexer, this.rules);
2120
+ return bt(r, s, r[0], this.lexer, this.rules);
2015
2121
  }
2016
2122
  }
2017
2123
  emStrong(e, t, r = "") {
@@ -2084,19 +2190,19 @@ ${d}` : d;
2084
2190
  return { type: "text", raw: t[0], text: t[0], escaped: r };
2085
2191
  }
2086
2192
  }
2087
- }, F = class Ie {
2193
+ }, G = class Ie {
2088
2194
  constructor(t) {
2089
- V(this, "tokens");
2090
- V(this, "options");
2091
- V(this, "state");
2092
- V(this, "inlineQueue");
2093
- V(this, "tokenizer");
2094
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || ee, this.options.tokenizer = this.options.tokenizer || new ze(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
2095
- let r = { other: q, block: ye.normal, inline: ce.normal };
2096
- this.options.pedantic ? (r.block = ye.pedantic, r.inline = ce.pedantic) : this.options.gfm && (r.block = ye.gfm, this.options.breaks ? r.inline = ce.breaks : r.inline = ce.gfm), this.tokenizer.rules = r;
2195
+ I(this, "tokens");
2196
+ I(this, "options");
2197
+ I(this, "state");
2198
+ I(this, "inlineQueue");
2199
+ I(this, "tokenizer");
2200
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || ie, this.options.tokenizer = this.options.tokenizer || new ze(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
2201
+ let r = { other: Z, block: ke.normal, inline: ue.normal };
2202
+ this.options.pedantic ? (r.block = ke.pedantic, r.inline = ue.pedantic) : this.options.gfm && (r.block = ke.gfm, this.options.breaks ? r.inline = ue.breaks : r.inline = ue.gfm), this.tokenizer.rules = r;
2097
2203
  }
2098
2204
  static get rules() {
2099
- return { block: ye, inline: ce };
2205
+ return { block: ke, inline: ue };
2100
2206
  }
2101
2207
  static lex(t, r) {
2102
2208
  return new Ie(r).lex(t);
@@ -2105,7 +2211,7 @@ ${d}` : d;
2105
2211
  return new Ie(r).inlineTokens(t);
2106
2212
  }
2107
2213
  lex(t) {
2108
- t = t.replace(q.carriageReturn, `
2214
+ t = t.replace(Z.carriageReturn, `
2109
2215
  `), this.blockTokens(t, this.tokens);
2110
2216
  for (let r = 0; r < this.inlineQueue.length; r++) {
2111
2217
  let a = this.inlineQueue[r];
@@ -2115,7 +2221,7 @@ ${d}` : d;
2115
2221
  }
2116
2222
  blockTokens(t, r = [], a = !1) {
2117
2223
  var s, n, o;
2118
- for (this.options.pedantic && (t = t.replace(q.tabCharGlobal, " ").replace(q.spaceLine, "")); t; ) {
2224
+ for (this.options.pedantic && (t = t.replace(Z.tabCharGlobal, " ").replace(Z.spaceLine, "")); t; ) {
2119
2225
  let i;
2120
2226
  if ((n = (s = this.options.extensions) == null ? void 0 : s.block) != null && n.some((l) => (i = l.call({ lexer: this }, t, r)) ? (t = t.substring(i.raw.length), r.push(i), !0) : !1)) continue;
2121
2227
  if (i = this.tokenizer.space(t)) {
@@ -2227,7 +2333,7 @@ ${d}` : d;
2227
2333
  for (; t; ) {
2228
2334
  o || (i = ""), o = !1;
2229
2335
  let c;
2230
- if ((p = (d = this.options.extensions) == null ? void 0 : d.inline) != null && p.some((h) => (c = h.call({ lexer: this }, t, r)) ? (t = t.substring(c.raw.length), r.push(c), !0) : !1)) continue;
2336
+ if ((p = (d = this.options.extensions) == null ? void 0 : d.inline) != null && p.some((f) => (c = f.call({ lexer: this }, t, r)) ? (t = t.substring(c.raw.length), r.push(c), !0) : !1)) continue;
2231
2337
  if (c = this.tokenizer.escape(t)) {
2232
2338
  t = t.substring(c.raw.length), r.push(c);
2233
2339
  continue;
@@ -2242,8 +2348,8 @@ ${d}` : d;
2242
2348
  }
2243
2349
  if (c = this.tokenizer.reflink(t, this.tokens.links)) {
2244
2350
  t = t.substring(c.raw.length);
2245
- let h = r.at(-1);
2246
- c.type === "text" && (h == null ? void 0 : h.type) === "text" ? (h.raw += c.raw, h.text += c.text) : r.push(c);
2351
+ let f = r.at(-1);
2352
+ c.type === "text" && (f == null ? void 0 : f.type) === "text" ? (f.raw += c.raw, f.text += c.text) : r.push(c);
2247
2353
  continue;
2248
2354
  }
2249
2355
  if (c = this.tokenizer.emStrong(t, a, i)) {
@@ -2270,44 +2376,44 @@ ${d}` : d;
2270
2376
  t = t.substring(c.raw.length), r.push(c);
2271
2377
  continue;
2272
2378
  }
2273
- let m = t;
2379
+ let h = t;
2274
2380
  if ((w = this.options.extensions) != null && w.startInline) {
2275
- let h = 1 / 0, g = t.slice(1), f;
2381
+ let f = 1 / 0, g = t.slice(1), m;
2276
2382
  this.options.extensions.startInline.forEach((b) => {
2277
- f = b.call({ lexer: this }, g), typeof f == "number" && f >= 0 && (h = Math.min(h, f));
2278
- }), h < 1 / 0 && h >= 0 && (m = t.substring(0, h + 1));
2383
+ m = b.call({ lexer: this }, g), typeof m == "number" && m >= 0 && (f = Math.min(f, m));
2384
+ }), f < 1 / 0 && f >= 0 && (h = t.substring(0, f + 1));
2279
2385
  }
2280
- if (c = this.tokenizer.inlineText(m)) {
2386
+ if (c = this.tokenizer.inlineText(h)) {
2281
2387
  t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (i = c.raw.slice(-1)), o = !0;
2282
- let h = r.at(-1);
2283
- (h == null ? void 0 : h.type) === "text" ? (h.raw += c.raw, h.text += c.text) : r.push(c);
2388
+ let f = r.at(-1);
2389
+ (f == null ? void 0 : f.type) === "text" ? (f.raw += c.raw, f.text += c.text) : r.push(c);
2284
2390
  continue;
2285
2391
  }
2286
2392
  if (t) {
2287
- let h = "Infinite loop on byte: " + t.charCodeAt(0);
2393
+ let f = "Infinite loop on byte: " + t.charCodeAt(0);
2288
2394
  if (this.options.silent) {
2289
- console.error(h);
2395
+ console.error(f);
2290
2396
  break;
2291
- } else throw new Error(h);
2397
+ } else throw new Error(f);
2292
2398
  }
2293
2399
  }
2294
2400
  return r;
2295
2401
  }
2296
- }, Ae = class {
2402
+ }, Se = class {
2297
2403
  constructor(e) {
2298
- V(this, "options");
2299
- V(this, "parser");
2300
- this.options = e || ee;
2404
+ I(this, "options");
2405
+ I(this, "parser");
2406
+ this.options = e || ie;
2301
2407
  }
2302
2408
  space(e) {
2303
2409
  return "";
2304
2410
  }
2305
2411
  code({ text: e, lang: t, escaped: r }) {
2306
2412
  var n;
2307
- let a = (n = (t || "").match(q.notSpaceStart)) == null ? void 0 : n[0], s = e.replace(q.endingNewline, "") + `
2413
+ let a = (n = (t || "").match(Z.notSpaceStart)) == null ? void 0 : n[0], s = e.replace(Z.endingNewline, "") + `
2308
2414
  `;
2309
- return a ? '<pre><code class="language-' + W(a) + '">' + (r ? s : W(s, !0)) + `</code></pre>
2310
- ` : "<pre><code>" + (r ? s : W(s, !0)) + `</code></pre>
2415
+ return a ? '<pre><code class="language-' + Q(a) + '">' + (r ? s : Q(s, !0)) + `</code></pre>
2416
+ ` : "<pre><code>" + (r ? s : Q(s, !0)) + `</code></pre>
2311
2417
  `;
2312
2418
  }
2313
2419
  blockquote({ tokens: e }) {
@@ -2385,7 +2491,7 @@ ${e}</tr>
2385
2491
  return `<em>${this.parser.parseInline(e)}</em>`;
2386
2492
  }
2387
2493
  codespan({ text: e }) {
2388
- return `<code>${W(e, !0)}</code>`;
2494
+ return `<code>${Q(e, !0)}</code>`;
2389
2495
  }
2390
2496
  br(e) {
2391
2497
  return "<br>";
@@ -2394,22 +2500,22 @@ ${e}</tr>
2394
2500
  return `<del>${this.parser.parseInline(e)}</del>`;
2395
2501
  }
2396
2502
  link({ href: e, title: t, tokens: r }) {
2397
- let a = this.parser.parseInline(r), s = gt(e);
2503
+ let a = this.parser.parseInline(r), s = mt(e);
2398
2504
  if (s === null) return a;
2399
2505
  e = s;
2400
2506
  let n = '<a href="' + e + '"';
2401
- return t && (n += ' title="' + W(t) + '"'), n += ">" + a + "</a>", n;
2507
+ return t && (n += ' title="' + Q(t) + '"'), n += ">" + a + "</a>", n;
2402
2508
  }
2403
2509
  image({ href: e, title: t, text: r, tokens: a }) {
2404
2510
  a && (r = this.parser.parseInline(a, this.parser.textRenderer));
2405
- let s = gt(e);
2406
- if (s === null) return W(r);
2511
+ let s = mt(e);
2512
+ if (s === null) return Q(r);
2407
2513
  e = s;
2408
2514
  let n = `<img src="${e}" alt="${r}"`;
2409
- return t && (n += ` title="${W(t)}"`), n += ">", n;
2515
+ return t && (n += ` title="${Q(t)}"`), n += ">", n;
2410
2516
  }
2411
2517
  text(e) {
2412
- return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : W(e.text);
2518
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : Q(e.text);
2413
2519
  }
2414
2520
  }, st = class {
2415
2521
  strong({ text: e }) {
@@ -2442,12 +2548,12 @@ ${e}</tr>
2442
2548
  checkbox({ raw: e }) {
2443
2549
  return e;
2444
2550
  }
2445
- }, N = class De {
2551
+ }, W = class De {
2446
2552
  constructor(t) {
2447
- V(this, "options");
2448
- V(this, "renderer");
2449
- V(this, "textRenderer");
2450
- this.options = t || ee, this.options.renderer = this.options.renderer || new Ae(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new st();
2553
+ I(this, "options");
2554
+ I(this, "renderer");
2555
+ I(this, "textRenderer");
2556
+ this.options = t || ie, this.options.renderer = this.options.renderer || new Se(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new st();
2451
2557
  }
2452
2558
  static parse(t, r) {
2453
2559
  return new De(r).parse(t);
@@ -2593,11 +2699,11 @@ ${e}</tr>
2593
2699
  }
2594
2700
  return a;
2595
2701
  }
2596
- }, xe, pe = (xe = class {
2702
+ }, Me, fe = (Me = class {
2597
2703
  constructor(e) {
2598
- V(this, "options");
2599
- V(this, "block");
2600
- this.options = e || ee;
2704
+ I(this, "options");
2705
+ I(this, "block");
2706
+ this.options = e || ie;
2601
2707
  }
2602
2708
  preprocess(e) {
2603
2709
  return e;
@@ -2612,23 +2718,23 @@ ${e}</tr>
2612
2718
  return e;
2613
2719
  }
2614
2720
  provideLexer() {
2615
- return this.block ? F.lex : F.lexInline;
2721
+ return this.block ? G.lex : G.lexInline;
2616
2722
  }
2617
2723
  provideParser() {
2618
- return this.block ? N.parse : N.parseInline;
2724
+ return this.block ? W.parse : W.parseInline;
2619
2725
  }
2620
- }, V(xe, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), V(xe, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), xe), Ka = class {
2726
+ }, I(Me, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(Me, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Me), Ja = class {
2621
2727
  constructor(...e) {
2622
- V(this, "defaults", Ke());
2623
- V(this, "options", this.setOptions);
2624
- V(this, "parse", this.parseMarkdown(!0));
2625
- V(this, "parseInline", this.parseMarkdown(!1));
2626
- V(this, "Parser", N);
2627
- V(this, "Renderer", Ae);
2628
- V(this, "TextRenderer", st);
2629
- V(this, "Lexer", F);
2630
- V(this, "Tokenizer", ze);
2631
- V(this, "Hooks", pe);
2728
+ I(this, "defaults", Ke());
2729
+ I(this, "options", this.setOptions);
2730
+ I(this, "parse", this.parseMarkdown(!0));
2731
+ I(this, "parseInline", this.parseMarkdown(!1));
2732
+ I(this, "Parser", W);
2733
+ I(this, "Renderer", Se);
2734
+ I(this, "TextRenderer", st);
2735
+ I(this, "Lexer", G);
2736
+ I(this, "Tokenizer", ze);
2737
+ I(this, "Hooks", fe);
2632
2738
  this.use(...e);
2633
2739
  }
2634
2740
  walkTokens(e, t) {
@@ -2676,7 +2782,7 @@ ${e}</tr>
2676
2782
  }
2677
2783
  "childTokens" in s && s.childTokens && (t.childTokens[s.name] = s.childTokens);
2678
2784
  }), a.extensions = t), r.renderer) {
2679
- let s = this.defaults.renderer || new Ae(this.defaults);
2785
+ let s = this.defaults.renderer || new Se(this.defaults);
2680
2786
  for (let n in r.renderer) {
2681
2787
  if (!(n in s)) throw new Error(`renderer '${n}' does not exist`);
2682
2788
  if (["options", "parser"].includes(n)) continue;
@@ -2702,13 +2808,13 @@ ${e}</tr>
2702
2808
  a.tokenizer = s;
2703
2809
  }
2704
2810
  if (r.hooks) {
2705
- let s = this.defaults.hooks || new pe();
2811
+ let s = this.defaults.hooks || new fe();
2706
2812
  for (let n in r.hooks) {
2707
2813
  if (!(n in s)) throw new Error(`hook '${n}' does not exist`);
2708
2814
  if (["options", "block"].includes(n)) continue;
2709
2815
  let o = n, i = r.hooks[o], u = s[o];
2710
- pe.passThroughHooks.has(n) ? s[o] = (l) => {
2711
- if (this.defaults.async && pe.passThroughHooksRespectAsync.has(n)) return (async () => {
2816
+ fe.passThroughHooks.has(n) ? s[o] = (l) => {
2817
+ if (this.defaults.async && fe.passThroughHooksRespectAsync.has(n)) return (async () => {
2712
2818
  let p = await i.call(s, l);
2713
2819
  return u.call(s, p);
2714
2820
  })();
@@ -2739,10 +2845,10 @@ ${e}</tr>
2739
2845
  return this.defaults = { ...this.defaults, ...e }, this;
2740
2846
  }
2741
2847
  lexer(e, t) {
2742
- return F.lex(e, t ?? this.defaults);
2848
+ return G.lex(e, t ?? this.defaults);
2743
2849
  }
2744
2850
  parser(e, t) {
2745
- return N.parse(e, t ?? this.defaults);
2851
+ return W.parse(e, t ?? this.defaults);
2746
2852
  }
2747
2853
  parseMarkdown(e) {
2748
2854
  return (t, r) => {
@@ -2751,16 +2857,16 @@ ${e}</tr>
2751
2857
  if (typeof t > "u" || t === null) return n(new Error("marked(): input parameter is undefined or null"));
2752
2858
  if (typeof t != "string") return n(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
2753
2859
  if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
2754
- let o = s.hooks ? await s.hooks.preprocess(t) : t, i = await (s.hooks ? await s.hooks.provideLexer() : e ? F.lex : F.lexInline)(o, s), u = s.hooks ? await s.hooks.processAllTokens(i) : i;
2860
+ let o = s.hooks ? await s.hooks.preprocess(t) : t, i = await (s.hooks ? await s.hooks.provideLexer() : e ? G.lex : G.lexInline)(o, s), u = s.hooks ? await s.hooks.processAllTokens(i) : i;
2755
2861
  s.walkTokens && await Promise.all(this.walkTokens(u, s.walkTokens));
2756
- let l = await (s.hooks ? await s.hooks.provideParser() : e ? N.parse : N.parseInline)(u, s);
2862
+ let l = await (s.hooks ? await s.hooks.provideParser() : e ? W.parse : W.parseInline)(u, s);
2757
2863
  return s.hooks ? await s.hooks.postprocess(l) : l;
2758
2864
  })().catch(n);
2759
2865
  try {
2760
2866
  s.hooks && (t = s.hooks.preprocess(t));
2761
- let o = (s.hooks ? s.hooks.provideLexer() : e ? F.lex : F.lexInline)(t, s);
2867
+ let o = (s.hooks ? s.hooks.provideLexer() : e ? G.lex : G.lexInline)(t, s);
2762
2868
  s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
2763
- let i = (s.hooks ? s.hooks.provideParser() : e ? N.parse : N.parseInline)(o, s);
2869
+ let i = (s.hooks ? s.hooks.provideParser() : e ? W.parse : W.parseInline)(o, s);
2764
2870
  return s.hooks && (i = s.hooks.postprocess(i)), i;
2765
2871
  } catch (o) {
2766
2872
  return n(o);
@@ -2771,47 +2877,47 @@ ${e}</tr>
2771
2877
  return (r) => {
2772
2878
  if (r.message += `
2773
2879
  Please report this to https://github.com/markedjs/marked.`, e) {
2774
- let a = "<p>An error occurred:</p><pre>" + W(r.message + "", !0) + "</pre>";
2880
+ let a = "<p>An error occurred:</p><pre>" + Q(r.message + "", !0) + "</pre>";
2775
2881
  return t ? Promise.resolve(a) : a;
2776
2882
  }
2777
2883
  if (t) return Promise.reject(r);
2778
2884
  throw r;
2779
2885
  };
2780
2886
  }
2781
- }, Q = new Ka();
2782
- function H(e, t) {
2783
- return Q.parse(e, t);
2887
+ }, se = new Ja();
2888
+ function V(e, t) {
2889
+ return se.parse(e, t);
2784
2890
  }
2785
- H.options = H.setOptions = function(e) {
2786
- return Q.setOptions(e), H.defaults = Q.defaults, mr(H.defaults), H;
2891
+ V.options = V.setOptions = function(e) {
2892
+ return se.setOptions(e), V.defaults = se.defaults, wr(V.defaults), V;
2787
2893
  };
2788
- H.getDefaults = Ke;
2789
- H.defaults = ee;
2790
- H.use = function(...e) {
2791
- return Q.use(...e), H.defaults = Q.defaults, mr(H.defaults), H;
2894
+ V.getDefaults = Ke;
2895
+ V.defaults = ie;
2896
+ V.use = function(...e) {
2897
+ return se.use(...e), V.defaults = se.defaults, wr(V.defaults), V;
2792
2898
  };
2793
- H.walkTokens = function(e, t) {
2794
- return Q.walkTokens(e, t);
2899
+ V.walkTokens = function(e, t) {
2900
+ return se.walkTokens(e, t);
2795
2901
  };
2796
- H.parseInline = Q.parseInline;
2797
- H.Parser = N;
2798
- H.parser = N.parse;
2799
- H.Renderer = Ae;
2800
- H.TextRenderer = st;
2801
- H.Lexer = F;
2802
- H.lexer = F.lex;
2803
- H.Tokenizer = ze;
2804
- H.Hooks = pe;
2805
- H.parse = H;
2806
- H.options;
2807
- H.setOptions;
2808
- H.use;
2809
- H.walkTokens;
2810
- H.parseInline;
2811
- N.parse;
2812
- F.lex;
2813
- const Ja = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
2814
- function Qa(e) {
2902
+ V.parseInline = se.parseInline;
2903
+ V.Parser = W;
2904
+ V.parser = W.parse;
2905
+ V.Renderer = Se;
2906
+ V.TextRenderer = st;
2907
+ V.Lexer = G;
2908
+ V.lexer = G.lex;
2909
+ V.Tokenizer = ze;
2910
+ V.Hooks = fe;
2911
+ V.parse = V;
2912
+ V.options;
2913
+ V.setOptions;
2914
+ V.use;
2915
+ V.walkTokens;
2916
+ V.parseInline;
2917
+ W.parse;
2918
+ G.lex;
2919
+ const Qa = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
2920
+ function Ya(e) {
2815
2921
  const t = [];
2816
2922
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (n) => {
2817
2923
  const o = `__IMG_PROTECTED_${t.length}__`;
@@ -2826,7 +2932,7 @@ function Qa(e) {
2826
2932
  const o = `__IMG_PROTECTED_${t.length}__`;
2827
2933
  return t.push(n), o;
2828
2934
  });
2829
- const r = Ja.join("|"), a = new RegExp(
2935
+ const r = Qa.join("|"), a = new RegExp(
2830
2936
  `<a[^>]*href="(https?:\\/\\/[^"]+\\.(?:${r})(?:\\?[^"]*)?)"[^>]*>([^<]*)<\\/a>`,
2831
2937
  "gi"
2832
2938
  );
@@ -2850,7 +2956,7 @@ function qe(e, t, r) {
2850
2956
  let n = '<div class="artifactuse-image-container">';
2851
2957
  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;
2852
2958
  }
2853
- function Ya(e) {
2959
+ function es(e) {
2854
2960
  const t = e.split(`
2855
2961
  `), r = [];
2856
2962
  let a = [], s = !1;
@@ -2871,43 +2977,43 @@ function Ya(e) {
2871
2977
  r.push(t[n]);
2872
2978
  } else {
2873
2979
  if (s && a.length >= 2) {
2874
- const i = bt(a);
2980
+ const i = vt(a);
2875
2981
  r.push(i);
2876
2982
  } else s && a.length === 1 && r.push(a[0]);
2877
2983
  s = !1, a = [], r.push(t[n]);
2878
2984
  }
2879
2985
  }
2880
2986
  if (s && a.length >= 2) {
2881
- const n = bt(a);
2987
+ const n = vt(a);
2882
2988
  r.push(n);
2883
2989
  } else s && a.length === 1 && r.push(a[0]);
2884
2990
  return r.join(`
2885
2991
  `);
2886
2992
  }
2887
- function bt(e) {
2993
+ function vt(e) {
2888
2994
  return `<div class="artifactuse-image-gallery">
2889
2995
  ${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(`
2890
2996
  `)}
2891
2997
  </div>`;
2892
2998
  }
2893
- const Sr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
2894
- function es(e) {
2999
+ const Cr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
3000
+ function ts(e) {
2895
3001
  if (!e) return !1;
2896
- const t = Sr.join("|");
3002
+ const t = Cr.join("|");
2897
3003
  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));
2898
3004
  }
2899
- function ts(e) {
3005
+ function rs(e) {
2900
3006
  if (!e) return null;
2901
3007
  let t = e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);
2902
3008
  if (t) return { type: "youtube", id: t[1] };
2903
3009
  if (t = e.match(/vimeo\.com\/(\d+)/), t) return { type: "vimeo", id: t[1] };
2904
3010
  if (t = e.match(/loom\.com\/share\/([a-zA-Z0-9]+)/), t) return { type: "loom", id: t[1] };
2905
3011
  if (t = e.match(/dailymotion\.com\/video\/([a-zA-Z0-9]+)/), t) return { type: "dailymotion", id: t[1] };
2906
- const r = Sr.join("|");
3012
+ const r = Cr.join("|");
2907
3013
  return new RegExp(`\\.(${r})(\\?.*)?$`, "i").test(e) ? { type: "direct", id: e } : null;
2908
3014
  }
2909
- function rs(e) {
2910
- const t = ts(e);
3015
+ function as(e) {
3016
+ const t = rs(e);
2911
3017
  if (!t) return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
2912
3018
  switch (t.type) {
2913
3019
  case "youtube":
@@ -2924,45 +3030,45 @@ function rs(e) {
2924
3030
  return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
2925
3031
  }
2926
3032
  }
2927
- function as(e) {
3033
+ function ss(e) {
2928
3034
  const t = [];
2929
3035
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (c) => {
2930
- const m = `__PROTECTED_${t.length}__`;
2931
- return t.push(c), m;
3036
+ const h = `__PROTECTED_${t.length}__`;
3037
+ return t.push(c), h;
2932
3038
  }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (c) => {
2933
- const m = `__PROTECTED_${t.length}__`;
2934
- return t.push(c), m;
3039
+ const h = `__PROTECTED_${t.length}__`;
3040
+ return t.push(c), h;
2935
3041
  }), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (c) => {
2936
- const m = `__PROTECTED_${t.length}__`;
2937
- return t.push(c), m;
3042
+ const h = `__PROTECTED_${t.length}__`;
3043
+ return t.push(c), h;
2938
3044
  });
2939
3045
  const r = /\[([^\]]+)\]\((https:\/\/www\.pexels\.com\/video\/[^)]+)\)\s*(?:<\/p>)?\s*(?:<p>)?\s*(?:Preview image:\s*)?!\[([^\]]*)\]\((https:\/\/images\.pexels\.com\/videos\/[^)]+)\)/gi;
2940
- e = e.replace(r, (c, m, h, g, f) => ns(m, h, f, g));
3046
+ e = e.replace(r, (c, h, f, g, m) => is(h, f, m, g));
2941
3047
  const a = /<a[^>]*href="(https?:\/\/[^"]+\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
2942
- e = e.replace(a, (c, m) => Ze(m));
3048
+ e = e.replace(a, (c, h) => Ze(h));
2943
3049
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
2944
- e = e.replace(s, (c, m) => Ze(m));
3050
+ e = e.replace(s, (c, h) => Ze(h));
2945
3051
  const n = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
2946
- e = e.replace(n, (c, m, h) => Oe(h));
3052
+ e = e.replace(n, (c, h, f) => Oe(f));
2947
3053
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9_-]+))(?!["'])`, "gi");
2948
- e = e.replace(o, (c, m, h) => Oe(h));
3054
+ e = e.replace(o, (c, h, f) => Oe(f));
2949
3055
  const i = /<a[^>]*href="(https?:\/\/(?:www\.)?vimeo\.com\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
2950
- e = e.replace(i, (c, m, h) => Be(h));
3056
+ e = e.replace(i, (c, h, f) => Be(f));
2951
3057
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?vimeo\\.com\\/(\\d+))(?!["'])`, "gi");
2952
- e = e.replace(u, (c, m, h) => Be(h));
3058
+ e = e.replace(u, (c, h, f) => Be(f));
2953
3059
  const l = /<a[^>]*href="(https?:\/\/(?:www\.)?loom\.com\/share\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
2954
- e = e.replace(l, (c, m, h) => Fe(h));
3060
+ e = e.replace(l, (c, h, f) => Fe(f));
2955
3061
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?loom\\.com\\/share\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
2956
- e = e.replace(d, (c, m, h) => Fe(h));
3062
+ e = e.replace(d, (c, h, f) => Fe(f));
2957
3063
  const p = /<a[^>]*href="(https?:\/\/(?:www\.)?dailymotion\.com\/video\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
2958
- e = e.replace(p, (c, m, h) => Ne(h));
3064
+ e = e.replace(p, (c, h, f) => Ne(f));
2959
3065
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?dailymotion\\.com\\/video\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
2960
- e = e.replace(w, (c, m, h) => Ne(h));
3066
+ e = e.replace(w, (c, h, f) => Ne(f));
2961
3067
  for (let c = t.length - 1; c >= 0; c--)
2962
3068
  e = e.replace(`__PROTECTED_${c}__`, t[c]);
2963
3069
  return e;
2964
3070
  }
2965
- function ss(e) {
3071
+ function ns(e) {
2966
3072
  const t = e.split("?")[0].split(".").pop().toLowerCase();
2967
3073
  return {
2968
3074
  mp4: "video/mp4",
@@ -2976,10 +3082,10 @@ function ss(e) {
2976
3082
  }[t] || "video/mp4";
2977
3083
  }
2978
3084
  function Ze(e) {
2979
- const t = ss(e);
3085
+ const t = ns(e);
2980
3086
  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>`;
2981
3087
  }
2982
- function ns(e, t, r, a) {
3088
+ function is(e, t, r, a) {
2983
3089
  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>`;
2984
3090
  }
2985
3091
  function Oe(e) {
@@ -2998,11 +3104,11 @@ function Ne(e) {
2998
3104
  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>'`;
2999
3105
  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>`;
3000
3106
  }
3001
- function is(e) {
3107
+ function os(e) {
3002
3108
  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();
3003
3109
  return /<(?!\/)[^>]+>/.test(t) ? !1 : t.length < 200;
3004
3110
  }
3005
- function Pe(e) {
3111
+ function je(e) {
3006
3112
  let t = e.match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
3007
3113
  if (t) {
3008
3114
  const r = t[1].trim(), a = r.replace(/<[^>]*>/g, "").trim();
@@ -3016,7 +3122,7 @@ function Pe(e) {
3016
3122
  }
3017
3123
  return "";
3018
3124
  }
3019
- function os(e) {
3125
+ function ls(e) {
3020
3126
  const t = /<div class="artifactuse-video-(wrapper|preview-container)/g, r = [];
3021
3127
  let a;
3022
3128
  for (; (a = t.exec(e)) !== null; ) {
@@ -3040,16 +3146,16 @@ function os(e) {
3040
3146
  const s = [];
3041
3147
  let n = [{
3042
3148
  ...r[0],
3043
- caption: Pe(e.substring(0, r[0].start))
3149
+ caption: je(e.substring(0, r[0].start))
3044
3150
  }];
3045
3151
  for (let u = 1; u < r.length; u++) {
3046
3152
  const l = r[u - 1], d = r[u], p = e.substring(l.end, d.start);
3047
- is(p) ? n.push({
3153
+ os(p) ? n.push({
3048
3154
  ...d,
3049
- caption: Pe(p)
3155
+ caption: je(p)
3050
3156
  }) : (s.push([...n]), n = [{
3051
3157
  ...d,
3052
- caption: Pe(e.substring(l.end, d.start))
3158
+ caption: je(e.substring(l.end, d.start))
3053
3159
  }]);
3054
3160
  }
3055
3161
  s.push(n);
@@ -3060,7 +3166,7 @@ function os(e) {
3060
3166
  let d = l.start;
3061
3167
  const w = e.substring(i, l.start).match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
3062
3168
  if (w && (d = l.start - w[0].length, u[0].caption = w[1].trim()), o += e.substring(i, d), u.length >= 2)
3063
- o += ls(u);
3169
+ o += cs(u);
3064
3170
  else {
3065
3171
  const c = u[0];
3066
3172
  c.caption ? o += `<div class="artifactuse-video-container">${c.html}<div class="artifactuse-video-caption">${c.caption}</div></div>` : o += c.html;
@@ -3069,7 +3175,7 @@ function os(e) {
3069
3175
  }
3070
3176
  return o += e.substring(i), o = o.replace(/<p>\s*<\/p>/g, ""), o;
3071
3177
  }
3072
- function ls(e) {
3178
+ function cs(e) {
3073
3179
  return `<div class="artifactuse-video-gallery">
3074
3180
  ${e.map(({ html: r, caption: a }) => {
3075
3181
  let s = r.replace(
@@ -3084,75 +3190,75 @@ ${e.map(({ html: r, caption: a }) => {
3084
3190
  `)}
3085
3191
  </div>`;
3086
3192
  }
3087
- function cs() {
3193
+ function us() {
3088
3194
  return `audio-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3089
3195
  }
3090
- function us(e, t = {}) {
3196
+ function ds(e, t = {}) {
3091
3197
  const r = t.theme || "dark", a = [];
3092
- e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (z) => {
3198
+ e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (A) => {
3093
3199
  const S = `__PROTECTED_${a.length}__`;
3094
- return a.push(z), S;
3095
- }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (z) => {
3200
+ return a.push(A), S;
3201
+ }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (A) => {
3096
3202
  const S = `__PROTECTED_${a.length}__`;
3097
- return a.push(z), S;
3098
- }), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (z) => {
3203
+ return a.push(A), S;
3204
+ }), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (A) => {
3099
3205
  const S = `__PROTECTED_${a.length}__`;
3100
- return a.push(z), S;
3206
+ return a.push(A), S;
3101
3207
  });
3102
3208
  const s = /<a[^>]*href="(https?:\/\/[^"]+\.(mp3|wav|flac|aac|ogg|m4a|wma)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3103
- e = e.replace(s, (z, S) => vt(S));
3209
+ e = e.replace(s, (A, S) => yt(S));
3104
3210
  const n = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp3|wav|flac|aac|ogg|m4a|wma)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
3105
- e = e.replace(n, (z, S) => vt(S));
3211
+ e = e.replace(n, (A, S) => yt(S));
3106
3212
  const o = /<a[^>]*href="(https?:\/\/(?:www\.)?soundcloud\.com\/[^"]+)"[^>]*>[^<]*<\/a>/gi;
3107
- e = e.replace(o, (z, S) => yt(S));
3213
+ e = e.replace(o, (A, S) => kt(S));
3108
3214
  const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?soundcloud\\.com\\/[^\\s<>"]+)(?!["'])`, "gi");
3109
- e = e.replace(i, (z, S) => yt(S));
3215
+ e = e.replace(i, (A, S) => kt(S));
3110
3216
  const u = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/track\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3111
- e = e.replace(u, (z, S, y) => B("track", y, r));
3217
+ e = e.replace(u, (A, S, L) => F("track", L, r));
3112
3218
  const l = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/track\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3113
- e = e.replace(l, (z, S, y) => B("track", y, r));
3219
+ e = e.replace(l, (A, S, L) => F("track", L, r));
3114
3220
  const d = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/album\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3115
- e = e.replace(d, (z, S, y) => B("album", y, r));
3221
+ e = e.replace(d, (A, S, L) => F("album", L, r));
3116
3222
  const p = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/album\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3117
- e = e.replace(p, (z, S, y) => B("album", y, r));
3223
+ e = e.replace(p, (A, S, L) => F("album", L, r));
3118
3224
  const w = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/playlist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3119
- e = e.replace(w, (z, S, y) => B("playlist", y, r));
3225
+ e = e.replace(w, (A, S, L) => F("playlist", L, r));
3120
3226
  const c = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/playlist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3121
- e = e.replace(c, (z, S, y) => B("playlist", y, r));
3122
- const m = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/artist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3123
- e = e.replace(m, (z, S, y) => B("artist", y, r));
3124
- const h = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/artist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3125
- e = e.replace(h, (z, S, y) => B("artist", y, r));
3227
+ e = e.replace(c, (A, S, L) => F("playlist", L, r));
3228
+ const h = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/artist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3229
+ e = e.replace(h, (A, S, L) => F("artist", L, r));
3230
+ const f = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/artist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3231
+ e = e.replace(f, (A, S, L) => F("artist", L, r));
3126
3232
  const g = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/episode\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3127
- e = e.replace(g, (z, S, y) => B("episode", y, r));
3128
- const f = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/episode\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3129
- e = e.replace(f, (z, S, y) => B("episode", y, r));
3233
+ e = e.replace(g, (A, S, L) => F("episode", L, r));
3234
+ const m = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/episode\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3235
+ e = e.replace(m, (A, S, L) => F("episode", L, r));
3130
3236
  const b = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/show\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3131
- e = e.replace(b, (z, S, y) => B("show", y, r));
3237
+ e = e.replace(b, (A, S, L) => F("show", L, r));
3132
3238
  const v = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/show\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3133
- e = e.replace(v, (z, S, y) => B("show", y, r));
3134
- const M = /<a[^>]*href="(https?:\/\/music\.apple\.com\/([a-z]{2})\/([a-z-]+)\/[^\/]+\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3135
- e = e.replace(M, (z, S, y, C, x) => kt(y, C, x));
3136
- const $ = new RegExp(`(?<!["'=])(https?:\\/\\/music\\.apple\\.com\\/([a-z]{2})\\/([a-z-]+)\\/[^\\/\\s]+\\/(\\d+))(?!["'])`, "gi");
3137
- e = e.replace($, (z, S, y, C, x) => kt(y, C, x));
3138
- for (let z = a.length - 1; z >= 0; z--)
3139
- e = e.replace(`__PROTECTED_${z}__`, a[z]);
3239
+ e = e.replace(v, (A, S, L) => F("show", L, r));
3240
+ const x = /<a[^>]*href="(https?:\/\/music\.apple\.com\/([a-z]{2})\/([a-z-]+)\/[^\/]+\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3241
+ e = e.replace(x, (A, S, L, $, y) => xt(L, $, y));
3242
+ const M = new RegExp(`(?<!["'=])(https?:\\/\\/music\\.apple\\.com\\/([a-z]{2})\\/([a-z-]+)\\/[^\\/\\s]+\\/(\\d+))(?!["'])`, "gi");
3243
+ e = e.replace(M, (A, S, L, $, y) => xt(L, $, y));
3244
+ for (let A = a.length - 1; A >= 0; A--)
3245
+ e = e.replace(`__PROTECTED_${A}__`, a[A]);
3140
3246
  return e;
3141
3247
  }
3142
- function ds(e) {
3248
+ function ps(e) {
3143
3249
  const t = e.match(/\.([a-zA-Z0-9]+)(?:\?|$)/);
3144
3250
  return t ? t[1].toUpperCase() : "AUDIO";
3145
3251
  }
3146
- function de(e) {
3252
+ function pe(e) {
3147
3253
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3148
3254
  }
3149
- function vt(e) {
3150
- const t = cs(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = ds(e);
3255
+ function yt(e) {
3256
+ const t = us(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = ps(e);
3151
3257
  return `
3152
- <div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${de(e)}">
3258
+ <div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${pe(e)}">
3153
3259
  <!-- Hidden audio element -->
3154
3260
  <audio preload="metadata" class="artifactuse-audio-element">
3155
- <source src="${de(e)}" type="audio/mpeg">
3261
+ <source src="${pe(e)}" type="audio/mpeg">
3156
3262
  </audio>
3157
3263
 
3158
3264
  <!-- Header -->
@@ -3165,7 +3271,7 @@ function vt(e) {
3165
3271
  </svg>
3166
3272
  </div>
3167
3273
  <div class="artifactuse-audio-meta">
3168
- <span class="artifactuse-audio-filename" title="${de(r)}">${de(r)}</span>
3274
+ <span class="artifactuse-audio-filename" title="${pe(r)}">${pe(r)}</span>
3169
3275
  <span class="artifactuse-audio-format">${a}</span>
3170
3276
  </div>
3171
3277
  <span class="artifactuse-audio-duration">--:--</span>
@@ -3226,7 +3332,7 @@ function vt(e) {
3226
3332
  </div>
3227
3333
 
3228
3334
  <!-- Download -->
3229
- <a href="${de(e)}" download class="artifactuse-audio-btn artifactuse-audio-download-btn" aria-label="Download">
3335
+ <a href="${pe(e)}" download class="artifactuse-audio-btn artifactuse-audio-download-btn" aria-label="Download">
3230
3336
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
3231
3337
  <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
3232
3338
  <polyline points="7 10 12 15 17 10"></polyline>
@@ -3238,7 +3344,7 @@ function vt(e) {
3238
3344
  </div>
3239
3345
  `;
3240
3346
  }
3241
- function yt(e) {
3347
+ function kt(e) {
3242
3348
  return `
3243
3349
  <div class="artifactuse-soundcloud-wrapper">
3244
3350
  <iframe
@@ -3250,7 +3356,7 @@ function yt(e) {
3250
3356
  </div>
3251
3357
  `;
3252
3358
  }
3253
- function B(e, t, r = "dark") {
3359
+ function F(e, t, r = "dark") {
3254
3360
  const s = {
3255
3361
  track: 152,
3256
3362
  album: 352,
@@ -3273,7 +3379,7 @@ function B(e, t, r = "dark") {
3273
3379
  </div>
3274
3380
  `;
3275
3381
  }
3276
- function kt(e, t, r) {
3382
+ function xt(e, t, r) {
3277
3383
  return `
3278
3384
  <div class="artifactuse-apple-music-wrapper">
3279
3385
  <iframe
@@ -3287,16 +3393,16 @@ function kt(e, t, r) {
3287
3393
  </div>
3288
3394
  `;
3289
3395
  }
3290
- const Y = /* @__PURE__ */ new Map(), je = [0.5, 0.75, 1, 1.25, 1.5, 2];
3291
- function ps(e = document) {
3396
+ const ne = /* @__PURE__ */ new Map(), He = [0.5, 0.75, 1, 1.25, 1.5, 2];
3397
+ function fs(e = document) {
3292
3398
  e.querySelectorAll(".artifactuse-audio-player:not([data-initialized])").forEach((r) => {
3293
- fs(r);
3399
+ hs(r);
3294
3400
  });
3295
3401
  }
3296
- function fs(e) {
3402
+ function hs(e) {
3297
3403
  const t = e.dataset.playerId, r = e.dataset.audioSrc;
3298
3404
  if (!t || !r) return;
3299
- 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"), u = e.querySelector(".artifactuse-audio-duration"), l = e.querySelector(".artifactuse-audio-waveform"), d = e.querySelector(".artifactuse-audio-waveform-canvas"), p = e.querySelector(".artifactuse-audio-waveform-progress"), w = e.querySelector(".artifactuse-audio-waveform-hover"), c = e.querySelector(".artifactuse-audio-mute-btn"), m = e.querySelector(".artifactuse-audio-icon-volume"), h = e.querySelector(".artifactuse-audio-icon-muted"), g = e.querySelector(".artifactuse-audio-volume-slider"), f = e.querySelector(".artifactuse-audio-speed-btn");
3405
+ 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"), u = e.querySelector(".artifactuse-audio-duration"), l = e.querySelector(".artifactuse-audio-waveform"), d = e.querySelector(".artifactuse-audio-waveform-canvas"), p = e.querySelector(".artifactuse-audio-waveform-progress"), w = e.querySelector(".artifactuse-audio-waveform-hover"), c = e.querySelector(".artifactuse-audio-mute-btn"), h = e.querySelector(".artifactuse-audio-icon-volume"), f = e.querySelector(".artifactuse-audio-icon-muted"), g = e.querySelector(".artifactuse-audio-volume-slider"), m = e.querySelector(".artifactuse-audio-speed-btn");
3300
3406
  if (!a) return;
3301
3407
  const b = {
3302
3408
  isPlaying: !1,
@@ -3307,41 +3413,41 @@ function fs(e) {
3307
3413
  currentTime: 0,
3308
3414
  waveformData: null
3309
3415
  };
3310
- Y.set(t, { playerEl: e, audio: a, state: b }), hs(d, t), s == null || s.addEventListener("click", () => {
3311
- b.isPlaying ? At(t) : zt(t);
3416
+ ne.set(t, { playerEl: e, audio: a, state: b }), gs(d, t), s == null || s.addEventListener("click", () => {
3417
+ b.isPlaying ? St(t) : zt(t);
3312
3418
  }), a.addEventListener("loadedmetadata", () => {
3313
- b.duration = a.duration, u.textContent = $t(a.duration);
3419
+ b.duration = a.duration, u.textContent = At(a.duration);
3314
3420
  }), a.addEventListener("timeupdate", () => {
3315
- b.currentTime = a.currentTime, i.textContent = $t(a.currentTime);
3421
+ b.currentTime = a.currentTime, i.textContent = At(a.currentTime);
3316
3422
  const v = a.currentTime / a.duration * 100;
3317
3423
  p.style.width = `${v}%`;
3318
3424
  }), a.addEventListener("ended", () => {
3319
3425
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing"), p.style.width = "0%";
3320
3426
  }), a.addEventListener("play", () => {
3321
- b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), gs(t);
3427
+ b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), ms(t);
3322
3428
  }), a.addEventListener("pause", () => {
3323
3429
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing");
3324
3430
  }), l == null || l.addEventListener("click", (v) => {
3325
- const M = l.getBoundingClientRect(), S = (v.clientX - M.left) / M.width * a.duration;
3431
+ const x = l.getBoundingClientRect(), S = (v.clientX - x.left) / x.width * a.duration;
3326
3432
  isNaN(S) || (a.currentTime = S);
3327
3433
  }), l == null || l.addEventListener("mousemove", (v) => {
3328
- const M = l.getBoundingClientRect(), z = (v.clientX - M.left) / M.width * 100;
3329
- w.style.width = `${z}%`;
3434
+ const x = l.getBoundingClientRect(), A = (v.clientX - x.left) / x.width * 100;
3435
+ w.style.width = `${A}%`;
3330
3436
  }), l == null || l.addEventListener("mouseleave", () => {
3331
3437
  w.style.width = "0%";
3332
3438
  }), c == null || c.addEventListener("click", () => {
3333
- b.isMuted = !b.isMuted, a.muted = b.isMuted, m.style.display = b.isMuted ? "none" : "", h.style.display = b.isMuted ? "" : "none", b.isMuted ? g.value = 0 : g.value = b.volume * 100;
3439
+ b.isMuted = !b.isMuted, a.muted = b.isMuted, h.style.display = b.isMuted ? "none" : "", f.style.display = b.isMuted ? "" : "none", b.isMuted ? g.value = 0 : g.value = b.volume * 100;
3334
3440
  }), g == null || g.addEventListener("input", (v) => {
3335
- const M = parseInt(v.target.value, 10) / 100;
3336
- b.volume = M, a.volume = M, M === 0 ? (b.isMuted = !0, m.style.display = "none", h.style.display = "") : (b.isMuted = !1, a.muted = !1, m.style.display = "", h.style.display = "none");
3337
- }), f == null || f.addEventListener("click", () => {
3338
- const M = (je.indexOf(b.playbackRate) + 1) % je.length;
3339
- b.playbackRate = je[M], a.playbackRate = b.playbackRate, f.querySelector("span").textContent = `${b.playbackRate}x`;
3441
+ const x = parseInt(v.target.value, 10) / 100;
3442
+ b.volume = x, a.volume = x, x === 0 ? (b.isMuted = !0, h.style.display = "none", f.style.display = "") : (b.isMuted = !1, a.muted = !1, h.style.display = "", f.style.display = "none");
3443
+ }), m == null || m.addEventListener("click", () => {
3444
+ const x = (He.indexOf(b.playbackRate) + 1) % He.length;
3445
+ b.playbackRate = He[x], a.playbackRate = b.playbackRate, m.querySelector("span").textContent = `${b.playbackRate}x`;
3340
3446
  }), e.addEventListener("keydown", (v) => {
3341
3447
  switch (v.key) {
3342
3448
  case " ":
3343
3449
  case "k":
3344
- v.preventDefault(), b.isPlaying ? At(t) : zt(t);
3450
+ v.preventDefault(), b.isPlaying ? St(t) : zt(t);
3345
3451
  break;
3346
3452
  case "ArrowLeft":
3347
3453
  v.preventDefault(), a.currentTime = Math.max(0, a.currentTime - 5);
@@ -3361,19 +3467,19 @@ function fs(e) {
3361
3467
  }
3362
3468
  }), e.setAttribute("data-initialized", "true"), e.setAttribute("tabindex", "0");
3363
3469
  }
3364
- function hs(e, t) {
3470
+ function gs(e, t) {
3365
3471
  if (!e) return;
3366
3472
  const r = e.getContext("2d"), a = window.devicePixelRatio || 1, s = e.parentElement.getBoundingClientRect();
3367
3473
  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);
3368
- const n = s.width, o = s.height, i = Math.floor(n / 4), u = xt(i, t);
3369
- Mt(r, u, n, o), new ResizeObserver(() => {
3474
+ const n = s.width, o = s.height, i = Math.floor(n / 4), u = Mt(i, t);
3475
+ $t(r, u, n, o), new ResizeObserver(() => {
3370
3476
  const d = e.parentElement.getBoundingClientRect();
3371
3477
  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);
3372
- const p = Math.floor(d.width / 4), w = xt(p, t);
3373
- Mt(r, w, d.width, d.height);
3478
+ const p = Math.floor(d.width / 4), w = Mt(p, t);
3479
+ $t(r, w, d.width, d.height);
3374
3480
  }).observe(e.parentElement);
3375
3481
  }
3376
- function xt(e, t) {
3482
+ function Mt(e, t) {
3377
3483
  const r = [];
3378
3484
  let a = 0;
3379
3485
  for (let n = 0; n < t.length; n++) {
@@ -3390,98 +3496,98 @@ function xt(e, t) {
3390
3496
  }
3391
3497
  return r;
3392
3498
  }
3393
- function Mt(e, t, r, a) {
3499
+ function $t(e, t, r, a) {
3394
3500
  e.clearRect(0, 0, r, a);
3395
3501
  const s = 2, o = s + 2, i = a / 2, l = getComputedStyle(document.documentElement).getPropertyValue("--artifactuse-text-muted").trim() || "107, 114, 128";
3396
3502
  e.fillStyle = `rgba(${l}, 0.4)`, t.forEach((d, p) => {
3397
- const w = p * o, c = d * (a * 0.8), m = c / 2, h = s / 2;
3398
- e.beginPath(), e.roundRect(w, i - m, s, c, h), e.fill();
3503
+ const w = p * o, c = d * (a * 0.8), h = c / 2, f = s / 2;
3504
+ e.beginPath(), e.roundRect(w, i - h, s, c, f), e.fill();
3399
3505
  });
3400
3506
  }
3401
- function $t(e) {
3507
+ function At(e) {
3402
3508
  if (!e || isNaN(e)) return "0:00";
3403
3509
  const t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), a = Math.floor(e % 60);
3404
3510
  return t > 0 ? `${t}:${r.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}` : `${r}:${a.toString().padStart(2, "0")}`;
3405
3511
  }
3406
3512
  function zt(e) {
3407
- const t = Y.get(e);
3513
+ const t = ne.get(e);
3408
3514
  t && t.audio.play();
3409
3515
  }
3410
- function At(e) {
3411
- const t = Y.get(e);
3516
+ function St(e) {
3517
+ const t = ne.get(e);
3412
3518
  t && t.audio.pause();
3413
3519
  }
3414
- function gs(e) {
3415
- Y.forEach((t, r) => {
3520
+ function ms(e) {
3521
+ ne.forEach((t, r) => {
3416
3522
  r !== e && t.state.isPlaying && t.audio.pause();
3417
3523
  });
3418
3524
  }
3419
- function ms(e) {
3420
- const t = Y.get(e);
3421
- t && (t.audio.pause(), t.audio.src = "", Y.delete(e));
3525
+ function ws(e) {
3526
+ const t = ne.get(e);
3527
+ t && (t.audio.pause(), t.audio.src = "", ne.delete(e));
3422
3528
  }
3423
- function ws() {
3424
- Y.forEach((e, t) => {
3425
- ms(t);
3529
+ function bs() {
3530
+ ne.forEach((e, t) => {
3531
+ ws(t);
3426
3532
  });
3427
3533
  }
3428
- function bs(e) {
3534
+ function vs(e) {
3429
3535
  const t = [];
3430
3536
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (g) => {
3431
- const f = `__PROTECTED_MAP_${t.length}__`;
3432
- return t.push(g), f;
3537
+ const m = `__PROTECTED_MAP_${t.length}__`;
3538
+ return t.push(g), m;
3433
3539
  }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (g) => {
3434
- const f = `__PROTECTED_MAP_${t.length}__`;
3435
- return t.push(g), f;
3540
+ const m = `__PROTECTED_MAP_${t.length}__`;
3541
+ return t.push(g), m;
3436
3542
  }), e = e.replace(/<iframe[^>]*>[\s\S]*?<\/iframe>/gi, (g) => {
3437
- const f = `__PROTECTED_MAP_${t.length}__`;
3438
- return t.push(g), f;
3543
+ const m = `__PROTECTED_MAP_${t.length}__`;
3544
+ return t.push(g), m;
3439
3545
  });
3440
3546
  const r = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/embed\?pb=[^"]+)"[^>]*>[^<]*<\/a>/gi;
3441
- e = e.replace(r, (g, f) => {
3547
+ e = e.replace(r, (g, m) => {
3442
3548
  const b = `__PROTECTED_MAP_${t.length}__`;
3443
- return t.push(St(f)), b;
3549
+ return t.push(Ct(m)), b;
3444
3550
  });
3445
3551
  const a = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/embed\\?pb=[^\\s<>"]+)(?!["'])`, "gi");
3446
- e = e.replace(a, (g, f) => {
3552
+ e = e.replace(a, (g, m) => {
3447
3553
  const b = `__PROTECTED_MAP_${t.length}__`;
3448
- return t.push(St(f)), b;
3554
+ return t.push(Ct(m)), b;
3449
3555
  });
3450
3556
  const s = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/place\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3451
- e = e.replace(s, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3557
+ e = e.replace(s, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3452
3558
  const n = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/place\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
3453
- e = e.replace(n, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3559
+ e = e.replace(n, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3454
3560
  const o = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/@([0-9.-]+),([0-9.-]+),([0-9]+)z[^"]*)"[^>]*>[^<]*<\/a>/gi;
3455
- e = e.replace(o, (g, f, b, v, M) => Ue(b, v, M));
3561
+ e = e.replace(o, (g, m, b, v, x) => Ue(b, v, x));
3456
3562
  const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/@([0-9.-]+),([0-9.-]+),([0-9]+)z)(?!["'])`, "gi");
3457
- e = e.replace(i, (g, f, b, v, M) => Ue(b, v, M));
3563
+ e = e.replace(i, (g, m, b, v, x) => Ue(b, v, x));
3458
3564
  const u = /<a[^>]*href="(https?:\/\/maps\.google\.com\/\?q=([^\s"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3459
- e = e.replace(u, (g, f, b) => X(decodeURIComponent(b)));
3565
+ e = e.replace(u, (g, m, b) => ee(decodeURIComponent(b)));
3460
3566
  const l = new RegExp(`(?<!["'=])(https?:\\/\\/maps\\.google\\.com\\/\\?q=([^\\s"&]+))(?!["'])`, "gi");
3461
- e = e.replace(l, (g, f, b) => X(decodeURIComponent(b)));
3567
+ e = e.replace(l, (g, m, b) => ee(decodeURIComponent(b)));
3462
3568
  const d = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3463
- e = e.replace(d, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3569
+ e = e.replace(d, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3464
3570
  const p = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
3465
- e = e.replace(p, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3571
+ e = e.replace(p, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3466
3572
  const w = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/\?[^"]*query=([^"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3467
- e = e.replace(w, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3573
+ e = e.replace(w, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3468
3574
  const c = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/\\?[^\\s"]*query=([^\\s"&]+))(?!["'])`, "gi");
3469
- e = e.replace(c, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3470
- const m = /<a[^>]*href="(https?:\/\/(?:www\.)?openstreetmap\.org\/[^"]*mlat=([0-9.-]+)[^"]*mlon=([0-9.-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3471
- e = e.replace(m, (g, f, b, v) => {
3472
- const M = f.match(/#map=(\d+)/), $ = M ? M[1] : 15;
3473
- return Ct(b, v, $);
3575
+ e = e.replace(c, (g, m, b) => ee(decodeURIComponent(b.replace(/\+/g, " "))));
3576
+ const h = /<a[^>]*href="(https?:\/\/(?:www\.)?openstreetmap\.org\/[^"]*mlat=([0-9.-]+)[^"]*mlon=([0-9.-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3577
+ e = e.replace(h, (g, m, b, v) => {
3578
+ const x = m.match(/#map=(\d+)/), M = x ? x[1] : 15;
3579
+ return Rt(b, v, M);
3474
3580
  });
3475
- const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?openstreetmap\\.org\\/[^\\s]*mlat=([0-9.-]+)[^\\s]*mlon=([0-9.-]+))(?!["'])`, "gi");
3476
- e = e.replace(h, (g, f, b, v) => {
3477
- const M = f.match(/#map=(\d+)/), $ = M ? M[1] : 15;
3478
- return Ct(b, v, $);
3581
+ const f = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?openstreetmap\\.org\\/[^\\s]*mlat=([0-9.-]+)[^\\s]*mlon=([0-9.-]+))(?!["'])`, "gi");
3582
+ e = e.replace(f, (g, m, b, v) => {
3583
+ const x = m.match(/#map=(\d+)/), M = x ? x[1] : 15;
3584
+ return Rt(b, v, M);
3479
3585
  });
3480
3586
  for (let g = t.length - 1; g >= 0; g--)
3481
3587
  e = e.replace(`__PROTECTED_MAP_${g}__`, t[g]);
3482
3588
  return e;
3483
3589
  }
3484
- function St(e) {
3590
+ function Ct(e) {
3485
3591
  const t = e.match(/pb=([^&]+)/);
3486
3592
  if (t) {
3487
3593
  const r = decodeURIComponent(t[1]), a = r.match(/!3d(-?[\d.]+).*?!2d(-?[\d.]+)/), s = r.match(/!2d(-?[\d.]+).*?!3d(-?[\d.]+)/);
@@ -3509,7 +3615,7 @@ function St(e) {
3509
3615
  </div>
3510
3616
  `;
3511
3617
  }
3512
- function X(e) {
3618
+ function ee(e) {
3513
3619
  const t = encodeURIComponent(e);
3514
3620
  return `
3515
3621
  <div class="artifactuse-map-wrapper">
@@ -3553,7 +3659,7 @@ function Ue(e, t, r) {
3553
3659
  </div>
3554
3660
  `;
3555
3661
  }
3556
- function Ct(e, t, r = 15) {
3662
+ function Rt(e, t, r = 15) {
3557
3663
  return `
3558
3664
  <div class="artifactuse-map-wrapper">
3559
3665
  <iframe
@@ -3569,41 +3675,41 @@ function Ct(e, t, r = 15) {
3569
3675
  </div>
3570
3676
  `;
3571
3677
  }
3572
- function vs(e, t = {}) {
3678
+ function ys(e, t = {}) {
3573
3679
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3574
- e = e.replace(a, (v, M, $, z) => Rt($, z, r));
3680
+ e = e.replace(a, (v, x, M, A) => Lt(M, A, r));
3575
3681
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:twitter\\.com|x\\.com)\\/([a-zA-Z0-9_]+)\\/status\\/(\\d+))(?!["'])`, "gi");
3576
- e = e.replace(s, (v, M, $, z) => Rt($, z, r));
3682
+ e = e.replace(s, (v, x, M, A) => Lt(M, A, r));
3577
3683
  const n = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/p\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3578
- e = e.replace(n, (v, M, $) => Lt($));
3684
+ e = e.replace(n, (v, x, M) => Tt(M));
3579
3685
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/p\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3580
- e = e.replace(o, (v, M, $) => Lt($));
3686
+ e = e.replace(o, (v, x, M) => Tt(M));
3581
3687
  const i = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/reel\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3582
- e = e.replace(i, (v, M, $) => Tt($));
3688
+ e = e.replace(i, (v, x, M) => _t(M));
3583
3689
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/reel\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3584
- e = e.replace(u, (v, M, $) => Tt($));
3690
+ e = e.replace(u, (v, x, M) => _t(M));
3585
3691
  const l = /<a[^>]*href="(https?:\/\/(?:www\.)?tiktok\.com\/@([a-zA-Z0-9_.]+)\/video\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3586
- e = e.replace(l, (v, M, $, z) => _t(z));
3692
+ e = e.replace(l, (v, x, M, A) => Et(A));
3587
3693
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?tiktok\\.com\\/@([a-zA-Z0-9_.]+)\\/video\\/(\\d+))(?!["'])`, "gi");
3588
- e = e.replace(d, (v, M, $, z) => _t(z));
3694
+ e = e.replace(d, (v, x, M, A) => Et(A));
3589
3695
  const p = /<a[^>]*href="(https?:\/\/(?:www\.)?linkedin\.com\/(?:posts|feed\/update)\/([a-zA-Z0-9_:-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3590
- e = e.replace(p, (v, M, $) => Et($, M));
3696
+ e = e.replace(p, (v, x, M) => Pt(M, x));
3591
3697
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?linkedin\\.com\\/(?:posts|feed\\/update)\\/([a-zA-Z0-9_:-]+))(?!["'])`, "gi");
3592
- e = e.replace(w, (v, M, $) => Et($, M));
3698
+ e = e.replace(w, (v, x, M) => Pt(M, x));
3593
3699
  const c = /<a[^>]*href="(https?:\/\/(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3594
- e = e.replace(c, (v, M, $, z) => Pt($, z, M));
3595
- const m = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?reddit\\.com\\/r\\/([a-zA-Z0-9_]+)\\/comments\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3596
- e = e.replace(m, (v, M, $, z) => Pt($, z, M));
3597
- const h = /<a[^>]*href="(https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/posts\/\d+[^"]*)"[^>]*>[^<]*<\/a>/gi;
3598
- e = e.replace(h, (v, M) => jt(M));
3700
+ e = e.replace(c, (v, x, M, A) => jt(M, A, x));
3701
+ const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?reddit\\.com\\/r\\/([a-zA-Z0-9_]+)\\/comments\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3702
+ e = e.replace(h, (v, x, M, A) => jt(M, A, x));
3703
+ const f = /<a[^>]*href="(https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/posts\/\d+[^"]*)"[^>]*>[^<]*<\/a>/gi;
3704
+ e = e.replace(f, (v, x) => Ht(x));
3599
3705
  const g = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?facebook\\.com\\/[a-zA-Z0-9.]+\\/posts\\/\\d+)(?!["'])`, "gi");
3600
- e = e.replace(g, (v, M) => jt(M));
3601
- const f = /<a[^>]*href="(https?:\/\/(?:www\.)?pinterest\.com\/pin\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3602
- e = e.replace(f, (v, M, $) => Ht($));
3706
+ e = e.replace(g, (v, x) => Ht(x));
3707
+ const m = /<a[^>]*href="(https?:\/\/(?:www\.)?pinterest\.com\/pin\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3708
+ e = e.replace(m, (v, x, M) => Vt(M));
3603
3709
  const b = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?pinterest\\.com\\/pin\\/(\\d+))(?!["'])`, "gi");
3604
- return e = e.replace(b, (v, M, $) => Ht($)), e;
3710
+ return e = e.replace(b, (v, x, M) => Vt(M)), e;
3605
3711
  }
3606
- function Rt(e, t, r = "dark") {
3712
+ function Lt(e, t, r = "dark") {
3607
3713
  return `
3608
3714
  <div class="artifactuse-twitter-wrapper">
3609
3715
  <blockquote class="twitter-tweet" data-dnt="true" data-theme="${r}">
@@ -3613,7 +3719,7 @@ function Rt(e, t, r = "dark") {
3613
3719
  </div>
3614
3720
  `;
3615
3721
  }
3616
- function Lt(e) {
3722
+ function Tt(e) {
3617
3723
  return `
3618
3724
  <div class="artifactuse-instagram-wrapper">
3619
3725
  <iframe
@@ -3627,7 +3733,7 @@ function Lt(e) {
3627
3733
  </div>
3628
3734
  `;
3629
3735
  }
3630
- function Tt(e) {
3736
+ function _t(e) {
3631
3737
  return `
3632
3738
  <div class="artifactuse-instagram-wrapper">
3633
3739
  <iframe
@@ -3641,7 +3747,7 @@ function Tt(e) {
3641
3747
  </div>
3642
3748
  `;
3643
3749
  }
3644
- function _t(e) {
3750
+ function Et(e) {
3645
3751
  return `
3646
3752
  <div class="artifactuse-tiktok-wrapper">
3647
3753
  <iframe
@@ -3654,7 +3760,7 @@ function _t(e) {
3654
3760
  </div>
3655
3761
  `;
3656
3762
  }
3657
- function Et(e, t) {
3763
+ function Pt(e, t) {
3658
3764
  return `
3659
3765
  <div class="artifactuse-linkedin-wrapper">
3660
3766
  <iframe
@@ -3670,7 +3776,7 @@ function Et(e, t) {
3670
3776
  </div>
3671
3777
  `;
3672
3778
  }
3673
- function Pt(e, t, r) {
3779
+ function jt(e, t, r) {
3674
3780
  return `
3675
3781
  <div class="artifactuse-reddit-wrapper">
3676
3782
  <iframe
@@ -3685,7 +3791,7 @@ function Pt(e, t, r) {
3685
3791
  </div>
3686
3792
  `;
3687
3793
  }
3688
- function jt(e) {
3794
+ function Ht(e) {
3689
3795
  return `
3690
3796
  <div class="artifactuse-facebook-wrapper">
3691
3797
  <iframe
@@ -3703,7 +3809,7 @@ function jt(e) {
3703
3809
  </div>
3704
3810
  `;
3705
3811
  }
3706
- function Ht(e) {
3812
+ function Vt(e) {
3707
3813
  return `
3708
3814
  <div class="artifactuse-pinterest-wrapper">
3709
3815
  <a data-pin-do="embedPin" data-pin-width="large" href="https://www.pinterest.com/pin/${e}/"></a>
@@ -3711,13 +3817,13 @@ function Ht(e) {
3711
3817
  </div>
3712
3818
  `;
3713
3819
  }
3714
- function ys(e) {
3820
+ function ks(e) {
3715
3821
  const t = /<a[^>]*href="(https?:\/\/[^"]+\.pdf(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3716
- e = e.replace(t, (a, s) => Vt(s));
3822
+ e = e.replace(t, (a, s) => It(s));
3717
3823
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.pdf(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
3718
- return e = e.replace(r, (a, s) => Vt(s)), e;
3824
+ return e = e.replace(r, (a, s) => It(s)), e;
3719
3825
  }
3720
- function Vt(e) {
3826
+ function It(e) {
3721
3827
  return `
3722
3828
  <div class="artifactuse-pdf-wrapper">
3723
3829
  <div class="artifactuse-pdf-header">
@@ -3741,25 +3847,25 @@ function Vt(e) {
3741
3847
  </div>
3742
3848
  `;
3743
3849
  }
3744
- function ks(e) {
3850
+ function xs(e) {
3745
3851
  const t = /<a[^>]*href="(https?:\/\/docs\.google\.com\/document\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3746
- e = e.replace(t, (l, d, p) => se(p, "document"));
3852
+ e = e.replace(t, (l, d, p) => oe(p, "document"));
3747
3853
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/document\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3748
- e = e.replace(r, (l, d, p) => se(p, "document"));
3854
+ e = e.replace(r, (l, d, p) => oe(p, "document"));
3749
3855
  const a = /<a[^>]*href="(https?:\/\/docs\.google\.com\/spreadsheets\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3750
- e = e.replace(a, (l, d, p) => se(p, "spreadsheets"));
3856
+ e = e.replace(a, (l, d, p) => oe(p, "spreadsheets"));
3751
3857
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/spreadsheets\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3752
- e = e.replace(s, (l, d, p) => se(p, "spreadsheets"));
3858
+ e = e.replace(s, (l, d, p) => oe(p, "spreadsheets"));
3753
3859
  const n = /<a[^>]*href="(https?:\/\/docs\.google\.com\/presentation\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3754
- e = e.replace(n, (l, d, p) => se(p, "presentation"));
3860
+ e = e.replace(n, (l, d, p) => oe(p, "presentation"));
3755
3861
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/presentation\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3756
- e = e.replace(o, (l, d, p) => se(p, "presentation"));
3862
+ e = e.replace(o, (l, d, p) => oe(p, "presentation"));
3757
3863
  const i = /<a[^>]*href="(https?:\/\/docs\.google\.com\/forms\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3758
- e = e.replace(i, (l, d, p) => It(p));
3864
+ e = e.replace(i, (l, d, p) => Dt(p));
3759
3865
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/forms\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3760
- return e = e.replace(u, (l, d, p) => It(p)), e;
3866
+ return e = e.replace(u, (l, d, p) => Dt(p)), e;
3761
3867
  }
3762
- function se(e, t) {
3868
+ function oe(e, t) {
3763
3869
  const r = {
3764
3870
  document: "Google Doc",
3765
3871
  spreadsheets: "Google Sheet",
@@ -3790,7 +3896,7 @@ function se(e, t) {
3790
3896
  </div>
3791
3897
  `;
3792
3898
  }
3793
- function It(e) {
3899
+ function Dt(e) {
3794
3900
  return `
3795
3901
  <div class="artifactuse-google-form-wrapper">
3796
3902
  <iframe
@@ -3801,13 +3907,13 @@ function It(e) {
3801
3907
  </div>
3802
3908
  `;
3803
3909
  }
3804
- function xs(e) {
3910
+ function Ms(e) {
3805
3911
  const t = /<a[^>]*href="(https?:\/\/[^"]+\.(docx?|xlsx?|pptx?)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3806
- e = e.replace(t, (a, s) => Dt(s));
3912
+ e = e.replace(t, (a, s) => qt(s));
3807
3913
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(docx?|xlsx?|pptx?)(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
3808
- return e = e.replace(r, (a, s) => Dt(s)), e;
3914
+ return e = e.replace(r, (a, s) => qt(s)), e;
3809
3915
  }
3810
- function Dt(e) {
3916
+ function qt(e) {
3811
3917
  const t = encodeURIComponent(e), r = e.split("/").pop().split("?")[0], a = r.split(".").pop().toLowerCase();
3812
3918
  return `
3813
3919
  <div class="artifactuse-office-wrapper">
@@ -3833,43 +3939,43 @@ function Dt(e) {
3833
3939
  </div>
3834
3940
  `;
3835
3941
  }
3836
- function Ms(e) {
3942
+ function $s(e) {
3837
3943
  return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3838
3944
  }
3839
- function $s(e, t = {}) {
3945
+ function As(e, t = {}) {
3840
3946
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/gist\.github\.com\/([a-zA-Z0-9_-]+)\/([a-f0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3841
- e = e.replace(a, (h, g, f, b) => qt(f, b));
3947
+ e = e.replace(a, (f, g, m, b) => Zt(m, b));
3842
3948
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/gist\\.github\\.com\\/([a-zA-Z0-9_-]+)\\/([a-f0-9]+))(?!["'])`, "gi");
3843
- e = e.replace(s, (h, g, f, b) => qt(f, b));
3949
+ e = e.replace(s, (f, g, m, b) => Zt(m, b));
3844
3950
  const n = /<a[^>]*href="(https?:\/\/codepen\.io\/([a-zA-Z0-9_-]+)\/(?:pen|full|details)\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3845
- e = e.replace(n, (h, g, f, b) => Zt(f, b, r));
3951
+ e = e.replace(n, (f, g, m, b) => Ot(m, b, r));
3846
3952
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/codepen\\.io\\/([a-zA-Z0-9_-]+)\\/(?:pen|full|details)\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3847
- e = e.replace(o, (h, g, f, b) => Zt(f, b, r));
3953
+ e = e.replace(o, (f, g, m, b) => Ot(m, b, r));
3848
3954
  const i = /<a[^>]*href="(https?:\/\/codesandbox\.io\/(?:s|embed)\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3849
- e = e.replace(i, (h, g, f) => Ot(f, r));
3955
+ e = e.replace(i, (f, g, m) => Bt(m, r));
3850
3956
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/codesandbox\\.io\\/(?:s|embed)\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
3851
- e = e.replace(u, (h, g, f) => Ot(f, r));
3957
+ e = e.replace(u, (f, g, m) => Bt(m, r));
3852
3958
  const l = /<a[^>]*href="(https?:\/\/jsfiddle\.net\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3853
- e = e.replace(l, (h, g, f, b) => Bt(f, b, r));
3959
+ e = e.replace(l, (f, g, m, b) => Ft(m, b, r));
3854
3960
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/jsfiddle\\.net\\/([a-zA-Z0-9_]+)\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3855
- e = e.replace(d, (h, g, f, b) => Bt(f, b, r));
3961
+ e = e.replace(d, (f, g, m, b) => Ft(m, b, r));
3856
3962
  const p = /<a[^>]*href="(https?:\/\/stackblitz\.com\/(?:edit|embed)\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3857
- e = e.replace(p, (h, g, f) => Ft(f, r));
3963
+ e = e.replace(p, (f, g, m) => Nt(m, r));
3858
3964
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/stackblitz\\.com\\/(?:edit|embed)\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
3859
- e = e.replace(w, (h, g, f) => Ft(f, r));
3965
+ e = e.replace(w, (f, g, m) => Nt(m, r));
3860
3966
  const c = /<a[^>]*href="(https?:\/\/replit\.com\/@([a-zA-Z0-9_]+)\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3861
- e = e.replace(c, (h, g, f, b) => Nt(f, b, r));
3862
- const m = new RegExp(`(?<!["'=])(https?:\\/\\/replit\\.com\\/@([a-zA-Z0-9_]+)\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3863
- return e = e.replace(m, (h, g, f, b) => Nt(f, b, r)), e;
3967
+ e = e.replace(c, (f, g, m, b) => Ut(m, b, r));
3968
+ const h = new RegExp(`(?<!["'=])(https?:\\/\\/replit\\.com\\/@([a-zA-Z0-9_]+)\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3969
+ return e = e.replace(h, (f, g, m, b) => Ut(m, b, r)), e;
3864
3970
  }
3865
- function qt(e, t) {
3971
+ function Zt(e, t) {
3866
3972
  return `
3867
- <div class="artifactuse-gist-wrapper" id="${Ms("gist")}">
3973
+ <div class="artifactuse-gist-wrapper" id="${$s("gist")}">
3868
3974
  <script src="https://gist.github.com/${e}/${t}.js"><\/script>
3869
3975
  </div>
3870
3976
  `;
3871
3977
  }
3872
- function Zt(e, t, r = "dark") {
3978
+ function Ot(e, t, r = "dark") {
3873
3979
  return `
3874
3980
  <div class="artifactuse-codepen-wrapper">
3875
3981
  <iframe
@@ -3886,7 +3992,7 @@ function Zt(e, t, r = "dark") {
3886
3992
  </div>
3887
3993
  `;
3888
3994
  }
3889
- function Ot(e, t = "dark") {
3995
+ function Bt(e, t = "dark") {
3890
3996
  return `
3891
3997
  <div class="artifactuse-codesandbox-wrapper">
3892
3998
  <iframe
@@ -3900,7 +4006,7 @@ function Ot(e, t = "dark") {
3900
4006
  </div>
3901
4007
  `;
3902
4008
  }
3903
- function Bt(e, t, r = "dark") {
4009
+ function Ft(e, t, r = "dark") {
3904
4010
  return `
3905
4011
  <div class="artifactuse-jsfiddle-wrapper">
3906
4012
  <iframe
@@ -3915,7 +4021,7 @@ function Bt(e, t, r = "dark") {
3915
4021
  </div>
3916
4022
  `;
3917
4023
  }
3918
- function Ft(e, t = "dark") {
4024
+ function Nt(e, t = "dark") {
3919
4025
  return `
3920
4026
  <div class="artifactuse-stackblitz-wrapper">
3921
4027
  <iframe
@@ -3927,7 +4033,7 @@ function Ft(e, t = "dark") {
3927
4033
  </div>
3928
4034
  `;
3929
4035
  }
3930
- function Nt(e, t, r = "dark") {
4036
+ function Ut(e, t, r = "dark") {
3931
4037
  return `
3932
4038
  <div class="artifactuse-replit-wrapper">
3933
4039
  <iframe
@@ -3941,23 +4047,23 @@ function Nt(e, t, r = "dark") {
3941
4047
  }
3942
4048
  function zs(e) {
3943
4049
  const t = /<a[^>]*href="(https?:\/\/public\.tableau\.com\/(?:views|profile)\/([^\s"]+))"[^>]*>[^<]*<\/a>/gi;
3944
- e = e.replace(t, (l, d, p) => Ut(p));
4050
+ e = e.replace(t, (l, d, p) => Gt(p));
3945
4051
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/public\\.tableau\\.com\\/(?:views|profile)\\/([^\\s<>"]+))(?!["'])`, "gi");
3946
- e = e.replace(r, (l, d, p) => Ut(p));
4052
+ e = e.replace(r, (l, d, p) => Gt(p));
3947
4053
  const a = /<a[^>]*href="(https?:\/\/(?:public\.)?flourish\.studio\/visualisation\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3948
- e = e.replace(a, (l, d, p) => Gt(p));
4054
+ e = e.replace(a, (l, d, p) => Wt(p));
3949
4055
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:public\\.)?flourish\\.studio\\/visualisation\\/(\\d+))(?!["'])`, "gi");
3950
- e = e.replace(s, (l, d, p) => Gt(p));
4056
+ e = e.replace(s, (l, d, p) => Wt(p));
3951
4057
  const n = /<a[^>]*href="(https?:\/\/datawrapper\.dwcdn\.net\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3952
- e = e.replace(n, (l, d, p) => Wt(p));
4058
+ e = e.replace(n, (l, d, p) => Xt(p));
3953
4059
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/datawrapper\\.dwcdn\\.net\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3954
- e = e.replace(o, (l, d, p) => Wt(p));
4060
+ e = e.replace(o, (l, d, p) => Xt(p));
3955
4061
  const i = /<a[^>]*href="(https?:\/\/(?:e\.)?infogram\.com\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3956
- e = e.replace(i, (l, d, p) => Xt(p));
4062
+ e = e.replace(i, (l, d, p) => Kt(p));
3957
4063
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:e\\.)?infogram\\.com\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3958
- return e = e.replace(u, (l, d, p) => Xt(p)), e;
4064
+ return e = e.replace(u, (l, d, p) => Kt(p)), e;
3959
4065
  }
3960
- function Ut(e) {
4066
+ function Gt(e) {
3961
4067
  return `
3962
4068
  <div class="artifactuse-tableau-wrapper">
3963
4069
  <iframe
@@ -3969,7 +4075,7 @@ function Ut(e) {
3969
4075
  </div>
3970
4076
  `;
3971
4077
  }
3972
- function Gt(e) {
4078
+ function Wt(e) {
3973
4079
  return `
3974
4080
  <div class="artifactuse-flourish-wrapper">
3975
4081
  <iframe
@@ -3981,7 +4087,7 @@ function Gt(e) {
3981
4087
  </div>
3982
4088
  `;
3983
4089
  }
3984
- function Wt(e) {
4090
+ function Xt(e) {
3985
4091
  return `
3986
4092
  <div class="artifactuse-datawrapper-wrapper">
3987
4093
  <iframe
@@ -3993,7 +4099,7 @@ function Wt(e) {
3993
4099
  </div>
3994
4100
  `;
3995
4101
  }
3996
- function Xt(e) {
4102
+ function Kt(e) {
3997
4103
  return `
3998
4104
  <div class="artifactuse-infogram-wrapper">
3999
4105
  <iframe
@@ -4006,33 +4112,33 @@ function Xt(e) {
4006
4112
  </div>
4007
4113
  `;
4008
4114
  }
4009
- function As(e, t = {}) {
4115
+ function Ss(e, t = {}) {
4010
4116
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/sketchfab\.com\/(?:3d-)?models\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4011
- e = e.replace(a, (h, g, f) => Kt(f, r));
4117
+ e = e.replace(a, (f, g, m) => Jt(m, r));
4012
4118
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/sketchfab\\.com\\/(?:3d-)?models\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
4013
- e = e.replace(s, (h, g, f) => Kt(f, r));
4119
+ e = e.replace(s, (f, g, m) => Jt(m, r));
4014
4120
  const n = /<a[^>]*href="(https?:\/\/(?:www\.)?figma\.com\/(?:file|design)\/([a-zA-Z0-9]+)(?:\/[^?\s"]*)?(?:\?node-id=([^&\s"]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4015
- e = e.replace(n, (h, g, f, b) => Jt(f, b));
4121
+ e = e.replace(n, (f, g, m, b) => Qt(m, b));
4016
4122
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?figma\\.com\\/(?:file|design)\\/([a-zA-Z0-9]+)(?:\\/[^?\\s]*)?(?:\\?node-id=([^&\\s]+))?)(?!["'])`, "gi");
4017
- e = e.replace(o, (h, g, f, b) => Jt(f, b));
4123
+ e = e.replace(o, (f, g, m, b) => Qt(m, b));
4018
4124
  const i = /<a[^>]*href="(https?:\/\/(?:www\.)?figma\.com\/proto\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4019
- e = e.replace(i, (h, g, f) => Qt(f, g));
4125
+ e = e.replace(i, (f, g, m) => Yt(m, g));
4020
4126
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?figma\\.com\\/proto\\/([a-zA-Z0-9]+)[^\\s]*)(?!["'])`, "gi");
4021
- e = e.replace(u, (h, g, f) => Qt(f, g));
4127
+ e = e.replace(u, (f, g, m) => Yt(m, g));
4022
4128
  const l = /<a[^>]*href="(https?:\/\/(?:www\.)?canva\.com\/design\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4023
- e = e.replace(l, (h, g, f) => Yt(f, g));
4129
+ e = e.replace(l, (f, g, m) => er(m, g));
4024
4130
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?canva\\.com\\/design\\/([a-zA-Z0-9_-]+)[^\\s]*)(?!["'])`, "gi");
4025
- e = e.replace(d, (h, g, f) => Yt(f, g));
4131
+ e = e.replace(d, (f, g, m) => er(m, g));
4026
4132
  const p = /<a[^>]*href="(https?:\/\/dribbble\.com\/shots\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4027
- e = e.replace(p, (h, g, f) => er(f));
4133
+ e = e.replace(p, (f, g, m) => tr(m));
4028
4134
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/dribbble\\.com\\/shots\\/(\\d+))(?!["'])`, "gi");
4029
- e = e.replace(w, (h, g, f) => er(f));
4135
+ e = e.replace(w, (f, g, m) => tr(m));
4030
4136
  const c = /<a[^>]*href="(https?:\/\/(?:www\.)?behance\.net\/gallery\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4031
- e = e.replace(c, (h, g, f) => tr(f, g));
4032
- const m = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?behance\\.net\\/gallery\\/(\\d+)[^\\s]*)(?!["'])`, "gi");
4033
- return e = e.replace(m, (h, g, f) => tr(f, g)), e;
4137
+ e = e.replace(c, (f, g, m) => rr(m, g));
4138
+ const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?behance\\.net\\/gallery\\/(\\d+)[^\\s]*)(?!["'])`, "gi");
4139
+ return e = e.replace(h, (f, g, m) => rr(m, g)), e;
4034
4140
  }
4035
- function Kt(e, t = "dark") {
4141
+ function Jt(e, t = "dark") {
4036
4142
  return `
4037
4143
  <div class="artifactuse-sketchfab-wrapper">
4038
4144
  <iframe
@@ -4047,7 +4153,7 @@ function Kt(e, t = "dark") {
4047
4153
  </div>
4048
4154
  `;
4049
4155
  }
4050
- function Jt(e, t) {
4156
+ function Qt(e, t) {
4051
4157
  const r = t ? `&node-id=${t}` : "";
4052
4158
  return `
4053
4159
  <div class="artifactuse-figma-wrapper">
@@ -4060,7 +4166,7 @@ function Jt(e, t) {
4060
4166
  </div>
4061
4167
  `;
4062
4168
  }
4063
- function Qt(e, t) {
4169
+ function Yt(e, t) {
4064
4170
  return `
4065
4171
  <div class="artifactuse-figma-wrapper">
4066
4172
  <iframe
@@ -4072,7 +4178,7 @@ function Qt(e, t) {
4072
4178
  </div>
4073
4179
  `;
4074
4180
  }
4075
- function Yt(e, t) {
4181
+ function er(e, t) {
4076
4182
  return `
4077
4183
  <div class="artifactuse-canva-wrapper">
4078
4184
  <div class="artifactuse-canva-preview">
@@ -4089,7 +4195,7 @@ function Yt(e, t) {
4089
4195
  </div>
4090
4196
  `;
4091
4197
  }
4092
- function er(e) {
4198
+ function tr(e) {
4093
4199
  return `
4094
4200
  <div class="artifactuse-dribbble-wrapper">
4095
4201
  <iframe
@@ -4101,7 +4207,7 @@ function er(e) {
4101
4207
  </div>
4102
4208
  `;
4103
4209
  }
4104
- function tr(e, t) {
4210
+ function rr(e, t) {
4105
4211
  return `
4106
4212
  <div class="artifactuse-behance-wrapper">
4107
4213
  <iframe
@@ -4116,37 +4222,37 @@ function tr(e, t) {
4116
4222
  </div>
4117
4223
  `;
4118
4224
  }
4119
- function Ss(e, t = {}) {
4225
+ function Cs(e, t = {}) {
4120
4226
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:[a-zA-Z0-9-]+\.)?typeform\.com\/to\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4121
- e = e.replace(a, (f, b, v) => rr(v));
4227
+ e = e.replace(a, (m, b, v) => ar(v));
4122
4228
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:[a-zA-Z0-9-]+\\.)?typeform\\.com\\/to\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
4123
- e = e.replace(s, (f, b, v) => rr(v));
4229
+ e = e.replace(s, (m, b, v) => ar(v));
4124
4230
  const n = /<a[^>]*href="(https?:\/\/calendly\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4125
- e = e.replace(n, (f, b, v, M) => ar(v, M));
4231
+ e = e.replace(n, (m, b, v, x) => sr(v, x));
4126
4232
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/calendly\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
4127
- e = e.replace(o, (f, b, v, M) => ar(v, M));
4233
+ e = e.replace(o, (m, b, v, x) => sr(v, x));
4128
4234
  const i = /<a[^>]*href="(https?:\/\/calendar\.google\.com\/calendar\/appointments\/schedules\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4129
- e = e.replace(i, (f, b, v) => sr(v));
4235
+ e = e.replace(i, (m, b, v) => nr(v));
4130
4236
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/calendar\\.google\\.com\\/calendar\\/appointments\\/schedules\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
4131
- e = e.replace(u, (f, b, v) => sr(v));
4237
+ e = e.replace(u, (m, b, v) => nr(v));
4132
4238
  const l = /<a[^>]*href="(https?:\/\/cal\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4133
- e = e.replace(l, (f, b, v, M) => nr(v, M, r));
4239
+ e = e.replace(l, (m, b, v, x) => ir(v, x, r));
4134
4240
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/cal\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
4135
- e = e.replace(d, (f, b, v, M) => nr(v, M, r));
4241
+ e = e.replace(d, (m, b, v, x) => ir(v, x, r));
4136
4242
  const p = /<a[^>]*href="(https?:\/\/(?:www\.)?notion\.so\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4137
- e = e.replace(p, (f, b, v) => ir(v));
4243
+ e = e.replace(p, (m, b, v) => or(v));
4138
4244
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?notion\\.so\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
4139
- e = e.replace(w, (f, b, v) => ir(v));
4245
+ e = e.replace(w, (m, b, v) => or(v));
4140
4246
  const c = /<a[^>]*href="(https?:\/\/airtable\.com\/(?:embed\/)?([a-zA-Z0-9]+)(?:\/([a-zA-Z0-9]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4141
- e = e.replace(c, (f, b, v, M) => or(v, M));
4142
- const m = new RegExp(`(?<!["'=])(https?:\\/\\/airtable\\.com\\/(?:embed\\/)?([a-zA-Z0-9]+)(?:\\/([a-zA-Z0-9]+))?)(?!["'])`, "gi");
4143
- e = e.replace(m, (f, b, v, M) => or(v, M));
4144
- const h = /<a[^>]*href="(https?:\/\/miro\.com\/app\/board\/([a-zA-Z0-9_=-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4145
- e = e.replace(h, (f, b, v) => lr(v));
4247
+ e = e.replace(c, (m, b, v, x) => lr(v, x));
4248
+ const h = new RegExp(`(?<!["'=])(https?:\\/\\/airtable\\.com\\/(?:embed\\/)?([a-zA-Z0-9]+)(?:\\/([a-zA-Z0-9]+))?)(?!["'])`, "gi");
4249
+ e = e.replace(h, (m, b, v, x) => lr(v, x));
4250
+ const f = /<a[^>]*href="(https?:\/\/miro\.com\/app\/board\/([a-zA-Z0-9_=-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4251
+ e = e.replace(f, (m, b, v) => cr(v));
4146
4252
  const g = new RegExp(`(?<!["'=])(https?:\\/\\/miro\\.com\\/app\\/board\\/([a-zA-Z0-9_=-]+))(?!["'])`, "gi");
4147
- return e = e.replace(g, (f, b, v) => lr(v)), e;
4253
+ return e = e.replace(g, (m, b, v) => cr(v)), e;
4148
4254
  }
4149
- function rr(e) {
4255
+ function ar(e) {
4150
4256
  return `
4151
4257
  <div class="artifactuse-typeform-wrapper">
4152
4258
  <iframe
@@ -4157,7 +4263,7 @@ function rr(e) {
4157
4263
  </div>
4158
4264
  `;
4159
4265
  }
4160
- function ar(e, t = "") {
4266
+ function sr(e, t = "") {
4161
4267
  return `
4162
4268
  <div class="artifactuse-calendly-wrapper">
4163
4269
  <iframe
@@ -4168,7 +4274,7 @@ function ar(e, t = "") {
4168
4274
  </div>
4169
4275
  `;
4170
4276
  }
4171
- function sr(e) {
4277
+ function nr(e) {
4172
4278
  return `
4173
4279
  <div class="artifactuse-google-calendar-wrapper">
4174
4280
  <iframe
@@ -4179,7 +4285,7 @@ function sr(e) {
4179
4285
  </div>
4180
4286
  `;
4181
4287
  }
4182
- function nr(e, t = "", r = "dark") {
4288
+ function ir(e, t = "", r = "dark") {
4183
4289
  return `
4184
4290
  <div class="artifactuse-calcom-wrapper">
4185
4291
  <iframe
@@ -4190,7 +4296,7 @@ function nr(e, t = "", r = "dark") {
4190
4296
  </div>
4191
4297
  `;
4192
4298
  }
4193
- function ir(e) {
4299
+ function or(e) {
4194
4300
  return `
4195
4301
  <div class="artifactuse-notion-wrapper">
4196
4302
  <iframe
@@ -4202,7 +4308,7 @@ function ir(e) {
4202
4308
  </div>
4203
4309
  `;
4204
4310
  }
4205
- function or(e, t) {
4311
+ function lr(e, t) {
4206
4312
  return `
4207
4313
  <div class="artifactuse-airtable-wrapper">
4208
4314
  <iframe
@@ -4213,7 +4319,7 @@ function or(e, t) {
4213
4319
  </div>
4214
4320
  `;
4215
4321
  }
4216
- function lr(e) {
4322
+ function cr(e) {
4217
4323
  return `
4218
4324
  <div class="artifactuse-miro-wrapper">
4219
4325
  <iframe
@@ -4225,37 +4331,37 @@ function lr(e) {
4225
4331
  </div>
4226
4332
  `;
4227
4333
  }
4228
- let K = null, Se = !1, nt = !1;
4229
- function Cr(e) {
4334
+ let te = null, Ce = !1, nt = !1;
4335
+ function Rr(e) {
4230
4336
  const t = /<pre><code class="language-mermaid">([\s\S]*?)<\/code><\/pre>/gi;
4231
4337
  return e = e.replace(t, (r, a) => {
4232
- const s = Cs(a).trim();
4233
- return Rs(s);
4338
+ const s = Rs(a).trim();
4339
+ return Ls(s);
4234
4340
  }), e;
4235
4341
  }
4236
- function Cs(e) {
4342
+ function Rs(e) {
4237
4343
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
4238
4344
  }
4239
- function Rs(e) {
4240
- const t = Rr(e);
4345
+ function Ls(e) {
4346
+ const t = Lr(e);
4241
4347
  return `
4242
4348
  <div class="artifactuse-mermaid-container" data-mermaid-id="${`mermaid-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`}" data-mermaid-diagram="${t}">
4243
4349
  <div class="artifactuse-mermaid-loading">Loading diagram...</div>
4244
4350
  </div>
4245
4351
  `;
4246
4352
  }
4247
- function Rr(e) {
4353
+ function Lr(e) {
4248
4354
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4249
4355
  }
4250
- function Lr(e) {
4356
+ function Tr(e) {
4251
4357
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
4252
4358
  }
4253
- function Tr(e = {}) {
4254
- return typeof mermaid > "u" ? Se ? (console.warn("Mermaid loading previously failed. Diagram rendering disabled."), Promise.resolve()) : (console.debug("Mermaid library not loaded. Attempting to load..."), Ts().then(() => (console.log("Mermaid loaded, rendering diagrams..."), cr(e), Ce())).catch((t) => {
4255
- console.error("Failed to load Mermaid library:", t), Se = !0, Ls();
4256
- })) : (nt || cr(e), Ce());
4359
+ function _r(e = {}) {
4360
+ return typeof mermaid > "u" ? Ce ? (console.warn("Mermaid loading previously failed. Diagram rendering disabled."), Promise.resolve()) : (console.debug("Mermaid library not loaded. Attempting to load..."), _s().then(() => (console.log("Mermaid loaded, rendering diagrams..."), ur(e), Re())).catch((t) => {
4361
+ console.error("Failed to load Mermaid library:", t), Ce = !0, Ts();
4362
+ })) : (nt || ur(e), Re());
4257
4363
  }
4258
- function cr(e = {}) {
4364
+ function ur(e = {}) {
4259
4365
  if (typeof mermaid > "u") return;
4260
4366
  const r = {
4261
4367
  dark: "dark",
@@ -4285,7 +4391,7 @@ function cr(e = {}) {
4285
4391
  };
4286
4392
  mermaid.initialize(a), nt = !0;
4287
4393
  }
4288
- async function Ce() {
4394
+ async function Re() {
4289
4395
  if (typeof mermaid > "u") {
4290
4396
  console.warn("renderAllMermaid called but Mermaid is not available");
4291
4397
  return;
@@ -4293,7 +4399,7 @@ async function Ce() {
4293
4399
  const e = document.querySelectorAll(".artifactuse-mermaid-container");
4294
4400
  for (const t of e) {
4295
4401
  if (t.dataset.rendered === "true") continue;
4296
- const r = Lr(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
4402
+ const r = Tr(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
4297
4403
  try {
4298
4404
  if (await mermaid.parse(r)) {
4299
4405
  const { svg: n } = await mermaid.render(a, r);
@@ -4313,10 +4419,10 @@ async function Ce() {
4313
4419
  }
4314
4420
  }
4315
4421
  }
4316
- function Ls() {
4422
+ function Ts() {
4317
4423
  document.querySelectorAll(".artifactuse-mermaid-container").forEach((e) => {
4318
4424
  if (e.dataset.rendered === "true") return;
4319
- const t = Lr(e.dataset.mermaidDiagram);
4425
+ const t = Tr(e.dataset.mermaidDiagram);
4320
4426
  e.innerHTML = `
4321
4427
  <div class="artifactuse-mermaid-fallback">
4322
4428
  <div class="artifactuse-mermaid-fallback-title">Mermaid Diagram</div>
@@ -4328,53 +4434,53 @@ function Ls() {
4328
4434
  function Ge(e) {
4329
4435
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4330
4436
  }
4331
- function Ts() {
4332
- return K || (typeof mermaid < "u" ? Promise.resolve() : (K = new Promise((e, t) => {
4437
+ function _s() {
4438
+ return te || (typeof mermaid < "u" ? Promise.resolve() : (te = new Promise((e, t) => {
4333
4439
  const r = setTimeout(() => {
4334
- K = null, t(new Error("Mermaid loading timed out after 15 seconds"));
4440
+ te = null, t(new Error("Mermaid loading timed out after 15 seconds"));
4335
4441
  }, 15e3), a = document.createElement("script");
4336
4442
  a.src = "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js", a.crossOrigin = "anonymous", a.onload = () => {
4337
4443
  clearTimeout(r), console.log("Mermaid script loaded successfully"), e();
4338
4444
  }, a.onerror = (s) => {
4339
- clearTimeout(r), K = null, console.error("Mermaid script failed to load:", s), t(new Error("Failed to load Mermaid script from CDN"));
4445
+ clearTimeout(r), te = null, console.error("Mermaid script failed to load:", s), t(new Error("Failed to load Mermaid script from CDN"));
4340
4446
  }, document.head.appendChild(a);
4341
- }), K));
4447
+ }), te));
4342
4448
  }
4343
- function rn() {
4344
- K = null, Se = !1, nt = !1;
4449
+ function nn() {
4450
+ te = null, Ce = !1, nt = !1;
4345
4451
  }
4346
- function an() {
4452
+ function on() {
4347
4453
  return typeof mermaid < "u";
4348
4454
  }
4349
- function sn() {
4350
- return Se;
4455
+ function ln() {
4456
+ return Ce;
4351
4457
  }
4352
- function nn(e, t = {}) {
4458
+ function cn(e, t = {}) {
4353
4459
  if (!e) return Promise.resolve();
4354
4460
  let r = e.innerHTML;
4355
- return r = Cr(r), e.innerHTML = r, Tr(t);
4461
+ return r = Rr(r), e.innerHTML = r, _r(t);
4356
4462
  }
4357
- async function on(e) {
4463
+ async function un(e) {
4358
4464
  const t = document.querySelector(`[data-mermaid-id="${e}"]`);
4359
- t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Ce());
4465
+ t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4360
4466
  }
4361
- async function ln(e, t) {
4467
+ async function dn(e, t) {
4362
4468
  const r = document.querySelector(`[data-mermaid-id="${e}"]`);
4363
- r && (r.dataset.mermaidDiagram = Rr(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Ce());
4469
+ r && (r.dataset.mermaidDiagram = Lr(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4364
4470
  }
4365
- function _s(e) {
4471
+ function Es(e) {
4366
4472
  const t = /<table([^>]*)>([\s\S]*?)<\/table>/gi;
4367
4473
  let r = 0;
4368
4474
  return e = e.replace(t, (a, s, n) => {
4369
4475
  const o = `artifactuse-table-${r++}`;
4370
- return Es(o, s, n);
4476
+ return Ps(o, s, n);
4371
4477
  }), e;
4372
4478
  }
4373
- function Es(e, t, r) {
4479
+ function Ps(e, t, r) {
4374
4480
  const a = /<thead/i.test(r) || /<th/i.test(r), s = (r.match(/<tr/gi) || []).length;
4375
4481
  if (!a || s < 3)
4376
4482
  return `<table${t} class="artifactuse-table">${r}</table>`;
4377
- const n = Ps(r);
4483
+ const n = js(r);
4378
4484
  return `
4379
4485
  <div class="artifactuse-table-container" data-table-id="${e}">
4380
4486
  <div class="artifactuse-table-controls">
@@ -4417,7 +4523,7 @@ function Es(e, t, r) {
4417
4523
  </div>
4418
4524
  `;
4419
4525
  }
4420
- function Ps(e) {
4526
+ function js(e) {
4421
4527
  let t = 0;
4422
4528
  return e = e.replace(/<th(\s[^>]*)?>([\s\S]*?)<\/th>/gi, (r, a, s) => {
4423
4529
  const n = t++;
@@ -4436,7 +4542,7 @@ function Ps(e) {
4436
4542
  `;
4437
4543
  }), e;
4438
4544
  }
4439
- function js(e) {
4545
+ function Hs(e) {
4440
4546
  const t = e.querySelectorAll("tr"), r = [];
4441
4547
  return t.forEach((a) => {
4442
4548
  const s = a.querySelectorAll("th, td"), n = [];
@@ -4448,11 +4554,11 @@ function js(e) {
4448
4554
  }), r.join(`
4449
4555
  `);
4450
4556
  }
4451
- function Hs(e, t = "table-data.csv") {
4557
+ function Vs(e, t = "table-data.csv") {
4452
4558
  const r = new Blob([e], { type: "text/csv;charset=utf-8;" }), a = URL.createObjectURL(r), s = document.createElement("a");
4453
4559
  s.href = a, s.download = t, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(a);
4454
4560
  }
4455
- function Vs(e) {
4561
+ function Is(e) {
4456
4562
  const t = e.querySelectorAll("tr"), r = [];
4457
4563
  return t.forEach((a) => {
4458
4564
  const s = a.querySelectorAll("th, td"), n = [];
@@ -4462,7 +4568,7 @@ function Vs(e) {
4462
4568
  }), r.join(`
4463
4569
  `);
4464
4570
  }
4465
- function Is(e, t, r = !0) {
4571
+ function Ds(e, t, r = !0) {
4466
4572
  const a = e.querySelector("tbody") || e, s = Array.from(a.querySelectorAll("tr")).filter((n) => !n.querySelector("th"));
4467
4573
  s.sort((n, o) => {
4468
4574
  const i = n.cells[t], u = o.cells[t];
@@ -4471,11 +4577,11 @@ function Is(e, t, r = !0) {
4471
4577
  const p = parseFloat(l.replace(/[,$%]/g, "")), w = parseFloat(d.replace(/[,$%]/g, ""));
4472
4578
  if (!isNaN(p) && !isNaN(w))
4473
4579
  return r ? p - w : w - p;
4474
- const c = new Date(l), m = new Date(d);
4475
- return !isNaN(c.getTime()) && !isNaN(m.getTime()) ? r ? c - m : m - c : r ? l.localeCompare(d) : d.localeCompare(l);
4580
+ const c = new Date(l), h = new Date(d);
4581
+ return !isNaN(c.getTime()) && !isNaN(h.getTime()) ? r ? c - h : h - c : r ? l.localeCompare(d) : d.localeCompare(l);
4476
4582
  }), s.forEach((n) => a.appendChild(n));
4477
4583
  }
4478
- function Ds(e, t) {
4584
+ function qs(e, t) {
4479
4585
  const r = e.querySelectorAll("tbody tr, tr:not(:first-child)"), a = t.toLowerCase().trim();
4480
4586
  let s = 0;
4481
4587
  return r.forEach((n) => {
@@ -4487,13 +4593,13 @@ function Ds(e, t) {
4487
4593
  n.style.display = i ? "" : "none", i && s++;
4488
4594
  }), s;
4489
4595
  }
4490
- function qs() {
4596
+ function Zs() {
4491
4597
  document.querySelectorAll("[data-table-search]").forEach((e) => {
4492
4598
  const t = e.dataset.tableSearch, r = document.getElementById(t), a = document.querySelector(`[data-table-count="${t}"]`);
4493
4599
  if (r) {
4494
4600
  const s = r.querySelectorAll("tbody tr, tr:not(:first-child)"), n = Array.from(s).filter((o) => !o.querySelector("th")).length;
4495
4601
  a && (a.textContent = `${n} rows`), e.addEventListener("input", (o) => {
4496
- const i = Ds(r, o.target.value);
4602
+ const i = qs(r, o.target.value);
4497
4603
  a && (a.textContent = o.target.value ? `${i} of ${n} rows` : `${n} rows`);
4498
4604
  });
4499
4605
  }
@@ -4502,21 +4608,21 @@ function qs() {
4502
4608
  const t = e.closest("table"), r = parseInt(e.dataset.sortCol), s = e.dataset.sortDir !== "asc";
4503
4609
  t.querySelectorAll(".artifactuse-sortable-header").forEach((n) => {
4504
4610
  n.dataset.sortDir = "", n.classList.remove("sort-asc", "sort-desc");
4505
- }), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), Is(t, r, s);
4611
+ }), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), Ds(t, r, s);
4506
4612
  });
4507
4613
  }), document.querySelectorAll("[data-table-export]").forEach((e) => {
4508
4614
  e.addEventListener("click", () => {
4509
4615
  const t = e.dataset.tableExport, r = document.getElementById(t);
4510
4616
  if (r) {
4511
- const a = js(r);
4512
- Hs(a, `${t}.csv`);
4617
+ const a = Hs(r);
4618
+ Vs(a, `${t}.csv`);
4513
4619
  }
4514
4620
  });
4515
4621
  }), document.querySelectorAll("[data-table-copy]").forEach((e) => {
4516
4622
  e.addEventListener("click", async () => {
4517
4623
  const t = e.dataset.tableCopy, r = document.getElementById(t);
4518
4624
  if (r) {
4519
- const a = Vs(r);
4625
+ const a = Is(r);
4520
4626
  try {
4521
4627
  await navigator.clipboard.writeText(a);
4522
4628
  const s = e.querySelector("span"), n = s ? s.textContent : "";
@@ -4530,52 +4636,52 @@ function qs() {
4530
4636
  });
4531
4637
  });
4532
4638
  }
4533
- let J = null, Re = !1;
4534
- function _r(e) {
4535
- return e = Zs(e), e = e.replace(/\$\$([\s\S]*?)\$\$/g, (t, r) => fe(r.trim(), !0)), e = e.replace(/\\\[([\s\S]*?)\\\]/g, (t, r) => fe(r.trim(), !0)), e = e.replace(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+?)\\$(?!\\$)", "g"), (t, r) => fe(r.trim(), !1)), e = e.replace(/\\\(([\s\S]*?)\\\)/g, (t, r) => fe(r.trim(), !1)), e;
4639
+ let re = null, Le = !1;
4640
+ function Er(e) {
4641
+ return e = Os(e), e = e.replace(/\$\$([\s\S]*?)\$\$/g, (t, r) => he(r.trim(), !0)), e = e.replace(/\\\[([\s\S]*?)\\\]/g, (t, r) => he(r.trim(), !0)), e = e.replace(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+?)\\$(?!\\$)", "g"), (t, r) => he(r.trim(), !1)), e = e.replace(/\\\(([\s\S]*?)\\\)/g, (t, r) => he(r.trim(), !1)), e;
4536
4642
  }
4537
- function Zs(e) {
4643
+ function Os(e) {
4538
4644
  const t = /<pre><code class="language-(math|latex)">([\s\S]*?)<\/code><\/pre>/gi;
4539
4645
  return e = e.replace(t, (r, a, s) => {
4540
- const n = Os(s).trim();
4541
- return fe(n, !0);
4646
+ const n = Bs(s).trim();
4647
+ return he(n, !0);
4542
4648
  }), e;
4543
4649
  }
4544
- function Os(e) {
4650
+ function Bs(e) {
4545
4651
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
4546
4652
  }
4547
- function fe(e, t = !1) {
4548
- const r = Bs(e);
4653
+ function he(e, t = !1) {
4654
+ const r = Fs(e);
4549
4655
  return `<span class="artifactuse-math-container ${t ? "artifactuse-math-display" : "artifactuse-math-inline"}" data-tex="${r}" data-display="${t ? "true" : "false"}"></span>`;
4550
4656
  }
4551
- function Bs(e) {
4657
+ function Fs(e) {
4552
4658
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4553
4659
  }
4554
- function Er(e) {
4660
+ function Pr(e) {
4555
4661
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
4556
4662
  }
4557
- function Pr() {
4558
- return typeof katex > "u" ? Re ? (console.warn("KaTeX loading previously failed. Math rendering disabled."), Promise.resolve()) : (console.debug("KaTeX library not loaded. Attempting to load..."), Ns().then(() => {
4559
- console.log("KaTeX loaded, rendering math..."), ur();
4663
+ function jr() {
4664
+ return typeof katex > "u" ? Le ? (console.warn("KaTeX loading previously failed. Math rendering disabled."), Promise.resolve()) : (console.debug("KaTeX library not loaded. Attempting to load..."), Us().then(() => {
4665
+ console.log("KaTeX loaded, rendering math..."), dr();
4560
4666
  }).catch((e) => {
4561
- console.error("Failed to load KaTeX library:", e), Re = !0, Fs();
4562
- })) : (ur(), Promise.resolve());
4667
+ console.error("Failed to load KaTeX library:", e), Le = !0, Ns();
4668
+ })) : (dr(), Promise.resolve());
4563
4669
  }
4564
- function Fs() {
4670
+ function Ns() {
4565
4671
  document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
4566
4672
  if (e.dataset.rendered === "true") return;
4567
- const t = Er(e.dataset.tex);
4673
+ const t = Pr(e.dataset.tex);
4568
4674
  e.innerHTML = `<code class="artifactuse-math-fallback" title="Math rendering unavailable">${We(t)}</code>`, e.dataset.rendered = "true", e.classList.add("artifactuse-math-fallback-container");
4569
4675
  });
4570
4676
  }
4571
- function ur() {
4677
+ function dr() {
4572
4678
  if (typeof katex > "u") {
4573
4679
  console.warn("renderAllMath called but KaTeX is not available");
4574
4680
  return;
4575
4681
  }
4576
4682
  document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
4577
4683
  if (e.dataset.rendered === "true") return;
4578
- const t = Er(e.dataset.tex), r = e.dataset.display === "true";
4684
+ const t = Pr(e.dataset.tex), r = e.dataset.display === "true";
4579
4685
  try {
4580
4686
  katex.render(t, e, {
4581
4687
  displayMode: r,
@@ -4603,10 +4709,10 @@ function ur() {
4603
4709
  function We(e) {
4604
4710
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4605
4711
  }
4606
- function Ns() {
4607
- return J || (typeof katex < "u" ? Promise.resolve() : (J = new Promise((e, t) => {
4712
+ function Us() {
4713
+ return re || (typeof katex < "u" ? Promise.resolve() : (re = new Promise((e, t) => {
4608
4714
  const r = setTimeout(() => {
4609
- J = null, t(new Error("KaTeX loading timed out after 10 seconds"));
4715
+ re = null, t(new Error("KaTeX loading timed out after 10 seconds"));
4610
4716
  }, 1e4), a = document.createElement("link");
4611
4717
  a.rel = "stylesheet", a.href = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css", a.crossOrigin = "anonymous", a.onerror = () => {
4612
4718
  console.warn("KaTeX CSS failed to load, math may not render correctly");
@@ -4615,25 +4721,25 @@ function Ns() {
4615
4721
  s.src = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js", s.crossOrigin = "anonymous", s.onload = () => {
4616
4722
  clearTimeout(r), console.log("KaTeX script loaded successfully"), e();
4617
4723
  }, s.onerror = (n) => {
4618
- clearTimeout(r), J = null, console.error("KaTeX script failed to load:", n), t(new Error("Failed to load KaTeX script from CDN"));
4724
+ clearTimeout(r), re = null, console.error("KaTeX script failed to load:", n), t(new Error("Failed to load KaTeX script from CDN"));
4619
4725
  }, document.head.appendChild(s);
4620
- }), J));
4726
+ }), re));
4621
4727
  }
4622
- function cn() {
4623
- J = null, Re = !1;
4728
+ function pn() {
4729
+ re = null, Le = !1;
4624
4730
  }
4625
- function un() {
4731
+ function fn() {
4626
4732
  return typeof katex < "u";
4627
4733
  }
4628
- function dn() {
4629
- return Re;
4734
+ function hn() {
4735
+ return Le;
4630
4736
  }
4631
- function pn(e) {
4737
+ function gn(e) {
4632
4738
  if (!e) return Promise.resolve();
4633
4739
  let t = e.innerHTML;
4634
- return t = _r(t), e.innerHTML = t, Pr();
4740
+ return t = Er(t), e.innerHTML = t, jr();
4635
4741
  }
4636
- const fn = {
4742
+ const mn = {
4637
4743
  // Fractions
4638
4744
  fraction: (e, t) => `\\frac{${e}}{${t}}`,
4639
4745
  // Square root
@@ -4666,104 +4772,7 @@ const fn = {
4666
4772
  derivative: (e, t) => `\\frac{d${e}}{d${t}}`,
4667
4773
  partialDerivative: (e, t) => `\\frac{\\partial ${e}}{\\partial ${t}}`
4668
4774
  };
4669
- function we() {
4670
- return typeof window < "u" && window.Prism;
4671
- }
4672
- function jr(e) {
4673
- if (!we()) {
4674
- console.warn("Artifactuse: Prism.js not found. Install and include Prism.js for syntax highlighting.");
4675
- return;
4676
- }
4677
- const t = typeof e == "string" ? document.querySelector(e) : e;
4678
- if (!t) return;
4679
- t.querySelectorAll("pre code").forEach((a) => {
4680
- if (a.classList.contains("prism-highlighted")) return;
4681
- const s = Us(a);
4682
- s && (a.className.includes(`language-${s}`) || a.classList.add(`language-${s}`), window.Prism.highlightElement(a), a.classList.add("prism-highlighted"));
4683
- });
4684
- }
4685
- function hn(e, t) {
4686
- we() && (t && !e.className.includes(`language-${t}`) && e.classList.add(`language-${t}`), window.Prism.highlightElement(e), e.classList.add("prism-highlighted"));
4687
- }
4688
- function gn(e, t) {
4689
- if (!we()) return dr(e);
4690
- const r = window.Prism.languages[t];
4691
- return r ? window.Prism.highlight(e, r, t) : dr(e);
4692
- }
4693
- function Us(e) {
4694
- const t = e.className.split(/\s+/);
4695
- for (const s of t) {
4696
- const n = s.match(/^(?:language-|lang-)(.+)$/);
4697
- if (n)
4698
- return He(n[1]);
4699
- }
4700
- const r = e.closest("pre");
4701
- if (r) {
4702
- const s = r.className.split(/\s+/);
4703
- for (const n of s) {
4704
- const o = n.match(/^(?:language-|lang-)(.+)$/);
4705
- if (o)
4706
- return He(o[1]);
4707
- }
4708
- }
4709
- const a = e.dataset.language || (r == null ? void 0 : r.dataset.language);
4710
- return a ? He(a) : null;
4711
- }
4712
- function He(e) {
4713
- const t = {
4714
- js: "javascript",
4715
- ts: "typescript",
4716
- py: "python",
4717
- rb: "ruby",
4718
- sh: "bash",
4719
- shell: "bash",
4720
- zsh: "bash",
4721
- yml: "yaml",
4722
- md: "markdown",
4723
- html: "markup",
4724
- xml: "markup",
4725
- svg: "markup",
4726
- vue: "markup",
4727
- jsx: "jsx",
4728
- tsx: "tsx",
4729
- "c++": "cpp",
4730
- "c#": "csharp",
4731
- cs: "csharp",
4732
- "f#": "fsharp",
4733
- "objective-c": "objectivec",
4734
- objc: "objectivec"
4735
- }, r = e.toLowerCase();
4736
- return t[r] || r;
4737
- }
4738
- function dr(e) {
4739
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
4740
- }
4741
- function mn(e) {
4742
- if (!we())
4743
- return console.warn("Artifactuse: Prism.js not found. Auto-highlighting disabled."), null;
4744
- const t = new MutationObserver((r) => {
4745
- let a = !1;
4746
- for (const s of r)
4747
- if (s.type === "childList") {
4748
- for (const n of s.addedNodes)
4749
- if (n.nodeType === Node.ELEMENT_NODE && (n.matches("pre code") || n.querySelector("pre code"))) {
4750
- a = !0;
4751
- break;
4752
- }
4753
- }
4754
- a && jr(e);
4755
- });
4756
- return t.observe(e, {
4757
- childList: !0,
4758
- subtree: !0
4759
- }), t;
4760
- }
4761
- function wn() {
4762
- return we() ? Object.keys(window.Prism.languages).filter(
4763
- (e) => typeof window.Prism.languages[e] == "object"
4764
- ) : [];
4765
- }
4766
- function ke(e) {
4775
+ function xe(e) {
4767
4776
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4768
4777
  }
4769
4778
  function Gs() {
@@ -4775,18 +4784,18 @@ function Gs() {
4775
4784
  }, t = {
4776
4785
  link(a) {
4777
4786
  const s = typeof a == "string" ? a : a.href, n = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
4778
- if (es(s))
4779
- return rs(s);
4780
- const i = n ? ` title="${ke(n)}"` : "";
4781
- return `<a href="${ke(s || "")}" target="_blank" rel="noopener noreferrer"${i}>${o || ""}</a>`;
4787
+ if (ts(s))
4788
+ return as(s);
4789
+ const i = n ? ` title="${xe(n)}"` : "";
4790
+ return `<a href="${xe(s || "")}" target="_blank" rel="noopener noreferrer"${i}>${o || ""}</a>`;
4782
4791
  }
4783
4792
  }, r = {
4784
4793
  code(a) {
4785
- const s = typeof a == "string" ? a : a.text, o = (typeof a == "string" ? arguments[1] : a.lang) || "", i = ke(s || "");
4786
- return o ? `<pre><code class="language-${ke(o)}">${i}</code></pre>` : `<pre><code>${i}</code></pre>`;
4794
+ const s = typeof a == "string" ? a : a.text, o = (typeof a == "string" ? arguments[1] : a.lang) || "", i = xe(s || "");
4795
+ return o ? `<pre><code class="language-${xe(o)}">${i}</code></pre>` : `<pre><code>${i}</code></pre>`;
4787
4796
  }
4788
4797
  };
4789
- H.use({
4798
+ V.use({
4790
4799
  renderer: {
4791
4800
  ...e,
4792
4801
  ...t,
@@ -4968,11 +4977,11 @@ function Ks(e, t) {
4968
4977
  return null;
4969
4978
  w.endsWith("/") || (w += "");
4970
4979
  const c = new URLSearchParams();
4971
- l.theme && c.set("theme", l.theme), l.accent && c.set("accent", l.accent), l.params && Object.entries(l.params).forEach(([h, g]) => {
4972
- c.set(h, g);
4980
+ l.theme && c.set("theme", l.theme), l.accent && c.set("accent", l.accent), l.params && Object.entries(l.params).forEach(([f, g]) => {
4981
+ c.set(f, g);
4973
4982
  });
4974
- const m = c.toString();
4975
- return m ? `${w}?${m}` : w;
4983
+ const h = c.toString();
4984
+ return h ? `${w}?${h}` : w;
4976
4985
  }
4977
4986
  function s(u) {
4978
4987
  const l = u == null ? void 0 : u.toLowerCase();
@@ -5007,138 +5016,141 @@ function Ks(e, t) {
5007
5016
  }
5008
5017
  };
5009
5018
  }
5010
- function bn(e = {}) {
5011
- const t = Ir(Ws, e), r = ta(), a = { ...Hr, ...t.panels }, s = Xs(a, t.cdnUrl), n = ra(s), o = na(t.theme, t.colors || {}), i = Ks(t, n), u = pa(t.sharing), l = fa(t.editor);
5012
- function d(k, _, R = {}) {
5013
- let A = H.parse(k);
5014
- const D = [], P = { theme: o.resolved }, Z = R.inlinePreview ?? t.inlinePreview ?? null, ne = R.inlineCode ?? t.inlineCode ?? null, re = R.tabs ?? t.tabs ?? null, ae = R.viewMode ?? t.viewMode ?? null;
5019
+ function wn(e = {}) {
5020
+ const t = Ir(Ws, e), r = ra(), a = { ...Hr, ...t.panels }, s = Xs(a, t.cdnUrl), n = aa(s), o = ia(t.theme, t.colors || {}), i = Ks(t, n), u = fa(t.sharing), l = ha(t.editor);
5021
+ function d(k, P, R = {}) {
5022
+ let C = V.parse(k);
5023
+ const D = [], _ = { theme: o.resolved }, q = R.inlinePreview ?? t.inlinePreview ?? null, J = R.inlineCode ?? t.inlineCode ?? null, le = R.tabs ?? t.tabs ?? null, K = R.viewMode ?? t.viewMode ?? null;
5015
5024
  if (t.processors.codeBlocks) {
5016
- const O = ea(A, _, {
5025
+ const U = ta(C, P, {
5017
5026
  ...t.codeExtraction,
5018
- inlinePreview: Z,
5019
- inlineCode: ne,
5020
- tabs: re,
5021
- viewMode: ae
5027
+ inlinePreview: q,
5028
+ inlineCode: J,
5029
+ tabs: le,
5030
+ viewMode: K
5022
5031
  });
5023
- A = O.html, D.push(...O.artifacts);
5032
+ C = U.html, D.push(...U.artifacts);
5024
5033
  }
5025
- return t.processors.images && (A = Qa(A)), t.processors.imageGalleries && (A = Ya(A)), t.processors.videos && (A = as(A)), t.processors.videoGalleries && (A = os(A)), t.processors.audio && (A = us(A, P)), t.processors.maps && (A = bs(A)), t.processors.social && (A = vs(A, P)), t.processors.documents && (A = ys(A), A = ks(A), A = xs(A)), t.processors.codeEmbeds && (A = $s(A, P)), t.processors.dataViz && (A = zs(A)), t.processors.design && (A = As(A, P)), t.processors.interactive && (A = Ss(A, P)), t.processors.tables && (A = _s(A)), t.processors.math && (A = _r(A)), t.processors.mermaid && (A = Cr(A)), D.forEach((O) => {
5026
- r.addArtifact(O);
5034
+ return t.processors.images && (C = Ya(C)), t.processors.imageGalleries && (C = es(C)), t.processors.videos && (C = ss(C)), t.processors.videoGalleries && (C = ls(C)), t.processors.audio && (C = ds(C, _)), t.processors.maps && (C = vs(C)), t.processors.social && (C = ys(C, _)), t.processors.documents && (C = ks(C), C = xs(C), C = Ms(C)), t.processors.codeEmbeds && (C = As(C, _)), t.processors.dataViz && (C = zs(C)), t.processors.design && (C = Ss(C, _)), t.processors.interactive && (C = Cs(C, _)), t.processors.tables && (C = Es(C)), t.processors.math && (C = Er(C)), t.processors.mermaid && (C = Rr(C)), D.forEach((U) => {
5035
+ r.addArtifact(U);
5027
5036
  }), {
5028
- html: A,
5037
+ html: C,
5029
5038
  artifacts: D
5030
5039
  };
5031
5040
  }
5032
5041
  async function p(k = document) {
5033
- const _ = [], R = { theme: o.resolved };
5034
- t.processors.math && _.push(Pr()), t.processors.mermaid && _.push(Tr(R)), t.processors.tables && qs(), t.processors.audio && ps(k), t.syntaxHighlight && (jr(k), (k === document ? document : k).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((P) => {
5035
- var ae;
5036
- const Z = P.querySelector("code");
5037
- if (!Z || Z.dataset.smartdiffProcessed) return;
5038
- const ne = ((ae = P.dataset.smartdiffMarkers) == null ? void 0 : ae.split(",")) || [], re = Z.innerHTML.split(`
5042
+ const P = [], R = { theme: o.resolved };
5043
+ t.processors.math && P.push(jr()), t.processors.mermaid && P.push(_r(R)), t.processors.tables && Zs(), t.processors.audio && fs(k), t.syntaxHighlight && (pr(k), (k === document ? document : k).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((_) => {
5044
+ var K;
5045
+ const q = _.querySelector("code");
5046
+ if (!q || q.dataset.smartdiffProcessed) return;
5047
+ const J = ((K = _.dataset.smartdiffMarkers) == null ? void 0 : K.split(",")) || [], le = q.innerHTML.split(`
5039
5048
  `);
5040
- Z.innerHTML = re.map((O, be) => {
5041
- const ie = ne[be];
5042
- return ie === "-" ? `<span class="token deleted">${O}</span>` : ie === "+" ? `<span class="token inserted">${O}</span>` : O;
5049
+ q.innerHTML = le.map((U, ve) => {
5050
+ const Y = J[ve];
5051
+ return Y === "-" ? `<span class="token deleted">${U}</span>` : Y === "+" ? `<span class="token inserted">${U}</span>` : U;
5043
5052
  }).join(`
5044
- `), Z.dataset.smartdiffProcessed = "true";
5045
- })), await Promise.all(_);
5053
+ `), q.dataset.smartdiffProcessed = "true";
5054
+ })), await Promise.all(P);
5046
5055
  }
5047
5056
  function w(k) {
5048
5057
  if (k.isInline) {
5049
5058
  console.warn("Attempted to open inline artifact in panel:", k.id);
5050
5059
  return;
5051
5060
  }
5052
- t.multiTab ? r.openTab(k.id) : r.setActiveArtifact(k.id), r.setPanelOpen(!0), k.viewMode && r.setViewMode(k.viewMode), L("artifact:opened", k);
5061
+ t.multiTab ? r.openTab(k.id) : r.setActiveArtifact(k.id), r.setForceEmptyView(!1), r.setPanelOpen(!0), k.viewMode && r.setViewMode(k.viewMode), T("artifact:opened", k);
5053
5062
  }
5054
- function c(k, _, R = {}) {
5055
- const A = k.split(".").pop(), D = R.language || Nr(A) || A, P = R.title || k;
5056
- return m(_, D, { ...R, title: P });
5063
+ function c(k, P, R = {}) {
5064
+ const C = k.split(".").pop(), D = R.language || Ur(C) || C, _ = R.title || k, q = r.getState().artifacts.find((J) => J.title === _ && !J.isInline);
5065
+ return q ? (f(q.id, P, { ...R, title: _ }), w(q), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), r.getArtifact(q.id)) : h(P, D, { ...R, title: _ });
5057
5066
  }
5058
- function m(k, _, R = {}) {
5059
- const A = R.messageId || Br("open"), D = $({ type: _, language: _ }) ? _ : "txt", P = Me(k, D, A, 0);
5060
- return P.title = R.title || P.title, P.isInline = !1, P.editorLanguage = _, R.tabs && (P.tabs = R.tabs), R.panelUrl && (P.panelUrl = R.panelUrl), r.addArtifact(P), w(P), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), P;
5067
+ function h(k, P, R = {}) {
5068
+ const C = R.messageId || Fr("open"), D = A({ type: P, language: P }) ? P : "txt", _ = $e(k, D, C, 0);
5069
+ return _.title = R.title || _.title, _.isInline = !1, _.editorLanguage = P, R.tabs && (_.tabs = R.tabs), R.panelUrl && (_.panelUrl = R.panelUrl), r.addArtifact(_), w(_), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), _;
5061
5070
  }
5062
- function h(k, _, R = {}) {
5063
- const A = typeof k == "string" ? k : k == null ? void 0 : k.id, D = r.getArtifact(A);
5071
+ function f(k, P, R = {}) {
5072
+ const C = typeof k == "string" ? k : k == null ? void 0 : k.id, D = r.getArtifact(C);
5064
5073
  if (!D) return null;
5065
- const P = { ...D, code: _, _refreshToken: Date.now() };
5066
- return R.title !== void 0 && (P.title = R.title), R.tabs !== void 0 && (P.tabs = R.tabs), R.panelUrl !== void 0 && (P.panelUrl = R.panelUrl), r.addArtifact(P), L("artifact:updated", { artifactId: A, artifact: r.getArtifact(A) }), r.getArtifact(A);
5074
+ const _ = { ...D, code: P, _refreshToken: Date.now() };
5075
+ return R.title !== void 0 && (_.title = R.title), R.tabs !== void 0 && (_.tabs = R.tabs), R.panelUrl !== void 0 && (_.panelUrl = R.panelUrl), r.addArtifact(_), T("artifact:updated", { artifactId: C, artifact: r.getArtifact(C) }), r.getArtifact(C);
5067
5076
  }
5068
5077
  function g() {
5069
- r.setPanelOpen(!1), r.setFullscreen(!1), L("panel:closed");
5078
+ r.clearActiveArtifact(), r.setForceEmptyView(!0), r.setPanelOpen(!0), T("panel:opened");
5070
5079
  }
5071
- function f() {
5072
- const k = !r.getState().isPanelOpen;
5073
- r.clearActiveArtifact(), r.setPanelOpen(k), k || r.setFullscreen(!1), L("panel:toggled", { isOpen: k });
5080
+ function m() {
5081
+ r.setPanelOpen(!1), r.setFullscreen(!1), T("panel:closed");
5074
5082
  }
5075
5083
  function b() {
5084
+ const k = !r.getState().isPanelOpen;
5085
+ r.clearActiveArtifact(), r.setPanelOpen(k), k || r.setFullscreen(!1), T("panel:toggled", { isOpen: k });
5086
+ }
5087
+ function v() {
5076
5088
  const k = !r.getState().isFullscreen;
5077
- r.setFullscreen(k), L("fullscreen:toggled", { isFullscreen: k });
5089
+ r.setFullscreen(k), T("fullscreen:toggled", { isFullscreen: k });
5078
5090
  }
5079
- function v(k) {
5080
- r.setViewMode(k), L("viewMode:changed", { mode: k });
5091
+ function x(k) {
5092
+ r.setViewMode(k), T("viewMode:changed", { mode: k });
5081
5093
  }
5082
- function M(k, _ = {}) {
5094
+ function M(k, P = {}) {
5083
5095
  if (!k) return null;
5084
5096
  if (k.panelUrl) return k.panelUrl;
5085
- const { type: R, language: A } = k, D = {
5086
- theme: _.theme || o.resolved
5087
- }, P = o.colors;
5088
- P != null && P.primary && (D.accent = P.primary);
5089
- let Z = i.resolve(R, D);
5090
- return !Z && A && (Z = i.resolve(A, D)), Z;
5091
- }
5092
- function $(k) {
5097
+ const { type: R, language: C } = k, D = {
5098
+ theme: P.theme || o.resolved
5099
+ }, _ = o.colors;
5100
+ _ != null && _.primary && (D.accent = _.primary);
5101
+ let q = i.resolve(R, D);
5102
+ return !q && C && (q = i.resolve(C, D)), q;
5103
+ }
5104
+ function A(k) {
5093
5105
  return k ? i.has(k.type) || i.has(k.language) : !1;
5094
5106
  }
5095
- function z(k, _) {
5096
- i.register(k, _);
5107
+ function S(k, P) {
5108
+ i.register(k, P);
5097
5109
  }
5098
- function S(k) {
5110
+ function L(k) {
5099
5111
  i.unregister(k);
5100
5112
  }
5101
- function y() {
5113
+ function $() {
5102
5114
  return i.getTypes();
5103
5115
  }
5104
- function C(k, _) {
5105
- n.send(k, _);
5116
+ function y(k, P) {
5117
+ n.send(k, P);
5106
5118
  }
5107
- const x = /* @__PURE__ */ new Map();
5108
- function E(k, _) {
5109
- return x.has(k) || x.set(k, /* @__PURE__ */ new Set()), x.get(k).add(_), () => {
5119
+ const z = /* @__PURE__ */ new Map();
5120
+ function j(k, P) {
5121
+ return z.has(k) || z.set(k, /* @__PURE__ */ new Set()), z.get(k).add(P), () => {
5110
5122
  var R;
5111
- (R = x.get(k)) == null || R.delete(_);
5123
+ (R = z.get(k)) == null || R.delete(P);
5112
5124
  };
5113
5125
  }
5114
- function T(k, _) {
5126
+ function E(k, P) {
5115
5127
  var R;
5116
- (R = x.get(k)) == null || R.delete(_);
5128
+ (R = z.get(k)) == null || R.delete(P);
5117
5129
  }
5118
- function L(k, _) {
5130
+ function T(k, P) {
5119
5131
  var R;
5120
- (R = x.get(k)) == null || R.forEach((A) => {
5132
+ (R = z.get(k)) == null || R.forEach((C) => {
5121
5133
  try {
5122
- A(_);
5134
+ C(P);
5123
5135
  } catch (D) {
5124
5136
  console.error(`Artifactuse event handler error (${k}):`, D);
5125
5137
  }
5126
5138
  });
5127
5139
  }
5128
- n.on("ai:request", (k) => L("ai:request", k)), n.on("save:request", (k) => L("save:request", k)), n.on("export:complete", (k) => L("export:complete", k)), n.on("form:submit", (k) => L("form:submit", k)), n.on("form:cancel", (k) => L("form:cancel", k)), n.on("form:step", (k) => L("form:step", k)), n.on("social:copy", (k) => L("social:copy", k)), n.on("edit:save", (k) => {
5129
- k != null && k.artifactId && (k == null ? void 0 : k.code) !== void 0 && h(k.artifactId, k.code), L("edit:save", k);
5140
+ n.on("ai:request", (k) => T("ai:request", k)), n.on("save:request", (k) => T("save:request", k)), n.on("export:complete", (k) => T("export:complete", k)), n.on("form:submit", (k) => T("form:submit", k)), n.on("form:cancel", (k) => T("form:cancel", k)), n.on("form:step", (k) => T("form:step", k)), n.on("social:copy", (k) => T("social:copy", k)), n.on("edit:save", (k) => {
5141
+ k != null && k.artifactId && (k == null ? void 0 : k.code) !== void 0 && f(k.artifactId, k.code), T("edit:save", k);
5130
5142
  });
5131
- function I() {
5143
+ function N() {
5132
5144
  o.apply();
5133
5145
  }
5134
- function G(k) {
5146
+ function X(k) {
5135
5147
  o.set(k);
5136
5148
  }
5137
- function te() {
5149
+ function O() {
5138
5150
  return o.resolved;
5139
5151
  }
5140
- function U() {
5141
- n.destroy(), x.clear(), r.clear(), ws();
5152
+ function B() {
5153
+ n.destroy(), z.clear(), r.clear(), bs();
5142
5154
  }
5143
5155
  return {
5144
5156
  // Config
@@ -5153,34 +5165,35 @@ function bn(e = {}) {
5153
5165
  // Panel control
5154
5166
  openArtifact: w,
5155
5167
  openFile: c,
5156
- openCode: m,
5157
- updateFile: h,
5158
- closePanel: g,
5159
- togglePanel: f,
5160
- toggleFullscreen: b,
5161
- setViewMode: v,
5168
+ openCode: h,
5169
+ updateFile: f,
5170
+ openPanel: g,
5171
+ closePanel: m,
5172
+ togglePanel: b,
5173
+ toggleFullscreen: v,
5174
+ setViewMode: x,
5162
5175
  getPanelUrl: M,
5163
- sendToPanel: C,
5176
+ sendToPanel: y,
5164
5177
  // Multi-tab
5165
5178
  closeTab: (k) => r.closeTab(k),
5166
5179
  closeOtherTabs: (k) => r.closeOtherTabs(k),
5167
5180
  closeAllTabs: () => r.closeAllTabs(),
5168
5181
  // Panel management (new)
5169
- hasPanel: $,
5170
- registerPanel: z,
5171
- unregisterPanel: S,
5172
- getPanelTypes: y,
5182
+ hasPanel: A,
5183
+ registerPanel: S,
5184
+ unregisterPanel: L,
5185
+ getPanelTypes: $,
5173
5186
  panelResolver: i,
5174
5187
  // Expose for advanced use
5175
5188
  // Theme
5176
5189
  theme: o,
5177
- applyTheme: I,
5178
- setTheme: G,
5179
- getTheme: te,
5190
+ applyTheme: N,
5191
+ setTheme: X,
5192
+ getTheme: O,
5180
5193
  // Events
5181
- on: E,
5182
- off: T,
5183
- emit: L,
5194
+ on: j,
5195
+ off: E,
5196
+ emit: T,
5184
5197
  // Editor (CodeMirror integration)
5185
5198
  editor: l,
5186
5199
  // Bridge (for advanced use)
@@ -5188,7 +5201,7 @@ function bn(e = {}) {
5188
5201
  // Sharing
5189
5202
  share: u,
5190
5203
  // Cleanup
5191
- destroy: U
5204
+ destroy: B
5192
5205
  };
5193
5206
  }
5194
5207
  function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
@@ -5221,122 +5234,122 @@ function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
5221
5234
  return a;
5222
5235
  }
5223
5236
  export {
5224
- ks as $,
5237
+ xs as $,
5225
5238
  Oe as A,
5226
5239
  Be as B,
5227
5240
  Fe as C,
5228
5241
  Hr as D,
5229
5242
  Ne as E,
5230
- us as F,
5231
- vt as G,
5232
- yt as H,
5233
- B as I,
5234
- kt as J,
5235
- ps as K,
5236
- ws as L,
5237
- bs as M,
5238
- X as N,
5243
+ ds as F,
5244
+ yt as G,
5245
+ kt as H,
5246
+ F as I,
5247
+ xt as J,
5248
+ fs as K,
5249
+ bs as L,
5250
+ vs as M,
5251
+ ee as N,
5239
5252
  Ue as O,
5240
- Ct as P,
5241
- vs as Q,
5242
- Rt as R,
5243
- Lt as S,
5244
- Tt as T,
5245
- _t as U,
5246
- Et as V,
5247
- Pt as W,
5248
- jt as X,
5249
- Ht as Y,
5250
- ys as Z,
5251
- Vt as _,
5252
- Ys as a,
5253
- wn as a$,
5254
- se as a0,
5255
- It as a1,
5256
- xs as a2,
5257
- Dt as a3,
5258
- $s as a4,
5259
- qt as a5,
5260
- Zt as a6,
5261
- Ot as a7,
5262
- Bt as a8,
5263
- Ft as a9,
5264
- an as aA,
5265
- sn as aB,
5266
- nn as aC,
5267
- on as aD,
5268
- ln as aE,
5269
- _s as aF,
5270
- Es as aG,
5271
- js as aH,
5272
- Hs as aI,
5273
- Vs as aJ,
5274
- Is as aK,
5275
- Ds as aL,
5276
- qs as aM,
5277
- _r as aN,
5278
- fe as aO,
5279
- Pr as aP,
5280
- Ns as aQ,
5281
- cn as aR,
5282
- un as aS,
5283
- dn as aT,
5284
- pn as aU,
5285
- fn as aV,
5286
- jr as aW,
5287
- hn as aX,
5288
- gn as aY,
5289
- Us as aZ,
5290
- mn as a_,
5291
- Nt as aa,
5253
+ Rt as P,
5254
+ ys as Q,
5255
+ Lt as R,
5256
+ Tt as S,
5257
+ _t as T,
5258
+ Et as U,
5259
+ Pt as V,
5260
+ jt as W,
5261
+ Ht as X,
5262
+ Vt as Y,
5263
+ ks as Z,
5264
+ It as _,
5265
+ rn as a,
5266
+ en as a$,
5267
+ oe as a0,
5268
+ Dt as a1,
5269
+ Ms as a2,
5270
+ qt as a3,
5271
+ As as a4,
5272
+ Zt as a5,
5273
+ Ot as a6,
5274
+ Bt as a7,
5275
+ Ft as a8,
5276
+ Nt as a9,
5277
+ on as aA,
5278
+ ln as aB,
5279
+ cn as aC,
5280
+ un as aD,
5281
+ dn as aE,
5282
+ Es as aF,
5283
+ Ps as aG,
5284
+ Hs as aH,
5285
+ Vs as aI,
5286
+ Is as aJ,
5287
+ Ds as aK,
5288
+ qs as aL,
5289
+ Zs as aM,
5290
+ Er as aN,
5291
+ he as aO,
5292
+ jr as aP,
5293
+ Us as aQ,
5294
+ pn as aR,
5295
+ fn as aS,
5296
+ hn as aT,
5297
+ gn as aU,
5298
+ mn as aV,
5299
+ pr as aW,
5300
+ Qs as aX,
5301
+ ot as aY,
5302
+ Zr as aZ,
5303
+ Ys as a_,
5304
+ Ut as aa,
5292
5305
  zs as ab,
5293
- Ut as ac,
5294
- Gt as ad,
5295
- Wt as ae,
5296
- Xt as af,
5297
- As as ag,
5298
- Kt as ah,
5299
- Jt as ai,
5300
- Qt as aj,
5301
- Yt as ak,
5302
- er as al,
5303
- tr as am,
5304
- Ss as an,
5305
- rr as ao,
5306
- ar as ap,
5307
- sr as aq,
5308
- nr as ar,
5309
- ir as as,
5310
- or as at,
5311
- lr as au,
5312
- Cr as av,
5313
- Rs as aw,
5314
- Tr as ax,
5315
- Ts as ay,
5316
- rn as az,
5317
- Qs as b,
5318
- Wr as c,
5319
- bn as d,
5320
- ea as e,
5321
- en as f,
5322
- ot as g,
5323
- Qr as h,
5324
- we as i,
5325
- ta as j,
5326
- ra as k,
5327
- na as l,
5328
- fa as m,
5329
- He as n,
5330
- Qa as o,
5331
- tn as p,
5332
- Ya as q,
5306
+ Gt as ac,
5307
+ Wt as ad,
5308
+ Xt as ae,
5309
+ Kt as af,
5310
+ Ss as ag,
5311
+ Jt as ah,
5312
+ Qt as ai,
5313
+ Yt as aj,
5314
+ er as ak,
5315
+ tr as al,
5316
+ rr as am,
5317
+ Cs as an,
5318
+ ar as ao,
5319
+ sr as ap,
5320
+ nr as aq,
5321
+ ir as ar,
5322
+ or as as,
5323
+ lr as at,
5324
+ cr as au,
5325
+ Rr as av,
5326
+ Ls as aw,
5327
+ _r as ax,
5328
+ _s as ay,
5329
+ nn as az,
5330
+ tn as b,
5331
+ Xr as c,
5332
+ wn as d,
5333
+ ta as e,
5334
+ an as f,
5335
+ ct as g,
5336
+ Yr as h,
5337
+ ae as i,
5338
+ ra as j,
5339
+ aa as k,
5340
+ ia as l,
5341
+ ha as m,
5342
+ ge as n,
5343
+ Ya as o,
5344
+ sn as p,
5345
+ es as q,
5333
5346
  qe as r,
5334
- bt as s,
5335
- as as t,
5336
- es as u,
5337
- rs as v,
5347
+ vt as s,
5348
+ ss as t,
5349
+ ts as u,
5350
+ as as v,
5338
5351
  Ze as w,
5339
- os as x,
5340
- ls as y,
5341
- ns as z
5352
+ ls as x,
5353
+ cs as y,
5354
+ is as z
5342
5355
  };