@tdacorp/hyle-sdk 0.17.0 → 0.21.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/README.md +155 -28
- package/dist/check-routes-bin.js +38 -13
- package/dist/chunk-56Y24XBV.js +840 -0
- package/dist/{chunk-MGSUQBDW.js → chunk-75JFLML4.js} +176 -14
- package/dist/chunk-HJX57NLI.js +1105 -0
- package/dist/chunk-K5VDLROQ.js +145 -0
- package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
- package/dist/chunk-U74B7AUG.js +398 -0
- package/dist/{chunk-6VOHFFA5.js → chunk-X2TLYM7Y.js} +2 -2
- package/dist/client-41fU6OY2.d.cts +201 -0
- package/dist/client-LwzHwqpM.d.ts +201 -0
- package/dist/code-copy.cjs +72 -0
- package/dist/code-copy.d.cts +15 -0
- package/dist/code-copy.d.ts +15 -0
- package/dist/code-copy.js +48 -0
- package/dist/comments.cjs +728 -275
- package/dist/comments.d.cts +66 -3
- package/dist/comments.d.ts +66 -3
- package/dist/comments.js +409 -326
- package/dist/{diagram-viewer-FJPED4SN.js → diagram-viewer-XY3CG75U.js} +62 -21
- package/dist/{embed-BmdwA2G9.d.cts → embed-BUFRQboD.d.ts} +2 -2
- package/dist/{embed-DNTZ2UXv.d.ts → embed-CYt-q13P.d.cts} +2 -2
- package/dist/fragment-alias.cjs +51 -0
- package/dist/fragment-alias.d.cts +7 -0
- package/dist/fragment-alias.d.ts +7 -0
- package/dist/fragment-alias.js +27 -0
- package/dist/html.cjs +881 -0
- package/dist/html.d.cts +20 -0
- package/dist/html.d.ts +20 -0
- package/dist/html.js +45 -0
- package/dist/index.cjs +181 -14
- package/dist/index.d.cts +14 -62
- package/dist/index.d.ts +14 -62
- package/dist/index.js +11 -1
- package/dist/{labels-nmukKYgL.d.ts → labels-CrA-iqTN.d.cts} +9 -0
- package/dist/{labels-nmukKYgL.d.cts → labels-CrA-iqTN.d.ts} +9 -0
- package/dist/mermaid-diagram.cjs +401 -125
- package/dist/mermaid-diagram.d.cts +23 -7
- package/dist/mermaid-diagram.d.ts +23 -7
- package/dist/mermaid-diagram.js +204 -51
- package/dist/mermaid-image.cjs +134 -60
- package/dist/mermaid-image.d.cts +4 -3
- package/dist/mermaid-image.d.ts +4 -3
- package/dist/mermaid-image.js +27 -28
- package/dist/next.cjs +627 -264
- package/dist/next.d.cts +11 -8
- package/dist/next.d.ts +11 -8
- package/dist/next.js +39 -12
- package/dist/print-coordinator.cjs +157 -0
- package/dist/print-coordinator.d.cts +27 -0
- package/dist/print-coordinator.d.ts +27 -0
- package/dist/print-coordinator.js +83 -0
- package/dist/react.cjs +556 -226
- package/dist/react.d.cts +136 -29
- package/dist/react.d.ts +136 -29
- package/dist/react.js +23 -3
- package/dist/reactions.cjs +653 -0
- package/dist/reactions.d.cts +27 -0
- package/dist/reactions.d.ts +27 -0
- package/dist/reactions.js +364 -0
- package/dist/{resolve-Ae7UFjsQ.d.ts → resolve-BjAK0k_Y.d.ts} +2 -2
- package/dist/{resolve-euZ4-aC9.d.cts → resolve-eI1muCKL.d.cts} +2 -2
- package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
- package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
- package/dist/sanitize-ijiWjEm9.d.cts +23 -0
- package/dist/sanitize-ijiWjEm9.d.ts +23 -0
- package/dist/styles.css +96 -25
- package/dist/toc-spy.cjs +59 -0
- package/dist/toc-spy.d.cts +15 -0
- package/dist/toc-spy.d.ts +15 -0
- package/dist/toc-spy.js +35 -0
- package/dist/{types-Czt887Iv.d.cts → types-3F0wqD-o.d.cts} +26 -2
- package/dist/{types-Czt887Iv.d.ts → types-3F0wqD-o.d.ts} +26 -2
- package/dist/use-cache.cjs +37 -11
- package/dist/use-cache.d.cts +12 -5
- package/dist/use-cache.d.ts +12 -5
- package/dist/use-cache.js +7 -7
- package/dist/youtube-facade.cjs +50 -0
- package/dist/youtube-facade.d.cts +17 -0
- package/dist/youtube-facade.d.ts +17 -0
- package/dist/youtube-facade.js +26 -0
- package/package.json +16 -3
- package/dist/chunk-DMK4XQLU.js +0 -1556
- package/dist/chunk-PJMJMP66.js +0 -63
- package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
- package/dist/revalidation-callback-D7Ms_Puz.d.ts +0 -42
package/dist/chunk-DMK4XQLU.js
DELETED
|
@@ -1,1556 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
hostAssetHtml,
|
|
3
|
-
hostAssetSrc
|
|
4
|
-
} from "./chunk-67IOIAVW.js";
|
|
5
|
-
|
|
6
|
-
// src/react/content.tsx
|
|
7
|
-
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
8
|
-
import { Children, Fragment as Fragment2, isValidElement } from "react";
|
|
9
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
10
|
-
|
|
11
|
-
// src/react/icons.tsx
|
|
12
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
var SHAPES = {
|
|
14
|
-
info: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
|
|
16
|
-
/* @__PURE__ */ jsx("path", { d: "M8 7.3V11M8 5v.1" })
|
|
17
|
-
] }),
|
|
18
|
-
"check-circle": /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
|
|
20
|
-
/* @__PURE__ */ jsx("path", { d: "m5.3 8.3 1.9 1.9 3.5-3.9" })
|
|
21
|
-
] }),
|
|
22
|
-
alert: /* @__PURE__ */ jsx("path", { d: "M8 2 1.8 13h12.4zM8 6.5v3M8 11.3v.1" }),
|
|
23
|
-
"x-circle": /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
|
|
25
|
-
/* @__PURE__ */ jsx("path", { d: "m5.8 5.8 4.4 4.4M10.2 5.8l-4.4 4.4" })
|
|
26
|
-
] }),
|
|
27
|
-
calendar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
-
/* @__PURE__ */ jsx("rect", { x: "2", y: "3", width: "12", height: "11", rx: "1.3" }),
|
|
29
|
-
/* @__PURE__ */ jsx("path", { d: "M2 6.5h12M5.5 1.7v2.6M10.5 1.7v2.6" })
|
|
30
|
-
] }),
|
|
31
|
-
globe: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
|
|
33
|
-
/* @__PURE__ */ jsx("path", { d: "M2 8h12M8 2c2 1.7 2.8 3.7 2.8 6S10 12.3 8 14M8 2C6 3.7 5.2 5.7 5.2 8S6 12.3 8 14" })
|
|
34
|
-
] }),
|
|
35
|
-
file: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
-
/* @__PURE__ */ jsx("path", { d: "M4 1.8h5l3 3v8.4a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2.8a1 1 0 0 1 1-1z" }),
|
|
37
|
-
/* @__PURE__ */ jsx("path", { d: "M9 1.8v3h3" })
|
|
38
|
-
] }),
|
|
39
|
-
chev: /* @__PURE__ */ jsx("path", { d: "m6 3.5 4.5 4.5L6 12.5" }),
|
|
40
|
-
"chev-down": /* @__PURE__ */ jsx("path", { d: "m3.5 6 4.5 4.5L12.5 6" }),
|
|
41
|
-
"chev-left": /* @__PURE__ */ jsx("path", { d: "M10 3.5 5.5 8 10 12.5" }),
|
|
42
|
-
x: /* @__PURE__ */ jsx("path", { d: "m4 4 8 8M12 4l-8 8" }),
|
|
43
|
-
heart: /* @__PURE__ */ jsx("path", { d: "M8 13.5S2.2 10 2.2 6.1A3 3 0 0 1 8 5a3 3 0 0 1 5.8 1.1C13.8 10 8 13.5 8 13.5z" }),
|
|
44
|
-
reply: /* @__PURE__ */ jsx("path", { d: "M6.5 3.5 2.5 7.5l4 4M2.5 7.5h6a5 5 0 0 1 5 5" }),
|
|
45
|
-
clock: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
|
|
47
|
-
/* @__PURE__ */ jsx("path", { d: "M8 4.5V8l2.3 1.5" })
|
|
48
|
-
] }),
|
|
49
|
-
ban: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
|
|
51
|
-
/* @__PURE__ */ jsx("path", { d: "m3.8 12.2 8.4-8.4" })
|
|
52
|
-
] }),
|
|
53
|
-
refresh: /* @__PURE__ */ jsx("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" })
|
|
54
|
-
};
|
|
55
|
-
function Icon({ name, className }) {
|
|
56
|
-
return /* @__PURE__ */ jsx("svg", { className: className ? `hyle-ic ${className}` : "hyle-ic", viewBox: "0 0 16 16", "aria-hidden": "true", children: SHAPES[name] });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// src/react/content.tsx
|
|
60
|
-
import { MermaidDiagram } from "./mermaid-diagram.js";
|
|
61
|
-
import { MermaidImage } from "./mermaid-image.js";
|
|
62
|
-
|
|
63
|
-
// src/react/sanitize.ts
|
|
64
|
-
var HastLimitError = class extends Error {
|
|
65
|
-
constructor(message) {
|
|
66
|
-
super(message);
|
|
67
|
-
this.name = "HastLimitError";
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
var MAX_NODES = 2e4;
|
|
71
|
-
var MAX_TEXT = 512 * 1024;
|
|
72
|
-
var MAX_DEPTH = 128;
|
|
73
|
-
var MAX_SRCDOC = 1024 * 1024;
|
|
74
|
-
var DROP = /* @__PURE__ */ new Set(["script", "style", "template", "noscript"]);
|
|
75
|
-
var VOID = /* @__PURE__ */ new Set(["br", "hr", "img", "input", "path"]);
|
|
76
|
-
var isString = (v) => typeof v === "string";
|
|
77
|
-
var isScalar = (v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean";
|
|
78
|
-
var matches = (re) => (v) => typeof v === "string" && re.test(v);
|
|
79
|
-
var ID_PREFIX = "user-content-";
|
|
80
|
-
var scopeId = (id) => id.startsWith(ID_PREFIX) ? id : ID_PREFIX + id;
|
|
81
|
-
var ID_BODY = /^[\p{L}\p{N}_:.-]{1,180}$/u;
|
|
82
|
-
var isIdValue = (v) => typeof v === "string" && ID_BODY.test(v.startsWith(ID_PREFIX) ? v.slice(ID_PREFIX.length) : v);
|
|
83
|
-
var CLASS_TOKEN = /^[A-Za-z_][\w:-]*$/;
|
|
84
|
-
var classTokens = (v) => {
|
|
85
|
-
const tokens = Array.isArray(v) ? v : typeof v === "string" ? v.split(/\s+/) : [];
|
|
86
|
-
return tokens.length > 0 && tokens.every((t) => typeof t === "string" && CLASS_TOKEN.test(t)) ? tokens : void 0;
|
|
87
|
-
};
|
|
88
|
-
var isClass = (v) => classTokens(v) !== void 0;
|
|
89
|
-
var isAlign = matches(/^(left|right|center)$/);
|
|
90
|
-
var isPixels = (v) => typeof v === "number" ? Number.isInteger(v) && v > 0 : typeof v === "string" && /^[1-9]\d*$/.test(v);
|
|
91
|
-
var isLength = matches(/^[\d.]+(em|px|%)?$/);
|
|
92
|
-
var STYLE_PROPS = /* @__PURE__ */ new Set(["height", "vertical-align", "margin-left", "margin-right", "margin-top", "margin-bottom", "top", "width", "min-width", "border-bottom-width", "padding-left"]);
|
|
93
|
-
var STYLE_LENGTH = /^(-?\d+(?:\.\d+)?)(em|px|%)?$/;
|
|
94
|
-
var MAX_STYLE_MAGNITUDE = 100;
|
|
95
|
-
function isKatexStyle(v, ctx2) {
|
|
96
|
-
if (typeof v !== "string" || !ctx2.katex) return false;
|
|
97
|
-
return v.split(";").filter((d) => d !== "").every((decl) => {
|
|
98
|
-
const [prop, value, ...extra] = decl.split(":");
|
|
99
|
-
if (extra.length > 0 || prop === void 0 || value === void 0) return false;
|
|
100
|
-
if (prop === "position") return value === "relative";
|
|
101
|
-
const m = STYLE_LENGTH.exec(value);
|
|
102
|
-
return STYLE_PROPS.has(prop) && m !== null && Math.abs(Number(m[1])) <= MAX_STYLE_MAGNITUDE;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function isSafeUrl(value, kind) {
|
|
106
|
-
if (typeof value !== "string") return false;
|
|
107
|
-
const url = value.trim();
|
|
108
|
-
if (url.length === 0 || /[\u0000-\u001f\u007f\\]/.test(url)) return false;
|
|
109
|
-
if (url.startsWith("#")) return kind === "href";
|
|
110
|
-
if (url.startsWith("/")) return !url.startsWith("//");
|
|
111
|
-
try {
|
|
112
|
-
const { protocol } = new URL(url);
|
|
113
|
-
return protocol === "https:" || protocol === "http:" || kind === "href" && protocol === "mailto:";
|
|
114
|
-
} catch {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
var isHref = (v) => isSafeUrl(v, "href") && (typeof v !== "string" || !v.trim().startsWith("#") || isIdValue(v.trim().slice(1)));
|
|
119
|
-
var isSrc = (v) => isSafeUrl(v, "src");
|
|
120
|
-
var MERMAID_SCRIPT_URL = "https://cdnjs.cloudflare.com/ajax/libs/mermaid/11.9.0/mermaid.min.js";
|
|
121
|
-
var MERMAID_SRCDOC = new RegExp(
|
|
122
|
-
`^<!doctype html><html><head><meta charset="utf-8"></head><body><div class="mermaid">([^<]*)</div><script src="${MERMAID_SCRIPT_URL.replace(/[.]/g, "\\.")}"></script><script>mermaid\\.initialize\\(\\{ startOnLoad: true, securityLevel: "strict" \\}\\);</script></body></html>$`
|
|
123
|
-
);
|
|
124
|
-
var isMermaidSrcdoc = (v) => typeof v === "string" && v.length <= MAX_SRCDOC && MERMAID_SRCDOC.test(v);
|
|
125
|
-
var ENTITIES = { "<": "<", "&": "&", "<": "<", ">": ">", "&": "&", """: '"', "'": "'" };
|
|
126
|
-
function mermaidSource(srcDoc) {
|
|
127
|
-
return MERMAID_SRCDOC.exec(srcDoc)?.[1]?.replace(/&(?:#x3c|#x26|#x27|lt|gt|amp|quot);/gi, (e) => ENTITIES[e.toLowerCase()]);
|
|
128
|
-
}
|
|
129
|
-
var RENDER_REF = /^(\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.svg) ([1-9]\d{0,5}) ([1-9]\d{0,5})$/;
|
|
130
|
-
var isRenderRef = matches(RENDER_REF);
|
|
131
|
-
function diagramRender(value) {
|
|
132
|
-
const m = typeof value === "string" ? RENDER_REF.exec(value) : null;
|
|
133
|
-
return m ? { src: hostAssetSrc(m[1]), width: Number(m[2]), height: Number(m[3]) } : void 0;
|
|
134
|
-
}
|
|
135
|
-
var heading = { id: isIdValue, className: isClass };
|
|
136
|
-
var ATTRS = new Map(
|
|
137
|
-
Object.entries({
|
|
138
|
-
p: {},
|
|
139
|
-
em: {},
|
|
140
|
-
strong: {},
|
|
141
|
-
del: {},
|
|
142
|
-
hr: {},
|
|
143
|
-
br: {},
|
|
144
|
-
sup: {},
|
|
145
|
-
blockquote: {},
|
|
146
|
-
thead: {},
|
|
147
|
-
tbody: {},
|
|
148
|
-
tr: {},
|
|
149
|
-
ol: {},
|
|
150
|
-
ul: { className: isClass },
|
|
151
|
-
li: { id: isIdValue, className: isClass },
|
|
152
|
-
h1: heading,
|
|
153
|
-
h2: heading,
|
|
154
|
-
h3: heading,
|
|
155
|
-
h4: heading,
|
|
156
|
-
h5: heading,
|
|
157
|
-
h6: heading,
|
|
158
|
-
a: { href: isHref, id: isIdValue, ariaDescribedBy: isIdValue, ariaLabel: isString, dataFootnoteRef: isScalar, dataFootnoteBackref: isScalar, className: isClass },
|
|
159
|
-
img: { src: isSrc, alt: isString, width: isPixels, height: isPixels },
|
|
160
|
-
table: {},
|
|
161
|
-
th: { scope: matches(/^(row|col|rowgroup|colgroup)$/), align: isAlign },
|
|
162
|
-
td: { align: isAlign },
|
|
163
|
-
pre: { className: isClass },
|
|
164
|
-
code: { className: isClass },
|
|
165
|
-
section: { dataFootnotes: isScalar, className: isClass },
|
|
166
|
-
input: { type: matches(/^checkbox$/), disabled: isScalar, checked: isScalar },
|
|
167
|
-
span: { className: isClass, style: isKatexStyle, ariaHidden: matches(/^(true|false)$/) },
|
|
168
|
-
svg: { xmlns: matches(/^http:\/\/www\.w3\.org\/2000\/svg$/), width: isLength, height: isLength, viewBox: matches(/^-?[\d.]+ -?[\d.]+ -?[\d.]+ -?[\d.]+$/), preserveAspectRatio: matches(/^[\w ]+$/) },
|
|
169
|
-
path: { d: matches(/^[MLCSQTAHVZmlcsqtahvz0-9.,\-\s]+$/) },
|
|
170
|
-
video: { src: isSrc, controls: isScalar },
|
|
171
|
-
audio: { src: isSrc, controls: isScalar },
|
|
172
|
-
// hyle's sandboxed Mermaid frame (ADR 0001). The renderer emits `sandbox` as ["allow-scripts"]; it is normalized below.
|
|
173
|
-
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc, dataLight: isRenderRef, dataDark: isRenderRef }
|
|
174
|
-
})
|
|
175
|
-
);
|
|
176
|
-
var isObject = (v) => typeof v === "object" && v !== null;
|
|
177
|
-
function textOf(node, depth = 0) {
|
|
178
|
-
if (!isObject(node) || depth > MAX_DEPTH) return "";
|
|
179
|
-
if (node.type === "text") return typeof node.value === "string" ? node.value : "";
|
|
180
|
-
return Array.isArray(node.children) ? node.children.map((c) => textOf(c, depth + 1)).join("") : "";
|
|
181
|
-
}
|
|
182
|
-
var CALLOUT_MARKER = /^\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*/i;
|
|
183
|
-
var CALLOUT_KIND = { note: "note", tip: "tip", important: "warning", warning: "warning", caution: "caution" };
|
|
184
|
-
function toCallout(children) {
|
|
185
|
-
const first = children.find((c) => c.type === "element");
|
|
186
|
-
const lead = first?.tagName === "p" ? first.children[0] : void 0;
|
|
187
|
-
const marker = lead?.type === "text" ? CALLOUT_MARKER.exec(lead.value) : null;
|
|
188
|
-
if (!first || lead?.type !== "text" || !marker) return void 0;
|
|
189
|
-
const rest = lead.value.slice(marker[0].length);
|
|
190
|
-
const firstChildren = rest ? [{ type: "text", value: rest }, ...first.children.slice(1)] : first.children.slice(1);
|
|
191
|
-
const body = firstChildren.length > 0 ? [{ ...first, children: firstChildren }] : [];
|
|
192
|
-
const kind = CALLOUT_KIND[(marker[1] ?? "note").toLowerCase()] ?? "note";
|
|
193
|
-
return { type: "element", tagName: "callout", properties: { kind }, children: [...body, ...children.slice(children.indexOf(first) + 1)] };
|
|
194
|
-
}
|
|
195
|
-
function clean(node, depth, ctx2, budget) {
|
|
196
|
-
if (!isObject(node) || depth > MAX_DEPTH) return [];
|
|
197
|
-
if (++budget.nodes > MAX_NODES) throw new HastLimitError("content has too many nodes");
|
|
198
|
-
if (node.type === "text") {
|
|
199
|
-
if (typeof node.value !== "string") return [];
|
|
200
|
-
budget.text += node.value.length;
|
|
201
|
-
if (budget.text > MAX_TEXT) throw new HastLimitError("content is too large");
|
|
202
|
-
return [{ type: "text", value: node.value }];
|
|
203
|
-
}
|
|
204
|
-
if (node.type !== "element" || typeof node.tagName !== "string" || DROP.has(node.tagName)) return [];
|
|
205
|
-
const tag = node.tagName;
|
|
206
|
-
const rules = ATTRS.get(tag);
|
|
207
|
-
const own = isObject(node.properties) ? classTokens(node.properties.className) : void 0;
|
|
208
|
-
const inner = tag === "span" && own?.some((t) => t === "katex" || t.startsWith("katex-")) ? { katex: true } : ctx2;
|
|
209
|
-
const children = Array.isArray(node.children) ? node.children.flatMap((c) => clean(c, depth + 1, inner, budget)) : [];
|
|
210
|
-
if (!rules) return children;
|
|
211
|
-
const properties = {};
|
|
212
|
-
if (isObject(node.properties)) {
|
|
213
|
-
for (const [key, value] of Object.entries(node.properties)) {
|
|
214
|
-
if (Object.hasOwn(rules, key) && rules[key](value, inner)) properties[key] = value;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if ((tag === "img" || tag === "video" || tag === "audio") && typeof properties.src === "string") properties.src = hostAssetSrc(properties.src);
|
|
218
|
-
if (tag === "iframe") {
|
|
219
|
-
if (properties.sandbox === void 0 || properties.srcdoc === void 0) return [];
|
|
220
|
-
properties.sandbox = "allow-scripts";
|
|
221
|
-
}
|
|
222
|
-
if (tag === "input") {
|
|
223
|
-
if (properties.type !== "checkbox") return [];
|
|
224
|
-
properties.disabled = true;
|
|
225
|
-
}
|
|
226
|
-
for (const key of ["id", "ariaDescribedBy"]) if (typeof properties[key] === "string") properties[key] = scopeId(properties[key]);
|
|
227
|
-
if (tag === "a" && typeof properties.href === "string" && properties.href.trim().startsWith("#")) properties.href = `#${scopeId(properties.href.trim().slice(1))}`;
|
|
228
|
-
if (tag === "blockquote") {
|
|
229
|
-
const callout = toCallout(children);
|
|
230
|
-
if (callout) return [callout];
|
|
231
|
-
}
|
|
232
|
-
const tagName = tag === "h1" ? "h2" : tag;
|
|
233
|
-
return [{ type: "element", tagName, properties, children: VOID.has(tag) ? [] : children }];
|
|
234
|
-
}
|
|
235
|
-
function sanitizeHast(tree, title, description) {
|
|
236
|
-
const raw = isObject(tree) && tree.type === "root" && Array.isArray(tree.children) ? tree.children : [];
|
|
237
|
-
const elements = raw.filter((n) => isObject(n) && n.type === "element");
|
|
238
|
-
const [first] = elements;
|
|
239
|
-
const skip = title !== void 0 && isObject(first) && first.tagName === "h1" && textOf(first).trim() === title.trim() ? first : void 0;
|
|
240
|
-
const lead = elements[skip ? 1 : 0];
|
|
241
|
-
const repeat = description && isObject(lead) && lead.tagName === "p" && textOf(lead).trim().startsWith(description.trim()) ? lead : void 0;
|
|
242
|
-
const budget = { nodes: 0, text: 0 };
|
|
243
|
-
return { type: "root", children: raw.filter((n) => n !== skip && n !== repeat).flatMap((n) => clean(n, 0, { katex: false }, budget)) };
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// src/react/comments-labels.ts
|
|
247
|
-
var COMMENT_LABELS_EN = {
|
|
248
|
-
heading: "Comments",
|
|
249
|
-
countLabel: "{n} comments",
|
|
250
|
-
likeArticle: "Like this article",
|
|
251
|
-
likedArticle: "Liked",
|
|
252
|
-
likeArticleSignIn: "(sign in), ",
|
|
253
|
-
likeComment: "Like this comment, ",
|
|
254
|
-
likeCommentSignIn: "Sign in to like this comment, ",
|
|
255
|
-
signInTitle: "Sign in to join the discussion",
|
|
256
|
-
signInBody: "Anyone can read. To comment or like, sign in.",
|
|
257
|
-
signIn: "Sign in",
|
|
258
|
-
commentingAs: "Commenting as {name}",
|
|
259
|
-
write: "Write a comment",
|
|
260
|
-
placeholder: "Add to the discussion",
|
|
261
|
-
help: "Markdown: links, emphasis, code and quotes.",
|
|
262
|
-
chars: "{n} / {max}",
|
|
263
|
-
post: "Post comment",
|
|
264
|
-
posting: "Posting",
|
|
265
|
-
reply: "Reply",
|
|
266
|
-
replyTo: "Reply to {name}",
|
|
267
|
-
replyPlaceholder: "Write a reply",
|
|
268
|
-
cancel: "Cancel",
|
|
269
|
-
edit: "Edit",
|
|
270
|
-
editLeft: "({n} min left)",
|
|
271
|
-
save: "Save",
|
|
272
|
-
delete: "Delete",
|
|
273
|
-
deleteConfirm: "Delete this comment?",
|
|
274
|
-
keep: "Keep",
|
|
275
|
-
you: "You",
|
|
276
|
-
edited: "edited",
|
|
277
|
-
removed: "This comment was removed.",
|
|
278
|
-
removedByModerator: "This comment was removed by a moderator.",
|
|
279
|
-
removedByAuthor: "This comment was deleted by its author.",
|
|
280
|
-
depthEnd: "Replies end at this depth",
|
|
281
|
-
held: "Awaiting approval.",
|
|
282
|
-
heldBanner: "Thanks, your comment is awaiting approval",
|
|
283
|
-
heldBannerBody: "New commenters may be reviewed first. You will see it here, marked as pending, until a moderator approves it. Nobody else can see it yet.",
|
|
284
|
-
heldNote: "Only you can see this until a moderator approves it.",
|
|
285
|
-
heldLive: "Comment awaiting approval",
|
|
286
|
-
postedLive: "Comment posted",
|
|
287
|
-
deletedLive: "Comment deleted",
|
|
288
|
-
savedLive: "Comment saved",
|
|
289
|
-
empty: "No comments yet",
|
|
290
|
-
emptyBody: "Start the discussion. Comments may be reviewed before they appear.",
|
|
291
|
-
loading: "Loading comments",
|
|
292
|
-
loadError: "Comments could not be loaded",
|
|
293
|
-
loadErrorBody: "The article is fine. The comments service did not answer.",
|
|
294
|
-
retry: "Try again",
|
|
295
|
-
postError: "Your comment was not posted. We kept your text, so nothing is lost. Check your connection and try again.",
|
|
296
|
-
tooLong: "That comment is too long or empty. Comments are 1 to 4000 characters.",
|
|
297
|
-
editClosed: "Comments can be edited for ten minutes after posting. That time has passed.",
|
|
298
|
-
actionError: "That did not go through. Please try again.",
|
|
299
|
-
rateTitle: "You are commenting too quickly",
|
|
300
|
-
rateBody: "Please wait before posting again. Your draft is kept in the box below.",
|
|
301
|
-
rateWait: "You can post again in {n} seconds.",
|
|
302
|
-
bannedTitle: "You cannot comment right now",
|
|
303
|
-
bannedBody: "Commenting is not available for your account on this site. You can still read every comment. If you think this is a mistake, contact the site team.",
|
|
304
|
-
expired: "Your session ended. Sign in again to post. Your text is kept.",
|
|
305
|
-
more: "Load more comments",
|
|
306
|
-
truncated: "Showing the first 500 comments.",
|
|
307
|
-
justNow: "just now"
|
|
308
|
-
};
|
|
309
|
-
var COMMENT_LABELS_FR = {
|
|
310
|
-
heading: "Commentaires",
|
|
311
|
-
countLabel: "{n} commentaires",
|
|
312
|
-
likeArticle: "Aimer cet article",
|
|
313
|
-
likedArticle: "Aim\xE9",
|
|
314
|
-
likeArticleSignIn: "(connexion requise), ",
|
|
315
|
-
likeComment: "Aimer ce commentaire, ",
|
|
316
|
-
likeCommentSignIn: "Connectez-vous pour aimer ce commentaire, ",
|
|
317
|
-
signInTitle: "Connectez-vous pour participer \xE0 la discussion",
|
|
318
|
-
signInBody: "Tout le monde peut lire. Pour commenter ou aimer, connectez-vous.",
|
|
319
|
-
signIn: "Se connecter",
|
|
320
|
-
commentingAs: "Vous commentez en tant que {name}",
|
|
321
|
-
write: "\xC9crire un commentaire",
|
|
322
|
-
placeholder: "Participez \xE0 la discussion",
|
|
323
|
-
help: "Markdown : liens, emphase, code et citations.",
|
|
324
|
-
chars: "{n} / {max}",
|
|
325
|
-
post: "Publier le commentaire",
|
|
326
|
-
posting: "Publication",
|
|
327
|
-
reply: "R\xE9pondre",
|
|
328
|
-
replyTo: "R\xE9pondre \xE0 {name}",
|
|
329
|
-
replyPlaceholder: "\xC9crire une r\xE9ponse",
|
|
330
|
-
cancel: "Annuler",
|
|
331
|
-
edit: "Modifier",
|
|
332
|
-
editLeft: "({n} min restantes)",
|
|
333
|
-
save: "Enregistrer",
|
|
334
|
-
delete: "Supprimer",
|
|
335
|
-
deleteConfirm: "Supprimer ce commentaire ?",
|
|
336
|
-
keep: "Conserver",
|
|
337
|
-
you: "Vous",
|
|
338
|
-
edited: "modifi\xE9",
|
|
339
|
-
removed: "Ce commentaire a \xE9t\xE9 retir\xE9.",
|
|
340
|
-
removedByModerator: "Ce commentaire a \xE9t\xE9 retir\xE9 par un mod\xE9rateur.",
|
|
341
|
-
removedByAuthor: "Ce commentaire a \xE9t\xE9 supprim\xE9 par son auteur.",
|
|
342
|
-
depthEnd: "Les r\xE9ponses s'arr\xEAtent \xE0 ce niveau",
|
|
343
|
-
held: "En attente d'approbation.",
|
|
344
|
-
heldBanner: "Merci, votre commentaire est en attente d'approbation",
|
|
345
|
-
heldBannerBody: "Les nouveaux commentaires peuvent \xEAtre relus d'abord. Vous le voyez ici, marqu\xE9 en attente, jusqu'\xE0 son approbation par un mod\xE9rateur. Personne d'autre ne peut le voir.",
|
|
346
|
-
heldNote: "Vous seul le voyez tant qu'un mod\xE9rateur ne l'a pas approuv\xE9.",
|
|
347
|
-
heldLive: "Commentaire en attente d'approbation",
|
|
348
|
-
postedLive: "Commentaire publi\xE9",
|
|
349
|
-
deletedLive: "Commentaire supprim\xE9",
|
|
350
|
-
savedLive: "Commentaire enregistr\xE9",
|
|
351
|
-
empty: "Aucun commentaire pour l'instant",
|
|
352
|
-
emptyBody: "Lancez la discussion. Les commentaires peuvent \xEAtre relus avant d'appara\xEEtre.",
|
|
353
|
-
loading: "Chargement des commentaires",
|
|
354
|
-
loadError: "Les commentaires n'ont pas pu \xEAtre charg\xE9s",
|
|
355
|
-
loadErrorBody: "L'article est intact. Le service de commentaires n'a pas r\xE9pondu.",
|
|
356
|
-
retry: "R\xE9essayer",
|
|
357
|
-
postError: "Votre commentaire n'a pas \xE9t\xE9 publi\xE9. Votre texte est conserv\xE9. V\xE9rifiez votre connexion et r\xE9essayez.",
|
|
358
|
-
tooLong: "Ce commentaire est trop long ou vide. Un commentaire compte de 1 \xE0 4000 caract\xE8res.",
|
|
359
|
-
editClosed: "Un commentaire peut \xEAtre modifi\xE9 pendant dix minutes apr\xE8s sa publication. Ce d\xE9lai est \xE9coul\xE9.",
|
|
360
|
-
actionError: "L'action a \xE9chou\xE9. R\xE9essayez.",
|
|
361
|
-
rateTitle: "Vous commentez trop vite",
|
|
362
|
-
rateBody: "Patientez avant de publier \xE0 nouveau. Votre brouillon est conserv\xE9 dans la zone ci-dessous.",
|
|
363
|
-
rateWait: "Vous pourrez publier \xE0 nouveau dans {n} secondes.",
|
|
364
|
-
bannedTitle: "Vous ne pouvez pas commenter pour le moment",
|
|
365
|
-
bannedBody: "Les commentaires ne sont pas disponibles pour votre compte sur ce site. Vous pouvez toujours tout lire. Si vous pensez \xE0 une erreur, contactez l'\xE9quipe du site.",
|
|
366
|
-
expired: "Votre session a expir\xE9. Reconnectez-vous pour publier. Votre texte est conserv\xE9.",
|
|
367
|
-
more: "Charger plus de commentaires",
|
|
368
|
-
truncated: "Affichage des 500 premiers commentaires.",
|
|
369
|
-
justNow: "\xE0 l'instant"
|
|
370
|
-
};
|
|
371
|
-
var COMMENT_LABELS_ES = {
|
|
372
|
-
heading: "Comentarios",
|
|
373
|
-
countLabel: "{n} comentarios",
|
|
374
|
-
likeArticle: "Me gusta este art\xEDculo",
|
|
375
|
-
likedArticle: "Te gusta",
|
|
376
|
-
likeArticleSignIn: "(inicia sesi\xF3n), ",
|
|
377
|
-
likeComment: "Me gusta este comentario, ",
|
|
378
|
-
likeCommentSignIn: "Inicia sesi\xF3n para dar me gusta a este comentario, ",
|
|
379
|
-
signInTitle: "Inicia sesi\xF3n para unirte a la conversaci\xF3n",
|
|
380
|
-
signInBody: "Todos pueden leer. Para comentar o dar me gusta, inicia sesi\xF3n.",
|
|
381
|
-
signIn: "Iniciar sesi\xF3n",
|
|
382
|
-
commentingAs: "Comentando como {name}",
|
|
383
|
-
write: "Escribe un comentario",
|
|
384
|
-
placeholder: "A\xF1ade a la conversaci\xF3n",
|
|
385
|
-
help: "Markdown: enlaces, \xE9nfasis, c\xF3digo y citas.",
|
|
386
|
-
chars: "{n} / {max}",
|
|
387
|
-
post: "Publicar comentario",
|
|
388
|
-
posting: "Publicando",
|
|
389
|
-
reply: "Responder",
|
|
390
|
-
replyTo: "Responder a {name}",
|
|
391
|
-
replyPlaceholder: "Escribe una respuesta",
|
|
392
|
-
cancel: "Cancelar",
|
|
393
|
-
edit: "Editar",
|
|
394
|
-
editLeft: "(quedan {n} min)",
|
|
395
|
-
save: "Guardar",
|
|
396
|
-
delete: "Eliminar",
|
|
397
|
-
deleteConfirm: "\xBFEliminar este comentario?",
|
|
398
|
-
keep: "Conservar",
|
|
399
|
-
you: "T\xFA",
|
|
400
|
-
edited: "editado",
|
|
401
|
-
removed: "Este comentario fue eliminado.",
|
|
402
|
-
removedByModerator: "Un moderador elimin\xF3 este comentario.",
|
|
403
|
-
removedByAuthor: "Su autor elimin\xF3 este comentario.",
|
|
404
|
-
depthEnd: "Las respuestas terminan en este nivel",
|
|
405
|
-
held: "Pendiente de aprobaci\xF3n.",
|
|
406
|
-
heldBanner: "Gracias, tu comentario est\xE1 pendiente de aprobaci\xF3n",
|
|
407
|
-
heldBannerBody: "Los comentarios nuevos pueden revisarse primero. Lo ves aqu\xED, marcado como pendiente, hasta que un moderador lo apruebe. Nadie m\xE1s puede verlo todav\xEDa.",
|
|
408
|
-
heldNote: "Solo t\xFA lo ves hasta que un moderador lo apruebe.",
|
|
409
|
-
heldLive: "Comentario pendiente de aprobaci\xF3n",
|
|
410
|
-
postedLive: "Comentario publicado",
|
|
411
|
-
deletedLive: "Comentario eliminado",
|
|
412
|
-
savedLive: "Comentario guardado",
|
|
413
|
-
empty: "A\xFAn no hay comentarios",
|
|
414
|
-
emptyBody: "Empieza la conversaci\xF3n. Los comentarios pueden revisarse antes de aparecer.",
|
|
415
|
-
loading: "Cargando comentarios",
|
|
416
|
-
loadError: "No se pudieron cargar los comentarios",
|
|
417
|
-
loadErrorBody: "El art\xEDculo est\xE1 bien. El servicio de comentarios no respondi\xF3.",
|
|
418
|
-
retry: "Reintentar",
|
|
419
|
-
postError: "Tu comentario no se public\xF3. Hemos conservado tu texto. Revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",
|
|
420
|
-
tooLong: "Ese comentario es demasiado largo o est\xE1 vac\xEDo. Los comentarios tienen de 1 a 4000 caracteres.",
|
|
421
|
-
editClosed: "Un comentario puede editarse durante diez minutos tras publicarlo. Ese tiempo ya pas\xF3.",
|
|
422
|
-
actionError: "No se pudo completar. Int\xE9ntalo de nuevo.",
|
|
423
|
-
rateTitle: "Est\xE1s comentando demasiado r\xE1pido",
|
|
424
|
-
rateBody: "Espera antes de publicar de nuevo. Tu borrador se conserva en el cuadro de abajo.",
|
|
425
|
-
rateWait: "Podr\xE1s publicar de nuevo en {n} segundos.",
|
|
426
|
-
bannedTitle: "No puedes comentar por ahora",
|
|
427
|
-
bannedBody: "Los comentarios no est\xE1n disponibles para tu cuenta en este sitio. A\xFAn puedes leerlos todos. Si crees que es un error, contacta con el equipo del sitio.",
|
|
428
|
-
expired: "Tu sesi\xF3n termin\xF3. Inicia sesi\xF3n de nuevo para publicar. Tu texto se conserva.",
|
|
429
|
-
more: "Cargar m\xE1s comentarios",
|
|
430
|
-
truncated: "Se muestran los primeros 500 comentarios.",
|
|
431
|
-
justNow: "ahora mismo"
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
// src/react/viewer/labels.ts
|
|
435
|
-
var VIEWER_LABELS_EN = {
|
|
436
|
-
expand: "Expand diagram",
|
|
437
|
-
expandHint: "Expand",
|
|
438
|
-
viewer: "Diagram viewer",
|
|
439
|
-
close: "Close",
|
|
440
|
-
zoomIn: "Zoom in",
|
|
441
|
-
zoomOut: "Zoom out",
|
|
442
|
-
fit: "Fit to window",
|
|
443
|
-
actual: "Actual size",
|
|
444
|
-
search: "Find in diagram",
|
|
445
|
-
searchPlaceholder: "Find",
|
|
446
|
-
noMatch: "No match",
|
|
447
|
-
matchOf: "{n} of {total}",
|
|
448
|
-
copySource: "Copy diagram source",
|
|
449
|
-
downloadSvg: "Download SVG",
|
|
450
|
-
downloadPng: "Download PNG",
|
|
451
|
-
copyImage: "Copy as image",
|
|
452
|
-
pngScale: "PNG scale",
|
|
453
|
-
fullscreen: "Fullscreen",
|
|
454
|
-
exitFullscreen: "Exit fullscreen",
|
|
455
|
-
copied: "Copied",
|
|
456
|
-
saved: "Saved",
|
|
457
|
-
unavailable: "Not available here",
|
|
458
|
-
hint: "Scroll to zoom, drag to pan, click a node to trace its paths, press / to search",
|
|
459
|
-
legendSelected: "Selected",
|
|
460
|
-
legendUpstream: "Upstream",
|
|
461
|
-
legendDownstream: "Downstream",
|
|
462
|
-
outgoing: "outgoing",
|
|
463
|
-
tracing: "{label}: {up} upstream, {down} downstream",
|
|
464
|
-
map: "Overview map"
|
|
465
|
-
};
|
|
466
|
-
var VIEWER_LABELS_FR = {
|
|
467
|
-
expand: "Agrandir le sch\xE9ma",
|
|
468
|
-
expandHint: "Agrandir",
|
|
469
|
-
viewer: "Visionneuse de sch\xE9ma",
|
|
470
|
-
close: "Fermer",
|
|
471
|
-
zoomIn: "Zoom avant",
|
|
472
|
-
zoomOut: "Zoom arri\xE8re",
|
|
473
|
-
fit: "Ajuster \xE0 la fen\xEAtre",
|
|
474
|
-
actual: "Taille r\xE9elle",
|
|
475
|
-
search: "Rechercher dans le sch\xE9ma",
|
|
476
|
-
searchPlaceholder: "Rechercher",
|
|
477
|
-
noMatch: "Aucun r\xE9sultat",
|
|
478
|
-
matchOf: "{n} sur {total}",
|
|
479
|
-
copySource: "Copier la source du sch\xE9ma",
|
|
480
|
-
downloadSvg: "T\xE9l\xE9charger le SVG",
|
|
481
|
-
downloadPng: "T\xE9l\xE9charger le PNG",
|
|
482
|
-
copyImage: "Copier comme image",
|
|
483
|
-
pngScale: "\xC9chelle du PNG",
|
|
484
|
-
fullscreen: "Plein \xE9cran",
|
|
485
|
-
exitFullscreen: "Quitter le plein \xE9cran",
|
|
486
|
-
copied: "Copi\xE9",
|
|
487
|
-
saved: "Enregistr\xE9",
|
|
488
|
-
unavailable: "Indisponible ici",
|
|
489
|
-
hint: "Molette pour zoomer, glisser pour d\xE9placer, cliquer un n\u0153ud pour suivre ses chemins, / pour chercher",
|
|
490
|
-
legendSelected: "S\xE9lection",
|
|
491
|
-
legendUpstream: "En amont",
|
|
492
|
-
legendDownstream: "En aval",
|
|
493
|
-
outgoing: "sortants",
|
|
494
|
-
tracing: "{label} : {up} en amont, {down} en aval",
|
|
495
|
-
map: "Carte d'ensemble"
|
|
496
|
-
};
|
|
497
|
-
var VIEWER_LABELS_ES = {
|
|
498
|
-
expand: "Ampliar el diagrama",
|
|
499
|
-
expandHint: "Ampliar",
|
|
500
|
-
viewer: "Visor de diagramas",
|
|
501
|
-
close: "Cerrar",
|
|
502
|
-
zoomIn: "Acercar",
|
|
503
|
-
zoomOut: "Alejar",
|
|
504
|
-
fit: "Ajustar a la ventana",
|
|
505
|
-
actual: "Tama\xF1o real",
|
|
506
|
-
search: "Buscar en el diagrama",
|
|
507
|
-
searchPlaceholder: "Buscar",
|
|
508
|
-
noMatch: "Sin resultados",
|
|
509
|
-
matchOf: "{n} de {total}",
|
|
510
|
-
copySource: "Copiar el c\xF3digo del diagrama",
|
|
511
|
-
downloadSvg: "Descargar SVG",
|
|
512
|
-
downloadPng: "Descargar PNG",
|
|
513
|
-
copyImage: "Copiar como imagen",
|
|
514
|
-
pngScale: "Escala del PNG",
|
|
515
|
-
fullscreen: "Pantalla completa",
|
|
516
|
-
exitFullscreen: "Salir de pantalla completa",
|
|
517
|
-
copied: "Copiado",
|
|
518
|
-
saved: "Guardado",
|
|
519
|
-
unavailable: "No disponible aqu\xED",
|
|
520
|
-
hint: "Rueda para acercar, arrastra para mover, pulsa un nodo para seguir sus caminos, / para buscar",
|
|
521
|
-
legendSelected: "Seleccionado",
|
|
522
|
-
legendUpstream: "Aguas arriba",
|
|
523
|
-
legendDownstream: "Aguas abajo",
|
|
524
|
-
outgoing: "salientes",
|
|
525
|
-
tracing: "{label}: {up} aguas arriba, {down} aguas abajo",
|
|
526
|
-
map: "Mapa general"
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
// src/react/strings.ts
|
|
530
|
-
var en = {
|
|
531
|
-
toc: "On this page",
|
|
532
|
-
prev: "Previous",
|
|
533
|
-
next: "Next",
|
|
534
|
-
pager: "Pager",
|
|
535
|
-
languages: "Languages",
|
|
536
|
-
readIn: "Read in",
|
|
537
|
-
anchor: "Link to this section",
|
|
538
|
-
table: "Table",
|
|
539
|
-
crumbs: "Breadcrumb",
|
|
540
|
-
by: "By",
|
|
541
|
-
note: "Note",
|
|
542
|
-
warning: "Heads up",
|
|
543
|
-
tip: "Tip",
|
|
544
|
-
caution: "Caution",
|
|
545
|
-
diagram: "Diagram",
|
|
546
|
-
diagramError: "This diagram could not be rendered.",
|
|
547
|
-
diagramLoading: "Loading the diagram",
|
|
548
|
-
diagramSource: "Diagram source",
|
|
549
|
-
contentError: "This content cannot be displayed.",
|
|
550
|
-
fallbackTitle: "Not translated into {language} yet.",
|
|
551
|
-
fallbackBody: "You are reading the original.",
|
|
552
|
-
readingTime: "{n} min read",
|
|
553
|
-
readingTimeLabel: "Reading time",
|
|
554
|
-
older: "Older posts",
|
|
555
|
-
viewAll: "View all",
|
|
556
|
-
moreInSection: "More in this section",
|
|
557
|
-
subPages: "In this section",
|
|
558
|
-
readAtSource: "Read at source",
|
|
559
|
-
emptyTitle: "Nothing published here yet",
|
|
560
|
-
emptyBody: "Documents published to this section will appear here, newest first.",
|
|
561
|
-
docs: "Documentation",
|
|
562
|
-
menu: "Menu",
|
|
563
|
-
closeMenu: "Close menu",
|
|
564
|
-
updated: "Last updated",
|
|
565
|
-
nfKind: "404 \xB7 Not found",
|
|
566
|
-
nfTitle: "This page does not exist",
|
|
567
|
-
nfBody: "The address may be mistyped, or the document may have been unpublished or moved.",
|
|
568
|
-
path: "Path",
|
|
569
|
-
home: "Go to home",
|
|
570
|
-
rdKind: "Moved",
|
|
571
|
-
rdTitle: "This page has moved",
|
|
572
|
-
rdBody: "You are being taken to its new address.",
|
|
573
|
-
from: "From",
|
|
574
|
-
to: "To",
|
|
575
|
-
rdFallback: "If nothing happens, go to the new address.",
|
|
576
|
-
unKind: "Unavailable",
|
|
577
|
-
unTitle: "This page is temporarily unavailable",
|
|
578
|
-
unBody: "The content could not be loaded. Please try again in a moment.",
|
|
579
|
-
viewer: VIEWER_LABELS_EN,
|
|
580
|
-
comments: COMMENT_LABELS_EN
|
|
581
|
-
};
|
|
582
|
-
var fr = {
|
|
583
|
-
toc: "Sur cette page",
|
|
584
|
-
prev: "Pr\xE9c\xE9dent",
|
|
585
|
-
next: "Suivant",
|
|
586
|
-
pager: "Pagination",
|
|
587
|
-
languages: "Langues",
|
|
588
|
-
readIn: "Lire en",
|
|
589
|
-
anchor: "Lien vers cette section",
|
|
590
|
-
table: "Tableau",
|
|
591
|
-
crumbs: "Fil d'Ariane",
|
|
592
|
-
by: "Par",
|
|
593
|
-
note: "Remarque",
|
|
594
|
-
warning: "Attention",
|
|
595
|
-
tip: "Astuce",
|
|
596
|
-
caution: "Danger",
|
|
597
|
-
diagram: "Sch\xE9ma",
|
|
598
|
-
diagramError: "Ce sch\xE9ma n'a pas pu \xEAtre affich\xE9.",
|
|
599
|
-
diagramLoading: "Chargement du sch\xE9ma",
|
|
600
|
-
diagramSource: "Source du sch\xE9ma",
|
|
601
|
-
contentError: "Ce contenu ne peut pas \xEAtre affich\xE9.",
|
|
602
|
-
fallbackTitle: "Pas encore traduit en {language}.",
|
|
603
|
-
fallbackBody: "Vous lisez l'original.",
|
|
604
|
-
readingTime: "{n} min de lecture",
|
|
605
|
-
readingTimeLabel: "Temps de lecture",
|
|
606
|
-
older: "Articles plus anciens",
|
|
607
|
-
viewAll: "Tout voir",
|
|
608
|
-
moreInSection: "Plus dans cette section",
|
|
609
|
-
subPages: "Dans cette section",
|
|
610
|
-
readAtSource: "Lire \xE0 la source",
|
|
611
|
-
emptyTitle: "Rien n'est encore publi\xE9 ici",
|
|
612
|
-
emptyBody: "Les documents publi\xE9s dans cette section appara\xEEtront ici, du plus r\xE9cent au plus ancien.",
|
|
613
|
-
docs: "Documentation",
|
|
614
|
-
menu: "Menu",
|
|
615
|
-
closeMenu: "Fermer le menu",
|
|
616
|
-
updated: "Derni\xE8re mise \xE0 jour",
|
|
617
|
-
nfKind: "404 \xB7 Introuvable",
|
|
618
|
-
nfTitle: "Cette page n'existe pas",
|
|
619
|
-
nfBody: "L'adresse est peut-\xEAtre mal saisie, ou le document a \xE9t\xE9 d\xE9publi\xE9 ou d\xE9plac\xE9.",
|
|
620
|
-
path: "Chemin",
|
|
621
|
-
home: "Aller \xE0 l'accueil",
|
|
622
|
-
rdKind: "D\xE9plac\xE9e",
|
|
623
|
-
rdTitle: "Cette page a \xE9t\xE9 d\xE9plac\xE9e",
|
|
624
|
-
rdBody: "Vous \xEAtes redirig\xE9 vers sa nouvelle adresse.",
|
|
625
|
-
from: "De",
|
|
626
|
-
to: "Vers",
|
|
627
|
-
rdFallback: "Si rien ne se passe, allez \xE0 la nouvelle adresse.",
|
|
628
|
-
unKind: "Indisponible",
|
|
629
|
-
unTitle: "Cette page est momentan\xE9ment indisponible",
|
|
630
|
-
unBody: "Le contenu n'a pas pu \xEAtre charg\xE9. R\xE9essayez dans un instant.",
|
|
631
|
-
viewer: VIEWER_LABELS_FR,
|
|
632
|
-
comments: COMMENT_LABELS_FR
|
|
633
|
-
};
|
|
634
|
-
var es = {
|
|
635
|
-
toc: "En esta p\xE1gina",
|
|
636
|
-
prev: "Anterior",
|
|
637
|
-
next: "Siguiente",
|
|
638
|
-
pager: "Paginaci\xF3n",
|
|
639
|
-
languages: "Idiomas",
|
|
640
|
-
readIn: "Leer en",
|
|
641
|
-
anchor: "Enlace a esta secci\xF3n",
|
|
642
|
-
table: "Tabla",
|
|
643
|
-
crumbs: "Ruta de navegaci\xF3n",
|
|
644
|
-
by: "Por",
|
|
645
|
-
note: "Nota",
|
|
646
|
-
warning: "Atenci\xF3n",
|
|
647
|
-
tip: "Consejo",
|
|
648
|
-
caution: "Peligro",
|
|
649
|
-
diagram: "Diagrama",
|
|
650
|
-
diagramError: "No se pudo mostrar este diagrama.",
|
|
651
|
-
diagramLoading: "Cargando el diagrama",
|
|
652
|
-
diagramSource: "C\xF3digo del diagrama",
|
|
653
|
-
contentError: "No se puede mostrar este contenido.",
|
|
654
|
-
fallbackTitle: "A\xFAn no est\xE1 traducida al {language}.",
|
|
655
|
-
fallbackBody: "Est\xE1s leyendo el original.",
|
|
656
|
-
readingTime: "{n} min de lectura",
|
|
657
|
-
readingTimeLabel: "Tiempo de lectura",
|
|
658
|
-
older: "Entradas anteriores",
|
|
659
|
-
viewAll: "Ver todo",
|
|
660
|
-
moreInSection: "M\xE1s en esta secci\xF3n",
|
|
661
|
-
subPages: "En esta secci\xF3n",
|
|
662
|
-
readAtSource: "Leer en la fuente",
|
|
663
|
-
emptyTitle: "A\xFAn no hay nada publicado aqu\xED",
|
|
664
|
-
emptyBody: "Los documentos publicados en esta secci\xF3n aparecer\xE1n aqu\xED, del m\xE1s reciente al m\xE1s antiguo.",
|
|
665
|
-
docs: "Documentaci\xF3n",
|
|
666
|
-
menu: "Men\xFA",
|
|
667
|
-
closeMenu: "Cerrar el men\xFA",
|
|
668
|
-
updated: "\xDAltima actualizaci\xF3n",
|
|
669
|
-
nfKind: "404 \xB7 No encontrada",
|
|
670
|
-
nfTitle: "Esta p\xE1gina no existe",
|
|
671
|
-
nfBody: "Puede que la direcci\xF3n est\xE9 mal escrita, o que el documento se haya despublicado o movido.",
|
|
672
|
-
path: "Ruta",
|
|
673
|
-
home: "Ir al inicio",
|
|
674
|
-
rdKind: "Movida",
|
|
675
|
-
rdTitle: "Esta p\xE1gina se ha movido",
|
|
676
|
-
rdBody: "Te estamos llevando a su nueva direcci\xF3n.",
|
|
677
|
-
from: "Desde",
|
|
678
|
-
to: "A",
|
|
679
|
-
rdFallback: "Si no pasa nada, ve a la nueva direcci\xF3n.",
|
|
680
|
-
unKind: "No disponible",
|
|
681
|
-
unTitle: "Esta p\xE1gina no est\xE1 disponible por el momento",
|
|
682
|
-
unBody: "No se pudo cargar el contenido. Int\xE9ntalo de nuevo en un momento.",
|
|
683
|
-
viewer: VIEWER_LABELS_ES,
|
|
684
|
-
comments: COMMENT_LABELS_ES
|
|
685
|
-
};
|
|
686
|
-
var TABLE = { en, fr, es };
|
|
687
|
-
function stringsFor(locale) {
|
|
688
|
-
return TABLE[(locale ?? "en").slice(0, 2).toLowerCase()] ?? en;
|
|
689
|
-
}
|
|
690
|
-
function languageName(code, inLocale) {
|
|
691
|
-
try {
|
|
692
|
-
return new Intl.DisplayNames([inLocale], { type: "language" }).of(code) ?? code;
|
|
693
|
-
} catch {
|
|
694
|
-
return code;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
function formatDate(iso, locale, options = { dateStyle: "medium" }) {
|
|
698
|
-
try {
|
|
699
|
-
return new Intl.DateTimeFormat(locale, { ...options, timeZone: "UTC" }).format(new Date(iso));
|
|
700
|
-
} catch {
|
|
701
|
-
return iso.slice(0, 10);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
// src/react/content.tsx
|
|
706
|
-
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
707
|
-
function plainText(node) {
|
|
708
|
-
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
709
|
-
if (Array.isArray(node)) return node.map(plainText).join("");
|
|
710
|
-
return isValidElement(node) ? plainText(node.props.children) : "";
|
|
711
|
-
}
|
|
712
|
-
var CALLOUT_ICON = { note: "info", tip: "check-circle", warning: "alert", caution: "x-circle" };
|
|
713
|
-
function buildComponents(c, s) {
|
|
714
|
-
const Link = c.Link ?? "a";
|
|
715
|
-
const Img = c.Image ?? "img";
|
|
716
|
-
const A = ({ href, children, ...rest }) => {
|
|
717
|
-
if (typeof href !== "string") return /* @__PURE__ */ jsx3(Fragment3, { children });
|
|
718
|
-
const url = href;
|
|
719
|
-
if (url.startsWith("/") || url.startsWith("#")) {
|
|
720
|
-
return url.startsWith("#") ? /* @__PURE__ */ jsx3("a", { href: url, ...rest, children }) : /* @__PURE__ */ jsx3(Link, { href: url, ...rest, children });
|
|
721
|
-
}
|
|
722
|
-
return /* @__PURE__ */ jsx3("a", { href: url, rel: "noopener noreferrer", ...rest, children });
|
|
723
|
-
};
|
|
724
|
-
let images = 0;
|
|
725
|
-
const Image = (props) => {
|
|
726
|
-
if (typeof props.src !== "string") return null;
|
|
727
|
-
const first = images++ === 0;
|
|
728
|
-
return /* @__PURE__ */ jsx3(Img, { loading: first ? "eager" : "lazy", ...first ? { fetchPriority: "high" } : {}, decoding: "async", ...props });
|
|
729
|
-
};
|
|
730
|
-
const Pre = ({ children, ...rest }) => {
|
|
731
|
-
const code = Children.toArray(children).find(isValidElement);
|
|
732
|
-
const language = /(?:^|\s)language-([\w-]+)/.exec(code?.props.className ?? "")?.[1];
|
|
733
|
-
const pre = /* @__PURE__ */ jsx3("pre", { tabIndex: 0, ...rest, children });
|
|
734
|
-
if (c.CodeBlock) return /* @__PURE__ */ jsx3(c.CodeBlock, { code: plainText(children), language, children: pre });
|
|
735
|
-
return /* @__PURE__ */ jsxs3("figure", { className: "hyle-codeblock", "data-slot-component": "CodeBlock", children: [
|
|
736
|
-
language ? /* @__PURE__ */ jsx3("header", { children: /* @__PURE__ */ jsx3("span", { className: "lang", children: language }) }) : null,
|
|
737
|
-
pre
|
|
738
|
-
] });
|
|
739
|
-
};
|
|
740
|
-
const Table = ({ children, ...rest }) => /* @__PURE__ */ jsx3("div", { className: "hyle-table", tabIndex: 0, role: "region", "aria-label": s.table, children: /* @__PURE__ */ jsx3("table", { ...rest, children }) });
|
|
741
|
-
const Callout = ({ kind, children }) => {
|
|
742
|
-
const k = ["note", "tip", "warning", "caution"].includes(String(kind)) ? kind : "note";
|
|
743
|
-
const title = s[k];
|
|
744
|
-
if (c.Callout) return /* @__PURE__ */ jsx3(c.Callout, { kind: k, title, children });
|
|
745
|
-
return /* @__PURE__ */ jsxs3("aside", { className: "hyle-callout", "data-kind": k, "data-slot-component": "Callout", role: "note", children: [
|
|
746
|
-
/* @__PURE__ */ jsx3(Icon, { name: CALLOUT_ICON[k] }),
|
|
747
|
-
/* @__PURE__ */ jsxs3("div", { children: [
|
|
748
|
-
/* @__PURE__ */ jsx3("p", { className: "ttl", children: title }),
|
|
749
|
-
/* @__PURE__ */ jsx3("div", { className: "bd", children })
|
|
750
|
-
] })
|
|
751
|
-
] });
|
|
752
|
-
};
|
|
753
|
-
const Frame = (props) => {
|
|
754
|
-
const { srcDoc } = props;
|
|
755
|
-
if (typeof srcDoc !== "string") return null;
|
|
756
|
-
const source = mermaidSource(srcDoc);
|
|
757
|
-
if (c.Mermaid) return /* @__PURE__ */ jsx3(c.Mermaid, { srcDoc, source, title: s.diagram });
|
|
758
|
-
if (source === void 0) return null;
|
|
759
|
-
const light = diagramRender(props["data-light"]);
|
|
760
|
-
const dark = diagramRender(props["data-dark"]);
|
|
761
|
-
if (light && dark) {
|
|
762
|
-
return /* @__PURE__ */ jsx3(MermaidImage, { source, title: s.diagram, errorText: s.diagramError, loadingText: s.diagramLoading, sourceLabel: s.diagramSource, light, dark, labels: s.viewer });
|
|
763
|
-
}
|
|
764
|
-
return /* @__PURE__ */ jsx3(MermaidDiagram, { source, title: s.diagram, errorText: s.diagramError, loadingText: s.diagramLoading, labels: s.viewer });
|
|
765
|
-
};
|
|
766
|
-
const Heading = (level) => function HyleHeading({ id, children, ...rest }) {
|
|
767
|
-
const Tag = `h${level}`;
|
|
768
|
-
return /* @__PURE__ */ jsxs3(Tag, { id, ...rest, children: [
|
|
769
|
-
typeof id === "string" ? /* @__PURE__ */ jsx3("a", { className: "hyle-anchor", href: `#${id}`, "aria-label": s.anchor, children: "#" }) : null,
|
|
770
|
-
children
|
|
771
|
-
] });
|
|
772
|
-
};
|
|
773
|
-
const defaults = { a: A, img: Image, pre: Pre, table: Table, callout: Callout, iframe: Frame, h2: Heading(2), h3: Heading(3), h4: Heading(4) };
|
|
774
|
-
const overrides = ["a", "img", "code", "pre", "table", "blockquote", "h1", "h2", "h3", "h4", "h5", "h6"];
|
|
775
|
-
for (const key of overrides) if (c[key]) defaults[key] = c[key];
|
|
776
|
-
return defaults;
|
|
777
|
-
}
|
|
778
|
-
function HastContent({ tree, title, description, components = {}, locale }) {
|
|
779
|
-
let root;
|
|
780
|
-
try {
|
|
781
|
-
root = sanitizeHast(tree, title, description);
|
|
782
|
-
} catch (error) {
|
|
783
|
-
if (!(error instanceof HastLimitError)) throw error;
|
|
784
|
-
const s = stringsFor(locale);
|
|
785
|
-
return /* @__PURE__ */ jsxs3("div", { className: "hyle-banner", "data-kind": "warn", role: "alert", children: [
|
|
786
|
-
/* @__PURE__ */ jsx3(Icon, { name: "alert" }),
|
|
787
|
-
/* @__PURE__ */ jsx3("div", { children: s.contentError })
|
|
788
|
-
] });
|
|
789
|
-
}
|
|
790
|
-
return toJsxRuntime(root, {
|
|
791
|
-
Fragment: Fragment2,
|
|
792
|
-
jsx: jsx2,
|
|
793
|
-
jsxs: jsxs2,
|
|
794
|
-
components: buildComponents(components, stringsFor(locale)),
|
|
795
|
-
elementAttributeNameCase: "react",
|
|
796
|
-
stylePropertyNameCase: "dom"
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
function TrustedServerHtml({ html }) {
|
|
800
|
-
return /* @__PURE__ */ jsx3("div", { dangerouslySetInnerHTML: { __html: hostAssetHtml(html) } });
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
// src/react/index.ts
|
|
804
|
-
import { MermaidDiagram as MermaidDiagram2 } from "./mermaid-diagram.js";
|
|
805
|
-
|
|
806
|
-
// src/react/pages.tsx
|
|
807
|
-
import { Comments } from "./comments.js";
|
|
808
|
-
|
|
809
|
-
// src/react/comments-api.ts
|
|
810
|
-
var isObject2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
811
|
-
var count = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? Math.trunc(v) : 0;
|
|
812
|
-
function toComment(raw) {
|
|
813
|
-
if (!isObject2(raw) || typeof raw.id !== "string" || typeof raw.created_at !== "string") return void 0;
|
|
814
|
-
const depth = typeof raw.depth === "number" ? Math.min(4, Math.max(1, Math.trunc(raw.depth))) : 1;
|
|
815
|
-
const author = isObject2(raw.author) && typeof raw.author.name === "string" ? raw.author.name : void 0;
|
|
816
|
-
const name = typeof raw.author_name === "string" ? raw.author_name : author;
|
|
817
|
-
const body = isObject2(raw.body) && raw.body.format === "hast" ? { format: "hast", tree: raw.body.tree } : null;
|
|
818
|
-
const removed = raw.removed === true || body === null;
|
|
819
|
-
return {
|
|
820
|
-
id: raw.id,
|
|
821
|
-
parent_id: typeof raw.parent_id === "string" ? raw.parent_id : null,
|
|
822
|
-
depth,
|
|
823
|
-
author_name: name ?? null,
|
|
824
|
-
created_at: raw.created_at,
|
|
825
|
-
edited_at: typeof raw.edited_at === "string" ? raw.edited_at : null,
|
|
826
|
-
like_count: count(raw.like_count),
|
|
827
|
-
removed,
|
|
828
|
-
...removed && (raw.removed_by === "moderator" || raw.removed_by === "author") ? { removed_by: raw.removed_by } : {},
|
|
829
|
-
body,
|
|
830
|
-
// Viewer members exist only on a live comment of a viewer-aware listing; a tombstone never carries them.
|
|
831
|
-
...!removed && typeof raw.mine === "boolean" ? { mine: raw.mine, liked_by_me: raw.liked_by_me === true, can_edit_until: typeof raw.can_edit_until === "string" ? raw.can_edit_until : null } : {}
|
|
832
|
-
};
|
|
833
|
-
}
|
|
834
|
-
function toHeld(raw) {
|
|
835
|
-
if (!isObject2(raw) || typeof raw.id !== "string" || typeof raw.created_at !== "string" || !isObject2(raw.body) || raw.body.format !== "hast") return void 0;
|
|
836
|
-
const author = isObject2(raw.author) && typeof raw.author.name === "string" ? raw.author.name : null;
|
|
837
|
-
return {
|
|
838
|
-
id: raw.id,
|
|
839
|
-
parent_id: typeof raw.parent_id === "string" ? raw.parent_id : null,
|
|
840
|
-
depth: typeof raw.depth === "number" ? Math.min(4, Math.max(1, Math.trunc(raw.depth))) : 1,
|
|
841
|
-
author_name: author,
|
|
842
|
-
created_at: raw.created_at,
|
|
843
|
-
edited_at: typeof raw.edited_at === "string" ? raw.edited_at : null,
|
|
844
|
-
can_edit_until: typeof raw.can_edit_until === "string" ? raw.can_edit_until : null,
|
|
845
|
-
body: { format: "hast", tree: raw.body.tree }
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
function parseListing(data) {
|
|
849
|
-
if (!isObject2(data) || data.kind !== "comments" || !Array.isArray(data.comments)) return void 0;
|
|
850
|
-
const comments = data.comments.map(toComment).filter((c) => c !== void 0);
|
|
851
|
-
const viewer = Array.isArray(data.mine_held) ? { liked_by_me: data.liked_by_me === true, mine_held: data.mine_held.slice(0, 5).map(toHeld).filter((h) => h !== void 0) } : {};
|
|
852
|
-
return { cp: 1, kind: "comments", publication_id: String(data.publication_id ?? ""), comment_count: count(data.comment_count), like_count: count(data.like_count), truncated: data.truncated === true, comments, ...viewer };
|
|
853
|
-
}
|
|
854
|
-
var untilMs = (iso) => {
|
|
855
|
-
const t = iso ? Date.parse(iso) : NaN;
|
|
856
|
-
return Number.isFinite(t) ? t : void 0;
|
|
857
|
-
};
|
|
858
|
-
function buildThread(listing, localHeld) {
|
|
859
|
-
const byId = /* @__PURE__ */ new Map();
|
|
860
|
-
const roots = [];
|
|
861
|
-
const place = (node, parentId) => {
|
|
862
|
-
const parent = parentId ? byId.get(parentId) : void 0;
|
|
863
|
-
(parent ? parent.kids : roots).push(node);
|
|
864
|
-
};
|
|
865
|
-
for (const c of listing.comments) {
|
|
866
|
-
if (byId.has(c.id)) continue;
|
|
867
|
-
const removed = c.removed;
|
|
868
|
-
const node = {
|
|
869
|
-
id: c.id,
|
|
870
|
-
depth: c.depth,
|
|
871
|
-
status: removed ? "removed" : "visible",
|
|
872
|
-
removedBy: removed ? c.removed_by : void 0,
|
|
873
|
-
mine: !removed && c.mine === true,
|
|
874
|
-
canEditUntil: untilMs(c.can_edit_until),
|
|
875
|
-
likedByMe: !removed && c.liked_by_me === true,
|
|
876
|
-
name: removed ? null : c.author_name ?? null,
|
|
877
|
-
createdAt: c.created_at,
|
|
878
|
-
editedAt: c.edited_at,
|
|
879
|
-
likes: c.like_count,
|
|
880
|
-
tree: c.body?.tree,
|
|
881
|
-
text: void 0,
|
|
882
|
-
kids: []
|
|
883
|
-
};
|
|
884
|
-
place(node, c.parent_id === c.id ? null : c.parent_id);
|
|
885
|
-
byId.set(c.id, node);
|
|
886
|
-
}
|
|
887
|
-
const mine = [];
|
|
888
|
-
const addHeld = (node, parentId, oldestFirst) => {
|
|
889
|
-
const parent = parentId ? byId.get(parentId) : void 0;
|
|
890
|
-
if (parent) parent.kids.push(node);
|
|
891
|
-
else if (oldestFirst) mine.unshift(node);
|
|
892
|
-
else mine.push(node);
|
|
893
|
-
};
|
|
894
|
-
const heldIds = /* @__PURE__ */ new Set();
|
|
895
|
-
for (const h of listing.mine_held ?? []) {
|
|
896
|
-
heldIds.add(h.id);
|
|
897
|
-
const parent = h.parent_id ? byId.get(h.parent_id) : void 0;
|
|
898
|
-
addHeld({ id: h.id, depth: Math.min(4, (parent?.depth ?? h.depth - 1) + 1), status: "held", removedBy: void 0, mine: true, canEditUntil: untilMs(h.can_edit_until), likedByMe: false, name: h.author_name, createdAt: h.created_at, editedAt: h.edited_at, likes: 0, tree: h.body?.tree, text: void 0, kids: [] }, h.parent_id, true);
|
|
899
|
-
}
|
|
900
|
-
if (listing.mine_held === void 0) {
|
|
901
|
-
for (const h of localHeld) {
|
|
902
|
-
if (byId.has(h.id) || heldIds.has(h.id)) continue;
|
|
903
|
-
const parent = h.parentId ? byId.get(h.parentId) : void 0;
|
|
904
|
-
addHeld({ id: h.id, depth: Math.min(4, (parent?.depth ?? 0) + 1), status: "held", removedBy: void 0, mine: true, canEditUntil: void 0, likedByMe: false, name: h.name, createdAt: h.createdAt, editedAt: null, likes: 0, tree: void 0, text: h.text, kids: [] }, h.parentId, false);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
return [...mine, ...roots];
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
// src/react/comments-body.tsx
|
|
911
|
-
import { toJsxRuntime as toJsxRuntime2 } from "hast-util-to-jsx-runtime";
|
|
912
|
-
import { Fragment as Fragment4 } from "react";
|
|
913
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
914
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
915
|
-
var ALLOWED = /* @__PURE__ */ new Set(["p", "a", "em", "strong", "del", "code", "pre", "blockquote", "ul", "ol", "li", "br"]);
|
|
916
|
-
var LINK_REL = "nofollow ugc noopener noreferrer";
|
|
917
|
-
function narrow(node) {
|
|
918
|
-
if (node.type === "text") return [node];
|
|
919
|
-
if (node.type !== "element") return [];
|
|
920
|
-
const children = node.children.flatMap(narrow);
|
|
921
|
-
if (!ALLOWED.has(node.tagName)) return children;
|
|
922
|
-
if (node.tagName === "a") {
|
|
923
|
-
const href = node.properties.href;
|
|
924
|
-
if (!isSafeUrl(href, "href")) return children;
|
|
925
|
-
return [{ type: "element", tagName: "a", properties: { href: String(href), rel: LINK_REL.split(" ") }, children }];
|
|
926
|
-
}
|
|
927
|
-
return [{ type: "element", tagName: node.tagName, properties: {}, children: node.tagName === "br" ? [] : children }];
|
|
928
|
-
}
|
|
929
|
-
function CommentBody({ tree }) {
|
|
930
|
-
let children;
|
|
931
|
-
try {
|
|
932
|
-
children = sanitizeHast(tree).children.flatMap((n) => narrow(n));
|
|
933
|
-
} catch (error) {
|
|
934
|
-
if (error instanceof HastLimitError) return null;
|
|
935
|
-
throw error;
|
|
936
|
-
}
|
|
937
|
-
return /* @__PURE__ */ jsx5("div", { className: "hyle-cm-body", children: toJsxRuntime2({ type: "root", children }, { Fragment: Fragment4, jsx: jsx4, jsxs: jsxs4, elementAttributeNameCase: "react", stylePropertyNameCase: "dom" }) });
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
// src/react/embed.tsx
|
|
941
|
-
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
942
|
-
function HyleListView({ items, layout = "list", title, headingLevel = 2, moreHref, olderHref, ...base }) {
|
|
943
|
-
const c = ctx(base, "en");
|
|
944
|
-
const { s, Link } = c;
|
|
945
|
-
const Row = base.slots?.["list.item"];
|
|
946
|
-
const Heading = `h${headingLevel}`;
|
|
947
|
-
const safe = items.filter((item) => item.canonical_path.startsWith("/"));
|
|
948
|
-
if (safe.length === 0) return base.slots?.["list.empty"] ? /* @__PURE__ */ jsx6("div", { className: "hyle hyle-embed", "data-layout": layout, children: /* @__PURE__ */ jsx6(Slot, { name: "list.empty", slots: base.slots }) }) : null;
|
|
949
|
-
return /* @__PURE__ */ jsxs5("div", { className: "hyle hyle-embed", "data-layout": layout, lang: c.locale, children: [
|
|
950
|
-
title ? /* @__PURE__ */ jsx6(Heading, { className: "hyle-title", children: title }) : null,
|
|
951
|
-
/* @__PURE__ */ jsx6("ul", { className: "hyle-items", children: safe.map((item) => /* @__PURE__ */ jsx6("li", { children: Row ? /* @__PURE__ */ jsx6(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ jsxs5(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
|
|
952
|
-
item.published_at ? /* @__PURE__ */ jsx6("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }) : null,
|
|
953
|
-
/* @__PURE__ */ jsxs5("div", { children: [
|
|
954
|
-
/* @__PURE__ */ jsx6("span", { className: "t", children: item.title }),
|
|
955
|
-
item.description ? /* @__PURE__ */ jsx6("p", { children: item.description }) : null
|
|
956
|
-
] })
|
|
957
|
-
] }) }, item.canonical_path)) }),
|
|
958
|
-
olderHref ? /* @__PURE__ */ jsx6(OlderNav, { href: olderHref, c }) : null,
|
|
959
|
-
moreHref ? /* @__PURE__ */ jsx6("a", { className: "hyle-more", href: moreHref, children: s.viewAll }) : null
|
|
960
|
-
] });
|
|
961
|
-
}
|
|
962
|
-
function HyleArticleView({ article, headingLevel = 2, ...base }) {
|
|
963
|
-
const { publication: pub } = article;
|
|
964
|
-
const c = ctx(base, pub.locale);
|
|
965
|
-
const Heading = `h${headingLevel}`;
|
|
966
|
-
return /* @__PURE__ */ jsx6("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsxs5("article", { lang: c.locale, children: [
|
|
967
|
-
/* @__PURE__ */ jsxs5("header", { className: "hyle-head", children: [
|
|
968
|
-
/* @__PURE__ */ jsx6(Heading, { className: "hyle-title", children: pub.title }),
|
|
969
|
-
pub.description ? /* @__PURE__ */ jsx6("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
970
|
-
/* @__PURE__ */ jsx6("div", { className: "hyle-meta", children: /* @__PURE__ */ jsx6("span", { children: /* @__PURE__ */ jsx6("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) }) }) })
|
|
971
|
-
] }),
|
|
972
|
-
/* @__PURE__ */ jsx6(Body, { article, components: base.components, locale: c.locale }),
|
|
973
|
-
pub.canonical_path.startsWith("/") ? /* @__PURE__ */ jsxs5("a", { className: "hyle-more", href: c.href(pub.canonical_path, pub.locale), rel: "bookmark", children: [
|
|
974
|
-
c.s.readAtSource,
|
|
975
|
-
/* @__PURE__ */ jsxs5("span", { className: "hyle-sr", children: [
|
|
976
|
-
": ",
|
|
977
|
-
pub.title
|
|
978
|
-
] })
|
|
979
|
-
] }) : null
|
|
980
|
-
] }) });
|
|
981
|
-
}
|
|
982
|
-
var initials = (name) => name.trim().split(/\s+/).slice(0, 2).map((w) => [...w][0] ?? "").join("").toUpperCase() || "?";
|
|
983
|
-
function StaticThread({ nodes, locale, s, level = 1 }) {
|
|
984
|
-
return /* @__PURE__ */ jsx6("ol", { className: "hyle-cm-list", role: "list", children: nodes.map((node) => {
|
|
985
|
-
const kids = node.kids.length > 0 && level < 32 ? /* @__PURE__ */ jsx6(StaticThread, { nodes: node.kids, locale, s, level: level + 1 }) : null;
|
|
986
|
-
if (node.status === "removed") {
|
|
987
|
-
const why = node.removedBy === "moderator" ? s.removedByModerator : node.removedBy === "author" ? s.removedByAuthor : s.removed;
|
|
988
|
-
return /* @__PURE__ */ jsxs5("li", { className: "hyle-cm", "data-depth": node.depth, "data-status": "removed", "data-removed-by": node.removedBy, children: [
|
|
989
|
-
/* @__PURE__ */ jsxs5("article", { "aria-label": why, children: [
|
|
990
|
-
/* @__PURE__ */ jsx6("span", { className: "hyle-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(Icon, { name: "ban" }) }),
|
|
991
|
-
/* @__PURE__ */ jsx6("div", { className: "hyle-cm-main", children: /* @__PURE__ */ jsx6("div", { className: "hyle-cm-body", children: /* @__PURE__ */ jsx6("p", { children: why }) }) })
|
|
992
|
-
] }),
|
|
993
|
-
kids
|
|
994
|
-
] }, node.id);
|
|
995
|
-
}
|
|
996
|
-
return /* @__PURE__ */ jsxs5("li", { className: "hyle-cm", "data-depth": node.depth, "data-status": "visible", children: [
|
|
997
|
-
/* @__PURE__ */ jsxs5("article", { children: [
|
|
998
|
-
/* @__PURE__ */ jsx6("span", { className: "hyle-avatar", "aria-hidden": "true", children: initials(node.name ?? "") }),
|
|
999
|
-
/* @__PURE__ */ jsxs5("div", { className: "hyle-cm-main", children: [
|
|
1000
|
-
/* @__PURE__ */ jsxs5("div", { className: "hyle-cm-by", children: [
|
|
1001
|
-
/* @__PURE__ */ jsx6("b", { children: node.name }),
|
|
1002
|
-
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1003
|
-
/* @__PURE__ */ jsx6("time", { dateTime: node.createdAt, title: node.createdAt, children: formatDate(node.createdAt, locale) }),
|
|
1004
|
-
node.editedAt ? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
1005
|
-
" ",
|
|
1006
|
-
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
1007
|
-
" ",
|
|
1008
|
-
/* @__PURE__ */ jsx6("span", { children: s.edited })
|
|
1009
|
-
] }) : null
|
|
1010
|
-
] })
|
|
1011
|
-
] }),
|
|
1012
|
-
/* @__PURE__ */ jsx6(CommentBody, { tree: node.tree })
|
|
1013
|
-
] })
|
|
1014
|
-
] }),
|
|
1015
|
-
kids
|
|
1016
|
-
] }, node.id);
|
|
1017
|
-
}) });
|
|
1018
|
-
}
|
|
1019
|
-
function HyleCommentsView({ listing, locale }) {
|
|
1020
|
-
const thread = buildThread(listing, []);
|
|
1021
|
-
if (thread.length === 0) return null;
|
|
1022
|
-
const s = stringsFor(locale).comments;
|
|
1023
|
-
return /* @__PURE__ */ jsx6("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsxs5("section", { className: "hyle-comments", "aria-label": s.heading, "data-slot-component": "Comments", lang: locale, children: [
|
|
1024
|
-
/* @__PURE__ */ jsx6("div", { className: "hyle-cm-head", children: /* @__PURE__ */ jsxs5("h2", { children: [
|
|
1025
|
-
s.heading,
|
|
1026
|
-
" ",
|
|
1027
|
-
/* @__PURE__ */ jsx6("span", { className: "hyle-cm-count", "aria-label": s.countLabel.replace("{n}", String(listing.comment_count)), children: listing.comment_count })
|
|
1028
|
-
] }) }),
|
|
1029
|
-
/* @__PURE__ */ jsx6(StaticThread, { nodes: thread, locale, s }),
|
|
1030
|
-
listing.truncated ? /* @__PURE__ */ jsx6("p", { className: "hyle-cm-note", children: s.truncated }) : null
|
|
1031
|
-
] }) });
|
|
1032
|
-
}
|
|
1033
|
-
function HyleCommentsFallback({ locale }) {
|
|
1034
|
-
const s = stringsFor(locale).comments;
|
|
1035
|
-
return /* @__PURE__ */ jsx6("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsx6("section", { className: "hyle-comments", "aria-label": s.heading, "data-slot-component": "Comments", children: /* @__PURE__ */ jsxs5("div", { role: "status", "aria-live": "polite", "aria-busy": "true", children: [
|
|
1036
|
-
/* @__PURE__ */ jsx6("span", { className: "hyle-sr", children: s.loading }),
|
|
1037
|
-
/* @__PURE__ */ jsx6("div", { "aria-hidden": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs5("div", { className: "hyle-cm-sk", children: [
|
|
1038
|
-
/* @__PURE__ */ jsx6("span", { className: "hyle-sk c" }),
|
|
1039
|
-
/* @__PURE__ */ jsxs5("div", { children: [
|
|
1040
|
-
/* @__PURE__ */ jsx6("span", { className: "hyle-sk l", style: { width: 120 } }),
|
|
1041
|
-
/* @__PURE__ */ jsx6("span", { className: "hyle-sk l", style: { width: "100%" } }),
|
|
1042
|
-
/* @__PURE__ */ jsx6("span", { className: "hyle-sk l", style: { width: "72%" } })
|
|
1043
|
-
] })
|
|
1044
|
-
] }, i)) })
|
|
1045
|
-
] }) }) });
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
// src/react/seo.ts
|
|
1049
|
-
var BARE_HTTPS_ORIGIN = /^https:\/\/[^/]+$/;
|
|
1050
|
-
var bareOrigin = (origin) => origin && BARE_HTTPS_ORIGIN.test(origin) ? origin : void 0;
|
|
1051
|
-
var absoluteUrl = (origin, href) => origin + encodeURI(href);
|
|
1052
|
-
var modifiedAt = (pub) => pub.updated_at && Date.parse(pub.updated_at) > Date.parse(pub.published_at) ? pub.updated_at : void 0;
|
|
1053
|
-
var wordCountOf = (pub) => Number.isInteger(pub.word_count) && pub.word_count > 0 ? pub.word_count : void 0;
|
|
1054
|
-
var WORDS_PER_MINUTE = 275;
|
|
1055
|
-
var readingMinutes = (wordCount) => Math.max(1, Math.ceil(wordCount / WORDS_PER_MINUTE));
|
|
1056
|
-
var breadcrumbItems = (article, jsonLd) => [
|
|
1057
|
-
...jsonLd?.breadcrumbRoot ? [{ title: jsonLd.breadcrumbRoot.name, canonical_path: "/" }] : [],
|
|
1058
|
-
...article.breadcrumbs
|
|
1059
|
-
];
|
|
1060
|
-
var crumbHref = (href, path, locale) => path === "/" ? href("/", locale).replace(/(.)\/$/, "$1") : href(path, locale);
|
|
1061
|
-
function articleAuthor(article, jsonLd) {
|
|
1062
|
-
const authored = article.publication.author;
|
|
1063
|
-
if (authored?.name) return { name: authored.name, ...authored.url ? { url: authored.url } : {} };
|
|
1064
|
-
const given = jsonLd?.author?.(article);
|
|
1065
|
-
if (given && typeof given.name === "string" && given.name) return given;
|
|
1066
|
-
const fromFrontmatter = article.frontmatter.author;
|
|
1067
|
-
return typeof fromFrontmatter === "string" && fromFrontmatter ? { name: fromFrontmatter } : void 0;
|
|
1068
|
-
}
|
|
1069
|
-
var UNSAFE_URL = /[\u0000- \u007f\\]/;
|
|
1070
|
-
var positive = (n) => typeof n === "number" && Number.isInteger(n) && n > 0 ? n : void 0;
|
|
1071
|
-
function validOgImage(image, origin) {
|
|
1072
|
-
if (!image || typeof image.url !== "string" || UNSAFE_URL.test(image.url)) return void 0;
|
|
1073
|
-
const relative = image.url.startsWith("/") && !image.url.startsWith("//");
|
|
1074
|
-
const url = relative ? origin ? origin + image.url : void 0 : image.url;
|
|
1075
|
-
if (!url) return void 0;
|
|
1076
|
-
try {
|
|
1077
|
-
const parsed = new URL(url);
|
|
1078
|
-
if (parsed.protocol !== "https:" || relative && parsed.origin !== origin) return void 0;
|
|
1079
|
-
} catch {
|
|
1080
|
-
return void 0;
|
|
1081
|
-
}
|
|
1082
|
-
const width = positive(image.width);
|
|
1083
|
-
const height = positive(image.height);
|
|
1084
|
-
const type = typeof image.type === "string" && image.type ? image.type : "image/png";
|
|
1085
|
-
return { url, type, ...width ? { width } : {}, ...height ? { height } : {}, ...typeof image.alt === "string" && image.alt ? { alt: image.alt } : {} };
|
|
1086
|
-
}
|
|
1087
|
-
function hreflangLanguages(members, defaultLocale, selfUrl, url) {
|
|
1088
|
-
const defaultMember = members.find((m) => m.locale === defaultLocale);
|
|
1089
|
-
return { ...Object.fromEntries(members.map((m) => [m.locale, url(m)])), "x-default": defaultMember ? url(defaultMember) : selfUrl };
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
// src/react/jsonld.ts
|
|
1093
|
-
var script = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
|
|
1094
|
-
var organization = (publisher) => ({ "@type": "Organization", "@id": publisher.id, name: publisher.name, ...publisher.logo ? { logo: publisher.logo } : {} });
|
|
1095
|
-
var webSite = (website) => ({ "@type": "WebSite", "@id": website.id, name: website.name });
|
|
1096
|
-
function articleJsonLd({ article, origin, href, jsonLd, imageUrl, imageWidth, imageHeight }) {
|
|
1097
|
-
const { publication: pub } = article;
|
|
1098
|
-
const url = (path) => absoluteUrl(origin, href(path, pub.locale));
|
|
1099
|
-
const canonical = url(pub.canonical_path);
|
|
1100
|
-
const id = (fragment) => ({ "@id": `${canonical}#${fragment}` });
|
|
1101
|
-
const full = jsonLd !== void 0;
|
|
1102
|
-
const author = articleAuthor(article, jsonLd);
|
|
1103
|
-
const publisher = jsonLd?.publisher;
|
|
1104
|
-
const website = jsonLd?.website?.(pub.locale);
|
|
1105
|
-
const modified = modifiedAt(pub);
|
|
1106
|
-
const words = wordCountOf(pub);
|
|
1107
|
-
const publisherNode = publisher ? organization(publisher) : void 0;
|
|
1108
|
-
const section = article.breadcrumbs[0]?.title;
|
|
1109
|
-
const graph = [
|
|
1110
|
-
...full ? [{
|
|
1111
|
-
"@type": "WebPage",
|
|
1112
|
-
...id("webpage"),
|
|
1113
|
-
url: canonical,
|
|
1114
|
-
name: pub.title,
|
|
1115
|
-
...pub.description ? { description: pub.description } : {},
|
|
1116
|
-
inLanguage: pub.locale,
|
|
1117
|
-
...website ? { isPartOf: webSite(website) } : {},
|
|
1118
|
-
...publisherNode ? { publisher: publisherNode } : {},
|
|
1119
|
-
breadcrumb: id("breadcrumb"),
|
|
1120
|
-
mainEntity: id("article")
|
|
1121
|
-
}] : [],
|
|
1122
|
-
{
|
|
1123
|
-
"@type": "BlogPosting",
|
|
1124
|
-
...id("article"),
|
|
1125
|
-
headline: pub.title,
|
|
1126
|
-
...pub.description ? { description: pub.description } : {},
|
|
1127
|
-
datePublished: pub.published_at,
|
|
1128
|
-
...section ? { articleSection: section } : {},
|
|
1129
|
-
...modified ? { dateModified: modified } : {},
|
|
1130
|
-
...words ? { wordCount: words } : {},
|
|
1131
|
-
url: canonical,
|
|
1132
|
-
mainEntityOfPage: full ? id("webpage") : canonical,
|
|
1133
|
-
...author ? { author: { "@type": "Person", ...author.id ? { "@id": author.id } : {}, name: author.name, ...author.url ? { url: author.url } : {} } } : {},
|
|
1134
|
-
...publisherNode ? { publisher: publisherNode } : {},
|
|
1135
|
-
inLanguage: pub.locale,
|
|
1136
|
-
...imageUrl ? { image: imageWidth && imageHeight ? { "@type": "ImageObject", url: imageUrl, width: imageWidth, height: imageHeight } : [imageUrl] } : {}
|
|
1137
|
-
},
|
|
1138
|
-
{
|
|
1139
|
-
"@type": "BreadcrumbList",
|
|
1140
|
-
...id("breadcrumb"),
|
|
1141
|
-
itemListElement: breadcrumbItems(article, jsonLd).map((b, i) => ({
|
|
1142
|
-
"@type": "ListItem",
|
|
1143
|
-
position: i + 1,
|
|
1144
|
-
name: b.title,
|
|
1145
|
-
item: absoluteUrl(origin, crumbHref(href, b.canonical_path, pub.locale).replace(/^\/$/, ""))
|
|
1146
|
-
}))
|
|
1147
|
-
}
|
|
1148
|
-
];
|
|
1149
|
-
return script({ "@context": "https://schema.org", "@graph": graph });
|
|
1150
|
-
}
|
|
1151
|
-
function listJsonLd({ list, origin, href, path, locale, description, jsonLd, cursor }) {
|
|
1152
|
-
const url = absoluteUrl(origin, href(path)) + (cursor ? `?cursor=${cursor}` : "");
|
|
1153
|
-
const website = jsonLd?.website?.(locale);
|
|
1154
|
-
return script({
|
|
1155
|
-
"@context": "https://schema.org",
|
|
1156
|
-
"@type": "CollectionPage",
|
|
1157
|
-
...jsonLd ? { "@id": `${url}#webpage` } : {},
|
|
1158
|
-
url,
|
|
1159
|
-
...website ? { isPartOf: webSite(website) } : {},
|
|
1160
|
-
...jsonLd?.publisher ? { publisher: organization(jsonLd.publisher) } : {},
|
|
1161
|
-
name: list.section.title,
|
|
1162
|
-
...description ? { description } : {},
|
|
1163
|
-
inLanguage: locale,
|
|
1164
|
-
mainEntity: {
|
|
1165
|
-
"@type": "ItemList",
|
|
1166
|
-
itemListElement: list.items.map((item, i) => ({ "@type": "ListItem", position: i + 1, url: absoluteUrl(origin, href(item.canonical_path)), name: item.title }))
|
|
1167
|
-
}
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
// src/react/pages.tsx
|
|
1172
|
-
import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1173
|
-
function Slot({ name, slots, tag: Tag = "div", className }) {
|
|
1174
|
-
const fill = slots?.[name];
|
|
1175
|
-
return fill ? /* @__PURE__ */ jsx7(Tag, { "data-slot": name, className, children: fill }) : null;
|
|
1176
|
-
}
|
|
1177
|
-
function Shell({ children }) {
|
|
1178
|
-
return /* @__PURE__ */ jsx7("div", { className: "hyle", children: /* @__PURE__ */ jsx7("div", { className: "hyle-page", children }) });
|
|
1179
|
-
}
|
|
1180
|
-
function ctx(p, fallbackLocale) {
|
|
1181
|
-
const locale = p.locale ?? fallbackLocale;
|
|
1182
|
-
return { s: stringsFor(locale), locale, href: (path, linkLocale) => p.toHref ? p.toHref(path, linkLocale ?? locale) : path, Link: p.components?.Link ?? "a" };
|
|
1183
|
-
}
|
|
1184
|
-
function Pager({ prev, next, c }) {
|
|
1185
|
-
if (!prev && !next) return null;
|
|
1186
|
-
const { Link, s } = c;
|
|
1187
|
-
return /* @__PURE__ */ jsxs6("nav", { className: "hyle-pager", "aria-label": s.pager, children: [
|
|
1188
|
-
prev ? /* @__PURE__ */ jsxs6(Link, { href: c.href(prev.canonical_path), rel: "prev", children: [
|
|
1189
|
-
/* @__PURE__ */ jsxs6("span", { className: "dir", children: [
|
|
1190
|
-
/* @__PURE__ */ jsx7(Icon, { name: "chev-left" }),
|
|
1191
|
-
s.prev
|
|
1192
|
-
] }),
|
|
1193
|
-
/* @__PURE__ */ jsx7("span", { className: "ttl", children: prev.title })
|
|
1194
|
-
] }) : /* @__PURE__ */ jsx7("span", { className: "none", "aria-hidden": "true" }),
|
|
1195
|
-
next ? /* @__PURE__ */ jsxs6(Link, { href: c.href(next.canonical_path), rel: "next", className: "next", children: [
|
|
1196
|
-
/* @__PURE__ */ jsxs6("span", { className: "dir", children: [
|
|
1197
|
-
s.next,
|
|
1198
|
-
/* @__PURE__ */ jsx7(Icon, { name: "chev" })
|
|
1199
|
-
] }),
|
|
1200
|
-
/* @__PURE__ */ jsx7("span", { className: "ttl", children: next.title })
|
|
1201
|
-
] }) : null
|
|
1202
|
-
] });
|
|
1203
|
-
}
|
|
1204
|
-
function OlderNav({ href, c }) {
|
|
1205
|
-
return /* @__PURE__ */ jsxs6("nav", { className: "hyle-pagination", "aria-label": c.s.pager, children: [
|
|
1206
|
-
/* @__PURE__ */ jsx7("span", { className: "sp" }),
|
|
1207
|
-
/* @__PURE__ */ jsxs6(c.Link, { className: "hyle-btn sm", href, rel: "next", children: [
|
|
1208
|
-
c.s.older,
|
|
1209
|
-
/* @__PURE__ */ jsx7(Icon, { name: "chev" })
|
|
1210
|
-
] })
|
|
1211
|
-
] });
|
|
1212
|
-
}
|
|
1213
|
-
function TocList({ toc }) {
|
|
1214
|
-
const groups = [];
|
|
1215
|
-
for (const entry of toc) {
|
|
1216
|
-
const last = groups.at(-1);
|
|
1217
|
-
if (entry.depth === 3 && last) last.subs.push(entry);
|
|
1218
|
-
else groups.push({ entry, subs: [] });
|
|
1219
|
-
}
|
|
1220
|
-
return /* @__PURE__ */ jsx7("ul", { children: groups.map(({ entry, subs }) => /* @__PURE__ */ jsxs6("li", { children: [
|
|
1221
|
-
/* @__PURE__ */ jsx7("a", { href: `#${scopeId(entry.id)}`, children: entry.text }),
|
|
1222
|
-
subs.length > 0 ? /* @__PURE__ */ jsx7("ul", { children: subs.map((sub) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7("a", { href: `#${scopeId(sub.id)}`, children: sub.text }) }, sub.id)) }) : null
|
|
1223
|
-
] }, entry.id)) });
|
|
1224
|
-
}
|
|
1225
|
-
function Toc({ toc, c, aside }) {
|
|
1226
|
-
const entries = toc.filter((t) => t.depth === 2 || t.depth === 3);
|
|
1227
|
-
if (entries.length === 0 && !aside) return { narrow: null, wide: null };
|
|
1228
|
-
const { s } = c;
|
|
1229
|
-
return {
|
|
1230
|
-
narrow: entries.length === 0 ? null : /* @__PURE__ */ jsxs6("details", { className: "hyle-toc-m", children: [
|
|
1231
|
-
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
1232
|
-
/* @__PURE__ */ jsx7(Icon, { name: "file" }),
|
|
1233
|
-
s.toc,
|
|
1234
|
-
/* @__PURE__ */ jsx7(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
1235
|
-
] }),
|
|
1236
|
-
/* @__PURE__ */ jsx7("nav", { className: "hyle-toc-list", "aria-label": s.toc, children: /* @__PURE__ */ jsx7(TocList, { toc: entries }) })
|
|
1237
|
-
] }),
|
|
1238
|
-
wide: /* @__PURE__ */ jsxs6("aside", { className: "hyle-toc-d", "aria-label": s.toc, children: [
|
|
1239
|
-
entries.length === 0 ? null : /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
1240
|
-
/* @__PURE__ */ jsx7("p", { className: "hyle-toc-title", children: s.toc }),
|
|
1241
|
-
/* @__PURE__ */ jsx7("nav", { className: "hyle-toc-list", children: /* @__PURE__ */ jsx7(TocList, { toc: entries }) })
|
|
1242
|
-
] }),
|
|
1243
|
-
aside
|
|
1244
|
-
] })
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
function Body({ article, components, locale }) {
|
|
1248
|
-
const { content, publication } = article;
|
|
1249
|
-
return /* @__PURE__ */ jsx7("div", { className: "hyle-body hyle-prose", lang: article.fallback ? void 0 : publication.locale, children: content.format === "hast" ? /* @__PURE__ */ jsx7(HastContent, { tree: content.tree, title: publication.title, description: publication.description, components: components ?? {}, locale }) : content.format === "html" ? /* @__PURE__ */ jsx7(TrustedServerHtml, { html: content.html }) : null });
|
|
1250
|
-
}
|
|
1251
|
-
function Languages({ alternates, current, c }) {
|
|
1252
|
-
if (alternates.length < 2) return null;
|
|
1253
|
-
const { Link, s } = c;
|
|
1254
|
-
return /* @__PURE__ */ jsxs6("nav", { className: "hyle-langs", "aria-label": s.languages, children: [
|
|
1255
|
-
/* @__PURE__ */ jsx7("span", { children: s.readIn }),
|
|
1256
|
-
/* @__PURE__ */ jsx7("ul", { children: alternates.map((a) => {
|
|
1257
|
-
const label = languageName(a.locale, a.locale);
|
|
1258
|
-
return /* @__PURE__ */ jsx7("li", { children: a.locale === current ? /* @__PURE__ */ jsx7("a", { href: c.href(a.canonical_path, a.locale), hrefLang: a.locale, lang: a.locale, "aria-current": "true", children: label }) : /* @__PURE__ */ jsx7(Link, { href: c.href(a.canonical_path, a.locale), hrefLang: a.locale, lang: a.locale, children: label }) }, a.locale);
|
|
1259
|
-
}) })
|
|
1260
|
-
] });
|
|
1261
|
-
}
|
|
1262
|
-
function LdScript({ json }) {
|
|
1263
|
-
return /* @__PURE__ */ jsx7("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: json } });
|
|
1264
|
-
}
|
|
1265
|
-
function Crumbs({ items, c }) {
|
|
1266
|
-
const { Link } = c;
|
|
1267
|
-
return /* @__PURE__ */ jsx7("nav", { className: "hyle-crumbs", "aria-label": c.s.crumbs, children: /* @__PURE__ */ jsx7("ol", { children: items.map((b, i) => /* @__PURE__ */ jsx7("li", { "aria-current": i === items.length - 1 ? "page" : void 0, children: i === items.length - 1 ? b.title : /* @__PURE__ */ jsx7(Link, { href: crumbHref(c.href, b.canonical_path, c.locale), children: b.title }) }, b.canonical_path)) }) });
|
|
1268
|
-
}
|
|
1269
|
-
function ArticlePage({ article, engagement, origin, jsonLd, imageUrl, imageWidth, imageHeight, related, ...base }) {
|
|
1270
|
-
const { publication: pub } = article;
|
|
1271
|
-
const c = ctx(base, pub.locale);
|
|
1272
|
-
const { s } = c;
|
|
1273
|
-
const jsonLdOrigin = bareOrigin(origin);
|
|
1274
|
-
const author = articleAuthor(article, jsonLd)?.name;
|
|
1275
|
-
const modified = modifiedAt(pub);
|
|
1276
|
-
const words = wordCountOf(pub);
|
|
1277
|
-
const toc = Toc({ toc: article.toc, c, aside: /* @__PURE__ */ jsx7(Slot, { name: "article.aside", slots: base.slots, className: "hyle-slot-wrap" }) });
|
|
1278
|
-
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
1279
|
-
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("article", { className: "hyle-article", "data-hyle-page": "article", lang: c.locale, children: [
|
|
1280
|
-
/* @__PURE__ */ jsxs6("header", { className: "hyle-head", children: [
|
|
1281
|
-
/* @__PURE__ */ jsx7(Slot, { name: "article.before", slots: base.slots, className: "hyle-eyebrow" }),
|
|
1282
|
-
/* @__PURE__ */ jsx7(Crumbs, { items: breadcrumbItems(article, jsonLd), c }),
|
|
1283
|
-
/* @__PURE__ */ jsx7("h1", { className: "hyle-title", children: pub.title }),
|
|
1284
|
-
pub.description ? /* @__PURE__ */ jsx7("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
1285
|
-
/* @__PURE__ */ jsxs6("div", { className: "hyle-meta", children: [
|
|
1286
|
-
author ? /* @__PURE__ */ jsxs6("span", { children: [
|
|
1287
|
-
/* @__PURE__ */ jsx7("span", { className: "hyle-avatar", "aria-hidden": "true", children: author.slice(0, 2).toUpperCase() }),
|
|
1288
|
-
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1289
|
-
/* @__PURE__ */ jsxs6("span", { className: "hyle-sr", children: [
|
|
1290
|
-
s.by,
|
|
1291
|
-
" "
|
|
1292
|
-
] }),
|
|
1293
|
-
/* @__PURE__ */ jsx7("span", { className: "by", children: author })
|
|
1294
|
-
] })
|
|
1295
|
-
] }) : null,
|
|
1296
|
-
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1297
|
-
/* @__PURE__ */ jsx7(Icon, { name: "calendar" }),
|
|
1298
|
-
/* @__PURE__ */ jsx7("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) })
|
|
1299
|
-
] }),
|
|
1300
|
-
modified ? /* @__PURE__ */ jsxs6("span", { children: [
|
|
1301
|
-
/* @__PURE__ */ jsx7(Icon, { name: "calendar" }),
|
|
1302
|
-
s.updated,
|
|
1303
|
-
" ",
|
|
1304
|
-
/* @__PURE__ */ jsx7("time", { dateTime: modified, title: modified, children: formatDate(modified, c.locale) })
|
|
1305
|
-
] }) : null,
|
|
1306
|
-
words ? /* @__PURE__ */ jsxs6("span", { children: [
|
|
1307
|
-
/* @__PURE__ */ jsx7(Icon, { name: "clock" }),
|
|
1308
|
-
s.readingTime.replace("{n}", String(readingMinutes(words)))
|
|
1309
|
-
] }) : null,
|
|
1310
|
-
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1311
|
-
/* @__PURE__ */ jsx7(Icon, { name: "globe" }),
|
|
1312
|
-
/* @__PURE__ */ jsx7("span", { lang: pub.locale, children: languageName(pub.locale, c.locale) })
|
|
1313
|
-
] }),
|
|
1314
|
-
/* @__PURE__ */ jsx7(Slot, { name: "article.meta", slots: base.slots, tag: "span" })
|
|
1315
|
-
] }),
|
|
1316
|
-
/* @__PURE__ */ jsx7(Languages, { alternates: article.alternates, current: pub.locale, c }),
|
|
1317
|
-
notTranslated ? /* @__PURE__ */ jsxs6("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
1318
|
-
/* @__PURE__ */ jsx7(Icon, { name: "alert" }),
|
|
1319
|
-
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1320
|
-
/* @__PURE__ */ jsx7("b", { children: notTranslated }),
|
|
1321
|
-
" ",
|
|
1322
|
-
s.fallbackBody
|
|
1323
|
-
] })
|
|
1324
|
-
] }) : null
|
|
1325
|
-
] }),
|
|
1326
|
-
toc.narrow,
|
|
1327
|
-
/* @__PURE__ */ jsx7(Body, { article, components: base.components, locale: c.locale }),
|
|
1328
|
-
engagement ? /* @__PURE__ */ jsx7(Comments, { path: pub.canonical_path, endpoint: engagement.endpoint ?? "/api/hyle/engage", signInHref: engagement.signInHref, locale: c.locale, labels: s.comments }) : null,
|
|
1329
|
-
/* @__PURE__ */ jsx7(Pager, { prev: article.prev, next: article.next, c }),
|
|
1330
|
-
related ? /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
1331
|
-
related.items.length > 0 ? /* @__PURE__ */ jsx7(HyleListView, { items: related.items, title: related.title ?? s.moreInSection, ...base, locale: c.locale }) : null,
|
|
1332
|
-
article.children.length > 0 ? /* @__PURE__ */ jsx7(HyleListView, { items: article.children.map((child) => ({ ...child, description: null, published_at: "" })), title: s.subPages, ...base, locale: c.locale }) : null
|
|
1333
|
-
] }) : null,
|
|
1334
|
-
/* @__PURE__ */ jsx7(Slot, { name: "article.after", slots: base.slots, className: "hyle-after" }),
|
|
1335
|
-
toc.wide,
|
|
1336
|
-
jsonLdOrigin ? /* @__PURE__ */ jsx7(LdScript, { json: articleJsonLd({ article, origin: jsonLdOrigin, href: c.href, jsonLd, imageUrl, imageWidth, imageHeight }) }) : null
|
|
1337
|
-
] }) });
|
|
1338
|
-
}
|
|
1339
|
-
function ListPage({ list, olderHref, description, origin, path, jsonLd, cursor, ...base }) {
|
|
1340
|
-
const c = ctx(base, "en");
|
|
1341
|
-
const { s, Link } = c;
|
|
1342
|
-
const Row = base.slots?.["list.item"];
|
|
1343
|
-
const groups = /* @__PURE__ */ new Map();
|
|
1344
|
-
for (const item of list.items) groups.set(item.published_at.slice(0, 7), [...groups.get(item.published_at.slice(0, 7)) ?? [], item]);
|
|
1345
|
-
const notTranslated = list.fallback ? s.fallbackTitle.replace("{language}", languageName(list.fallback.requested_locale, c.locale)) : void 0;
|
|
1346
|
-
const jsonLdOrigin = bareOrigin(origin);
|
|
1347
|
-
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("div", { className: "hyle-listpage", "data-hyle-page": "list", lang: c.locale, children: [
|
|
1348
|
-
/* @__PURE__ */ jsxs6("header", { className: "hyle-head", children: [
|
|
1349
|
-
/* @__PURE__ */ jsx7("h1", { className: "hyle-title", children: list.section.title }),
|
|
1350
|
-
description ? /* @__PURE__ */ jsx7("p", { className: "hyle-desc", children: description }) : null,
|
|
1351
|
-
/* @__PURE__ */ jsx7(Slot, { name: "list.header", slots: base.slots, className: "hyle-slot-wrap" }),
|
|
1352
|
-
notTranslated ? /* @__PURE__ */ jsxs6("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
1353
|
-
/* @__PURE__ */ jsx7(Icon, { name: "alert" }),
|
|
1354
|
-
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1355
|
-
/* @__PURE__ */ jsx7("b", { children: notTranslated }),
|
|
1356
|
-
" ",
|
|
1357
|
-
s.fallbackBody
|
|
1358
|
-
] })
|
|
1359
|
-
] }) : null
|
|
1360
|
-
] }),
|
|
1361
|
-
list.items.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "hyle-empty", "data-slot-state": "empty", children: [
|
|
1362
|
-
/* @__PURE__ */ jsx7(Icon, { name: "file" }),
|
|
1363
|
-
/* @__PURE__ */ jsx7("h2", { children: s.emptyTitle }),
|
|
1364
|
-
/* @__PURE__ */ jsx7("p", { children: s.emptyBody }),
|
|
1365
|
-
/* @__PURE__ */ jsx7(Slot, { name: "list.empty", slots: base.slots })
|
|
1366
|
-
] }) : [...groups].map(([month, items]) => /* @__PURE__ */ jsxs6("section", { "aria-label": formatDate(`${month}-01`, c.locale, { month: "long", year: "numeric" }), children: [
|
|
1367
|
-
/* @__PURE__ */ jsx7("h2", { className: "hyle-year", children: formatDate(`${month}-01`, c.locale, { month: "long", year: "numeric" }) }),
|
|
1368
|
-
/* @__PURE__ */ jsx7("ul", { className: "hyle-items", children: items.map((item) => /* @__PURE__ */ jsx7("li", { children: Row ? /* @__PURE__ */ jsx7(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ jsxs6(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
|
|
1369
|
-
/* @__PURE__ */ jsx7("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }),
|
|
1370
|
-
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1371
|
-
/* @__PURE__ */ jsx7("span", { className: "t", children: item.title }),
|
|
1372
|
-
item.description ? /* @__PURE__ */ jsx7("p", { children: item.description }) : null
|
|
1373
|
-
] })
|
|
1374
|
-
] }) }, item.canonical_path)) })
|
|
1375
|
-
] }, month)),
|
|
1376
|
-
olderHref ? /* @__PURE__ */ jsx7(OlderNav, { href: olderHref, c }) : null,
|
|
1377
|
-
jsonLdOrigin && path ? /* @__PURE__ */ jsx7(LdScript, { json: listJsonLd({ list, origin: jsonLdOrigin, href: c.href, path, locale: c.locale, description, jsonLd, cursor }) }) : null
|
|
1378
|
-
] }) });
|
|
1379
|
-
}
|
|
1380
|
-
function NotFound({ path, homeHref = "/", ...base }) {
|
|
1381
|
-
const c = ctx(base, "en");
|
|
1382
|
-
const { Link, s } = c;
|
|
1383
|
-
const body = base.slots?.["notfound.body"];
|
|
1384
|
-
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("section", { className: "hyle-state", "data-hyle-page": "not-found", lang: c.locale, children: [
|
|
1385
|
-
/* @__PURE__ */ jsx7("span", { className: "kind", children: s.nfKind }),
|
|
1386
|
-
/* @__PURE__ */ jsx7("h1", { children: s.nfTitle }),
|
|
1387
|
-
body ? /* @__PURE__ */ jsx7("div", { "data-slot": "notfound.body", children: body }) : /* @__PURE__ */ jsx7("p", { children: s.nfBody }),
|
|
1388
|
-
path ? /* @__PURE__ */ jsx7("dl", { className: "hyle-addr", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
1389
|
-
/* @__PURE__ */ jsx7("dt", { children: s.path }),
|
|
1390
|
-
/* @__PURE__ */ jsx7("dd", { children: path })
|
|
1391
|
-
] }) }) : null,
|
|
1392
|
-
/* @__PURE__ */ jsxs6("div", { className: "hyle-actions", children: [
|
|
1393
|
-
/* @__PURE__ */ jsx7(Link, { className: "hyle-btn primary", href: crumbHref(c.href, homeHref, c.locale), children: s.home }),
|
|
1394
|
-
/* @__PURE__ */ jsx7(Slot, { name: "notfound.actions", slots: base.slots, tag: "span" })
|
|
1395
|
-
] })
|
|
1396
|
-
] }) });
|
|
1397
|
-
}
|
|
1398
|
-
function Unavailable(base) {
|
|
1399
|
-
const c = ctx(base, "en");
|
|
1400
|
-
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("section", { className: "hyle-state", "data-hyle-page": "unavailable", lang: c.locale, role: "status", children: [
|
|
1401
|
-
/* @__PURE__ */ jsx7("span", { className: "kind", children: c.s.unKind }),
|
|
1402
|
-
/* @__PURE__ */ jsx7("h1", { children: c.s.unTitle }),
|
|
1403
|
-
/* @__PURE__ */ jsx7("p", { children: c.s.unBody })
|
|
1404
|
-
] }) });
|
|
1405
|
-
}
|
|
1406
|
-
function Redirecting({ from, to, ...base }) {
|
|
1407
|
-
const c = ctx(base, "en");
|
|
1408
|
-
const { Link, s } = c;
|
|
1409
|
-
const extra = base.slots?.["redirecting.body"];
|
|
1410
|
-
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("section", { className: "hyle-state", "data-hyle-page": "redirecting", role: "status", lang: c.locale, children: [
|
|
1411
|
-
/* @__PURE__ */ jsx7("span", { className: "kind", children: s.rdKind }),
|
|
1412
|
-
/* @__PURE__ */ jsx7("h1", { children: s.rdTitle }),
|
|
1413
|
-
/* @__PURE__ */ jsx7("p", { children: s.rdBody }),
|
|
1414
|
-
/* @__PURE__ */ jsxs6("dl", { className: "hyle-addr", children: [
|
|
1415
|
-
from ? /* @__PURE__ */ jsxs6("div", { children: [
|
|
1416
|
-
/* @__PURE__ */ jsx7("dt", { children: s.from }),
|
|
1417
|
-
/* @__PURE__ */ jsx7("dd", { children: from })
|
|
1418
|
-
] }) : null,
|
|
1419
|
-
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1420
|
-
/* @__PURE__ */ jsx7("dt", { children: s.to }),
|
|
1421
|
-
/* @__PURE__ */ jsx7("dd", { children: to })
|
|
1422
|
-
] })
|
|
1423
|
-
] }),
|
|
1424
|
-
/* @__PURE__ */ jsx7("p", { className: "fine", children: /* @__PURE__ */ jsx7(Link, { href: c.href(to), children: s.rdFallback }) }),
|
|
1425
|
-
extra ? /* @__PURE__ */ jsx7("p", { "data-slot": "redirecting.body", className: "fine", children: extra }) : null
|
|
1426
|
-
] }) });
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
// src/react/index.ts
|
|
1430
|
-
import { Comments as Comments2 } from "./comments.js";
|
|
1431
|
-
|
|
1432
|
-
// src/react/docs.tsx
|
|
1433
|
-
import { DocsEnhance } from "./docs-enhance.js";
|
|
1434
|
-
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1435
|
-
var ROOT_ID = "hyle-docs";
|
|
1436
|
-
var NAV_ID = "hyle-docs-nav";
|
|
1437
|
-
function navTreeOf(article) {
|
|
1438
|
-
if (article.nav && !article.nav.truncated && article.nav.items.length > 0) return article.nav.items;
|
|
1439
|
-
const { publication: pub } = article;
|
|
1440
|
-
const here = {
|
|
1441
|
-
slug: pub.slug,
|
|
1442
|
-
title: pub.title,
|
|
1443
|
-
canonical_path: pub.canonical_path,
|
|
1444
|
-
children: article.children.map((child) => ({ ...child, children: [] }))
|
|
1445
|
-
};
|
|
1446
|
-
return [article.ancestors.reduceRight((inner, a) => ({ ...a, children: [inner] }), here)];
|
|
1447
|
-
}
|
|
1448
|
-
function pathTo(nodes, path) {
|
|
1449
|
-
for (const node of nodes) {
|
|
1450
|
-
if (node.canonical_path === path) return [node.canonical_path];
|
|
1451
|
-
const below = pathTo(node.children, path);
|
|
1452
|
-
if (below.length > 0) return [node.canonical_path, ...below];
|
|
1453
|
-
}
|
|
1454
|
-
return [];
|
|
1455
|
-
}
|
|
1456
|
-
function Branch({ nodes, current, onPath, c }) {
|
|
1457
|
-
const { Link } = c;
|
|
1458
|
-
return /* @__PURE__ */ jsx8("ul", { children: nodes.map((node) => {
|
|
1459
|
-
const link = /* @__PURE__ */ jsx8(Link, { href: c.href(node.canonical_path), ...node.canonical_path === current ? { "aria-current": "page" } : {}, children: node.title });
|
|
1460
|
-
if (node.children.length === 0) return /* @__PURE__ */ jsx8("li", { children: link }, node.canonical_path);
|
|
1461
|
-
return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs7("details", { ...onPath.has(node.canonical_path) ? { open: true } : {}, children: [
|
|
1462
|
-
/* @__PURE__ */ jsxs7("summary", { children: [
|
|
1463
|
-
/* @__PURE__ */ jsx8(Icon, { name: "chev" }),
|
|
1464
|
-
link
|
|
1465
|
-
] }),
|
|
1466
|
-
/* @__PURE__ */ jsx8(Branch, { nodes: node.children, current, onPath, c })
|
|
1467
|
-
] }) }, node.canonical_path);
|
|
1468
|
-
}) });
|
|
1469
|
-
}
|
|
1470
|
-
function DocsPage({ article, ...base }) {
|
|
1471
|
-
const { publication: pub } = article;
|
|
1472
|
-
const c = ctx(base, pub.locale);
|
|
1473
|
-
const { Link, s } = c;
|
|
1474
|
-
const toc = Toc({ toc: article.toc, c });
|
|
1475
|
-
const tree = navTreeOf(article);
|
|
1476
|
-
const onPath = new Set(pathTo(tree, pub.canonical_path));
|
|
1477
|
-
const siteName = article.breadcrumbs[0]?.title ?? "";
|
|
1478
|
-
const headingIds = article.toc.filter((t) => t.depth === 2 || t.depth === 3).map((t) => scopeId(t.id));
|
|
1479
|
-
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
1480
|
-
return /* @__PURE__ */ jsx8(Shell, { children: /* @__PURE__ */ jsxs7("div", { className: "hyle-docs", id: ROOT_ID, lang: c.locale, children: [
|
|
1481
|
-
/* @__PURE__ */ jsx8(DocsEnhance, { headingIds, rootId: ROOT_ID }),
|
|
1482
|
-
/* @__PURE__ */ jsxs7("button", { type: "button", className: "hyle-nav-bar", popoverTarget: NAV_ID, children: [
|
|
1483
|
-
/* @__PURE__ */ jsx8(Icon, { name: "file" }),
|
|
1484
|
-
s.menu,
|
|
1485
|
-
/* @__PURE__ */ jsx8("span", { className: "cur", children: pub.title }),
|
|
1486
|
-
/* @__PURE__ */ jsx8(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
1487
|
-
] }),
|
|
1488
|
-
/* @__PURE__ */ jsxs7("aside", { className: "hyle-nav-d", id: NAV_ID, popover: "auto", "aria-label": s.docs, children: [
|
|
1489
|
-
/* @__PURE__ */ jsxs7("div", { className: "hyle-side-head", children: [
|
|
1490
|
-
/* @__PURE__ */ jsx8("b", { children: siteName }),
|
|
1491
|
-
/* @__PURE__ */ jsx8(Slot, { name: "docs.version", slots: base.slots, tag: "span" }),
|
|
1492
|
-
/* @__PURE__ */ jsx8("button", { type: "button", className: "hyle-nav-x", popoverTarget: NAV_ID, popoverTargetAction: "hide", "aria-label": s.closeMenu, children: /* @__PURE__ */ jsx8(Icon, { name: "x" }) })
|
|
1493
|
-
] }),
|
|
1494
|
-
/* @__PURE__ */ jsx8(Slot, { name: "docs.sidebar-header", slots: base.slots, className: "hyle-side-slot" }),
|
|
1495
|
-
/* @__PURE__ */ jsx8("nav", { className: "hyle-tree", "aria-label": s.docs, children: /* @__PURE__ */ jsx8(Branch, { nodes: tree, current: pub.canonical_path, onPath, c }) }),
|
|
1496
|
-
/* @__PURE__ */ jsx8(Slot, { name: "docs.sidebar-footer", slots: base.slots, className: "hyle-side-slot" })
|
|
1497
|
-
] }),
|
|
1498
|
-
/* @__PURE__ */ jsxs7("div", { className: "hyle-docs-main", "data-hyle-page": "docs", children: [
|
|
1499
|
-
notTranslated ? /* @__PURE__ */ jsxs7("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
1500
|
-
/* @__PURE__ */ jsx8(Icon, { name: "alert" }),
|
|
1501
|
-
/* @__PURE__ */ jsxs7("div", { children: [
|
|
1502
|
-
/* @__PURE__ */ jsx8("b", { children: notTranslated }),
|
|
1503
|
-
" ",
|
|
1504
|
-
s.fallbackBody
|
|
1505
|
-
] })
|
|
1506
|
-
] }) : null,
|
|
1507
|
-
/* @__PURE__ */ jsx8("nav", { className: "hyle-crumbs", "aria-label": s.crumbs, children: /* @__PURE__ */ jsx8("ol", { children: article.breadcrumbs.map((b, i) => /* @__PURE__ */ jsx8("li", { "aria-current": i === article.breadcrumbs.length - 1 ? "page" : void 0, children: i === article.breadcrumbs.length - 1 ? b.title : /* @__PURE__ */ jsx8(Link, { href: c.href(b.canonical_path), children: b.title }) }, b.canonical_path)) }) }),
|
|
1508
|
-
/* @__PURE__ */ jsx8("h1", { className: "hyle-title", children: pub.title }),
|
|
1509
|
-
pub.description ? /* @__PURE__ */ jsx8("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
1510
|
-
/* @__PURE__ */ jsxs7("p", { className: "hyle-updated", children: [
|
|
1511
|
-
/* @__PURE__ */ jsx8(Icon, { name: "calendar" }),
|
|
1512
|
-
s.updated,
|
|
1513
|
-
" ",
|
|
1514
|
-
/* @__PURE__ */ jsx8("time", { dateTime: pub.updated_at, title: pub.updated_at, children: formatDate(pub.updated_at, c.locale) })
|
|
1515
|
-
] }),
|
|
1516
|
-
toc.narrow,
|
|
1517
|
-
/* @__PURE__ */ jsx8(Body, { article, components: base.components, locale: c.locale }),
|
|
1518
|
-
/* @__PURE__ */ jsx8(Pager, { prev: article.prev, next: article.next, c }),
|
|
1519
|
-
/* @__PURE__ */ jsx8(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" }),
|
|
1520
|
-
/* @__PURE__ */ jsx8("span", { className: "hyle-docs-end", "aria-hidden": "true" })
|
|
1521
|
-
] }),
|
|
1522
|
-
toc.wide
|
|
1523
|
-
] }) });
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
export {
|
|
1527
|
-
HastLimitError,
|
|
1528
|
-
scopeId,
|
|
1529
|
-
isSafeUrl,
|
|
1530
|
-
sanitizeHast,
|
|
1531
|
-
stringsFor,
|
|
1532
|
-
HastContent,
|
|
1533
|
-
TrustedServerHtml,
|
|
1534
|
-
parseListing,
|
|
1535
|
-
HyleListView,
|
|
1536
|
-
HyleArticleView,
|
|
1537
|
-
HyleCommentsView,
|
|
1538
|
-
HyleCommentsFallback,
|
|
1539
|
-
BARE_HTTPS_ORIGIN,
|
|
1540
|
-
bareOrigin,
|
|
1541
|
-
absoluteUrl,
|
|
1542
|
-
modifiedAt,
|
|
1543
|
-
wordCountOf,
|
|
1544
|
-
readingMinutes,
|
|
1545
|
-
articleAuthor,
|
|
1546
|
-
validOgImage,
|
|
1547
|
-
hreflangLanguages,
|
|
1548
|
-
ArticlePage,
|
|
1549
|
-
ListPage,
|
|
1550
|
-
NotFound,
|
|
1551
|
-
Unavailable,
|
|
1552
|
-
Redirecting,
|
|
1553
|
-
DocsPage,
|
|
1554
|
-
MermaidDiagram2 as MermaidDiagram,
|
|
1555
|
-
Comments2 as Comments
|
|
1556
|
-
};
|