@aiquants/markdown-explorer 0.29.1 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,27 @@
1
- import { jsxs as B, jsx as c, Fragment as pe } from "react/jsx-runtime";
1
+ import { jsxs as B, jsx as d, Fragment as pe } from "react/jsx-runtime";
2
2
  import * as E from "react";
3
- import { createContext as ve, use as se, useMemo as X, useSyncExternalStore as re, useRef as U, useLayoutEffect as Y, useCallback as F, useId as Te, useEffect as ee, Component as Qn, Suspense as Ie, lazy as $t, useState as V, useEffectEvent as le } from "react";
4
- import { useParams as vo, useSearchParams as bo, matchPath as yo, useBlocker as ko, useNavigate as Eo, Link as So, useHref as nt, useLocation as er, useRevalidator as xo } from "react-router";
5
- import { k as To, h as tr, H as Ro, E as nr, a as rr, I as Co, J as nn, K as Oo, s as Lo, L as Mo, M as Me, e as Ne, m as Ao, O as No, Q as Do, R as Po, T as rn, U as Io, V as on, W as $o, w as _o, X as Fo } from "./location-CKuabtKl.js";
6
- import { SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS as sn, SPREADSHEET_BLOCK_LABEL_CATALOGS as Xe } from "@aiquants/markdown/code-blocks";
7
- import { H as fe, i as qo, I as rt, J as Bo, A as te, K as dt, B as ut, z as Uo, L as Ho, f as zo, N as jo, O as Vo, P as Zo, Q as Wo, R as an, x as Go, S as Ko, T as Yo, U as Xo, D as Jo, y as Qo, V as es, W as ts, X as ns, w as ln } from "./dataRoute-DLhQfdoW.js";
8
- import { HostedScrollArea as cn, SpreadsheetBlock as rs, useMarkdownToolbarState as os, MarkdownViewer as or } from "@aiquants/markdown";
9
- import { SOURCE_LINES_ATTRIBUTE as sr, parseSourceLines as ss } from "@aiquants/markdown/source-lines";
10
- import { iterateTsvRows as as, iterateTsvPrefixRows as is, serializeTsv as ls } from "@aiquants/spreadsheet/tsv";
11
- import { SPREADSHEET_MAX_OPERATION_CELLS as dn } from "@aiquants/spreadsheet/view";
12
- import { DEFAULT_CONTENT_ALIGN as cs } from "@aiquants/markdown/viewer-settings";
13
- import { w as Ct, r as Ot, a as ds, b as un, s as Oe, c as us } from "./storage-CmGHg7OA.js";
14
- import { createShouldRevalidate as fs } from "@aiquants/route-revalidation";
15
- const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`, ar = Object.freeze(Object.keys(Xe.en)), ir = (e) => Object.fromEntries(ar.map((t) => [_t(t), Xe[e][t].text])), hs = Object.freeze({
3
+ import { createContext as ve, use as se, useMemo as X, useSyncExternalStore as re, useRef as U, useLayoutEffect as Y, useCallback as F, useId as Te, useEffect as ee, Component as nr, Suspense as Ie, lazy as Ft, useState as V, useEffectEvent as le } from "react";
4
+ import { useParams as ko, useSearchParams as Eo, matchPath as So, useBlocker as xo, useNavigate as To, Link as Ro, useHref as ot, useLocation as rr, useRevalidator as Co } from "react-router";
5
+ import { k as Oo, h as or, H as Lo, E as sr, a as ar, I as Mo, J as on, K as Ao, s as No, L as Do, M as Me, e as Ne, m as Po, O as Io, Q as $o, R as _o, T as sn, U as Fo, V as an, W as qo, w as Bo, X as Uo } from "./location-CKuabtKl.js";
6
+ import { SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS as ln, SPREADSHEET_BLOCK_LABEL_CATALOGS as Je } from "@aiquants/markdown/code-blocks";
7
+ import { H as fe, i as Ho, I as st, J as zo, A as te, K as ft, B as mt, z as jo, L as Vo, f as Zo, N as Wo, O as Go, P as Ko, Q as Yo, R as cn, x as Xo, S as Jo, T as Qo, U as es, D as ts, y as ns, V as rs, W as os, X as ss, w as dn } from "./dataRoute-DLhQfdoW.js";
8
+ import { HostedScrollArea as un, SpreadsheetBlock as as, useMarkdownToolbarState as is, MarkdownViewer as ir } from "@aiquants/markdown";
9
+ import { SOURCE_LINES_ATTRIBUTE as lr, parseSourceLines as ls } from "@aiquants/markdown/source-lines";
10
+ import { iterateTsvRows as cs, iterateTsvPrefixRows as ds, serializeTsv as us } from "@aiquants/spreadsheet/tsv";
11
+ import { SPREADSHEET_MAX_OPERATION_CELLS as fn } from "@aiquants/spreadsheet/view";
12
+ import { DEFAULT_CONTENT_ALIGN as fs } from "@aiquants/markdown/viewer-settings";
13
+ import { w as Lt, r as Mt, a as ms, b as mn, s as Oe, c as hs } from "./storage-CmGHg7OA.js";
14
+ import { createShouldRevalidate as ps } from "@aiquants/route-revalidation";
15
+ const hn = Object.freeze(["en", "ja"]), gs = "en", qt = (e) => `viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`, cr = Object.freeze(Object.keys(Je.en)), dr = (e) => Object.fromEntries(cr.map((t) => [qt(t), Je[e][t].text])), ws = Object.freeze({
16
16
  panelMoved: Object.freeze(["title", "column", "position"]),
17
17
  panelMoveUnavailable: Object.freeze(["title", "move"]),
18
18
  panelDragStarted: Object.freeze(["title"]),
19
19
  panelDragCancelled: Object.freeze(["title"]),
20
20
  multiColumnRegion: Object.freeze(["column"]),
21
21
  viewerSvgImageSourceRegion: Object.freeze(["name"]),
22
- ...Object.fromEntries(ar.filter((e) => sn[e].length > 0).map((e) => [_t(e), sn[e]]))
23
- }), ps = /\{(\w+)\}/gu, lr = {
24
- ...ir("en"),
22
+ ...Object.fromEntries(cr.filter((e) => ln[e].length > 0).map((e) => [qt(e), ln[e]]))
23
+ }), vs = /\{(\w+)\}/gu, ur = {
24
+ ...dr("en"),
25
25
  explorerRegion: "Explorer",
26
26
  sourceLabel: "Source",
27
27
  refreshTreeLabel: "Refresh tree",
@@ -316,8 +316,8 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
316
316
  multiColumnEmpty: "This column is empty",
317
317
  multiColumnRegion: "Column {column}",
318
318
  panelDropHere: "Drop the panel here"
319
- }, gs = {
320
- ...ir("ja"),
319
+ }, bs = {
320
+ ...dr("ja"),
321
321
  explorerRegion: "エクスプローラー",
322
322
  sourceLabel: "ソース",
323
323
  refreshTreeLabel: "ツリーを更新",
@@ -612,24 +612,24 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
612
612
  multiColumnEmpty: "この列は空です",
613
613
  multiColumnRegion: "{column} 列目",
614
614
  panelDropHere: "ここへパネルをドロップ"
615
- }, ws = Object.freeze({
616
- en: Object.freeze(lr),
617
- ja: Object.freeze(gs)
618
- }), cr = Object.freeze(Object.keys(lr)), vs = new Set(cr), bs = (e) => vs.has(e), Ge = (e) => e === null ? "null" : typeof e == "string" ? JSON.stringify(e.length > 40 ? `${e.slice(0, 40)}…` : e) : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : typeof e, dr = (e) => {
619
- if (e === void 0) return ms;
620
- if (fn.includes(e)) return e;
621
- throw new RangeError(`[markdown-explorer] locale is the UI language (${fn.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${Ge(e)}`);
622
- }, mn = (e, t) => {
623
- const n = ws[dr(e)];
615
+ }, ys = Object.freeze({
616
+ en: Object.freeze(ur),
617
+ ja: Object.freeze(bs)
618
+ }), fr = Object.freeze(Object.keys(ur)), ks = new Set(fr), Es = (e) => ks.has(e), Ge = (e) => e === null ? "null" : typeof e == "string" ? JSON.stringify(e.length > 40 ? `${e.slice(0, 40)}…` : e) : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : typeof e, mr = (e) => {
619
+ if (e === void 0) return gs;
620
+ if (hn.includes(e)) return e;
621
+ throw new RangeError(`[markdown-explorer] locale is the UI language (${hn.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${Ge(e)}`);
622
+ }, pn = (e, t) => {
623
+ const n = ys[mr(e)];
624
624
  if (t === void 0) return n;
625
625
  if (t === null || typeof t != "object")
626
626
  throw new RangeError(`[markdown-explorer] labels must be an object; got ${Ge(t)}`);
627
- if (!To(t))
627
+ if (!Oo(t))
628
628
  throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${Ge(t)}`);
629
629
  const r = t, o = { ...n };
630
630
  for (const s of Object.keys(r)) {
631
- if (!bs(s))
632
- throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${cr.join(", ")}`);
631
+ if (!Es(s))
632
+ throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${fr.join(", ")}`);
633
633
  const a = r[s];
634
634
  if (a === void 0) continue;
635
635
  const i = typeof n[s];
@@ -637,35 +637,35 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
637
637
  throw new TypeError(`[markdown-explorer] labels.${s} must be a ${i}; got ${Ge(a)}`);
638
638
  if (typeof a == "string" && a.trim() === "")
639
639
  throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);
640
- const f = hs[s];
640
+ const f = ws[s];
641
641
  if (typeof a == "string" && f !== void 0) {
642
- for (const [, u] of a.matchAll(ps))
642
+ for (const [, u] of a.matchAll(vs))
643
643
  if (!f.includes(u ?? ""))
644
644
  throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(u)}}; it accepts ${f.map((l) => `{${l}}`).join(", ")}`);
645
645
  }
646
646
  o[s] = a;
647
647
  }
648
648
  return Object.freeze(o);
649
- }, ys = (e, t) => {
649
+ }, Ss = (e, t) => {
650
650
  if (Object.is(e, t)) return !0;
651
651
  if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
652
652
  const n = e, r = t, o = Object.keys(n), s = Object.keys(r);
653
653
  return o.length === s.length && s.every((a) => Object.hasOwn(n, a) && Object.is(n[a], r[a]));
654
- }, hn = Object.freeze(["light", "dark"]), ks = (e) => {
654
+ }, gn = Object.freeze(["light", "dark"]), xs = (e) => {
655
655
  if (e === void 0) return "light";
656
- if (hn.includes(e)) return e;
657
- throw new RangeError(`[markdown-explorer] theme must be ${hn.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
658
- }, ur = ve(null), $ = () => {
659
- const e = se(ur);
656
+ if (gn.includes(e)) return e;
657
+ throw new RangeError(`[markdown-explorer] theme must be ${gn.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
658
+ }, hr = ve(null), $ = () => {
659
+ const e = se(hr);
660
660
  if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
661
661
  return e;
662
- }, Je = (e) => {
662
+ }, Qe = (e) => {
663
663
  const { viewSettings: t } = $(), n = () => e(t.getSnapshot());
664
664
  return re(t.subscribe, n, n);
665
- }, Ft = () => {
666
- const { config: e } = $(), t = vo()["*"], [n] = bo(), r = n.toString();
667
- return X(() => tr(e, t, new URLSearchParams(r)), [e, t, r]);
668
- }, fr = {
665
+ }, Bt = () => {
666
+ const { config: e } = $(), t = ko()["*"], [n] = Eo(), r = n.toString();
667
+ return X(() => or(e, t, new URLSearchParams(r)), [e, t, r]);
668
+ }, pr = {
669
669
  unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
670
670
  forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
671
671
  "not-found": ["failureNotFoundTitle", "failureNotFoundBody"],
@@ -674,14 +674,14 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
674
674
  "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
675
675
  unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
676
676
  failed: ["failureFailedTitle", "failureFailedBody"]
677
- }, de = (e, t) => e[fr[t][0]], Re = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
678
- const { labels: o } = $(), s = de(o, e.reason), a = o[fr[e.reason][1]], i = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
677
+ }, de = (e, t) => e[pr[t][0]], Re = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
678
+ const { labels: o } = $(), s = de(o, e.reason), a = o[pr[e.reason][1]], i = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
679
679
  return /* @__PURE__ */ B("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": i, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
680
- /* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: s }),
681
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: a }),
682
- e.reason === "unauthorized" ? /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", onClick: () => window.location.reload(), children: o.reloadPage }) : n !== void 0 && e.reason === "failed" ? /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", onClick: n, children: o.retry }) : null
680
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: s }),
681
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: a }),
682
+ e.reason === "unauthorized" ? /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", onClick: () => window.location.reload(), children: o.reloadPage }) : n !== void 0 && e.reason === "failed" ? /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", onClick: n, children: o.retry }) : null
683
683
  ] });
684
- }, Es = (e, t) => {
684
+ }, Ts = (e, t) => {
685
685
  const { phase: n, save: r, dirty: o } = t;
686
686
  switch (n.kind) {
687
687
  case "opening":
@@ -707,7 +707,7 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
707
707
  break;
708
708
  }
709
709
  return o ? e.draftUnsaved : "";
710
- }, Ss = (e, t, n) => {
710
+ }, Rs = (e, t, n) => {
711
711
  switch (t.kind) {
712
712
  case "draft":
713
713
  return e.draftNotSaved;
@@ -733,38 +733,38 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
733
733
  for (const t of [...e]) t();
734
734
  }
735
735
  };
736
- }, xs = "<<<<<<<", Ts = "=======", Rs = ">>>>>>>", pn = (e, t) => e === t || e.startsWith(`${t} `), gn = (e) => Cs(e.split(`
737
- `)), Cs = (e) => {
736
+ }, Cs = "<<<<<<<", Os = "=======", Ls = ">>>>>>>", wn = (e, t) => e === t || e.startsWith(`${t} `), vn = (e) => Ms(e.split(`
737
+ `)), Ms = (e) => {
738
738
  const t = [];
739
739
  let n = null, r = null, o = 0;
740
740
  for (const s of e) {
741
741
  o += 1;
742
742
  const a = s.charCodeAt(0);
743
- a !== 60 && a !== 61 && a !== 62 || (pn(s, xs) ? (n = o, r = null) : s === Ts ? n !== null && r === null ? r = o : n = null : pn(s, Rs) && (n !== null && r !== null && t.push({ start: n, separator: r, end: o }), n = null, r = null));
743
+ a !== 60 && a !== 61 && a !== 62 || (wn(s, Cs) ? (n = o, r = null) : s === Os ? n !== null && r === null ? r = o : n = null : wn(s, Ls) && (n !== null && r !== null && t.push({ start: n, separator: r, end: o }), n = null, r = null));
744
744
  }
745
745
  return t;
746
- }, wn = (e) => e.includes(`\r
746
+ }, bn = (e) => e.includes(`\r
747
747
  `) ? `\r
748
748
  ` : `
749
- `, ft = (e) => e.replace(/\r\n?/gu, `
750
- `), Os = (e, t) => t === `
749
+ `, ht = (e) => e.replace(/\r\n?/gu, `
750
+ `), As = (e, t) => t === `
751
751
  ` ? e : e.replaceAll(`
752
752
  `, `\r
753
- `), Ls = 3, Ms = /^\d+(?:\.\d+)?$/u, As = (e) => {
754
- if (e === null || !Ms.test(e)) return null;
753
+ `), Ns = 3, Ds = /^\d+(?:\.\d+)?$/u, Ps = (e) => {
754
+ if (e === null || !Ds.test(e)) return null;
755
755
  const t = Number(e);
756
- return t >= rr && t <= nr ? t : null;
757
- }, mt = Object.freeze({ kind: "idle" }), vn = Object.freeze({ kind: "draft" }), Ns = ({ data: e, conflictLabels: t, onSaveSettled: n, sideBySideSetting: r, editorShareSetting: o }) => {
756
+ return t >= ar && t <= sr ? t : null;
757
+ }, pt = Object.freeze({ kind: "idle" }), yn = Object.freeze({ kind: "draft" }), Is = ({ data: e, conflictLabels: t, onSaveSettled: n, sideBySideSetting: r, editorShareSetting: o }) => {
758
758
  const s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), l = qe();
759
- let d = null, h = null, g = null;
760
- const v = (m, p) => {
761
- m.value = { ...m.value, ...p }, l.emit();
762
- }, y = (m, p) => s.get(m) === p, T = async (m, p) => {
759
+ let c = null, m = null, g = null;
760
+ const v = (h, p) => {
761
+ h.value = { ...h.value, ...p }, l.emit();
762
+ }, y = (h, p) => s.get(h) === p, T = async (h, p) => {
763
763
  p.controller.abort(), p.controller = new AbortController();
764
764
  const { signal: x } = p.controller;
765
765
  v(p, { phase: { kind: "opening" } });
766
- const A = await e.edit(m, x);
767
- if (!y(m, p) || x.aborted || !("kind" in A)) return;
766
+ const A = await e.edit(h, x);
767
+ if (!y(h, p) || x.aborted || !("kind" in A)) return;
768
768
  if (A.kind === "grant") {
769
769
  v(p, { phase: { kind: "grant", href: A.href } });
770
770
  return;
@@ -773,162 +773,162 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
773
773
  v(p, { phase: { kind: "failed", failure: A.failure } });
774
774
  return;
775
775
  }
776
- const I = ft(A.text), _ = A.kind === "draft";
777
- p.base = { text: I, version: _ ? null : A.version }, p.draft = I, p.ending = wn(A.text), v(p, { phase: { kind: "editing" }, history: _ ? !1 : A.history, dirty: !1, save: _ ? vn : mt, generation: p.value.generation + 1 });
778
- }, O = (m) => {
779
- const p = s.get(m);
780
- p !== void 0 && (p.controller.abort(), s.delete(m), i.delete(m));
781
- }, R = (m, p, x) => (m.set(p, x), () => {
782
- m.get(p) === x && m.delete(p);
783
- }), q = (m, p, x, A = {}) => {
784
- v(p, { ...A, save: x }), n(m, x);
785
- }, D = async (m) => {
786
- f.get(m)?.flush();
787
- const p = s.get(m);
776
+ const I = ht(A.text), _ = A.kind === "draft";
777
+ p.base = { text: I, version: _ ? null : A.version }, p.draft = I, p.ending = bn(A.text), v(p, { phase: { kind: "editing" }, history: _ ? !1 : A.history, dirty: !1, save: _ ? yn : pt, generation: p.value.generation + 1 });
778
+ }, O = (h) => {
779
+ const p = s.get(h);
780
+ p !== void 0 && (p.controller.abort(), s.delete(h), i.delete(h));
781
+ }, R = (h, p, x) => (h.set(p, x), () => {
782
+ h.get(p) === x && h.delete(p);
783
+ }), q = (h, p, x, A = {}) => {
784
+ v(p, { ...A, save: x }), n(h, x);
785
+ }, D = async (h) => {
786
+ f.get(h)?.flush();
787
+ const p = s.get(h);
788
788
  if (p === void 0 || p.value.phase.kind !== "editing" || p.base === null || p.value.save.kind === "saving") return;
789
789
  const { version: x } = p.base;
790
790
  if (x === null) {
791
- n(m, vn);
791
+ n(h, yn);
792
792
  return;
793
793
  }
794
- const A = gn(p.draft).length;
794
+ const A = vn(p.draft).length;
795
795
  if (A > 0) {
796
- q(m, p, { kind: "conflicts", count: A });
796
+ q(h, p, { kind: "conflicts", count: A });
797
797
  return;
798
798
  }
799
799
  p.controller.abort(), p.controller = new AbortController();
800
800
  const { signal: I } = p.controller;
801
801
  let _ = { text: p.base.text, version: x }, b = p.draft, S = !1;
802
802
  v(p, { save: { kind: "saving" } });
803
- for (let L = 0; L < Ls; L += 1) {
804
- const M = await e.save(m, _.version, Os(b, p.ending), I);
805
- if (!y(m, p) || I.aborted || !("kind" in M)) return;
803
+ for (let L = 0; L < Ns; L += 1) {
804
+ const M = await e.save(h, _.version, As(b, p.ending), I);
805
+ if (!y(h, p) || I.aborted || !("kind" in M)) return;
806
806
  if (M.kind === "saved") {
807
- f.get(m)?.flush(), p.base = { text: b, version: M.version }, q(m, p, { kind: "saved", merged: S }, { dirty: p.draft !== b });
807
+ f.get(h)?.flush(), p.base = { text: b, version: M.version }, q(h, p, { kind: "saved", merged: S }, { dirty: p.draft !== b });
808
808
  return;
809
809
  }
810
810
  if (M.kind === "grant") {
811
- q(m, p, { kind: "grant", href: M.href });
811
+ q(h, p, { kind: "grant", href: M.href });
812
812
  return;
813
813
  }
814
814
  if (M.kind === "failure") {
815
- q(m, p, { kind: "failed", failure: M.failure });
815
+ q(h, p, { kind: "failed", failure: M.failure });
816
816
  return;
817
817
  }
818
- const { mergeDraft: P } = await import("./merge-qfptirid.js");
819
- if (!y(m, p) || I.aborted) return;
820
- const H = f.get(m);
818
+ const { mergeDraft: P } = await import("./merge-D1jbIOPw.js");
819
+ if (!y(h, p) || I.aborted) return;
820
+ const H = f.get(h);
821
821
  H?.flush();
822
- const K = ft(M.text), w = P(_.text, p.draft, K, t());
823
- if (_ = { text: K, version: M.version }, p.base = _, p.ending = wn(M.text), p.draft = w.text, H?.adopt(w.text), w.kind === "conflicts") {
824
- q(m, p, { kind: "conflicts", count: w.conflicts }, { dirty: !0, generation: p.value.generation + 1 });
822
+ const K = ht(M.text), w = P(_.text, p.draft, K, t());
823
+ if (_ = { text: K, version: M.version }, p.base = _, p.ending = bn(M.text), p.draft = w.text, H?.adopt(w.text), w.kind === "conflicts") {
824
+ q(h, p, { kind: "conflicts", count: w.conflicts }, { dirty: !0, generation: p.value.generation + 1 });
825
825
  return;
826
826
  }
827
827
  if (S = !0, b = w.text, b === _.text) {
828
- q(m, p, { kind: "saved", merged: S }, { dirty: !1, generation: p.value.generation + 1 });
828
+ q(h, p, { kind: "saved", merged: S }, { dirty: !1, generation: p.value.generation + 1 });
829
829
  return;
830
830
  }
831
831
  v(p, { dirty: !0, generation: p.value.generation + 1 });
832
832
  }
833
- q(m, p, { kind: "failed", failure: { reason: "failed" } });
833
+ q(h, p, { kind: "failed", failure: { reason: "failed" } });
834
834
  };
835
835
  return {
836
- session: (m) => s.get(m)?.value,
836
+ session: (h) => s.get(h)?.value,
837
837
  subscribe: l.subscribe,
838
- start: (m, p) => {
839
- const x = s.get(m);
838
+ start: (h, p) => {
839
+ const x = s.get(h);
840
840
  if (x !== void 0) {
841
- v(x, { request: { anchor: p }, view: "editor" }), (x.value.phase.kind === "failed" || x.value.phase.kind === "grant") && T(m, x);
841
+ v(x, { request: { anchor: p }, view: "editor" }), (x.value.phase.kind === "failed" || x.value.phase.kind === "grant") && T(h, x);
842
842
  return;
843
843
  }
844
- a.delete(m);
844
+ a.delete(h);
845
845
  const A = {
846
- value: { path: m, phase: { kind: "opening" }, view: "editor", previewPrepared: !1, history: !1, dirty: !1, save: mt, generation: 0, request: { anchor: p } },
846
+ value: { path: h, phase: { kind: "opening" }, view: "editor", previewPrepared: !1, history: !1, dirty: !1, save: pt, generation: 0, request: { anchor: p } },
847
847
  base: null,
848
848
  draft: "",
849
849
  ending: `
850
850
  `,
851
851
  controller: new AbortController()
852
852
  };
853
- s.set(m, A), T(m, A);
853
+ s.set(h, A), T(h, A);
854
854
  },
855
- retry: (m) => {
856
- const p = s.get(m);
857
- p === void 0 || p.value.phase.kind === "editing" || T(m, p);
855
+ retry: (h) => {
856
+ const p = s.get(h);
857
+ p === void 0 || p.value.phase.kind === "editing" || T(h, p);
858
858
  },
859
- draft: (m) => {
860
- const p = s.get(m);
859
+ draft: (h) => {
860
+ const p = s.get(h);
861
861
  return p === void 0 || p.base === null ? null : p.draft;
862
862
  },
863
- setDraft: (m, p) => {
864
- const x = s.get(m);
863
+ setDraft: (h, p) => {
864
+ const x = s.get(h);
865
865
  if (x === void 0 || x.base === null) return;
866
866
  x.draft = p;
867
867
  const A = {}, I = p !== x.base.text;
868
868
  I !== x.value.dirty && (A.dirty = I);
869
869
  const { save: _ } = x.value;
870
870
  if (_.kind === "conflicts") {
871
- const b = gn(p).length;
872
- b === 0 ? A.save = mt : b !== _.count && (A.save = { kind: "conflicts", count: b });
871
+ const b = vn(p).length;
872
+ b === 0 ? A.save = pt : b !== _.count && (A.save = { kind: "conflicts", count: b });
873
873
  }
874
874
  (A.dirty !== void 0 || A.save !== void 0) && v(x, A);
875
875
  },
876
- consumeRequest: (m) => {
877
- const p = s.get(m);
876
+ consumeRequest: (h) => {
877
+ const p = s.get(h);
878
878
  p !== void 0 && p.value.request !== null && v(p, { request: null });
879
879
  },
880
880
  save: D,
881
- replaceDraft: (m, p) => {
882
- const x = f.get(m);
881
+ replaceDraft: (h, p) => {
882
+ const x = f.get(h);
883
883
  x?.flush();
884
- const A = s.get(m);
884
+ const A = s.get(h);
885
885
  if (A === void 0 || A.base === null) return;
886
- const I = ft(p);
886
+ const I = ht(p);
887
887
  A.draft = I, x?.adopt(I), v(A, { dirty: I !== A.base.text, generation: A.value.generation + 1 });
888
888
  },
889
- close: (m) => {
890
- if (!s.has(m)) return;
891
- const p = f.get(m), x = p === void 0 ? null : p.returnPoint();
892
- O(m), x === null ? a.delete(m) : a.set(m, x), l.emit();
889
+ close: (h) => {
890
+ if (!s.has(h)) return;
891
+ const p = f.get(h), x = p === void 0 ? null : p.returnPoint();
892
+ O(h), x === null ? a.delete(h) : a.set(h, x), l.emit();
893
893
  },
894
- takeReturn: (m) => {
895
- const p = a.get(m) ?? null;
896
- return a.delete(m), p;
894
+ takeReturn: (h) => {
895
+ const p = a.get(h) ?? null;
896
+ return a.delete(h), p;
897
897
  },
898
- dirtyPaths: () => [...s.values()].filter((m) => m.value.dirty).map((m) => m.value.path),
899
- discard: (m) => {
900
- for (const p of m) O(p);
901
- m.length > 0 && l.emit();
898
+ dirtyPaths: () => [...s.values()].filter((h) => h.value.dirty).map((h) => h.value.path),
899
+ discard: (h) => {
900
+ for (const p of h) O(p);
901
+ h.length > 0 && l.emit();
902
902
  },
903
903
  editorState: {
904
- get: (m) => i.get(m),
905
- set: (m, p) => {
906
- s.has(m) && i.set(m, p);
904
+ get: (h) => i.get(h),
905
+ set: (h, p) => {
906
+ s.has(h) && i.set(h, p);
907
907
  }
908
908
  },
909
- bindEditor: (m, p) => R(f, m, p),
910
- bindView: (m, p) => R(u, m, p),
911
- viewAnchor: (m) => {
912
- const p = u.get(m);
909
+ bindEditor: (h, p) => R(f, h, p),
910
+ bindView: (h, p) => R(u, h, p),
911
+ viewAnchor: (h) => {
912
+ const p = u.get(h);
913
913
  return p === void 0 ? null : p.anchor();
914
914
  },
915
- flush: (m) => f.get(m)?.flush(),
915
+ flush: (h) => f.get(h)?.flush(),
916
916
  flushDrafts: () => {
917
- for (const m of f.values()) m.flush();
917
+ for (const h of f.values()) h.flush();
918
918
  },
919
- nextConflict: (m) => f.get(m)?.nextConflict() === !0,
919
+ nextConflict: (h) => f.get(h)?.nextConflict() === !0,
920
920
  hasSessions: () => s.size > 0,
921
- unsavedAmong: (m) => {
921
+ unsavedAmong: (h) => {
922
922
  for (const p of f.values()) p.flush();
923
- return m.filter((p) => s.get(p)?.value.dirty === !0);
923
+ return h.filter((p) => s.get(p)?.value.dirty === !0);
924
924
  },
925
- askToDiscard: (m) => new Promise((p) => {
925
+ askToDiscard: (h) => new Promise((p) => {
926
926
  g?.settle(!1);
927
927
  const x = {
928
- paths: m,
928
+ paths: h,
929
929
  settle: (A) => {
930
930
  if (g === x) {
931
- if (g = null, A) for (const I of m) O(I);
931
+ if (g = null, A) for (const I of h) O(I);
932
932
  l.emit(), p(A);
933
933
  }
934
934
  }
@@ -936,37 +936,37 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
936
936
  g = x, l.emit();
937
937
  }),
938
938
  discardRequest: () => g,
939
- sideBySide: () => (d ??= r.read(), d),
940
- setSideBySide: (m) => {
941
- d !== m && (d = m, r.write(m), l.emit());
939
+ sideBySide: () => (c ??= r.read(), c),
940
+ setSideBySide: (h) => {
941
+ c !== h && (c = h, r.write(h), l.emit());
942
942
  },
943
- editorShare: () => (h ??= o.read() ?? Ro, h),
944
- setEditorShare: (m) => {
945
- if (!Number.isFinite(m)) throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(m)}`);
946
- const p = Math.min(nr, Math.max(rr, m));
947
- h !== p && (h = p, o.write(p));
943
+ editorShare: () => (m ??= o.read() ?? Lo, m),
944
+ setEditorShare: (h) => {
945
+ if (!Number.isFinite(h)) throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(h)}`);
946
+ const p = Math.min(sr, Math.max(ar, h));
947
+ m !== p && (m = p, o.write(p));
948
948
  },
949
- setView: (m, p) => {
950
- const x = s.get(m);
951
- x === void 0 || x.value.view === p || (f.get(m)?.beforeView(p), v(x, { view: p, previewPrepared: x.value.previewPrepared || p === "preview" }));
949
+ setView: (h, p) => {
950
+ const x = s.get(h);
951
+ x === void 0 || x.value.view === p || (f.get(h)?.beforeView(p), v(x, { view: p, previewPrepared: x.value.previewPrepared || p === "preview" }));
952
952
  },
953
- preparePreview: (m) => {
954
- const p = s.get(m);
953
+ preparePreview: (h) => {
954
+ const p = s.get(h);
955
955
  p !== void 0 && !p.value.previewPrepared && v(p, { previewPrepared: !0 });
956
956
  }
957
957
  };
958
- }, mr = (e) => {
958
+ }, gr = (e) => {
959
959
  e.preventDefault(), e.stopPropagation();
960
- }, Ds = (e) => e.endsWith("px") ? Number.parseFloat(e) : Number.NaN, hr = "data-aqmx-content-pane", Lt = Object.freeze({ [hr]: "" }), Ps = "--aqmx-dialog-left", Is = "--aqmx-dialog-top", $s = '[data-testid="markdown-explorer"]', _s = (e) => {
961
- const t = e.closest($s)?.querySelectorAll(`[${hr}]`), n = t?.item(t.length - 1);
960
+ }, $s = (e) => e.endsWith("px") ? Number.parseFloat(e) : Number.NaN, wr = "data-aqmx-content-pane", At = Object.freeze({ [wr]: "" }), _s = "--aqmx-dialog-left", Fs = "--aqmx-dialog-top", qs = '[data-testid="markdown-explorer"]', Bs = (e) => {
961
+ const t = e.closest(qs)?.querySelectorAll(`[${wr}]`), n = t?.item(t.length - 1);
962
962
  if (!(n instanceof HTMLElement)) throw new Error("[markdown-explorer] a dialog opened where the explorer marks no content pane");
963
963
  return n;
964
- }, Fs = (e) => {
965
- const t = Ds(getComputedStyle(e).marginTop);
964
+ }, Us = (e) => {
965
+ const t = $s(getComputedStyle(e).marginTop);
966
966
  if (Number.isNaN(t)) return null;
967
- const n = _s(e), r = e.getBoundingClientRect(), o = e.ownerDocument.documentElement, { left: s, top: a } = Co(n.getBoundingClientRect(), { width: r.width + 2 * t, height: r.height + 2 * t }, { width: o.clientWidth, height: o.clientHeight });
968
- return e.style.setProperty(Ps, `${String(s)}px`), e.style.setProperty(Is, `${String(a)}px`), n;
969
- }, qs = (e) => e.preventDefault(), pr = ({ open: e, onOpen: t, onDismiss: n }) => {
967
+ const n = Bs(e), r = e.getBoundingClientRect(), o = e.ownerDocument.documentElement, { left: s, top: a } = Mo(n.getBoundingClientRect(), { width: r.width + 2 * t, height: r.height + 2 * t }, { width: o.clientWidth, height: o.clientHeight });
968
+ return e.style.setProperty(_s, `${String(s)}px`), e.style.setProperty(Fs, `${String(a)}px`), n;
969
+ }, Hs = (e) => e.preventDefault(), vr = ({ open: e, onOpen: t, onDismiss: n }) => {
970
970
  const r = U(null), o = U(null), s = U(!1), a = U(t);
971
971
  Y(() => {
972
972
  a.current = t;
@@ -975,27 +975,27 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
975
975
  const l = r.current;
976
976
  if (l !== null)
977
977
  if (e && !l.open) {
978
- const d = l.ownerDocument.activeElement;
979
- o.current = d instanceof HTMLElement ? d : null, l.showModal(), a.current?.();
978
+ const c = l.ownerDocument.activeElement;
979
+ o.current = c instanceof HTMLElement ? c : null, l.showModal(), a.current?.();
980
980
  } else !e && l.open && (l.close(), o.current?.isConnected === !0 && o.current.focus(), o.current = null);
981
981
  }, [e]), Y(() => {
982
982
  const l = r.current;
983
983
  if (!e || l === null) return;
984
- const d = new ResizeObserver(() => g());
985
- let h = null;
984
+ const c = new ResizeObserver(() => g());
985
+ let m = null;
986
986
  const g = () => {
987
- const y = Fs(l);
988
- y === null || y === h || (h !== null && d.unobserve(h), d.observe(y), h = y);
987
+ const y = Us(l);
988
+ y === null || y === m || (m !== null && c.unobserve(m), c.observe(y), m = y);
989
989
  };
990
- g(), d.observe(l);
990
+ g(), c.observe(l);
991
991
  const v = l.ownerDocument.defaultView;
992
992
  return v?.addEventListener("resize", g), l.ownerDocument.addEventListener("scroll", g, { capture: !0, passive: !0 }), () => {
993
- d.disconnect(), v?.removeEventListener("resize", g), l.ownerDocument.removeEventListener("scroll", g, { capture: !0 });
993
+ c.disconnect(), v?.removeEventListener("resize", g), l.ownerDocument.removeEventListener("scroll", g, { capture: !0 });
994
994
  };
995
995
  }, [e]);
996
996
  const i = F(
997
997
  (l) => {
998
- l.key !== "Escape" || l.defaultPrevented || (mr(l), n());
998
+ l.key !== "Escape" || l.defaultPrevented || (gr(l), n());
999
999
  },
1000
1000
  [n]
1001
1001
  ), f = F(
@@ -1006,15 +1006,15 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
1006
1006
  ), u = F(() => {
1007
1007
  s.current && n();
1008
1008
  }, [n]);
1009
- return { ref: r, onKeyDown: i, onClick: f, onCancel: qs, onClose: u };
1010
- }, gr = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: s, onCancel: a, testId: i }) => {
1011
- const f = U(null), u = Te(), l = Te(), d = F(() => f.current?.focus(), []), h = pr({ open: e, onOpen: d, onDismiss: a });
1012
- return /* @__PURE__ */ c("dialog", { ...h, className: "aqmx-confirm", "aria-labelledby": u, "aria-describedby": l, "data-testid": i, children: /* @__PURE__ */ B("div", { className: "aqmx-confirm-panel", children: [
1013
- /* @__PURE__ */ c("p", { id: u, className: "aqmx-confirm-title", children: t }),
1014
- /* @__PURE__ */ c("p", { id: l, className: "aqmx-confirm-body", children: n }),
1009
+ return { ref: r, onKeyDown: i, onClick: f, onCancel: Hs, onClose: u };
1010
+ }, br = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: s, onCancel: a, testId: i }) => {
1011
+ const f = U(null), u = Te(), l = Te(), c = F(() => f.current?.focus(), []), m = vr({ open: e, onOpen: c, onDismiss: a });
1012
+ return /* @__PURE__ */ d("dialog", { ...m, className: "aqmx-confirm", "aria-labelledby": u, "aria-describedby": l, "data-testid": i, children: /* @__PURE__ */ B("div", { className: "aqmx-confirm-panel", children: [
1013
+ /* @__PURE__ */ d("p", { id: u, className: "aqmx-confirm-title", children: t }),
1014
+ /* @__PURE__ */ d("p", { id: l, className: "aqmx-confirm-body", children: n }),
1015
1015
  /* @__PURE__ */ B("div", { className: "aqmx-confirm-actions", children: [
1016
- /* @__PURE__ */ c("button", { ref: f, type: "button", className: "aqmx-callout-action", "data-testid": `${i}-cancel`, onClick: a, children: o }),
1017
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-aqmx-tone": "danger", "data-testid": `${i}-confirm`, onClick: s, children: r })
1016
+ /* @__PURE__ */ d("button", { ref: f, type: "button", className: "aqmx-callout-action", "data-testid": `${i}-cancel`, onClick: a, children: o }),
1017
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "data-aqmx-tone": "danger", "data-testid": `${i}-confirm`, onClick: s, children: r })
1018
1018
  ] })
1019
1019
  ] }) });
1020
1020
  }, $e = (e) => {
@@ -1027,7 +1027,7 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
1027
1027
  t.status = "rejected", t.reason = n;
1028
1028
  }
1029
1029
  )), t;
1030
- }, wr = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Ae = (e) => e.status === "fulfilled" ? e.value : void 0, Bs = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !1 }), Us = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !0 }), Hs = (e, t, n) => {
1030
+ }, yr = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Ae = (e) => e.status === "fulfilled" ? e.value : void 0, zs = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !1 }), js = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !0 }), Vs = (e, t, n) => {
1031
1031
  const r = /* @__PURE__ */ new Set(), o = [...e].reverse();
1032
1032
  for (let s = o.pop(); s !== void 0; s = o.pop()) {
1033
1033
  if (s.type !== "directory" || r.has(s.path)) continue;
@@ -1037,21 +1037,21 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
1037
1037
  if (i !== null) for (const f of [...i].reverse()) o.push(f);
1038
1038
  }
1039
1039
  return null;
1040
- }, zs = (e, t, n) => {
1040
+ }, Zs = (e, t, n) => {
1041
1041
  const r = Ae(e.read(t));
1042
- if (r === void 0 || r.status === "deferred") return Bs;
1042
+ if (r === void 0 || r.status === "deferred") return zs;
1043
1043
  if (r.status === "error") return { readme: { status: "failed", failure: r.failure, retry: () => e.retry(t) }, claim: !1 };
1044
- const o = Hs(r.entries, n, (a) => e.children(t, a));
1045
- if (o !== null) return { readme: { status: "ok", readme: nn(o) }, claim: !1 };
1044
+ const o = Vs(r.entries, n, (a) => e.children(t, a));
1045
+ if (o !== null) return { readme: { status: "ok", readme: on(o) }, claim: !1 };
1046
1046
  const s = e.children(t, n);
1047
- return s === void 0 || s.status === "loading" ? Us : s.status === "failed" ? { readme: { status: "failed", failure: s.failure, retry: () => e.retryChildren(t, n) }, claim: !0 } : { readme: { status: "ok", readme: nn(s.entries) }, claim: !0 };
1048
- }, js = (e, t, n) => {
1049
- const { readme: r } = zs(e, t, n);
1047
+ return s === void 0 || s.status === "loading" ? js : s.status === "failed" ? { readme: { status: "failed", failure: s.failure, retry: () => e.retryChildren(t, n) }, claim: !0 } : { readme: { status: "ok", readme: on(s.entries) }, claim: !0 };
1048
+ }, Ws = (e, t, n) => {
1049
+ const { readme: r } = Zs(e, t, n);
1050
1050
  return r.status === "ok" ? r.readme : null;
1051
- }, Vs = (e, t, n) => {
1052
- const r = yo({ path: `${e.basePath}/*`, end: !0 }, t.pathname);
1051
+ }, Gs = (e, t, n) => {
1052
+ const r = So({ path: `${e.basePath}/*`, end: !0 }, t.pathname);
1053
1053
  if (r === null) return /* @__PURE__ */ new Set();
1054
- const { location: o } = tr(e, r.params["*"], new URLSearchParams(t.search));
1054
+ const { location: o } = or(e, r.params["*"], new URLSearchParams(t.search));
1055
1055
  switch (o.view) {
1056
1056
  case "tree": {
1057
1057
  const s = o.folder === null ? o.doc : n(o.source, o.folder);
@@ -1062,24 +1062,24 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
1062
1062
  case "multi":
1063
1063
  return new Set(o.docs);
1064
1064
  }
1065
- }, vr = (e) => {
1065
+ }, kr = (e) => {
1066
1066
  const { edits: t } = $(), n = F(() => t.session(e), [t, e]);
1067
- return re(t.subscribe, n, Zs);
1068
- }, br = () => !1, Zs = () => {
1069
- }, Ws = () => {
1067
+ return re(t.subscribe, n, Ks);
1068
+ }, Er = () => !1, Ks = () => {
1069
+ }, Ys = () => {
1070
1070
  const { edits: e } = $();
1071
- return re(e.subscribe, e.hasSessions, br);
1072
- }, Gs = () => {
1071
+ return re(e.subscribe, e.hasSessions, Er);
1072
+ }, Xs = () => {
1073
1073
  const { edits: e } = $();
1074
- return re(e.subscribe, e.sideBySide, br);
1075
- }, Ks = () => null, Ys = () => {
1074
+ return re(e.subscribe, e.sideBySide, Er);
1075
+ }, Js = () => null, Qs = () => {
1076
1076
  const { edits: e, labels: t, config: n, trees: r } = $(), o = U([]), s = F(
1077
1077
  ({ nextLocation: g }) => {
1078
- const v = Vs(n, g, (y, T) => js(r, y, T));
1078
+ const v = Gs(n, g, (y, T) => Ws(r, y, T));
1079
1079
  return e.flushDrafts(), o.current = e.dirtyPaths().filter((y) => !v.has(y)), o.current.length > 0;
1080
1080
  },
1081
1081
  [e, n, r]
1082
- ), a = ko(s), i = Ws();
1082
+ ), a = xo(s), i = Ys();
1083
1083
  ee(() => {
1084
1084
  if (!i) return;
1085
1085
  const g = (v) => {
@@ -1087,13 +1087,13 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
1087
1087
  };
1088
1088
  return window.addEventListener("beforeunload", g), () => window.removeEventListener("beforeunload", g);
1089
1089
  }, [i, e]);
1090
- const f = re(e.subscribe, e.discardRequest, Ks), u = a.state === "blocked", l = u ? o.current : f === null ? [] : f.paths, d = l.map((g) => fe(g)).join(", "), h = l.length > 0 && l.every((g) => e.session(g)?.save.kind === "draft");
1091
- return /* @__PURE__ */ c(
1092
- gr,
1090
+ const f = re(e.subscribe, e.discardRequest, Js), u = a.state === "blocked", l = u ? o.current : f === null ? [] : f.paths, c = l.map((g) => fe(g)).join(", "), m = l.length > 0 && l.every((g) => e.session(g)?.save.kind === "draft");
1091
+ return /* @__PURE__ */ d(
1092
+ br,
1093
1093
  {
1094
1094
  open: u || f !== null,
1095
- title: h ? t.draftDiscardTitle : t.unsavedTitle,
1096
- body: h ? t.draftDiscardBody(d) : t.unsavedBody(d),
1095
+ title: m ? t.draftDiscardTitle : t.unsavedTitle,
1096
+ body: m ? t.draftDiscardBody(c) : t.unsavedBody(c),
1097
1097
  confirmLabel: t.unsavedDiscard,
1098
1098
  cancelLabel: t.unsavedStay,
1099
1099
  testId: "markdown-explorer-unsaved-guard",
@@ -1114,7 +1114,7 @@ const fn = Object.freeze(["en", "ja"]), ms = "en", _t = (e) => `viewerSpreadshee
1114
1114
  }
1115
1115
  );
1116
1116
  };
1117
- function Xs({
1117
+ function ea({
1118
1118
  title: e,
1119
1119
  titleId: t,
1120
1120
  ...n
@@ -1135,18 +1135,18 @@ function Xs({
1135
1135
  clipRule: "evenodd"
1136
1136
  }));
1137
1137
  }
1138
- const Js = /* @__PURE__ */ E.forwardRef(Xs);
1139
- let ht = null;
1140
- const yr = () => (ht ??= import("./EditSurface-BrdChI9n.js").catch((e) => {
1141
- throw ht = null, e;
1142
- }), ht), Qs = () => {
1143
- yr().catch(() => {
1138
+ const ta = /* @__PURE__ */ E.forwardRef(ea);
1139
+ let gt = null;
1140
+ const Sr = () => (gt ??= import("./EditSurface-DY1VNM9L.js").catch((e) => {
1141
+ throw gt = null, e;
1142
+ }), gt), na = () => {
1143
+ Sr().catch(() => {
1144
1144
  });
1145
- }, ea = (e) => {
1146
- const { default: t } = se(yr());
1147
- return /* @__PURE__ */ c(t, { ...e });
1145
+ }, ra = (e) => {
1146
+ const { default: t } = se(Sr());
1147
+ return /* @__PURE__ */ d(t, { ...e });
1148
1148
  };
1149
- class ta extends Qn {
1149
+ class oa extends nr {
1150
1150
  state = { failed: !1 };
1151
1151
  static getDerivedStateFromError() {
1152
1152
  return { failed: !0 };
@@ -1156,55 +1156,55 @@ class ta extends Qn {
1156
1156
  return this.state.failed ? this.props.fallback(this.retry) : this.props.children;
1157
1157
  }
1158
1158
  }
1159
- const qt = `[${sr}]`, na = "[data-aqmd-content]", ra = 'a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], [data-aqmd-spreadsheet-fullscreen], [data-aqmd-svg-image-source]', oa = 200, _e = (e) => ss(e.getAttribute(sr)), sa = (e, t) => {
1159
+ const Ut = `[${lr}]`, sa = "[data-aqmd-content]", aa = 'a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], [data-aqmd-spreadsheet-fullscreen], [data-aqmd-svg-image-source]', ia = 200, _e = (e) => ls(e.getAttribute(lr)), la = (e, t) => {
1160
1160
  for (let r = e; r !== null && t.contains(r); r = r.parentElement) {
1161
1161
  const o = _e(r);
1162
1162
  if (o !== null) return { block: r, lines: o, own: !0 };
1163
1163
  }
1164
1164
  let n = null;
1165
- for (const r of t.querySelectorAll(qt)) {
1165
+ for (const r of t.querySelectorAll(Ut)) {
1166
1166
  if (!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING)) break;
1167
1167
  const o = _e(r);
1168
1168
  o !== null && (n = { block: r, lines: o });
1169
1169
  }
1170
1170
  return n === null ? null : { ...n, own: !1 };
1171
- }, aa = (e, t) => {
1171
+ }, ca = (e, t) => {
1172
1172
  let n = 0;
1173
1173
  for (let r = e.indexOf(t); r >= 0; r = e.indexOf(t, r + t.length)) n += 1;
1174
1174
  return n;
1175
- }, ia = (e) => e.closest(na) !== null && e.closest(ra) === null, la = (e, t, n) => {
1176
- const r = sa(e, t);
1175
+ }, da = (e) => e.closest(sa) !== null && e.closest(aa) === null, ua = (e, t, n) => {
1176
+ const r = la(e, t);
1177
1177
  if (r === null) return null;
1178
1178
  const { block: o, own: s } = r;
1179
1179
  if (!s) {
1180
1180
  const i = r.lines.last + 1;
1181
- return { lines: { first: i, last: i }, word: null, occurrence: 0, clientTop: Qe(e) };
1181
+ return { lines: { first: i, last: i }, word: null, occurrence: 0, clientTop: et(e) };
1182
1182
  }
1183
- const a = fa(o, n);
1184
- return a === null ? { lines: r.lines, word: null, occurrence: 0, clientTop: Qe(o) } : { lines: r.lines, word: a.text, occurrence: a.occurrence, clientTop: a.clientTop };
1185
- }, ca = (e, t) => {
1183
+ const a = pa(o, n);
1184
+ return a === null ? { lines: r.lines, word: null, occurrence: 0, clientTop: et(o) } : { lines: r.lines, word: a.text, occurrence: a.occurrence, clientTop: a.clientTop };
1185
+ }, fa = (e, t) => {
1186
1186
  let n = null, r = null, o = null;
1187
- for (const a of e.querySelectorAll(qt)) {
1187
+ for (const a of e.querySelectorAll(Ut)) {
1188
1188
  const i = _e(a);
1189
1189
  if (i === null) continue;
1190
- n ??= ua(t, a);
1190
+ n ??= ha(t, a);
1191
1191
  const { top: f, bottom: u } = a.getBoundingClientRect();
1192
1192
  f <= n && n < u ? r = { lines: i, block: a } : o === null && f >= n && (o = { lines: i, block: a });
1193
1193
  }
1194
1194
  const s = r === null ? o : r;
1195
- return s === null ? null : { lines: s.lines, word: null, occurrence: 0, clientTop: Qe(s.block) };
1196
- }, da = (e) => e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, ua = (e, t) => {
1195
+ return s === null ? null : { lines: s.lines, word: null, occurrence: 0, clientTop: et(s.block) };
1196
+ }, ma = (e) => e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, ha = (e, t) => {
1197
1197
  const n = Number.parseFloat(getComputedStyle(t).scrollMarginTop);
1198
- return da(e) + (Number.isFinite(n) ? n : 0);
1199
- }, fa = (e, t) => {
1198
+ return ma(e) + (Number.isFinite(n) ? n : 0);
1199
+ }, pa = (e, t) => {
1200
1200
  if (t === null || t.rangeCount === 0) return null;
1201
1201
  const n = t.getRangeAt(0);
1202
1202
  if (!(e.contains(n.startContainer) && e.contains(n.endContainer))) return null;
1203
1203
  const r = n.toString().trim();
1204
- if (r === "" || r.length > oa || /[\r\n]/u.test(r)) return null;
1204
+ if (r === "" || r.length > ia || /[\r\n]/u.test(r)) return null;
1205
1205
  const o = e.ownerDocument.createRange();
1206
- return o.setStart(e, 0), o.setEnd(n.startContainer, n.startOffset), { text: r, occurrence: aa(o.toString(), r), clientTop: n.getBoundingClientRect().top };
1207
- }, wu = (e, t) => {
1206
+ return o.setStart(e, 0), o.setEnd(n.startContainer, n.startOffset), { text: r, occurrence: ca(o.toString(), r), clientTop: n.getBoundingClientRect().top };
1207
+ }, Ru = (e, t) => {
1208
1208
  const n = e.split(`
1209
1209
  `), r = Math.min(t.lines.first, n.length), o = Math.min(t.lines.last, n.length), s = { line: r, column: 0 };
1210
1210
  if (t.word === null) return s;
@@ -1216,26 +1216,26 @@ const qt = `[${sr}]`, na = "[data-aqmd-content]", ra = 'a[href], button, input,
1216
1216
  a += 1;
1217
1217
  }
1218
1218
  }
1219
- return a > 0 ? ma(n, r, o, t.word) ?? s : s;
1220
- }, ma = (e, t, n, r) => {
1219
+ return a > 0 ? ga(n, r, o, t.word) ?? s : s;
1220
+ }, ga = (e, t, n, r) => {
1221
1221
  for (let o = n; o >= t; o -= 1) {
1222
1222
  const s = (e[o - 1] ?? "").lastIndexOf(r);
1223
1223
  if (s >= 0) return { line: o, column: s };
1224
1224
  }
1225
1225
  return null;
1226
- }, ha = (e, t) => {
1226
+ }, wa = (e, t) => {
1227
1227
  let n = null, r = null;
1228
- for (const o of e.querySelectorAll(qt)) {
1228
+ for (const o of e.querySelectorAll(Ut)) {
1229
1229
  const s = _e(o);
1230
1230
  s === null || s.first > t || (s.last >= t ? n = o : (r === null || s.last >= r.last) && (r = { element: o, last: s.last }));
1231
1231
  }
1232
1232
  return n !== null ? n : r === null ? null : r.element;
1233
- }, pa = (e, t) => {
1234
- const { bottom: n } = e.getBoundingClientRect(), r = Qe(e), o = _e(e);
1233
+ }, va = (e, t) => {
1234
+ const { bottom: n } = e.getBoundingClientRect(), r = et(e), o = _e(e);
1235
1235
  if (o === null) return r;
1236
1236
  const s = Math.min(Math.max(t - o.first, 0) / (o.last - o.first + 1), 1);
1237
1237
  return r + (n - r) * s;
1238
- }, Qe = (e) => {
1238
+ }, et = (e) => {
1239
1239
  const t = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT);
1240
1240
  for (let n = t.nextNode(); n !== null; n = t.nextNode()) {
1241
1241
  const o = (n.textContent ?? "").search(/\S/u);
@@ -1246,20 +1246,20 @@ const qt = `[${sr}]`, na = "[data-aqmd-content]", ra = 'a[href], button, input,
1246
1246
  if (i > 0) return a;
1247
1247
  }
1248
1248
  return e.getBoundingClientRect().top;
1249
- }, Bt = Object.freeze({
1249
+ }, Ht = Object.freeze({
1250
1250
  browse: Object.freeze({ replace: !0, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
1251
1251
  "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
1252
1252
  "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
1253
1253
  "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
1254
- }), vu = (e) => Bt[e], ot = () => {
1255
- const e = Eo();
1254
+ }), Cu = (e) => Ht[e], at = () => {
1255
+ const e = To();
1256
1256
  return F(
1257
1257
  (t, n) => {
1258
- e(t, Bt[n]);
1258
+ e(t, Ht[n]);
1259
1259
  },
1260
1260
  [e]
1261
1261
  );
1262
- }, ga = ({ navigation: e, ...t }) => /* @__PURE__ */ c(So, { ...t, ...Bt[e] }), kr = (e) => {
1262
+ }, ba = ({ navigation: e, ...t }) => /* @__PURE__ */ d(Ro, { ...t, ...Ht[e] }), xr = (e) => {
1263
1263
  const t = e.ownerDocument;
1264
1264
  if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
1265
1265
  if (e.hasAttribute("tabindex")) return !1;
@@ -1269,7 +1269,7 @@ const qt = `[${sr}]`, na = "[data-aqmd-content]", ra = 'a[href], button, input,
1269
1269
  t.activeElement !== e && (e.removeAttribute("tabindex"), e.removeEventListener("blur", n));
1270
1270
  };
1271
1271
  return e.addEventListener("blur", n), !0;
1272
- }, wa = (e, t) => {
1272
+ }, ya = (e, t) => {
1273
1273
  const n = U(null), r = U(null), o = U(null), s = F(() => {
1274
1274
  n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
1275
1275
  }, []);
@@ -1283,11 +1283,11 @@ const qt = `[${sr}]`, na = "[data-aqmd-content]", ra = 'a[href], button, input,
1283
1283
  return;
1284
1284
  }
1285
1285
  e.prefetch(u);
1286
- const d = e.peek(u);
1287
- if (d?.status !== "pending") return;
1288
- const h = Promise.allSettled([d.promise]);
1289
- o.current = h, h.then(() => {
1290
- o.current === h && (o.current = null);
1286
+ const c = e.peek(u);
1287
+ if (c?.status !== "pending") return;
1288
+ const m = Promise.allSettled([c.promise]);
1289
+ o.current = m, m.then(() => {
1290
+ o.current === m && (o.current = null);
1291
1291
  });
1292
1292
  },
1293
1293
  [e]
@@ -1296,7 +1296,7 @@ const qt = `[${sr}]`, na = "[data-aqmd-content]", ra = 'a[href], button, input,
1296
1296
  const l = t(u);
1297
1297
  l !== r.current && (s(), l !== null && (r.current = l, n.current = window.setTimeout(() => {
1298
1298
  n.current = null, a(l);
1299
- }, Oo)));
1299
+ }, Ao)));
1300
1300
  },
1301
1301
  [s, t, a]
1302
1302
  ), f = F(
@@ -1314,8 +1314,8 @@ const qt = `[${sr}]`, na = "[data-aqmd-content]", ra = 'a[href], button, input,
1314
1314
  }),
1315
1315
  [i, f]
1316
1316
  );
1317
- }, va = $t(() => import("./NativeScrollBar-ybJw3OHE.js").then((e) => ({ default: e.NativeScrollBar })));
1318
- class ba extends Qn {
1317
+ }, ka = Ft(() => import("./NativeScrollBar-C4vkvdGz.js").then((e) => ({ default: e.NativeScrollBar })));
1318
+ class Ea extends nr {
1319
1319
  state = { failed: !1 };
1320
1320
  static getDerivedStateFromError() {
1321
1321
  return { failed: !0 };
@@ -1327,33 +1327,33 @@ class ba extends Qn {
1327
1327
  return this.state.failed ? null : this.props.children;
1328
1328
  }
1329
1329
  }
1330
- const ya = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(ba, { children: /* @__PURE__ */ c(Ie, { fallback: null, children: /* @__PURE__ */ c(va, { scroller: e, withCircle: t }) }) }), Er = (e) => /* @__PURE__ */ c(ya, { scroller: e, withCircle: !0 }), bu = 8, Ut = Lo, Sr = Mo[3], xr = Ut + 2 * Sr, yu = -(Ut + Sr), ka = Object.freeze({ minSpeedMultiplier: 0.25, maxSpeedMultiplier: 18 });
1331
- let Tr = null, pt = null;
1332
- const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1333
- Mt.delete(e);
1334
- }), Sa = () => {
1335
- pt === null && (pt = import("./tapScrollCircle-DYmzWI-8.js").then((e) => {
1330
+ const Sa = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Ea, { children: /* @__PURE__ */ d(Ie, { fallback: null, children: /* @__PURE__ */ d(ka, { scroller: e, withCircle: t }) }) }), Tr = (e) => /* @__PURE__ */ d(Sa, { scroller: e, withCircle: !0 }), Ou = 8, zt = No, Rr = Do[3], Cr = zt + 2 * Rr, Lu = -(zt + Rr), xa = Object.freeze({ minSpeedMultiplier: 0.25, maxSpeedMultiplier: 18 });
1331
+ let Or = null, wt = null;
1332
+ const Nt = /* @__PURE__ */ new Set(), Ta = (e) => (Nt.add(e), () => {
1333
+ Nt.delete(e);
1334
+ }), Ra = () => {
1335
+ wt === null && (wt = import("./tapScrollCircle-DYQ8P2ag.js").then((e) => {
1336
1336
  const t = e.TAP_SCROLL_CIRCLE.renderVisual;
1337
1337
  if (t === void 0) throw new TypeError("[markdown-explorer] the bars' tap-scroll circle has no look to share");
1338
- Tr = t;
1339
- for (const n of [...Mt]) n();
1338
+ Or = t;
1339
+ for (const n of [...Nt]) n();
1340
1340
  }).catch((e) => {
1341
- pt = null, console.error("[markdown-explorer] the look of a table's tap-scroll circle failed to load; the circle still scrolls without it.", e);
1341
+ wt = null, console.error("[markdown-explorer] the look of a table's tap-scroll circle failed to load; the circle still scrolls without it.", e);
1342
1342
  }));
1343
- }, xa = ({ look: e, state: t }) => e(t), Ta = (e) => {
1343
+ }, Ca = ({ look: e, state: t }) => e(t), Oa = (e) => {
1344
1344
  const t = re(
1345
- Ea,
1346
- () => Tr,
1345
+ Ta,
1346
+ () => Or,
1347
1347
  () => null
1348
1348
  );
1349
1349
  return ee(() => {
1350
- t === null && Sa();
1351
- }, [t]), t === null ? null : /* @__PURE__ */ c(xa, { look: t, state: e });
1352
- }, Rr = Object.freeze({
1353
- renderVisual: (e) => /* @__PURE__ */ c(Ta, { ...e }),
1354
- ...ka,
1355
- size: Ut
1356
- }), Cr = () => {
1350
+ t === null && Ra();
1351
+ }, [t]), t === null ? null : /* @__PURE__ */ d(Ca, { look: t, state: e });
1352
+ }, Lr = Object.freeze({
1353
+ renderVisual: (e) => /* @__PURE__ */ d(Oa, { ...e }),
1354
+ ...xa,
1355
+ size: zt
1356
+ }), Mr = () => {
1357
1357
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
1358
1358
  let n = !1;
1359
1359
  const r = (o) => {
@@ -1380,18 +1380,18 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1380
1380
  resumes: (o) => t.delete(o),
1381
1381
  heldKeys: () => [...e.keys()]
1382
1382
  };
1383
- }, et = (e, t) => {
1383
+ }, tt = (e, t) => {
1384
1384
  if (Object.is(e, t)) return !0;
1385
1385
  if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
1386
1386
  if (Array.isArray(e) || Array.isArray(t))
1387
- return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((s, a) => et(s, t[a]));
1387
+ return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((s, a) => tt(s, t[a]));
1388
1388
  const n = e, r = t, o = Object.keys(n);
1389
- return o.length !== Object.keys(r).length ? !1 : o.every((s) => Object.hasOwn(r, s) && et(n[s], r[s]));
1390
- }, Ra = 55e3, bn = Object.freeze({ status: "deferred" }), gt = Object.freeze({ status: "refreshed" }), wt = Object.freeze({ status: "shown", failed: !1 }), je = Object.freeze({ status: "shown", failed: !0 }), Ve = Object.freeze({ status: "superseded" }), ge = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, Ca = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", Oa = ({ client: e, capacity: t }) => {
1389
+ return o.length !== Object.keys(r).length ? !1 : o.every((s) => Object.hasOwn(r, s) && tt(n[s], r[s]));
1390
+ }, La = 55e3, kn = Object.freeze({ status: "deferred" }), vt = Object.freeze({ status: "refreshed" }), bt = Object.freeze({ status: "shown", failed: !1 }), je = Object.freeze({ status: "shown", failed: !0 }), Ve = Object.freeze({ status: "superseded" }), ge = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, Ma = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", Aa = ({ client: e, capacity: t }) => {
1391
1391
  if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
1392
- const n = /* @__PURE__ */ new Map(), r = Cr(), o = qe(), s = /* @__PURE__ */ new WeakSet(), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
1392
+ const n = /* @__PURE__ */ new Map(), r = Mr(), o = qe(), s = /* @__PURE__ */ new WeakSet(), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
1393
1393
  let u = 0;
1394
- const l = o.emit, d = () => (u += 1, u), h = () => {
1394
+ const l = o.emit, c = () => (u += 1, u), m = () => {
1395
1395
  if (!(n.size <= t))
1396
1396
  for (const b of [...n.keys()]) {
1397
1397
  if (n.size <= t) return;
@@ -1399,13 +1399,13 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1399
1399
  }
1400
1400
  }, g = (b, S) => {
1401
1401
  n.delete(b), n.set(b, S);
1402
- }, v = (b) => performance.now() - b.validatedAt >= Ra, y = (b, S, L) => {
1403
- const M = n.get(b), P = ge(M?.snapshot), H = L || M?.refreshPending === !0, K = $e(e.document(b, { refresh: H }).then((k) => ({ status: "loaded", document: k }))), w = { snapshot: { status: "pending", promise: K, previous: P }, validatedAt: performance.now(), opened: S, background: null, refreshPending: !1, seeded: void 0, stamp: d() };
1404
- return g(b, w), h(), K.then((k) => {
1405
- n.get(b) === w && (w.snapshot = k, w.stamp = d(), l());
1402
+ }, v = (b) => performance.now() - b.validatedAt >= La, y = (b, S, L) => {
1403
+ const M = n.get(b), P = ge(M?.snapshot), H = L || M?.refreshPending === !0, K = $e(e.document(b, { refresh: H }).then((k) => ({ status: "loaded", document: k }))), w = { snapshot: { status: "pending", promise: K, previous: P }, validatedAt: performance.now(), opened: S, background: null, refreshPending: !1, seeded: void 0, stamp: c() };
1404
+ return g(b, w), m(), K.then((k) => {
1405
+ n.get(b) === w && (w.snapshot = k, w.stamp = c(), l());
1406
1406
  }), w;
1407
1407
  }, T = (b, S, L, M, P, H) => {
1408
- S.background === L && (S.background = null, !(n.get(b) !== S || S.snapshot !== M) && (P.kind === "failure" && M.document.kind !== "failure" || (S.validatedAt = H, S.stamp = d(), et(M.document, P) || (S.snapshot = { status: "loaded", document: P }), l())));
1408
+ S.background === L && (S.background = null, !(n.get(b) !== S || S.snapshot !== M) && (P.kind === "failure" && M.document.kind !== "failure" || (S.validatedAt = H, S.stamp = c(), tt(M.document, P) || (S.snapshot = { status: "loaded", document: P }), l())));
1409
1409
  }, O = async (b, S) => {
1410
1410
  const L = S.snapshot;
1411
1411
  if (L.status !== "loaded") return null;
@@ -1432,7 +1432,7 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1432
1432
  }
1433
1433
  const M = f.get(b);
1434
1434
  M === void 0 ? f.set(b, /* @__PURE__ */ new Set([L])) : M.add(L);
1435
- }), m = (b, S) => {
1435
+ }), h = (b, S) => {
1436
1436
  const L = a.get(b);
1437
1437
  if (L === void 0) {
1438
1438
  S.resolve(null);
@@ -1444,17 +1444,17 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1444
1444
  }
1445
1445
  L.waiters.add(S);
1446
1446
  }, p = async (b, S, L) => {
1447
- const M = await new Promise((P) => m(b, { stamp: S.stamp, resolve: P }));
1447
+ const M = await new Promise((P) => h(b, { stamp: S.stamp, resolve: P }));
1448
1448
  if (n.get(b) !== S) return Ve;
1449
- if (M === null) return L ? gt : wt;
1450
- if (!L) return M.failure === null ? wt : je;
1449
+ if (M === null) return L ? vt : bt;
1450
+ if (!L) return M.failure === null ? bt : je;
1451
1451
  switch (M.before) {
1452
1452
  case "copy":
1453
- return M.failure === null ? gt : { status: "failed", failure: M.failure };
1453
+ return M.failure === null ? vt : { status: "failed", failure: M.failure };
1454
1454
  case "failure":
1455
- return M.failure === null ? wt : je;
1455
+ return M.failure === null ? bt : je;
1456
1456
  case "none":
1457
- return M.failure === null ? gt : je;
1457
+ return M.failure === null ? vt : je;
1458
1458
  }
1459
1459
  }, x = (b) => {
1460
1460
  const S = { showing: "none", last: null, waiters: /* @__PURE__ */ new Set() };
@@ -1473,7 +1473,7 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1473
1473
  L = !0, a.get(b) === S && a.delete(b);
1474
1474
  const M = [...S.waiters];
1475
1475
  S.waiters.clear(), M.length > 0 && queueMicrotask(() => {
1476
- for (const P of M) m(b, P);
1476
+ for (const P of M) h(b, P);
1477
1477
  });
1478
1478
  }
1479
1479
  };
@@ -1484,7 +1484,7 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1484
1484
  if (L) return;
1485
1485
  L = !0, S();
1486
1486
  const M = n.get(b);
1487
- M !== void 0 && g(b, M), h(), r.isHeld(b) || queueMicrotask(() => {
1487
+ M !== void 0 && g(b, M), m(), r.isHeld(b) || queueMicrotask(() => {
1488
1488
  r.isHeld(b) || q(b);
1489
1489
  });
1490
1490
  };
@@ -1513,8 +1513,8 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1513
1513
  seed: (b, S) => {
1514
1514
  const L = performance.now(), M = $e(
1515
1515
  S.then(
1516
- (k) => k === null ? bn : { status: "loaded", document: k },
1517
- () => bn
1516
+ (k) => k === null ? kn : { status: "loaded", document: k },
1517
+ () => kn
1518
1518
  )
1519
1519
  ), P = n.get(b);
1520
1520
  if (P !== void 0 && P.snapshot.status === "loaded") {
@@ -1528,9 +1528,9 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1528
1528
  });
1529
1529
  return;
1530
1530
  }
1531
- const H = P !== void 0 && P.snapshot.status === "pending" ? P.snapshot.previous : null, K = { status: "pending", promise: M, previous: H }, w = { snapshot: K, validatedAt: L, opened: P?.opened === !0, background: null, refreshPending: P?.refreshPending === !0, seeded: K, stamp: d() };
1532
- g(b, w), h(), M.then((k) => {
1533
- n.get(b) === w && (k.status === "deferred" && r.isHeld(b) ? y(b, w.opened, !1) : (w.snapshot = k, w.stamp = d()), l());
1531
+ const H = P !== void 0 && P.snapshot.status === "pending" ? P.snapshot.previous : null, K = { status: "pending", promise: M, previous: H }, w = { snapshot: K, validatedAt: L, opened: P?.opened === !0, background: null, refreshPending: P?.refreshPending === !0, seeded: K, stamp: c() };
1532
+ g(b, w), m(), M.then((k) => {
1533
+ n.get(b) === w && (k.status === "deferred" && r.isHeld(b) ? y(b, w.opened, !1) : (w.snapshot = k, w.stamp = c()), l());
1534
1534
  });
1535
1535
  },
1536
1536
  invalidate: () => {
@@ -1550,7 +1550,7 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1550
1550
  },
1551
1551
  refresh: async (b) => {
1552
1552
  const S = n.get(b);
1553
- if (S !== void 0 && Ca(S.snapshot)) {
1553
+ if (S !== void 0 && Ma(S.snapshot)) {
1554
1554
  S.refreshPending = !0;
1555
1555
  const P = await O(b, S);
1556
1556
  return P === null ? Ve : P.kind === "failure" ? { status: "failed", failure: P.failure } : p(b, S, !0);
@@ -1577,11 +1577,11 @@ const Mt = /* @__PURE__ */ new Set(), Ea = (e) => (Mt.add(e), () => {
1577
1577
  },
1578
1578
  noteFailureShown: (b) => s.has(b) ? !1 : (s.add(b), !0)
1579
1579
  };
1580
- }, we = ve("fill"), La = "--aqmx-tap-circle-gutter", Ma = Object.freeze({ blockSize: "100%", [La]: `${String(xr)}px` }), Be = ({ scrollerProps: e, children: t }) => se(we) === "content" ? /* @__PURE__ */ c(cn, { scrollerProps: e, children: t }) : /* @__PURE__ */ c(cn, { scrollerProps: { ...e, style: Ma }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: Er, children: t }), Aa = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Na = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), Ce = ({ label: e, testId: t }) => /* @__PURE__ */ B(pe, { children: [
1581
- /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": t, children: Aa.map((n) => /* @__PURE__ */ c("span", {}, n)) }),
1582
- /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: e })
1583
- ] }), Ht = ({ failure: e, onRetry: t, testId: n }) => /* @__PURE__ */ c(Be, { scrollerProps: Na, children: /* @__PURE__ */ c(Re, { failure: e, alert: !1, onRetry: t, testId: n }) });
1584
- function Da({
1580
+ }, we = ve("fill"), Na = "--aqmx-tap-circle-gutter", Da = Object.freeze({ blockSize: "100%", [Na]: `${String(Cr)}px` }), Be = ({ scrollerProps: e, children: t }) => se(we) === "content" ? /* @__PURE__ */ d(un, { scrollerProps: e, children: t }) : /* @__PURE__ */ d(un, { scrollerProps: { ...e, style: Da }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: Tr, children: t }), Pa = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Ia = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), Ce = ({ label: e, testId: t }) => /* @__PURE__ */ B(pe, { children: [
1581
+ /* @__PURE__ */ d("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": t, children: Pa.map((n) => /* @__PURE__ */ d("span", {}, n)) }),
1582
+ /* @__PURE__ */ d("p", { className: "aqmx-sr-only", children: e })
1583
+ ] }), jt = ({ failure: e, onRetry: t, testId: n }) => /* @__PURE__ */ d(Be, { scrollerProps: Ia, children: /* @__PURE__ */ d(Re, { failure: e, alert: !1, onRetry: t, testId: n }) });
1584
+ function $a({
1585
1585
  title: e,
1586
1586
  titleId: t,
1587
1587
  ...n
@@ -1606,8 +1606,8 @@ function Da({
1606
1606
  clipRule: "evenodd"
1607
1607
  }));
1608
1608
  }
1609
- const Pa = /* @__PURE__ */ E.forwardRef(Da);
1610
- function Ia({
1609
+ const _a = /* @__PURE__ */ E.forwardRef($a);
1610
+ function Fa({
1611
1611
  title: e,
1612
1612
  titleId: t,
1613
1613
  ...n
@@ -1630,8 +1630,8 @@ function Ia({
1630
1630
  d: "M3.5 6A1.5 1.5 0 0 0 2 7.5v9A1.5 1.5 0 0 0 3.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L8.44 6.439A1.5 1.5 0 0 0 7.378 6H3.5Z"
1631
1631
  }));
1632
1632
  }
1633
- const $a = /* @__PURE__ */ E.forwardRef(Ia);
1634
- function _a({
1633
+ const qa = /* @__PURE__ */ E.forwardRef(Fa);
1634
+ function Ba({
1635
1635
  title: e,
1636
1636
  titleId: t,
1637
1637
  ...n
@@ -1652,33 +1652,33 @@ function _a({
1652
1652
  clipRule: "evenodd"
1653
1653
  }));
1654
1654
  }
1655
- const Fa = /* @__PURE__ */ E.forwardRef(_a), qa = 2e3, yn = Object.freeze({ outcome: "idle" }), Ba = (e) => {
1655
+ const Ua = /* @__PURE__ */ E.forwardRef(Ba), Ha = 2e3, En = Object.freeze({ outcome: "idle" }), za = (e) => {
1656
1656
  const t = navigator.clipboard;
1657
1657
  return t === void 0 ? Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")) : t.writeText(e);
1658
- }, Ua = ({ text: e }) => {
1659
- const { announcer: t, labels: n } = $(), [r, o] = V(yn);
1658
+ }, ja = ({ text: e }) => {
1659
+ const { announcer: t, labels: n } = $(), [r, o] = V(En);
1660
1660
  ee(() => {
1661
1661
  if (r.outcome === "idle") return;
1662
- const f = setTimeout(() => o(yn), qa);
1662
+ const f = setTimeout(() => o(En), Ha);
1663
1663
  return () => clearTimeout(f);
1664
1664
  }, [r]);
1665
1665
  const s = (f) => {
1666
1666
  o({ outcome: f }), t.announce(f === "copied" ? n.copiedText : n.copyTextFailed);
1667
1667
  }, a = () => {
1668
- Ba(e).then(
1668
+ za(e).then(
1669
1669
  () => s("copied"),
1670
1670
  () => s("failed")
1671
1671
  );
1672
1672
  }, i = r.outcome === "copied" ? n.copiedText : r.outcome === "failed" ? n.copyTextFailed : n.copyText;
1673
1673
  return (
1674
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: i, onClick: a, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ c(Pa, {}) : r.outcome === "failed" ? /* @__PURE__ */ c(Fa, {}) : /* @__PURE__ */ c($a, {}) })
1674
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: i, onClick: a, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ d(_a, {}) : r.outcome === "failed" ? /* @__PURE__ */ d(Ua, {}) : /* @__PURE__ */ d(qa, {}) })
1675
1675
  );
1676
- }, Or = ve(null), Ha = () => {
1677
- const e = se(Or);
1676
+ }, Ar = ve(null), Va = () => {
1677
+ const e = se(Ar);
1678
1678
  if (e === null) throw new Error("[markdown-explorer] a document's content reads its own part only inside a document pane (DocumentContentChannelContext)");
1679
1679
  return e;
1680
1680
  };
1681
- function za({
1681
+ function Za({
1682
1682
  title: e,
1683
1683
  titleId: t,
1684
1684
  ...n
@@ -1699,8 +1699,8 @@ function za({
1699
1699
  d: "M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"
1700
1700
  }));
1701
1701
  }
1702
- const ja = /* @__PURE__ */ E.forwardRef(za);
1703
- function Va({
1702
+ const Wa = /* @__PURE__ */ E.forwardRef(Za);
1703
+ function Ga({
1704
1704
  title: e,
1705
1705
  titleId: t,
1706
1706
  ...n
@@ -1725,17 +1725,17 @@ function Va({
1725
1725
  clipRule: "evenodd"
1726
1726
  }));
1727
1727
  }
1728
- const Za = /* @__PURE__ */ E.forwardRef(Va), Ue = ({ name: e, openUrl: t, downloadUrl: n, icon: r, children: o }) => {
1728
+ const Ka = /* @__PURE__ */ E.forwardRef(Ga), Ue = ({ name: e, openUrl: t, downloadUrl: n, icon: r, children: o }) => {
1729
1729
  const { labels: s } = $();
1730
1730
  return /* @__PURE__ */ B("div", { className: "aqmx-document-toolbar", children: [
1731
- /* @__PURE__ */ c("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: r }),
1732
- /* @__PURE__ */ c("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
1731
+ /* @__PURE__ */ d("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: r }),
1732
+ /* @__PURE__ */ d("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
1733
1733
  o,
1734
- /* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": s.openInNewTab, title: s.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ c(Za, {}) }),
1735
- /* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: n, download: e, "aria-label": s.download, title: s.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ c(ja, {}) })
1734
+ /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": s.openInNewTab, title: s.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ d(Ka, {}) }),
1735
+ /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: n, download: e, "aria-label": s.download, title: s.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ d(Wa, {}) })
1736
1736
  ] });
1737
1737
  };
1738
- function Wa({
1738
+ function Ya({
1739
1739
  title: e,
1740
1740
  titleId: t,
1741
1741
  ...n
@@ -1756,45 +1756,101 @@ function Wa({
1756
1756
  clipRule: "evenodd"
1757
1757
  }));
1758
1758
  }
1759
- const Ga = /* @__PURE__ */ E.forwardRef(Wa), Ka = Object.freeze({ className: "aqmx-document-stage" }), Ya = ({ document: e }) => {
1759
+ const Xa = /* @__PURE__ */ E.forwardRef(Ya), Ja = Object.freeze({ className: "aqmx-document-stage" }), Qa = ({ document: e }) => {
1760
1760
  const { labels: t } = $();
1761
1761
  return /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
1762
- /* @__PURE__ */ c(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ c(Ga, {}) }),
1763
- /* @__PURE__ */ c(Be, { scrollerProps: Ka, children: /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
1764
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
1765
- /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
1762
+ /* @__PURE__ */ d(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ d(Xa, {}) }),
1763
+ /* @__PURE__ */ d(Be, { scrollerProps: Ja, children: /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
1764
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
1765
+ /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
1766
1766
  ] }) })
1767
1767
  ] });
1768
- }, st = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", Xa = (e) => {
1768
+ }, Sn = ["keydown", "pointerdown", "wheel", "touchstart"], Ke = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(), ei = (e) => {
1769
+ const t = nt.get(e);
1770
+ if (t !== void 0) {
1771
+ t.count += 1;
1772
+ return;
1773
+ }
1774
+ nt.set(e, { count: 1, original: e.style.overflowAnchor }), e.style.overflowAnchor = "none";
1775
+ }, ti = (e) => {
1776
+ const t = nt.get(e);
1777
+ t !== void 0 && (t.count -= 1, !(t.count > 0) && (nt.delete(e), e.style.overflowAnchor = t.original));
1778
+ }, ni = (e, t, n) => {
1779
+ for (let r = t; r !== null && r !== n; r = r.parentElement) {
1780
+ e.observe(r);
1781
+ for (let o = r.previousElementSibling; o !== null; o = o.previousElementSibling) e.observe(o);
1782
+ }
1783
+ }, ri = (e) => {
1784
+ const t = /* @__PURE__ */ new Map();
1785
+ for (let n = e.parentElement; n !== null; n = n.parentElement) t.set(n, { top: n.scrollTop, left: n.scrollLeft });
1786
+ return t;
1787
+ }, oi = (e) => {
1788
+ Ke.get(e)?.();
1789
+ }, si = (e, t, n) => {
1790
+ oi(e);
1791
+ let r = /* @__PURE__ */ new Map();
1792
+ const o = /* @__PURE__ */ new Set(), s = () => {
1793
+ const c = t();
1794
+ return c === null ? !1 : (r = ri(c), !0);
1795
+ };
1796
+ if (!s() || typeof ResizeObserver > "u") return;
1797
+ const a = () => {
1798
+ for (const c of r.keys())
1799
+ !(c instanceof HTMLElement) || o.has(c) || (o.add(c), ei(c));
1800
+ };
1801
+ a();
1802
+ const { ownerDocument: i } = e, f = new ResizeObserver(() => {
1803
+ if (!s()) {
1804
+ l();
1805
+ return;
1806
+ }
1807
+ a();
1808
+ });
1809
+ for (const { element: c, boundary: m } of n) ni(f, c, m);
1810
+ const u = (c) => {
1811
+ const m = c.target === i ? i.scrollingElement : c.target;
1812
+ if (!(m instanceof Element)) return;
1813
+ const g = r.get(m);
1814
+ g !== void 0 && (m.scrollTop !== g.top || m.scrollLeft !== g.left) && l();
1815
+ }, l = () => {
1816
+ f.disconnect();
1817
+ for (const c of Sn) i.removeEventListener(c, l, !0);
1818
+ i.removeEventListener("scroll", u, !0);
1819
+ for (const c of o) ti(c);
1820
+ o.clear(), Ke.get(e) === l && Ke.delete(e);
1821
+ };
1822
+ for (const c of Sn) i.addEventListener(c, l, { capture: !0, passive: !0 });
1823
+ i.addEventListener("scroll", u, { capture: !0, passive: !0 }), Ke.set(e, l);
1824
+ }, it = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", ai = (e) => {
1769
1825
  const t = e.indexOf("#");
1770
1826
  return t === -1 ? "" : e.slice(t);
1771
- }, Ja = /(%[0-9A-Fa-f]{2})/u, zt = (e) => {
1827
+ }, ii = /(%[0-9A-Fa-f]{2})/u, Vt = (e) => {
1772
1828
  if (!e.startsWith("#") || e.length === 1) return null;
1773
- const t = new TextEncoder(), n = e.slice(1).split(Ja).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
1829
+ const t = new TextEncoder(), n = e.slice(1).split(ii).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
1774
1830
  return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
1775
- }, Lr = (e) => `#${encodeURIComponent(e)}`, Qa = (e) => {
1831
+ }, Nr = (e) => `#${encodeURIComponent(e)}`, li = (e) => {
1776
1832
  if (e === "#") return !0;
1777
- const t = zt(e);
1833
+ const t = Vt(e);
1778
1834
  return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
1779
- }, Mr = (e, t) => {
1835
+ }, Dr = (e, t) => {
1780
1836
  if (t === "") return null;
1781
1837
  for (const n of e.querySelectorAll("[id]"))
1782
1838
  if (n.id === t) return n;
1783
1839
  return null;
1784
- }, ei = "http://www.w3.org/1999/xhtml", kn = (e, t) => {
1840
+ }, ci = "http://www.w3.org/1999/xhtml", xn = (e, t) => {
1785
1841
  if (t === "") return null;
1786
- const n = Mr(e, t);
1842
+ const n = Dr(e, t);
1787
1843
  if (n !== null) return n;
1788
1844
  for (const r of e.querySelectorAll("a[name]"))
1789
- if (r.localName === "a" && r.namespaceURI === ei && r.getAttribute("name") === t) return r;
1845
+ if (r.localName === "a" && r.namespaceURI === ci && r.getAttribute("name") === t) return r;
1790
1846
  return null;
1791
- }, Ar = (e, t) => {
1847
+ }, Pr = (e, t) => {
1792
1848
  if (e === null || !t.startsWith("#")) return null;
1793
- const n = kn(e, t.slice(1));
1849
+ const n = xn(e, t.slice(1));
1794
1850
  if (n !== null) return n;
1795
- const r = zt(t);
1796
- return r === null ? null : kn(e, r);
1797
- }, En = (e) => {
1851
+ const r = Vt(t);
1852
+ return r === null ? null : xn(e, r);
1853
+ }, Tn = (e) => {
1798
1854
  const { body: t, documentElement: n } = e.ownerDocument;
1799
1855
  if (e === t) {
1800
1856
  const o = getComputedStyle(n);
@@ -1802,22 +1858,25 @@ const Ga = /* @__PURE__ */ E.forwardRef(Wa), Ka = Object.freeze({ className: "aq
1802
1858
  }
1803
1859
  const { overflowY: r } = getComputedStyle(e);
1804
1860
  return r === "auto" || r === "scroll";
1805
- }, ti = (e) => {
1861
+ }, di = (e) => {
1806
1862
  const { body: t, documentElement: n } = e, r = getComputedStyle(n), o = r.overflowX === "visible" && r.overflowY === "visible" && t !== null ? getComputedStyle(t).overflowY : r.overflowY;
1807
1863
  return o !== "hidden" && o !== "clip";
1808
- }, ni = (e, t) => {
1809
- const n = t.closest(st), r = n !== null && e.contains(n) ? n : e;
1810
- if (r.scrollHeight > r.clientHeight && En(r)) return r;
1864
+ }, ui = (e, t) => {
1865
+ const n = t.closest(it), r = n !== null && e.contains(n) ? n : e;
1866
+ if (r.scrollHeight > r.clientHeight && Tn(r)) return r;
1811
1867
  const o = e.getBoundingClientRect().height, { documentElement: s, scrollingElement: a } = e.ownerDocument;
1812
1868
  for (let i = e.parentElement; i !== null && i !== s; i = i.parentElement)
1813
- if (En(i) && i.scrollHeight > i.clientHeight && i.clientHeight < o) return i;
1814
- return a instanceof Element && ti(e.ownerDocument) && a.scrollHeight > a.clientHeight && a.clientHeight < o ? a : r;
1815
- }, ri = Object.freeze({
1816
- scrollerOf: ni,
1869
+ if (Tn(i) && i.scrollHeight > i.clientHeight && i.clientHeight < o) return i;
1870
+ return a instanceof Element && di(e.ownerDocument) && a.scrollHeight > a.clientHeight && a.clientHeight < o ? a : r;
1871
+ }, fi = Object.freeze({
1872
+ scrollerOf: ui,
1817
1873
  reveal: (e) => {
1818
- e.scrollIntoView(At);
1874
+ e.scrollIntoView(Dt);
1875
+ },
1876
+ keepAtStart: (e, t) => {
1877
+ si(e, () => t.isConnected ? (hi(e, t), t) : null, [{ element: t, boundary: e }]);
1819
1878
  }
1820
- }), At = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), oi = (e, t) => {
1879
+ }), Dt = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), mi = (e, t) => {
1821
1880
  for (let n = t; n !== null && n !== e; n = n.parentElement) {
1822
1881
  const r = n.parentElement;
1823
1882
  if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
@@ -1825,23 +1884,23 @@ const Ga = /* @__PURE__ */ E.forwardRef(Wa), Ka = Object.freeze({ className: "aq
1825
1884
  n.removeAttribute("hidden");
1826
1885
  }
1827
1886
  }
1828
- }, si = (e, t) => {
1887
+ }, hi = (e, t) => {
1829
1888
  if (t.getClientRects().length === 0) return;
1830
1889
  const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), s = Number.parseFloat(r), a = t.getBoundingClientRect(), i = a.height + s + Number.parseFloat(o) > e.clientHeight;
1831
1890
  if (!i && Math.abs(a.top - s - n) < 1) {
1832
- t.scrollIntoView(At);
1891
+ t.scrollIntoView(Dt);
1833
1892
  return;
1834
1893
  }
1835
- e.scrollBy({ top: i ? a.top - n - e.clientHeight : a.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(At);
1836
- }, ai = (e, t) => {
1837
- const n = t.scrollerOf(e, e.querySelector(st) ?? e);
1894
+ e.scrollBy({ top: i ? a.top - n - e.clientHeight : a.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Dt);
1895
+ }, pi = (e, t) => {
1896
+ const n = t.scrollerOf(e, e.querySelector(it) ?? e);
1838
1897
  n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
1839
- }, Sn = (e, t, n) => {
1898
+ }, Rn = (e, t, n) => {
1840
1899
  if (e === null) return null;
1841
- const r = Ar(e, t);
1842
- return r === null ? (Qa(t) && ai(e, n), null) : (oi(e, r), si(n.scrollerOf(e, r), r), n.reveal(r), r);
1900
+ const r = Pr(e, t);
1901
+ return r === null ? (li(t) && pi(e, n), null) : (mi(e, r), n.keepAtStart(n.scrollerOf(e, r), r), r);
1843
1902
  };
1844
- function ii({
1903
+ function gi({
1845
1904
  title: e,
1846
1905
  titleId: t,
1847
1906
  ...n
@@ -1860,8 +1919,8 @@ function ii({
1860
1919
  d: "M3.28 2.22a.75.75 0 0 0-1.06 1.06L5.44 6.5H2.75a.75.75 0 0 0 0 1.5h4.5A.75.75 0 0 0 8 7.25v-4.5a.75.75 0 0 0-1.5 0v2.69L3.28 2.22ZM13.5 2.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-2.69l3.22-3.22a.75.75 0 0 0-1.06-1.06L13.5 5.44V2.75ZM3.28 17.78l3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 1 0 1.06 1.06ZM13.5 14.56l3.22 3.22a.75.75 0 1 0 1.06-1.06l-3.22-3.22h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0v-2.69Z"
1861
1920
  }));
1862
1921
  }
1863
- const li = /* @__PURE__ */ E.forwardRef(ii);
1864
- function ci({
1922
+ const wi = /* @__PURE__ */ E.forwardRef(gi);
1923
+ function vi({
1865
1924
  title: e,
1866
1925
  titleId: t,
1867
1926
  ...n
@@ -1884,8 +1943,8 @@ function ci({
1884
1943
  clipRule: "evenodd"
1885
1944
  }));
1886
1945
  }
1887
- const di = /* @__PURE__ */ E.forwardRef(ci);
1888
- function ui({
1946
+ const bi = /* @__PURE__ */ E.forwardRef(vi);
1947
+ function yi({
1889
1948
  title: e,
1890
1949
  titleId: t,
1891
1950
  ...n
@@ -1908,8 +1967,8 @@ function ui({
1908
1967
  clipRule: "evenodd"
1909
1968
  }));
1910
1969
  }
1911
- const fi = /* @__PURE__ */ E.forwardRef(ui);
1912
- function mi({
1970
+ const ki = /* @__PURE__ */ E.forwardRef(yi);
1971
+ function Ei({
1913
1972
  title: e,
1914
1973
  titleId: t,
1915
1974
  ...n
@@ -1930,7 +1989,7 @@ function mi({
1930
1989
  clipRule: "evenodd"
1931
1990
  }));
1932
1991
  }
1933
- const hi = /* @__PURE__ */ E.forwardRef(mi), Nt = "data-aqmx-key-repeat", Dt = Object.freeze({ [Nt]: "allow" }), pi = `[${Nt}="${Dt[Nt]}"]`, gi = () => {
1992
+ const Si = /* @__PURE__ */ E.forwardRef(Ei), Pt = "data-aqmx-key-repeat", It = Object.freeze({ [Pt]: "allow" }), xi = `[${Pt}="${It[Pt]}"]`, Ti = () => {
1934
1993
  let e = null;
1935
1994
  return {
1936
1995
  onKeyDownCapture: (t) => {
@@ -1939,7 +1998,7 @@ const hi = /* @__PURE__ */ E.forwardRef(mi), Nt = "data-aqmx-key-repeat", Dt = O
1939
1998
  e = t.target instanceof Element ? t.target : null;
1940
1999
  return;
1941
2000
  }
1942
- e !== null && t.target === e && e.closest(pi) !== null || (t.preventDefault(), t.stopPropagation());
2001
+ e !== null && t.target === e && e.closest(xi) !== null || (t.preventDefault(), t.stopPropagation());
1943
2002
  }
1944
2003
  },
1945
2004
  onKeyUpCapture: (t) => {
@@ -1949,85 +2008,85 @@ const hi = /* @__PURE__ */ E.forwardRef(mi), Nt = "data-aqmx-key-repeat", Dt = O
1949
2008
  t.target === e && (e = null);
1950
2009
  }
1951
2010
  };
1952
- }, Ke = Object.freeze([1 / Me ** 2, 1 / Me, 1, Me, Me ** 2]), xn = Object.freeze({ mode: "fit" }), wi = 1, Nr = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), Tn = `[data-testid="${Nr["data-testid"]}"]`, vi = ve(null), bi = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= wi ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, Rn = (e, t, n) => {
2011
+ }, Ye = Object.freeze([1 / Me ** 2, 1 / Me, 1, Me, Me ** 2]), Cn = Object.freeze({ mode: "fit" }), Ri = 1, Ir = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), On = `[data-testid="${Ir["data-testid"]}"]`, Ci = ve(null), Oi = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= Ri ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, Ln = (e, t, n) => {
1953
2012
  if (e.mode === "level") {
1954
2013
  const o = e.index + n;
1955
- return o >= 0 && o < Ke.length ? o : null;
2014
+ return o >= 0 && o < Ye.length ? o : null;
1956
2015
  }
1957
2016
  if (t === null || !Number.isFinite(t) || t <= 0) return null;
1958
- const r = n === 1 ? Ke.findIndex((o) => o > t) : Ke.findLastIndex((o) => o < t);
2017
+ const r = n === 1 ? Ye.findIndex((o) => o > t) : Ye.findLastIndex((o) => o < t);
1959
2018
  return r === -1 ? null : r;
1960
- }, Cn = (e, t, n) => {
2019
+ }, Mn = (e, t, n) => {
1961
2020
  if (e.mode === "level") {
1962
- const o = Rn(e, null, n);
2021
+ const o = Ln(e, null, n);
1963
2022
  return o === null ? null : { mode: "level", index: o, base: e.base };
1964
2023
  }
1965
2024
  if (t === null) return null;
1966
- const r = Rn(e, t.scale, n);
2025
+ const r = Ln(e, t.scale, n);
1967
2026
  return r === null ? null : { mode: "level", index: r, base: t.base };
1968
- }, yi = (e, t) => {
2027
+ }, Li = (e, t) => {
1969
2028
  if (e <= 0 || t <= 0) return 0;
1970
2029
  const n = Math.trunc(Math.log(t / e) / Math.log(Me));
1971
2030
  return n === 0 ? 0 : n;
1972
- }, On = (e) => {
2031
+ }, An = (e) => {
1973
2032
  const t = e[0], n = e[1];
1974
2033
  return e.length !== 2 || t === void 0 || n === void 0 ? null : { distance: Math.hypot(n.clientX - t.clientX, n.clientY - t.clientY), middle: { x: (t.clientX + n.clientX) / 2, y: (t.clientY + n.clientY) / 2 } };
1975
- }, ki = (e) => {
1976
- const t = Ke[e];
2034
+ }, Mi = (e) => {
2035
+ const t = Ye[e];
1977
2036
  if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
1978
2037
  return t;
1979
- }, Ln = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, Ei = ({ document: e }) => {
1980
- const { labels: t } = $(), n = se(vi), [r] = V(() => n === null ? null : n.read(e.url)), [o, s] = V(r === null ? xn : r.zoom), [a, i] = V(r === null ? null : r.reported), [f, u] = V(null), l = U(null), d = F((D) => {
1981
- const { naturalWidth: m, naturalHeight: p } = D;
1982
- i((x) => Ln(x, m, p));
1983
- }, []), h = F(
2038
+ }, Nn = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, Ai = ({ document: e }) => {
2039
+ const { labels: t } = $(), n = se(Ci), [r] = V(() => n === null ? null : n.read(e.url)), [o, s] = V(r === null ? Cn : r.zoom), [a, i] = V(r === null ? null : r.reported), [f, u] = V(null), l = U(null), c = F((D) => {
2040
+ const { naturalWidth: h, naturalHeight: p } = D;
2041
+ i((x) => Nn(x, h, p));
2042
+ }, []), m = F(
1984
2043
  (D) => {
1985
- l.current = D, !(D === null || !D.complete) && (D.naturalWidth > 0 || D.naturalHeight > 0 ? d(D) : D.decode().then(
1986
- () => d(D),
2044
+ l.current = D, !(D === null || !D.complete) && (D.naturalWidth > 0 || D.naturalHeight > 0 ? c(D) : D.decode().then(
2045
+ () => c(D),
1987
2046
  () => {
1988
2047
  }
1989
2048
  ));
1990
2049
  },
1991
- [d]
2050
+ [c]
1992
2051
  );
1993
2052
  ee(() => {
1994
2053
  n !== null && a !== null && n.save(e.url, { zoom: o, reported: a });
1995
2054
  }, [n, e.url, o, a]), Y(() => {
1996
2055
  const D = l.current;
1997
2056
  if (D === null || a === null || o.mode !== "fit") return;
1998
- const m = () => u((x) => Ln(x, D.clientWidth, D.clientHeight));
1999
- if (m(), typeof ResizeObserver > "u") return;
2000
- const p = new ResizeObserver(m);
2057
+ const h = () => u((x) => Nn(x, D.clientWidth, D.clientHeight));
2058
+ if (h(), typeof ResizeObserver > "u") return;
2059
+ const p = new ResizeObserver(h);
2001
2060
  return p.observe(D), () => p.disconnect();
2002
2061
  }, [a, o.mode]);
2003
- const g = a === null || f === null ? null : bi(a, f), v = Cn(o, g, -1), y = Cn(o, g, 1), T = o.mode === "level" ? ki(o.index) : null, O = U({ zoomIn: y, zoomOut: v });
2062
+ const g = a === null || f === null ? null : Oi(a, f), v = Mn(o, g, -1), y = Mn(o, g, 1), T = o.mode === "level" ? Mi(o.index) : null, O = U({ zoomIn: y, zoomOut: v });
2004
2063
  Y(() => {
2005
2064
  O.current = { zoomIn: y, zoomOut: v };
2006
2065
  });
2007
2066
  const R = U(null);
2008
2067
  Y(() => {
2009
- const D = R.current, m = l.current?.closest(Tn);
2010
- R.current = null, !(D === null || m === null || m === void 0) && (m.scrollLeft = D.across * m.scrollWidth - D.x, m.scrollTop = D.down * m.scrollHeight - D.y);
2068
+ const D = R.current, h = l.current?.closest(On);
2069
+ R.current = null, !(D === null || h === null || h === void 0) && (h.scrollLeft = D.across * h.scrollWidth - D.x, h.scrollTop = D.down * h.scrollHeight - D.y);
2011
2070
  }, [o]), ee(() => {
2012
- const D = l.current?.closest(Tn);
2071
+ const D = l.current?.closest(On);
2013
2072
  if (D == null) return;
2014
- let m = null;
2073
+ let h = null;
2015
2074
  const p = (I) => {
2016
- const _ = On(I.touches);
2017
- m = _ === null ? null : { distance: _.distance, steps: 0 };
2075
+ const _ = An(I.touches);
2076
+ h = _ === null ? null : { distance: _.distance, steps: 0 };
2018
2077
  }, x = (I) => {
2019
- const _ = On(I.touches);
2020
- if (m === null || _ === null) return;
2078
+ const _ = An(I.touches);
2079
+ if (h === null || _ === null) return;
2021
2080
  I.preventDefault();
2022
- const b = yi(m.distance, _.distance);
2023
- if (b === m.steps) return;
2024
- const S = b > m.steps ? 1 : -1, L = S === 1 ? O.current.zoomIn : O.current.zoomOut;
2081
+ const b = Li(h.distance, _.distance);
2082
+ if (b === h.steps) return;
2083
+ const S = b > h.steps ? 1 : -1, L = S === 1 ? O.current.zoomIn : O.current.zoomOut;
2025
2084
  if (L === null) return;
2026
- m.steps += S;
2085
+ h.steps += S;
2027
2086
  const M = D.getBoundingClientRect(), P = _.middle.x - M.left, H = _.middle.y - M.top;
2028
2087
  R.current = D.scrollWidth > 0 && D.scrollHeight > 0 ? { x: P, y: H, across: (D.scrollLeft + P) / D.scrollWidth, down: (D.scrollTop + H) / D.scrollHeight } : null, s(L);
2029
2088
  }, A = (I) => {
2030
- I.touches.length < 2 && (m = null);
2089
+ I.touches.length < 2 && (h = null);
2031
2090
  };
2032
2091
  return D.addEventListener("touchstart", p, { passive: !0 }), D.addEventListener("touchmove", x, { passive: !1 }), D.addEventListener("touchend", A, { passive: !0 }), D.addEventListener("touchcancel", A, { passive: !0 }), () => {
2033
2092
  D.removeEventListener("touchstart", p), D.removeEventListener("touchmove", x), D.removeEventListener("touchend", A), D.removeEventListener("touchcancel", A);
@@ -2035,8 +2094,8 @@ const hi = /* @__PURE__ */ E.forwardRef(mi), Nt = "data-aqmx-key-repeat", Dt = O
2035
2094
  }, []);
2036
2095
  const q = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
2037
2096
  return /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
2038
- /* @__PURE__ */ B(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ c(hi, {}), children: [
2039
- /* @__PURE__ */ c(
2097
+ /* @__PURE__ */ B(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ d(Si, {}), children: [
2098
+ /* @__PURE__ */ d(
2040
2099
  "button",
2041
2100
  {
2042
2101
  type: "button",
@@ -2047,12 +2106,12 @@ const hi = /* @__PURE__ */ E.forwardRef(mi), Nt = "data-aqmx-key-repeat", Dt = O
2047
2106
  onClick: () => {
2048
2107
  v !== null && s(v);
2049
2108
  },
2050
- ...Dt,
2051
- children: /* @__PURE__ */ c(di, {})
2109
+ ...It,
2110
+ children: /* @__PURE__ */ d(bi, {})
2052
2111
  }
2053
2112
  ),
2054
- /* @__PURE__ */ c("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: T === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(T * 100)) }),
2055
- /* @__PURE__ */ c(
2113
+ /* @__PURE__ */ d("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: T === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(T * 100)) }),
2114
+ /* @__PURE__ */ d(
2056
2115
  "button",
2057
2116
  {
2058
2117
  type: "button",
@@ -2063,47 +2122,47 @@ const hi = /* @__PURE__ */ E.forwardRef(mi), Nt = "data-aqmx-key-repeat", Dt = O
2063
2122
  onClick: () => {
2064
2123
  y !== null && s(y);
2065
2124
  },
2066
- ...Dt,
2067
- children: /* @__PURE__ */ c(fi, {})
2125
+ ...It,
2126
+ children: /* @__PURE__ */ d(ki, {})
2068
2127
  }
2069
2128
  ),
2070
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => s(xn), children: /* @__PURE__ */ c(li, {}) })
2129
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => s(Cn), children: /* @__PURE__ */ d(wi, {}) })
2071
2130
  ] }),
2072
- /* @__PURE__ */ c(Be, { scrollerProps: Nr, children: /* @__PURE__ */ c("img", { ref: h, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: q, onLoad: (D) => d(D.currentTarget), "data-testid": "markdown-explorer-image" }) })
2131
+ /* @__PURE__ */ d(Be, { scrollerProps: Ir, children: /* @__PURE__ */ d("img", { ref: m, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: q, onLoad: (D) => c(D.currentTarget), "data-testid": "markdown-explorer-image" }) })
2073
2132
  ] });
2074
- }, Si = async (e, t, n) => {
2133
+ }, Ni = async (e, t, n) => {
2075
2134
  const r = await e.text(t, n);
2076
2135
  if (!("kind" in r)) throw n.reason;
2077
2136
  return r.kind === "text" ? { kind: "text", text: r.text, truncated: r.truncated } : { kind: "failure", retryable: r.failure.reason === "failed" };
2078
- }, Dr = ve(null), at = ve(void 0), Pr = ve(null), it = () => {
2079
- const e = se(Dr);
2137
+ }, $r = ve(null), lt = ve(void 0), _r = ve(null), ct = () => {
2138
+ const e = se($r);
2080
2139
  if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
2081
2140
  return e;
2082
- }, xi = () => {
2083
- const e = se(Pr);
2141
+ }, Di = () => {
2142
+ const e = se(_r);
2084
2143
  if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
2085
2144
  return e;
2086
- }, lt = (e, t, n, r) => t.kind === "panel" ? Ne(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? Ne(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : Ne(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Ti = ({ children: e }) => {
2087
- const { config: t } = $(), n = it(), r = Ft(), o = r.kind === "location" ? r.location.source : void 0, s = nt(lt(t, n.navigation, o, n.currentPath));
2088
- return /* @__PURE__ */ c(at, { value: o, children: /* @__PURE__ */ c(Pr, { value: s, children: e }) });
2089
- }, Ri = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', Ci = (e) => {
2090
- const t = e instanceof Element ? e.closest(Ri) : null;
2145
+ }, dt = (e, t, n, r) => t.kind === "panel" ? Ne(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? Ne(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : Ne(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Pi = ({ children: e }) => {
2146
+ const { config: t } = $(), n = ct(), r = Bt(), o = r.kind === "location" ? r.location.source : void 0, s = ot(dt(t, n.navigation, o, n.currentPath));
2147
+ return /* @__PURE__ */ d(lt, { value: o, children: /* @__PURE__ */ d(_r, { value: s, children: e }) });
2148
+ }, Ii = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', $i = (e) => {
2149
+ const t = e instanceof Element ? e.closest(Ii) : null;
2091
2150
  return t === null ? null : t.getAttribute("data-doc-path");
2092
- }, ct = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, Oi = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: s, onDocumentLink: a, scope: i, children: f }) => {
2093
- const u = nt(e);
2094
- return /* @__PURE__ */ c("a", { ...s, href: u, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (d) => {
2095
- if (ct(d)) {
2096
- if (d.preventDefault(), t === i.currentPath && n !== "") {
2151
+ }, ut = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, _i = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: s, onDocumentLink: a, scope: i, children: f }) => {
2152
+ const u = ot(e);
2153
+ return /* @__PURE__ */ d("a", { ...s, href: u, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (c) => {
2154
+ if (ut(c)) {
2155
+ if (c.preventDefault(), t === i.currentPath && n !== "") {
2097
2156
  i.scrollWithin(n);
2098
2157
  return;
2099
2158
  }
2100
2159
  a(t, n);
2101
2160
  }
2102
2161
  }, children: f });
2103
- }, Li = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: s }) => {
2104
- const { config: a } = $(), i = it(), f = se(at), u = Xa(e), { navigation: l } = i, d = `${lt(a, l, f, t)}${u}`, h = n === !1 ? "false" : void 0;
2105
- return l.kind === "page" ? /* @__PURE__ */ c(ga, { ...o, to: d, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": h, children: s }) : /* @__PURE__ */ c(Oi, { to: d, docPath: t, fragment: u, exists: h, className: r, attributes: o, onDocumentLink: l.onDocumentLink, scope: i, children: s });
2106
- }, Mi = ({ className: e, attributes: t, children: n }) => {
2162
+ }, Fi = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: s }) => {
2163
+ const { config: a } = $(), i = ct(), f = se(lt), u = ai(e), { navigation: l } = i, c = `${dt(a, l, f, t)}${u}`, m = n === !1 ? "false" : void 0;
2164
+ return l.kind === "page" ? /* @__PURE__ */ d(ba, { ...o, to: c, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": m, children: s }) : /* @__PURE__ */ d(_i, { to: c, docPath: t, fragment: u, exists: m, className: r, attributes: o, onDocumentLink: l.onDocumentLink, scope: i, children: s });
2165
+ }, qi = ({ className: e, attributes: t, children: n }) => {
2107
2166
  const { labels: r } = $();
2108
2167
  return (
2109
2168
  /* @__PURE__ */ B("a", { ...t, className: e === void 0 ? "aqmx-document-inert-link" : `${e} aqmx-document-inert-link`, title: r.inertLink, "data-link-kind": "doc", "data-doc-exists": "false", children: [
@@ -2115,34 +2174,34 @@ const hi = /* @__PURE__ */ E.forwardRef(mi), Nt = "data-aqmx-key-repeat", Dt = O
2115
2174
  ] })
2116
2175
  ] })
2117
2176
  );
2118
- }, Ai = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
2119
- const { config: s } = $(), a = se(at), i = nt(`${lt(s, r.navigation, a, r.currentPath)}${e}`);
2120
- return /* @__PURE__ */ c("a", { ...n, href: i, className: t, onClick: (u) => {
2121
- ct(u) && (u.preventDefault(), r.scrollWithin(e));
2177
+ }, Bi = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
2178
+ const { config: s } = $(), a = se(lt), i = ot(`${dt(s, r.navigation, a, r.currentPath)}${e}`);
2179
+ return /* @__PURE__ */ d("a", { ...n, href: i, className: t, onClick: (u) => {
2180
+ ut(u) && (u.preventDefault(), r.scrollWithin(e));
2122
2181
  }, children: o });
2123
- }, Ni = ({ href: e, className: t, attributes: n, children: r }) => {
2124
- const o = it();
2125
- return o.navigation.kind === "page" ? /* @__PURE__ */ c("a", { ...n, href: e, className: t, onClick: (a) => {
2126
- if (!ct(a)) return;
2182
+ }, Ui = ({ href: e, className: t, attributes: n, children: r }) => {
2183
+ const o = ct();
2184
+ return o.navigation.kind === "page" ? /* @__PURE__ */ d("a", { ...n, href: e, className: t, onClick: (a) => {
2185
+ if (!ut(a)) return;
2127
2186
  const i = a.currentTarget;
2128
2187
  e === "#" ? o.followEmptyFragment(a.nativeEvent) : i.href === i.ownerDocument.URL && o.followSameUrlJump(e, a.nativeEvent);
2129
- }, children: r }) : /* @__PURE__ */ c(Ai, { href: e, className: t, attributes: n, scope: o, children: r });
2130
- }, Di = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: s, children: a }) => t === "doc" ? n === void 0 || !qo(n) ? /* @__PURE__ */ c(Mi, { className: o, attributes: s, children: a }) : /* @__PURE__ */ c(Li, { href: e, docPath: n, docExists: r, className: o, attributes: s, children: a }) : e.startsWith("#") ? /* @__PURE__ */ c(Ni, { href: e, className: o, attributes: s, children: a }) : /* @__PURE__ */ c("a", { ...s, href: e, className: o, children: a }), Pi = () => {
2131
- const { config: e } = $(), t = it(), n = se(at), r = ot();
2188
+ }, children: r }) : /* @__PURE__ */ d(Bi, { href: e, className: t, attributes: n, scope: o, children: r });
2189
+ }, Hi = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: s, children: a }) => t === "doc" ? n === void 0 || !Ho(n) ? /* @__PURE__ */ d(qi, { className: o, attributes: s, children: a }) : /* @__PURE__ */ d(Fi, { href: e, docPath: n, docExists: r, className: o, attributes: s, children: a }) : e.startsWith("#") ? /* @__PURE__ */ d(Ui, { href: e, className: o, attributes: s, children: a }) : /* @__PURE__ */ d("a", { ...s, href: e, className: o, children: a }), zi = () => {
2190
+ const { config: e } = $(), t = ct(), n = se(lt), r = at();
2132
2191
  return F(
2133
2192
  (o, s) => {
2134
- if (!ct(s)) return !0;
2193
+ if (!ut(s)) return !0;
2135
2194
  s.preventDefault();
2136
- const a = Lr(o.id), { navigation: i } = t;
2137
- return i.kind === "panel" || zt(s.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(a), !0) : (r(`${lt(e, i, n, t.currentPath)}${a}`, "follow-link"), !0);
2195
+ const a = Nr(o.id), { navigation: i } = t;
2196
+ return i.kind === "panel" || Vt(s.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(a), !0) : (r(`${dt(e, i, n, t.currentPath)}${a}`, "follow-link"), !0);
2138
2197
  },
2139
2198
  [e, t, n, r]
2140
2199
  );
2141
- }, Ii = () => {
2142
- const e = xi();
2143
- return F((t) => `${e}${Lr(t.id)}`, [e]);
2200
+ }, ji = () => {
2201
+ const e = Di();
2202
+ return F((t) => `${e}${Nr(t.id)}`, [e]);
2144
2203
  };
2145
- function $i({
2204
+ function Vi({
2146
2205
  title: e,
2147
2206
  titleId: t,
2148
2207
  ...n
@@ -2161,8 +2220,8 @@ function $i({
2161
2220
  d: "M3 3.5A1.5 1.5 0 0 1 4.5 2h6.879a1.5 1.5 0 0 1 1.06.44l4.122 4.12A1.5 1.5 0 0 1 17 7.622V16.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 16.5v-13Z"
2162
2221
  }));
2163
2222
  }
2164
- const _i = /* @__PURE__ */ E.forwardRef($i);
2165
- function Fi({
2223
+ const Zi = /* @__PURE__ */ E.forwardRef(Vi);
2224
+ function Wi({
2166
2225
  title: e,
2167
2226
  titleId: t,
2168
2227
  ...n
@@ -2183,8 +2242,8 @@ function Fi({
2183
2242
  clipRule: "evenodd"
2184
2243
  }));
2185
2244
  }
2186
- const qi = /* @__PURE__ */ E.forwardRef(Fi);
2187
- function Bi({
2245
+ const Gi = /* @__PURE__ */ E.forwardRef(Wi);
2246
+ function Ki({
2188
2247
  title: e,
2189
2248
  titleId: t,
2190
2249
  ...n
@@ -2205,51 +2264,51 @@ function Bi({
2205
2264
  clipRule: "evenodd"
2206
2265
  }));
2207
2266
  }
2208
- const Ui = /* @__PURE__ */ E.forwardRef(Bi), Hi = Object.freeze({ className: "aqmx-document-stage" }), zi = () => () => {
2209
- }, ji = () => navigator.pdfViewerEnabled !== !1, Vi = () => null, Zi = ({ document: e }) => {
2210
- const { labels: t } = $(), n = re(zi, ji, Vi);
2211
- return n === null ? null : n ? /* @__PURE__ */ c("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" }) : /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-pdf-not-shown", children: [
2212
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: t.pdfNotShown }),
2267
+ const Yi = /* @__PURE__ */ E.forwardRef(Ki), Xi = Object.freeze({ className: "aqmx-document-stage" }), Ji = () => () => {
2268
+ }, Qi = () => navigator.pdfViewerEnabled !== !1, el = () => null, tl = ({ document: e }) => {
2269
+ const { labels: t } = $(), n = re(Ji, Qi, el);
2270
+ return n === null ? null : n ? /* @__PURE__ */ d("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" }) : /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-pdf-not-shown", children: [
2271
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: t.pdfNotShown }),
2213
2272
  /* @__PURE__ */ B("div", { className: "aqmx-callout-actions", children: [
2214
- /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, target: "_blank", rel: "noopener noreferrer", "data-testid": "markdown-explorer-pdf-not-shown-open", children: t.openInNewTab }),
2215
- /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-pdf-not-shown-download", children: t.download })
2273
+ /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, target: "_blank", rel: "noopener noreferrer", "data-testid": "markdown-explorer-pdf-not-shown-open", children: t.openInNewTab }),
2274
+ /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-pdf-not-shown-download", children: t.download })
2216
2275
  ] })
2217
2276
  ] });
2218
- }, Wi = (e) => {
2277
+ }, nl = (e) => {
2219
2278
  switch (e) {
2220
2279
  case "video":
2221
- return /* @__PURE__ */ c(qi, {});
2280
+ return /* @__PURE__ */ d(Gi, {});
2222
2281
  case "audio":
2223
- return /* @__PURE__ */ c(Ui, {});
2282
+ return /* @__PURE__ */ d(Yi, {});
2224
2283
  case "pdf":
2225
- return /* @__PURE__ */ c(_i, {});
2284
+ return /* @__PURE__ */ d(Zi, {});
2226
2285
  default: {
2227
2286
  const t = e;
2228
2287
  throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`);
2229
2288
  }
2230
2289
  }
2231
- }, Gi = ({ document: e }) => {
2290
+ }, rl = ({ document: e }) => {
2232
2291
  const { labels: t } = $();
2233
2292
  switch (e.mediaType) {
2234
2293
  case "video":
2235
2294
  return (
2236
- /* @__PURE__ */ c("video", { className: "aqmx-document-video", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
2295
+ /* @__PURE__ */ d("video", { className: "aqmx-document-video", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
2237
2296
  );
2238
2297
  case "audio":
2239
2298
  return (
2240
- /* @__PURE__ */ c("audio", { className: "aqmx-document-audio", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
2299
+ /* @__PURE__ */ d("audio", { className: "aqmx-document-audio", src: e.url, controls: !0, preload: "metadata", "aria-label": e.name, "data-testid": "markdown-explorer-media-player", children: t.mediaUnsupported })
2241
2300
  );
2242
2301
  case "pdf":
2243
- return /* @__PURE__ */ c(Zi, { document: e });
2302
+ return /* @__PURE__ */ d(tl, { document: e });
2244
2303
  default: {
2245
2304
  const n = e.mediaType;
2246
2305
  throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`);
2247
2306
  }
2248
2307
  }
2249
- }, Ki = ({ document: e }) => /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
2250
- /* @__PURE__ */ c(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: Wi(e.mediaType) }),
2251
- /* @__PURE__ */ c(Be, { scrollerProps: Hi, children: /* @__PURE__ */ c(Gi, { document: e }) })
2252
- ] }), jt = (e) => {
2308
+ }, ol = ({ document: e }) => /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
2309
+ /* @__PURE__ */ d(Ue, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: nl(e.mediaType) }),
2310
+ /* @__PURE__ */ d(Be, { scrollerProps: Xi, children: /* @__PURE__ */ d(rl, { document: e }) })
2311
+ ] }), Zt = (e) => {
2253
2312
  switch (e.kind) {
2254
2313
  case "markdown":
2255
2314
  return "markdown";
@@ -2260,14 +2319,14 @@ const Ui = /* @__PURE__ */ E.forwardRef(Bi), Hi = Object.freeze({ className: "aq
2260
2319
  default:
2261
2320
  return null;
2262
2321
  }
2263
- }, Yi = (e) => {
2322
+ }, sl = (e) => {
2264
2323
  const { documents: t } = $(), n = F(() => t.peek(e), [t, e]), r = F(() => t.peekSeeded(e), [t, e]), o = re(t.subscribe, n, r), s = ge(o);
2265
- return s === null ? null : jt(s.document);
2266
- }, Xi = (e) => {
2267
- const { config: t } = $(), n = ot(), r = F(() => n(Ne(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
2324
+ return s === null ? null : Zt(s.document);
2325
+ }, al = (e) => {
2326
+ const { config: t } = $(), n = at(), r = F(() => n(Ne(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
2268
2327
  return X(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
2269
2328
  };
2270
- function Ji({
2329
+ function il({
2271
2330
  title: e,
2272
2331
  titleId: t,
2273
2332
  ...n
@@ -2288,16 +2347,16 @@ function Ji({
2288
2347
  clipRule: "evenodd"
2289
2348
  }));
2290
2349
  }
2291
- const Qi = /* @__PURE__ */ E.forwardRef(Ji), el = 100, tl = 32767, Ye = Object.freeze({ maxCells: dn, maxColumns: dn / el, maxCellLength: tl }), Ir = 44, $r = 10, _r = 13, Ze = '"', Mn = (e, t) => {
2350
+ const ll = /* @__PURE__ */ E.forwardRef(il), cl = 100, dl = 32767, Xe = Object.freeze({ maxCells: fn, maxColumns: fn / cl, maxCellLength: dl }), Fr = 44, qr = 10, Br = 13, Ze = '"', Dn = (e, t) => {
2292
2351
  let n = t;
2293
2352
  for (; n < e.length; ) {
2294
2353
  const r = e.charCodeAt(n);
2295
- if (r === Ir || r === $r || r === _r) return n;
2354
+ if (r === Fr || r === qr || r === Br) return n;
2296
2355
  n += 1;
2297
2356
  }
2298
2357
  return n;
2299
2358
  };
2300
- function* nl(e, t) {
2359
+ function* ul(e, t) {
2301
2360
  let n = [], r = 0;
2302
2361
  for (; ; ) {
2303
2362
  let o;
@@ -2317,10 +2376,10 @@ function* nl(e, t) {
2317
2376
  r = f + 1;
2318
2377
  break;
2319
2378
  }
2320
- const i = Mn(e, r);
2379
+ const i = Dn(e, r);
2321
2380
  o += e.slice(r, i), r = i;
2322
2381
  } else {
2323
- const a = Mn(e, r);
2382
+ const a = Dn(e, r);
2324
2383
  o = e.slice(r, a), r = a;
2325
2384
  }
2326
2385
  if (n.push(o), r >= e.length) {
@@ -2328,15 +2387,15 @@ function* nl(e, t) {
2328
2387
  return;
2329
2388
  }
2330
2389
  const s = e.charCodeAt(r);
2331
- if (r += 1, s !== Ir && (yield n, n = [], s === _r && e.charCodeAt(r) === $r && (r += 1), r >= e.length))
2390
+ if (r += 1, s !== Fr && (yield n, n = [], s === Br && e.charCodeAt(r) === qr && (r += 1), r >= e.length))
2332
2391
  return;
2333
2392
  }
2334
2393
  }
2335
- const rl = (e, t, n) => t === "csv" ? nl(e, n) : n === "whole" ? as(e) : is(e), ol = (e, t) => {
2394
+ const fl = (e, t, n) => t === "csv" ? ul(e, n) : n === "whole" ? cs(e) : ds(e), ml = (e, t) => {
2336
2395
  if (e.length <= t) return e;
2337
2396
  const n = e.charCodeAt(t - 1);
2338
2397
  return e.slice(0, n >= 55296 && n <= 56319 ? t - 1 : t);
2339
- }, Fr = (e, t) => {
2398
+ }, Ur = (e, t) => {
2340
2399
  const n = [];
2341
2400
  let r = 0, o = !1, s = !1;
2342
2401
  for (const i of e) {
@@ -2345,17 +2404,17 @@ const rl = (e, t, n) => t === "csv" ? nl(e, n) : n === "whole" ? as(e) : is(e),
2345
2404
  s = !0;
2346
2405
  break;
2347
2406
  }
2348
- const l = f.some((d) => d.length > t.maxCellLength) ? f.map((d) => ol(d, t.maxCellLength)) : f;
2407
+ const l = f.some((c) => c.length > t.maxCellLength) ? f.map((c) => ml(c, t.maxCellLength)) : f;
2349
2408
  l !== i && (o = !0), n.push(l), r = u;
2350
2409
  }
2351
2410
  return { rows: n.map((i) => i.length === r ? i : [...i, ...Array(r - i.length).fill("")]), truncated: s || o, full: s };
2352
- }, vt = (e, t, n, r, o) => {
2353
- const s = Ao(e, t, r);
2354
- if (s === null) return { kind: "unreadable", code: "encoding", encodings: No(e, t, r) };
2411
+ }, yt = (e, t, n, r, o) => {
2412
+ const s = Po(e, t, r);
2413
+ if (s === null) return { kind: "unreadable", code: "encoding", encodings: Io(e, t, r) };
2355
2414
  if (s.includes("\0")) return { kind: "unreadable", code: "binary" };
2356
- const a = Fr(rl(s, n, t ? "whole" : "prefix"), o);
2415
+ const a = Ur(fl(s, n, t ? "whole" : "prefix"), o);
2357
2416
  return t ? a.truncated || a.rows.some((i) => i.some((f) => f !== "")) ? { kind: "table", table: a } : { kind: "empty" } : a.rows.length === 0 ? { kind: "unreadable", code: "long-row" } : { kind: "table", table: { ...a, truncated: !0 } };
2358
- }, sl = Object.freeze({ maxPartBytes: 64 * 1024 * 1024, maxSheets: 256 }), qr = (e) => {
2417
+ }, hl = Object.freeze({ maxPartBytes: 64 * 1024 * 1024, maxSheets: 256 }), Hr = (e) => {
2359
2418
  const t = [];
2360
2419
  let n = 0, r = !1;
2361
2420
  const o = (s) => {
@@ -2367,28 +2426,28 @@ const rl = (e, t, n) => t === "csv" ? nl(e, n) : n === "whole" ? as(e) : is(e),
2367
2426
  addRow: (s, a, i) => {
2368
2427
  if (a.size === 0 || r) return;
2369
2428
  let f = -1;
2370
- for (const d of a.keys()) d > f && (f = d);
2429
+ for (const c of a.keys()) c > f && (f = c);
2371
2430
  const u = Array(Math.min(f, e.maxColumns) + 1).fill("");
2372
- for (const [d, h] of a) d <= e.maxColumns && (u[d] = h);
2431
+ for (const [c, m] of a) c <= e.maxColumns && (u[c] = m);
2373
2432
  const l = Math.min(u.length, e.maxColumns);
2374
2433
  if (n === 0 && (s + 1) * l > e.maxCells) {
2375
- const d = Math.floor(e.maxCells / l);
2376
- for (; t.length < d; ) t.push([]);
2434
+ const c = Math.floor(e.maxCells / l);
2435
+ for (; t.length < c; ) t.push([]);
2377
2436
  o(u);
2378
2437
  return;
2379
2438
  }
2380
2439
  for (; t.length < s && !r; ) o([]);
2381
- for (let d = 0; d < i && !r; d += 1) o(d === 0 ? u : [...u]);
2440
+ for (let c = 0; c < i && !r; c += 1) o(c === 0 ? u : [...u]);
2382
2441
  },
2383
2442
  full: () => r,
2384
- table: () => Fr(t, e)
2443
+ table: () => Ur(t, e)
2385
2444
  };
2386
- }, al = (e) => {
2445
+ }, pl = (e) => {
2387
2446
  const t = Array.from(e.currentTarget.querySelectorAll('[role="tab"]')), n = e.target instanceof HTMLButtonElement ? t.indexOf(e.target) : -1;
2388
2447
  if (n === -1) return;
2389
2448
  const r = getComputedStyle(e.currentTarget).direction === "rtl" ? "ArrowRight" : "ArrowLeft", o = r === "ArrowLeft" ? "ArrowRight" : "ArrowLeft", s = e.key === o ? (n + 1) % t.length : e.key === r ? (n - 1 + t.length) % t.length : e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : null;
2390
2449
  s !== null && (e.preventDefault(), t[s]?.focus());
2391
- }, il = ({ names: e, selected: t, onSelect: n, label: r, tabIdOf: o, panelId: s }) => /* @__PURE__ */ c("div", { role: "tablist", "aria-label": r, className: "aqmx-sheet-tabs", "data-testid": "markdown-explorer-spreadsheet-sheets", onKeyDown: al, children: e.map((a, i) => /* @__PURE__ */ c(
2450
+ }, gl = ({ names: e, selected: t, onSelect: n, label: r, tabIdOf: o, panelId: s }) => /* @__PURE__ */ d("div", { role: "tablist", "aria-label": r, className: "aqmx-sheet-tabs", "data-testid": "markdown-explorer-spreadsheet-sheets", onKeyDown: pl, children: e.map((a, i) => /* @__PURE__ */ d(
2392
2451
  "button",
2393
2452
  {
2394
2453
  type: "button",
@@ -2403,8 +2462,8 @@ const rl = (e, t, n) => t === "csv" ? nl(e, n) : n === "whole" ? as(e) : is(e),
2403
2462
  children: a
2404
2463
  },
2405
2464
  i
2406
- )) }), Br = 64 * 1024, ll = (e) => {
2407
- let t = new Uint8Array(Math.min(e, Br)), n = 0;
2465
+ )) }), zr = 64 * 1024, wl = (e) => {
2466
+ let t = new Uint8Array(Math.min(e, zr)), n = 0;
2408
2467
  return {
2409
2468
  append: (r) => {
2410
2469
  if (n + r.byteLength > t.byteLength) {
@@ -2416,55 +2475,55 @@ const rl = (e, t, n) => t === "csv" ? nl(e, n) : n === "whole" ? as(e) : is(e),
2416
2475
  bytes: () => t.subarray(0, n),
2417
2476
  length: () => n
2418
2477
  };
2419
- }, cl = async (e) => {
2478
+ }, vl = async (e) => {
2420
2479
  for (; ; ) {
2421
2480
  const { done: t, value: n } = await e.read();
2422
2481
  if (t) return !0;
2423
2482
  if (n.byteLength > 0) return !1;
2424
2483
  }
2425
- }, dl = async (e, t) => {
2426
- const { format: n, legacyEncoding: r, maxBytes: o, budget: s } = t, a = e.getReader(), i = ll(o);
2427
- let f = Br;
2484
+ }, bl = async (e, t) => {
2485
+ const { format: n, legacyEncoding: r, maxBytes: o, budget: s } = t, a = e.getReader(), i = wl(o);
2486
+ let f = zr;
2428
2487
  try {
2429
2488
  for (; ; ) {
2430
2489
  const { done: u, value: l } = await a.read();
2431
- if (u) return vt(i.bytes(), !0, n, r, s);
2432
- const d = o - i.length();
2433
- if (i.append(l.byteLength > d ? l.subarray(0, d) : l), i.length() === o) {
2434
- const g = l.byteLength <= d && await cl(a);
2435
- return vt(i.bytes(), g, n, r, s);
2490
+ if (u) return yt(i.bytes(), !0, n, r, s);
2491
+ const c = o - i.length();
2492
+ if (i.append(l.byteLength > c ? l.subarray(0, c) : l), i.length() === o) {
2493
+ const g = l.byteLength <= c && await vl(a);
2494
+ return yt(i.bytes(), g, n, r, s);
2436
2495
  }
2437
2496
  if (i.length() < f) continue;
2438
2497
  f = i.length() * 2;
2439
- const h = vt(i.bytes(), !1, n, r, s);
2440
- if (h.kind === "unreadable" && h.code !== "long-row" || h.kind === "table" && h.table.full) return h;
2498
+ const m = yt(i.bytes(), !1, n, r, s);
2499
+ if (m.kind === "unreadable" && m.code !== "long-row" || m.kind === "table" && m.table.full) return m;
2441
2500
  }
2442
2501
  } finally {
2443
2502
  a.cancel().catch(() => {
2444
2503
  });
2445
2504
  }
2446
- }, Ur = async (e, t, n, r) => {
2447
- const o = await e.asset(rt(t), r);
2505
+ }, jr = async (e, t, n, r) => {
2506
+ const o = await e.asset(st(t), r);
2448
2507
  if (o.status === "cancelled") return null;
2449
2508
  if (o.status === "error") return { kind: "failure", failure: o.failure };
2450
2509
  let s;
2451
2510
  try {
2452
- s = await dl(o.body, n);
2511
+ s = await bl(o.body, n);
2453
2512
  } catch {
2454
2513
  return r.aborted ? null : { kind: "failure", failure: { reason: "failed" } };
2455
2514
  }
2456
2515
  return r.aborted ? null : s.kind === "table" ? { kind: "table", rows: s.table.rows, truncated: s.table.truncated } : s;
2457
- }, Vt = (e, t, n) => {
2458
- const { documents: r, labels: o } = $(), s = Ha(), a = F(() => r.answerStampOf(e), [r, e]), i = re(r.subscribe, a, a), [f, u] = V(0), l = X(() => ({ read: n, stamp: i, attempt: f }), [n, i, f]), [d, h] = V({ settled: null, shown: null, failure: null }), g = U(null), v = le((O, R) => {
2516
+ }, Wt = (e, t, n) => {
2517
+ const { documents: r, labels: o } = $(), s = Va(), a = F(() => r.answerStampOf(e), [r, e]), i = re(r.subscribe, a, a), [f, u] = V(0), l = X(() => ({ read: n, stamp: i, attempt: f }), [n, i, f]), [c, m] = V({ settled: null, shown: null, failure: null }), g = U(null), v = le((O, R) => {
2459
2518
  if (g.current?.settle(R.stamp, O.kind === "failure" ? O.failure : null), O.kind === "read") {
2460
- h({ settled: R, shown: O.value, failure: null });
2519
+ m({ settled: R, shown: O.value, failure: null });
2461
2520
  return;
2462
2521
  }
2463
- if (d.shown !== null) {
2464
- h({ settled: R, shown: d.shown, failure: null });
2522
+ if (c.shown !== null) {
2523
+ m({ settled: R, shown: c.shown, failure: null });
2465
2524
  return;
2466
2525
  }
2467
- h({ settled: R, shown: null, failure: O.failure }), s.announceFailure(o.documentFailed(t, de(o, O.failure.reason)));
2526
+ m({ settled: R, shown: null, failure: O.failure }), s.announceFailure(o.documentFailed(t, de(o, O.failure.reason)));
2468
2527
  });
2469
2528
  ee(() => {
2470
2529
  const O = s.readPart();
@@ -2477,19 +2536,19 @@ const rl = (e, t, n) => t === "csv" ? nl(e, n) : n === "whole" ? as(e) : is(e),
2477
2536
  R !== null && !O.signal.aborted && v(R, l);
2478
2537
  }), () => O.abort();
2479
2538
  }, [l]);
2480
- const y = d.settled !== l && (d.shown !== null || d.failure !== null);
2539
+ const y = c.settled !== l && (c.shown !== null || c.failure !== null);
2481
2540
  Y(() => y ? s.holdBusy() : void 0, [y, s]);
2482
2541
  const T = F(() => u((O) => O + 1), []);
2483
- return { shown: d.shown, failure: d.failure, retry: T };
2484
- }, Hr = (e, t) => {
2542
+ return { shown: c.shown, failure: c.failure, retry: T };
2543
+ }, Vr = (e, t) => {
2485
2544
  const n = {};
2486
- for (const r of Object.keys(Xe[t])) {
2487
- const o = e[_t(r)];
2488
- o !== Xe[t][r].text && (n[r] = o);
2545
+ for (const r of Object.keys(Je[t])) {
2546
+ const o = e[qt(r)];
2547
+ o !== Je[t][r].text && (n[r] = o);
2489
2548
  }
2490
2549
  return n;
2491
- }, ul = (e, t) => Object.fromEntries(Object.entries(Hr(e, t)).map(([n, r]) => [`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`, r])), fl = (e, t) => ({
2492
- ...ul(e, t),
2550
+ }, yl = (e, t) => Object.fromEntries(Object.entries(Vr(e, t)).map(([n, r]) => [`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`, r])), kl = (e, t) => ({
2551
+ ...yl(e, t),
2493
2552
  loading: e.viewerLoading,
2494
2553
  errorPrefix: e.viewerErrorPrefix,
2495
2554
  styleTitle: e.viewerStyleTitle,
@@ -2547,28 +2606,28 @@ const rl = (e, t, n) => t === "csv" ? nl(e, n) : n === "whole" ? as(e) : is(e),
2547
2606
  svgImageCopyImage: e.viewerSvgImageCopyImage,
2548
2607
  svgImageCopiedImage: e.viewerSvgImageCopiedImage,
2549
2608
  svgImageCopyImageFailed: e.viewerSvgImageCopyImageFailed
2550
- }), zr = (e, t, n) => {
2609
+ }), Zr = (e, t, n) => {
2551
2610
  if (t !== void 0) return t;
2552
2611
  if (n !== void 0) return n;
2553
2612
  const [r] = e.documentStyles;
2554
2613
  if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
2555
2614
  return r.name;
2556
- }, jr = (e, t) => e !== void 0 ? e : t !== void 0 ? t : cs;
2615
+ }, Wr = (e, t) => e !== void 0 ? e : t !== void 0 ? t : fs;
2557
2616
  class ne extends Error {
2558
2617
  refusal;
2559
2618
  constructor(t, n) {
2560
2619
  super(n), this.name = "WorkbookError", this.refusal = t;
2561
2620
  }
2562
2621
  }
2563
- const ml = /* @__PURE__ */ new Map([
2622
+ const El = /* @__PURE__ */ new Map([
2564
2623
  ["lt", "<"],
2565
2624
  ["gt", ">"],
2566
2625
  ["amp", "&"],
2567
2626
  ["quot", '"'],
2568
2627
  ["apos", "'"]
2569
- ]), hl = /&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z_][A-Za-z0-9._-]*);/gu, pl = /([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gu, gl = /^[^\s/>]+/u, Se = (e) => {
2628
+ ]), Sl = /&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z_][A-Za-z0-9._-]*);/gu, xl = /([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gu, Tl = /^[^\s/>]+/u, Se = (e) => {
2570
2629
  throw new ne("not-workbook", `the XML ${e}`);
2571
- }, An = (e) => Number.isInteger(e) && e >= 0 && e <= 1114111 ? String.fromCodePoint(e) : Se(`refers to the code point ${e}`), Vr = (e) => e.includes("&") ? e.replace(hl, (t, n) => n.startsWith("#x") ? An(Number.parseInt(n.slice(2), 16)) : n.startsWith("#") ? An(Number.parseInt(n.slice(1), 10)) : ml.get(n) ?? Se(`names the undeclared entity ${t}`)) : e, Pt = (e) => e.slice(e.indexOf(":") + 1), wl = (e, t) => {
2630
+ }, Pn = (e) => Number.isInteger(e) && e >= 0 && e <= 1114111 ? String.fromCodePoint(e) : Se(`refers to the code point ${e}`), Gr = (e) => e.includes("&") ? e.replace(Sl, (t, n) => n.startsWith("#x") ? Pn(Number.parseInt(n.slice(2), 16)) : n.startsWith("#") ? Pn(Number.parseInt(n.slice(1), 10)) : El.get(n) ?? Se(`names the undeclared entity ${t}`)) : e, $t = (e) => e.slice(e.indexOf(":") + 1), Rl = (e, t) => {
2572
2631
  let n = "";
2573
2632
  for (let r = t; r < e.length; r += 1) {
2574
2633
  const o = e[r];
@@ -2580,18 +2639,18 @@ const ml = /* @__PURE__ */ new Map([
2580
2639
  return r;
2581
2640
  }
2582
2641
  return -1;
2583
- }, vl = (e) => {
2642
+ }, Cl = (e) => {
2584
2643
  const t = /* @__PURE__ */ new Map();
2585
- for (const n of e.matchAll(pl)) t.set(Pt(n[1] ?? ""), Vr(n[2] ?? n[3] ?? ""));
2644
+ for (const n of e.matchAll(xl)) t.set($t(n[1] ?? ""), Gr(n[2] ?? n[3] ?? ""));
2586
2645
  return t;
2587
- }, Zr = (e, t) => {
2646
+ }, Kr = (e, t) => {
2588
2647
  let n = "";
2589
2648
  const r = () => {
2590
2649
  let o = 0;
2591
2650
  for (; !t(); ) {
2592
2651
  const s = n.indexOf("<", o);
2593
2652
  if (s === -1) break;
2594
- if (s > o && (e.text?.(Vr(n.slice(o, s))), o = s), n.startsWith("<!--", s)) {
2653
+ if (s > o && (e.text?.(Gr(n.slice(o, s))), o = s), n.startsWith("<!--", s)) {
2595
2654
  const u = n.indexOf("-->", s + 4);
2596
2655
  if (u === -1) break;
2597
2656
  o = u + 3;
@@ -2611,14 +2670,14 @@ const ml = /* @__PURE__ */ new Map([
2611
2670
  o = u + 2;
2612
2671
  continue;
2613
2672
  }
2614
- const i = wl(n, s + 1);
2673
+ const i = Rl(n, s + 1);
2615
2674
  if (i === -1) break;
2616
2675
  const f = n.slice(s + 1, i);
2617
2676
  if (f.startsWith("/"))
2618
- e.end?.(Pt(f.slice(1).trim()));
2677
+ e.end?.($t(f.slice(1).trim()));
2619
2678
  else {
2620
- const u = f.endsWith("/"), l = u ? f.slice(0, -1) : f, d = gl.exec(l)?.[0] ?? Se("has a tag without a name"), h = Pt(d);
2621
- e.start?.(h, vl(l.slice(d.length)), u), u && e.end?.(h);
2679
+ const u = f.endsWith("/"), l = u ? f.slice(0, -1) : f, c = Tl.exec(l)?.[0] ?? Se("has a tag without a name"), m = $t(c);
2680
+ e.start?.(m, Cl(l.slice(c.length)), u), u && e.end?.(m);
2622
2681
  }
2623
2682
  o = i + 1;
2624
2683
  }
@@ -2633,7 +2692,7 @@ const ml = /* @__PURE__ */ new Map([
2633
2692
  }
2634
2693
  };
2635
2694
  }, He = async (e, t, n) => {
2636
- const r = Zr(t, n), o = new TextDecoder("utf-8", { fatal: !0 }), s = e.getReader();
2695
+ const r = Kr(t, n), o = new TextDecoder("utf-8", { fatal: !0 }), s = e.getReader();
2637
2696
  try {
2638
2697
  for (; !n(); ) {
2639
2698
  const { done: a, value: i } = await s.read();
@@ -2650,44 +2709,44 @@ const ml = /* @__PURE__ */ new Map([
2650
2709
  s.cancel().catch(() => {
2651
2710
  });
2652
2711
  }
2653
- }, bl = 101010256, yl = 33639248, kl = 67324752, Wr = 22, El = 65535, Nn = 46, Dn = 30, Sl = 1, Pn = 0, xl = 8, Tl = 65535, Le = 4294967295, Rl = new TextDecoder("utf-8"), ae = (e) => {
2712
+ }, Ol = 101010256, Ll = 33639248, Ml = 67324752, Yr = 22, Al = 65535, In = 46, $n = 30, Nl = 1, _n = 0, Dl = 8, Pl = 65535, Le = 4294967295, Il = new TextDecoder("utf-8"), ae = (e) => {
2654
2713
  throw new ne("not-workbook", `the ZIP package ${e}`);
2655
- }, Cl = (e) => {
2656
- const t = e.byteLength - Wr, n = Math.max(0, t - El);
2714
+ }, $l = (e) => {
2715
+ const t = e.byteLength - Yr, n = Math.max(0, t - Al);
2657
2716
  for (let r = t; r >= n; r -= 1)
2658
- if (e.getUint32(r, !0) === bl) return r;
2717
+ if (e.getUint32(r, !0) === Ol) return r;
2659
2718
  return ae("has no end of central directory record");
2660
- }, Ol = (e) => {
2661
- if (e.byteLength < Wr) return ae("is shorter than its end record");
2662
- const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = Cl(t), r = t.getUint16(n + 4, !0), o = t.getUint16(n + 6, !0), s = t.getUint16(n + 10, !0), a = t.getUint32(n + 12, !0), i = t.getUint32(n + 16, !0);
2719
+ }, _l = (e) => {
2720
+ if (e.byteLength < Yr) return ae("is shorter than its end record");
2721
+ const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = $l(t), r = t.getUint16(n + 4, !0), o = t.getUint16(n + 6, !0), s = t.getUint16(n + 10, !0), a = t.getUint32(n + 12, !0), i = t.getUint32(n + 16, !0);
2663
2722
  if (r !== 0 || o !== 0) return ae("spans several disks");
2664
- if (s === Tl || a === Le || i === Le) return ae("is a ZIP64 package");
2723
+ if (s === Pl || a === Le || i === Le) return ae("is a ZIP64 package");
2665
2724
  if (i + a > n) return ae("has a central directory past its end record");
2666
2725
  const f = /* @__PURE__ */ new Map();
2667
2726
  let u = i;
2668
2727
  for (let l = 0; l < s; l += 1) {
2669
- if (u + Nn > n || t.getUint32(u, !0) !== yl) return ae("has a malformed central directory");
2670
- const d = t.getUint16(u + 8, !0), h = t.getUint16(u + 10, !0), g = t.getUint32(u + 20, !0), v = t.getUint32(u + 24, !0), y = t.getUint16(u + 28, !0), T = t.getUint16(u + 30, !0), O = t.getUint16(u + 32, !0), R = t.getUint32(u + 42, !0), q = u + Nn;
2728
+ if (u + In > n || t.getUint32(u, !0) !== Ll) return ae("has a malformed central directory");
2729
+ const c = t.getUint16(u + 8, !0), m = t.getUint16(u + 10, !0), g = t.getUint32(u + 20, !0), v = t.getUint32(u + 24, !0), y = t.getUint16(u + 28, !0), T = t.getUint16(u + 30, !0), O = t.getUint16(u + 32, !0), R = t.getUint32(u + 42, !0), q = u + In;
2671
2730
  if (q + y > n) return ae("has a name past its central directory");
2672
- const D = Rl.decode(e.subarray(q, q + y));
2731
+ const D = Il.decode(e.subarray(q, q + y));
2673
2732
  if (g === Le || v === Le || R === Le) return ae("has a ZIP64 entry");
2674
2733
  if (!D.endsWith("/")) {
2675
2734
  if (f.has(D)) return ae(`names ${D} twice`);
2676
- f.set(D, { name: D, encrypted: (d & Sl) !== 0, method: h, compressedSize: g, uncompressedSize: v, localHeaderOffset: R });
2735
+ f.set(D, { name: D, encrypted: (c & Nl) !== 0, method: m, compressedSize: g, uncompressedSize: v, localHeaderOffset: R });
2677
2736
  }
2678
2737
  u = q + y + T + O;
2679
2738
  }
2680
2739
  return { bytes: e, entries: f };
2681
- }, Ll = (e, t) => {
2740
+ }, Fl = (e, t) => {
2682
2741
  const { bytes: n } = e, r = new DataView(n.buffer, n.byteOffset, n.byteLength), o = t.localHeaderOffset;
2683
- if (o + Dn > n.byteLength || r.getUint32(o, !0) !== kl) return ae(`has no local header for ${t.name}`);
2684
- const s = o + Dn + r.getUint16(o + 26, !0) + r.getUint16(o + 28, !0), a = s + t.compressedSize;
2742
+ if (o + $n > n.byteLength || r.getUint32(o, !0) !== Ml) return ae(`has no local header for ${t.name}`);
2743
+ const s = o + $n + r.getUint16(o + 26, !0) + r.getUint16(o + 28, !0), a = s + t.compressedSize;
2685
2744
  return a > n.byteLength ? ae(`has the data of ${t.name} past its end`) : { start: s, end: a };
2686
- }, Gr = (e) => new ReadableStream({
2745
+ }, Xr = (e) => new ReadableStream({
2687
2746
  start(t) {
2688
2747
  e.byteLength > 0 && t.enqueue(e), t.close();
2689
2748
  }
2690
- }), Ml = (e) => Gr(e).pipeThrough(new DecompressionStream("deflate-raw")), Al = (e, t) => {
2749
+ }), ql = (e) => Xr(e).pipeThrough(new DecompressionStream("deflate-raw")), Bl = (e, t) => {
2691
2750
  let n = 0;
2692
2751
  return new TransformStream({
2693
2752
  transform(r, o) {
@@ -2702,11 +2761,11 @@ const ml = /* @__PURE__ */ new Map([
2702
2761
  const r = e.entries.get(t);
2703
2762
  if (r === void 0) return null;
2704
2763
  if (r.encrypted) throw new ne("encrypted", `${t} is encrypted`);
2705
- if (r.method !== Pn && r.method !== xl) return ae(`compresses ${t} with method ${r.method}`);
2764
+ if (r.method !== _n && r.method !== Dl) return ae(`compresses ${t} with method ${r.method}`);
2706
2765
  if (r.uncompressedSize > n) throw new ne("too-large", `${t} declares ${r.uncompressedSize} bytes`);
2707
- const { start: o, end: s } = Ll(e, r), a = e.bytes.subarray(o, s);
2708
- return (r.method === Pn ? Gr(a) : Ml(a)).pipeThrough(Al(t, n));
2709
- }, tt = async (e, t, n) => {
2766
+ const { start: o, end: s } = Fl(e, r), a = e.bytes.subarray(o, s);
2767
+ return (r.method === _n ? Xr(a) : ql(a)).pipeThrough(Bl(t, n));
2768
+ }, rt = async (e, t, n) => {
2710
2769
  const r = Fe(e, t, n);
2711
2770
  if (r === null) return null;
2712
2771
  const o = new TextDecoder("utf-8", { fatal: !0 }), s = r.getReader();
@@ -2724,10 +2783,10 @@ const ml = /* @__PURE__ */ new Map([
2724
2783
  } finally {
2725
2784
  s.releaseLock();
2726
2785
  }
2727
- }, In = "content.xml", Nl = "META-INF/manifest.xml", Kr = (e) => {
2786
+ }, Fn = "content.xml", Ul = "META-INF/manifest.xml", Jr = (e) => {
2728
2787
  throw new ne("not-workbook", `the spreadsheet ${e}`);
2729
- }, $n = (e, t) => Fe(e, In, t.maxPartBytes) ?? Kr(`has no ${In}`), Dl = async (e, t) => {
2730
- const n = Fe(e, Nl, t.maxPartBytes);
2788
+ }, qn = (e, t) => Fe(e, Fn, t.maxPartBytes) ?? Jr(`has no ${Fn}`), Hl = async (e, t) => {
2789
+ const n = Fe(e, Ul, t.maxPartBytes);
2731
2790
  if (n === null) return !1;
2732
2791
  let r = !1;
2733
2792
  return await He(
@@ -2739,7 +2798,7 @@ const ml = /* @__PURE__ */ new Map([
2739
2798
  },
2740
2799
  () => r
2741
2800
  ), r;
2742
- }, Pl = async (e) => {
2801
+ }, zl = async (e) => {
2743
2802
  const t = [], n = /* @__PURE__ */ new Set();
2744
2803
  let r = null, o = 0;
2745
2804
  return await He(
@@ -2754,12 +2813,12 @@ const ml = /* @__PURE__ */ new Map([
2754
2813
  },
2755
2814
  () => !1
2756
2815
  ), { tables: t, hidingStyles: n };
2757
- }, bt = (e) => {
2816
+ }, kt = (e) => {
2758
2817
  const t = Number(e);
2759
2818
  return Number.isInteger(t) && t > 0 ? t : 1;
2760
- }, Il = async (e, t, n) => {
2761
- const r = qr(n);
2762
- let o = 0, s = 0, a = !1, i = !1, f = 0, u = 1, l = /* @__PURE__ */ new Map(), d = 0, h = null;
2819
+ }, jl = async (e, t, n) => {
2820
+ const r = Hr(n);
2821
+ let o = 0, s = 0, a = !1, i = !1, f = 0, u = 1, l = /* @__PURE__ */ new Map(), c = 0, m = null;
2763
2822
  return await He(
2764
2823
  e,
2765
2824
  {
@@ -2768,8 +2827,8 @@ const ml = /* @__PURE__ */ new Map([
2768
2827
  s === 0 && (a = o === t, o += 1), y || (s += 1);
2769
2828
  return;
2770
2829
  }
2771
- !a || s !== 1 || (g === "table-row" ? (u = bt(v.get("number-rows-repeated")), l = /* @__PURE__ */ new Map(), d = 0) : g === "table-cell" || g === "covered-table-cell" ? h = { repeat: bt(v.get("number-columns-repeated")), covered: g === "covered-table-cell", parts: [], paragraphs: 0, paragraphDepth: 0, annotationDepth: 0 } : h !== null && h.annotationDepth === 0 && (g === "annotation" && !y ? h.annotationDepth += 1 : g === "p" || g === "h" ? (h.paragraphs > 0 && h.parts.push(`
2772
- `), h.paragraphs += 1, y || (h.paragraphDepth += 1)) : h.paragraphDepth > 0 && (g === "s" ? h.parts.push(" ".repeat(bt(v.get("c")))) : g === "tab" ? h.parts.push(" ") : g === "line-break" && h.parts.push(`
2830
+ !a || s !== 1 || (g === "table-row" ? (u = kt(v.get("number-rows-repeated")), l = /* @__PURE__ */ new Map(), c = 0) : g === "table-cell" || g === "covered-table-cell" ? m = { repeat: kt(v.get("number-columns-repeated")), covered: g === "covered-table-cell", parts: [], paragraphs: 0, paragraphDepth: 0, annotationDepth: 0 } : m !== null && m.annotationDepth === 0 && (g === "annotation" && !y ? m.annotationDepth += 1 : g === "p" || g === "h" ? (m.paragraphs > 0 && m.parts.push(`
2831
+ `), m.paragraphs += 1, y || (m.paragraphDepth += 1)) : m.paragraphDepth > 0 && (g === "s" ? m.parts.push(" ".repeat(kt(v.get("c")))) : g === "tab" ? m.parts.push(" ") : g === "line-break" && m.parts.push(`
2773
2832
  `))));
2774
2833
  },
2775
2834
  end: (g) => {
@@ -2777,38 +2836,38 @@ const ml = /* @__PURE__ */ new Map([
2777
2836
  s = Math.max(0, s - 1), s === 0 && a && (a = !1, i = !0);
2778
2837
  return;
2779
2838
  }
2780
- if (h !== null && h.annotationDepth > 0) {
2781
- g === "annotation" && (h.annotationDepth -= 1);
2839
+ if (m !== null && m.annotationDepth > 0) {
2840
+ g === "annotation" && (m.annotationDepth -= 1);
2782
2841
  return;
2783
2842
  }
2784
2843
  if (!(!a || s !== 1))
2785
- if ((g === "table-cell" || g === "covered-table-cell") && h !== null) {
2786
- const v = h.covered ? "" : h.parts.join("");
2844
+ if ((g === "table-cell" || g === "covered-table-cell") && m !== null) {
2845
+ const v = m.covered ? "" : m.parts.join("");
2787
2846
  if (v !== "") {
2788
- const y = Math.min(d + h.repeat, n.maxColumns + 1);
2789
- for (let T = d; T < y; T += 1) l.set(T, v);
2847
+ const y = Math.min(c + m.repeat, n.maxColumns + 1);
2848
+ for (let T = c; T < y; T += 1) l.set(T, v);
2790
2849
  }
2791
- d += h.repeat, h = null;
2792
- } else g === "table-row" ? (r.addRow(f, l, u), f += u) : (g === "p" || g === "h") && h !== null && (h.paragraphDepth = Math.max(0, h.paragraphDepth - 1));
2850
+ c += m.repeat, m = null;
2851
+ } else g === "table-row" ? (r.addRow(f, l, u), f += u) : (g === "p" || g === "h") && m !== null && (m.paragraphDepth = Math.max(0, m.paragraphDepth - 1));
2793
2852
  },
2794
2853
  text: (g) => {
2795
- h !== null && h.annotationDepth === 0 && h.paragraphDepth > 0 && h.parts.push(g);
2854
+ m !== null && m.annotationDepth === 0 && m.paragraphDepth > 0 && m.parts.push(g);
2796
2855
  }
2797
2856
  },
2798
2857
  () => i || r.full()
2799
2858
  ), r.table();
2800
- }, $l = async (e, t) => {
2801
- if (await Dl(e, t)) throw new ne("encrypted", "the spreadsheet's manifest names encryption data");
2802
- const { tables: n, hidingStyles: r } = await Pl($n(e, t)), o = [];
2859
+ }, Vl = async (e, t) => {
2860
+ if (await Hl(e, t)) throw new ne("encrypted", "the spreadsheet's manifest names encryption data");
2861
+ const { tables: n, hidingStyles: r } = await zl(qn(e, t)), o = [];
2803
2862
  let s = 0;
2804
2863
  return n.forEach((a, i) => {
2805
2864
  if (r.has(a.style)) {
2806
2865
  s += 1;
2807
2866
  return;
2808
2867
  }
2809
- o.push({ name: a.name, read: async (f) => Il($n(e, t), i, f) });
2810
- }), o.length === 0 && Kr("shows no table"), { sheets: o.slice(0, t.maxSheets), unshownSheets: s, unlistedSheets: Math.max(0, o.length - t.maxSheets) };
2811
- }, Ee = Object.freeze({ kind: "general" }), _l = new Map([
2868
+ o.push({ name: a.name, read: async (f) => jl(qn(e, t), i, f) });
2869
+ }), o.length === 0 && Jr("shows no table"), { sheets: o.slice(0, t.maxSheets), unshownSheets: s, unlistedSheets: Math.max(0, o.length - t.maxSheets) };
2870
+ }, Ee = Object.freeze({ kind: "general" }), Zl = new Map([
2812
2871
  [0, "General"],
2813
2872
  [1, "0"],
2814
2873
  [2, "0.00"],
@@ -2840,7 +2899,7 @@ const ml = /* @__PURE__ */ new Map([
2840
2899
  [47, "mmss.0"],
2841
2900
  [48, "##0.0E+0"],
2842
2901
  [49, "@"]
2843
- ]), Fl = /^\[(h+|m+|s+)\]$/iu, ql = (e) => {
2902
+ ]), Wl = /^\[(h+|m+|s+)\]$/iu, Gl = (e) => {
2844
2903
  let t = "", n = !1;
2845
2904
  for (let r = 0; r < e.length; r += 1) {
2846
2905
  const o = e[r];
@@ -2852,13 +2911,13 @@ const ml = /* @__PURE__ */ new Map([
2852
2911
  r += 1;
2853
2912
  else if (o === "[") {
2854
2913
  const s = e.indexOf("]", r + 1), a = e.slice(r, s === -1 ? e.length : s + 1);
2855
- Fl.test(a) && (t += a.slice(1, -1), n = !0), r = s === -1 ? e.length : s;
2914
+ Wl.test(a) && (t += a.slice(1, -1), n = !0), r = s === -1 ? e.length : s;
2856
2915
  } else
2857
2916
  t += o;
2858
2917
  }
2859
2918
  return { text: t.toLowerCase(), elapsed: n };
2860
- }, Bl = (e) => {
2861
- const { text: t, elapsed: n } = ql(e);
2919
+ }, Kl = (e) => {
2920
+ const { text: t, elapsed: n } = Gl(e);
2862
2921
  if (t === "" || t === "general" || t.includes("@") || /[0#?.]e[+-]/u.test(t)) return Ee;
2863
2922
  const r = n || /[hs]/u.test(t) || t.includes("am/pm") || t.includes("a/p"), o = /[ydge]/u.test(t.replace(/am\/pm|a\/p/gu, "")) || t.includes("m") && !r;
2864
2923
  if (o || r) return { kind: "date-time", date: o, time: r, seconds: t.includes("s"), elapsed: n };
@@ -2867,77 +2926,77 @@ const ml = /* @__PURE__ */ new Map([
2867
2926
  if (s === void 0) return Ee;
2868
2927
  const a = /,*$/u.exec(s)?.[0].length ?? 0, [i = "", f = ""] = s.slice(0, s.length - a).split("."), u = (f.match(/[0#?]/gu) ?? []).length;
2869
2928
  return t.includes("%") ? { kind: "percent", decimals: u } : { kind: "fixed", decimals: u, grouping: i.includes(","), scale: 1e3 ** a };
2870
- }, Ul = (e, t) => {
2871
- const n = t.get(e) ?? _l.get(e);
2872
- return n === void 0 ? Ee : Bl(n);
2873
- }, Zt = (e) => {
2929
+ }, Yl = (e, t) => {
2930
+ const n = t.get(e) ?? Zl.get(e);
2931
+ return n === void 0 ? Ee : Kl(n);
2932
+ }, Gt = (e) => {
2874
2933
  if (Number.isInteger(e) && Math.abs(e) < 1e15) return String(e);
2875
2934
  const [t = "", n] = e.toPrecision(15).split("e"), r = t.includes(".") ? t.replace(/0+$/u, "").replace(/\.$/u, "") : t;
2876
2935
  return n === void 0 ? r : `${r}E${n.startsWith("-") ? n : `+${n.replace("+", "")}`}`;
2877
- }, _n = (e, t, n) => {
2936
+ }, Bn = (e, t, n) => {
2878
2937
  const r = Math.abs(e).toFixed(t);
2879
- if (r.includes("e")) return Zt(e);
2938
+ if (r.includes("e")) return Gt(e);
2880
2939
  const [o = "", s] = r.split("."), a = n ? o.replace(/\B(?=(\d{3})+(?!\d))/gu, ",") : o;
2881
2940
  return `${e < 0 && /[1-9]/u.test(r) ? "-" : ""}${a}${s === void 0 ? "" : `.${s}`}`;
2882
- }, Hl = 864e5, Fn = 86400, zl = 2958465, xe = (e, t) => String(e).padStart(t, "0"), jl = (e, t) => {
2941
+ }, Xl = 864e5, Un = 86400, Jl = 2958465, xe = (e, t) => String(e).padStart(t, "0"), Ql = (e, t) => {
2883
2942
  if (!t && e === 0) return "1900-01-00";
2884
2943
  if (!t && e === 60) return "1900-02-29";
2885
- const n = t ? Date.UTC(1904, 0, 1) : e < 60 ? Date.UTC(1899, 11, 31) : Date.UTC(1899, 11, 30), r = new Date(n + e * Hl);
2944
+ const n = t ? Date.UTC(1904, 0, 1) : e < 60 ? Date.UTC(1899, 11, 31) : Date.UTC(1899, 11, 30), r = new Date(n + e * Xl);
2886
2945
  return `${xe(r.getUTCFullYear(), 4)}-${xe(r.getUTCMonth() + 1, 2)}-${xe(r.getUTCDate(), 2)}`;
2887
- }, Vl = (e, t, n) => {
2888
- if (e < 0 || e >= zl + 1) return Zt(e);
2889
- let r = Math.floor(e), o = Math.round((e - r) * Fn);
2890
- o === Fn && (r += 1, o = 0);
2946
+ }, ec = (e, t, n) => {
2947
+ if (e < 0 || e >= Jl + 1) return Gt(e);
2948
+ let r = Math.floor(e), o = Math.round((e - r) * Un);
2949
+ o === Un && (r += 1, o = 0);
2891
2950
  const s = Math.floor(o / 3600), a = Math.floor(o % 3600 / 60), i = `${xe(t.elapsed ? r * 24 + s : s, 2)}:${xe(a, 2)}${t.seconds ? `:${xe(o % 60, 2)}` : ""}`;
2892
2951
  if (t.elapsed || !t.date) return i;
2893
- const f = jl(r, n);
2952
+ const f = Ql(r, n);
2894
2953
  return t.time ? `${f} ${i}` : f;
2895
- }, Zl = (e, t, n) => {
2954
+ }, tc = (e, t, n) => {
2896
2955
  switch (t.kind) {
2897
2956
  case "general":
2898
- return Zt(e);
2957
+ return Gt(e);
2899
2958
  case "date-time":
2900
- return Vl(e, t, n);
2959
+ return ec(e, t, n);
2901
2960
  case "percent":
2902
- return `${_n(e * 100, t.decimals, !1)}%`;
2961
+ return `${Bn(e * 100, t.decimals, !1)}%`;
2903
2962
  case "fixed":
2904
- return _n(e / t.scale, t.decimals, t.grouping);
2963
+ return Bn(e / t.scale, t.decimals, t.grouping);
2905
2964
  }
2906
- }, Yr = "_rels/.rels", ce = (e) => {
2965
+ }, Qr = "_rels/.rels", ce = (e) => {
2907
2966
  throw new ne("not-workbook", `the workbook ${e}`);
2908
- }, Wt = (e, t) => {
2909
- const n = Zr(t, () => !1);
2967
+ }, Kt = (e, t) => {
2968
+ const n = Kr(t, () => !1);
2910
2969
  n.write(e), n.finish();
2911
- }, Wl = (e, t) => {
2970
+ }, nc = (e, t) => {
2912
2971
  try {
2913
2972
  return decodeURIComponent(e);
2914
2973
  } catch {
2915
2974
  return ce(`points to a malformed part name (${t})`);
2916
2975
  }
2917
- }, Gl = (e, t) => {
2976
+ }, rc = (e, t) => {
2918
2977
  const r = [...t.startsWith("/") ? [] : e.split("/").slice(0, -1)];
2919
2978
  for (const o of t.split("/"))
2920
- o === "" || o === "." || (o === ".." ? (r.length === 0 && ce(`points above its root (${t})`), r.pop()) : r.push(Wl(o, t)));
2979
+ o === "" || o === "." || (o === ".." ? (r.length === 0 && ce(`points above its root (${t})`), r.pop()) : r.push(nc(o, t)));
2921
2980
  return r.join("/");
2922
- }, Kl = (e) => {
2981
+ }, oc = (e) => {
2923
2982
  const t = e.lastIndexOf("/");
2924
2983
  return `${e.slice(0, t + 1)}_rels/${e.slice(t + 1)}.rels`;
2925
- }, qn = async (e, t, n) => {
2926
- const r = await tt(e, t === "" ? Yr : Kl(t), n.maxPartBytes), o = /* @__PURE__ */ new Map();
2927
- return r === null || Wt(r, {
2984
+ }, Hn = async (e, t, n) => {
2985
+ const r = await rt(e, t === "" ? Qr : oc(t), n.maxPartBytes), o = /* @__PURE__ */ new Map();
2986
+ return r === null || Kt(r, {
2928
2987
  start: (s, a) => {
2929
2988
  if (s !== "Relationship") return;
2930
2989
  const i = a.get("Id"), f = a.get("Type"), u = a.get("Target");
2931
- i === void 0 || f === void 0 || u === void 0 || a.get("TargetMode") === "External" || o.set(i, { type: f, target: Gl(t, u) });
2990
+ i === void 0 || f === void 0 || u === void 0 || a.get("TargetMode") === "External" || o.set(i, { type: f, target: rc(t, u) });
2932
2991
  }
2933
2992
  }), o;
2934
- }, yt = (e, t) => {
2993
+ }, Et = (e, t) => {
2935
2994
  for (const n of e.values()) if (n.type.endsWith(`/${t}`)) return n.target;
2936
2995
  return null;
2937
- }, Yl = (e) => {
2996
+ }, sc = (e) => {
2938
2997
  const t = [];
2939
2998
  let n = !1;
2940
- return Wt(e, {
2999
+ return Kt(e, {
2941
3000
  start: (r, o) => {
2942
3001
  if (r === "workbookPr") {
2943
3002
  const s = o.get("date1904");
@@ -2945,7 +3004,7 @@ const ml = /* @__PURE__ */ new Map([
2945
3004
  } else r === "sheet" && t.push({ name: o.get("name") ?? "", state: o.get("state") ?? "visible", relationship: o.get("id") ?? "" });
2946
3005
  }
2947
3006
  }), { sheets: t, date1904: n };
2948
- }, Xl = async (e) => {
3007
+ }, ac = async (e) => {
2949
3008
  const t = [];
2950
3009
  let n = null, r = !1, o = 0;
2951
3010
  return await He(
@@ -2963,10 +3022,10 @@ const ml = /* @__PURE__ */ new Map([
2963
3022
  },
2964
3023
  () => !1
2965
3024
  ), t;
2966
- }, Jl = (e) => {
3025
+ }, ic = (e) => {
2967
3026
  const t = /* @__PURE__ */ new Map(), n = [];
2968
3027
  let r = !1;
2969
- return Wt(e, {
3028
+ return Kt(e, {
2970
3029
  start: (o, s) => {
2971
3030
  if (o === "numFmt") {
2972
3031
  const a = Number(s.get("numFmtId")), i = s.get("formatCode");
@@ -2981,19 +3040,19 @@ const ml = /* @__PURE__ */ new Map([
2981
3040
  end: (o) => {
2982
3041
  o === "cellXfs" && (r = !1);
2983
3042
  }
2984
- }), n.map((o) => Ul(o, t));
2985
- }, Ql = /^(\d{4}-\d{2}-\d{2})(?:T(\d{2}:\d{2}(?::\d{2})?)(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/u, ec = (e) => {
2986
- const t = Ql.exec(e);
3043
+ }), n.map((o) => Yl(o, t));
3044
+ }, lc = /^(\d{4}-\d{2}-\d{2})(?:T(\d{2}:\d{2}(?::\d{2})?)(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/u, cc = (e) => {
3045
+ const t = lc.exec(e);
2987
3046
  if (t === null) return e;
2988
3047
  const [, n, r] = t;
2989
3048
  return r === void 0 || /^00:00(?::00)?$/u.test(r) ? n ?? e : `${n} ${r}`;
2990
- }, tc = /^([A-Za-z]{1,3})(\d+)$/u, nc = (e) => {
2991
- const t = tc.exec(e)?.[1];
3049
+ }, dc = /^([A-Za-z]{1,3})(\d+)$/u, uc = (e) => {
3050
+ const t = dc.exec(e)?.[1];
2992
3051
  if (t === void 0) return null;
2993
3052
  let n = 0;
2994
3053
  for (const r of t.toUpperCase()) n = n * 26 + (r.charCodeAt(0) - 64);
2995
3054
  return n - 1;
2996
- }, rc = (e, t, n, r) => {
3055
+ }, fc = (e, t, n, r) => {
2997
3056
  const o = e.value.join("");
2998
3057
  switch (e.type) {
2999
3058
  case "s":
@@ -3006,33 +3065,33 @@ const ml = /* @__PURE__ */ new Map([
3006
3065
  case "e":
3007
3066
  return o;
3008
3067
  case "d":
3009
- return ec(o.trim());
3068
+ return cc(o.trim());
3010
3069
  default: {
3011
3070
  const s = o.trim();
3012
3071
  if (s === "") return "";
3013
3072
  const a = Number(s);
3014
- return Number.isFinite(a) ? Zl(a, n[e.style] ?? Ee, r) : s;
3073
+ return Number.isFinite(a) ? tc(a, n[e.style] ?? Ee, r) : s;
3015
3074
  }
3016
3075
  }
3017
- }, oc = async (e, t, n, r, o) => {
3018
- const s = qr(t);
3076
+ }, mc = async (e, t, n, r, o) => {
3077
+ const s = Hr(t);
3019
3078
  let a = -1, i = /* @__PURE__ */ new Map(), f = 0, u = null;
3020
3079
  return await He(
3021
3080
  e,
3022
3081
  {
3023
- start: (l, d, h) => {
3082
+ start: (l, c, m) => {
3024
3083
  if (l === "row") {
3025
- const g = Number(d.get("r"));
3084
+ const g = Number(c.get("r"));
3026
3085
  a = Number.isInteger(g) && g > a + 1 ? g - 1 : a + 1, i = /* @__PURE__ */ new Map(), f = 0;
3027
3086
  } else if (l === "c") {
3028
- const g = nc(d.get("r") ?? "") ?? f, v = Number(d.get("s") ?? "0");
3029
- u = { column: g, type: d.get("t") ?? "n", style: Number.isInteger(v) ? v : 0, value: [], inline: [], inValue: !1, inInlineText: !1, phoneticDepth: 0 };
3030
- } else u !== null && (l === "v" ? u.inValue = !h : l === "rPh" && !h ? u.phoneticDepth += 1 : l === "t" && u.type === "inlineStr" && u.phoneticDepth === 0 && (u.inInlineText = !h));
3087
+ const g = uc(c.get("r") ?? "") ?? f, v = Number(c.get("s") ?? "0");
3088
+ u = { column: g, type: c.get("t") ?? "n", style: Number.isInteger(v) ? v : 0, value: [], inline: [], inValue: !1, inInlineText: !1, phoneticDepth: 0 };
3089
+ } else u !== null && (l === "v" ? u.inValue = !m : l === "rPh" && !m ? u.phoneticDepth += 1 : l === "t" && u.type === "inlineStr" && u.phoneticDepth === 0 && (u.inInlineText = !m));
3031
3090
  },
3032
3091
  end: (l) => {
3033
3092
  if (l === "c" && u !== null) {
3034
- const d = rc(u, n, r, o);
3035
- d !== "" && i.set(u.column, d), f = u.column + 1, u = null;
3093
+ const c = fc(u, n, r, o);
3094
+ c !== "" && i.set(u.column, c), f = u.column + 1, u = null;
3036
3095
  } else l === "row" ? s.addRow(a, i, 1) : u !== null && (l === "v" ? u.inValue = !1 : l === "rPh" ? u.phoneticDepth = Math.max(0, u.phoneticDepth - 1) : l === "t" && (u.inInlineText = !1));
3037
3096
  },
3038
3097
  text: (l) => {
@@ -3041,8 +3100,8 @@ const ml = /* @__PURE__ */ new Map([
3041
3100
  },
3042
3101
  s.full
3043
3102
  ), s.table();
3044
- }, sc = async (e, t) => {
3045
- const n = yt(await qn(e, "", t), "officeDocument") ?? ce("has no officeDocument relationship"), r = await tt(e, n, t.maxPartBytes) ?? ce(`has no part ${n}`), { sheets: o, date1904: s } = Yl(r), a = await qn(e, n, t), i = yt(a, "sharedStrings"), f = i === null ? null : Fe(e, i, t.maxPartBytes), u = f === null ? [] : await Xl(f), l = yt(a, "styles"), d = l === null ? null : await tt(e, l, t.maxPartBytes), h = d === null ? [] : Jl(d), g = [];
3103
+ }, hc = async (e, t) => {
3104
+ const n = Et(await Hn(e, "", t), "officeDocument") ?? ce("has no officeDocument relationship"), r = await rt(e, n, t.maxPartBytes) ?? ce(`has no part ${n}`), { sheets: o, date1904: s } = sc(r), a = await Hn(e, n, t), i = Et(a, "sharedStrings"), f = i === null ? null : Fe(e, i, t.maxPartBytes), u = f === null ? [] : await ac(f), l = Et(a, "styles"), c = l === null ? null : await rt(e, l, t.maxPartBytes), m = c === null ? [] : ic(c), g = [];
3046
3105
  let v = 0;
3047
3106
  for (const y of o) {
3048
3107
  const T = a.get(y.relationship) ?? ce(`lists the sheet ${y.name} without its relationship`);
@@ -3054,25 +3113,25 @@ const ml = /* @__PURE__ */ new Map([
3054
3113
  name: y.name,
3055
3114
  read: async (O) => {
3056
3115
  const R = Fe(e, T.target, t.maxPartBytes) ?? ce(`has no part ${T.target}`);
3057
- return oc(R, O, u, h, s);
3116
+ return mc(R, O, u, m, s);
3058
3117
  }
3059
3118
  });
3060
3119
  }
3061
3120
  return g.length === 0 && ce("shows no sheet"), { sheets: g.slice(0, t.maxSheets), unshownSheets: v, unlistedSheets: Math.max(0, g.length - t.maxSheets) };
3062
- }, ac = Object.freeze([80, 75, 3, 4]), ic = Object.freeze([208, 207, 17, 224, 161, 177, 26, 225]), kt = Uint8Array.from([..."EncryptedPackage"].flatMap((e) => [e.charCodeAt(0), 0])), lc = /* @__PURE__ */ new Set(["application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.spreadsheet-template"]), cc = "mimetype", Xr = (e, t) => e.byteLength >= t.length && t.every((n, r) => e[r] === n), Jr = (e) => Xr(e, ac), Qr = (e) => Xr(e, ic), dc = (e) => {
3063
- const t = e.byteLength - kt.byteLength;
3121
+ }, pc = Object.freeze([80, 75, 3, 4]), gc = Object.freeze([208, 207, 17, 224, 161, 177, 26, 225]), St = Uint8Array.from([..."EncryptedPackage"].flatMap((e) => [e.charCodeAt(0), 0])), wc = /* @__PURE__ */ new Set(["application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.spreadsheet-template"]), vc = "mimetype", eo = (e, t) => e.byteLength >= t.length && t.every((n, r) => e[r] === n), to = (e) => eo(e, pc), no = (e) => eo(e, gc), bc = (e) => {
3122
+ const t = e.byteLength - St.byteLength;
3064
3123
  for (let n = 0; n <= t; n += 1)
3065
- if (e[n] === kt[0] && kt.every((r, o) => e[n + o] === r)) return !0;
3124
+ if (e[n] === St[0] && St.every((r, o) => e[n + o] === r)) return !0;
3066
3125
  return !1;
3067
- }, uc = async (e, t) => {
3068
- if (Qr(e))
3069
- throw dc(e) ? new ne("encrypted", "the bytes are a password-protected workbook") : new ne("not-workbook", "the bytes are a compound file (a legacy .xls)");
3070
- if (!Jr(e)) throw new ne("not-workbook", "the bytes are no ZIP package");
3071
- const n = Ol(e), r = await tt(n, cc, t.maxPartBytes);
3072
- if (r !== null && lc.has(r.trim())) return $l(n, t);
3073
- if (n.entries.has(Yr)) return sc(n, t);
3126
+ }, yc = async (e, t) => {
3127
+ if (no(e))
3128
+ throw bc(e) ? new ne("encrypted", "the bytes are a password-protected workbook") : new ne("not-workbook", "the bytes are a compound file (a legacy .xls)");
3129
+ if (!to(e)) throw new ne("not-workbook", "the bytes are no ZIP package");
3130
+ const n = _l(e), r = await rt(n, vc, t.maxPartBytes);
3131
+ if (r !== null && wc.has(r.trim())) return Vl(n, t);
3132
+ if (n.entries.has(Qr)) return hc(n, t);
3074
3133
  throw new ne("not-workbook", "the ZIP package is neither an OpenDocument spreadsheet nor an Office Open XML package");
3075
- }, fc = async (e, t) => {
3134
+ }, kc = async (e, t) => {
3076
3135
  const n = e.getReader(), r = [];
3077
3136
  let o = 0;
3078
3137
  try {
@@ -3091,34 +3150,34 @@ const ml = /* @__PURE__ */ new Map([
3091
3150
  for (const i of r)
3092
3151
  s.set(i, a), a += i.byteLength;
3093
3152
  return s;
3094
- }, eo = async (e, t) => {
3153
+ }, ro = async (e, t) => {
3095
3154
  try {
3096
3155
  return { kind: "table", table: await e.read(t) };
3097
3156
  } catch (n) {
3098
3157
  return { kind: "refused", refusal: n instanceof ne ? n.refusal : "not-workbook" };
3099
3158
  }
3100
- }, mc = async (e, t, n, r, o) => {
3101
- const s = await e.asset(Bo(t), o);
3159
+ }, Ec = async (e, t, n, r, o) => {
3160
+ const s = await e.asset(zo(t), o);
3102
3161
  if (s.status === "cancelled") return null;
3103
3162
  if (s.status === "error") return { kind: "failure", failure: s.failure };
3104
3163
  let a;
3105
3164
  try {
3106
- a = await fc(s.body, n.maxBytes);
3165
+ a = await kc(s.body, n.maxBytes);
3107
3166
  } catch {
3108
3167
  return o.aborted ? null : { kind: "failure", failure: { reason: "failed" } };
3109
3168
  }
3110
3169
  if (o.aborted) return null;
3111
3170
  if (a === null) return { kind: "refused", refusal: "too-large" };
3112
- if (!(Jr(a) || Qr(a))) return { kind: "not-package" };
3171
+ if (!(to(a) || no(a))) return { kind: "not-package" };
3113
3172
  try {
3114
- const i = await uc(a, n.limits), f = r === null ? -1 : i.sheets.findIndex((h) => h.name === r), u = Math.max(f, 0), l = i.sheets[u];
3173
+ const i = await yc(a, n.limits), f = r === null ? -1 : i.sheets.findIndex((m) => m.name === r), u = Math.max(f, 0), l = i.sheets[u];
3115
3174
  if (l === void 0) return { kind: "refused", refusal: "not-workbook" };
3116
- const d = await eo(l, n.budget);
3117
- return o.aborted ? null : { kind: "workbook", workbook: i, selected: u, sheet: d };
3175
+ const c = await ro(l, n.budget);
3176
+ return o.aborted ? null : { kind: "workbook", workbook: i, selected: u, sheet: c };
3118
3177
  } catch (i) {
3119
3178
  return i instanceof ne ? { kind: "refused", refusal: i.refusal } : o.aborted ? null : { kind: "failure", failure: { reason: "failed" } };
3120
3179
  }
3121
- }, hc = Object.freeze({ className: "aqmx-document-spreadsheet-body", "data-aqmx-document-scroller": "" }), pc = (e, t) => {
3180
+ }, Sc = Object.freeze({ className: "aqmx-document-spreadsheet-body", "data-aqmx-document-scroller": "" }), xc = (e, t) => {
3122
3181
  switch (t.code) {
3123
3182
  case "encoding":
3124
3183
  return e.spreadsheetUnreadableEncoding(t.encodings);
@@ -3127,7 +3186,7 @@ const ml = /* @__PURE__ */ new Map([
3127
3186
  case "long-row":
3128
3187
  return e.spreadsheetLongRow;
3129
3188
  }
3130
- }, Bn = (e, t) => {
3189
+ }, zn = (e, t) => {
3131
3190
  switch (t) {
3132
3191
  case "encrypted":
3133
3192
  return e.spreadsheetWorkbookEncrypted;
@@ -3136,60 +3195,60 @@ const ml = /* @__PURE__ */ new Map([
3136
3195
  case "too-large":
3137
3196
  return e.spreadsheetWorkbookTooLarge;
3138
3197
  }
3139
- }, Et = (e) => e.every((t) => t.every((n) => n === "")), to = ({ name: e, url: t, openUrl: n, state: r, children: o }) => /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-spreadsheet-view", "data-aqmx-spreadsheet": r, children: [
3140
- /* @__PURE__ */ c(Ue, { name: e, openUrl: n, downloadUrl: t, icon: /* @__PURE__ */ c(Qi, {}) }),
3141
- /* @__PURE__ */ c(Be, { scrollerProps: hc, children: /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet-column", children: o }) })
3142
- ] }), no = ({ rows: e, title: t }) => {
3143
- const { labels: n, locale: r, theme: o } = $(), s = se(we), a = X(() => ({ ...Hr(n, r), table: t, fullscreenDialog: n.spreadsheetFullscreen(t) }), [n, r, t]), i = X(() => ls(e), [e]);
3198
+ }, xt = (e) => e.every((t) => t.every((n) => n === "")), oo = ({ name: e, url: t, openUrl: n, state: r, children: o }) => /* @__PURE__ */ B("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-spreadsheet-view", "data-aqmx-spreadsheet": r, children: [
3199
+ /* @__PURE__ */ d(Ue, { name: e, openUrl: n, downloadUrl: t, icon: /* @__PURE__ */ d(ll, {}) }),
3200
+ /* @__PURE__ */ d(Be, { scrollerProps: Sc, children: /* @__PURE__ */ d("div", { className: "aqmx-document-spreadsheet-column", children: o }) })
3201
+ ] }), so = ({ rows: e, title: t }) => {
3202
+ const { labels: n, locale: r, theme: o } = $(), s = se(we), a = X(() => ({ ...Vr(n, r), table: t, fullscreenDialog: n.spreadsheetFullscreen(t) }), [n, r, t]), i = X(() => us(e), [e]);
3144
3203
  return (
3145
- /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet", "data-theme": o, children: /* @__PURE__ */ c(rs, { tsv: i, layout: s === "fill" ? "fill" : "inline", locale: r, labels: a, tapScrollCircle: Rr }) })
3204
+ /* @__PURE__ */ d("div", { className: "aqmx-document-spreadsheet", "data-theme": o, children: /* @__PURE__ */ d(as, { tsv: i, layout: s === "fill" ? "fill" : "inline", locale: r, labels: a, tapScrollCircle: Lr }) })
3146
3205
  );
3147
3206
  }, De = ({ note: e, testId: t, code: n, download: r }) => {
3148
3207
  const { labels: o } = $();
3149
- return /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet-stage", children: r === void 0 ? /* @__PURE__ */ c("p", { className: "aqmx-callout", role: "note", "data-testid": t, children: e }) : /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": t, "data-aqmx-unreadable": n, children: [
3150
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: e }),
3151
- /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: r.url, download: r.name, "data-testid": "markdown-explorer-spreadsheet-unreadable-download", children: o.download })
3208
+ return /* @__PURE__ */ d("div", { className: "aqmx-document-spreadsheet-stage", children: r === void 0 ? /* @__PURE__ */ d("p", { className: "aqmx-callout", role: "note", "data-testid": t, children: e }) : /* @__PURE__ */ B("div", { className: "aqmx-callout", role: "note", "data-testid": t, "data-aqmx-unreadable": n, children: [
3209
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: e }),
3210
+ /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: r.url, download: r.name, "data-testid": "markdown-explorer-spreadsheet-unreadable-download", children: o.download })
3152
3211
  ] }) });
3153
- }, ro = ({ reading: e, name: t, url: n }) => {
3212
+ }, ao = ({ reading: e, name: t, url: n }) => {
3154
3213
  const { labels: r } = $();
3155
3214
  switch (e.kind) {
3156
3215
  case "table":
3157
3216
  return /* @__PURE__ */ B(pe, { children: [
3158
- e.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-truncated", children: r.spreadsheetTruncated }) : null,
3159
- /* @__PURE__ */ c(no, { rows: e.rows, title: t })
3217
+ e.truncated ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-truncated", children: r.spreadsheetTruncated }) : null,
3218
+ /* @__PURE__ */ d(so, { rows: e.rows, title: t })
3160
3219
  ] });
3161
3220
  case "empty":
3162
- return /* @__PURE__ */ c(De, { note: r.spreadsheetEmpty, testId: "markdown-explorer-spreadsheet-empty" });
3221
+ return /* @__PURE__ */ d(De, { note: r.spreadsheetEmpty, testId: "markdown-explorer-spreadsheet-empty" });
3163
3222
  case "unreadable":
3164
- return /* @__PURE__ */ c(De, { note: pc(r, e), testId: "markdown-explorer-spreadsheet-unreadable", code: e.code, download: { url: n, name: t } });
3223
+ return /* @__PURE__ */ d(De, { note: xc(r, e), testId: "markdown-explorer-spreadsheet-unreadable", code: e.code, download: { url: n, name: t } });
3165
3224
  }
3166
- }, gc = ({ path: e, document: t }) => t.format === "workbook" ? /* @__PURE__ */ c(vc, { path: e, document: t }) : /* @__PURE__ */ c(wc, { path: e, document: t, format: t.format }), wc = ({ path: e, document: t, format: n }) => {
3225
+ }, Tc = ({ path: e, document: t }) => t.format === "workbook" ? /* @__PURE__ */ d(Cc, { path: e, document: t }) : /* @__PURE__ */ d(Rc, { path: e, document: t, format: t.format }), Rc = ({ path: e, document: t, format: n }) => {
3167
3226
  const { config: r, data: o, labels: s } = $(), { name: a, url: i } = t, f = F(
3168
- async (h) => {
3169
- const g = await Ur(o, i, { format: n, legacyEncoding: r.legacyTextEncoding, maxBytes: r.spreadsheets.maxBytes, budget: Ye }, h);
3227
+ async (m) => {
3228
+ const g = await jr(o, i, { format: n, legacyEncoding: r.legacyTextEncoding, maxBytes: r.spreadsheets.maxBytes, budget: Xe }, m);
3170
3229
  return g === null || g.kind === "failure" ? g : { kind: "read", value: g };
3171
3230
  },
3172
3231
  [o, i, n, r.legacyTextEncoding, r.spreadsheets.maxBytes]
3173
- ), { shown: u, failure: l, retry: d } = Vt(e, a, f);
3174
- return /* @__PURE__ */ B(to, { name: a, url: i, openUrl: rt(i), state: u === null ? l === null ? "loading" : "failure" : u.kind, children: [
3175
- u === null && l === null ? /* @__PURE__ */ c(Ce, { label: s.spreadsheetLoading, testId: "markdown-explorer-spreadsheet-skeleton" }) : null,
3176
- u === null && l !== null ? /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet-failure", children: /* @__PURE__ */ c(Re, { failure: l, alert: !1, onRetry: d, testId: "markdown-explorer-spreadsheet-failure" }) }) : null,
3177
- u === null ? null : /* @__PURE__ */ c(ro, { reading: u, name: a, url: i })
3232
+ ), { shown: u, failure: l, retry: c } = Wt(e, a, f);
3233
+ return /* @__PURE__ */ B(oo, { name: a, url: i, openUrl: st(i), state: u === null ? l === null ? "loading" : "failure" : u.kind, children: [
3234
+ u === null && l === null ? /* @__PURE__ */ d(Ce, { label: s.spreadsheetLoading, testId: "markdown-explorer-spreadsheet-skeleton" }) : null,
3235
+ u === null && l !== null ? /* @__PURE__ */ d("div", { className: "aqmx-document-spreadsheet-failure", children: /* @__PURE__ */ d(Re, { failure: l, alert: !1, onRetry: c, testId: "markdown-explorer-spreadsheet-failure" }) }) : null,
3236
+ u === null ? null : /* @__PURE__ */ d(ao, { reading: u, name: a, url: i })
3178
3237
  ] });
3179
- }, vc = ({ path: e, document: t }) => {
3238
+ }, Cc = ({ path: e, document: t }) => {
3180
3239
  const { config: n, data: r, labels: o } = $(), { name: s, url: a, firstSheetText: i } = t, f = Te(), u = U(null), l = F(
3181
3240
  async (b) => {
3182
- const S = await mc(r, a, { maxBytes: n.spreadsheets.maxWorkbookBytes, limits: sl, budget: Ye }, u.current, b);
3241
+ const S = await Ec(r, a, { maxBytes: n.spreadsheets.maxWorkbookBytes, limits: hl, budget: Xe }, u.current, b);
3183
3242
  if (S === null || S.kind === "failure") return S;
3184
3243
  if (S.kind === "workbook") return { kind: "read", value: S };
3185
3244
  if (i !== null) {
3186
- const L = await Ur(r, a, { format: i, legacyEncoding: n.legacyTextEncoding, maxBytes: n.spreadsheets.maxBytes, budget: Ye }, b);
3245
+ const L = await jr(r, a, { format: i, legacyEncoding: n.legacyTextEncoding, maxBytes: n.spreadsheets.maxBytes, budget: Xe }, b);
3187
3246
  return L === null || L.kind === "failure" ? L : { kind: "read", value: { kind: "first-sheet", reading: L } };
3188
3247
  }
3189
3248
  return { kind: "read", value: { kind: "refused", refusal: S.kind === "not-package" ? "not-workbook" : S.refusal } };
3190
3249
  },
3191
3250
  [r, a, i, n.legacyTextEncoding, n.spreadsheets.maxBytes, n.spreadsheets.maxWorkbookBytes]
3192
- ), { shown: d, failure: h, retry: g } = Vt(e, s, l), [v, y] = V(null), T = U(/* @__PURE__ */ new WeakMap()), O = d?.kind === "workbook" ? d : null, R = O === null ? null : v !== null && v.workbook === O.workbook ? v : { workbook: O.workbook, index: O.selected, reading: O.sheet }, q = (b) => {
3251
+ ), { shown: c, failure: m, retry: g } = Wt(e, s, l), [v, y] = V(null), T = U(/* @__PURE__ */ new WeakMap()), O = c?.kind === "workbook" ? c : null, R = O === null ? null : v !== null && v.workbook === O.workbook ? v : { workbook: O.workbook, index: O.selected, reading: O.sheet }, q = (b) => {
3193
3252
  if (O === null) return;
3194
3253
  const S = O.workbook.sheets[b];
3195
3254
  if (S === void 0) return;
@@ -3199,32 +3258,32 @@ const ml = /* @__PURE__ */ new Map([
3199
3258
  const M = L.get(b), P = { workbook: O.workbook, index: b, reading: M ?? null };
3200
3259
  if (y(P), M !== void 0) return;
3201
3260
  const H = L;
3202
- eo(S, Ye).then((K) => {
3261
+ ro(S, Xe).then((K) => {
3203
3262
  H.set(b, K), y((w) => w === P ? { ...P, reading: K } : w);
3204
3263
  });
3205
- }, D = R === null ? null : R.reading === null ? "loading" : R.reading.kind === "refused" ? "unreadable" : Et(R.reading.table.rows) ? "empty" : "table", m = d === null ? h === null ? "loading" : "failure" : d.kind === "first-sheet" ? d.reading.kind : d.kind === "refused" ? "unreadable" : D ?? "loading", p = i === null ? a : rt(a), x = (b) => `${f}-sheet-${b}`, A = `${f}-panel`, I = R === null ? null : O?.workbook.sheets[R.index]?.name ?? null, _ = O !== null && O.workbook.sheets.length > 1;
3206
- return /* @__PURE__ */ B(to, { name: s, url: a, openUrl: p, state: m, children: [
3207
- d === null && h === null ? /* @__PURE__ */ c(Ce, { label: o.spreadsheetLoading, testId: "markdown-explorer-spreadsheet-skeleton" }) : null,
3208
- d === null && h !== null ? /* @__PURE__ */ c("div", { className: "aqmx-document-spreadsheet-failure", children: /* @__PURE__ */ c(Re, { failure: h, alert: !1, onRetry: g, testId: "markdown-explorer-spreadsheet-failure" }) }) : null,
3209
- d?.kind === "refused" ? /* @__PURE__ */ c(De, { note: Bn(o, d.refusal), testId: "markdown-explorer-spreadsheet-unreadable", code: d.refusal, download: { url: a, name: s } }) : null,
3210
- d?.kind === "first-sheet" ? /* @__PURE__ */ B(pe, { children: [
3211
- /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-first-sheet", children: o.spreadsheetWorkbookFirstSheet }),
3212
- /* @__PURE__ */ c(ro, { reading: d.reading, name: s, url: a })
3264
+ }, D = R === null ? null : R.reading === null ? "loading" : R.reading.kind === "refused" ? "unreadable" : xt(R.reading.table.rows) ? "empty" : "table", h = c === null ? m === null ? "loading" : "failure" : c.kind === "first-sheet" ? c.reading.kind : c.kind === "refused" ? "unreadable" : D ?? "loading", p = i === null ? a : st(a), x = (b) => `${f}-sheet-${b}`, A = `${f}-panel`, I = R === null ? null : O?.workbook.sheets[R.index]?.name ?? null, _ = O !== null && O.workbook.sheets.length > 1;
3265
+ return /* @__PURE__ */ B(oo, { name: s, url: a, openUrl: p, state: h, children: [
3266
+ c === null && m === null ? /* @__PURE__ */ d(Ce, { label: o.spreadsheetLoading, testId: "markdown-explorer-spreadsheet-skeleton" }) : null,
3267
+ c === null && m !== null ? /* @__PURE__ */ d("div", { className: "aqmx-document-spreadsheet-failure", children: /* @__PURE__ */ d(Re, { failure: m, alert: !1, onRetry: g, testId: "markdown-explorer-spreadsheet-failure" }) }) : null,
3268
+ c?.kind === "refused" ? /* @__PURE__ */ d(De, { note: zn(o, c.refusal), testId: "markdown-explorer-spreadsheet-unreadable", code: c.refusal, download: { url: a, name: s } }) : null,
3269
+ c?.kind === "first-sheet" ? /* @__PURE__ */ B(pe, { children: [
3270
+ /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-first-sheet", children: o.spreadsheetWorkbookFirstSheet }),
3271
+ /* @__PURE__ */ d(ao, { reading: c.reading, name: s, url: a })
3213
3272
  ] }) : null,
3214
3273
  O === null || R === null || I === null ? null : /* @__PURE__ */ B(pe, { children: [
3215
- O.workbook.unshownSheets > 0 ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-unshown-sheets", children: o.spreadsheetUnshownSheets(O.workbook.unshownSheets) }) : null,
3216
- O.workbook.unlistedSheets > 0 ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-unlisted-sheets", children: o.spreadsheetUnlistedSheets(O.workbook.sheets.length) }) : null,
3217
- _ ? /* @__PURE__ */ c(il, { names: O.workbook.sheets.map((b) => b.name), selected: R.index, onSelect: q, label: o.spreadsheetSheets(s), tabIdOf: x, panelId: A }) : null,
3274
+ O.workbook.unshownSheets > 0 ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-unshown-sheets", children: o.spreadsheetUnshownSheets(O.workbook.unshownSheets) }) : null,
3275
+ O.workbook.unlistedSheets > 0 ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-unlisted-sheets", children: o.spreadsheetUnlistedSheets(O.workbook.sheets.length) }) : null,
3276
+ _ ? /* @__PURE__ */ d(gl, { names: O.workbook.sheets.map((b) => b.name), selected: R.index, onSelect: q, label: o.spreadsheetSheets(s), tabIdOf: x, panelId: A }) : null,
3218
3277
  /* @__PURE__ */ B("div", { className: "aqmx-document-spreadsheet-sheet", "data-testid": "markdown-explorer-spreadsheet-sheet", "data-aqmx-sheet": R.index, ..._ ? { role: "tabpanel", id: A, "aria-labelledby": x(R.index) } : {}, children: [
3219
- R.reading === null ? /* @__PURE__ */ c(Ce, { label: o.spreadsheetSheetLoading, testId: "markdown-explorer-spreadsheet-sheet-skeleton" }) : null,
3220
- R.reading?.kind === "table" && R.reading.table.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-truncated", children: o.spreadsheetTruncated }) : null,
3221
- R.reading?.kind === "refused" ? /* @__PURE__ */ c(De, { note: Bn(o, R.reading.refusal), testId: "markdown-explorer-spreadsheet-unreadable", code: R.reading.refusal, download: { url: a, name: s } }) : null,
3222
- R.reading?.kind === "table" && Et(R.reading.table.rows) ? /* @__PURE__ */ c(De, { note: o.spreadsheetSheetEmpty, testId: "markdown-explorer-spreadsheet-empty" }) : null,
3223
- R.reading?.kind === "table" && !Et(R.reading.table.rows) ? /* @__PURE__ */ c(no, { rows: R.reading.table.rows, title: o.spreadsheetSheetName(s, I) }, R.index) : null
3278
+ R.reading === null ? /* @__PURE__ */ d(Ce, { label: o.spreadsheetSheetLoading, testId: "markdown-explorer-spreadsheet-sheet-skeleton" }) : null,
3279
+ R.reading?.kind === "table" && R.reading.table.truncated ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-truncated", children: o.spreadsheetTruncated }) : null,
3280
+ R.reading?.kind === "refused" ? /* @__PURE__ */ d(De, { note: zn(o, R.reading.refusal), testId: "markdown-explorer-spreadsheet-unreadable", code: R.reading.refusal, download: { url: a, name: s } }) : null,
3281
+ R.reading?.kind === "table" && xt(R.reading.table.rows) ? /* @__PURE__ */ d(De, { note: o.spreadsheetSheetEmpty, testId: "markdown-explorer-spreadsheet-empty" }) : null,
3282
+ R.reading?.kind === "table" && !xt(R.reading.table.rows) ? /* @__PURE__ */ d(so, { rows: R.reading.table.rows, title: o.spreadsheetSheetName(s, I) }, R.index) : null
3224
3283
  ] })
3225
3284
  ] })
3226
3285
  ] });
3227
- }, bc = Object.freeze({ kind: "empty" }), yc = (e, t, n) => {
3286
+ }, Oc = Object.freeze({ kind: "empty" }), Lc = (e, t, n) => {
3228
3287
  if (t.view === "multi" || t.overrides[n] === void 0) return null;
3229
3288
  const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
3230
3289
  return Ne(e, { ...t, overrides: r });
@@ -3232,11 +3291,11 @@ const ml = /* @__PURE__ */ new Map([
3232
3291
  const f = se(we);
3233
3292
  return (
3234
3293
  /* @__PURE__ */ B("section", { ref: s, role: "region", "aria-label": n, "aria-busy": o, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-view": t, "data-aqmx-document-flow": f, className: "aqmx-document", ...a, children: [
3235
- r ? /* @__PURE__ */ c("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
3294
+ r ? /* @__PURE__ */ d("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
3236
3295
  i
3237
3296
  ] })
3238
3297
  );
3239
- }, kc = ({ absence: e, announces: t, announceFailure: n }) => {
3298
+ }, Mc = ({ absence: e, announces: t, announceFailure: n }) => {
3240
3299
  const { labels: r, announcer: o } = $(), s = e.kind === "no-readme" ? e.folder : null, a = e.kind === "failure" ? e.folder : null, i = e.kind === "failure" ? e.failure : null;
3241
3300
  switch (ee(() => {
3242
3301
  t && s !== null && o.announce(r.folderReadmeMissing(fe(s)));
@@ -3244,121 +3303,121 @@ const ml = /* @__PURE__ */ new Map([
3244
3303
  a !== null && i !== null && n(r.documentFailed(fe(a), de(r, i.reason)));
3245
3304
  }, [a, i, n, r]), e.kind) {
3246
3305
  case "empty":
3247
- return /* @__PURE__ */ c(Pe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ c("p", { className: "aqmx-empty-title", children: r.documentEmpty }) }) });
3306
+ return /* @__PURE__ */ d(Pe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ d("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ d("p", { className: "aqmx-empty-title", children: r.documentEmpty }) }) });
3248
3307
  case "loading":
3249
- return /* @__PURE__ */ c(Gt, { label: r.documentRegion });
3308
+ return /* @__PURE__ */ d(Yt, { label: r.documentRegion });
3250
3309
  case "no-readme":
3251
- return /* @__PURE__ */ c(Pe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-folder-empty", children: /* @__PURE__ */ c("p", { className: "aqmx-empty-title", children: r.folderReadmeMissing(fe(e.folder)) }) }) });
3310
+ return /* @__PURE__ */ d(Pe, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ d("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-folder-empty", children: /* @__PURE__ */ d("p", { className: "aqmx-empty-title", children: r.folderReadmeMissing(fe(e.folder)) }) }) });
3252
3311
  case "failure":
3253
- return /* @__PURE__ */ c(Pe, { kind: "failure", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ c(Ht, { failure: e.failure, onRetry: e.onRetry, testId: "markdown-explorer-folder-failure" }) });
3312
+ return /* @__PURE__ */ d(Pe, { kind: "failure", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ d(jt, { failure: e.failure, onRetry: e.onRetry, testId: "markdown-explorer-folder-failure" }) });
3254
3313
  }
3255
- }, Gt = ({ label: e }) => {
3314
+ }, Yt = ({ label: e }) => {
3256
3315
  const { labels: t } = $();
3257
- return /* @__PURE__ */ c(Pe, { kind: "loading", label: e, stale: !1, busy: !0, children: /* @__PURE__ */ c(Ce, { label: t.documentLoading, testId: "markdown-explorer-document-skeleton" }) });
3258
- }, Un = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), Ec = ({ path: e, document: t, viewer: n, editing: r }) => {
3259
- const { reportMathDiagnostics: o, edits: s } = $(), a = X(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), i = Pi(), f = Ii(), u = X(() => o === void 0 ? void 0 : (m) => o(e, m), [o, e]), l = U(null), { editable: d, doubleClick: h, region: g, paneScroll: v, stale: y } = r;
3316
+ return /* @__PURE__ */ d(Pe, { kind: "loading", label: e, stale: !1, busy: !0, children: /* @__PURE__ */ d(Ce, { label: t.documentLoading, testId: "markdown-explorer-document-skeleton" }) });
3317
+ }, jn = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), Ac = ({ path: e, document: t, viewer: n, editing: r }) => {
3318
+ const { reportMathDiagnostics: o, edits: s } = $(), a = X(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), i = zi(), f = ji(), u = X(() => o === void 0 ? void 0 : (h) => o(e, h), [o, e]), l = U(null), { editable: c, doubleClick: m, region: g, paneScroll: v, stale: y } = r;
3260
3319
  Y(() => {
3261
- if (d)
3320
+ if (c)
3262
3321
  return s.bindView(e, {
3263
3322
  anchor: () => {
3264
- const m = l.current, p = g(), x = m === null ? null : m.querySelector(st);
3265
- return m === null || p === null || x === null ? null : ca(m, v.scrollerOf(p, x));
3323
+ const h = l.current, p = g(), x = h === null ? null : h.querySelector(it);
3324
+ return h === null || p === null || x === null ? null : fa(h, v.scrollerOf(p, x));
3266
3325
  }
3267
3326
  });
3268
- }, [s, e, d, g, v]);
3269
- const T = (m) => {
3270
- const p = l.current, { target: x } = m;
3271
- !h || p === null || !(x instanceof Element) || !ia(x) || (m.stopPropagation(), s.start(e, la(x, p, p.ownerDocument.getSelection())));
3327
+ }, [s, e, c, g, v]);
3328
+ const T = (h) => {
3329
+ const p = l.current, { target: x } = h;
3330
+ !m || p === null || !(x instanceof Element) || !da(x) || (h.stopPropagation(), s.start(e, ua(x, p, p.ownerDocument.getSelection())));
3272
3331
  }, O = U(null), R = U(y);
3273
3332
  Y(() => {
3274
3333
  R.current = y;
3275
3334
  });
3276
- const q = le((m) => {
3277
- const p = l.current, x = g(), A = p === null ? null : ha(p, m.line);
3335
+ const q = le((h) => {
3336
+ const p = l.current, x = g(), A = p === null ? null : wa(p, h.line);
3278
3337
  if (x === null || A === null) return !1;
3279
3338
  const I = v.scrollerOf(x, A);
3280
- return I.scrollTop += pa(A, m.line) - m.clientTop, !0;
3281
- }), D = le((m) => {
3339
+ return I.scrollTop += va(A, h.line) - h.clientTop, !0;
3340
+ }), D = le((h) => {
3282
3341
  const p = g();
3283
3342
  if (p === null) return;
3284
3343
  const x = () => {
3285
- for (const I of Un) p.removeEventListener(I, A, !0);
3344
+ for (const I of jn) p.removeEventListener(I, A, !0);
3286
3345
  O.current?.release === x && (O.current = null);
3287
3346
  }, A = () => x();
3288
- for (const I of Un) p.addEventListener(I, A, { capture: !0, passive: !0 });
3289
- O.current = { point: m, release: x };
3347
+ for (const I of jn) p.addEventListener(I, A, { capture: !0, passive: !0 });
3348
+ O.current = { point: h, release: x };
3290
3349
  });
3291
3350
  return Y(() => {
3292
- const m = s.takeReturn(e);
3293
- if (m !== null)
3351
+ const h = s.takeReturn(e);
3352
+ if (h !== null)
3294
3353
  return queueMicrotask(() => {
3295
- q(m) && R.current && D(m);
3354
+ q(h) && R.current && D(h);
3296
3355
  }), () => O.current?.release();
3297
3356
  }, [s, e]), Y(() => {
3298
- const m = O.current;
3299
- m === null || y || (m.release(), q(m.point));
3357
+ const h = O.current;
3358
+ h === null || y || (h.release(), q(h.point));
3300
3359
  }, [t, y]),
3301
- /* @__PURE__ */ c("div", { ref: l, className: "aqmx-document-viewer", onDoubleClick: T, children: /* @__PURE__ */ c(or, { ...n, onHeadingSelect: i, headingHref: f, onMathDiagnostics: u, parseResult: a, content: null }) });
3302
- }, oo = ({ document: e, viewer: t }) => {
3360
+ /* @__PURE__ */ d("div", { ref: l, className: "aqmx-document-viewer", onDoubleClick: T, children: /* @__PURE__ */ d(ir, { ...n, onHeadingSelect: i, headingHref: f, onMathDiagnostics: u, parseResult: a, content: null }) });
3361
+ }, io = ({ document: e, viewer: t }) => {
3303
3362
  const { labels: n } = $();
3304
3363
  return /* @__PURE__ */ B(pe, { children: [
3305
- /* @__PURE__ */ c(Ue, { name: e.name, openUrl: rt(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ c(Js, {}), children: e.truncated ? null : /* @__PURE__ */ c(Ua, { text: e.text }) }),
3306
- e.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
3307
- /* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(or, { ...t, parseResult: null, content: e.text }) })
3364
+ /* @__PURE__ */ d(Ue, { name: e.name, openUrl: st(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ d(ta, {}), children: e.truncated ? null : /* @__PURE__ */ d(ja, { text: e.text }) }),
3365
+ e.truncated ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
3366
+ /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(ir, { ...t, parseResult: null, content: e.text }) })
3308
3367
  ] });
3309
- }, St = ({ path: e, name: t, viewer: n }) => {
3368
+ }, Tt = ({ path: e, name: t, viewer: n }) => {
3310
3369
  const { data: r, labels: o } = $(), s = F(
3311
3370
  async (u) => {
3312
3371
  const l = await r.text(e, u);
3313
3372
  return "kind" in l ? l.kind === "failure" ? { kind: "failure", failure: l.failure } : { kind: "read", value: l } : null;
3314
3373
  },
3315
3374
  [r, e]
3316
- ), { shown: a, failure: i, retry: f } = Vt(e, t, s);
3317
- return a !== null ? /* @__PURE__ */ c(oo, { document: a, viewer: n }) : i !== null ? /* @__PURE__ */ c(Ht, { failure: i, onRetry: f, testId: "markdown-explorer-markup-failure" }) : /* @__PURE__ */ c(Ce, { label: o.markupLoading, testId: "markdown-explorer-markup-skeleton" });
3318
- }, Sc = Object.freeze({ reason: "failed" }), xc = (e) => {
3375
+ ), { shown: a, failure: i, retry: f } = Wt(e, t, s);
3376
+ return a !== null ? /* @__PURE__ */ d(io, { document: a, viewer: n }) : i !== null ? /* @__PURE__ */ d(jt, { failure: i, onRetry: f, testId: "markdown-explorer-markup-failure" }) : /* @__PURE__ */ d(Ce, { label: o.markupLoading, testId: "markdown-explorer-markup-skeleton" });
3377
+ }, Nc = Object.freeze({ reason: "failed" }), Dc = (e) => {
3319
3378
  const { labels: t } = $();
3320
- return /* @__PURE__ */ c(
3321
- ta,
3379
+ return /* @__PURE__ */ d(
3380
+ oa,
3322
3381
  {
3323
- fallback: (n) => /* @__PURE__ */ c("div", { className: "aqmx-edit-message", children: /* @__PURE__ */ c(Re, { failure: Sc, alert: !1, onRetry: n, testId: "markdown-explorer-edit-load-failure" }) }),
3324
- children: /* @__PURE__ */ c(Ie, { fallback: /* @__PURE__ */ c(Ce, { label: t.editLoading, testId: "markdown-explorer-edit-skeleton" }), children: /* @__PURE__ */ c(ea, { ...e }) })
3382
+ fallback: (n) => /* @__PURE__ */ d("div", { className: "aqmx-edit-message", children: /* @__PURE__ */ d(Re, { failure: Nc, alert: !1, onRetry: n, testId: "markdown-explorer-edit-load-failure" }) }),
3383
+ children: /* @__PURE__ */ d(Ie, { fallback: /* @__PURE__ */ d(Ce, { label: t.editLoading, testId: "markdown-explorer-edit-skeleton" }), children: /* @__PURE__ */ d(ra, { ...e }) })
3325
3384
  }
3326
3385
  );
3327
- }, Tc = ({ path: e, document: t, view: n, viewer: r, onRetry: o, editing: s }) => {
3386
+ }, Pc = ({ path: e, document: t, view: n, viewer: r, onRetry: o, editing: s }) => {
3328
3387
  switch (t.kind) {
3329
3388
  case "markdown": {
3330
3389
  const { session: a, layout: i, region: f, paneScroll: u, stale: l } = s;
3331
- if (n === "edit" && a !== void 0) return /* @__PURE__ */ c(xc, { path: e, name: t.name, session: a, layout: i, viewer: r, region: f, paneScroll: u });
3332
- if (n === "markup") return /* @__PURE__ */ c(St, { path: e, name: t.name, viewer: r });
3333
- const d = t.edit !== null && (t.edit.kind === "inline" || t.edit.kind === "draft");
3334
- return /* @__PURE__ */ c(Ec, { path: e, document: t, viewer: r, editing: { editable: d, doubleClick: d && i === "fill", region: f, paneScroll: u, stale: l } });
3390
+ if (n === "edit" && a !== void 0) return /* @__PURE__ */ d(Dc, { path: e, name: t.name, session: a, layout: i, viewer: r, region: f, paneScroll: u });
3391
+ if (n === "markup") return /* @__PURE__ */ d(Tt, { path: e, name: t.name, viewer: r });
3392
+ const c = t.edit !== null && (t.edit.kind === "inline" || t.edit.kind === "draft");
3393
+ return /* @__PURE__ */ d(Ac, { path: e, document: t, viewer: r, editing: { editable: c, doubleClick: c && i === "fill", region: f, paneScroll: u, stale: l } });
3335
3394
  }
3336
3395
  case "text":
3337
- return /* @__PURE__ */ c(oo, { document: t, viewer: r });
3396
+ return /* @__PURE__ */ d(io, { document: t, viewer: r });
3338
3397
  case "image":
3339
- return n === "markup" && jt(t) === "svg" ? /* @__PURE__ */ c(St, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ c(Ei, { document: t });
3398
+ return n === "markup" && Zt(t) === "svg" ? /* @__PURE__ */ d(Tt, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ d(Ai, { document: t });
3340
3399
  case "media":
3341
- return /* @__PURE__ */ c(Ki, { document: t });
3400
+ return /* @__PURE__ */ d(ol, { document: t });
3342
3401
  case "spreadsheet":
3343
- return n === "markup" ? /* @__PURE__ */ c(St, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ c(gc, { path: e, document: t });
3402
+ return n === "markup" ? /* @__PURE__ */ d(Tt, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ d(Tc, { path: e, document: t });
3344
3403
  case "file":
3345
- return /* @__PURE__ */ c(Ya, { document: t });
3404
+ return /* @__PURE__ */ d(Qa, { document: t });
3346
3405
  case "failure":
3347
- return /* @__PURE__ */ c(Ht, { failure: t.failure, onRetry: o, testId: "markdown-explorer-document-failure" });
3406
+ return /* @__PURE__ */ d(jt, { failure: t.failure, onRetry: o, testId: "markdown-explorer-document-failure" });
3348
3407
  default: {
3349
3408
  const a = t;
3350
3409
  throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(a)}`);
3351
3410
  }
3352
3411
  }
3353
- }, Rc = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', Cc = (e, t, n) => {
3354
- const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Ar(e, n), r === void 0 ? null : Mr(e, r.id), e.querySelector(st), e.querySelector(Rc)];
3412
+ }, Ic = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', $c = (e, t, n) => {
3413
+ const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Pr(e, n), r === void 0 ? null : Dr(e, r.id), e.querySelector(it), e.querySelector(Ic)];
3355
3414
  for (const s of o)
3356
- if (s instanceof HTMLElement && kr(s)) return s;
3415
+ if (s instanceof HTMLElement && xr(s)) return s;
3357
3416
  return null;
3358
- }, Hn = (e, t, n) => {
3417
+ }, Vn = (e, t, n) => {
3359
3418
  const { activeElement: r, body: o } = e.ownerDocument, s = r === null || r === o;
3360
- t instanceof HTMLElement && n && (s || e.contains(r)) && kr(t);
3361
- }, Oc = (e) => {
3419
+ t instanceof HTMLElement && n && (s || e.contains(r)) && xr(t);
3420
+ }, _c = (e) => {
3362
3421
  const t = U(!1);
3363
3422
  return Y(() => {
3364
3423
  const n = e.current;
@@ -3366,31 +3425,31 @@ const ml = /* @__PURE__ */ new Map([
3366
3425
  const r = n.ownerDocument, o = r.defaultView;
3367
3426
  if (o === null) throw new Error("[markdown-explorer] the document region's document has no window");
3368
3427
  let s = !1, a;
3369
- const i = (h) => {
3370
- s = !(h.target instanceof Node && n.contains(h.target)), s && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(a), a = setTimeout(() => {
3428
+ const i = (m) => {
3429
+ s = !(m.target instanceof Node && n.contains(m.target)), s && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(a), a = setTimeout(() => {
3371
3430
  s = !1;
3372
3431
  }, 0);
3373
- }, f = (h) => {
3374
- t.current = h.target instanceof Node && n.contains(h.target);
3375
- }, u = (h) => {
3376
- h.relatedTarget === null && s && (t.current = !1);
3432
+ }, f = (m) => {
3433
+ t.current = m.target instanceof Node && n.contains(m.target);
3434
+ }, u = (m) => {
3435
+ m.relatedTarget === null && s && (t.current = !1);
3377
3436
  }, l = () => {
3378
- const { activeElement: h, body: g } = r;
3379
- h !== null && h !== g && (t.current = n.contains(h));
3380
- }, d = () => {
3437
+ const { activeElement: m, body: g } = r;
3438
+ m !== null && m !== g && (t.current = n.contains(m));
3439
+ }, c = () => {
3381
3440
  s && !n.contains(r.activeElement) && (t.current = !1);
3382
3441
  };
3383
- return o.addEventListener("pointerdown", i, !0), o.addEventListener("mousedown", i, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", l), o.addEventListener("focus", d), n.addEventListener("focusout", u), () => {
3384
- clearTimeout(a), o.removeEventListener("pointerdown", i, !0), o.removeEventListener("mousedown", i, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", l), o.removeEventListener("focus", d), n.removeEventListener("focusout", u);
3442
+ return o.addEventListener("pointerdown", i, !0), o.addEventListener("mousedown", i, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", l), o.addEventListener("focus", c), n.addEventListener("focusout", u), () => {
3443
+ clearTimeout(a), o.removeEventListener("pointerdown", i, !0), o.removeEventListener("mousedown", i, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", l), o.removeEventListener("focus", c), n.removeEventListener("focusout", u);
3385
3444
  };
3386
3445
  }, [e]), t;
3387
- }, Lc = Object.freeze({ count: 0, recovered: !1 }), Mc = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: s, regionLabel: a, navigation: i, fragment: f, paneScroll: u, announces: l, announceFailure: d, onDocumentShown: h }) => {
3388
- const { labels: g, announcer: v, documents: y } = $(), { document: T } = t, O = U(null), R = U(null), q = U(null), D = U(0), m = Oc(O), p = U({ path: e, document: T }), x = U(null), A = F(
3446
+ }, Fc = Object.freeze({ count: 0, recovered: !1 }), qc = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: s, regionLabel: a, navigation: i, fragment: f, paneScroll: u, announces: l, announceFailure: c, onDocumentShown: m }) => {
3447
+ const { labels: g, announcer: v, documents: y } = $(), { document: T } = t, O = U(null), R = U(null), q = U(null), D = U(0), h = _c(O), p = U({ path: e, document: T }), x = U(null), A = F(
3389
3448
  (j) => {
3390
- const Z = O.current, Q = Sn(Z, j, u);
3391
- Z !== null && Q !== null && Hn(Z, Q, m.current);
3449
+ const Z = O.current, Q = Rn(Z, j, u);
3450
+ Z !== null && Q !== null && Vn(Z, Q, h.current);
3392
3451
  },
3393
- [u, m]
3452
+ [u, h]
3394
3453
  ), I = F(
3395
3454
  (j, Z) => {
3396
3455
  const Q = D.current;
@@ -3406,14 +3465,14 @@ const ml = /* @__PURE__ */ new Map([
3406
3465
  }, 0);
3407
3466
  },
3408
3467
  [A]
3409
- ), b = X(() => ({ navigation: i, currentPath: e, scrollWithin: A, followSameUrlJump: I, followEmptyFragment: _ }), [i, e, A, I, _]), S = F(() => y.retry(e), [y, e]), L = wa(y, Ci), M = vr(e), P = M !== void 0 ? "edit" : n ? "markup" : "rendered", H = jt(T) === null ? void 0 : P, K = F(() => O.current, []), w = X(() => ({ session: M, layout: s, region: K, paneScroll: u, stale: r }), [M, s, K, u, r]), k = H === "edit" ? !1 : r, C = se(we), N = H === "edit" && s === "fill" ? "fill" : C, [z, W] = V(0), J = U(0), G = U(!1), [ie, Yt] = V(Lc), [Xt, lo] = V(0), Jt = U(d), Qt = U(r);
3468
+ ), b = X(() => ({ navigation: i, currentPath: e, scrollWithin: A, followSameUrlJump: I, followEmptyFragment: _ }), [i, e, A, I, _]), S = F(() => y.retry(e), [y, e]), L = ya(y, $i), M = kr(e), P = M !== void 0 ? "edit" : n ? "markup" : "rendered", H = Zt(T) === null ? void 0 : P, K = F(() => O.current, []), w = X(() => ({ session: M, layout: s, region: K, paneScroll: u, stale: r }), [M, s, K, u, r]), k = H === "edit" ? !1 : r, C = se(we), N = H === "edit" && s === "fill" ? "fill" : C, [z, W] = V(0), J = U(0), G = U(!1), [ie, Jt] = V(Fc), [Qt, fo] = V(0), en = U(c), tn = U(r);
3410
3469
  Y(() => {
3411
- Jt.current = d, Qt.current = r;
3412
- }, [d, r]);
3413
- const co = X(
3470
+ en.current = c, tn.current = r;
3471
+ }, [c, r]);
3472
+ const mo = X(
3414
3473
  () => ({
3415
3474
  announceFailure: (j) => {
3416
- Qt.current || Jt.current(j);
3475
+ tn.current || en.current(j);
3417
3476
  },
3418
3477
  readPart: () => {
3419
3478
  const j = y.readPart(e);
@@ -3426,11 +3485,11 @@ const ml = /* @__PURE__ */ new Map([
3426
3485
  Q = !0, G.current = !1;
3427
3486
  return;
3428
3487
  }
3429
- Z = !0, Yt((ze) => ({ count: ze.count + 1, recovered: Q }));
3488
+ Z = !0, Jt((ze) => ({ count: ze.count + 1, recovered: Q }));
3430
3489
  }
3431
3490
  },
3432
3491
  release: () => {
3433
- oe || (oe = !0, j.release(), J.current -= 1, Z || lo((be) => be + 1));
3492
+ oe || (oe = !0, j.release(), J.current -= 1, Z || fo((be) => be + 1));
3434
3493
  }
3435
3494
  };
3436
3495
  },
@@ -3443,44 +3502,44 @@ const ml = /* @__PURE__ */ new Map([
3443
3502
  }
3444
3503
  }),
3445
3504
  [y, e]
3446
- ), en = k || z > 0, uo = le((j, Z) => {
3505
+ ), nn = k || z > 0, ho = le((j, Z) => {
3447
3506
  const Q = R.current;
3448
3507
  if (Q !== null && Q.path === j && Q.snapshot === Z) return;
3449
3508
  R.current = { path: j, snapshot: Z }, y.noteShown(j, Z);
3450
3509
  const oe = Z.document;
3451
3510
  if (oe.kind === "failure") {
3452
- G.current = !1, y.noteFailureShown(Z) && d(g.documentFailed(fe(j), de(g, oe.failure.reason)));
3511
+ G.current = !1, y.noteFailureShown(Z) && c(g.documentFailed(fe(j), de(g, oe.failure.reason)));
3453
3512
  return;
3454
3513
  }
3455
- h?.(j, oe), !(!l || Q !== null && Q.path === j && Q.snapshot.document.kind !== "failure") && (G.current = J.current > 0, G.current || v.announce(g.documentShown(oe.name)));
3514
+ m?.(j, oe), !(!l || Q !== null && Q.path === j && Q.snapshot.document.kind !== "failure") && (G.current = J.current > 0, G.current || v.announce(g.documentShown(oe.name)));
3456
3515
  });
3457
3516
  ee(() => {
3458
- uo(e, t);
3517
+ ho(e, t);
3459
3518
  }, [e, t]);
3460
- const fo = le(() => {
3519
+ const po = le(() => {
3461
3520
  f.kind === "panel" && f.consume();
3462
- }), tn = le((j) => {
3521
+ }), rn = le((j) => {
3463
3522
  const Z = O.current;
3464
- if (Z === null || !m.current) return null;
3523
+ if (Z === null || !h.current) return null;
3465
3524
  const { activeElement: Q, body: oe } = Z.ownerDocument;
3466
- return Q !== null && Q !== oe ? null : Cc(Z, T, j);
3467
- }), mo = le((j) => {
3525
+ return Q !== null && Q !== oe ? null : $c(Z, T, j);
3526
+ }), go = le((j) => {
3468
3527
  const Z = G.current;
3469
- G.current = !1, !r && (j && tn(null), l && (j || Z) && T.kind !== "failure" && v.announce(g.documentShown(T.name)));
3528
+ G.current = !1, !r && (j && rn(null), l && (j || Z) && T.kind !== "failure" && v.announce(g.documentShown(T.name)));
3470
3529
  });
3471
3530
  ee(() => {
3472
- ie.count > 0 && mo(ie.recovered);
3531
+ ie.count > 0 && go(ie.recovered);
3473
3532
  }, [ie]);
3474
- const ho = le(() => {
3533
+ const wo = le(() => {
3475
3534
  J.current > 0 || !G.current || (G.current = !1, l && !r && T.kind !== "failure" && v.announce(g.documentShown(T.name)));
3476
3535
  });
3477
3536
  ee(() => {
3478
- Xt > 0 && ho();
3479
- }, [Xt]);
3480
- const po = le((j) => {
3537
+ Qt > 0 && wo();
3538
+ }, [Qt]);
3539
+ const vo = le((j) => {
3481
3540
  const Z = O.current;
3482
- Z !== null && Hn(Z, j, m.current);
3483
- }), go = le((j) => u.reveal(j)), wo = le((j) => Sn(O.current, j, u));
3541
+ Z !== null && Vn(Z, j, h.current);
3542
+ }), bo = le((j) => u.reveal(j)), yo = le((j) => Rn(O.current, j, u));
3484
3543
  return ee(() => {
3485
3544
  if (r) return;
3486
3545
  const j = p.current.path !== e, Z = j || p.current.document !== T;
@@ -3488,50 +3547,50 @@ const ml = /* @__PURE__ */ new Map([
3488
3547
  const Q = x.current !== e;
3489
3548
  x.current = e;
3490
3549
  let oe = null;
3491
- f.kind === "page" ? q.current !== f.navigation && (q.current = f.navigation, D.current += 1, oe = f.fragment) : f.fragment !== null && (oe = f.fragment, fo());
3550
+ f.kind === "page" ? q.current !== f.navigation && (q.current = f.navigation, D.current += 1, oe = f.fragment) : f.fragment !== null && (oe = f.fragment, po());
3492
3551
  const be = () => {
3493
- const ye = oe === null ? null : wo(oe);
3552
+ const ye = oe === null ? null : yo(oe);
3494
3553
  if (!Z) {
3495
- ye !== null && po(ye);
3554
+ ye !== null && vo(ye);
3496
3555
  return;
3497
3556
  }
3498
- const ze = tn(f.fragment);
3499
- j && ye === null && ze !== null && go(ze);
3557
+ const ze = rn(f.fragment);
3558
+ j && ye === null && ze !== null && bo(ze);
3500
3559
  };
3501
3560
  Q ? queueMicrotask(be) : be();
3502
- }, [f, e, T, r]), /* @__PURE__ */ c(we, { value: N, children: /* @__PURE__ */ c(Pe, { kind: T.kind, view: H, label: a(e, T), stale: en, busy: en, frameRef: O, intent: L, children: /* @__PURE__ */ c(Dr, { value: b, children: /* @__PURE__ */ c(Ti, { children: /* @__PURE__ */ c(Or, { value: co, children: /* @__PURE__ */ c(Tc, { path: e, document: T, view: P, viewer: o, onRetry: S, editing: w }, e) }) }) }) }) });
3503
- }, Kt = Object.freeze({ kind: "skeleton" }), Ac = (e, t, n, r, o) => {
3561
+ }, [f, e, T, r]), /* @__PURE__ */ d(we, { value: N, children: /* @__PURE__ */ d(Pe, { kind: T.kind, view: H, label: a(e, T), stale: nn, busy: nn, frameRef: O, intent: L, children: /* @__PURE__ */ d($r, { value: b, children: /* @__PURE__ */ d(Pi, { children: /* @__PURE__ */ d(Ar, { value: mo, children: /* @__PURE__ */ d(Pc, { path: e, document: T, view: P, viewer: o, onRetry: S, editing: w }, e) }) }) }) }) });
3562
+ }, Xt = Object.freeze({ kind: "skeleton" }), Bc = (e, t, n, r, o) => {
3504
3563
  if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
3505
3564
  const s = ge(t);
3506
3565
  if (s !== null) return { kind: "document", path: e, snapshot: s, stale: !0 };
3507
3566
  if (o && t?.status === "pending") return { kind: "streaming", path: e, promise: t.promise };
3508
3567
  const a = n === null || n === e ? null : ge(r);
3509
- return n === null || a === null ? Kt : { kind: "document", path: n, snapshot: a, stale: !0 };
3510
- }, Nc = (e, t) => t.status === "deferred" ? Kt : { kind: "document", path: e, snapshot: t, stale: !1 }, Dc = ({ requestedPath: e, content: t, markup: n, ...r }) => {
3511
- const o = t.kind === "streaming" ? Nc(t.path, se(t.promise)) : t;
3512
- return o.kind !== "document" ? /* @__PURE__ */ c(Gt, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ c(Mc, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
3513
- }, so = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: s, paneScroll: a, announces: i, announceFailure: f, onDocumentShown: u }) => {
3514
- const { config: l, labels: d, locale: h, theme: g, documents: v, data: y } = $(), T = os(), O = U(!1);
3568
+ return n === null || a === null ? Xt : { kind: "document", path: n, snapshot: a, stale: !0 };
3569
+ }, Uc = (e, t) => t.status === "deferred" ? Xt : { kind: "document", path: e, snapshot: t, stale: !1 }, Hc = ({ requestedPath: e, content: t, markup: n, ...r }) => {
3570
+ const o = t.kind === "streaming" ? Uc(t.path, se(t.promise)) : t;
3571
+ return o.kind !== "document" ? /* @__PURE__ */ d(Yt, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ d(qc, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
3572
+ }, lo = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: s, paneScroll: a, announces: i, announceFailure: f, onDocumentShown: u }) => {
3573
+ const { config: l, labels: c, locale: m, theme: g, documents: v, data: y } = $(), T = is(), O = U(!1);
3515
3574
  Y(() => {
3516
3575
  O.current = !0;
3517
3576
  }, []);
3518
- const [R, q] = V(null), [D, m] = V(n), p = F(() => e === null ? void 0 : v.peek(e), [v, e]), x = re(v.subscribe, p, p), A = F(() => R === null ? void 0 : v.peek(R), [v, R]), I = re(v.subscribe, A, A);
3577
+ const [R, q] = V(null), [D, h] = V(n), p = F(() => e === null ? void 0 : v.peek(e), [v, e]), x = re(v.subscribe, p, p), A = F(() => R === null ? void 0 : v.peek(R), [v, R]), I = re(v.subscribe, A, A);
3519
3578
  Y(() => e === null ? void 0 : v.open(e), [v, e]), Y(() => R === null ? void 0 : v.retain(R), [v, R]);
3520
- const _ = e === null ? Kt : Ac(e, x, R, I, !O.current), b = e === null ? null : _.kind === "document" && !_.stale ? _.path : R;
3579
+ const _ = e === null ? Xt : Bc(e, x, R, I, !O.current), b = e === null ? null : _.kind === "document" && !_.stale ? _.path : R;
3521
3580
  b !== R && q(b);
3522
3581
  const S = _.kind !== "document" || _.path === e;
3523
- S && n !== D && m(n);
3524
- const L = X(() => fl(d, h), [d, h]), M = X(() => ({ read: (C, N) => Si(y, C, N) }), [y]), P = X(() => [...l.iframeHosts], [l]), H = o.kind === "panel", K = X(
3582
+ S && n !== D && h(n);
3583
+ const L = X(() => kl(c, m), [c, m]), M = X(() => ({ read: (C, N) => Ni(y, C, N) }), [y]), P = X(() => [...l.iframeHosts], [l]), H = o.kind === "panel", K = X(
3525
3584
  () => ({
3526
3585
  labels: L,
3527
- spreadsheetLocale: h,
3528
- spreadsheetTapScrollCircle: Rr,
3529
- emptyMessage: d.documentEmpty,
3586
+ spreadsheetLocale: m,
3587
+ spreadsheetTapScrollCircle: Lr,
3588
+ emptyMessage: c.documentEmpty,
3530
3589
  theme: g,
3531
3590
  availableStyles: l.documentStyles,
3532
3591
  iFrameAllowedDomains: P,
3533
3592
  embeds: l.embeds,
3534
- linkComponent: Di,
3593
+ linkComponent: Hi,
3535
3594
  toolbar: T,
3536
3595
  style: r.style,
3537
3596
  onStyleChange: r.onStyleChange,
@@ -3543,14 +3602,14 @@ const ml = /* @__PURE__ */ new Map([
3543
3602
  padding: r.padding,
3544
3603
  width: r.width === void 0 ? void 0 : `min(${r.width}, 100%)`,
3545
3604
  maxWidth: r.maxWidth === void 0 ? void 0 : `min(${r.maxWidth}, 100%)`,
3546
- renderScrollBar: H ? void 0 : Er,
3547
- scrollBarGutter: H ? void 0 : xr,
3605
+ renderScrollBar: H ? void 0 : Tr,
3606
+ scrollBarGutter: H ? void 0 : Cr,
3548
3607
  imageSource: M
3549
3608
  }),
3550
- [L, h, d.documentEmpty, g, l.documentStyles, P, l.embeds, T, r, H, M]
3551
- ), w = F((C, N) => H ? N === null || N.kind === "failure" ? fe(C) : N.name : d.documentRegion, [H, d.documentRegion]), k = H ? "content" : "fill";
3552
- return e === null ? /* @__PURE__ */ c(we, { value: k, children: /* @__PURE__ */ c(kc, { absence: t, announces: i, announceFailure: f }) }) : /* @__PURE__ */ c(we, { value: k, children: /* @__PURE__ */ c(Ie, { fallback: /* @__PURE__ */ c(Gt, { label: w(e, null) }), children: /* @__PURE__ */ c(
3553
- Dc,
3609
+ [L, m, c.documentEmpty, g, l.documentStyles, P, l.embeds, T, r, H, M]
3610
+ ), w = F((C, N) => H ? N === null || N.kind === "failure" ? fe(C) : N.name : c.documentRegion, [H, c.documentRegion]), k = H ? "content" : "fill";
3611
+ return e === null ? /* @__PURE__ */ d(we, { value: k, children: /* @__PURE__ */ d(Mc, { absence: t, announces: i, announceFailure: f }) }) : /* @__PURE__ */ d(we, { value: k, children: /* @__PURE__ */ d(Ie, { fallback: /* @__PURE__ */ d(Yt, { label: w(e, null) }), children: /* @__PURE__ */ d(
3612
+ Hc,
3554
3613
  {
3555
3614
  requestedPath: e,
3556
3615
  content: _,
@@ -3566,14 +3625,14 @@ const ml = /* @__PURE__ */ new Map([
3566
3625
  onDocumentShown: u
3567
3626
  }
3568
3627
  ) }) });
3569
- }, Pc = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
3570
- const { config: s, viewSettings: a, announcer: i } = $(), f = Je((I) => I.style), u = Je((I) => I.align), l = ot(), d = er(), h = Ft(), { view: g, overrides: v, embed: y } = r, T = F(
3628
+ }, zc = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
3629
+ const { config: s, viewSettings: a, announcer: i } = $(), f = Qe((I) => I.style), u = Qe((I) => I.align), l = at(), c = rr(), m = Bt(), { view: g, overrides: v, embed: y } = r, T = F(
3571
3630
  (I) => {
3572
- if (h.kind !== "location") return;
3573
- const _ = yc(s, h.location, I);
3631
+ if (m.kind !== "location") return;
3632
+ const _ = Lc(s, m.location, I);
3574
3633
  _ !== null && l(_, "browse");
3575
3634
  },
3576
- [s, l, h]
3635
+ [s, l, m]
3577
3636
  ), O = F(
3578
3637
  (I) => {
3579
3638
  a.update({ style: I }), T("style");
@@ -3584,7 +3643,7 @@ const ml = /* @__PURE__ */ new Map([
3584
3643
  a.update({ align: I }), T("align");
3585
3644
  },
3586
3645
  [a, T]
3587
- ), q = zr(s, v.style, f), D = jr(v.align, u), m = X(
3646
+ ), q = Zr(s, v.style, f), D = Wr(v.align, u), h = X(
3588
3647
  () => ({
3589
3648
  style: q,
3590
3649
  onStyleChange: O,
@@ -3599,15 +3658,15 @@ const ml = /* @__PURE__ */ new Map([
3599
3658
  editLayout: "fill"
3600
3659
  }),
3601
3660
  [q, O, D, R, y]
3602
- ), p = X(() => ({ kind: "page", view: g, overrides: v, embed: y }), [g, v, y]), x = X(() => ({ kind: "page", fragment: d.hash, navigation: d }), [d]), A = F((I) => i.announce(I), [i]);
3603
- return /* @__PURE__ */ c(so, { path: e, absence: t, markup: n, display: m, navigation: p, fragment: x, paneScroll: ri, announces: !0, announceFailure: A, onDocumentShown: o });
3604
- }, Ic = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
3605
- const { config: s, viewSettings: a } = $(), i = Je((p) => p.style), f = Je((p) => p.align), [u, l] = V(() => zr(s, void 0, i)), d = jr(void 0, f), h = F((p) => a.update({ align: p }), [a]), { maximized: g, onDocumentLink: v, pendingHash: y, onHashConsumed: T, announceFailure: O, paneScroll: R } = r, q = X(
3661
+ ), p = X(() => ({ kind: "page", view: g, overrides: v, embed: y }), [g, v, y]), x = X(() => ({ kind: "page", fragment: c.hash, navigation: c }), [c]), A = F((I) => i.announce(I), [i]);
3662
+ return /* @__PURE__ */ d(lo, { path: e, absence: t, markup: n, display: h, navigation: p, fragment: x, paneScroll: fi, announces: !0, announceFailure: A, onDocumentShown: o });
3663
+ }, jc = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
3664
+ const { config: s, viewSettings: a } = $(), i = Qe((p) => p.style), f = Qe((p) => p.align), [u, l] = V(() => Zr(s, void 0, i)), c = Wr(void 0, f), m = F((p) => a.update({ align: p }), [a]), { maximized: g, onDocumentLink: v, pendingHash: y, onHashConsumed: T, announceFailure: O, paneScroll: R } = r, q = X(
3606
3665
  () => ({
3607
3666
  style: u,
3608
3667
  onStyleChange: l,
3609
- align: d,
3610
- onAlignChange: h,
3668
+ align: c,
3669
+ onAlignChange: m,
3611
3670
  showToc: g,
3612
3671
  showStyle: g,
3613
3672
  showAlign: g,
@@ -3616,11 +3675,11 @@ const ml = /* @__PURE__ */ new Map([
3616
3675
  maxWidth: void 0,
3617
3676
  editLayout: g ? "fill" : "content"
3618
3677
  }),
3619
- [u, d, h, g]
3620
- ), D = X(() => ({ kind: "panel", onDocumentLink: v }), [v]), m = X(() => ({ kind: "panel", fragment: y, consume: T }), [y, T]);
3621
- return /* @__PURE__ */ c(so, { path: e, absence: t, markup: n, display: q, navigation: D, fragment: m, paneScroll: R, announces: !1, announceFailure: O, onDocumentShown: o });
3622
- }, $c = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => r.kind === "page" ? /* @__PURE__ */ c(Pc, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) : /* @__PURE__ */ c(Ic, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o });
3623
- function _c({
3678
+ [u, c, m, g]
3679
+ ), D = X(() => ({ kind: "panel", onDocumentLink: v }), [v]), h = X(() => ({ kind: "panel", fragment: y, consume: T }), [y, T]);
3680
+ return /* @__PURE__ */ d(lo, { path: e, absence: t, markup: n, display: q, navigation: D, fragment: h, paneScroll: R, announces: !1, announceFailure: O, onDocumentShown: o });
3681
+ }, Vc = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => r.kind === "page" ? /* @__PURE__ */ d(zc, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) : /* @__PURE__ */ d(jc, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o });
3682
+ function Zc({
3624
3683
  title: e,
3625
3684
  titleId: t,
3626
3685
  ...n
@@ -3641,8 +3700,8 @@ function _c({
3641
3700
  clipRule: "evenodd"
3642
3701
  }));
3643
3702
  }
3644
- const Fc = /* @__PURE__ */ E.forwardRef(_c);
3645
- function qc({
3703
+ const Wc = /* @__PURE__ */ E.forwardRef(Zc);
3704
+ function Gc({
3646
3705
  title: e,
3647
3706
  titleId: t,
3648
3707
  ...n
@@ -3663,8 +3722,8 @@ function qc({
3663
3722
  clipRule: "evenodd"
3664
3723
  }));
3665
3724
  }
3666
- const ao = /* @__PURE__ */ E.forwardRef(qc);
3667
- function Bc({
3725
+ const co = /* @__PURE__ */ E.forwardRef(Gc);
3726
+ function Kc({
3668
3727
  title: e,
3669
3728
  titleId: t,
3670
3729
  ...n
@@ -3685,8 +3744,8 @@ function Bc({
3685
3744
  clipRule: "evenodd"
3686
3745
  }));
3687
3746
  }
3688
- const Uc = /* @__PURE__ */ E.forwardRef(Bc);
3689
- function Hc({
3747
+ const Yc = /* @__PURE__ */ E.forwardRef(Kc);
3748
+ function Xc({
3690
3749
  title: e,
3691
3750
  titleId: t,
3692
3751
  ...n
@@ -3711,8 +3770,8 @@ function Hc({
3711
3770
  clipRule: "evenodd"
3712
3771
  }));
3713
3772
  }
3714
- const zc = /* @__PURE__ */ E.forwardRef(Hc);
3715
- function jc({
3773
+ const Jc = /* @__PURE__ */ E.forwardRef(Xc);
3774
+ function Qc({
3716
3775
  title: e,
3717
3776
  titleId: t,
3718
3777
  ...n
@@ -3733,8 +3792,8 @@ function jc({
3733
3792
  clipRule: "evenodd"
3734
3793
  }));
3735
3794
  }
3736
- const Vc = /* @__PURE__ */ E.forwardRef(jc);
3737
- function Zc({
3795
+ const ed = /* @__PURE__ */ E.forwardRef(Qc);
3796
+ function td({
3738
3797
  title: e,
3739
3798
  titleId: t,
3740
3799
  ...n
@@ -3757,8 +3816,8 @@ function Zc({
3757
3816
  d: "M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"
3758
3817
  }));
3759
3818
  }
3760
- const Wc = /* @__PURE__ */ E.forwardRef(Zc);
3761
- function Gc({
3819
+ const nd = /* @__PURE__ */ E.forwardRef(td);
3820
+ function rd({
3762
3821
  title: e,
3763
3822
  titleId: t,
3764
3823
  ...n
@@ -3781,8 +3840,8 @@ function Gc({
3781
3840
  clipRule: "evenodd"
3782
3841
  }));
3783
3842
  }
3784
- const Kc = /* @__PURE__ */ E.forwardRef(Gc);
3785
- function Yc({
3843
+ const od = /* @__PURE__ */ E.forwardRef(rd);
3844
+ function sd({
3786
3845
  title: e,
3787
3846
  titleId: t,
3788
3847
  ...n
@@ -3803,8 +3862,8 @@ function Yc({
3803
3862
  d: "M5.25 5.25a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h10.5a3 3 0 0 0 3-3V13.5a.75.75 0 0 0-1.5 0v5.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5V8.25a1.5 1.5 0 0 1 1.5-1.5h5.25a.75.75 0 0 0 0-1.5H5.25Z"
3804
3863
  }));
3805
3864
  }
3806
- const Xc = /* @__PURE__ */ E.forwardRef(Yc);
3807
- function Jc({
3865
+ const ad = /* @__PURE__ */ E.forwardRef(sd);
3866
+ function id({
3808
3867
  title: e,
3809
3868
  titleId: t,
3810
3869
  ...n
@@ -3823,81 +3882,81 @@ function Jc({
3823
3882
  d: "M15 3.75H9v16.5h6V3.75ZM16.5 20.25h3.375c1.035 0 1.875-.84 1.875-1.875V5.625c0-1.036-.84-1.875-1.875-1.875H16.5v16.5ZM4.125 3.75H7.5v16.5H4.125a1.875 1.875 0 0 1-1.875-1.875V5.625c0-1.036.84-1.875 1.875-1.875Z"
3824
3883
  }));
3825
3884
  }
3826
- const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId: n }) => {
3885
+ const ld = /* @__PURE__ */ E.forwardRef(id), cd = ({ href: e, onRetry: t, testId: n }) => {
3827
3886
  const { labels: r, onEditGrant: o } = $(), [s, a] = V(!1), i = () => {
3828
3887
  o === void 0 || s || (a(!0), o(e).then((f) => {
3829
3888
  f && t();
3830
3889
  }).finally(() => a(!1)));
3831
3890
  };
3832
3891
  return /* @__PURE__ */ B("div", { className: "aqmx-callout aqmx-edit-grant", "data-testid": n, children: [
3833
- /* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: r.editGrantTitle }),
3834
- /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: r.editGrantBody }),
3892
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: r.editGrantTitle }),
3893
+ /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: r.editGrantBody }),
3835
3894
  /* @__PURE__ */ B("div", { className: "aqmx-edit-grant-actions", children: [
3836
- o === void 0 ? /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e, target: "_blank", rel: "noopener", "data-testid": `${n}-open`, children: r.editGrantAction }) : (
3837
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": s, "data-testid": `${n}-open`, onClick: i, children: r.editGrantAction })
3895
+ o === void 0 ? /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e, target: "_blank", rel: "noopener", "data-testid": `${n}-open`, children: r.editGrantAction }) : (
3896
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": s, "data-testid": `${n}-open`, onClick: i, children: r.editGrantAction })
3838
3897
  ),
3839
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-testid": `${n}-retry`, onClick: t, children: r.editGrantRetry })
3898
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "data-testid": `${n}-retry`, onClick: t, children: r.editGrantRetry })
3840
3899
  ] })
3841
3900
  ] });
3842
- }, td = "Control+E Meta+E", nd = (e, t, n) => n && t ? "split" : e.view, zn = (e, t, n, r) => {
3901
+ }, dd = "Control+E Meta+E", ud = (e, t, n) => n && t ? "split" : e.view, Zn = (e, t, n, r) => {
3843
3902
  if (n === "split") {
3844
3903
  e.setSideBySide(!0);
3845
3904
  return;
3846
3905
  }
3847
3906
  e.setView(t, n), r && e.sideBySide() && e.setSideBySide(!1);
3848
- }, ku = (e) => e === "split" ? null : e, rd = (e) => e === "preview" ? "editor" : "preview", od = (e) => /Mac|iPhone|iPad|iPod/u.test(e), sd = (e, t) => {
3907
+ }, Mu = (e) => e === "split" ? null : e, fd = (e) => e === "preview" ? "editor" : "preview", md = (e) => /Mac|iPhone|iPad|iPod/u.test(e), hd = (e, t) => {
3849
3908
  if (e.isComposing || e.altKey || e.shiftKey || (t ? !e.metaKey || e.ctrlKey : !e.ctrlKey || e.metaKey)) return !1;
3850
3909
  const n = e.key.toLowerCase();
3851
3910
  return n === "e" || e.code === "KeyE" && /^\p{L}$/u.test(n) && !/^[a-z]$/u.test(n);
3852
- }, jn = (e, t, n) => {
3911
+ }, Wn = (e, t, n) => {
3853
3912
  const r = e.modifiedAt === null ? Number.NaN : Date.parse(e.modifiedAt);
3854
3913
  return n(Number.isNaN(r) ? e.id : t.format(r), e.author === null ? "" : e.author);
3855
- }, ad = ({ path: e, documentName: t, open: n, onClose: r }) => {
3856
- const { data: o, edits: s, labels: a, locale: i, announcer: f } = $(), u = Te(), [l, d] = V(null), [h, g] = V(0), [v, y] = V(null), [T, O] = V(null), R = X(() => new Intl.DateTimeFormat(i, { dateStyle: "medium", timeStyle: "short" }), [i]), q = F(() => {
3914
+ }, pd = ({ path: e, documentName: t, open: n, onClose: r }) => {
3915
+ const { data: o, edits: s, labels: a, locale: i, announcer: f } = $(), u = Te(), [l, c] = V(null), [m, g] = V(0), [v, y] = V(null), [T, O] = V(null), R = X(() => new Intl.DateTimeFormat(i, { dateStyle: "medium", timeStyle: "short" }), [i]), q = F(() => {
3857
3916
  y(null), O(null);
3858
- }, []), D = pr({ open: n, onOpen: q, onDismiss: r });
3917
+ }, []), D = vr({ open: n, onOpen: q, onDismiss: r });
3859
3918
  ee(() => {
3860
3919
  if (!n) return;
3861
3920
  const x = new AbortController();
3862
- return d(null), o.revisions(e, x.signal).then((A) => {
3863
- "kind" in A && d(A);
3921
+ return c(null), o.revisions(e, x.signal).then((A) => {
3922
+ "kind" in A && c(A);
3864
3923
  }), () => x.abort();
3865
- }, [n, o, e, h]), ee(() => {
3924
+ }, [n, o, e, m]), ee(() => {
3866
3925
  if (!n || v === null) return;
3867
3926
  const x = new AbortController();
3868
3927
  return O(null), o.revision(e, v, x.signal).then((A) => {
3869
3928
  "kind" in A && O(A);
3870
3929
  }), () => x.abort();
3871
3930
  }, [n, o, e, v]);
3872
- const m = () => {
3931
+ const h = () => {
3873
3932
  T === null || T.kind !== "revision" || (s.replaceDraft(e, T.text), f.announce(a.historyRestored(t)), r());
3874
3933
  }, p = l !== null && l.kind === "revisions" ? l.revisions.find((x) => x.id === v) : void 0;
3875
- return /* @__PURE__ */ c("dialog", { ...D, className: "aqmx-confirm aqmx-history", "aria-labelledby": u, "data-testid": "markdown-explorer-history", children: /* @__PURE__ */ B("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
3876
- /* @__PURE__ */ c("p", { id: u, className: "aqmx-confirm-title", children: a.historyTitle(t) }),
3877
- l === null ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: a.historyLoading }) : l.kind === "failure" ? /* @__PURE__ */ c(Re, { failure: l.failure, alert: !1, onRetry: () => g((x) => x + 1), testId: "markdown-explorer-history-failure" }) : l.revisions.length === 0 ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: a.historyEmpty }) : /* @__PURE__ */ c("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: l.revisions.map((x) => /* @__PURE__ */ c("li", { children: /* @__PURE__ */ B("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": x.id === v, "data-testid": "markdown-explorer-history-entry", onClick: () => y(x.id), children: [
3878
- /* @__PURE__ */ c("span", { children: jn(x, R, a.historyEntry) }),
3879
- x.current ? /* @__PURE__ */ c("span", { className: "aqmx-history-mark", children: a.historyCurrent }) : null,
3880
- x.kept ? /* @__PURE__ */ c("span", { className: "aqmx-history-mark", children: a.historyKept }) : null
3934
+ return /* @__PURE__ */ d("dialog", { ...D, className: "aqmx-confirm aqmx-history", "aria-labelledby": u, "data-testid": "markdown-explorer-history", children: /* @__PURE__ */ B("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
3935
+ /* @__PURE__ */ d("p", { id: u, className: "aqmx-confirm-title", children: a.historyTitle(t) }),
3936
+ l === null ? /* @__PURE__ */ d("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: a.historyLoading }) : l.kind === "failure" ? /* @__PURE__ */ d(Re, { failure: l.failure, alert: !1, onRetry: () => g((x) => x + 1), testId: "markdown-explorer-history-failure" }) : l.revisions.length === 0 ? /* @__PURE__ */ d("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: a.historyEmpty }) : /* @__PURE__ */ d("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: l.revisions.map((x) => /* @__PURE__ */ d("li", { children: /* @__PURE__ */ B("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": x.id === v, "data-testid": "markdown-explorer-history-entry", onClick: () => y(x.id), children: [
3937
+ /* @__PURE__ */ d("span", { children: Wn(x, R, a.historyEntry) }),
3938
+ x.current ? /* @__PURE__ */ d("span", { className: "aqmx-history-mark", children: a.historyCurrent }) : null,
3939
+ x.kept ? /* @__PURE__ */ d("span", { className: "aqmx-history-mark", children: a.historyKept }) : null
3881
3940
  ] }) }, x.id)) }),
3882
- v === null ? null : T === null ? /* @__PURE__ */ c("p", { className: "aqmx-history-note", children: a.historyLoading }) : T.kind === "failure" ? /* @__PURE__ */ c(Re, { failure: T.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
3883
- /* @__PURE__ */ c("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": p === void 0 ? a.historyTitle(t) : jn(p, R, a.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ c("pre", { children: T.text }) })
3941
+ v === null ? null : T === null ? /* @__PURE__ */ d("p", { className: "aqmx-history-note", children: a.historyLoading }) : T.kind === "failure" ? /* @__PURE__ */ d(Re, { failure: T.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
3942
+ /* @__PURE__ */ d("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": p === void 0 ? a.historyTitle(t) : Wn(p, R, a.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ d("pre", { children: T.text }) })
3884
3943
  ),
3885
3944
  /* @__PURE__ */ B("div", { className: "aqmx-confirm-actions", children: [
3886
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "data-testid": "markdown-explorer-history-close", onClick: r, children: a.historyClose }),
3887
- /* @__PURE__ */ c("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": T === null || T.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: m, children: a.historyRestore })
3945
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "data-testid": "markdown-explorer-history-close", onClick: r, children: a.historyClose }),
3946
+ /* @__PURE__ */ d("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": T === null || T.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: h, children: a.historyRestore })
3888
3947
  ] })
3889
3948
  ] }) });
3890
- }, id = (e) => {
3949
+ }, gd = (e) => {
3891
3950
  const { documents: t } = $(), n = F(() => t.peek(e), [t, e]), r = F(() => t.peekSeeded(e), [t, e]), o = re(t.subscribe, n, r), s = ge(o)?.document;
3892
3951
  return s === void 0 || s.kind === "failure" ? { edit: null, name: fe(e) } : { edit: s.kind === "markdown" || s.kind === "spreadsheet" ? s.edit : null, name: s.name };
3893
3952
  }, me = (e) => {
3894
3953
  e.stopPropagation();
3895
- }, ld = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r, draft: o }) => {
3954
+ }, wd = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r, draft: o }) => {
3896
3955
  const { draftConverter: s, edits: a, labels: i } = $(), f = re(
3897
3956
  a.subscribe,
3898
3957
  () => a.session(e) !== void 0,
3899
3958
  () => !1
3900
- ), [u, l] = V(null), d = () => {
3959
+ ), [u, l] = V(null), c = () => {
3901
3960
  if (!f) {
3902
3961
  a.start(e, a.viewAnchor(e));
3903
3962
  return;
@@ -3905,8 +3964,8 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
3905
3964
  a.flush(e);
3906
3965
  const y = a.session(e);
3907
3966
  y?.dirty === !0 ? l(y.save.kind === "draft" ? "draft" : "unsaved") : a.close(e);
3908
- }, h = () => {
3909
- f || (Qs(), r && a.sideBySide() && s?.prepare?.());
3967
+ }, m = () => {
3968
+ f || (na(), r && a.sideBySide() && s?.prepare?.());
3910
3969
  }, g = n ? o ? i.editDraftDocumentNamed(t) : i.editDocumentNamed(t) : null, v = o ? i.editDraftDocument : i.editDocument;
3911
3970
  return /* @__PURE__ */ B(pe, { children: [
3912
3971
  /* @__PURE__ */ B(
@@ -3918,18 +3977,18 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
3918
3977
  "aria-label": g === null ? void 0 : g,
3919
3978
  "aria-pressed": f,
3920
3979
  "data-testid": "markdown-explorer-document-edit",
3921
- onClick: d,
3980
+ onClick: c,
3922
3981
  onDoubleClick: me,
3923
- onPointerEnter: h,
3924
- onFocus: h,
3982
+ onPointerEnter: m,
3983
+ onFocus: m,
3925
3984
  children: [
3926
- /* @__PURE__ */ c(Xc, { "aria-hidden": "true" }),
3927
- g === null ? /* @__PURE__ */ c("span", { children: i.editDocumentLabel }) : null
3985
+ /* @__PURE__ */ d(ad, { "aria-hidden": "true" }),
3986
+ g === null ? /* @__PURE__ */ d("span", { children: i.editDocumentLabel }) : null
3928
3987
  ]
3929
3988
  }
3930
3989
  ),
3931
- /* @__PURE__ */ c(
3932
- gr,
3990
+ /* @__PURE__ */ d(
3991
+ br,
3933
3992
  {
3934
3993
  open: u !== null,
3935
3994
  title: u === "draft" ? i.draftDiscardTitle : i.unsavedTitle,
@@ -3944,7 +4003,7 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
3944
4003
  }
3945
4004
  )
3946
4005
  ] });
3947
- }, cd = ({ href: e, documentName: t, iconOnly: n }) => {
4006
+ }, vd = ({ href: e, documentName: t, iconOnly: n }) => {
3948
4007
  const { labels: r } = $(), o = n ? r.editExternallyNamed(t) : null;
3949
4008
  return /* @__PURE__ */ B(
3950
4009
  "a",
@@ -3958,85 +4017,85 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
3958
4017
  "data-testid": "markdown-explorer-document-edit-external",
3959
4018
  onDoubleClick: me,
3960
4019
  children: [
3961
- /* @__PURE__ */ c(Uc, { "aria-hidden": "true" }),
3962
- o === null ? /* @__PURE__ */ c("span", { children: r.editExternallyLabel }) : null
4020
+ /* @__PURE__ */ d(Yc, { "aria-hidden": "true" }),
4021
+ o === null ? /* @__PURE__ */ d("span", { children: r.editExternallyLabel }) : null
3963
4022
  ]
3964
4023
  }
3965
4024
  );
3966
- }, dd = ({ session: e }) => {
3967
- const { labels: t } = $(), n = Es(t, e);
3968
- return /* @__PURE__ */ c("p", { className: "aqmx-edit-status", title: n === "" ? void 0 : n, "data-testid": "markdown-explorer-edit-status", "data-aqmx-save": e.save.kind, children: n });
3969
- }, ud = Object.freeze(["editor", "split", "preview"]), fd = Object.freeze(["editor", "preview"]), md = Object.freeze({ editor: ao, split: Qc, preview: Kc }), hd = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
3970
- const { draftConverter: s, edits: a, labels: i } = $(), f = Gs(), u = nd(r, f, o), l = o ? ud : fd, d = Te(), h = U(/* @__PURE__ */ new Map()), g = {
4025
+ }, bd = ({ session: e }) => {
4026
+ const { labels: t } = $(), n = Ts(t, e);
4027
+ return /* @__PURE__ */ d("p", { className: "aqmx-edit-status", title: n === "" ? void 0 : n, "data-testid": "markdown-explorer-edit-status", "data-aqmx-save": e.save.kind, children: n });
4028
+ }, yd = Object.freeze(["editor", "split", "preview"]), kd = Object.freeze(["editor", "preview"]), Ed = Object.freeze({ editor: co, split: ld, preview: od }), Sd = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
4029
+ const { draftConverter: s, edits: a, labels: i } = $(), f = Xs(), u = ud(r, f, o), l = o ? yd : kd, c = Te(), m = U(/* @__PURE__ */ new Map()), g = {
3971
4030
  editor: { label: i.editViewEditor, tooltip: i.editViewEditorTooltip },
3972
4031
  split: { label: i.editViewSplit, tooltip: i.editViewSplitTooltip },
3973
4032
  preview: { label: i.editViewPreview, tooltip: i.editViewPreviewTooltip }
3974
4033
  }, v = () => {
3975
4034
  a.preparePreview(e), s?.prepare?.();
3976
4035
  }, y = (T) => {
3977
- if (!sd(T.nativeEvent, od(navigator.platform))) return;
3978
- mr(T);
3979
- const O = rd(u);
3980
- zn(a, e, O, o), h.current.get(O)?.focus();
4036
+ if (!hd(T.nativeEvent, md(navigator.platform))) return;
4037
+ gr(T);
4038
+ const O = fd(u);
4039
+ Zn(a, e, O, o), m.current.get(O)?.focus();
3981
4040
  };
3982
- return /* @__PURE__ */ c("div", { role: "radiogroup", "aria-label": n ? i.editViewNamed(t) : i.editView, className: "aqmx-edit-view", "data-testid": "markdown-explorer-edit-view", onKeyDown: y, children: l.map((T) => {
3983
- const O = md[T], { label: R, tooltip: q } = g[T], D = T === "preview" ? v : void 0;
4041
+ return /* @__PURE__ */ d("div", { role: "radiogroup", "aria-label": n ? i.editViewNamed(t) : i.editView, className: "aqmx-edit-view", "data-testid": "markdown-explorer-edit-view", onKeyDown: y, children: l.map((T) => {
4042
+ const O = Ed[T], { label: R, tooltip: q } = g[T], D = T === "preview" ? v : void 0;
3984
4043
  return /* @__PURE__ */ B("label", { className: n ? "aqmx-icon-button" : "aqmx-icon-button aqmx-labelled-button", children: [
3985
- /* @__PURE__ */ c(
4044
+ /* @__PURE__ */ d(
3986
4045
  "input",
3987
4046
  {
3988
- ref: (m) => {
3989
- m === null ? h.current.delete(T) : h.current.set(T, m);
4047
+ ref: (h) => {
4048
+ h === null ? m.current.delete(T) : m.current.set(T, h);
3990
4049
  },
3991
4050
  type: "radio",
3992
- name: d,
4051
+ name: c,
3993
4052
  value: T,
3994
4053
  checked: T === u,
3995
4054
  "aria-label": R,
3996
- "aria-keyshortcuts": T === "split" ? void 0 : td,
4055
+ "aria-keyshortcuts": T === "split" ? void 0 : dd,
3997
4056
  title: q,
3998
4057
  "data-testid": `markdown-explorer-edit-view-${T}`,
3999
- onChange: () => zn(a, e, T, o),
4058
+ onChange: () => Zn(a, e, T, o),
4000
4059
  onDoubleClick: me,
4001
4060
  onPointerEnter: D,
4002
4061
  onFocus: D
4003
4062
  }
4004
4063
  ),
4005
- /* @__PURE__ */ c(O, { "aria-hidden": "true" }),
4006
- n ? null : /* @__PURE__ */ c("span", { children: R })
4064
+ /* @__PURE__ */ d(O, { "aria-hidden": "true" }),
4065
+ n ? null : /* @__PURE__ */ d("span", { children: R })
4007
4066
  ] }, T);
4008
4067
  }) });
4009
- }, pd = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
4068
+ }, xd = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
4010
4069
  const { edits: s, labels: a } = $(), [i, f] = V(!1);
4011
4070
  if (r.phase.kind !== "editing") return null;
4012
- const u = r.save.kind === "saving", l = u || !r.dirty, d = () => {
4071
+ const u = r.save.kind === "saving", l = u || !r.dirty, c = () => {
4013
4072
  s.flush(e);
4014
4073
  const g = s.session(e);
4015
4074
  g === void 0 || !g.dirty || g.save.kind === "saving" || s.save(e);
4016
- }, h = (g) => n ? { className: "aqmx-icon-button", "aria-label": g } : { className: "aqmx-icon-button aqmx-labelled-button" };
4075
+ }, m = (g) => n ? { className: "aqmx-icon-button", "aria-label": g } : { className: "aqmx-icon-button aqmx-labelled-button" };
4017
4076
  return /* @__PURE__ */ B(pe, { children: [
4018
- r.save.kind === "conflicts" ? /* @__PURE__ */ B("button", { type: "button", ...h(a.conflictNext), title: a.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => s.nextConflict(e), onDoubleClick: me, children: [
4019
- /* @__PURE__ */ c(zc, { "aria-hidden": "true" }),
4020
- n ? null : /* @__PURE__ */ c("span", { children: a.conflictNext })
4077
+ r.save.kind === "conflicts" ? /* @__PURE__ */ B("button", { type: "button", ...m(a.conflictNext), title: a.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => s.nextConflict(e), onDoubleClick: me, children: [
4078
+ /* @__PURE__ */ d(Jc, { "aria-hidden": "true" }),
4079
+ n ? null : /* @__PURE__ */ d("span", { children: a.conflictNext })
4021
4080
  ] }) : null,
4022
- /* @__PURE__ */ c(hd, { path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }),
4023
- r.history ? /* @__PURE__ */ B("button", { type: "button", ...h(a.historyOpen), title: a.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => f(!0), onDoubleClick: me, children: [
4024
- /* @__PURE__ */ c(Vc, { "aria-hidden": "true" }),
4025
- n ? null : /* @__PURE__ */ c("span", { children: a.historyOpen })
4081
+ /* @__PURE__ */ d(Sd, { path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }),
4082
+ r.history ? /* @__PURE__ */ B("button", { type: "button", ...m(a.historyOpen), title: a.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => f(!0), onDoubleClick: me, children: [
4083
+ /* @__PURE__ */ d(ed, { "aria-hidden": "true" }),
4084
+ n ? null : /* @__PURE__ */ d("span", { children: a.historyOpen })
4026
4085
  ] }) : null,
4027
- r.save.kind === "draft" ? null : /* @__PURE__ */ B("button", { type: "button", ...h(a.saveDraft), title: a.saveDraftTooltip, "aria-disabled": l, "aria-busy": u, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: d, onDoubleClick: me, children: [
4028
- /* @__PURE__ */ c(Wc, { "aria-hidden": "true" }),
4029
- n ? null : /* @__PURE__ */ c("span", { children: a.saveDraft })
4086
+ r.save.kind === "draft" ? null : /* @__PURE__ */ B("button", { type: "button", ...m(a.saveDraft), title: a.saveDraftTooltip, "aria-disabled": l, "aria-busy": u, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: c, onDoubleClick: me, children: [
4087
+ /* @__PURE__ */ d(nd, { "aria-hidden": "true" }),
4088
+ n ? null : /* @__PURE__ */ d("span", { children: a.saveDraft })
4030
4089
  ] }),
4031
- r.history ? /* @__PURE__ */ c(ad, { path: e, documentName: t, open: i, onClose: () => f(!1) }) : null
4090
+ r.history ? /* @__PURE__ */ d(pd, { path: e, documentName: t, open: i, onClose: () => f(!1) }) : null
4032
4091
  ] });
4033
- }, gd = ({ path: e, session: t }) => {
4092
+ }, Td = ({ path: e, session: t }) => {
4034
4093
  const { edits: n } = $();
4035
- return t.save.kind !== "grant" ? null : /* @__PURE__ */ c(ed, { href: t.save.href, onRetry: () => {
4094
+ return t.save.kind !== "grant" ? null : /* @__PURE__ */ d(cd, { href: t.save.href, onRetry: () => {
4036
4095
  n.save(e);
4037
4096
  }, testId: "markdown-explorer-save-grant" });
4038
- }, wd = /* @__PURE__ */ new Set(), vd = (e, t, n) => {
4039
- const { documents: r, announcer: o, labels: s } = $(), a = F(() => r.peek(e), [r, e]), i = F(() => r.peekSeeded(e), [r, e]), f = re(r.subscribe, a, i), u = F(() => r.answerStampOf(e), [r, e]), l = re(r.subscribe, u, u), [d] = V(() => /* @__PURE__ */ new Set()), [h, g] = V(wd), [v, y] = V(null);
4097
+ }, Rd = /* @__PURE__ */ new Set(), Cd = (e, t, n) => {
4098
+ const { documents: r, announcer: o, labels: s } = $(), a = F(() => r.peek(e), [r, e]), i = F(() => r.peekSeeded(e), [r, e]), f = re(r.subscribe, a, i), u = F(() => r.answerStampOf(e), [r, e]), l = re(r.subscribe, u, u), [c] = V(() => /* @__PURE__ */ new Set()), [m, g] = V(Rd), [v, y] = V(null);
4040
4099
  v !== null && (v.path !== e || v.markup !== n) && y(null);
4041
4100
  const T = U(null);
4042
4101
  Y(() => (T.current = e, () => {
@@ -4047,26 +4106,26 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4047
4106
  O.current = n;
4048
4107
  }, [n]);
4049
4108
  const R = F(() => {
4050
- const m = e, p = r.peek(m);
4051
- d.has(m) || p?.status === "pending" || (d.add(m), g(new Set(d)), y(null), (async () => {
4109
+ const h = e, p = r.peek(h);
4110
+ c.has(h) || p?.status === "pending" || (c.add(h), g(new Set(c)), y(null), (async () => {
4052
4111
  try {
4053
- const x = await r.refresh(m);
4054
- if (T.current !== m || x.status === "superseded") return;
4112
+ const x = await r.refresh(h);
4113
+ if (T.current !== h || x.status === "superseded") return;
4055
4114
  if (x.status === "failed") {
4056
- y({ path: m, failure: x.failure, stamp: r.answerStampOf(m), markup: O.current }), o.announce(s.documentRefreshFailed(de(s, x.failure.reason)));
4115
+ y({ path: h, failure: x.failure, stamp: r.answerStampOf(h), markup: O.current }), o.announce(s.documentRefreshFailed(de(s, x.failure.reason)));
4057
4116
  return;
4058
4117
  }
4059
4118
  if (x.status === "shown" && (t || x.failed)) return;
4060
- const A = ge(r.peek(m));
4119
+ const A = ge(r.peek(h));
4061
4120
  if (A === null || A.document.kind === "failure") return;
4062
4121
  o.announce(s.documentRefreshed(A.document.name));
4063
4122
  } finally {
4064
- d.delete(m), g(new Set(d));
4123
+ c.delete(h), g(new Set(c));
4065
4124
  }
4066
4125
  })());
4067
- }, [e, t, d, r, o, s]), q = h.has(e), D = v !== null && v.path === e && v.stamp === l && v.markup === n ? v.failure : null;
4126
+ }, [e, t, c, r, o, s]), q = m.has(e), D = v !== null && v.path === e && v.stamp === l && v.markup === n ? v.failure : null;
4068
4127
  return { refreshing: q, unavailable: q || f?.status === "pending", failure: D, refresh: R };
4069
- }, bd = (e, t) => {
4128
+ }, Od = (e, t) => {
4070
4129
  switch (t) {
4071
4130
  case "markdown":
4072
4131
  return e.showMarkup;
@@ -4076,37 +4135,37 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4076
4135
  case "tsv":
4077
4136
  return e.showSpreadsheetMarkup(t.toUpperCase());
4078
4137
  }
4079
- }, yd = Object.freeze({ kind: "page" }), kd = ({ path: e, placement: t, markup: n }) => {
4080
- const { labels: r } = $(), { refreshing: o, unavailable: s, failure: a, refresh: i } = vd(e, t.kind === "page", n.shown), f = Yi(e), u = id(e), l = vr(e), d = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, h = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, g = t.kind === "panel", v = t.kind === "panel" ? t.documentName : u.name, y = t.kind === "page" || t.maximized;
4138
+ }, Ld = Object.freeze({ kind: "page" }), Md = ({ path: e, placement: t, markup: n }) => {
4139
+ const { labels: r } = $(), { refreshing: o, unavailable: s, failure: a, refresh: i } = Cd(e, t.kind === "page", n.shown), f = sl(e), u = gd(e), l = kr(e), c = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, m = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, g = t.kind === "panel", v = t.kind === "panel" ? t.documentName : u.name, y = t.kind === "page" || t.maximized;
4081
4140
  return /* @__PURE__ */ B("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", "data-aqmx-editing": l === void 0 ? void 0 : "true", children: [
4082
4141
  /* @__PURE__ */ B("div", { className: "aqmx-document-refresh-row", children: [
4083
- l === void 0 ? null : /* @__PURE__ */ c(dd, { session: l }),
4084
- l === void 0 ? null : /* @__PURE__ */ c(pd, { path: e, documentName: v, iconOnly: g, session: l, previewAvailable: y }),
4142
+ l === void 0 ? null : /* @__PURE__ */ d(bd, { session: l }),
4143
+ l === void 0 ? null : /* @__PURE__ */ d(xd, { path: e, documentName: v, iconOnly: g, session: l, previewAvailable: y }),
4085
4144
  l === void 0 && f !== null ? /* @__PURE__ */ B(
4086
4145
  "button",
4087
4146
  {
4088
4147
  type: "button",
4089
- className: h === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
4090
- title: h === null ? bd(r, f) : h,
4091
- "aria-label": h === null ? void 0 : h,
4148
+ className: m === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
4149
+ title: m === null ? Od(r, f) : m,
4150
+ "aria-label": m === null ? void 0 : m,
4092
4151
  "aria-pressed": n.shown,
4093
4152
  "data-testid": "markdown-explorer-document-markup",
4094
4153
  onClick: n.toggle,
4095
4154
  onDoubleClick: me,
4096
4155
  children: [
4097
- /* @__PURE__ */ c(ao, { "aria-hidden": "true" }),
4098
- h === null ? /* @__PURE__ */ c("span", { children: r.showMarkupLabel }) : null
4156
+ /* @__PURE__ */ d(co, { "aria-hidden": "true" }),
4157
+ m === null ? /* @__PURE__ */ d("span", { children: r.showMarkupLabel }) : null
4099
4158
  ]
4100
4159
  }
4101
4160
  ) : null,
4102
- l !== void 0 || u.edit?.kind === "inline" || u.edit?.kind === "draft" ? /* @__PURE__ */ c(ld, { path: e, documentName: v, iconOnly: g, previewAvailable: y, draft: u.edit?.kind === "draft" }) : u.edit?.kind === "external" ? /* @__PURE__ */ c(cd, { href: u.edit.href, documentName: v, iconOnly: g }) : null,
4161
+ l !== void 0 || u.edit?.kind === "inline" || u.edit?.kind === "draft" ? /* @__PURE__ */ d(wd, { path: e, documentName: v, iconOnly: g, previewAvailable: y, draft: u.edit?.kind === "draft" }) : u.edit?.kind === "external" ? /* @__PURE__ */ d(vd, { href: u.edit.href, documentName: v, iconOnly: g }) : null,
4103
4162
  l === void 0 ? /* @__PURE__ */ B(
4104
4163
  "button",
4105
4164
  {
4106
4165
  type: "button",
4107
- className: d === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
4108
- title: d === null ? r.refreshDocument : d,
4109
- "aria-label": d === null ? void 0 : d,
4166
+ className: c === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
4167
+ title: c === null ? r.refreshDocument : c,
4168
+ "aria-label": c === null ? void 0 : c,
4110
4169
  "aria-disabled": s,
4111
4170
  "aria-busy": o,
4112
4171
  "data-aqmx-busy": o ? "true" : void 0,
@@ -4114,46 +4173,46 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4114
4173
  onClick: i,
4115
4174
  onDoubleClick: me,
4116
4175
  children: [
4117
- /* @__PURE__ */ c(Fc, { "aria-hidden": "true" }),
4118
- d === null ? /* @__PURE__ */ c("span", { children: r.refreshDocumentLabel }) : null
4176
+ /* @__PURE__ */ d(Wc, { "aria-hidden": "true" }),
4177
+ c === null ? /* @__PURE__ */ d("span", { children: r.refreshDocumentLabel }) : null
4119
4178
  ]
4120
4179
  }
4121
4180
  ) : null
4122
4181
  ] }),
4123
- l !== void 0 || a === null ? null : /* @__PURE__ */ c("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": a.reason, children: r.documentRefreshFailed(de(r, a.reason)) }),
4124
- l === void 0 ? null : /* @__PURE__ */ c(gd, { path: e, session: l })
4182
+ l !== void 0 || a === null ? null : /* @__PURE__ */ d("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": a.reason, children: r.documentRefreshFailed(de(r, a.reason)) }),
4183
+ l === void 0 ? null : /* @__PURE__ */ d(Td, { path: e, session: l })
4125
4184
  ] });
4126
- }, Ed = ({ location: e }) => {
4127
- const t = e.doc, n = X(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = Xi(e);
4128
- return /* @__PURE__ */ B("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", ...Lt, children: [
4129
- /* @__PURE__ */ c(kd, { path: t, placement: yd, markup: r }),
4130
- /* @__PURE__ */ c($c, { path: t, absence: bc, markup: e.markup, variant: n })
4185
+ }, Ad = ({ location: e }) => {
4186
+ const t = e.doc, n = X(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = al(e);
4187
+ return /* @__PURE__ */ B("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", ...At, children: [
4188
+ /* @__PURE__ */ d(Md, { path: t, placement: Ld, markup: r }),
4189
+ /* @__PURE__ */ d(Vc, { path: t, absence: Oc, markup: e.markup, variant: n })
4131
4190
  ] });
4132
- }, Sd = ({ holds: e, testId: t }) => {
4191
+ }, Nd = ({ holds: e, testId: t }) => {
4133
4192
  const { labels: n, announcer: r } = $(), o = Te();
4134
4193
  Y(() => e ? r.claim(o) : void 0, [e, r, o]);
4135
4194
  const s = F(() => r.shownIn(o), [r, o]), a = re(r.subscribe, s, s);
4136
- return /* @__PURE__ */ c("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: a.length > 1 ? n.announcementSequence(a) : a[0] });
4137
- }, ke = Object.freeze([]), xd = (e) => {
4195
+ return /* @__PURE__ */ d("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: a.length > 1 ? n.announcementSequence(a) : a[0] });
4196
+ }, ke = Object.freeze([]), Dd = (e) => {
4138
4197
  const t = /* @__PURE__ */ new Set();
4139
4198
  let n = ke, r = [], o = !1;
4140
4199
  const s = [], a = (l) => {
4141
4200
  n = l;
4142
- for (const d of [...t]) d();
4201
+ for (const c of [...t]) c();
4143
4202
  }, i = () => s.at(-1)?.region, f = (l) => {
4144
- const d = i();
4145
- l(), i() !== d && n !== ke && a(ke);
4203
+ const c = i();
4204
+ l(), i() !== c && n !== ke && a(ke);
4146
4205
  }, u = () => {
4147
4206
  o = !1;
4148
- const l = r.map((d) => "sentence" in d ? d.sentence : d.list(d.items));
4207
+ const l = r.map((c) => "sentence" in c ? c.sentence : c.list(c.items));
4149
4208
  r = [], a(Object.freeze(l));
4150
4209
  };
4151
4210
  return {
4152
4211
  announce: (l) => {
4153
4212
  if (typeof l == "string") r.push({ sentence: l });
4154
4213
  else {
4155
- const d = r.find((h) => "list" in h && h.list === l.list);
4156
- d !== void 0 && "items" in d ? d.items.push(l.item) : r.push({ list: l.list, items: [l.item] });
4214
+ const c = r.find((m) => "list" in m && m.list === l.list);
4215
+ c !== void 0 && "items" in c ? c.items.push(l.item) : r.push({ list: l.list, items: [l.item] });
4157
4216
  }
4158
4217
  o || (o = !0, n !== ke && a(ke), e.request(u));
4159
4218
  },
@@ -4161,29 +4220,29 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4161
4220
  t.delete(l);
4162
4221
  }),
4163
4222
  claim: (l) => {
4164
- const d = { region: l };
4165
- return f(() => s.push(d)), () => f(() => {
4166
- const h = s.indexOf(d);
4167
- h !== -1 && s.splice(h, 1);
4223
+ const c = { region: l };
4224
+ return f(() => s.push(c)), () => f(() => {
4225
+ const m = s.indexOf(c);
4226
+ m !== -1 && s.splice(m, 1);
4168
4227
  });
4169
4228
  },
4170
4229
  shownIn: (l) => i() === l ? n : ke
4171
4230
  };
4172
- }, ue = Object.freeze({ status: "cancelled" }), Vn = (e) => {
4231
+ }, ue = Object.freeze({ status: "cancelled" }), Gn = (e) => {
4173
4232
  if (e === null || typeof e != "object") return null;
4174
4233
  const { failure: t } = e;
4175
- if (Ho(t) !== null) return null;
4234
+ if (Vo(t) !== null) return null;
4176
4235
  const { reason: n, code: r } = t;
4177
- return zo(n, r);
4178
- }, Td = ({ dataPath: e, onScope: t, fetch: n }) => {
4179
- const r = n ?? ((l, d) => globalThis.fetch(l, d)), o = (l, d) => `${e}/${l}?${new URLSearchParams(d).toString()}`, s = (l) => {
4236
+ return Zo(n, r);
4237
+ }, Pd = ({ dataPath: e, onScope: t, fetch: n }) => {
4238
+ const r = n ?? ((l, c) => globalThis.fetch(l, c)), o = (l, c) => `${e}/${l}?${new URLSearchParams(c).toString()}`, s = (l) => {
4180
4239
  l.status === 401 && t(null);
4181
- const d = l.headers.get(Uo);
4182
- d !== null && t(d);
4183
- }, a = async (l, d, h, g) => {
4240
+ const c = l.headers.get(jo);
4241
+ c !== null && t(c);
4242
+ }, a = async (l, c, m, g) => {
4184
4243
  let v;
4185
4244
  try {
4186
- v = await r(l, { credentials: "same-origin", ...d, headers: { Accept: "application/json", ...d.headers } });
4245
+ v = await r(l, { credentials: "same-origin", ...c, headers: { Accept: "application/json", ...c.headers } });
4187
4246
  } catch {
4188
4247
  return g({ reason: "failed" });
4189
4248
  }
@@ -4192,66 +4251,66 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4192
4251
  try {
4193
4252
  y = await v.json();
4194
4253
  } catch {
4195
- return g({ reason: dt(v.status) });
4254
+ return g({ reason: ft(v.status) });
4196
4255
  }
4197
4256
  let T;
4198
4257
  try {
4199
- T = h(y);
4258
+ T = m(y);
4200
4259
  } catch {
4201
4260
  T = !1;
4202
4261
  }
4203
4262
  if (T) return y;
4204
- const O = Vn(y);
4205
- return g(O !== null ? O : { reason: v.status === 200 ? "failed" : dt(v.status) });
4206
- }, i = { [ln]: Go }, f = { [ln]: Qo, "Content-Type": `${Jo}; charset=utf-8` }, u = async (l, d, h) => {
4207
- const g = await a(l, d, h, (v) => ut(v.reason, v.code));
4208
- return d.signal.aborted ? ue : g;
4263
+ const O = Gn(y);
4264
+ return g(O !== null ? O : { reason: v.status === 200 ? "failed" : ft(v.status) });
4265
+ }, i = { [dn]: Xo }, f = { [dn]: ns, "Content-Type": `${ts}; charset=utf-8` }, u = async (l, c, m) => {
4266
+ const g = await a(l, c, m, (v) => mt(v.reason, v.code));
4267
+ return c.signal.aborted ? ue : g;
4209
4268
  };
4210
4269
  return {
4211
- tree: (l) => a(o("tree", { [te.source]: l }), { method: "GET" }, an, (d) => ({ status: "error", failure: d })),
4212
- children: async (l, d, h) => {
4213
- const g = await a(o("children", { [te.source]: l, [te.path]: d }), { method: "GET", signal: h }, Wo, (v) => ({ status: "error", failure: v }));
4214
- return h.aborted ? ue : g;
4270
+ tree: (l) => a(o("tree", { [te.source]: l }), { method: "GET" }, cn, (c) => ({ status: "error", failure: c })),
4271
+ children: async (l, c, m) => {
4272
+ const g = await a(o("children", { [te.source]: l, [te.path]: c }), { method: "GET", signal: m }, Yo, (v) => ({ status: "error", failure: v }));
4273
+ return m.aborted ? ue : g;
4215
4274
  },
4216
- ancestors: async (l, d, h) => {
4217
- const g = await a(o("ancestors", { [te.source]: l, [te.path]: d }), { method: "GET", signal: h }, Zo, (v) => ({ status: "error", failure: v }));
4218
- return h.aborted ? ue : g;
4275
+ ancestors: async (l, c, m) => {
4276
+ const g = await a(o("ancestors", { [te.source]: l, [te.path]: c }), { method: "GET", signal: m }, Ko, (v) => ({ status: "error", failure: v }));
4277
+ return m.aborted ? ue : g;
4219
4278
  },
4220
- reveal: async (l, d, h) => {
4221
- const g = await a(o("reveal", { [te.source]: l, [te.path]: d }), { method: "GET", signal: h }, Vo, (v) => ({ status: "error", failure: v }));
4222
- return h.aborted ? ue : g;
4279
+ reveal: async (l, c, m) => {
4280
+ const g = await a(o("reveal", { [te.source]: l, [te.path]: c }), { method: "GET", signal: m }, Go, (v) => ({ status: "error", failure: v }));
4281
+ return m.aborted ? ue : g;
4223
4282
  },
4224
- document: (l, { refresh: d }) => a(o("document", { [te.path]: l }), d ? { method: "GET", headers: i } : { method: "GET" }, ns, (h) => ut(h.reason, h.code)),
4225
- text: async (l, d) => {
4226
- const h = await a(o("text", { [te.path]: l }), { method: "GET", signal: d }, jo, (g) => ut(g.reason, g.code));
4227
- return d.aborted ? ue : h;
4283
+ document: (l, { refresh: c }) => a(o("document", { [te.path]: l }), c ? { method: "GET", headers: i } : { method: "GET" }, ss, (m) => mt(m.reason, m.code)),
4284
+ text: async (l, c) => {
4285
+ const m = await a(o("text", { [te.path]: l }), { method: "GET", signal: c }, Wo, (g) => mt(g.reason, g.code));
4286
+ return c.aborted ? ue : m;
4228
4287
  },
4229
- asset: async (l, d) => {
4230
- let h;
4288
+ asset: async (l, c) => {
4289
+ let m;
4231
4290
  try {
4232
- h = await r(l, { method: "GET", credentials: "same-origin", signal: d });
4291
+ m = await r(l, { method: "GET", credentials: "same-origin", signal: c });
4233
4292
  } catch {
4234
- return d.aborted ? ue : { status: "error", failure: { reason: "failed" } };
4293
+ return c.aborted ? ue : { status: "error", failure: { reason: "failed" } };
4235
4294
  }
4236
- if (s(h), h.ok)
4237
- return d.aborted ? ue : { status: "ok", body: h.body === null ? new ReadableStream({ start: (y) => y.close() }) : h.body };
4295
+ if (s(m), m.ok)
4296
+ return c.aborted ? ue : { status: "ok", body: m.body === null ? new ReadableStream({ start: (y) => y.close() }) : m.body };
4238
4297
  let g = null;
4239
4298
  try {
4240
- g = await h.json();
4299
+ g = await m.json();
4241
4300
  } catch {
4242
4301
  }
4243
- if (d.aborted) return ue;
4244
- const v = Vn(g);
4245
- return { status: "error", failure: v === null ? { reason: dt(h.status) } : v };
4302
+ if (c.aborted) return ue;
4303
+ const v = Gn(g);
4304
+ return { status: "error", failure: v === null ? { reason: ft(m.status) } : v };
4246
4305
  },
4247
- edit: (l, d) => u(o("edit", { [te.path]: l }), { method: "GET", signal: d }, ts),
4248
- save: (l, d, h, g) => u(o("save", { [te.path]: l, [te.base]: d }), { method: "POST", headers: f, body: h, signal: g }, es),
4249
- preview: (l, d, h) => u(o("preview", { [te.path]: l }), { method: "POST", headers: f, body: d, signal: h }, Xo),
4250
- revisions: (l, d) => u(o("revisions", { [te.path]: l }), { method: "GET", signal: d }, Yo),
4251
- revision: (l, d, h) => u(o("revision", { [te.path]: l, [te.revision]: d }), { method: "GET", signal: h }, Ko),
4252
- refresh: (l) => a(o("refresh", { [te.source]: l }), { method: "POST", headers: i }, an, (d) => ({ status: "error", failure: d }))
4306
+ edit: (l, c) => u(o("edit", { [te.path]: l }), { method: "GET", signal: c }, os),
4307
+ save: (l, c, m, g) => u(o("save", { [te.path]: l, [te.base]: c }), { method: "POST", headers: f, body: m, signal: g }, rs),
4308
+ preview: (l, c, m) => u(o("preview", { [te.path]: l }), { method: "POST", headers: f, body: c, signal: m }, es),
4309
+ revisions: (l, c) => u(o("revisions", { [te.path]: l }), { method: "GET", signal: c }, Qo),
4310
+ revision: (l, c, m) => u(o("revision", { [te.path]: l, [te.revision]: c }), { method: "GET", signal: m }, Jo),
4311
+ refresh: (l) => a(o("refresh", { [te.source]: l }), { method: "POST", headers: i }, cn, (c) => ({ status: "error", failure: c }))
4253
4312
  };
4254
- }, Rd = () => {
4313
+ }, Id = () => {
4255
4314
  let e = null, t = null;
4256
4315
  return {
4257
4316
  settle: (n) => {
@@ -4266,20 +4325,20 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4266
4325
  return t = null, o;
4267
4326
  }
4268
4327
  };
4269
- }, Cd = (e) => {
4270
- const t = Ot(e);
4271
- if (t === null) return on;
4328
+ }, $d = (e) => {
4329
+ const t = Mt(e);
4330
+ if (t === null) return an;
4272
4331
  try {
4273
- return $o(JSON.parse(t));
4332
+ return qo(JSON.parse(t));
4274
4333
  } catch (n) {
4275
- return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), on;
4334
+ return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), an;
4276
4335
  }
4277
- }, Zn = (e, t) => {
4336
+ }, Kn = (e, t) => {
4278
4337
  let n = null;
4279
4338
  const r = () => {
4280
4339
  if (n === null) {
4281
- const s = Cd(e);
4282
- n = { changes: s, settings: rn(t, s) };
4340
+ const s = $d(e);
4341
+ n = { changes: s, settings: sn(t, s) };
4283
4342
  }
4284
4343
  return n;
4285
4344
  }, o = qe();
@@ -4290,14 +4349,14 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4290
4349
  getServerSnapshot: () => t,
4291
4350
  subscribe: o.subscribe,
4292
4351
  advance: (s) => {
4293
- const { changes: a, settings: i } = r(), f = Do(a, s, Po(i, s)[s], t);
4294
- return n = { changes: f, settings: rn(t, f) }, o.emit(), Ct(e, Io(f)), n.settings;
4352
+ const { changes: a, settings: i } = r(), f = $o(a, s, _o(i, s)[s], t);
4353
+ return n = { changes: f, settings: sn(t, f) }, o.emit(), Lt(e, Fo(f)), n.settings;
4295
4354
  }
4296
4355
  };
4297
- }, Od = Object.freeze({ status: "refreshed" }), Ld = Object.freeze({ status: "superseded" }), It = Object.freeze({ status: "deferred" }), Md = wr(It), io = 4, Ad = io - 1, Wn = Object.freeze({ status: "loading" }), Nd = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), Dd = (e) => {
4298
- const t = /* @__PURE__ */ new Map(), n = Cr(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = qe(), f = /* @__PURE__ */ new Set();
4356
+ }, _d = Object.freeze({ status: "refreshed" }), Fd = Object.freeze({ status: "superseded" }), _t = Object.freeze({ status: "deferred" }), qd = yr(_t), uo = 4, Bd = uo - 1, Yn = Object.freeze({ status: "loading" }), Ud = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), Hd = (e) => {
4357
+ const t = /* @__PURE__ */ new Map(), n = Mr(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = qe(), f = /* @__PURE__ */ new Set();
4299
4358
  let u = 0, l = 0;
4300
- const d = { direct: null, bulk: null }, h = /* @__PURE__ */ new Set();
4359
+ const c = { direct: null, bulk: null }, m = /* @__PURE__ */ new Set();
4301
4360
  let g = !1, v = 0;
4302
4361
  const y = () => {
4303
4362
  v += 1, i.emit();
@@ -4316,7 +4375,7 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4316
4375
  }, D = (w) => {
4317
4376
  const k = T(w) + 1;
4318
4377
  return o.set(w, k), q(w), k;
4319
- }, m = (w, k) => {
4378
+ }, h = (w, k) => {
4320
4379
  const C = Ae(w), N = { promise: w, opened: k, stale: !1, loadedAt: C?.status === "ok" ? C.loadedAt : null };
4321
4380
  return w.status === "pending" && w.then((z) => {
4322
4381
  z.status === "ok" && (N.loadedAt = z.loadedAt);
@@ -4325,13 +4384,13 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4325
4384
  let k = r.get(w);
4326
4385
  return k === void 0 && (k = /* @__PURE__ */ new Map(), r.set(w, k)), k;
4327
4386
  }, x = (w) => {
4328
- const k = [...a.keys()], C = d[w], N = C === null ? 0 : k.indexOf(C) + 1;
4387
+ const k = [...a.keys()], C = c[w], N = C === null ? 0 : k.indexOf(C) + 1;
4329
4388
  for (let z = 0; z < k.length; z += 1) {
4330
4389
  const W = k[(N + z) % k.length], J = W === void 0 ? void 0 : a.get(W);
4331
4390
  if (!(W === void 0 || J === void 0)) {
4332
4391
  for (const G of J[w])
4333
4392
  if ((J.claims.get(G) ?? 0) !== 0)
4334
- return J[w].delete(G), d[w] = W, { sourceId: W, path: G };
4393
+ return J[w].delete(G), c[w] = W, { sourceId: W, path: G };
4335
4394
  }
4336
4395
  }
4337
4396
  return null;
@@ -4349,16 +4408,16 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4349
4408
  const N = { controller: new AbortController(), lane: C };
4350
4409
  O(w).inFlight.set(k, N), u += 1, C === "bulk" && (l += 1), e.children(w, k, N.controller.signal).then(
4351
4410
  (z) => A(w, k, N, z),
4352
- () => A(w, k, N, Nd)
4411
+ () => A(w, k, N, Ud)
4353
4412
  );
4354
4413
  }, _ = () => {
4355
- for (; u < io; ) {
4414
+ for (; u < uo; ) {
4356
4415
  const w = x("direct");
4357
4416
  if (w !== null) {
4358
4417
  I(w.sourceId, w.path, "direct");
4359
4418
  continue;
4360
4419
  }
4361
- const k = l < Ad ? x("bulk") : null;
4420
+ const k = l < Bd ? x("bulk") : null;
4362
4421
  if (k === null) return;
4363
4422
  I(k.sourceId, k.path, "bulk");
4364
4423
  }
@@ -4372,24 +4431,24 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4372
4431
  }, S = () => {
4373
4432
  g = !1;
4374
4433
  let w = !1;
4375
- for (const k of h) {
4434
+ for (const k of m) {
4376
4435
  const C = O(k);
4377
4436
  for (const N of C.unclaimed)
4378
4437
  (C.claims.get(N) ?? 0) === 0 && b(k, C, N) && (w = !0);
4379
4438
  C.unclaimed.clear();
4380
4439
  }
4381
- h.clear(), w && (y(), _());
4440
+ m.clear(), w && (y(), _());
4382
4441
  }, L = (w, k) => {
4383
- t.set(w, m($e(e.tree(w)), k));
4442
+ t.set(w, h($e(e.tree(w)), k));
4384
4443
  }, M = (w, k, C) => {
4385
4444
  D(w);
4386
- const N = m(wr(k), C);
4445
+ const N = h(yr(k), C);
4387
4446
  return t.set(w, N), r.delete(w), y(), _(), N;
4388
4447
  }, P = (w, k, C, N) => {
4389
4448
  if (C !== T(w) || t.get(w) !== k) return;
4390
4449
  const z = Ae(k.promise);
4391
4450
  if (!(N.status !== "ok" || z?.status !== "ok" || k.loadedAt === null || N.loadedAt <= k.loadedAt)) {
4392
- if (et(z.entries, N.entries)) {
4451
+ if (tt(z.entries, N.entries)) {
4393
4452
  k.loadedAt = N.loadedAt;
4394
4453
  return;
4395
4454
  }
@@ -4404,7 +4463,7 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4404
4463
  e.tree(w).then((N) => P(w, k, C, N));
4405
4464
  };
4406
4465
  return {
4407
- read: (w) => t.get(w)?.promise ?? Md,
4466
+ read: (w) => t.get(w)?.promise ?? qd,
4408
4467
  open: (w) => {
4409
4468
  const k = n.resumes(w), C = n.hold(w), N = t.get(w);
4410
4469
  return N === void 0 || H(w, "deferred") ? (L(w, !0), y()) : k || (N.opened && H(w, "error") ? (L(w, !0), y()) : (N.opened = !0, N.stale && H(w, "ok") && K(w, N))), C;
@@ -4414,8 +4473,8 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4414
4473
  },
4415
4474
  seed: (w, k) => {
4416
4475
  const C = k.then(
4417
- (W) => W === null ? It : W,
4418
- () => It
4476
+ (W) => W === null ? _t : W,
4477
+ () => _t
4419
4478
  ), N = t.get(w);
4420
4479
  if (N !== void 0 && H(w, "ok")) {
4421
4480
  const W = T(w);
@@ -4423,7 +4482,7 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4423
4482
  return;
4424
4483
  }
4425
4484
  D(w);
4426
- const z = m($e(C), N?.opened === !0);
4485
+ const z = h($e(C), N?.opened === !0);
4427
4486
  t.set(w, z), r.delete(w), _(), C.then((W) => {
4428
4487
  t.get(w) === z && (W.status === "deferred" && n.isHeld(w) && L(w, z.opened), y());
4429
4488
  });
@@ -4432,7 +4491,7 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4432
4491
  const k = (s.get(w) ?? 0) + 1;
4433
4492
  s.set(w, k);
4434
4493
  const C = await e.refresh(w);
4435
- if (s.get(w) !== k) return Ld;
4494
+ if (s.get(w) !== k) return Fd;
4436
4495
  if (C.status === "error") return { status: "failed", failure: C.failure };
4437
4496
  const N = t.get(w);
4438
4497
  if (!(N !== void 0 && N.loadedAt !== null && H(w, "ok") && N.loadedAt > C.loadedAt)) {
@@ -4444,14 +4503,14 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4444
4503
  }
4445
4504
  for (const [W, J] of t)
4446
4505
  W !== w && Ae(J.promise)?.status === "ok" && (J.stale = !0);
4447
- return Od;
4506
+ return _d;
4448
4507
  },
4449
4508
  children: (w, k) => r.get(w)?.get(k),
4450
4509
  claimChildren: (w, k) => {
4451
4510
  const C = O(w), N = p(w);
4452
4511
  let z = !1, W = !1;
4453
4512
  for (const [G, ie] of k)
4454
- C.claims.set(G, (C.claims.get(G) ?? 0) + 1), N.get(G) === void 0 ? (N.set(G, Wn), C[ie].add(G), z = !0, W = !0) : ie === "direct" && C.bulk.delete(G) && (C.direct.add(G), W = !0);
4513
+ C.claims.set(G, (C.claims.get(G) ?? 0) + 1), N.get(G) === void 0 ? (N.set(G, Yn), C[ie].add(G), z = !0, W = !0) : ie === "direct" && C.bulk.delete(G) && (C.direct.add(G), W = !0);
4455
4514
  z && y(), W && _();
4456
4515
  let J = !1;
4457
4516
  return () => {
@@ -4461,7 +4520,7 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4461
4520
  const ie = (C.claims.get(G) ?? 0) - 1;
4462
4521
  ie > 0 ? C.claims.set(G, ie) : (C.claims.delete(G), C.unclaimed.add(G));
4463
4522
  }
4464
- h.add(w), !g && (g = !0, queueMicrotask(S));
4523
+ m.add(w), !g && (g = !0, queueMicrotask(S));
4465
4524
  }
4466
4525
  };
4467
4526
  },
@@ -4470,7 +4529,7 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4470
4529
  if (C === void 0 || C.get(k)?.status !== "failed") return;
4471
4530
  const N = O(w);
4472
4531
  if ((N.claims.get(k) ?? 0) > 0) {
4473
- C.set(k, Wn), N.direct.add(k), y(), _();
4532
+ C.set(k, Yn), N.direct.add(k), y(), _();
4474
4533
  return;
4475
4534
  }
4476
4535
  C.delete(k), y();
@@ -4490,7 +4549,7 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4490
4549
  subscribe: i.subscribe,
4491
4550
  version: () => v
4492
4551
  };
4493
- }, Pd = (e, t) => {
4552
+ }, zd = (e, t) => {
4494
4553
  let n = e;
4495
4554
  const r = qe();
4496
4555
  return {
@@ -4500,66 +4559,66 @@ const Qc = /* @__PURE__ */ E.forwardRef(Jc), ed = ({ href: e, onRetry: t, testId
4500
4559
  n = { ...n, ...o }, t(n), r.emit();
4501
4560
  }
4502
4561
  };
4503
- }, Id = 1;
4562
+ }, jd = 1;
4504
4563
  let We = 0, he = null;
4505
- const $d = () => {
4564
+ const Vd = () => {
4506
4565
  const { documentElement: e, body: t } = document;
4507
4566
  We === 0 && (he = { htmlOverflow: e.style.overflow, bodyOverflow: t.style.overflow, htmlGutter: e.style.scrollbarGutter, bodyGutter: t.style.scrollbarGutter }, e.style.overflow = "hidden", t.style.overflow = "hidden", e.style.scrollbarGutter = "auto", t.style.scrollbarGutter = "auto"), We += 1;
4508
4567
  let n = !1;
4509
4568
  return () => {
4510
4569
  n || (n = !0, We -= 1, !(We > 0 || he === null) && (e.style.overflow = he.htmlOverflow, t.style.overflow = he.bodyOverflow, e.style.scrollbarGutter = he.htmlGutter, t.style.scrollbarGutter = he.bodyGutter, he = null));
4511
4570
  };
4512
- }, _d = [
4571
+ }, Zd = [
4513
4572
  { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
4514
4573
  { selector: "[data-aqmx-explorer-body]", name: "tree area" }
4515
- ], Gn = 1, Fd = 1e3, Kn = (e) => e.getClientRects().length > 0, xt = "Give the explorer's container a definite block size (for example height: 100dvh, or a flex column of definite height whose item has flex: 1 and min-height: 0; in a fresh React Router app also html and body at height: 100%) instead of an auto or only a minimum height.", qd = (e) => {
4516
- if (!Kn(e)) return null;
4574
+ ], Xn = 1, Wd = 1e3, Jn = (e) => e.getClientRects().length > 0, Rt = "Give the explorer's container a definite block size (for example height: 100dvh, or a flex column of definite height whose item has flex: 1 and min-height: 0; in a fresh React Router app also html and body at height: 100%) instead of an auto or only a minimum height.", Gd = (e) => {
4575
+ if (!Jn(e)) return null;
4517
4576
  const t = e.getBoundingClientRect(), n = window.innerHeight;
4518
- if (t.bottom > n + Id)
4519
- return `[markdown-explorer] the explorer ends ${String(Math.round(t.bottom))}px down a ${String(n)}px viewport while lockDocumentScroll stops the page from scrolling, so the rest cannot be reached. ${xt}`;
4520
- if (t.height < Gn)
4521
- return `[markdown-explorer] the explorer collapsed to ${String(Math.round(t.height))}px while lockDocumentScroll stops the page from scrolling, so nothing can be read. ${xt}`;
4522
- for (const { selector: r, name: o } of _d)
4577
+ if (t.bottom > n + jd)
4578
+ return `[markdown-explorer] the explorer ends ${String(Math.round(t.bottom))}px down a ${String(n)}px viewport while lockDocumentScroll stops the page from scrolling, so the rest cannot be reached. ${Rt}`;
4579
+ if (t.height < Xn)
4580
+ return `[markdown-explorer] the explorer collapsed to ${String(Math.round(t.height))}px while lockDocumentScroll stops the page from scrolling, so nothing can be read. ${Rt}`;
4581
+ for (const { selector: r, name: o } of Zd)
4523
4582
  for (const s of e.querySelectorAll(r)) {
4524
- if (!Kn(s)) continue;
4583
+ if (!Jn(s)) continue;
4525
4584
  const a = s.getBoundingClientRect().height;
4526
- if (a < Gn)
4527
- return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(a))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${xt}`;
4585
+ if (a < Xn)
4586
+ return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(a))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Rt}`;
4528
4587
  }
4529
4588
  return null;
4530
- }, Bd = (e) => {
4589
+ }, Kd = (e) => {
4531
4590
  let t = !1, n;
4532
4591
  const r = () => {
4533
4592
  n = void 0;
4534
- const a = qd(e);
4593
+ const a = Gd(e);
4535
4594
  a !== null && (t = !0, console.error(a));
4536
4595
  }, o = () => {
4537
- t || (clearTimeout(n), n = setTimeout(r, Fd));
4596
+ t || (clearTimeout(n), n = setTimeout(r, Wd));
4538
4597
  }, s = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
4539
4598
  return s?.observe(e), window.addEventListener("resize", o), o(), () => {
4540
4599
  clearTimeout(n), s?.disconnect(), window.removeEventListener("resize", o);
4541
4600
  };
4542
- }, Ud = (e, t) => {
4543
- ee(() => e ? $d() : void 0, [e]), ee(() => {
4601
+ }, Yd = (e, t) => {
4602
+ ee(() => e ? Vd() : void 0, [e]), ee(() => {
4544
4603
  const n = t.current;
4545
4604
  if (!(!e || n === null))
4546
- return Bd(n);
4605
+ return Kd(n);
4547
4606
  }, [e, t]);
4548
- }, Yn = '[data-testid="markdown-explorer-view-switch"]', Hd = [
4549
- { control: Yn, successors: [Yn, '[data-testid="markdown-explorer-sheet-toggle"]'] },
4607
+ }, Qn = '[data-testid="markdown-explorer-view-switch"]', Xd = [
4608
+ { control: Qn, successors: [Qn, '[data-testid="markdown-explorer-sheet-toggle"]'] },
4550
4609
  { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
4551
- ], zd = (e) => {
4552
- for (const t of Hd) {
4610
+ ], Jd = (e) => {
4611
+ for (const t of Xd) {
4553
4612
  const n = e.closest(t.control);
4554
4613
  if (n !== null) return { element: n, control: t };
4555
4614
  }
4556
4615
  return null;
4557
- }, jd = (e, t) => {
4616
+ }, Qd = (e, t) => {
4558
4617
  const n = U(null);
4559
4618
  ee(() => {
4560
4619
  const o = (i) => {
4561
4620
  const f = e.current;
4562
- n.current = f !== null && i instanceof Element && f.contains(i) ? zd(i) : null;
4621
+ n.current = f !== null && i instanceof Element && f.contains(i) ? Jd(i) : null;
4563
4622
  }, s = (i) => o(i.target);
4564
4623
  o(document.activeElement);
4565
4624
  const a = (i) => {
@@ -4584,8 +4643,8 @@ const $d = () => {
4584
4643
  const u = e.current;
4585
4644
  if (u === null) return !0;
4586
4645
  for (const l of o.control.successors)
4587
- for (const d of u.querySelectorAll(l))
4588
- if (d !== o.element && (d.focus({ preventScroll: !0 }), document.activeElement === d))
4646
+ for (const c of u.querySelectorAll(l))
4647
+ if (c !== o.element && (c.focus({ preventScroll: !0 }), document.activeElement === c))
4589
4648
  return !0;
4590
4649
  return !1;
4591
4650
  };
@@ -4597,37 +4656,37 @@ const $d = () => {
4597
4656
  });
4598
4657
  return i.observe(a, { childList: !0, subtree: !0 }), () => i.disconnect();
4599
4658
  }, [t, e]);
4600
- }, Vd = $t(() => import("./TreeLayout-C4l591Nc.js").then((e) => ({ default: e.TreeLayout }))), Zd = $t(() => import("./MultiLayout-Pf-6yPif.js").then((e) => ({ default: e.MultiLayout }))), Wd = 64, Gd = {
4659
+ }, eu = Ft(() => import("./TreeLayout-Bak1y1m4.js").then((e) => ({ default: e.TreeLayout }))), tu = Ft(() => import("./MultiLayout-B0dfZlpx.js").then((e) => ({ default: e.MultiLayout }))), nu = 64, ru = {
4601
4660
  request: (e) => {
4602
4661
  requestAnimationFrame(e);
4603
4662
  }
4604
- }, Xn = (e) => {
4663
+ }, er = (e) => {
4605
4664
  e.documents.clear(), e.trees.clear();
4606
- }, Tt = (e, t) => {
4665
+ }, Ct = (e, t) => {
4607
4666
  t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
4608
4667
  for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
4609
- }, Kd = (e, t) => {
4610
- const [n, r] = V(() => ({ overrides: t, locale: e, labels: mn(e, t) }));
4611
- if (n.locale === e && ys(n.overrides, t)) return n.labels;
4612
- const o = { overrides: t, locale: e, labels: mn(e, t) };
4668
+ }, ou = (e, t) => {
4669
+ const [n, r] = V(() => ({ overrides: t, locale: e, labels: pn(e, t) }));
4670
+ if (n.locale === e && Ss(n.overrides, t)) return n.labels;
4671
+ const o = { overrides: t, locale: e, labels: pn(e, t) };
4613
4672
  return r(o), o.labels;
4614
- }, Yd = (e, t, n) => {
4615
- const [r, o] = V(() => ({ scope: t, store: Zn(e, n) }));
4673
+ }, su = (e, t, n) => {
4674
+ const [r, o] = V(() => ({ scope: t, store: Kn(e, n) }));
4616
4675
  if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
4617
- const s = { scope: t, store: Zn(e, n) };
4676
+ const s = { scope: t, store: Kn(e, n) };
4618
4677
  return o(s), s.store;
4619
- }, Rt = (e, t) => {
4678
+ }, Ot = (e, t) => {
4620
4679
  const [n, r] = V(() => ({ scope: e, value: t() }));
4621
4680
  if (n.scope === e) return n.value;
4622
4681
  const o = { scope: e, value: t() };
4623
4682
  return r(o), o.value;
4624
- }, Xd = () => xd(Gd), Jn = "on", Jd = "off", Qd = Object.freeze({ kind: "unavailable" }), eu = (e) => {
4683
+ }, au = () => Dd(ru), tr = "on", iu = "off", lu = Object.freeze({ kind: "unavailable" }), cu = (e) => {
4625
4684
  if (e !== void 0 && (e === null || typeof e != "object" || typeof e.convert != "function"))
4626
4685
  throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function");
4627
- }, tu = (e, t) => {
4686
+ }, du = (e, t) => {
4628
4687
  const n = ge(e.peek(t));
4629
4688
  return n === null || n.document.kind === "failure" ? fe(t) : n.document.name;
4630
- }, Eu = ({
4689
+ }, Au = ({
4631
4690
  data: e,
4632
4691
  config: t,
4633
4692
  storageNamespace: n,
@@ -4639,26 +4698,26 @@ const $d = () => {
4639
4698
  lockDocumentScroll: f = !1,
4640
4699
  onMathDiagnostics: u,
4641
4700
  onEditGrant: l,
4642
- draftConverter: d
4701
+ draftConverter: c
4643
4702
  }) => {
4644
- ds(n), eu(d);
4645
- const h = dr(r), g = ks(s), v = Kd(h, o), { revalidate: y } = xo(), T = U(() => {
4646
- }), O = nt(t.dataPath), [R] = V(() => {
4647
- const C = Td({ dataPath: O, onScope: (z) => T.current(z) }), N = { documents: Oa({ client: C, capacity: Math.max(Wd, t.multiView.maxPanels * 2) }), trees: Dd(C) };
4648
- return Tt(N, e), un(n, e.scope), { data: C, ...N, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
4703
+ ms(n), cu(c);
4704
+ const m = mr(r), g = xs(s), v = ou(m, o), { revalidate: y } = Co(), T = U(() => {
4705
+ }), O = ot(t.dataPath), [R] = V(() => {
4706
+ const C = Pd({ dataPath: O, onScope: (z) => T.current(z) }), N = { documents: Aa({ client: C, capacity: Math.max(nu, t.multiView.maxPanels * 2) }), trees: Hd(C) };
4707
+ return Ct(N, e), mn(n, e.scope), { data: C, ...N, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
4649
4708
  });
4650
4709
  if (R.aligned.pageData !== e || R.aligned.storageNamespace !== n) {
4651
4710
  const C = R.aligned.pageData;
4652
- R.aligned.pageData = e, R.aligned.storageNamespace = n, C !== e && (C.scope !== e.scope ? R.aligned.pendingReader = e : Tt(R, e)), un(n, e.scope);
4711
+ R.aligned.pageData = e, R.aligned.storageNamespace = n, C !== e && (C.scope !== e.scope ? R.aligned.pendingReader = e : Ct(R, e)), mn(n, e.scope);
4653
4712
  }
4654
- const q = Yd(Oe(n).treeSettings, e.scope, t.defaultTreeSettings);
4713
+ const q = su(Oe(n).treeSettings, e.scope, t.defaultTreeSettings);
4655
4714
  Y(() => {
4656
4715
  const C = R.aligned.pendingReader;
4657
- C !== null && (R.aligned.pendingReader = null, Xn(R), Tt(R, C));
4716
+ C !== null && (R.aligned.pendingReader = null, er(R), Ct(R, C));
4658
4717
  }, [e, R]), Y(() => {
4659
4718
  let C = !1;
4660
4719
  return T.current = (N) => {
4661
- N === e.scope || C || (C = !0, N !== null && (Xn(R), us(n)), y());
4720
+ N === e.scope || C || (C = !0, N !== null && (er(R), hs(n)), y());
4662
4721
  }, () => {
4663
4722
  T.current = () => {
4664
4723
  };
@@ -4668,51 +4727,51 @@ const $d = () => {
4668
4727
  Y(() => {
4669
4728
  D.current = t.settingsCookie;
4670
4729
  }, [t.settingsCookie]);
4671
- const [m] = V(
4672
- () => Pd(e.settings, (C) => {
4673
- document.cookie = Fo(D.current, C, window.location.protocol === "https:");
4730
+ const [h] = V(
4731
+ () => zd(e.settings, (C) => {
4732
+ document.cookie = Uo(D.current, C, window.location.protocol === "https:");
4674
4733
  })
4675
- ), p = Rt(e.scope, Xd), x = Rt(e.scope, Rd), A = U(v);
4734
+ ), p = Ot(e.scope, au), x = Ot(e.scope, Id), A = U(v);
4676
4735
  Y(() => {
4677
4736
  A.current = v;
4678
4737
  }, [v]);
4679
- const I = Rt(
4738
+ const I = Ot(
4680
4739
  e.scope,
4681
- () => Ns({
4740
+ () => Is({
4682
4741
  data: R.data,
4683
4742
  conflictLabels: () => ({ ours: A.current.conflictOurs, theirs: A.current.conflictTheirs }),
4684
4743
  onSaveSettled: (C, N) => {
4685
4744
  N.kind === "saved" && R.documents.refresh(C);
4686
- const z = Ss(A.current, N, tu(R.documents, C));
4745
+ const z = Rs(A.current, N, du(R.documents, C));
4687
4746
  z !== null && p.announce(z);
4688
4747
  },
4689
4748
  sideBySideSetting: {
4690
- read: () => Ot(Oe(n).editPreview) === Jn,
4691
- write: (C) => Ct(Oe(n).editPreview, C ? Jn : Jd)
4749
+ read: () => Mt(Oe(n).editPreview) === tr,
4750
+ write: (C) => Lt(Oe(n).editPreview, C ? tr : iu)
4692
4751
  },
4693
4752
  editorShareSetting: {
4694
- read: () => As(Ot(Oe(n).editSplit)),
4695
- write: (C) => Ct(Oe(n).editSplit, String(C))
4753
+ read: () => Ps(Mt(Oe(n).editSplit)),
4754
+ write: (C) => Lt(Oe(n).editSplit, String(C))
4696
4755
  }
4697
4756
  })
4698
4757
  ), _ = X(() => $e(e.notices.catch(() => [])), [e.notices]), b = e.sources.map((C) => C.id).join(`
4699
- `), S = X(() => _o(t, b.split(`
4758
+ `), S = X(() => Bo(t, b.split(`
4700
4759
  `)), [t, b]), L = U(u);
4701
4760
  Y(() => {
4702
4761
  L.current = u;
4703
4762
  }, [u]);
4704
4763
  const [M] = V(() => (C, N) => {
4705
4764
  L.current?.(C, N);
4706
- }), P = u === void 0 ? void 0 : M, H = U(d);
4765
+ }), P = u === void 0 ? void 0 : M, H = U(c);
4707
4766
  Y(() => {
4708
- H.current = d;
4709
- }, [d]);
4767
+ H.current = c;
4768
+ }, [c]);
4710
4769
  const [K] = V(() => {
4711
4770
  let C = !1;
4712
4771
  return {
4713
4772
  convert: (N, z) => {
4714
4773
  const W = H.current;
4715
- return W === void 0 ? Promise.resolve(Qd) : W.convert(N, z);
4774
+ return W === void 0 ? Promise.resolve(lu) : W.convert(N, z);
4716
4775
  },
4717
4776
  prepare: () => {
4718
4777
  try {
@@ -4723,11 +4782,11 @@ const $d = () => {
4723
4782
  }
4724
4783
  }
4725
4784
  };
4726
- }), w = d === void 0 ? void 0 : K, k = X(
4785
+ }), w = c === void 0 ? void 0 : K, k = X(
4727
4786
  () => ({
4728
4787
  config: S,
4729
4788
  labels: v,
4730
- locale: h,
4789
+ locale: m,
4731
4790
  theme: g,
4732
4791
  storageNamespace: n,
4733
4792
  scope: e.scope,
@@ -4736,7 +4795,7 @@ const $d = () => {
4736
4795
  documents: R.documents,
4737
4796
  trees: R.trees,
4738
4797
  data: R.data,
4739
- viewSettings: m,
4798
+ viewSettings: h,
4740
4799
  treeSettings: q,
4741
4800
  announcer: p,
4742
4801
  reveals: x,
@@ -4746,88 +4805,92 @@ const $d = () => {
4746
4805
  renderTreeFailure: i,
4747
4806
  reportMathDiagnostics: P
4748
4807
  }),
4749
- [S, v, h, g, n, e.scope, e.sources, _, R, m, q, p, x, I, l, w, i, P]
4808
+ [S, v, m, g, n, e.scope, e.sources, _, R, h, q, p, x, I, l, w, i, P]
4750
4809
  );
4751
- return /* @__PURE__ */ c(ur, { value: k, children: /* @__PURE__ */ c(ru, { renderFrame: a, lockDocumentScroll: f }, e.scope) });
4752
- }, nu = ({ ref: e, theme: t, view: n, children: r }) => {
4753
- const [o] = V(gi);
4754
- return /* @__PURE__ */ c("div", { ref: e, className: "aqmx-root", "data-aqmx-theme": t, "data-aqmx-view": n, "data-testid": "markdown-explorer", onKeyDownCapture: o.onKeyDownCapture, onKeyUpCapture: o.onKeyUpCapture, onBlurCapture: o.onBlurCapture, children: r });
4755
- }, ru = ({ renderFrame: e, lockDocumentScroll: t }) => {
4756
- const { theme: n, labels: r } = $(), o = Ft(), { hash: s } = er(), a = ot(), i = U(null);
4757
- Ud(t, i), Y(() => {
4810
+ return /* @__PURE__ */ d(hr, { value: k, children: /* @__PURE__ */ d(fu, { renderFrame: a, lockDocumentScroll: f }, e.scope) });
4811
+ }, uu = ({ ref: e, theme: t, view: n, children: r }) => {
4812
+ const [o] = V(Ti);
4813
+ return /* @__PURE__ */ d("div", { ref: e, className: "aqmx-root", "data-aqmx-theme": t, "data-aqmx-view": n, "data-testid": "markdown-explorer", onKeyDownCapture: o.onKeyDownCapture, onKeyUpCapture: o.onKeyUpCapture, onBlurCapture: o.onBlurCapture, children: r });
4814
+ }, fu = ({ renderFrame: e, lockDocumentScroll: t }) => {
4815
+ const { theme: n, labels: r } = $(), o = Bt(), { hash: s } = rr(), a = at(), i = U(null);
4816
+ Yd(t, i), Y(() => {
4758
4817
  o.kind === "redirect" && a(`${o.href}${s}`, "browse");
4759
4818
  }, [o, s, a]);
4760
4819
  const { location: f } = o, u = f.view;
4761
- jd(i, u);
4762
- const l = f.view === "tree" ? /* @__PURE__ */ c(Ie, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...Lt }), children: /* @__PURE__ */ c(Vd, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ c(Ie, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading", ...Lt }), children: /* @__PURE__ */ c(Zd, { location: f }) }) : /* @__PURE__ */ c(Ed, { location: f }), d = /* @__PURE__ */ B(nu, { ref: i, theme: n, view: u, children: [
4820
+ Qd(i, u);
4821
+ const l = f.view === "tree" ? /* @__PURE__ */ d(Ie, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...At }), children: /* @__PURE__ */ d(eu, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ d(Ie, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading", ...At }), children: /* @__PURE__ */ d(tu, { location: f }) }) : /* @__PURE__ */ d(Ad, { location: f }), c = /* @__PURE__ */ B(uu, { ref: i, theme: n, view: u, children: [
4763
4822
  l,
4764
- /* @__PURE__ */ c(Ys, {}),
4765
- /* @__PURE__ */ c(Sd, { holds: !0, testId: "markdown-explorer-announcer" })
4823
+ /* @__PURE__ */ d(Qs, {}),
4824
+ /* @__PURE__ */ d(Nd, { holds: !0, testId: "markdown-explorer-announcer" })
4766
4825
  ] });
4767
- return e === void 0 ? d : e({ view: u, children: d });
4768
- }, Su = fs({ submissions: "skip", otherPath: "skip", query: "skip", hashChange: "skip" });
4826
+ return e === void 0 ? c : e({ view: u, children: c });
4827
+ }, Nu = ps({ submissions: "skip", otherPath: "skip", query: "skip", hashChange: "skip" });
4769
4828
  export {
4770
- Je as $,
4771
- ku as A,
4772
- Dt as B,
4773
- xs as C,
4774
- kd as D,
4775
- ed as E,
4776
- Bs as F,
4777
- mr as G,
4778
- sd as H,
4779
- od as I,
4780
- zn as J,
4781
- rd as K,
4829
+ od as $,
4830
+ Mu as A,
4831
+ It as B,
4832
+ Cs as C,
4833
+ Md as D,
4834
+ cd as E,
4835
+ zs as F,
4836
+ gr as G,
4837
+ hd as H,
4838
+ md as I,
4839
+ Zn as J,
4840
+ fd as K,
4782
4841
  qe as L,
4783
- vu as M,
4784
- bu as N,
4785
- vi as O,
4786
- yd as P,
4787
- Ds as Q,
4788
- kr as R,
4789
- ya as S,
4790
- yu as T,
4791
- xr as U,
4792
- Fc as V,
4793
- wa as W,
4794
- Kc as X,
4795
- ga as Y,
4796
- Ft as Z,
4797
- Sd as _,
4798
- Ts as a,
4799
- ms as a0,
4800
- hn as a1,
4801
- ws as a2,
4802
- cr as a3,
4803
- hs as a4,
4804
- fn as a5,
4805
- Eu as a6,
4806
- mn as a7,
4807
- Su as a8,
4808
- Rs as b,
4809
- Ut as c,
4810
- ka as d,
4811
- ot as e,
4812
- bc as f,
4813
- Xi as g,
4814
- Lt as h,
4815
- $c as i,
4816
- da as j,
4817
- Cs as k,
4818
- ha as l,
4819
- pa as m,
4820
- ca as n,
4842
+ Cu as M,
4843
+ Ou as N,
4844
+ Ci as O,
4845
+ Ld as P,
4846
+ $s as Q,
4847
+ xr as R,
4848
+ Sa as S,
4849
+ Lu as T,
4850
+ Cr as U,
4851
+ oi as V,
4852
+ si as W,
4853
+ Dt as X,
4854
+ hi as Y,
4855
+ Wc as Z,
4856
+ ya as _,
4857
+ Os as a,
4858
+ ba as a0,
4859
+ Bt as a1,
4860
+ Nd as a2,
4861
+ Qe as a3,
4862
+ gs as a4,
4863
+ gn as a5,
4864
+ ys as a6,
4865
+ fr as a7,
4866
+ ws as a8,
4867
+ hn as a9,
4868
+ Au as aa,
4869
+ pn as ab,
4870
+ Nu as ac,
4871
+ Ls as b,
4872
+ zt as c,
4873
+ xa as d,
4874
+ at as e,
4875
+ Oc as f,
4876
+ al as g,
4877
+ At as h,
4878
+ Vc as i,
4879
+ ma as j,
4880
+ Ms as k,
4881
+ wa as l,
4882
+ va as m,
4883
+ fa as n,
4821
4884
  de as o,
4822
4885
  ge as p,
4823
- ia as q,
4824
- zs as r,
4825
- la as s,
4886
+ da as q,
4887
+ Zs as r,
4888
+ ua as s,
4826
4889
  Re as t,
4827
4890
  $ as u,
4828
- ua as v,
4891
+ ha as v,
4829
4892
  Ce as w,
4830
- Gs as x,
4831
- nd as y,
4832
- wu as z
4893
+ Xs as x,
4894
+ ud as y,
4895
+ Ru as z
4833
4896
  };