artifactuse 0.3.2 → 0.4.0

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,6 +1,6 @@
1
- var Dr = Object.defineProperty;
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 I = (e, t, r) => qr(e, typeof t != "symbol" ? t + "" : t, r);
1
+ var qr = Object.defineProperty;
2
+ var Zr = (e, t, r) => t in e ? qr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var I = (e, t, r) => Zr(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  function ae() {
5
5
  return typeof window < "u" && window.Prism;
6
6
  }
@@ -13,11 +13,11 @@ function pr(e) {
13
13
  if (!t) return;
14
14
  t.querySelectorAll("pre code").forEach((a) => {
15
15
  if (a.classList.contains("prism-highlighted")) return;
16
- const s = Zr(a);
16
+ const s = Or(a);
17
17
  s && (a.className.includes(`language-${s}`) || a.classList.add(`language-${s}`), window.Prism.highlightElement(a), a.classList.add("prism-highlighted"));
18
18
  });
19
19
  }
20
- function Qs(e, t) {
20
+ function en(e, t) {
21
21
  ae() && (t && !e.className.includes(`language-${t}`) && e.classList.add(`language-${t}`), window.Prism.highlightElement(e), e.classList.add("prism-highlighted"));
22
22
  }
23
23
  function ot(e, t) {
@@ -25,7 +25,7 @@ function ot(e, t) {
25
25
  const r = window.Prism.languages[t];
26
26
  return r ? window.Prism.highlight(e, r, t) : lt(e);
27
27
  }
28
- function Zr(e) {
28
+ function Or(e) {
29
29
  const t = e.className.split(/\s+/);
30
30
  for (const s of t) {
31
31
  const n = s.match(/^(?:language-|lang-)(.+)$/);
@@ -73,7 +73,7 @@ function ge(e) {
73
73
  function lt(e) {
74
74
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
75
75
  }
76
- function Ys(e) {
76
+ function tn(e) {
77
77
  if (!ae())
78
78
  return console.warn("Artifactuse: Prism.js not found. Auto-highlighting disabled."), null;
79
79
  const t = new MutationObserver((r) => {
@@ -93,7 +93,7 @@ function Ys(e) {
93
93
  subtree: !0
94
94
  }), t;
95
95
  }
96
- function en() {
96
+ function rn() {
97
97
  return ae() ? Object.keys(window.Prism.languages).filter(
98
98
  (e) => typeof window.Prism.languages[e] == "object"
99
99
  ) : [];
@@ -102,7 +102,7 @@ const Pe = {
102
102
  CODE: "code",
103
103
  FORM: "form",
104
104
  SOCIAL: "social"
105
- }, Or = [
105
+ }, Br = [
106
106
  // Code languages
107
107
  "html",
108
108
  "htm",
@@ -131,7 +131,7 @@ const Pe = {
131
131
  // Structured artifacts
132
132
  "form",
133
133
  "social"
134
- ], Br = [
134
+ ], Fr = [
135
135
  // Visual editors (always panel)
136
136
  "video",
137
137
  "videoeditor",
@@ -156,17 +156,49 @@ const Pe = {
156
156
  "html",
157
157
  "htm",
158
158
  // Structured artifacts (form can be panel based on complexity)
159
- "form"
160
- ];
161
- function Fr(e = "artifact") {
159
+ "form",
160
+ // Binary workspace files
161
+ "image",
162
+ "audio",
163
+ "pdf",
164
+ "font",
165
+ "binary"
166
+ ], fr = {
167
+ png: "image",
168
+ jpg: "image",
169
+ jpeg: "image",
170
+ gif: "image",
171
+ webp: "image",
172
+ ico: "image",
173
+ bmp: "image",
174
+ tiff: "image",
175
+ tif: "image",
176
+ svg: "image",
177
+ mp3: "audio",
178
+ wav: "audio",
179
+ ogg: "audio",
180
+ flac: "audio",
181
+ aac: "audio",
182
+ mp4: "video",
183
+ m4a: "video",
184
+ webm: "video",
185
+ pdf: "pdf",
186
+ woff: "font",
187
+ woff2: "font",
188
+ ttf: "font",
189
+ eot: "font",
190
+ otf: "font",
191
+ bin: "binary"
192
+ };
193
+ function Nr(e = "artifact") {
162
194
  return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
163
195
  }
164
- function fr(e) {
165
- return Or.includes(e == null ? void 0 : e.toLowerCase());
166
- }
167
- function Nr(e) {
196
+ function hr(e) {
168
197
  return Br.includes(e == null ? void 0 : e.toLowerCase());
169
198
  }
199
+ function Ur(e) {
200
+ return Fr.includes(e == null ? void 0 : e.toLowerCase());
201
+ }
170
202
  function ct(e) {
171
203
  return {
172
204
  // Code languages
@@ -226,6 +258,12 @@ function ct(e) {
226
258
  // Structured artifacts
227
259
  form: "Form",
228
260
  social: "Social Preview",
261
+ // Binary workspace file types
262
+ image: "Image",
263
+ audio: "Audio",
264
+ pdf: "PDF",
265
+ font: "Font",
266
+ binary: "Binary",
229
267
  txt: "Plain Text",
230
268
  plaintext: "Plain Text",
231
269
  text: "Plain Text",
@@ -263,7 +301,7 @@ function ct(e) {
263
301
  v: "V"
264
302
  }[e == null ? void 0 : e.toLowerCase()] || (e == null ? void 0 : e.toUpperCase()) || "Code";
265
303
  }
266
- function tn(e) {
304
+ function an(e) {
267
305
  const t = {
268
306
  html: "html",
269
307
  htm: "html",
@@ -343,8 +381,8 @@ function tn(e) {
343
381
  }, r = e == null ? void 0 : e.toLowerCase();
344
382
  return t[r] || r || "txt";
345
383
  }
346
- function Ur(e) {
347
- return {
384
+ function Gr(e) {
385
+ const t = {
348
386
  html: "html",
349
387
  htm: "html",
350
388
  css: "css",
@@ -403,9 +441,10 @@ function Ur(e) {
403
441
  zig: "zig",
404
442
  nim: "nim",
405
443
  v: "v"
406
- }[e == null ? void 0 : e.toLowerCase()] || null;
444
+ }, r = e == null ? void 0 : e.toLowerCase();
445
+ return t[r] || fr[r] || null;
407
446
  }
408
- function rn(e) {
447
+ function sn(e) {
409
448
  return {
410
449
  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"/>',
411
450
  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"/>',
@@ -497,26 +536,32 @@ function rn(e) {
497
536
  zig: '<path d="M2 6h7l-5 12h7l5-12h7l-5 12h7" fill="none" stroke="currentColor" stroke-width="1.5"/>',
498
537
  nim: '<path d="M12 2l3 5h5l-3 5 3 5h-5l-3 5-3-5H4l3-5-3-5h5l3-5z" fill="none" stroke="currentColor" stroke-width="1.2"/>',
499
538
  v: '<path d="M4 4l8 16 8-16" fill="none" stroke="currentColor" stroke-width="2"/>',
539
+ // Binary workspace file types
540
+ image: '<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/>',
541
+ audio: '<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>',
542
+ pdf: '<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"/><path d="M10 11h4M10 14h4M10 17h2"/>',
543
+ font: '<path d="M4 7V4h16v3M9 20h6M12 4v16"/>',
544
+ binary: '<path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/><path d="M7 8v8M10 8v8M14 8h2v3h-2v2h2v3h-2M7.5 12h3"/>',
500
545
  // Text/document icon
501
546
  txt: '<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"/>',
502
547
  plaintext: '<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"/>',
503
548
  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"/>'
504
549
  }[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"/>';
505
550
  }
506
- function an(e) {
551
+ function nn(e) {
507
552
  if (e === 0) return "0 Bytes";
508
553
  const t = 1024, r = ["Bytes", "KB", "MB", "GB"], a = Math.floor(Math.log(e) / Math.log(t));
509
554
  return parseFloat((e / Math.pow(t, a)).toFixed(2)) + " " + r[a];
510
555
  }
511
- function hr(e) {
556
+ function gr(e) {
512
557
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&").replace(/&#10;/g, `
513
558
  `).replace(/&#13;/g, "\r").replace(/&#9;/g, " ").replace(/&nbsp;/g, " ");
514
559
  }
515
- function Gr(e) {
560
+ function Wr(e) {
516
561
  const t = JSON.stringify(e);
517
562
  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;");
518
563
  }
519
- function Wr(e, t) {
564
+ function Xr(e, t) {
520
565
  const r = t == null ? void 0 : t.toLowerCase();
521
566
  if (r === "smartdiff")
522
567
  try {
@@ -554,7 +599,7 @@ function Wr(e, t) {
554
599
  const u = e.match(/<title>([^<]+)<\/title>/i);
555
600
  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`;
556
601
  }
557
- function Xr(e, t) {
602
+ function Kr(e, t) {
558
603
  const r = (e || "").split(`
559
604
  `), a = (t || "").split(`
560
605
  `), s = [], n = Math.max(r.length, a.length);
@@ -565,7 +610,7 @@ function Xr(e, t) {
565
610
  return s.join(`
566
611
  `);
567
612
  }
568
- function Kr(e, t, r, a) {
613
+ function Jr(e, t, r, a) {
569
614
  const s = a.maxLines || 15;
570
615
  function n(v, x) {
571
616
  if (x) return !1;
@@ -581,7 +626,7 @@ function Kr(e, t, r, a) {
581
626
  }
582
627
  if (r === "smartdiff")
583
628
  try {
584
- const v = JSON.parse(t), M = Xr(v.oldCode, v.newCode).split(`
629
+ const v = JSON.parse(t), M = Kr(v.oldCode, v.newCode).split(`
585
630
  `), A = M.slice(0, s), S = A.map((B) => B[0] || " "), L = A.map((B) => B.slice(1)), $ = v.language || "plaintext", k = ge($), z = ot(L.join(`
586
631
  `), k), j = ae() && window.Prism.languages[k], P = M.length > s, T = n(M.length, P), N = T ? " artifactuse-inline-preview--static" : "", X = T ? ' data-non-clickable="true"' : "", O = o("smartdiff", M.length);
587
632
  return `<div class="artifactuse-inline-preview${P ? " 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>` + (P ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${O}</span></div>` : "") + "</div>";
@@ -593,20 +638,20 @@ function Kr(e, t, r, a) {
593
638
  `), 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);
594
639
  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>";
595
640
  }
596
- function Jr(e, t = "panel") {
597
- const r = Gr(e);
641
+ function Qr(e, t = "panel") {
642
+ const r = Wr(e);
598
643
  return `<div class="${`artifactuse-placeholder artifactuse-${t}`}" data-artifact-id="${e.id}" data-artifact-type="${e.type}" data-artifact="${r}"></div>`;
599
644
  }
600
- function gr(e) {
645
+ function mr(e) {
601
646
  try {
602
647
  return JSON.parse(e);
603
648
  } catch {
604
649
  return null;
605
650
  }
606
651
  }
607
- function Qr(e) {
652
+ function Yr(e) {
608
653
  var s;
609
- const t = gr(e);
654
+ const t = mr(e);
610
655
  if (!t || t.display === "inline") return !0;
611
656
  if (t.display === "panel" || t.variant === "wizard") return !1;
612
657
  if (t.variant === "buttons") return !0;
@@ -615,39 +660,39 @@ function Qr(e) {
615
660
  const a = ["multiselect", "rating", "color", "range"];
616
661
  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));
617
662
  }
618
- function Yr(e, t) {
663
+ function ea(e, t) {
619
664
  const r = e == null ? void 0 : e.toLowerCase();
620
- return r === "social" ? !0 : r === "form" ? Qr(t) : !1;
665
+ return r === "social" ? !0 : r === "form" ? Yr(t) : !1;
621
666
  }
622
- function ea(e) {
667
+ function ta(e) {
623
668
  const t = e == null ? void 0 : e.toLowerCase();
624
669
  return t === "form" ? Pe.FORM : t === "social" ? Pe.SOCIAL : Pe.CODE;
625
670
  }
626
671
  function $e(e, t, r, a) {
627
- const s = t == null ? void 0 : t.toLowerCase(), n = ea(s), o = Yr(s, e);
672
+ const s = t == null ? void 0 : t.toLowerCase(), n = ta(s), o = ea(s, e);
628
673
  return {
629
674
  id: `${r}-${n}-${a}`,
630
675
  messageId: r,
631
676
  type: n,
632
677
  language: s,
633
- title: Wr(e, s),
678
+ title: Xr(e, s),
634
679
  code: e,
635
680
  isInline: o,
636
- isPreviewable: fr(s),
637
- isPanelArtifact: Nr(s),
681
+ isPreviewable: hr(s),
682
+ isPanelArtifact: Ur(s),
638
683
  size: e.length,
639
684
  lineCount: e.split(`
640
685
  `).length,
641
686
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
642
687
  };
643
688
  }
644
- function sn(e, t) {
689
+ function on(e, t) {
645
690
  const r = [], a = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
646
691
  let s, n = 0;
647
692
  for (; (s = a.exec(e)) !== null; ) {
648
- const o = s[1], i = hr(s[2]);
693
+ const o = s[1], i = gr(s[2]);
649
694
  let u = o.toLowerCase();
650
- 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)) {
695
+ if ((["xml", "markup", "html", "htm"].includes(u) || !u) && (i.trim().startsWith("<svg") || i.includes("<svg ") || i.includes("<svg>")) && (u = "svg"), (u === "form" || u === "social") && !mr(i)) {
651
696
  r.push($e(i, "json", t, n)), n++;
652
697
  continue;
653
698
  }
@@ -655,7 +700,7 @@ function sn(e, t) {
655
700
  }
656
701
  return r;
657
702
  }
658
- function ta(e, t, r = {}) {
703
+ function ra(e, t, r = {}) {
659
704
  const {
660
705
  minLines: a = 3,
661
706
  minLength: s = 50,
@@ -674,19 +719,19 @@ function ta(e, t, r = {}) {
674
719
  const w = [], c = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
675
720
  let h = 0;
676
721
  const f = e.replace(c, (g, m, b) => {
677
- const v = hr(b).trim(), x = v.split(`
722
+ const v = gr(b).trim(), x = v.split(`
678
723
  `).length;
679
724
  let M = m.toLowerCase();
680
725
  if ((["xml", "markup", "html", "htm"].includes(M) || !M) && v.trim().startsWith("<svg") && (M = "svg"), p(M))
681
726
  return h++, g;
682
- const A = fr(M);
727
+ const A = hr(M);
683
728
  let S = !1;
684
729
  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) {
685
730
  const L = $e(v, M, t, h);
686
731
  if (u && (L.tabs = u), l && (L.viewMode = l), h++, w.push(L), d(M))
687
- return Kr(L, v, M, o);
732
+ return Jr(L, v, M, o);
688
733
  let $ = "panel";
689
- return L.isInline && ($ = L.type === "social" ? "inline-social" : "inline-form"), Jr(L, $);
734
+ return L.isInline && ($ = L.type === "social" ? "inline-social" : "inline-form"), Qr(L, $);
690
735
  }
691
736
  return h++, g;
692
737
  });
@@ -695,7 +740,7 @@ function ta(e, t, r = {}) {
695
740
  html: f
696
741
  };
697
742
  }
698
- function ra() {
743
+ function aa() {
699
744
  let e = {
700
745
  artifacts: [],
701
746
  activeArtifactId: null,
@@ -933,7 +978,7 @@ function ut(e) {
933
978
  return null;
934
979
  }
935
980
  }
936
- function aa(e = []) {
981
+ function sa(e = []) {
937
982
  const t = Array.isArray(e) ? e : [e].filter(Boolean), r = new Set(t), a = /* @__PURE__ */ new Map();
938
983
  let s = null, n = !1, o = !1;
939
984
  const i = [];
@@ -964,14 +1009,14 @@ function aa(e = []) {
964
1009
  (a.get(j) || []).forEach((E) => {
965
1010
  try {
966
1011
  E(P, T);
967
- } catch (R) {
968
- console.error(`Artifactuse bridge handler error (${j}):`, R);
1012
+ } catch (C) {
1013
+ console.error(`Artifactuse bridge handler error (${j}):`, C);
969
1014
  }
970
1015
  }), (a.get("*") || []).forEach((E) => {
971
1016
  try {
972
1017
  E({ action: j, data: P, requestId: T });
973
- } catch (R) {
974
- console.error("Artifactuse bridge wildcard handler error:", R);
1018
+ } catch (C) {
1019
+ console.error("Artifactuse bridge wildcard handler error:", C);
975
1020
  }
976
1021
  });
977
1022
  }
@@ -1076,7 +1121,7 @@ function aa(e = []) {
1076
1121
  function dt() {
1077
1122
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
1078
1123
  }
1079
- function sa(e) {
1124
+ function na(e) {
1080
1125
  if (!e) return null;
1081
1126
  if (typeof e == "string" && e.includes(","))
1082
1127
  return e.trim();
@@ -1086,8 +1131,8 @@ function sa(e) {
1086
1131
  const r = parseInt(t.slice(0, 2), 16), a = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16);
1087
1132
  return `${r}, ${a}, ${s}`;
1088
1133
  }
1089
- function na(e) {
1090
- return e ? sa(e) : null;
1134
+ function ia(e) {
1135
+ return e ? na(e) : null;
1091
1136
  }
1092
1137
  function ye(e) {
1093
1138
  if (!e || typeof e != "object") return {};
@@ -1096,7 +1141,7 @@ function ye(e) {
1096
1141
  if (r === "gradientOpacity" || typeof a == "number")
1097
1142
  t[r] = a;
1098
1143
  else {
1099
- const s = na(a);
1144
+ const s = ia(a);
1100
1145
  s && (t[r] = s);
1101
1146
  }
1102
1147
  return t;
@@ -1171,7 +1216,7 @@ const pt = {
1171
1216
  gradientOpacity: "0.25"
1172
1217
  }
1173
1218
  };
1174
- function ia(e = "auto", t = {}) {
1219
+ function oa(e = "auto", t = {}) {
1175
1220
  let r = e, a = {
1176
1221
  dark: { ...pt.dark },
1177
1222
  light: { ...pt.light }
@@ -1267,7 +1312,7 @@ function ia(e = "auto", t = {}) {
1267
1312
  function ce(e) {
1268
1313
  return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1269
1314
  }
1270
- const Xe = "artifactuse_auth", mr = "https://app.artifactuse.com", we = "https://api.artifactuse.com";
1315
+ const Xe = "artifactuse_auth", wr = "https://app.artifactuse.com", we = "https://api.artifactuse.com";
1271
1316
  function Te() {
1272
1317
  if (typeof window > "u" || !window.localStorage)
1273
1318
  return null;
@@ -1278,14 +1323,14 @@ function Te() {
1278
1323
  return null;
1279
1324
  }
1280
1325
  }
1281
- function oa(e) {
1326
+ function la(e) {
1282
1327
  if (!(typeof window > "u" || !window.localStorage))
1283
1328
  try {
1284
1329
  localStorage.setItem(Xe, JSON.stringify(e));
1285
1330
  } catch {
1286
1331
  }
1287
1332
  }
1288
- async function la(e, t = {}) {
1333
+ async function ca(e, t = {}) {
1289
1334
  const { apiUrl: r = we } = t, a = await fetch(`${r}/v1/project/share`, {
1290
1335
  method: "POST",
1291
1336
  headers: {
@@ -1303,7 +1348,7 @@ async function la(e, t = {}) {
1303
1348
  }
1304
1349
  return a.json();
1305
1350
  }
1306
- async function ca(e, t = {}) {
1351
+ async function ua(e, t = {}) {
1307
1352
  const { apiUrl: r = we, getStoredAuthData: a = Te } = t, s = a();
1308
1353
  if (!(s != null && s.token))
1309
1354
  throw new Error("Authentication required. Please sign in first.");
@@ -1325,10 +1370,10 @@ async function ca(e, t = {}) {
1325
1370
  }
1326
1371
  return n.json();
1327
1372
  }
1328
- function ua(e = {}) {
1373
+ function da(e = {}) {
1329
1374
  const {
1330
- appUrl: t = mr,
1331
- setStoredAuthData: r = oa,
1375
+ appUrl: t = wr,
1376
+ setStoredAuthData: r = la,
1332
1377
  getStoredAuthData: a = Te
1333
1378
  } = e;
1334
1379
  return new Promise((s, n) => {
@@ -1359,7 +1404,7 @@ function ua(e = {}) {
1359
1404
  }, 500);
1360
1405
  });
1361
1406
  }
1362
- async function da(e = {}) {
1407
+ async function pa(e = {}) {
1363
1408
  const { apiUrl: t = we, language: r, getStoredAuthData: a = Te } = e, s = a();
1364
1409
  if (!(s != null && s.token))
1365
1410
  throw new Error("Authentication required. Please sign in first.");
@@ -1378,7 +1423,7 @@ async function da(e = {}) {
1378
1423
  }
1379
1424
  return o.json();
1380
1425
  }
1381
- async function pa(e, t, r = {}) {
1426
+ async function fa(e, t, r = {}) {
1382
1427
  const { apiUrl: a = we, getStoredAuthData: s = Te } = r, n = s();
1383
1428
  if (!(n != null && n.token))
1384
1429
  throw new Error("Authentication required. Please sign in first.");
@@ -1400,10 +1445,10 @@ async function pa(e, t, r = {}) {
1400
1445
  }
1401
1446
  return o.json();
1402
1447
  }
1403
- function fa(e = {}) {
1448
+ function ha(e = {}) {
1404
1449
  const {
1405
1450
  apiUrl: t = we,
1406
- appUrl: r = mr,
1451
+ appUrl: r = wr,
1407
1452
  storageKey: a = Xe,
1408
1453
  enabled: s = !0,
1409
1454
  allowAnonymous: n = !0,
@@ -1452,14 +1497,14 @@ function fa(e = {}) {
1452
1497
  clearStoredAuthData: l,
1453
1498
  signOut: l,
1454
1499
  // API methods
1455
- share: (d) => la(d, { apiUrl: t }),
1456
- save: (d) => ca(d, { apiUrl: t, getStoredAuthData: i }),
1457
- listArtifacts: (d) => da({ apiUrl: t, language: d, getStoredAuthData: i }),
1458
- updateArtifact: (d, p) => pa(d, p, { apiUrl: t, getStoredAuthData: i }),
1459
- openAuthPopup: () => ua({ appUrl: r, setStoredAuthData: u, getStoredAuthData: i })
1500
+ share: (d) => ca(d, { apiUrl: t }),
1501
+ save: (d) => ua(d, { apiUrl: t, getStoredAuthData: i }),
1502
+ listArtifacts: (d) => pa({ apiUrl: t, language: d, getStoredAuthData: i }),
1503
+ updateArtifact: (d, p) => fa(d, p, { apiUrl: t, getStoredAuthData: i }),
1504
+ openAuthPopup: () => da({ appUrl: r, setStoredAuthData: u, getStoredAuthData: i })
1460
1505
  };
1461
1506
  }
1462
- function ha(e = {}) {
1507
+ function ga(e = {}) {
1463
1508
  const t = e.modules || null;
1464
1509
  let r = e.theme || "dark";
1465
1510
  function a() {
@@ -1737,8 +1782,8 @@ function ha(e = {}) {
1737
1782
  } = t.language, {
1738
1783
  closeBrackets: y,
1739
1784
  closeBracketsKeymap: E,
1740
- autocompletion: R,
1741
- completionKeymap: C
1785
+ autocompletion: C,
1786
+ completionKeymap: R
1742
1787
  } = 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 = [
1743
1788
  m(),
1744
1789
  b(),
@@ -1755,7 +1800,7 @@ function ha(e = {}) {
1755
1800
  ...D ? [T(o(B, D, _))] : [],
1756
1801
  N(),
1757
1802
  y(),
1758
- R(),
1803
+ C(),
1759
1804
  A(),
1760
1805
  S(),
1761
1806
  L(),
@@ -1764,7 +1809,7 @@ function ha(e = {}) {
1764
1809
  ...$,
1765
1810
  ...z,
1766
1811
  ...O,
1767
- ...C,
1812
+ ...R,
1768
1813
  j
1769
1814
  ]),
1770
1815
  u(c.language),
@@ -1811,7 +1856,7 @@ function Ke() {
1811
1856
  return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
1812
1857
  }
1813
1858
  var ie = Ke();
1814
- function wr(e) {
1859
+ function br(e) {
1815
1860
  ie = e;
1816
1861
  }
1817
1862
  var me = { exec: () => null };
@@ -1822,14 +1867,14 @@ function H(e, t = "") {
1822
1867
  }, getRegex: () => new RegExp(r, t) };
1823
1868
  return a;
1824
1869
  }
1825
- var ga = (() => {
1870
+ var ma = (() => {
1826
1871
  try {
1827
1872
  return !!new RegExp("(?<=1)(?<!1)");
1828
1873
  } catch {
1829
1874
  return !1;
1830
1875
  }
1831
- })(), 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} *[^
1832
- ]`).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];
1876
+ })(), 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") }, wa = /^(?:[ \t]*(?:\n|$))+/, ba = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, va = /^ {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+|$)/, ya = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, vr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, yr = H(vr).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(), ka = H(vr).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]+)*)/, xa = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Ma = H(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), $a = 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]*?(?:-->|$))/, Aa = 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(), kr = 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(), za = H(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", kr).getRegex(), tt = { blockquote: za, code: ba, def: Ma, fences: va, heading: ya, hr: be, html: Aa, lheading: yr, list: $a, newline: wa, paragraph: kr, table: me, text: xa }, 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(), Sa = { ...tt, lheading: ka, 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() }, Ca = { ...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} *[^
1877
+ ]`).replace("lheading", yr).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ra = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, La = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, xr = /^( {2,}|\\)\n(?!\s*$)/, Ta = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ee = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, Mr = /[^\s\p{P}\p{S}]/u, _a = H(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), $r = /(?!~)[\p{P}\p{S}]/u, Ea = /(?!~)[\s\p{P}\p{S}]/u, Pa = /(?:[^\s\p{P}\p{S}]|~)/u, ja = H(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ma ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Ar = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Ha = H(Ar, "u").replace(/punct/g, Ee).getRegex(), Va = H(Ar, "u").replace(/punct/g, $r).getRegex(), zr = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ia = H(zr, "gu").replace(/notPunctSpace/g, Mr).replace(/punctSpace/g, rt).replace(/punct/g, Ee).getRegex(), Da = H(zr, "gu").replace(/notPunctSpace/g, Pa).replace(/punctSpace/g, Ea).replace(/punct/g, $r).getRegex(), qa = H("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Mr).replace(/punctSpace/g, rt).replace(/punct/g, Ee).getRegex(), Za = H(/\\(punct)/, "gu").replace(/punct/g, Ee).getRegex(), Oa = 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(), Ba = H(et).replace("(?:-->|$)", "-->").getRegex(), Fa = 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", Ba).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ae = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Na = H(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Ae).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Sr = H(/^!?\[(label)\]\[(ref)\]/).replace("label", Ae).replace("ref", Ye).getRegex(), Cr = H(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Ua = H("reflink|nolink(?!\\()", "g").replace("reflink", Sr).replace("nolink", Cr).getRegex(), ht = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: me, anyPunctuation: Za, autolink: Oa, blockSkip: ja, br: xr, code: La, del: me, emStrongLDelim: Ha, emStrongRDelimAst: Ia, emStrongRDelimUnd: qa, escape: Ra, link: Na, nolink: Cr, punctuation: _a, reflink: Sr, reflinkSearch: Ua, tag: Fa, text: Ta, url: me }, Ga = { ...at, link: H(/^!?\[(label)\]\((.*?)\)/).replace("label", Ae).getRegex(), reflink: H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ae).getRegex() }, Ve = { ...at, emStrongRDelimAst: Da, emStrongLDelim: Va, 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() }, Wa = { ...Ve, br: H(xr).replace("{2,}", "*").getRegex(), text: H(Ve.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ke = { normal: tt, gfm: Sa, pedantic: Ca }, ue = { normal: at, gfm: Ve, breaks: Wa, pedantic: Ga }, Xa = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, gt = (e) => Xa[e];
1833
1878
  function Q(e, t) {
1834
1879
  if (t) {
1835
1880
  if (Z.escapeTest.test(e)) return e.replace(Z.escapeReplace, gt);
@@ -1864,7 +1909,7 @@ function de(e, t, r) {
1864
1909
  s++;
1865
1910
  return e.slice(0, a - s);
1866
1911
  }
1867
- function Xa(e, t) {
1912
+ function Ka(e, t) {
1868
1913
  if (e.indexOf(t[1]) === -1) return -1;
1869
1914
  let r = 0;
1870
1915
  for (let a = 0; a < e.length; a++) if (e[a] === "\\") a++;
@@ -1878,7 +1923,7 @@ function bt(e, t, r, a, s) {
1878
1923
  let u = { type: e[0].charAt(0) === "!" ? "image" : "link", raw: r, href: n, title: o, text: i, tokens: a.inlineTokens(i) };
1879
1924
  return a.state.inLink = !1, u;
1880
1925
  }
1881
- function Ka(e, t, r) {
1926
+ function Ja(e, t, r) {
1882
1927
  let a = e.match(r.other.indentCodeCompensation);
1883
1928
  if (a === null) return t;
1884
1929
  let s = a[1];
@@ -1913,7 +1958,7 @@ var ze = class {
1913
1958
  fences(e) {
1914
1959
  let t = this.rules.block.fences.exec(e);
1915
1960
  if (t) {
1916
- let r = t[0], a = Ka(r, t[3] || "", this.rules);
1961
+ let r = t[0], a = Ja(r, t[3] || "", this.rules);
1917
1962
  return { type: "code", raw: r, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: a };
1918
1963
  }
1919
1964
  }
@@ -2095,7 +2140,7 @@ ${d}` : d;
2095
2140
  let n = de(r.slice(0, -1), "\\");
2096
2141
  if ((r.length - n.length) % 2 === 0) return;
2097
2142
  } else {
2098
- let n = Xa(t[2], "()");
2143
+ let n = Ka(t[2], "()");
2099
2144
  if (n === -2) return;
2100
2145
  if (n > -1) {
2101
2146
  let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + n;
@@ -2724,7 +2769,7 @@ ${e}</tr>
2724
2769
  provideParser() {
2725
2770
  return this.block ? W.parse : W.parseInline;
2726
2771
  }
2727
- }, I(Me, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(Me, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Me), Ja = class {
2772
+ }, I(Me, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(Me, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Me), Qa = class {
2728
2773
  constructor(...e) {
2729
2774
  I(this, "defaults", Ke());
2730
2775
  I(this, "options", this.setOptions);
@@ -2885,17 +2930,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
2885
2930
  throw r;
2886
2931
  };
2887
2932
  }
2888
- }, se = new Ja();
2933
+ }, se = new Qa();
2889
2934
  function V(e, t) {
2890
2935
  return se.parse(e, t);
2891
2936
  }
2892
2937
  V.options = V.setOptions = function(e) {
2893
- return se.setOptions(e), V.defaults = se.defaults, wr(V.defaults), V;
2938
+ return se.setOptions(e), V.defaults = se.defaults, br(V.defaults), V;
2894
2939
  };
2895
2940
  V.getDefaults = Ke;
2896
2941
  V.defaults = ie;
2897
2942
  V.use = function(...e) {
2898
- return se.use(...e), V.defaults = se.defaults, wr(V.defaults), V;
2943
+ return se.use(...e), V.defaults = se.defaults, br(V.defaults), V;
2899
2944
  };
2900
2945
  V.walkTokens = function(e, t) {
2901
2946
  return se.walkTokens(e, t);
@@ -2917,8 +2962,8 @@ V.walkTokens;
2917
2962
  V.parseInline;
2918
2963
  W.parse;
2919
2964
  G.lex;
2920
- const Qa = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
2921
- function Ya(e) {
2965
+ const Ya = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
2966
+ function es(e) {
2922
2967
  const t = [];
2923
2968
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (n) => {
2924
2969
  const o = `__IMG_PROTECTED_${t.length}__`;
@@ -2933,7 +2978,7 @@ function Ya(e) {
2933
2978
  const o = `__IMG_PROTECTED_${t.length}__`;
2934
2979
  return t.push(n), o;
2935
2980
  });
2936
- const r = Qa.join("|"), a = new RegExp(
2981
+ const r = Ya.join("|"), a = new RegExp(
2937
2982
  `<a[^>]*href="(https?:\\/\\/[^"]+\\.(?:${r})(?:\\?[^"]*)?)"[^>]*>([^<]*)<\\/a>`,
2938
2983
  "gi"
2939
2984
  );
@@ -2957,7 +3002,7 @@ function qe(e, t, r) {
2957
3002
  let n = '<div class="artifactuse-image-container">';
2958
3003
  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;
2959
3004
  }
2960
- function es(e) {
3005
+ function ts(e) {
2961
3006
  const t = e.split(`
2962
3007
  `), r = [];
2963
3008
  let a = [], s = !1;
@@ -2997,24 +3042,24 @@ ${e.map((r) => r.replace("artifactuse-image-container", "artifactuse-gallery-ite
2997
3042
  `)}
2998
3043
  </div>`;
2999
3044
  }
3000
- const Cr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
3001
- function ts(e) {
3045
+ const Rr = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
3046
+ function rs(e) {
3002
3047
  if (!e) return !1;
3003
- const t = Cr.join("|");
3048
+ const t = Rr.join("|");
3004
3049
  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));
3005
3050
  }
3006
- function rs(e) {
3051
+ function as(e) {
3007
3052
  if (!e) return null;
3008
3053
  let t = e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);
3009
3054
  if (t) return { type: "youtube", id: t[1] };
3010
3055
  if (t = e.match(/vimeo\.com\/(\d+)/), t) return { type: "vimeo", id: t[1] };
3011
3056
  if (t = e.match(/loom\.com\/share\/([a-zA-Z0-9]+)/), t) return { type: "loom", id: t[1] };
3012
3057
  if (t = e.match(/dailymotion\.com\/video\/([a-zA-Z0-9]+)/), t) return { type: "dailymotion", id: t[1] };
3013
- const r = Cr.join("|");
3058
+ const r = Rr.join("|");
3014
3059
  return new RegExp(`\\.(${r})(\\?.*)?$`, "i").test(e) ? { type: "direct", id: e } : null;
3015
3060
  }
3016
- function as(e) {
3017
- const t = rs(e);
3061
+ function ss(e) {
3062
+ const t = as(e);
3018
3063
  if (!t) return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
3019
3064
  switch (t.type) {
3020
3065
  case "youtube":
@@ -3031,7 +3076,7 @@ function as(e) {
3031
3076
  return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
3032
3077
  }
3033
3078
  }
3034
- function ss(e) {
3079
+ function ns(e) {
3035
3080
  const t = [];
3036
3081
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (c) => {
3037
3082
  const h = `__PROTECTED_${t.length}__`;
@@ -3044,7 +3089,7 @@ function ss(e) {
3044
3089
  return t.push(c), h;
3045
3090
  });
3046
3091
  const r = /\[([^\]]+)\]\((https:\/\/www\.pexels\.com\/video\/[^)]+)\)\s*(?:<\/p>)?\s*(?:<p>)?\s*(?:Preview image:\s*)?!\[([^\]]*)\]\((https:\/\/images\.pexels\.com\/videos\/[^)]+)\)/gi;
3047
- e = e.replace(r, (c, h, f, g, m) => is(h, f, m, g));
3092
+ e = e.replace(r, (c, h, f, g, m) => os(h, f, m, g));
3048
3093
  const a = /<a[^>]*href="(https?:\/\/[^"]+\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3049
3094
  e = e.replace(a, (c, h) => Ze(h));
3050
3095
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
@@ -3069,7 +3114,7 @@ function ss(e) {
3069
3114
  e = e.replace(`__PROTECTED_${c}__`, t[c]);
3070
3115
  return e;
3071
3116
  }
3072
- function ns(e) {
3117
+ function is(e) {
3073
3118
  const t = e.split("?")[0].split(".").pop().toLowerCase();
3074
3119
  return {
3075
3120
  mp4: "video/mp4",
@@ -3083,10 +3128,10 @@ function ns(e) {
3083
3128
  }[t] || "video/mp4";
3084
3129
  }
3085
3130
  function Ze(e) {
3086
- const t = ns(e);
3131
+ const t = is(e);
3087
3132
  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>`;
3088
3133
  }
3089
- function is(e, t, r, a) {
3134
+ function os(e, t, r, a) {
3090
3135
  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>`;
3091
3136
  }
3092
3137
  function Oe(e) {
@@ -3105,7 +3150,7 @@ function Ne(e) {
3105
3150
  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>'`;
3106
3151
  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>`;
3107
3152
  }
3108
- function os(e) {
3153
+ function ls(e) {
3109
3154
  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();
3110
3155
  return /<(?!\/)[^>]+>/.test(t) ? !1 : t.length < 200;
3111
3156
  }
@@ -3123,7 +3168,7 @@ function je(e) {
3123
3168
  }
3124
3169
  return "";
3125
3170
  }
3126
- function ls(e) {
3171
+ function cs(e) {
3127
3172
  const t = /<div class="artifactuse-video-(wrapper|preview-container)/g, r = [];
3128
3173
  let a;
3129
3174
  for (; (a = t.exec(e)) !== null; ) {
@@ -3151,7 +3196,7 @@ function ls(e) {
3151
3196
  }];
3152
3197
  for (let u = 1; u < r.length; u++) {
3153
3198
  const l = r[u - 1], d = r[u], p = e.substring(l.end, d.start);
3154
- os(p) ? n.push({
3199
+ ls(p) ? n.push({
3155
3200
  ...d,
3156
3201
  caption: je(p)
3157
3202
  }) : (s.push([...n]), n = [{
@@ -3167,7 +3212,7 @@ function ls(e) {
3167
3212
  let d = l.start;
3168
3213
  const w = e.substring(i, l.start).match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
3169
3214
  if (w && (d = l.start - w[0].length, u[0].caption = w[1].trim()), o += e.substring(i, d), u.length >= 2)
3170
- o += cs(u);
3215
+ o += us(u);
3171
3216
  else {
3172
3217
  const c = u[0];
3173
3218
  c.caption ? o += `<div class="artifactuse-video-container">${c.html}<div class="artifactuse-video-caption">${c.caption}</div></div>` : o += c.html;
@@ -3176,7 +3221,7 @@ function ls(e) {
3176
3221
  }
3177
3222
  return o += e.substring(i), o = o.replace(/<p>\s*<\/p>/g, ""), o;
3178
3223
  }
3179
- function cs(e) {
3224
+ function us(e) {
3180
3225
  return `<div class="artifactuse-video-gallery">
3181
3226
  ${e.map(({ html: r, caption: a }) => {
3182
3227
  let s = r.replace(
@@ -3191,10 +3236,10 @@ ${e.map(({ html: r, caption: a }) => {
3191
3236
  `)}
3192
3237
  </div>`;
3193
3238
  }
3194
- function us() {
3239
+ function ds() {
3195
3240
  return `audio-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3196
3241
  }
3197
- function ds(e, t = {}) {
3242
+ function ps(e, t = {}) {
3198
3243
  const r = t.theme || "dark", a = [];
3199
3244
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (A) => {
3200
3245
  const S = `__PROTECTED_${a.length}__`;
@@ -3246,7 +3291,7 @@ function ds(e, t = {}) {
3246
3291
  e = e.replace(`__PROTECTED_${A}__`, a[A]);
3247
3292
  return e;
3248
3293
  }
3249
- function ps(e) {
3294
+ function fs(e) {
3250
3295
  const t = e.match(/\.([a-zA-Z0-9]+)(?:\?|$)/);
3251
3296
  return t ? t[1].toUpperCase() : "AUDIO";
3252
3297
  }
@@ -3254,7 +3299,7 @@ function pe(e) {
3254
3299
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
3255
3300
  }
3256
3301
  function yt(e) {
3257
- const t = us(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = ps(e);
3302
+ const t = ds(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = fs(e);
3258
3303
  return `
3259
3304
  <div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${pe(e)}">
3260
3305
  <!-- Hidden audio element -->
@@ -3395,12 +3440,12 @@ function xt(e, t, r) {
3395
3440
  `;
3396
3441
  }
3397
3442
  const ne = /* @__PURE__ */ new Map(), He = [0.5, 0.75, 1, 1.25, 1.5, 2];
3398
- function fs(e = document) {
3443
+ function hs(e = document) {
3399
3444
  e.querySelectorAll(".artifactuse-audio-player:not([data-initialized])").forEach((r) => {
3400
- hs(r);
3445
+ gs(r);
3401
3446
  });
3402
3447
  }
3403
- function hs(e) {
3448
+ function gs(e) {
3404
3449
  const t = e.dataset.playerId, r = e.dataset.audioSrc;
3405
3450
  if (!t || !r) return;
3406
3451
  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");
@@ -3414,7 +3459,7 @@ function hs(e) {
3414
3459
  currentTime: 0,
3415
3460
  waveformData: null
3416
3461
  };
3417
- ne.set(t, { playerEl: e, audio: a, state: b }), gs(d, t), s == null || s.addEventListener("click", () => {
3462
+ ne.set(t, { playerEl: e, audio: a, state: b }), ms(d, t), s == null || s.addEventListener("click", () => {
3418
3463
  b.isPlaying ? St(t) : zt(t);
3419
3464
  }), a.addEventListener("loadedmetadata", () => {
3420
3465
  b.duration = a.duration, u.textContent = At(a.duration);
@@ -3425,7 +3470,7 @@ function hs(e) {
3425
3470
  }), a.addEventListener("ended", () => {
3426
3471
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing"), p.style.width = "0%";
3427
3472
  }), a.addEventListener("play", () => {
3428
- b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), ms(t);
3473
+ b.isPlaying = !0, n.style.display = "none", o.style.display = "", e.classList.add("is-playing"), ws(t);
3429
3474
  }), a.addEventListener("pause", () => {
3430
3475
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing");
3431
3476
  }), l == null || l.addEventListener("click", (v) => {
@@ -3468,7 +3513,7 @@ function hs(e) {
3468
3513
  }
3469
3514
  }), e.setAttribute("data-initialized", "true"), e.setAttribute("tabindex", "0");
3470
3515
  }
3471
- function gs(e, t) {
3516
+ function ms(e, t) {
3472
3517
  if (!e) return;
3473
3518
  const r = e.getContext("2d"), a = window.devicePixelRatio || 1, s = e.parentElement.getBoundingClientRect();
3474
3519
  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);
@@ -3518,21 +3563,21 @@ function St(e) {
3518
3563
  const t = ne.get(e);
3519
3564
  t && t.audio.pause();
3520
3565
  }
3521
- function ms(e) {
3566
+ function ws(e) {
3522
3567
  ne.forEach((t, r) => {
3523
3568
  r !== e && t.state.isPlaying && t.audio.pause();
3524
3569
  });
3525
3570
  }
3526
- function ws(e) {
3571
+ function bs(e) {
3527
3572
  const t = ne.get(e);
3528
3573
  t && (t.audio.pause(), t.audio.src = "", ne.delete(e));
3529
3574
  }
3530
- function bs() {
3575
+ function vs() {
3531
3576
  ne.forEach((e, t) => {
3532
- ws(t);
3577
+ bs(t);
3533
3578
  });
3534
3579
  }
3535
- function vs(e) {
3580
+ function ys(e) {
3536
3581
  const t = [];
3537
3582
  e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (g) => {
3538
3583
  const m = `__PROTECTED_MAP_${t.length}__`;
@@ -3676,7 +3721,7 @@ function Rt(e, t, r = 15) {
3676
3721
  </div>
3677
3722
  `;
3678
3723
  }
3679
- function ys(e, t = {}) {
3724
+ function ks(e, t = {}) {
3680
3725
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3681
3726
  e = e.replace(a, (v, x, M, A) => Lt(M, A, r));
3682
3727
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:twitter\\.com|x\\.com)\\/([a-zA-Z0-9_]+)\\/status\\/(\\d+))(?!["'])`, "gi");
@@ -3818,7 +3863,7 @@ function Vt(e) {
3818
3863
  </div>
3819
3864
  `;
3820
3865
  }
3821
- function ks(e) {
3866
+ function xs(e) {
3822
3867
  const t = /<a[^>]*href="(https?:\/\/[^"]+\.pdf(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3823
3868
  e = e.replace(t, (a, s) => It(s));
3824
3869
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.pdf(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
@@ -3848,7 +3893,7 @@ function It(e) {
3848
3893
  </div>
3849
3894
  `;
3850
3895
  }
3851
- function xs(e) {
3896
+ function Ms(e) {
3852
3897
  const t = /<a[^>]*href="(https?:\/\/docs\.google\.com\/document\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3853
3898
  e = e.replace(t, (l, d, p) => oe(p, "document"));
3854
3899
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/document\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
@@ -3908,7 +3953,7 @@ function Dt(e) {
3908
3953
  </div>
3909
3954
  `;
3910
3955
  }
3911
- function Ms(e) {
3956
+ function $s(e) {
3912
3957
  const t = /<a[^>]*href="(https?:\/\/[^"]+\.(docx?|xlsx?|pptx?)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3913
3958
  e = e.replace(t, (a, s) => qt(s));
3914
3959
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(docx?|xlsx?|pptx?)(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
@@ -3940,10 +3985,10 @@ function qt(e) {
3940
3985
  </div>
3941
3986
  `;
3942
3987
  }
3943
- function $s(e) {
3988
+ function As(e) {
3944
3989
  return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3945
3990
  }
3946
- function As(e, t = {}) {
3991
+ function zs(e, t = {}) {
3947
3992
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/gist\.github\.com\/([a-zA-Z0-9_-]+)\/([a-f0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3948
3993
  e = e.replace(a, (f, g, m, b) => Zt(m, b));
3949
3994
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/gist\\.github\\.com\\/([a-zA-Z0-9_-]+)\\/([a-f0-9]+))(?!["'])`, "gi");
@@ -3971,7 +4016,7 @@ function As(e, t = {}) {
3971
4016
  }
3972
4017
  function Zt(e, t) {
3973
4018
  return `
3974
- <div class="artifactuse-gist-wrapper" id="${$s("gist")}">
4019
+ <div class="artifactuse-gist-wrapper" id="${As("gist")}">
3975
4020
  <script src="https://gist.github.com/${e}/${t}.js"><\/script>
3976
4021
  </div>
3977
4022
  `;
@@ -4046,7 +4091,7 @@ function Ut(e, t, r = "dark") {
4046
4091
  </div>
4047
4092
  `;
4048
4093
  }
4049
- function zs(e) {
4094
+ function Ss(e) {
4050
4095
  const t = /<a[^>]*href="(https?:\/\/public\.tableau\.com\/(?:views|profile)\/([^\s"]+))"[^>]*>[^<]*<\/a>/gi;
4051
4096
  e = e.replace(t, (l, d, p) => Gt(p));
4052
4097
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/public\\.tableau\\.com\\/(?:views|profile)\\/([^\\s<>"]+))(?!["'])`, "gi");
@@ -4113,7 +4158,7 @@ function Kt(e) {
4113
4158
  </div>
4114
4159
  `;
4115
4160
  }
4116
- function Ss(e, t = {}) {
4161
+ function Cs(e, t = {}) {
4117
4162
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/sketchfab\.com\/(?:3d-)?models\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4118
4163
  e = e.replace(a, (f, g, m) => Jt(m, r));
4119
4164
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/sketchfab\\.com\\/(?:3d-)?models\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
@@ -4223,7 +4268,7 @@ function rr(e, t) {
4223
4268
  </div>
4224
4269
  `;
4225
4270
  }
4226
- function Cs(e, t = {}) {
4271
+ function Rs(e, t = {}) {
4227
4272
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:[a-zA-Z0-9-]+\.)?typeform\.com\/to\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4228
4273
  e = e.replace(a, (m, b, v) => ar(v));
4229
4274
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:[a-zA-Z0-9-]+\\.)?typeform\\.com\\/to\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
@@ -4333,33 +4378,33 @@ function cr(e) {
4333
4378
  `;
4334
4379
  }
4335
4380
  let te = null, Ce = !1, nt = !1;
4336
- function Rr(e) {
4381
+ function Lr(e) {
4337
4382
  const t = /<pre><code class="language-mermaid">([\s\S]*?)<\/code><\/pre>/gi;
4338
4383
  return e = e.replace(t, (r, a) => {
4339
- const s = Rs(a).trim();
4340
- return Ls(s);
4384
+ const s = Ls(a).trim();
4385
+ return Ts(s);
4341
4386
  }), e;
4342
4387
  }
4343
- function Rs(e) {
4388
+ function Ls(e) {
4344
4389
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
4345
4390
  }
4346
- function Ls(e) {
4347
- const t = Lr(e);
4391
+ function Ts(e) {
4392
+ const t = Tr(e);
4348
4393
  return `
4349
4394
  <div class="artifactuse-mermaid-container" data-mermaid-id="${`mermaid-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`}" data-mermaid-diagram="${t}">
4350
4395
  <div class="artifactuse-mermaid-loading">Loading diagram...</div>
4351
4396
  </div>
4352
4397
  `;
4353
4398
  }
4354
- function Lr(e) {
4399
+ function Tr(e) {
4355
4400
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4356
4401
  }
4357
- function Tr(e) {
4402
+ function _r(e) {
4358
4403
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
4359
4404
  }
4360
- function _r(e = {}) {
4361
- 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) => {
4362
- console.error("Failed to load Mermaid library:", t), Ce = !0, Ts();
4405
+ function Er(e = {}) {
4406
+ 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..."), Es().then(() => (console.log("Mermaid loaded, rendering diagrams..."), ur(e), Re())).catch((t) => {
4407
+ console.error("Failed to load Mermaid library:", t), Ce = !0, _s();
4363
4408
  })) : (nt || ur(e), Re());
4364
4409
  }
4365
4410
  function ur(e = {}) {
@@ -4400,7 +4445,7 @@ async function Re() {
4400
4445
  const e = document.querySelectorAll(".artifactuse-mermaid-container");
4401
4446
  for (const t of e) {
4402
4447
  if (t.dataset.rendered === "true") continue;
4403
- const r = Tr(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
4448
+ const r = _r(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
4404
4449
  try {
4405
4450
  if (await mermaid.parse(r)) {
4406
4451
  const { svg: n } = await mermaid.render(a, r);
@@ -4420,10 +4465,10 @@ async function Re() {
4420
4465
  }
4421
4466
  }
4422
4467
  }
4423
- function Ts() {
4468
+ function _s() {
4424
4469
  document.querySelectorAll(".artifactuse-mermaid-container").forEach((e) => {
4425
4470
  if (e.dataset.rendered === "true") return;
4426
- const t = Tr(e.dataset.mermaidDiagram);
4471
+ const t = _r(e.dataset.mermaidDiagram);
4427
4472
  e.innerHTML = `
4428
4473
  <div class="artifactuse-mermaid-fallback">
4429
4474
  <div class="artifactuse-mermaid-fallback-title">Mermaid Diagram</div>
@@ -4435,7 +4480,7 @@ function Ts() {
4435
4480
  function Ge(e) {
4436
4481
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4437
4482
  }
4438
- function _s() {
4483
+ function Es() {
4439
4484
  return te || (typeof mermaid < "u" ? Promise.resolve() : (te = new Promise((e, t) => {
4440
4485
  const r = setTimeout(() => {
4441
4486
  te = null, t(new Error("Mermaid loading timed out after 15 seconds"));
@@ -4447,41 +4492,41 @@ function _s() {
4447
4492
  }, document.head.appendChild(a);
4448
4493
  }), te));
4449
4494
  }
4450
- function nn() {
4495
+ function ln() {
4451
4496
  te = null, Ce = !1, nt = !1;
4452
4497
  }
4453
- function on() {
4498
+ function cn() {
4454
4499
  return typeof mermaid < "u";
4455
4500
  }
4456
- function ln() {
4501
+ function un() {
4457
4502
  return Ce;
4458
4503
  }
4459
- function cn(e, t = {}) {
4504
+ function dn(e, t = {}) {
4460
4505
  if (!e) return Promise.resolve();
4461
4506
  let r = e.innerHTML;
4462
- return r = Rr(r), e.innerHTML = r, _r(t);
4507
+ return r = Lr(r), e.innerHTML = r, Er(t);
4463
4508
  }
4464
- async function un(e) {
4509
+ async function pn(e) {
4465
4510
  const t = document.querySelector(`[data-mermaid-id="${e}"]`);
4466
4511
  t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4467
4512
  }
4468
- async function dn(e, t) {
4513
+ async function fn(e, t) {
4469
4514
  const r = document.querySelector(`[data-mermaid-id="${e}"]`);
4470
- r && (r.dataset.mermaidDiagram = Lr(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4515
+ r && (r.dataset.mermaidDiagram = Tr(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await Re());
4471
4516
  }
4472
- function Es(e) {
4517
+ function Ps(e) {
4473
4518
  const t = /<table([^>]*)>([\s\S]*?)<\/table>/gi;
4474
4519
  let r = 0;
4475
4520
  return e = e.replace(t, (a, s, n) => {
4476
4521
  const o = `artifactuse-table-${r++}`;
4477
- return Ps(o, s, n);
4522
+ return js(o, s, n);
4478
4523
  }), e;
4479
4524
  }
4480
- function Ps(e, t, r) {
4525
+ function js(e, t, r) {
4481
4526
  const a = /<thead/i.test(r) || /<th/i.test(r), s = (r.match(/<tr/gi) || []).length;
4482
4527
  if (!a || s < 3)
4483
4528
  return `<table${t} class="artifactuse-table">${r}</table>`;
4484
- const n = js(r);
4529
+ const n = Hs(r);
4485
4530
  return `
4486
4531
  <div class="artifactuse-table-container" data-table-id="${e}">
4487
4532
  <div class="artifactuse-table-controls">
@@ -4524,7 +4569,7 @@ function Ps(e, t, r) {
4524
4569
  </div>
4525
4570
  `;
4526
4571
  }
4527
- function js(e) {
4572
+ function Hs(e) {
4528
4573
  let t = 0;
4529
4574
  return e = e.replace(/<th(\s[^>]*)?>([\s\S]*?)<\/th>/gi, (r, a, s) => {
4530
4575
  const n = t++;
@@ -4543,7 +4588,7 @@ function js(e) {
4543
4588
  `;
4544
4589
  }), e;
4545
4590
  }
4546
- function Hs(e) {
4591
+ function Vs(e) {
4547
4592
  const t = e.querySelectorAll("tr"), r = [];
4548
4593
  return t.forEach((a) => {
4549
4594
  const s = a.querySelectorAll("th, td"), n = [];
@@ -4555,11 +4600,11 @@ function Hs(e) {
4555
4600
  }), r.join(`
4556
4601
  `);
4557
4602
  }
4558
- function Vs(e, t = "table-data.csv") {
4603
+ function Is(e, t = "table-data.csv") {
4559
4604
  const r = new Blob([e], { type: "text/csv;charset=utf-8;" }), a = URL.createObjectURL(r), s = document.createElement("a");
4560
4605
  s.href = a, s.download = t, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(a);
4561
4606
  }
4562
- function Is(e) {
4607
+ function Ds(e) {
4563
4608
  const t = e.querySelectorAll("tr"), r = [];
4564
4609
  return t.forEach((a) => {
4565
4610
  const s = a.querySelectorAll("th, td"), n = [];
@@ -4569,7 +4614,7 @@ function Is(e) {
4569
4614
  }), r.join(`
4570
4615
  `);
4571
4616
  }
4572
- function Ds(e, t, r = !0) {
4617
+ function qs(e, t, r = !0) {
4573
4618
  const a = e.querySelector("tbody") || e, s = Array.from(a.querySelectorAll("tr")).filter((n) => !n.querySelector("th"));
4574
4619
  s.sort((n, o) => {
4575
4620
  const i = n.cells[t], u = o.cells[t];
@@ -4582,7 +4627,7 @@ function Ds(e, t, r = !0) {
4582
4627
  return !isNaN(c.getTime()) && !isNaN(h.getTime()) ? r ? c - h : h - c : r ? l.localeCompare(d) : d.localeCompare(l);
4583
4628
  }), s.forEach((n) => a.appendChild(n));
4584
4629
  }
4585
- function qs(e, t) {
4630
+ function Zs(e, t) {
4586
4631
  const r = e.querySelectorAll("tbody tr, tr:not(:first-child)"), a = t.toLowerCase().trim();
4587
4632
  let s = 0;
4588
4633
  return r.forEach((n) => {
@@ -4594,13 +4639,13 @@ function qs(e, t) {
4594
4639
  n.style.display = i ? "" : "none", i && s++;
4595
4640
  }), s;
4596
4641
  }
4597
- function Zs() {
4642
+ function Os() {
4598
4643
  document.querySelectorAll("[data-table-search]").forEach((e) => {
4599
4644
  const t = e.dataset.tableSearch, r = document.getElementById(t), a = document.querySelector(`[data-table-count="${t}"]`);
4600
4645
  if (r) {
4601
4646
  const s = r.querySelectorAll("tbody tr, tr:not(:first-child)"), n = Array.from(s).filter((o) => !o.querySelector("th")).length;
4602
4647
  a && (a.textContent = `${n} rows`), e.addEventListener("input", (o) => {
4603
- const i = qs(r, o.target.value);
4648
+ const i = Zs(r, o.target.value);
4604
4649
  a && (a.textContent = o.target.value ? `${i} of ${n} rows` : `${n} rows`);
4605
4650
  });
4606
4651
  }
@@ -4609,21 +4654,21 @@ function Zs() {
4609
4654
  const t = e.closest("table"), r = parseInt(e.dataset.sortCol), s = e.dataset.sortDir !== "asc";
4610
4655
  t.querySelectorAll(".artifactuse-sortable-header").forEach((n) => {
4611
4656
  n.dataset.sortDir = "", n.classList.remove("sort-asc", "sort-desc");
4612
- }), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), Ds(t, r, s);
4657
+ }), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), qs(t, r, s);
4613
4658
  });
4614
4659
  }), document.querySelectorAll("[data-table-export]").forEach((e) => {
4615
4660
  e.addEventListener("click", () => {
4616
4661
  const t = e.dataset.tableExport, r = document.getElementById(t);
4617
4662
  if (r) {
4618
- const a = Hs(r);
4619
- Vs(a, `${t}.csv`);
4663
+ const a = Vs(r);
4664
+ Is(a, `${t}.csv`);
4620
4665
  }
4621
4666
  });
4622
4667
  }), document.querySelectorAll("[data-table-copy]").forEach((e) => {
4623
4668
  e.addEventListener("click", async () => {
4624
4669
  const t = e.dataset.tableCopy, r = document.getElementById(t);
4625
4670
  if (r) {
4626
- const a = Is(r);
4671
+ const a = Ds(r);
4627
4672
  try {
4628
4673
  await navigator.clipboard.writeText(a);
4629
4674
  const s = e.querySelector("span"), n = s ? s.textContent : "";
@@ -4638,40 +4683,40 @@ function Zs() {
4638
4683
  });
4639
4684
  }
4640
4685
  let re = null, Le = !1;
4641
- function Er(e) {
4642
- 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;
4686
+ function Pr(e) {
4687
+ return e = Bs(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;
4643
4688
  }
4644
- function Os(e) {
4689
+ function Bs(e) {
4645
4690
  const t = /<pre><code class="language-(math|latex)">([\s\S]*?)<\/code><\/pre>/gi;
4646
4691
  return e = e.replace(t, (r, a, s) => {
4647
- const n = Bs(s).trim();
4692
+ const n = Fs(s).trim();
4648
4693
  return he(n, !0);
4649
4694
  }), e;
4650
4695
  }
4651
- function Bs(e) {
4696
+ function Fs(e) {
4652
4697
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
4653
4698
  }
4654
4699
  function he(e, t = !1) {
4655
- const r = Fs(e);
4700
+ const r = Ns(e);
4656
4701
  return `<span class="artifactuse-math-container ${t ? "artifactuse-math-display" : "artifactuse-math-inline"}" data-tex="${r}" data-display="${t ? "true" : "false"}"></span>`;
4657
4702
  }
4658
- function Fs(e) {
4703
+ function Ns(e) {
4659
4704
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4660
4705
  }
4661
- function Pr(e) {
4706
+ function jr(e) {
4662
4707
  return e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
4663
4708
  }
4664
- function jr() {
4665
- 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(() => {
4709
+ function Hr() {
4710
+ 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..."), Gs().then(() => {
4666
4711
  console.log("KaTeX loaded, rendering math..."), dr();
4667
4712
  }).catch((e) => {
4668
- console.error("Failed to load KaTeX library:", e), Le = !0, Ns();
4713
+ console.error("Failed to load KaTeX library:", e), Le = !0, Us();
4669
4714
  })) : (dr(), Promise.resolve());
4670
4715
  }
4671
- function Ns() {
4716
+ function Us() {
4672
4717
  document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
4673
4718
  if (e.dataset.rendered === "true") return;
4674
- const t = Pr(e.dataset.tex);
4719
+ const t = jr(e.dataset.tex);
4675
4720
  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");
4676
4721
  });
4677
4722
  }
@@ -4682,7 +4727,7 @@ function dr() {
4682
4727
  }
4683
4728
  document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
4684
4729
  if (e.dataset.rendered === "true") return;
4685
- const t = Pr(e.dataset.tex), r = e.dataset.display === "true";
4730
+ const t = jr(e.dataset.tex), r = e.dataset.display === "true";
4686
4731
  try {
4687
4732
  katex.render(t, e, {
4688
4733
  displayMode: r,
@@ -4710,7 +4755,7 @@ function dr() {
4710
4755
  function We(e) {
4711
4756
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4712
4757
  }
4713
- function Us() {
4758
+ function Gs() {
4714
4759
  return re || (typeof katex < "u" ? Promise.resolve() : (re = new Promise((e, t) => {
4715
4760
  const r = setTimeout(() => {
4716
4761
  re = null, t(new Error("KaTeX loading timed out after 10 seconds"));
@@ -4726,21 +4771,21 @@ function Us() {
4726
4771
  }, document.head.appendChild(s);
4727
4772
  }), re));
4728
4773
  }
4729
- function pn() {
4774
+ function hn() {
4730
4775
  re = null, Le = !1;
4731
4776
  }
4732
- function fn() {
4777
+ function gn() {
4733
4778
  return typeof katex < "u";
4734
4779
  }
4735
- function hn() {
4780
+ function mn() {
4736
4781
  return Le;
4737
4782
  }
4738
- function gn(e) {
4783
+ function wn(e) {
4739
4784
  if (!e) return Promise.resolve();
4740
4785
  let t = e.innerHTML;
4741
- return t = Er(t), e.innerHTML = t, jr();
4786
+ return t = Pr(t), e.innerHTML = t, Hr();
4742
4787
  }
4743
- const mn = {
4788
+ const bn = {
4744
4789
  // Fractions
4745
4790
  fraction: (e, t) => `\\frac{${e}}{${t}}`,
4746
4791
  // Square root
@@ -4772,11 +4817,11 @@ const mn = {
4772
4817
  euler: "e^{i\\pi} + 1 = 0",
4773
4818
  derivative: (e, t) => `\\frac{d${e}}{d${t}}`,
4774
4819
  partialDerivative: (e, t) => `\\frac{\\partial ${e}}{\\partial ${t}}`
4775
- };
4820
+ }, Ws = new Set(Object.values(fr));
4776
4821
  function xe(e) {
4777
4822
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4778
4823
  }
4779
- function Gs() {
4824
+ function Xs() {
4780
4825
  const e = {
4781
4826
  image(a) {
4782
4827
  const s = typeof a == "string" ? a : a.href, n = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
@@ -4785,8 +4830,8 @@ function Gs() {
4785
4830
  }, t = {
4786
4831
  link(a) {
4787
4832
  const s = typeof a == "string" ? a : a.href, n = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
4788
- if (ts(s))
4789
- return as(s);
4833
+ if (rs(s))
4834
+ return ss(s);
4790
4835
  const i = n ? ` title="${xe(n)}"` : "";
4791
4836
  return `<a href="${xe(s || "")}" target="_blank" rel="noopener noreferrer"${i}>${o || ""}</a>`;
4792
4837
  }
@@ -4806,8 +4851,8 @@ function Gs() {
4806
4851
  breaks: !0
4807
4852
  });
4808
4853
  }
4809
- Gs();
4810
- const Hr = {
4854
+ Xs();
4855
+ const Vr = {
4811
4856
  // Structured artifact types
4812
4857
  form: "form-panel",
4813
4858
  // Visual editors
@@ -4845,7 +4890,7 @@ const Hr = {
4845
4890
  md: "html-panel",
4846
4891
  // Diagrams
4847
4892
  mermaid: "mermaid-panel"
4848
- }, Ws = {
4893
+ }, Ks = {
4849
4894
  // CDN URL for panel artifacts (video editor, canvas, etc.)
4850
4895
  cdnUrl: "https://cdn.artifactuse.com",
4851
4896
  // Theme: 'dark' | 'light' | 'auto'
@@ -4929,7 +4974,7 @@ const Hr = {
4929
4974
  expiryDays: 30
4930
4975
  }
4931
4976
  };
4932
- function Vr(e, t) {
4977
+ function Ir(e, t) {
4933
4978
  if (e == null)
4934
4979
  return null;
4935
4980
  try {
@@ -4944,7 +4989,7 @@ function Vr(e, t) {
4944
4989
  }
4945
4990
  return null;
4946
4991
  }
4947
- function Xs(e, t) {
4992
+ function Js(e, t) {
4948
4993
  const r = /* @__PURE__ */ new Set();
4949
4994
  try {
4950
4995
  r.add(new URL(t).origin);
@@ -4952,13 +4997,13 @@ function Xs(e, t) {
4952
4997
  console.warn("Artifactuse: Invalid default CDN URL:", t);
4953
4998
  }
4954
4999
  for (const a of Object.values(e)) {
4955
- const s = Vr(a, t);
5000
+ const s = Ir(a, t);
4956
5001
  s && r.add(s);
4957
5002
  }
4958
5003
  return [...r];
4959
5004
  }
4960
- function Ks(e, t) {
4961
- const r = { ...Hr };
5005
+ function Qs(e, t) {
5006
+ const r = { ...Vr };
4962
5007
  if (e.panels)
4963
5008
  for (const [u, l] of Object.entries(e.panels))
4964
5009
  if (Array.isArray(u))
@@ -5002,7 +5047,7 @@ function Ks(e, t) {
5002
5047
  const c = w == null ? void 0 : w.toLowerCase();
5003
5048
  c && (r[c] = l);
5004
5049
  });
5005
- const p = Vr(l, e.cdnUrl);
5050
+ const p = Ir(l, e.cdnUrl);
5006
5051
  p && t && t.addAllowedOrigin(p);
5007
5052
  }
5008
5053
  function i(u) {
@@ -5023,31 +5068,31 @@ function Ks(e, t) {
5023
5068
  }
5024
5069
  };
5025
5070
  }
5026
- function wn(e = {}) {
5027
- 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);
5028
- function d(y, E, R = {}) {
5029
- let C = V.parse(y);
5030
- 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;
5071
+ function vn(e = {}) {
5072
+ const t = Dr(Ks, e), r = aa(), a = { ...Vr, ...t.panels }, s = Js(a, t.cdnUrl), n = sa(s), o = oa(t.theme, t.colors || {}), i = Qs(t, n), u = ha(t.sharing), l = ga(t.editor);
5073
+ function d(y, E, C = {}) {
5074
+ let R = V.parse(y);
5075
+ const D = [], _ = { theme: o.resolved }, q = C.inlinePreview ?? t.inlinePreview ?? null, J = C.inlineCode ?? t.inlineCode ?? null, le = C.tabs ?? t.tabs ?? null, K = C.viewMode ?? t.viewMode ?? null;
5031
5076
  if (t.processors.codeBlocks) {
5032
- const U = ta(C, E, {
5077
+ const U = ra(R, E, {
5033
5078
  ...t.codeExtraction,
5034
5079
  inlinePreview: q,
5035
5080
  inlineCode: J,
5036
5081
  tabs: le,
5037
5082
  viewMode: K
5038
5083
  });
5039
- C = U.html, D.push(...U.artifacts);
5084
+ R = U.html, D.push(...U.artifacts);
5040
5085
  }
5041
- 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) => {
5086
+ return t.processors.images && (R = es(R)), t.processors.imageGalleries && (R = ts(R)), t.processors.videos && (R = ns(R)), t.processors.videoGalleries && (R = cs(R)), t.processors.audio && (R = ps(R, _)), t.processors.maps && (R = ys(R)), t.processors.social && (R = ks(R, _)), t.processors.documents && (R = xs(R), R = Ms(R), R = $s(R)), t.processors.codeEmbeds && (R = zs(R, _)), t.processors.dataViz && (R = Ss(R)), t.processors.design && (R = Cs(R, _)), t.processors.interactive && (R = Rs(R, _)), t.processors.tables && (R = Ps(R)), t.processors.math && (R = Pr(R)), t.processors.mermaid && (R = Lr(R)), D.forEach((U) => {
5042
5087
  r.addArtifact(U);
5043
5088
  }), {
5044
- html: C,
5089
+ html: R,
5045
5090
  artifacts: D
5046
5091
  };
5047
5092
  }
5048
5093
  async function p(y = document) {
5049
- const E = [], R = { theme: o.resolved };
5050
- t.processors.math && E.push(jr()), t.processors.mermaid && E.push(_r(R)), t.processors.tables && Zs(), t.processors.audio && fs(y), t.syntaxHighlight && (pr(y), (y === document ? document : y).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((_) => {
5094
+ const E = [], C = { theme: o.resolved };
5095
+ t.processors.math && E.push(Hr()), t.processors.mermaid && E.push(Er(C)), t.processors.tables && Os(), t.processors.audio && hs(y), t.syntaxHighlight && (pr(y), (y === document ? document : y).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((_) => {
5051
5096
  var K;
5052
5097
  const q = _.querySelector("code");
5053
5098
  if (!q || q.dataset.smartdiffProcessed) return;
@@ -5067,19 +5112,19 @@ function wn(e = {}) {
5067
5112
  }
5068
5113
  t.multiTab ? r.openTab(y.id) : r.setActiveArtifact(y.id), r.setForceEmptyView(!1), r.setPanelOpen(!0), y.viewMode && r.setViewMode(y.viewMode), T("artifact:opened", y);
5069
5114
  }
5070
- function c(y, E, R = {}) {
5071
- const C = y.split(".").pop(), D = R.language || Ur(C) || C, _ = R.title || y, q = r.getState().artifacts.find((J) => J.title === _ && !J.isInline);
5072
- return q ? (f(q.id, E, { ...R, title: _ }), w(q), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), r.getArtifact(q.id)) : h(E, D, { ...R, title: _ });
5115
+ function c(y, E, C = {}) {
5116
+ const R = y.split(".").pop().toLowerCase(), D = C.language || Gr(R) || R, _ = C.title || y, q = r.getState().artifacts.find((J) => J.title === _ && !J.isInline);
5117
+ return q ? (f(q.id, E, { ...C, title: _ }), w(q), C.viewMode ? r.setViewMode(C.viewMode) : C.tabs && r.setViewMode(C.tabs[0]), r.getArtifact(q.id)) : h(E, D, { ...C, title: _, fileExtension: R });
5073
5118
  }
5074
- function h(y, E, R = {}) {
5075
- const C = R.messageId || Fr("open"), D = A({ type: E, language: E }) ? E : "txt", _ = $e(y, D, C, 0);
5076
- return _.title = R.title || _.title, _.isInline = !1, _.editorLanguage = E, R.tabs && (_.tabs = R.tabs), R.panelUrl && (_.panelUrl = R.panelUrl), R.externalPreview !== void 0 && (_.externalPreview = R.externalPreview), r.addArtifact(_), w(_), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), _;
5119
+ function h(y, E, C = {}) {
5120
+ const R = C.messageId || Nr("open"), D = A({ type: E, language: E }) || Ws.has(E) ? E : "txt", _ = $e(y, D, R, 0);
5121
+ return _.title = C.title || _.title, _.isInline = !1, _.editorLanguage = E, C.fileExtension && (_.fileExtension = C.fileExtension), C.tabs && (_.tabs = C.tabs), C.panelUrl && (_.panelUrl = C.panelUrl), C.externalPreview !== void 0 && (_.externalPreview = C.externalPreview), r.addArtifact(_), w(_), C.viewMode ? r.setViewMode(C.viewMode) : C.tabs && r.setViewMode(C.tabs[0]), _;
5077
5122
  }
5078
- function f(y, E, R = {}) {
5079
- const C = typeof y == "string" ? y : y == null ? void 0 : y.id, D = r.getArtifact(C);
5123
+ function f(y, E, C = {}) {
5124
+ const R = typeof y == "string" ? y : y == null ? void 0 : y.id, D = r.getArtifact(R);
5080
5125
  if (!D) return null;
5081
5126
  const _ = { ...D, code: E, _refreshToken: Date.now() };
5082
- return R.title !== void 0 && (_.title = R.title), R.tabs !== void 0 && (_.tabs = R.tabs), R.panelUrl !== void 0 && (_.panelUrl = R.panelUrl), R.externalPreview !== void 0 && (_.externalPreview = R.externalPreview), r.addArtifact(_), T("artifact:updated", { artifactId: C, artifact: r.getArtifact(C) }), r.getArtifact(C);
5127
+ return C.title !== void 0 && (_.title = C.title), C.tabs !== void 0 && (_.tabs = C.tabs), C.panelUrl !== void 0 && (_.panelUrl = C.panelUrl), C.externalPreview !== void 0 && (_.externalPreview = C.externalPreview), r.addArtifact(_), T("artifact:updated", { artifactId: R, artifact: r.getArtifact(R) }), r.getArtifact(R);
5083
5128
  }
5084
5129
  function g() {
5085
5130
  r.clearActiveArtifact(), r.setForceEmptyView(!0), r.setPanelOpen(!0), T("panel:opened");
@@ -5101,12 +5146,12 @@ function wn(e = {}) {
5101
5146
  function M(y, E = {}) {
5102
5147
  if (!y) return null;
5103
5148
  if (y.panelUrl) return y.panelUrl;
5104
- const { type: R, language: C } = y, D = {
5149
+ const { type: C, language: R } = y, D = {
5105
5150
  theme: E.theme || o.resolved
5106
5151
  }, _ = o.colors;
5107
5152
  _ != null && _.primary && (D.accent = _.primary);
5108
- let q = i.resolve(R, D);
5109
- return !q && C && (q = i.resolve(C, D)), q;
5153
+ let q = i.resolve(C, D);
5154
+ return !q && R && (q = i.resolve(R, D)), q;
5110
5155
  }
5111
5156
  function A(y) {
5112
5157
  return y ? i.has(y.type) || i.has(y.language) : !1;
@@ -5126,19 +5171,19 @@ function wn(e = {}) {
5126
5171
  const z = /* @__PURE__ */ new Map();
5127
5172
  function j(y, E) {
5128
5173
  return z.has(y) || z.set(y, /* @__PURE__ */ new Set()), z.get(y).add(E), () => {
5129
- var R;
5130
- (R = z.get(y)) == null || R.delete(E);
5174
+ var C;
5175
+ (C = z.get(y)) == null || C.delete(E);
5131
5176
  };
5132
5177
  }
5133
5178
  function P(y, E) {
5134
- var R;
5135
- (R = z.get(y)) == null || R.delete(E);
5179
+ var C;
5180
+ (C = z.get(y)) == null || C.delete(E);
5136
5181
  }
5137
5182
  function T(y, E) {
5138
- var R;
5139
- (R = z.get(y)) == null || R.forEach((C) => {
5183
+ var C;
5184
+ (C = z.get(y)) == null || C.forEach((R) => {
5140
5185
  try {
5141
- C(E);
5186
+ R(E);
5142
5187
  } catch (D) {
5143
5188
  console.error(`Artifactuse event handler error (${y}):`, D);
5144
5189
  }
@@ -5160,7 +5205,7 @@ function wn(e = {}) {
5160
5205
  return o.resolved;
5161
5206
  }
5162
5207
  function B() {
5163
- n.destroy(), z.clear(), r.clear(), bs();
5208
+ n.destroy(), z.clear(), r.clear(), vs();
5164
5209
  }
5165
5210
  return {
5166
5211
  // Config
@@ -5214,7 +5259,7 @@ function wn(e = {}) {
5214
5259
  destroy: B
5215
5260
  };
5216
5261
  }
5217
- function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
5262
+ function Dr(e, t, r = /* @__PURE__ */ new WeakSet()) {
5218
5263
  if (!t) return e;
5219
5264
  if (!e) return t;
5220
5265
  if (typeof t == "object" && t !== null) {
@@ -5235,7 +5280,7 @@ function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
5235
5280
  continue;
5236
5281
  }
5237
5282
  if (typeof n == "object" && n.constructor === Object) {
5238
- a[s] = Ir(e[s] || {}, n, r);
5283
+ a[s] = Dr(e[s] || {}, n, r);
5239
5284
  continue;
5240
5285
  }
5241
5286
  a[s] = n;
@@ -5244,24 +5289,24 @@ function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
5244
5289
  return a;
5245
5290
  }
5246
5291
  export {
5247
- xs as $,
5292
+ Ms as $,
5248
5293
  Oe as A,
5249
5294
  Be as B,
5250
5295
  Fe as C,
5251
- Hr as D,
5296
+ Vr as D,
5252
5297
  Ne as E,
5253
- ds as F,
5298
+ ps as F,
5254
5299
  yt as G,
5255
5300
  kt as H,
5256
5301
  F as I,
5257
5302
  xt as J,
5258
- fs as K,
5259
- bs as L,
5260
- vs as M,
5303
+ hs as K,
5304
+ vs as L,
5305
+ ys as M,
5261
5306
  ee as N,
5262
5307
  Ue as O,
5263
5308
  Rt as P,
5264
- ys as Q,
5309
+ ks as Q,
5265
5310
  Lt as R,
5266
5311
  Tt as S,
5267
5312
  _t as T,
@@ -5270,61 +5315,61 @@ export {
5270
5315
  jt as W,
5271
5316
  Ht as X,
5272
5317
  Vt as Y,
5273
- ks as Z,
5318
+ xs as Z,
5274
5319
  It as _,
5275
- rn as a,
5276
- en as a$,
5320
+ sn as a,
5321
+ rn as a$,
5277
5322
  oe as a0,
5278
5323
  Dt as a1,
5279
- Ms as a2,
5324
+ $s as a2,
5280
5325
  qt as a3,
5281
- As as a4,
5326
+ zs as a4,
5282
5327
  Zt as a5,
5283
5328
  Ot as a6,
5284
5329
  Bt as a7,
5285
5330
  Ft as a8,
5286
5331
  Nt as a9,
5287
- on as aA,
5288
- ln as aB,
5289
- cn as aC,
5290
- un as aD,
5291
- dn as aE,
5292
- Es as aF,
5293
- Ps as aG,
5294
- Hs as aH,
5295
- Vs as aI,
5296
- Is as aJ,
5297
- Ds as aK,
5298
- qs as aL,
5299
- Zs as aM,
5300
- Er as aN,
5332
+ cn as aA,
5333
+ un as aB,
5334
+ dn as aC,
5335
+ pn as aD,
5336
+ fn as aE,
5337
+ Ps as aF,
5338
+ js as aG,
5339
+ Vs as aH,
5340
+ Is as aI,
5341
+ Ds as aJ,
5342
+ qs as aK,
5343
+ Zs as aL,
5344
+ Os as aM,
5345
+ Pr as aN,
5301
5346
  he as aO,
5302
- jr as aP,
5303
- Us as aQ,
5304
- pn as aR,
5305
- fn as aS,
5306
- hn as aT,
5307
- gn as aU,
5308
- mn as aV,
5347
+ Hr as aP,
5348
+ Gs as aQ,
5349
+ hn as aR,
5350
+ gn as aS,
5351
+ mn as aT,
5352
+ wn as aU,
5353
+ bn as aV,
5309
5354
  pr as aW,
5310
- Qs as aX,
5355
+ en as aX,
5311
5356
  ot as aY,
5312
- Zr as aZ,
5313
- Ys as a_,
5357
+ Or as aZ,
5358
+ tn as a_,
5314
5359
  Ut as aa,
5315
- zs as ab,
5360
+ Ss as ab,
5316
5361
  Gt as ac,
5317
5362
  Wt as ad,
5318
5363
  Xt as ae,
5319
5364
  Kt as af,
5320
- Ss as ag,
5365
+ Cs as ag,
5321
5366
  Jt as ah,
5322
5367
  Qt as ai,
5323
5368
  Yt as aj,
5324
5369
  er as ak,
5325
5370
  tr as al,
5326
5371
  rr as am,
5327
- Cs as an,
5372
+ Rs as an,
5328
5373
  ar as ao,
5329
5374
  sr as ap,
5330
5375
  nr as aq,
@@ -5332,34 +5377,34 @@ export {
5332
5377
  or as as,
5333
5378
  lr as at,
5334
5379
  cr as au,
5335
- Rr as av,
5336
- Ls as aw,
5337
- _r as ax,
5338
- _s as ay,
5339
- nn as az,
5340
- tn as b,
5341
- Xr as c,
5342
- wn as d,
5343
- ta as e,
5344
- an as f,
5380
+ Lr as av,
5381
+ Ts as aw,
5382
+ Er as ax,
5383
+ Es as ay,
5384
+ ln as az,
5385
+ an as b,
5386
+ Kr as c,
5387
+ vn as d,
5388
+ ra as e,
5389
+ nn as f,
5345
5390
  ct as g,
5346
- Yr as h,
5391
+ ea as h,
5347
5392
  ae as i,
5348
- ra as j,
5349
- aa as k,
5350
- ia as l,
5351
- ha as m,
5393
+ aa as j,
5394
+ sa as k,
5395
+ oa as l,
5396
+ ga as m,
5352
5397
  ge as n,
5353
- Ya as o,
5354
- sn as p,
5355
- es as q,
5398
+ es as o,
5399
+ on as p,
5400
+ ts as q,
5356
5401
  qe as r,
5357
5402
  vt as s,
5358
- ss as t,
5359
- ts as u,
5360
- as as v,
5403
+ ns as t,
5404
+ rs as u,
5405
+ ss as v,
5361
5406
  Ze as w,
5362
- ls as x,
5363
- cs as y,
5364
- is as z
5407
+ cs as x,
5408
+ us as y,
5409
+ os as z
5365
5410
  };