artifactuse 0.2.2 → 0.2.3

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
1
  var Dr = Object.defineProperty;
2
2
  var qr = (e, t, r) => t in e ? Dr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var V = (e, t, r) => qr(e, typeof t != "symbol" ? t + "" : t, r);
3
+ var I = (e, t, r) => qr(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  const Ee = {
5
5
  CODE: "code",
6
6
  FORM: "form",
@@ -476,20 +476,20 @@ function Xr(e, t, r, a) {
476
476
  if (b) return !1;
477
477
  const v = a.minClickableLines;
478
478
  if (v == null) return !1;
479
- const M = typeof v == "number" ? v : v.lines || 0, $ = typeof v == "object" && Array.isArray(v.ignoreLanguages) ? v.ignoreLanguages : [];
480
- return f < M && !$.includes(r);
479
+ const x = typeof v == "number" ? v : v.lines || 0, $ = typeof v == "object" && Array.isArray(v.ignoreLanguages) ? v.ignoreLanguages : [];
480
+ return f < x && !$.includes(r);
481
481
  }
482
482
  function o(f, b) {
483
483
  const v = a.actionLabel;
484
- let M;
485
- return typeof v == "string" ? M = v : v && typeof v == "object" && (M = v[f] || v.default || null), M || (M = f === "diff" || f === "patch" || f === "smartdiff" ? "View full diff" : "View full code"), `${M} (${b} lines)`;
484
+ let x;
485
+ return typeof v == "string" ? x = v : v && typeof v == "object" && (x = v[f] || v.default || null), x || (x = f === "diff" || f === "patch" || f === "smartdiff" ? "View full diff" : "View full code"), `${x} (${b} lines)`;
486
486
  }
487
487
  if (r === "smartdiff")
488
488
  try {
489
489
  const f = JSON.parse(t), v = Wr(f.oldCode, f.newCode).split(`
490
- `), M = v.slice(0, s), $ = M.map((I) => I[0] || " "), z = M.map((I) => I.slice(1)), S = lt(z.join(`
491
- `)), y = v.length > s, C = f.language || "plaintext", x = n(v.length, y), E = x ? " artifactuse-inline-preview--static" : "", T = x ? ' data-non-clickable="true"' : "", L = o("smartdiff", v.length);
492
- return `<div class="artifactuse-inline-preview${y ? " artifactuse-inline-preview--truncated" : ""}${E}" data-artifact-id="${e.id}" data-smartdiff="true" data-smartdiff-markers="${$.join(",")}"${T}><pre class="artifactuse-inline-preview__pre"><code class="language-${C}">${S}</code></pre>` + (y ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${L}</span></div>` : "") + "</div>";
490
+ `), x = v.slice(0, s), $ = x.map((T) => T[0] || " "), A = x.map((T) => T.slice(1)), C = lt(A.join(`
491
+ `)), R = v.length > s, M = f.language || "plaintext", y = n(v.length, R), z = y ? " artifactuse-inline-preview--static" : "", H = y ? ' data-non-clickable="true"' : "", P = o("smartdiff", v.length);
492
+ return `<div class="artifactuse-inline-preview${R ? " artifactuse-inline-preview--truncated" : ""}${z}" data-artifact-id="${e.id}" data-smartdiff="true" data-smartdiff-markers="${$.join(",")}"${H}><pre class="artifactuse-inline-preview__pre"><code class="language-${M}">${C}</code></pre>` + (R ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${P}</span></div>` : "") + "</div>";
493
493
  } catch {
494
494
  }
495
495
  let i = t, u = r;
@@ -579,19 +579,19 @@ function ea(e, t, r = {}) {
579
579
  const w = [], c = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
580
580
  let m = 0;
581
581
  const h = e.replace(c, (g, f, b) => {
582
- const v = fr(b).trim(), M = v.split(`
582
+ const v = fr(b).trim(), x = v.split(`
583
583
  `).length;
584
584
  let $ = f.toLowerCase();
585
585
  if ((["xml", "markup", "html", "htm"].includes($) || !$) && v.trim().startsWith("<svg") && ($ = "svg"), p($))
586
586
  return m++, g;
587
- const z = pr($);
588
- let S = !1;
589
- if (n ? S = !0 : $ === "diff" || $ === "patch" || $ === "smartdiff" ? S = M > 10 : z ? S = !0 : S = v.length >= s && M >= a, !S && d($) && (S = !0), S) {
590
- const y = Me(v, $, t, m);
591
- if (u && (y.tabs = u), l && (y.viewMode = l), m++, w.push(y), d($))
592
- return Xr(y, v, $, o);
593
- let C = "panel";
594
- return y.isInline && (C = y.type === "social" ? "inline-social" : "inline-form"), Kr(y, C);
587
+ const A = pr($);
588
+ let C = !1;
589
+ if (n ? C = !0 : $ === "diff" || $ === "patch" || $ === "smartdiff" ? C = x > 10 : A ? C = !0 : C = v.length >= s && x >= a, !C && d($) && (C = !0), C) {
590
+ const R = Me(v, $, t, m);
591
+ if (u && (R.tabs = u), l && (R.viewMode = l), m++, w.push(R), d($))
592
+ return Xr(R, v, $, o);
593
+ let M = "panel";
594
+ return R.isInline && (M = R.type === "social" ? "inline-social" : "inline-form"), Kr(R, M);
595
595
  }
596
596
  return m++, g;
597
597
  });
@@ -611,70 +611,74 @@ function ta() {
611
611
  // Multi-tab support
612
612
  openTabs: [],
613
613
  // Array of artifact IDs open as tabs (ordered)
614
- tabViewModes: {}
614
+ tabViewModes: {},
615
615
  // { [artifactId]: 'preview' | 'code' | 'split' | 'edit' }
616
+ // Panel empty view
617
+ forceEmptyView: !1
618
+ // When true, panel shows empty state regardless of artifacts
616
619
  };
617
620
  const t = /* @__PURE__ */ new Set();
618
621
  function r() {
619
- t.forEach((y) => {
622
+ t.forEach((M) => {
620
623
  try {
621
- y(e);
622
- } catch (C) {
623
- console.error("Artifactuse state subscriber error:", C);
624
+ M(e);
625
+ } catch (y) {
626
+ console.error("Artifactuse state subscriber error:", y);
624
627
  }
625
628
  });
626
629
  }
627
- function a(y) {
628
- return t.add(y), y(e), () => {
629
- t.delete(y);
630
+ function a(M) {
631
+ return t.add(M), M(e), () => {
632
+ t.delete(M);
630
633
  };
631
634
  }
632
635
  function s() {
633
636
  return { ...e };
634
637
  }
635
- function n(y) {
636
- const C = e.artifacts.findIndex((x) => x.id === y.id);
637
- if (C === -1)
638
+ function n(M) {
639
+ const y = e.artifacts.findIndex((z) => z.id === M.id);
640
+ if (y === -1)
638
641
  e = {
639
642
  ...e,
640
- artifacts: [...e.artifacts, y]
643
+ artifacts: [...e.artifacts, M]
641
644
  };
642
645
  else {
643
- const x = [...e.artifacts];
644
- x[C] = { ...x[C], ...y }, e = {
646
+ const z = [...e.artifacts];
647
+ z[y] = { ...z[y], ...M }, e = {
645
648
  ...e,
646
- artifacts: x
649
+ artifacts: z
647
650
  };
648
651
  }
649
652
  r();
650
653
  }
651
- function o(y) {
652
- y.forEach(n);
654
+ function o(M) {
655
+ M.forEach(n);
653
656
  }
654
- function i(y) {
655
- const C = e.openTabs.filter((T) => T !== y), { [y]: x, ...E } = e.tabViewModes;
657
+ function i(M) {
658
+ const y = e.openTabs.filter((P) => P !== M), { [M]: z, ...H } = e.tabViewModes;
656
659
  e = {
657
660
  ...e,
658
- artifacts: e.artifacts.filter((T) => T.id !== y),
659
- activeArtifactId: e.activeArtifactId === y ? null : e.activeArtifactId,
660
- isPanelOpen: e.activeArtifactId === y ? !1 : e.isPanelOpen,
661
- openTabs: C,
662
- tabViewModes: E
661
+ artifacts: e.artifacts.filter((P) => P.id !== M),
662
+ activeArtifactId: e.activeArtifactId === M ? null : e.activeArtifactId,
663
+ isPanelOpen: e.activeArtifactId === M ? !1 : e.isPanelOpen,
664
+ openTabs: y,
665
+ tabViewModes: H
663
666
  }, r();
664
667
  }
665
- function u(y) {
666
- return e.artifacts.find((C) => C.id === y) || null;
668
+ function u(M) {
669
+ return e.artifacts.find((y) => y.id === M) || null;
667
670
  }
668
671
  function l() {
669
672
  return e.activeArtifactId ? u(e.activeArtifactId) : null;
670
673
  }
671
- function d(y) {
672
- const C = u(y);
673
- let x = e.tabViewModes[y];
674
- x || (x = (C == null ? void 0 : C.isPreviewable) === !1 ? "code" : "preview", C != null && C.tabs && !C.tabs.includes(x) && (x = C.tabs[0])), e = {
674
+ function d(M) {
675
+ const y = u(M);
676
+ let z = e.tabViewModes[M];
677
+ z || (z = (y == null ? void 0 : y.isPreviewable) === !1 ? "code" : "preview", y != null && y.tabs && !y.tabs.includes(z) && (z = y.tabs[0])), e = {
675
678
  ...e,
676
- activeArtifactId: y,
677
- viewMode: x
679
+ activeArtifactId: M,
680
+ viewMode: z,
681
+ forceEmptyView: !1
678
682
  }, r();
679
683
  }
680
684
  function p() {
@@ -683,80 +687,86 @@ function ta() {
683
687
  activeArtifactId: null
684
688
  }, r();
685
689
  }
686
- function w(y) {
690
+ function w(M) {
687
691
  e = {
688
692
  ...e,
689
- isPanelOpen: y,
690
- isFullscreen: y ? e.isFullscreen : !1
693
+ isPanelOpen: M,
694
+ isFullscreen: M ? e.isFullscreen : !1
691
695
  }, r();
692
696
  }
693
- function c(y) {
694
- if (!["preview", "code", "split", "edit"].includes(y)) {
695
- console.warn(`Invalid view mode: ${y}`);
697
+ function c(M) {
698
+ if (!["preview", "code", "split", "edit"].includes(M)) {
699
+ console.warn(`Invalid view mode: ${M}`);
696
700
  return;
697
701
  }
698
- const C = e.activeArtifactId ? { ...e.tabViewModes, [e.activeArtifactId]: y } : e.tabViewModes;
702
+ const y = e.activeArtifactId ? { ...e.tabViewModes, [e.activeArtifactId]: M } : e.tabViewModes;
703
+ e = {
704
+ ...e,
705
+ viewMode: M,
706
+ tabViewModes: y
707
+ }, r();
708
+ }
709
+ function m(M) {
699
710
  e = {
700
711
  ...e,
701
- viewMode: y,
702
- tabViewModes: C
712
+ isFullscreen: M
703
713
  }, r();
704
714
  }
705
- function m(y) {
715
+ function h(M) {
706
716
  e = {
707
717
  ...e,
708
- isFullscreen: y
718
+ forceEmptyView: !!M
709
719
  }, r();
710
720
  }
711
- function h(y) {
712
- return e.artifacts.filter((C) => C.messageId === y);
721
+ function g(M) {
722
+ return e.artifacts.filter((y) => y.messageId === M);
713
723
  }
714
- function g(y) {
715
- return e.artifacts.filter((C) => C.type === y);
724
+ function f(M) {
725
+ return e.artifacts.filter((y) => y.type === M);
716
726
  }
717
- function f() {
727
+ function b() {
718
728
  return e.artifacts.length;
719
729
  }
720
- function b(y) {
721
- const C = u(y);
722
- if (!C) return;
723
- const E = e.openTabs.includes(y) ? e.openTabs : [...e.openTabs, y];
724
- let T = e.tabViewModes[y];
725
- T || (T = C.isPreviewable === !1 ? "code" : "preview", C.tabs && !C.tabs.includes(T) && (T = C.tabs[0])), e = {
730
+ function v(M) {
731
+ const y = u(M);
732
+ if (!y) return;
733
+ const H = e.openTabs.includes(M) ? e.openTabs : [...e.openTabs, M];
734
+ let P = e.tabViewModes[M];
735
+ P || (P = y.isPreviewable === !1 ? "code" : "preview", y.tabs && !y.tabs.includes(P) && (P = y.tabs[0])), e = {
726
736
  ...e,
727
- openTabs: E,
728
- activeArtifactId: y,
729
- tabViewModes: { ...e.tabViewModes, [y]: T },
730
- viewMode: T
737
+ openTabs: H,
738
+ activeArtifactId: M,
739
+ tabViewModes: { ...e.tabViewModes, [M]: P },
740
+ viewMode: P
731
741
  }, r();
732
742
  }
733
- function v(y) {
734
- const C = e.openTabs.indexOf(y);
735
- if (C === -1) return;
736
- const x = e.openTabs.filter((G) => G !== y), { [y]: E, ...T } = e.tabViewModes;
737
- let L = e.activeArtifactId;
738
- e.activeArtifactId === y && (x.length === 0 ? L = null : C >= x.length ? L = x[x.length - 1] : L = x[C]);
739
- const I = L && T[L] || "preview";
743
+ function x(M) {
744
+ const y = e.openTabs.indexOf(M);
745
+ if (y === -1) return;
746
+ const z = e.openTabs.filter((K) => K !== M), { [M]: H, ...P } = e.tabViewModes;
747
+ let T = e.activeArtifactId;
748
+ e.activeArtifactId === M && (z.length === 0 ? T = null : y >= z.length ? T = z[z.length - 1] : T = z[y]);
749
+ const W = T && P[T] || "preview";
740
750
  e = {
741
751
  ...e,
742
- openTabs: x,
743
- activeArtifactId: L,
744
- tabViewModes: T,
745
- viewMode: I
752
+ openTabs: z,
753
+ activeArtifactId: T,
754
+ tabViewModes: P,
755
+ viewMode: W
746
756
  }, r();
747
757
  }
748
- function M(y) {
749
- if (!u(y)) return;
750
- const x = e.tabViewModes[y] || e.viewMode;
758
+ function $(M) {
759
+ if (!u(M)) return;
760
+ const z = e.tabViewModes[M] || e.viewMode;
751
761
  e = {
752
762
  ...e,
753
- openTabs: [y],
754
- activeArtifactId: y,
755
- tabViewModes: { [y]: x },
756
- viewMode: x
763
+ openTabs: [M],
764
+ activeArtifactId: M,
765
+ tabViewModes: { [M]: z },
766
+ viewMode: z
757
767
  }, r();
758
768
  }
759
- function $() {
769
+ function A() {
760
770
  e = {
761
771
  ...e,
762
772
  openTabs: [],
@@ -764,7 +774,7 @@ function ta() {
764
774
  tabViewModes: {}
765
775
  }, r();
766
776
  }
767
- function z() {
777
+ function C() {
768
778
  e = {
769
779
  artifacts: [],
770
780
  activeArtifactId: null,
@@ -772,22 +782,23 @@ function ta() {
772
782
  viewMode: "preview",
773
783
  isFullscreen: !1,
774
784
  openTabs: [],
775
- tabViewModes: {}
785
+ tabViewModes: {},
786
+ forceEmptyView: !1
776
787
  }, r();
777
788
  }
778
- function S(y) {
779
- const C = r;
780
- let x = !1;
781
- const E = () => {
782
- x = !0;
789
+ function R(M) {
790
+ const y = r;
791
+ let z = !1;
792
+ const H = () => {
793
+ z = !0;
783
794
  };
784
795
  try {
785
796
  Object.defineProperty(window, "__artifactuse_notify__", {
786
- value: E,
797
+ value: H,
787
798
  configurable: !0
788
- }), y();
799
+ }), M();
789
800
  } finally {
790
- delete window.__artifactuse_notify__, x && C();
801
+ delete window.__artifactuse_notify__, z && y();
791
802
  }
792
803
  }
793
804
  return {
@@ -800,23 +811,24 @@ function ta() {
800
811
  removeArtifact: i,
801
812
  getArtifact: u,
802
813
  getActiveArtifact: l,
803
- getArtifactsByMessageId: h,
804
- getArtifactsByType: g,
805
- getArtifactCount: f,
814
+ getArtifactsByMessageId: g,
815
+ getArtifactsByType: f,
816
+ getArtifactCount: b,
806
817
  // Panel state
807
818
  setActiveArtifact: d,
808
819
  clearActiveArtifact: p,
809
820
  setPanelOpen: w,
810
821
  setViewMode: c,
811
822
  setFullscreen: m,
823
+ setForceEmptyView: h,
812
824
  // Multi-tab
813
- openTab: b,
814
- closeTab: v,
815
- closeOtherTabs: M,
816
- closeAllTabs: $,
825
+ openTab: v,
826
+ closeTab: x,
827
+ closeOtherTabs: $,
828
+ closeAllTabs: A,
817
829
  // Utilities
818
- clear: z,
819
- batch: S
830
+ clear: C,
831
+ batch: R
820
832
  };
821
833
  }
822
834
  function ct(e) {
@@ -830,115 +842,115 @@ function ra(e = []) {
830
842
  const t = Array.isArray(e) ? e : [e].filter(Boolean), r = new Set(t), a = /* @__PURE__ */ new Map();
831
843
  let s = null, n = !1, o = !1;
832
844
  const i = [];
833
- function u(x) {
845
+ function u(y) {
834
846
  if (r.size === 0)
835
847
  return console.warn("Artifactuse bridge: No allowed origins configured, accepting all messages"), !0;
836
- const E = ct(x);
837
- if (!E) return !1;
838
- for (const T of r) {
839
- const L = ct(T);
840
- if (L && L === E || T === E)
848
+ const z = ct(y);
849
+ if (!z) return !1;
850
+ for (const H of r) {
851
+ const P = ct(H);
852
+ if (P && P === z || H === z)
841
853
  return !0;
842
854
  }
843
855
  return !1;
844
856
  }
845
- function l(x) {
846
- var U, k, _;
847
- if (((U = x.data) == null ? void 0 : U.type) === "artifactuse" && (console.log("[Bridge] Message from:", x.origin, "action:", (k = x.data) == null ? void 0 : k.action), console.log("[Bridge] Allowed origins:", w())), !u(x.origin)) {
848
- ((_ = x.data) == null ? void 0 : _.type) === "artifactuse" && console.warn("[Bridge] Origin NOT allowed:", x.origin);
857
+ function l(y) {
858
+ var U, J, k;
859
+ if (((U = y.data) == null ? void 0 : U.type) === "artifactuse" && (console.log("[Bridge] Message from:", y.origin, "action:", (J = y.data) == null ? void 0 : J.action), console.log("[Bridge] Allowed origins:", w())), !u(y.origin)) {
860
+ ((k = y.data) == null ? void 0 : k.type) === "artifactuse" && console.warn("[Bridge] Origin NOT allowed:", y.origin);
849
861
  return;
850
862
  }
851
- const { type: E, action: T, data: L, requestId: I } = x.data || {};
852
- if (E !== "artifactuse") return;
853
- if (T === "ready" || T === "panel:ready") {
863
+ const { type: z, action: H, data: P, requestId: T } = y.data || {};
864
+ if (z !== "artifactuse") return;
865
+ if (H === "ready" || H === "panel:ready") {
854
866
  console.log("[Bridge] panel:ready received, setting isReady=true"), n = !0, o = !0, m();
855
867
  return;
856
868
  }
857
- (a.get(T) || []).forEach((R) => {
869
+ (a.get(H) || []).forEach((_) => {
858
870
  try {
859
- R(L, I);
860
- } catch (A) {
861
- console.error(`Artifactuse bridge handler error (${T}):`, A);
871
+ _(P, T);
872
+ } catch (L) {
873
+ console.error(`Artifactuse bridge handler error (${H}):`, L);
862
874
  }
863
- }), (a.get("*") || []).forEach((R) => {
875
+ }), (a.get("*") || []).forEach((_) => {
864
876
  try {
865
- R({ action: T, data: L, requestId: I });
866
- } catch (A) {
867
- console.error("Artifactuse bridge wildcard handler error:", A);
877
+ _({ action: H, data: P, requestId: T });
878
+ } catch (L) {
879
+ console.error("Artifactuse bridge wildcard handler error:", L);
868
880
  }
869
881
  });
870
882
  }
871
883
  window.addEventListener("message", l);
872
- function d(x) {
873
- x && typeof x == "string" && r.add(x);
884
+ function d(y) {
885
+ y && typeof y == "string" && r.add(y);
874
886
  }
875
- function p(x) {
876
- x && typeof x == "string" && r.delete(x);
887
+ function p(y) {
888
+ y && typeof y == "string" && r.delete(y);
877
889
  }
878
890
  function w() {
879
891
  return [...r];
880
892
  }
881
- function c(x) {
882
- console.log("[Bridge] setIframe called, current isReady:", n, "readySignalReceived:", o, "same iframe:", s === x), s !== x && (s = x, o ? (console.log("[Bridge] Ready signal was already received, keeping isReady=true"), n = !0) : n = !1), console.log("[Bridge] setIframe done, isReady:", n, "pendingMessages:", i.length), m();
893
+ function c(y) {
894
+ console.log("[Bridge] setIframe called, current isReady:", n, "readySignalReceived:", o, "same iframe:", s === y), s !== y && (s = y, o ? (console.log("[Bridge] Ready signal was already received, keeping isReady=true"), n = !0) : n = !1), console.log("[Bridge] setIframe done, isReady:", n, "pendingMessages:", i.length), m();
883
895
  }
884
896
  function m() {
885
- console.log("[Bridge] flushPendingMessages: isReady=", n, "hasIframe=", !!(s != null && s.contentWindow), "pending=", i.length), n && (s != null && s.contentWindow) && i.length > 0 && (console.log("[Bridge] Flushing", i.length, "pending messages"), i.forEach((x) => h(x)), i.length = 0);
897
+ console.log("[Bridge] flushPendingMessages: isReady=", n, "hasIframe=", !!(s != null && s.contentWindow), "pending=", i.length), n && (s != null && s.contentWindow) && i.length > 0 && (console.log("[Bridge] Flushing", i.length, "pending messages"), i.forEach((y) => h(y)), i.length = 0);
886
898
  }
887
- function h(x, E = "*") {
899
+ function h(y, z = "*") {
888
900
  if (!(s != null && s.contentWindow))
889
901
  return console.warn("Artifactuse: No panel iframe available"), !1;
890
902
  try {
891
- return s.contentWindow.postMessage(x, E), !0;
892
- } catch (T) {
893
- return console.error("Artifactuse bridge send error:", T), !1;
903
+ return s.contentWindow.postMessage(y, z), !0;
904
+ } catch (H) {
905
+ return console.error("Artifactuse bridge send error:", H), !1;
894
906
  }
895
907
  }
896
- function g(x, E, T = null, L = "*") {
897
- const I = {
908
+ function g(y, z, H = null, P = "*") {
909
+ const T = {
898
910
  type: "artifactuse",
899
- action: x,
900
- data: E,
901
- requestId: T || ut(),
911
+ action: y,
912
+ data: z,
913
+ requestId: H || ut(),
902
914
  timestamp: Date.now()
903
915
  };
904
- return n ? (h(I, L), I.requestId) : (i.push(I), I.requestId);
905
- }
906
- function f(x, E, T = 3e4) {
907
- return new Promise((L, I) => {
908
- const G = ut(), te = setTimeout(() => {
909
- v(`${x}:response`, U), I(new Error(`Artifactuse bridge request timeout: ${x}`));
910
- }, T), U = (k, _) => {
911
- _ === G && (clearTimeout(te), v(`${x}:response`, U), L(k));
916
+ return n ? (h(T, P), T.requestId) : (i.push(T), T.requestId);
917
+ }
918
+ function f(y, z, H = 3e4) {
919
+ return new Promise((P, T) => {
920
+ const W = ut(), K = setTimeout(() => {
921
+ v(`${y}:response`, U), T(new Error(`Artifactuse bridge request timeout: ${y}`));
922
+ }, H), U = (J, k) => {
923
+ k === W && (clearTimeout(K), v(`${y}:response`, U), P(J));
912
924
  };
913
- b(`${x}:response`, U), g(x, E, G);
925
+ b(`${y}:response`, U), g(y, z, W);
914
926
  });
915
927
  }
916
- function b(x, E) {
917
- return a.has(x) || a.set(x, []), a.get(x).push(E), () => v(x, E);
928
+ function b(y, z) {
929
+ return a.has(y) || a.set(y, []), a.get(y).push(z), () => v(y, z);
918
930
  }
919
- function v(x, E) {
920
- const T = a.get(x);
921
- if (T) {
922
- const L = T.indexOf(E);
923
- L > -1 && T.splice(L, 1);
931
+ function v(y, z) {
932
+ const H = a.get(y);
933
+ if (H) {
934
+ const P = H.indexOf(z);
935
+ P > -1 && H.splice(P, 1);
924
936
  }
925
937
  }
926
- function M(x) {
927
- return g("load:artifact", x);
938
+ function x(y) {
939
+ return g("load:artifact", y);
928
940
  }
929
- function $(x, E) {
930
- return g("update:artifact", { artifactId: x, updates: E });
941
+ function $(y, z) {
942
+ return g("update:artifact", { artifactId: y, updates: z });
931
943
  }
932
- function z() {
944
+ function A() {
933
945
  return f("save", {});
934
946
  }
935
- function S(x = "default") {
936
- return f("export", { format: x });
947
+ function C(y = "default") {
948
+ return f("export", { format: y });
937
949
  }
938
- function y(x, E) {
939
- return g("ai:response", x, E);
950
+ function R(y, z) {
951
+ return g("ai:response", y, z);
940
952
  }
941
- function C() {
953
+ function M() {
942
954
  window.removeEventListener("message", l), a.clear(), r.clear(), s = null, n = !1, o = !1, i.length = 0;
943
955
  }
944
956
  return {
@@ -947,12 +959,12 @@ function ra(e = []) {
947
959
  request: f,
948
960
  on: b,
949
961
  off: v,
950
- loadArtifact: M,
962
+ loadArtifact: x,
951
963
  updateArtifact: $,
952
- requestSave: z,
953
- requestExport: S,
954
- sendAIResponse: y,
955
- destroy: C,
964
+ requestSave: A,
965
+ requestExport: C,
966
+ sendAIResponse: R,
967
+ destroy: M,
956
968
  // Origin management
957
969
  addAllowedOrigin: d,
958
970
  removeAllowedOrigin: p,
@@ -1606,7 +1618,7 @@ function fa(e = {}) {
1606
1618
  return r === "auto" ? w === "dark" : r === "dark";
1607
1619
  }
1608
1620
  function d(w, c = {}) {
1609
- var be, ie;
1621
+ var B, be;
1610
1622
  if (!a())
1611
1623
  return console.warn("Artifactuse: CodeMirror modules not provided. Editor not available."), null;
1612
1624
  const { EditorState: m } = t.state, {
@@ -1615,79 +1627,79 @@ function fa(e = {}) {
1615
1627
  lineNumbers: f,
1616
1628
  highlightActiveLineGutter: b,
1617
1629
  highlightSpecialChars: v,
1618
- drawSelection: M,
1630
+ drawSelection: x,
1619
1631
  dropCursor: $,
1620
- rectangularSelection: z,
1621
- crosshairCursor: S,
1622
- highlightActiveLine: y
1623
- } = t.view, { defaultKeymap: C, history: x, historyKeymap: E, indentWithTab: T } = t.commands, {
1624
- indentOnInput: L,
1625
- syntaxHighlighting: I,
1626
- bracketMatching: G,
1627
- foldGutter: te,
1632
+ rectangularSelection: A,
1633
+ crosshairCursor: C,
1634
+ highlightActiveLine: R
1635
+ } = t.view, { defaultKeymap: M, history: y, historyKeymap: z, indentWithTab: H } = t.commands, {
1636
+ indentOnInput: P,
1637
+ syntaxHighlighting: T,
1638
+ bracketMatching: W,
1639
+ foldGutter: K,
1628
1640
  foldKeymap: U,
1629
- HighlightStyle: k
1641
+ HighlightStyle: J
1630
1642
  } = t.language, {
1631
- closeBrackets: _,
1632
- closeBracketsKeymap: R,
1633
- autocompletion: A,
1634
- completionKeymap: D
1635
- } = t.autocomplete, P = ((be = t.lezerHighlight) == null ? void 0 : be.tags) || ((ie = t.language) == null ? void 0 : ie.tags), Z = l(c.sdkTheme), ne = Z ? s(h) : n(h), re = [
1643
+ closeBrackets: k,
1644
+ closeBracketsKeymap: _,
1645
+ autocompletion: L,
1646
+ completionKeymap: S
1647
+ } = t.autocomplete, D = ((B = t.lezerHighlight) == null ? void 0 : B.tags) || ((be = t.language) == null ? void 0 : be.tags), E = l(c.sdkTheme), Z = E ? s(h) : n(h), ne = [
1636
1648
  f(),
1637
1649
  b(),
1638
1650
  v(),
1639
- x(),
1640
- te({
1651
+ y(),
1652
+ K({
1641
1653
  openText: "▾",
1642
1654
  closedText: "▸"
1643
1655
  }),
1644
- M(),
1656
+ x(),
1645
1657
  $(),
1646
1658
  m.allowMultipleSelections.of(!0),
1659
+ P(),
1660
+ ...D ? [T(o(J, D, E))] : [],
1661
+ W(),
1662
+ k(),
1647
1663
  L(),
1648
- ...P ? [I(o(k, P, Z))] : [],
1649
- G(),
1650
- _(),
1651
1664
  A(),
1652
- z(),
1653
- S(),
1654
- y(),
1665
+ C(),
1666
+ R(),
1655
1667
  g.of([
1656
- ...R,
1657
- ...C,
1658
- ...E,
1668
+ ..._,
1669
+ ...M,
1670
+ ...z,
1659
1671
  ...U,
1660
- ...D,
1661
- T
1672
+ ...S,
1673
+ H
1662
1674
  ]),
1663
1675
  u(c.language),
1664
- ne
1676
+ Z
1665
1677
  ];
1666
- c.onChange && re.push(
1667
- h.updateListener.of((oe) => {
1668
- oe.docChanged && c.onChange(oe.state.doc.toString());
1678
+ c.onChange && ne.push(
1679
+ h.updateListener.of((Q) => {
1680
+ Q.docChanged && c.onChange(Q.state.doc.toString());
1669
1681
  })
1670
1682
  );
1671
- const ae = m.create({
1683
+ const oe = m.create({
1672
1684
  doc: c.code || "",
1673
- extensions: re
1674
- }), O = new h({
1675
- state: ae,
1685
+ extensions: ne
1686
+ }), G = new h({
1687
+ state: oe,
1676
1688
  parent: w
1677
1689
  });
1678
1690
  return {
1679
- view: O,
1691
+ view: G,
1680
1692
  getCode() {
1681
- return O.state.doc.toString();
1693
+ return G.state.doc.toString();
1682
1694
  },
1683
- setCode(oe) {
1684
- const it = O.state.doc.toString();
1685
- it !== oe && O.dispatch({
1686
- changes: { from: 0, to: it.length, insert: oe }
1695
+ setCode(Q) {
1696
+ const it = G.state.doc.toString();
1697
+ it !== Q && G.dispatch({
1698
+ changes: { from: 0, to: it.length, insert: Q }
1687
1699
  });
1688
1700
  },
1689
1701
  destroy() {
1690
- O.destroy();
1702
+ G.destroy();
1691
1703
  }
1692
1704
  };
1693
1705
  }
@@ -1703,9 +1715,9 @@ function fa(e = {}) {
1703
1715
  function Ke() {
1704
1716
  return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
1705
1717
  }
1706
- var ee = Ke();
1718
+ var se = Ke();
1707
1719
  function mr(e) {
1708
- ee = e;
1720
+ se = e;
1709
1721
  }
1710
1722
  var he = { exec: () => null };
1711
1723
  function j(e, t = "") {
@@ -1721,9 +1733,9 @@ var ha = (() => {
1721
1733
  } catch {
1722
1734
  return !1;
1723
1735
  }
1724
- })(), q = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e) => new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}#`), htmlBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i") }, ga = /^(?:[ \t]*(?:\n|$))+/, ma = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, wa = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, me = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ba = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, wr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, br = j(wr).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), va = j(wr).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Qe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ya = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ka = j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), xa = j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Je).getRegex(), Te = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", et = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ma = j("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", et).replace("tag", Te).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), vr = j(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex(), $a = j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", vr).getRegex(), tt = { blockquote: $a, code: ma, def: ka, fences: wa, heading: ba, hr: me, html: Ma, lheading: br, list: xa, newline: ga, paragraph: vr, table: he, text: ya }, pt = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex(), za = { ...tt, lheading: va, table: pt, paragraph: j(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", pt).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex() }, Aa = { ...tt, html: j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", et).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: he, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: j(Qe).replace("hr", me).replace("heading", ` *#{1,6} *[^
1725
- ]`).replace("lheading", br).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Sa = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ca = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, yr = /^( {2,}|\\)\n(?!\s*$)/, Ra = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, _e = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, kr = /[^\s\p{P}\p{S}]/u, La = j(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), xr = /(?!~)[\p{P}\p{S}]/u, Ta = /(?!~)[\s\p{P}\p{S}]/u, _a = /(?:[^\s\p{P}\p{S}]|~)/u, Ea = j(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ha ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Mr = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Pa = j(Mr, "u").replace(/punct/g, _e).getRegex(), ja = j(Mr, "u").replace(/punct/g, xr).getRegex(), $r = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ha = j($r, "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, _e).getRegex(), Va = j($r, "gu").replace(/notPunctSpace/g, _a).replace(/punctSpace/g, Ta).replace(/punct/g, xr).getRegex(), Ia = j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, _e).getRegex(), Da = j(/\\(punct)/, "gu").replace(/punct/g, _e).getRegex(), qa = j(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Za = j(et).replace("(?:-->|$)", "-->").getRegex(), Oa = j("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Za).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), $e = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ba = j(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", $e).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), zr = j(/^!?\[(label)\]\[(ref)\]/).replace("label", $e).replace("ref", Ye).getRegex(), Ar = j(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Fa = j("reflink|nolink(?!\\()", "g").replace("reflink", zr).replace("nolink", Ar).getRegex(), ft = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: he, anyPunctuation: Da, autolink: qa, blockSkip: Ea, br: yr, code: Ca, del: he, emStrongLDelim: Pa, emStrongRDelimAst: Ha, emStrongRDelimUnd: Ia, escape: Sa, link: Ba, nolink: Ar, punctuation: La, reflink: zr, reflinkSearch: Fa, tag: Oa, text: Ra, url: he }, Na = { ...at, link: j(/^!?\[(label)\]\((.*?)\)/).replace("label", $e).getRegex(), reflink: j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", $e).getRegex() }, Ve = { ...at, emStrongRDelimAst: Va, emStrongLDelim: ja, url: j(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ft).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: j(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ft).getRegex() }, Ua = { ...Ve, br: j(yr).replace("{2,}", "*").getRegex(), text: j(Ve.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ye = { normal: tt, gfm: za, pedantic: Aa }, ce = { normal: at, gfm: Ve, breaks: Ua, pedantic: Na }, Ga = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ht = (e) => Ga[e];
1726
- function W(e, t) {
1736
+ })(), q = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e) => new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}#`), htmlBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i") }, ga = /^(?:[ \t]*(?:\n|$))+/, ma = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, wa = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, me = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ba = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Je = /(?:[*+-]|\d{1,9}[.)])/, wr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, br = j(wr).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), va = j(wr).replace(/bull/g, Je).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Qe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ya = /^[^\n]+/, Ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ka = j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ye).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), xa = j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Je).getRegex(), Te = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", et = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ma = j("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", et).replace("tag", Te).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), vr = j(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex(), $a = j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", vr).getRegex(), tt = { blockquote: $a, code: ma, def: ka, fences: wa, heading: ba, hr: me, html: Ma, lheading: br, list: xa, newline: ga, paragraph: vr, table: he, text: ya }, pt = j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex(), Aa = { ...tt, lheading: va, table: pt, paragraph: j(Qe).replace("hr", me).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", pt).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Te).getRegex() }, za = { ...tt, html: j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", et).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: he, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: j(Qe).replace("hr", me).replace("heading", ` *#{1,6} *[^
1737
+ ]`).replace("lheading", br).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Sa = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ca = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, yr = /^( {2,}|\\)\n(?!\s*$)/, Ra = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, _e = /[\p{P}\p{S}]/u, rt = /[\s\p{P}\p{S}]/u, kr = /[^\s\p{P}\p{S}]/u, La = j(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, rt).getRegex(), xr = /(?!~)[\p{P}\p{S}]/u, Ta = /(?!~)[\s\p{P}\p{S}]/u, _a = /(?:[^\s\p{P}\p{S}]|~)/u, Ea = j(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ha ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Mr = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Pa = j(Mr, "u").replace(/punct/g, _e).getRegex(), ja = j(Mr, "u").replace(/punct/g, xr).getRegex(), $r = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ha = j($r, "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, _e).getRegex(), Va = j($r, "gu").replace(/notPunctSpace/g, _a).replace(/punctSpace/g, Ta).replace(/punct/g, xr).getRegex(), Ia = j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, kr).replace(/punctSpace/g, rt).replace(/punct/g, _e).getRegex(), Da = j(/\\(punct)/, "gu").replace(/punct/g, _e).getRegex(), qa = j(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Za = j(et).replace("(?:-->|$)", "-->").getRegex(), Oa = j("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Za).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), $e = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ba = j(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", $e).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Ar = j(/^!?\[(label)\]\[(ref)\]/).replace("label", $e).replace("ref", Ye).getRegex(), zr = j(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ye).getRegex(), Fa = j("reflink|nolink(?!\\()", "g").replace("reflink", Ar).replace("nolink", zr).getRegex(), ft = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, at = { _backpedal: he, anyPunctuation: Da, autolink: qa, blockSkip: Ea, br: yr, code: Ca, del: he, emStrongLDelim: Pa, emStrongRDelimAst: Ha, emStrongRDelimUnd: Ia, escape: Sa, link: Ba, nolink: zr, punctuation: La, reflink: Ar, reflinkSearch: Fa, tag: Oa, text: Ra, url: he }, Na = { ...at, link: j(/^!?\[(label)\]\((.*?)\)/).replace("label", $e).getRegex(), reflink: j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", $e).getRegex() }, Ve = { ...at, emStrongRDelimAst: Va, emStrongLDelim: ja, url: j(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ft).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: j(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ft).getRegex() }, Ua = { ...Ve, br: j(yr).replace("{2,}", "*").getRegex(), text: j(Ve.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ye = { normal: tt, gfm: Aa, pedantic: za }, ce = { normal: at, gfm: Ve, breaks: Ua, pedantic: Na }, Ga = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ht = (e) => Ga[e];
1738
+ function X(e, t) {
1727
1739
  if (t) {
1728
1740
  if (q.escapeTest.test(e)) return e.replace(q.escapeReplace, ht);
1729
1741
  } else if (q.escapeTestNoEncode.test(e)) return e.replace(q.escapeReplaceNoEncode, ht);
@@ -1784,12 +1796,12 @@ function Xa(e, t, r) {
1784
1796
  }).join(`
1785
1797
  `);
1786
1798
  }
1787
- var ze = class {
1799
+ var Ae = class {
1788
1800
  constructor(e) {
1789
- V(this, "options");
1790
- V(this, "rules");
1791
- V(this, "lexer");
1792
- this.options = e || ee;
1801
+ I(this, "options");
1802
+ I(this, "rules");
1803
+ I(this, "lexer");
1804
+ this.options = e || se;
1793
1805
  }
1794
1806
  space(e) {
1795
1807
  let t = this.rules.block.newline.exec(e);
@@ -1882,20 +1894,20 @@ ${d}` : d;
1882
1894
  `, 1)[0], h = !c.trim(), g = 0;
1883
1895
  if (this.options.pedantic ? (g = 2, w = c.trimStart()) : h ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, w = c.slice(g), g += t[1].length), h && this.rules.other.blankLine.test(m) && (p += m + `
1884
1896
  `, e = e.substring(m.length + 1), d = !0), !d) {
1885
- let f = this.rules.other.nextBulletRegex(g), b = this.rules.other.hrRegex(g), v = this.rules.other.fencesBeginRegex(g), M = this.rules.other.headingBeginRegex(g), $ = this.rules.other.htmlBeginRegex(g);
1897
+ let f = this.rules.other.nextBulletRegex(g), b = this.rules.other.hrRegex(g), v = this.rules.other.fencesBeginRegex(g), x = this.rules.other.headingBeginRegex(g), $ = this.rules.other.htmlBeginRegex(g);
1886
1898
  for (; e; ) {
1887
- let z = e.split(`
1888
- `, 1)[0], S;
1889
- if (m = z, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), S = m) : S = m.replace(this.rules.other.tabCharGlobal, " "), v.test(m) || M.test(m) || $.test(m) || f.test(m) || b.test(m)) break;
1890
- if (S.search(this.rules.other.nonSpaceChar) >= g || !m.trim()) w += `
1891
- ` + S.slice(g);
1899
+ let A = e.split(`
1900
+ `, 1)[0], C;
1901
+ if (m = A, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), C = m) : C = m.replace(this.rules.other.tabCharGlobal, " "), v.test(m) || x.test(m) || $.test(m) || f.test(m) || b.test(m)) break;
1902
+ if (C.search(this.rules.other.nonSpaceChar) >= g || !m.trim()) w += `
1903
+ ` + C.slice(g);
1892
1904
  else {
1893
- if (h || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(c) || M.test(c) || b.test(c)) break;
1905
+ if (h || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(c) || x.test(c) || b.test(c)) break;
1894
1906
  w += `
1895
1907
  ` + m;
1896
1908
  }
1897
- !h && !m.trim() && (h = !0), p += z + `
1898
- `, e = e.substring(z.length + 1), c = S.slice(g);
1909
+ !h && !m.trim() && (h = !0), p += A + `
1910
+ `, e = e.substring(A.length + 1), c = C.slice(g);
1899
1911
  }
1900
1912
  }
1901
1913
  o.loose || (u ? o.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (u = !0)), o.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(w), loose: !1, text: w, tokens: [] }), o.raw += p;
@@ -2086,12 +2098,12 @@ ${d}` : d;
2086
2098
  }
2087
2099
  }, F = class Ie {
2088
2100
  constructor(t) {
2089
- V(this, "tokens");
2090
- V(this, "options");
2091
- V(this, "state");
2092
- V(this, "inlineQueue");
2093
- V(this, "tokenizer");
2094
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || ee, this.options.tokenizer = this.options.tokenizer || new ze(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
2101
+ I(this, "tokens");
2102
+ I(this, "options");
2103
+ I(this, "state");
2104
+ I(this, "inlineQueue");
2105
+ I(this, "tokenizer");
2106
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || se, this.options.tokenizer = this.options.tokenizer || new Ae(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
2095
2107
  let r = { other: q, block: ye.normal, inline: ce.normal };
2096
2108
  this.options.pedantic ? (r.block = ye.pedantic, r.inline = ce.pedantic) : this.options.gfm && (r.block = ye.gfm, this.options.breaks ? r.inline = ce.breaks : r.inline = ce.gfm), this.tokenizer.rules = r;
2097
2109
  }
@@ -2293,11 +2305,11 @@ ${d}` : d;
2293
2305
  }
2294
2306
  return r;
2295
2307
  }
2296
- }, Ae = class {
2308
+ }, ze = class {
2297
2309
  constructor(e) {
2298
- V(this, "options");
2299
- V(this, "parser");
2300
- this.options = e || ee;
2310
+ I(this, "options");
2311
+ I(this, "parser");
2312
+ this.options = e || se;
2301
2313
  }
2302
2314
  space(e) {
2303
2315
  return "";
@@ -2306,8 +2318,8 @@ ${d}` : d;
2306
2318
  var n;
2307
2319
  let a = (n = (t || "").match(q.notSpaceStart)) == null ? void 0 : n[0], s = e.replace(q.endingNewline, "") + `
2308
2320
  `;
2309
- return a ? '<pre><code class="language-' + W(a) + '">' + (r ? s : W(s, !0)) + `</code></pre>
2310
- ` : "<pre><code>" + (r ? s : W(s, !0)) + `</code></pre>
2321
+ return a ? '<pre><code class="language-' + X(a) + '">' + (r ? s : X(s, !0)) + `</code></pre>
2322
+ ` : "<pre><code>" + (r ? s : X(s, !0)) + `</code></pre>
2311
2323
  `;
2312
2324
  }
2313
2325
  blockquote({ tokens: e }) {
@@ -2385,7 +2397,7 @@ ${e}</tr>
2385
2397
  return `<em>${this.parser.parseInline(e)}</em>`;
2386
2398
  }
2387
2399
  codespan({ text: e }) {
2388
- return `<code>${W(e, !0)}</code>`;
2400
+ return `<code>${X(e, !0)}</code>`;
2389
2401
  }
2390
2402
  br(e) {
2391
2403
  return "<br>";
@@ -2398,18 +2410,18 @@ ${e}</tr>
2398
2410
  if (s === null) return a;
2399
2411
  e = s;
2400
2412
  let n = '<a href="' + e + '"';
2401
- return t && (n += ' title="' + W(t) + '"'), n += ">" + a + "</a>", n;
2413
+ return t && (n += ' title="' + X(t) + '"'), n += ">" + a + "</a>", n;
2402
2414
  }
2403
2415
  image({ href: e, title: t, text: r, tokens: a }) {
2404
2416
  a && (r = this.parser.parseInline(a, this.parser.textRenderer));
2405
2417
  let s = gt(e);
2406
- if (s === null) return W(r);
2418
+ if (s === null) return X(r);
2407
2419
  e = s;
2408
2420
  let n = `<img src="${e}" alt="${r}"`;
2409
- return t && (n += ` title="${W(t)}"`), n += ">", n;
2421
+ return t && (n += ` title="${X(t)}"`), n += ">", n;
2410
2422
  }
2411
2423
  text(e) {
2412
- return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : W(e.text);
2424
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : X(e.text);
2413
2425
  }
2414
2426
  }, st = class {
2415
2427
  strong({ text: e }) {
@@ -2444,10 +2456,10 @@ ${e}</tr>
2444
2456
  }
2445
2457
  }, N = class De {
2446
2458
  constructor(t) {
2447
- V(this, "options");
2448
- V(this, "renderer");
2449
- V(this, "textRenderer");
2450
- this.options = t || ee, this.options.renderer = this.options.renderer || new Ae(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new st();
2459
+ I(this, "options");
2460
+ I(this, "renderer");
2461
+ I(this, "textRenderer");
2462
+ this.options = t || se, this.options.renderer = this.options.renderer || new ze(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new st();
2451
2463
  }
2452
2464
  static parse(t, r) {
2453
2465
  return new De(r).parse(t);
@@ -2595,9 +2607,9 @@ ${e}</tr>
2595
2607
  }
2596
2608
  }, xe, pe = (xe = class {
2597
2609
  constructor(e) {
2598
- V(this, "options");
2599
- V(this, "block");
2600
- this.options = e || ee;
2610
+ I(this, "options");
2611
+ I(this, "block");
2612
+ this.options = e || se;
2601
2613
  }
2602
2614
  preprocess(e) {
2603
2615
  return e;
@@ -2617,18 +2629,18 @@ ${e}</tr>
2617
2629
  provideParser() {
2618
2630
  return this.block ? N.parse : N.parseInline;
2619
2631
  }
2620
- }, V(xe, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), V(xe, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), xe), Ka = class {
2632
+ }, I(xe, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(xe, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), xe), Ka = class {
2621
2633
  constructor(...e) {
2622
- V(this, "defaults", Ke());
2623
- V(this, "options", this.setOptions);
2624
- V(this, "parse", this.parseMarkdown(!0));
2625
- V(this, "parseInline", this.parseMarkdown(!1));
2626
- V(this, "Parser", N);
2627
- V(this, "Renderer", Ae);
2628
- V(this, "TextRenderer", st);
2629
- V(this, "Lexer", F);
2630
- V(this, "Tokenizer", ze);
2631
- V(this, "Hooks", pe);
2634
+ I(this, "defaults", Ke());
2635
+ I(this, "options", this.setOptions);
2636
+ I(this, "parse", this.parseMarkdown(!0));
2637
+ I(this, "parseInline", this.parseMarkdown(!1));
2638
+ I(this, "Parser", N);
2639
+ I(this, "Renderer", ze);
2640
+ I(this, "TextRenderer", st);
2641
+ I(this, "Lexer", F);
2642
+ I(this, "Tokenizer", Ae);
2643
+ I(this, "Hooks", pe);
2632
2644
  this.use(...e);
2633
2645
  }
2634
2646
  walkTokens(e, t) {
@@ -2676,7 +2688,7 @@ ${e}</tr>
2676
2688
  }
2677
2689
  "childTokens" in s && s.childTokens && (t.childTokens[s.name] = s.childTokens);
2678
2690
  }), a.extensions = t), r.renderer) {
2679
- let s = this.defaults.renderer || new Ae(this.defaults);
2691
+ let s = this.defaults.renderer || new ze(this.defaults);
2680
2692
  for (let n in r.renderer) {
2681
2693
  if (!(n in s)) throw new Error(`renderer '${n}' does not exist`);
2682
2694
  if (["options", "parser"].includes(n)) continue;
@@ -2689,7 +2701,7 @@ ${e}</tr>
2689
2701
  a.renderer = s;
2690
2702
  }
2691
2703
  if (r.tokenizer) {
2692
- let s = this.defaults.tokenizer || new ze(this.defaults);
2704
+ let s = this.defaults.tokenizer || new Ae(this.defaults);
2693
2705
  for (let n in r.tokenizer) {
2694
2706
  if (!(n in s)) throw new Error(`tokenizer '${n}' does not exist`);
2695
2707
  if (["options", "rules", "lexer"].includes(n)) continue;
@@ -2771,43 +2783,43 @@ ${e}</tr>
2771
2783
  return (r) => {
2772
2784
  if (r.message += `
2773
2785
  Please report this to https://github.com/markedjs/marked.`, e) {
2774
- let a = "<p>An error occurred:</p><pre>" + W(r.message + "", !0) + "</pre>";
2786
+ let a = "<p>An error occurred:</p><pre>" + X(r.message + "", !0) + "</pre>";
2775
2787
  return t ? Promise.resolve(a) : a;
2776
2788
  }
2777
2789
  if (t) return Promise.reject(r);
2778
2790
  throw r;
2779
2791
  };
2780
2792
  }
2781
- }, Q = new Ka();
2782
- function H(e, t) {
2783
- return Q.parse(e, t);
2793
+ }, re = new Ka();
2794
+ function V(e, t) {
2795
+ return re.parse(e, t);
2784
2796
  }
2785
- H.options = H.setOptions = function(e) {
2786
- return Q.setOptions(e), H.defaults = Q.defaults, mr(H.defaults), H;
2797
+ V.options = V.setOptions = function(e) {
2798
+ return re.setOptions(e), V.defaults = re.defaults, mr(V.defaults), V;
2787
2799
  };
2788
- H.getDefaults = Ke;
2789
- H.defaults = ee;
2790
- H.use = function(...e) {
2791
- return Q.use(...e), H.defaults = Q.defaults, mr(H.defaults), H;
2800
+ V.getDefaults = Ke;
2801
+ V.defaults = se;
2802
+ V.use = function(...e) {
2803
+ return re.use(...e), V.defaults = re.defaults, mr(V.defaults), V;
2792
2804
  };
2793
- H.walkTokens = function(e, t) {
2794
- return Q.walkTokens(e, t);
2805
+ V.walkTokens = function(e, t) {
2806
+ return re.walkTokens(e, t);
2795
2807
  };
2796
- H.parseInline = Q.parseInline;
2797
- H.Parser = N;
2798
- H.parser = N.parse;
2799
- H.Renderer = Ae;
2800
- H.TextRenderer = st;
2801
- H.Lexer = F;
2802
- H.lexer = F.lex;
2803
- H.Tokenizer = ze;
2804
- H.Hooks = pe;
2805
- H.parse = H;
2806
- H.options;
2807
- H.setOptions;
2808
- H.use;
2809
- H.walkTokens;
2810
- H.parseInline;
2808
+ V.parseInline = re.parseInline;
2809
+ V.Parser = N;
2810
+ V.parser = N.parse;
2811
+ V.Renderer = ze;
2812
+ V.TextRenderer = st;
2813
+ V.Lexer = F;
2814
+ V.lexer = F.lex;
2815
+ V.Tokenizer = Ae;
2816
+ V.Hooks = pe;
2817
+ V.parse = V;
2818
+ V.options;
2819
+ V.setOptions;
2820
+ V.use;
2821
+ V.walkTokens;
2822
+ V.parseInline;
2811
2823
  N.parse;
2812
2824
  F.lex;
2813
2825
  const Ja = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
@@ -3089,54 +3101,54 @@ function cs() {
3089
3101
  }
3090
3102
  function us(e, t = {}) {
3091
3103
  const r = t.theme || "dark", a = [];
3092
- e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (z) => {
3093
- const S = `__PROTECTED_${a.length}__`;
3094
- return a.push(z), S;
3095
- }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (z) => {
3096
- const S = `__PROTECTED_${a.length}__`;
3097
- return a.push(z), S;
3098
- }), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (z) => {
3099
- const S = `__PROTECTED_${a.length}__`;
3100
- return a.push(z), S;
3104
+ e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (A) => {
3105
+ const C = `__PROTECTED_${a.length}__`;
3106
+ return a.push(A), C;
3107
+ }), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (A) => {
3108
+ const C = `__PROTECTED_${a.length}__`;
3109
+ return a.push(A), C;
3110
+ }), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (A) => {
3111
+ const C = `__PROTECTED_${a.length}__`;
3112
+ return a.push(A), C;
3101
3113
  });
3102
3114
  const s = /<a[^>]*href="(https?:\/\/[^"]+\.(mp3|wav|flac|aac|ogg|m4a|wma)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
3103
- e = e.replace(s, (z, S) => vt(S));
3115
+ e = e.replace(s, (A, C) => vt(C));
3104
3116
  const n = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp3|wav|flac|aac|ogg|m4a|wma)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
3105
- e = e.replace(n, (z, S) => vt(S));
3117
+ e = e.replace(n, (A, C) => vt(C));
3106
3118
  const o = /<a[^>]*href="(https?:\/\/(?:www\.)?soundcloud\.com\/[^"]+)"[^>]*>[^<]*<\/a>/gi;
3107
- e = e.replace(o, (z, S) => yt(S));
3119
+ e = e.replace(o, (A, C) => yt(C));
3108
3120
  const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?soundcloud\\.com\\/[^\\s<>"]+)(?!["'])`, "gi");
3109
- e = e.replace(i, (z, S) => yt(S));
3121
+ e = e.replace(i, (A, C) => yt(C));
3110
3122
  const u = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/track\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3111
- e = e.replace(u, (z, S, y) => B("track", y, r));
3123
+ e = e.replace(u, (A, C, R) => O("track", R, r));
3112
3124
  const l = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/track\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3113
- e = e.replace(l, (z, S, y) => B("track", y, r));
3125
+ e = e.replace(l, (A, C, R) => O("track", R, r));
3114
3126
  const d = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/album\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3115
- e = e.replace(d, (z, S, y) => B("album", y, r));
3127
+ e = e.replace(d, (A, C, R) => O("album", R, r));
3116
3128
  const p = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/album\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3117
- e = e.replace(p, (z, S, y) => B("album", y, r));
3129
+ e = e.replace(p, (A, C, R) => O("album", R, r));
3118
3130
  const w = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/playlist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3119
- e = e.replace(w, (z, S, y) => B("playlist", y, r));
3131
+ e = e.replace(w, (A, C, R) => O("playlist", R, r));
3120
3132
  const c = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/playlist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3121
- e = e.replace(c, (z, S, y) => B("playlist", y, r));
3133
+ e = e.replace(c, (A, C, R) => O("playlist", R, r));
3122
3134
  const m = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/artist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3123
- e = e.replace(m, (z, S, y) => B("artist", y, r));
3135
+ e = e.replace(m, (A, C, R) => O("artist", R, r));
3124
3136
  const h = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/artist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3125
- e = e.replace(h, (z, S, y) => B("artist", y, r));
3137
+ e = e.replace(h, (A, C, R) => O("artist", R, r));
3126
3138
  const g = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/episode\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3127
- e = e.replace(g, (z, S, y) => B("episode", y, r));
3139
+ e = e.replace(g, (A, C, R) => O("episode", R, r));
3128
3140
  const f = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/episode\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3129
- e = e.replace(f, (z, S, y) => B("episode", y, r));
3141
+ e = e.replace(f, (A, C, R) => O("episode", R, r));
3130
3142
  const b = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/show\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3131
- e = e.replace(b, (z, S, y) => B("show", y, r));
3143
+ e = e.replace(b, (A, C, R) => O("show", R, r));
3132
3144
  const v = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/show\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3133
- e = e.replace(v, (z, S, y) => B("show", y, r));
3134
- const M = /<a[^>]*href="(https?:\/\/music\.apple\.com\/([a-z]{2})\/([a-z-]+)\/[^\/]+\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3135
- e = e.replace(M, (z, S, y, C, x) => kt(y, C, x));
3145
+ e = e.replace(v, (A, C, R) => O("show", R, r));
3146
+ const x = /<a[^>]*href="(https?:\/\/music\.apple\.com\/([a-z]{2})\/([a-z-]+)\/[^\/]+\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3147
+ e = e.replace(x, (A, C, R, M, y) => kt(R, M, y));
3136
3148
  const $ = new RegExp(`(?<!["'=])(https?:\\/\\/music\\.apple\\.com\\/([a-z]{2})\\/([a-z-]+)\\/[^\\/\\s]+\\/(\\d+))(?!["'])`, "gi");
3137
- e = e.replace($, (z, S, y, C, x) => kt(y, C, x));
3138
- for (let z = a.length - 1; z >= 0; z--)
3139
- e = e.replace(`__PROTECTED_${z}__`, a[z]);
3149
+ e = e.replace($, (A, C, R, M, y) => kt(R, M, y));
3150
+ for (let A = a.length - 1; A >= 0; A--)
3151
+ e = e.replace(`__PROTECTED_${A}__`, a[A]);
3140
3152
  return e;
3141
3153
  }
3142
3154
  function ds(e) {
@@ -3250,7 +3262,7 @@ function yt(e) {
3250
3262
  </div>
3251
3263
  `;
3252
3264
  }
3253
- function B(e, t, r = "dark") {
3265
+ function O(e, t, r = "dark") {
3254
3266
  const s = {
3255
3267
  track: 152,
3256
3268
  album: 352,
@@ -3287,7 +3299,7 @@ function kt(e, t, r) {
3287
3299
  </div>
3288
3300
  `;
3289
3301
  }
3290
- const Y = /* @__PURE__ */ new Map(), je = [0.5, 0.75, 1, 1.25, 1.5, 2];
3302
+ const ae = /* @__PURE__ */ new Map(), je = [0.5, 0.75, 1, 1.25, 1.5, 2];
3291
3303
  function ps(e = document) {
3292
3304
  e.querySelectorAll(".artifactuse-audio-player:not([data-initialized])").forEach((r) => {
3293
3305
  fs(r);
@@ -3307,8 +3319,8 @@ function fs(e) {
3307
3319
  currentTime: 0,
3308
3320
  waveformData: null
3309
3321
  };
3310
- Y.set(t, { playerEl: e, audio: a, state: b }), hs(d, t), s == null || s.addEventListener("click", () => {
3311
- b.isPlaying ? At(t) : zt(t);
3322
+ ae.set(t, { playerEl: e, audio: a, state: b }), hs(d, t), s == null || s.addEventListener("click", () => {
3323
+ b.isPlaying ? zt(t) : At(t);
3312
3324
  }), a.addEventListener("loadedmetadata", () => {
3313
3325
  b.duration = a.duration, u.textContent = $t(a.duration);
3314
3326
  }), a.addEventListener("timeupdate", () => {
@@ -3322,26 +3334,26 @@ function fs(e) {
3322
3334
  }), a.addEventListener("pause", () => {
3323
3335
  b.isPlaying = !1, n.style.display = "", o.style.display = "none", e.classList.remove("is-playing");
3324
3336
  }), l == null || l.addEventListener("click", (v) => {
3325
- const M = l.getBoundingClientRect(), S = (v.clientX - M.left) / M.width * a.duration;
3326
- isNaN(S) || (a.currentTime = S);
3337
+ const x = l.getBoundingClientRect(), C = (v.clientX - x.left) / x.width * a.duration;
3338
+ isNaN(C) || (a.currentTime = C);
3327
3339
  }), l == null || l.addEventListener("mousemove", (v) => {
3328
- const M = l.getBoundingClientRect(), z = (v.clientX - M.left) / M.width * 100;
3329
- w.style.width = `${z}%`;
3340
+ const x = l.getBoundingClientRect(), A = (v.clientX - x.left) / x.width * 100;
3341
+ w.style.width = `${A}%`;
3330
3342
  }), l == null || l.addEventListener("mouseleave", () => {
3331
3343
  w.style.width = "0%";
3332
3344
  }), c == null || c.addEventListener("click", () => {
3333
3345
  b.isMuted = !b.isMuted, a.muted = b.isMuted, m.style.display = b.isMuted ? "none" : "", h.style.display = b.isMuted ? "" : "none", b.isMuted ? g.value = 0 : g.value = b.volume * 100;
3334
3346
  }), g == null || g.addEventListener("input", (v) => {
3335
- const M = parseInt(v.target.value, 10) / 100;
3336
- b.volume = M, a.volume = M, M === 0 ? (b.isMuted = !0, m.style.display = "none", h.style.display = "") : (b.isMuted = !1, a.muted = !1, m.style.display = "", h.style.display = "none");
3347
+ const x = parseInt(v.target.value, 10) / 100;
3348
+ b.volume = x, a.volume = x, x === 0 ? (b.isMuted = !0, m.style.display = "none", h.style.display = "") : (b.isMuted = !1, a.muted = !1, m.style.display = "", h.style.display = "none");
3337
3349
  }), f == null || f.addEventListener("click", () => {
3338
- const M = (je.indexOf(b.playbackRate) + 1) % je.length;
3339
- b.playbackRate = je[M], a.playbackRate = b.playbackRate, f.querySelector("span").textContent = `${b.playbackRate}x`;
3350
+ const x = (je.indexOf(b.playbackRate) + 1) % je.length;
3351
+ b.playbackRate = je[x], a.playbackRate = b.playbackRate, f.querySelector("span").textContent = `${b.playbackRate}x`;
3340
3352
  }), e.addEventListener("keydown", (v) => {
3341
3353
  switch (v.key) {
3342
3354
  case " ":
3343
3355
  case "k":
3344
- v.preventDefault(), b.isPlaying ? At(t) : zt(t);
3356
+ v.preventDefault(), b.isPlaying ? zt(t) : At(t);
3345
3357
  break;
3346
3358
  case "ArrowLeft":
3347
3359
  v.preventDefault(), a.currentTime = Math.max(0, a.currentTime - 5);
@@ -3403,25 +3415,25 @@ function $t(e) {
3403
3415
  const t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), a = Math.floor(e % 60);
3404
3416
  return t > 0 ? `${t}:${r.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}` : `${r}:${a.toString().padStart(2, "0")}`;
3405
3417
  }
3406
- function zt(e) {
3407
- const t = Y.get(e);
3418
+ function At(e) {
3419
+ const t = ae.get(e);
3408
3420
  t && t.audio.play();
3409
3421
  }
3410
- function At(e) {
3411
- const t = Y.get(e);
3422
+ function zt(e) {
3423
+ const t = ae.get(e);
3412
3424
  t && t.audio.pause();
3413
3425
  }
3414
3426
  function gs(e) {
3415
- Y.forEach((t, r) => {
3427
+ ae.forEach((t, r) => {
3416
3428
  r !== e && t.state.isPlaying && t.audio.pause();
3417
3429
  });
3418
3430
  }
3419
3431
  function ms(e) {
3420
- const t = Y.get(e);
3421
- t && (t.audio.pause(), t.audio.src = "", Y.delete(e));
3432
+ const t = ae.get(e);
3433
+ t && (t.audio.pause(), t.audio.src = "", ae.delete(e));
3422
3434
  }
3423
3435
  function ws() {
3424
- Y.forEach((e, t) => {
3436
+ ae.forEach((e, t) => {
3425
3437
  ms(t);
3426
3438
  });
3427
3439
  }
@@ -3448,33 +3460,33 @@ function bs(e) {
3448
3460
  return t.push(St(f)), b;
3449
3461
  });
3450
3462
  const s = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/place\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3451
- e = e.replace(s, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3463
+ e = e.replace(s, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3452
3464
  const n = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/place\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
3453
- e = e.replace(n, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3465
+ e = e.replace(n, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3454
3466
  const o = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/@([0-9.-]+),([0-9.-]+),([0-9]+)z[^"]*)"[^>]*>[^<]*<\/a>/gi;
3455
- e = e.replace(o, (g, f, b, v, M) => Ue(b, v, M));
3467
+ e = e.replace(o, (g, f, b, v, x) => Ue(b, v, x));
3456
3468
  const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/@([0-9.-]+),([0-9.-]+),([0-9]+)z)(?!["'])`, "gi");
3457
- e = e.replace(i, (g, f, b, v, M) => Ue(b, v, M));
3469
+ e = e.replace(i, (g, f, b, v, x) => Ue(b, v, x));
3458
3470
  const u = /<a[^>]*href="(https?:\/\/maps\.google\.com\/\?q=([^\s"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3459
- e = e.replace(u, (g, f, b) => X(decodeURIComponent(b)));
3471
+ e = e.replace(u, (g, f, b) => Y(decodeURIComponent(b)));
3460
3472
  const l = new RegExp(`(?<!["'=])(https?:\\/\\/maps\\.google\\.com\\/\\?q=([^\\s"&]+))(?!["'])`, "gi");
3461
- e = e.replace(l, (g, f, b) => X(decodeURIComponent(b)));
3473
+ e = e.replace(l, (g, f, b) => Y(decodeURIComponent(b)));
3462
3474
  const d = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3463
- e = e.replace(d, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3475
+ e = e.replace(d, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3464
3476
  const p = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
3465
- e = e.replace(p, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3477
+ e = e.replace(p, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3466
3478
  const w = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/\?[^"]*query=([^"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3467
- e = e.replace(w, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3479
+ e = e.replace(w, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3468
3480
  const c = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/\\?[^\\s"]*query=([^\\s"&]+))(?!["'])`, "gi");
3469
- e = e.replace(c, (g, f, b) => X(decodeURIComponent(b.replace(/\+/g, " "))));
3481
+ e = e.replace(c, (g, f, b) => Y(decodeURIComponent(b.replace(/\+/g, " "))));
3470
3482
  const m = /<a[^>]*href="(https?:\/\/(?:www\.)?openstreetmap\.org\/[^"]*mlat=([0-9.-]+)[^"]*mlon=([0-9.-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3471
3483
  e = e.replace(m, (g, f, b, v) => {
3472
- const M = f.match(/#map=(\d+)/), $ = M ? M[1] : 15;
3484
+ const x = f.match(/#map=(\d+)/), $ = x ? x[1] : 15;
3473
3485
  return Ct(b, v, $);
3474
3486
  });
3475
3487
  const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?openstreetmap\\.org\\/[^\\s]*mlat=([0-9.-]+)[^\\s]*mlon=([0-9.-]+))(?!["'])`, "gi");
3476
3488
  e = e.replace(h, (g, f, b, v) => {
3477
- const M = f.match(/#map=(\d+)/), $ = M ? M[1] : 15;
3489
+ const x = f.match(/#map=(\d+)/), $ = x ? x[1] : 15;
3478
3490
  return Ct(b, v, $);
3479
3491
  });
3480
3492
  for (let g = t.length - 1; g >= 0; g--)
@@ -3509,7 +3521,7 @@ function St(e) {
3509
3521
  </div>
3510
3522
  `;
3511
3523
  }
3512
- function X(e) {
3524
+ function Y(e) {
3513
3525
  const t = encodeURIComponent(e);
3514
3526
  return `
3515
3527
  <div class="artifactuse-map-wrapper">
@@ -3571,37 +3583,37 @@ function Ct(e, t, r = 15) {
3571
3583
  }
3572
3584
  function vs(e, t = {}) {
3573
3585
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3574
- e = e.replace(a, (v, M, $, z) => Rt($, z, r));
3586
+ e = e.replace(a, (v, x, $, A) => Rt($, A, r));
3575
3587
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:twitter\\.com|x\\.com)\\/([a-zA-Z0-9_]+)\\/status\\/(\\d+))(?!["'])`, "gi");
3576
- e = e.replace(s, (v, M, $, z) => Rt($, z, r));
3588
+ e = e.replace(s, (v, x, $, A) => Rt($, A, r));
3577
3589
  const n = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/p\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3578
- e = e.replace(n, (v, M, $) => Lt($));
3590
+ e = e.replace(n, (v, x, $) => Lt($));
3579
3591
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/p\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3580
- e = e.replace(o, (v, M, $) => Lt($));
3592
+ e = e.replace(o, (v, x, $) => Lt($));
3581
3593
  const i = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/reel\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3582
- e = e.replace(i, (v, M, $) => Tt($));
3594
+ e = e.replace(i, (v, x, $) => Tt($));
3583
3595
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/reel\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3584
- e = e.replace(u, (v, M, $) => Tt($));
3596
+ e = e.replace(u, (v, x, $) => Tt($));
3585
3597
  const l = /<a[^>]*href="(https?:\/\/(?:www\.)?tiktok\.com\/@([a-zA-Z0-9_.]+)\/video\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3586
- e = e.replace(l, (v, M, $, z) => _t(z));
3598
+ e = e.replace(l, (v, x, $, A) => _t(A));
3587
3599
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?tiktok\\.com\\/@([a-zA-Z0-9_.]+)\\/video\\/(\\d+))(?!["'])`, "gi");
3588
- e = e.replace(d, (v, M, $, z) => _t(z));
3600
+ e = e.replace(d, (v, x, $, A) => _t(A));
3589
3601
  const p = /<a[^>]*href="(https?:\/\/(?:www\.)?linkedin\.com\/(?:posts|feed\/update)\/([a-zA-Z0-9_:-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3590
- e = e.replace(p, (v, M, $) => Et($, M));
3602
+ e = e.replace(p, (v, x, $) => Et($, x));
3591
3603
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?linkedin\\.com\\/(?:posts|feed\\/update)\\/([a-zA-Z0-9_:-]+))(?!["'])`, "gi");
3592
- e = e.replace(w, (v, M, $) => Et($, M));
3604
+ e = e.replace(w, (v, x, $) => Et($, x));
3593
3605
  const c = /<a[^>]*href="(https?:\/\/(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3594
- e = e.replace(c, (v, M, $, z) => Pt($, z, M));
3606
+ e = e.replace(c, (v, x, $, A) => Pt($, A, x));
3595
3607
  const m = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?reddit\\.com\\/r\\/([a-zA-Z0-9_]+)\\/comments\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
3596
- e = e.replace(m, (v, M, $, z) => Pt($, z, M));
3608
+ e = e.replace(m, (v, x, $, A) => Pt($, A, x));
3597
3609
  const h = /<a[^>]*href="(https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/posts\/\d+[^"]*)"[^>]*>[^<]*<\/a>/gi;
3598
- e = e.replace(h, (v, M) => jt(M));
3610
+ e = e.replace(h, (v, x) => jt(x));
3599
3611
  const g = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?facebook\\.com\\/[a-zA-Z0-9.]+\\/posts\\/\\d+)(?!["'])`, "gi");
3600
- e = e.replace(g, (v, M) => jt(M));
3612
+ e = e.replace(g, (v, x) => jt(x));
3601
3613
  const f = /<a[^>]*href="(https?:\/\/(?:www\.)?pinterest\.com\/pin\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3602
- e = e.replace(f, (v, M, $) => Ht($));
3614
+ e = e.replace(f, (v, x, $) => Ht($));
3603
3615
  const b = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?pinterest\\.com\\/pin\\/(\\d+))(?!["'])`, "gi");
3604
- return e = e.replace(b, (v, M, $) => Ht($)), e;
3616
+ return e = e.replace(b, (v, x, $) => Ht($)), e;
3605
3617
  }
3606
3618
  function Rt(e, t, r = "dark") {
3607
3619
  return `
@@ -3743,23 +3755,23 @@ function Vt(e) {
3743
3755
  }
3744
3756
  function ks(e) {
3745
3757
  const t = /<a[^>]*href="(https?:\/\/docs\.google\.com\/document\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3746
- e = e.replace(t, (l, d, p) => se(p, "document"));
3758
+ e = e.replace(t, (l, d, p) => ie(p, "document"));
3747
3759
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/document\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3748
- e = e.replace(r, (l, d, p) => se(p, "document"));
3760
+ e = e.replace(r, (l, d, p) => ie(p, "document"));
3749
3761
  const a = /<a[^>]*href="(https?:\/\/docs\.google\.com\/spreadsheets\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3750
- e = e.replace(a, (l, d, p) => se(p, "spreadsheets"));
3762
+ e = e.replace(a, (l, d, p) => ie(p, "spreadsheets"));
3751
3763
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/spreadsheets\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3752
- e = e.replace(s, (l, d, p) => se(p, "spreadsheets"));
3764
+ e = e.replace(s, (l, d, p) => ie(p, "spreadsheets"));
3753
3765
  const n = /<a[^>]*href="(https?:\/\/docs\.google\.com\/presentation\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3754
- e = e.replace(n, (l, d, p) => se(p, "presentation"));
3766
+ e = e.replace(n, (l, d, p) => ie(p, "presentation"));
3755
3767
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/presentation\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3756
- e = e.replace(o, (l, d, p) => se(p, "presentation"));
3768
+ e = e.replace(o, (l, d, p) => ie(p, "presentation"));
3757
3769
  const i = /<a[^>]*href="(https?:\/\/docs\.google\.com\/forms\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
3758
3770
  e = e.replace(i, (l, d, p) => It(p));
3759
3771
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/forms\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
3760
3772
  return e = e.replace(u, (l, d, p) => It(p)), e;
3761
3773
  }
3762
- function se(e, t) {
3774
+ function ie(e, t) {
3763
3775
  const r = {
3764
3776
  document: "Google Doc",
3765
3777
  spreadsheets: "Google Sheet",
@@ -3939,7 +3951,7 @@ function Nt(e, t, r = "dark") {
3939
3951
  </div>
3940
3952
  `;
3941
3953
  }
3942
- function zs(e) {
3954
+ function As(e) {
3943
3955
  const t = /<a[^>]*href="(https?:\/\/public\.tableau\.com\/(?:views|profile)\/([^\s"]+))"[^>]*>[^<]*<\/a>/gi;
3944
3956
  e = e.replace(t, (l, d, p) => Ut(p));
3945
3957
  const r = new RegExp(`(?<!["'=])(https?:\\/\\/public\\.tableau\\.com\\/(?:views|profile)\\/([^\\s<>"]+))(?!["'])`, "gi");
@@ -4006,7 +4018,7 @@ function Xt(e) {
4006
4018
  </div>
4007
4019
  `;
4008
4020
  }
4009
- function As(e, t = {}) {
4021
+ function zs(e, t = {}) {
4010
4022
  const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/sketchfab\.com\/(?:3d-)?models\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4011
4023
  e = e.replace(a, (h, g, f) => Kt(f, r));
4012
4024
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/sketchfab\\.com\\/(?:3d-)?models\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
@@ -4122,25 +4134,25 @@ function Ss(e, t = {}) {
4122
4134
  const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:[a-zA-Z0-9-]+\\.)?typeform\\.com\\/to\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
4123
4135
  e = e.replace(s, (f, b, v) => rr(v));
4124
4136
  const n = /<a[^>]*href="(https?:\/\/calendly\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4125
- e = e.replace(n, (f, b, v, M) => ar(v, M));
4137
+ e = e.replace(n, (f, b, v, x) => ar(v, x));
4126
4138
  const o = new RegExp(`(?<!["'=])(https?:\\/\\/calendly\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
4127
- e = e.replace(o, (f, b, v, M) => ar(v, M));
4139
+ e = e.replace(o, (f, b, v, x) => ar(v, x));
4128
4140
  const i = /<a[^>]*href="(https?:\/\/calendar\.google\.com\/calendar\/appointments\/schedules\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4129
4141
  e = e.replace(i, (f, b, v) => sr(v));
4130
4142
  const u = new RegExp(`(?<!["'=])(https?:\\/\\/calendar\\.google\\.com\\/calendar\\/appointments\\/schedules\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
4131
4143
  e = e.replace(u, (f, b, v) => sr(v));
4132
4144
  const l = /<a[^>]*href="(https?:\/\/cal\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4133
- e = e.replace(l, (f, b, v, M) => nr(v, M, r));
4145
+ e = e.replace(l, (f, b, v, x) => nr(v, x, r));
4134
4146
  const d = new RegExp(`(?<!["'=])(https?:\\/\\/cal\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
4135
- e = e.replace(d, (f, b, v, M) => nr(v, M, r));
4147
+ e = e.replace(d, (f, b, v, x) => nr(v, x, r));
4136
4148
  const p = /<a[^>]*href="(https?:\/\/(?:www\.)?notion\.so\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4137
4149
  e = e.replace(p, (f, b, v) => ir(v));
4138
4150
  const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?notion\\.so\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
4139
4151
  e = e.replace(w, (f, b, v) => ir(v));
4140
4152
  const c = /<a[^>]*href="(https?:\/\/airtable\.com\/(?:embed\/)?([a-zA-Z0-9]+)(?:\/([a-zA-Z0-9]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
4141
- e = e.replace(c, (f, b, v, M) => or(v, M));
4153
+ e = e.replace(c, (f, b, v, x) => or(v, x));
4142
4154
  const m = new RegExp(`(?<!["'=])(https?:\\/\\/airtable\\.com\\/(?:embed\\/)?([a-zA-Z0-9]+)(?:\\/([a-zA-Z0-9]+))?)(?!["'])`, "gi");
4143
- e = e.replace(m, (f, b, v, M) => or(v, M));
4155
+ e = e.replace(m, (f, b, v, x) => or(v, x));
4144
4156
  const h = /<a[^>]*href="(https?:\/\/miro\.com\/app\/board\/([a-zA-Z0-9_=-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
4145
4157
  e = e.replace(h, (f, b, v) => lr(v));
4146
4158
  const g = new RegExp(`(?<!["'=])(https?:\\/\\/miro\\.com\\/app\\/board\\/([a-zA-Z0-9_=-]+))(?!["'])`, "gi");
@@ -4225,7 +4237,7 @@ function lr(e) {
4225
4237
  </div>
4226
4238
  `;
4227
4239
  }
4228
- let K = null, Se = !1, nt = !1;
4240
+ let ee = null, Se = !1, nt = !1;
4229
4241
  function Cr(e) {
4230
4242
  const t = /<pre><code class="language-mermaid">([\s\S]*?)<\/code><\/pre>/gi;
4231
4243
  return e = e.replace(t, (r, a) => {
@@ -4329,19 +4341,19 @@ function Ge(e) {
4329
4341
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4330
4342
  }
4331
4343
  function Ts() {
4332
- return K || (typeof mermaid < "u" ? Promise.resolve() : (K = new Promise((e, t) => {
4344
+ return ee || (typeof mermaid < "u" ? Promise.resolve() : (ee = new Promise((e, t) => {
4333
4345
  const r = setTimeout(() => {
4334
- K = null, t(new Error("Mermaid loading timed out after 15 seconds"));
4346
+ ee = null, t(new Error("Mermaid loading timed out after 15 seconds"));
4335
4347
  }, 15e3), a = document.createElement("script");
4336
4348
  a.src = "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js", a.crossOrigin = "anonymous", a.onload = () => {
4337
4349
  clearTimeout(r), console.log("Mermaid script loaded successfully"), e();
4338
4350
  }, a.onerror = (s) => {
4339
- clearTimeout(r), K = null, console.error("Mermaid script failed to load:", s), t(new Error("Failed to load Mermaid script from CDN"));
4351
+ clearTimeout(r), ee = null, console.error("Mermaid script failed to load:", s), t(new Error("Failed to load Mermaid script from CDN"));
4340
4352
  }, document.head.appendChild(a);
4341
- }), K));
4353
+ }), ee));
4342
4354
  }
4343
4355
  function rn() {
4344
- K = null, Se = !1, nt = !1;
4356
+ ee = null, Se = !1, nt = !1;
4345
4357
  }
4346
4358
  function an() {
4347
4359
  return typeof mermaid < "u";
@@ -4530,7 +4542,7 @@ function qs() {
4530
4542
  });
4531
4543
  });
4532
4544
  }
4533
- let J = null, Re = !1;
4545
+ let te = null, Re = !1;
4534
4546
  function _r(e) {
4535
4547
  return e = Zs(e), e = e.replace(/\$\$([\s\S]*?)\$\$/g, (t, r) => fe(r.trim(), !0)), e = e.replace(/\\\[([\s\S]*?)\\\]/g, (t, r) => fe(r.trim(), !0)), e = e.replace(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+?)\\$(?!\\$)", "g"), (t, r) => fe(r.trim(), !1)), e = e.replace(/\\\(([\s\S]*?)\\\)/g, (t, r) => fe(r.trim(), !1)), e;
4536
4548
  }
@@ -4604,9 +4616,9 @@ function We(e) {
4604
4616
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4605
4617
  }
4606
4618
  function Ns() {
4607
- return J || (typeof katex < "u" ? Promise.resolve() : (J = new Promise((e, t) => {
4619
+ return te || (typeof katex < "u" ? Promise.resolve() : (te = new Promise((e, t) => {
4608
4620
  const r = setTimeout(() => {
4609
- J = null, t(new Error("KaTeX loading timed out after 10 seconds"));
4621
+ te = null, t(new Error("KaTeX loading timed out after 10 seconds"));
4610
4622
  }, 1e4), a = document.createElement("link");
4611
4623
  a.rel = "stylesheet", a.href = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css", a.crossOrigin = "anonymous", a.onerror = () => {
4612
4624
  console.warn("KaTeX CSS failed to load, math may not render correctly");
@@ -4615,12 +4627,12 @@ function Ns() {
4615
4627
  s.src = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js", s.crossOrigin = "anonymous", s.onload = () => {
4616
4628
  clearTimeout(r), console.log("KaTeX script loaded successfully"), e();
4617
4629
  }, s.onerror = (n) => {
4618
- clearTimeout(r), J = null, console.error("KaTeX script failed to load:", n), t(new Error("Failed to load KaTeX script from CDN"));
4630
+ clearTimeout(r), te = null, console.error("KaTeX script failed to load:", n), t(new Error("Failed to load KaTeX script from CDN"));
4619
4631
  }, document.head.appendChild(s);
4620
- }), J));
4632
+ }), te));
4621
4633
  }
4622
4634
  function cn() {
4623
- J = null, Re = !1;
4635
+ te = null, Re = !1;
4624
4636
  }
4625
4637
  function un() {
4626
4638
  return typeof katex < "u";
@@ -4786,7 +4798,7 @@ function Gs() {
4786
4798
  return o ? `<pre><code class="language-${ke(o)}">${i}</code></pre>` : `<pre><code>${i}</code></pre>`;
4787
4799
  }
4788
4800
  };
4789
- H.use({
4801
+ V.use({
4790
4802
  renderer: {
4791
4803
  ...e,
4792
4804
  ...t,
@@ -5009,37 +5021,37 @@ function Ks(e, t) {
5009
5021
  }
5010
5022
  function bn(e = {}) {
5011
5023
  const t = Ir(Ws, e), r = ta(), a = { ...Hr, ...t.panels }, s = Xs(a, t.cdnUrl), n = ra(s), o = na(t.theme, t.colors || {}), i = Ks(t, n), u = pa(t.sharing), l = fa(t.editor);
5012
- function d(k, _, R = {}) {
5013
- let A = H.parse(k);
5014
- const D = [], P = { theme: o.resolved }, Z = R.inlinePreview ?? t.inlinePreview ?? null, ne = R.inlineCode ?? t.inlineCode ?? null, re = R.tabs ?? t.tabs ?? null, ae = R.viewMode ?? t.viewMode ?? null;
5024
+ function d(k, _, L = {}) {
5025
+ let S = V.parse(k);
5026
+ const D = [], E = { theme: o.resolved }, Z = L.inlinePreview ?? t.inlinePreview ?? null, ne = L.inlineCode ?? t.inlineCode ?? null, oe = L.tabs ?? t.tabs ?? null, G = L.viewMode ?? t.viewMode ?? null;
5015
5027
  if (t.processors.codeBlocks) {
5016
- const O = ea(A, _, {
5028
+ const B = ea(S, _, {
5017
5029
  ...t.codeExtraction,
5018
5030
  inlinePreview: Z,
5019
5031
  inlineCode: ne,
5020
- tabs: re,
5021
- viewMode: ae
5032
+ tabs: oe,
5033
+ viewMode: G
5022
5034
  });
5023
- A = O.html, D.push(...O.artifacts);
5035
+ S = B.html, D.push(...B.artifacts);
5024
5036
  }
5025
- return t.processors.images && (A = Qa(A)), t.processors.imageGalleries && (A = Ya(A)), t.processors.videos && (A = as(A)), t.processors.videoGalleries && (A = os(A)), t.processors.audio && (A = us(A, P)), t.processors.maps && (A = bs(A)), t.processors.social && (A = vs(A, P)), t.processors.documents && (A = ys(A), A = ks(A), A = xs(A)), t.processors.codeEmbeds && (A = $s(A, P)), t.processors.dataViz && (A = zs(A)), t.processors.design && (A = As(A, P)), t.processors.interactive && (A = Ss(A, P)), t.processors.tables && (A = _s(A)), t.processors.math && (A = _r(A)), t.processors.mermaid && (A = Cr(A)), D.forEach((O) => {
5026
- r.addArtifact(O);
5037
+ return t.processors.images && (S = Qa(S)), t.processors.imageGalleries && (S = Ya(S)), t.processors.videos && (S = as(S)), t.processors.videoGalleries && (S = os(S)), t.processors.audio && (S = us(S, E)), t.processors.maps && (S = bs(S)), t.processors.social && (S = vs(S, E)), t.processors.documents && (S = ys(S), S = ks(S), S = xs(S)), t.processors.codeEmbeds && (S = $s(S, E)), t.processors.dataViz && (S = As(S)), t.processors.design && (S = zs(S, E)), t.processors.interactive && (S = Ss(S, E)), t.processors.tables && (S = _s(S)), t.processors.math && (S = _r(S)), t.processors.mermaid && (S = Cr(S)), D.forEach((B) => {
5038
+ r.addArtifact(B);
5027
5039
  }), {
5028
- html: A,
5040
+ html: S,
5029
5041
  artifacts: D
5030
5042
  };
5031
5043
  }
5032
5044
  async function p(k = document) {
5033
- const _ = [], R = { theme: o.resolved };
5034
- t.processors.math && _.push(Pr()), t.processors.mermaid && _.push(Tr(R)), t.processors.tables && qs(), t.processors.audio && ps(k), t.syntaxHighlight && (jr(k), (k === document ? document : k).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((P) => {
5035
- var ae;
5036
- const Z = P.querySelector("code");
5045
+ const _ = [], L = { theme: o.resolved };
5046
+ t.processors.math && _.push(Pr()), t.processors.mermaid && _.push(Tr(L)), t.processors.tables && qs(), t.processors.audio && ps(k), t.syntaxHighlight && (jr(k), (k === document ? document : k).querySelectorAll(".artifactuse-inline-preview[data-smartdiff]").forEach((E) => {
5047
+ var G;
5048
+ const Z = E.querySelector("code");
5037
5049
  if (!Z || Z.dataset.smartdiffProcessed) return;
5038
- const ne = ((ae = P.dataset.smartdiffMarkers) == null ? void 0 : ae.split(",")) || [], re = Z.innerHTML.split(`
5050
+ const ne = ((G = E.dataset.smartdiffMarkers) == null ? void 0 : G.split(",")) || [], oe = Z.innerHTML.split(`
5039
5051
  `);
5040
- Z.innerHTML = re.map((O, be) => {
5041
- const ie = ne[be];
5042
- return ie === "-" ? `<span class="token deleted">${O}</span>` : ie === "+" ? `<span class="token inserted">${O}</span>` : O;
5052
+ Z.innerHTML = oe.map((B, be) => {
5053
+ const Q = ne[be];
5054
+ return Q === "-" ? `<span class="token deleted">${B}</span>` : Q === "+" ? `<span class="token inserted">${B}</span>` : B;
5043
5055
  }).join(`
5044
5056
  `), Z.dataset.smartdiffProcessed = "true";
5045
5057
  })), await Promise.all(_);
@@ -5049,96 +5061,99 @@ function bn(e = {}) {
5049
5061
  console.warn("Attempted to open inline artifact in panel:", k.id);
5050
5062
  return;
5051
5063
  }
5052
- t.multiTab ? r.openTab(k.id) : r.setActiveArtifact(k.id), r.setPanelOpen(!0), k.viewMode && r.setViewMode(k.viewMode), L("artifact:opened", k);
5064
+ t.multiTab ? r.openTab(k.id) : r.setActiveArtifact(k.id), r.setForceEmptyView(!1), r.setPanelOpen(!0), k.viewMode && r.setViewMode(k.viewMode), T("artifact:opened", k);
5053
5065
  }
5054
- function c(k, _, R = {}) {
5055
- const A = k.split(".").pop(), D = R.language || Nr(A) || A, P = R.title || k;
5056
- return m(_, D, { ...R, title: P });
5066
+ function c(k, _, L = {}) {
5067
+ const S = k.split(".").pop(), D = L.language || Nr(S) || S, E = L.title || k;
5068
+ return m(_, D, { ...L, title: E });
5057
5069
  }
5058
- function m(k, _, R = {}) {
5059
- const A = R.messageId || Br("open"), D = $({ type: _, language: _ }) ? _ : "txt", P = Me(k, D, A, 0);
5060
- return P.title = R.title || P.title, P.isInline = !1, P.editorLanguage = _, R.tabs && (P.tabs = R.tabs), R.panelUrl && (P.panelUrl = R.panelUrl), r.addArtifact(P), w(P), R.viewMode ? r.setViewMode(R.viewMode) : R.tabs && r.setViewMode(R.tabs[0]), P;
5070
+ function m(k, _, L = {}) {
5071
+ const S = L.messageId || Br("open"), D = A({ type: _, language: _ }) ? _ : "txt", E = Me(k, D, S, 0);
5072
+ return E.title = L.title || E.title, E.isInline = !1, E.editorLanguage = _, L.tabs && (E.tabs = L.tabs), L.panelUrl && (E.panelUrl = L.panelUrl), r.addArtifact(E), w(E), L.viewMode ? r.setViewMode(L.viewMode) : L.tabs && r.setViewMode(L.tabs[0]), E;
5061
5073
  }
5062
- function h(k, _, R = {}) {
5063
- const A = typeof k == "string" ? k : k == null ? void 0 : k.id, D = r.getArtifact(A);
5074
+ function h(k, _, L = {}) {
5075
+ const S = typeof k == "string" ? k : k == null ? void 0 : k.id, D = r.getArtifact(S);
5064
5076
  if (!D) return null;
5065
- const P = { ...D, code: _, _refreshToken: Date.now() };
5066
- return R.title !== void 0 && (P.title = R.title), R.tabs !== void 0 && (P.tabs = R.tabs), R.panelUrl !== void 0 && (P.panelUrl = R.panelUrl), r.addArtifact(P), L("artifact:updated", { artifactId: A, artifact: r.getArtifact(A) }), r.getArtifact(A);
5077
+ const E = { ...D, code: _, _refreshToken: Date.now() };
5078
+ return L.title !== void 0 && (E.title = L.title), L.tabs !== void 0 && (E.tabs = L.tabs), L.panelUrl !== void 0 && (E.panelUrl = L.panelUrl), r.addArtifact(E), T("artifact:updated", { artifactId: S, artifact: r.getArtifact(S) }), r.getArtifact(S);
5067
5079
  }
5068
5080
  function g() {
5069
- r.setPanelOpen(!1), r.setFullscreen(!1), L("panel:closed");
5081
+ r.clearActiveArtifact(), r.setForceEmptyView(!0), r.setPanelOpen(!0), T("panel:opened");
5070
5082
  }
5071
5083
  function f() {
5072
- const k = !r.getState().isPanelOpen;
5073
- r.clearActiveArtifact(), r.setPanelOpen(k), k || r.setFullscreen(!1), L("panel:toggled", { isOpen: k });
5084
+ r.setPanelOpen(!1), r.setFullscreen(!1), T("panel:closed");
5074
5085
  }
5075
5086
  function b() {
5087
+ const k = !r.getState().isPanelOpen;
5088
+ r.clearActiveArtifact(), r.setPanelOpen(k), k || r.setFullscreen(!1), T("panel:toggled", { isOpen: k });
5089
+ }
5090
+ function v() {
5076
5091
  const k = !r.getState().isFullscreen;
5077
- r.setFullscreen(k), L("fullscreen:toggled", { isFullscreen: k });
5092
+ r.setFullscreen(k), T("fullscreen:toggled", { isFullscreen: k });
5078
5093
  }
5079
- function v(k) {
5080
- r.setViewMode(k), L("viewMode:changed", { mode: k });
5094
+ function x(k) {
5095
+ r.setViewMode(k), T("viewMode:changed", { mode: k });
5081
5096
  }
5082
- function M(k, _ = {}) {
5097
+ function $(k, _ = {}) {
5083
5098
  if (!k) return null;
5084
5099
  if (k.panelUrl) return k.panelUrl;
5085
- const { type: R, language: A } = k, D = {
5100
+ const { type: L, language: S } = k, D = {
5086
5101
  theme: _.theme || o.resolved
5087
- }, P = o.colors;
5088
- P != null && P.primary && (D.accent = P.primary);
5089
- let Z = i.resolve(R, D);
5090
- return !Z && A && (Z = i.resolve(A, D)), Z;
5102
+ }, E = o.colors;
5103
+ E != null && E.primary && (D.accent = E.primary);
5104
+ let Z = i.resolve(L, D);
5105
+ return !Z && S && (Z = i.resolve(S, D)), Z;
5091
5106
  }
5092
- function $(k) {
5107
+ function A(k) {
5093
5108
  return k ? i.has(k.type) || i.has(k.language) : !1;
5094
5109
  }
5095
- function z(k, _) {
5110
+ function C(k, _) {
5096
5111
  i.register(k, _);
5097
5112
  }
5098
- function S(k) {
5113
+ function R(k) {
5099
5114
  i.unregister(k);
5100
5115
  }
5101
- function y() {
5116
+ function M() {
5102
5117
  return i.getTypes();
5103
5118
  }
5104
- function C(k, _) {
5119
+ function y(k, _) {
5105
5120
  n.send(k, _);
5106
5121
  }
5107
- const x = /* @__PURE__ */ new Map();
5108
- function E(k, _) {
5109
- return x.has(k) || x.set(k, /* @__PURE__ */ new Set()), x.get(k).add(_), () => {
5110
- var R;
5111
- (R = x.get(k)) == null || R.delete(_);
5122
+ const z = /* @__PURE__ */ new Map();
5123
+ function H(k, _) {
5124
+ return z.has(k) || z.set(k, /* @__PURE__ */ new Set()), z.get(k).add(_), () => {
5125
+ var L;
5126
+ (L = z.get(k)) == null || L.delete(_);
5112
5127
  };
5113
5128
  }
5114
- function T(k, _) {
5115
- var R;
5116
- (R = x.get(k)) == null || R.delete(_);
5129
+ function P(k, _) {
5130
+ var L;
5131
+ (L = z.get(k)) == null || L.delete(_);
5117
5132
  }
5118
- function L(k, _) {
5119
- var R;
5120
- (R = x.get(k)) == null || R.forEach((A) => {
5133
+ function T(k, _) {
5134
+ var L;
5135
+ (L = z.get(k)) == null || L.forEach((S) => {
5121
5136
  try {
5122
- A(_);
5137
+ S(_);
5123
5138
  } catch (D) {
5124
5139
  console.error(`Artifactuse event handler error (${k}):`, D);
5125
5140
  }
5126
5141
  });
5127
5142
  }
5128
- n.on("ai:request", (k) => L("ai:request", k)), n.on("save:request", (k) => L("save:request", k)), n.on("export:complete", (k) => L("export:complete", k)), n.on("form:submit", (k) => L("form:submit", k)), n.on("form:cancel", (k) => L("form:cancel", k)), n.on("form:step", (k) => L("form:step", k)), n.on("social:copy", (k) => L("social:copy", k)), n.on("edit:save", (k) => {
5129
- k != null && k.artifactId && (k == null ? void 0 : k.code) !== void 0 && h(k.artifactId, k.code), L("edit:save", k);
5143
+ n.on("ai:request", (k) => T("ai:request", k)), n.on("save:request", (k) => T("save:request", k)), n.on("export:complete", (k) => T("export:complete", k)), n.on("form:submit", (k) => T("form:submit", k)), n.on("form:cancel", (k) => T("form:cancel", k)), n.on("form:step", (k) => T("form:step", k)), n.on("social:copy", (k) => T("social:copy", k)), n.on("edit:save", (k) => {
5144
+ k != null && k.artifactId && (k == null ? void 0 : k.code) !== void 0 && h(k.artifactId, k.code), T("edit:save", k);
5130
5145
  });
5131
- function I() {
5146
+ function W() {
5132
5147
  o.apply();
5133
5148
  }
5134
- function G(k) {
5149
+ function K(k) {
5135
5150
  o.set(k);
5136
5151
  }
5137
- function te() {
5152
+ function U() {
5138
5153
  return o.resolved;
5139
5154
  }
5140
- function U() {
5141
- n.destroy(), x.clear(), r.clear(), ws();
5155
+ function J() {
5156
+ n.destroy(), z.clear(), r.clear(), ws();
5142
5157
  }
5143
5158
  return {
5144
5159
  // Config
@@ -5155,32 +5170,33 @@ function bn(e = {}) {
5155
5170
  openFile: c,
5156
5171
  openCode: m,
5157
5172
  updateFile: h,
5158
- closePanel: g,
5159
- togglePanel: f,
5160
- toggleFullscreen: b,
5161
- setViewMode: v,
5162
- getPanelUrl: M,
5163
- sendToPanel: C,
5173
+ openPanel: g,
5174
+ closePanel: f,
5175
+ togglePanel: b,
5176
+ toggleFullscreen: v,
5177
+ setViewMode: x,
5178
+ getPanelUrl: $,
5179
+ sendToPanel: y,
5164
5180
  // Multi-tab
5165
5181
  closeTab: (k) => r.closeTab(k),
5166
5182
  closeOtherTabs: (k) => r.closeOtherTabs(k),
5167
5183
  closeAllTabs: () => r.closeAllTabs(),
5168
5184
  // Panel management (new)
5169
- hasPanel: $,
5170
- registerPanel: z,
5171
- unregisterPanel: S,
5172
- getPanelTypes: y,
5185
+ hasPanel: A,
5186
+ registerPanel: C,
5187
+ unregisterPanel: R,
5188
+ getPanelTypes: M,
5173
5189
  panelResolver: i,
5174
5190
  // Expose for advanced use
5175
5191
  // Theme
5176
5192
  theme: o,
5177
- applyTheme: I,
5178
- setTheme: G,
5179
- getTheme: te,
5193
+ applyTheme: W,
5194
+ setTheme: K,
5195
+ getTheme: U,
5180
5196
  // Events
5181
- on: E,
5182
- off: T,
5183
- emit: L,
5197
+ on: H,
5198
+ off: P,
5199
+ emit: T,
5184
5200
  // Editor (CodeMirror integration)
5185
5201
  editor: l,
5186
5202
  // Bridge (for advanced use)
@@ -5188,7 +5204,7 @@ function bn(e = {}) {
5188
5204
  // Sharing
5189
5205
  share: u,
5190
5206
  // Cleanup
5191
- destroy: U
5207
+ destroy: J
5192
5208
  };
5193
5209
  }
5194
5210
  function Ir(e, t, r = /* @__PURE__ */ new WeakSet()) {
@@ -5230,12 +5246,12 @@ export {
5230
5246
  us as F,
5231
5247
  vt as G,
5232
5248
  yt as H,
5233
- B as I,
5249
+ O as I,
5234
5250
  kt as J,
5235
5251
  ps as K,
5236
5252
  ws as L,
5237
5253
  bs as M,
5238
- X as N,
5254
+ Y as N,
5239
5255
  Ue as O,
5240
5256
  Ct as P,
5241
5257
  vs as Q,
@@ -5251,7 +5267,7 @@ export {
5251
5267
  Vt as _,
5252
5268
  Ys as a,
5253
5269
  wn as a$,
5254
- se as a0,
5270
+ ie as a0,
5255
5271
  It as a1,
5256
5272
  xs as a2,
5257
5273
  Dt as a3,
@@ -5289,12 +5305,12 @@ export {
5289
5305
  Us as aZ,
5290
5306
  mn as a_,
5291
5307
  Nt as aa,
5292
- zs as ab,
5308
+ As as ab,
5293
5309
  Ut as ac,
5294
5310
  Gt as ad,
5295
5311
  Wt as ae,
5296
5312
  Xt as af,
5297
- As as ag,
5313
+ zs as ag,
5298
5314
  Kt as ah,
5299
5315
  Jt as ai,
5300
5316
  Qt as aj,