@aiquants/markdown-explorer 0.16.0 → 0.18.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 (36) hide show
  1. package/CHANGELOG.md +121 -15
  2. package/README.md +47 -21
  3. package/dist/{EditSurface-DGMLY7Gh.js → EditSurface-B2bzY1b_.js} +3 -3
  4. package/dist/{EditSurface-CwKsTS11.cjs → EditSurface-BRuIjA9L.cjs} +1 -1
  5. package/dist/{ExplorerSplit-BLOaU5fE.cjs → ExplorerSplit-BE1VJuok.cjs} +1 -1
  6. package/dist/{ExplorerSplit-tUCp0XdJ.js → ExplorerSplit-qAKZsLZa.js} +3 -3
  7. package/dist/{MultiLayout-BBP2ajz8.cjs → MultiLayout-Bc6RYc3U.cjs} +1 -1
  8. package/dist/{MultiLayout-DYy66vcO.js → MultiLayout-rsmtFma5.js} +251 -247
  9. package/dist/NativeScrollBar-Dq3YeUVY.js +65 -0
  10. package/dist/NativeScrollBar-DqTkrnPZ.cjs +1 -0
  11. package/dist/{TreeLayout-CXX-rFO6.js → TreeLayout-BPa7NdeT.js} +3 -3
  12. package/dist/{TreeLayout-C8s5lBH_.cjs → TreeLayout-DXoEAcpD.cjs} +1 -1
  13. package/dist/core/geometry.d.cts +1 -1
  14. package/dist/core/geometry.d.ts +1 -1
  15. package/dist/core/labels.d.cts +11 -0
  16. package/dist/core/labels.d.ts +11 -0
  17. package/dist/{index-DTKGgaok.js → index-25s_q0vD.js} +829 -795
  18. package/dist/index-W3iAjkLb.cjs +13 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/{location-G7psbmv_.js → location-B-m9scLf.js} +82 -82
  22. package/dist/{location-D85EXiPt.cjs → location-BVEN_Ihk.cjs} +1 -1
  23. package/dist/{merge-BkFru0eg.js → merge-B9jrWxMa.js} +1 -1
  24. package/dist/{merge-SRws1-Zj.cjs → merge-DuTAponF.cjs} +1 -1
  25. package/dist/server.cjs +1 -1
  26. package/dist/server.js +1 -1
  27. package/dist/styles/markdown-explorer.css +1 -1
  28. package/dist/{useSplitPersistence-DRjsPZdH.cjs → useSplitPersistence-Ba-v64n-.cjs} +1 -1
  29. package/dist/{useSplitPersistence-B1b5Lg5E.js → useSplitPersistence-Cc4tDxB4.js} +1 -1
  30. package/docs/behavior/dom-hooks.md +5 -2
  31. package/docs/behavior/layout.md +78 -33
  32. package/docs/behavior/localization.md +11 -5
  33. package/package.json +5 -5
  34. package/dist/NativeScrollBar-BkFg1EcW.cjs +0 -1
  35. package/dist/NativeScrollBar-Dazd542j.js +0 -59
  36. package/dist/index-DffJZ8-y.cjs +0 -13
@@ -15,7 +15,7 @@ const J = (e) => {
15
15
  if (n !== 0) return n;
16
16
  const o = I.compare(e.name, t.name);
17
17
  return o !== 0 ? o : I.compare(e.path, t.path);
18
- }, pt = (e) => {
18
+ }, ht = (e) => {
19
19
  let t = null;
20
20
  for (const r of e)
21
21
  V(r) && (t === null || Oe(r, t) < 0) && (t = r);
@@ -90,25 +90,25 @@ const J = (e) => {
90
90
  h("expandIcons", "settingExpandIcons"),
91
91
  h("directoryIcons", "settingDirectoryIcons"),
92
92
  h("fileIcons", "settingFileIcons")
93
- ]), ht = (e) => e ? x : x.filter((t) => !t.requiresItemSelection), oe = (e) => {
93
+ ]), Et = (e) => e ? x : x.filter((t) => !t.requiresItemSelection), oe = (e) => {
94
94
  const t = x.find((r) => r.key === e);
95
95
  if (t === void 0) throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);
96
96
  return t;
97
- }, Et = (e, t) => {
97
+ }, St = (e, t) => {
98
98
  const r = oe(t).values, n = r[(r.indexOf(e[t]) + 1) % r.length];
99
99
  return { ...e, [t]: n };
100
- }, St = (e, t, r) => oe(r).formatValue(e, t[r]), se = 2, B = Object.freeze({}), X = (e, t) => Object.freeze(Object.fromEntries(x.filter((r) => t(r, e[r.key])).map((r) => [r.key, e[r.key]]))), Z = "directoriesFirst", Te = (e) => {
100
+ }, xt = (e, t, r) => oe(r).formatValue(e, t[r]), se = 2, B = Object.freeze({}), X = (e, t) => Object.freeze(Object.fromEntries(x.filter((r) => t(r, e[r.key])).map((r) => [r.key, e[r.key]]))), Z = "directoriesFirst", Te = (e) => {
101
101
  if (!Object.hasOwn(e, Z)) return e;
102
102
  const { [Z]: t, ...r } = e;
103
103
  return Object.hasOwn(r, "folderPlacement") || typeof t != "boolean" ? r : { ...r, folderPlacement: t ? "first" : "mixed" };
104
- }, xt = (e) => {
104
+ }, bt = (e) => {
105
105
  if (e === null || typeof e != "object" || Array.isArray(e)) return B;
106
106
  const t = e;
107
107
  return t.version !== se || t.settings === null || typeof t.settings != "object" || Array.isArray(t.settings) ? B : X(Te(t.settings), (r, n) => r.values.includes(n));
108
- }, bt = (e, t) => {
108
+ }, yt = (e, t) => {
109
109
  const r = X(t, (n, o) => o !== void 0 && o !== e[n.key]);
110
110
  return Object.keys(r).length === 0 ? e : Object.freeze({ ...e, ...r });
111
- }, yt = (e, t, r, n) => X({ ...e, [t]: r }, (o, s) => s !== void 0 && !(o.key === t && s === n[t])), Ot = (e) => JSON.stringify({ version: se, settings: e }), Ne = (e, t, r) => e === void 0 || t === void 0 ? e === t ? 0 : e === void 0 ? 1 : -1 : r * (e - t), kt = (e) => {
111
+ }, Ot = (e, t, r, n) => X({ ...e, [t]: r }, (o, s) => s !== void 0 && !(o.key === t && s === n[t])), kt = (e) => JSON.stringify({ version: se, settings: e }), Ne = (e, t, r) => e === void 0 || t === void 0 ? e === t ? 0 : e === void 0 ? 1 : -1 : r * (e - t), Rt = (e) => {
112
112
  const { sortMode: t, folderPlacement: r, readmePlacement: n } = e;
113
113
  if (t === "native" && r === "mixed" && n === "mixed") return;
114
114
  const o = (s, i) => {
@@ -127,13 +127,13 @@ const J = (e) => {
127
127
  const l = Ne(s.modifiedAt, i.modifiedAt, t === "oldest" ? 1 : -1);
128
128
  return l !== 0 ? l : o(s, i);
129
129
  };
130
- }, g = (1 + Math.sqrt(5)) / 2, Rt = 100 / g ** 3, _t = 100 / g ** 4, ie = 100 / g ** 2, Ae = 13, Tt = 16, Nt = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), Ie = Object.freeze([89, 144, 233, 377]), At = 34, It = 44, Pt = 24, vt = 1 / g, $t = 1 / g ** 3, Mt = "40ch", Pe = (e) => {
130
+ }, g = (1 + Math.sqrt(5)) / 2, _t = 100 / g ** 3, Tt = 100 / g ** 4, ie = 100 / g ** 2, Ae = 13, Nt = 16, At = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), Ie = Object.freeze([89, 144, 233, 377]), Pe = 44, It = Pe, Pt = 24, vt = 1 / g, $t = 1 / g ** 3, Mt = "40ch", ve = (e) => {
131
131
  if (!Number.isFinite(e) || e <= 0)
132
132
  throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`);
133
- }, ve = (e) => (Pe(e), Ae * e), Ct = (e) => ve(e) * g ** 2, Lt = 233, Dt = 50, $e = 100 / g ** 3, zt = 100 - $e, jt = Ie[0], w = (e, t) => {
133
+ }, $e = (e) => (ve(e), Ae * e), Ct = (e) => $e(e) * g ** 2, Lt = 233, Dt = 50, Me = 100 / g ** 3, zt = 100 - Me, jt = Ie[0], w = (e, t) => {
134
134
  if (!Number.isFinite(t) || t < 0)
135
135
  throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`);
136
- }, Me = ({ trackInlineSize: e, gap: t, minColumnInlineSize: r, logicalColumns: n }) => {
136
+ }, Ce = ({ trackInlineSize: e, gap: t, minColumnInlineSize: r, logicalColumns: n }) => {
137
137
  if (w("trackInlineSize", e), w("gap", t), !Number.isFinite(r) || r <= 0)
138
138
  throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(r)}`);
139
139
  if (!Number.isInteger(n) || n < 1)
@@ -143,7 +143,7 @@ const J = (e) => {
143
143
  }, Ft = (e, t) => {
144
144
  const { trackInlineSize: r, gap: n, minColumnInlineSize: o, logicalColumns: s } = t;
145
145
  if (!([r, n, o].every(Number.isFinite) && r > 0 && n >= 0 && o > 0)) return e;
146
- const l = Me(t);
146
+ const l = Ce(t);
147
147
  if (e === null || l === e) return l;
148
148
  const a = Math.min(s, Math.max(1, e));
149
149
  if (l > a) {
@@ -169,10 +169,10 @@ const J = (e) => {
169
169
  left: Y(e.left, e.right, r.width, t.width),
170
170
  top: Y(e.top, e.bottom, r.height, t.height)
171
171
  };
172
- }, Ce = 31536e3, Le = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u, De = (e) => {
173
- if (typeof e != "string" || !Le.test(e))
172
+ }, Le = 31536e3, De = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u, ze = (e) => {
173
+ if (typeof e != "string" || !De.test(e))
174
174
  throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`);
175
- }, Q = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= ie, ze = (e, t) => {
175
+ }, Q = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= ie, je = (e, t) => {
176
176
  if (e === null || typeof e != "object" || Array.isArray(e)) return {};
177
177
  const r = e, { treeExplorer: n, multiExplorer: o, style: s, align: i } = r;
178
178
  return {
@@ -191,12 +191,12 @@ const J = (e) => {
191
191
  }, Gt = (e, t) => {
192
192
  if (e === void 0 || e === "") return {};
193
193
  try {
194
- return ze(JSON.parse(decodeURIComponent(e)), t);
194
+ return je(JSON.parse(decodeURIComponent(e)), t);
195
195
  } catch {
196
196
  return {};
197
197
  }
198
- }, P = 100, je = Math.floor(ie * P) / P, Fe = (e) => {
199
- const t = (r) => Math.min(je, Math.max(1, Math.round(r * P)) / P);
198
+ }, P = 100, Fe = Math.floor(ie * P) / P, Ve = (e) => {
199
+ const t = (r) => Math.min(Fe, Math.max(1, Math.round(r * P)) / P);
200
200
  return encodeURIComponent(
201
201
  JSON.stringify({
202
202
  ...e.treeExplorer === void 0 ? {} : { treeExplorer: t(e.treeExplorer) },
@@ -205,9 +205,9 @@ const J = (e) => {
205
205
  ...e.align === void 0 ? {} : { align: e.align }
206
206
  })
207
207
  );
208
- }, Wt = (e, t, r) => `${e}=${Fe(t)}; Path=/; Max-Age=${String(Ce)}; SameSite=Lax${r ? "; Secure" : ""}`, ee = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), Ve = Object.freeze({ default: 12, min: 1, max: 64 }), Ue = Object.freeze({ default: 4, min: 1, max: 6 }), Je = Object.freeze({ default: 500, min: 1, max: 1e4 }), Xe = Object.freeze({ default: 16, min: 1, max: 64 }), Ge = Object.freeze({ default: 16, min: 1, max: 64 }), We = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, He = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, Ke = /^[a-z0-9][a-z0-9-]*$/u, qe = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u, te = (e, t) => {
208
+ }, Wt = (e, t, r) => `${e}=${Ve(t)}; Path=/; Max-Age=${String(Le)}; SameSite=Lax${r ? "; Secure" : ""}`, ee = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), Ue = Object.freeze({ default: 12, min: 1, max: 64 }), Je = Object.freeze({ default: 4, min: 1, max: 6 }), Xe = Object.freeze({ default: 500, min: 1, max: 1e4 }), Ge = Object.freeze({ default: 16, min: 1, max: 64 }), We = Object.freeze({ default: 16, min: 1, max: 64 }), He = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, Ke = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, qe = /^[a-z0-9][a-z0-9-]*$/u, Be = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u, te = (e, t) => {
209
209
  if (typeof t != "string") throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);
210
- if (!We.test(t) || t.split("/").some((r) => r === "." || r === ".."))
210
+ if (!He.test(t) || t.split("/").some((r) => r === "." || r === ".."))
211
211
  throw new RangeError(`[markdown-explorer] ${e} must start with "/", have no trailing "/", and use only letters, digits and "._~-" in each segment; got ${JSON.stringify(t)}`);
212
212
  }, d = (e) => typeof e == "string" ? JSON.stringify(e) : typeof e == "bigint" ? `${String(e)}n` : Object.is(e, -0) ? "-0" : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : e !== null && typeof e == "object" ? J(e) ? "a plain object" : `a non-plain object (${Object.prototype.toString.call(e)})` : String(e), S = (e, t, r) => {
213
213
  if (t === void 0) return [];
@@ -216,11 +216,11 @@ const J = (e) => {
216
216
  for (const [o] of n)
217
217
  if (!r.includes(o)) throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${r.join(", ")}`);
218
218
  return n.filter(([, o]) => o !== void 0);
219
- }, Be = (e) => {
219
+ }, Ze = (e) => {
220
220
  const t = { ...ee };
221
221
  for (const [r, n] of S("views", e, Object.keys(ee))) t[r] = n;
222
222
  for (const [r, n] of Object.entries(t))
223
- if (typeof n != "string" || !He.test(n))
223
+ if (typeof n != "string" || !Ke.test(n))
224
224
  throw new RangeError(`[markdown-explorer] views.${r} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(n)}`);
225
225
  return Object.freeze(t);
226
226
  }, R = (e, t, r) => {
@@ -228,7 +228,7 @@ const J = (e) => {
228
228
  if (typeof t != "number" || !Number.isInteger(t) || t < r.min || t > r.max)
229
229
  throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(r.min)}..${String(r.max)}; got ${d(t)}`);
230
230
  return t;
231
- }, Ze = (e, t) => {
231
+ }, Ye = (e, t) => {
232
232
  const r = new Map(S("embeds", e, ["providers", "linkCards", "linkCardSize"]));
233
233
  if (r.size === 0) return we;
234
234
  const n = r.has("providers") ? r.get("providers") : [];
@@ -243,7 +243,7 @@ const J = (e) => {
243
243
  if (!he(i)) throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${Ee.join(", ")}; got ${d(i)}`);
244
244
  if (!o) throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${d(i)} with linkCards ${d(o)}`);
245
245
  return Object.freeze({ ...s, linkCardSize: i });
246
- }, Ye = (e) => {
246
+ }, Qe = (e) => {
247
247
  const t = new Map(
248
248
  S(
249
249
  "defaultTreeSettings",
@@ -260,10 +260,10 @@ const J = (e) => {
260
260
  r[n.key] = o;
261
261
  }
262
262
  return Object.freeze(r);
263
- }, Qe = (e) => {
263
+ }, et = (e) => {
264
264
  if (e === null || typeof e != "object") throw new TypeError("[markdown-explorer] the explorer configuration must be an object");
265
265
  te("basePath", e.basePath), te("dataPath", e.dataPath);
266
- const t = Be(e.views);
266
+ const t = Ze(e.views);
267
267
  if ((/* @__PURE__ */ new Set([t.tree, t.multi, t.single])).size !== 3)
268
268
  throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);
269
269
  if (e.dataPath === e.basePath) throw new RangeError("[markdown-explorer] dataPath must differ from basePath");
@@ -272,9 +272,9 @@ const J = (e) => {
272
272
  if (a === t.tree || a === t.multi || a === t.single)
273
273
  throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`);
274
274
  }
275
- De(e.settingsCookie);
275
+ ze(e.settingsCookie);
276
276
  const r = e.iframeHosts ?? [];
277
- if (!Array.isArray(r) || r.some((a) => typeof a != "string" || !qe.test(a)))
277
+ if (!Array.isArray(r) || r.some((a) => typeof a != "string" || !Be.test(a)))
278
278
  throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(r)}`);
279
279
  const n = Object.fromEntries(S("multiView", e.multiView, ["maxPanels", "columns"])), o = Object.fromEntries(S("expandAll", e.expandAll, ["maxFolders", "maxDepth"])), s = Object.fromEntries(S("revealDocument", e.revealDocument, ["maxDepth"])), i = e.documentStyles ?? Se;
280
280
  if (!Array.isArray(i) || i.length === 0) throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");
@@ -291,33 +291,33 @@ const J = (e) => {
291
291
  settingsCookie: e.settingsCookie,
292
292
  views: t,
293
293
  multiView: Object.freeze({
294
- maxPanels: R("multiView.maxPanels", n.maxPanels, Ve),
295
- columns: R("multiView.columns", n.columns, Ue)
294
+ maxPanels: R("multiView.maxPanels", n.maxPanels, Ue),
295
+ columns: R("multiView.columns", n.columns, Je)
296
296
  }),
297
297
  expandAll: Object.freeze({
298
- maxFolders: R("expandAll.maxFolders", o.maxFolders, Je),
299
- maxDepth: R("expandAll.maxDepth", o.maxDepth, Xe)
298
+ maxFolders: R("expandAll.maxFolders", o.maxFolders, Xe),
299
+ maxDepth: R("expandAll.maxDepth", o.maxDepth, Ge)
300
300
  }),
301
- revealDocument: Object.freeze({ maxDepth: R("revealDocument.maxDepth", s.maxDepth, Ge) }),
301
+ revealDocument: Object.freeze({ maxDepth: R("revealDocument.maxDepth", s.maxDepth, We) }),
302
302
  documentStyles: Object.freeze(i.map((a) => Object.freeze({ name: a.name, className: a.className }))),
303
303
  iframeHosts: Object.freeze([...new Set(r)]),
304
- embeds: Ze(e.embeds, e.dataPath),
305
- defaultTreeSettings: Ye(e.defaultTreeSettings)
304
+ embeds: Ye(e.embeds, e.dataPath),
305
+ defaultTreeSettings: Qe(e.defaultTreeSettings)
306
306
  });
307
307
  }, Ht = (e) => {
308
308
  const t = e.embeds;
309
309
  if (!J(t)) throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${d(t)}`);
310
310
  if (Object.hasOwn(t, "linkCards"))
311
311
  throw new RangeError(`[markdown-explorer] config.embeds.linkCards is an option of defineExplorerConfig, not a key of the embeds it resolves; pass the option to defineExplorerConfig (got linkCards ${d(t.linkCards)})`);
312
- const { linkCardEndpoint: r, ...n } = t, o = Qe({ ...e, embeds: { ...n, linkCards: r !== null } });
312
+ const { linkCardEndpoint: r, ...n } = t, o = et({ ...e, embeds: { ...n, linkCards: r !== null } });
313
313
  if (o.embeds.linkCardEndpoint !== r)
314
314
  throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${d(o.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${d(r)}`);
315
315
  return o;
316
- }, et = (e) => typeof e == "string" && Ke.test(e), Kt = (e, t) => {
316
+ }, tt = (e) => typeof e == "string" && qe.test(e), Kt = (e, t) => {
317
317
  if (e === null || typeof e != "object") throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${d(e)}`);
318
318
  if (!Array.isArray(t) || t.length === 0) throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${d(t)}`);
319
319
  for (const r of t)
320
- if (!et(r)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);
320
+ if (!tt(r)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);
321
321
  if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);
322
322
  return Object.freeze({ ...e, sourceIds: Object.freeze([...t]) });
323
323
  }, qt = (e) => e.documentStyles.map((t) => t.name), c = Object.freeze({
@@ -336,22 +336,22 @@ const J = (e) => {
336
336
  }), ae = "true", v = "/", re = ".data", le = 256, ce = /^\d+(?:\.\d+)?$/u, U = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, de = Object.freeze(["showToc", "showStyle", "showAlign"]), ne = (e) => {
337
337
  const t = encodeURIComponent(e.replaceAll("%", "%25"));
338
338
  return t.endsWith(re) ? `${t.slice(0, -re.length)}%2Edata` : t;
339
- }, tt = (e) => e.replaceAll("%25", "%"), me = (e) => {
339
+ }, rt = (e) => e.replaceAll("%25", "%"), me = (e) => {
340
340
  const { sourceIds: t } = e;
341
341
  if (t === void 0) throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");
342
342
  return t;
343
- }, rt = (e, t, r) => {
343
+ }, nt = (e, t, r) => {
344
344
  const n = r.getAll(c.source);
345
345
  if (n.length === 0) return t;
346
346
  const [o] = n;
347
347
  return n.length > 1 || o === void 0 || o === t || !e.includes(o) ? null : o;
348
- }, nt = (e, t) => {
348
+ }, ot = (e, t) => {
349
349
  const r = t.get(c.style), n = t.get(c.align);
350
350
  return {
351
351
  ...r !== null && e.documentStyles.some((o) => o.name === r) ? { style: r } : {},
352
352
  ...n !== null && N.includes(n) ? { align: n } : {}
353
353
  };
354
- }, ue = (e) => Number.isFinite(e) && e >= 0 && e <= le && ce.test(String(e)), ot = (e) => {
354
+ }, ue = (e) => Number.isFinite(e) && e >= 0 && e <= le && ce.test(String(e)), st = (e) => {
355
355
  const t = e.get(c.padding), r = t !== null && ce.test(t) ? Number(t) : Number.NaN, n = e.get(c.width), o = e.get(c.maxWidth);
356
356
  return {
357
357
  ...e.get(c.showToc) === "false" ? { showToc: !1 } : {},
@@ -361,7 +361,7 @@ const J = (e) => {
361
361
  ...n !== null && U.test(n) ? { width: n } : {},
362
362
  ...o !== null && U.test(o) ? { maxWidth: o } : {}
363
363
  };
364
- }, st = (e, t) => [...new Set(t.filter(A))].slice(0, e.multiView.maxPanels), it = (e, t, r, n) => {
364
+ }, it = (e, t) => [...new Set(t.filter(A))].slice(0, e.multiView.maxPanels), at = (e, t, r, n) => {
365
365
  for (const s of t) G(s);
366
366
  if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] multi-view documents must each appear once; got ${String(t.length)} with repeats`);
367
367
  if (t.length > e.multiView.maxPanels) throw new RangeError(`[markdown-explorer] the multi view opens at most ${String(e.multiView.maxPanels)} documents; got ${String(t.length)}`);
@@ -372,15 +372,15 @@ const J = (e) => {
372
372
  }, G = (e) => {
373
373
  if (!A(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0, 80))}`);
374
374
  return e;
375
- }, at = (e) => {
375
+ }, lt = (e) => {
376
376
  if (G(e).endsWith(v)) throw new RangeError(`[markdown-explorer] a document path ending in a slash has no URL (its segment would name a folder): ${JSON.stringify(e.slice(0, 80))}`);
377
377
  return e;
378
- }, lt = (e, t) => {
378
+ }, ct = (e, t) => {
379
379
  if (t.style !== void 0 && !e.documentStyles.some((r) => r.name === t.style))
380
380
  throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map((r) => JSON.stringify(r.name)).join(", ")}); got ${JSON.stringify(t.style)}`);
381
381
  if (t.align !== void 0 && !N.includes(t.align))
382
382
  throw new RangeError(`[markdown-explorer] overrides.align must be one of ${N.join(", ")}; got ${JSON.stringify(t.align)}`);
383
- }, ct = (e) => {
383
+ }, dt = (e) => {
384
384
  for (const t of de)
385
385
  if (e[t] !== void 0 && typeof e[t] != "boolean") throw new RangeError(`[markdown-explorer] embed.${t} must be a boolean; got ${JSON.stringify(e[t])}`);
386
386
  if (e.padding !== void 0 && !ue(e.padding)) throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(le)} px in plain decimal digits; got ${String(e.padding)}`);
@@ -388,112 +388,112 @@ const J = (e) => {
388
388
  const r = e[t];
389
389
  if (r !== void 0 && !U.test(r)) throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(r)}`);
390
390
  }
391
- }, dt = (e, t) => {
391
+ }, mt = (e, t) => {
392
392
  const r = new URLSearchParams();
393
393
  let n = `${e.basePath}/${e.views[t.view]}`;
394
394
  if (t.view === "multi") {
395
395
  const s = t.docs ?? [], i = t.maximized ?? null, l = t.markup ?? [];
396
- it(e, s, i, l);
396
+ at(e, s, i, l);
397
397
  for (const a of s) r.append(c.doc, a);
398
398
  i !== null && r.set(c.maximized, i);
399
399
  for (const a of s) l.includes(a) && r.append(c.markup, a);
400
400
  } else {
401
401
  const s = t.doc ?? null, i = t.view === "tree" ? t.folder ?? null : null;
402
402
  if (s !== null && i !== null) throw new RangeError("[markdown-explorer] a tree view shows a document or a folder, not both");
403
- s !== null && (n += `/${ne(at(s))}`), i !== null && (n += `/${ne(`${G(i)}${v}`)}`);
403
+ s !== null && (n += `/${ne(lt(s))}`), i !== null && (n += `/${ne(`${G(i)}${v}`)}`);
404
404
  }
405
405
  if (t.source !== void 0) {
406
406
  const s = me(e);
407
407
  if (!s.includes(t.source)) throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${s.join(", ")}`);
408
408
  t.source !== s[0] && r.set(c.source, t.source);
409
409
  }
410
- if (t.view !== "multi" && t.overrides !== void 0 && (lt(e, t.overrides), t.overrides.style !== void 0 && r.set(c.style, t.overrides.style), t.overrides.align !== void 0 && r.set(c.align, t.overrides.align)), t.view !== "multi" && t.markup === !0) {
410
+ if (t.view !== "multi" && t.overrides !== void 0 && (ct(e, t.overrides), t.overrides.style !== void 0 && r.set(c.style, t.overrides.style), t.overrides.align !== void 0 && r.set(c.align, t.overrides.align)), t.view !== "multi" && t.markup === !0) {
411
411
  if (!(t.doc !== void 0 && t.doc !== null || t.view === "tree" && t.folder !== void 0 && t.folder !== null)) throw new RangeError("[markdown-explorer] a tree view without a document or a folder has nothing to show as written");
412
412
  r.set(c.markup, ae);
413
413
  }
414
414
  if (t.view === "single" && t.embed !== void 0) {
415
415
  const { embed: s } = t;
416
- ct(s);
416
+ dt(s);
417
417
  for (const i of de) s[i] === !1 && r.set(c[i], "false");
418
418
  s.padding !== void 0 && r.set(c.padding, String(s.padding)), s.width !== void 0 && r.set(c.width, s.width), s.maxWidth !== void 0 && r.set(c.maxWidth, s.maxWidth);
419
419
  }
420
420
  const o = r.toString();
421
421
  return o === "" ? n : `${n}?${o}`;
422
- }, mt = (e, t) => Object.keys(e.views).find((r) => e.views[r] === t), Bt = (e, t, r) => {
422
+ }, ut = (e, t) => Object.keys(e.views).find((r) => e.views[r] === t), Bt = (e, t, r) => {
423
423
  const n = me(e), [o] = n;
424
424
  if (o === void 0) throw new RangeError("[markdown-explorer] the configuration has no source");
425
- const s = rt(n, o, r), i = s === null ? o : s, l = (m) => ({ kind: "redirect", href: dt(e, m), location: m }), a = () => l({ view: "tree", source: i, doc: null, folder: null, overrides: {}, markup: !1 });
425
+ const s = nt(n, o, r), i = s === null ? o : s, l = (m) => ({ kind: "redirect", href: mt(e, m), location: m }), a = () => l({ view: "tree", source: i, doc: null, folder: null, overrides: {}, markup: !1 });
426
426
  if (t === void 0 || t === "") return a();
427
- const b = t.indexOf("/"), $ = b < 0 ? t : t.slice(0, b), M = b < 0 ? null : t.slice(b + 1), p = mt(e, $);
427
+ const b = t.indexOf("/"), $ = b < 0 ? t : t.slice(0, b), M = b < 0 ? null : t.slice(b + 1), p = ut(e, $);
428
428
  if (p === void 0) return a();
429
429
  if (p === "multi") {
430
- const m = r.getAll(c.doc), E = st(e, m), C = r.getAll(c.maximized), [L] = C, D = C.length === 1 && L !== void 0 && E.includes(L) ? L : null, z = r.getAll(c.markup), T = E.filter((k) => z.includes(k)), fe = T.length === z.length && T.every((k, j) => k === z[j]);
430
+ const m = r.getAll(c.doc), E = it(e, m), C = r.getAll(c.maximized), [L] = C, D = C.length === 1 && L !== void 0 && E.includes(L) ? L : null, z = r.getAll(c.markup), T = E.filter((k) => z.includes(k)), fe = T.length === z.length && T.every((k, j) => k === z[j]);
431
431
  return M === null && s !== null && E.length === m.length && E.every((k, j) => k === m[j]) && (C.length === 0 || D !== null) && fe ? { kind: "location", location: { view: "multi", source: i, docs: E, maximized: D, markup: T } } : l({ view: "multi", source: i, docs: E, maximized: D, markup: T });
432
432
  }
433
- const _ = M === null ? null : tt(M), u = _?.endsWith(v) === !0 ? _.slice(0, -v.length) : null, f = _ !== null && u === null ? _ : null;
433
+ const _ = M === null ? null : rt(M), u = _?.endsWith(v) === !0 ? _.slice(0, -v.length) : null, f = _ !== null && u === null ? _ : null;
434
434
  if (f !== null && !A(f) || u !== null && !A(u)) return a();
435
- const y = nt(e, r), O = (f !== null || u !== null) && r.get(c.markup) === ae;
435
+ const y = ot(e, r), O = (f !== null || u !== null) && r.get(c.markup) === ae;
436
436
  if (p === "single") {
437
437
  if (u !== null) return l({ view: "tree", source: i, doc: null, folder: u, overrides: y, markup: O });
438
438
  if (f === null) return a();
439
- const m = ot(r);
439
+ const m = st(r);
440
440
  return s === null ? l({ view: p, source: i, doc: f, overrides: y, embed: m, markup: O }) : { kind: "location", location: { view: p, source: i, doc: f, overrides: y, embed: m, markup: O } };
441
441
  }
442
442
  return s === null ? l({ view: p, source: i, doc: f, folder: u, overrides: y, markup: O }) : { kind: "location", location: { view: p, source: i, doc: f, folder: u, overrides: y, markup: O } };
443
443
  };
444
444
  export {
445
- Qe as $,
446
- Tt as A,
445
+ et as $,
446
+ Nt as A,
447
447
  Jt as B,
448
448
  It as C,
449
- pt as D,
449
+ ht as D,
450
450
  zt as E,
451
451
  Pt as F,
452
452
  jt as G,
453
453
  g as H,
454
- yt as I,
455
- Et as J,
456
- bt as K,
457
- Ot as L,
454
+ Ot as I,
455
+ St as J,
456
+ yt as K,
457
+ kt as L,
458
458
  B as M,
459
459
  I as N,
460
- xt as O,
460
+ bt as O,
461
461
  vt as P,
462
462
  Wt as Q,
463
463
  Mt as R,
464
464
  Lt as S,
465
465
  q as T,
466
466
  ee as U,
467
- Xe as V,
468
- Je as W,
467
+ Ge as V,
468
+ Xe as W,
469
469
  Ae as X,
470
- Ue as Y,
471
- Ve as Z,
472
- Ge as _,
473
- $e as a,
474
- Nt as b,
475
- st as c,
470
+ Je as Y,
471
+ Ue as Z,
472
+ We as _,
473
+ Me as a,
474
+ At as b,
475
+ it as c,
476
476
  Ut as d,
477
- dt as e,
477
+ mt as e,
478
478
  qt as f,
479
479
  Bt as g,
480
480
  Xt as h,
481
- et as i,
481
+ tt as i,
482
482
  J as j,
483
483
  Vt as k,
484
484
  Ft as l,
485
485
  $t as m,
486
- At as n,
487
- kt as o,
486
+ Pe as n,
487
+ Rt as o,
488
488
  Gt as p,
489
- St as q,
489
+ xt as q,
490
490
  Ht as r,
491
491
  Ct as s,
492
- ve as t,
492
+ $e as t,
493
493
  ie as u,
494
- ht as v,
494
+ Et as v,
495
495
  Kt as w,
496
- Rt as x,
497
- _t as y,
496
+ _t as x,
497
+ Tt as y,
498
498
  Dt as z
499
499
  };
@@ -1 +1 @@
1
- "use strict";const y=require("@aiquants/markdown/embeds"),N=require("@aiquants/markdown/viewer-settings"),I=require("./dataRoute-BONacTPi.cjs"),M=e=>{if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},A=new Intl.Collator("en",{numeric:!0,sensitivity:"variant"}),Ne=/^readme(?:\.|$)/iu,Z=/^readme(?:\.[^.]*)?$/iu,Y=Object.freeze(["md","markdown","mdx","txt",""]),Ie=e=>Ne.test(e),X=e=>e.type==="file"&&Ie(e.name),Q=e=>{const t=e.lastIndexOf("."),r=Y.indexOf(t<0?"":e.slice(t+1).toLowerCase());return r<0?Y.length:r},Ae=(e,t)=>{const r=+!Z.test(e.name)-+!Z.test(t.name);if(r!==0)return r;const n=Q(e.name)-Q(t.name);if(n!==0)return n;const o=A.compare(e.name,t.name);return o!==0?o:A.compare(e.path,t.path)},ke=e=>{let t=null;for(const r of e)X(r)&&(t===null||Ae(r,t)<0)&&(t=r);return t===null?null:t.path},G=Object.freeze({sortMode:"native",folderPlacement:"mixed",readmePlacement:"mixed",selectionMode:"single",doubleClickAction:"recursive",expandIconSize:8,alwaysExpanded:!1,revealDocument:!1,removeRootIndent:!1,lines:!0,expandIcons:!0,directoryIcons:!0,fileIcons:!0}),Pe=[!0,!1],Le=(e,t)=>t?e.settingOn:e.settingOff,p=(e,t)=>({key:e,labelKey:t,values:Pe,formatValue:Le,requiresItemSelection:!1}),Ce=Object.freeze({native:e=>e.sortNative,asc:e=>e.sortAscending,desc:e=>e.sortDescending,oldest:e=>e.sortOldest,newest:e=>e.sortNewest}),_=Object.freeze([{key:"sortMode",labelKey:"settingSortMode",values:["native","asc","desc","oldest","newest"],formatValue:(e,t)=>Ce[t](e),requiresItemSelection:!1},{key:"folderPlacement",labelKey:"settingFolderPlacement",values:["mixed","first","last"],formatValue:(e,t)=>t==="mixed"?e.folderPlacementMixed:t==="first"?e.folderPlacementFirst:e.folderPlacementLast,requiresItemSelection:!1},{key:"readmePlacement",labelKey:"settingReadmePlacement",values:["mixed","first","last"],formatValue:(e,t)=>t==="mixed"?e.readmePlacementMixed:t==="first"?e.readmePlacementFirst:e.readmePlacementLast,requiresItemSelection:!1},{key:"selectionMode",labelKey:"settingSelectionMode",values:["single","multiple","none"],formatValue:(e,t)=>t==="single"?e.selectionSingle:t==="multiple"?e.selectionMultiple:e.selectionNone,requiresItemSelection:!0},{key:"doubleClickAction",labelKey:"settingDoubleClick",values:["recursive","toggle"],formatValue:(e,t)=>t==="recursive"?e.doubleClickRecursive:e.doubleClickToggle,requiresItemSelection:!1},{key:"expandIconSize",labelKey:"settingExpandIconSize",values:[8,13,5],formatValue:(e,t)=>e.expandIconSizeValue(t),requiresItemSelection:!1},p("alwaysExpanded","settingAlwaysExpanded"),p("revealDocument","settingRevealDocument"),p("removeRootIndent","settingRemoveRootIndent"),p("lines","settingTreeLines"),p("expandIcons","settingExpandIcons"),p("directoryIcons","settingDirectoryIcons"),p("fileIcons","settingFileIcons")]),Me=e=>e?_:_.filter(t=>!t.requiresItemSelection),se=e=>{const t=_.find(r=>r.key===e);if(t===void 0)throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);return t},ve=(e,t)=>{const r=se(t).values,n=r[(r.indexOf(e[t])+1)%r.length];return{...e,[t]:n}},De=(e,t,r)=>se(r).formatValue(e,t[r]),ae=2,W=Object.freeze({}),K=(e,t)=>Object.freeze(Object.fromEntries(_.filter(r=>t(r,e[r.key])).map(r=>[r.key,e[r.key]]))),ee="directoriesFirst",$e=e=>{if(!Object.hasOwn(e,ee))return e;const{[ee]:t,...r}=e;return Object.hasOwn(r,"folderPlacement")||typeof t!="boolean"?r:{...r,folderPlacement:t?"first":"mixed"}},ze=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return W;const t=e;return t.version!==ae||t.settings===null||typeof t.settings!="object"||Array.isArray(t.settings)?W:K($e(t.settings),(r,n)=>r.values.includes(n))},je=(e,t)=>{const r=K(t,(n,o)=>o!==void 0&&o!==e[n.key]);return Object.keys(r).length===0?e:Object.freeze({...e,...r})},Fe=(e,t,r,n)=>K({...e,[t]:r},(o,i)=>i!==void 0&&!(o.key===t&&i===n[t])),Ve=e=>JSON.stringify({version:ae,settings:e}),Ue=(e,t,r)=>e===void 0||t===void 0?e===t?0:e===void 0?1:-1:r*(e-t),Xe=e=>{const{sortMode:t,folderPlacement:r,readmePlacement:n}=e;if(t==="native"&&r==="mixed"&&n==="mixed")return;const o=(i,s)=>{const l=A.compare(i.name,s.name);return l!==0?l:A.compare(i.path,s.path)};return(i,s)=>{if(r!=="mixed"&&i.type!==s.type)return i.type==="directory"==(r==="first")?-1:1;if(n!=="mixed"){const a=X(i);if(a!==X(s))return a===(n==="first")?-1:1}if(t==="native")return 0;if(t==="asc")return o(i,s);if(t==="desc")return-o(i,s);const l=Ue(i.modifiedAt,s.modifiedAt,t==="oldest"?1:-1);return l!==0?l:o(i,s)}},u=(1+Math.sqrt(5))/2,Ge=100/u**3,We=100/u**4,q=100/u**2,le=13,Je=16,He=Object.freeze({gripThickness:5,gripLength:34,barThickness:2,barLength:21}),Ke=Object.freeze([89,144,233,377]),qe=34,Be=44,Ze=24,Ye=1/u,Qe=1/u**3,et="40ch",tt=e=>{if(!Number.isFinite(e)||e<=0)throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`)},ce=e=>(tt(e),le*e),rt=e=>ce(e)*u**2,nt=233,ot=50,de=100/u**3,it=100-de,st=Ke[0],g=(e,t)=>{if(!Number.isFinite(t)||t<0)throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`)},at=({trackInlineSize:e,gap:t,minColumnInlineSize:r,logicalColumns:n})=>{if(g("trackInlineSize",e),g("gap",t),!Number.isFinite(r)||r<=0)throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(r)}`);if(!Number.isInteger(n)||n<1)throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(n)}`);const o=Math.floor((e+t)/(r+t));return Math.min(n,Math.max(1,o))},lt=(e,t)=>{const{trackInlineSize:r,gap:n,minColumnInlineSize:o,logicalColumns:i}=t;if(!([r,n,o].every(Number.isFinite)&&r>0&&n>=0&&o>0))return e;const l=at(t);if(e===null||l===e)return l;const a=Math.min(i,Math.max(1,e));if(l>a){const v=(a+1)*o+a*n+n/u;return r>=v?l:a}return r>=a*o+(a-1)*n?a:l},ct=(e,t)=>{if(!(Number.isInteger(e)&&Number.isInteger(t))||t<1||t>e)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);return Array.from({length:t},(r,n)=>[Math.floor(n*e/t),Math.floor((n+1)*e/t)])},dt=(e,t,r)=>{if(g("surfaceInlineSize",e),g("handlePixels",r),!Number.isFinite(t)||t<=0)throw new RangeError(`[markdown-explorer] measure must be a finite number > 0; got ${String(t)}`);return e>=2*t+r?"beside":"stacked"},U=(e,t,r)=>Math.max(t,Math.min(e,r)),te=(e,t,r,n)=>{const o=(U(e,0,r)+U(t,0,r))/2;return U(o-n/2,0,r-n)},mt=(e,t,r)=>{for(const[n,o]of Object.entries(e))if(!Number.isFinite(o))throw new RangeError(`[markdown-explorer] anchor.${n} must be a finite number; got ${String(o)}`);return g("marginBox.width",t.width),g("marginBox.height",t.height),g("viewport.width",r.width),g("viewport.height",r.height),{left:te(e.left,e.right,r.width,t.width),top:te(e.top,e.bottom,r.height,t.height)}},ut=31536e3,ft=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u,Et=e=>{if(typeof e!="string"||!ft.test(e))throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`)},re=e=>typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=q,gt=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))return{};const r=e,{treeExplorer:n,multiExplorer:o,style:i,align:s}=r;return{...re(n)?{treeExplorer:n}:{},...re(o)?{multiExplorer:o}:{},...typeof i=="string"&&t.includes(i)?{style:i}:{},...typeof s=="string"&&N.CONTENT_ALIGNS.includes(s)?{align:s}:{}}},wt=(e,t)=>{if(e!==null)for(const r of e.split(";")){const n=r.indexOf("=");if(!(n<0)&&r.slice(0,n).trim()===t)return r.slice(n+1).trim()}},pt=(e,t)=>{if(e===void 0||e==="")return{};try{return gt(JSON.parse(decodeURIComponent(e)),t)}catch{return{}}},L=100,St=Math.floor(q*L)/L,ht=e=>{const t=r=>Math.min(St,Math.max(1,Math.round(r*L))/L);return encodeURIComponent(JSON.stringify({...e.treeExplorer===void 0?{}:{treeExplorer:t(e.treeExplorer)},...e.multiExplorer===void 0?{}:{multiExplorer:t(e.multiExplorer)},...e.style===void 0?{}:{style:e.style},...e.align===void 0?{}:{align:e.align}}))},_t=(e,t,r)=>`${e}=${ht(t)}; Path=/; Max-Age=${String(ut)}; SameSite=Lax${r?"; Secure":""}`,J=Object.freeze({tree:"tree",multi:"multi",single:"single"}),me=Object.freeze({default:12,min:1,max:64}),ue=Object.freeze({default:4,min:1,max:6}),fe=Object.freeze({default:500,min:1,max:1e4}),Ee=Object.freeze({default:16,min:1,max:64}),ge=Object.freeze({default:16,min:1,max:64}),xt=/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u,Ot=/^[A-Za-z0-9][A-Za-z0-9_-]*$/u,Tt=/^[a-z0-9][a-z0-9-]*$/u,bt=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u,ne=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);if(!xt.test(t)||t.split("/").some(r=>r==="."||r===".."))throw new RangeError(`[markdown-explorer] ${e} must start with "/", have no trailing "/", and use only letters, digits and "._~-" in each segment; got ${JSON.stringify(t)}`)},d=e=>typeof e=="string"?JSON.stringify(e):typeof e=="bigint"?`${String(e)}n`:Object.is(e,-0)?"-0":typeof e=="function"?"a function":Array.isArray(e)?"an array":e!==null&&typeof e=="object"?M(e)?"a plain object":`a non-plain object (${Object.prototype.toString.call(e)})`:String(e),h=(e,t,r)=>{if(t===void 0)return[];if(!M(t))throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${d(t)}`);const n=Object.entries(t);for(const[o]of n)if(!r.includes(o))throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${r.join(", ")}`);return n.filter(([,o])=>o!==void 0)},yt=e=>{const t={...J};for(const[r,n]of h("views",e,Object.keys(J)))t[r]=n;for(const[r,n]of Object.entries(t))if(typeof n!="string"||!Ot.test(n))throw new RangeError(`[markdown-explorer] views.${r} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(n)}`);return Object.freeze(t)},R=(e,t,r)=>{if(t===void 0)return r.default;if(typeof t!="number"||!Number.isInteger(t)||t<r.min||t>r.max)throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(r.min)}..${String(r.max)}; got ${d(t)}`);return t},Rt=(e,t)=>{const r=new Map(h("embeds",e,["providers","linkCards","linkCardSize"]));if(r.size===0)return y.NO_EMBEDS;const n=r.has("providers")?r.get("providers"):[];if(!Array.isArray(n))throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${d(n)}`);for(const l of n)if(!y.isEmbedProviderId(l))throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${y.EMBED_PROVIDER_IDS.join(", ")}; got ${d(l)}`);const o=r.has("linkCards")?r.get("linkCards"):!1;if(typeof o!="boolean")throw new RangeError(`[markdown-explorer] embeds.linkCards must be a boolean; got ${d(o)}`);const i={providers:Object.freeze([...new Set(n)]),linkCardEndpoint:o?I.explorerLinkCardEndpoint(t):null};if(!r.has("linkCardSize"))return Object.freeze(i);const s=r.get("linkCardSize");if(!y.isLinkCardSize(s))throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${y.LINK_CARD_SIZES.join(", ")}; got ${d(s)}`);if(!o)throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${d(s)} with linkCards ${d(o)}`);return Object.freeze({...i,linkCardSize:s})},Nt=e=>{const t=new Map(h("defaultTreeSettings",e,_.map(n=>n.key)));if(t.size===0)return G;const r={...G};for(const n of _){if(!t.has(n.key))continue;const o=t.get(n.key),i=n.values;if(!i.includes(o))throw new RangeError(`[markdown-explorer] defaultTreeSettings.${n.key} must be one of ${i.map(d).join(", ")}; got ${d(o)}`);r[n.key]=o}return Object.freeze(r)},we=e=>{if(e===null||typeof e!="object")throw new TypeError("[markdown-explorer] the explorer configuration must be an object");ne("basePath",e.basePath),ne("dataPath",e.dataPath);const t=yt(e.views);if(new Set([t.tree,t.multi,t.single]).size!==3)throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);if(e.dataPath===e.basePath)throw new RangeError("[markdown-explorer] dataPath must differ from basePath");if(e.dataPath.startsWith(`${e.basePath}/`)){const a=e.dataPath.slice(e.basePath.length+1).split("/")[0];if(a===t.tree||a===t.multi||a===t.single)throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`)}Et(e.settingsCookie);const r=e.iframeHosts??[];if(!Array.isArray(r)||r.some(a=>typeof a!="string"||!bt.test(a)))throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(r)}`);const n=Object.fromEntries(h("multiView",e.multiView,["maxPanels","columns"])),o=Object.fromEntries(h("expandAll",e.expandAll,["maxFolders","maxDepth"])),i=Object.fromEntries(h("revealDocument",e.revealDocument,["maxDepth"])),s=e.documentStyles??N.DEFAULT_MARKDOWN_STYLES;if(!Array.isArray(s)||s.length===0)throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");const l=new Set;for(const a of s){if(a===null||typeof a!="object"||typeof a.name!="string"||a.name.trim()===""||typeof a.className!="string")throw new RangeError("[markdown-explorer] each document style needs a non-blank name and a className string");if(l.has(a.name))throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(a.name)} repeats`);l.add(a.name)}return Object.freeze({basePath:e.basePath,dataPath:e.dataPath,settingsCookie:e.settingsCookie,views:t,multiView:Object.freeze({maxPanels:R("multiView.maxPanels",n.maxPanels,me),columns:R("multiView.columns",n.columns,ue)}),expandAll:Object.freeze({maxFolders:R("expandAll.maxFolders",o.maxFolders,fe),maxDepth:R("expandAll.maxDepth",o.maxDepth,Ee)}),revealDocument:Object.freeze({maxDepth:R("revealDocument.maxDepth",i.maxDepth,ge)}),documentStyles:Object.freeze(s.map(a=>Object.freeze({name:a.name,className:a.className}))),iframeHosts:Object.freeze([...new Set(r)]),embeds:Rt(e.embeds,e.dataPath),defaultTreeSettings:Nt(e.defaultTreeSettings)})},It=e=>{const t=e.embeds;if(!M(t))throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${d(t)}`);if(Object.hasOwn(t,"linkCards"))throw new RangeError(`[markdown-explorer] config.embeds.linkCards is an option of defineExplorerConfig, not a key of the embeds it resolves; pass the option to defineExplorerConfig (got linkCards ${d(t.linkCards)})`);const{linkCardEndpoint:r,...n}=t,o=we({...e,embeds:{...n,linkCards:r!==null}});if(o.embeds.linkCardEndpoint!==r)throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${d(o.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${d(r)}`);return o},pe=e=>typeof e=="string"&&Tt.test(e),At=(e,t)=>{if(e===null||typeof e!="object")throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${d(e)}`);if(!Array.isArray(t)||t.length===0)throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${d(t)}`);for(const r of t)if(!pe(r))throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);return Object.freeze({...e,sourceIds:Object.freeze([...t])})},kt=e=>e.documentStyles.map(t=>t.name),c=Object.freeze({source:"source",doc:"doc",maximized:"maximized",style:"style",align:"align",showToc:"showToc",showStyle:"showStyle",showAlign:"showAlign",padding:"padding",width:"width",maxWidth:"maxWidth",markup:"markup"}),Se="true",C="/",oe=".data",he=256,_e=/^\d+(?:\.\d+)?$/u,H=/^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u,xe=Object.freeze(["showToc","showStyle","showAlign"]),ie=e=>{const t=encodeURIComponent(e.replaceAll("%","%25"));return t.endsWith(oe)?`${t.slice(0,-oe.length)}%2Edata`:t},Pt=e=>e.replaceAll("%25","%"),Oe=e=>{const{sourceIds:t}=e;if(t===void 0)throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");return t},Lt=(e,t,r)=>{const n=r.getAll(c.source);if(n.length===0)return t;const[o]=n;return n.length>1||o===void 0||o===t||!e.includes(o)?null:o},Ct=(e,t)=>{const r=t.get(c.style),n=t.get(c.align);return{...r!==null&&e.documentStyles.some(o=>o.name===r)?{style:r}:{},...n!==null&&N.CONTENT_ALIGNS.includes(n)?{align:n}:{}}},Te=e=>Number.isFinite(e)&&e>=0&&e<=he&&_e.test(String(e)),Mt=e=>{const t=e.get(c.padding),r=t!==null&&_e.test(t)?Number(t):Number.NaN,n=e.get(c.width),o=e.get(c.maxWidth);return{...e.get(c.showToc)==="false"?{showToc:!1}:{},...e.get(c.showStyle)==="false"?{showStyle:!1}:{},...e.get(c.showAlign)==="false"?{showAlign:!1}:{},...Te(r)?{padding:r}:{},...n!==null&&H.test(n)?{width:n}:{},...o!==null&&H.test(o)?{maxWidth:o}:{}}},be=(e,t)=>[...new Set(t.filter(I.isAcceptableDocumentPath))].slice(0,e.multiView.maxPanels),vt=(e,t,r,n)=>{for(const i of t)B(i);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] multi-view documents must each appear once; got ${String(t.length)} with repeats`);if(t.length>e.multiView.maxPanels)throw new RangeError(`[markdown-explorer] the multi view opens at most ${String(e.multiView.maxPanels)} documents; got ${String(t.length)}`);if(r!==null&&!t.includes(r))throw new RangeError(`[markdown-explorer] the maximized document must be one of the open documents; got ${JSON.stringify(r.slice(0,80))}`);if(new Set(n).size!==n.length)throw new RangeError(`[markdown-explorer] the documents shown as written must each appear once; got ${String(n.length)} with repeats`);const o=n.find(i=>!t.includes(i));if(o!==void 0)throw new RangeError(`[markdown-explorer] a document shown as written must be one of the open documents; got ${JSON.stringify(o.slice(0,80))}`)},B=e=>{if(!I.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0,80))}`);return e},Dt=e=>{if(B(e).endsWith(C))throw new RangeError(`[markdown-explorer] a document path ending in a slash has no URL (its segment would name a folder): ${JSON.stringify(e.slice(0,80))}`);return e},$t=(e,t)=>{if(t.style!==void 0&&!e.documentStyles.some(r=>r.name===t.style))throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map(r=>JSON.stringify(r.name)).join(", ")}); got ${JSON.stringify(t.style)}`);if(t.align!==void 0&&!N.CONTENT_ALIGNS.includes(t.align))throw new RangeError(`[markdown-explorer] overrides.align must be one of ${N.CONTENT_ALIGNS.join(", ")}; got ${JSON.stringify(t.align)}`)},zt=e=>{for(const t of xe)if(e[t]!==void 0&&typeof e[t]!="boolean")throw new RangeError(`[markdown-explorer] embed.${t} must be a boolean; got ${JSON.stringify(e[t])}`);if(e.padding!==void 0&&!Te(e.padding))throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(he)} px in plain decimal digits; got ${String(e.padding)}`);for(const t of["width","maxWidth"]){const r=e[t];if(r!==void 0&&!H.test(r))throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(r)}`)}},ye=(e,t)=>{const r=new URLSearchParams;let n=`${e.basePath}/${e.views[t.view]}`;if(t.view==="multi"){const i=t.docs??[],s=t.maximized??null,l=t.markup??[];vt(e,i,s,l);for(const a of i)r.append(c.doc,a);s!==null&&r.set(c.maximized,s);for(const a of i)l.includes(a)&&r.append(c.markup,a)}else{const i=t.doc??null,s=t.view==="tree"?t.folder??null:null;if(i!==null&&s!==null)throw new RangeError("[markdown-explorer] a tree view shows a document or a folder, not both");i!==null&&(n+=`/${ie(Dt(i))}`),s!==null&&(n+=`/${ie(`${B(s)}${C}`)}`)}if(t.source!==void 0){const i=Oe(e);if(!i.includes(t.source))throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${i.join(", ")}`);t.source!==i[0]&&r.set(c.source,t.source)}if(t.view!=="multi"&&t.overrides!==void 0&&($t(e,t.overrides),t.overrides.style!==void 0&&r.set(c.style,t.overrides.style),t.overrides.align!==void 0&&r.set(c.align,t.overrides.align)),t.view!=="multi"&&t.markup===!0){if(!(t.doc!==void 0&&t.doc!==null||t.view==="tree"&&t.folder!==void 0&&t.folder!==null))throw new RangeError("[markdown-explorer] a tree view without a document or a folder has nothing to show as written");r.set(c.markup,Se)}if(t.view==="single"&&t.embed!==void 0){const{embed:i}=t;zt(i);for(const s of xe)i[s]===!1&&r.set(c[s],"false");i.padding!==void 0&&r.set(c.padding,String(i.padding)),i.width!==void 0&&r.set(c.width,i.width),i.maxWidth!==void 0&&r.set(c.maxWidth,i.maxWidth)}const o=r.toString();return o===""?n:`${n}?${o}`},jt=(e,t)=>Object.keys(e.views).find(r=>e.views[r]===t),Ft=(e,t,r)=>{const n=Oe(e),[o]=n;if(o===void 0)throw new RangeError("[markdown-explorer] the configuration has no source");const i=Lt(n,o,r),s=i===null?o:i,l=m=>({kind:"redirect",href:ye(e,m),location:m}),a=()=>l({view:"tree",source:s,doc:null,folder:null,overrides:{},markup:!1});if(t===void 0||t==="")return a();const x=t.indexOf("/"),v=x<0?t:t.slice(0,x),D=x<0?null:t.slice(x+1),w=jt(e,v);if(w===void 0)return a();if(w==="multi"){const m=r.getAll(c.doc),S=be(e,m),$=r.getAll(c.maximized),[z]=$,j=$.length===1&&z!==void 0&&S.includes(z)?z:null,F=r.getAll(c.markup),P=S.filter(b=>F.includes(b)),Re=P.length===F.length&&P.every((b,V)=>b===F[V]);return D===null&&i!==null&&S.length===m.length&&S.every((b,V)=>b===m[V])&&($.length===0||j!==null)&&Re?{kind:"location",location:{view:"multi",source:s,docs:S,maximized:j,markup:P}}:l({view:"multi",source:s,docs:S,maximized:j,markup:P})}const k=D===null?null:Pt(D),f=k?.endsWith(C)===!0?k.slice(0,-C.length):null,E=k!==null&&f===null?k:null;if(E!==null&&!I.isAcceptableDocumentPath(E)||f!==null&&!I.isAcceptableDocumentPath(f))return a();const O=Ct(e,r),T=(E!==null||f!==null)&&r.get(c.markup)===Se;if(w==="single"){if(f!==null)return l({view:"tree",source:s,doc:null,folder:f,overrides:O,markup:T});if(E===null)return a();const m=Mt(r);return i===null?l({view:w,source:s,doc:E,overrides:O,embed:m,markup:T}):{kind:"location",location:{view:w,source:s,doc:E,overrides:O,embed:m,markup:T}}}return i===null?l({view:w,source:s,doc:E,folder:f,overrides:O,markup:T}):{kind:"location",location:{view:w,source:s,doc:E,folder:f,overrides:O,markup:T}}};exports.ASSUMED_ROOT_FONT_PIXELS=Je;exports.COARSE_TARGET_PIXELS=Be;exports.COLUMN_MIN_MEASURE=et;exports.CONTROL_BLOCK_PIXELS=qe;exports.DEFAULT_TREE_SETTINGS=G;exports.DEFAULT_VIEW_SLUGS=J;exports.EDIT_SPLIT_DEFAULT_PERCENT=ot;exports.EDIT_SPLIT_MAX_PERCENT=it;exports.EDIT_SPLIT_MIN_PERCENT=de;exports.EXPAND_ALL_DEPTH_LIMITS=Ee;exports.EXPAND_ALL_FOLDER_LIMITS=fe;exports.EXPLORER_DEFAULT_PERCENT=Ge;exports.EXPLORER_MAX_PERCENT=q;exports.EXPLORER_MIN_REM=le;exports.EXPLORER_MULTI_DEFAULT_PERCENT=We;exports.FINE_TARGET_PIXELS=Ze;exports.GOLDEN_RATIO=u;exports.MULTI_VIEW_COLUMN_LIMITS=ue;exports.MULTI_VIEW_PANEL_LIMITS=me;exports.NAME_COLLATOR=A;exports.NO_TREE_SETTING_CHANGES=W;exports.PANEL_MAX_BLOCK_RATIO=Ye;exports.PANEL_MIN_BLOCK_RATIO=Qe;exports.PREFETCH_DWELL_MS=st;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=ge;exports.SPLIT_HANDLE_PIXELS=He;exports.SPLIT_PERSIST_DELAY_MS=nt;exports.advanceTreeSetting=ve;exports.applyTreeSettingChanges=je;exports.canonicalMultiDocuments=be;exports.centeredDialogPosition=mt;exports.columnGroups=ct;exports.createEntryComparator=Xe;exports.defineExplorerConfig=we;exports.documentStyleNames=kt;exports.editSplitOrientation=dt;exports.explorerHref=ye;exports.explorerMinPixels=ce;exports.explorerSheetBelowPixels=rt;exports.folderReadmeOf=ke;exports.formatTreeSettingValue=De;exports.isExplorerSourceId=pe;exports.isPlainObject=M;exports.parseViewSettings=pt;exports.readCookieValue=wt;exports.readTreeSettingChanges=ze;exports.recordTreeSettingChange=Fe;exports.replanVisibleColumns=lt;exports.resolveExplorerLocation=Ft;exports.revalidateExplorerConfig=It;exports.serializeTreeSettingChanges=Ve;exports.viewSettingsCookieString=_t;exports.visibleTreeSettingDescriptors=Me;exports.withExplorerSources=At;
1
+ "use strict";const y=require("@aiquants/markdown/embeds"),N=require("@aiquants/markdown/viewer-settings"),I=require("./dataRoute-BONacTPi.cjs"),M=e=>{if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},A=new Intl.Collator("en",{numeric:!0,sensitivity:"variant"}),Ie=/^readme(?:\.|$)/iu,Z=/^readme(?:\.[^.]*)?$/iu,Y=Object.freeze(["md","markdown","mdx","txt",""]),Ae=e=>Ie.test(e),X=e=>e.type==="file"&&Ae(e.name),Q=e=>{const t=e.lastIndexOf("."),r=Y.indexOf(t<0?"":e.slice(t+1).toLowerCase());return r<0?Y.length:r},ke=(e,t)=>{const r=+!Z.test(e.name)-+!Z.test(t.name);if(r!==0)return r;const n=Q(e.name)-Q(t.name);if(n!==0)return n;const o=A.compare(e.name,t.name);return o!==0?o:A.compare(e.path,t.path)},Pe=e=>{let t=null;for(const r of e)X(r)&&(t===null||ke(r,t)<0)&&(t=r);return t===null?null:t.path},G=Object.freeze({sortMode:"native",folderPlacement:"mixed",readmePlacement:"mixed",selectionMode:"single",doubleClickAction:"recursive",expandIconSize:8,alwaysExpanded:!1,revealDocument:!1,removeRootIndent:!1,lines:!0,expandIcons:!0,directoryIcons:!0,fileIcons:!0}),Le=[!0,!1],Ce=(e,t)=>t?e.settingOn:e.settingOff,p=(e,t)=>({key:e,labelKey:t,values:Le,formatValue:Ce,requiresItemSelection:!1}),Me=Object.freeze({native:e=>e.sortNative,asc:e=>e.sortAscending,desc:e=>e.sortDescending,oldest:e=>e.sortOldest,newest:e=>e.sortNewest}),_=Object.freeze([{key:"sortMode",labelKey:"settingSortMode",values:["native","asc","desc","oldest","newest"],formatValue:(e,t)=>Me[t](e),requiresItemSelection:!1},{key:"folderPlacement",labelKey:"settingFolderPlacement",values:["mixed","first","last"],formatValue:(e,t)=>t==="mixed"?e.folderPlacementMixed:t==="first"?e.folderPlacementFirst:e.folderPlacementLast,requiresItemSelection:!1},{key:"readmePlacement",labelKey:"settingReadmePlacement",values:["mixed","first","last"],formatValue:(e,t)=>t==="mixed"?e.readmePlacementMixed:t==="first"?e.readmePlacementFirst:e.readmePlacementLast,requiresItemSelection:!1},{key:"selectionMode",labelKey:"settingSelectionMode",values:["single","multiple","none"],formatValue:(e,t)=>t==="single"?e.selectionSingle:t==="multiple"?e.selectionMultiple:e.selectionNone,requiresItemSelection:!0},{key:"doubleClickAction",labelKey:"settingDoubleClick",values:["recursive","toggle"],formatValue:(e,t)=>t==="recursive"?e.doubleClickRecursive:e.doubleClickToggle,requiresItemSelection:!1},{key:"expandIconSize",labelKey:"settingExpandIconSize",values:[8,13,5],formatValue:(e,t)=>e.expandIconSizeValue(t),requiresItemSelection:!1},p("alwaysExpanded","settingAlwaysExpanded"),p("revealDocument","settingRevealDocument"),p("removeRootIndent","settingRemoveRootIndent"),p("lines","settingTreeLines"),p("expandIcons","settingExpandIcons"),p("directoryIcons","settingDirectoryIcons"),p("fileIcons","settingFileIcons")]),ve=e=>e?_:_.filter(t=>!t.requiresItemSelection),se=e=>{const t=_.find(r=>r.key===e);if(t===void 0)throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);return t},De=(e,t)=>{const r=se(t).values,n=r[(r.indexOf(e[t])+1)%r.length];return{...e,[t]:n}},$e=(e,t,r)=>se(r).formatValue(e,t[r]),ae=2,W=Object.freeze({}),K=(e,t)=>Object.freeze(Object.fromEntries(_.filter(r=>t(r,e[r.key])).map(r=>[r.key,e[r.key]]))),ee="directoriesFirst",ze=e=>{if(!Object.hasOwn(e,ee))return e;const{[ee]:t,...r}=e;return Object.hasOwn(r,"folderPlacement")||typeof t!="boolean"?r:{...r,folderPlacement:t?"first":"mixed"}},je=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return W;const t=e;return t.version!==ae||t.settings===null||typeof t.settings!="object"||Array.isArray(t.settings)?W:K(ze(t.settings),(r,n)=>r.values.includes(n))},Fe=(e,t)=>{const r=K(t,(n,o)=>o!==void 0&&o!==e[n.key]);return Object.keys(r).length===0?e:Object.freeze({...e,...r})},Ve=(e,t,r,n)=>K({...e,[t]:r},(o,i)=>i!==void 0&&!(o.key===t&&i===n[t])),Ue=e=>JSON.stringify({version:ae,settings:e}),Xe=(e,t,r)=>e===void 0||t===void 0?e===t?0:e===void 0?1:-1:r*(e-t),Ge=e=>{const{sortMode:t,folderPlacement:r,readmePlacement:n}=e;if(t==="native"&&r==="mixed"&&n==="mixed")return;const o=(i,s)=>{const l=A.compare(i.name,s.name);return l!==0?l:A.compare(i.path,s.path)};return(i,s)=>{if(r!=="mixed"&&i.type!==s.type)return i.type==="directory"==(r==="first")?-1:1;if(n!=="mixed"){const a=X(i);if(a!==X(s))return a===(n==="first")?-1:1}if(t==="native")return 0;if(t==="asc")return o(i,s);if(t==="desc")return-o(i,s);const l=Xe(i.modifiedAt,s.modifiedAt,t==="oldest"?1:-1);return l!==0?l:o(i,s)}},u=(1+Math.sqrt(5))/2,We=100/u**3,Je=100/u**4,q=100/u**2,le=13,He=16,Ke=Object.freeze({gripThickness:5,gripLength:34,barThickness:2,barLength:21}),qe=Object.freeze([89,144,233,377]),ce=44,Be=ce,Ze=24,Ye=1/u,Qe=1/u**3,et="40ch",tt=e=>{if(!Number.isFinite(e)||e<=0)throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`)},de=e=>(tt(e),le*e),rt=e=>de(e)*u**2,nt=233,ot=50,me=100/u**3,it=100-me,st=qe[0],g=(e,t)=>{if(!Number.isFinite(t)||t<0)throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`)},at=({trackInlineSize:e,gap:t,minColumnInlineSize:r,logicalColumns:n})=>{if(g("trackInlineSize",e),g("gap",t),!Number.isFinite(r)||r<=0)throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(r)}`);if(!Number.isInteger(n)||n<1)throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(n)}`);const o=Math.floor((e+t)/(r+t));return Math.min(n,Math.max(1,o))},lt=(e,t)=>{const{trackInlineSize:r,gap:n,minColumnInlineSize:o,logicalColumns:i}=t;if(!([r,n,o].every(Number.isFinite)&&r>0&&n>=0&&o>0))return e;const l=at(t);if(e===null||l===e)return l;const a=Math.min(i,Math.max(1,e));if(l>a){const v=(a+1)*o+a*n+n/u;return r>=v?l:a}return r>=a*o+(a-1)*n?a:l},ct=(e,t)=>{if(!(Number.isInteger(e)&&Number.isInteger(t))||t<1||t>e)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);return Array.from({length:t},(r,n)=>[Math.floor(n*e/t),Math.floor((n+1)*e/t)])},dt=(e,t,r)=>{if(g("surfaceInlineSize",e),g("handlePixels",r),!Number.isFinite(t)||t<=0)throw new RangeError(`[markdown-explorer] measure must be a finite number > 0; got ${String(t)}`);return e>=2*t+r?"beside":"stacked"},U=(e,t,r)=>Math.max(t,Math.min(e,r)),te=(e,t,r,n)=>{const o=(U(e,0,r)+U(t,0,r))/2;return U(o-n/2,0,r-n)},mt=(e,t,r)=>{for(const[n,o]of Object.entries(e))if(!Number.isFinite(o))throw new RangeError(`[markdown-explorer] anchor.${n} must be a finite number; got ${String(o)}`);return g("marginBox.width",t.width),g("marginBox.height",t.height),g("viewport.width",r.width),g("viewport.height",r.height),{left:te(e.left,e.right,r.width,t.width),top:te(e.top,e.bottom,r.height,t.height)}},ut=31536e3,ft=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u,Et=e=>{if(typeof e!="string"||!ft.test(e))throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`)},re=e=>typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=q,gt=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))return{};const r=e,{treeExplorer:n,multiExplorer:o,style:i,align:s}=r;return{...re(n)?{treeExplorer:n}:{},...re(o)?{multiExplorer:o}:{},...typeof i=="string"&&t.includes(i)?{style:i}:{},...typeof s=="string"&&N.CONTENT_ALIGNS.includes(s)?{align:s}:{}}},wt=(e,t)=>{if(e!==null)for(const r of e.split(";")){const n=r.indexOf("=");if(!(n<0)&&r.slice(0,n).trim()===t)return r.slice(n+1).trim()}},pt=(e,t)=>{if(e===void 0||e==="")return{};try{return gt(JSON.parse(decodeURIComponent(e)),t)}catch{return{}}},L=100,St=Math.floor(q*L)/L,ht=e=>{const t=r=>Math.min(St,Math.max(1,Math.round(r*L))/L);return encodeURIComponent(JSON.stringify({...e.treeExplorer===void 0?{}:{treeExplorer:t(e.treeExplorer)},...e.multiExplorer===void 0?{}:{multiExplorer:t(e.multiExplorer)},...e.style===void 0?{}:{style:e.style},...e.align===void 0?{}:{align:e.align}}))},_t=(e,t,r)=>`${e}=${ht(t)}; Path=/; Max-Age=${String(ut)}; SameSite=Lax${r?"; Secure":""}`,J=Object.freeze({tree:"tree",multi:"multi",single:"single"}),ue=Object.freeze({default:12,min:1,max:64}),fe=Object.freeze({default:4,min:1,max:6}),Ee=Object.freeze({default:500,min:1,max:1e4}),ge=Object.freeze({default:16,min:1,max:64}),we=Object.freeze({default:16,min:1,max:64}),xt=/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u,Ot=/^[A-Za-z0-9][A-Za-z0-9_-]*$/u,Tt=/^[a-z0-9][a-z0-9-]*$/u,bt=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u,ne=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);if(!xt.test(t)||t.split("/").some(r=>r==="."||r===".."))throw new RangeError(`[markdown-explorer] ${e} must start with "/", have no trailing "/", and use only letters, digits and "._~-" in each segment; got ${JSON.stringify(t)}`)},d=e=>typeof e=="string"?JSON.stringify(e):typeof e=="bigint"?`${String(e)}n`:Object.is(e,-0)?"-0":typeof e=="function"?"a function":Array.isArray(e)?"an array":e!==null&&typeof e=="object"?M(e)?"a plain object":`a non-plain object (${Object.prototype.toString.call(e)})`:String(e),h=(e,t,r)=>{if(t===void 0)return[];if(!M(t))throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${d(t)}`);const n=Object.entries(t);for(const[o]of n)if(!r.includes(o))throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${r.join(", ")}`);return n.filter(([,o])=>o!==void 0)},yt=e=>{const t={...J};for(const[r,n]of h("views",e,Object.keys(J)))t[r]=n;for(const[r,n]of Object.entries(t))if(typeof n!="string"||!Ot.test(n))throw new RangeError(`[markdown-explorer] views.${r} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(n)}`);return Object.freeze(t)},R=(e,t,r)=>{if(t===void 0)return r.default;if(typeof t!="number"||!Number.isInteger(t)||t<r.min||t>r.max)throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(r.min)}..${String(r.max)}; got ${d(t)}`);return t},Rt=(e,t)=>{const r=new Map(h("embeds",e,["providers","linkCards","linkCardSize"]));if(r.size===0)return y.NO_EMBEDS;const n=r.has("providers")?r.get("providers"):[];if(!Array.isArray(n))throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${d(n)}`);for(const l of n)if(!y.isEmbedProviderId(l))throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${y.EMBED_PROVIDER_IDS.join(", ")}; got ${d(l)}`);const o=r.has("linkCards")?r.get("linkCards"):!1;if(typeof o!="boolean")throw new RangeError(`[markdown-explorer] embeds.linkCards must be a boolean; got ${d(o)}`);const i={providers:Object.freeze([...new Set(n)]),linkCardEndpoint:o?I.explorerLinkCardEndpoint(t):null};if(!r.has("linkCardSize"))return Object.freeze(i);const s=r.get("linkCardSize");if(!y.isLinkCardSize(s))throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${y.LINK_CARD_SIZES.join(", ")}; got ${d(s)}`);if(!o)throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${d(s)} with linkCards ${d(o)}`);return Object.freeze({...i,linkCardSize:s})},Nt=e=>{const t=new Map(h("defaultTreeSettings",e,_.map(n=>n.key)));if(t.size===0)return G;const r={...G};for(const n of _){if(!t.has(n.key))continue;const o=t.get(n.key),i=n.values;if(!i.includes(o))throw new RangeError(`[markdown-explorer] defaultTreeSettings.${n.key} must be one of ${i.map(d).join(", ")}; got ${d(o)}`);r[n.key]=o}return Object.freeze(r)},pe=e=>{if(e===null||typeof e!="object")throw new TypeError("[markdown-explorer] the explorer configuration must be an object");ne("basePath",e.basePath),ne("dataPath",e.dataPath);const t=yt(e.views);if(new Set([t.tree,t.multi,t.single]).size!==3)throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);if(e.dataPath===e.basePath)throw new RangeError("[markdown-explorer] dataPath must differ from basePath");if(e.dataPath.startsWith(`${e.basePath}/`)){const a=e.dataPath.slice(e.basePath.length+1).split("/")[0];if(a===t.tree||a===t.multi||a===t.single)throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`)}Et(e.settingsCookie);const r=e.iframeHosts??[];if(!Array.isArray(r)||r.some(a=>typeof a!="string"||!bt.test(a)))throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(r)}`);const n=Object.fromEntries(h("multiView",e.multiView,["maxPanels","columns"])),o=Object.fromEntries(h("expandAll",e.expandAll,["maxFolders","maxDepth"])),i=Object.fromEntries(h("revealDocument",e.revealDocument,["maxDepth"])),s=e.documentStyles??N.DEFAULT_MARKDOWN_STYLES;if(!Array.isArray(s)||s.length===0)throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");const l=new Set;for(const a of s){if(a===null||typeof a!="object"||typeof a.name!="string"||a.name.trim()===""||typeof a.className!="string")throw new RangeError("[markdown-explorer] each document style needs a non-blank name and a className string");if(l.has(a.name))throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(a.name)} repeats`);l.add(a.name)}return Object.freeze({basePath:e.basePath,dataPath:e.dataPath,settingsCookie:e.settingsCookie,views:t,multiView:Object.freeze({maxPanels:R("multiView.maxPanels",n.maxPanels,ue),columns:R("multiView.columns",n.columns,fe)}),expandAll:Object.freeze({maxFolders:R("expandAll.maxFolders",o.maxFolders,Ee),maxDepth:R("expandAll.maxDepth",o.maxDepth,ge)}),revealDocument:Object.freeze({maxDepth:R("revealDocument.maxDepth",i.maxDepth,we)}),documentStyles:Object.freeze(s.map(a=>Object.freeze({name:a.name,className:a.className}))),iframeHosts:Object.freeze([...new Set(r)]),embeds:Rt(e.embeds,e.dataPath),defaultTreeSettings:Nt(e.defaultTreeSettings)})},It=e=>{const t=e.embeds;if(!M(t))throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${d(t)}`);if(Object.hasOwn(t,"linkCards"))throw new RangeError(`[markdown-explorer] config.embeds.linkCards is an option of defineExplorerConfig, not a key of the embeds it resolves; pass the option to defineExplorerConfig (got linkCards ${d(t.linkCards)})`);const{linkCardEndpoint:r,...n}=t,o=pe({...e,embeds:{...n,linkCards:r!==null}});if(o.embeds.linkCardEndpoint!==r)throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${d(o.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${d(r)}`);return o},Se=e=>typeof e=="string"&&Tt.test(e),At=(e,t)=>{if(e===null||typeof e!="object")throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${d(e)}`);if(!Array.isArray(t)||t.length===0)throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${d(t)}`);for(const r of t)if(!Se(r))throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${d(r)}`);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);return Object.freeze({...e,sourceIds:Object.freeze([...t])})},kt=e=>e.documentStyles.map(t=>t.name),c=Object.freeze({source:"source",doc:"doc",maximized:"maximized",style:"style",align:"align",showToc:"showToc",showStyle:"showStyle",showAlign:"showAlign",padding:"padding",width:"width",maxWidth:"maxWidth",markup:"markup"}),he="true",C="/",oe=".data",_e=256,xe=/^\d+(?:\.\d+)?$/u,H=/^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u,Oe=Object.freeze(["showToc","showStyle","showAlign"]),ie=e=>{const t=encodeURIComponent(e.replaceAll("%","%25"));return t.endsWith(oe)?`${t.slice(0,-oe.length)}%2Edata`:t},Pt=e=>e.replaceAll("%25","%"),Te=e=>{const{sourceIds:t}=e;if(t===void 0)throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");return t},Lt=(e,t,r)=>{const n=r.getAll(c.source);if(n.length===0)return t;const[o]=n;return n.length>1||o===void 0||o===t||!e.includes(o)?null:o},Ct=(e,t)=>{const r=t.get(c.style),n=t.get(c.align);return{...r!==null&&e.documentStyles.some(o=>o.name===r)?{style:r}:{},...n!==null&&N.CONTENT_ALIGNS.includes(n)?{align:n}:{}}},be=e=>Number.isFinite(e)&&e>=0&&e<=_e&&xe.test(String(e)),Mt=e=>{const t=e.get(c.padding),r=t!==null&&xe.test(t)?Number(t):Number.NaN,n=e.get(c.width),o=e.get(c.maxWidth);return{...e.get(c.showToc)==="false"?{showToc:!1}:{},...e.get(c.showStyle)==="false"?{showStyle:!1}:{},...e.get(c.showAlign)==="false"?{showAlign:!1}:{},...be(r)?{padding:r}:{},...n!==null&&H.test(n)?{width:n}:{},...o!==null&&H.test(o)?{maxWidth:o}:{}}},ye=(e,t)=>[...new Set(t.filter(I.isAcceptableDocumentPath))].slice(0,e.multiView.maxPanels),vt=(e,t,r,n)=>{for(const i of t)B(i);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] multi-view documents must each appear once; got ${String(t.length)} with repeats`);if(t.length>e.multiView.maxPanels)throw new RangeError(`[markdown-explorer] the multi view opens at most ${String(e.multiView.maxPanels)} documents; got ${String(t.length)}`);if(r!==null&&!t.includes(r))throw new RangeError(`[markdown-explorer] the maximized document must be one of the open documents; got ${JSON.stringify(r.slice(0,80))}`);if(new Set(n).size!==n.length)throw new RangeError(`[markdown-explorer] the documents shown as written must each appear once; got ${String(n.length)} with repeats`);const o=n.find(i=>!t.includes(i));if(o!==void 0)throw new RangeError(`[markdown-explorer] a document shown as written must be one of the open documents; got ${JSON.stringify(o.slice(0,80))}`)},B=e=>{if(!I.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0,80))}`);return e},Dt=e=>{if(B(e).endsWith(C))throw new RangeError(`[markdown-explorer] a document path ending in a slash has no URL (its segment would name a folder): ${JSON.stringify(e.slice(0,80))}`);return e},$t=(e,t)=>{if(t.style!==void 0&&!e.documentStyles.some(r=>r.name===t.style))throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map(r=>JSON.stringify(r.name)).join(", ")}); got ${JSON.stringify(t.style)}`);if(t.align!==void 0&&!N.CONTENT_ALIGNS.includes(t.align))throw new RangeError(`[markdown-explorer] overrides.align must be one of ${N.CONTENT_ALIGNS.join(", ")}; got ${JSON.stringify(t.align)}`)},zt=e=>{for(const t of Oe)if(e[t]!==void 0&&typeof e[t]!="boolean")throw new RangeError(`[markdown-explorer] embed.${t} must be a boolean; got ${JSON.stringify(e[t])}`);if(e.padding!==void 0&&!be(e.padding))throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(_e)} px in plain decimal digits; got ${String(e.padding)}`);for(const t of["width","maxWidth"]){const r=e[t];if(r!==void 0&&!H.test(r))throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(r)}`)}},Re=(e,t)=>{const r=new URLSearchParams;let n=`${e.basePath}/${e.views[t.view]}`;if(t.view==="multi"){const i=t.docs??[],s=t.maximized??null,l=t.markup??[];vt(e,i,s,l);for(const a of i)r.append(c.doc,a);s!==null&&r.set(c.maximized,s);for(const a of i)l.includes(a)&&r.append(c.markup,a)}else{const i=t.doc??null,s=t.view==="tree"?t.folder??null:null;if(i!==null&&s!==null)throw new RangeError("[markdown-explorer] a tree view shows a document or a folder, not both");i!==null&&(n+=`/${ie(Dt(i))}`),s!==null&&(n+=`/${ie(`${B(s)}${C}`)}`)}if(t.source!==void 0){const i=Te(e);if(!i.includes(t.source))throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${i.join(", ")}`);t.source!==i[0]&&r.set(c.source,t.source)}if(t.view!=="multi"&&t.overrides!==void 0&&($t(e,t.overrides),t.overrides.style!==void 0&&r.set(c.style,t.overrides.style),t.overrides.align!==void 0&&r.set(c.align,t.overrides.align)),t.view!=="multi"&&t.markup===!0){if(!(t.doc!==void 0&&t.doc!==null||t.view==="tree"&&t.folder!==void 0&&t.folder!==null))throw new RangeError("[markdown-explorer] a tree view without a document or a folder has nothing to show as written");r.set(c.markup,he)}if(t.view==="single"&&t.embed!==void 0){const{embed:i}=t;zt(i);for(const s of Oe)i[s]===!1&&r.set(c[s],"false");i.padding!==void 0&&r.set(c.padding,String(i.padding)),i.width!==void 0&&r.set(c.width,i.width),i.maxWidth!==void 0&&r.set(c.maxWidth,i.maxWidth)}const o=r.toString();return o===""?n:`${n}?${o}`},jt=(e,t)=>Object.keys(e.views).find(r=>e.views[r]===t),Ft=(e,t,r)=>{const n=Te(e),[o]=n;if(o===void 0)throw new RangeError("[markdown-explorer] the configuration has no source");const i=Lt(n,o,r),s=i===null?o:i,l=m=>({kind:"redirect",href:Re(e,m),location:m}),a=()=>l({view:"tree",source:s,doc:null,folder:null,overrides:{},markup:!1});if(t===void 0||t==="")return a();const x=t.indexOf("/"),v=x<0?t:t.slice(0,x),D=x<0?null:t.slice(x+1),w=jt(e,v);if(w===void 0)return a();if(w==="multi"){const m=r.getAll(c.doc),S=ye(e,m),$=r.getAll(c.maximized),[z]=$,j=$.length===1&&z!==void 0&&S.includes(z)?z:null,F=r.getAll(c.markup),P=S.filter(b=>F.includes(b)),Ne=P.length===F.length&&P.every((b,V)=>b===F[V]);return D===null&&i!==null&&S.length===m.length&&S.every((b,V)=>b===m[V])&&($.length===0||j!==null)&&Ne?{kind:"location",location:{view:"multi",source:s,docs:S,maximized:j,markup:P}}:l({view:"multi",source:s,docs:S,maximized:j,markup:P})}const k=D===null?null:Pt(D),f=k?.endsWith(C)===!0?k.slice(0,-C.length):null,E=k!==null&&f===null?k:null;if(E!==null&&!I.isAcceptableDocumentPath(E)||f!==null&&!I.isAcceptableDocumentPath(f))return a();const O=Ct(e,r),T=(E!==null||f!==null)&&r.get(c.markup)===he;if(w==="single"){if(f!==null)return l({view:"tree",source:s,doc:null,folder:f,overrides:O,markup:T});if(E===null)return a();const m=Mt(r);return i===null?l({view:w,source:s,doc:E,overrides:O,embed:m,markup:T}):{kind:"location",location:{view:w,source:s,doc:E,overrides:O,embed:m,markup:T}}}return i===null?l({view:w,source:s,doc:E,folder:f,overrides:O,markup:T}):{kind:"location",location:{view:w,source:s,doc:E,folder:f,overrides:O,markup:T}}};exports.ASSUMED_ROOT_FONT_PIXELS=He;exports.COARSE_TARGET_PIXELS=Be;exports.COLUMN_MIN_MEASURE=et;exports.CONTROL_BLOCK_PIXELS=ce;exports.DEFAULT_TREE_SETTINGS=G;exports.DEFAULT_VIEW_SLUGS=J;exports.EDIT_SPLIT_DEFAULT_PERCENT=ot;exports.EDIT_SPLIT_MAX_PERCENT=it;exports.EDIT_SPLIT_MIN_PERCENT=me;exports.EXPAND_ALL_DEPTH_LIMITS=ge;exports.EXPAND_ALL_FOLDER_LIMITS=Ee;exports.EXPLORER_DEFAULT_PERCENT=We;exports.EXPLORER_MAX_PERCENT=q;exports.EXPLORER_MIN_REM=le;exports.EXPLORER_MULTI_DEFAULT_PERCENT=Je;exports.FINE_TARGET_PIXELS=Ze;exports.GOLDEN_RATIO=u;exports.MULTI_VIEW_COLUMN_LIMITS=fe;exports.MULTI_VIEW_PANEL_LIMITS=ue;exports.NAME_COLLATOR=A;exports.NO_TREE_SETTING_CHANGES=W;exports.PANEL_MAX_BLOCK_RATIO=Ye;exports.PANEL_MIN_BLOCK_RATIO=Qe;exports.PREFETCH_DWELL_MS=st;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=we;exports.SPLIT_HANDLE_PIXELS=Ke;exports.SPLIT_PERSIST_DELAY_MS=nt;exports.advanceTreeSetting=De;exports.applyTreeSettingChanges=Fe;exports.canonicalMultiDocuments=ye;exports.centeredDialogPosition=mt;exports.columnGroups=ct;exports.createEntryComparator=Ge;exports.defineExplorerConfig=pe;exports.documentStyleNames=kt;exports.editSplitOrientation=dt;exports.explorerHref=Re;exports.explorerMinPixels=de;exports.explorerSheetBelowPixels=rt;exports.folderReadmeOf=Pe;exports.formatTreeSettingValue=$e;exports.isExplorerSourceId=Se;exports.isPlainObject=M;exports.parseViewSettings=pt;exports.readCookieValue=wt;exports.readTreeSettingChanges=je;exports.recordTreeSettingChange=Ve;exports.replanVisibleColumns=lt;exports.resolveExplorerLocation=Ft;exports.revalidateExplorerConfig=It;exports.serializeTreeSettingChanges=Ue;exports.viewSettingsCookieString=_t;exports.visibleTreeSettingDescriptors=ve;exports.withExplorerSources=At;
@@ -1,5 +1,5 @@
1
1
  import { diff3Merge as d } from "node-diff3";
2
- import { C, a as R, b as u } from "./index-DTKGgaok.js";
2
+ import { C, a as R, b as u } from "./index-25s_q0vD.js";
3
3
  const g = (n, o, e, l) => {
4
4
  if (o === n || o === e) return { kind: "clean", text: e };
5
5
  if (e === n) return { kind: "clean", text: o };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-DffJZ8-y.cjs"),R=(n,t,i,l)=>{if(t===n||t===i)return{kind:"clean",text:i};if(i===n)return{kind:"clean",text:t};const d=g.diff3Merge(t.split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-W3iAjkLb.cjs"),R=(n,t,i,l)=>{if(t===n||t===i)return{kind:"clean",text:i};if(i===n)return{kind:"clean",text:t};const d=g.diff3Merge(t.split(`
2
2
  `),n.split(`
3
3
  `),i.split(`
4
4
  `),{excludeFalseConflicts:!0}),o=[];let c=0;const u=s(l.ours),a=s(l.theirs);for(const e of d)e.ok!==void 0?o.push(...e.ok):e.conflict!==void 0&&(c+=1,o.push(`${r.CONFLICT_OURS_MARKER} ${u}`,...e.conflict.a,r.CONFLICT_SEPARATOR,...e.conflict.b,`${r.CONFLICT_THEIRS_MARKER} ${a}`));const f=o.join(`