@aiquants/markdown-explorer 0.22.0 → 0.24.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 (58) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/README.md +63 -17
  3. package/dist/{EditSurface-BesNcSQj.cjs → EditSurface-CRc4g0Qa.cjs} +5 -5
  4. package/dist/{EditSurface-DNjI8pV3.js → EditSurface-CcWEczj3.js} +333 -336
  5. package/dist/{ExplorerSplit-GUdzpDPg.js → ExplorerSplit-97SeIAOS.js} +81 -81
  6. package/dist/{ExplorerSplit-B4oNvydP.cjs → ExplorerSplit-ByxxXlgs.cjs} +1 -1
  7. package/dist/{MultiLayout-DtKChQ_s.cjs → MultiLayout-B_yMVDt_.cjs} +1 -1
  8. package/dist/{MultiLayout-BJ-s6AaD.js → MultiLayout-CnbuAlxd.js} +4 -4
  9. package/dist/{NativeScrollBar-D10fsk-7.js → NativeScrollBar-BXdaM3EA.js} +1 -1
  10. package/dist/{NativeScrollBar-DJKlPWvD.cjs → NativeScrollBar-D4a7fBOS.cjs} +1 -1
  11. package/dist/{TreeLayout-DQT5p2vI.js → TreeLayout-BIQBKAkV.js} +3 -3
  12. package/dist/{TreeLayout-C1mTmoPp.cjs → TreeLayout-C6QDpEBS.cjs} +1 -1
  13. package/dist/core/config.d.cts +13 -0
  14. package/dist/core/config.d.ts +13 -0
  15. package/dist/core/contracts.d.cts +29 -4
  16. package/dist/core/contracts.d.ts +29 -4
  17. package/dist/core/labels.d.cts +21 -0
  18. package/dist/core/labels.d.ts +21 -0
  19. package/dist/core/textEncoding.d.cts +4 -0
  20. package/dist/core/textEncoding.d.ts +4 -0
  21. package/dist/{dataRoute-CObbjNxG.js → dataRoute-BEvesOvN.js} +108 -99
  22. package/dist/dataRoute-Cv7fgCW7.cjs +1 -0
  23. package/dist/index-BwTVYkTR.cjs +13 -0
  24. package/dist/index-CeZDCyEl.js +4088 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.cts +2 -2
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +24 -23
  29. package/dist/location-CasigkBk.cjs +1 -0
  30. package/dist/location-gXXmC7CQ.js +643 -0
  31. package/dist/{merge-DauzoA2W.js → merge-DqjUgcV_.js} +1 -1
  32. package/dist/{merge-CTkzzHtn.cjs → merge-QLktbpZY.cjs} +1 -1
  33. package/dist/{sanitizePolicy-gEXeavb-.cjs → sanitizePolicy-CZwOaJ92.cjs} +1 -1
  34. package/dist/{sanitizePolicy-BWQtWhsL.js → sanitizePolicy-gVKBhabq.js} +1 -1
  35. package/dist/sanitizeWorker.cjs +1 -1
  36. package/dist/sanitizeWorker.js +1 -1
  37. package/dist/server/fileSystemSource.d.cts +1 -0
  38. package/dist/server/fileSystemSource.d.ts +1 -0
  39. package/dist/server/ports.d.cts +9 -1
  40. package/dist/server/ports.d.ts +9 -1
  41. package/dist/server.cjs +1 -1
  42. package/dist/server.d.cts +1 -0
  43. package/dist/server.d.ts +1 -0
  44. package/dist/server.js +852 -834
  45. package/dist/styles/markdown-explorer.css +1 -1
  46. package/dist/{useSplitPersistence-Cc4tDxB4.js → useSplitPersistence-BPNjvuJi.js} +1 -1
  47. package/dist/{useSplitPersistence-Ba-v64n-.cjs → useSplitPersistence-Bmpb2prR.cjs} +1 -1
  48. package/docs/behavior/dom-hooks.md +13 -6
  49. package/docs/behavior/layout.md +22 -8
  50. package/docs/behavior/localization.md +9 -5
  51. package/docs/behavior/security.md +6 -4
  52. package/docs/behavior/url-contract.md +2 -2
  53. package/package.json +5 -5
  54. package/dist/dataRoute-BONacTPi.cjs +0 -1
  55. package/dist/index-0pnuyLUO.js +0 -3662
  56. package/dist/index-T98wklgM.cjs +0 -13
  57. package/dist/location-B-m9scLf.js +0 -499
  58. package/dist/location-BVEN_Ihk.cjs +0 -1
@@ -0,0 +1,643 @@
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";
2
+ import { CONTENT_ALIGNS as N, DEFAULT_MARKDOWN_STYLES as Re } from "@aiquants/markdown/viewer-settings";
3
+ import { a as _e, i as $ } from "./dataRoute-BEvesOvN.js";
4
+ const R = (e) => {
5
+ if (e === null || typeof e != "object") return !1;
6
+ const t = Object.getPrototypeOf(e);
7
+ return t === Object.prototype || t === null;
8
+ }, Ie = Object.freeze([
9
+ "UTF-8",
10
+ "IBM866",
11
+ "ISO-8859-2",
12
+ "ISO-8859-3",
13
+ "ISO-8859-4",
14
+ "ISO-8859-5",
15
+ "ISO-8859-6",
16
+ "ISO-8859-7",
17
+ "ISO-8859-8",
18
+ "ISO-8859-8-I",
19
+ "ISO-8859-10",
20
+ "ISO-8859-13",
21
+ "ISO-8859-14",
22
+ "ISO-8859-15",
23
+ "ISO-8859-16",
24
+ "KOI8-R",
25
+ "KOI8-U",
26
+ "macintosh",
27
+ "windows-874",
28
+ "windows-1250",
29
+ "windows-1251",
30
+ "windows-1252",
31
+ "windows-1253",
32
+ "windows-1254",
33
+ "windows-1255",
34
+ "windows-1256",
35
+ "windows-1257",
36
+ "windows-1258",
37
+ "x-mac-cyrillic",
38
+ "GBK",
39
+ "gb18030",
40
+ "Big5",
41
+ "EUC-JP",
42
+ "ISO-2022-JP",
43
+ "Shift_JIS",
44
+ "EUC-KR",
45
+ "replacement",
46
+ "UTF-16BE",
47
+ "UTF-16LE",
48
+ "x-user-defined"
49
+ ]), Ne = new Map(Ie.map((e) => [e.toLowerCase(), e])), A = "UTF-8", H = Object.freeze([
50
+ Object.freeze({ bytes: Object.freeze([239, 187, 191]), encoding: A }),
51
+ Object.freeze({ bytes: Object.freeze([255, 254]), encoding: "UTF-16LE" }),
52
+ Object.freeze({ bytes: Object.freeze([254, 255]), encoding: "UTF-16BE" })
53
+ ]), $e = /* @__PURE__ */ new Map([
54
+ [A, "is read before any legacy encoding"],
55
+ ["UTF-16LE", "is read only by its byte order mark"],
56
+ ["UTF-16BE", "is read only by its byte order mark"],
57
+ ["ISO-2022-JP", "writes only bytes below 0x80, which UTF-8 always reads first, so it would never be used"],
58
+ ["x-user-defined", "is no text encoding (it maps bytes to private-use characters)"]
59
+ ]), le = (e) => {
60
+ let t;
61
+ try {
62
+ t = new TextDecoder(e).encoding;
63
+ } catch (o) {
64
+ throw o instanceof RangeError ? new RangeError(`[markdown-explorer] legacyTextEncoding ${JSON.stringify(e)} is no encoding label TextDecoder knows (for example "Shift_JIS" or "windows-1252")`) : o;
65
+ }
66
+ const n = Ae(t), r = $e.get(n);
67
+ if (r !== void 0) throw new RangeError(`[markdown-explorer] legacyTextEncoding ${JSON.stringify(e)} names ${n}, which cannot be the legacy encoding: it ${r}`);
68
+ return n;
69
+ }, Ae = (e) => {
70
+ const t = Ne.get(e);
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
+ 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));
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));
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) => {
79
+ try {
80
+ return new TextDecoder(e, { fatal: !0, ignoreBOM: !0 }).decode(t, { stream: !n });
81
+ } catch (r) {
82
+ if (r instanceof TypeError) return null;
83
+ throw r;
84
+ }
85
+ }, Pt = (e, t, n) => de(W(e, t, n), t), de = ({ body: e, encodings: t }, n) => {
86
+ for (const r of t) {
87
+ const o = Pe(r, e, n);
88
+ if (o !== null) return o;
89
+ }
90
+ return null;
91
+ }, 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;
97
+ }, Ce = (e, t) => {
98
+ const n = +!q.test(e.name) - +!q.test(t.name);
99
+ if (n !== 0) return n;
100
+ const r = Z(e.name) - Z(t.name);
101
+ if (r !== 0) return r;
102
+ const o = P.compare(e.name, t.name);
103
+ return o !== 0 ? o : P.compare(e.path, t.path);
104
+ }, jt = (e) => {
105
+ let t = null;
106
+ for (const n of e)
107
+ J(n) && (t === null || Ce(n, t) < 0) && (t = n);
108
+ return t === null ? null : t.path;
109
+ }, Q = Object.freeze({
110
+ sortMode: "native",
111
+ folderPlacement: "mixed",
112
+ readmePlacement: "mixed",
113
+ selectionMode: "single",
114
+ doubleClickAction: "recursive",
115
+ expandIconSize: 8,
116
+ alwaysExpanded: !1,
117
+ revealDocument: !1,
118
+ removeRootIndent: !1,
119
+ lines: !0,
120
+ expandIcons: !0,
121
+ directoryIcons: !0,
122
+ fileIcons: !0
123
+ }), Me = [!0, !1], De = (e, t) => t ? e.settingOn : e.settingOff, p = (e, t) => ({ key: e, labelKey: t, values: Me, formatValue: De, requiresItemSelection: !1 }), Le = Object.freeze({
124
+ native: (e) => e.sortNative,
125
+ asc: (e) => e.sortAscending,
126
+ desc: (e) => e.sortDescending,
127
+ oldest: (e) => e.sortOldest,
128
+ newest: (e) => e.sortNewest
129
+ }), b = Object.freeze([
130
+ {
131
+ key: "sortMode",
132
+ labelKey: "settingSortMode",
133
+ values: ["native", "asc", "desc", "oldest", "newest"],
134
+ formatValue: (e, t) => Le[t](e),
135
+ requiresItemSelection: !1
136
+ },
137
+ {
138
+ key: "folderPlacement",
139
+ labelKey: "settingFolderPlacement",
140
+ values: ["mixed", "first", "last"],
141
+ formatValue: (e, t) => t === "mixed" ? e.folderPlacementMixed : t === "first" ? e.folderPlacementFirst : e.folderPlacementLast,
142
+ requiresItemSelection: !1
143
+ },
144
+ {
145
+ key: "readmePlacement",
146
+ labelKey: "settingReadmePlacement",
147
+ values: ["mixed", "first", "last"],
148
+ formatValue: (e, t) => t === "mixed" ? e.readmePlacementMixed : t === "first" ? e.readmePlacementFirst : e.readmePlacementLast,
149
+ requiresItemSelection: !1
150
+ },
151
+ {
152
+ key: "selectionMode",
153
+ labelKey: "settingSelectionMode",
154
+ values: ["single", "multiple", "none"],
155
+ formatValue: (e, t) => t === "single" ? e.selectionSingle : t === "multiple" ? e.selectionMultiple : e.selectionNone,
156
+ requiresItemSelection: !0
157
+ },
158
+ {
159
+ key: "doubleClickAction",
160
+ labelKey: "settingDoubleClick",
161
+ values: ["recursive", "toggle"],
162
+ formatValue: (e, t) => t === "recursive" ? e.doubleClickRecursive : e.doubleClickToggle,
163
+ requiresItemSelection: !1
164
+ },
165
+ {
166
+ key: "expandIconSize",
167
+ labelKey: "settingExpandIconSize",
168
+ values: [8, 13, 5],
169
+ formatValue: (e, t) => e.expandIconSizeValue(t),
170
+ requiresItemSelection: !1
171
+ },
172
+ p("alwaysExpanded", "settingAlwaysExpanded"),
173
+ p("revealDocument", "settingRevealDocument"),
174
+ p("removeRootIndent", "settingRemoveRootIndent"),
175
+ p("lines", "settingTreeLines"),
176
+ p("expandIcons", "settingExpandIcons"),
177
+ p("directoryIcons", "settingDirectoryIcons"),
178
+ p("fileIcons", "settingFileIcons")
179
+ ]), Ct = (e) => e ? b : b.filter((t) => !t.requiresItemSelection), me = (e) => {
180
+ const t = b.find((n) => n.key === e);
181
+ if (t === void 0) throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);
182
+ return t;
183
+ }, Mt = (e, t) => {
184
+ const n = me(t).values, r = n[(n.indexOf(e[t]) + 1) % n.length];
185
+ 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;
189
+ 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;
192
+ 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]);
196
+ 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) => {
198
+ const { sortMode: t, folderPlacement: n, readmePlacement: r } = e;
199
+ if (t === "native" && n === "mixed" && r === "mixed") return;
200
+ const o = (s, i) => {
201
+ const a = P.compare(s.name, i.name);
202
+ return a !== 0 ? a : P.compare(s.path, i.path);
203
+ };
204
+ return (s, i) => {
205
+ if (n !== "mixed" && s.type !== i.type) return s.type === "directory" == (n === "first") ? -1 : 1;
206
+ if (r !== "mixed") {
207
+ const l = J(s);
208
+ if (l !== J(i)) return l === (r === "first") ? -1 : 1;
209
+ }
210
+ if (t === "native") return 0;
211
+ if (t === "asc") return o(s, i);
212
+ if (t === "desc") return -o(s, i);
213
+ const a = Fe(s.modifiedAt, i.modifiedAt, t === "oldest" ? 1 : -1);
214
+ return a !== 0 ? a : o(s, i);
215
+ };
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) => {
217
+ if (!Number.isFinite(e) || e <= 0)
218
+ 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) => {
220
+ if (!Number.isFinite(t) || t < 0)
221
+ throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`);
222
+ }, Xe = ({ trackInlineSize: e, gap: t, minColumnInlineSize: n, logicalColumns: r }) => {
223
+ if (w("trackInlineSize", e), w("gap", t), !Number.isFinite(n) || n <= 0)
224
+ throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(n)}`);
225
+ if (!Number.isInteger(r) || r < 1)
226
+ throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(r)}`);
227
+ const o = Math.floor((e + t) / (n + t));
228
+ return Math.min(r, Math.max(1, o));
229
+ }, rn = (e, t) => {
230
+ const { trackInlineSize: n, gap: r, minColumnInlineSize: o, logicalColumns: s } = t;
231
+ if (!([n, r, o].every(Number.isFinite) && n > 0 && r >= 0 && o > 0)) return e;
232
+ const a = Xe(t);
233
+ if (e === null || a === e) return a;
234
+ const l = Math.min(s, Math.max(1, e));
235
+ if (a > l) {
236
+ const C = (l + 1) * o + l * r + r / h;
237
+ return n >= C ? a : l;
238
+ }
239
+ return n >= l * o + (l - 1) * r ? l : a;
240
+ }, on = (e, t) => {
241
+ if (!(Number.isInteger(e) && Number.isInteger(t)) || t < 1 || t > e)
242
+ throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);
243
+ return Array.from({ length: t }, (n, r) => [Math.floor(r * e / t), Math.floor((r + 1) * e / t)]);
244
+ }, sn = (e, t, n) => {
245
+ if (w("surfaceInlineSize", e), w("handlePixels", n), !Number.isFinite(t) || t <= 0)
246
+ throw new RangeError(`[markdown-explorer] measure must be a finite number > 0; got ${String(t)}`);
247
+ 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) => {
252
+ for (const [r, o] of Object.entries(e))
253
+ if (!Number.isFinite(o)) throw new RangeError(`[markdown-explorer] anchor.${r} must be a finite number; got ${String(o)}`);
254
+ 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)
257
+ };
258
+ }, Ke = 31536e3, He = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u, qe = (e) => {
259
+ if (typeof e != "string" || !He.test(e))
260
+ 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) => {
262
+ if (e === null || typeof e != "object" || Array.isArray(e)) return {};
263
+ const n = e, { treeExplorer: r, multiExplorer: o, style: s, align: i } = n;
264
+ return {
265
+ ...re(r) ? { treeExplorer: r } : {},
266
+ ...re(o) ? { multiExplorer: o } : {},
267
+ ...typeof s == "string" && t.includes(s) ? { style: s } : {},
268
+ ...typeof i == "string" && N.includes(i) ? { align: i } : {}
269
+ };
270
+ }, cn = (e, t) => {
271
+ if (e !== null)
272
+ for (const n of e.split(";")) {
273
+ const r = n.indexOf("=");
274
+ if (!(r < 0) && n.slice(0, r).trim() === t)
275
+ return n.slice(r + 1).trim();
276
+ }
277
+ }, ln = (e, t) => {
278
+ if (e === void 0 || e === "") return {};
279
+ try {
280
+ return Ye(JSON.parse(decodeURIComponent(e)), t);
281
+ } catch {
282
+ return {};
283
+ }
284
+ }, v = 100, Ze = Math.floor(ue * v) / v, Qe = (e) => {
285
+ const t = (n) => Math.min(Ze, Math.max(1, Math.round(n * v)) / v);
286
+ return encodeURIComponent(
287
+ JSON.stringify({
288
+ ...e.treeExplorer === void 0 ? {} : { treeExplorer: t(e.treeExplorer) },
289
+ ...e.multiExplorer === void 0 ? {} : { multiExplorer: t(e.multiExplorer) },
290
+ ...e.style === void 0 ? {} : { style: e.style },
291
+ ...e.align === void 0 ? {} : { align: e.align }
292
+ })
293
+ );
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) => {
295
+ if (typeof t != "string") throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);
296
+ if (!it.test(t) || t.split("/").some((n) => n === "." || n === ".."))
297
+ 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(
299
+ Object.keys({
300
+ basePath: !0,
301
+ dataPath: !0,
302
+ settingsCookie: !0,
303
+ views: !0,
304
+ multiView: !0,
305
+ expandAll: !0,
306
+ revealDocument: !0,
307
+ documentStyles: !0,
308
+ iframeHosts: !0,
309
+ embeds: !0,
310
+ defaultTreeSettings: !0,
311
+ legacyTextEncoding: !0,
312
+ spreadsheets: !0
313
+ })
314
+ ), S = (e, t, n) => {
315
+ if (t === void 0) return [];
316
+ if (!R(t)) throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${m(t)}`);
317
+ const r = Object.entries(t);
318
+ for (const [o] of r)
319
+ if (!n.includes(o)) throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${n.join(", ")}`);
320
+ return r.filter(([, o]) => o !== void 0);
321
+ }, dt = (e) => {
322
+ const t = { ...oe };
323
+ for (const [n, r] of S("views", e, Object.keys(oe))) t[n] = r;
324
+ for (const [n, r] of Object.entries(t))
325
+ if (typeof r != "string" || !at.test(r))
326
+ 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
+ return Object.freeze(t);
328
+ }, x = (e, t, n) => {
329
+ if (t === void 0) return n.default;
330
+ if (typeof t != "number" || !Number.isInteger(t) || t < n.min || t > n.max)
331
+ throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(n.min)}..${String(n.max)}; got ${m(t)}`);
332
+ return t;
333
+ }, mt = (e, t) => {
334
+ const n = new Map(S("embeds", e, ["providers", "linkCards", "linkCardSize"]));
335
+ if (n.size === 0) return xe;
336
+ const r = n.has("providers") ? n.get("providers") : [];
337
+ if (!Array.isArray(r)) throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${m(r)}`);
338
+ for (const a of r)
339
+ if (!be(a)) throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${Oe.join(", ")}; got ${m(a)}`);
340
+ const o = n.has("linkCards") ? n.get("linkCards") : !1;
341
+ if (typeof o != "boolean") throw new RangeError(`[markdown-explorer] embeds.linkCards must be a boolean; got ${m(o)}`);
342
+ const s = { providers: Object.freeze([...new Set(r)]), linkCardEndpoint: o ? _e(t) : null };
343
+ if (!n.has("linkCardSize")) return Object.freeze(s);
344
+ const i = n.get("linkCardSize");
345
+ if (!ke(i)) throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${Te.join(", ")}; got ${m(i)}`);
346
+ if (!o) throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${m(i)} with linkCards ${m(o)}`);
347
+ return Object.freeze({ ...s, linkCardSize: i });
348
+ }, ft = (e) => {
349
+ if (e === void 0) return null;
350
+ if (typeof e != "string") throw new TypeError(`[markdown-explorer] legacyTextEncoding must be a string; got ${m(e)}`);
351
+ return le(e);
352
+ }, ut = (e) => {
353
+ const t = new Map(
354
+ S(
355
+ "defaultTreeSettings",
356
+ e,
357
+ b.map((r) => r.key)
358
+ )
359
+ );
360
+ if (t.size === 0) return Q;
361
+ const n = { ...Q };
362
+ for (const r of b) {
363
+ if (!t.has(r.key)) continue;
364
+ const o = t.get(r.key), s = r.values;
365
+ if (!s.includes(o)) throw new RangeError(`[markdown-explorer] defaultTreeSettings.${r.key} must be one of ${s.map(m).join(", ")}; got ${m(o)}`);
366
+ n[r.key] = o;
367
+ }
368
+ return Object.freeze(n);
369
+ }, gt = (e) => {
370
+ if (e === null || typeof e != "object") throw new TypeError("[markdown-explorer] the explorer configuration must be an object");
371
+ 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);
374
+ const t = dt(e.views);
375
+ if ((/* @__PURE__ */ new Set([t.tree, t.multi, t.single])).size !== 3)
376
+ throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);
377
+ if (e.dataPath === e.basePath) throw new RangeError("[markdown-explorer] dataPath must differ from basePath");
378
+ if (e.dataPath.startsWith(`${e.basePath}/`)) {
379
+ const c = e.dataPath.slice(e.basePath.length + 1).split("/")[0];
380
+ if (c === t.tree || c === t.multi || c === t.single)
381
+ throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`);
382
+ }
383
+ qe(e.settingsCookie);
384
+ const n = e.iframeHosts ?? [];
385
+ if (!Array.isArray(n) || n.some((c) => typeof c != "string" || !lt.test(c)))
386
+ throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(n)}`);
387
+ const r = 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 = Object.fromEntries(S("spreadsheets", e.spreadsheets, ["maxBytes"])), a = e.documentStyles ?? Re;
388
+ if (!Array.isArray(a) || a.length === 0) throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");
389
+ const l = /* @__PURE__ */ new Set();
390
+ for (const c of a) {
391
+ if (c === null || typeof c != "object" || typeof c.name != "string" || c.name.trim() === "" || typeof c.className != "string")
392
+ throw new RangeError("[markdown-explorer] each document style needs a non-blank name and a className string");
393
+ if (l.has(c.name)) throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(c.name)} repeats`);
394
+ l.add(c.name);
395
+ }
396
+ return Object.freeze({
397
+ basePath: e.basePath,
398
+ dataPath: e.dataPath,
399
+ settingsCookie: e.settingsCookie,
400
+ views: t,
401
+ multiView: Object.freeze({
402
+ maxPanels: x("multiView.maxPanels", r.maxPanels, et),
403
+ columns: x("multiView.columns", r.columns, tt)
404
+ }),
405
+ expandAll: Object.freeze({
406
+ maxFolders: x("expandAll.maxFolders", o.maxFolders, nt),
407
+ maxDepth: x("expandAll.maxDepth", o.maxDepth, rt)
408
+ }),
409
+ revealDocument: Object.freeze({ maxDepth: x("revealDocument.maxDepth", s.maxDepth, ot) }),
410
+ documentStyles: Object.freeze(a.map((c) => Object.freeze({ name: c.name, className: c.className }))),
411
+ iframeHosts: Object.freeze([...new Set(n)]),
412
+ embeds: mt(e.embeds, e.dataPath),
413
+ defaultTreeSettings: ut(e.defaultTreeSettings),
414
+ legacyTextEncoding: ft(e.legacyTextEncoding),
415
+ spreadsheets: Object.freeze({ maxBytes: x("spreadsheets.maxBytes", i.maxBytes, st) })
416
+ });
417
+ }, mn = (e) => {
418
+ const t = e.embeds;
419
+ if (!R(t)) throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${m(t)}`);
420
+ if (Object.hasOwn(t, "linkCards"))
421
+ 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 ${m(t.linkCards)})`);
422
+ const n = e.legacyTextEncoding;
423
+ if (n !== null && typeof n != "string")
424
+ throw new TypeError(`[markdown-explorer] config.legacyTextEncoding must be the encoding defineExplorerConfig resolved, or null; got ${m(n)}`);
425
+ const { linkCardEndpoint: r, ...o } = t, s = gt({ ...e, embeds: { ...o, linkCards: r !== null }, legacyTextEncoding: n === null ? void 0 : n });
426
+ if (s.embeds.linkCardEndpoint !== r)
427
+ throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${m(s.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${m(r)}`);
428
+ if (s.legacyTextEncoding !== n)
429
+ throw new RangeError(`[markdown-explorer] config.legacyTextEncoding must be ${m(s.legacyTextEncoding)} (the written name of the encoding it names); got ${m(n)}`);
430
+ const i = e;
431
+ for (const [a, l] of Object.entries(s)) {
432
+ const c = G(i[a], l, a);
433
+ if (c !== null)
434
+ 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
+ }
436
+ return s;
437
+ }, G = (e, t, n) => {
438
+ if (Object.is(e, t)) return null;
439
+ if (Array.isArray(t)) {
440
+ if (!Array.isArray(e)) return { kind: "value", path: n, given: e, resolved: t };
441
+ if (e.length !== t.length) return { kind: "value", path: `${n}.length`, given: e.length, resolved: t.length };
442
+ for (const [o, s] of t.entries()) {
443
+ const i = G(e[o], s, `${n}[${String(o)}]`);
444
+ if (i !== null) return i;
445
+ }
446
+ return null;
447
+ }
448
+ if (!(R(t) && R(e))) return { kind: "value", path: n, given: e, resolved: t };
449
+ for (const o of Object.keys(t)) {
450
+ const s = G(Object.hasOwn(e, o) ? e[o] : void 0, t[o], `${n}.${o}`);
451
+ if (s !== null) return s;
452
+ }
453
+ const r = Object.keys(e).find((o) => !Object.hasOwn(t, o));
454
+ 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) => {
456
+ if (e === null || typeof e != "object") throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${m(e)}`);
457
+ if (!Array.isArray(t) || t.length === 0) throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${m(t)}`);
458
+ for (const n of t)
459
+ 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
+ if (new Set(t).size !== t.length) throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);
461
+ return Object.freeze({ ...e, sourceIds: Object.freeze([...t]) });
462
+ }, un = (e) => e.documentStyles.map((t) => t.name), d = Object.freeze({
463
+ source: "source",
464
+ doc: "doc",
465
+ maximized: "maximized",
466
+ style: "style",
467
+ align: "align",
468
+ showToc: "showToc",
469
+ showStyle: "showStyle",
470
+ showAlign: "showAlign",
471
+ padding: "padding",
472
+ width: "width",
473
+ maxWidth: "maxWidth",
474
+ 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) => {
476
+ const t = encodeURIComponent(e.replaceAll("%", "%25"));
477
+ return t.endsWith(ae) ? `${t.slice(0, -ae.length)}%2Edata` : t;
478
+ }, ht = (e) => e.replaceAll("%25", "%"), pe = (e) => {
479
+ const { sourceIds: t } = e;
480
+ if (t === void 0) throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");
481
+ return t;
482
+ }, Et = (e, t, n) => {
483
+ const r = n.getAll(d.source);
484
+ if (r.length === 0) return t;
485
+ const [o] = r;
486
+ return r.length > 1 || o === void 0 || o === t || !e.includes(o) ? null : o;
487
+ }, pt = (e, t) => {
488
+ const n = t.get(d.style), r = t.get(d.align);
489
+ return {
490
+ ...n !== null && e.documentStyles.some((o) => o.name === n) ? { style: n } : {},
491
+ ...r !== null && N.includes(r) ? { align: r } : {}
492
+ };
493
+ }, Se = (e) => Number.isFinite(e) && e >= 0 && e <= we && he.test(String(e)), St = (e) => {
494
+ const t = e.get(d.padding), n = t !== null && he.test(t) ? Number(t) : Number.NaN, r = e.get(d.width), o = e.get(d.maxWidth);
495
+ return {
496
+ ...e.get(d.showToc) === "false" ? { showToc: !1 } : {},
497
+ ...e.get(d.showStyle) === "false" ? { showStyle: !1 } : {},
498
+ ...e.get(d.showAlign) === "false" ? { showAlign: !1 } : {},
499
+ ...Se(n) ? { padding: n } : {},
500
+ ...r !== null && B.test(r) ? { width: r } : {},
501
+ ...o !== null && B.test(o) ? { maxWidth: o } : {}
502
+ };
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);
505
+ 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
+ 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
+ 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
+ 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
+ const o = r.find((s) => !t.includes(s));
510
+ 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) => {
512
+ if (!$(e)) throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0, 80))}`);
513
+ return e;
514
+ }, 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))}`);
516
+ return e;
517
+ }, Ot = (e, t) => {
518
+ if (t.style !== void 0 && !e.documentStyles.some((n) => n.name === t.style))
519
+ throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map((n) => JSON.stringify(n.name)).join(", ")}); got ${JSON.stringify(t.style)}`);
520
+ if (t.align !== void 0 && !N.includes(t.align))
521
+ throw new RangeError(`[markdown-explorer] overrides.align must be one of ${N.join(", ")}; got ${JSON.stringify(t.align)}`);
522
+ }, kt = (e) => {
523
+ for (const t of Ee)
524
+ 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])}`);
525
+ 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
+ for (const t of ["width", "maxWidth"]) {
527
+ 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)}`);
529
+ }
530
+ }, Tt = (e, t) => {
531
+ const n = new URLSearchParams();
532
+ let r = `${e.basePath}/${e.views[t.view]}`;
533
+ if (t.view === "multi") {
534
+ const s = t.docs ?? [], i = t.maximized ?? null, a = t.markup ?? [];
535
+ xt(e, s, i, a);
536
+ for (const l of s) n.append(d.doc, l);
537
+ i !== null && n.set(d.maximized, i);
538
+ for (const l of s) a.includes(l) && n.append(d.markup, l);
539
+ } else {
540
+ const s = t.doc ?? null, i = t.view === "tree" ? t.folder ?? null : null;
541
+ 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}`)}`);
543
+ }
544
+ if (t.source !== void 0) {
545
+ const s = pe(e);
546
+ if (!s.includes(t.source)) throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${s.join(", ")}`);
547
+ t.source !== s[0] && n.set(d.source, t.source);
548
+ }
549
+ if (t.view !== "multi" && t.overrides !== void 0 && (Ot(e, t.overrides), t.overrides.style !== void 0 && n.set(d.style, t.overrides.style), t.overrides.align !== void 0 && n.set(d.align, t.overrides.align)), t.view !== "multi" && t.markup === !0) {
550
+ 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");
551
+ n.set(d.markup, ge);
552
+ }
553
+ if (t.view === "single" && t.embed !== void 0) {
554
+ const { embed: s } = t;
555
+ kt(s);
556
+ for (const i of Ee) s[i] === !1 && n.set(d[i], "false");
557
+ s.padding !== void 0 && n.set(d.padding, String(s.padding)), s.width !== void 0 && n.set(d.width, s.width), s.maxWidth !== void 0 && n.set(d.maxWidth, s.maxWidth);
558
+ }
559
+ const o = n.toString();
560
+ return o === "" ? r : `${r}?${o}`;
561
+ }, Rt = (e, t) => Object.keys(e.views).find((n) => e.views[n] === t), gn = (e, t, n) => {
562
+ const r = pe(e), [o] = r;
563
+ if (o === void 0) throw new RangeError("[markdown-explorer] the configuration has no source");
564
+ 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
+ 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);
567
+ if (E === void 0) return l();
568
+ 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 });
571
+ }
572
+ const _ = M === null ? null : ht(M), u = _?.endsWith(j) === !0 ? _.slice(0, -j.length) : null, g = _ !== null && u === null ? _ : null;
573
+ if (g !== null && !$(g) || u !== null && !$(u)) return l();
574
+ const O = pt(e, n), k = (g !== null || u !== null) && n.get(d.markup) === ge;
575
+ if (E === "single") {
576
+ if (u !== null) return a({ view: "tree", source: i, doc: null, folder: u, overrides: O, markup: k });
577
+ if (g === null) return l();
578
+ const f = St(n);
579
+ return s === null ? a({ view: E, source: i, doc: g, overrides: O, embed: f, markup: k }) : { kind: "location", location: { view: E, source: i, doc: g, overrides: O, embed: f, markup: k } };
580
+ }
581
+ 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
+ };
583
+ export {
584
+ Ue as $,
585
+ Jt as A,
586
+ Gt as B,
587
+ Xt as C,
588
+ 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,
598
+ 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 _,
612
+ 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,
621
+ Tt as e,
622
+ vt as f,
623
+ un as g,
624
+ gn as h,
625
+ wt as i,
626
+ cn as j,
627
+ R as k,
628
+ le as l,
629
+ Pt as m,
630
+ on as n,
631
+ rn as o,
632
+ ln as p,
633
+ qt as q,
634
+ mn as r,
635
+ 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
+ };
@@ -1,5 +1,5 @@
1
1
  import { diff3Merge as d } from "node-diff3";
2
- import { C, a as R, b as u } from "./index-0pnuyLUO.js";
2
+ import { C, a as R, b as u } from "./index-CeZDCyEl.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-T98wklgM.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-BwTVYkTR.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(`