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