@aiquants/markdown-explorer 0.4.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.
- package/CHANGELOG.md +12 -0
- package/README.md +20 -2
- package/dist/ExplorerSplit-CWcK1E4I.js +1495 -0
- package/dist/ExplorerSplit-ajN3GSdA.cjs +1 -0
- package/dist/{MultiLayout-8s7q3-Hm.js → MultiLayout-BtWtCzJV.js} +69 -66
- package/dist/MultiLayout-DvkcdO9c.cjs +1 -0
- package/dist/{NativeScrollBar-DqkutcGb.cjs → NativeScrollBar-DbzyQ85y.cjs} +1 -1
- package/dist/{NativeScrollBar-D3VDRQqf.js → NativeScrollBar-apXjIKRW.js} +1 -1
- package/dist/TreeLayout-BcHsv9G8.js +23 -0
- package/dist/TreeLayout-rwhJfLmU.cjs +1 -0
- package/dist/core/contracts.d.cts +13 -0
- package/dist/core/contracts.d.ts +13 -0
- package/dist/{dataRoute-Dl6xmEFs.js → dataRoute-Btg4w3vO.js} +70 -65
- package/dist/dataRoute-DHpu0fg2.cjs +1 -0
- package/dist/{index-Dv9lUZqD.js → index-CIZw73j9.js} +539 -519
- package/dist/index-Cie6WPiM.cjs +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/{location-2QZADLiv.cjs → location-CSIhx-L4.cjs} +1 -1
- package/dist/{location-CaNtUswk.js → location-c1zdeySY.js} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/errors.d.cts +1 -1
- package/dist/server/errors.d.ts +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +597 -589
- package/docs/behavior/security.md +1 -1
- package/docs/behavior/url-contract.md +1 -0
- package/package.json +1 -1
- package/dist/ExplorerSplit-rUVsf5i-.cjs +0 -1
- package/dist/ExplorerSplit-uX2ojZe8.js +0 -1479
- package/dist/MultiLayout-ZK2V9nms.cjs +0 -1
- package/dist/TreeLayout-C7ZNnaOr.js +0 -22
- package/dist/TreeLayout-DkTVgxxb.cjs +0 -1
- package/dist/dataRoute-DYjYBiXF.cjs +0 -1
- package/dist/index-CLe6vRXs.cjs +0 -3
|
@@ -0,0 +1,1495 @@
|
|
|
1
|
+
import { jsx as f, jsxs as O, Fragment as Ge } from "react/jsx-runtime";
|
|
2
|
+
import { u as D, F as Nt, d as Oe, f as Ye, g as kt, E as Lt, h as Ot, i as Pt, j as At, k as qt } from "./index-CIZw73j9.js";
|
|
3
|
+
import * as m from "react";
|
|
4
|
+
import { use as Ee, createContext as Pe, useState as q, useCallback as w, useMemo as F, useRef as g, useLayoutEffect as I, useEffect as _, useSyncExternalStore as be, Suspense as Qe, useId as ye } from "react";
|
|
5
|
+
import { C as Ct, k as Ft, l as Je, v as Mt, m as _t, n as It, E as Dt, o as Be, q as Ht, s as Zt, S as ve, t as $t, F as Bt, A as zt } from "./location-c1zdeySY.js";
|
|
6
|
+
import { useDirectoryTreeState as Vt, DirectoryTree as jt } from "@aiquants/directory-tree";
|
|
7
|
+
import { T as Kt } from "./tapScrollCircle-u4EXeLhx.js";
|
|
8
|
+
import { s as Ut } from "./storage-DA4ItHzl.js";
|
|
9
|
+
import { PanelGroup as Wt, Panel as ze, PanelResizeHandle as Xt } from "@aiquants/resize-panels";
|
|
10
|
+
import { useLocation as Gt } from "react-router";
|
|
11
|
+
function Yt({
|
|
12
|
+
title: e,
|
|
13
|
+
titleId: t,
|
|
14
|
+
...n
|
|
15
|
+
}, r) {
|
|
16
|
+
return /* @__PURE__ */ m.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__ */ m.createElement("title", {
|
|
25
|
+
id: t
|
|
26
|
+
}, e) : null, /* @__PURE__ */ m.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 Qt = /* @__PURE__ */ m.forwardRef(Yt);
|
|
33
|
+
function Jt({
|
|
34
|
+
title: e,
|
|
35
|
+
titleId: t,
|
|
36
|
+
...n
|
|
37
|
+
}, r) {
|
|
38
|
+
return /* @__PURE__ */ m.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__ */ m.createElement("title", {
|
|
47
|
+
id: t
|
|
48
|
+
}, e) : null, /* @__PURE__ */ m.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 en = /* @__PURE__ */ m.forwardRef(Jt);
|
|
55
|
+
function tn({
|
|
56
|
+
title: e,
|
|
57
|
+
titleId: t,
|
|
58
|
+
...n
|
|
59
|
+
}, r) {
|
|
60
|
+
return /* @__PURE__ */ m.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__ */ m.createElement("title", {
|
|
69
|
+
id: t
|
|
70
|
+
}, e) : null, /* @__PURE__ */ m.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__ */ m.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 nn = /* @__PURE__ */ m.forwardRef(tn);
|
|
77
|
+
function rn({
|
|
78
|
+
title: e,
|
|
79
|
+
titleId: t,
|
|
80
|
+
...n
|
|
81
|
+
}, r) {
|
|
82
|
+
return /* @__PURE__ */ m.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__ */ m.createElement("title", {
|
|
91
|
+
id: t
|
|
92
|
+
}, e) : null, /* @__PURE__ */ m.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 an = /* @__PURE__ */ m.forwardRef(rn), ln = () => {
|
|
99
|
+
const { notices: e } = D(), t = Ee(e);
|
|
100
|
+
return t.length === 0 ? null : /* @__PURE__ */ f("div", { className: "aqmx-explorer-notices", children: t.map((n) => /* @__PURE__ */ O("div", { className: "aqmx-callout", "data-aqmx-tone": n.tone, "data-testid": "markdown-explorer-notice", "data-aqmx-notice": n.id, children: [
|
|
101
|
+
/* @__PURE__ */ f("p", { className: "aqmx-callout-title", children: n.title }),
|
|
102
|
+
n.body === void 0 ? null : /* @__PURE__ */ f("p", { className: "aqmx-callout-body", children: n.body }),
|
|
103
|
+
n.action === void 0 ? null : (
|
|
104
|
+
/* @__PURE__ */ f("a", { className: "aqmx-callout-action", href: n.action.href, children: n.action.label })
|
|
105
|
+
)
|
|
106
|
+
] }, n.id)) });
|
|
107
|
+
};
|
|
108
|
+
function on({
|
|
109
|
+
title: e,
|
|
110
|
+
titleId: t,
|
|
111
|
+
...n
|
|
112
|
+
}, r) {
|
|
113
|
+
return /* @__PURE__ */ m.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__ */ m.createElement("title", {
|
|
122
|
+
id: t
|
|
123
|
+
}, e) : null, /* @__PURE__ */ m.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 sn = /* @__PURE__ */ m.forwardRef(on), Ae = Pe(!0), et = "\0loop\0", tt = "\0", cn = () => {
|
|
130
|
+
const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = (l) => {
|
|
131
|
+
const a = e.get(l);
|
|
132
|
+
if (a !== void 0) return a;
|
|
133
|
+
const s = Object.freeze({ type: "loop", name: l.name, path: l.path });
|
|
134
|
+
return e.set(l, s), s;
|
|
135
|
+
}, o = (l, a, s) => {
|
|
136
|
+
let d = !1;
|
|
137
|
+
const u = l.map((p) => {
|
|
138
|
+
const h = i(p, a, s);
|
|
139
|
+
return h !== p && (d = !0), h;
|
|
140
|
+
});
|
|
141
|
+
if (!d) return l;
|
|
142
|
+
const c = n.get(l);
|
|
143
|
+
return c !== void 0 && c.length === u.length && c.every((p, h) => p === u[h]) ? c : (n.set(l, u), u);
|
|
144
|
+
}, i = (l, a, s) => {
|
|
145
|
+
if (l.type !== "directory") return l;
|
|
146
|
+
if (s.has(l.path)) return r(l);
|
|
147
|
+
const d = l.lazy === !0 ? a(l.path) : void 0, u = d?.status === "loaded", c = u ? d.entries : l.children;
|
|
148
|
+
if (c === void 0) return l;
|
|
149
|
+
s.add(l.path);
|
|
150
|
+
const p = o(c, a, s);
|
|
151
|
+
if (s.delete(l.path), !u && p === l.children) return l;
|
|
152
|
+
const h = t.get(l);
|
|
153
|
+
if (h !== void 0 && h.state === d && h.children === p) return h.grafted;
|
|
154
|
+
const v = { ...l, children: p, lazy: u ? !1 : l.lazy };
|
|
155
|
+
return t.set(l, { state: d, children: p, grafted: v }), v;
|
|
156
|
+
};
|
|
157
|
+
return (l, a) => o(l, a, /* @__PURE__ */ new Set());
|
|
158
|
+
}, dn = (e, t) => `${et}${e}${tt}${t}`, pe = (e) => e.startsWith(et), un = (e) => e.slice(e.lastIndexOf(tt) + 1), se = "data-aqmx-path", mn = (e, t, n, r, o) => {
|
|
159
|
+
const i = { aqmxPath: e.path };
|
|
160
|
+
return n && (i.aqmxOpen = !0), (r === "loading" || r === "failed") && (i.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: i
|
|
169
|
+
};
|
|
170
|
+
}, fn = (e, t, n, r) => {
|
|
171
|
+
const o = dn(t, e.path);
|
|
172
|
+
return { name: n, type: "directory", absolutePath: o, relativePath: o, children: r, data: { aqmxLoop: e.path } };
|
|
173
|
+
}, pn = () => {
|
|
174
|
+
const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = [], o = (a, s, d) => {
|
|
175
|
+
const u = a.map((p) => p.type === "loop" ? i(p, s, d) : l(p, s)), c = n.get(a);
|
|
176
|
+
return c !== void 0 && c.length === u.length && c.every((p, h) => p === u[h]) ? c : (n.set(a, u), u);
|
|
177
|
+
}, i = (a, s, d) => {
|
|
178
|
+
const u = t.get(a);
|
|
179
|
+
if (u !== void 0 && u.parentKey === d && u.loopFolderName === s.loopFolderName) return u.row;
|
|
180
|
+
const c = fn(a, d, s.loopFolderName(a.name), r);
|
|
181
|
+
return t.set(a, { row: c, parentKey: d, loopFolderName: s.loopFolderName }), c;
|
|
182
|
+
}, l = (a, s) => {
|
|
183
|
+
const d = a.type === "directory" ? a.children === void 0 ? r : o(a.children, s, a.path) : void 0, u = s.openPaths.has(a.path), c = a.type === "directory" && a.lazy === !0 ? s.childrenOf(a.path)?.status : void 0, p = c === "failed" ? s.renderFailedFolder : void 0, h = e.get(a);
|
|
184
|
+
if (h !== void 0 && h.open === u && h.childrenStatus === c && h.children === d && h.renderFailedFolder === p)
|
|
185
|
+
return h.row;
|
|
186
|
+
const v = mn(a, d, u, c, p === void 0 ? void 0 : p(a));
|
|
187
|
+
return e.set(a, { row: v, open: u, childrenStatus: c, children: d, renderFailedFolder: p }), v;
|
|
188
|
+
};
|
|
189
|
+
return (a, s) => o(a, s, "");
|
|
190
|
+
}, hn = (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
|
+
}, Le = (e, t) => {
|
|
195
|
+
const n = e.filter((r) => r.type === "directory");
|
|
196
|
+
return t === void 0 ? n : n.sort(t);
|
|
197
|
+
}, xn = (e, t) => {
|
|
198
|
+
const n = /* @__PURE__ */ new Map();
|
|
199
|
+
let r = 0;
|
|
200
|
+
const o = (i) => {
|
|
201
|
+
for (const l of Le(i, t.compare))
|
|
202
|
+
if (t.isShownExpanded(l.path)) {
|
|
203
|
+
if (l.lazy !== !0) {
|
|
204
|
+
l.children !== void 0 && o(l.children);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
n.has(l.path) || (n.set(l.path, t.isDirect(l.path) ? "direct" : "bulk"), t.childrenOf(l.path)?.status !== "failed" && (r += 1));
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
return o(e), { folders: n, waiting: r };
|
|
211
|
+
}, wn = (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
|
+
}, nt = (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 : nt(n.children, t);
|
|
222
|
+
if (r !== null) return r;
|
|
223
|
+
}
|
|
224
|
+
return null;
|
|
225
|
+
}, gn = (e, t, n, r) => {
|
|
226
|
+
let o = e;
|
|
227
|
+
for (const i of t) {
|
|
228
|
+
const l = o.find((a) => a.type === "directory" && a.path === i);
|
|
229
|
+
if (l === void 0) return "missing";
|
|
230
|
+
if (l.lazy === !0) return r.childrenOf(l.path)?.status === "failed" ? "failed" : "loading";
|
|
231
|
+
if (!r.isShownExpanded(l.path)) return "loading";
|
|
232
|
+
o = l.children ?? [];
|
|
233
|
+
}
|
|
234
|
+
return o.some((i) => i.type === "file" && i.path === n) ? "ready" : "missing";
|
|
235
|
+
}, Ve = /* @__PURE__ */ new Set(), vn = (e, t) => e.has(t) ? e : new Set(e).add(t), En = (e, t) => {
|
|
236
|
+
if (!t.some((r) => e.has(r))) return e;
|
|
237
|
+
const n = new Set(t);
|
|
238
|
+
return new Set([...e].filter((r) => !n.has(r)));
|
|
239
|
+
}, bn = (e, t) => [...e].every((n) => t.has(n)) ? e : new Set([...e].filter((n) => t.has(n))), yn = () => {
|
|
240
|
+
const [e, t] = q(Ve), n = w((l) => t((a) => vn(a, l)), []), r = w((l) => t((a) => En(a, l)), []), o = w((l) => t((a) => bn(a, l)), []), i = w(() => t(Ve), []);
|
|
241
|
+
return F(() => ({ direct: e, markDirect: n, unmarkDirect: r, pruneDirect: o, clearDirect: i }), [e, n, r, o, i]);
|
|
242
|
+
}, Rn = (e) => ({
|
|
243
|
+
budget: e,
|
|
244
|
+
handled: /* @__PURE__ */ new Set(),
|
|
245
|
+
loads: /* @__PURE__ */ new Set(),
|
|
246
|
+
opened: 0,
|
|
247
|
+
folderLimited: !1,
|
|
248
|
+
depthLimited: !1,
|
|
249
|
+
announcedStart: !1,
|
|
250
|
+
issuedAgainst: null
|
|
251
|
+
}), Sn = (e, t) => {
|
|
252
|
+
const n = [];
|
|
253
|
+
let r = Le(t.entries, t.compare);
|
|
254
|
+
for (let o = 1; r.length > 0; o += 1) {
|
|
255
|
+
const i = [];
|
|
256
|
+
for (const l of r) {
|
|
257
|
+
const { path: a } = l;
|
|
258
|
+
if (t.isShownExpanded(a))
|
|
259
|
+
e.handled.add(a);
|
|
260
|
+
else {
|
|
261
|
+
if (e.handled.has(a)) continue;
|
|
262
|
+
if (e.handled.add(a), l.lazy === !0 && t.childrenOf(a) === void 0) {
|
|
263
|
+
if (o > e.budget.maxDepth) {
|
|
264
|
+
e.depthLimited = !0;
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
if (e.loads.size >= e.budget.maxFolders) {
|
|
268
|
+
e.folderLimited = !0;
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
e.loads.add(a);
|
|
272
|
+
}
|
|
273
|
+
n.push(a), e.opened += 1;
|
|
274
|
+
}
|
|
275
|
+
l.lazy !== !0 && l.children !== void 0 && i.push(...Le(l.children, t.compare));
|
|
276
|
+
}
|
|
277
|
+
r = i;
|
|
278
|
+
}
|
|
279
|
+
return n;
|
|
280
|
+
}, rt = (e, t) => e.every((n) => n.type !== "directory" || t(n.path) && (n.lazy === !0 || n.children === void 0 || rt(n.children, t))), Tn = (e, t) => {
|
|
281
|
+
if (e.folderLimited) return { kind: "folder-limit", opened: e.opened };
|
|
282
|
+
if (e.depthLimited) return { kind: "depth-limit", opened: e.opened };
|
|
283
|
+
let n = 0;
|
|
284
|
+
for (const r of e.loads) t.childrenOf(r)?.status === "failed" && (n += 1);
|
|
285
|
+
return { kind: "done", opened: e.opened, failed: n, complete: rt(t.entries, t.isShownExpanded) };
|
|
286
|
+
}, Ne = Object.freeze({ state: "idle" }), Nn = (e) => {
|
|
287
|
+
const t = g(null), n = g(e), [r, o] = q(Ne);
|
|
288
|
+
I(() => {
|
|
289
|
+
n.current = e;
|
|
290
|
+
});
|
|
291
|
+
const i = w(() => {
|
|
292
|
+
t.current === null && (t.current = Rn(n.current.budget), o({ state: "running", opened: 0 }));
|
|
293
|
+
}, []), l = w(() => {
|
|
294
|
+
t.current = null, o(Ne);
|
|
295
|
+
}, []), a = w((s) => {
|
|
296
|
+
const d = t.current;
|
|
297
|
+
if (d === null) return;
|
|
298
|
+
const u = Sn(d, s);
|
|
299
|
+
if (u.length > 0 && (d.issuedAgainst = s.expanded, n.current.expandMultiple([...u])), !d.announcedStart && (d.loads.size > 0 || s.waiting > 0) && (d.announcedStart = !0, n.current.onStart()), u.length === 0 && !s.expansionPending && s.expanded !== d.issuedAgainst && s.waiting === 0) {
|
|
300
|
+
t.current = null;
|
|
301
|
+
const p = Tn(d, s);
|
|
302
|
+
o(p.kind === "done" ? Ne : { state: "stopped", stop: p.kind, opened: p.opened }), n.current.onFinish(p);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const { opened: c } = d;
|
|
306
|
+
o((p) => p.state === "running" && p.opened === c ? p : { state: "running", opened: c });
|
|
307
|
+
}, []);
|
|
308
|
+
return F(() => ({ status: r, start: i, end: l, advance: a }), [r, i, l, a]);
|
|
309
|
+
}, je = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], kn = 8, Ke = { least: Number.POSITIVE_INFINITY, stalled: 0 }, Ln = ({ tree: e, container: t, path: n, chain: r, rows: o, cancel: i, displayed: l, placement: a }) => {
|
|
310
|
+
const s = g(null), d = g(!0), u = g(Ke), c = g(null), p = g(null), h = g(r), v = g(a);
|
|
311
|
+
I(() => {
|
|
312
|
+
h.current = r, v.current = a;
|
|
313
|
+
}, [r, a]);
|
|
314
|
+
const b = w(() => {
|
|
315
|
+
const L = c.current;
|
|
316
|
+
L !== null && (c.current = null, L.phase === "asking" ? L.controller.abort() : h.current?.open(null));
|
|
317
|
+
}, []), S = w(() => {
|
|
318
|
+
s.current = null, b();
|
|
319
|
+
}, [b]), C = w(() => {
|
|
320
|
+
const L = t.current;
|
|
321
|
+
s.current === null || p.current !== null || L === null || L.getClientRects().length === 0 || (p.current = requestAnimationFrame(() => {
|
|
322
|
+
p.current = null;
|
|
323
|
+
const E = s.current;
|
|
324
|
+
if (E === null) return;
|
|
325
|
+
const R = v.current(E);
|
|
326
|
+
if (R === 0) {
|
|
327
|
+
d.current = !0, c.current?.phase === "opening" && b();
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
if (e.current?.scrollToPath(E, { align: "nearest" }) === !0) {
|
|
331
|
+
c.current?.phase === "opening" && b();
|
|
332
|
+
const { least: P, stalled: H } = u.current;
|
|
333
|
+
u.current = R < P ? { least: R, stalled: 0 } : { least: P, stalled: H + 1 }, u.current.stalled < kn && C();
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const y = c.current;
|
|
337
|
+
if (y === null) {
|
|
338
|
+
s.current = null;
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
y.phase === "opening" && h.current?.progress(y.folders, E) !== "loading" && S();
|
|
342
|
+
}));
|
|
343
|
+
}, [e, t, b, S]), T = w(() => {
|
|
344
|
+
d.current = !1, u.current = Ke, C();
|
|
345
|
+
}, [C]);
|
|
346
|
+
_(() => {
|
|
347
|
+
const L = t.current;
|
|
348
|
+
if (L === null) return;
|
|
349
|
+
const E = typeof ResizeObserver > "u" ? null : new ResizeObserver(T);
|
|
350
|
+
E?.observe(L);
|
|
351
|
+
for (const R of je) L.addEventListener(R, S, { passive: !0 });
|
|
352
|
+
return () => {
|
|
353
|
+
E?.disconnect();
|
|
354
|
+
for (const R of je) L.removeEventListener(R, S);
|
|
355
|
+
p.current !== null && cancelAnimationFrame(p.current), p.current = null, b();
|
|
356
|
+
};
|
|
357
|
+
}, [t, T, S, b]);
|
|
358
|
+
const k = r !== null;
|
|
359
|
+
_(() => {
|
|
360
|
+
const L = t.current;
|
|
361
|
+
if (S(), n === null || L === null || L.contains(L.ownerDocument.activeElement)) return;
|
|
362
|
+
s.current = n;
|
|
363
|
+
const E = h.current;
|
|
364
|
+
if (k && E !== null) {
|
|
365
|
+
const R = new AbortController(), y = { phase: "asking", controller: R };
|
|
366
|
+
c.current = y, E.ancestors(n, R.signal).then((P) => {
|
|
367
|
+
c.current === y && (P === null ? c.current = null : (c.current = { phase: "opening", folders: P }, h.current?.open(P)), T());
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
T();
|
|
371
|
+
}, [n, k, t, S, T]), _(() => {
|
|
372
|
+
(c.current?.phase === "opening" || s.current !== null && !d.current) && T();
|
|
373
|
+
}, [o, T]);
|
|
374
|
+
const $ = g(i);
|
|
375
|
+
_(() => {
|
|
376
|
+
$.current !== i && ($.current = i, S());
|
|
377
|
+
}, [i, S]);
|
|
378
|
+
const M = g(l);
|
|
379
|
+
_(() => {
|
|
380
|
+
M.current && !l && b(), M.current = l;
|
|
381
|
+
}, [l, b]);
|
|
382
|
+
}, On = "--aqmx-tree-line", Pn = Object.freeze(["(forced-colors: active)", "(prefers-color-scheme: dark)"]), An = "data-aqmx-tree-probe", qn = Object.freeze({ rowHeight: Ct, lineColor: null }), Cn = /^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u, Fn = (e) => {
|
|
383
|
+
const t = Cn.exec(e);
|
|
384
|
+
return t === null ? e : `#${t.slice(1).map((n) => Number(n).toString(16).padStart(2, "0")).join("")}`;
|
|
385
|
+
}, Mn = (e, t) => {
|
|
386
|
+
const [n, r] = q(qn);
|
|
387
|
+
return I(() => {
|
|
388
|
+
const o = e.current;
|
|
389
|
+
if (o === null) return;
|
|
390
|
+
const i = () => {
|
|
391
|
+
const s = Math.round(o.getBoundingClientRect().height), d = getComputedStyle(o), u = d.getPropertyValue(On).trim() === "" ? null : Fn(d.color);
|
|
392
|
+
r((c) => {
|
|
393
|
+
const p = Number.isFinite(s) && s > 0 ? s : c.rowHeight;
|
|
394
|
+
return c.rowHeight === p && c.lineColor === u ? c : { rowHeight: p, lineColor: u };
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
i();
|
|
398
|
+
const l = Pn.map((s) => window.matchMedia(s));
|
|
399
|
+
for (const s of l) s.addEventListener("change", i);
|
|
400
|
+
const a = typeof ResizeObserver > "u" ? null : new ResizeObserver(i);
|
|
401
|
+
return a?.observe(o), () => {
|
|
402
|
+
for (const s of l) s.removeEventListener("change", i);
|
|
403
|
+
a?.disconnect();
|
|
404
|
+
};
|
|
405
|
+
}, [e, t]), n;
|
|
406
|
+
}, at = "markdown-explorer-tree-scroll", _n = 0.5, lt = (e, t) => [...e.querySelectorAll(`[role="treeitem"][${se}]`)].find((n) => n.getAttribute(se) === t), In = (e, t) => {
|
|
407
|
+
const n = lt(e, t), r = n?.closest(`[data-testid="${at}"]`);
|
|
408
|
+
if (n === void 0 || r === null || r === void 0) return Number.POSITIVE_INFINITY;
|
|
409
|
+
const o = r.getBoundingClientRect(), i = n.getBoundingClientRect(), l = o.top - i.top, a = i.height > o.height ? Math.abs(l) : Math.max(0, l) + Math.max(0, i.bottom - o.bottom);
|
|
410
|
+
return a <= _n ? 0 : a;
|
|
411
|
+
}, Dn = {
|
|
412
|
+
testId: at,
|
|
413
|
+
overscanCount: 13,
|
|
414
|
+
callbackThrottleMs: 13,
|
|
415
|
+
scrollBarOptions: {
|
|
416
|
+
width: 8,
|
|
417
|
+
enableTrackClick: !0,
|
|
418
|
+
enableThumbDrag: !0,
|
|
419
|
+
enableArrowButtons: !0,
|
|
420
|
+
enableArrowButtonTabStops: !1,
|
|
421
|
+
enableScrollToTopBottomButtons: !0,
|
|
422
|
+
tapScrollCircleOptions: Kt
|
|
423
|
+
},
|
|
424
|
+
behaviorOptions: { enablePointerDrag: !0 }
|
|
425
|
+
}, Hn = { hoverClassName: "", directorySelectedClassName: "", itemSelectedClassName: "" }, Zn = { color: "inherit" }, $n = { paddingBlock: 0 }, Bn = /* @__PURE__ */ new Set(), zn = /* @__PURE__ */ new Map(), Vn = { color: "var(--aqmx-tree-line)" }, jn = (e) => {
|
|
426
|
+
const t = e instanceof Element ? e.closest(`[${se}]`) : null;
|
|
427
|
+
return t === null || t.getAttribute("data-entry-type") !== "file" ? null : t.getAttribute(se);
|
|
428
|
+
}, ot = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth), Kn = (e, t, n) => n.kind === "done" ? e.expandAllDone(n.opened, n.failed, n.complete) : ot(e, t, n.kind, n.opened), st = () => {
|
|
429
|
+
const { labels: e } = D();
|
|
430
|
+
return /* @__PURE__ */ O("div", { className: "aqmx-explorer-loading", "aria-busy": "true", "data-testid": "markdown-explorer-tree-loading", children: [
|
|
431
|
+
/* @__PURE__ */ f("p", { className: "aqmx-explorer-loading-text", children: e.treeLoading }),
|
|
432
|
+
/* @__PURE__ */ O("div", { className: "aqmx-skeleton", "aria-hidden": "true", children: [
|
|
433
|
+
/* @__PURE__ */ f("span", {}),
|
|
434
|
+
/* @__PURE__ */ f("span", {}),
|
|
435
|
+
/* @__PURE__ */ f("span", {}),
|
|
436
|
+
/* @__PURE__ */ f("span", {}),
|
|
437
|
+
/* @__PURE__ */ f("span", {})
|
|
438
|
+
] })
|
|
439
|
+
] });
|
|
440
|
+
}, Un = () => {
|
|
441
|
+
const { labels: e } = D();
|
|
442
|
+
return /* @__PURE__ */ O("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-tree-empty", children: [
|
|
443
|
+
/* @__PURE__ */ f(sn, { className: "aqmx-explorer-empty-icon", "aria-hidden": "true" }),
|
|
444
|
+
/* @__PURE__ */ f("p", { className: "aqmx-empty-title", children: e.treeEmptyTitle }),
|
|
445
|
+
/* @__PURE__ */ f("p", { className: "aqmx-explorer-empty-body", children: e.treeEmptyBody })
|
|
446
|
+
] });
|
|
447
|
+
}, Wn = ({ name: e, onRetry: t }) => {
|
|
448
|
+
const { labels: n } = D(), r = ye();
|
|
449
|
+
return /* @__PURE__ */ O("span", { className: "aqmx-explorer-folder-failed", children: [
|
|
450
|
+
/* @__PURE__ */ f("span", { className: "aqmx-explorer-folder-name", children: e }),
|
|
451
|
+
/* @__PURE__ */ f("span", { id: r, className: "aqmx-explorer-folder-error", children: n.folderLoadFailed }),
|
|
452
|
+
/* @__PURE__ */ O(
|
|
453
|
+
"button",
|
|
454
|
+
{
|
|
455
|
+
type: "button",
|
|
456
|
+
className: "aqmx-explorer-folder-retry",
|
|
457
|
+
"aria-describedby": r,
|
|
458
|
+
"data-testid": "markdown-explorer-folder-retry",
|
|
459
|
+
onClick: (o) => {
|
|
460
|
+
o.stopPropagation();
|
|
461
|
+
const i = o.currentTarget, l = i.ownerDocument.activeElement === i ? i.closest('[role="treeitem"]') : null;
|
|
462
|
+
l instanceof HTMLElement && Ye(l), t();
|
|
463
|
+
},
|
|
464
|
+
onKeyDown: (o) => {
|
|
465
|
+
o.key !== "Escape" && o.stopPropagation();
|
|
466
|
+
},
|
|
467
|
+
children: [
|
|
468
|
+
/* @__PURE__ */ f(Oe, { className: "aqmx-explorer-folder-retry-icon", "aria-hidden": "true" }),
|
|
469
|
+
/* @__PURE__ */ f("span", { className: "aqmx-explorer-folder-retry-text", children: n.retry })
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
] });
|
|
474
|
+
}, Xn = ({
|
|
475
|
+
entries: e,
|
|
476
|
+
version: t,
|
|
477
|
+
mode: n,
|
|
478
|
+
sourceId: r,
|
|
479
|
+
settings: o,
|
|
480
|
+
reveal: i,
|
|
481
|
+
openPaths: l,
|
|
482
|
+
selection: a,
|
|
483
|
+
onOpenDocument: s,
|
|
484
|
+
onRevealSource: d,
|
|
485
|
+
expansion: u,
|
|
486
|
+
onShown: c,
|
|
487
|
+
marks: p,
|
|
488
|
+
claimsHeld: h,
|
|
489
|
+
expandAll: v,
|
|
490
|
+
revealCancel: b
|
|
491
|
+
}) => {
|
|
492
|
+
const { trees: S, documents: C, labels: T, locale: k, theme: $, data: M, config: L, sources: E, reveals: R } = D(), y = Ee(Ae), [P] = q(pn), H = g(null), { rowHeight: de, lineColor: X } = Mn(H, $), { isExpanded: B, toggle: ee, expandMultiple: K, collapseMultiple: ae, expanded: V, isPending: le } = u, { alwaysExpanded: G, sortMode: Z, folderPlacement: U } = o, { direct: ue, markDirect: W, unmarkDirect: ce, pruneDirect: me } = p, { running: oe, advance: he } = v, fe = g(null), te = g(null), N = F(() => Ft({ sortMode: Z, folderPlacement: U }), [Z, U]), Y = F(() => hn(N), [N]), z = w((x) => S.children(r, x), [S, r]), ne = F(() => wn(e), [e]), re = w((x) => !pe(x) && (B(x) || G && !ne.has(x)), [B, G, ne]), Q = g({ shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z });
|
|
493
|
+
I(() => {
|
|
494
|
+
Q.current = { shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z };
|
|
495
|
+
}, [re, B, ne, e, z]);
|
|
496
|
+
const Me = w((x) => {
|
|
497
|
+
fe.current?.scrollToPath(x, { align: "nearest" }), requestAnimationFrame(() => {
|
|
498
|
+
const A = te.current, j = A === null ? void 0 : lt(A, x);
|
|
499
|
+
j !== void 0 && Ye(j);
|
|
500
|
+
});
|
|
501
|
+
}, []), pt = w(
|
|
502
|
+
(x) => {
|
|
503
|
+
if (pe(x)) {
|
|
504
|
+
Me(un(x));
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
Q.current.isExpanded(x) ? ce([x]) : Q.current.unloadedFolders.has(x) && W(x), ee(x);
|
|
508
|
+
},
|
|
509
|
+
[Me, W, ce, ee]
|
|
510
|
+
), Re = w(
|
|
511
|
+
(x) => {
|
|
512
|
+
const A = x.filter((j) => !pe(j));
|
|
513
|
+
A.length !== 0 && (ce(A), ae(A));
|
|
514
|
+
},
|
|
515
|
+
[ce, ae]
|
|
516
|
+
), ht = w(
|
|
517
|
+
(x) => {
|
|
518
|
+
const A = x.filter((j) => !pe(j));
|
|
519
|
+
A.length !== 0 && (A.length < x.length && A.every((j) => Q.current.shownExpanded(j)) ? Re(A) : K(A));
|
|
520
|
+
},
|
|
521
|
+
[K, Re]
|
|
522
|
+
), _e = w(
|
|
523
|
+
(x) => /* @__PURE__ */ f(
|
|
524
|
+
Wn,
|
|
525
|
+
{
|
|
526
|
+
name: x.name,
|
|
527
|
+
onRetry: () => {
|
|
528
|
+
W(x.path), S.retryChildren(r, x.path), Q.current.shownExpanded(x.path) || K([x.path]);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
),
|
|
532
|
+
[S, r, W, K]
|
|
533
|
+
), Ie = n === "multi" ? l : Bn, { loopFolderName: De } = T, xt = F(() => P(e, { openPaths: Ie, childrenOf: z, renderFailedFolder: _e, loopFolderName: De }), [P, e, Ie, z, _e, De, t]), wt = kt(C, jn), He = g([]), xe = w(() => {
|
|
534
|
+
for (const x of He.current) Q.current.unloadedFolders.has(x) && W(x);
|
|
535
|
+
}, [W]), { maxDepth: Se } = L.revealDocument, Ze = g(d);
|
|
536
|
+
I(() => {
|
|
537
|
+
Ze.current = d;
|
|
538
|
+
}, [d]);
|
|
539
|
+
const gt = F(
|
|
540
|
+
() => ({
|
|
541
|
+
ancestors: async (x, A) => {
|
|
542
|
+
const j = R.take(r, x);
|
|
543
|
+
if (j !== null) return j;
|
|
544
|
+
if (!R.mayMove(x)) {
|
|
545
|
+
const ie = await M.ancestors(r, x, A);
|
|
546
|
+
return ie.status !== "ok" || ie.ancestors === null || ie.ancestors.length > Se ? null : ie.ancestors;
|
|
547
|
+
}
|
|
548
|
+
const J = await M.reveal(r, x, A);
|
|
549
|
+
return J.status !== "ok" || J.source === null || J.ancestors.length > Se ? null : J.source === r ? J.ancestors : (A.aborted || !E.some((ie) => ie.id === J.source) || (R.move(J.source, x, J.ancestors), Ze.current(J.source)), null);
|
|
550
|
+
},
|
|
551
|
+
open: (x) => {
|
|
552
|
+
He.current = x ?? [], x !== null && (xe(), K([...x]));
|
|
553
|
+
},
|
|
554
|
+
progress: (x, A) => gn(Q.current.entries, x, A, { isShownExpanded: Q.current.shownExpanded, childrenOf: Q.current.childrenOf })
|
|
555
|
+
}),
|
|
556
|
+
[M, r, E, R, Se, xe, K]
|
|
557
|
+
);
|
|
558
|
+
_(() => xe(), [xe, ne]);
|
|
559
|
+
const vt = F(() => [e, t, V], [e, t, V]), Et = w((x) => te.current === null ? Number.POSITIVE_INFINITY : In(te.current, x), []);
|
|
560
|
+
Ln({ tree: fe, container: te, path: i.path, chain: i.openFolders ? gt : null, rows: vt, cancel: b, displayed: y, placement: Et });
|
|
561
|
+
const $e = w((x) => ue.has(x), [ue]), we = F(() => xn(e, { isShownExpanded: re, childrenOf: z, compare: N, isDirect: $e }), [e, re, z, N, $e, t]), ge = y && h;
|
|
562
|
+
I(() => {
|
|
563
|
+
c(e);
|
|
564
|
+
}, [e, c]), I(() => () => c(null), [c]), _(() => S.claimChildren(r, ge ? we.folders : zn), [S, r, ge, we]), _(() => me(ne), [me, ne]), _(() => {
|
|
565
|
+
ge && oe && he({ entries: e, isShownExpanded: re, childrenOf: z, compare: N, expanded: V, waiting: we.waiting, expansionPending: le });
|
|
566
|
+
}, [ge, oe, he, e, re, z, N, V, we, le]);
|
|
567
|
+
const bt = w(
|
|
568
|
+
(x) => {
|
|
569
|
+
x.isDirectory || (R.settle(x.entry.absolutePath), s(x.entry.absolutePath));
|
|
570
|
+
},
|
|
571
|
+
[R, s]
|
|
572
|
+
), { onChange: Te } = a, yt = F(
|
|
573
|
+
() => Te === null ? void 0 : (x, A) => {
|
|
574
|
+
pe(x.absolutePath) || Te({ path: x.absolutePath, name: x.name, selected: A });
|
|
575
|
+
},
|
|
576
|
+
[Te]
|
|
577
|
+
), Rt = F(() => new Set(a.items), [a.items]), St = F(
|
|
578
|
+
() => ({
|
|
579
|
+
entryKindDirectory: T.treeEntryKindDirectory,
|
|
580
|
+
entryKindFile: T.treeEntryKindFile,
|
|
581
|
+
scrollUp: T.treeScrollUp,
|
|
582
|
+
scrollDown: T.treeScrollDown,
|
|
583
|
+
scrollToTop: T.treeScrollToTop,
|
|
584
|
+
scrollToBottom: T.treeScrollToBottom
|
|
585
|
+
}),
|
|
586
|
+
[T]
|
|
587
|
+
), Tt = X === null ? { showTreeLines: !1 } : { showTreeLines: o.lines, lineColor: X };
|
|
588
|
+
return /* @__PURE__ */ O("div", { ref: te, className: "aqmx-explorer-tree", "data-testid": "markdown-explorer-tree", ...wt, children: [
|
|
589
|
+
/* @__PURE__ */ f("span", { ref: H, className: "aqmx-explorer-tree-probe", "aria-hidden": "true", [An]: "" }),
|
|
590
|
+
/* @__PURE__ */ f(
|
|
591
|
+
jt,
|
|
592
|
+
{
|
|
593
|
+
ref: fe,
|
|
594
|
+
entries: xt,
|
|
595
|
+
expansion: {
|
|
596
|
+
toggle: pt,
|
|
597
|
+
isExpanded: re,
|
|
598
|
+
expandMultiple: ht,
|
|
599
|
+
collapseMultiple: Re,
|
|
600
|
+
isPending: le && !oe,
|
|
601
|
+
doubleClickAction: o.doubleClickAction
|
|
602
|
+
},
|
|
603
|
+
selection: { mode: a.mode, selectedPath: a.shownPath, currentPath: a.shownPath, selectedItems: Rt, onEntryClick: bt, onSelectionChange: yt },
|
|
604
|
+
visual: {
|
|
605
|
+
className: "aqmx-explorer-tree-view",
|
|
606
|
+
ariaLabel: T.treeRegion,
|
|
607
|
+
...Tt,
|
|
608
|
+
showExpandIcons: o.expandIcons,
|
|
609
|
+
expandIconStyle: Vn,
|
|
610
|
+
showDirectoryIcons: o.directoryIcons,
|
|
611
|
+
showFileIcons: o.fileIcons,
|
|
612
|
+
expandIconSize: o.expandIconSize,
|
|
613
|
+
itemHeight: de,
|
|
614
|
+
removeRootIndent: o.removeRootIndent,
|
|
615
|
+
highlightStyles: Hn,
|
|
616
|
+
entryStyle: $n,
|
|
617
|
+
nameStyle: Zn
|
|
618
|
+
},
|
|
619
|
+
virtualScroll: Dn,
|
|
620
|
+
sort: Y,
|
|
621
|
+
locale: k,
|
|
622
|
+
labels: St
|
|
623
|
+
}
|
|
624
|
+
)
|
|
625
|
+
] });
|
|
626
|
+
}, Gn = ({ pending: e, status: t }) => {
|
|
627
|
+
const { labels: n } = D(), r = t.state !== "running", [o, i] = q(0), l = g(!0);
|
|
628
|
+
I(() => {
|
|
629
|
+
const s = l.current;
|
|
630
|
+
if (l.current = r, !r || e > 0 && !s) {
|
|
631
|
+
i(0);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
if (e > 0) {
|
|
635
|
+
i(e);
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
if (o === 0) return;
|
|
639
|
+
const d = setTimeout(() => i(0), 0);
|
|
640
|
+
return () => clearTimeout(d);
|
|
641
|
+
}, [r, e, o]);
|
|
642
|
+
const a = r && e === 0 ? o : e;
|
|
643
|
+
return a === 0 && r ? null : /* @__PURE__ */ O("p", { className: "aqmx-explorer-tree-progress", "data-testid": "markdown-explorer-tree-progress", "data-aqmx-loading": String(a), "data-aqmx-expand-all": t.state, children: [
|
|
644
|
+
a > 0 ? /* @__PURE__ */ f(Oe, { className: "aqmx-explorer-tree-progress-icon", "aria-hidden": "true" }) : null,
|
|
645
|
+
/* @__PURE__ */ f("span", { children: t.state === "running" ? n.expandAllProgress(t.opened, a) : n.foldersLoading(a) })
|
|
646
|
+
] });
|
|
647
|
+
}, Yn = ({ stop: e, opened: t, budget: n }) => {
|
|
648
|
+
const { labels: r } = D();
|
|
649
|
+
return /* @__PURE__ */ f("p", { className: "aqmx-explorer-expand-all-stop", "data-testid": "markdown-explorer-expand-all-stop", "data-aqmx-stop": e, children: ot(r, n, e, t) });
|
|
650
|
+
}, Qn = ({ entries: e, ...t }) => {
|
|
651
|
+
const { trees: n } = D(), r = be(n.subscribe, n.version, n.version), { sourceId: o } = t, [i] = q(cn), l = F(() => i(e, (a) => n.children(o, a)), [i, e, n, o, r]);
|
|
652
|
+
return l.length === 0 ? /* @__PURE__ */ f(Un, {}) : /* @__PURE__ */ f(Xn, { entries: l, version: r, ...t });
|
|
653
|
+
}, Jn = ({ result: e, onRetry: t, ...n }) => {
|
|
654
|
+
const { renderTreeFailure: r } = D(), o = Ee(e);
|
|
655
|
+
if (o.status === "deferred") return /* @__PURE__ */ f(st, {});
|
|
656
|
+
if (o.status === "ok") return /* @__PURE__ */ f(Qn, { entries: o.entries, ...n });
|
|
657
|
+
const i = r?.(o.failure);
|
|
658
|
+
return /* @__PURE__ */ f("div", { className: "aqmx-explorer-tree-message", "data-testid": "markdown-explorer-tree-failure", "data-aqmx-failure": o.failure.reason, children: i !== void 0 ? i : /* @__PURE__ */ f(Nt, { failure: o.failure, alert: !0, onRetry: t, testId: null }) });
|
|
659
|
+
}, er = ({ onControls: e, ...t }) => {
|
|
660
|
+
const { trees: n, storageNamespace: r, labels: o, announcer: i, config: l } = D(), { sourceId: a } = t, s = Vt({ storageKey: Ut(r).treeExpansion(a) });
|
|
661
|
+
be(n.subscribe, n.version, n.version);
|
|
662
|
+
const d = n.read(a), u = w(() => n.retry(a), [n, a]);
|
|
663
|
+
I(() => n.open(a), [n, a]);
|
|
664
|
+
const c = yn(), { expanded: p, expandMultiple: h, collapseAll: v } = s, [b, S] = q(null), C = b !== p, T = g(p);
|
|
665
|
+
I(() => {
|
|
666
|
+
T.current = p;
|
|
667
|
+
}, [p]);
|
|
668
|
+
const k = l.expandAll, $ = w(() => i.announce(o.expandAllStarted), [i, o]), M = w((Z) => i.announce(Kn(o, k, Z)), [i, o, k]), L = Nn({ budget: k, expandMultiple: h, onStart: $, onFinish: M }), { status: E, start: R, end: y, advance: P } = L, H = E.state === "running", de = F(() => ({ running: H, advance: P }), [H, P]), X = g(null), [B, ee] = q(!1), K = w((Z) => {
|
|
669
|
+
X.current = Z, ee(Z !== null);
|
|
670
|
+
}, []);
|
|
671
|
+
_(
|
|
672
|
+
() => n.subscribeChildrenFailures((Z) => {
|
|
673
|
+
const U = Z.sourceId === a && X.current !== null ? nt(X.current, Z.path) : null;
|
|
674
|
+
U !== null && i.announce({ list: o.foldersLoadFailedNamed, item: U.name });
|
|
675
|
+
}),
|
|
676
|
+
[n, a, i, o]
|
|
677
|
+
);
|
|
678
|
+
const { clearDirect: ae } = c, [V, le] = q(0), G = w(() => {
|
|
679
|
+
le((Z) => Z + 1), y(), ae(), S(T.current), v();
|
|
680
|
+
}, [y, ae, v]);
|
|
681
|
+
return _(() => {
|
|
682
|
+
e({ collapseAll: G, expandAll: B ? R : null, expanding: H });
|
|
683
|
+
}, [e, G, R, B, H]), _(() => () => e(null), [e]), _(() => {
|
|
684
|
+
B || y();
|
|
685
|
+
}, [B, y]), /* @__PURE__ */ O(Ge, { children: [
|
|
686
|
+
E.state === "stopped" ? /* @__PURE__ */ f(Yn, { stop: E.stop, opened: E.opened, budget: k }) : null,
|
|
687
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-tree-area", children: [
|
|
688
|
+
/* @__PURE__ */ f(Qe, { fallback: /* @__PURE__ */ f(st, {}), children: /* @__PURE__ */ f(Jn, { result: d, onRetry: u, expansion: s, onShown: K, marks: c, claimsHeld: C, expandAll: de, revealCancel: V, ...t }) }),
|
|
689
|
+
/* @__PURE__ */ f(Gn, { pending: n.pendingChildren(a), status: E })
|
|
690
|
+
] })
|
|
691
|
+
] });
|
|
692
|
+
};
|
|
693
|
+
function tr({
|
|
694
|
+
title: e,
|
|
695
|
+
titleId: t,
|
|
696
|
+
...n
|
|
697
|
+
}, r) {
|
|
698
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
699
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
700
|
+
viewBox: "0 0 24 24",
|
|
701
|
+
fill: "currentColor",
|
|
702
|
+
"aria-hidden": "true",
|
|
703
|
+
"data-slot": "icon",
|
|
704
|
+
ref: r,
|
|
705
|
+
"aria-labelledby": t
|
|
706
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
707
|
+
id: t
|
|
708
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
709
|
+
fillRule: "evenodd",
|
|
710
|
+
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",
|
|
711
|
+
clipRule: "evenodd"
|
|
712
|
+
}));
|
|
713
|
+
}
|
|
714
|
+
const ct = /* @__PURE__ */ m.forwardRef(tr), Ue = "markdown-explorer-selection-remove", nr = ({ selection: e, onRemove: t, onClear: n, onOpenSelection: r, onLeave: o }) => {
|
|
715
|
+
const { labels: i } = D(), l = ye(), a = g(null), s = [...e], d = (c, p) => {
|
|
716
|
+
if (p.ownerDocument.activeElement === p) {
|
|
717
|
+
const h = a.current === null ? [] : [...a.current.querySelectorAll(`[data-testid="${Ue}"]`)], v = h.indexOf(p), b = [h[v + 1], h[v - 1]].find((S) => S !== void 0);
|
|
718
|
+
b === void 0 ? o() : b.focus();
|
|
719
|
+
}
|
|
720
|
+
t(c);
|
|
721
|
+
}, u = () => {
|
|
722
|
+
const c = a.current;
|
|
723
|
+
c !== null && c.contains(c.ownerDocument.activeElement) && o(), n();
|
|
724
|
+
};
|
|
725
|
+
return /* @__PURE__ */ O("section", { ref: a, className: "aqmx-explorer-tray", "aria-labelledby": l, "data-testid": "markdown-explorer-selection-tray", children: [
|
|
726
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-tray-header", children: [
|
|
727
|
+
/* @__PURE__ */ f("p", { id: l, className: "aqmx-explorer-tray-title", children: i.selectionTitle(s.length) }),
|
|
728
|
+
/* @__PURE__ */ f("button", { type: "button", className: "aqmx-explorer-tray-button", "data-testid": "markdown-explorer-selection-clear", onClick: u, children: i.clearSelection })
|
|
729
|
+
] }),
|
|
730
|
+
/* @__PURE__ */ f("ul", { className: "aqmx-explorer-tray-list", children: s.map(([c, p]) => /* @__PURE__ */ O("li", { className: "aqmx-explorer-tray-item", children: [
|
|
731
|
+
/* @__PURE__ */ f("span", { className: "aqmx-explorer-tray-name", title: c, children: p }),
|
|
732
|
+
/* @__PURE__ */ f(
|
|
733
|
+
"button",
|
|
734
|
+
{
|
|
735
|
+
type: "button",
|
|
736
|
+
className: "aqmx-icon-button aqmx-explorer-tray-remove",
|
|
737
|
+
"aria-label": i.removeFromSelection(p),
|
|
738
|
+
title: i.removeFromSelection(p),
|
|
739
|
+
"data-testid": Ue,
|
|
740
|
+
"data-aqmx-path": c,
|
|
741
|
+
onClick: (h) => d(c, h.currentTarget),
|
|
742
|
+
children: /* @__PURE__ */ f(ct, { "aria-hidden": "true" })
|
|
743
|
+
}
|
|
744
|
+
)
|
|
745
|
+
] }, c)) }),
|
|
746
|
+
r === void 0 ? null : /* @__PURE__ */ f("button", { type: "button", className: "aqmx-explorer-tray-open", "data-testid": "markdown-explorer-selection-open", onClick: () => r(s.map(([c]) => c)), children: i.openSelectionInMulti(s.length) })
|
|
747
|
+
] });
|
|
748
|
+
}, ke = /* @__PURE__ */ new Map(), rr = (e, t) => {
|
|
749
|
+
if (t.selected === e.has(t.path)) return e;
|
|
750
|
+
const n = new Map(e);
|
|
751
|
+
return t.selected ? n.set(t.path, t.name) : n.delete(t.path), n;
|
|
752
|
+
}, ar = (e, t) => {
|
|
753
|
+
if (!e.has(t)) return e;
|
|
754
|
+
const n = new Map(e);
|
|
755
|
+
return n.delete(t), n;
|
|
756
|
+
}, it = Pe(null), lr = (e) => {
|
|
757
|
+
const t = Ee(it);
|
|
758
|
+
I(() => {
|
|
759
|
+
if (t !== null)
|
|
760
|
+
return t(e), () => t(!1);
|
|
761
|
+
}, [t, e]);
|
|
762
|
+
};
|
|
763
|
+
function or({
|
|
764
|
+
title: e,
|
|
765
|
+
titleId: t,
|
|
766
|
+
...n
|
|
767
|
+
}, r) {
|
|
768
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
769
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
770
|
+
viewBox: "0 0 24 24",
|
|
771
|
+
fill: "currentColor",
|
|
772
|
+
"aria-hidden": "true",
|
|
773
|
+
"data-slot": "icon",
|
|
774
|
+
ref: r,
|
|
775
|
+
"aria-labelledby": t
|
|
776
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
777
|
+
id: t
|
|
778
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
779
|
+
fillRule: "evenodd",
|
|
780
|
+
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",
|
|
781
|
+
clipRule: "evenodd"
|
|
782
|
+
}));
|
|
783
|
+
}
|
|
784
|
+
const sr = /* @__PURE__ */ m.forwardRef(or);
|
|
785
|
+
function cr({
|
|
786
|
+
title: e,
|
|
787
|
+
titleId: t,
|
|
788
|
+
...n
|
|
789
|
+
}, r) {
|
|
790
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
791
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
792
|
+
viewBox: "0 0 24 24",
|
|
793
|
+
fill: "currentColor",
|
|
794
|
+
"aria-hidden": "true",
|
|
795
|
+
"data-slot": "icon",
|
|
796
|
+
ref: r,
|
|
797
|
+
"aria-labelledby": t
|
|
798
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
799
|
+
id: t
|
|
800
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
801
|
+
fillRule: "evenodd",
|
|
802
|
+
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",
|
|
803
|
+
clipRule: "evenodd"
|
|
804
|
+
}));
|
|
805
|
+
}
|
|
806
|
+
const ir = /* @__PURE__ */ m.forwardRef(cr);
|
|
807
|
+
function dr({
|
|
808
|
+
title: e,
|
|
809
|
+
titleId: t,
|
|
810
|
+
...n
|
|
811
|
+
}, r) {
|
|
812
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
813
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
814
|
+
viewBox: "0 0 24 24",
|
|
815
|
+
fill: "currentColor",
|
|
816
|
+
"aria-hidden": "true",
|
|
817
|
+
"data-slot": "icon",
|
|
818
|
+
ref: r,
|
|
819
|
+
"aria-labelledby": t
|
|
820
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
821
|
+
id: t
|
|
822
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
823
|
+
fillRule: "evenodd",
|
|
824
|
+
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",
|
|
825
|
+
clipRule: "evenodd"
|
|
826
|
+
}));
|
|
827
|
+
}
|
|
828
|
+
const ur = /* @__PURE__ */ m.forwardRef(dr);
|
|
829
|
+
function mr({
|
|
830
|
+
title: e,
|
|
831
|
+
titleId: t,
|
|
832
|
+
...n
|
|
833
|
+
}, r) {
|
|
834
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
835
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
836
|
+
viewBox: "0 0 24 24",
|
|
837
|
+
fill: "currentColor",
|
|
838
|
+
"aria-hidden": "true",
|
|
839
|
+
"data-slot": "icon",
|
|
840
|
+
ref: r,
|
|
841
|
+
"aria-labelledby": t
|
|
842
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
843
|
+
id: t
|
|
844
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
845
|
+
fillRule: "evenodd",
|
|
846
|
+
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",
|
|
847
|
+
clipRule: "evenodd"
|
|
848
|
+
}));
|
|
849
|
+
}
|
|
850
|
+
const fr = /* @__PURE__ */ m.forwardRef(mr);
|
|
851
|
+
function pr({
|
|
852
|
+
title: e,
|
|
853
|
+
titleId: t,
|
|
854
|
+
...n
|
|
855
|
+
}, r) {
|
|
856
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
857
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
858
|
+
viewBox: "0 0 24 24",
|
|
859
|
+
fill: "currentColor",
|
|
860
|
+
"aria-hidden": "true",
|
|
861
|
+
"data-slot": "icon",
|
|
862
|
+
ref: r,
|
|
863
|
+
"aria-labelledby": t
|
|
864
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
865
|
+
id: t
|
|
866
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
867
|
+
fillRule: "evenodd",
|
|
868
|
+
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",
|
|
869
|
+
clipRule: "evenodd"
|
|
870
|
+
}));
|
|
871
|
+
}
|
|
872
|
+
const hr = /* @__PURE__ */ m.forwardRef(pr);
|
|
873
|
+
function xr({
|
|
874
|
+
title: e,
|
|
875
|
+
titleId: t,
|
|
876
|
+
...n
|
|
877
|
+
}, r) {
|
|
878
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
879
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
880
|
+
viewBox: "0 0 24 24",
|
|
881
|
+
fill: "currentColor",
|
|
882
|
+
"aria-hidden": "true",
|
|
883
|
+
"data-slot": "icon",
|
|
884
|
+
ref: r,
|
|
885
|
+
"aria-labelledby": t
|
|
886
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
887
|
+
id: t
|
|
888
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
889
|
+
fillRule: "evenodd",
|
|
890
|
+
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",
|
|
891
|
+
clipRule: "evenodd"
|
|
892
|
+
}));
|
|
893
|
+
}
|
|
894
|
+
const wr = /* @__PURE__ */ m.forwardRef(xr);
|
|
895
|
+
function gr({
|
|
896
|
+
title: e,
|
|
897
|
+
titleId: t,
|
|
898
|
+
...n
|
|
899
|
+
}, r) {
|
|
900
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
901
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
902
|
+
viewBox: "0 0 24 24",
|
|
903
|
+
fill: "currentColor",
|
|
904
|
+
"aria-hidden": "true",
|
|
905
|
+
"data-slot": "icon",
|
|
906
|
+
ref: r,
|
|
907
|
+
"aria-labelledby": t
|
|
908
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
909
|
+
id: t
|
|
910
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
911
|
+
fillRule: "evenodd",
|
|
912
|
+
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",
|
|
913
|
+
clipRule: "evenodd"
|
|
914
|
+
}));
|
|
915
|
+
}
|
|
916
|
+
const vr = /* @__PURE__ */ m.forwardRef(gr);
|
|
917
|
+
function Er({
|
|
918
|
+
title: e,
|
|
919
|
+
titleId: t,
|
|
920
|
+
...n
|
|
921
|
+
}, r) {
|
|
922
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
923
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
924
|
+
viewBox: "0 0 24 24",
|
|
925
|
+
fill: "currentColor",
|
|
926
|
+
"aria-hidden": "true",
|
|
927
|
+
"data-slot": "icon",
|
|
928
|
+
ref: r,
|
|
929
|
+
"aria-labelledby": t
|
|
930
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
931
|
+
id: t
|
|
932
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
933
|
+
fillRule: "evenodd",
|
|
934
|
+
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",
|
|
935
|
+
clipRule: "evenodd"
|
|
936
|
+
}), /* @__PURE__ */ m.createElement("path", {
|
|
937
|
+
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"
|
|
938
|
+
}));
|
|
939
|
+
}
|
|
940
|
+
const br = /* @__PURE__ */ m.forwardRef(Er);
|
|
941
|
+
function yr({
|
|
942
|
+
title: e,
|
|
943
|
+
titleId: t,
|
|
944
|
+
...n
|
|
945
|
+
}, r) {
|
|
946
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
947
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
948
|
+
viewBox: "0 0 24 24",
|
|
949
|
+
fill: "currentColor",
|
|
950
|
+
"aria-hidden": "true",
|
|
951
|
+
"data-slot": "icon",
|
|
952
|
+
ref: r,
|
|
953
|
+
"aria-labelledby": t
|
|
954
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
955
|
+
id: t
|
|
956
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
957
|
+
d: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
|
|
958
|
+
}), /* @__PURE__ */ m.createElement("path", {
|
|
959
|
+
fillRule: "evenodd",
|
|
960
|
+
d: "M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",
|
|
961
|
+
clipRule: "evenodd"
|
|
962
|
+
}));
|
|
963
|
+
}
|
|
964
|
+
const Rr = /* @__PURE__ */ m.forwardRef(yr);
|
|
965
|
+
function Sr({
|
|
966
|
+
title: e,
|
|
967
|
+
titleId: t,
|
|
968
|
+
...n
|
|
969
|
+
}, r) {
|
|
970
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
971
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
972
|
+
viewBox: "0 0 24 24",
|
|
973
|
+
fill: "currentColor",
|
|
974
|
+
"aria-hidden": "true",
|
|
975
|
+
"data-slot": "icon",
|
|
976
|
+
ref: r,
|
|
977
|
+
"aria-labelledby": t
|
|
978
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
979
|
+
id: t
|
|
980
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
981
|
+
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"
|
|
982
|
+
}));
|
|
983
|
+
}
|
|
984
|
+
const Tr = /* @__PURE__ */ m.forwardRef(Sr);
|
|
985
|
+
function Nr({
|
|
986
|
+
title: e,
|
|
987
|
+
titleId: t,
|
|
988
|
+
...n
|
|
989
|
+
}, r) {
|
|
990
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
991
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
992
|
+
viewBox: "0 0 24 24",
|
|
993
|
+
fill: "currentColor",
|
|
994
|
+
"aria-hidden": "true",
|
|
995
|
+
"data-slot": "icon",
|
|
996
|
+
ref: r,
|
|
997
|
+
"aria-labelledby": t
|
|
998
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
999
|
+
id: t
|
|
1000
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
1001
|
+
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"
|
|
1002
|
+
}));
|
|
1003
|
+
}
|
|
1004
|
+
const kr = /* @__PURE__ */ m.forwardRef(Nr);
|
|
1005
|
+
function Lr({
|
|
1006
|
+
title: e,
|
|
1007
|
+
titleId: t,
|
|
1008
|
+
...n
|
|
1009
|
+
}, r) {
|
|
1010
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
1011
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1012
|
+
viewBox: "0 0 24 24",
|
|
1013
|
+
fill: "currentColor",
|
|
1014
|
+
"aria-hidden": "true",
|
|
1015
|
+
"data-slot": "icon",
|
|
1016
|
+
ref: r,
|
|
1017
|
+
"aria-labelledby": t
|
|
1018
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
1019
|
+
id: t
|
|
1020
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
1021
|
+
fillRule: "evenodd",
|
|
1022
|
+
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",
|
|
1023
|
+
clipRule: "evenodd"
|
|
1024
|
+
}));
|
|
1025
|
+
}
|
|
1026
|
+
const Or = /* @__PURE__ */ m.forwardRef(Lr);
|
|
1027
|
+
function Pr({
|
|
1028
|
+
title: e,
|
|
1029
|
+
titleId: t,
|
|
1030
|
+
...n
|
|
1031
|
+
}, r) {
|
|
1032
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
1033
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1034
|
+
viewBox: "0 0 24 24",
|
|
1035
|
+
fill: "currentColor",
|
|
1036
|
+
"aria-hidden": "true",
|
|
1037
|
+
"data-slot": "icon",
|
|
1038
|
+
ref: r,
|
|
1039
|
+
"aria-labelledby": t
|
|
1040
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
1041
|
+
id: t
|
|
1042
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
1043
|
+
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"
|
|
1044
|
+
}));
|
|
1045
|
+
}
|
|
1046
|
+
const Ar = /* @__PURE__ */ m.forwardRef(Pr), qe = (e) => {
|
|
1047
|
+
e.preventDefault(), e.stopPropagation();
|
|
1048
|
+
}, qr = Object.freeze({
|
|
1049
|
+
sortMode: ir,
|
|
1050
|
+
folderPlacement: Tr,
|
|
1051
|
+
selectionMode: ur,
|
|
1052
|
+
doubleClickAction: vr,
|
|
1053
|
+
expandIconSize: Or,
|
|
1054
|
+
alwaysExpanded: sr,
|
|
1055
|
+
revealDocument: Rr,
|
|
1056
|
+
removeRootIndent: fr,
|
|
1057
|
+
lines: Ar,
|
|
1058
|
+
expandIcons: hr,
|
|
1059
|
+
directoryIcons: kr,
|
|
1060
|
+
fileIcons: br
|
|
1061
|
+
}), dt = (e, t) => {
|
|
1062
|
+
const n = e[t.labelKey];
|
|
1063
|
+
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}`);
|
|
1064
|
+
return n;
|
|
1065
|
+
}, Cr = ({ id: e, settings: t, descriptors: n, onAdvance: r, onClose: o, ref: i }) => {
|
|
1066
|
+
const { labels: l } = D(), a = g([]);
|
|
1067
|
+
_(() => {
|
|
1068
|
+
a.current[0]?.focus();
|
|
1069
|
+
}, []);
|
|
1070
|
+
const s = w(
|
|
1071
|
+
(u) => {
|
|
1072
|
+
const c = n.length;
|
|
1073
|
+
a.current[(u % c + c) % c]?.focus();
|
|
1074
|
+
},
|
|
1075
|
+
[n.length]
|
|
1076
|
+
), d = w(
|
|
1077
|
+
(u, c) => {
|
|
1078
|
+
switch (u.key) {
|
|
1079
|
+
case "ArrowDown":
|
|
1080
|
+
u.preventDefault(), s(c + 1);
|
|
1081
|
+
break;
|
|
1082
|
+
case "ArrowUp":
|
|
1083
|
+
u.preventDefault(), s(c - 1);
|
|
1084
|
+
break;
|
|
1085
|
+
case "Home":
|
|
1086
|
+
u.preventDefault(), s(0);
|
|
1087
|
+
break;
|
|
1088
|
+
case "End":
|
|
1089
|
+
u.preventDefault(), s(n.length - 1);
|
|
1090
|
+
break;
|
|
1091
|
+
case "Escape":
|
|
1092
|
+
qe(u), o();
|
|
1093
|
+
break;
|
|
1094
|
+
case "Tab":
|
|
1095
|
+
o();
|
|
1096
|
+
break;
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
[n.length, s, o]
|
|
1100
|
+
);
|
|
1101
|
+
return /* @__PURE__ */ f("div", { ref: i, id: e, role: "menu", "aria-label": l.treeSettings, className: "aqmx-explorer-menu", "data-testid": "markdown-explorer-tree-settings-menu", children: n.map((u, c) => {
|
|
1102
|
+
const p = qr[u.key], h = dt(l, u), v = Je(l, t, u.key), b = t[u.key], S = typeof b == "boolean" ? { role: "menuitemcheckbox", "aria-checked": b, "aria-label": h } : { role: "menuitem", "aria-label": `${h}: ${v}` };
|
|
1103
|
+
return /* @__PURE__ */ O(
|
|
1104
|
+
"button",
|
|
1105
|
+
{
|
|
1106
|
+
ref: (C) => {
|
|
1107
|
+
a.current[c] = C;
|
|
1108
|
+
},
|
|
1109
|
+
type: "button",
|
|
1110
|
+
tabIndex: -1,
|
|
1111
|
+
...S,
|
|
1112
|
+
title: `${h}: ${v}`,
|
|
1113
|
+
className: "aqmx-explorer-menu-item",
|
|
1114
|
+
"data-testid": "markdown-explorer-tree-settings-item",
|
|
1115
|
+
"data-aqmx-setting": u.key,
|
|
1116
|
+
onClick: () => r(u),
|
|
1117
|
+
onKeyDown: (C) => d(C, c),
|
|
1118
|
+
children: [
|
|
1119
|
+
/* @__PURE__ */ f(p, { className: "aqmx-explorer-menu-icon", "aria-hidden": "true" }),
|
|
1120
|
+
/* @__PURE__ */ f("span", { className: "aqmx-explorer-menu-name", children: h }),
|
|
1121
|
+
/* @__PURE__ */ f("span", { className: "aqmx-explorer-menu-value", children: v })
|
|
1122
|
+
]
|
|
1123
|
+
},
|
|
1124
|
+
u.key
|
|
1125
|
+
);
|
|
1126
|
+
}) });
|
|
1127
|
+
}, Fr = ({ settings: e, descriptors: t, onAdvance: n }) => {
|
|
1128
|
+
const { labels: r, announcer: o } = D(), [i, l] = q(!1), a = g(null), s = g(null), d = g(null), u = ye(), c = w(() => {
|
|
1129
|
+
a.current?.focus(), l(!1);
|
|
1130
|
+
}, []);
|
|
1131
|
+
_(() => {
|
|
1132
|
+
if (!i) return;
|
|
1133
|
+
const v = (b) => {
|
|
1134
|
+
b.target instanceof Node && (a.current?.contains(b.target) === !0 || s.current?.contains(b.target) === !0) || (l(!1), d.current !== null && window.clearTimeout(d.current), d.current = window.setTimeout(() => {
|
|
1135
|
+
d.current = null, (document.activeElement === null || document.activeElement === document.body) && a.current?.focus();
|
|
1136
|
+
}, 0));
|
|
1137
|
+
};
|
|
1138
|
+
return document.addEventListener("pointerdown", v), () => document.removeEventListener("pointerdown", v);
|
|
1139
|
+
}, [i]), _(
|
|
1140
|
+
() => () => {
|
|
1141
|
+
d.current !== null && window.clearTimeout(d.current);
|
|
1142
|
+
},
|
|
1143
|
+
[]
|
|
1144
|
+
);
|
|
1145
|
+
const p = w(
|
|
1146
|
+
(v) => {
|
|
1147
|
+
v.key !== "Escape" || !i || (qe(v), c());
|
|
1148
|
+
},
|
|
1149
|
+
[i, c]
|
|
1150
|
+
), h = w(
|
|
1151
|
+
(v) => {
|
|
1152
|
+
const b = n(v.key);
|
|
1153
|
+
o.announce(r.settingAnnouncement(dt(r, v), Je(r, b, v.key)));
|
|
1154
|
+
},
|
|
1155
|
+
[o, r, n]
|
|
1156
|
+
);
|
|
1157
|
+
return {
|
|
1158
|
+
trigger: /* @__PURE__ */ f(
|
|
1159
|
+
"button",
|
|
1160
|
+
{
|
|
1161
|
+
ref: a,
|
|
1162
|
+
type: "button",
|
|
1163
|
+
className: "aqmx-icon-button",
|
|
1164
|
+
"aria-haspopup": "menu",
|
|
1165
|
+
"aria-expanded": i,
|
|
1166
|
+
"aria-controls": i ? u : void 0,
|
|
1167
|
+
"aria-label": r.treeSettings,
|
|
1168
|
+
title: r.treeSettings,
|
|
1169
|
+
"data-testid": "markdown-explorer-tree-settings",
|
|
1170
|
+
onClick: () => l((v) => !v),
|
|
1171
|
+
onKeyDown: p,
|
|
1172
|
+
children: /* @__PURE__ */ f(wr, { "aria-hidden": "true" })
|
|
1173
|
+
}
|
|
1174
|
+
),
|
|
1175
|
+
menu: i ? /* @__PURE__ */ f(Cr, { ref: s, id: u, settings: e, descriptors: t, onAdvance: h, onClose: c }) : null
|
|
1176
|
+
};
|
|
1177
|
+
}, Mr = () => {
|
|
1178
|
+
const { treeSettings: e } = D();
|
|
1179
|
+
return { settings: be(e.subscribe, e.getSnapshot, e.getServerSnapshot), advance: e.advance };
|
|
1180
|
+
}, We = /* @__PURE__ */ new Set(), _r = '[role="tree"] [role="treeitem"][tabindex="0"]', Ir = "[data-directory-tree-tab-stop]", sa = (e) => {
|
|
1181
|
+
const { mode: t, sourceId: n, currentPath: r, openPaths: o, onOpenDocument: i, onSourceChange: l, onRevealSource: a, viewSwitch: s } = e, { labels: d, sources: u, trees: c, documents: p, announcer: h, reveals: v } = D(), { settings: b, advance: S } = Mr(), C = F(() => Mt(t === "tree"), [t]), T = t === "tree" && b.selectionMode === "multiple";
|
|
1182
|
+
lr(T);
|
|
1183
|
+
const k = e.mode === "tree" ? e.tray.onGatheredChange : null, $ = e.mode === "tree" ? e.onOpenSelection : void 0, M = e.mode === "tree" && T ? e.tray.gathered : ke, L = w(
|
|
1184
|
+
(N) => {
|
|
1185
|
+
const Y = S(N);
|
|
1186
|
+
return Y.selectionMode !== "multiple" && k?.(ke), Y;
|
|
1187
|
+
},
|
|
1188
|
+
[S, k]
|
|
1189
|
+
), E = Fr({ settings: b, descriptors: C, onAdvance: L }), R = w((N) => k?.((Y) => rr(Y, N)), [k]), y = w((N) => k?.((Y) => ar(Y, N)), [k]), P = w(() => k?.(ke), [k]), H = g(null), de = w(() => {
|
|
1190
|
+
const N = H.current;
|
|
1191
|
+
if (N === null) return;
|
|
1192
|
+
[_r, Ir, '[data-testid="markdown-explorer-tree-settings"]'].map((z) => N.querySelector(z)).find((z) => z !== null)?.focus();
|
|
1193
|
+
}, []), X = F(() => new Set(M.keys()), [M]), B = F(() => r === null ? We : /* @__PURE__ */ new Set([r]), [r]), ee = F(() => {
|
|
1194
|
+
if (t === "multi") return { mode: "multiple", items: o, shownPath: null, onChange: null };
|
|
1195
|
+
switch (b.selectionMode) {
|
|
1196
|
+
case "single":
|
|
1197
|
+
return { mode: "single", items: B, shownPath: r, onChange: null };
|
|
1198
|
+
case "multiple":
|
|
1199
|
+
return { mode: "multiple", items: X, shownPath: r, onChange: R };
|
|
1200
|
+
case "none":
|
|
1201
|
+
return { mode: "none", items: We, shownPath: null, onChange: null };
|
|
1202
|
+
}
|
|
1203
|
+
}, [t, o, b.selectionMode, B, r, X, R]), K = F(() => b.revealDocument ? { path: r, openFolders: !0 } : { path: ee.shownPath, openFolders: !1 }, [b.revealDocument, r, ee.shownPath]), ae = w(
|
|
1204
|
+
(N) => {
|
|
1205
|
+
r !== null && v.settle(r), l(N);
|
|
1206
|
+
},
|
|
1207
|
+
[r, v, l]
|
|
1208
|
+
), [V, le] = q(null), [G, Z] = q(!1), [U, ue] = q(null), W = g(!1), ce = w(async () => {
|
|
1209
|
+
if (!W.current) {
|
|
1210
|
+
W.current = !0, Z(!0), ue(null);
|
|
1211
|
+
try {
|
|
1212
|
+
const N = await c.refresh(n);
|
|
1213
|
+
if (N.status === "superseded") return;
|
|
1214
|
+
p.invalidate(), N.status === "failed" ? ue({ sourceId: n, failure: N.failure }) : h.announce(d.treeRefreshed);
|
|
1215
|
+
} finally {
|
|
1216
|
+
W.current = !1, Z(!1);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}, [c, p, n, h, d]), me = V === null ? null : V.expandAll, oe = V?.expanding === !0, he = u.find((N) => N.id === n), fe = s.target === "multi" ? an : nn, te = s.target === "multi" ? d.switchToMulti : d.switchToTree;
|
|
1220
|
+
return /* @__PURE__ */ O("nav", { ref: H, "aria-label": d.explorerRegion, className: "aqmx-explorer", "data-testid": "markdown-explorer-explorer", "data-aqmx-mode": t, children: [
|
|
1221
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-header", children: [
|
|
1222
|
+
u.length > 1 ? /* @__PURE__ */ f("select", { className: "aqmx-explorer-source", "aria-label": d.sourceLabel, title: he?.label, value: n, onChange: (N) => ae(N.currentTarget.value), "data-testid": "markdown-explorer-source-select", children: u.map((N) => /* @__PURE__ */ f("option", { value: N.id, children: N.label }, N.id)) }) : null,
|
|
1223
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-actions", children: [
|
|
1224
|
+
/* @__PURE__ */ f(Lt, { to: s.href, navigation: "switch-view", className: "aqmx-icon-button", "aria-label": te, title: te, "data-testid": "markdown-explorer-view-switch", "data-aqmx-target": s.target, children: /* @__PURE__ */ f(fe, { "aria-hidden": "true" }) }),
|
|
1225
|
+
/* @__PURE__ */ O(
|
|
1226
|
+
"button",
|
|
1227
|
+
{
|
|
1228
|
+
type: "button",
|
|
1229
|
+
className: "aqmx-icon-button aqmx-labelled-button",
|
|
1230
|
+
title: d.refreshTree,
|
|
1231
|
+
"aria-disabled": G,
|
|
1232
|
+
"aria-busy": G,
|
|
1233
|
+
"data-aqmx-busy": G ? "true" : void 0,
|
|
1234
|
+
"data-testid": "markdown-explorer-refresh",
|
|
1235
|
+
onClick: () => {
|
|
1236
|
+
ce();
|
|
1237
|
+
},
|
|
1238
|
+
children: [
|
|
1239
|
+
/* @__PURE__ */ f(Oe, { "aria-hidden": "true" }),
|
|
1240
|
+
/* @__PURE__ */ f("span", { children: d.refreshTreeLabel })
|
|
1241
|
+
]
|
|
1242
|
+
}
|
|
1243
|
+
),
|
|
1244
|
+
/* @__PURE__ */ f(
|
|
1245
|
+
"button",
|
|
1246
|
+
{
|
|
1247
|
+
type: "button",
|
|
1248
|
+
className: "aqmx-icon-button",
|
|
1249
|
+
"aria-label": d.expandAll,
|
|
1250
|
+
title: d.expandAll,
|
|
1251
|
+
"aria-disabled": me === null || oe,
|
|
1252
|
+
"aria-busy": oe,
|
|
1253
|
+
"data-aqmx-busy": oe ? "true" : void 0,
|
|
1254
|
+
"data-testid": "markdown-explorer-expand-all",
|
|
1255
|
+
onClick: () => me?.(),
|
|
1256
|
+
children: /* @__PURE__ */ f(en, { "aria-hidden": "true" })
|
|
1257
|
+
}
|
|
1258
|
+
),
|
|
1259
|
+
/* @__PURE__ */ f("button", { type: "button", className: "aqmx-icon-button", "aria-label": d.collapseAll, title: d.collapseAll, "aria-disabled": V === null, "data-testid": "markdown-explorer-collapse-all", onClick: () => V?.collapseAll(), children: /* @__PURE__ */ f(Qt, { "aria-hidden": "true" }) }),
|
|
1260
|
+
E.trigger
|
|
1261
|
+
] })
|
|
1262
|
+
] }),
|
|
1263
|
+
/* @__PURE__ */ O("div", { className: "aqmx-explorer-body", "data-aqmx-explorer-body": "", children: [
|
|
1264
|
+
U !== null && U.sourceId === n ? /* @__PURE__ */ f("p", { role: "alert", className: "aqmx-explorer-refresh-failure", "data-testid": "markdown-explorer-refresh-failure", "data-aqmx-failure": U.failure.reason, children: d.treeRefreshFailed(Ot(d, U.failure.reason)) }) : null,
|
|
1265
|
+
/* @__PURE__ */ f(Qe, { fallback: null, children: /* @__PURE__ */ f(ln, {}) }),
|
|
1266
|
+
/* @__PURE__ */ f(er, { mode: t, sourceId: n, settings: b, reveal: K, openPaths: o, selection: ee, onOpenDocument: i, onRevealSource: a, onControls: le }, n),
|
|
1267
|
+
T && M.size > 0 ? /* @__PURE__ */ f(nr, { selection: M, onRemove: y, onClear: P, onOpenSelection: $, onLeave: de }) : null,
|
|
1268
|
+
E.menu
|
|
1269
|
+
] })
|
|
1270
|
+
] });
|
|
1271
|
+
}, ut = "(pointer: coarse)", Dr = (e) => {
|
|
1272
|
+
const t = window.matchMedia(ut);
|
|
1273
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
1274
|
+
}, Hr = () => window.matchMedia(ut).matches, Zr = () => !1, $r = () => be(Dr, Hr, Zr);
|
|
1275
|
+
function Br({
|
|
1276
|
+
title: e,
|
|
1277
|
+
titleId: t,
|
|
1278
|
+
...n
|
|
1279
|
+
}, r) {
|
|
1280
|
+
return /* @__PURE__ */ m.createElement("svg", Object.assign({
|
|
1281
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1282
|
+
viewBox: "0 0 24 24",
|
|
1283
|
+
fill: "currentColor",
|
|
1284
|
+
"aria-hidden": "true",
|
|
1285
|
+
"data-slot": "icon",
|
|
1286
|
+
ref: r,
|
|
1287
|
+
"aria-labelledby": t
|
|
1288
|
+
}, n), e ? /* @__PURE__ */ m.createElement("title", {
|
|
1289
|
+
id: t
|
|
1290
|
+
}, e) : null, /* @__PURE__ */ m.createElement("path", {
|
|
1291
|
+
fillRule: "evenodd",
|
|
1292
|
+
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",
|
|
1293
|
+
clipRule: "evenodd"
|
|
1294
|
+
}));
|
|
1295
|
+
}
|
|
1296
|
+
const zr = /* @__PURE__ */ m.forwardRef(Br), Vr = ({ explorer: e, toggleRef: t, covered: n, onNoticeSlotChange: r, dismissals: o }) => {
|
|
1297
|
+
const { labels: i } = D(), l = Gt(), { location: a } = Pt(), [s, d] = q(!1), [u, c] = q({ navigated: l, source: a.source }), [p, h] = q(!1);
|
|
1298
|
+
u.navigated !== l && (c({ navigated: l, source: a.source }), u.source === a.source && !p && d(!1));
|
|
1299
|
+
const [v, b] = q(o);
|
|
1300
|
+
v !== o && (b(o), d(!1));
|
|
1301
|
+
const S = g(null), C = g(null), T = g(null), k = g(!1), $ = ye();
|
|
1302
|
+
I(() => {
|
|
1303
|
+
const y = S.current;
|
|
1304
|
+
y !== null && (s && !y.open ? (y.showModal(), C.current?.focus()) : !s && y.open && (y.close(), t.current?.focus()), r(s ? T.current : null));
|
|
1305
|
+
}, [s, t, r]), I(() => () => r(null), [r]);
|
|
1306
|
+
const M = w((y) => {
|
|
1307
|
+
y.key !== "Escape" || y.defaultPrevented || (qe(y), d(!1));
|
|
1308
|
+
}, []), L = w((y) => {
|
|
1309
|
+
k.current = y.target === y.currentTarget;
|
|
1310
|
+
}, []), E = w((y) => {
|
|
1311
|
+
const P = k.current;
|
|
1312
|
+
k.current = !1, P && y.target === y.currentTarget && d(!1);
|
|
1313
|
+
}, []), R = w(() => {
|
|
1314
|
+
d(!1);
|
|
1315
|
+
}, []);
|
|
1316
|
+
return /* @__PURE__ */ O(Ge, { children: [
|
|
1317
|
+
/* @__PURE__ */ f("div", { className: "aqmx-sheet-bar", inert: n, children: /* @__PURE__ */ O("button", { ref: t, type: "button", className: "aqmx-sheet-toggle", "aria-haspopup": "dialog", "aria-expanded": s, "aria-controls": $, "data-testid": "markdown-explorer-sheet-toggle", onClick: () => d(!0), children: [
|
|
1318
|
+
/* @__PURE__ */ f(zr, { "aria-hidden": "true" }),
|
|
1319
|
+
/* @__PURE__ */ f("span", { children: i.showExplorer })
|
|
1320
|
+
] }) }),
|
|
1321
|
+
/* @__PURE__ */ f("dialog", { ref: S, id: $, className: "aqmx-sheet", "aria-label": i.explorerRegion, "data-testid": "markdown-explorer-sheet", onKeyDown: M, onPointerDown: L, onClick: E, onClose: R, children: /* @__PURE__ */ O("div", { className: "aqmx-sheet-panel", children: [
|
|
1322
|
+
/* @__PURE__ */ O("div", { className: "aqmx-sheet-header", children: [
|
|
1323
|
+
/* @__PURE__ */ f("div", { ref: T, className: "aqmx-sheet-notice-slot" }),
|
|
1324
|
+
/* @__PURE__ */ f("button", { ref: C, type: "button", className: "aqmx-sheet-close", "aria-label": i.hideExplorer, title: i.hideExplorer, "data-testid": "markdown-explorer-sheet-close", onClick: () => d(!1), children: /* @__PURE__ */ f(ct, { "aria-hidden": "true" }) })
|
|
1325
|
+
] }),
|
|
1326
|
+
/* @__PURE__ */ f("div", { className: "aqmx-sheet-body", children: /* @__PURE__ */ f(Ae, { value: s, children: /* @__PURE__ */ f(it, { value: h, children: e }) }) }),
|
|
1327
|
+
/* @__PURE__ */ f(At, { holds: s, testId: "markdown-explorer-sheet-announcer" })
|
|
1328
|
+
] }) })
|
|
1329
|
+
] });
|
|
1330
|
+
}, jr = Pe(null), Ce = "aqmx-explorer", mt = "aqmx-content", Fe = '[role="tree"] [role="treeitem"]', Kr = `${Fe}[tabindex="0"]`, Ur = "[data-directory-tree-tab-stop]", Wr = (e, t) => {
|
|
1331
|
+
for (const n of e.querySelectorAll(`[data-panel-id="${Ce}"] ${Fe}`)) if (n.getAttribute(se) === t) return n;
|
|
1332
|
+
return null;
|
|
1333
|
+
}, Xe = (e, t) => ({
|
|
1334
|
+
inlineSize: e > 0 ? e : null,
|
|
1335
|
+
rootFontPixels: t > 0 ? t : zt
|
|
1336
|
+
}), Xr = (e, t) => {
|
|
1337
|
+
const [n, r] = q(() => Xe(0, 0));
|
|
1338
|
+
return I(() => {
|
|
1339
|
+
const o = e.current, i = t.current;
|
|
1340
|
+
if (o === null || i === null) throw new Error("[markdown-explorer] the split frame is not mounted");
|
|
1341
|
+
const l = { frame: o.getBoundingClientRect().width, rem: i.getBoundingClientRect().width }, a = () => {
|
|
1342
|
+
const d = Xe(l.frame, l.rem);
|
|
1343
|
+
r((u) => u.inlineSize === d.inlineSize && u.rootFontPixels === d.rootFontPixels ? u : d);
|
|
1344
|
+
};
|
|
1345
|
+
a();
|
|
1346
|
+
const s = new ResizeObserver((d) => {
|
|
1347
|
+
for (const u of d) {
|
|
1348
|
+
const [c] = u.borderBoxSize;
|
|
1349
|
+
c !== void 0 && (u.target === o && (l.frame = c.inlineSize), u.target === i && (l.rem = c.inlineSize));
|
|
1350
|
+
}
|
|
1351
|
+
a();
|
|
1352
|
+
});
|
|
1353
|
+
return s.observe(o), s.observe(i), () => s.disconnect();
|
|
1354
|
+
}, [e, t]), n;
|
|
1355
|
+
}, ft = (e) => `aqmx-split-handle-${e}`, Gr = (e, { frameRef: t, sheetToggleRef: n, handleId: r }) => {
|
|
1356
|
+
const o = g(!1), i = g(null), l = g(!1);
|
|
1357
|
+
I(() => {
|
|
1358
|
+
const s = t.current;
|
|
1359
|
+
if (s === null) throw new Error("[markdown-explorer] the split frame is not mounted");
|
|
1360
|
+
const d = (c) => {
|
|
1361
|
+
const p = c.target instanceof Element ? c.target : null;
|
|
1362
|
+
o.current = p !== null && p.closest(`[data-panel-id="${mt}"]`) === null, !l.current && (i.current = p?.closest(`${Fe}[${se}]`)?.getAttribute(se) ?? null);
|
|
1363
|
+
}, u = (c) => {
|
|
1364
|
+
c.relatedTarget instanceof Node && !s.contains(c.relatedTarget) && (o.current = !1);
|
|
1365
|
+
};
|
|
1366
|
+
return s.addEventListener("focusin", d), s.addEventListener("focusout", u), () => {
|
|
1367
|
+
s.removeEventListener("focusin", d), s.removeEventListener("focusout", u);
|
|
1368
|
+
};
|
|
1369
|
+
}, [t]);
|
|
1370
|
+
const a = g(e);
|
|
1371
|
+
I(() => {
|
|
1372
|
+
if (a.current === e) return;
|
|
1373
|
+
a.current = e;
|
|
1374
|
+
const s = t.current;
|
|
1375
|
+
if (s === null || !o.current) return;
|
|
1376
|
+
const d = (u) => {
|
|
1377
|
+
const { activeElement: c, body: p } = s.ownerDocument;
|
|
1378
|
+
if (c !== null && c !== p) return;
|
|
1379
|
+
const h = u.find((v) => v !== null);
|
|
1380
|
+
if (h != null) {
|
|
1381
|
+
l.current = !0;
|
|
1382
|
+
try {
|
|
1383
|
+
h.focus();
|
|
1384
|
+
} finally {
|
|
1385
|
+
l.current = !1;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
if (e) {
|
|
1390
|
+
d([n.current]);
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
queueMicrotask(() => {
|
|
1394
|
+
if (a.current !== e || !o.current) return;
|
|
1395
|
+
const u = i.current, c = `[data-panel-id="${Ce}"]`;
|
|
1396
|
+
d([
|
|
1397
|
+
u === null ? null : Wr(s, u),
|
|
1398
|
+
s.querySelector(`${c} ${Kr}`),
|
|
1399
|
+
s.querySelector(`${c} ${Ur}`),
|
|
1400
|
+
s.querySelector(`[data-resize-handle-id="${r}"]`)
|
|
1401
|
+
]);
|
|
1402
|
+
});
|
|
1403
|
+
}, [e, t, n, r]);
|
|
1404
|
+
}, ca = ({ view: e, explorer: t, content: n, contentCoversPage: r = !1, sheetDismissals: o = 0, onDraggingChange: i }) => {
|
|
1405
|
+
const l = g(null), [a, s] = q(null), d = g(null), u = g(null), { inlineSize: c, rootFontPixels: p } = Xr(l, d), h = c !== null && c < _t(p);
|
|
1406
|
+
return Gr(h, { frameRef: l, sheetToggleRef: u, handleId: ft(e) }), /* @__PURE__ */ O("div", { ref: l, className: "aqmx-split-frame", "data-aqmx-explorer-mode": h ? "sheet" : "split", children: [
|
|
1407
|
+
/* @__PURE__ */ f("span", { ref: d, className: "aqmx-rem-probe", "aria-hidden": "true", "data-aqmx-rem-probe": "" }),
|
|
1408
|
+
h ? /* @__PURE__ */ f(Vr, { explorer: t, toggleRef: u, covered: r, onNoticeSlotChange: s, dismissals: o }) : null,
|
|
1409
|
+
/* @__PURE__ */ f(jr, { value: h ? a : null, children: /* @__PURE__ */ f(Yr, { view: e, sheet: h, explorer: t, content: n, contentCoversPage: r, onDraggingChange: i, explorerMinPixels: It(p) }) })
|
|
1410
|
+
] });
|
|
1411
|
+
}, Yr = ({
|
|
1412
|
+
view: e,
|
|
1413
|
+
sheet: t,
|
|
1414
|
+
explorer: n,
|
|
1415
|
+
content: r,
|
|
1416
|
+
contentCoversPage: o,
|
|
1417
|
+
onDraggingChange: i,
|
|
1418
|
+
explorerMinPixels: l
|
|
1419
|
+
}) => {
|
|
1420
|
+
const { viewSettings: a, labels: s } = D(), u = qt((E) => e === "tree" ? E.treeExplorer : E.multiExplorer) ?? (e === "tree" ? Ht : Zt), c = g(null), p = g(null), h = g(!1), v = g(!1), [b, S] = q(!1), C = g(i);
|
|
1421
|
+
I(() => {
|
|
1422
|
+
C.current = i;
|
|
1423
|
+
}, [i]);
|
|
1424
|
+
const T = w(() => {
|
|
1425
|
+
const E = c.current;
|
|
1426
|
+
if (E === null || E.length !== 2) return;
|
|
1427
|
+
const [R = 0, y = 0] = E, P = R + y;
|
|
1428
|
+
if (P <= 0 || R <= 0) return;
|
|
1429
|
+
const H = Math.min(Be, R / P * 100);
|
|
1430
|
+
a.update(e === "tree" ? { treeExplorer: H } : { multiExplorer: H });
|
|
1431
|
+
}, [a, e]), k = w(() => {
|
|
1432
|
+
p.current !== null && clearTimeout(p.current), p.current = setTimeout(() => {
|
|
1433
|
+
p.current = null, T();
|
|
1434
|
+
}, Dt);
|
|
1435
|
+
}, [T]);
|
|
1436
|
+
_(
|
|
1437
|
+
() => () => {
|
|
1438
|
+
p.current !== null && clearTimeout(p.current), v.current && C.current?.(!1);
|
|
1439
|
+
},
|
|
1440
|
+
[]
|
|
1441
|
+
);
|
|
1442
|
+
const $ = $r(), M = w(
|
|
1443
|
+
(E, R) => {
|
|
1444
|
+
c.current = E;
|
|
1445
|
+
const [y = 0, P = 0] = E;
|
|
1446
|
+
E.length === 2 && P > 0 && S(y <= 0), R.source === "keyboard" ? k() : R.source === "pointer" && (h.current = !0);
|
|
1447
|
+
},
|
|
1448
|
+
[k]
|
|
1449
|
+
), L = w(
|
|
1450
|
+
(E) => {
|
|
1451
|
+
if (v.current = E, i?.(E), E) {
|
|
1452
|
+
h.current = !1;
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
h.current && (h.current = !1, k());
|
|
1456
|
+
},
|
|
1457
|
+
[i, k]
|
|
1458
|
+
);
|
|
1459
|
+
return /* @__PURE__ */ O(Wt, { id: `aqmx-split-${e}`, direction: "horizontal", onLayout: M, className: "aqmx-split", "data-aqmx-split": e, children: [
|
|
1460
|
+
t ? null : /* @__PURE__ */ f(
|
|
1461
|
+
ze,
|
|
1462
|
+
{
|
|
1463
|
+
id: Ce,
|
|
1464
|
+
defaultSize: { value: u, unit: "percentage" },
|
|
1465
|
+
minSize: { value: l, unit: "pixels" },
|
|
1466
|
+
maxSize: { value: Be, unit: "percentage" },
|
|
1467
|
+
collapsible: { from: "end" },
|
|
1468
|
+
pixelAdjustPriority: 1,
|
|
1469
|
+
inert: o,
|
|
1470
|
+
className: "aqmx-split-explorer",
|
|
1471
|
+
children: /* @__PURE__ */ f(Ae, { value: !b, children: n })
|
|
1472
|
+
}
|
|
1473
|
+
),
|
|
1474
|
+
t ? null : /* @__PURE__ */ f(
|
|
1475
|
+
Xt,
|
|
1476
|
+
{
|
|
1477
|
+
id: ft(e),
|
|
1478
|
+
thickness: $ ? $t : Bt,
|
|
1479
|
+
indicator: { visible: !0, thickness: ve.gripThickness, length: ve.gripLength, barThickness: ve.barThickness, barLength: ve.barLength },
|
|
1480
|
+
title: s.resizeExplorer,
|
|
1481
|
+
"aria-label": s.resizeExplorer,
|
|
1482
|
+
onDragging: L,
|
|
1483
|
+
inert: o,
|
|
1484
|
+
className: "aqmx-split-handle"
|
|
1485
|
+
}
|
|
1486
|
+
),
|
|
1487
|
+
/* @__PURE__ */ f(ze, { id: mt, defaultSize: { value: 100 - u, unit: "percentage" }, contentOverflow: "hidden", className: "aqmx-split-content", ...o ? { style: { isolation: "auto" } } : {}, children: r })
|
|
1488
|
+
] });
|
|
1489
|
+
};
|
|
1490
|
+
export {
|
|
1491
|
+
ke as E,
|
|
1492
|
+
jr as S,
|
|
1493
|
+
ca as a,
|
|
1494
|
+
sa as b
|
|
1495
|
+
};
|