@aiquants/markdown-explorer 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +45 -6
  3. package/dist/ExplorerSplit-rUVsf5i-.cjs +1 -0
  4. package/dist/ExplorerSplit-uX2ojZe8.js +1479 -0
  5. package/dist/MultiLayout-8s7q3-Hm.js +919 -0
  6. package/dist/MultiLayout-ZK2V9nms.cjs +1 -0
  7. package/dist/NativeScrollBar-D3VDRQqf.js +59 -0
  8. package/dist/NativeScrollBar-DqkutcGb.cjs +1 -0
  9. package/dist/{TreeLayout-D6hCSihW.js → TreeLayout-C7ZNnaOr.js} +3 -3
  10. package/dist/{TreeLayout-BQUfVNlA.cjs → TreeLayout-DkTVgxxb.cjs} +1 -1
  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 +8 -0
  14. package/dist/core/contracts.d.ts +8 -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-DYjYBiXF.cjs +1 -0
  20. package/dist/{dataRoute-zUX-oR9j.js → dataRoute-Dl6xmEFs.js} +41 -36
  21. package/dist/index-CLe6vRXs.cjs +3 -0
  22. package/dist/{index-BJTmp0lR.js → index-Dv9lUZqD.js} +530 -503
  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 +23 -22
  27. package/dist/location-2QZADLiv.cjs +1 -0
  28. package/dist/{location-V5BKeWNs.js → location-CaNtUswk.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 +725 -680
  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/package.json +7 -7
  51. package/dist/ExplorerSplit-B7pmzR8t.js +0 -1362
  52. package/dist/ExplorerSplit-Bi3yU6NG.cjs +0 -1
  53. package/dist/MultiLayout-BxeXOLX1.js +0 -909
  54. package/dist/MultiLayout-DtFrFRmS.cjs +0 -1
  55. package/dist/dataRoute-B9Wk-G7A.cjs +0 -1
  56. package/dist/index-DkiGlM7C.cjs +0 -3
  57. package/dist/location-DfYTzfFS.cjs +0 -1
@@ -1,1362 +0,0 @@
1
- import { jsx as m, jsxs as S, Fragment as _e } from "react/jsx-runtime";
2
- import { u as k, F as ct, d as ge, f as Ie, g as it, E as dt, h as ut, i as mt, L as pt, j as ft } from "./index-BJTmp0lR.js";
3
- import * as p from "react";
4
- import { use as ie, createContext as ve, useState as N, useCallback as x, useMemo as C, useRef as v, useLayoutEffect as P, useSyncExternalStore as de, useEffect as H, Suspense as De, useId as ue } from "react";
5
- import { C as ht, k as xt, l as He, v as wt, m as gt, n as vt, E as bt, o as qe, q as Et, s as yt, S as ce, t as Rt, F as St, A as Tt } from "./location-V5BKeWNs.js";
6
- import { useDirectoryTreeState as Lt, DirectoryTree as Nt } from "@aiquants/directory-tree";
7
- import { tapScrollCircleSampleVisual as kt } from "@aiquants/virtualscroll";
8
- import { s as qt } from "./storage-DA4ItHzl.js";
9
- import { PanelGroup as At, Panel as Ae, PanelResizeHandle as Ot } from "@aiquants/resize-panels";
10
- import { useLocation as Ct } from "react-router";
11
- function Pt({
12
- title: e,
13
- titleId: t,
14
- ...n
15
- }, r) {
16
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
17
- xmlns: "http://www.w3.org/2000/svg",
18
- viewBox: "0 0 24 24",
19
- fill: "currentColor",
20
- "aria-hidden": "true",
21
- "data-slot": "icon",
22
- ref: r,
23
- "aria-labelledby": t
24
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
25
- id: t
26
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
27
- fillRule: "evenodd",
28
- d: "M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15ZM9 12.75a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5H9Z",
29
- clipRule: "evenodd"
30
- }));
31
- }
32
- const Mt = /* @__PURE__ */ p.forwardRef(Pt);
33
- function Ft({
34
- title: e,
35
- titleId: t,
36
- ...n
37
- }, r) {
38
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
39
- xmlns: "http://www.w3.org/2000/svg",
40
- viewBox: "0 0 24 24",
41
- fill: "currentColor",
42
- "aria-hidden": "true",
43
- "data-slot": "icon",
44
- ref: r,
45
- "aria-labelledby": t
46
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
47
- id: t
48
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
49
- fillRule: "evenodd",
50
- d: "M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15Zm-6.75-10.5a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25v2.25a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V10.5Z",
51
- clipRule: "evenodd"
52
- }));
53
- }
54
- const _t = /* @__PURE__ */ p.forwardRef(Ft);
55
- function It({
56
- title: e,
57
- titleId: t,
58
- ...n
59
- }, r) {
60
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
61
- xmlns: "http://www.w3.org/2000/svg",
62
- viewBox: "0 0 24 24",
63
- fill: "currentColor",
64
- "aria-hidden": "true",
65
- "data-slot": "icon",
66
- ref: r,
67
- "aria-labelledby": t
68
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
69
- id: t
70
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
71
- d: "M16.5 6a3 3 0 0 0-3-3H6a3 3 0 0 0-3 3v7.5a3 3 0 0 0 3 3v-6A4.5 4.5 0 0 1 10.5 6h6Z"
72
- }), /* @__PURE__ */ p.createElement("path", {
73
- d: "M18 7.5a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-7.5a3 3 0 0 1-3-3v-7.5a3 3 0 0 1 3-3H18Z"
74
- }));
75
- }
76
- const Dt = /* @__PURE__ */ p.forwardRef(It);
77
- function Ht({
78
- title: e,
79
- titleId: t,
80
- ...n
81
- }, r) {
82
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
83
- xmlns: "http://www.w3.org/2000/svg",
84
- viewBox: "0 0 24 24",
85
- fill: "currentColor",
86
- "aria-hidden": "true",
87
- "data-slot": "icon",
88
- ref: r,
89
- "aria-labelledby": t
90
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
91
- id: t
92
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
93
- fillRule: "evenodd",
94
- d: "M3 6a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3V6ZM3 15.75a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2.25Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3v-2.25Z",
95
- clipRule: "evenodd"
96
- }));
97
- }
98
- const Zt = /* @__PURE__ */ p.forwardRef(Ht), $t = () => {
99
- const { notices: e } = k(), t = ie(e);
100
- return t.length === 0 ? null : /* @__PURE__ */ m("div", { className: "aqmx-explorer-notices", children: t.map((n) => /* @__PURE__ */ S("div", { className: "aqmx-callout", "data-aqmx-tone": n.tone, "data-testid": "markdown-explorer-notice", "data-aqmx-notice": n.id, children: [
101
- /* @__PURE__ */ m("p", { className: "aqmx-callout-title", children: n.title }),
102
- n.body === void 0 ? null : /* @__PURE__ */ m("p", { className: "aqmx-callout-body", children: n.body }),
103
- n.action === void 0 ? null : (
104
- /* @__PURE__ */ m("a", { className: "aqmx-callout-action", href: n.action.href, children: n.action.label })
105
- )
106
- ] }, n.id)) });
107
- };
108
- function Bt({
109
- title: e,
110
- titleId: t,
111
- ...n
112
- }, r) {
113
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
114
- xmlns: "http://www.w3.org/2000/svg",
115
- viewBox: "0 0 24 24",
116
- fill: "currentColor",
117
- "aria-hidden": "true",
118
- "data-slot": "icon",
119
- ref: r,
120
- "aria-labelledby": t
121
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
122
- id: t
123
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
124
- fillRule: "evenodd",
125
- d: "M6.912 3a3 3 0 0 0-2.868 2.118l-2.411 7.838a3 3 0 0 0-.133.882V18a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3v-4.162c0-.299-.045-.596-.133-.882l-2.412-7.838A3 3 0 0 0 17.088 3H6.912Zm13.823 9.75-2.213-7.191A1.5 1.5 0 0 0 17.088 4.5H6.912a1.5 1.5 0 0 0-1.434 1.059L3.265 12.75H6.11a3 3 0 0 1 2.684 1.658l.256.513a1.5 1.5 0 0 0 1.342.829h3.218a1.5 1.5 0 0 0 1.342-.83l.256-.512a3 3 0 0 1 2.684-1.658h2.844Z",
126
- clipRule: "evenodd"
127
- }));
128
- }
129
- const zt = /* @__PURE__ */ p.forwardRef(Bt), be = ve(!0), Ze = "\0loop\0", $e = "\0", Vt = () => {
130
- const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = (a) => {
131
- const l = e.get(a);
132
- if (l !== void 0) return l;
133
- const s = Object.freeze({ type: "loop", name: a.name, path: a.path });
134
- return e.set(a, s), s;
135
- }, o = (a, l, s) => {
136
- let u = !1;
137
- const d = a.map((f) => {
138
- const h = c(f, l, s);
139
- return h !== f && (u = !0), h;
140
- });
141
- if (!u) return a;
142
- const i = n.get(a);
143
- return i !== void 0 && i.length === d.length && i.every((f, h) => f === d[h]) ? i : (n.set(a, d), d);
144
- }, c = (a, l, s) => {
145
- if (a.type !== "directory") return a;
146
- if (s.has(a.path)) return r(a);
147
- const u = a.lazy === !0 ? l(a.path) : void 0, d = u?.status === "loaded", i = d ? u.entries : a.children;
148
- if (i === void 0) return a;
149
- s.add(a.path);
150
- const f = o(i, l, s);
151
- if (s.delete(a.path), !d && f === a.children) return a;
152
- const h = t.get(a);
153
- if (h !== void 0 && h.state === u && h.children === f) return h.grafted;
154
- const w = { ...a, children: f, lazy: d ? !1 : a.lazy };
155
- return t.set(a, { state: u, children: f, grafted: w }), w;
156
- };
157
- return (a, l) => o(a, l, /* @__PURE__ */ new Set());
158
- }, jt = (e, t) => `${Ze}${e}${$e}${t}`, ae = (e) => e.startsWith(Ze), Kt = (e) => e.slice(e.lastIndexOf($e) + 1), te = "data-aqmx-path", Ut = (e, t, n, r, o) => {
159
- const c = { aqmxPath: e.path };
160
- return n && (c.aqmxOpen = !0), (r === "loading" || r === "failed") && (c.aqmxChildren = r), {
161
- name: e.name,
162
- type: e.type,
163
- absolutePath: e.path,
164
- relativePath: e.path,
165
- mimeType: e.mimeType,
166
- children: t,
167
- label: o,
168
- data: c
169
- };
170
- }, Xt = (e, t, n, r) => {
171
- const o = jt(t, e.path);
172
- return { name: n, type: "directory", absolutePath: o, relativePath: o, children: r, data: { aqmxLoop: e.path } };
173
- }, Gt = () => {
174
- const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = [], o = (l, s, u) => {
175
- const d = l.map((f) => f.type === "loop" ? c(f, s, u) : a(f, s)), i = n.get(l);
176
- return i !== void 0 && i.length === d.length && i.every((f, h) => f === d[h]) ? i : (n.set(l, d), d);
177
- }, c = (l, s, u) => {
178
- const d = t.get(l);
179
- if (d !== void 0 && d.parentKey === u && d.loopFolderName === s.loopFolderName) return d.row;
180
- const i = Xt(l, u, s.loopFolderName(l.name), r);
181
- return t.set(l, { row: i, parentKey: u, loopFolderName: s.loopFolderName }), i;
182
- }, a = (l, s) => {
183
- const u = l.type === "directory" ? l.children === void 0 ? r : o(l.children, s, l.path) : void 0, d = s.openPaths.has(l.path), i = l.type === "directory" && l.lazy === !0 ? s.childrenOf(l.path)?.status : void 0, f = i === "failed" ? s.renderFailedFolder : void 0, h = e.get(l);
184
- if (h !== void 0 && h.open === d && h.childrenStatus === i && h.children === u && h.renderFailedFolder === f)
185
- return h.row;
186
- const w = Ut(l, u, d, i, f === void 0 ? void 0 : f(l));
187
- return e.set(l, { row: w, open: d, childrenStatus: i, children: u, renderFailedFolder: f }), w;
188
- };
189
- return (l, s) => o(l, s, "");
190
- }, Wt = (e) => {
191
- if (e === void 0) return;
192
- const t = (n) => ({ name: n.name, path: n.absolutePath, type: n.type });
193
- return (n, r) => e(t(n), t(r));
194
- }, we = (e, t) => {
195
- const n = e.filter((r) => r.type === "directory");
196
- return t === void 0 ? n : n.sort(t);
197
- }, Yt = (e, t) => {
198
- const n = /* @__PURE__ */ new Map();
199
- let r = 0;
200
- const o = (c) => {
201
- for (const a of we(c, t.compare))
202
- if (t.isShownExpanded(a.path)) {
203
- if (a.lazy !== !0) {
204
- a.children !== void 0 && o(a.children);
205
- continue;
206
- }
207
- n.has(a.path) || (n.set(a.path, t.isDirect(a.path) ? "direct" : "bulk"), t.childrenOf(a.path)?.status !== "failed" && (r += 1));
208
- }
209
- };
210
- return o(e), { folders: n, waiting: r };
211
- }, Qt = (e) => {
212
- const t = /* @__PURE__ */ new Set(), n = (r) => {
213
- for (const o of r)
214
- o.type === "directory" && (o.lazy === !0 && t.add(o.path), o.children !== void 0 && n(o.children));
215
- };
216
- return n(e), t;
217
- }, Be = (e, t) => {
218
- for (const n of e) {
219
- if (n.type !== "directory") continue;
220
- if (n.path === t) return n;
221
- const r = n.children === void 0 ? null : Be(n.children, t);
222
- if (r !== null) return r;
223
- }
224
- return null;
225
- }, Oe = /* @__PURE__ */ new Set(), Jt = (e, t) => e.has(t) ? e : new Set(e).add(t), en = (e, t) => {
226
- if (!t.some((r) => e.has(r))) return e;
227
- const n = new Set(t);
228
- return new Set([...e].filter((r) => !n.has(r)));
229
- }, tn = (e, t) => [...e].every((n) => t.has(n)) ? e : new Set([...e].filter((n) => t.has(n))), nn = () => {
230
- const [e, t] = N(Oe), n = x((a) => t((l) => Jt(l, a)), []), r = x((a) => t((l) => en(l, a)), []), o = x((a) => t((l) => tn(l, a)), []), c = x(() => t(Oe), []);
231
- return C(() => ({ direct: e, markDirect: n, unmarkDirect: r, pruneDirect: o, clearDirect: c }), [e, n, r, o, c]);
232
- }, rn = (e) => ({
233
- budget: e,
234
- handled: /* @__PURE__ */ new Set(),
235
- loads: /* @__PURE__ */ new Set(),
236
- opened: 0,
237
- folderLimited: !1,
238
- depthLimited: !1,
239
- announcedStart: !1,
240
- issuedAgainst: null
241
- }), an = (e, t) => {
242
- const n = [];
243
- let r = we(t.entries, t.compare);
244
- for (let o = 1; r.length > 0; o += 1) {
245
- const c = [];
246
- for (const a of r) {
247
- const { path: l } = a;
248
- if (t.isShownExpanded(l))
249
- e.handled.add(l);
250
- else {
251
- if (e.handled.has(l)) continue;
252
- if (e.handled.add(l), a.lazy === !0 && t.childrenOf(l) === void 0) {
253
- if (o > e.budget.maxDepth) {
254
- e.depthLimited = !0;
255
- continue;
256
- }
257
- if (e.loads.size >= e.budget.maxFolders) {
258
- e.folderLimited = !0;
259
- continue;
260
- }
261
- e.loads.add(l);
262
- }
263
- n.push(l), e.opened += 1;
264
- }
265
- a.lazy !== !0 && a.children !== void 0 && c.push(...we(a.children, t.compare));
266
- }
267
- r = c;
268
- }
269
- return n;
270
- }, ze = (e, t) => e.every((n) => n.type !== "directory" || t(n.path) && (n.lazy === !0 || n.children === void 0 || ze(n.children, t))), ln = (e, t) => {
271
- if (e.folderLimited) return { kind: "folder-limit", opened: e.opened };
272
- if (e.depthLimited) return { kind: "depth-limit", opened: e.opened };
273
- let n = 0;
274
- for (const r of e.loads) t.childrenOf(r)?.status === "failed" && (n += 1);
275
- return { kind: "done", opened: e.opened, failed: n, complete: ze(t.entries, t.isShownExpanded) };
276
- }, he = Object.freeze({ state: "idle" }), on = (e) => {
277
- const t = v(null), n = v(e), [r, o] = N(he);
278
- P(() => {
279
- n.current = e;
280
- });
281
- const c = x(() => {
282
- t.current === null && (t.current = rn(n.current.budget), o({ state: "running", opened: 0 }));
283
- }, []), a = x(() => {
284
- t.current = null, o(he);
285
- }, []), l = x((s) => {
286
- const u = t.current;
287
- if (u === null) return;
288
- const d = an(u, s);
289
- if (d.length > 0 && (u.issuedAgainst = s.expanded, n.current.expandMultiple([...d])), !u.announcedStart && (u.loads.size > 0 || s.waiting > 0) && (u.announcedStart = !0, n.current.onStart()), d.length === 0 && !s.expansionPending && s.expanded !== u.issuedAgainst && s.waiting === 0) {
290
- t.current = null;
291
- const f = ln(u, s);
292
- o(f.kind === "done" ? he : { state: "stopped", stop: f.kind, opened: f.opened }), n.current.onFinish(f);
293
- return;
294
- }
295
- const { opened: i } = u;
296
- o((f) => f.state === "running" && f.opened === i ? f : { state: "running", opened: i });
297
- }, []);
298
- return C(() => ({ status: r, start: c, end: a, advance: l }), [r, c, a, l]);
299
- }, sn = "--aqmx-tree-line", cn = Object.freeze(["(forced-colors: active)", "(prefers-color-scheme: dark)"]), dn = "data-aqmx-tree-probe", un = Object.freeze({ rowHeight: ht, lineColor: null }), mn = /^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u, pn = (e) => {
300
- const t = mn.exec(e);
301
- return t === null ? e : `#${t.slice(1).map((n) => Number(n).toString(16).padStart(2, "0")).join("")}`;
302
- }, fn = (e, t) => {
303
- const [n, r] = N(un);
304
- return P(() => {
305
- const o = e.current;
306
- if (o === null) return;
307
- const c = () => {
308
- const s = Math.round(o.getBoundingClientRect().height), u = getComputedStyle(o), d = u.getPropertyValue(sn).trim() === "" ? null : pn(u.color);
309
- r((i) => {
310
- const f = Number.isFinite(s) && s > 0 ? s : i.rowHeight;
311
- return i.rowHeight === f && i.lineColor === d ? i : { rowHeight: f, lineColor: d };
312
- });
313
- };
314
- c();
315
- const a = cn.map((s) => window.matchMedia(s));
316
- for (const s of a) s.addEventListener("change", c);
317
- const l = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
318
- return l?.observe(o), () => {
319
- for (const s of a) s.removeEventListener("change", c);
320
- l?.disconnect();
321
- };
322
- }, [e, t]), n;
323
- }, hn = { renderVisual: kt, minSpeedMultiplier: 0.25, maxSpeedMultiplier: 18 }, xn = "markdown-explorer-tree-scroll", wn = {
324
- testId: xn,
325
- overscanCount: 13,
326
- callbackThrottleMs: 13,
327
- scrollBarOptions: {
328
- width: 8,
329
- enableTrackClick: !0,
330
- enableThumbDrag: !0,
331
- enableArrowButtons: !0,
332
- enableArrowButtonTabStops: !1,
333
- enableScrollToTopBottomButtons: !0,
334
- tapScrollCircleOptions: hn
335
- },
336
- behaviorOptions: { enablePointerDrag: !0 }
337
- }, gn = { hoverClassName: "", directorySelectedClassName: "", itemSelectedClassName: "" }, vn = { color: "inherit" }, bn = { paddingBlock: 0 }, En = /* @__PURE__ */ new Set(), yn = /* @__PURE__ */ new Map(), Rn = { color: "var(--aqmx-tree-line)" }, Ce = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], Sn = (e, t, n) => {
338
- const r = v(null), o = v(null), c = x(() => {
339
- const a = t.current;
340
- r.current === null || o.current !== null || a === null || a.getClientRects().length === 0 || (o.current = requestAnimationFrame(() => {
341
- o.current = null;
342
- const l = r.current;
343
- l !== null && e.current?.scrollToPath(l, { align: "nearest" }) === !1 && (r.current = null);
344
- }));
345
- }, [e, t]);
346
- H(() => {
347
- const a = t.current;
348
- if (a === null) return;
349
- const l = () => {
350
- r.current = null;
351
- }, s = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
352
- s?.observe(a);
353
- for (const u of Ce) a.addEventListener(u, l, { passive: !0 });
354
- return () => {
355
- s?.disconnect();
356
- for (const u of Ce) a.removeEventListener(u, l);
357
- o.current !== null && cancelAnimationFrame(o.current), o.current = null;
358
- };
359
- }, [t, c]), H(() => {
360
- const a = t.current;
361
- r.current = n === null || a === null || a.contains(a.ownerDocument.activeElement) ? null : n, c();
362
- }, [n, t, c]);
363
- }, Tn = (e) => {
364
- const t = e instanceof Element ? e.closest(`[${te}]`) : null;
365
- return t === null || t.getAttribute("data-entry-type") !== "file" ? null : t.getAttribute(te);
366
- }, Ve = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth), Ln = (e, t, n) => n.kind === "done" ? e.expandAllDone(n.opened, n.failed, n.complete) : Ve(e, t, n.kind, n.opened), je = () => {
367
- const { labels: e } = k();
368
- return /* @__PURE__ */ S("div", { className: "aqmx-explorer-loading", "aria-busy": "true", "data-testid": "markdown-explorer-tree-loading", children: [
369
- /* @__PURE__ */ m("p", { className: "aqmx-explorer-loading-text", children: e.treeLoading }),
370
- /* @__PURE__ */ S("div", { className: "aqmx-skeleton", "aria-hidden": "true", children: [
371
- /* @__PURE__ */ m("span", {}),
372
- /* @__PURE__ */ m("span", {}),
373
- /* @__PURE__ */ m("span", {}),
374
- /* @__PURE__ */ m("span", {}),
375
- /* @__PURE__ */ m("span", {})
376
- ] })
377
- ] });
378
- }, Nn = () => {
379
- const { labels: e } = k();
380
- return /* @__PURE__ */ S("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-tree-empty", children: [
381
- /* @__PURE__ */ m(zt, { className: "aqmx-explorer-empty-icon", "aria-hidden": "true" }),
382
- /* @__PURE__ */ m("p", { className: "aqmx-empty-title", children: e.treeEmptyTitle }),
383
- /* @__PURE__ */ m("p", { className: "aqmx-explorer-empty-body", children: e.treeEmptyBody })
384
- ] });
385
- }, kn = ({ name: e, onRetry: t }) => {
386
- const { labels: n } = k(), r = ue();
387
- return /* @__PURE__ */ S("span", { className: "aqmx-explorer-folder-failed", children: [
388
- /* @__PURE__ */ m("span", { className: "aqmx-explorer-folder-name", children: e }),
389
- /* @__PURE__ */ m("span", { id: r, className: "aqmx-explorer-folder-error", children: n.folderLoadFailed }),
390
- /* @__PURE__ */ S(
391
- "button",
392
- {
393
- type: "button",
394
- className: "aqmx-explorer-folder-retry",
395
- "aria-describedby": r,
396
- "data-testid": "markdown-explorer-folder-retry",
397
- onClick: (o) => {
398
- o.stopPropagation();
399
- const c = o.currentTarget, a = c.ownerDocument.activeElement === c ? c.closest('[role="treeitem"]') : null;
400
- a instanceof HTMLElement && Ie(a), t();
401
- },
402
- onKeyDown: (o) => {
403
- o.key !== "Escape" && o.stopPropagation();
404
- },
405
- children: [
406
- /* @__PURE__ */ m(ge, { className: "aqmx-explorer-folder-retry-icon", "aria-hidden": "true" }),
407
- /* @__PURE__ */ m("span", { className: "aqmx-explorer-folder-retry-text", children: n.retry })
408
- ]
409
- }
410
- )
411
- ] });
412
- }, qn = ({ entries: e, version: t, mode: n, sourceId: r, settings: o, openPaths: c, selection: a, onOpenDocument: l, expansion: s, onShown: u, marks: d, claimsHeld: i, expandAll: f }) => {
413
- const { trees: h, documents: w, labels: y, locale: q, theme: T } = k(), Z = ie(be), [L] = N(Gt), B = v(null), { rowHeight: V, lineColor: z } = fn(B, T), { isExpanded: E, toggle: A, expandMultiple: b, collapseMultiple: M, expanded: _, isPending: G } = s, { alwaysExpanded: W, sortMode: I, directoriesFirst: ne } = o, { direct: Y, markDirect: j, unmarkDirect: $, pruneDirect: D } = d, { running: K, advance: le } = f, re = v(null), ee = v(null);
414
- Sn(re, ee, a.shownPath);
415
- const Q = C(() => xt({ sortMode: I, directoriesFirst: ne }), [I, ne]), me = C(() => Wt(Q), [Q]), U = x((g) => h.children(r, g), [h, r]), R = C(() => Qt(e), [e]), O = x((g) => !ae(g) && (E(g) || W && !R.has(g)), [E, W, R]), X = v({ shownExpanded: O, isExpanded: E, unloadedFolders: R });
416
- P(() => {
417
- X.current = { shownExpanded: O, isExpanded: E, unloadedFolders: R };
418
- }, [O, E, R]);
419
- const Se = x((g) => {
420
- re.current?.scrollToPath(g, { align: "nearest" }), requestAnimationFrame(() => {
421
- const F = ee.current;
422
- if (F === null) return;
423
- const J = [...F.querySelectorAll(`[role="treeitem"][${te}]`)].find((st) => st.getAttribute(te) === g);
424
- J !== void 0 && Ie(J);
425
- });
426
- }, []), Qe = x(
427
- (g) => {
428
- if (ae(g)) {
429
- Se(Kt(g));
430
- return;
431
- }
432
- X.current.isExpanded(g) ? $([g]) : X.current.unloadedFolders.has(g) && j(g), A(g);
433
- },
434
- [Se, j, $, A]
435
- ), pe = x(
436
- (g) => {
437
- const F = g.filter((J) => !ae(J));
438
- F.length !== 0 && ($(F), M(F));
439
- },
440
- [$, M]
441
- ), Je = x(
442
- (g) => {
443
- const F = g.filter((J) => !ae(J));
444
- F.length !== 0 && (F.length < g.length && F.every((J) => X.current.shownExpanded(J)) ? pe(F) : b(F));
445
- },
446
- [b, pe]
447
- ), Te = x(
448
- (g) => /* @__PURE__ */ m(
449
- kn,
450
- {
451
- name: g.name,
452
- onRetry: () => {
453
- j(g.path), h.retryChildren(r, g.path), X.current.shownExpanded(g.path) || b([g.path]);
454
- }
455
- }
456
- ),
457
- [h, r, j, b]
458
- ), Le = n === "multi" ? c : En, { loopFolderName: Ne } = y, et = C(() => L(e, { openPaths: Le, childrenOf: U, renderFailedFolder: Te, loopFolderName: Ne }), [L, e, Le, U, Te, Ne, t]), tt = it(w, Tn), ke = x((g) => Y.has(g), [Y]), oe = C(() => Yt(e, { isShownExpanded: O, childrenOf: U, compare: Q, isDirect: ke }), [e, O, U, Q, ke, t]), se = Z && i;
459
- P(() => {
460
- u(e);
461
- }, [e, u]), P(() => () => u(null), [u]), H(() => h.claimChildren(r, se ? oe.folders : yn), [h, r, se, oe]), H(() => D(R), [D, R]), H(() => {
462
- se && K && le({ entries: e, isShownExpanded: O, childrenOf: U, compare: Q, expanded: _, waiting: oe.waiting, expansionPending: G });
463
- }, [se, K, le, e, O, U, Q, _, oe, G]);
464
- const nt = x(
465
- (g) => {
466
- g.isDirectory || l(g.entry.absolutePath);
467
- },
468
- [l]
469
- ), { onChange: fe } = a, rt = C(
470
- () => fe === null ? void 0 : (g, F) => {
471
- ae(g.absolutePath) || fe({ path: g.absolutePath, name: g.name, selected: F });
472
- },
473
- [fe]
474
- ), at = C(() => new Set(a.items), [a.items]), lt = C(
475
- () => ({
476
- entryKindDirectory: y.treeEntryKindDirectory,
477
- entryKindFile: y.treeEntryKindFile,
478
- scrollUp: y.treeScrollUp,
479
- scrollDown: y.treeScrollDown,
480
- scrollToTop: y.treeScrollToTop,
481
- scrollToBottom: y.treeScrollToBottom
482
- }),
483
- [y]
484
- ), ot = z === null ? { showTreeLines: !1 } : { showTreeLines: o.lines, lineColor: z };
485
- return /* @__PURE__ */ S("div", { ref: ee, className: "aqmx-explorer-tree", "data-testid": "markdown-explorer-tree", ...tt, children: [
486
- /* @__PURE__ */ m("span", { ref: B, className: "aqmx-explorer-tree-probe", "aria-hidden": "true", [dn]: "" }),
487
- /* @__PURE__ */ m(
488
- Nt,
489
- {
490
- ref: re,
491
- entries: et,
492
- expansion: {
493
- toggle: Qe,
494
- isExpanded: O,
495
- expandMultiple: Je,
496
- collapseMultiple: pe,
497
- isPending: G && !K,
498
- doubleClickAction: o.doubleClickAction
499
- },
500
- selection: { mode: a.mode, selectedPath: a.shownPath, currentPath: a.shownPath, selectedItems: at, onEntryClick: nt, onSelectionChange: rt },
501
- visual: {
502
- className: "aqmx-explorer-tree-view",
503
- ariaLabel: y.treeRegion,
504
- ...ot,
505
- showExpandIcons: o.expandIcons,
506
- expandIconStyle: Rn,
507
- showDirectoryIcons: o.directoryIcons,
508
- showFileIcons: o.fileIcons,
509
- expandIconSize: o.expandIconSize,
510
- itemHeight: V,
511
- removeRootIndent: o.removeRootIndent,
512
- highlightStyles: gn,
513
- entryStyle: bn,
514
- nameStyle: vn
515
- },
516
- virtualScroll: wn,
517
- sort: me,
518
- locale: q,
519
- labels: lt
520
- }
521
- )
522
- ] });
523
- }, An = ({ pending: e, status: t }) => {
524
- const { labels: n } = k(), r = t.state !== "running", [o, c] = N(0), a = v(!0);
525
- P(() => {
526
- const s = a.current;
527
- if (a.current = r, !r || e > 0 && !s) {
528
- c(0);
529
- return;
530
- }
531
- if (e > 0) {
532
- c(e);
533
- return;
534
- }
535
- if (o === 0) return;
536
- const u = setTimeout(() => c(0), 0);
537
- return () => clearTimeout(u);
538
- }, [r, e, o]);
539
- const l = r && e === 0 ? o : e;
540
- return l === 0 && r ? null : /* @__PURE__ */ S("p", { className: "aqmx-explorer-tree-progress", "data-testid": "markdown-explorer-tree-progress", "data-aqmx-loading": String(l), "data-aqmx-expand-all": t.state, children: [
541
- l > 0 ? /* @__PURE__ */ m(ge, { className: "aqmx-explorer-tree-progress-icon", "aria-hidden": "true" }) : null,
542
- /* @__PURE__ */ m("span", { children: t.state === "running" ? n.expandAllProgress(t.opened, l) : n.foldersLoading(l) })
543
- ] });
544
- }, On = ({ stop: e, opened: t, budget: n }) => {
545
- const { labels: r } = k();
546
- return /* @__PURE__ */ m("p", { className: "aqmx-explorer-expand-all-stop", "data-testid": "markdown-explorer-expand-all-stop", "data-aqmx-stop": e, children: Ve(r, n, e, t) });
547
- }, Cn = ({ entries: e, ...t }) => {
548
- const { trees: n } = k(), r = de(n.subscribe, n.version, n.version), { sourceId: o } = t, [c] = N(Vt), a = C(() => c(e, (l) => n.children(o, l)), [c, e, n, o, r]);
549
- return a.length === 0 ? /* @__PURE__ */ m(Nn, {}) : /* @__PURE__ */ m(qn, { entries: a, version: r, ...t });
550
- }, Pn = ({ result: e, onRetry: t, ...n }) => {
551
- const { renderTreeFailure: r } = k(), o = ie(e);
552
- if (o.status === "deferred") return /* @__PURE__ */ m(je, {});
553
- if (o.status === "ok") return /* @__PURE__ */ m(Cn, { entries: o.entries, ...n });
554
- const c = r?.(o.failure);
555
- return /* @__PURE__ */ m("div", { className: "aqmx-explorer-tree-message", "data-testid": "markdown-explorer-tree-failure", "data-aqmx-failure": o.failure.reason, children: c !== void 0 ? c : /* @__PURE__ */ m(ct, { failure: o.failure, alert: !0, onRetry: t, testId: null }) });
556
- }, Mn = ({ onControls: e, ...t }) => {
557
- const { trees: n, storageNamespace: r, labels: o, announcer: c, config: a } = k(), { sourceId: l } = t, s = Lt({ storageKey: qt(r).treeExpansion(l) });
558
- de(n.subscribe, n.version, n.version);
559
- const u = n.read(l), d = x(() => n.retry(l), [n, l]);
560
- P(() => n.open(l), [n, l]);
561
- const i = nn(), { expanded: f, expandMultiple: h, collapseAll: w } = s, [y, q] = N(null), T = y !== f, Z = v(f);
562
- P(() => {
563
- Z.current = f;
564
- }, [f]);
565
- const L = a.expandAll, B = x(() => c.announce(o.expandAllStarted), [c, o]), V = x((D) => c.announce(Ln(o, L, D)), [c, o, L]), z = on({ budget: L, expandMultiple: h, onStart: B, onFinish: V }), { status: E, start: A, end: b, advance: M } = z, _ = E.state === "running", G = C(() => ({ running: _, advance: M }), [_, M]), W = v(null), [I, ne] = N(!1), Y = x((D) => {
566
- W.current = D, ne(D !== null);
567
- }, []);
568
- H(
569
- () => n.subscribeChildrenFailures((D) => {
570
- const K = D.sourceId === l && W.current !== null ? Be(W.current, D.path) : null;
571
- K !== null && c.announce({ list: o.foldersLoadFailedNamed, item: K.name });
572
- }),
573
- [n, l, c, o]
574
- );
575
- const { clearDirect: j } = i, $ = x(() => {
576
- b(), j(), q(Z.current), w();
577
- }, [b, j, w]);
578
- return H(() => {
579
- e({ collapseAll: $, expandAll: I ? A : null, expanding: _ });
580
- }, [e, $, A, I, _]), H(() => () => e(null), [e]), H(() => {
581
- I || b();
582
- }, [I, b]), /* @__PURE__ */ S(_e, { children: [
583
- E.state === "stopped" ? /* @__PURE__ */ m(On, { stop: E.stop, opened: E.opened, budget: L }) : null,
584
- /* @__PURE__ */ S("div", { className: "aqmx-explorer-tree-area", children: [
585
- /* @__PURE__ */ m(De, { fallback: /* @__PURE__ */ m(je, {}), children: /* @__PURE__ */ m(Pn, { result: u, onRetry: d, expansion: s, onShown: Y, marks: i, claimsHeld: T, expandAll: G, ...t }) }),
586
- /* @__PURE__ */ m(An, { pending: n.pendingChildren(l), status: E })
587
- ] })
588
- ] });
589
- };
590
- function Fn({
591
- title: e,
592
- titleId: t,
593
- ...n
594
- }, r) {
595
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
596
- xmlns: "http://www.w3.org/2000/svg",
597
- viewBox: "0 0 24 24",
598
- fill: "currentColor",
599
- "aria-hidden": "true",
600
- "data-slot": "icon",
601
- ref: r,
602
- "aria-labelledby": t
603
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
604
- id: t
605
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
606
- fillRule: "evenodd",
607
- d: "M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",
608
- clipRule: "evenodd"
609
- }));
610
- }
611
- const Ke = /* @__PURE__ */ p.forwardRef(Fn), Pe = "markdown-explorer-selection-remove", _n = ({ selection: e, onRemove: t, onClear: n, onOpenSelection: r, onLeave: o }) => {
612
- const { labels: c } = k(), a = ue(), l = v(null), s = [...e], u = (i, f) => {
613
- if (f.ownerDocument.activeElement === f) {
614
- const h = l.current === null ? [] : [...l.current.querySelectorAll(`[data-testid="${Pe}"]`)], w = h.indexOf(f), y = [h[w + 1], h[w - 1]].find((q) => q !== void 0);
615
- y === void 0 ? o() : y.focus();
616
- }
617
- t(i);
618
- }, d = () => {
619
- const i = l.current;
620
- i !== null && i.contains(i.ownerDocument.activeElement) && o(), n();
621
- };
622
- return /* @__PURE__ */ S("section", { ref: l, className: "aqmx-explorer-tray", "aria-labelledby": a, "data-testid": "markdown-explorer-selection-tray", children: [
623
- /* @__PURE__ */ S("div", { className: "aqmx-explorer-tray-header", children: [
624
- /* @__PURE__ */ m("p", { id: a, className: "aqmx-explorer-tray-title", children: c.selectionTitle(s.length) }),
625
- /* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-button", "data-testid": "markdown-explorer-selection-clear", onClick: d, children: c.clearSelection })
626
- ] }),
627
- /* @__PURE__ */ m("ul", { className: "aqmx-explorer-tray-list", children: s.map(([i, f]) => /* @__PURE__ */ S("li", { className: "aqmx-explorer-tray-item", children: [
628
- /* @__PURE__ */ m("span", { className: "aqmx-explorer-tray-name", title: i, children: f }),
629
- /* @__PURE__ */ m(
630
- "button",
631
- {
632
- type: "button",
633
- className: "aqmx-icon-button aqmx-explorer-tray-remove",
634
- "aria-label": c.removeFromSelection(f),
635
- title: c.removeFromSelection(f),
636
- "data-testid": Pe,
637
- "data-aqmx-path": i,
638
- onClick: (h) => u(i, h.currentTarget),
639
- children: /* @__PURE__ */ m(Ke, { "aria-hidden": "true" })
640
- }
641
- )
642
- ] }, i)) }),
643
- r === void 0 ? null : /* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-open", "data-testid": "markdown-explorer-selection-open", onClick: () => r(s.map(([i]) => i)), children: c.openSelectionInMulti(s.length) })
644
- ] });
645
- }, xe = /* @__PURE__ */ new Map(), In = (e, t) => {
646
- if (t.selected === e.has(t.path)) return e;
647
- const n = new Map(e);
648
- return t.selected ? n.set(t.path, t.name) : n.delete(t.path), n;
649
- }, Dn = (e, t) => {
650
- if (!e.has(t)) return e;
651
- const n = new Map(e);
652
- return n.delete(t), n;
653
- }, Ue = ve(null), Hn = (e) => {
654
- const t = ie(Ue);
655
- P(() => {
656
- if (t !== null)
657
- return t(e), () => t(!1);
658
- }, [t, e]);
659
- };
660
- function Zn({
661
- title: e,
662
- titleId: t,
663
- ...n
664
- }, r) {
665
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
666
- xmlns: "http://www.w3.org/2000/svg",
667
- viewBox: "0 0 24 24",
668
- fill: "currentColor",
669
- "aria-hidden": "true",
670
- "data-slot": "icon",
671
- ref: r,
672
- "aria-labelledby": t
673
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
674
- id: t
675
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
676
- fillRule: "evenodd",
677
- d: "M15 3.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0V5.56l-3.97 3.97a.75.75 0 1 1-1.06-1.06l3.97-3.97h-2.69a.75.75 0 0 1-.75-.75Zm-12 0A.75.75 0 0 1 3.75 3h4.5a.75.75 0 0 1 0 1.5H5.56l3.97 3.97a.75.75 0 0 1-1.06 1.06L4.5 5.56v2.69a.75.75 0 0 1-1.5 0v-4.5Zm11.47 11.78a.75.75 0 1 1 1.06-1.06l3.97 3.97v-2.69a.75.75 0 0 1 1.5 0v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h2.69l-3.97-3.97Zm-4.94-1.06a.75.75 0 0 1 0 1.06L5.56 19.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0Z",
678
- clipRule: "evenodd"
679
- }));
680
- }
681
- const $n = /* @__PURE__ */ p.forwardRef(Zn);
682
- function Bn({
683
- title: e,
684
- titleId: t,
685
- ...n
686
- }, r) {
687
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
688
- xmlns: "http://www.w3.org/2000/svg",
689
- viewBox: "0 0 24 24",
690
- fill: "currentColor",
691
- "aria-hidden": "true",
692
- "data-slot": "icon",
693
- ref: r,
694
- "aria-labelledby": t
695
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
696
- id: t
697
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
698
- fillRule: "evenodd",
699
- d: "M6.97 2.47a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.25 4.81V16.5a.75.75 0 0 1-1.5 0V4.81L3.53 8.03a.75.75 0 0 1-1.06-1.06l4.5-4.5Zm9.53 4.28a.75.75 0 0 1 .75.75v11.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V7.5a.75.75 0 0 1 .75-.75Z",
700
- clipRule: "evenodd"
701
- }));
702
- }
703
- const zn = /* @__PURE__ */ p.forwardRef(Bn);
704
- function Vn({
705
- title: e,
706
- titleId: t,
707
- ...n
708
- }, r) {
709
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
710
- xmlns: "http://www.w3.org/2000/svg",
711
- viewBox: "0 0 24 24",
712
- fill: "currentColor",
713
- "aria-hidden": "true",
714
- "data-slot": "icon",
715
- ref: r,
716
- "aria-labelledby": t
717
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
718
- id: t
719
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
720
- fillRule: "evenodd",
721
- d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",
722
- clipRule: "evenodd"
723
- }));
724
- }
725
- const jn = /* @__PURE__ */ p.forwardRef(Vn);
726
- function Kn({
727
- title: e,
728
- titleId: t,
729
- ...n
730
- }, r) {
731
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
732
- xmlns: "http://www.w3.org/2000/svg",
733
- viewBox: "0 0 24 24",
734
- fill: "currentColor",
735
- "aria-hidden": "true",
736
- "data-slot": "icon",
737
- ref: r,
738
- "aria-labelledby": t
739
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
740
- id: t
741
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
742
- fillRule: "evenodd",
743
- d: "M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",
744
- clipRule: "evenodd"
745
- }));
746
- }
747
- const Un = /* @__PURE__ */ p.forwardRef(Kn);
748
- function Xn({
749
- title: e,
750
- titleId: t,
751
- ...n
752
- }, r) {
753
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
754
- xmlns: "http://www.w3.org/2000/svg",
755
- viewBox: "0 0 24 24",
756
- fill: "currentColor",
757
- "aria-hidden": "true",
758
- "data-slot": "icon",
759
- ref: r,
760
- "aria-labelledby": t
761
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
762
- id: t
763
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
764
- fillRule: "evenodd",
765
- d: "M11.47 4.72a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1-1.06 1.06L12 6.31 8.78 9.53a.75.75 0 0 1-1.06-1.06l3.75-3.75Zm-3.75 9.75a.75.75 0 0 1 1.06 0L12 17.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-3.75 3.75a.75.75 0 0 1-1.06 0l-3.75-3.75a.75.75 0 0 1 0-1.06Z",
766
- clipRule: "evenodd"
767
- }));
768
- }
769
- const Gn = /* @__PURE__ */ p.forwardRef(Xn);
770
- function Wn({
771
- title: e,
772
- titleId: t,
773
- ...n
774
- }, r) {
775
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
776
- xmlns: "http://www.w3.org/2000/svg",
777
- viewBox: "0 0 24 24",
778
- fill: "currentColor",
779
- "aria-hidden": "true",
780
- "data-slot": "icon",
781
- ref: r,
782
- "aria-labelledby": t
783
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
784
- id: t
785
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
786
- fillRule: "evenodd",
787
- d: "M11.078 2.25c-.917 0-1.699.663-1.85 1.567L9.05 4.889c-.02.12-.115.26-.297.348a7.493 7.493 0 0 0-.986.57c-.166.115-.334.126-.45.083L6.3 5.508a1.875 1.875 0 0 0-2.282.819l-.922 1.597a1.875 1.875 0 0 0 .432 2.385l.84.692c.095.078.17.229.154.43a7.598 7.598 0 0 0 0 1.139c.015.2-.059.352-.153.43l-.841.692a1.875 1.875 0 0 0-.432 2.385l.922 1.597a1.875 1.875 0 0 0 2.282.818l1.019-.382c.115-.043.283-.031.45.082.312.214.641.405.985.57.182.088.277.228.297.35l.178 1.071c.151.904.933 1.567 1.85 1.567h1.844c.916 0 1.699-.663 1.85-1.567l.178-1.072c.02-.12.114-.26.297-.349.344-.165.673-.356.985-.57.167-.114.335-.125.45-.082l1.02.382a1.875 1.875 0 0 0 2.28-.819l.923-1.597a1.875 1.875 0 0 0-.432-2.385l-.84-.692c-.095-.078-.17-.229-.154-.43a7.614 7.614 0 0 0 0-1.139c-.016-.2.059-.352.153-.43l.84-.692c.708-.582.891-1.59.433-2.385l-.922-1.597a1.875 1.875 0 0 0-2.282-.818l-1.02.382c-.114.043-.282.031-.449-.083a7.49 7.49 0 0 0-.985-.57c-.183-.087-.277-.227-.297-.348l-.179-1.072a1.875 1.875 0 0 0-1.85-1.567h-1.843ZM12 15.75a3.75 3.75 0 1 0 0-7.5 3.75 3.75 0 0 0 0 7.5Z",
788
- clipRule: "evenodd"
789
- }));
790
- }
791
- const Yn = /* @__PURE__ */ p.forwardRef(Wn);
792
- function Qn({
793
- title: e,
794
- titleId: t,
795
- ...n
796
- }, r) {
797
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
798
- xmlns: "http://www.w3.org/2000/svg",
799
- viewBox: "0 0 24 24",
800
- fill: "currentColor",
801
- "aria-hidden": "true",
802
- "data-slot": "icon",
803
- ref: r,
804
- "aria-labelledby": t
805
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
806
- id: t
807
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
808
- fillRule: "evenodd",
809
- d: "M12 1.5a.75.75 0 0 1 .75.75V4.5a.75.75 0 0 1-1.5 0V2.25A.75.75 0 0 1 12 1.5ZM5.636 4.136a.75.75 0 0 1 1.06 0l1.592 1.591a.75.75 0 0 1-1.061 1.06l-1.591-1.59a.75.75 0 0 1 0-1.061Zm12.728 0a.75.75 0 0 1 0 1.06l-1.591 1.592a.75.75 0 0 1-1.06-1.061l1.59-1.591a.75.75 0 0 1 1.061 0Zm-6.816 4.496a.75.75 0 0 1 .82.311l5.228 7.917a.75.75 0 0 1-.777 1.148l-2.097-.43 1.045 3.9a.75.75 0 0 1-1.45.388l-1.044-3.899-1.601 1.42a.75.75 0 0 1-1.247-.606l.569-9.47a.75.75 0 0 1 .554-.68ZM3 10.5a.75.75 0 0 1 .75-.75H6a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 10.5Zm14.25 0a.75.75 0 0 1 .75-.75h2.25a.75.75 0 0 1 0 1.5H18a.75.75 0 0 1-.75-.75Zm-8.962 3.712a.75.75 0 0 1 0 1.061l-1.591 1.591a.75.75 0 1 1-1.061-1.06l1.591-1.592a.75.75 0 0 1 1.06 0Z",
810
- clipRule: "evenodd"
811
- }));
812
- }
813
- const Jn = /* @__PURE__ */ p.forwardRef(Qn);
814
- function er({
815
- title: e,
816
- titleId: t,
817
- ...n
818
- }, r) {
819
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
820
- xmlns: "http://www.w3.org/2000/svg",
821
- viewBox: "0 0 24 24",
822
- fill: "currentColor",
823
- "aria-hidden": "true",
824
- "data-slot": "icon",
825
- ref: r,
826
- "aria-labelledby": t
827
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
828
- id: t
829
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
830
- fillRule: "evenodd",
831
- d: "M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5H5.625ZM7.5 15a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 7.5 15Zm.75 2.25a.75.75 0 0 0 0 1.5H12a.75.75 0 0 0 0-1.5H8.25Z",
832
- clipRule: "evenodd"
833
- }), /* @__PURE__ */ p.createElement("path", {
834
- d: "M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"
835
- }));
836
- }
837
- const tr = /* @__PURE__ */ p.forwardRef(er);
838
- function nr({
839
- title: e,
840
- titleId: t,
841
- ...n
842
- }, r) {
843
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
844
- xmlns: "http://www.w3.org/2000/svg",
845
- viewBox: "0 0 24 24",
846
- fill: "currentColor",
847
- "aria-hidden": "true",
848
- "data-slot": "icon",
849
- ref: r,
850
- "aria-labelledby": t
851
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
852
- id: t
853
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
854
- d: "M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"
855
- }));
856
- }
857
- const rr = /* @__PURE__ */ p.forwardRef(nr);
858
- function ar({
859
- title: e,
860
- titleId: t,
861
- ...n
862
- }, r) {
863
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
864
- xmlns: "http://www.w3.org/2000/svg",
865
- viewBox: "0 0 24 24",
866
- fill: "currentColor",
867
- "aria-hidden": "true",
868
- "data-slot": "icon",
869
- ref: r,
870
- "aria-labelledby": t
871
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
872
- id: t
873
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
874
- d: "M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 0 0-3-3h-3.879a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H6a3 3 0 0 0-3 3v3.162A3.756 3.756 0 0 1 4.094 9h15.812ZM4.094 10.5a2.25 2.25 0 0 0-2.227 2.568l.857 6A2.25 2.25 0 0 0 4.951 21H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-2.227-2.568H4.094Z"
875
- }));
876
- }
877
- const lr = /* @__PURE__ */ p.forwardRef(ar);
878
- function or({
879
- title: e,
880
- titleId: t,
881
- ...n
882
- }, r) {
883
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
884
- xmlns: "http://www.w3.org/2000/svg",
885
- viewBox: "0 0 24 24",
886
- fill: "currentColor",
887
- "aria-hidden": "true",
888
- "data-slot": "icon",
889
- ref: r,
890
- "aria-labelledby": t
891
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
892
- id: t
893
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
894
- fillRule: "evenodd",
895
- d: "M10.5 3.75a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.25 10.5a8.25 8.25 0 1 1 14.59 5.28l4.69 4.69a.75.75 0 1 1-1.06 1.06l-4.69-4.69A8.25 8.25 0 0 1 2.25 10.5Zm8.25-3.75a.75.75 0 0 1 .75.75v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25H7.5a.75.75 0 0 1 0-1.5h2.25V7.5a.75.75 0 0 1 .75-.75Z",
896
- clipRule: "evenodd"
897
- }));
898
- }
899
- const sr = /* @__PURE__ */ p.forwardRef(or);
900
- function cr({
901
- title: e,
902
- titleId: t,
903
- ...n
904
- }, r) {
905
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
906
- xmlns: "http://www.w3.org/2000/svg",
907
- viewBox: "0 0 24 24",
908
- fill: "currentColor",
909
- "aria-hidden": "true",
910
- "data-slot": "icon",
911
- ref: r,
912
- "aria-labelledby": t
913
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
914
- id: t
915
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
916
- d: "M5.625 3.75a2.625 2.625 0 1 0 0 5.25h12.75a2.625 2.625 0 0 0 0-5.25H5.625ZM3.75 11.25a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75ZM3 15.75a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75ZM3.75 18.75a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75Z"
917
- }));
918
- }
919
- const ir = /* @__PURE__ */ p.forwardRef(cr), Ee = (e) => {
920
- e.preventDefault(), e.stopPropagation();
921
- }, dr = Object.freeze({
922
- sortMode: zn,
923
- directoriesFirst: rr,
924
- selectionMode: jn,
925
- doubleClickAction: Jn,
926
- expandIconSize: sr,
927
- alwaysExpanded: $n,
928
- removeRootIndent: Un,
929
- lines: ir,
930
- expandIcons: Gn,
931
- directoryIcons: lr,
932
- fileIcons: tr
933
- }), Xe = (e, t) => {
934
- const n = e[t.labelKey];
935
- if (typeof n != "string") throw new TypeError(`[markdown-explorer] the tree setting ${t.key} must name a string label; labels.${t.labelKey} is a ${typeof n}`);
936
- return n;
937
- }, ur = ({ id: e, settings: t, descriptors: n, onAdvance: r, onClose: o, ref: c }) => {
938
- const { labels: a } = k(), l = v([]);
939
- H(() => {
940
- l.current[0]?.focus();
941
- }, []);
942
- const s = x(
943
- (d) => {
944
- const i = n.length;
945
- l.current[(d % i + i) % i]?.focus();
946
- },
947
- [n.length]
948
- ), u = x(
949
- (d, i) => {
950
- switch (d.key) {
951
- case "ArrowDown":
952
- d.preventDefault(), s(i + 1);
953
- break;
954
- case "ArrowUp":
955
- d.preventDefault(), s(i - 1);
956
- break;
957
- case "Home":
958
- d.preventDefault(), s(0);
959
- break;
960
- case "End":
961
- d.preventDefault(), s(n.length - 1);
962
- break;
963
- case "Escape":
964
- Ee(d), o();
965
- break;
966
- case "Tab":
967
- o();
968
- break;
969
- }
970
- },
971
- [n.length, s, o]
972
- );
973
- return /* @__PURE__ */ m("div", { ref: c, id: e, role: "menu", "aria-label": a.treeSettings, className: "aqmx-explorer-menu", "data-testid": "markdown-explorer-tree-settings-menu", children: n.map((d, i) => {
974
- const f = dr[d.key], h = Xe(a, d), w = He(a, t, d.key), y = t[d.key], q = typeof y == "boolean" ? { role: "menuitemcheckbox", "aria-checked": y, "aria-label": h } : { role: "menuitem", "aria-label": `${h}: ${w}` };
975
- return /* @__PURE__ */ S(
976
- "button",
977
- {
978
- ref: (T) => {
979
- l.current[i] = T;
980
- },
981
- type: "button",
982
- tabIndex: -1,
983
- ...q,
984
- title: `${h}: ${w}`,
985
- className: "aqmx-explorer-menu-item",
986
- "data-testid": "markdown-explorer-tree-settings-item",
987
- "data-aqmx-setting": d.key,
988
- onClick: () => r(d),
989
- onKeyDown: (T) => u(T, i),
990
- children: [
991
- /* @__PURE__ */ m(f, { className: "aqmx-explorer-menu-icon", "aria-hidden": "true" }),
992
- /* @__PURE__ */ m("span", { className: "aqmx-explorer-menu-name", children: h }),
993
- /* @__PURE__ */ m("span", { className: "aqmx-explorer-menu-value", children: w })
994
- ]
995
- },
996
- d.key
997
- );
998
- }) });
999
- }, mr = ({ settings: e, descriptors: t, onAdvance: n }) => {
1000
- const { labels: r, announcer: o } = k(), [c, a] = N(!1), l = v(null), s = v(null), u = v(null), d = ue(), i = x(() => {
1001
- l.current?.focus(), a(!1);
1002
- }, []);
1003
- H(() => {
1004
- if (!c) return;
1005
- const w = (y) => {
1006
- y.target instanceof Node && (l.current?.contains(y.target) === !0 || s.current?.contains(y.target) === !0) || (a(!1), u.current !== null && window.clearTimeout(u.current), u.current = window.setTimeout(() => {
1007
- u.current = null, (document.activeElement === null || document.activeElement === document.body) && l.current?.focus();
1008
- }, 0));
1009
- };
1010
- return document.addEventListener("pointerdown", w), () => document.removeEventListener("pointerdown", w);
1011
- }, [c]), H(
1012
- () => () => {
1013
- u.current !== null && window.clearTimeout(u.current);
1014
- },
1015
- []
1016
- );
1017
- const f = x(
1018
- (w) => {
1019
- w.key !== "Escape" || !c || (Ee(w), i());
1020
- },
1021
- [c, i]
1022
- ), h = x(
1023
- (w) => {
1024
- const y = n(w.key);
1025
- o.announce(r.settingAnnouncement(Xe(r, w), He(r, y, w.key)));
1026
- },
1027
- [o, r, n]
1028
- );
1029
- return {
1030
- trigger: /* @__PURE__ */ m(
1031
- "button",
1032
- {
1033
- ref: l,
1034
- type: "button",
1035
- className: "aqmx-icon-button",
1036
- "aria-haspopup": "menu",
1037
- "aria-expanded": c,
1038
- "aria-controls": c ? d : void 0,
1039
- "aria-label": r.treeSettings,
1040
- title: r.treeSettings,
1041
- "data-testid": "markdown-explorer-tree-settings",
1042
- onClick: () => a((w) => !w),
1043
- onKeyDown: f,
1044
- children: /* @__PURE__ */ m(Yn, { "aria-hidden": "true" })
1045
- }
1046
- ),
1047
- menu: c ? /* @__PURE__ */ m(ur, { ref: s, id: d, settings: e, descriptors: t, onAdvance: h, onClose: i }) : null
1048
- };
1049
- }, pr = () => {
1050
- const { treeSettings: e } = k();
1051
- return { settings: de(e.subscribe, e.getSnapshot, e.getServerSnapshot), advance: e.advance };
1052
- }, Me = /* @__PURE__ */ new Set(), fr = '[role="tree"] [role="treeitem"][tabindex="0"]', hr = "[data-directory-tree-tab-stop]", Hr = (e) => {
1053
- const { mode: t, sourceId: n, currentPath: r, openPaths: o, onOpenDocument: c, onSourceChange: a, viewSwitch: l } = e, { labels: s, sources: u, trees: d, documents: i, announcer: f } = k(), { settings: h, advance: w } = pr(), y = C(() => wt(t === "tree"), [t]), q = t === "tree" && h.selectionMode === "multiple";
1054
- Hn(q);
1055
- const T = e.mode === "tree" ? e.tray.onGatheredChange : null, Z = e.mode === "tree" ? e.onOpenSelection : void 0, L = e.mode === "tree" && q ? e.tray.gathered : xe, B = x(
1056
- (R) => {
1057
- const O = w(R);
1058
- return O.selectionMode !== "multiple" && T?.(xe), O;
1059
- },
1060
- [w, T]
1061
- ), V = mr({ settings: h, descriptors: y, onAdvance: B }), z = x((R) => T?.((O) => In(O, R)), [T]), E = x((R) => T?.((O) => Dn(O, R)), [T]), A = x(() => T?.(xe), [T]), b = v(null), M = x(() => {
1062
- const R = b.current;
1063
- if (R === null) return;
1064
- [fr, hr, '[data-testid="markdown-explorer-tree-settings"]'].map((X) => R.querySelector(X)).find((X) => X !== null)?.focus();
1065
- }, []), _ = C(() => new Set(L.keys()), [L]), G = C(() => r === null ? Me : /* @__PURE__ */ new Set([r]), [r]), W = C(() => {
1066
- if (t === "multi") return { mode: "multiple", items: o, shownPath: null, onChange: null };
1067
- switch (h.selectionMode) {
1068
- case "single":
1069
- return { mode: "single", items: G, shownPath: r, onChange: null };
1070
- case "multiple":
1071
- return { mode: "multiple", items: _, shownPath: r, onChange: z };
1072
- case "none":
1073
- return { mode: "none", items: Me, shownPath: null, onChange: null };
1074
- }
1075
- }, [t, o, h.selectionMode, G, r, _, z]), [I, ne] = N(null), [Y, j] = N(!1), [$, D] = N(null), K = v(!1), le = x(async () => {
1076
- if (!K.current) {
1077
- K.current = !0, j(!0), D(null);
1078
- try {
1079
- const R = await d.refresh(n);
1080
- if (R.status === "superseded") return;
1081
- i.invalidate(), R.status === "failed" ? D({ sourceId: n, failure: R.failure }) : f.announce(s.treeRefreshed);
1082
- } finally {
1083
- K.current = !1, j(!1);
1084
- }
1085
- }
1086
- }, [d, i, n, f, s]), re = I === null ? null : I.expandAll, ee = I?.expanding === !0, Q = u.find((R) => R.id === n), me = l.target === "multi" ? Zt : Dt, U = l.target === "multi" ? s.switchToMulti : s.switchToTree;
1087
- return /* @__PURE__ */ S("nav", { ref: b, "aria-label": s.explorerRegion, className: "aqmx-explorer", "data-testid": "markdown-explorer-explorer", "data-aqmx-mode": t, children: [
1088
- /* @__PURE__ */ S("div", { className: "aqmx-explorer-header", children: [
1089
- u.length > 1 ? /* @__PURE__ */ m("select", { className: "aqmx-explorer-source", "aria-label": s.sourceLabel, title: Q?.label, value: n, onChange: (R) => a(R.currentTarget.value), "data-testid": "markdown-explorer-source-select", children: u.map((R) => /* @__PURE__ */ m("option", { value: R.id, children: R.label }, R.id)) }) : null,
1090
- /* @__PURE__ */ S("div", { className: "aqmx-explorer-actions", children: [
1091
- /* @__PURE__ */ m(dt, { to: l.href, navigation: "switch-view", className: "aqmx-icon-button", "aria-label": U, title: U, "data-testid": "markdown-explorer-view-switch", "data-aqmx-target": l.target, children: /* @__PURE__ */ m(me, { "aria-hidden": "true" }) }),
1092
- /* @__PURE__ */ S(
1093
- "button",
1094
- {
1095
- type: "button",
1096
- className: "aqmx-icon-button aqmx-labelled-button",
1097
- title: s.refreshTree,
1098
- "aria-disabled": Y,
1099
- "aria-busy": Y,
1100
- "data-aqmx-busy": Y ? "true" : void 0,
1101
- "data-testid": "markdown-explorer-refresh",
1102
- onClick: () => {
1103
- le();
1104
- },
1105
- children: [
1106
- /* @__PURE__ */ m(ge, { "aria-hidden": "true" }),
1107
- /* @__PURE__ */ m("span", { children: s.refreshTreeLabel })
1108
- ]
1109
- }
1110
- ),
1111
- /* @__PURE__ */ m(
1112
- "button",
1113
- {
1114
- type: "button",
1115
- className: "aqmx-icon-button",
1116
- "aria-label": s.expandAll,
1117
- title: s.expandAll,
1118
- "aria-disabled": re === null || ee,
1119
- "aria-busy": ee,
1120
- "data-aqmx-busy": ee ? "true" : void 0,
1121
- "data-testid": "markdown-explorer-expand-all",
1122
- onClick: () => re?.(),
1123
- children: /* @__PURE__ */ m(_t, { "aria-hidden": "true" })
1124
- }
1125
- ),
1126
- /* @__PURE__ */ m("button", { type: "button", className: "aqmx-icon-button", "aria-label": s.collapseAll, title: s.collapseAll, "aria-disabled": I === null, "data-testid": "markdown-explorer-collapse-all", onClick: () => I?.collapseAll(), children: /* @__PURE__ */ m(Mt, { "aria-hidden": "true" }) }),
1127
- V.trigger
1128
- ] })
1129
- ] }),
1130
- /* @__PURE__ */ S("div", { className: "aqmx-explorer-body", "data-aqmx-explorer-body": "", children: [
1131
- $ !== null && $.sourceId === n ? /* @__PURE__ */ m("p", { role: "alert", className: "aqmx-explorer-refresh-failure", "data-testid": "markdown-explorer-refresh-failure", "data-aqmx-failure": $.failure.reason, children: s.treeRefreshFailed(ut(s, $.failure.reason)) }) : null,
1132
- /* @__PURE__ */ m(De, { fallback: null, children: /* @__PURE__ */ m($t, {}) }),
1133
- /* @__PURE__ */ m(Mn, { mode: t, sourceId: n, settings: h, openPaths: o, selection: W, onOpenDocument: c, onControls: ne }, n),
1134
- q && L.size > 0 ? /* @__PURE__ */ m(_n, { selection: L, onRemove: E, onClear: A, onOpenSelection: Z, onLeave: M }) : null,
1135
- V.menu
1136
- ] })
1137
- ] });
1138
- }, Ge = "(pointer: coarse)", xr = (e) => {
1139
- const t = window.matchMedia(Ge);
1140
- return t.addEventListener("change", e), () => t.removeEventListener("change", e);
1141
- }, wr = () => window.matchMedia(Ge).matches, gr = () => !1, vr = () => de(xr, wr, gr);
1142
- function br({
1143
- title: e,
1144
- titleId: t,
1145
- ...n
1146
- }, r) {
1147
- return /* @__PURE__ */ p.createElement("svg", Object.assign({
1148
- xmlns: "http://www.w3.org/2000/svg",
1149
- viewBox: "0 0 24 24",
1150
- fill: "currentColor",
1151
- "aria-hidden": "true",
1152
- "data-slot": "icon",
1153
- ref: r,
1154
- "aria-labelledby": t
1155
- }, n), e ? /* @__PURE__ */ p.createElement("title", {
1156
- id: t
1157
- }, e) : null, /* @__PURE__ */ p.createElement("path", {
1158
- fillRule: "evenodd",
1159
- d: "M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z",
1160
- clipRule: "evenodd"
1161
- }));
1162
- }
1163
- const Er = /* @__PURE__ */ p.forwardRef(br), yr = ({ explorer: e, toggleRef: t, covered: n, onNoticeSlotChange: r, dismissals: o }) => {
1164
- const { labels: c } = k(), a = Ct(), { location: l } = mt(), [s, u] = N(!1), [d, i] = N({ navigated: a, source: l.source }), [f, h] = N(!1);
1165
- d.navigated !== a && (i({ navigated: a, source: l.source }), d.source === l.source && !f && u(!1));
1166
- const [w, y] = N(o);
1167
- w !== o && (y(o), u(!1));
1168
- const q = v(null), T = v(null), Z = v(null), L = v(!1), B = ue();
1169
- P(() => {
1170
- const b = q.current;
1171
- b !== null && (s && !b.open ? (b.showModal(), T.current?.focus()) : !s && b.open && (b.close(), t.current?.focus()), r(s ? Z.current : null));
1172
- }, [s, t, r]), P(() => () => r(null), [r]);
1173
- const V = x((b) => {
1174
- b.key !== "Escape" || b.defaultPrevented || (Ee(b), u(!1));
1175
- }, []), z = x((b) => {
1176
- L.current = b.target === b.currentTarget;
1177
- }, []), E = x((b) => {
1178
- const M = L.current;
1179
- L.current = !1, M && b.target === b.currentTarget && u(!1);
1180
- }, []), A = x(() => {
1181
- u(!1);
1182
- }, []);
1183
- return /* @__PURE__ */ S(_e, { children: [
1184
- /* @__PURE__ */ m("div", { className: "aqmx-sheet-bar", inert: n, children: /* @__PURE__ */ S("button", { ref: t, type: "button", className: "aqmx-sheet-toggle", "aria-haspopup": "dialog", "aria-expanded": s, "aria-controls": B, "data-testid": "markdown-explorer-sheet-toggle", onClick: () => u(!0), children: [
1185
- /* @__PURE__ */ m(Er, { "aria-hidden": "true" }),
1186
- /* @__PURE__ */ m("span", { children: c.showExplorer })
1187
- ] }) }),
1188
- /* @__PURE__ */ m("dialog", { ref: q, id: B, className: "aqmx-sheet", "aria-label": c.explorerRegion, "data-testid": "markdown-explorer-sheet", onKeyDown: V, onPointerDown: z, onClick: E, onClose: A, children: /* @__PURE__ */ S("div", { className: "aqmx-sheet-panel", children: [
1189
- /* @__PURE__ */ S("div", { className: "aqmx-sheet-header", children: [
1190
- /* @__PURE__ */ m("div", { ref: Z, className: "aqmx-sheet-notice-slot" }),
1191
- /* @__PURE__ */ m("button", { ref: T, type: "button", className: "aqmx-sheet-close", "aria-label": c.hideExplorer, title: c.hideExplorer, "data-testid": "markdown-explorer-sheet-close", onClick: () => u(!1), children: /* @__PURE__ */ m(Ke, { "aria-hidden": "true" }) })
1192
- ] }),
1193
- /* @__PURE__ */ m("div", { className: "aqmx-sheet-body", children: /* @__PURE__ */ m(be, { value: s, children: /* @__PURE__ */ m(Ue, { value: h, children: e }) }) }),
1194
- /* @__PURE__ */ m(pt, { holds: s, testId: "markdown-explorer-sheet-announcer" })
1195
- ] }) })
1196
- ] });
1197
- }, Rr = ve(null), ye = "aqmx-explorer", We = "aqmx-content", Re = '[role="tree"] [role="treeitem"]', Sr = `${Re}[tabindex="0"]`, Tr = "[data-directory-tree-tab-stop]", Lr = (e, t) => {
1198
- for (const n of e.querySelectorAll(`[data-panel-id="${ye}"] ${Re}`)) if (n.getAttribute(te) === t) return n;
1199
- return null;
1200
- }, Fe = (e, t) => ({
1201
- inlineSize: e > 0 ? e : null,
1202
- rootFontPixels: t > 0 ? t : Tt
1203
- }), Nr = (e, t) => {
1204
- const [n, r] = N(() => Fe(0, 0));
1205
- return P(() => {
1206
- const o = e.current, c = t.current;
1207
- if (o === null || c === null) throw new Error("[markdown-explorer] the split frame is not mounted");
1208
- const a = { frame: o.getBoundingClientRect().width, rem: c.getBoundingClientRect().width }, l = () => {
1209
- const u = Fe(a.frame, a.rem);
1210
- r((d) => d.inlineSize === u.inlineSize && d.rootFontPixels === u.rootFontPixels ? d : u);
1211
- };
1212
- l();
1213
- const s = new ResizeObserver((u) => {
1214
- for (const d of u) {
1215
- const [i] = d.borderBoxSize;
1216
- i !== void 0 && (d.target === o && (a.frame = i.inlineSize), d.target === c && (a.rem = i.inlineSize));
1217
- }
1218
- l();
1219
- });
1220
- return s.observe(o), s.observe(c), () => s.disconnect();
1221
- }, [e, t]), n;
1222
- }, Ye = (e) => `aqmx-split-handle-${e}`, kr = (e, { frameRef: t, sheetToggleRef: n, handleId: r }) => {
1223
- const o = v(!1), c = v(null), a = v(!1);
1224
- P(() => {
1225
- const s = t.current;
1226
- if (s === null) throw new Error("[markdown-explorer] the split frame is not mounted");
1227
- const u = (i) => {
1228
- const f = i.target instanceof Element ? i.target : null;
1229
- o.current = f !== null && f.closest(`[data-panel-id="${We}"]`) === null, !a.current && (c.current = f?.closest(`${Re}[${te}]`)?.getAttribute(te) ?? null);
1230
- }, d = (i) => {
1231
- i.relatedTarget instanceof Node && !s.contains(i.relatedTarget) && (o.current = !1);
1232
- };
1233
- return s.addEventListener("focusin", u), s.addEventListener("focusout", d), () => {
1234
- s.removeEventListener("focusin", u), s.removeEventListener("focusout", d);
1235
- };
1236
- }, [t]);
1237
- const l = v(e);
1238
- P(() => {
1239
- if (l.current === e) return;
1240
- l.current = e;
1241
- const s = t.current;
1242
- if (s === null || !o.current) return;
1243
- const u = (d) => {
1244
- const { activeElement: i, body: f } = s.ownerDocument;
1245
- if (i !== null && i !== f) return;
1246
- const h = d.find((w) => w !== null);
1247
- if (h != null) {
1248
- a.current = !0;
1249
- try {
1250
- h.focus();
1251
- } finally {
1252
- a.current = !1;
1253
- }
1254
- }
1255
- };
1256
- if (e) {
1257
- u([n.current]);
1258
- return;
1259
- }
1260
- queueMicrotask(() => {
1261
- if (l.current !== e || !o.current) return;
1262
- const d = c.current, i = `[data-panel-id="${ye}"]`;
1263
- u([
1264
- d === null ? null : Lr(s, d),
1265
- s.querySelector(`${i} ${Sr}`),
1266
- s.querySelector(`${i} ${Tr}`),
1267
- s.querySelector(`[data-resize-handle-id="${r}"]`)
1268
- ]);
1269
- });
1270
- }, [e, t, n, r]);
1271
- }, Zr = ({ view: e, explorer: t, content: n, contentCoversPage: r = !1, sheetDismissals: o = 0, onDraggingChange: c }) => {
1272
- const a = v(null), [l, s] = N(null), u = v(null), d = v(null), { inlineSize: i, rootFontPixels: f } = Nr(a, u), h = i !== null && i < gt(f);
1273
- return kr(h, { frameRef: a, sheetToggleRef: d, handleId: Ye(e) }), /* @__PURE__ */ S("div", { ref: a, className: "aqmx-split-frame", "data-aqmx-explorer-mode": h ? "sheet" : "split", children: [
1274
- /* @__PURE__ */ m("span", { ref: u, className: "aqmx-rem-probe", "aria-hidden": "true", "data-aqmx-rem-probe": "" }),
1275
- h ? /* @__PURE__ */ m(yr, { explorer: t, toggleRef: d, covered: r, onNoticeSlotChange: s, dismissals: o }) : null,
1276
- /* @__PURE__ */ m(Rr, { value: h ? l : null, children: /* @__PURE__ */ m(qr, { view: e, sheet: h, explorer: t, content: n, contentCoversPage: r, onDraggingChange: c, explorerMinPixels: vt(f) }) })
1277
- ] });
1278
- }, qr = ({
1279
- view: e,
1280
- sheet: t,
1281
- explorer: n,
1282
- content: r,
1283
- contentCoversPage: o,
1284
- onDraggingChange: c,
1285
- explorerMinPixels: a
1286
- }) => {
1287
- const { viewSettings: l, labels: s } = k(), d = ft((E) => e === "tree" ? E.treeExplorer : E.multiExplorer) ?? (e === "tree" ? Et : yt), i = v(null), f = v(null), h = v(!1), w = v(!1), [y, q] = N(!1), T = v(c);
1288
- P(() => {
1289
- T.current = c;
1290
- }, [c]);
1291
- const Z = x(() => {
1292
- const E = i.current;
1293
- if (E === null || E.length !== 2) return;
1294
- const [A = 0, b = 0] = E, M = A + b;
1295
- if (M <= 0 || A <= 0) return;
1296
- const _ = Math.min(qe, A / M * 100);
1297
- l.update(e === "tree" ? { treeExplorer: _ } : { multiExplorer: _ });
1298
- }, [l, e]), L = x(() => {
1299
- f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => {
1300
- f.current = null, Z();
1301
- }, bt);
1302
- }, [Z]);
1303
- H(
1304
- () => () => {
1305
- f.current !== null && clearTimeout(f.current), w.current && T.current?.(!1);
1306
- },
1307
- []
1308
- );
1309
- const B = vr(), V = x(
1310
- (E, A) => {
1311
- i.current = E;
1312
- const [b = 0, M = 0] = E;
1313
- E.length === 2 && M > 0 && q(b <= 0), A.source === "keyboard" ? L() : A.source === "pointer" && (h.current = !0);
1314
- },
1315
- [L]
1316
- ), z = x(
1317
- (E) => {
1318
- if (w.current = E, c?.(E), E) {
1319
- h.current = !1;
1320
- return;
1321
- }
1322
- h.current && (h.current = !1, L());
1323
- },
1324
- [c, L]
1325
- );
1326
- return /* @__PURE__ */ S(At, { id: `aqmx-split-${e}`, direction: "horizontal", onLayout: V, className: "aqmx-split", "data-aqmx-split": e, children: [
1327
- t ? null : /* @__PURE__ */ m(
1328
- Ae,
1329
- {
1330
- id: ye,
1331
- defaultSize: { value: d, unit: "percentage" },
1332
- minSize: { value: a, unit: "pixels" },
1333
- maxSize: { value: qe, unit: "percentage" },
1334
- collapsible: { from: "end" },
1335
- pixelAdjustPriority: 1,
1336
- inert: o,
1337
- className: "aqmx-split-explorer",
1338
- children: /* @__PURE__ */ m(be, { value: !y, children: n })
1339
- }
1340
- ),
1341
- t ? null : /* @__PURE__ */ m(
1342
- Ot,
1343
- {
1344
- id: Ye(e),
1345
- thickness: B ? Rt : St,
1346
- indicator: { visible: !0, thickness: ce.gripThickness, length: ce.gripLength, barThickness: ce.barThickness, barLength: ce.barLength },
1347
- title: s.resizeExplorer,
1348
- "aria-label": s.resizeExplorer,
1349
- onDragging: z,
1350
- inert: o,
1351
- className: "aqmx-split-handle"
1352
- }
1353
- ),
1354
- /* @__PURE__ */ m(Ae, { id: We, defaultSize: { value: 100 - d, unit: "percentage" }, contentOverflow: "hidden", className: "aqmx-split-content", ...o ? { style: { isolation: "auto" } } : {}, children: r })
1355
- ] });
1356
- };
1357
- export {
1358
- xe as E,
1359
- Rr as S,
1360
- Zr as a,
1361
- Hr as b
1362
- };