@aiquants/markdown-explorer 0.24.1 → 0.25.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 (30) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +14 -5
  3. package/dist/{EditSurface-CFXG8Qok.js → EditSurface-Blymamic.js} +3 -3
  4. package/dist/{EditSurface-CiKQiYSD.cjs → EditSurface-Co4Rvfa1.cjs} +1 -1
  5. package/dist/{ExplorerSplit-DIkC3R7O.js → ExplorerSplit-BZ0PA3z3.js} +47 -47
  6. package/dist/{ExplorerSplit-BWMVatnB.cjs → ExplorerSplit-WApgYMPb.cjs} +1 -1
  7. package/dist/{MultiLayout-DXnuRzb4.js → MultiLayout-B5-1N3JD.js} +3 -3
  8. package/dist/{MultiLayout-q_Pvwykp.cjs → MultiLayout-dAW_JCzg.cjs} +1 -1
  9. package/dist/{NativeScrollBar-s_uSPPEd.js → NativeScrollBar-BraWuZvN.js} +1 -1
  10. package/dist/{NativeScrollBar-UYBG64v1.cjs → NativeScrollBar-ThVMbI0Y.cjs} +1 -1
  11. package/dist/{TreeLayout-Di0yv1E-.cjs → TreeLayout-C60lb9hP.cjs} +1 -1
  12. package/dist/{TreeLayout-BQ1lWVf3.js → TreeLayout-CChoxh9W.js} +3 -3
  13. package/dist/core/textEncoding.d.cts +1 -0
  14. package/dist/core/textEncoding.d.ts +1 -0
  15. package/dist/{index-ZdsIXJap.cjs → index-B6FkGD-p.cjs} +4 -4
  16. package/dist/{index-BhxsL0Sm.js → index-Bd6hgisa.js} +5 -5
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.js +3 -3
  19. package/dist/location-D3DgoELB.cjs +1 -0
  20. package/dist/{location-gXXmC7CQ.js → location-DIxIjqs7.js} +147 -140
  21. package/dist/{merge-CQAXBfvi.js → merge-CgSp-0Dd.js} +1 -1
  22. package/dist/{merge-DkmrVEIc.cjs → merge-DRWmjC24.cjs} +1 -1
  23. package/dist/server.cjs +1 -1
  24. package/dist/server.js +785 -725
  25. package/dist/{useSplitPersistence-Bmpb2prR.cjs → useSplitPersistence-D-T75Hlh.cjs} +1 -1
  26. package/dist/{useSplitPersistence-BPNjvuJi.js → useSplitPersistence-Df63lnQZ.js} +1 -1
  27. package/docs/behavior/security.md +5 -2
  28. package/docs/behavior/url-contract.md +3 -3
  29. package/package.json +1 -1
  30. package/dist/location-CasigkBk.cjs +0 -1
@@ -1,4 +1,4 @@
1
- import { NO_EMBEDS as xe, isEmbedProviderId as be, EMBED_PROVIDER_IDS as Oe, isLinkCardSize as ke, LINK_CARD_SIZES as Te } from "@aiquants/markdown/embeds";
1
+ import { NO_EMBEDS as ye, isEmbedProviderId as be, EMBED_PROVIDER_IDS as Oe, isLinkCardSize as ke, LINK_CARD_SIZES as Te } from "@aiquants/markdown/embeds";
2
2
  import { CONTENT_ALIGNS as N, DEFAULT_MARKDOWN_STYLES as Re } from "@aiquants/markdown/viewer-settings";
3
3
  import { a as _e, i as $ } from "./dataRoute-BEvesOvN.js";
4
4
  const R = (e) => {
@@ -46,7 +46,7 @@ const R = (e) => {
46
46
  "UTF-16BE",
47
47
  "UTF-16LE",
48
48
  "x-user-defined"
49
- ]), Ne = new Map(Ie.map((e) => [e.toLowerCase(), e])), A = "UTF-8", H = Object.freeze([
49
+ ]), Ne = new Map(Ie.map((e) => [e.toLowerCase(), e])), A = "UTF-8", q = Object.freeze([
50
50
  Object.freeze({ bytes: Object.freeze([239, 187, 191]), encoding: A }),
51
51
  Object.freeze({ bytes: Object.freeze([255, 254]), encoding: "UTF-16LE" }),
52
52
  Object.freeze({ bytes: Object.freeze([254, 255]), encoding: "UTF-16BE" })
@@ -56,7 +56,7 @@ const R = (e) => {
56
56
  ["UTF-16BE", "is read only by its byte order mark"],
57
57
  ["ISO-2022-JP", "writes only bytes below 0x80, which UTF-8 always reads first, so it would never be used"],
58
58
  ["x-user-defined", "is no text encoding (it maps bytes to private-use characters)"]
59
- ]), le = (e) => {
59
+ ]), de = (e) => {
60
60
  let t;
61
61
  try {
62
62
  t = new TextDecoder(e).encoding;
@@ -70,43 +70,49 @@ const R = (e) => {
70
70
  const t = Ne.get(e);
71
71
  if (t === void 0) throw new RangeError(`[markdown-explorer] TextDecoder answered ${JSON.stringify(e)}, which is no encoding of the WHATWG Encoding Standard`);
72
72
  return t;
73
- }, W = (e, t, n) => {
74
- const r = n === null ? null : le(n), o = H.find(({ bytes: i }) => i.every((a, l) => e[l] === a));
73
+ }, C = (e, t, n) => {
74
+ const r = n === null ? null : de(n), o = q.find(({ bytes: i }) => i.every((a, l) => e[l] === a));
75
75
  if (o !== void 0) return { body: e.subarray(o.bytes.length), encodings: [o.encoding] };
76
- const s = t || e.length === 0 ? void 0 : H.find(({ bytes: i }) => e.length < i.length && e.every((a, l) => i[l] === a));
76
+ const s = t || e.length === 0 ? void 0 : q.find(({ bytes: i }) => e.length < i.length && e.every((a, l) => i[l] === a));
77
77
  return s !== void 0 ? { body: e.subarray(e.length), encodings: [s.encoding] } : { body: e, encodings: r === null ? [A] : [A, r] };
78
- }, At = (e, t, n) => W(e, t, n).encodings, Pe = (e, t, n) => {
78
+ }, At = (e, t, n) => C(e, t, n).encodings, Pe = (e, t, n) => {
79
79
  try {
80
80
  return new TextDecoder(e, { fatal: !0, ignoreBOM: !0 }).decode(t, { stream: !n });
81
81
  } catch (r) {
82
82
  if (r instanceof TypeError) return null;
83
83
  throw r;
84
84
  }
85
- }, Pt = (e, t, n) => de(W(e, t, n), t), de = ({ body: e, encodings: t }, n) => {
85
+ }, Pt = (e, t, n) => {
86
+ const r = X(C(e, t, n), t);
87
+ return r === null ? null : r.text;
88
+ }, X = ({ body: e, encodings: t }, n) => {
86
89
  for (const r of t) {
87
90
  const o = Pe(r, e, n);
88
- if (o !== null) return o;
91
+ if (o !== null) return { encoding: r, text: o };
89
92
  }
90
93
  return null;
91
94
  }, vt = (e, t, n) => {
92
- const r = W(e, t, n), o = de(r, t);
93
- return o !== null ? o : new TextDecoder(r.encodings[0], { ignoreBOM: !0 }).decode(r.body, { stream: !t });
94
- }, P = new Intl.Collator("en", { numeric: !0, sensitivity: "variant" }), ve = /^readme(?:\.|$)/iu, q = /^readme(?:\.[^.]*)?$/iu, Y = Object.freeze(["md", "markdown", "mdx", "txt", ""]), je = (e) => ve.test(e), J = (e) => e.type === "file" && je(e.name), Z = (e) => {
95
- const t = e.lastIndexOf("."), n = Y.indexOf(t < 0 ? "" : e.slice(t + 1).toLowerCase());
96
- return n < 0 ? Y.length : n;
95
+ const r = C(e, t, n), o = X(r, t);
96
+ return o === null ? r.encodings[0] : o.encoding;
97
+ }, jt = (e, t, n) => {
98
+ const r = C(e, t, n), o = X(r, t);
99
+ return o !== null ? o.text : new TextDecoder(r.encodings[0], { ignoreBOM: !0 }).decode(r.body, { stream: !t });
100
+ }, P = new Intl.Collator("en", { numeric: !0, sensitivity: "variant" }), ve = /^readme(?:\.|$)/iu, Y = /^readme(?:\.[^.]*)?$/iu, Z = Object.freeze(["md", "markdown", "mdx", "txt", ""]), je = (e) => ve.test(e), G = (e) => e.type === "file" && je(e.name), Q = (e) => {
101
+ const t = e.lastIndexOf("."), n = Z.indexOf(t < 0 ? "" : e.slice(t + 1).toLowerCase());
102
+ return n < 0 ? Z.length : n;
97
103
  }, Ce = (e, t) => {
98
- const n = +!q.test(e.name) - +!q.test(t.name);
104
+ const n = +!Y.test(e.name) - +!Y.test(t.name);
99
105
  if (n !== 0) return n;
100
- const r = Z(e.name) - Z(t.name);
106
+ const r = Q(e.name) - Q(t.name);
101
107
  if (r !== 0) return r;
102
108
  const o = P.compare(e.name, t.name);
103
109
  return o !== 0 ? o : P.compare(e.path, t.path);
104
- }, jt = (e) => {
110
+ }, Ct = (e) => {
105
111
  let t = null;
106
112
  for (const n of e)
107
- J(n) && (t === null || Ce(n, t) < 0) && (t = n);
113
+ G(n) && (t === null || Ce(n, t) < 0) && (t = n);
108
114
  return t === null ? null : t.path;
109
- }, Q = Object.freeze({
115
+ }, ee = Object.freeze({
110
116
  sortMode: "native",
111
117
  folderPlacement: "mixed",
112
118
  readmePlacement: "mixed",
@@ -176,25 +182,25 @@ const R = (e) => {
176
182
  p("expandIcons", "settingExpandIcons"),
177
183
  p("directoryIcons", "settingDirectoryIcons"),
178
184
  p("fileIcons", "settingFileIcons")
179
- ]), Ct = (e) => e ? b : b.filter((t) => !t.requiresItemSelection), me = (e) => {
185
+ ]), Mt = (e) => e ? b : b.filter((t) => !t.requiresItemSelection), me = (e) => {
180
186
  const t = b.find((n) => n.key === e);
181
187
  if (t === void 0) throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);
182
188
  return t;
183
- }, Mt = (e, t) => {
189
+ }, Dt = (e, t) => {
184
190
  const n = me(t).values, r = n[(n.indexOf(e[t]) + 1) % n.length];
185
191
  return { ...e, [t]: r };
186
- }, Dt = (e, t, n) => me(n).formatValue(e, t[n]), fe = 2, ee = Object.freeze({}), X = (e, t) => Object.freeze(Object.fromEntries(b.filter((n) => t(n, e[n.key])).map((n) => [n.key, e[n.key]]))), te = "directoriesFirst", ze = (e) => {
187
- if (!Object.hasOwn(e, te)) return e;
188
- const { [te]: t, ...n } = e;
192
+ }, Lt = (e, t, n) => me(n).formatValue(e, t[n]), fe = 2, te = Object.freeze({}), K = (e, t) => Object.freeze(Object.fromEntries(b.filter((n) => t(n, e[n.key])).map((n) => [n.key, e[n.key]]))), ne = "directoriesFirst", ze = (e) => {
193
+ if (!Object.hasOwn(e, ne)) return e;
194
+ const { [ne]: t, ...n } = e;
189
195
  return Object.hasOwn(n, "folderPlacement") || typeof t != "boolean" ? n : { ...n, folderPlacement: t ? "first" : "mixed" };
190
- }, Lt = (e) => {
191
- if (e === null || typeof e != "object" || Array.isArray(e)) return ee;
196
+ }, zt = (e) => {
197
+ if (e === null || typeof e != "object" || Array.isArray(e)) return te;
192
198
  const t = e;
193
- return t.version !== fe || t.settings === null || typeof t.settings != "object" || Array.isArray(t.settings) ? ee : X(ze(t.settings), (n, r) => n.values.includes(r));
194
- }, zt = (e, t) => {
195
- const n = X(t, (r, o) => o !== void 0 && o !== e[r.key]);
199
+ return t.version !== fe || t.settings === null || typeof t.settings != "object" || Array.isArray(t.settings) ? te : K(ze(t.settings), (n, r) => n.values.includes(r));
200
+ }, Ft = (e, t) => {
201
+ const n = K(t, (r, o) => o !== void 0 && o !== e[r.key]);
196
202
  return Object.keys(n).length === 0 ? e : Object.freeze({ ...e, ...n });
197
- }, Ft = (e, t, n, r) => X({ ...e, [t]: n }, (o, s) => s !== void 0 && !(o.key === t && s === r[t])), Ut = (e) => JSON.stringify({ version: fe, settings: e }), Fe = (e, t, n) => e === void 0 || t === void 0 ? e === t ? 0 : e === void 0 ? 1 : -1 : n * (e - t), Vt = (e) => {
203
+ }, Ut = (e, t, n, r) => K({ ...e, [t]: n }, (o, s) => s !== void 0 && !(o.key === t && s === r[t])), Vt = (e) => JSON.stringify({ version: fe, settings: e }), Fe = (e, t, n) => e === void 0 || t === void 0 ? e === t ? 0 : e === void 0 ? 1 : -1 : n * (e - t), Jt = (e) => {
198
204
  const { sortMode: t, folderPlacement: n, readmePlacement: r } = e;
199
205
  if (t === "native" && n === "mixed" && r === "mixed") return;
200
206
  const o = (s, i) => {
@@ -204,8 +210,8 @@ const R = (e) => {
204
210
  return (s, i) => {
205
211
  if (n !== "mixed" && s.type !== i.type) return s.type === "directory" == (n === "first") ? -1 : 1;
206
212
  if (r !== "mixed") {
207
- const l = J(s);
208
- if (l !== J(i)) return l === (r === "first") ? -1 : 1;
213
+ const l = G(s);
214
+ if (l !== G(i)) return l === (r === "first") ? -1 : 1;
209
215
  }
210
216
  if (t === "native") return 0;
211
217
  if (t === "asc") return o(s, i);
@@ -213,10 +219,10 @@ const R = (e) => {
213
219
  const a = Fe(s.modifiedAt, i.modifiedAt, t === "oldest" ? 1 : -1);
214
220
  return a !== 0 ? a : o(s, i);
215
221
  };
216
- }, h = (1 + Math.sqrt(5)) / 2, Jt = 100 / h ** 3, Gt = 100 / h ** 4, ue = 100 / h ** 2, Ue = 13, Bt = 16, Wt = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), Ve = Object.freeze([89, 144, 233, 377]), Je = 44, Xt = Je, Kt = 24, Ht = 1 / h, qt = 1 / h ** 3, Yt = "40ch", Ge = (e) => {
222
+ }, h = (1 + Math.sqrt(5)) / 2, Gt = 100 / h ** 3, Bt = 100 / h ** 4, ue = 100 / h ** 2, Ue = 13, Wt = 16, Xt = Object.freeze({ gripThickness: 5, gripLength: 34, barThickness: 2, barLength: 21 }), Ve = Object.freeze([89, 144, 233, 377]), Je = 44, Kt = Je, Ht = 24, qt = 1 / h, Yt = 1 / h ** 3, Zt = "40ch", Ge = (e) => {
217
223
  if (!Number.isFinite(e) || e <= 0)
218
224
  throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`);
219
- }, Be = (e) => (Ge(e), Ue * e), Zt = (e) => Be(e) * h ** 2, Qt = 233, en = 50, We = 100 / h ** 3, tn = 100 - We, nn = Ve[0], w = (e, t) => {
225
+ }, Be = (e) => (Ge(e), Ue * e), Qt = (e) => Be(e) * h ** 2, en = 233, tn = 50, We = 100 / h ** 3, nn = 100 - We, rn = Ve[0], w = (e, t) => {
220
226
  if (!Number.isFinite(t) || t < 0)
221
227
  throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`);
222
228
  }, Xe = ({ trackInlineSize: e, gap: t, minColumnInlineSize: n, logicalColumns: r }) => {
@@ -226,55 +232,55 @@ const R = (e) => {
226
232
  throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(r)}`);
227
233
  const o = Math.floor((e + t) / (n + t));
228
234
  return Math.min(r, Math.max(1, o));
229
- }, rn = (e, t) => {
235
+ }, on = (e, t) => {
230
236
  const { trackInlineSize: n, gap: r, minColumnInlineSize: o, logicalColumns: s } = t;
231
237
  if (!([n, r, o].every(Number.isFinite) && n > 0 && r >= 0 && o > 0)) return e;
232
238
  const a = Xe(t);
233
239
  if (e === null || a === e) return a;
234
240
  const l = Math.min(s, Math.max(1, e));
235
241
  if (a > l) {
236
- const C = (l + 1) * o + l * r + r / h;
237
- return n >= C ? a : l;
242
+ const M = (l + 1) * o + l * r + r / h;
243
+ return n >= M ? a : l;
238
244
  }
239
245
  return n >= l * o + (l - 1) * r ? l : a;
240
- }, on = (e, t) => {
246
+ }, sn = (e, t) => {
241
247
  if (!(Number.isInteger(e) && Number.isInteger(t)) || t < 1 || t > e)
242
248
  throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);
243
249
  return Array.from({ length: t }, (n, r) => [Math.floor(r * e / t), Math.floor((r + 1) * e / t)]);
244
- }, sn = (e, t, n) => {
250
+ }, an = (e, t, n) => {
245
251
  if (w("surfaceInlineSize", e), w("handlePixels", n), !Number.isFinite(t) || t <= 0)
246
252
  throw new RangeError(`[markdown-explorer] measure must be a finite number > 0; got ${String(t)}`);
247
253
  return e >= 2 * t + n ? "beside" : "stacked";
248
- }, V = (e, t, n) => Math.max(t, Math.min(e, n)), ne = (e, t, n, r) => {
249
- const o = (V(e, 0, n) + V(t, 0, n)) / 2;
250
- return V(o - r / 2, 0, n - r);
251
- }, an = (e, t, n) => {
254
+ }, J = (e, t, n) => Math.max(t, Math.min(e, n)), re = (e, t, n, r) => {
255
+ const o = (J(e, 0, n) + J(t, 0, n)) / 2;
256
+ return J(o - r / 2, 0, n - r);
257
+ }, cn = (e, t, n) => {
252
258
  for (const [r, o] of Object.entries(e))
253
259
  if (!Number.isFinite(o)) throw new RangeError(`[markdown-explorer] anchor.${r} must be a finite number; got ${String(o)}`);
254
260
  return w("marginBox.width", t.width), w("marginBox.height", t.height), w("viewport.width", n.width), w("viewport.height", n.height), {
255
- left: ne(e.left, e.right, n.width, t.width),
256
- top: ne(e.top, e.bottom, n.height, t.height)
261
+ left: re(e.left, e.right, n.width, t.width),
262
+ top: re(e.top, e.bottom, n.height, t.height)
257
263
  };
258
264
  }, Ke = 31536e3, He = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u, qe = (e) => {
259
265
  if (typeof e != "string" || !He.test(e))
260
266
  throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`);
261
- }, re = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= ue, Ye = (e, t) => {
267
+ }, oe = (e) => typeof e == "number" && Number.isFinite(e) && e > 0 && e <= ue, Ye = (e, t) => {
262
268
  if (e === null || typeof e != "object" || Array.isArray(e)) return {};
263
269
  const n = e, { treeExplorer: r, multiExplorer: o, style: s, align: i } = n;
264
270
  return {
265
- ...re(r) ? { treeExplorer: r } : {},
266
- ...re(o) ? { multiExplorer: o } : {},
271
+ ...oe(r) ? { treeExplorer: r } : {},
272
+ ...oe(o) ? { multiExplorer: o } : {},
267
273
  ...typeof s == "string" && t.includes(s) ? { style: s } : {},
268
274
  ...typeof i == "string" && N.includes(i) ? { align: i } : {}
269
275
  };
270
- }, cn = (e, t) => {
276
+ }, ln = (e, t) => {
271
277
  if (e !== null)
272
278
  for (const n of e.split(";")) {
273
279
  const r = n.indexOf("=");
274
280
  if (!(r < 0) && n.slice(0, r).trim() === t)
275
281
  return n.slice(r + 1).trim();
276
282
  }
277
- }, ln = (e, t) => {
283
+ }, dn = (e, t) => {
278
284
  if (e === void 0 || e === "") return {};
279
285
  try {
280
286
  return Ye(JSON.parse(decodeURIComponent(e)), t);
@@ -291,11 +297,11 @@ const R = (e) => {
291
297
  ...e.align === void 0 ? {} : { align: e.align }
292
298
  })
293
299
  );
294
- }, dn = (e, t, n) => `${e}=${Qe(t)}; Path=/; Max-Age=${String(Ke)}; SameSite=Lax${n ? "; Secure" : ""}`, oe = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), et = Object.freeze({ default: 12, min: 1, max: 64 }), tt = Object.freeze({ default: 4, min: 1, max: 6 }), nt = Object.freeze({ default: 500, min: 1, max: 1e4 }), rt = Object.freeze({ default: 16, min: 1, max: 64 }), ot = Object.freeze({ default: 16, min: 1, max: 64 }), st = Object.freeze({ default: 2 * 1024 * 1024, min: 1, max: 256 * 1024 * 1024 }), it = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, at = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, ct = /^[a-z0-9][a-z0-9-]*$/u, lt = /^(?=.{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, se = (e, t) => {
300
+ }, mn = (e, t, n) => `${e}=${Qe(t)}; Path=/; Max-Age=${String(Ke)}; SameSite=Lax${n ? "; Secure" : ""}`, se = Object.freeze({ tree: "tree", multi: "multi", single: "single" }), et = Object.freeze({ default: 12, min: 1, max: 64 }), tt = Object.freeze({ default: 4, min: 1, max: 6 }), nt = Object.freeze({ default: 500, min: 1, max: 1e4 }), rt = Object.freeze({ default: 16, min: 1, max: 64 }), ot = Object.freeze({ default: 16, min: 1, max: 64 }), st = Object.freeze({ default: 2 * 1024 * 1024, min: 1, max: 256 * 1024 * 1024 }), it = /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u, at = /^[A-Za-z0-9][A-Za-z0-9_-]*$/u, ct = /^[a-z0-9][a-z0-9-]*$/u, lt = /^(?=.{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, ie = (e, t) => {
295
301
  if (typeof t != "string") throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);
296
302
  if (!it.test(t) || t.split("/").some((n) => n === "." || n === ".."))
297
303
  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)}`);
298
- }, m = (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" ? R(e) ? "a plain object" : `a non-plain object (${Object.prototype.toString.call(e)})` : String(e), ie = Object.freeze(
304
+ }, m = (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" ? R(e) ? "a plain object" : `a non-plain object (${Object.prototype.toString.call(e)})` : String(e), ae = Object.freeze(
299
305
  Object.keys({
300
306
  basePath: !0,
301
307
  dataPath: !0,
@@ -319,20 +325,20 @@ const R = (e) => {
319
325
  if (!n.includes(o)) throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${n.join(", ")}`);
320
326
  return r.filter(([, o]) => o !== void 0);
321
327
  }, dt = (e) => {
322
- const t = { ...oe };
323
- for (const [n, r] of S("views", e, Object.keys(oe))) t[n] = r;
328
+ const t = { ...se };
329
+ for (const [n, r] of S("views", e, Object.keys(se))) t[n] = r;
324
330
  for (const [n, r] of Object.entries(t))
325
331
  if (typeof r != "string" || !at.test(r))
326
332
  throw new RangeError(`[markdown-explorer] views.${n} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(r)}`);
327
333
  return Object.freeze(t);
328
- }, x = (e, t, n) => {
334
+ }, y = (e, t, n) => {
329
335
  if (t === void 0) return n.default;
330
336
  if (typeof t != "number" || !Number.isInteger(t) || t < n.min || t > n.max)
331
337
  throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(n.min)}..${String(n.max)}; got ${m(t)}`);
332
338
  return t;
333
339
  }, mt = (e, t) => {
334
340
  const n = new Map(S("embeds", e, ["providers", "linkCards", "linkCardSize"]));
335
- if (n.size === 0) return xe;
341
+ if (n.size === 0) return ye;
336
342
  const r = n.has("providers") ? n.get("providers") : [];
337
343
  if (!Array.isArray(r)) throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${m(r)}`);
338
344
  for (const a of r)
@@ -348,7 +354,7 @@ const R = (e) => {
348
354
  }, ft = (e) => {
349
355
  if (e === void 0) return null;
350
356
  if (typeof e != "string") throw new TypeError(`[markdown-explorer] legacyTextEncoding must be a string; got ${m(e)}`);
351
- return le(e);
357
+ return de(e);
352
358
  }, ut = (e) => {
353
359
  const t = new Map(
354
360
  S(
@@ -357,8 +363,8 @@ const R = (e) => {
357
363
  b.map((r) => r.key)
358
364
  )
359
365
  );
360
- if (t.size === 0) return Q;
361
- const n = { ...Q };
366
+ if (t.size === 0) return ee;
367
+ const n = { ...ee };
362
368
  for (const r of b) {
363
369
  if (!t.has(r.key)) continue;
364
370
  const o = t.get(r.key), s = r.values;
@@ -369,8 +375,8 @@ const R = (e) => {
369
375
  }, gt = (e) => {
370
376
  if (e === null || typeof e != "object") throw new TypeError("[markdown-explorer] the explorer configuration must be an object");
371
377
  for (const c of Object.keys(e))
372
- if (!ie.includes(c)) throw new RangeError(`[markdown-explorer] ${c} is not an option of the explorer configuration; expected ${ie.join(", ")}`);
373
- se("basePath", e.basePath), se("dataPath", e.dataPath);
378
+ if (!ae.includes(c)) throw new RangeError(`[markdown-explorer] ${c} is not an option of the explorer configuration; expected ${ae.join(", ")}`);
379
+ ie("basePath", e.basePath), ie("dataPath", e.dataPath);
374
380
  const t = dt(e.views);
375
381
  if ((/* @__PURE__ */ new Set([t.tree, t.multi, t.single])).size !== 3)
376
382
  throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);
@@ -399,22 +405,22 @@ const R = (e) => {
399
405
  settingsCookie: e.settingsCookie,
400
406
  views: t,
401
407
  multiView: Object.freeze({
402
- maxPanels: x("multiView.maxPanels", r.maxPanels, et),
403
- columns: x("multiView.columns", r.columns, tt)
408
+ maxPanels: y("multiView.maxPanels", r.maxPanels, et),
409
+ columns: y("multiView.columns", r.columns, tt)
404
410
  }),
405
411
  expandAll: Object.freeze({
406
- maxFolders: x("expandAll.maxFolders", o.maxFolders, nt),
407
- maxDepth: x("expandAll.maxDepth", o.maxDepth, rt)
412
+ maxFolders: y("expandAll.maxFolders", o.maxFolders, nt),
413
+ maxDepth: y("expandAll.maxDepth", o.maxDepth, rt)
408
414
  }),
409
- revealDocument: Object.freeze({ maxDepth: x("revealDocument.maxDepth", s.maxDepth, ot) }),
415
+ revealDocument: Object.freeze({ maxDepth: y("revealDocument.maxDepth", s.maxDepth, ot) }),
410
416
  documentStyles: Object.freeze(a.map((c) => Object.freeze({ name: c.name, className: c.className }))),
411
417
  iframeHosts: Object.freeze([...new Set(n)]),
412
418
  embeds: mt(e.embeds, e.dataPath),
413
419
  defaultTreeSettings: ut(e.defaultTreeSettings),
414
420
  legacyTextEncoding: ft(e.legacyTextEncoding),
415
- spreadsheets: Object.freeze({ maxBytes: x("spreadsheets.maxBytes", i.maxBytes, st) })
421
+ spreadsheets: Object.freeze({ maxBytes: y("spreadsheets.maxBytes", i.maxBytes, st) })
416
422
  });
417
- }, mn = (e) => {
423
+ }, fn = (e) => {
418
424
  const t = e.embeds;
419
425
  if (!R(t)) throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${m(t)}`);
420
426
  if (Object.hasOwn(t, "linkCards"))
@@ -429,37 +435,37 @@ const R = (e) => {
429
435
  throw new RangeError(`[markdown-explorer] config.legacyTextEncoding must be ${m(s.legacyTextEncoding)} (the written name of the encoding it names); got ${m(n)}`);
430
436
  const i = e;
431
437
  for (const [a, l] of Object.entries(s)) {
432
- const c = G(i[a], l, a);
438
+ const c = B(i[a], l, a);
433
439
  if (c !== null)
434
440
  throw c.kind === "extra" ? new RangeError(`[markdown-explorer] config.${c.path} is not a key of what defineExplorerConfig resolves; got ${m(c.given)} there`) : new RangeError(`[markdown-explorer] config.${c.path} must be what defineExplorerConfig resolves; got ${m(c.given)} where it resolves ${m(c.resolved)}`);
435
441
  }
436
442
  return s;
437
- }, G = (e, t, n) => {
443
+ }, B = (e, t, n) => {
438
444
  if (Object.is(e, t)) return null;
439
445
  if (Array.isArray(t)) {
440
446
  if (!Array.isArray(e)) return { kind: "value", path: n, given: e, resolved: t };
441
447
  if (e.length !== t.length) return { kind: "value", path: `${n}.length`, given: e.length, resolved: t.length };
442
448
  for (const [o, s] of t.entries()) {
443
- const i = G(e[o], s, `${n}[${String(o)}]`);
449
+ const i = B(e[o], s, `${n}[${String(o)}]`);
444
450
  if (i !== null) return i;
445
451
  }
446
452
  return null;
447
453
  }
448
454
  if (!(R(t) && R(e))) return { kind: "value", path: n, given: e, resolved: t };
449
455
  for (const o of Object.keys(t)) {
450
- const s = G(Object.hasOwn(e, o) ? e[o] : void 0, t[o], `${n}.${o}`);
456
+ const s = B(Object.hasOwn(e, o) ? e[o] : void 0, t[o], `${n}.${o}`);
451
457
  if (s !== null) return s;
452
458
  }
453
459
  const r = Object.keys(e).find((o) => !Object.hasOwn(t, o));
454
460
  return r === void 0 ? null : { kind: "extra", path: `${n}.${r}`, given: e[r] };
455
- }, wt = (e) => typeof e == "string" && ct.test(e), fn = (e, t) => {
461
+ }, wt = (e) => typeof e == "string" && ct.test(e), un = (e, t) => {
456
462
  if (e === null || typeof e != "object") throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${m(e)}`);
457
463
  if (!Array.isArray(t) || t.length === 0) throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${m(t)}`);
458
464
  for (const n of t)
459
465
  if (!wt(n)) throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${m(n)}`);
460
466
  if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);
461
467
  return Object.freeze({ ...e, sourceIds: Object.freeze([...t]) });
462
- }, un = (e) => e.documentStyles.map((t) => t.name), d = Object.freeze({
468
+ }, gn = (e) => e.documentStyles.map((t) => t.name), d = Object.freeze({
463
469
  source: "source",
464
470
  doc: "doc",
465
471
  maximized: "maximized",
@@ -472,9 +478,9 @@ const R = (e) => {
472
478
  width: "width",
473
479
  maxWidth: "maxWidth",
474
480
  markup: "markup"
475
- }), ge = "true", j = "/", ae = ".data", we = 256, he = /^\d+(?:\.\d+)?$/u, B = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, Ee = Object.freeze(["showToc", "showStyle", "showAlign"]), ce = (e) => {
481
+ }), ge = "true", j = "/", ce = ".data", we = 256, he = /^\d+(?:\.\d+)?$/u, W = /^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u, Ee = Object.freeze(["showToc", "showStyle", "showAlign"]), le = (e) => {
476
482
  const t = encodeURIComponent(e.replaceAll("%", "%25"));
477
- return t.endsWith(ae) ? `${t.slice(0, -ae.length)}%2Edata` : t;
483
+ return t.endsWith(ce) ? `${t.slice(0, -ce.length)}%2Edata` : t;
478
484
  }, ht = (e) => e.replaceAll("%25", "%"), pe = (e) => {
479
485
  const { sourceIds: t } = e;
480
486
  if (t === void 0) throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");
@@ -497,22 +503,22 @@ const R = (e) => {
497
503
  ...e.get(d.showStyle) === "false" ? { showStyle: !1 } : {},
498
504
  ...e.get(d.showAlign) === "false" ? { showAlign: !1 } : {},
499
505
  ...Se(n) ? { padding: n } : {},
500
- ...r !== null && B.test(r) ? { width: r } : {},
501
- ...o !== null && B.test(o) ? { maxWidth: o } : {}
506
+ ...r !== null && W.test(r) ? { width: r } : {},
507
+ ...o !== null && W.test(o) ? { maxWidth: o } : {}
502
508
  };
503
- }, yt = (e, t) => [...new Set(t.filter($))].slice(0, e.multiView.maxPanels), xt = (e, t, n, r) => {
504
- for (const s of t) K(s);
509
+ }, xt = (e, t) => [...new Set(t.filter($))].slice(0, e.multiView.maxPanels), yt = (e, t, n, r) => {
510
+ for (const s of t) H(s);
505
511
  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`);
506
512
  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)}`);
507
513
  if (n !== null && !t.includes(n)) throw new RangeError(`[markdown-explorer] the maximized document must be one of the open documents; got ${JSON.stringify(n.slice(0, 80))}`);
508
514
  if (new Set(r).size !== r.length) throw new RangeError(`[markdown-explorer] the documents shown as written must each appear once; got ${String(r.length)} with repeats`);
509
515
  const o = r.find((s) => !t.includes(s));
510
516
  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))}`);
511
- }, K = (e) => {
517
+ }, H = (e) => {
512
518
  if (!$(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0, 80))}`);
513
519
  return e;
514
520
  }, bt = (e) => {
515
- if (K(e).endsWith(j)) 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))}`);
521
+ if (H(e).endsWith(j)) 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))}`);
516
522
  return e;
517
523
  }, Ot = (e, t) => {
518
524
  if (t.style !== void 0 && !e.documentStyles.some((n) => n.name === t.style))
@@ -525,21 +531,21 @@ const R = (e) => {
525
531
  if (e.padding !== void 0 && !Se(e.padding)) throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(we)} px in plain decimal digits; got ${String(e.padding)}`);
526
532
  for (const t of ["width", "maxWidth"]) {
527
533
  const n = e[t];
528
- if (n !== void 0 && !B.test(n)) throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(n)}`);
534
+ if (n !== void 0 && !W.test(n)) throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(n)}`);
529
535
  }
530
536
  }, Tt = (e, t) => {
531
537
  const n = new URLSearchParams();
532
538
  let r = `${e.basePath}/${e.views[t.view]}`;
533
539
  if (t.view === "multi") {
534
540
  const s = t.docs ?? [], i = t.maximized ?? null, a = t.markup ?? [];
535
- xt(e, s, i, a);
541
+ yt(e, s, i, a);
536
542
  for (const l of s) n.append(d.doc, l);
537
543
  i !== null && n.set(d.maximized, i);
538
544
  for (const l of s) a.includes(l) && n.append(d.markup, l);
539
545
  } else {
540
546
  const s = t.doc ?? null, i = t.view === "tree" ? t.folder ?? null : null;
541
547
  if (s !== null && i !== null) throw new RangeError("[markdown-explorer] a tree view shows a document or a folder, not both");
542
- s !== null && (r += `/${ce(bt(s))}`), i !== null && (r += `/${ce(`${K(i)}${j}`)}`);
548
+ s !== null && (r += `/${le(bt(s))}`), i !== null && (r += `/${le(`${H(i)}${j}`)}`);
543
549
  }
544
550
  if (t.source !== void 0) {
545
551
  const s = pe(e);
@@ -558,18 +564,18 @@ const R = (e) => {
558
564
  }
559
565
  const o = n.toString();
560
566
  return o === "" ? r : `${r}?${o}`;
561
- }, Rt = (e, t) => Object.keys(e.views).find((n) => e.views[n] === t), gn = (e, t, n) => {
567
+ }, Rt = (e, t) => Object.keys(e.views).find((n) => e.views[n] === t), wn = (e, t, n) => {
562
568
  const r = pe(e), [o] = r;
563
569
  if (o === void 0) throw new RangeError("[markdown-explorer] the configuration has no source");
564
570
  const s = Et(r, o, n), i = s === null ? o : s, a = (f) => ({ kind: "redirect", href: Tt(e, f), location: f }), l = () => a({ view: "tree", source: i, doc: null, folder: null, overrides: {}, markup: !1 });
565
571
  if (t === void 0 || t === "") return l();
566
- const c = t.indexOf("/"), C = c < 0 ? t : t.slice(0, c), M = c < 0 ? null : t.slice(c + 1), E = Rt(e, C);
572
+ const c = t.indexOf("/"), M = c < 0 ? t : t.slice(0, c), D = c < 0 ? null : t.slice(c + 1), E = Rt(e, M);
567
573
  if (E === void 0) return l();
568
574
  if (E === "multi") {
569
- const f = n.getAll(d.doc), y = yt(e, f), D = n.getAll(d.maximized), [L] = D, z = D.length === 1 && L !== void 0 && y.includes(L) ? L : null, F = n.getAll(d.markup), I = y.filter((T) => F.includes(T)), ye = I.length === F.length && I.every((T, U) => T === F[U]);
570
- return M === null && s !== null && y.length === f.length && y.every((T, U) => T === f[U]) && (D.length === 0 || z !== null) && ye ? { kind: "location", location: { view: "multi", source: i, docs: y, maximized: z, markup: I } } : a({ view: "multi", source: i, docs: y, maximized: z, markup: I });
575
+ const f = n.getAll(d.doc), x = xt(e, f), L = n.getAll(d.maximized), [z] = L, F = L.length === 1 && z !== void 0 && x.includes(z) ? z : null, U = n.getAll(d.markup), I = x.filter((T) => U.includes(T)), xe = I.length === U.length && I.every((T, V) => T === U[V]);
576
+ return D === null && s !== null && x.length === f.length && x.every((T, V) => T === f[V]) && (L.length === 0 || F !== null) && xe ? { kind: "location", location: { view: "multi", source: i, docs: x, maximized: F, markup: I } } : a({ view: "multi", source: i, docs: x, maximized: F, markup: I });
571
577
  }
572
- const _ = M === null ? null : ht(M), u = _?.endsWith(j) === !0 ? _.slice(0, -j.length) : null, g = _ !== null && u === null ? _ : null;
578
+ const _ = D === null ? null : ht(D), u = _?.endsWith(j) === !0 ? _.slice(0, -j.length) : null, g = _ !== null && u === null ? _ : null;
573
579
  if (g !== null && !$(g) || u !== null && !$(u)) return l();
574
580
  const O = pt(e, n), k = (g !== null || u !== null) && n.get(d.markup) === ge;
575
581
  if (E === "single") {
@@ -581,63 +587,64 @@ const R = (e) => {
581
587
  return s === null ? a({ view: E, source: i, doc: g, folder: u, overrides: O, markup: k }) : { kind: "location", location: { view: E, source: i, doc: g, folder: u, overrides: O, markup: k } };
582
588
  };
583
589
  export {
584
- Ue as $,
585
- Jt as A,
590
+ nt as $,
591
+ ue as A,
586
592
  Gt as B,
587
- Xt as C,
593
+ Kt as C,
588
594
  Bt as D,
589
- tn as E,
590
- Kt as F,
591
- en as G,
592
- an as H,
593
- jt as I,
594
- nn as J,
595
- h as K,
596
- At as L,
597
- Ft as M,
595
+ nn as E,
596
+ Ht as F,
597
+ Wt as G,
598
+ tn as H,
599
+ cn as I,
600
+ Ct as J,
601
+ rn as K,
602
+ h as L,
603
+ At as M,
598
604
  P as N,
599
- Mt as O,
600
- Ht as P,
601
- zt as Q,
602
- Ut as R,
603
- Qt as S,
604
- ee as T,
605
- Lt as U,
606
- dn as V,
607
- Yt as W,
608
- Q as X,
609
- oe as Y,
610
- rt as Z,
611
- nt as _,
605
+ Ut as O,
606
+ qt as P,
607
+ Dt as Q,
608
+ Ft as R,
609
+ en as S,
610
+ Vt as T,
611
+ te as U,
612
+ zt as V,
613
+ mn as W,
614
+ Zt as X,
615
+ ee as Y,
616
+ se as Z,
617
+ rt as _,
612
618
  We as a,
613
- tt as a0,
614
- et as a1,
615
- ot as a2,
616
- st as a3,
617
- gt as a4,
618
- Wt as b,
619
- yt as c,
620
- sn as d,
619
+ Ue as a0,
620
+ tt as a1,
621
+ et as a2,
622
+ ot as a3,
623
+ st as a4,
624
+ gt as a5,
625
+ Xt as b,
626
+ xt as c,
627
+ an as d,
621
628
  Tt as e,
622
- vt as f,
623
- un as g,
624
- gn as h,
629
+ jt as f,
630
+ gn as g,
631
+ wn as h,
625
632
  wt as i,
626
- cn as j,
633
+ ln as j,
627
634
  R as k,
628
- le as l,
635
+ de as l,
629
636
  Pt as m,
630
- on as n,
631
- rn as o,
632
- ln as p,
633
- qt as q,
634
- mn as r,
637
+ sn as n,
638
+ on as o,
639
+ dn as p,
640
+ Yt as q,
641
+ fn as r,
635
642
  Je as s,
636
- Vt as t,
637
- Dt as u,
638
- Ct as v,
639
- fn as w,
640
- Zt as x,
641
- Be as y,
642
- ue as z
643
+ vt as t,
644
+ Jt as u,
645
+ Lt as v,
646
+ un as w,
647
+ Mt as x,
648
+ Qt as y,
649
+ Be as z
643
650
  };
@@ -1,5 +1,5 @@
1
1
  import { diff3Merge as d } from "node-diff3";
2
- import { C, a as R, b as u } from "./index-BhxsL0Sm.js";
2
+ import { C, a as R, b as u } from "./index-Bd6hgisa.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-ZdsIXJap.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-B6FkGD-p.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(`