@aiquants/markdown-explorer 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +16 -10
- package/dist/{EditSurface-BesNcSQj.cjs → EditSurface-Bk4tdJ99.cjs} +1 -1
- package/dist/{EditSurface-DNjI8pV3.js → EditSurface-Dhvw9IDD.js} +5 -5
- package/dist/{ExplorerSplit-B4oNvydP.cjs → ExplorerSplit-BAFiXU-V.cjs} +1 -1
- package/dist/{ExplorerSplit-GUdzpDPg.js → ExplorerSplit-Q5VqUBDE.js} +3 -3
- package/dist/{MultiLayout-DtKChQ_s.cjs → MultiLayout-Bq_TS3ez.cjs} +1 -1
- package/dist/{MultiLayout-BJ-s6AaD.js → MultiLayout-DlATT7km.js} +22 -22
- package/dist/{NativeScrollBar-DJKlPWvD.cjs → NativeScrollBar-A6-qEpz7.cjs} +1 -1
- package/dist/{NativeScrollBar-D10fsk-7.js → NativeScrollBar-TsIcS3JZ.js} +1 -1
- package/dist/{TreeLayout-C1mTmoPp.cjs → TreeLayout-l-r2pPao.cjs} +1 -1
- package/dist/{TreeLayout-DQT5p2vI.js → TreeLayout-zrSo4MNZ.js} +3 -3
- package/dist/core/contracts.d.cts +7 -0
- package/dist/core/contracts.d.ts +7 -0
- package/dist/core/labels.d.cts +12 -0
- package/dist/core/labels.d.ts +12 -0
- package/dist/{dataRoute-CObbjNxG.js → dataRoute-Diu_7gle.js} +84 -83
- package/dist/dataRoute-vXGZMVB-.cjs +1 -0
- package/dist/index-BNFl3BsO.cjs +13 -0
- package/dist/{index-0pnuyLUO.js → index-Jz6zeO4O.js} +876 -835
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/{location-B-m9scLf.js → location-8Ho8ZNv_.js} +1 -1
- package/dist/{location-BVEN_Ihk.cjs → location-DN0AI4ir.cjs} +1 -1
- package/dist/{merge-DauzoA2W.js → merge-BzMpSaxx.js} +1 -1
- package/dist/{merge-CTkzzHtn.cjs → merge-DlPkU2Jc.cjs} +1 -1
- package/dist/{sanitizePolicy-BWQtWhsL.js → sanitizePolicy-BvhYIqVO.js} +1 -1
- package/dist/{sanitizePolicy-gEXeavb-.cjs → sanitizePolicy-Du3lFZd-.cjs} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/ports.d.cts +2 -1
- package/dist/server/ports.d.ts +2 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +524 -521
- package/dist/{useSplitPersistence-Ba-v64n-.cjs → useSplitPersistence-CR4Oxtaa.cjs} +1 -1
- package/dist/{useSplitPersistence-Cc4tDxB4.js → useSplitPersistence-HfAb8Kzh.js} +1 -1
- package/docs/behavior/dom-hooks.md +2 -2
- package/docs/behavior/layout.md +9 -4
- package/docs/behavior/localization.md +4 -3
- package/docs/behavior/security.md +1 -1
- package/docs/behavior/url-contract.md +2 -2
- package/package.json +3 -3
- package/dist/dataRoute-BONacTPi.cjs +0 -1
- package/dist/index-T98wklgM.cjs +0 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Ee = 4096;
|
|
2
2
|
const v = Object.freeze([
|
|
3
3
|
".env*",
|
|
4
4
|
"*.env",
|
|
@@ -57,7 +57,7 @@ const v = Object.freeze([
|
|
|
57
57
|
"*.tfvars.json",
|
|
58
58
|
".*_history",
|
|
59
59
|
"fish_history"
|
|
60
|
-
]), w = /[\u0000-\u001f\u007f]/u, P = /\p{Cs}/u,
|
|
60
|
+
]), w = /[\u0000-\u001f\u007f]/u, P = /\p{Cs}/u, ye = (e) => {
|
|
61
61
|
const t = e.split("/").filter((n) => n !== "").at(-1);
|
|
62
62
|
return t === void 0 ? e : t;
|
|
63
63
|
}, R = (e) => e.length > 0 && e.length <= 4096 && !P.test(e) && !w.test(e) && !e.includes("\\"), A = (e) => e.normalize("NFKC").toUpperCase().toLowerCase(), L = /(?:%[0-9A-Fa-f]{2})+/gu, D = new TextDecoder("utf-8"), k = /[/\\]/u, j = (e) => e.replace(
|
|
@@ -88,49 +88,49 @@ const v = Object.freeze([
|
|
|
88
88
|
deniesPath: (s) => s.split("/").some(r),
|
|
89
89
|
deniesName: r
|
|
90
90
|
};
|
|
91
|
-
}, C = y(v), z = Object.freeze({ deniesPath: () => !1, deniesName: () => !1 }),
|
|
91
|
+
}, C = y(v), z = Object.freeze({ deniesPath: () => !1, deniesName: () => !1 }), me = (e) => e === void 0 ? C : e === !1 ? z : y(e), ge = (e, t) => y(e).deniesPath(t), b = Object.freeze(["unauthorized", "forbidden", "not-found", "not-configured", "invalid", "too-large", "unsupported", "failed"]), U = Object.freeze(["file", "directory"]), X = Object.freeze(["video", "audio", "pdf"]), H = Object.freeze(["raster", "svg"]), V = Object.freeze(["info", "warning", "danger"]), F = Object.freeze(["markdown", "text", "image", "media", "file", "failure"]), m = Object.freeze({ min: 1, max: 6 }), Re = 1e4, f = (e) => typeof e == "string" && /^\/(?![/\\])[\x21-\x7E]*$/u.test(e), Ae = Object.freeze(["http:", "https:", "mailto:"]), h = 1024, M = /^[a-z0-9-]{1,64}$/u, K = "https://relative.invalid/", g = 64, l = (e, t) => typeof t == "string" && e.includes(t), o = (e) => typeof e == "string" ? JSON.stringify(e.length > g ? `${e.slice(0, g)}…` : e) : typeof e, G = (e) => l(b, e), Y = (e) => l(U, e), W = (e) => l(X, e), J = (e) => l(H, e), be = (e) => l(V, e), q = (e) => l(F, e), _ = (e) => typeof e == "string" && M.test(e), he = (e, t) => {
|
|
92
92
|
if (typeof e != "string") return !1;
|
|
93
93
|
try {
|
|
94
|
-
return t.includes(new URL(e,
|
|
94
|
+
return t.includes(new URL(e, K).protocol);
|
|
95
95
|
} catch {
|
|
96
96
|
return !1;
|
|
97
97
|
}
|
|
98
98
|
}, p = (e) => {
|
|
99
99
|
if (e === null || typeof e != "object") return "a failure must be an object";
|
|
100
100
|
const { reason: t, code: n } = e;
|
|
101
|
-
return
|
|
102
|
-
},
|
|
101
|
+
return G(t) ? n !== void 0 && !_(n) ? `a failure code must be 1 to 64 lowercase letters, digits or hyphens; got ${o(n)}` : null : `unknown failure reason ${o(t)}`;
|
|
102
|
+
}, B = (e) => {
|
|
103
103
|
if (e === null || typeof e != "object") return "an entry must be an object";
|
|
104
104
|
const { name: t, path: n, type: r, mimeType: s, modifiedAt: i, children: a, lazy: c } = e;
|
|
105
|
-
return typeof t != "string" || t === "" ? "an entry needs a non-empty name" : typeof n != "string" || !R(n) ? "an entry needs an acceptable path" :
|
|
105
|
+
return typeof t != "string" || t === "" ? "an entry needs a non-empty name" : typeof n != "string" || !R(n) ? "an entry needs an acceptable path" : Y(r) ? s !== void 0 && typeof s != "string" ? "an entry mimeType must be a string" : i !== void 0 && !Number.isSafeInteger(i) ? `an entry modifiedAt must be a safe integer of epoch milliseconds; got ${o(i)}` : c !== void 0 && typeof c != "boolean" ? "an entry lazy flag must be a boolean" : a !== void 0 && !Array.isArray(a) ? "entry children must be an array" : r === "file" && (a !== void 0 || c === !0) ? "a file entry cannot have children or be lazy" : c === !0 && Array.isArray(a) && a.length > 0 ? "a lazy directory must not list children" : null : `an entry type must be "file" or "directory"; got ${o(r)}`;
|
|
106
106
|
}, O = (e) => {
|
|
107
|
-
if (
|
|
107
|
+
if (B(e) !== null) return !1;
|
|
108
108
|
const { children: t } = e;
|
|
109
109
|
return t === void 0 || t.every(O);
|
|
110
|
-
},
|
|
110
|
+
}, Q = (e) => {
|
|
111
111
|
if (e === null || typeof e != "object") return !1;
|
|
112
112
|
const { status: t, entries: n, failure: r } = e;
|
|
113
113
|
return t === "ok" ? Array.isArray(n) && n.every(O) : t === "error" && p(r) === null;
|
|
114
|
-
},
|
|
114
|
+
}, _e = (e) => {
|
|
115
115
|
if (e === null || typeof e != "object") return !1;
|
|
116
116
|
const { status: t, ancestors: n, failure: r } = e;
|
|
117
117
|
return t === "ok" ? n === null || x(n) : t === "error" && p(r) === null;
|
|
118
|
-
}, x = (e) => Array.isArray(e) && e.every((t) => typeof t == "string" && R(t)) && new Set(e).size === e.length,
|
|
118
|
+
}, x = (e) => Array.isArray(e) && e.every((t) => typeof t == "string" && R(t)) && new Set(e).size === e.length, Oe = (e) => {
|
|
119
119
|
if (e === null || typeof e != "object") return !1;
|
|
120
120
|
const { status: t, source: n, ancestors: r, failure: s } = e;
|
|
121
121
|
return t === "ok" ? n === null && r === null || typeof n == "string" && n !== "" && x(r) : t === "error" && p(s) === null;
|
|
122
|
-
},
|
|
122
|
+
}, xe = (e) => {
|
|
123
123
|
if (e === null || typeof e != "object") return !1;
|
|
124
124
|
const { status: t, loadedAt: n } = e;
|
|
125
|
-
return t === "ok" && !(Number.isSafeInteger(n) && n >= 0) ? !1 :
|
|
125
|
+
return t === "ok" && !(Number.isSafeInteger(n) && n >= 0) ? !1 : Q(e);
|
|
126
126
|
}, T = (e) => {
|
|
127
127
|
if (e === null || typeof e != "object") return "a heading must be an object";
|
|
128
128
|
const { text: t, depth: n, id: r } = e;
|
|
129
129
|
return typeof t != "string" || typeof r != "string" ? "a heading needs text and id strings" : typeof n != "number" || !Number.isInteger(n) || n < m.min || n > m.max ? `a heading depth must be an integer in 1..6; got ${String(n)}` : null;
|
|
130
|
-
},
|
|
130
|
+
}, Z = (e) => {
|
|
131
131
|
if (e === null || typeof e != "object") return "a document must be an object";
|
|
132
132
|
const t = e, { kind: n } = t;
|
|
133
|
-
if (!
|
|
133
|
+
if (!q(n)) return `unknown document kind ${o(n)}`;
|
|
134
134
|
if (n === "failure") return p(t.failure);
|
|
135
135
|
if (typeof t.name != "string") return "a document needs a name string";
|
|
136
136
|
switch (n) {
|
|
@@ -141,49 +141,49 @@ const v = Object.freeze([
|
|
|
141
141
|
const a = T(i);
|
|
142
142
|
if (a !== null) return a;
|
|
143
143
|
}
|
|
144
|
-
return
|
|
144
|
+
return te(t.edit);
|
|
145
145
|
}
|
|
146
146
|
case "text":
|
|
147
|
-
return typeof t.text != "string" || typeof t.truncated != "boolean" ? "a text document needs text and truncated" :
|
|
147
|
+
return typeof t.text != "string" || typeof t.truncated != "boolean" ? "a text document needs text and truncated" : f(t.url) ? null : "a text document needs a root-relative url";
|
|
148
148
|
case "image":
|
|
149
|
-
return
|
|
149
|
+
return f(t.url) ? J(t.imageType) ? null : `unknown image type ${o(t.imageType)}` : "an image document needs a root-relative url";
|
|
150
150
|
case "media":
|
|
151
|
-
return
|
|
151
|
+
return f(t.url) ? W(t.mediaType) ? null : `unknown media type ${o(t.mediaType)}` : "a media document needs a root-relative url";
|
|
152
152
|
case "file":
|
|
153
|
-
return
|
|
153
|
+
return f(t.url) ? null : "a file document needs a root-relative url";
|
|
154
154
|
}
|
|
155
|
-
},
|
|
155
|
+
}, ee = (e) => Z(e) === null, Te = (e) => ee(e) && (e.kind === "text" || e.kind === "failure"), te = (e) => {
|
|
156
156
|
if (e === null) return null;
|
|
157
157
|
if (typeof e != "object") return "a markdown document's edit must be null or an object";
|
|
158
158
|
const { kind: t, href: n } = e;
|
|
159
|
-
return t === "inline" ? n === void 0 ? null : "an inline edit carries no href" : t === "draft" ? n === void 0 ? null : "a draft edit carries no href" : t !== "external" ? `unknown edit kind ${o(t)}` :
|
|
160
|
-
},
|
|
159
|
+
return t === "inline" ? n === void 0 ? null : "an inline edit carries no href" : t === "draft" ? n === void 0 ? null : "a draft edit carries no href" : t !== "external" ? `unknown edit kind ${o(t)}` : ne(n) ? null : `an external edit needs an absolute https: href; got ${o(n)}`;
|
|
160
|
+
}, ne = (e) => {
|
|
161
161
|
if (typeof e != "string") return !1;
|
|
162
162
|
try {
|
|
163
163
|
return new URL(e).protocol === "https:";
|
|
164
164
|
} catch {
|
|
165
165
|
return !1;
|
|
166
166
|
}
|
|
167
|
-
},
|
|
167
|
+
}, d = (e) => typeof e == "string" && e.length > 0 && e.length <= h, re = (e) => f(e.href) ? null : `a grant needs a root-relative href; got ${o(e.href)}`, se = (e) => {
|
|
168
168
|
if (e === null || typeof e != "object") return "a revision must be an object";
|
|
169
169
|
const { id: t, modifiedAt: n, size: r, author: s, kept: i, current: a } = e;
|
|
170
|
-
return
|
|
171
|
-
},
|
|
170
|
+
return d(t) ? n !== null && (typeof n != "string" || Number.isNaN(Date.parse(n))) ? `a revision's modifiedAt must be a date-time string or null; got ${o(n)}` : typeof r != "number" || !Number.isSafeInteger(r) || r < 0 ? `a revision's size must be a non-negative integer; got ${o(r)}` : s !== null && typeof s != "string" ? `a revision's author must be a string or null; got ${o(s)}` : typeof i != "boolean" || typeof a != "boolean" ? "a revision needs kept and current booleans" : null : `a revision id must be a non-empty string of at most ${h} characters; got ${o(t)}`;
|
|
171
|
+
}, u = (e, t) => {
|
|
172
172
|
if (e === null || typeof e != "object") return "an answer must be an object";
|
|
173
173
|
const n = e, { kind: r } = n;
|
|
174
174
|
if (r === "failure") return p(n.failure);
|
|
175
175
|
if (typeof r != "string" || !t.includes(r)) return `unexpected answer kind ${o(r)}`;
|
|
176
176
|
switch (r) {
|
|
177
177
|
case "grant":
|
|
178
|
-
return
|
|
178
|
+
return re(n);
|
|
179
179
|
case "edit":
|
|
180
|
-
return typeof n.text != "string" || typeof n.history != "boolean" ? "an edit source needs text and history" :
|
|
180
|
+
return typeof n.text != "string" || typeof n.history != "boolean" ? "an edit source needs text and history" : d(n.version) ? null : `an edit source needs a version; got ${o(n.version)}`;
|
|
181
181
|
case "draft":
|
|
182
182
|
return typeof n.text == "string" ? null : "a draft source needs text";
|
|
183
183
|
case "saved":
|
|
184
|
-
return
|
|
184
|
+
return d(n.version) ? null : `a saved answer needs a version; got ${o(n.version)}`;
|
|
185
185
|
case "conflict":
|
|
186
|
-
return typeof n.text != "string" ? "a conflict needs the current text" :
|
|
186
|
+
return typeof n.text != "string" ? "a conflict needs the current text" : d(n.version) ? null : `a conflict needs the current version; got ${o(n.version)}`;
|
|
187
187
|
case "preview": {
|
|
188
188
|
const { htmlContent: s, headings: i } = n;
|
|
189
189
|
if (typeof s != "string" || !Array.isArray(i)) return "a preview needs htmlContent and headings";
|
|
@@ -196,26 +196,26 @@ const v = Object.freeze([
|
|
|
196
196
|
case "revisions": {
|
|
197
197
|
if (!Array.isArray(n.revisions)) return "revisions need an array";
|
|
198
198
|
for (const s of n.revisions) {
|
|
199
|
-
const i =
|
|
199
|
+
const i = se(s);
|
|
200
200
|
if (i !== null) return i;
|
|
201
201
|
}
|
|
202
202
|
return null;
|
|
203
203
|
}
|
|
204
204
|
case "revision":
|
|
205
|
-
return typeof n.text != "string" ? "a revision answer needs text" :
|
|
205
|
+
return typeof n.text != "string" ? "a revision answer needs text" : d(n.id) ? null : `a revision answer needs an id; got ${o(n.id)}`;
|
|
206
206
|
default:
|
|
207
207
|
return `unexpected answer kind ${o(r)}`;
|
|
208
208
|
}
|
|
209
|
-
},
|
|
210
|
-
const r = `${e}/${
|
|
209
|
+
}, oe = Object.freeze(["edit", "draft", "grant"]), ie = Object.freeze(["saved", "conflict", "grant"]), S = Object.freeze(["preview"]), ae = Object.freeze(["revisions"]), ce = Object.freeze(["revision"]), Se = (e) => u(e, oe) === null, Ne = (e) => u(e, ie) === null, ve = (e) => u(e, S) === null, we = (e) => u(e, ae) === null, Pe = (e) => u(e, ce) === null, Le = (e) => e !== null && typeof e == "object" && e.kind === "unavailable" ? null : u(e, S), De = (e, t) => ({ kind: "failure", failure: le(e, t) }), le = (e, t) => _(t) ? { reason: e, code: t } : { reason: e }, ue = Object.freeze(["tree", "children", "ancestors", "reveal", "document", "text", "edit", "save", "preview", "revisions", "revision", "refresh", "asset", "link-card"]), E = Object.freeze({ source: "source", path: "path", version: "v", base: "base", revision: "revision", display: "as" }), fe = "asset", de = "link-card", ke = (e, t, n) => {
|
|
210
|
+
const r = `${e}/${fe}?${E.path}=${encodeURIComponent(t)}`;
|
|
211
211
|
return n === null ? r : `${r}&${E.version}=${encodeURIComponent(n)}`;
|
|
212
|
-
}, N = "text",
|
|
212
|
+
}, N = "text", je = (e) => {
|
|
213
213
|
if (!e.includes("?")) throw new RangeError(`[markdown-explorer] an asset URL always carries a query; got ${JSON.stringify(e)}`);
|
|
214
214
|
return `${e}&${E.display}=${N}`;
|
|
215
|
-
},
|
|
215
|
+
}, $e = (e) => {
|
|
216
216
|
const t = e.getAll(E.display);
|
|
217
217
|
return t.length === 0 ? "file" : t.length === 1 && t[0] === N ? "text" : null;
|
|
218
|
-
},
|
|
218
|
+
}, Ie = (e) => `${e}/${de}`, Ce = "X-Markdown-Explorer-Scope", ze = "X-Markdown-Explorer", Ue = "refresh", Xe = "edit", He = "text/markdown", Ve = (e) => ue.includes(e), pe = Object.freeze({
|
|
219
219
|
invalid: 400,
|
|
220
220
|
unauthorized: 401,
|
|
221
221
|
forbidden: 403,
|
|
@@ -224,58 +224,59 @@ const v = Object.freeze([
|
|
|
224
224
|
"not-configured": 500,
|
|
225
225
|
unsupported: 500,
|
|
226
226
|
failed: 500
|
|
227
|
-
}),
|
|
228
|
-
const [t, ...n] =
|
|
227
|
+
}), Fe = (e) => {
|
|
228
|
+
const [t, ...n] = b.filter((r) => pe[r] === e);
|
|
229
229
|
return t !== void 0 && n.length === 0 ? t : "failed";
|
|
230
230
|
};
|
|
231
231
|
export {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
De as A,
|
|
233
|
+
$e as B,
|
|
234
|
+
He as C,
|
|
235
235
|
v as D,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
236
|
+
Re as E,
|
|
237
|
+
ge as F,
|
|
238
|
+
ye as G,
|
|
239
|
+
je as H,
|
|
240
|
+
Fe as I,
|
|
241
|
+
Te as J,
|
|
242
|
+
Oe as K,
|
|
243
|
+
_e as L,
|
|
244
|
+
Ee as M,
|
|
245
|
+
Q as N,
|
|
246
|
+
p as O,
|
|
247
|
+
xe as P,
|
|
248
|
+
Pe as Q,
|
|
249
|
+
we as R,
|
|
250
|
+
ve as S,
|
|
251
|
+
Ne as T,
|
|
252
|
+
Se as U,
|
|
253
|
+
ee as V,
|
|
254
254
|
h as W,
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
b as X,
|
|
256
|
+
Ie as a,
|
|
257
|
+
G as b,
|
|
257
258
|
_ as c,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
Le as d,
|
|
260
|
+
ke as e,
|
|
261
|
+
le as f,
|
|
262
|
+
be as g,
|
|
263
|
+
he as h,
|
|
263
264
|
R as i,
|
|
264
265
|
W as j,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
266
|
+
J as k,
|
|
267
|
+
Z as l,
|
|
268
|
+
d as m,
|
|
269
|
+
T as n,
|
|
270
|
+
f as o,
|
|
271
|
+
B as p,
|
|
272
|
+
Ae as q,
|
|
273
|
+
se as r,
|
|
274
|
+
me as s,
|
|
275
|
+
Ve as t,
|
|
276
|
+
pe as u,
|
|
277
|
+
ze as v,
|
|
278
|
+
Ue as w,
|
|
279
|
+
Xe as x,
|
|
280
|
+
Ce as y,
|
|
281
|
+
E as z
|
|
281
282
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const x=Object.freeze([".env*","*.env","*.env.*","*.env~*","*.env-*","*.env_*","*.env#*",".git",".git-credentials",".svn",".hg","node_modules","secrets",".secrets","secrets.json","secrets.yml","secrets.yaml","secrets.toml","secrets.ini","secrets.txt",".ssh",".aws",".gnupg",".docker",".kube",".terraform",".npmrc",".yarnrc",".yarnrc.yml",".netrc","_netrc",".pypirc",".pgpass",".my.cnf",".htpasswd",".vault-token","id_rsa*","id_dsa*","id_ecdsa*","id_ed25519*","*.pem","*.key","*.p8","*.p12","*.pfx","*.ppk","*.jks","*.keystore","*.kdbx","*credentials*.json","service-account*.json","*.tfstate","*.tfstate.*","*.tfvars","*.tfvars.json",".*_history","fish_history"]),U=/[\u0000-\u001f\u007f]/u,H=/\p{Cs}/u,z=e=>{const t=e.split("/").filter(n=>n!=="").at(-1);return t===void 0?e:t},R=e=>e.length>0&&e.length<=4096&&!H.test(e)&&!U.test(e)&&!e.includes("\\"),b=e=>e.normalize("NFKC").toUpperCase().toLowerCase(),F=/(?:%[0-9A-Fa-f]{2})+/gu,M=new TextDecoder("utf-8"),V=/[/\\]/u,G=e=>e.replace(F,t=>M.decode(Uint8Array.from(t.slice(1).split("%").map(n=>Number.parseInt(n,16))))),K=e=>{const t=[e];let n=e;for(let r=0;r<3&&n.includes("%");r+=1){const o=G(n);if(o===n)break;t.push(o),n=o}return t.map(b)},Y=e=>{if(typeof e!="string"||e.trim()===""||e.includes("/")||e.includes("\\"))throw new RangeError(`[markdown-explorer] a deny pattern must be one non-blank path segment; got ${JSON.stringify(e)}`);const t=b(e).split("*").map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${t}$`,"su")},y=e=>{if(!Array.isArray(e))throw new RangeError("[markdown-explorer] deny rules must be an array of segment patterns");const t=e.map(Y),n=o=>o!==""&&t.some(i=>i.test(o)),r=o=>o!==""&&K(o).some(i=>n(i)||i.split(V).some(n));return{deniesPath:o=>o.split("/").some(r),deniesName:r}},W=y(x),J=Object.freeze({deniesPath:()=>!1,deniesName:()=>!1}),Q=e=>e===void 0?W:e===!1?J:y(e),q=(e,t)=>y(e).deniesPath(t),m=Object.freeze(["unauthorized","forbidden","not-found","not-configured","invalid","too-large","unsupported","failed"]),B=Object.freeze(["file","directory"]),Z=Object.freeze(["video","audio","pdf"]),ee=Object.freeze(["raster","svg"]),te=Object.freeze(["info","warning","danger"]),ne=Object.freeze(["markdown","text","image","media","file","failure"]),O=Object.freeze({min:1,max:6}),re=1e4,c=e=>typeof e=="string"&&/^\/(?![/\\])[\x21-\x7E]*$/u.test(e),oe=Object.freeze(["http:","https:","mailto:"]),_=1024,se=/^[a-z0-9-]{1,64}$/u,ie="https://relative.invalid/",h=64,f=(e,t)=>typeof t=="string"&&e.includes(t),s=e=>typeof e=="string"?JSON.stringify(e.length>h?`${e.slice(0,h)}…`:e):typeof e,T=e=>f(m,e),ae=e=>f(B,e),P=e=>f(Z,e),S=e=>f(ee,e),le=e=>f(te,e),ce=e=>f(ne,e),g=e=>typeof e=="string"&&se.test(e),ue=(e,t)=>{if(typeof e!="string")return!1;try{return t.includes(new URL(e,ie).protocol)}catch{return!1}},d=e=>{if(e===null||typeof e!="object")return"a failure must be an object";const{reason:t,code:n}=e;return T(t)?n!==void 0&&!g(n)?`a failure code must be 1 to 64 lowercase letters, digits or hyphens; got ${s(n)}`:null:`unknown failure reason ${s(t)}`},L=e=>{if(e===null||typeof e!="object")return"an entry must be an object";const{name:t,path:n,type:r,mimeType:o,modifiedAt:i,children:a,lazy:l}=e;return typeof t!="string"||t===""?"an entry needs a non-empty name":typeof n!="string"||!R(n)?"an entry needs an acceptable path":ae(r)?o!==void 0&&typeof o!="string"?"an entry mimeType must be a string":i!==void 0&&!Number.isSafeInteger(i)?`an entry modifiedAt must be a safe integer of epoch milliseconds; got ${s(i)}`:l!==void 0&&typeof l!="boolean"?"an entry lazy flag must be a boolean":a!==void 0&&!Array.isArray(a)?"entry children must be an array":r==="file"&&(a!==void 0||l===!0)?"a file entry cannot have children or be lazy":l===!0&&Array.isArray(a)&&a.length>0?"a lazy directory must not list children":null:`an entry type must be "file" or "directory"; got ${s(r)}`},N=e=>{if(L(e)!==null)return!1;const{children:t}=e;return t===void 0||t.every(N)},D=e=>{if(e===null||typeof e!="object")return!1;const{status:t,entries:n,failure:r}=e;return t==="ok"?Array.isArray(n)&&n.every(N):t==="error"&&d(r)===null},fe=e=>{if(e===null||typeof e!="object")return!1;const{status:t,ancestors:n,failure:r}=e;return t==="ok"?n===null||v(n):t==="error"&&d(r)===null},v=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"&&R(t))&&new Set(e).size===e.length,de=e=>{if(e===null||typeof e!="object")return!1;const{status:t,source:n,ancestors:r,failure:o}=e;return t==="ok"?n===null&&r===null||typeof n=="string"&&n!==""&&v(r):t==="error"&&d(o)===null},Ee=e=>{if(e===null||typeof e!="object")return!1;const{status:t,loadedAt:n}=e;return t==="ok"&&!(Number.isSafeInteger(n)&&n>=0)?!1:D(e)},A=e=>{if(e===null||typeof e!="object")return"a heading must be an object";const{text:t,depth:n,id:r}=e;return typeof t!="string"||typeof r!="string"?"a heading needs text and id strings":typeof n!="number"||!Number.isInteger(n)||n<O.min||n>O.max?`a heading depth must be an integer in 1..6; got ${String(n)}`:null},w=e=>{if(e===null||typeof e!="object")return"a document must be an object";const t=e,{kind:n}=t;if(!ce(n))return`unknown document kind ${s(n)}`;if(n==="failure")return d(t.failure);if(typeof t.name!="string")return"a document needs a name string";switch(n){case"markdown":{const{htmlContent:r,headings:o}=t;if(typeof r!="string"||!Array.isArray(o))return"a markdown document needs htmlContent and headings";for(const i of o){const a=A(i);if(a!==null)return a}return Re(t.edit)}case"text":return typeof t.text!="string"||typeof t.truncated!="boolean"?"a text document needs text and truncated":c(t.url)?null:"a text document needs a root-relative url";case"image":return c(t.url)?S(t.imageType)?null:`unknown image type ${s(t.imageType)}`:"an image document needs a root-relative url";case"media":return c(t.url)?P(t.mediaType)?null:`unknown media type ${s(t.mediaType)}`:"a media document needs a root-relative url";case"file":return c(t.url)?null:"a file document needs a root-relative url"}},I=e=>w(e)===null,pe=e=>I(e)&&(e.kind==="text"||e.kind==="failure"),Re=e=>{if(e===null)return null;if(typeof e!="object")return"a markdown document's edit must be null or an object";const{kind:t,href:n}=e;return t==="inline"?n===void 0?null:"an inline edit carries no href":t==="draft"?n===void 0?null:"a draft edit carries no href":t!=="external"?`unknown edit kind ${s(t)}`:ye(n)?null:`an external edit needs an absolute https: href; got ${s(n)}`},ye=e=>{if(typeof e!="string")return!1;try{return new URL(e).protocol==="https:"}catch{return!1}},u=e=>typeof e=="string"&&e.length>0&&e.length<=_,me=e=>c(e.href)?null:`a grant needs a root-relative href; got ${s(e.href)}`,k=e=>{if(e===null||typeof e!="object")return"a revision must be an object";const{id:t,modifiedAt:n,size:r,author:o,kept:i,current:a}=e;return u(t)?n!==null&&(typeof n!="string"||Number.isNaN(Date.parse(n)))?`a revision's modifiedAt must be a date-time string or null; got ${s(n)}`:typeof r!="number"||!Number.isSafeInteger(r)||r<0?`a revision's size must be a non-negative integer; got ${s(r)}`:o!==null&&typeof o!="string"?`a revision's author must be a string or null; got ${s(o)}`:typeof i!="boolean"||typeof a!="boolean"?"a revision needs kept and current booleans":null:`a revision id must be a non-empty string of at most ${_} characters; got ${s(t)}`},E=(e,t)=>{if(e===null||typeof e!="object")return"an answer must be an object";const n=e,{kind:r}=n;if(r==="failure")return d(n.failure);if(typeof r!="string"||!t.includes(r))return`unexpected answer kind ${s(r)}`;switch(r){case"grant":return me(n);case"edit":return typeof n.text!="string"||typeof n.history!="boolean"?"an edit source needs text and history":u(n.version)?null:`an edit source needs a version; got ${s(n.version)}`;case"draft":return typeof n.text=="string"?null:"a draft source needs text";case"saved":return u(n.version)?null:`a saved answer needs a version; got ${s(n.version)}`;case"conflict":return typeof n.text!="string"?"a conflict needs the current text":u(n.version)?null:`a conflict needs the current version; got ${s(n.version)}`;case"preview":{const{htmlContent:o,headings:i}=n;if(typeof o!="string"||!Array.isArray(i))return"a preview needs htmlContent and headings";for(const a of i){const l=A(a);if(l!==null)return l}return null}case"revisions":{if(!Array.isArray(n.revisions))return"revisions need an array";for(const o of n.revisions){const i=k(o);if(i!==null)return i}return null}case"revision":return typeof n.text!="string"?"a revision answer needs text":u(n.id)?null:`a revision answer needs an id; got ${s(n.id)}`;default:return`unexpected answer kind ${s(r)}`}},_e=Object.freeze(["edit","draft","grant"]),ge=Object.freeze(["saved","conflict","grant"]),j=Object.freeze(["preview"]),Ae=Object.freeze(["revisions"]),Oe=Object.freeze(["revision"]),he=e=>E(e,_e)===null,xe=e=>E(e,ge)===null,be=e=>E(e,j)===null,Te=e=>E(e,Ae)===null,Pe=e=>E(e,Oe)===null,Se=e=>e!==null&&typeof e=="object"&&e.kind==="unavailable"?null:E(e,j),Le=(e,t)=>({kind:"failure",failure:$(e,t)}),$=(e,t)=>g(t)?{reason:e,code:t}:{reason:e},Ne=Object.freeze(["tree","children","ancestors","reveal","document","text","edit","save","preview","revisions","revision","refresh","asset","link-card"]),p=Object.freeze({source:"source",path:"path",version:"v",base:"base",revision:"revision",display:"as"}),De="asset",ve="link-card",we=(e,t,n)=>{const r=`${e}/${De}?${p.path}=${encodeURIComponent(t)}`;return n===null?r:`${r}&${p.version}=${encodeURIComponent(n)}`},X="text",Ie=e=>{if(!e.includes("?"))throw new RangeError(`[markdown-explorer] an asset URL always carries a query; got ${JSON.stringify(e)}`);return`${e}&${p.display}=${X}`},ke=e=>{const t=e.getAll(p.display);return t.length===0?"file":t.length===1&&t[0]===X?"text":null},je=e=>`${e}/${ve}`,$e="X-Markdown-Explorer-Scope",Xe="X-Markdown-Explorer",Ce="refresh",Ue="edit",He="text/markdown",ze=e=>Ne.includes(e),C=Object.freeze({invalid:400,unauthorized:401,forbidden:403,"not-found":404,"too-large":413,"not-configured":500,unsupported:500,failed:500}),Fe=e=>{const[t,...n]=m.filter(r=>C[r]===e);return t!==void 0&&n.length===0?t:"failed"};exports.DEFAULT_DENIED_PATH_SEGMENTS=x;exports.EXPLORER_DATA_QUERY=p;exports.EXPLORER_DRAFT_MEDIA_TYPE=He;exports.EXPLORER_EDIT_PROOF=Ue;exports.EXPLORER_EDIT_TOKEN_MAX_LENGTH=_;exports.EXPLORER_FAILURE_REASONS=m;exports.EXPLORER_FAILURE_STATUS=C;exports.EXPLORER_LINK_PROTOCOLS=oe;exports.EXPLORER_MAX_HEADINGS=re;exports.EXPLORER_PROOF_HEADER=Xe;exports.EXPLORER_REFRESH_PROOF=Ce;exports.EXPLORER_SCOPE_HEADER=$e;exports.MAX_DOCUMENT_PATH_LENGTH=4096;exports.documentViolation=w;exports.draftAnswerViolation=Se;exports.entryViolation=L;exports.explorerAssetHref=we;exports.explorerLinkCardEndpoint=je;exports.explorerPlainTextHref=Ie;exports.failureDocument=Le;exports.failureOf=$;exports.failureReasonOfStatus=Fe;exports.failureViolation=d;exports.headingViolation=A;exports.isAcceptableDocumentPath=R;exports.isAcceptableUrl=ue;exports.isDeniedPath=q;exports.isExplorerAncestorsResult=fe;exports.isExplorerChildrenResult=D;exports.isExplorerDataOperation=ze;exports.isExplorerDocument=I;exports.isExplorerEditAnswer=he;exports.isExplorerEditToken=u;exports.isExplorerFailureCode=g;exports.isExplorerFailureReason=T;exports.isExplorerImageType=S;exports.isExplorerMediaType=P;exports.isExplorerNoticeTone=le;exports.isExplorerPreviewAnswer=be;exports.isExplorerRevealResult=de;exports.isExplorerRevisionAnswer=Pe;exports.isExplorerRevisionsAnswer=Te;exports.isExplorerSaveAnswer=xe;exports.isExplorerTextAnswer=pe;exports.isExplorerTreeResult=Ee;exports.isRootRelativeUrl=c;exports.lastPathSegment=z;exports.readExplorerAssetDisplay=ke;exports.resolvePathRules=Q;exports.revisionViolation=k;
|