@aiquants/markdown-explorer 0.4.0 → 0.6.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +30 -4
  3. package/dist/ExplorerSplit-CN5TvRj6.js +1495 -0
  4. package/dist/ExplorerSplit-CUIbSLQm.cjs +1 -0
  5. package/dist/MultiLayout-BDcQSpa6.cjs +1 -0
  6. package/dist/{MultiLayout-8s7q3-Hm.js → MultiLayout-hPmV-bae.js} +69 -66
  7. package/dist/{NativeScrollBar-DqkutcGb.cjs → NativeScrollBar-CHEQgaVx.cjs} +1 -1
  8. package/dist/{NativeScrollBar-D3VDRQqf.js → NativeScrollBar-DYEv2GLV.js} +1 -1
  9. package/dist/TreeLayout-BDaIyoGT.cjs +1 -0
  10. package/dist/TreeLayout-CqzxLpoM.js +23 -0
  11. package/dist/core/contracts.d.cts +23 -7
  12. package/dist/core/contracts.d.ts +23 -7
  13. package/dist/core/labels.d.cts +4 -0
  14. package/dist/core/labels.d.ts +4 -0
  15. package/dist/dataRoute-CUXlMhUJ.cjs +1 -0
  16. package/dist/{dataRoute-Dl6xmEFs.js → dataRoute-Ce6EIuu4.js} +69 -63
  17. package/dist/index-B3nShkkt.cjs +3 -0
  18. package/dist/{index-Dv9lUZqD.js → index-gJp1iXTc.js} +1020 -916
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +3 -3
  21. package/dist/{location-CaNtUswk.js → location-CtM94G0O.js} +1 -1
  22. package/dist/{location-2QZADLiv.cjs → location-FavgY_gB.cjs} +1 -1
  23. package/dist/sanitizeWorker.cjs +1 -1
  24. package/dist/sanitizeWorker.js +1 -1
  25. package/dist/server/errors.d.cts +1 -1
  26. package/dist/server/errors.d.ts +1 -1
  27. package/dist/server/ports.d.cts +1 -0
  28. package/dist/server/ports.d.ts +1 -0
  29. package/dist/server.cjs +1 -1
  30. package/dist/server.js +753 -716
  31. package/dist/styles/markdown-explorer.css +1 -1
  32. package/docs/behavior/dom-hooks.md +6 -3
  33. package/docs/behavior/layout.md +6 -0
  34. package/docs/behavior/localization.md +4 -1
  35. package/docs/behavior/security.md +11 -4
  36. package/docs/behavior/url-contract.md +1 -0
  37. package/package.json +4 -3
  38. package/dist/ExplorerSplit-rUVsf5i-.cjs +0 -1
  39. package/dist/ExplorerSplit-uX2ojZe8.js +0 -1479
  40. package/dist/MultiLayout-ZK2V9nms.cjs +0 -1
  41. package/dist/TreeLayout-C7ZNnaOr.js +0 -22
  42. package/dist/TreeLayout-DkTVgxxb.cjs +0 -1
  43. package/dist/dataRoute-DYjYBiXF.cjs +0 -1
  44. package/dist/index-CLe6vRXs.cjs +0 -3
@@ -1,19 +1,19 @@
1
- import { jsx as d, jsxs as U, Fragment as Bt } from "react/jsx-runtime";
1
+ import { jsx as c, jsxs as z, Fragment as wt } from "react/jsx-runtime";
2
2
  import * as x from "react";
3
- import { createContext as re, use as G, useMemo as H, useSyncExternalStore as ne, useCallback as P, useRef as j, useEffect as J, Suspense as fe, Component as zt, lazy as $e, useState as Z, useLayoutEffect as V, useEffectEvent as ee, useId as jt } from "react";
4
- import { useParams as Ht, useSearchParams as It, useNavigate as Zt, Link as Ut, useHref as we, useLocation as pt, useRevalidator as Vt } from "react-router";
5
- import { f as Gt, a as Wt, u as Kt, G as se, e as le, x as Yt, y as Xt, z as He, B as Jt, D as Ie, H as Qt, w as en, I as tn } from "./location-CaNtUswk.js";
6
- import { HostedScrollArea as Ze, useMarkdownToolbarState as nn, MarkdownViewer as wt } from "@aiquants/markdown";
7
- import { i as rn, v as vt, s as Y, q as on, w as Ue, x as ln, y as sn, z as an, f as cn, A as Ve, p as dn, t as un, B as fn, o as mn } from "./dataRoute-Dl6xmEFs.js";
8
- import { DEFAULT_CONTENT_ALIGN as gn } from "@aiquants/markdown/viewer-settings";
9
- import { w as hn, r as pn, a as wn, b as Ge, s as vn, c as bn } from "./storage-DA4ItHzl.js";
10
- const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
3
+ import { createContext as oe, use as J, useMemo as H, useSyncExternalStore as Q, useCallback as C, useRef as j, useEffect as ee, Suspense as we, Component as Vt, lazy as De, useState as Z, useLayoutEffect as G, useEffectEvent as ne, useId as Gt } from "react";
4
+ import { useParams as Wt, useSearchParams as Kt, useNavigate as Yt, Link as Xt, useHref as Se, useLocation as vt, useRevalidator as Jt } from "react-router";
5
+ import { f as Qt, a as en, u as tn, G as ue, e as le, x as nn, y as rn, z as Ze, B as on, D as Ue, H as ln, w as sn, I as an } from "./location-CtM94G0O.js";
6
+ import { HostedScrollArea as Ve, useMarkdownToolbarState as cn, MarkdownViewer as bt } from "@aiquants/markdown";
7
+ import { i as dn, v as Et, s as X, q as un, w as Ge, t as We, x as mn, y as fn, z as pn, A as hn, B as gn, f as wn, C as Ke, p as vn, F as bn, o as En } from "./dataRoute-Ce6EIuu4.js";
8
+ import { DEFAULT_CONTENT_ALIGN as Sn } from "@aiquants/markdown/viewer-settings";
9
+ import { w as kn, r as xn, a as yn, b as Ye, s as Rn, c as Tn } from "./storage-DA4ItHzl.js";
10
+ const Xe = Object.freeze(["en", "ja"]), An = "en", Ln = Object.freeze({
11
11
  panelMoved: Object.freeze(["title", "column", "position"]),
12
12
  panelMoveUnavailable: Object.freeze(["title", "move"]),
13
13
  panelDragStarted: Object.freeze(["title"]),
14
14
  panelDragCancelled: Object.freeze(["title"]),
15
15
  multiColumnRegion: Object.freeze(["column"])
16
- }), yn = /\{(\w+)\}/gu, bt = {
16
+ }), On = /\{(\w+)\}/gu, St = {
17
17
  explorerRegion: "Explorer",
18
18
  sourceLabel: "Source",
19
19
  refreshTreeLabel: "Refresh tree",
@@ -25,6 +25,9 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
25
25
  refreshDocumentNamed: (e) => `Refresh ${e}`,
26
26
  documentRefreshed: (e) => `Reloaded ${e}`,
27
27
  documentRefreshFailed: (e) => `Could not reload the document: ${e}`,
28
+ showMarkupLabel: "Source",
29
+ showMarkup: "Show the document's Markdown as written",
30
+ showMarkupNamed: (e) => `Source of ${e}`,
28
31
  expandAll: "Expand all folders",
29
32
  collapseAll: "Collapse all folders",
30
33
  treeSettings: "Tree settings",
@@ -89,6 +92,7 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
89
92
  documentRegion: "Document",
90
93
  documentEmpty: "Select a document in the explorer.",
91
94
  documentLoading: "Loading the document…",
95
+ markupLoading: "Loading the source…",
92
96
  documentShown: (e) => `Showing ${e}`,
93
97
  documentFailed: (e, t) => `${e}: ${t}`,
94
98
  announcementSequence: (e) => e.map((t) => /[.!?]$/u.test(t) ? t : `${t}.`).join(" "),
@@ -185,7 +189,7 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
185
189
  multiColumnEmpty: "This column is empty",
186
190
  multiColumnRegion: "Column {column}",
187
191
  panelDropHere: "Drop the panel here"
188
- }, xn = {
192
+ }, Mn = {
189
193
  explorerRegion: "エクスプローラー",
190
194
  sourceLabel: "ソース",
191
195
  refreshTreeLabel: "ツリーを更新",
@@ -197,6 +201,9 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
197
201
  refreshDocumentNamed: (e) => `${e} を更新`,
198
202
  documentRefreshed: (e) => `${e} を読み込み直しました`,
199
203
  documentRefreshFailed: (e) => `文書を読み込み直せませんでした: ${e}`,
204
+ showMarkupLabel: "ソース",
205
+ showMarkup: "文書の Markdown を書いたまま表示",
206
+ showMarkupNamed: (e) => `${e} のソース`,
200
207
  expandAll: "すべてのフォルダーを展開",
201
208
  collapseAll: "すべてのフォルダーを折りたたむ",
202
209
  treeSettings: "ツリーの設定",
@@ -261,6 +268,7 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
261
268
  documentRegion: "文書",
262
269
  documentEmpty: "エクスプローラーで文書を選んでください。",
263
270
  documentLoading: "文書を読み込み中…",
271
+ markupLoading: "ソースを読み込み中…",
264
272
  documentShown: (e) => `${e} を表示しています`,
265
273
  documentFailed: (e, t) => `${e}: ${t}`,
266
274
  announcementSequence: (e) => e.map((t) => /[。!?]$/u.test(t) ? t : `${t}。`).join(""),
@@ -357,61 +365,61 @@ const We = Object.freeze(["en", "ja"]), En = "en", Sn = Object.freeze({
357
365
  multiColumnEmpty: "この列は空です",
358
366
  multiColumnRegion: "{column} 列目",
359
367
  panelDropHere: "ここへパネルをドロップ"
360
- }, kn = Object.freeze({
361
- en: Object.freeze(bt),
362
- ja: Object.freeze(xn)
363
- }), Et = Object.freeze(Object.keys(bt)), Rn = new Set(Et), Tn = (e) => Rn.has(e), de = (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, St = (e) => {
364
- if (e === void 0) return En;
365
- if (We.includes(e)) return e;
366
- throw new RangeError(`[markdown-explorer] locale is the UI language (${We.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${de(e)}`);
367
- }, Ke = (e, t) => {
368
- const n = kn[St(e)];
368
+ }, Cn = Object.freeze({
369
+ en: Object.freeze(St),
370
+ ja: Object.freeze(Mn)
371
+ }), kt = Object.freeze(Object.keys(St)), Nn = new Set(kt), Pn = (e) => Nn.has(e), he = (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, xt = (e) => {
372
+ if (e === void 0) return An;
373
+ if (Xe.includes(e)) return e;
374
+ throw new RangeError(`[markdown-explorer] locale is the UI language (${Xe.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${he(e)}`);
375
+ }, Je = (e, t) => {
376
+ const n = Cn[xt(e)];
369
377
  if (t === void 0) return n;
370
378
  if (t === null || typeof t != "object")
371
- throw new RangeError(`[markdown-explorer] labels must be an object; got ${de(t)}`);
372
- if (!Gt(t))
373
- throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${de(t)}`);
379
+ throw new RangeError(`[markdown-explorer] labels must be an object; got ${he(t)}`);
380
+ if (!Qt(t))
381
+ throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${he(t)}`);
374
382
  const r = t, o = { ...n };
375
383
  for (const l of Object.keys(r)) {
376
- if (!Tn(l))
377
- throw new RangeError(`[markdown-explorer] labels.${l} is not a known label key; expected one of ${Et.join(", ")}`);
384
+ if (!Pn(l))
385
+ throw new RangeError(`[markdown-explorer] labels.${l} is not a known label key; expected one of ${kt.join(", ")}`);
378
386
  const s = r[l];
379
387
  if (s === void 0) continue;
380
- const a = typeof n[l];
381
- if (typeof s !== a)
382
- throw new TypeError(`[markdown-explorer] labels.${l} must be a ${a}; got ${de(s)}`);
388
+ const i = typeof n[l];
389
+ if (typeof s !== i)
390
+ throw new TypeError(`[markdown-explorer] labels.${l} must be a ${i}; got ${he(s)}`);
383
391
  if (typeof s == "string" && s.trim() === "")
384
392
  throw new RangeError(`[markdown-explorer] labels.${l} must be a non-blank string`);
385
- const f = Sn[l];
386
- if (typeof s == "string" && f !== void 0) {
387
- for (const [, h] of s.matchAll(yn))
388
- if (!f.includes(h ?? ""))
389
- throw new RangeError(`[markdown-explorer] labels.${l} uses the unknown placeholder {${String(h)}}; it accepts ${f.map((m) => `{${m}}`).join(", ")}`);
393
+ const d = Ln[l];
394
+ if (typeof s == "string" && d !== void 0) {
395
+ for (const [, u] of s.matchAll(On))
396
+ if (!d.includes(u ?? ""))
397
+ throw new RangeError(`[markdown-explorer] labels.${l} uses the unknown placeholder {${String(u)}}; it accepts ${d.map((p) => `{${p}}`).join(", ")}`);
390
398
  }
391
399
  o[l] = s;
392
400
  }
393
401
  return Object.freeze(o);
394
- }, An = (e, t) => {
402
+ }, $n = (e, t) => {
395
403
  if (Object.is(e, t)) return !0;
396
404
  if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
397
405
  const n = e, r = t, o = Object.keys(n), l = Object.keys(r);
398
406
  return o.length === l.length && l.every((s) => Object.hasOwn(n, s) && Object.is(n[s], r[s]));
399
- }, Ye = Object.freeze(["light", "dark"]), On = (e) => {
407
+ }, Qe = Object.freeze(["light", "dark"]), Fn = (e) => {
400
408
  if (e === void 0) return "light";
401
- if (Ye.includes(e)) return e;
402
- throw new RangeError(`[markdown-explorer] theme must be ${Ye.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
403
- }, yt = re(null), D = () => {
404
- const e = G(yt);
409
+ if (Qe.includes(e)) return e;
410
+ throw new RangeError(`[markdown-explorer] theme must be ${Qe.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
411
+ }, yt = oe(null), P = () => {
412
+ const e = J(yt);
405
413
  if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
406
414
  return e;
407
- }, me = (e) => {
408
- const { viewSettings: t } = D(), n = () => e(t.getSnapshot());
409
- return ne(t.subscribe, n, n);
410
- }, De = () => {
411
- const { config: e } = D(), t = Ht()["*"], [n] = It(), r = n.toString();
412
- return H(() => Wt(e, t, new URLSearchParams(r)), [e, t, r]);
415
+ }, ve = (e) => {
416
+ const { viewSettings: t } = P(), n = () => e(t.getSnapshot());
417
+ return Q(t.subscribe, n, n);
418
+ }, qe = () => {
419
+ const { config: e } = P(), t = Wt()["*"], [n] = Kt(), r = n.toString();
420
+ return H(() => en(e, t, new URLSearchParams(r)), [e, t, r]);
413
421
  };
414
- function Ln({
422
+ function Dn({
415
423
  title: e,
416
424
  titleId: t,
417
425
  ...n
@@ -432,20 +440,20 @@ function Ln({
432
440
  clipRule: "evenodd"
433
441
  }));
434
442
  }
435
- const Cn = /* @__PURE__ */ x.forwardRef(Ln), Fe = Object.freeze({
443
+ const qn = /* @__PURE__ */ x.forwardRef(Dn), _e = Object.freeze({
436
444
  browse: Object.freeze({ replace: !0, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
437
445
  "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
438
446
  "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
439
447
  "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
440
- }), Jo = (e) => Fe[e], _e = () => {
441
- const e = Zt();
442
- return P(
448
+ }), al = (e) => _e[e], Be = () => {
449
+ const e = Yt();
450
+ return C(
443
451
  (t, n) => {
444
- e(t, Fe[n]);
452
+ e(t, _e[n]);
445
453
  },
446
454
  [e]
447
455
  );
448
- }, Mn = ({ navigation: e, ...t }) => /* @__PURE__ */ d(Ut, { ...t, ...Fe[e] }), xt = {
456
+ }, _n = ({ navigation: e, ...t }) => /* @__PURE__ */ c(Xt, { ...t, ..._e[e] }), Rt = {
449
457
  unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
450
458
  forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
451
459
  "not-found": ["failureNotFoundTitle", "failureNotFoundBody"],
@@ -454,14 +462,14 @@ const Cn = /* @__PURE__ */ x.forwardRef(Ln), Fe = Object.freeze({
454
462
  "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
455
463
  unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
456
464
  failed: ["failureFailedTitle", "failureFailedBody"]
457
- }, ve = (e, t) => e[xt[t][0]], Nn = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
458
- const { labels: o } = D(), l = ve(o, e.reason), s = o[xt[e.reason][1]], a = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
459
- return /* @__PURE__ */ U("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": a, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
460
- /* @__PURE__ */ d("p", { className: "aqmx-callout-title", children: l }),
461
- /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: s }),
462
- 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
465
+ }, ae = (e, t) => e[Rt[t][0]], Tt = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
466
+ const { labels: o } = P(), l = ae(o, e.reason), s = o[Rt[e.reason][1]], i = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
467
+ return /* @__PURE__ */ z("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: [
468
+ /* @__PURE__ */ c("p", { className: "aqmx-callout-title", children: l }),
469
+ /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: s }),
470
+ 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
463
471
  ] });
464
- }, kt = (e) => {
472
+ }, At = (e) => {
465
473
  const t = e.ownerDocument;
466
474
  if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
467
475
  if (e.hasAttribute("tabindex")) return !1;
@@ -471,53 +479,53 @@ const Cn = /* @__PURE__ */ x.forwardRef(Ln), Fe = Object.freeze({
471
479
  t.activeElement !== e && (e.removeAttribute("tabindex"), e.removeEventListener("blur", n));
472
480
  };
473
481
  return e.addEventListener("blur", n), !0;
474
- }, Pn = (e, t) => {
475
- const n = j(null), r = j(null), o = j(null), l = P(() => {
482
+ }, Bn = (e, t) => {
483
+ const n = j(null), r = j(null), o = j(null), l = C(() => {
476
484
  n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
477
485
  }, []);
478
- J(() => l, [l]);
479
- const s = P(
480
- (h) => {
481
- if (r.current !== h) return;
482
- const m = o.current;
483
- if (m !== null) {
484
- m.then(() => s(h));
486
+ ee(() => l, [l]);
487
+ const s = C(
488
+ (u) => {
489
+ if (r.current !== u) return;
490
+ const p = o.current;
491
+ if (p !== null) {
492
+ p.then(() => s(u));
485
493
  return;
486
494
  }
487
- e.prefetch(h);
488
- const g = e.peek(h);
489
- if (g?.status !== "pending") return;
490
- const b = Promise.allSettled([g.promise]);
495
+ e.prefetch(u);
496
+ const h = e.peek(u);
497
+ if (h?.status !== "pending") return;
498
+ const b = Promise.allSettled([h.promise]);
491
499
  o.current = b, b.then(() => {
492
500
  o.current === b && (o.current = null);
493
501
  });
494
502
  },
495
503
  [e]
496
- ), a = P(
497
- (h) => {
498
- const m = t(h);
499
- m !== r.current && (l(), m !== null && (r.current = m, n.current = window.setTimeout(() => {
500
- n.current = null, s(m);
501
- }, Kt)));
504
+ ), i = C(
505
+ (u) => {
506
+ const p = t(u);
507
+ p !== r.current && (l(), p !== null && (r.current = p, n.current = window.setTimeout(() => {
508
+ n.current = null, s(p);
509
+ }, tn)));
502
510
  },
503
511
  [l, t, s]
504
- ), f = P(
505
- (h) => {
506
- t(h) !== r.current && l();
512
+ ), d = C(
513
+ (u) => {
514
+ t(u) !== r.current && l();
507
515
  },
508
516
  [l, t]
509
517
  );
510
518
  return H(
511
519
  () => ({
512
- onPointerOver: (h) => a(h.target),
513
- onPointerOut: (h) => f(h.relatedTarget),
514
- onFocus: (h) => a(h.target),
515
- onBlur: (h) => f(h.relatedTarget)
520
+ onPointerOver: (u) => i(u.target),
521
+ onPointerOut: (u) => d(u.relatedTarget),
522
+ onFocus: (u) => i(u.target),
523
+ onBlur: (u) => d(u.relatedTarget)
516
524
  }),
517
- [a, f]
525
+ [i, d]
518
526
  );
519
- }, $n = $e(() => import("./NativeScrollBar-D3VDRQqf.js").then((e) => ({ default: e.NativeScrollBar })));
520
- class Dn extends zt {
527
+ }, jn = De(() => import("./NativeScrollBar-DYEv2GLV.js").then((e) => ({ default: e.NativeScrollBar })));
528
+ class zn extends Vt {
521
529
  state = { failed: !1 };
522
530
  static getDerivedStateFromError() {
523
531
  return { failed: !0 };
@@ -529,7 +537,7 @@ class Dn extends zt {
529
537
  return this.state.failed ? null : this.props.children;
530
538
  }
531
539
  }
532
- const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children: /* @__PURE__ */ d(fe, { fallback: null, children: /* @__PURE__ */ d($n, { scroller: e, withCircle: t }) }) }), Rt = (e) => /* @__PURE__ */ d(Fn, { scroller: e, withCircle: !0 }), be = () => {
540
+ const Hn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ c(zn, { children: /* @__PURE__ */ c(we, { fallback: null, children: /* @__PURE__ */ c(jn, { scroller: e, withCircle: t }) }) }), Lt = (e) => /* @__PURE__ */ c(Hn, { scroller: e, withCircle: !0 }), ce = () => {
533
541
  const e = /* @__PURE__ */ new Set();
534
542
  return {
535
543
  subscribe: (t) => (e.add(t), () => {
@@ -539,7 +547,7 @@ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children:
539
547
  for (const t of [...e]) t();
540
548
  }
541
549
  };
542
- }, Tt = () => {
550
+ }, Ot = () => {
543
551
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
544
552
  let n = !1;
545
553
  const r = (o) => {
@@ -566,14 +574,14 @@ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children:
566
574
  resumes: (o) => t.delete(o),
567
575
  heldKeys: () => [...e.keys()]
568
576
  };
569
- }, ge = (e, t) => {
577
+ }, be = (e, t) => {
570
578
  if (Object.is(e, t)) return !0;
571
579
  if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
572
580
  if (Array.isArray(e) || Array.isArray(t))
573
- return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((l, s) => ge(l, t[s]));
581
+ return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((l, s) => be(l, t[s]));
574
582
  const n = e, r = t, o = Object.keys(n);
575
- return o.length !== Object.keys(r).length ? !1 : o.every((l) => Object.hasOwn(r, l) && ge(n[l], r[l]));
576
- }, ie = (e) => {
583
+ return o.length !== Object.keys(r).length ? !1 : o.every((l) => Object.hasOwn(r, l) && be(n[l], r[l]));
584
+ }, se = (e) => {
577
585
  const t = e;
578
586
  return t.status === void 0 && (t.status = "pending", e.then(
579
587
  (n) => {
@@ -583,126 +591,126 @@ const Fn = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ d(Dn, { children:
583
591
  t.status = "rejected", t.reason = n;
584
592
  }
585
593
  )), t;
586
- }, At = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), ae = (e) => e.status === "fulfilled" ? e.value : void 0, _n = 55e3, Xe = Object.freeze({ status: "deferred" }), Je = Object.freeze({ status: "refreshed" }), Ae = Object.freeze({ status: "superseded" }), he = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, Ot = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", qn = ({ client: e, capacity: t }) => {
594
+ }, Mt = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), me = (e) => e.status === "fulfilled" ? e.value : void 0, In = 55e3, et = Object.freeze({ status: "deferred" }), tt = Object.freeze({ status: "refreshed" }), Le = Object.freeze({ status: "superseded" }), ie = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, Ct = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", Zn = ({ client: e, capacity: t }) => {
587
595
  if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
588
- const n = /* @__PURE__ */ new Map(), r = Tt(), o = be(), l = /* @__PURE__ */ new WeakSet();
596
+ const n = /* @__PURE__ */ new Map(), r = Ot(), o = ce(), l = /* @__PURE__ */ new WeakSet();
589
597
  let s = 0;
590
- const a = o.emit, f = () => (s += 1, s), h = () => {
598
+ const i = o.emit, d = () => (s += 1, s), u = () => {
591
599
  if (!(n.size <= t))
592
- for (const u of [...n.keys()]) {
600
+ for (const m of [...n.keys()]) {
593
601
  if (n.size <= t) return;
594
- r.isHeld(u) || n.delete(u);
602
+ r.isHeld(m) || n.delete(m);
595
603
  }
596
- }, m = (u, p) => {
597
- n.delete(u), n.set(u, p);
598
- }, g = (u) => performance.now() - u.validatedAt >= _n, b = (u, p, S) => {
599
- const E = n.get(u), y = he(E?.snapshot), $ = S || E?.refreshPending === !0, I = ie(e.document(u, { refresh: $ }).then((B) => ({ status: "loaded", document: B }))), C = { snapshot: { status: "pending", promise: I, previous: y }, validatedAt: performance.now(), opened: p, background: null, refreshPending: !1, seeded: void 0, stamp: f() };
600
- return m(u, C), h(), I.then((B) => {
601
- n.get(u) === C && (C.snapshot = B, C.stamp = f(), a());
602
- }), C;
603
- }, R = (u, p, S, E, y, $) => {
604
- p.background === S && (p.background = null, !(n.get(u) !== p || p.snapshot !== E) && (y.kind === "failure" && E.document.kind !== "failure" || (p.validatedAt = $, p.stamp = f(), ge(E.document, y) || (p.snapshot = { status: "loaded", document: y }), a())));
605
- }, k = async (u, p) => {
606
- const S = p.snapshot;
604
+ }, p = (m, w) => {
605
+ n.delete(m), n.set(m, w);
606
+ }, h = (m) => performance.now() - m.validatedAt >= In, b = (m, w, S) => {
607
+ const E = n.get(m), R = ie(E?.snapshot), F = S || E?.refreshPending === !0, I = se(e.document(m, { refresh: F }).then((B) => ({ status: "loaded", document: B }))), N = { snapshot: { status: "pending", promise: I, previous: R }, validatedAt: performance.now(), opened: w, background: null, refreshPending: !1, seeded: void 0, stamp: d() };
608
+ return p(m, N), u(), I.then((B) => {
609
+ n.get(m) === N && (N.snapshot = B, N.stamp = d(), i());
610
+ }), N;
611
+ }, T = (m, w, S, E, R, F) => {
612
+ w.background === S && (w.background = null, !(n.get(m) !== w || w.snapshot !== E) && (R.kind === "failure" && E.document.kind !== "failure" || (w.validatedAt = F, w.stamp = d(), be(E.document, R) || (w.snapshot = { status: "loaded", document: R }), i())));
613
+ }, y = async (m, w) => {
614
+ const S = w.snapshot;
607
615
  if (S.status !== "loaded") return null;
608
616
  const E = {};
609
- p.background = E;
610
- const y = performance.now(), $ = e.document(u, { refresh: p.refreshPending });
611
- p.refreshPending = !1;
612
- const I = await $, C = p.background === E && n.get(u) === p && p.snapshot === S;
613
- return R(u, p, E, S, I, y), C ? I : null;
614
- }, A = (u, p) => {
615
- const { snapshot: S } = p;
616
- return S.status === "pending" ? !1 : S.status === "loaded" && S.document.kind !== "failure" ? (k(u, p), !1) : (S.status === "loaded" && l.add(S), b(u, !0, !1), !0);
617
- }, T = (u) => {
618
- const p = r.hold(u);
617
+ w.background = E;
618
+ const R = performance.now(), F = e.document(m, { refresh: w.refreshPending });
619
+ w.refreshPending = !1;
620
+ const I = await F, N = w.background === E && n.get(m) === w && w.snapshot === S;
621
+ return T(m, w, E, S, I, R), N ? I : null;
622
+ }, L = (m, w) => {
623
+ const { snapshot: S } = w;
624
+ return S.status === "pending" ? !1 : S.status === "loaded" && S.document.kind !== "failure" ? (y(m, w), !1) : (S.status === "loaded" && l.add(S), b(m, !0, !1), !0);
625
+ }, k = (m) => {
626
+ const w = r.hold(m);
619
627
  let S = !1;
620
628
  return () => {
621
629
  if (S) return;
622
- S = !0, p();
623
- const E = n.get(u);
624
- E !== void 0 && m(u, E), h();
630
+ S = !0, w();
631
+ const E = n.get(m);
632
+ E !== void 0 && p(m, E), u();
625
633
  };
626
634
  };
627
635
  return {
628
- peek: (u) => n.get(u)?.snapshot,
629
- peekSeeded: (u) => n.get(u)?.seeded,
630
- answerStampOf: (u) => n.get(u)?.stamp,
631
- prefetch: (u) => {
632
- const p = n.get(u);
633
- p !== void 0 && p.snapshot.status !== "deferred" || (b(u, !1, !1), a());
636
+ peek: (m) => n.get(m)?.snapshot,
637
+ peekSeeded: (m) => n.get(m)?.seeded,
638
+ answerStampOf: (m) => n.get(m)?.stamp,
639
+ prefetch: (m) => {
640
+ const w = n.get(m);
641
+ w !== void 0 && w.snapshot.status !== "deferred" || (b(m, !1, !1), i());
634
642
  },
635
- open: (u) => {
636
- const p = r.resumes(u), S = T(u), E = n.get(u);
643
+ open: (m) => {
644
+ const w = r.resumes(m), S = k(m), E = n.get(m);
637
645
  if (E === void 0 || E.snapshot.status === "deferred")
638
- return b(u, !0, !1), a(), S;
639
- if (m(u, E), p) return S;
640
- const { snapshot: y } = E;
641
- return y.status === "pending" ? (E.opened = !0, S) : y.document.kind === "failure" ? (E.opened || g(E) ? (l.add(y), b(u, !0, !1), a()) : E.opened = !0, S) : (E.opened = !0, E.background === null && g(E) && k(u, E), S);
646
+ return b(m, !0, !1), i(), S;
647
+ if (p(m, E), w) return S;
648
+ const { snapshot: R } = E;
649
+ return R.status === "pending" ? (E.opened = !0, S) : R.document.kind === "failure" ? (E.opened || h(E) ? (l.add(R), b(m, !0, !1), i()) : E.opened = !0, S) : (E.opened = !0, E.background === null && h(E) && y(m, E), S);
642
650
  },
643
- retain: T,
644
- retry: (u) => {
645
- const p = n.get(u);
646
- p === void 0 || p.snapshot.status !== "loaded" || p.snapshot.document.kind !== "failure" || (b(u, !0, !1), a());
651
+ retain: k,
652
+ retry: (m) => {
653
+ const w = n.get(m);
654
+ w === void 0 || w.snapshot.status !== "loaded" || w.snapshot.document.kind !== "failure" || (b(m, !0, !1), i());
647
655
  },
648
- seed: (u, p) => {
649
- const S = performance.now(), E = ie(
650
- p.then(
651
- (B) => B === null ? Xe : { status: "loaded", document: B },
652
- () => Xe
656
+ seed: (m, w) => {
657
+ const S = performance.now(), E = se(
658
+ w.then(
659
+ (B) => B === null ? et : { status: "loaded", document: B },
660
+ () => et
653
661
  )
654
- ), y = n.get(u);
655
- if (y !== void 0 && y.snapshot.status === "loaded") {
656
- const B = y.snapshot, M = {};
657
- y.background = M, E.then((_) => {
658
- if (_.status === "loaded") {
659
- R(u, y, M, B, _.document, S);
662
+ ), R = n.get(m);
663
+ if (R !== void 0 && R.snapshot.status === "loaded") {
664
+ const B = R.snapshot, W = {};
665
+ R.background = W, E.then((U) => {
666
+ if (U.status === "loaded") {
667
+ T(m, R, W, B, U.document, S);
660
668
  return;
661
669
  }
662
- y.background === M && (y.background = null);
670
+ R.background === W && (R.background = null);
663
671
  });
664
672
  return;
665
673
  }
666
- const $ = y !== void 0 && y.snapshot.status === "pending" ? y.snapshot.previous : null, I = { status: "pending", promise: E, previous: $ }, C = { snapshot: I, validatedAt: S, opened: y?.opened === !0, background: null, refreshPending: y?.refreshPending === !0, seeded: I, stamp: f() };
667
- m(u, C), h(), E.then((B) => {
668
- n.get(u) === C && (B.status === "deferred" && r.isHeld(u) ? b(u, C.opened, !1) : (C.snapshot = B, C.stamp = f()), a());
674
+ const F = R !== void 0 && R.snapshot.status === "pending" ? R.snapshot.previous : null, I = { status: "pending", promise: E, previous: F }, N = { snapshot: I, validatedAt: S, opened: R?.opened === !0, background: null, refreshPending: R?.refreshPending === !0, seeded: I, stamp: d() };
675
+ p(m, N), u(), E.then((B) => {
676
+ n.get(m) === N && (B.status === "deferred" && r.isHeld(m) ? b(m, N.opened, !1) : (N.snapshot = B, N.stamp = d()), i());
669
677
  });
670
678
  },
671
679
  invalidate: () => {
672
- let u = !1;
673
- for (const [p, S] of [...n]) {
674
- if (S.validatedAt = Number.NEGATIVE_INFINITY, S.opened = !0, S.refreshPending = !0, !r.isHeld(p)) continue;
680
+ let m = !1;
681
+ for (const [w, S] of [...n]) {
682
+ if (S.validatedAt = Number.NEGATIVE_INFINITY, S.opened = !0, S.refreshPending = !0, !r.isHeld(w)) continue;
675
683
  const { snapshot: E } = S;
676
684
  if (E.status !== "pending") {
677
- A(p, S) && (u = !0);
685
+ L(w, S) && (m = !0);
678
686
  continue;
679
687
  }
680
688
  E.promise.then(() => {
681
- n.get(p) === S && S.refreshPending && r.isHeld(p) && A(p, S) && a();
689
+ n.get(w) === S && S.refreshPending && r.isHeld(w) && L(w, S) && i();
682
690
  });
683
691
  }
684
- u && a();
692
+ m && i();
685
693
  },
686
- refresh: async (u) => {
687
- const p = n.get(u);
688
- if (p !== void 0 && Ot(p.snapshot)) {
689
- p.refreshPending = !0;
690
- const E = await k(u, p);
691
- return E === null ? Ae : E.kind === "failure" ? { status: "failed", failure: E.failure } : Je;
694
+ refresh: async (m) => {
695
+ const w = n.get(m);
696
+ if (w !== void 0 && Ct(w.snapshot)) {
697
+ w.refreshPending = !0;
698
+ const E = await y(m, w);
699
+ return E === null ? Le : E.kind === "failure" ? { status: "failed", failure: E.failure } : tt;
692
700
  }
693
- const S = b(u, !0, !0);
694
- return a(), S.snapshot.status !== "pending" ? Ae : (await S.snapshot.promise, n.get(u) === S ? Je : Ae);
701
+ const S = b(m, !0, !0);
702
+ return i(), S.snapshot.status !== "pending" ? Le : (await S.snapshot.promise, n.get(m) === S ? tt : Le);
695
703
  },
696
704
  clear: () => {
697
705
  n.clear();
698
- for (const u of r.heldKeys()) b(u, !0, !1);
699
- a();
706
+ for (const m of r.heldKeys()) b(m, !0, !1);
707
+ i();
700
708
  },
701
709
  subscribe: o.subscribe,
702
- noteFailureShown: (u) => l.has(u) ? !1 : (l.add(u), !0)
710
+ noteFailureShown: (m) => l.has(m) ? !1 : (l.add(m), !0)
703
711
  };
704
- }, pe = re("fill"), Bn = Object.freeze({ blockSize: "100%" }), Ee = ({ scrollerProps: e, children: t }) => G(pe) === "content" ? /* @__PURE__ */ d(Ze, { scrollerProps: e, children: t }) : /* @__PURE__ */ d(Ze, { scrollerProps: { ...e, style: Bn }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: Rt, children: t });
705
- function zn({
712
+ }, Ee = oe("fill"), Un = Object.freeze({ blockSize: "100%" }), de = ({ scrollerProps: e, children: t }) => J(Ee) === "content" ? /* @__PURE__ */ c(Ve, { scrollerProps: e, children: t }) : /* @__PURE__ */ c(Ve, { scrollerProps: { ...e, style: Un }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: Lt, children: t });
713
+ function Vn({
706
714
  title: e,
707
715
  titleId: t,
708
716
  ...n
@@ -723,8 +731,8 @@ function zn({
723
731
  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"
724
732
  }));
725
733
  }
726
- const jn = /* @__PURE__ */ x.forwardRef(zn);
727
- function Hn({
734
+ const Gn = /* @__PURE__ */ x.forwardRef(Vn);
735
+ function Wn({
728
736
  title: e,
729
737
  titleId: t,
730
738
  ...n
@@ -749,17 +757,17 @@ function Hn({
749
757
  clipRule: "evenodd"
750
758
  }));
751
759
  }
752
- const In = /* @__PURE__ */ x.forwardRef(Hn), Se = ({ name: e, url: t, icon: n, children: r }) => {
753
- const { labels: o } = D();
754
- return /* @__PURE__ */ U("div", { className: "aqmx-document-toolbar", children: [
755
- /* @__PURE__ */ d("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: n }),
756
- /* @__PURE__ */ d("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
760
+ const Kn = /* @__PURE__ */ x.forwardRef(Wn), ke = ({ name: e, url: t, icon: n, children: r }) => {
761
+ const { labels: o } = P();
762
+ return /* @__PURE__ */ z("div", { className: "aqmx-document-toolbar", children: [
763
+ /* @__PURE__ */ c("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: n }),
764
+ /* @__PURE__ */ c("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
757
765
  r,
758
- /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": o.openInNewTab, title: o.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ d(In, {}) }),
759
- /* @__PURE__ */ d("a", { className: "aqmx-icon-button", href: t, download: e, "aria-label": o.download, title: o.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ d(jn, {}) })
766
+ /* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": o.openInNewTab, title: o.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ c(Kn, {}) }),
767
+ /* @__PURE__ */ c("a", { className: "aqmx-icon-button", href: t, download: e, "aria-label": o.download, title: o.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ c(Gn, {}) })
760
768
  ] });
761
769
  };
762
- function Zn({
770
+ function Yn({
763
771
  title: e,
764
772
  titleId: t,
765
773
  ...n
@@ -780,45 +788,45 @@ function Zn({
780
788
  clipRule: "evenodd"
781
789
  }));
782
790
  }
783
- const Un = /* @__PURE__ */ x.forwardRef(Zn), Vn = Object.freeze({ className: "aqmx-document-stage" }), Gn = ({ document: e }) => {
784
- const { labels: t } = D();
785
- return /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
786
- /* @__PURE__ */ d(Se, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(Un, {}) }),
787
- /* @__PURE__ */ d(Ee, { scrollerProps: Vn, children: /* @__PURE__ */ U("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
788
- /* @__PURE__ */ d("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
789
- /* @__PURE__ */ d("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
791
+ const Xn = /* @__PURE__ */ x.forwardRef(Yn), Jn = Object.freeze({ className: "aqmx-document-stage" }), Qn = ({ document: e }) => {
792
+ const { labels: t } = P();
793
+ return /* @__PURE__ */ z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
794
+ /* @__PURE__ */ c(ke, { name: e.name, url: e.url, icon: /* @__PURE__ */ c(Xn, {}) }),
795
+ /* @__PURE__ */ c(de, { scrollerProps: Jn, children: /* @__PURE__ */ z("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
796
+ /* @__PURE__ */ c("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
797
+ /* @__PURE__ */ c("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
790
798
  ] }) })
791
799
  ] });
792
- }, qe = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", Wn = (e) => {
800
+ }, je = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", er = (e) => {
793
801
  const t = e.indexOf("#");
794
802
  return t === -1 ? "" : e.slice(t);
795
- }, Kn = /(%[0-9A-Fa-f]{2})/u, Be = (e) => {
803
+ }, tr = /(%[0-9A-Fa-f]{2})/u, ze = (e) => {
796
804
  if (!e.startsWith("#") || e.length === 1) return null;
797
- const t = new TextEncoder(), n = e.slice(1).split(Kn).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
805
+ const t = new TextEncoder(), n = e.slice(1).split(tr).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
798
806
  return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
799
- }, Lt = (e) => `#${encodeURIComponent(e)}`, Yn = (e) => {
807
+ }, Nt = (e) => `#${encodeURIComponent(e)}`, nr = (e) => {
800
808
  if (e === "#") return !0;
801
- const t = Be(e);
809
+ const t = ze(e);
802
810
  return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
803
- }, Ct = (e, t) => {
811
+ }, Pt = (e, t) => {
804
812
  if (t === "") return null;
805
813
  for (const n of e.querySelectorAll("[id]"))
806
814
  if (n.id === t) return n;
807
815
  return null;
808
- }, Xn = "http://www.w3.org/1999/xhtml", Qe = (e, t) => {
816
+ }, rr = "http://www.w3.org/1999/xhtml", nt = (e, t) => {
809
817
  if (t === "") return null;
810
- const n = Ct(e, t);
818
+ const n = Pt(e, t);
811
819
  if (n !== null) return n;
812
820
  for (const r of e.querySelectorAll("a[name]"))
813
- if (r.localName === "a" && r.namespaceURI === Xn && r.getAttribute("name") === t) return r;
821
+ if (r.localName === "a" && r.namespaceURI === rr && r.getAttribute("name") === t) return r;
814
822
  return null;
815
- }, Mt = (e, t) => {
823
+ }, $t = (e, t) => {
816
824
  if (e === null || !t.startsWith("#")) return null;
817
- const n = Qe(e, t.slice(1));
825
+ const n = nt(e, t.slice(1));
818
826
  if (n !== null) return n;
819
- const r = Be(t);
820
- return r === null ? null : Qe(e, r);
821
- }, et = (e) => {
827
+ const r = ze(t);
828
+ return r === null ? null : nt(e, r);
829
+ }, rt = (e) => {
822
830
  const { body: t, documentElement: n } = e.ownerDocument;
823
831
  if (e === t) {
824
832
  const o = getComputedStyle(n);
@@ -826,22 +834,22 @@ const Un = /* @__PURE__ */ x.forwardRef(Zn), Vn = Object.freeze({ className: "aq
826
834
  }
827
835
  const { overflowY: r } = getComputedStyle(e);
828
836
  return r === "auto" || r === "scroll";
829
- }, Jn = (e) => {
837
+ }, or = (e) => {
830
838
  const { body: t, documentElement: n } = e, r = getComputedStyle(n), o = r.overflowX === "visible" && r.overflowY === "visible" && t !== null ? getComputedStyle(t).overflowY : r.overflowY;
831
839
  return o !== "hidden" && o !== "clip";
832
- }, Qn = (e, t) => {
833
- const n = t.closest(qe), r = n !== null && e.contains(n) ? n : e;
834
- if (r.scrollHeight > r.clientHeight && et(r)) return r;
840
+ }, lr = (e, t) => {
841
+ const n = t.closest(je), r = n !== null && e.contains(n) ? n : e;
842
+ if (r.scrollHeight > r.clientHeight && rt(r)) return r;
835
843
  const o = e.getBoundingClientRect().height, { documentElement: l, scrollingElement: s } = e.ownerDocument;
836
- for (let a = e.parentElement; a !== null && a !== l; a = a.parentElement)
837
- if (et(a) && a.scrollHeight > a.clientHeight && a.clientHeight < o) return a;
838
- return s instanceof Element && Jn(e.ownerDocument) && s.scrollHeight > s.clientHeight && s.clientHeight < o ? s : r;
839
- }, er = Object.freeze({
840
- scrollerOf: Qn,
844
+ for (let i = e.parentElement; i !== null && i !== l; i = i.parentElement)
845
+ if (rt(i) && i.scrollHeight > i.clientHeight && i.clientHeight < o) return i;
846
+ return s instanceof Element && or(e.ownerDocument) && s.scrollHeight > s.clientHeight && s.clientHeight < o ? s : r;
847
+ }, sr = Object.freeze({
848
+ scrollerOf: lr,
841
849
  reveal: (e) => {
842
- e.scrollIntoView(Ce);
850
+ e.scrollIntoView(Ne);
843
851
  }
844
- }), Ce = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), tr = (e, t) => {
852
+ }), Ne = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), ir = (e, t) => {
845
853
  for (let n = t; n !== null && n !== e; n = n.parentElement) {
846
854
  const r = n.parentElement;
847
855
  if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
@@ -849,23 +857,23 @@ const Un = /* @__PURE__ */ x.forwardRef(Zn), Vn = Object.freeze({ className: "aq
849
857
  n.removeAttribute("hidden");
850
858
  }
851
859
  }
852
- }, nr = (e, t) => {
860
+ }, ar = (e, t) => {
853
861
  if (t.getClientRects().length === 0) return;
854
- const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), l = Number.parseFloat(r), s = t.getBoundingClientRect(), a = s.height + l + Number.parseFloat(o) > e.clientHeight;
855
- if (!a && Math.abs(s.top - l - n) < 1) {
856
- t.scrollIntoView(Ce);
862
+ const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), l = Number.parseFloat(r), s = t.getBoundingClientRect(), i = s.height + l + Number.parseFloat(o) > e.clientHeight;
863
+ if (!i && Math.abs(s.top - l - n) < 1) {
864
+ t.scrollIntoView(Ne);
857
865
  return;
858
866
  }
859
- e.scrollBy({ top: a ? s.top - n - e.clientHeight : s.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Ce);
860
- }, rr = (e, t) => {
861
- const n = t.scrollerOf(e, e.querySelector(qe) ?? e);
867
+ e.scrollBy({ top: i ? s.top - n - e.clientHeight : s.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(Ne);
868
+ }, cr = (e, t) => {
869
+ const n = t.scrollerOf(e, e.querySelector(je) ?? e);
862
870
  n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
863
- }, tt = (e, t, n) => {
871
+ }, ot = (e, t, n) => {
864
872
  if (e === null) return null;
865
- const r = Mt(e, t);
866
- return r === null ? (Yn(t) && rr(e, n), null) : (tr(e, r), nr(n.scrollerOf(e, r), r), n.reveal(r), r);
873
+ const r = $t(e, t);
874
+ return r === null ? (nr(t) && cr(e, n), null) : (ir(e, r), ar(n.scrollerOf(e, r), r), n.reveal(r), r);
867
875
  };
868
- function or({
876
+ function dr({
869
877
  title: e,
870
878
  titleId: t,
871
879
  ...n
@@ -884,8 +892,8 @@ function or({
884
892
  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"
885
893
  }));
886
894
  }
887
- const lr = /* @__PURE__ */ x.forwardRef(or);
888
- function ir({
895
+ const ur = /* @__PURE__ */ x.forwardRef(dr);
896
+ function mr({
889
897
  title: e,
890
898
  titleId: t,
891
899
  ...n
@@ -908,8 +916,8 @@ function ir({
908
916
  clipRule: "evenodd"
909
917
  }));
910
918
  }
911
- const sr = /* @__PURE__ */ x.forwardRef(ir);
912
- function ar({
919
+ const fr = /* @__PURE__ */ x.forwardRef(mr);
920
+ function pr({
913
921
  title: e,
914
922
  titleId: t,
915
923
  ...n
@@ -932,8 +940,8 @@ function ar({
932
940
  clipRule: "evenodd"
933
941
  }));
934
942
  }
935
- const cr = /* @__PURE__ */ x.forwardRef(ar);
936
- function dr({
943
+ const hr = /* @__PURE__ */ x.forwardRef(pr);
944
+ function gr({
937
945
  title: e,
938
946
  titleId: t,
939
947
  ...n
@@ -954,7 +962,7 @@ function dr({
954
962
  clipRule: "evenodd"
955
963
  }));
956
964
  }
957
- const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = Object.freeze({ [Me]: "allow" }), fr = `[${Me}="${Ne[Me]}"]`, mr = () => {
965
+ const wr = /* @__PURE__ */ x.forwardRef(gr), Pe = "data-aqmx-key-repeat", $e = Object.freeze({ [Pe]: "allow" }), vr = `[${Pe}="${$e[Pe]}"]`, br = () => {
958
966
  let e = null;
959
967
  return {
960
968
  onKeyDownCapture: (t) => {
@@ -963,7 +971,7 @@ const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = O
963
971
  e = t.target instanceof Element ? t.target : null;
964
972
  return;
965
973
  }
966
- e !== null && t.target === e && e.closest(fr) !== null || (t.preventDefault(), t.stopPropagation());
974
+ e !== null && t.target === e && e.closest(vr) !== null || (t.preventDefault(), t.stopPropagation());
967
975
  }
968
976
  },
969
977
  onKeyUpCapture: (t) => {
@@ -973,156 +981,156 @@ const ur = /* @__PURE__ */ x.forwardRef(dr), Me = "data-aqmx-key-repeat", Ne = O
973
981
  t.target === e && (e = null);
974
982
  }
975
983
  };
976
- }, ue = Object.freeze([1 / se ** 2, 1 / se, 1, se, se ** 2]), nt = Object.freeze({ mode: "fit" }), gr = 1, hr = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), pr = re(null), wr = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= gr ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, rt = (e, t, n) => {
984
+ }, ge = Object.freeze([1 / ue ** 2, 1 / ue, 1, ue, ue ** 2]), lt = Object.freeze({ mode: "fit" }), Er = 1, Sr = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), kr = oe(null), xr = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= Er ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, st = (e, t, n) => {
977
985
  if (e.mode === "level") {
978
986
  const o = e.index + n;
979
- return o >= 0 && o < ue.length ? o : null;
987
+ return o >= 0 && o < ge.length ? o : null;
980
988
  }
981
989
  if (t === null || !Number.isFinite(t) || t <= 0) return null;
982
- const r = n === 1 ? ue.findIndex((o) => o > t) : ue.findLastIndex((o) => o < t);
990
+ const r = n === 1 ? ge.findIndex((o) => o > t) : ge.findLastIndex((o) => o < t);
983
991
  return r === -1 ? null : r;
984
- }, ot = (e, t, n) => {
992
+ }, it = (e, t, n) => {
985
993
  if (e.mode === "level") {
986
- const o = rt(e, null, n);
994
+ const o = st(e, null, n);
987
995
  return o === null ? null : { mode: "level", index: o, base: e.base };
988
996
  }
989
997
  if (t === null) return null;
990
- const r = rt(e, t.scale, n);
998
+ const r = st(e, t.scale, n);
991
999
  return r === null ? null : { mode: "level", index: r, base: t.base };
992
- }, vr = (e) => {
993
- const t = ue[e];
1000
+ }, yr = (e) => {
1001
+ const t = ge[e];
994
1002
  if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
995
1003
  return t;
996
- }, lt = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, br = ({ document: e }) => {
997
- const { labels: t } = D(), n = G(pr), [r] = Z(() => n === null ? null : n.read(e.url)), [o, l] = Z(r === null ? nt : r.zoom), [s, a] = Z(r === null ? null : r.reported), [f, h] = Z(null), m = j(null), g = P((O) => {
998
- const { naturalWidth: u, naturalHeight: p } = O;
999
- a((S) => lt(S, u, p));
1000
- }, []), b = P(
1004
+ }, at = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, Rr = ({ document: e }) => {
1005
+ const { labels: t } = P(), n = J(kr), [r] = Z(() => n === null ? null : n.read(e.url)), [o, l] = Z(r === null ? lt : r.zoom), [s, i] = Z(r === null ? null : r.reported), [d, u] = Z(null), p = j(null), h = C((O) => {
1006
+ const { naturalWidth: m, naturalHeight: w } = O;
1007
+ i((S) => at(S, m, w));
1008
+ }, []), b = C(
1001
1009
  (O) => {
1002
- m.current = O, !(O === null || !O.complete) && (O.naturalWidth > 0 || O.naturalHeight > 0 ? g(O) : O.decode().then(
1003
- () => g(O),
1010
+ p.current = O, !(O === null || !O.complete) && (O.naturalWidth > 0 || O.naturalHeight > 0 ? h(O) : O.decode().then(
1011
+ () => h(O),
1004
1012
  () => {
1005
1013
  }
1006
1014
  ));
1007
1015
  },
1008
- [g]
1016
+ [h]
1009
1017
  );
1010
- J(() => {
1018
+ ee(() => {
1011
1019
  n !== null && s !== null && n.save(e.url, { zoom: o, reported: s });
1012
- }, [n, e.url, o, s]), V(() => {
1013
- const O = m.current;
1020
+ }, [n, e.url, o, s]), G(() => {
1021
+ const O = p.current;
1014
1022
  if (O === null || s === null || o.mode !== "fit") return;
1015
- const u = () => h((S) => lt(S, O.clientWidth, O.clientHeight));
1016
- if (u(), typeof ResizeObserver > "u") return;
1017
- const p = new ResizeObserver(u);
1018
- return p.observe(O), () => p.disconnect();
1023
+ const m = () => u((S) => at(S, O.clientWidth, O.clientHeight));
1024
+ if (m(), typeof ResizeObserver > "u") return;
1025
+ const w = new ResizeObserver(m);
1026
+ return w.observe(O), () => w.disconnect();
1019
1027
  }, [s, o.mode]);
1020
- const R = s === null || f === null ? null : wr(s, f), k = ot(o, R, -1), A = ot(o, R, 1), T = o.mode === "level" ? vr(o.index) : null, F = o.mode === "level" && T !== null ? { width: `${o.base.width * T}px`, height: `${o.base.height * T}px` } : void 0;
1021
- return /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1022
- /* @__PURE__ */ U(Se, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(ur, {}), children: [
1023
- /* @__PURE__ */ d(
1028
+ const T = s === null || d === null ? null : xr(s, d), y = it(o, T, -1), L = it(o, T, 1), k = o.mode === "level" ? yr(o.index) : null, $ = o.mode === "level" && k !== null ? { width: `${o.base.width * k}px`, height: `${o.base.height * k}px` } : void 0;
1029
+ return /* @__PURE__ */ z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1030
+ /* @__PURE__ */ z(ke, { name: e.name, url: e.url, icon: /* @__PURE__ */ c(wr, {}), children: [
1031
+ /* @__PURE__ */ c(
1024
1032
  "button",
1025
1033
  {
1026
1034
  type: "button",
1027
1035
  className: "aqmx-icon-button",
1028
1036
  "aria-label": t.imageZoomOut,
1029
1037
  title: t.imageZoomOut,
1030
- "aria-disabled": k === null,
1038
+ "aria-disabled": y === null,
1031
1039
  onClick: () => {
1032
- k !== null && l(k);
1040
+ y !== null && l(y);
1033
1041
  },
1034
- ...Ne,
1035
- children: /* @__PURE__ */ d(sr, {})
1042
+ ...$e,
1043
+ children: /* @__PURE__ */ c(fr, {})
1036
1044
  }
1037
1045
  ),
1038
- /* @__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)) }),
1039
- /* @__PURE__ */ d(
1046
+ /* @__PURE__ */ c("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: k === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(k * 100)) }),
1047
+ /* @__PURE__ */ c(
1040
1048
  "button",
1041
1049
  {
1042
1050
  type: "button",
1043
1051
  className: "aqmx-icon-button",
1044
1052
  "aria-label": t.imageZoomIn,
1045
1053
  title: t.imageZoomIn,
1046
- "aria-disabled": A === null,
1054
+ "aria-disabled": L === null,
1047
1055
  onClick: () => {
1048
- A !== null && l(A);
1056
+ L !== null && l(L);
1049
1057
  },
1050
- ...Ne,
1051
- children: /* @__PURE__ */ d(cr, {})
1058
+ ...$e,
1059
+ children: /* @__PURE__ */ c(hr, {})
1052
1060
  }
1053
1061
  ),
1054
- /* @__PURE__ */ d("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => l(nt), children: /* @__PURE__ */ d(lr, {}) })
1062
+ /* @__PURE__ */ c("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => l(lt), children: /* @__PURE__ */ c(ur, {}) })
1055
1063
  ] }),
1056
- /* @__PURE__ */ d(Ee, { scrollerProps: hr, children: /* @__PURE__ */ d("img", { ref: b, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: F, onLoad: (O) => g(O.currentTarget), "data-testid": "markdown-explorer-image" }) })
1064
+ /* @__PURE__ */ c(de, { scrollerProps: Sr, children: /* @__PURE__ */ c("img", { ref: b, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: $, onLoad: (O) => h(O.currentTarget), "data-testid": "markdown-explorer-image" }) })
1057
1065
  ] });
1058
- }, Nt = re(null), ye = re(void 0), Pt = re(null), xe = () => {
1059
- const e = G(Nt);
1066
+ }, Ft = oe(null), xe = oe(void 0), Dt = oe(null), ye = () => {
1067
+ const e = J(Ft);
1060
1068
  if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
1061
1069
  return e;
1062
- }, Er = () => {
1063
- const e = G(Pt);
1070
+ }, Tr = () => {
1071
+ const e = J(Dt);
1064
1072
  if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
1065
1073
  return e;
1066
- }, ke = (e, t, n, r) => t.kind === "panel" ? le(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? le(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : le(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Sr = ({ children: e }) => {
1067
- const { config: t } = D(), n = xe(), r = De(), o = r.kind === "location" ? r.location.source : void 0, l = we(ke(t, n.navigation, o, n.currentPath));
1068
- return /* @__PURE__ */ d(ye, { value: o, children: /* @__PURE__ */ d(Pt, { value: l, children: e }) });
1069
- }, yr = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', xr = (e) => {
1070
- const t = e instanceof Element ? e.closest(yr) : null;
1074
+ }, Re = (e, t, n, r) => t.kind === "panel" ? le(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? le(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : le(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), Ar = ({ children: e }) => {
1075
+ const { config: t } = P(), n = ye(), r = qe(), o = r.kind === "location" ? r.location.source : void 0, l = Se(Re(t, n.navigation, o, n.currentPath));
1076
+ return /* @__PURE__ */ c(xe, { value: o, children: /* @__PURE__ */ c(Dt, { value: l, children: e }) });
1077
+ }, Lr = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', Or = (e) => {
1078
+ const t = e instanceof Element ? e.closest(Lr) : null;
1071
1079
  return t === null ? null : t.getAttribute("data-doc-path");
1072
- }, Re = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, kr = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: l, onDocumentLink: s, scope: a, children: f }) => {
1073
- const h = we(e);
1074
- return /* @__PURE__ */ d("a", { ...l, href: h, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (g) => {
1075
- if (Re(g)) {
1076
- if (g.preventDefault(), t === a.currentPath && n !== "") {
1077
- a.scrollWithin(n);
1080
+ }, Te = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, Mr = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: l, onDocumentLink: s, scope: i, children: d }) => {
1081
+ const u = Se(e);
1082
+ return /* @__PURE__ */ c("a", { ...l, href: u, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (h) => {
1083
+ if (Te(h)) {
1084
+ if (h.preventDefault(), t === i.currentPath && n !== "") {
1085
+ i.scrollWithin(n);
1078
1086
  return;
1079
1087
  }
1080
1088
  s(t, n);
1081
1089
  }
1082
- }, children: f });
1083
- }, Rr = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: l }) => {
1084
- const { config: s } = D(), a = xe(), f = G(ye), h = Wn(e), { navigation: m } = a, g = `${ke(s, m, f, t)}${h}`, b = n === !1 ? "false" : void 0;
1085
- return m.kind === "page" ? /* @__PURE__ */ d(Mn, { ...o, to: g, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": b, children: l }) : /* @__PURE__ */ d(kr, { to: g, docPath: t, fragment: h, exists: b, className: r, attributes: o, onDocumentLink: m.onDocumentLink, scope: a, children: l });
1086
- }, Tr = ({ className: e, attributes: t, children: n }) => {
1087
- const { labels: r } = D();
1090
+ }, children: d });
1091
+ }, Cr = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: l }) => {
1092
+ const { config: s } = P(), i = ye(), d = J(xe), u = er(e), { navigation: p } = i, h = `${Re(s, p, d, t)}${u}`, b = n === !1 ? "false" : void 0;
1093
+ return p.kind === "page" ? /* @__PURE__ */ c(_n, { ...o, to: h, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": b, children: l }) : /* @__PURE__ */ c(Mr, { to: h, docPath: t, fragment: u, exists: b, className: r, attributes: o, onDocumentLink: p.onDocumentLink, scope: i, children: l });
1094
+ }, Nr = ({ className: e, attributes: t, children: n }) => {
1095
+ const { labels: r } = P();
1088
1096
  return (
1089
- /* @__PURE__ */ U("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: [
1097
+ /* @__PURE__ */ z("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: [
1090
1098
  n,
1091
- /* @__PURE__ */ U("span", { className: "aqmx-sr-only", children: [
1099
+ /* @__PURE__ */ z("span", { className: "aqmx-sr-only", children: [
1092
1100
  " (",
1093
1101
  r.inertLink,
1094
1102
  ")"
1095
1103
  ] })
1096
1104
  ] })
1097
1105
  );
1098
- }, Ar = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1099
- const { config: l } = D(), s = G(ye), a = we(`${ke(l, r.navigation, s, r.currentPath)}${e}`);
1100
- return /* @__PURE__ */ d("a", { ...n, href: a, className: t, onClick: (h) => {
1101
- Re(h) && (h.preventDefault(), r.scrollWithin(e));
1106
+ }, Pr = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
1107
+ const { config: l } = P(), s = J(xe), i = Se(`${Re(l, r.navigation, s, r.currentPath)}${e}`);
1108
+ return /* @__PURE__ */ c("a", { ...n, href: i, className: t, onClick: (u) => {
1109
+ Te(u) && (u.preventDefault(), r.scrollWithin(e));
1102
1110
  }, children: o });
1103
- }, Or = ({ href: e, className: t, attributes: n, children: r }) => {
1104
- const o = xe();
1105
- return o.navigation.kind === "page" ? /* @__PURE__ */ d("a", { ...n, href: e, className: t, onClick: (s) => {
1106
- if (!Re(s)) return;
1107
- const a = s.currentTarget;
1108
- e === "#" ? o.followEmptyFragment(s.nativeEvent) : a.href === a.ownerDocument.URL && o.followSameUrlJump(e, s.nativeEvent);
1109
- }, children: r }) : /* @__PURE__ */ d(Ar, { href: e, className: t, attributes: n, scope: o, children: r });
1110
- }, Lr = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: l, children: s }) => t === "doc" ? n === void 0 || !rn(n) ? /* @__PURE__ */ d(Tr, { className: o, attributes: l, children: s }) : /* @__PURE__ */ d(Rr, { href: e, docPath: n, docExists: r, className: o, attributes: l, children: s }) : e.startsWith("#") ? /* @__PURE__ */ d(Or, { href: e, className: o, attributes: l, children: s }) : /* @__PURE__ */ d("a", { ...l, href: e, className: o, children: s }), Cr = () => {
1111
- const { config: e } = D(), t = xe(), n = G(ye), r = _e();
1112
- return P(
1111
+ }, $r = ({ href: e, className: t, attributes: n, children: r }) => {
1112
+ const o = ye();
1113
+ return o.navigation.kind === "page" ? /* @__PURE__ */ c("a", { ...n, href: e, className: t, onClick: (s) => {
1114
+ if (!Te(s)) return;
1115
+ const i = s.currentTarget;
1116
+ e === "#" ? o.followEmptyFragment(s.nativeEvent) : i.href === i.ownerDocument.URL && o.followSameUrlJump(e, s.nativeEvent);
1117
+ }, children: r }) : /* @__PURE__ */ c(Pr, { href: e, className: t, attributes: n, scope: o, children: r });
1118
+ }, Fr = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: l, children: s }) => t === "doc" ? n === void 0 || !dn(n) ? /* @__PURE__ */ c(Nr, { className: o, attributes: l, children: s }) : /* @__PURE__ */ c(Cr, { href: e, docPath: n, docExists: r, className: o, attributes: l, children: s }) : e.startsWith("#") ? /* @__PURE__ */ c($r, { href: e, className: o, attributes: l, children: s }) : /* @__PURE__ */ c("a", { ...l, href: e, className: o, children: s }), Dr = () => {
1119
+ const { config: e } = P(), t = ye(), n = J(xe), r = Be();
1120
+ return C(
1113
1121
  (o, l) => {
1114
- if (!Re(l)) return !0;
1122
+ if (!Te(l)) return !0;
1115
1123
  l.preventDefault();
1116
- const s = Lt(o.id), { navigation: a } = t;
1117
- return a.kind === "panel" || Be(l.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(s), !0) : (r(`${ke(e, a, n, t.currentPath)}${s}`, "follow-link"), !0);
1124
+ const s = Nt(o.id), { navigation: i } = t;
1125
+ return i.kind === "panel" || ze(l.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(s), !0) : (r(`${Re(e, i, n, t.currentPath)}${s}`, "follow-link"), !0);
1118
1126
  },
1119
1127
  [e, t, n, r]
1120
1128
  );
1121
- }, Mr = () => {
1122
- const e = Er();
1123
- return P((t) => `${e}${Lt(t.id)}`, [e]);
1129
+ }, qr = () => {
1130
+ const e = Tr();
1131
+ return C((t) => `${e}${Nt(t.id)}`, [e]);
1124
1132
  };
1125
- function Nr({
1133
+ function _r({
1126
1134
  title: e,
1127
1135
  titleId: t,
1128
1136
  ...n
@@ -1141,8 +1149,8 @@ function Nr({
1141
1149
  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"
1142
1150
  }));
1143
1151
  }
1144
- const Pr = /* @__PURE__ */ x.forwardRef(Nr);
1145
- function $r({
1152
+ const Br = /* @__PURE__ */ x.forwardRef(_r);
1153
+ function jr({
1146
1154
  title: e,
1147
1155
  titleId: t,
1148
1156
  ...n
@@ -1163,8 +1171,8 @@ function $r({
1163
1171
  clipRule: "evenodd"
1164
1172
  }));
1165
1173
  }
1166
- const Dr = /* @__PURE__ */ x.forwardRef($r);
1167
- function Fr({
1174
+ const zr = /* @__PURE__ */ x.forwardRef(jr);
1175
+ function Hr({
1168
1176
  title: e,
1169
1177
  titleId: t,
1170
1178
  ...n
@@ -1185,41 +1193,47 @@ function Fr({
1185
1193
  clipRule: "evenodd"
1186
1194
  }));
1187
1195
  }
1188
- const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aqmx-document-stage" }), Br = (e) => {
1196
+ const Ir = /* @__PURE__ */ x.forwardRef(Hr), Zr = Object.freeze({ className: "aqmx-document-stage" }), Ur = (e) => {
1189
1197
  switch (e) {
1190
1198
  case "video":
1191
- return /* @__PURE__ */ d(Dr, {});
1199
+ return /* @__PURE__ */ c(zr, {});
1192
1200
  case "audio":
1193
- return /* @__PURE__ */ d(_r, {});
1201
+ return /* @__PURE__ */ c(Ir, {});
1194
1202
  case "pdf":
1195
- return /* @__PURE__ */ d(Pr, {});
1203
+ return /* @__PURE__ */ c(Br, {});
1196
1204
  default: {
1197
1205
  const t = e;
1198
1206
  throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`);
1199
1207
  }
1200
1208
  }
1201
- }, zr = ({ document: e }) => {
1202
- const { labels: t } = D();
1209
+ }, Vr = ({ document: e }) => {
1210
+ const { labels: t } = P();
1203
1211
  switch (e.mediaType) {
1204
1212
  case "video":
1205
1213
  return (
1206
- /* @__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 })
1214
+ /* @__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 })
1207
1215
  );
1208
1216
  case "audio":
1209
1217
  return (
1210
- /* @__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 })
1218
+ /* @__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 })
1211
1219
  );
1212
1220
  case "pdf":
1213
- return /* @__PURE__ */ d("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" });
1221
+ return /* @__PURE__ */ c("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" });
1214
1222
  default: {
1215
1223
  const n = e.mediaType;
1216
1224
  throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`);
1217
1225
  }
1218
1226
  }
1219
- }, jr = ({ document: e }) => /* @__PURE__ */ U("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
1220
- /* @__PURE__ */ d(Se, { name: e.name, url: e.url, icon: Br(e.mediaType) }),
1221
- /* @__PURE__ */ d(Ee, { scrollerProps: qr, children: /* @__PURE__ */ d(zr, { document: e }) })
1222
- ] }), Hr = (e) => ({
1227
+ }, Gr = ({ document: e }) => /* @__PURE__ */ z("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
1228
+ /* @__PURE__ */ c(ke, { name: e.name, url: e.url, icon: Ur(e.mediaType) }),
1229
+ /* @__PURE__ */ c(de, { scrollerProps: Zr, children: /* @__PURE__ */ c(Vr, { document: e }) })
1230
+ ] }), qt = (e) => {
1231
+ const { markupViews: t } = P(), n = C(() => t.isShown(e), [t, e]);
1232
+ return Q(t.subscribe, n, n);
1233
+ }, Wr = (e) => {
1234
+ const { documents: t, markupViews: n } = P(), r = C(() => t.peek(e), [t, e]), o = C(() => t.peekSeeded(e), [t, e]), l = Q(t.subscribe, r, o), s = qt(e), i = C(() => n.toggle(e), [n, e]);
1235
+ return { available: ie(l)?.document.kind === "markdown", shown: s, toggle: i };
1236
+ }, Kr = (e) => ({
1223
1237
  loading: e.viewerLoading,
1224
1238
  errorPrefix: e.viewerErrorPrefix,
1225
1239
  styleTitle: e.viewerStyleTitle,
@@ -1253,190 +1267,205 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1253
1267
  embeddedVideo: e.viewerEmbeddedVideo,
1254
1268
  embeddedPost: e.viewerEmbeddedPost,
1255
1269
  embeddedFrame: e.viewerEmbeddedFrame
1256
- }), $t = (e, t, n) => {
1270
+ }), _t = (e, t, n) => {
1257
1271
  if (t !== void 0) return t;
1258
1272
  if (n !== void 0) return n;
1259
1273
  const [r] = e.documentStyles;
1260
1274
  if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
1261
1275
  return r.name;
1262
- }, Dt = (e, t) => e !== void 0 ? e : t !== void 0 ? t : gn, Ir = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Zr = (e, t, n) => {
1276
+ }, Bt = (e, t) => e !== void 0 ? e : t !== void 0 ? t : Sn, jt = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Yr = (e, t, n) => {
1263
1277
  if (t.view === "multi" || t.overrides[n] === void 0) return null;
1264
1278
  const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
1265
1279
  return t.view === "single" ? le(e, { view: "single", source: t.source, doc: t.doc, overrides: r, embed: t.embed }) : le(e, { view: "tree", source: t.source, doc: t.doc, overrides: r });
1266
- }, ze = ({ kind: e, label: t, stale: n, busy: r, frameRef: o, intent: l, children: s }) => {
1267
- const a = G(pe);
1280
+ }, He = ({ kind: e, view: t, label: n, stale: r, busy: o, frameRef: l, intent: s, children: i }) => {
1281
+ const d = J(Ee);
1268
1282
  return (
1269
- /* @__PURE__ */ U("section", { ref: o, role: "region", "aria-label": t, "aria-busy": r, "data-testid": "markdown-explorer-document", "data-aqmx-document-kind": e, "data-aqmx-document-flow": a, className: "aqmx-document", ...l, children: [
1270
- n ? /* @__PURE__ */ d("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
1271
- s
1283
+ /* @__PURE__ */ z("section", { ref: l, 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": d, className: "aqmx-document", ...s, children: [
1284
+ r ? /* @__PURE__ */ c("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
1285
+ i
1272
1286
  ] })
1273
1287
  );
1274
- }, Ur = () => {
1275
- const { labels: e } = D();
1276
- return /* @__PURE__ */ d(ze, { kind: "empty", label: e.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: e.documentEmpty }) }) });
1277
- }, Ft = ({ label: e }) => {
1278
- const { labels: t } = D();
1279
- return /* @__PURE__ */ U(ze, { kind: "loading", label: e, stale: !1, busy: !0, children: [
1280
- /* @__PURE__ */ d("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: Ir.map((n) => /* @__PURE__ */ d("span", {}, n)) }),
1281
- /* @__PURE__ */ d("p", { className: "aqmx-sr-only", children: t.documentLoading })
1288
+ }, Xr = () => {
1289
+ const { labels: e } = P();
1290
+ return /* @__PURE__ */ c(He, { kind: "empty", label: e.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: e.documentEmpty }) }) });
1291
+ }, zt = ({ label: e }) => {
1292
+ const { labels: t } = P();
1293
+ return /* @__PURE__ */ z(He, { kind: "loading", label: e, stale: !1, busy: !0, children: [
1294
+ /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-document-skeleton", children: jt.map((n) => /* @__PURE__ */ c("span", {}, n)) }),
1295
+ /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: t.documentLoading })
1282
1296
  ] });
1283
- }, Vr = ({ path: e, document: t, viewer: n }) => {
1284
- const { reportMathDiagnostics: r } = D(), o = H(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), l = Cr(), s = Mr(), a = H(() => r === void 0 ? void 0 : (f) => r(e, f), [r, e]);
1285
- return /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(wt, { ...n, onHeadingSelect: l, headingHref: s, onMathDiagnostics: a, parseResult: o, content: null }) });
1286
- }, Gr = ({ document: e, viewer: t }) => {
1287
- const { labels: n } = D();
1288
- return /* @__PURE__ */ U(Bt, { children: [
1289
- /* @__PURE__ */ d(Se, { name: e.name, url: e.url, icon: /* @__PURE__ */ d(Cn, {}) }),
1290
- e.truncated ? /* @__PURE__ */ d("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
1291
- /* @__PURE__ */ d("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ d(wt, { ...t, parseResult: null, content: e.text }) })
1297
+ }, Jr = ({ path: e, document: t, viewer: n }) => {
1298
+ const { reportMathDiagnostics: r } = P(), o = H(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), l = Dr(), s = qr(), i = H(() => r === void 0 ? void 0 : (d) => r(e, d), [r, e]);
1299
+ return /* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(bt, { ...n, onHeadingSelect: l, headingHref: s, onMathDiagnostics: i, parseResult: o, content: null }) });
1300
+ }, Ht = ({ document: e, viewer: t }) => {
1301
+ const { labels: n } = P();
1302
+ return /* @__PURE__ */ z(wt, { children: [
1303
+ /* @__PURE__ */ c(ke, { name: e.name, url: e.url, icon: /* @__PURE__ */ c(qn, {}) }),
1304
+ e.truncated ? /* @__PURE__ */ c("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
1305
+ /* @__PURE__ */ c("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ c(bt, { ...t, parseResult: null, content: e.text }) })
1292
1306
  ] });
1293
- }, Wr = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), Kr = ({ path: e, document: t, viewer: n, onRetry: r }) => {
1307
+ }, Qr = ({ path: e, name: t, viewer: n }) => {
1308
+ const { data: r, documents: o, announcer: l, labels: s } = P(), i = C(() => o.answerStampOf(e), [o, e]), d = Q(o.subscribe, i, i), [u, p] = Z(0), h = H(() => ({ path: e, stamp: d, attempt: u }), [e, d, u]), [b, T] = Z(null), y = ne((k) => {
1309
+ T(k), k.kind === "failure" && l.announce(s.documentFailed(t, ae(s, k.failure.reason)));
1310
+ });
1311
+ ee(() => {
1312
+ const k = new AbortController();
1313
+ return r.text(h.path, k.signal).then(($) => {
1314
+ "kind" in $ && y($);
1315
+ }), () => k.abort();
1316
+ }, [r, h]);
1317
+ const L = C(() => p((k) => k + 1), []);
1318
+ return b === null ? /* @__PURE__ */ z(wt, { children: [
1319
+ /* @__PURE__ */ c("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": "markdown-explorer-markup-skeleton", children: jt.map((k) => /* @__PURE__ */ c("span", {}, k)) }),
1320
+ /* @__PURE__ */ c("p", { className: "aqmx-sr-only", children: s.markupLoading })
1321
+ ] }) : b.kind === "failure" ? /* @__PURE__ */ c(de, { scrollerProps: It, children: /* @__PURE__ */ c(Tt, { failure: b.failure, alert: !1, onRetry: L, testId: "markdown-explorer-markup-failure" }) }) : /* @__PURE__ */ c(Ht, { document: b, viewer: n });
1322
+ }, It = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), eo = ({ path: e, document: t, markup: n, viewer: r, onRetry: o }) => {
1294
1323
  switch (t.kind) {
1295
1324
  case "markdown":
1296
- return /* @__PURE__ */ d(Vr, { path: e, document: t, viewer: n });
1325
+ return n ? /* @__PURE__ */ c(Qr, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ c(Jr, { path: e, document: t, viewer: r });
1297
1326
  case "text":
1298
- return /* @__PURE__ */ d(Gr, { document: t, viewer: n });
1327
+ return /* @__PURE__ */ c(Ht, { document: t, viewer: r });
1299
1328
  case "image":
1300
- return /* @__PURE__ */ d(br, { document: t });
1329
+ return /* @__PURE__ */ c(Rr, { document: t });
1301
1330
  case "media":
1302
- return /* @__PURE__ */ d(jr, { document: t });
1331
+ return /* @__PURE__ */ c(Gr, { document: t });
1303
1332
  case "file":
1304
- return /* @__PURE__ */ d(Gn, { document: t });
1333
+ return /* @__PURE__ */ c(Qn, { document: t });
1305
1334
  case "failure":
1306
- return /* @__PURE__ */ d(Ee, { scrollerProps: Wr, children: /* @__PURE__ */ d(Nn, { failure: t.failure, alert: !1, onRetry: r, testId: "markdown-explorer-document-failure" }) });
1335
+ return /* @__PURE__ */ c(de, { scrollerProps: It, children: /* @__PURE__ */ c(Tt, { failure: t.failure, alert: !1, onRetry: o, testId: "markdown-explorer-document-failure" }) });
1307
1336
  default: {
1308
- const o = t;
1309
- throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(o)}`);
1337
+ const l = t;
1338
+ throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(l)}`);
1310
1339
  }
1311
1340
  }
1312
- }, Yr = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', Xr = (e, t, n) => {
1313
- const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Mt(e, n), r === void 0 ? null : Ct(e, r.id), e.querySelector(qe), e.querySelector(Yr)];
1341
+ }, to = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', no = (e, t, n) => {
1342
+ const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : $t(e, n), r === void 0 ? null : Pt(e, r.id), e.querySelector(je), e.querySelector(to)];
1314
1343
  for (const l of o)
1315
- if (l instanceof HTMLElement && kt(l)) return l;
1344
+ if (l instanceof HTMLElement && At(l)) return l;
1316
1345
  return null;
1317
- }, it = (e, t, n) => {
1346
+ }, ct = (e, t, n) => {
1318
1347
  const { activeElement: r, body: o } = e.ownerDocument, l = r === null || r === o;
1319
- t instanceof HTMLElement && n && (l || e.contains(r)) && kt(t);
1320
- }, Jr = (e) => {
1348
+ t instanceof HTMLElement && n && (l || e.contains(r)) && At(t);
1349
+ }, ro = (e) => {
1321
1350
  const t = j(!1);
1322
- return V(() => {
1351
+ return G(() => {
1323
1352
  const n = e.current;
1324
1353
  if (n === null) throw new Error("[markdown-explorer] the document region is not mounted");
1325
1354
  const r = n.ownerDocument, o = r.defaultView;
1326
1355
  if (o === null) throw new Error("[markdown-explorer] the document region's document has no window");
1327
1356
  let l = !1, s;
1328
- const a = (b) => {
1357
+ const i = (b) => {
1329
1358
  l = !(b.target instanceof Node && n.contains(b.target)), l && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(s), s = setTimeout(() => {
1330
1359
  l = !1;
1331
1360
  }, 0);
1332
- }, f = (b) => {
1361
+ }, d = (b) => {
1333
1362
  t.current = b.target instanceof Node && n.contains(b.target);
1334
- }, h = (b) => {
1363
+ }, u = (b) => {
1335
1364
  b.relatedTarget === null && l && (t.current = !1);
1336
- }, m = () => {
1337
- const { activeElement: b, body: R } = r;
1338
- b !== null && b !== R && (t.current = n.contains(b));
1339
- }, g = () => {
1365
+ }, p = () => {
1366
+ const { activeElement: b, body: T } = r;
1367
+ b !== null && b !== T && (t.current = n.contains(b));
1368
+ }, h = () => {
1340
1369
  l && !n.contains(r.activeElement) && (t.current = !1);
1341
1370
  };
1342
- return o.addEventListener("pointerdown", a, !0), o.addEventListener("mousedown", a, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", m), o.addEventListener("focus", g), n.addEventListener("focusout", h), () => {
1343
- clearTimeout(s), o.removeEventListener("pointerdown", a, !0), o.removeEventListener("mousedown", a, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", m), o.removeEventListener("focus", g), n.removeEventListener("focusout", h);
1371
+ return o.addEventListener("pointerdown", i, !0), o.addEventListener("mousedown", i, !0), o.addEventListener("focusin", d, !0), o.addEventListener("blur", p), o.addEventListener("focus", h), n.addEventListener("focusout", u), () => {
1372
+ clearTimeout(s), o.removeEventListener("pointerdown", i, !0), o.removeEventListener("mousedown", i, !0), o.removeEventListener("focusin", d, !0), o.removeEventListener("blur", p), o.removeEventListener("focus", h), n.removeEventListener("focusout", u);
1344
1373
  };
1345
1374
  }, [e]), t;
1346
- }, Qr = ({ path: e, snapshot: t, stale: n, viewer: r, regionLabel: o, navigation: l, fragment: s, paneScroll: a, announces: f, announceFailure: h, onDocumentShown: m }) => {
1347
- const { labels: g, announcer: b, documents: R } = D(), { document: k } = t, A = j(null), T = j(null), F = j(null), O = j(0), u = Jr(A), p = j({ path: e, document: k }), S = j(null), E = P(
1348
- (i) => {
1349
- const c = A.current, w = tt(c, i, a);
1350
- c !== null && w !== null && it(c, w, u.current);
1375
+ }, oo = ({ path: e, snapshot: t, stale: n, viewer: r, regionLabel: o, navigation: l, fragment: s, paneScroll: i, announces: d, announceFailure: u, onDocumentShown: p }) => {
1376
+ const { labels: h, announcer: b, documents: T } = P(), { document: y } = t, L = j(null), k = j(null), $ = j(null), O = j(0), m = ro(L), w = j({ path: e, document: y }), S = j(null), E = C(
1377
+ (g) => {
1378
+ const v = L.current, A = ot(v, g, i);
1379
+ v !== null && A !== null && ct(v, A, m.current);
1351
1380
  },
1352
- [a, u]
1353
- ), y = P(
1354
- (i, c) => {
1355
- const w = O.current;
1381
+ [i, m]
1382
+ ), R = C(
1383
+ (g, v) => {
1384
+ const A = O.current;
1356
1385
  setTimeout(() => {
1357
- !c.defaultPrevented && O.current === w && E(i);
1386
+ !v.defaultPrevented && O.current === A && E(g);
1358
1387
  }, 0);
1359
1388
  },
1360
1389
  [E]
1361
- ), $ = P(
1362
- (i) => {
1390
+ ), F = C(
1391
+ (g) => {
1363
1392
  setTimeout(() => {
1364
- i.defaultPrevented || E("#");
1393
+ g.defaultPrevented || E("#");
1365
1394
  }, 0);
1366
1395
  },
1367
1396
  [E]
1368
- ), I = H(() => ({ navigation: l, currentPath: e, scrollWithin: E, followSameUrlJump: y, followEmptyFragment: $ }), [l, e, E, y, $]), C = P(() => R.retry(e), [R, e]), B = Pn(R, xr), M = ee((i, c) => {
1369
- const w = T.current;
1370
- if (w !== null && w.path === i && w.snapshot === c) return;
1371
- T.current = { path: i, snapshot: c };
1372
- const v = c.document;
1373
- if (v.kind === "failure") {
1374
- R.noteFailureShown(c) && h(g.documentFailed(vt(i), ve(g, v.failure.reason)));
1397
+ ), I = H(() => ({ navigation: l, currentPath: e, scrollWithin: E, followSameUrlJump: R, followEmptyFragment: F }), [l, e, E, R, F]), N = C(() => T.retry(e), [T, e]), B = Bn(T, Or), W = qt(e) ? "markup" : "rendered", U = y.kind === "markdown" ? W : void 0, q = ne((g, v) => {
1398
+ const A = k.current;
1399
+ if (A !== null && A.path === g && A.snapshot === v) return;
1400
+ k.current = { path: g, snapshot: v };
1401
+ const M = v.document;
1402
+ if (M.kind === "failure") {
1403
+ T.noteFailureShown(v) && u(h.documentFailed(Et(g), ae(h, M.failure.reason)));
1375
1404
  return;
1376
1405
  }
1377
- m?.(i, v), f && (w === null || w.path !== i || w.snapshot.document.kind === "failure") && b.announce(g.documentShown(v.name));
1406
+ p?.(g, M), d && (A === null || A.path !== g || A.snapshot.document.kind === "failure") && b.announce(h.documentShown(M.name));
1378
1407
  });
1379
- J(() => {
1380
- M(e, t);
1408
+ ee(() => {
1409
+ q(e, t);
1381
1410
  }, [e, t]);
1382
- const _ = ee(() => {
1411
+ const V = ne(() => {
1383
1412
  s.kind === "panel" && s.consume();
1384
- }), Q = ee((i) => {
1385
- const c = A.current;
1386
- if (c === null || !u.current) return null;
1387
- const { activeElement: w, body: v } = c.ownerDocument;
1388
- return w !== null && w !== v ? null : Xr(c, k, i);
1389
- }), oe = ee((i) => {
1390
- const c = A.current;
1391
- c !== null && it(c, i, u.current);
1392
- }), W = ee((i) => a.reveal(i)), Te = ee((i) => tt(A.current, i, a));
1393
- return J(() => {
1413
+ }), K = ne((g) => {
1414
+ const v = L.current;
1415
+ if (v === null || !m.current) return null;
1416
+ const { activeElement: A, body: M } = v.ownerDocument;
1417
+ return A !== null && A !== M ? null : no(v, y, g);
1418
+ }), Ae = ne((g) => {
1419
+ const v = L.current;
1420
+ v !== null && ct(v, g, m.current);
1421
+ }), a = ne((g) => i.reveal(g)), f = ne((g) => ot(L.current, g, i));
1422
+ return ee(() => {
1394
1423
  if (n) return;
1395
- const i = p.current.path !== e, c = i || p.current.document !== k;
1396
- p.current = { path: e, document: k };
1397
- const w = S.current !== e;
1424
+ const g = w.current.path !== e, v = g || w.current.document !== y;
1425
+ w.current = { path: e, document: y };
1426
+ const A = S.current !== e;
1398
1427
  S.current = e;
1399
- let v = null;
1400
- s.kind === "page" ? F.current !== s.navigation && (F.current = s.navigation, O.current += 1, v = s.fragment) : s.fragment !== null && (v = s.fragment, _());
1401
- const L = () => {
1402
- const N = v === null ? null : Te(v);
1403
- if (!c) {
1404
- N !== null && oe(N);
1428
+ let M = null;
1429
+ s.kind === "page" ? $.current !== s.navigation && ($.current = s.navigation, O.current += 1, M = s.fragment) : s.fragment !== null && (M = s.fragment, V());
1430
+ const _ = () => {
1431
+ const D = M === null ? null : f(M);
1432
+ if (!v) {
1433
+ D !== null && Ae(D);
1405
1434
  return;
1406
1435
  }
1407
- const q = Q(s.fragment);
1408
- i && N === null && q !== null && W(q);
1436
+ const Y = K(s.fragment);
1437
+ g && D === null && Y !== null && a(Y);
1409
1438
  };
1410
- w ? queueMicrotask(L) : L();
1411
- }, [s, e, k, n]), /* @__PURE__ */ d(ze, { kind: k.kind, label: o(e, k), stale: n, busy: n, frameRef: A, intent: B, children: /* @__PURE__ */ d(Nt, { value: I, children: /* @__PURE__ */ d(Sr, { children: /* @__PURE__ */ d(Kr, { path: e, document: k, viewer: r, onRetry: C }, e) }) }) });
1412
- }, je = Object.freeze({ kind: "skeleton" }), eo = (e, t, n, r, o) => {
1439
+ A ? queueMicrotask(_) : _();
1440
+ }, [s, e, y, n]), /* @__PURE__ */ c(He, { kind: y.kind, view: U, label: o(e, y), stale: n, busy: n, frameRef: L, intent: B, children: /* @__PURE__ */ c(Ft, { value: I, children: /* @__PURE__ */ c(Ar, { children: /* @__PURE__ */ c(eo, { path: e, document: y, markup: U === "markup", viewer: r, onRetry: N }, e) }) }) });
1441
+ }, Ie = Object.freeze({ kind: "skeleton" }), lo = (e, t, n, r, o) => {
1413
1442
  if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
1414
- const l = he(t);
1443
+ const l = ie(t);
1415
1444
  if (l !== null) return { kind: "document", path: e, snapshot: l, stale: !0 };
1416
1445
  if (o && t?.status === "pending") return { kind: "streaming", path: e, promise: t.promise };
1417
- const s = n === null || n === e ? null : he(r);
1418
- return n === null || s === null ? je : { kind: "document", path: n, snapshot: s, stale: !0 };
1419
- }, to = (e, t) => t.status === "deferred" ? je : { kind: "document", path: e, snapshot: t, stale: !1 }, no = ({ requestedPath: e, content: t, ...n }) => {
1420
- const r = t.kind === "streaming" ? to(t.path, G(t.promise)) : t;
1421
- return r.kind !== "document" ? /* @__PURE__ */ d(Ft, { label: n.regionLabel(e, null) }) : /* @__PURE__ */ d(Qr, { path: r.path, snapshot: r.snapshot, stale: r.stale, ...n });
1422
- }, _t = ({ path: e, display: t, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: a }) => {
1423
- const { config: f, labels: h, theme: m, documents: g } = D(), b = nn(), R = j(!1);
1424
- V(() => {
1425
- R.current = !0;
1446
+ const s = n === null || n === e ? null : ie(r);
1447
+ return n === null || s === null ? Ie : { kind: "document", path: n, snapshot: s, stale: !0 };
1448
+ }, so = (e, t) => t.status === "deferred" ? Ie : { kind: "document", path: e, snapshot: t, stale: !1 }, io = ({ requestedPath: e, content: t, ...n }) => {
1449
+ const r = t.kind === "streaming" ? so(t.path, J(t.promise)) : t;
1450
+ return r.kind !== "document" ? /* @__PURE__ */ c(zt, { label: n.regionLabel(e, null) }) : /* @__PURE__ */ c(oo, { path: r.path, snapshot: r.snapshot, stale: r.stale, ...n });
1451
+ }, Zt = ({ path: e, display: t, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: i }) => {
1452
+ const { config: d, labels: u, theme: p, documents: h } = P(), b = cn(), T = j(!1);
1453
+ G(() => {
1454
+ T.current = !0;
1426
1455
  }, []);
1427
- const [k, A] = Z(null), T = P(() => e === null ? void 0 : g.peek(e), [g, e]), F = ne(g.subscribe, T, T), O = P(() => k === null ? void 0 : g.peek(k), [g, k]), u = ne(g.subscribe, O, O);
1428
- V(() => e === null ? void 0 : g.open(e), [g, e]), V(() => k === null ? void 0 : g.retain(k), [g, k]);
1429
- const p = e === null ? je : eo(e, F, k, u, !R.current), S = e === null ? null : p.kind === "document" && !p.stale ? p.path : k;
1430
- S !== k && A(S);
1431
- const E = H(() => Hr(h), [h]), y = H(() => [...f.iframeHosts], [f]), $ = n.kind === "panel", I = H(
1456
+ const [y, L] = Z(null), k = C(() => e === null ? void 0 : h.peek(e), [h, e]), $ = Q(h.subscribe, k, k), O = C(() => y === null ? void 0 : h.peek(y), [h, y]), m = Q(h.subscribe, O, O);
1457
+ G(() => e === null ? void 0 : h.open(e), [h, e]), G(() => y === null ? void 0 : h.retain(y), [h, y]);
1458
+ const w = e === null ? Ie : lo(e, $, y, m, !T.current), S = e === null ? null : w.kind === "document" && !w.stale ? w.path : y;
1459
+ S !== y && L(S);
1460
+ const E = H(() => Kr(u), [u]), R = H(() => [...d.iframeHosts], [d]), F = n.kind === "panel", I = H(
1432
1461
  () => ({
1433
1462
  labels: E,
1434
- emptyMessage: h.documentEmpty,
1435
- theme: m,
1436
- availableStyles: f.documentStyles,
1437
- iFrameAllowedDomains: y,
1438
- embeds: f.embeds,
1439
- linkComponent: Lr,
1463
+ emptyMessage: u.documentEmpty,
1464
+ theme: p,
1465
+ availableStyles: d.documentStyles,
1466
+ iFrameAllowedDomains: R,
1467
+ embeds: d.embeds,
1468
+ linkComponent: Fr,
1440
1469
  toolbar: b,
1441
1470
  style: t.style,
1442
1471
  onStyleChange: t.onStyleChange,
@@ -1448,64 +1477,64 @@ const _r = /* @__PURE__ */ x.forwardRef(Fr), qr = Object.freeze({ className: "aq
1448
1477
  padding: t.padding,
1449
1478
  width: t.width === void 0 ? void 0 : `min(${t.width}, 100%)`,
1450
1479
  maxWidth: t.maxWidth === void 0 ? void 0 : `min(${t.maxWidth}, 100%)`,
1451
- renderScrollBar: $ ? void 0 : Rt
1480
+ renderScrollBar: F ? void 0 : Lt
1452
1481
  }),
1453
- [E, h.documentEmpty, m, f.documentStyles, y, f.embeds, b, t, $]
1454
- ), C = P((M, _) => $ ? _ === null || _.kind === "failure" ? vt(M) : _.name : h.documentRegion, [$, h.documentRegion]), B = $ ? "content" : "fill";
1455
- return e === null ? /* @__PURE__ */ d(pe, { value: B, children: /* @__PURE__ */ d(Ur, {}) }) : /* @__PURE__ */ d(pe, { value: B, children: /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d(Ft, { label: C(e, null) }), children: /* @__PURE__ */ d(no, { requestedPath: e, content: p, viewer: I, regionLabel: C, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: a }) }) });
1456
- }, ro = ({ path: e, variant: t, onDocumentShown: n }) => {
1457
- const { config: r, viewSettings: o, announcer: l } = D(), s = me((y) => y.style), a = me((y) => y.align), f = _e(), h = pt(), m = De(), { view: g, overrides: b, embed: R } = t, k = P(
1458
- (y) => {
1459
- if (m.kind !== "location") return;
1460
- const $ = Zr(r, m.location, y);
1461
- $ !== null && f($, "browse");
1482
+ [E, u.documentEmpty, p, d.documentStyles, R, d.embeds, b, t, F]
1483
+ ), N = C((W, U) => F ? U === null || U.kind === "failure" ? Et(W) : U.name : u.documentRegion, [F, u.documentRegion]), B = F ? "content" : "fill";
1484
+ return e === null ? /* @__PURE__ */ c(Ee, { value: B, children: /* @__PURE__ */ c(Xr, {}) }) : /* @__PURE__ */ c(Ee, { value: B, children: /* @__PURE__ */ c(we, { fallback: /* @__PURE__ */ c(zt, { label: N(e, null) }), children: /* @__PURE__ */ c(io, { requestedPath: e, content: w, viewer: I, regionLabel: N, navigation: n, fragment: r, paneScroll: o, announces: l, announceFailure: s, onDocumentShown: i }) }) });
1485
+ }, ao = ({ path: e, variant: t, onDocumentShown: n }) => {
1486
+ const { config: r, viewSettings: o, announcer: l } = P(), s = ve((R) => R.style), i = ve((R) => R.align), d = Be(), u = vt(), p = qe(), { view: h, overrides: b, embed: T } = t, y = C(
1487
+ (R) => {
1488
+ if (p.kind !== "location") return;
1489
+ const F = Yr(r, p.location, R);
1490
+ F !== null && d(F, "browse");
1462
1491
  },
1463
- [r, f, m]
1464
- ), A = P(
1465
- (y) => {
1466
- o.update({ style: y }), k("style");
1492
+ [r, d, p]
1493
+ ), L = C(
1494
+ (R) => {
1495
+ o.update({ style: R }), y("style");
1467
1496
  },
1468
- [o, k]
1469
- ), T = P(
1470
- (y) => {
1471
- o.update({ align: y }), k("align");
1497
+ [o, y]
1498
+ ), k = C(
1499
+ (R) => {
1500
+ o.update({ align: R }), y("align");
1472
1501
  },
1473
- [o, k]
1474
- ), F = $t(r, b.style, s), O = Dt(b.align, a), u = H(
1502
+ [o, y]
1503
+ ), $ = _t(r, b.style, s), O = Bt(b.align, i), m = H(
1475
1504
  () => ({
1476
- style: F,
1477
- onStyleChange: A,
1505
+ style: $,
1506
+ onStyleChange: L,
1478
1507
  align: O,
1479
- onAlignChange: T,
1480
- showToc: R.showToc !== !1,
1481
- showStyle: R.showStyle !== !1,
1482
- showAlign: R.showAlign !== !1,
1483
- padding: R.padding,
1484
- width: R.width,
1485
- maxWidth: R.maxWidth
1508
+ onAlignChange: k,
1509
+ showToc: T.showToc !== !1,
1510
+ showStyle: T.showStyle !== !1,
1511
+ showAlign: T.showAlign !== !1,
1512
+ padding: T.padding,
1513
+ width: T.width,
1514
+ maxWidth: T.maxWidth
1486
1515
  }),
1487
- [F, A, O, T, R]
1488
- ), p = H(() => ({ kind: "page", view: g, overrides: b, embed: R }), [g, b, R]), S = H(() => ({ kind: "page", fragment: h.hash, navigation: h }), [h]), E = P((y) => l.announce(y), [l]);
1489
- return /* @__PURE__ */ d(_t, { path: e, display: u, navigation: p, fragment: S, paneScroll: er, announces: !0, announceFailure: E, onDocumentShown: n });
1490
- }, oo = ({ path: e, variant: t, onDocumentShown: n }) => {
1491
- const { config: r, viewSettings: o } = D(), l = me((p) => p.style), s = me((p) => p.align), [a, f] = Z(() => $t(r, void 0, l)), h = Dt(void 0, s), m = P((p) => o.update({ align: p }), [o]), { maximized: g, onDocumentLink: b, pendingHash: R, onHashConsumed: k, announceFailure: A, paneScroll: T } = t, F = H(
1516
+ [$, L, O, k, T]
1517
+ ), w = H(() => ({ kind: "page", view: h, overrides: b, embed: T }), [h, b, T]), S = H(() => ({ kind: "page", fragment: u.hash, navigation: u }), [u]), E = C((R) => l.announce(R), [l]);
1518
+ return /* @__PURE__ */ c(Zt, { path: e, display: m, navigation: w, fragment: S, paneScroll: sr, announces: !0, announceFailure: E, onDocumentShown: n });
1519
+ }, co = ({ path: e, variant: t, onDocumentShown: n }) => {
1520
+ const { config: r, viewSettings: o } = P(), l = ve((w) => w.style), s = ve((w) => w.align), [i, d] = Z(() => _t(r, void 0, l)), u = Bt(void 0, s), p = C((w) => o.update({ align: w }), [o]), { maximized: h, onDocumentLink: b, pendingHash: T, onHashConsumed: y, announceFailure: L, paneScroll: k } = t, $ = H(
1492
1521
  () => ({
1493
- style: a,
1494
- onStyleChange: f,
1495
- align: h,
1496
- onAlignChange: m,
1497
- showToc: g,
1498
- showStyle: g,
1499
- showAlign: g,
1522
+ style: i,
1523
+ onStyleChange: d,
1524
+ align: u,
1525
+ onAlignChange: p,
1526
+ showToc: h,
1527
+ showStyle: h,
1528
+ showAlign: h,
1500
1529
  padding: void 0,
1501
1530
  width: void 0,
1502
1531
  maxWidth: void 0
1503
1532
  }),
1504
- [a, h, m, g]
1505
- ), O = H(() => ({ kind: "panel", onDocumentLink: b }), [b]), u = H(() => ({ kind: "panel", fragment: R, consume: k }), [R, k]);
1506
- return /* @__PURE__ */ d(_t, { path: e, display: F, navigation: O, fragment: u, paneScroll: T, announces: !1, announceFailure: A, onDocumentShown: n });
1507
- }, lo = ({ path: e, variant: t, onDocumentShown: n }) => t.kind === "page" ? /* @__PURE__ */ d(ro, { path: e, variant: t, onDocumentShown: n }) : /* @__PURE__ */ d(oo, { path: e, variant: t, onDocumentShown: n });
1508
- function io({
1533
+ [i, u, p, h]
1534
+ ), O = H(() => ({ kind: "panel", onDocumentLink: b }), [b]), m = H(() => ({ kind: "panel", fragment: T, consume: y }), [T, y]);
1535
+ return /* @__PURE__ */ c(Zt, { path: e, display: $, navigation: O, fragment: m, paneScroll: k, announces: !1, announceFailure: L, onDocumentShown: n });
1536
+ }, uo = ({ path: e, variant: t, onDocumentShown: n }) => t.kind === "page" ? /* @__PURE__ */ c(ao, { path: e, variant: t, onDocumentShown: n }) : /* @__PURE__ */ c(co, { path: e, variant: t, onDocumentShown: n });
1537
+ function mo({
1509
1538
  title: e,
1510
1539
  titleId: t,
1511
1540
  ...n
@@ -1526,169 +1555,242 @@ function io({
1526
1555
  clipRule: "evenodd"
1527
1556
  }));
1528
1557
  }
1529
- const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co = (e, t) => {
1530
- const { documents: n, announcer: r, labels: o } = D(), l = P(() => n.peek(e), [n, e]), s = P(() => n.peekSeeded(e), [n, e]), a = ne(n.subscribe, l, s), f = P(() => n.answerStampOf(e), [n, e]), h = ne(n.subscribe, f, f), [m] = Z(() => /* @__PURE__ */ new Set()), [g, b] = Z(ao), [R, k] = Z(null);
1531
- R !== null && R.path !== e && k(null);
1532
- const A = j(null);
1533
- V(() => (A.current = e, () => {
1534
- A.current = null;
1558
+ const fo = /* @__PURE__ */ x.forwardRef(mo);
1559
+ function po({
1560
+ title: e,
1561
+ titleId: t,
1562
+ ...n
1563
+ }, r) {
1564
+ return /* @__PURE__ */ x.createElement("svg", Object.assign({
1565
+ xmlns: "http://www.w3.org/2000/svg",
1566
+ viewBox: "0 0 24 24",
1567
+ fill: "currentColor",
1568
+ "aria-hidden": "true",
1569
+ "data-slot": "icon",
1570
+ ref: r,
1571
+ "aria-labelledby": t
1572
+ }, n), e ? /* @__PURE__ */ x.createElement("title", {
1573
+ id: t
1574
+ }, e) : null, /* @__PURE__ */ x.createElement("path", {
1575
+ fillRule: "evenodd",
1576
+ d: "M14.447 3.026a.75.75 0 0 1 .527.921l-4.5 16.5a.75.75 0 0 1-1.448-.394l4.5-16.5a.75.75 0 0 1 .921-.527ZM16.72 6.22a.75.75 0 0 1 1.06 0l5.25 5.25a.75.75 0 0 1 0 1.06l-5.25 5.25a.75.75 0 1 1-1.06-1.06L21.44 12l-4.72-4.72a.75.75 0 0 1 0-1.06Zm-9.44 0a.75.75 0 0 1 0 1.06L2.56 12l4.72 4.72a.75.75 0 0 1-1.06 1.06L.97 12.53a.75.75 0 0 1 0-1.06l5.25-5.25a.75.75 0 0 1 1.06 0Z",
1577
+ clipRule: "evenodd"
1578
+ }));
1579
+ }
1580
+ const ho = /* @__PURE__ */ x.forwardRef(po), go = /* @__PURE__ */ new Set(), wo = (e, t) => {
1581
+ const { documents: n, announcer: r, labels: o } = P(), l = C(() => n.peek(e), [n, e]), s = C(() => n.peekSeeded(e), [n, e]), i = Q(n.subscribe, l, s), d = C(() => n.answerStampOf(e), [n, e]), u = Q(n.subscribe, d, d), [p] = Z(() => /* @__PURE__ */ new Set()), [h, b] = Z(go), [T, y] = Z(null);
1582
+ T !== null && T.path !== e && y(null);
1583
+ const L = j(null);
1584
+ G(() => (L.current = e, () => {
1585
+ L.current = null;
1535
1586
  }), [e]);
1536
- const T = P(() => {
1537
- const u = e, p = n.peek(u);
1538
- if (m.has(u) || p?.status === "pending") return;
1539
- const S = t && !Ot(p);
1540
- m.add(u), b(new Set(m)), k(null), (async () => {
1587
+ const k = C(() => {
1588
+ const m = e, w = n.peek(m);
1589
+ if (p.has(m) || w?.status === "pending") return;
1590
+ const S = t && !Ct(w);
1591
+ p.add(m), b(new Set(p)), y(null), (async () => {
1541
1592
  try {
1542
- const E = await n.refresh(u);
1543
- if (A.current !== u || E.status === "superseded") return;
1593
+ const E = await n.refresh(m);
1594
+ if (L.current !== m || E.status === "superseded") return;
1544
1595
  if (E.status === "failed") {
1545
- k({ path: u, failure: E.failure, stamp: n.answerStampOf(u) }), r.announce(o.documentRefreshFailed(ve(o, E.failure.reason)));
1596
+ y({ path: m, failure: E.failure, stamp: n.answerStampOf(m) }), r.announce(o.documentRefreshFailed(ae(o, E.failure.reason)));
1546
1597
  return;
1547
1598
  }
1548
- const y = he(n.peek(u));
1549
- if (S || y === null || y.document.kind === "failure") return;
1550
- r.announce(o.documentRefreshed(y.document.name));
1599
+ const R = ie(n.peek(m));
1600
+ if (S || R === null || R.document.kind === "failure") return;
1601
+ r.announce(o.documentRefreshed(R.document.name));
1551
1602
  } finally {
1552
- m.delete(u), b(new Set(m));
1603
+ p.delete(m), b(new Set(p));
1553
1604
  }
1554
1605
  })();
1555
- }, [e, t, m, n, r, o]), F = g.has(e), O = R !== null && R.path === e && R.stamp === h ? R.failure : null;
1556
- return { refreshing: F, unavailable: F || a?.status === "pending", failure: O, refresh: T };
1557
- }, uo = Object.freeze({ kind: "page" }), fo = (e) => {
1606
+ }, [e, t, p, n, r, o]), $ = h.has(e), O = T !== null && T.path === e && T.stamp === u ? T.failure : null;
1607
+ return { refreshing: $, unavailable: $ || i?.status === "pending", failure: O, refresh: k };
1608
+ }, vo = Object.freeze({ kind: "page" }), dt = (e) => {
1558
1609
  e.stopPropagation();
1559
- }, mo = ({ path: e, placement: t }) => {
1560
- const { labels: n } = D(), { refreshing: r, unavailable: o, failure: l, refresh: s } = co(e, t.kind === "page"), a = t.kind === "panel" ? n.refreshDocumentNamed(t.documentName) : null;
1561
- return /* @__PURE__ */ U("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", children: [
1562
- /* @__PURE__ */ d("div", { className: "aqmx-document-refresh-row", children: /* @__PURE__ */ U(
1563
- "button",
1564
- {
1565
- type: "button",
1566
- className: a === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
1567
- title: a === null ? n.refreshDocument : a,
1568
- "aria-label": a === null ? void 0 : a,
1569
- "aria-disabled": o,
1570
- "aria-busy": r,
1571
- "data-aqmx-busy": r ? "true" : void 0,
1572
- "data-testid": "markdown-explorer-document-refresh",
1573
- onClick: s,
1574
- onDoubleClick: fo,
1575
- children: [
1576
- /* @__PURE__ */ d(so, { "aria-hidden": "true" }),
1577
- a === null ? /* @__PURE__ */ d("span", { children: n.refreshDocumentLabel }) : null
1578
- ]
1579
- }
1580
- ) }),
1581
- l === null ? null : /* @__PURE__ */ d("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": l.reason, children: n.documentRefreshFailed(ve(n, l.reason)) })
1610
+ }, bo = ({ path: e, placement: t }) => {
1611
+ const { labels: n } = P(), { refreshing: r, unavailable: o, failure: l, refresh: s } = wo(e, t.kind === "page"), i = Wr(e), d = t.kind === "panel" ? n.refreshDocumentNamed(t.documentName) : null, u = t.kind === "panel" ? n.showMarkupNamed(t.documentName) : null;
1612
+ return /* @__PURE__ */ z("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", children: [
1613
+ /* @__PURE__ */ z("div", { className: "aqmx-document-refresh-row", children: [
1614
+ i.available ? /* @__PURE__ */ z(
1615
+ "button",
1616
+ {
1617
+ type: "button",
1618
+ className: u === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
1619
+ title: u === null ? n.showMarkup : u,
1620
+ "aria-label": u === null ? void 0 : u,
1621
+ "aria-pressed": i.shown,
1622
+ "data-testid": "markdown-explorer-document-markup",
1623
+ onClick: i.toggle,
1624
+ onDoubleClick: dt,
1625
+ children: [
1626
+ /* @__PURE__ */ c(ho, { "aria-hidden": "true" }),
1627
+ u === null ? /* @__PURE__ */ c("span", { children: n.showMarkupLabel }) : null
1628
+ ]
1629
+ }
1630
+ ) : null,
1631
+ /* @__PURE__ */ z(
1632
+ "button",
1633
+ {
1634
+ type: "button",
1635
+ className: d === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
1636
+ title: d === null ? n.refreshDocument : d,
1637
+ "aria-label": d === null ? void 0 : d,
1638
+ "aria-disabled": o,
1639
+ "aria-busy": r,
1640
+ "data-aqmx-busy": r ? "true" : void 0,
1641
+ "data-testid": "markdown-explorer-document-refresh",
1642
+ onClick: s,
1643
+ onDoubleClick: dt,
1644
+ children: [
1645
+ /* @__PURE__ */ c(fo, { "aria-hidden": "true" }),
1646
+ d === null ? /* @__PURE__ */ c("span", { children: n.refreshDocumentLabel }) : null
1647
+ ]
1648
+ }
1649
+ )
1650
+ ] }),
1651
+ l === null ? null : /* @__PURE__ */ c("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": l.reason, children: n.documentRefreshFailed(ae(n, l.reason)) })
1582
1652
  ] });
1583
- }, go = ({ location: e }) => {
1653
+ }, Eo = ({ location: e }) => {
1584
1654
  const t = e.doc, n = H(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]);
1585
- return /* @__PURE__ */ U("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", children: [
1586
- /* @__PURE__ */ d(mo, { path: t, placement: uo }),
1587
- /* @__PURE__ */ d(lo, { path: t, variant: n })
1655
+ return /* @__PURE__ */ z("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", children: [
1656
+ /* @__PURE__ */ c(bo, { path: t, placement: vo }),
1657
+ /* @__PURE__ */ c(uo, { path: t, variant: n })
1588
1658
  ] });
1589
- }, ho = ({ holds: e, testId: t }) => {
1590
- const { labels: n, announcer: r } = D(), o = jt();
1591
- V(() => e ? r.claim(o) : void 0, [e, r, o]);
1592
- const l = P(() => r.shownIn(o), [r, o]), s = ne(r.subscribe, l, l);
1593
- return /* @__PURE__ */ d("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: s.length > 1 ? n.announcementSequence(s) : s[0] });
1594
- }, te = Object.freeze([]), st = (e) => {
1659
+ }, So = ({ holds: e, testId: t }) => {
1660
+ const { labels: n, announcer: r } = P(), o = Gt();
1661
+ G(() => e ? r.claim(o) : void 0, [e, r, o]);
1662
+ const l = C(() => r.shownIn(o), [r, o]), s = Q(r.subscribe, l, l);
1663
+ return /* @__PURE__ */ c("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: s.length > 1 ? n.announcementSequence(s) : s[0] });
1664
+ }, re = Object.freeze([]), ko = (e) => {
1595
1665
  const t = /* @__PURE__ */ new Set();
1596
- let n = te, r = [], o = !1;
1597
- const l = [], s = (m) => {
1598
- n = m;
1599
- for (const g of [...t]) g();
1600
- }, a = () => l.at(-1)?.region, f = (m) => {
1601
- const g = a();
1602
- m(), a() !== g && n !== te && s(te);
1603
- }, h = () => {
1666
+ let n = re, r = [], o = !1;
1667
+ const l = [], s = (p) => {
1668
+ n = p;
1669
+ for (const h of [...t]) h();
1670
+ }, i = () => l.at(-1)?.region, d = (p) => {
1671
+ const h = i();
1672
+ p(), i() !== h && n !== re && s(re);
1673
+ }, u = () => {
1604
1674
  o = !1;
1605
- const m = r.map((g) => "sentence" in g ? g.sentence : g.list(g.items));
1606
- r = [], s(Object.freeze(m));
1675
+ const p = r.map((h) => "sentence" in h ? h.sentence : h.list(h.items));
1676
+ r = [], s(Object.freeze(p));
1607
1677
  };
1608
1678
  return {
1609
- announce: (m) => {
1610
- if (typeof m == "string") r.push({ sentence: m });
1679
+ announce: (p) => {
1680
+ if (typeof p == "string") r.push({ sentence: p });
1611
1681
  else {
1612
- const g = r.find((b) => "list" in b && b.list === m.list);
1613
- g !== void 0 && "items" in g ? g.items.push(m.item) : r.push({ list: m.list, items: [m.item] });
1682
+ const h = r.find((b) => "list" in b && b.list === p.list);
1683
+ h !== void 0 && "items" in h ? h.items.push(p.item) : r.push({ list: p.list, items: [p.item] });
1614
1684
  }
1615
- o || (o = !0, n !== te && s(te), e.request(h));
1685
+ o || (o = !0, n !== re && s(re), e.request(u));
1616
1686
  },
1617
- subscribe: (m) => (t.add(m), () => {
1618
- t.delete(m);
1687
+ subscribe: (p) => (t.add(p), () => {
1688
+ t.delete(p);
1619
1689
  }),
1620
- claim: (m) => {
1621
- const g = { region: m };
1622
- return f(() => l.push(g)), () => f(() => {
1623
- const b = l.indexOf(g);
1690
+ claim: (p) => {
1691
+ const h = { region: p };
1692
+ return d(() => l.push(h)), () => d(() => {
1693
+ const b = l.indexOf(h);
1624
1694
  b !== -1 && l.splice(b, 1);
1625
1695
  });
1626
1696
  },
1627
- shownIn: (m) => a() === m ? n : te
1697
+ shownIn: (p) => i() === p ? n : re
1628
1698
  };
1629
- }, at = Object.freeze({ status: "cancelled" }), po = (e) => {
1699
+ }, fe = Object.freeze({ status: "cancelled" }), xo = (e) => {
1630
1700
  if (e === null || typeof e != "object") return null;
1631
1701
  const { failure: t } = e;
1632
- if (an(t) !== null) return null;
1702
+ if (gn(t) !== null) return null;
1633
1703
  const { reason: n, code: r } = t;
1634
- return cn(n, r);
1635
- }, wo = ({ dataPath: e, onScope: t, fetch: n }) => {
1636
- const r = n ?? ((a, f) => globalThis.fetch(a, f)), o = (a, f) => `${e}/${a}?${new URLSearchParams(f).toString()}`, l = async (a, f, h, m) => {
1637
- let g;
1704
+ return wn(n, r);
1705
+ }, yo = ({ dataPath: e, onScope: t, fetch: n }) => {
1706
+ const r = n ?? ((i, d) => globalThis.fetch(i, d)), o = (i, d) => `${e}/${i}?${new URLSearchParams(d).toString()}`, l = async (i, d, u, p) => {
1707
+ let h;
1638
1708
  try {
1639
- g = await r(a, { credentials: "same-origin", ...f, headers: { Accept: "application/json", ...f.headers } });
1709
+ h = await r(i, { credentials: "same-origin", ...d, headers: { Accept: "application/json", ...d.headers } });
1640
1710
  } catch {
1641
- return m({ reason: "failed" });
1711
+ return p({ reason: "failed" });
1642
1712
  }
1643
- g.status === 401 && t(null);
1644
- const b = g.headers.get(on);
1713
+ h.status === 401 && t(null);
1714
+ const b = h.headers.get(un);
1645
1715
  b !== null && t(b);
1646
- let R;
1716
+ let T;
1647
1717
  try {
1648
- R = await g.json();
1718
+ T = await h.json();
1649
1719
  } catch {
1650
- return m({ reason: Ue(g.status) });
1720
+ return p({ reason: Ge(h.status) });
1651
1721
  }
1652
- let k;
1722
+ let y;
1653
1723
  try {
1654
- k = h(R);
1724
+ y = u(T);
1655
1725
  } catch {
1656
- k = !1;
1726
+ y = !1;
1657
1727
  }
1658
- if (k) return R;
1659
- const A = po(R);
1660
- return m(A !== null ? A : { reason: g.status === 200 ? "failed" : Ue(g.status) });
1661
- }, s = { [mn]: dn };
1728
+ if (y) return T;
1729
+ const L = xo(T);
1730
+ return p(L !== null ? L : { reason: h.status === 200 ? "failed" : Ge(h.status) });
1731
+ }, s = { [En]: vn };
1662
1732
  return {
1663
- tree: (a) => l(o("tree", { [Y.source]: a }), { method: "GET" }, Ve, (f) => ({ status: "error", failure: f })),
1664
- children: async (a, f, h) => {
1665
- const m = await l(o("children", { [Y.source]: a, [Y.path]: f }), { method: "GET", signal: h }, sn, (g) => ({ status: "error", failure: g }));
1666
- return h.aborted ? at : m;
1733
+ tree: (i) => l(o("tree", { [X.source]: i }), { method: "GET" }, Ke, (d) => ({ status: "error", failure: d })),
1734
+ children: async (i, d, u) => {
1735
+ const p = await l(o("children", { [X.source]: i, [X.path]: d }), { method: "GET", signal: u }, hn, (h) => ({ status: "error", failure: h }));
1736
+ return u.aborted ? fe : p;
1667
1737
  },
1668
- ancestors: async (a, f, h) => {
1669
- const m = await l(o("ancestors", { [Y.source]: a, [Y.path]: f }), { method: "GET", signal: h }, ln, (g) => ({ status: "error", failure: g }));
1670
- return h.aborted ? at : m;
1738
+ ancestors: async (i, d, u) => {
1739
+ const p = await l(o("ancestors", { [X.source]: i, [X.path]: d }), { method: "GET", signal: u }, pn, (h) => ({ status: "error", failure: h }));
1740
+ return u.aborted ? fe : p;
1671
1741
  },
1672
- document: (a, { refresh: f }) => l(o("document", { [Y.path]: a }), f ? { method: "GET", headers: s } : { method: "GET" }, fn, (h) => un(h.reason, h.code)),
1673
- refresh: (a) => l(o("refresh", { [Y.source]: a }), { method: "POST", headers: s }, Ve, (f) => ({ status: "error", failure: f }))
1742
+ reveal: async (i, d, u) => {
1743
+ const p = await l(o("reveal", { [X.source]: i, [X.path]: d }), { method: "GET", signal: u }, fn, (h) => ({ status: "error", failure: h }));
1744
+ return u.aborted ? fe : p;
1745
+ },
1746
+ document: (i, { refresh: d }) => l(o("document", { [X.path]: i }), d ? { method: "GET", headers: s } : { method: "GET" }, bn, (u) => We(u.reason, u.code)),
1747
+ text: async (i, d) => {
1748
+ const u = await l(o("text", { [X.path]: i }), { method: "GET", signal: d }, mn, (p) => We(p.reason, p.code));
1749
+ return d.aborted ? fe : u;
1750
+ },
1751
+ refresh: (i) => l(o("refresh", { [X.source]: i }), { method: "POST", headers: s }, Ke, (d) => ({ status: "error", failure: d }))
1752
+ };
1753
+ }, Ro = () => {
1754
+ const e = /* @__PURE__ */ new Set(), t = ce();
1755
+ return {
1756
+ isShown: (n) => e.has(n),
1757
+ toggle: (n) => {
1758
+ e.delete(n) || e.add(n), t.emit();
1759
+ },
1760
+ subscribe: t.subscribe
1761
+ };
1762
+ }, To = () => {
1763
+ let e = null, t = null;
1764
+ return {
1765
+ settle: (n) => {
1766
+ e = n;
1767
+ },
1768
+ mayMove: (n) => e !== n,
1769
+ move: (n, r, o) => {
1770
+ e = r, t = { sourceId: n, path: r, ancestors: o };
1771
+ },
1772
+ take: (n, r) => {
1773
+ const o = t !== null && t.sourceId === n && t.path === r ? t.ancestors : null;
1774
+ return t = null, o;
1775
+ }
1674
1776
  };
1675
- }, vo = (e) => {
1676
- const t = pn(e);
1677
- if (t === null) return Ie;
1777
+ }, Ao = (e) => {
1778
+ const t = xn(e);
1779
+ if (t === null) return Ue;
1678
1780
  try {
1679
- return Qt(JSON.parse(t));
1781
+ return ln(JSON.parse(t));
1680
1782
  } catch (n) {
1681
- return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), Ie;
1783
+ return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), Ue;
1682
1784
  }
1683
- }, ct = (e, t) => {
1785
+ }, ut = (e, t) => {
1684
1786
  let n = null;
1685
1787
  const r = () => {
1686
1788
  if (n === null) {
1687
- const l = vo(e);
1688
- n = { changes: l, settings: He(t, l) };
1789
+ const l = Ao(e);
1790
+ n = { changes: l, settings: Ze(t, l) };
1689
1791
  }
1690
1792
  return n;
1691
- }, o = be();
1793
+ }, o = ce();
1692
1794
  return {
1693
1795
  storageKey: e,
1694
1796
  defaults: t,
@@ -1696,209 +1798,209 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1696
1798
  getServerSnapshot: () => t,
1697
1799
  subscribe: o.subscribe,
1698
1800
  advance: (l) => {
1699
- const { changes: s, settings: a } = r(), f = Yt(s, l, Xt(a, l)[l], t);
1700
- return n = { changes: f, settings: He(t, f) }, o.emit(), hn(e, Jt(f)), n.settings;
1801
+ const { changes: s, settings: i } = r(), d = nn(s, l, rn(i, l)[l], t);
1802
+ return n = { changes: d, settings: Ze(t, d) }, o.emit(), kn(e, on(d)), n.settings;
1701
1803
  }
1702
1804
  };
1703
- }, bo = Object.freeze({ status: "refreshed" }), Eo = Object.freeze({ status: "superseded" }), Pe = Object.freeze({ status: "deferred" }), So = At(Pe), qt = 4, yo = qt - 1, dt = Object.freeze({ status: "loading" }), xo = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), ko = (e) => {
1704
- const t = /* @__PURE__ */ new Map(), n = Tt(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = be(), f = /* @__PURE__ */ new Set();
1705
- let h = 0, m = 0;
1706
- const g = { direct: null, bulk: null }, b = /* @__PURE__ */ new Set();
1707
- let R = !1, k = 0;
1708
- const A = () => {
1709
- k += 1, a.emit();
1710
- }, T = (i) => o.get(i) ?? 0, F = (i) => {
1711
- let c = s.get(i);
1712
- return c === void 0 && (c = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, s.set(i, c)), c;
1713
- }, O = (i, c, w) => {
1714
- i.inFlight.delete(c), h -= 1, w.lane === "bulk" && (m -= 1);
1715
- }, u = (i) => {
1716
- const c = s.get(i);
1717
- if (c !== void 0) {
1718
- for (const [w, v] of [...c.inFlight])
1719
- O(c, w, v), v.controller.abort();
1720
- c.direct.clear(), c.bulk.clear(), c.unclaimed.clear();
1805
+ }, Lo = Object.freeze({ status: "refreshed" }), Oo = Object.freeze({ status: "superseded" }), Fe = Object.freeze({ status: "deferred" }), Mo = Mt(Fe), Ut = 4, Co = Ut - 1, mt = Object.freeze({ status: "loading" }), No = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), Po = (e) => {
1806
+ const t = /* @__PURE__ */ new Map(), n = Ot(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = ce(), d = /* @__PURE__ */ new Set();
1807
+ let u = 0, p = 0;
1808
+ const h = { direct: null, bulk: null }, b = /* @__PURE__ */ new Set();
1809
+ let T = !1, y = 0;
1810
+ const L = () => {
1811
+ y += 1, i.emit();
1812
+ }, k = (a) => o.get(a) ?? 0, $ = (a) => {
1813
+ let f = s.get(a);
1814
+ return f === void 0 && (f = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, s.set(a, f)), f;
1815
+ }, O = (a, f, g) => {
1816
+ a.inFlight.delete(f), u -= 1, g.lane === "bulk" && (p -= 1);
1817
+ }, m = (a) => {
1818
+ const f = s.get(a);
1819
+ if (f !== void 0) {
1820
+ for (const [g, v] of [...f.inFlight])
1821
+ O(f, g, v), v.controller.abort();
1822
+ f.direct.clear(), f.bulk.clear(), f.unclaimed.clear();
1721
1823
  }
1722
- }, p = (i) => {
1723
- const c = T(i) + 1;
1724
- return o.set(i, c), u(i), c;
1725
- }, S = (i, c) => {
1726
- const w = ae(i), v = { promise: i, opened: c, stale: !1, loadedAt: w?.status === "ok" ? w.loadedAt : null };
1727
- return i.status === "pending" && i.then((L) => {
1728
- L.status === "ok" && (v.loadedAt = L.loadedAt);
1824
+ }, w = (a) => {
1825
+ const f = k(a) + 1;
1826
+ return o.set(a, f), m(a), f;
1827
+ }, S = (a, f) => {
1828
+ const g = me(a), v = { promise: a, opened: f, stale: !1, loadedAt: g?.status === "ok" ? g.loadedAt : null };
1829
+ return a.status === "pending" && a.then((A) => {
1830
+ A.status === "ok" && (v.loadedAt = A.loadedAt);
1729
1831
  }), v;
1730
- }, E = (i) => {
1731
- let c = r.get(i);
1732
- return c === void 0 && (c = /* @__PURE__ */ new Map(), r.set(i, c)), c;
1733
- }, y = (i) => {
1734
- const c = [...s.keys()], w = g[i], v = w === null ? 0 : c.indexOf(w) + 1;
1735
- for (let L = 0; L < c.length; L += 1) {
1736
- const N = c[(v + L) % c.length], q = N === void 0 ? void 0 : s.get(N);
1737
- if (!(N === void 0 || q === void 0)) {
1738
- for (const z of q[i])
1739
- if ((q.claims.get(z) ?? 0) !== 0)
1740
- return q[i].delete(z), g[i] = N, { sourceId: N, path: z };
1832
+ }, E = (a) => {
1833
+ let f = r.get(a);
1834
+ return f === void 0 && (f = /* @__PURE__ */ new Map(), r.set(a, f)), f;
1835
+ }, R = (a) => {
1836
+ const f = [...s.keys()], g = h[a], v = g === null ? 0 : f.indexOf(g) + 1;
1837
+ for (let A = 0; A < f.length; A += 1) {
1838
+ const M = f[(v + A) % f.length], _ = M === void 0 ? void 0 : s.get(M);
1839
+ if (!(M === void 0 || _ === void 0)) {
1840
+ for (const D of _[a])
1841
+ if ((_.claims.get(D) ?? 0) !== 0)
1842
+ return _[a].delete(D), h[a] = M, { sourceId: M, path: D };
1741
1843
  }
1742
1844
  }
1743
1845
  return null;
1744
- }, $ = (i, c, w, v) => {
1745
- const L = s.get(i);
1746
- if (L === void 0 || L.inFlight.get(c) !== w) return;
1747
- O(L, c, w);
1748
- const N = (L.claims.get(c) ?? 0) > 0, q = E(i);
1749
- if (v.status === "ok" ? q.set(c, { status: "loaded", entries: v.entries }) : v.status === "error" && N ? q.set(c, { status: "failed", failure: v.failure }) : q.delete(c), A(), v.status === "error" && N) {
1750
- const z = { sourceId: i, path: c, failure: v.failure };
1751
- for (const K of [...f]) K(z);
1846
+ }, F = (a, f, g, v) => {
1847
+ const A = s.get(a);
1848
+ if (A === void 0 || A.inFlight.get(f) !== g) return;
1849
+ O(A, f, g);
1850
+ const M = (A.claims.get(f) ?? 0) > 0, _ = E(a);
1851
+ if (v.status === "ok" ? _.set(f, { status: "loaded", entries: v.entries }) : v.status === "error" && M ? _.set(f, { status: "failed", failure: v.failure }) : _.delete(f), L(), v.status === "error" && M) {
1852
+ const D = { sourceId: a, path: f, failure: v.failure };
1853
+ for (const Y of [...d]) Y(D);
1752
1854
  }
1753
- C();
1754
- }, I = (i, c, w) => {
1755
- const v = { controller: new AbortController(), lane: w };
1756
- F(i).inFlight.set(c, v), h += 1, w === "bulk" && (m += 1), e.children(i, c, v.controller.signal).then(
1757
- (L) => $(i, c, v, L),
1758
- () => $(i, c, v, xo)
1855
+ N();
1856
+ }, I = (a, f, g) => {
1857
+ const v = { controller: new AbortController(), lane: g };
1858
+ $(a).inFlight.set(f, v), u += 1, g === "bulk" && (p += 1), e.children(a, f, v.controller.signal).then(
1859
+ (A) => F(a, f, v, A),
1860
+ () => F(a, f, v, No)
1759
1861
  );
1760
- }, C = () => {
1761
- for (; h < qt; ) {
1762
- const i = y("direct");
1763
- if (i !== null) {
1764
- I(i.sourceId, i.path, "direct");
1862
+ }, N = () => {
1863
+ for (; u < Ut; ) {
1864
+ const a = R("direct");
1865
+ if (a !== null) {
1866
+ I(a.sourceId, a.path, "direct");
1765
1867
  continue;
1766
1868
  }
1767
- const c = m < yo ? y("bulk") : null;
1768
- if (c === null) return;
1769
- I(c.sourceId, c.path, "bulk");
1869
+ const f = p < Co ? R("bulk") : null;
1870
+ if (f === null) return;
1871
+ I(f.sourceId, f.path, "bulk");
1770
1872
  }
1771
- }, B = (i, c, w) => {
1772
- if (!(c.direct.delete(w) || c.bulk.delete(w))) {
1773
- const L = c.inFlight.get(w);
1774
- if (L === void 0) return !1;
1775
- O(c, w, L), L.controller.abort();
1873
+ }, B = (a, f, g) => {
1874
+ if (!(f.direct.delete(g) || f.bulk.delete(g))) {
1875
+ const A = f.inFlight.get(g);
1876
+ if (A === void 0) return !1;
1877
+ O(f, g, A), A.controller.abort();
1776
1878
  }
1777
- return r.get(i)?.delete(w), !0;
1778
- }, M = () => {
1779
- R = !1;
1780
- let i = !1;
1781
- for (const c of b) {
1782
- const w = F(c);
1783
- for (const v of w.unclaimed)
1784
- (w.claims.get(v) ?? 0) === 0 && B(c, w, v) && (i = !0);
1785
- w.unclaimed.clear();
1879
+ return r.get(a)?.delete(g), !0;
1880
+ }, W = () => {
1881
+ T = !1;
1882
+ let a = !1;
1883
+ for (const f of b) {
1884
+ const g = $(f);
1885
+ for (const v of g.unclaimed)
1886
+ (g.claims.get(v) ?? 0) === 0 && B(f, g, v) && (a = !0);
1887
+ g.unclaimed.clear();
1786
1888
  }
1787
- b.clear(), i && (A(), C());
1788
- }, _ = (i, c) => {
1789
- t.set(i, S(ie(e.tree(i)), c));
1790
- }, Q = (i, c, w) => {
1791
- p(i);
1792
- const v = S(At(c), w);
1793
- return t.set(i, v), r.delete(i), A(), C(), v;
1794
- }, oe = (i, c, w, v) => {
1795
- if (w !== T(i) || t.get(i) !== c) return;
1796
- const L = ae(c.promise);
1797
- if (!(v.status !== "ok" || L?.status !== "ok" || c.loadedAt === null || v.loadedAt <= c.loadedAt)) {
1798
- if (ge(L.entries, v.entries)) {
1799
- c.loadedAt = v.loadedAt;
1889
+ b.clear(), a && (L(), N());
1890
+ }, U = (a, f) => {
1891
+ t.set(a, S(se(e.tree(a)), f));
1892
+ }, q = (a, f, g) => {
1893
+ w(a);
1894
+ const v = S(Mt(f), g);
1895
+ return t.set(a, v), r.delete(a), L(), N(), v;
1896
+ }, V = (a, f, g, v) => {
1897
+ if (g !== k(a) || t.get(a) !== f) return;
1898
+ const A = me(f.promise);
1899
+ if (!(v.status !== "ok" || A?.status !== "ok" || f.loadedAt === null || v.loadedAt <= f.loadedAt)) {
1900
+ if (be(A.entries, v.entries)) {
1901
+ f.loadedAt = v.loadedAt;
1800
1902
  return;
1801
1903
  }
1802
- Q(i, v, c.opened);
1904
+ q(a, v, f.opened);
1803
1905
  }
1804
- }, W = (i, c) => {
1805
- const w = t.get(i);
1806
- return w !== void 0 && ae(w.promise)?.status === c;
1807
- }, Te = (i, c) => {
1808
- c.stale = !1;
1809
- const w = T(i);
1810
- e.tree(i).then((v) => oe(i, c, w, v));
1906
+ }, K = (a, f) => {
1907
+ const g = t.get(a);
1908
+ return g !== void 0 && me(g.promise)?.status === f;
1909
+ }, Ae = (a, f) => {
1910
+ f.stale = !1;
1911
+ const g = k(a);
1912
+ e.tree(a).then((v) => V(a, f, g, v));
1811
1913
  };
1812
1914
  return {
1813
- read: (i) => t.get(i)?.promise ?? So,
1814
- open: (i) => {
1815
- const c = n.resumes(i), w = n.hold(i), v = t.get(i);
1816
- return v === void 0 || W(i, "deferred") ? (_(i, !0), A()) : c || (v.opened && W(i, "error") ? (_(i, !0), A()) : (v.opened = !0, v.stale && W(i, "ok") && Te(i, v))), w;
1915
+ read: (a) => t.get(a)?.promise ?? Mo,
1916
+ open: (a) => {
1917
+ const f = n.resumes(a), g = n.hold(a), v = t.get(a);
1918
+ return v === void 0 || K(a, "deferred") ? (U(a, !0), L()) : f || (v.opened && K(a, "error") ? (U(a, !0), L()) : (v.opened = !0, v.stale && K(a, "ok") && Ae(a, v))), g;
1817
1919
  },
1818
- retry: (i) => {
1819
- W(i, "error") && (_(i, !0), A());
1920
+ retry: (a) => {
1921
+ K(a, "error") && (U(a, !0), L());
1820
1922
  },
1821
- seed: (i, c) => {
1822
- const w = c.then(
1823
- (N) => N === null ? Pe : N,
1824
- () => Pe
1825
- ), v = t.get(i);
1826
- if (v !== void 0 && W(i, "ok")) {
1827
- const N = T(i);
1828
- w.then((q) => oe(i, v, N, q));
1923
+ seed: (a, f) => {
1924
+ const g = f.then(
1925
+ (M) => M === null ? Fe : M,
1926
+ () => Fe
1927
+ ), v = t.get(a);
1928
+ if (v !== void 0 && K(a, "ok")) {
1929
+ const M = k(a);
1930
+ g.then((_) => V(a, v, M, _));
1829
1931
  return;
1830
1932
  }
1831
- p(i);
1832
- const L = S(ie(w), v?.opened === !0);
1833
- t.set(i, L), r.delete(i), C(), w.then((N) => {
1834
- t.get(i) === L && (N.status === "deferred" && n.isHeld(i) && _(i, L.opened), A());
1933
+ w(a);
1934
+ const A = S(se(g), v?.opened === !0);
1935
+ t.set(a, A), r.delete(a), N(), g.then((M) => {
1936
+ t.get(a) === A && (M.status === "deferred" && n.isHeld(a) && U(a, A.opened), L());
1835
1937
  });
1836
1938
  },
1837
- refresh: async (i) => {
1838
- const c = (l.get(i) ?? 0) + 1;
1839
- l.set(i, c);
1840
- const w = await e.refresh(i);
1841
- if (l.get(i) !== c) return Eo;
1842
- if (w.status === "error") return { status: "failed", failure: w.failure };
1843
- const v = t.get(i);
1844
- if (!(v !== void 0 && v.loadedAt !== null && W(i, "ok") && v.loadedAt > w.loadedAt)) {
1845
- const N = Q(i, w, !0);
1939
+ refresh: async (a) => {
1940
+ const f = (l.get(a) ?? 0) + 1;
1941
+ l.set(a, f);
1942
+ const g = await e.refresh(a);
1943
+ if (l.get(a) !== f) return Oo;
1944
+ if (g.status === "error") return { status: "failed", failure: g.failure };
1945
+ const v = t.get(a);
1946
+ if (!(v !== void 0 && v.loadedAt !== null && K(a, "ok") && v.loadedAt > g.loadedAt)) {
1947
+ const M = q(a, g, !0);
1846
1948
  if (v !== void 0 && v.promise.status === "pending") {
1847
- const q = T(i);
1848
- v.promise.then((z) => oe(i, N, q, z));
1949
+ const _ = k(a);
1950
+ v.promise.then((D) => V(a, M, _, D));
1849
1951
  }
1850
1952
  }
1851
- for (const [N, q] of t)
1852
- N !== i && ae(q.promise)?.status === "ok" && (q.stale = !0);
1853
- return bo;
1953
+ for (const [M, _] of t)
1954
+ M !== a && me(_.promise)?.status === "ok" && (_.stale = !0);
1955
+ return Lo;
1854
1956
  },
1855
- children: (i, c) => r.get(i)?.get(c),
1856
- claimChildren: (i, c) => {
1857
- const w = F(i), v = E(i);
1858
- let L = !1, N = !1;
1859
- for (const [z, K] of c)
1860
- w.claims.set(z, (w.claims.get(z) ?? 0) + 1), v.get(z) === void 0 ? (v.set(z, dt), w[K].add(z), L = !0, N = !0) : K === "direct" && w.bulk.delete(z) && (w.direct.add(z), N = !0);
1861
- L && A(), N && C();
1862
- let q = !1;
1957
+ children: (a, f) => r.get(a)?.get(f),
1958
+ claimChildren: (a, f) => {
1959
+ const g = $(a), v = E(a);
1960
+ let A = !1, M = !1;
1961
+ for (const [D, Y] of f)
1962
+ g.claims.set(D, (g.claims.get(D) ?? 0) + 1), v.get(D) === void 0 ? (v.set(D, mt), g[Y].add(D), A = !0, M = !0) : Y === "direct" && g.bulk.delete(D) && (g.direct.add(D), M = !0);
1963
+ A && L(), M && N();
1964
+ let _ = !1;
1863
1965
  return () => {
1864
- if (!q) {
1865
- q = !0;
1866
- for (const z of c.keys()) {
1867
- const K = (w.claims.get(z) ?? 0) - 1;
1868
- K > 0 ? w.claims.set(z, K) : (w.claims.delete(z), w.unclaimed.add(z));
1966
+ if (!_) {
1967
+ _ = !0;
1968
+ for (const D of f.keys()) {
1969
+ const Y = (g.claims.get(D) ?? 0) - 1;
1970
+ Y > 0 ? g.claims.set(D, Y) : (g.claims.delete(D), g.unclaimed.add(D));
1869
1971
  }
1870
- b.add(i), !R && (R = !0, queueMicrotask(M));
1972
+ b.add(a), !T && (T = !0, queueMicrotask(W));
1871
1973
  }
1872
1974
  };
1873
1975
  },
1874
- retryChildren: (i, c) => {
1875
- const w = r.get(i);
1876
- if (w === void 0 || w.get(c)?.status !== "failed") return;
1877
- const v = F(i);
1878
- if ((v.claims.get(c) ?? 0) > 0) {
1879
- w.set(c, dt), v.direct.add(c), A(), C();
1976
+ retryChildren: (a, f) => {
1977
+ const g = r.get(a);
1978
+ if (g === void 0 || g.get(f)?.status !== "failed") return;
1979
+ const v = $(a);
1980
+ if ((v.claims.get(f) ?? 0) > 0) {
1981
+ g.set(f, mt), v.direct.add(f), L(), N();
1880
1982
  return;
1881
1983
  }
1882
- w.delete(c), A();
1984
+ g.delete(f), L();
1883
1985
  },
1884
- pendingChildren: (i) => {
1885
- const c = s.get(i);
1886
- return c === void 0 ? 0 : c.direct.size + c.bulk.size + c.inFlight.size;
1986
+ pendingChildren: (a) => {
1987
+ const f = s.get(a);
1988
+ return f === void 0 ? 0 : f.direct.size + f.bulk.size + f.inFlight.size;
1887
1989
  },
1888
1990
  clear: () => {
1889
- for (const i of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...s.keys()])) p(i);
1890
- for (const [i, c] of l) l.set(i, c + 1);
1891
- t.clear(), r.clear(), A();
1991
+ for (const a of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...s.keys()])) w(a);
1992
+ for (const [a, f] of l) l.set(a, f + 1);
1993
+ t.clear(), r.clear(), L();
1892
1994
  },
1893
- subscribeChildrenFailures: (i) => (f.add(i), () => {
1894
- f.delete(i);
1995
+ subscribeChildrenFailures: (a) => (d.add(a), () => {
1996
+ d.delete(a);
1895
1997
  }),
1896
- subscribe: a.subscribe,
1897
- version: () => k
1998
+ subscribe: i.subscribe,
1999
+ version: () => y
1898
2000
  };
1899
- }, Ro = (e, t) => {
2001
+ }, $o = (e, t) => {
1900
2002
  let n = e;
1901
- const r = be();
2003
+ const r = ce();
1902
2004
  return {
1903
2005
  getSnapshot: () => n,
1904
2006
  subscribe: r.subscribe,
@@ -1906,70 +2008,70 @@ const so = /* @__PURE__ */ x.forwardRef(io), ao = /* @__PURE__ */ new Set(), co
1906
2008
  n = { ...n, ...o }, t(n), r.emit();
1907
2009
  }
1908
2010
  };
1909
- }, To = 1;
1910
- let ce = 0, X = null;
1911
- const Ao = () => {
2011
+ }, Fo = 1;
2012
+ let pe = 0, te = null;
2013
+ const Do = () => {
1912
2014
  const { documentElement: e, body: t } = document;
1913
- ce === 0 && (X = { 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"), ce += 1;
2015
+ pe === 0 && (te = { 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"), pe += 1;
1914
2016
  let n = !1;
1915
2017
  return () => {
1916
- n || (n = !0, ce -= 1, !(ce > 0 || X === null) && (e.style.overflow = X.htmlOverflow, t.style.overflow = X.bodyOverflow, e.style.scrollbarGutter = X.htmlGutter, t.style.scrollbarGutter = X.bodyGutter, X = null));
2018
+ n || (n = !0, pe -= 1, !(pe > 0 || te === null) && (e.style.overflow = te.htmlOverflow, t.style.overflow = te.bodyOverflow, e.style.scrollbarGutter = te.htmlGutter, t.style.scrollbarGutter = te.bodyGutter, te = null));
1917
2019
  };
1918
- }, Oo = [
2020
+ }, qo = [
1919
2021
  { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
1920
2022
  { selector: "[data-aqmx-explorer-body]", name: "tree area" }
1921
- ], ut = 1, ft = (e) => e.getClientRects().length > 0, Oe = "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.", Lo = (e) => {
1922
- if (!ft(e)) return null;
2023
+ ], ft = 1, pt = (e) => e.getClientRects().length > 0, Oe = "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.", _o = (e) => {
2024
+ if (!pt(e)) return null;
1923
2025
  const t = e.getBoundingClientRect(), n = window.innerHeight;
1924
- if (t.bottom > n + To)
2026
+ if (t.bottom > n + Fo)
1925
2027
  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. ${Oe}`;
1926
- if (t.height < ut)
2028
+ if (t.height < ft)
1927
2029
  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. ${Oe}`;
1928
- for (const { selector: r, name: o } of Oo)
2030
+ for (const { selector: r, name: o } of qo)
1929
2031
  for (const l of e.querySelectorAll(r)) {
1930
- if (!ft(l)) continue;
2032
+ if (!pt(l)) continue;
1931
2033
  const s = l.getBoundingClientRect().height;
1932
- if (s < ut)
2034
+ if (s < ft)
1933
2035
  return `[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(s))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Oe}`;
1934
2036
  }
1935
2037
  return null;
1936
- }, Co = (e) => {
2038
+ }, Bo = (e) => {
1937
2039
  let t = !1;
1938
2040
  const n = () => {
1939
2041
  if (t) return;
1940
- const o = Lo(e);
2042
+ const o = _o(e);
1941
2043
  o !== null && (t = !0, console.error(o));
1942
2044
  }, r = typeof ResizeObserver > "u" ? null : new ResizeObserver(n);
1943
2045
  return r?.observe(e), window.addEventListener("resize", n), n(), () => {
1944
2046
  r?.disconnect(), window.removeEventListener("resize", n);
1945
2047
  };
1946
- }, Mo = (e, t) => {
1947
- J(() => e ? Ao() : void 0, [e]), J(() => {
2048
+ }, jo = (e, t) => {
2049
+ ee(() => e ? Do() : void 0, [e]), ee(() => {
1948
2050
  const n = t.current;
1949
2051
  if (!(!e || n === null))
1950
- return Co(n);
2052
+ return Bo(n);
1951
2053
  }, [e, t]);
1952
- }, mt = '[data-testid="markdown-explorer-view-switch"]', No = [
1953
- { control: mt, successors: [mt, '[data-testid="markdown-explorer-sheet-toggle"]'] },
2054
+ }, ht = '[data-testid="markdown-explorer-view-switch"]', zo = [
2055
+ { control: ht, successors: [ht, '[data-testid="markdown-explorer-sheet-toggle"]'] },
1954
2056
  { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
1955
- ], Po = (e) => {
1956
- for (const t of No) {
2057
+ ], Ho = (e) => {
2058
+ for (const t of zo) {
1957
2059
  const n = e.closest(t.control);
1958
2060
  if (n !== null) return { element: n, control: t };
1959
2061
  }
1960
2062
  return null;
1961
- }, $o = (e, t) => {
2063
+ }, Io = (e, t) => {
1962
2064
  const n = j(null);
1963
- J(() => {
1964
- const o = (a) => {
1965
- const f = e.current;
1966
- n.current = f !== null && a instanceof Element && f.contains(a) ? Po(a) : null;
1967
- }, l = (a) => o(a.target);
2065
+ ee(() => {
2066
+ const o = (i) => {
2067
+ const d = e.current;
2068
+ n.current = d !== null && i instanceof Element && d.contains(i) ? Ho(i) : null;
2069
+ }, l = (i) => o(i.target);
1968
2070
  o(document.activeElement);
1969
- const s = (a) => {
1970
- const f = a.target;
1971
- a.relatedTarget !== null || !(f instanceof Element) || queueMicrotask(() => {
1972
- n.current?.element === f && f.isConnected && document.activeElement !== f && (n.current = null);
2071
+ const s = (i) => {
2072
+ const d = i.target;
2073
+ i.relatedTarget !== null || !(d instanceof Element) || queueMicrotask(() => {
2074
+ n.current?.element === d && d.isConnected && document.activeElement !== d && (n.current = null);
1973
2075
  });
1974
2076
  };
1975
2077
  return document.addEventListener("focusin", l), document.addEventListener("focusout", s), () => {
@@ -1977,158 +2079,160 @@ const Ao = () => {
1977
2079
  };
1978
2080
  }, [e]);
1979
2081
  const r = j(t);
1980
- V(() => {
2082
+ G(() => {
1981
2083
  if (r.current === t) return;
1982
2084
  r.current = t;
1983
2085
  const o = n.current;
1984
2086
  if (o === null) return;
1985
2087
  const l = () => {
1986
- const f = document.activeElement;
1987
- if (f !== null && f !== document.body && f !== o.element) return !0;
1988
- const h = e.current;
1989
- if (h === null) return !0;
1990
- for (const m of o.control.successors)
1991
- for (const g of h.querySelectorAll(m))
1992
- if (g !== o.element && (g.focus({ preventScroll: !0 }), document.activeElement === g))
2088
+ const d = document.activeElement;
2089
+ if (d !== null && d !== document.body && d !== o.element) return !0;
2090
+ const u = e.current;
2091
+ if (u === null) return !0;
2092
+ for (const p of o.control.successors)
2093
+ for (const h of u.querySelectorAll(p))
2094
+ if (h !== o.element && (h.focus({ preventScroll: !0 }), document.activeElement === h))
1993
2095
  return !0;
1994
2096
  return !1;
1995
2097
  };
1996
2098
  if (l()) return;
1997
2099
  const s = e.current;
1998
2100
  if (s === null) return;
1999
- const a = new MutationObserver(() => {
2000
- l() && a.disconnect();
2101
+ const i = new MutationObserver(() => {
2102
+ l() && i.disconnect();
2001
2103
  });
2002
- return a.observe(s, { childList: !0, subtree: !0 }), () => a.disconnect();
2104
+ return i.observe(s, { childList: !0, subtree: !0 }), () => i.disconnect();
2003
2105
  }, [t, e]);
2004
- }, Do = $e(() => import("./TreeLayout-C7ZNnaOr.js").then((e) => ({ default: e.TreeLayout }))), Fo = $e(() => import("./MultiLayout-8s7q3-Hm.js").then((e) => ({ default: e.MultiLayout }))), _o = 64, gt = {
2106
+ }, Zo = De(() => import("./TreeLayout-CqzxLpoM.js").then((e) => ({ default: e.TreeLayout }))), Uo = De(() => import("./MultiLayout-hPmV-bae.js").then((e) => ({ default: e.MultiLayout }))), Vo = 64, Go = {
2005
2107
  request: (e) => {
2006
2108
  requestAnimationFrame(e);
2007
2109
  }
2008
- }, ht = (e) => {
2110
+ }, gt = (e) => {
2009
2111
  e.documents.clear(), e.trees.clear();
2010
- }, Le = (e, t) => {
2112
+ }, Me = (e, t) => {
2011
2113
  t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
2012
2114
  for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
2013
- }, qo = (e, t) => {
2014
- const [n, r] = Z(() => ({ overrides: t, locale: e, labels: Ke(e, t) }));
2015
- if (n.locale === e && An(n.overrides, t)) return n.labels;
2016
- const o = { overrides: t, locale: e, labels: Ke(e, t) };
2115
+ }, Wo = (e, t) => {
2116
+ const [n, r] = Z(() => ({ overrides: t, locale: e, labels: Je(e, t) }));
2117
+ if (n.locale === e && $n(n.overrides, t)) return n.labels;
2118
+ const o = { overrides: t, locale: e, labels: Je(e, t) };
2017
2119
  return r(o), o.labels;
2018
- }, Bo = (e, t, n) => {
2019
- const [r, o] = Z(() => ({ scope: t, store: ct(e, n) }));
2120
+ }, Ko = (e, t, n) => {
2121
+ const [r, o] = Z(() => ({ scope: t, store: ut(e, n) }));
2020
2122
  if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
2021
- const l = { scope: t, store: ct(e, n) };
2123
+ const l = { scope: t, store: ut(e, n) };
2022
2124
  return o(l), l.store;
2023
- }, zo = (e) => {
2024
- const [t, n] = Z(() => ({ scope: e, announcer: st(gt) }));
2025
- if (t.scope === e) return t.announcer;
2026
- const r = { scope: e, announcer: st(gt) };
2027
- return n(r), r.announcer;
2028
- }, Qo = ({ data: e, config: t, storageNamespace: n, locale: r, labels: o, theme: l, renderFrame: s, renderTreeFailure: a, lockDocumentScroll: f = !1, onMathDiagnostics: h }) => {
2029
- wn(n);
2030
- const m = St(r), g = On(l), b = qo(m, o), { revalidate: R } = Vt(), k = j(() => {
2031
- }), A = we(t.dataPath), [T] = Z(() => {
2032
- const M = wo({ dataPath: A, onScope: (Q) => k.current(Q) }), _ = { documents: qn({ client: M, capacity: Math.max(_o, t.multiView.maxPanels * 2) }), trees: ko(M) };
2033
- return Le(_, e), Ge(n, e.scope), { data: M, ..._, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
2125
+ }, Ce = (e, t) => {
2126
+ const [n, r] = Z(() => ({ scope: e, value: t() }));
2127
+ if (n.scope === e) return n.value;
2128
+ const o = { scope: e, value: t() };
2129
+ return r(o), o.value;
2130
+ }, Yo = () => ko(Go), cl = ({ data: e, config: t, storageNamespace: n, locale: r, labels: o, theme: l, renderFrame: s, renderTreeFailure: i, lockDocumentScroll: d = !1, onMathDiagnostics: u }) => {
2131
+ yn(n);
2132
+ const p = xt(r), h = Fn(l), b = Wo(p, o), { revalidate: T } = Jt(), y = j(() => {
2133
+ }), L = Se(t.dataPath), [k] = Z(() => {
2134
+ const q = yo({ dataPath: L, onScope: (K) => y.current(K) }), V = { documents: Zn({ client: q, capacity: Math.max(Vo, t.multiView.maxPanels * 2) }), trees: Po(q) };
2135
+ return Me(V, e), Ye(n, e.scope), { data: q, ...V, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
2034
2136
  });
2035
- if (T.aligned.pageData !== e || T.aligned.storageNamespace !== n) {
2036
- const M = T.aligned.pageData;
2037
- T.aligned.pageData = e, T.aligned.storageNamespace = n, M !== e && (M.scope !== e.scope ? T.aligned.pendingReader = e : Le(T, e)), Ge(n, e.scope);
2137
+ if (k.aligned.pageData !== e || k.aligned.storageNamespace !== n) {
2138
+ const q = k.aligned.pageData;
2139
+ k.aligned.pageData = e, k.aligned.storageNamespace = n, q !== e && (q.scope !== e.scope ? k.aligned.pendingReader = e : Me(k, e)), Ye(n, e.scope);
2038
2140
  }
2039
- const F = Bo(vn(n).treeSettings, e.scope, t.defaultTreeSettings);
2040
- V(() => {
2041
- const M = T.aligned.pendingReader;
2042
- M !== null && (T.aligned.pendingReader = null, ht(T), Le(T, M));
2043
- }, [e, T]), V(() => {
2044
- let M = !1;
2045
- return k.current = (_) => {
2046
- _ === e.scope || M || (M = !0, _ !== null && (ht(T), bn(n)), R());
2141
+ const $ = Ko(Rn(n).treeSettings, e.scope, t.defaultTreeSettings);
2142
+ G(() => {
2143
+ const q = k.aligned.pendingReader;
2144
+ q !== null && (k.aligned.pendingReader = null, gt(k), Me(k, q));
2145
+ }, [e, k]), G(() => {
2146
+ let q = !1;
2147
+ return y.current = (V) => {
2148
+ V === e.scope || q || (q = !0, V !== null && (gt(k), Tn(n)), T());
2047
2149
  }, () => {
2048
- k.current = () => {
2150
+ y.current = () => {
2049
2151
  };
2050
2152
  };
2051
- }, [e, R, T, n]);
2153
+ }, [e, T, k, n]);
2052
2154
  const O = j(t.settingsCookie);
2053
- V(() => {
2155
+ G(() => {
2054
2156
  O.current = t.settingsCookie;
2055
2157
  }, [t.settingsCookie]);
2056
- const [u] = Z(
2057
- () => Ro(e.settings, (M) => {
2058
- document.cookie = tn(O.current, M, window.location.protocol === "https:");
2158
+ const [m] = Z(
2159
+ () => $o(e.settings, (q) => {
2160
+ document.cookie = an(O.current, q, window.location.protocol === "https:");
2059
2161
  })
2060
- ), p = zo(e.scope), S = H(() => ie(e.notices.catch(() => [])), [e.notices]), E = e.sources.map((M) => M.id).join(`
2061
- `), y = H(() => en(t, E.split(`
2062
- `)), [t, E]), $ = j(h);
2063
- V(() => {
2064
- $.current = h;
2065
- }, [h]);
2066
- const [I] = Z(() => (M, _) => {
2067
- $.current?.(M, _);
2068
- }), C = h === void 0 ? void 0 : I, B = H(
2162
+ ), w = Ce(e.scope, Yo), S = Ce(e.scope, To), E = Ce(e.scope, Ro), R = H(() => se(e.notices.catch(() => [])), [e.notices]), F = e.sources.map((q) => q.id).join(`
2163
+ `), I = H(() => sn(t, F.split(`
2164
+ `)), [t, F]), N = j(u);
2165
+ G(() => {
2166
+ N.current = u;
2167
+ }, [u]);
2168
+ const [B] = Z(() => (q, V) => {
2169
+ N.current?.(q, V);
2170
+ }), W = u === void 0 ? void 0 : B, U = H(
2069
2171
  () => ({
2070
- config: y,
2172
+ config: I,
2071
2173
  labels: b,
2072
- locale: m,
2073
- theme: g,
2174
+ locale: p,
2175
+ theme: h,
2074
2176
  storageNamespace: n,
2075
2177
  scope: e.scope,
2076
2178
  sources: e.sources,
2077
- notices: S,
2078
- documents: T.documents,
2079
- trees: T.trees,
2080
- data: T.data,
2081
- viewSettings: u,
2082
- treeSettings: F,
2083
- announcer: p,
2084
- renderTreeFailure: a,
2085
- reportMathDiagnostics: C
2179
+ notices: R,
2180
+ documents: k.documents,
2181
+ trees: k.trees,
2182
+ data: k.data,
2183
+ viewSettings: m,
2184
+ treeSettings: $,
2185
+ announcer: w,
2186
+ reveals: S,
2187
+ markupViews: E,
2188
+ renderTreeFailure: i,
2189
+ reportMathDiagnostics: W
2086
2190
  }),
2087
- [y, b, m, g, n, e.scope, e.sources, S, T, u, F, p, a, C]
2191
+ [I, b, p, h, n, e.scope, e.sources, R, k, m, $, w, S, E, i, W]
2088
2192
  );
2089
- return /* @__PURE__ */ d(yt, { value: B, children: /* @__PURE__ */ d(Ho, { renderFrame: s, lockDocumentScroll: f }, e.scope) });
2090
- }, jo = ({ ref: e, theme: t, view: n, children: r }) => {
2091
- const [o] = Z(mr);
2092
- 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 });
2093
- }, Ho = ({ renderFrame: e, lockDocumentScroll: t }) => {
2094
- const { theme: n, labels: r } = D(), o = De(), { hash: l } = pt(), s = _e(), a = j(null);
2095
- Mo(t, a), V(() => {
2193
+ return /* @__PURE__ */ c(yt, { value: U, children: /* @__PURE__ */ c(Jo, { renderFrame: s, lockDocumentScroll: d }, e.scope) });
2194
+ }, Xo = ({ ref: e, theme: t, view: n, children: r }) => {
2195
+ const [o] = Z(br);
2196
+ 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 });
2197
+ }, Jo = ({ renderFrame: e, lockDocumentScroll: t }) => {
2198
+ const { theme: n, labels: r } = P(), o = qe(), { hash: l } = vt(), s = Be(), i = j(null);
2199
+ jo(t, i), G(() => {
2096
2200
  o.kind === "redirect" && s(`${o.href}${l}`, "browse");
2097
2201
  }, [o, l, s]);
2098
- const { location: f } = o, h = f.view;
2099
- $o(a, h);
2100
- const m = f.view === "tree" ? /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ d(Do, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ d(fe, { fallback: /* @__PURE__ */ d("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ d(Fo, { location: f }) }) : /* @__PURE__ */ d(go, { location: f }), g = /* @__PURE__ */ U(jo, { ref: a, theme: n, view: h, children: [
2101
- m,
2102
- /* @__PURE__ */ d(ho, { holds: !0, testId: "markdown-explorer-announcer" })
2202
+ const { location: d } = o, u = d.view;
2203
+ Io(i, u);
2204
+ const p = d.view === "tree" ? /* @__PURE__ */ c(we, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading" }), children: /* @__PURE__ */ c(Zo, { location: d }) }) : d.view === "multi" ? /* @__PURE__ */ c(we, { fallback: /* @__PURE__ */ c("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading" }), children: /* @__PURE__ */ c(Uo, { location: d }) }) : /* @__PURE__ */ c(Eo, { location: d }), h = /* @__PURE__ */ z(Xo, { ref: i, theme: n, view: u, children: [
2205
+ p,
2206
+ /* @__PURE__ */ c(So, { holds: !0, testId: "markdown-explorer-announcer" })
2103
2207
  ] });
2104
- return e === void 0 ? g : e({ view: h, children: g });
2105
- }, el = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
2208
+ return e === void 0 ? h : e({ view: u, children: h });
2209
+ }, dl = ({ currentUrl: e, nextUrl: t, formMethod: n, defaultShouldRevalidate: r }) => n === void 0 && e.href === t.href && r;
2106
2210
  export {
2107
- mo as D,
2108
- Mn as E,
2109
- Nn as F,
2110
- pr as I,
2111
- Fn as L,
2112
- kn as M,
2113
- uo as P,
2114
- _e as a,
2115
- lo as b,
2116
- be as c,
2117
- so as d,
2118
- Jo as e,
2119
- kt as f,
2120
- Pn as g,
2121
- ve as h,
2122
- De as i,
2123
- ho as j,
2124
- me as k,
2125
- En as l,
2126
- Ye as m,
2127
- Et as n,
2128
- Sn as o,
2129
- We as p,
2130
- Qo as q,
2131
- Ke as r,
2132
- el as s,
2133
- D as u
2211
+ bo as D,
2212
+ _n as E,
2213
+ Tt as F,
2214
+ kr as I,
2215
+ Hn as L,
2216
+ Cn as M,
2217
+ vo as P,
2218
+ Be as a,
2219
+ uo as b,
2220
+ ce as c,
2221
+ fo as d,
2222
+ al as e,
2223
+ At as f,
2224
+ Bn as g,
2225
+ ae as h,
2226
+ qe as i,
2227
+ So as j,
2228
+ ve as k,
2229
+ An as l,
2230
+ Qe as m,
2231
+ kt as n,
2232
+ Ln as o,
2233
+ Xe as p,
2234
+ cl as q,
2235
+ Je as r,
2236
+ dl as s,
2237
+ P as u
2134
2238
  };