nizel-plugin-alert 0.1.9 → 0.1.11
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/dist/alert.iife.js +4420 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/alert.iife.js
CHANGED
|
@@ -22,9 +22,4412 @@ var NizelAlert = (() => {
|
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
24
|
alertPlugin: () => alertPlugin,
|
|
25
|
+
alertToMarkdown: () => alertToMarkdown,
|
|
25
26
|
default: () => index_default,
|
|
26
27
|
transformGitHubAlerts: () => transformGitHubAlerts
|
|
27
28
|
});
|
|
29
|
+
|
|
30
|
+
// ../nizel/dist/collect.js
|
|
31
|
+
function collect(ast) {
|
|
32
|
+
const headings = [];
|
|
33
|
+
const links = [];
|
|
34
|
+
const images = [];
|
|
35
|
+
const text = blockText(ast.children, { headings, links, images }).trim();
|
|
36
|
+
const words = text ? text.split(/\s+/).length : 0;
|
|
37
|
+
return {
|
|
38
|
+
text,
|
|
39
|
+
headings,
|
|
40
|
+
links,
|
|
41
|
+
images,
|
|
42
|
+
excerpt: text ? text.slice(0, 160).trim() : void 0,
|
|
43
|
+
readingTime: {
|
|
44
|
+
words,
|
|
45
|
+
minutes: Math.max(1, Math.ceil(words / 200))
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function blockText(nodes, state) {
|
|
50
|
+
return nodes.map((node) => {
|
|
51
|
+
if (node.type === "heading") {
|
|
52
|
+
const text = inlineText(node.children, state);
|
|
53
|
+
state.headings.push({
|
|
54
|
+
id: node.id ?? "",
|
|
55
|
+
slug: node.id ?? "",
|
|
56
|
+
text,
|
|
57
|
+
depth: node.depth,
|
|
58
|
+
level: node.depth
|
|
59
|
+
});
|
|
60
|
+
return text;
|
|
61
|
+
}
|
|
62
|
+
if (node.type === "paragraph")
|
|
63
|
+
return inlineText(node.children, state);
|
|
64
|
+
if (node.type === "code")
|
|
65
|
+
return node.code;
|
|
66
|
+
if (node.type === "list") {
|
|
67
|
+
return node.children.map((item) => blockText(item.children, state)).join("\n");
|
|
68
|
+
}
|
|
69
|
+
if (node.type === "blockquote")
|
|
70
|
+
return blockText(node.children, state);
|
|
71
|
+
if (node.type === "table") {
|
|
72
|
+
return node.children.map((row) => row.children.map((cell) => inlineText(cell.children, state)).join(" ")).join("\n");
|
|
73
|
+
}
|
|
74
|
+
if (node.type === "html")
|
|
75
|
+
return node.value;
|
|
76
|
+
if (node.type === "customBlock")
|
|
77
|
+
return nestedText(node.children ?? [], state);
|
|
78
|
+
return "";
|
|
79
|
+
}).filter(Boolean).join("\n");
|
|
80
|
+
}
|
|
81
|
+
function inlineText(nodes, state) {
|
|
82
|
+
if (nodes.length === 0)
|
|
83
|
+
return "";
|
|
84
|
+
if (nodes.length === 1)
|
|
85
|
+
return inlineNodeText(nodes[0], state);
|
|
86
|
+
return nodes.map((node) => inlineNodeText(node, state)).join("");
|
|
87
|
+
}
|
|
88
|
+
function inlineNodeText(node, state) {
|
|
89
|
+
if (node.type === "text")
|
|
90
|
+
return node.value;
|
|
91
|
+
if (node.type === "inlineHtml")
|
|
92
|
+
return "";
|
|
93
|
+
if (node.type === "lineBreak")
|
|
94
|
+
return " ";
|
|
95
|
+
if (node.type === "inlineCode")
|
|
96
|
+
return node.code;
|
|
97
|
+
if (node.type === "image") {
|
|
98
|
+
state.images.push({
|
|
99
|
+
src: node.src,
|
|
100
|
+
alt: node.alt,
|
|
101
|
+
title: node.title
|
|
102
|
+
});
|
|
103
|
+
return node.alt ?? "";
|
|
104
|
+
}
|
|
105
|
+
if (node.type === "link") {
|
|
106
|
+
const text = inlineText(node.children, state);
|
|
107
|
+
state.links.push({
|
|
108
|
+
href: node.href,
|
|
109
|
+
text,
|
|
110
|
+
title: node.title,
|
|
111
|
+
external: Boolean(node.external)
|
|
112
|
+
});
|
|
113
|
+
return text;
|
|
114
|
+
}
|
|
115
|
+
return inlineText(node.children, state);
|
|
116
|
+
}
|
|
117
|
+
function nestedText(nodes, state) {
|
|
118
|
+
return nodes.map((node) => {
|
|
119
|
+
if (node.type === "root")
|
|
120
|
+
return blockText(node.children, state);
|
|
121
|
+
if (isBlock(node))
|
|
122
|
+
return blockText([node], state);
|
|
123
|
+
if (isInline(node))
|
|
124
|
+
return inlineText([node], state);
|
|
125
|
+
if (node.type === "listItem")
|
|
126
|
+
return blockText(node.children, state);
|
|
127
|
+
if (node.type === "tableRow") {
|
|
128
|
+
return node.children.map((cell) => inlineText(cell.children, state)).join(" ");
|
|
129
|
+
}
|
|
130
|
+
if (node.type === "tableCell")
|
|
131
|
+
return inlineText(node.children, state);
|
|
132
|
+
return "";
|
|
133
|
+
}).join("\n");
|
|
134
|
+
}
|
|
135
|
+
function isInline(node) {
|
|
136
|
+
return [
|
|
137
|
+
"text",
|
|
138
|
+
"emphasis",
|
|
139
|
+
"strong",
|
|
140
|
+
"delete",
|
|
141
|
+
"lineBreak",
|
|
142
|
+
"inlineCode",
|
|
143
|
+
"link",
|
|
144
|
+
"image",
|
|
145
|
+
"inlineHtml"
|
|
146
|
+
].includes(node.type);
|
|
147
|
+
}
|
|
148
|
+
function isBlock(node) {
|
|
149
|
+
return ![
|
|
150
|
+
"root",
|
|
151
|
+
"text",
|
|
152
|
+
"emphasis",
|
|
153
|
+
"strong",
|
|
154
|
+
"delete",
|
|
155
|
+
"lineBreak",
|
|
156
|
+
"inlineCode",
|
|
157
|
+
"link",
|
|
158
|
+
"image"
|
|
159
|
+
].includes(node.type);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// ../nizel/dist/frontmatter.js
|
|
163
|
+
var extractFrontmatter = (markdown) => {
|
|
164
|
+
if (!markdown.startsWith("---\n")) {
|
|
165
|
+
return { markdown, frontmatter: {} };
|
|
166
|
+
}
|
|
167
|
+
const end = markdown.indexOf("\n---", 4);
|
|
168
|
+
if (end === -1) {
|
|
169
|
+
return { markdown, frontmatter: {} };
|
|
170
|
+
}
|
|
171
|
+
const raw = markdown.slice(4, end).trim();
|
|
172
|
+
const rest = markdown.slice(end).replace(/^\n---\n?/, "").replace(/^\n/, "");
|
|
173
|
+
return {
|
|
174
|
+
markdown: rest,
|
|
175
|
+
frontmatter: parseSimpleYaml(raw)
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
var parseSimpleYaml = (raw) => {
|
|
179
|
+
const result = {};
|
|
180
|
+
const lines = raw.split("\n");
|
|
181
|
+
let currentKey = null;
|
|
182
|
+
let currentArray = null;
|
|
183
|
+
for (const line of lines) {
|
|
184
|
+
const listMatch = /^\s+-\s+(.*)$/.exec(line);
|
|
185
|
+
if (listMatch && currentKey !== null) {
|
|
186
|
+
if (!currentArray)
|
|
187
|
+
currentArray = [];
|
|
188
|
+
currentArray.push(parseValue(listMatch[1]));
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (currentKey !== null && currentArray !== null) {
|
|
192
|
+
result[currentKey] = currentArray;
|
|
193
|
+
currentArray = null;
|
|
194
|
+
currentKey = null;
|
|
195
|
+
}
|
|
196
|
+
const match = /^([A-Za-z0-9_-]+):\s*(.*)$/.exec(line.trim());
|
|
197
|
+
if (!match)
|
|
198
|
+
continue;
|
|
199
|
+
const [, key, rawValue] = match;
|
|
200
|
+
if (rawValue.trim() === "") {
|
|
201
|
+
currentKey = key;
|
|
202
|
+
currentArray = null;
|
|
203
|
+
} else {
|
|
204
|
+
result[key] = parseValue(rawValue);
|
|
205
|
+
currentKey = null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (currentKey !== null && currentArray !== null) {
|
|
209
|
+
result[currentKey] = currentArray;
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
};
|
|
213
|
+
var parseValue = (value) => {
|
|
214
|
+
const trimmed = value.trim();
|
|
215
|
+
if (trimmed === "true")
|
|
216
|
+
return true;
|
|
217
|
+
if (trimmed === "false")
|
|
218
|
+
return false;
|
|
219
|
+
if (trimmed === "null")
|
|
220
|
+
return null;
|
|
221
|
+
if (/^-?\d+(\.\d+)?$/.test(trimmed))
|
|
222
|
+
return Number(trimmed);
|
|
223
|
+
return trimmed.replace(/^["']|["']$/g, "");
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// ../../node_modules/@sil/case/dist/index.mjs
|
|
227
|
+
var h = { a: ["\xE4", "\xE1", "\xE0", "\xE2", "\xE3", "\u0101", "\u01CE", "\xE5", "\u0103", "\u0105", "\u01DF", "\u01E1", "\u01FB", "\u0201", "\u0203", "\u0227", "\u1EA1", "\u1EA3", "\u1EA5", "\u1EA7", "\u1EA9", "\u1EAB", "\u1EAD", "\u1EAF", "\u1EB1", "\u1EB3", "\u1EB5", "\u1EB7"], b: ["\xDF", "\u0180", "\u0183", "\u0253", "\u1D6C", "\u1D80", "\u1E03", "\u1E05", "\u1E07"], c: ["\u0107", "\u010D", "\xE7", "\u0109", "\u010B", "\u0188", "\u023C", "\u0255", "\u1E09"], d: ["\u0111", "\u010F", "\u1E0B", "\u1E0D", "\u1E0F", "\u1E11", "\u1E13"], e: ["\xEB", "\xE9", "\xE8", "\xEA", "\u0113", "\u011B", "\u0117", "\u0119", "\u01DD", "\u0205", "\u0207", "\u0229", "\u025B", "\u0258", "\u1EB9", "\u1EBB", "\u1EBD", "\u1EBF", "\u1EC1", "\u1EC3", "\u1EC5", "\u1EC7"], f: ["\u0192", "\u1E1F"], g: ["\u011F", "\u011D", "\u0121", "\u0123", "\u01E7", "\u01F5", "\u0260", "\u1E21", "\u1D79"], h: ["\u0125", "\u021F", "\u1E29", "\u1E25", "\u1E2B", "\u1E96", "\u0127", "\u2C68", "\u0266"], i: ["\xEF", "\xED", "\xEC", "\xEE", "\u012B", "\u01D0", "\u012F", "\u0131", "\u0268", "\u1EC9", "\u1ECB", "\u026A", "\u0269"], j: ["\u0135", "\u01F0", "\u0237"], k: ["\u0137", "\u0199", "\u1E33", "\u1E35", "\u2C6A"], l: ["\u0142", "\u013A", "\u013E", "\u013C", "\u0140", "\u1E37", "\u1E39", "\u1E3B", "\u1E3D", "\u0234"], m: ["\u1E41", "\u1E43", "\u1D6F", "\u0271", "\u1D86", "\u1E3F", "\u1E41", "\u1E43", "\u1E47", "\u1E45", "\u1E49", "\u1E4B"], n: ["\xF1", "\u0144", "\u01F9", "\u0148", "\u0146", "\u014B", "\u0272", "\u1E45", "\u1E47", "\u1E49", "\u1E4B", "\u207F"], o: ["\xF6", "\xF3", "\xF2", "\xF4", "\xF5", "\u014D", "\u01D2", "\xF8", "\u0151", "\u01A1", "\u01EB", "\u020D", "\u020F", "\u022B", "\u022D", "\u022F", "\u1ECD", "\u1ECF", "\u1ED1", "\u1ED3", "\u1ED5", "\u1ED7", "\u1ED9", "\u1EDB", "\u1EDD", "\u1EDF", "\u1EE1", "\u1EE3"], p: ["\xFE", "\u01A5", "\u1D7D", "\u1D88", "\u1E57"], q: ["\u02A0", "\u024B"], r: ["\u0159", "\u0155", "\u1E59", "\u1E5B", "\u1E5D", "\u1E5F"], s: ["\u015B", "\u0161", "\u015F", "\u015D", "\u0219", "\u1E61", "\u1E63", "\u1E65", "\u1E67", "\u1E69"], t: ["\u0163", "\u0165", "\u1E6B", "\u1E6D", "\u1E6F", "\u1E71", "\u1E97", "\u01AD", "\u0236"], u: ["\xFC", "\xFA", "\xF9", "\xFB", "\u016B", "\u01D4", "\u016F", "\u0171", "\u0173", "\u01B0", "\u01D8", "\u01DC", "\u01D6", "\u01DA", "\u0215", "\u0217", "\u1EE5", "\u1EE7", "\u1EE9", "\u1EEB", "\u1EED", "\u1EEF", "\u1EF1"], v: ["\u028B", "\u1E7F", "\u2C71", "\u028C"], w: ["\u1E85", "\u1E83", "\u1E81", "\u0175", "\u1E87", "\u1E89", "\u2C73", "\u1E98"], x: ["\u1E8D", "\u1E8B", "\u2093", "\u2715"], y: ["\xFF", "\xFD", "\u1EF3", "\u0177", "\xFF", "\u1EF9", "\u0233", "\u024F", "\u01B4", "\u028E", "\u1E99", "\u1EF7", "\u1EF5"], z: ["\u017E", "\u017A", "\u017C", "\u1E91", "\u1E93", "\u1E95"] };
|
|
228
|
+
var A = (e) => e === e.toUpperCase();
|
|
229
|
+
var u = (e, t) => e.split("").map((s) => {
|
|
230
|
+
if (t && t.has(s)) return s;
|
|
231
|
+
if (!s.match(/([a-zA-Z0-9 -])/g)) {
|
|
232
|
+
let a = Object.keys(h).find((o) => h[o].indexOf(s.toLowerCase()) > -1) || "_";
|
|
233
|
+
return A(s) ? a.toUpperCase() : a;
|
|
234
|
+
}
|
|
235
|
+
return s;
|
|
236
|
+
}).join("");
|
|
237
|
+
var $ = (e, t = {}) => {
|
|
238
|
+
if (!e) return "";
|
|
239
|
+
let r = t.exclude ? new Set(t.exclude) : void 0, n = u(e, r);
|
|
240
|
+
if (t.exclude && t.exclude.length > 0) {
|
|
241
|
+
let l = e.split(/[-_\s]+/), c = "";
|
|
242
|
+
for (let i = 0; i < l.length; i++) {
|
|
243
|
+
let x = l[i];
|
|
244
|
+
if (!x) continue;
|
|
245
|
+
let f = "", w = c === "" || i > 0;
|
|
246
|
+
for (let p = 0; p < x.length; p++) {
|
|
247
|
+
let d = x[p];
|
|
248
|
+
if (r.has(d)) {
|
|
249
|
+
if (f) {
|
|
250
|
+
let S = u(f, r);
|
|
251
|
+
c += w ? S.charAt(0).toUpperCase() + S.slice(1).toLowerCase() : S.toLowerCase(), f = "";
|
|
252
|
+
}
|
|
253
|
+
c += d, w = !/[a-zA-ZÀ-ÿ]/i.test(d);
|
|
254
|
+
} else f += d;
|
|
255
|
+
}
|
|
256
|
+
if (f) {
|
|
257
|
+
let p = u(f, r);
|
|
258
|
+
c += w ? p.charAt(0).toUpperCase() + p.slice(1).toLowerCase() : p.toLowerCase();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return c;
|
|
262
|
+
}
|
|
263
|
+
let s = "A-Za-z0-9", a = `^[^${s}]*|[^${s}]*$`, o = new RegExp(a, "g"), g = `[^${s}]+`, C = new RegExp(g, "g");
|
|
264
|
+
return String(n).replace(o, "$").replace(C, "$").replace(/([a-z])([A-Z])/g, (l, c, i) => c + "$" + i).toLowerCase().replace(/(\$)(\w?)/g, (l, c, i) => i.toUpperCase());
|
|
265
|
+
};
|
|
266
|
+
var j = (e, t = {}) => {
|
|
267
|
+
if (!e) return "";
|
|
268
|
+
let r = $(e, t);
|
|
269
|
+
return r.charAt(0).toLowerCase() + r.substring(1);
|
|
270
|
+
};
|
|
271
|
+
var L = (e = "", t = {}) => {
|
|
272
|
+
if (!e) return "";
|
|
273
|
+
let r = t.exclude ? new Set(t.exclude) : void 0, s = u(e, r).replace(/[-_]/g, " ");
|
|
274
|
+
if (s = s.replace(/([a-z])([A-Z])/g, "$1 $2"), s = s.replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2"), t.exclude && t.exclude.length > 0) {
|
|
275
|
+
let a = e.split(/[-_\s]+/), o = [];
|
|
276
|
+
for (let g = 0; g < a.length; g++) {
|
|
277
|
+
let C = a[g];
|
|
278
|
+
if (!C) continue;
|
|
279
|
+
g > 0 && o.push("-");
|
|
280
|
+
let l = "";
|
|
281
|
+
for (let c = 0; c < C.length; c++) {
|
|
282
|
+
let i = C[c];
|
|
283
|
+
if (r.has(i)) {
|
|
284
|
+
if (l) {
|
|
285
|
+
let x = u(l, r);
|
|
286
|
+
o.push(x.toLowerCase()), l = "";
|
|
287
|
+
}
|
|
288
|
+
o.push(i);
|
|
289
|
+
} else l += i;
|
|
290
|
+
}
|
|
291
|
+
if (l) {
|
|
292
|
+
let c = u(l, r);
|
|
293
|
+
o.push(c.toLowerCase());
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return o.join("");
|
|
297
|
+
}
|
|
298
|
+
return s.split(" ").filter((a) => a.length > 0).map((a) => a.toLowerCase()).join("-");
|
|
299
|
+
};
|
|
300
|
+
var m = (e, t = {}) => e ? L(e, t).replace(/-/g, "_") : "";
|
|
301
|
+
var b = (e, t = {}) => {
|
|
302
|
+
if (!e) return "";
|
|
303
|
+
if (!t.exclude || t.exclude.length === 0) return m(e, t).toUpperCase();
|
|
304
|
+
let r = new Set(t.exclude), n = m(e, t), s = "";
|
|
305
|
+
for (let a = 0; a < n.length; a++) {
|
|
306
|
+
let o = n[a];
|
|
307
|
+
r.has(o) || r.has(o.toLowerCase()), s += o.toUpperCase();
|
|
308
|
+
}
|
|
309
|
+
return s;
|
|
310
|
+
};
|
|
311
|
+
var P = (e, t = {}) => e ? L(e, t) : "";
|
|
312
|
+
var I = (e, t = {}) => {
|
|
313
|
+
if (!e || !e.trim()) return "";
|
|
314
|
+
let n = (t.exclude ? e : u(e)).replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
315
|
+
return n = n.trim(), n ? (n = n.replace(/[-_]/g, " ").toLowerCase(), n.replace(/^./, (s) => s.toUpperCase())) : "";
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
// ../../node_modules/@sil/format/dist/index.mjs
|
|
319
|
+
var __defProp2 = Object.defineProperty;
|
|
320
|
+
var __defProps = Object.defineProperties;
|
|
321
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
322
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
323
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
324
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
325
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
326
|
+
var __spreadValues = (a, b2) => {
|
|
327
|
+
for (var prop in b2 || (b2 = {}))
|
|
328
|
+
if (__hasOwnProp2.call(b2, prop))
|
|
329
|
+
__defNormalProp(a, prop, b2[prop]);
|
|
330
|
+
if (__getOwnPropSymbols)
|
|
331
|
+
for (var prop of __getOwnPropSymbols(b2)) {
|
|
332
|
+
if (__propIsEnum.call(b2, prop))
|
|
333
|
+
__defNormalProp(a, prop, b2[prop]);
|
|
334
|
+
}
|
|
335
|
+
return a;
|
|
336
|
+
};
|
|
337
|
+
var __spreadProps = (a, b2) => __defProps(a, __getOwnPropDescs(b2));
|
|
338
|
+
var pad = (value) => `${value}`.padStart(2, "0");
|
|
339
|
+
var flattenObject = (obj, parentKey) => {
|
|
340
|
+
let result = {};
|
|
341
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
342
|
+
const _key = parentKey ? parentKey + "." + key : key;
|
|
343
|
+
if (typeof value === "object") {
|
|
344
|
+
result = __spreadValues(__spreadValues({}, result), flattenObject(value, _key));
|
|
345
|
+
} else {
|
|
346
|
+
result[_key] = value;
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
return result;
|
|
350
|
+
};
|
|
351
|
+
var Language = {
|
|
352
|
+
AM: "Armenian",
|
|
353
|
+
AR: "Arabic",
|
|
354
|
+
BG: "Bulgarian",
|
|
355
|
+
CY: "Welsh",
|
|
356
|
+
DE: "German",
|
|
357
|
+
DK: "Danish",
|
|
358
|
+
EN: "English",
|
|
359
|
+
ES: "Spanish",
|
|
360
|
+
ET: "Estonian",
|
|
361
|
+
FI: "Finnish",
|
|
362
|
+
FR: "French",
|
|
363
|
+
GR: "Greek",
|
|
364
|
+
HU: "Hungarian",
|
|
365
|
+
IR: "Irish",
|
|
366
|
+
IT: "Italian",
|
|
367
|
+
LA: "Latvian",
|
|
368
|
+
LT: "Lithuanian",
|
|
369
|
+
MT: "Maltese",
|
|
370
|
+
NL: "Dutch",
|
|
371
|
+
NO: "Norwegian",
|
|
372
|
+
PE: "Persian",
|
|
373
|
+
PL: "Polish",
|
|
374
|
+
PT: "Portuguese",
|
|
375
|
+
RO: "Romanian",
|
|
376
|
+
RU: "Russian",
|
|
377
|
+
SV: "SWEDISH"
|
|
378
|
+
};
|
|
379
|
+
var defaultOptions = {
|
|
380
|
+
language: Language.EN,
|
|
381
|
+
index: -1,
|
|
382
|
+
padded: false,
|
|
383
|
+
template: "YY-MM-DD hh:mm:ss",
|
|
384
|
+
replace: {}
|
|
385
|
+
};
|
|
386
|
+
var copy = {
|
|
387
|
+
"month": [
|
|
388
|
+
"\u0540\u0578\u0582\u0576\u057E\u0561\u0580",
|
|
389
|
+
"\u0553\u0565\u057F\u0580\u057E\u0561\u0580",
|
|
390
|
+
"\u0544\u0561\u0580\u057F",
|
|
391
|
+
"\u0531\u057A\u0580\u056B\u056C",
|
|
392
|
+
"\u0544\u0561\u0575\u056B\u057D",
|
|
393
|
+
"\u0540\u0578\u0582\u0576\u056B\u057D",
|
|
394
|
+
"\u0540\u0578\u0582\u056C\u056B\u057D",
|
|
395
|
+
"\u0555\u0563\u0578\u057D\u057F\u0578\u057D",
|
|
396
|
+
"\u054D\u0565\u057A\u057F\u0565\u0574\u0562\u0565\u0580",
|
|
397
|
+
"\u0540\u0578\u056F\u057F\u0565\u0574\u0562\u0565\u0580",
|
|
398
|
+
"\u0546\u0578\u0575\u0565\u0574\u0562\u0565\u0580",
|
|
399
|
+
"\u0534\u0565\u056F\u057F\u0565\u0574\u0562\u0565\u0580"
|
|
400
|
+
],
|
|
401
|
+
"month_short": [
|
|
402
|
+
"\u0540\u0578\u0582\u0576",
|
|
403
|
+
"\u0553\u0565\u057F",
|
|
404
|
+
"\u0544\u0561\u0580",
|
|
405
|
+
"\u0531\u057A\u0580",
|
|
406
|
+
"\u0544\u0561\u0575",
|
|
407
|
+
"\u0540\u0578\u0582\u0576",
|
|
408
|
+
"\u0540\u0578\u0582\u056C",
|
|
409
|
+
"\u0555\u0563\u057D",
|
|
410
|
+
"\u054D\u0565\u057A",
|
|
411
|
+
"\u0540\u0578\u056F",
|
|
412
|
+
"\u0546\u0578\u0575",
|
|
413
|
+
"\u0534\u0565\u056F"
|
|
414
|
+
],
|
|
415
|
+
"day": [
|
|
416
|
+
"\u053F\u056B\u0580\u0561\u056F\u056B",
|
|
417
|
+
"\u0535\u0580\u056F\u0578\u0582\u0577\u0561\u0562\u0569\u056B",
|
|
418
|
+
"\u0535\u0580\u0565\u0584\u0577\u0561\u0562\u0569\u056B",
|
|
419
|
+
"\u0549\u0578\u0580\u0565\u0584\u0577\u0561\u0562\u0569\u056B",
|
|
420
|
+
"\u0540\u056B\u0576\u0563\u0577\u0561\u0562\u0569\u056B",
|
|
421
|
+
"\u0548\u0582\u0580\u0562\u0561\u0569",
|
|
422
|
+
"\u0547\u0561\u0562\u0561\u0569"
|
|
423
|
+
],
|
|
424
|
+
"day_short": [
|
|
425
|
+
"\u053F\u056B\u0580",
|
|
426
|
+
"\u0535\u0580\u056F",
|
|
427
|
+
"\u0535\u0580\u0584",
|
|
428
|
+
"\u0549\u0578\u0580",
|
|
429
|
+
"\u0540\u0576\u0563",
|
|
430
|
+
"\u0548\u0582\u0580\u0562",
|
|
431
|
+
"\u0547\u0562\u0569"
|
|
432
|
+
],
|
|
433
|
+
"ordinal": {
|
|
434
|
+
"one": "{n}\u056B\u0576",
|
|
435
|
+
"two": "{n}\u0580\u0564",
|
|
436
|
+
"few": "{n}\u0580\u0564",
|
|
437
|
+
"other": "{n}\u0580\u0564"
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
var am_default = copy;
|
|
441
|
+
var copy2 = {
|
|
442
|
+
"month": [
|
|
443
|
+
"\u064A\u0646\u0627\u064A\u0631",
|
|
444
|
+
"\u0641\u0628\u0631\u0627\u064A\u0631",
|
|
445
|
+
"\u0645\u0627\u0631\u0633",
|
|
446
|
+
"\u0623\u0628\u0631\u064A\u0644",
|
|
447
|
+
"\u0645\u0627\u064A\u0648",
|
|
448
|
+
"\u064A\u0648\u0646\u064A\u0648",
|
|
449
|
+
"\u064A\u0648\u0644\u064A\u0648",
|
|
450
|
+
"\u0623\u063A\u0633\u0637\u0633",
|
|
451
|
+
"\u0633\u0628\u062A\u0645\u0628\u0631",
|
|
452
|
+
"\u0623\u0643\u062A\u0648\u0628\u0631",
|
|
453
|
+
"\u0646\u0648\u0641\u0645\u0628\u0631",
|
|
454
|
+
"\u062F\u064A\u0633\u0645\u0628\u0631"
|
|
455
|
+
],
|
|
456
|
+
"month_short": [
|
|
457
|
+
"\u064A\u0646\u0627",
|
|
458
|
+
"\u0641\u0628\u0631",
|
|
459
|
+
"\u0645\u0627\u0631",
|
|
460
|
+
"\u0623\u0628\u0631",
|
|
461
|
+
"\u0645\u0627\u064A",
|
|
462
|
+
"\u064A\u0648\u0646",
|
|
463
|
+
"\u064A\u0648\u0644",
|
|
464
|
+
"\u0623\u063A\u0633",
|
|
465
|
+
"\u0633\u0628\u062A",
|
|
466
|
+
"\u0623\u0643\u062A",
|
|
467
|
+
"\u0646\u0648\u0641",
|
|
468
|
+
"\u062F\u064A\u0633"
|
|
469
|
+
],
|
|
470
|
+
"day": [
|
|
471
|
+
"\u0627\u0644\u0623\u062D\u062F",
|
|
472
|
+
"\u0627\u0644\u0627\u062B\u0646\u064A\u0646",
|
|
473
|
+
"\u0627\u0644\u062B\u0644\u0627\u062B\u0627\u0621",
|
|
474
|
+
"\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621",
|
|
475
|
+
"\u0627\u0644\u062E\u0645\u064A\u0633",
|
|
476
|
+
"\u0627\u0644\u062C\u0645\u0639\u0629",
|
|
477
|
+
"\u0627\u0644\u0633\u0628\u062A"
|
|
478
|
+
],
|
|
479
|
+
"day_short": [
|
|
480
|
+
"\u0627\u0644\u0623\u062D",
|
|
481
|
+
"\u0627\u0644\u0627\u062B",
|
|
482
|
+
"\u0627\u0644\u062B\u0644",
|
|
483
|
+
"\u0627\u0644\u0623\u0631",
|
|
484
|
+
"\u0627\u0644\u062E\u0645",
|
|
485
|
+
"\u0627\u0644\u062C\u0645",
|
|
486
|
+
"\u0627\u0644\u0633\u0628"
|
|
487
|
+
],
|
|
488
|
+
"ordinal": {
|
|
489
|
+
"one": "{n}\u0627\u0644\u0623\u0648\u0644",
|
|
490
|
+
"two": "{n}\u0627\u0644\u062B\u0627\u0646\u064A",
|
|
491
|
+
"few": "{n}\u0627\u0644\u062B\u0627\u0644\u062B",
|
|
492
|
+
"other": "{n}\u0627\u0644\u062B\u0627\u0644\u062B"
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
var ar_default = copy2;
|
|
496
|
+
var copy3 = {
|
|
497
|
+
"month": [
|
|
498
|
+
"\u044F\u043D\u0443\u0430\u0440\u0438",
|
|
499
|
+
"\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438",
|
|
500
|
+
"\u043C\u0430\u0440\u0442",
|
|
501
|
+
"\u0430\u043F\u0440\u0438\u043B",
|
|
502
|
+
"\u043C\u0430\u0439",
|
|
503
|
+
"\u044E\u043D\u0438",
|
|
504
|
+
"\u044E\u043B\u0438",
|
|
505
|
+
"\u0430\u0432\u0433\u0443\u0441\u0442",
|
|
506
|
+
"\u0441\u0435\u043F\u0442\u0435\u043C\u0432\u0440\u0438",
|
|
507
|
+
"\u043E\u043A\u0442\u043E\u043C\u0432\u0440\u0438",
|
|
508
|
+
"\u043D\u043E\u0435\u043C\u0432\u0440\u0438",
|
|
509
|
+
"\u0434\u0435\u043A\u0435\u043C\u0432\u0440\u0438"
|
|
510
|
+
],
|
|
511
|
+
"month_short": [
|
|
512
|
+
"\u044F\u043D\u0443",
|
|
513
|
+
"\u0444\u0435\u0432",
|
|
514
|
+
"\u043C\u0430\u0440",
|
|
515
|
+
"\u0430\u043F\u0440",
|
|
516
|
+
"\u043C\u0430\u0439",
|
|
517
|
+
"\u044E\u043D\u0438",
|
|
518
|
+
"\u044E\u043B\u0438",
|
|
519
|
+
"\u0430\u0432\u0433",
|
|
520
|
+
"\u0441\u0435\u043F",
|
|
521
|
+
"\u043E\u043A\u0442",
|
|
522
|
+
"\u043D\u043E\u0435",
|
|
523
|
+
"\u0434\u0435\u043A"
|
|
524
|
+
],
|
|
525
|
+
"day": [
|
|
526
|
+
"\u043D\u0435\u0434\u0435\u043B\u044F",
|
|
527
|
+
"\u043F\u043E\u043D\u0435\u0434\u0435\u043B\u043D\u0438\u043A",
|
|
528
|
+
"\u0432\u0442\u043E\u0440\u043D\u0438\u043A",
|
|
529
|
+
"\u0441\u0440\u044F\u0434\u0430",
|
|
530
|
+
"\u0447\u0435\u0442\u0432\u044A\u0440\u0442\u044A\u043A",
|
|
531
|
+
"\u043F\u0435\u0442\u044A\u043A",
|
|
532
|
+
"\u0441\u044A\u0431\u043E\u0442\u0430"
|
|
533
|
+
],
|
|
534
|
+
"day_short": [
|
|
535
|
+
"\u043D\u0435\u0434",
|
|
536
|
+
"\u043F\u043E\u043D",
|
|
537
|
+
"\u0432\u0442\u043E",
|
|
538
|
+
"\u0441\u0440\u044F",
|
|
539
|
+
"\u0447\u0435\u0442",
|
|
540
|
+
"\u043F\u0435\u0442",
|
|
541
|
+
"\u0441\u044A\u0431"
|
|
542
|
+
],
|
|
543
|
+
ordinal: {
|
|
544
|
+
one: "\u0432\u0438",
|
|
545
|
+
two: "\u0440\u0438",
|
|
546
|
+
few: "\u0442\u0438",
|
|
547
|
+
other: "\u0442\u0438"
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
var bg_default = copy3;
|
|
551
|
+
var copy4 = {
|
|
552
|
+
"month": [
|
|
553
|
+
"Ionawr",
|
|
554
|
+
"Chwefror",
|
|
555
|
+
"Mawrth",
|
|
556
|
+
"Ebrill",
|
|
557
|
+
"Mai",
|
|
558
|
+
"Mehefin",
|
|
559
|
+
"Gorffennaf",
|
|
560
|
+
"Awst",
|
|
561
|
+
"Medi",
|
|
562
|
+
"Hydref",
|
|
563
|
+
"Tachwedd",
|
|
564
|
+
"Rhagfyr"
|
|
565
|
+
],
|
|
566
|
+
"month_short": [
|
|
567
|
+
"Ion",
|
|
568
|
+
"Chwef",
|
|
569
|
+
"Maw",
|
|
570
|
+
"Ebr",
|
|
571
|
+
"Mai",
|
|
572
|
+
"Meh",
|
|
573
|
+
"Gorff",
|
|
574
|
+
"Awst",
|
|
575
|
+
"Medi",
|
|
576
|
+
"Hyd",
|
|
577
|
+
"Tach",
|
|
578
|
+
"Rhag"
|
|
579
|
+
],
|
|
580
|
+
"day": [
|
|
581
|
+
"Dydd Sul",
|
|
582
|
+
"Dydd Llun",
|
|
583
|
+
"Dydd Mawrth",
|
|
584
|
+
"Dydd Mercher",
|
|
585
|
+
"Dydd Iau",
|
|
586
|
+
"Dydd Gwener",
|
|
587
|
+
"Dydd Sadwrn"
|
|
588
|
+
],
|
|
589
|
+
"day_short": [
|
|
590
|
+
"Sul",
|
|
591
|
+
"Llun",
|
|
592
|
+
"Maw",
|
|
593
|
+
"Mer",
|
|
594
|
+
"Iau",
|
|
595
|
+
"Gwen",
|
|
596
|
+
"Sad"
|
|
597
|
+
],
|
|
598
|
+
"ordinal": {
|
|
599
|
+
"one": "{n}fed",
|
|
600
|
+
"two": "{n}fed",
|
|
601
|
+
"few": "{n}ydd",
|
|
602
|
+
"other": "{n}ed"
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
var cy_default = copy4;
|
|
606
|
+
var copy5 = {
|
|
607
|
+
month: [
|
|
608
|
+
"Januar",
|
|
609
|
+
"Februar",
|
|
610
|
+
"M\xE4rz",
|
|
611
|
+
"April",
|
|
612
|
+
"Mai",
|
|
613
|
+
"Juni",
|
|
614
|
+
"Juli",
|
|
615
|
+
"August",
|
|
616
|
+
"September",
|
|
617
|
+
"Oktober",
|
|
618
|
+
"November",
|
|
619
|
+
"Dezember"
|
|
620
|
+
],
|
|
621
|
+
month_short: [
|
|
622
|
+
"Jan",
|
|
623
|
+
"Feb",
|
|
624
|
+
"M\xE4r",
|
|
625
|
+
"Apr",
|
|
626
|
+
"Mai",
|
|
627
|
+
"Jun",
|
|
628
|
+
"Jul",
|
|
629
|
+
"Aug",
|
|
630
|
+
"Sep",
|
|
631
|
+
"Okt",
|
|
632
|
+
"Nov",
|
|
633
|
+
"Dez"
|
|
634
|
+
],
|
|
635
|
+
day: [
|
|
636
|
+
"Sonntag",
|
|
637
|
+
"Montag",
|
|
638
|
+
"Dienstag",
|
|
639
|
+
"Mittwoch",
|
|
640
|
+
"Donnerstag",
|
|
641
|
+
"Freitag",
|
|
642
|
+
"Samstag"
|
|
643
|
+
],
|
|
644
|
+
day_short: [
|
|
645
|
+
"So",
|
|
646
|
+
"Mo",
|
|
647
|
+
"Di",
|
|
648
|
+
"Mi",
|
|
649
|
+
"Do",
|
|
650
|
+
"Fr",
|
|
651
|
+
"Sa"
|
|
652
|
+
],
|
|
653
|
+
ordinal: {
|
|
654
|
+
"one": "{n}ste",
|
|
655
|
+
"two": "{n}de",
|
|
656
|
+
"few": "{n}de",
|
|
657
|
+
"other": "{n}de"
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
var de_default = copy5;
|
|
661
|
+
var copy6 = {
|
|
662
|
+
"month": [
|
|
663
|
+
"januar",
|
|
664
|
+
"februar",
|
|
665
|
+
"marts",
|
|
666
|
+
"april",
|
|
667
|
+
"maj",
|
|
668
|
+
"juni",
|
|
669
|
+
"juli",
|
|
670
|
+
"august",
|
|
671
|
+
"september",
|
|
672
|
+
"oktober",
|
|
673
|
+
"november",
|
|
674
|
+
"december"
|
|
675
|
+
],
|
|
676
|
+
"month_short": [
|
|
677
|
+
"jan",
|
|
678
|
+
"feb",
|
|
679
|
+
"mar",
|
|
680
|
+
"apr",
|
|
681
|
+
"maj",
|
|
682
|
+
"jun",
|
|
683
|
+
"jul",
|
|
684
|
+
"aug",
|
|
685
|
+
"sep",
|
|
686
|
+
"okt",
|
|
687
|
+
"nov",
|
|
688
|
+
"dec"
|
|
689
|
+
],
|
|
690
|
+
"day": [
|
|
691
|
+
"s\xF8ndag",
|
|
692
|
+
"mandag",
|
|
693
|
+
"tirsdag",
|
|
694
|
+
"onsdag",
|
|
695
|
+
"torsdag",
|
|
696
|
+
"fredag",
|
|
697
|
+
"l\xF8rdag"
|
|
698
|
+
],
|
|
699
|
+
"day_short": [
|
|
700
|
+
"s\xF8n",
|
|
701
|
+
"man",
|
|
702
|
+
"tir",
|
|
703
|
+
"ons",
|
|
704
|
+
"tor",
|
|
705
|
+
"fre",
|
|
706
|
+
"l\xF8r"
|
|
707
|
+
],
|
|
708
|
+
"ordinal": {
|
|
709
|
+
"one": "{n}st",
|
|
710
|
+
"two": "{n}nd",
|
|
711
|
+
"few": "{n}rd",
|
|
712
|
+
"other": "{n}th"
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
var dk_default = copy6;
|
|
716
|
+
var copy7 = {
|
|
717
|
+
month: [
|
|
718
|
+
"January",
|
|
719
|
+
"February",
|
|
720
|
+
"March",
|
|
721
|
+
"April",
|
|
722
|
+
"May",
|
|
723
|
+
"June",
|
|
724
|
+
"July",
|
|
725
|
+
"August",
|
|
726
|
+
"September",
|
|
727
|
+
"October",
|
|
728
|
+
"November",
|
|
729
|
+
"December"
|
|
730
|
+
],
|
|
731
|
+
month_short: [
|
|
732
|
+
"jan",
|
|
733
|
+
"feb",
|
|
734
|
+
"mar",
|
|
735
|
+
"apr",
|
|
736
|
+
"may",
|
|
737
|
+
"jun",
|
|
738
|
+
"jul",
|
|
739
|
+
"aug",
|
|
740
|
+
"sep",
|
|
741
|
+
"oct",
|
|
742
|
+
"nov",
|
|
743
|
+
"dec"
|
|
744
|
+
],
|
|
745
|
+
day: [
|
|
746
|
+
"Sunday",
|
|
747
|
+
"Monday",
|
|
748
|
+
"Tuesday",
|
|
749
|
+
"Wednesday",
|
|
750
|
+
"Thursday",
|
|
751
|
+
"Friday",
|
|
752
|
+
"Saturday"
|
|
753
|
+
],
|
|
754
|
+
day_short: ["sun", "mon", "tue", "wed", "thu", "fri", "sat"],
|
|
755
|
+
ordinal: {
|
|
756
|
+
one: "{n}st",
|
|
757
|
+
two: "{n}nd",
|
|
758
|
+
few: "{n}rd",
|
|
759
|
+
other: "{n}th"
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
var en_default = copy7;
|
|
763
|
+
var copy8 = {
|
|
764
|
+
"month": [
|
|
765
|
+
"enero",
|
|
766
|
+
"febrero",
|
|
767
|
+
"marzo",
|
|
768
|
+
"abril",
|
|
769
|
+
"mayo",
|
|
770
|
+
"junio",
|
|
771
|
+
"julio",
|
|
772
|
+
"agosto",
|
|
773
|
+
"septiembre",
|
|
774
|
+
"octubre",
|
|
775
|
+
"noviembre",
|
|
776
|
+
"diciembre"
|
|
777
|
+
],
|
|
778
|
+
"month_short": [
|
|
779
|
+
"ene",
|
|
780
|
+
"feb",
|
|
781
|
+
"mar",
|
|
782
|
+
"abr",
|
|
783
|
+
"may",
|
|
784
|
+
"jun",
|
|
785
|
+
"jul",
|
|
786
|
+
"ago",
|
|
787
|
+
"sep",
|
|
788
|
+
"oct",
|
|
789
|
+
"nov",
|
|
790
|
+
"dic"
|
|
791
|
+
],
|
|
792
|
+
"day": [
|
|
793
|
+
"domingo",
|
|
794
|
+
"lunes",
|
|
795
|
+
"martes",
|
|
796
|
+
"mi\xE9rcoles",
|
|
797
|
+
"jueves",
|
|
798
|
+
"viernes",
|
|
799
|
+
"s\xE1bado"
|
|
800
|
+
],
|
|
801
|
+
"day_short": [
|
|
802
|
+
"dom",
|
|
803
|
+
"lun",
|
|
804
|
+
"mar",
|
|
805
|
+
"mi\xE9",
|
|
806
|
+
"jue",
|
|
807
|
+
"vie",
|
|
808
|
+
"s\xE1b"
|
|
809
|
+
],
|
|
810
|
+
"ordinal": {
|
|
811
|
+
"one": "{n}ro",
|
|
812
|
+
"two": "{n}do",
|
|
813
|
+
"few": "{n}ro",
|
|
814
|
+
"other": "{n}to"
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
var es_default = copy8;
|
|
818
|
+
var copy9 = {
|
|
819
|
+
"month": [
|
|
820
|
+
"jaanuar",
|
|
821
|
+
"veebruar",
|
|
822
|
+
"m\xE4rts",
|
|
823
|
+
"aprill",
|
|
824
|
+
"mai",
|
|
825
|
+
"juuni",
|
|
826
|
+
"juuli",
|
|
827
|
+
"august",
|
|
828
|
+
"september",
|
|
829
|
+
"oktoober",
|
|
830
|
+
"november",
|
|
831
|
+
"detsember"
|
|
832
|
+
],
|
|
833
|
+
"month_short": [
|
|
834
|
+
"jaan",
|
|
835
|
+
"veebr",
|
|
836
|
+
"m\xE4rts",
|
|
837
|
+
"apr",
|
|
838
|
+
"mai",
|
|
839
|
+
"juuni",
|
|
840
|
+
"juuli",
|
|
841
|
+
"aug",
|
|
842
|
+
"sept",
|
|
843
|
+
"okt",
|
|
844
|
+
"nov",
|
|
845
|
+
"dets"
|
|
846
|
+
],
|
|
847
|
+
"day": [
|
|
848
|
+
"p\xFChap\xE4ev",
|
|
849
|
+
"esmasp\xE4ev",
|
|
850
|
+
"teisip\xE4ev",
|
|
851
|
+
"kolmap\xE4ev",
|
|
852
|
+
"neljap\xE4ev",
|
|
853
|
+
"reede",
|
|
854
|
+
"laup\xE4ev"
|
|
855
|
+
],
|
|
856
|
+
"day_short": [
|
|
857
|
+
"P",
|
|
858
|
+
"E",
|
|
859
|
+
"T",
|
|
860
|
+
"K",
|
|
861
|
+
"N",
|
|
862
|
+
"R",
|
|
863
|
+
"L"
|
|
864
|
+
],
|
|
865
|
+
"ordinal": {
|
|
866
|
+
"one": "{n}esimene",
|
|
867
|
+
"two": "{n}teine",
|
|
868
|
+
"few": "{n}kolmas",
|
|
869
|
+
"other": "{n}esimene"
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
var et_default = copy9;
|
|
873
|
+
var copy10 = {
|
|
874
|
+
"month": [
|
|
875
|
+
"tammikuu",
|
|
876
|
+
"helmikuu",
|
|
877
|
+
"maaliskuu",
|
|
878
|
+
"huhtikuu",
|
|
879
|
+
"toukokuu",
|
|
880
|
+
"kes\xE4kuu",
|
|
881
|
+
"hein\xE4kuu",
|
|
882
|
+
"elokuu",
|
|
883
|
+
"syyskuu",
|
|
884
|
+
"lokakuu",
|
|
885
|
+
"marraskuu",
|
|
886
|
+
"joulukuu"
|
|
887
|
+
],
|
|
888
|
+
"month_short": [
|
|
889
|
+
"tammi",
|
|
890
|
+
"helmi",
|
|
891
|
+
"maalis",
|
|
892
|
+
"huhti",
|
|
893
|
+
"touko",
|
|
894
|
+
"kes\xE4",
|
|
895
|
+
"hein\xE4",
|
|
896
|
+
"elo",
|
|
897
|
+
"syys",
|
|
898
|
+
"loka",
|
|
899
|
+
"marras",
|
|
900
|
+
"joulu"
|
|
901
|
+
],
|
|
902
|
+
"day": [
|
|
903
|
+
"sunnuntai",
|
|
904
|
+
"maanantai",
|
|
905
|
+
"tiistai",
|
|
906
|
+
"keskiviikko",
|
|
907
|
+
"torstai",
|
|
908
|
+
"perjantai",
|
|
909
|
+
"lauantai"
|
|
910
|
+
],
|
|
911
|
+
"day_short": [
|
|
912
|
+
"su",
|
|
913
|
+
"ma",
|
|
914
|
+
"ti",
|
|
915
|
+
"ke",
|
|
916
|
+
"to",
|
|
917
|
+
"pe",
|
|
918
|
+
"la"
|
|
919
|
+
],
|
|
920
|
+
"ordinal": {
|
|
921
|
+
"one": "{n}ensimm\xE4inen",
|
|
922
|
+
"two": "{n}toinen",
|
|
923
|
+
"few": "{n}kolmas",
|
|
924
|
+
"other": "{n}kolmas"
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
var fi_default = copy10;
|
|
928
|
+
var copy11 = {
|
|
929
|
+
"month": [
|
|
930
|
+
"janvier",
|
|
931
|
+
"f\xE9vrier",
|
|
932
|
+
"mars",
|
|
933
|
+
"avril",
|
|
934
|
+
"mai",
|
|
935
|
+
"juin",
|
|
936
|
+
"juillet",
|
|
937
|
+
"ao\xFBt",
|
|
938
|
+
"septembre",
|
|
939
|
+
"octobre",
|
|
940
|
+
"novembre",
|
|
941
|
+
"d\xE9cembre"
|
|
942
|
+
],
|
|
943
|
+
"month_short": [
|
|
944
|
+
"janv",
|
|
945
|
+
"f\xE9vr",
|
|
946
|
+
"mars",
|
|
947
|
+
"avr",
|
|
948
|
+
"mai",
|
|
949
|
+
"juin",
|
|
950
|
+
"juil",
|
|
951
|
+
"ao\xFBt",
|
|
952
|
+
"sept",
|
|
953
|
+
"oct",
|
|
954
|
+
"nov",
|
|
955
|
+
"d\xE9c"
|
|
956
|
+
],
|
|
957
|
+
"day": [
|
|
958
|
+
"dimanche",
|
|
959
|
+
"lundi",
|
|
960
|
+
"mardi",
|
|
961
|
+
"mercredi",
|
|
962
|
+
"jeudi",
|
|
963
|
+
"vendredi",
|
|
964
|
+
"samedi"
|
|
965
|
+
],
|
|
966
|
+
"day_short": [
|
|
967
|
+
"dim",
|
|
968
|
+
"lun",
|
|
969
|
+
"mar",
|
|
970
|
+
"mer",
|
|
971
|
+
"jeu",
|
|
972
|
+
"ven",
|
|
973
|
+
"sam"
|
|
974
|
+
],
|
|
975
|
+
"ordinal": {
|
|
976
|
+
"one": "{n}er",
|
|
977
|
+
"two": "{n}do",
|
|
978
|
+
"few": "{n}do",
|
|
979
|
+
"other": "{n}to"
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
var fr_default = copy11;
|
|
983
|
+
var copy12 = {
|
|
984
|
+
"month": [
|
|
985
|
+
"\u0399\u03B1\u03BD\u03BF\u03C5\u03AC\u03C1\u03B9\u03BF\u03C2",
|
|
986
|
+
"\u03A6\u03B5\u03B2\u03C1\u03BF\u03C5\u03AC\u03C1\u03B9\u03BF\u03C2",
|
|
987
|
+
"\u039C\u03AC\u03C1\u03C4\u03B9\u03BF\u03C2",
|
|
988
|
+
"\u0391\u03C0\u03C1\u03AF\u03BB\u03B9\u03BF\u03C2",
|
|
989
|
+
"\u039C\u03AC\u03B9\u03BF\u03C2",
|
|
990
|
+
"\u0399\u03BF\u03CD\u03BD\u03B9\u03BF\u03C2",
|
|
991
|
+
"\u0399\u03BF\u03CD\u03BB\u03B9\u03BF\u03C2",
|
|
992
|
+
"\u0391\u03CD\u03B3\u03BF\u03C5\u03C3\u03C4\u03BF\u03C2",
|
|
993
|
+
"\u03A3\u03B5\u03C0\u03C4\u03AD\u03BC\u03B2\u03C1\u03B9\u03BF\u03C2",
|
|
994
|
+
"\u039F\u03BA\u03C4\u03CE\u03B2\u03C1\u03B9\u03BF\u03C2",
|
|
995
|
+
"\u039D\u03BF\u03AD\u03BC\u03B2\u03C1\u03B9\u03BF\u03C2",
|
|
996
|
+
"\u0394\u03B5\u03BA\u03AD\u03BC\u03B2\u03C1\u03B9\u03BF\u03C2"
|
|
997
|
+
],
|
|
998
|
+
"month_short": [
|
|
999
|
+
"\u0399\u03B1\u03BD",
|
|
1000
|
+
"\u03A6\u03B5\u03B2",
|
|
1001
|
+
"\u039C\u03AC\u03C1",
|
|
1002
|
+
"\u0391\u03C0\u03C1",
|
|
1003
|
+
"\u039C\u03AC\u03B9",
|
|
1004
|
+
"\u0399\u03BF\u03CD\u03BD",
|
|
1005
|
+
"\u0399\u03BF\u03CD\u03BB",
|
|
1006
|
+
"\u0391\u03CD\u03B3",
|
|
1007
|
+
"\u03A3\u03B5\u03C0",
|
|
1008
|
+
"\u039F\u03BA\u03C4",
|
|
1009
|
+
"\u039D\u03BF\u03AD",
|
|
1010
|
+
"\u0394\u03B5\u03BA"
|
|
1011
|
+
],
|
|
1012
|
+
"day": [
|
|
1013
|
+
"\u039A\u03C5\u03C1\u03B9\u03B1\u03BA\u03AE",
|
|
1014
|
+
"\u0394\u03B5\u03C5\u03C4\u03AD\u03C1\u03B1",
|
|
1015
|
+
"\u03A4\u03C1\u03AF\u03C4\u03B7",
|
|
1016
|
+
"\u03A4\u03B5\u03C4\u03AC\u03C1\u03C4\u03B7",
|
|
1017
|
+
"\u03A0\u03AD\u03BC\u03C0\u03C4\u03B7",
|
|
1018
|
+
"\u03A0\u03B1\u03C1\u03B1\u03C3\u03BA\u03B5\u03C5\u03AE",
|
|
1019
|
+
"\u03A3\u03AC\u03B2\u03B2\u03B1\u03C4\u03BF"
|
|
1020
|
+
],
|
|
1021
|
+
"day_short": [
|
|
1022
|
+
"\u039A\u03C5\u03C1",
|
|
1023
|
+
"\u0394\u03B5\u03C5",
|
|
1024
|
+
"\u03A4\u03C1\u03B9",
|
|
1025
|
+
"\u03A4\u03B5\u03C4",
|
|
1026
|
+
"\u03A0\u03B5\u03BC",
|
|
1027
|
+
"\u03A0\u03B1\u03C1",
|
|
1028
|
+
"\u03A3\u03B1\u03B2"
|
|
1029
|
+
],
|
|
1030
|
+
"ordinal": {
|
|
1031
|
+
"one": "{n}\u03B7",
|
|
1032
|
+
"two": "{n}\u03B7",
|
|
1033
|
+
"few": "{n}\u03B7",
|
|
1034
|
+
"other": "{n}\u03B7"
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
var gr_default = copy12;
|
|
1038
|
+
var copy13 = {
|
|
1039
|
+
"month": [
|
|
1040
|
+
"janu\xE1r",
|
|
1041
|
+
"febru\xE1r",
|
|
1042
|
+
"m\xE1rcius",
|
|
1043
|
+
"\xE1prilis",
|
|
1044
|
+
"m\xE1jus",
|
|
1045
|
+
"j\xFAnius",
|
|
1046
|
+
"j\xFAlius",
|
|
1047
|
+
"augusztus",
|
|
1048
|
+
"szeptember",
|
|
1049
|
+
"okt\xF3ber",
|
|
1050
|
+
"november",
|
|
1051
|
+
"december"
|
|
1052
|
+
],
|
|
1053
|
+
"month_short": [
|
|
1054
|
+
"jan",
|
|
1055
|
+
"feb",
|
|
1056
|
+
"m\xE1r",
|
|
1057
|
+
"\xE1pr",
|
|
1058
|
+
"m\xE1j",
|
|
1059
|
+
"j\xFAn",
|
|
1060
|
+
"j\xFAl",
|
|
1061
|
+
"aug",
|
|
1062
|
+
"szept",
|
|
1063
|
+
"okt",
|
|
1064
|
+
"nov",
|
|
1065
|
+
"dec"
|
|
1066
|
+
],
|
|
1067
|
+
"day": [
|
|
1068
|
+
"vas\xE1rnap",
|
|
1069
|
+
"h\xE9tf\u0151",
|
|
1070
|
+
"kedd",
|
|
1071
|
+
"szerda",
|
|
1072
|
+
"cs\xFCt\xF6rt\xF6k",
|
|
1073
|
+
"p\xE9ntek",
|
|
1074
|
+
"szombat"
|
|
1075
|
+
],
|
|
1076
|
+
"day_short": [
|
|
1077
|
+
"v",
|
|
1078
|
+
"h",
|
|
1079
|
+
"k",
|
|
1080
|
+
"sze",
|
|
1081
|
+
"cs",
|
|
1082
|
+
"p",
|
|
1083
|
+
"szo"
|
|
1084
|
+
],
|
|
1085
|
+
"ordinal": {
|
|
1086
|
+
"one": "{n}ik",
|
|
1087
|
+
"two": "{n}ik",
|
|
1088
|
+
"few": "{n}ik",
|
|
1089
|
+
"other": "{n}ik"
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
var hu_default = copy13;
|
|
1093
|
+
var copy14 = {
|
|
1094
|
+
"month": [
|
|
1095
|
+
"Ean\xE1ir",
|
|
1096
|
+
"Feabhra",
|
|
1097
|
+
"M\xE1rta",
|
|
1098
|
+
"Aibre\xE1n",
|
|
1099
|
+
"Bealtaine",
|
|
1100
|
+
"Meitheamh",
|
|
1101
|
+
"I\xFAil",
|
|
1102
|
+
"L\xFAnasa",
|
|
1103
|
+
"Me\xE1n F\xF3mhair",
|
|
1104
|
+
"Deireadh F\xF3mhair",
|
|
1105
|
+
"Samhain",
|
|
1106
|
+
"Nollaig"
|
|
1107
|
+
],
|
|
1108
|
+
"month_short": [
|
|
1109
|
+
"Ean",
|
|
1110
|
+
"Feabh",
|
|
1111
|
+
"M\xE1r",
|
|
1112
|
+
"Aib",
|
|
1113
|
+
"Beal",
|
|
1114
|
+
"Meith",
|
|
1115
|
+
"I\xFAil",
|
|
1116
|
+
"L\xFAn",
|
|
1117
|
+
"MF\xF3mh",
|
|
1118
|
+
"DF\xF3mh",
|
|
1119
|
+
"Samh",
|
|
1120
|
+
"Noll"
|
|
1121
|
+
],
|
|
1122
|
+
"day": [
|
|
1123
|
+
"D\xE9 Domhnaigh",
|
|
1124
|
+
"D\xE9 Luain",
|
|
1125
|
+
"D\xE9 M\xE1irt",
|
|
1126
|
+
"D\xE9 C\xE9adaoin",
|
|
1127
|
+
"D\xE9ardaoin",
|
|
1128
|
+
"D\xE9 hAoine",
|
|
1129
|
+
"D\xE9 Sathairn"
|
|
1130
|
+
],
|
|
1131
|
+
"day_short": [
|
|
1132
|
+
"Domh",
|
|
1133
|
+
"Luan",
|
|
1134
|
+
"M\xE1irt",
|
|
1135
|
+
"C\xE9ad",
|
|
1136
|
+
"D\xE9ar",
|
|
1137
|
+
"Aoine",
|
|
1138
|
+
"Sath"
|
|
1139
|
+
],
|
|
1140
|
+
"ordinal": {
|
|
1141
|
+
"one": "{n}\xFA",
|
|
1142
|
+
"two": "{n}\xFA",
|
|
1143
|
+
"few": "{n}\xFA",
|
|
1144
|
+
"other": "{n}\xFA"
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
var ir_default = copy14;
|
|
1148
|
+
var copy15 = {
|
|
1149
|
+
"month": [
|
|
1150
|
+
"gennaio",
|
|
1151
|
+
"febbraio",
|
|
1152
|
+
"marzo",
|
|
1153
|
+
"aprile",
|
|
1154
|
+
"maggio",
|
|
1155
|
+
"giugno",
|
|
1156
|
+
"luglio",
|
|
1157
|
+
"agosto",
|
|
1158
|
+
"settembre",
|
|
1159
|
+
"ottobre",
|
|
1160
|
+
"novembre",
|
|
1161
|
+
"dicembre"
|
|
1162
|
+
],
|
|
1163
|
+
"month_short": [
|
|
1164
|
+
"gen",
|
|
1165
|
+
"feb",
|
|
1166
|
+
"mar",
|
|
1167
|
+
"apr",
|
|
1168
|
+
"mag",
|
|
1169
|
+
"giu",
|
|
1170
|
+
"lug",
|
|
1171
|
+
"ago",
|
|
1172
|
+
"set",
|
|
1173
|
+
"ott",
|
|
1174
|
+
"nov",
|
|
1175
|
+
"dic"
|
|
1176
|
+
],
|
|
1177
|
+
"day": [
|
|
1178
|
+
"domenica",
|
|
1179
|
+
"luned\xEC",
|
|
1180
|
+
"marted\xEC",
|
|
1181
|
+
"mercoled\xEC",
|
|
1182
|
+
"gioved\xEC",
|
|
1183
|
+
"venerd\xEC",
|
|
1184
|
+
"sabato"
|
|
1185
|
+
],
|
|
1186
|
+
"day_short": [
|
|
1187
|
+
"dom",
|
|
1188
|
+
"lun",
|
|
1189
|
+
"mar",
|
|
1190
|
+
"mer",
|
|
1191
|
+
"gio",
|
|
1192
|
+
"ven",
|
|
1193
|
+
"sab"
|
|
1194
|
+
],
|
|
1195
|
+
"ordinal": {
|
|
1196
|
+
"one": "{n}ro",
|
|
1197
|
+
"two": "{n}do",
|
|
1198
|
+
"few": "{n}ro",
|
|
1199
|
+
"other": "{n}to"
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
var it_default = copy15;
|
|
1203
|
+
var copy16 = {
|
|
1204
|
+
"month": [
|
|
1205
|
+
"janv\u0101ris",
|
|
1206
|
+
"febru\u0101ris",
|
|
1207
|
+
"marts",
|
|
1208
|
+
"apr\u012Blis",
|
|
1209
|
+
"maijs",
|
|
1210
|
+
"j\u016Bnijs",
|
|
1211
|
+
"j\u016Blijs",
|
|
1212
|
+
"augusts",
|
|
1213
|
+
"septembris",
|
|
1214
|
+
"oktobris",
|
|
1215
|
+
"novembris",
|
|
1216
|
+
"decembris"
|
|
1217
|
+
],
|
|
1218
|
+
"month_short": [
|
|
1219
|
+
"jan",
|
|
1220
|
+
"feb",
|
|
1221
|
+
"mar",
|
|
1222
|
+
"apr",
|
|
1223
|
+
"mai",
|
|
1224
|
+
"j\u016Bn",
|
|
1225
|
+
"j\u016Bl",
|
|
1226
|
+
"aug",
|
|
1227
|
+
"sep",
|
|
1228
|
+
"okt",
|
|
1229
|
+
"nov",
|
|
1230
|
+
"dec"
|
|
1231
|
+
],
|
|
1232
|
+
"day": [
|
|
1233
|
+
"sv\u0113tdiena",
|
|
1234
|
+
"pirmdiena",
|
|
1235
|
+
"otrdiena",
|
|
1236
|
+
"tre\u0161diena",
|
|
1237
|
+
"ceturtdiena",
|
|
1238
|
+
"piektdiena",
|
|
1239
|
+
"sestdiena"
|
|
1240
|
+
],
|
|
1241
|
+
"day_short": [
|
|
1242
|
+
"sv\u0113t",
|
|
1243
|
+
"pir",
|
|
1244
|
+
"otr",
|
|
1245
|
+
"tre",
|
|
1246
|
+
"cet",
|
|
1247
|
+
"pie",
|
|
1248
|
+
"ses"
|
|
1249
|
+
],
|
|
1250
|
+
"ordinal": {
|
|
1251
|
+
"one": "{n}ais",
|
|
1252
|
+
"two": "{n}ais",
|
|
1253
|
+
"few": "{n}ais",
|
|
1254
|
+
"other": "{n}ais"
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
var la_default = copy16;
|
|
1258
|
+
var copy17 = {
|
|
1259
|
+
"month": [
|
|
1260
|
+
"sausis",
|
|
1261
|
+
"vasaris",
|
|
1262
|
+
"kovas",
|
|
1263
|
+
"balandis",
|
|
1264
|
+
"gegu\u017E\u0117",
|
|
1265
|
+
"bir\u017Eelis",
|
|
1266
|
+
"liepa",
|
|
1267
|
+
"rugpj\u016Btis",
|
|
1268
|
+
"rugs\u0117jis",
|
|
1269
|
+
"spalis",
|
|
1270
|
+
"lapkritis",
|
|
1271
|
+
"gruodis"
|
|
1272
|
+
],
|
|
1273
|
+
"month_short": [
|
|
1274
|
+
"sau",
|
|
1275
|
+
"vas",
|
|
1276
|
+
"kov",
|
|
1277
|
+
"bal",
|
|
1278
|
+
"geg",
|
|
1279
|
+
"bir",
|
|
1280
|
+
"lie",
|
|
1281
|
+
"rugp",
|
|
1282
|
+
"rugs",
|
|
1283
|
+
"spa",
|
|
1284
|
+
"lap",
|
|
1285
|
+
"gru"
|
|
1286
|
+
],
|
|
1287
|
+
"day": [
|
|
1288
|
+
"sekmadienis",
|
|
1289
|
+
"pirmadienis",
|
|
1290
|
+
"antradienis",
|
|
1291
|
+
"tre\u010Diadienis",
|
|
1292
|
+
"ketvirtadienis",
|
|
1293
|
+
"penktadienis",
|
|
1294
|
+
"\u0161e\u0161tadienis"
|
|
1295
|
+
],
|
|
1296
|
+
"day_short": [
|
|
1297
|
+
"sek",
|
|
1298
|
+
"pir",
|
|
1299
|
+
"ant",
|
|
1300
|
+
"tre",
|
|
1301
|
+
"ket",
|
|
1302
|
+
"pen",
|
|
1303
|
+
"\u0161e\u0161"
|
|
1304
|
+
],
|
|
1305
|
+
"ordinal": {
|
|
1306
|
+
"one": "{n}as",
|
|
1307
|
+
"two": "{n}as",
|
|
1308
|
+
"few": "{n}as",
|
|
1309
|
+
"other": "{n}as"
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
var lt_default = copy17;
|
|
1313
|
+
var copy18 = {
|
|
1314
|
+
"month": [
|
|
1315
|
+
"Jannar",
|
|
1316
|
+
"Frar",
|
|
1317
|
+
"Marzu",
|
|
1318
|
+
"April",
|
|
1319
|
+
"Mejju",
|
|
1320
|
+
"\u0120unju",
|
|
1321
|
+
"Lulju",
|
|
1322
|
+
"Awissu",
|
|
1323
|
+
"Settembru",
|
|
1324
|
+
"Ottubru",
|
|
1325
|
+
"Novembru",
|
|
1326
|
+
"Di\u010Bembru"
|
|
1327
|
+
],
|
|
1328
|
+
"month_short": [
|
|
1329
|
+
"Jan",
|
|
1330
|
+
"Fra",
|
|
1331
|
+
"Mar",
|
|
1332
|
+
"Apr",
|
|
1333
|
+
"Mej",
|
|
1334
|
+
"\u0120un",
|
|
1335
|
+
"Lul",
|
|
1336
|
+
"Awi",
|
|
1337
|
+
"Set",
|
|
1338
|
+
"Ott",
|
|
1339
|
+
"Nov",
|
|
1340
|
+
"Di\u010B"
|
|
1341
|
+
],
|
|
1342
|
+
"day": [
|
|
1343
|
+
"Il-\u0126add",
|
|
1344
|
+
"It-Tnejn",
|
|
1345
|
+
"It-Tlieta",
|
|
1346
|
+
"L-Erbg\u0127a",
|
|
1347
|
+
"Il-\u0126amis",
|
|
1348
|
+
"Il-\u0120img\u0127a",
|
|
1349
|
+
"Is-Sibt"
|
|
1350
|
+
],
|
|
1351
|
+
"day_short": [
|
|
1352
|
+
"\u0126ad",
|
|
1353
|
+
"Tne",
|
|
1354
|
+
"Tli",
|
|
1355
|
+
"Erb",
|
|
1356
|
+
"\u0126am",
|
|
1357
|
+
"\u0120im",
|
|
1358
|
+
"Sib"
|
|
1359
|
+
],
|
|
1360
|
+
"ordinal": {
|
|
1361
|
+
"one": "il{n}",
|
|
1362
|
+
"two": "il{n}",
|
|
1363
|
+
"few": "il{n}",
|
|
1364
|
+
"other": "il{n}"
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
var mt_default = copy18;
|
|
1368
|
+
var copy19 = {
|
|
1369
|
+
month: [
|
|
1370
|
+
"januari",
|
|
1371
|
+
"februari",
|
|
1372
|
+
"maart",
|
|
1373
|
+
"april",
|
|
1374
|
+
"mei",
|
|
1375
|
+
"juni",
|
|
1376
|
+
"juli",
|
|
1377
|
+
"augustus",
|
|
1378
|
+
"september",
|
|
1379
|
+
"oktober",
|
|
1380
|
+
"november",
|
|
1381
|
+
"december"
|
|
1382
|
+
],
|
|
1383
|
+
month_short: [
|
|
1384
|
+
"jan",
|
|
1385
|
+
"feb",
|
|
1386
|
+
"mrt",
|
|
1387
|
+
"apr",
|
|
1388
|
+
"mei",
|
|
1389
|
+
"jun",
|
|
1390
|
+
"jul",
|
|
1391
|
+
"aug",
|
|
1392
|
+
"sep",
|
|
1393
|
+
"okt",
|
|
1394
|
+
"nov",
|
|
1395
|
+
"dec"
|
|
1396
|
+
],
|
|
1397
|
+
day: [
|
|
1398
|
+
"zondag",
|
|
1399
|
+
"maandag",
|
|
1400
|
+
"dinsdag",
|
|
1401
|
+
"woensdag",
|
|
1402
|
+
"donderdag",
|
|
1403
|
+
"vrijdag",
|
|
1404
|
+
"zaterdag"
|
|
1405
|
+
],
|
|
1406
|
+
day_short: ["zo", "ma", "di", "wo", "do", "vr", "za"],
|
|
1407
|
+
ordinal: {
|
|
1408
|
+
one: "{n}ste",
|
|
1409
|
+
two: "{n}de",
|
|
1410
|
+
few: "{n}de",
|
|
1411
|
+
other: "{n}de"
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
var nl_default = copy19;
|
|
1415
|
+
var copy20 = {
|
|
1416
|
+
"month": [
|
|
1417
|
+
"januar",
|
|
1418
|
+
"februar",
|
|
1419
|
+
"mars",
|
|
1420
|
+
"april",
|
|
1421
|
+
"mai",
|
|
1422
|
+
"juni",
|
|
1423
|
+
"juli",
|
|
1424
|
+
"august",
|
|
1425
|
+
"september",
|
|
1426
|
+
"oktober",
|
|
1427
|
+
"november",
|
|
1428
|
+
"desember"
|
|
1429
|
+
],
|
|
1430
|
+
"month_short": [
|
|
1431
|
+
"jan",
|
|
1432
|
+
"feb",
|
|
1433
|
+
"mar",
|
|
1434
|
+
"apr",
|
|
1435
|
+
"mai",
|
|
1436
|
+
"jun",
|
|
1437
|
+
"jul",
|
|
1438
|
+
"aug",
|
|
1439
|
+
"sep",
|
|
1440
|
+
"okt",
|
|
1441
|
+
"nov",
|
|
1442
|
+
"des"
|
|
1443
|
+
],
|
|
1444
|
+
"day": [
|
|
1445
|
+
"s\xF8ndag",
|
|
1446
|
+
"mandag",
|
|
1447
|
+
"tirsdag",
|
|
1448
|
+
"onsdag",
|
|
1449
|
+
"torsdag",
|
|
1450
|
+
"fredag",
|
|
1451
|
+
"l\xF8rdag"
|
|
1452
|
+
],
|
|
1453
|
+
"day_short": [
|
|
1454
|
+
"s\xF8n",
|
|
1455
|
+
"man",
|
|
1456
|
+
"tir",
|
|
1457
|
+
"ons",
|
|
1458
|
+
"tor",
|
|
1459
|
+
"fre",
|
|
1460
|
+
"l\xF8r"
|
|
1461
|
+
],
|
|
1462
|
+
"ordinal": {
|
|
1463
|
+
"one": "{n}ste",
|
|
1464
|
+
"two": "{n}de",
|
|
1465
|
+
"few": "{n}de",
|
|
1466
|
+
"other": "{n}de"
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
var no_default = copy20;
|
|
1470
|
+
var copy21 = {
|
|
1471
|
+
"month": [
|
|
1472
|
+
"\u0698\u0627\u0646\u0648\u06CC\u0647",
|
|
1473
|
+
"\u0641\u0648\u0631\u06CC\u0647",
|
|
1474
|
+
"\u0645\u0627\u0631\u0633",
|
|
1475
|
+
"\u0622\u0648\u0631\u06CC\u0644",
|
|
1476
|
+
"\u0645\u0647",
|
|
1477
|
+
"\u0698\u0648\u0626\u0646",
|
|
1478
|
+
"\u0698\u0648\u0626\u06CC\u0647",
|
|
1479
|
+
"\u0627\u0648\u062A",
|
|
1480
|
+
"\u0633\u067E\u062A\u0627\u0645\u0628\u0631",
|
|
1481
|
+
"\u0627\u06A9\u062A\u0628\u0631",
|
|
1482
|
+
"\u0646\u0648\u0627\u0645\u0628\u0631",
|
|
1483
|
+
"\u062F\u0633\u0627\u0645\u0628\u0631"
|
|
1484
|
+
],
|
|
1485
|
+
"month_short": [
|
|
1486
|
+
"\u0698\u0627\u0646",
|
|
1487
|
+
"\u0641\u0648\u0631",
|
|
1488
|
+
"\u0645\u0627\u0631",
|
|
1489
|
+
"\u0622\u0648\u0631",
|
|
1490
|
+
"\u0645\u0647",
|
|
1491
|
+
"\u0698\u0648\u0646",
|
|
1492
|
+
"\u0698\u0648\u06CC",
|
|
1493
|
+
"\u0627\u0648\u062A",
|
|
1494
|
+
"\u0633\u067E\u062A",
|
|
1495
|
+
"\u0627\u06A9\u062A",
|
|
1496
|
+
"\u0646\u0648\u0627",
|
|
1497
|
+
"\u062F\u0633\u0627"
|
|
1498
|
+
],
|
|
1499
|
+
"day": [
|
|
1500
|
+
"\u06CC\u06A9\u0634\u0646\u0628\u0647",
|
|
1501
|
+
"\u062F\u0648\u0634\u0646\u0628\u0647",
|
|
1502
|
+
"\u0633\u0647\u200C\u0634\u0646\u0628\u0647",
|
|
1503
|
+
"\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647",
|
|
1504
|
+
"\u067E\u0646\u062C\u0634\u0646\u0628\u0647",
|
|
1505
|
+
"\u062C\u0645\u0639\u0647",
|
|
1506
|
+
"\u0634\u0646\u0628\u0647"
|
|
1507
|
+
],
|
|
1508
|
+
"day_short": [
|
|
1509
|
+
"\u06CC\u06A9",
|
|
1510
|
+
"\u062F\u0648",
|
|
1511
|
+
"\u0633\u0647",
|
|
1512
|
+
"\u0686\u0647\u0627\u0631",
|
|
1513
|
+
"\u067E\u0646\u062C",
|
|
1514
|
+
"\u062C\u0645\u0639\u0647",
|
|
1515
|
+
"\u0634\u0646\u0628\u0647"
|
|
1516
|
+
],
|
|
1517
|
+
"ordinal": {
|
|
1518
|
+
"one": "{n}\u0645",
|
|
1519
|
+
"two": "{n}\u0645",
|
|
1520
|
+
"few": "{n}\u0645",
|
|
1521
|
+
"other": "{n}\u0645"
|
|
1522
|
+
}
|
|
1523
|
+
};
|
|
1524
|
+
var pe_default = copy21;
|
|
1525
|
+
var copy22 = {
|
|
1526
|
+
"month": [
|
|
1527
|
+
"stycze\u0144",
|
|
1528
|
+
"luty",
|
|
1529
|
+
"marzec",
|
|
1530
|
+
"kwiecie\u0144",
|
|
1531
|
+
"maj",
|
|
1532
|
+
"czerwiec",
|
|
1533
|
+
"lipiec",
|
|
1534
|
+
"sierpie\u0144",
|
|
1535
|
+
"wrzesie\u0144",
|
|
1536
|
+
"pa\u017Adziernik",
|
|
1537
|
+
"listopad",
|
|
1538
|
+
"grudzie\u0144"
|
|
1539
|
+
],
|
|
1540
|
+
"month_short": [
|
|
1541
|
+
"sty",
|
|
1542
|
+
"lut",
|
|
1543
|
+
"mar",
|
|
1544
|
+
"kwi",
|
|
1545
|
+
"maj",
|
|
1546
|
+
"cze",
|
|
1547
|
+
"lip",
|
|
1548
|
+
"sie",
|
|
1549
|
+
"wrz",
|
|
1550
|
+
"pa\u017A",
|
|
1551
|
+
"lis",
|
|
1552
|
+
"gru"
|
|
1553
|
+
],
|
|
1554
|
+
"day": [
|
|
1555
|
+
"niedziela",
|
|
1556
|
+
"poniedzia\u0142ek",
|
|
1557
|
+
"wtorek",
|
|
1558
|
+
"\u015Broda",
|
|
1559
|
+
"czwartek",
|
|
1560
|
+
"pi\u0105tek",
|
|
1561
|
+
"sobota"
|
|
1562
|
+
],
|
|
1563
|
+
"day_short": [
|
|
1564
|
+
"niedz",
|
|
1565
|
+
"pon",
|
|
1566
|
+
"wt",
|
|
1567
|
+
"\u015Br",
|
|
1568
|
+
"czw",
|
|
1569
|
+
"pt",
|
|
1570
|
+
"sob"
|
|
1571
|
+
],
|
|
1572
|
+
"ordinal": {
|
|
1573
|
+
"one": "{n}szy",
|
|
1574
|
+
"two": "{n}gi",
|
|
1575
|
+
"few": "{n}gi",
|
|
1576
|
+
"other": "{n}gi"
|
|
1577
|
+
}
|
|
1578
|
+
};
|
|
1579
|
+
var pl_default = copy22;
|
|
1580
|
+
var copy23 = {
|
|
1581
|
+
"month": [
|
|
1582
|
+
"janeiro",
|
|
1583
|
+
"fevereiro",
|
|
1584
|
+
"mar\xE7o",
|
|
1585
|
+
"abril",
|
|
1586
|
+
"maio",
|
|
1587
|
+
"junho",
|
|
1588
|
+
"julho",
|
|
1589
|
+
"agosto",
|
|
1590
|
+
"setembro",
|
|
1591
|
+
"outubro",
|
|
1592
|
+
"novembro",
|
|
1593
|
+
"dezembro"
|
|
1594
|
+
],
|
|
1595
|
+
"month_short": [
|
|
1596
|
+
"jan",
|
|
1597
|
+
"fev",
|
|
1598
|
+
"mar",
|
|
1599
|
+
"abr",
|
|
1600
|
+
"mai",
|
|
1601
|
+
"jun",
|
|
1602
|
+
"jul",
|
|
1603
|
+
"ago",
|
|
1604
|
+
"set",
|
|
1605
|
+
"out",
|
|
1606
|
+
"nov",
|
|
1607
|
+
"dez"
|
|
1608
|
+
],
|
|
1609
|
+
"day": [
|
|
1610
|
+
"domingo",
|
|
1611
|
+
"segunda-feira",
|
|
1612
|
+
"ter\xE7a-feira",
|
|
1613
|
+
"quarta-feira",
|
|
1614
|
+
"quinta-feira",
|
|
1615
|
+
"sexta-feira",
|
|
1616
|
+
"s\xE1bado"
|
|
1617
|
+
],
|
|
1618
|
+
"day_short": [
|
|
1619
|
+
"dom",
|
|
1620
|
+
"seg",
|
|
1621
|
+
"ter",
|
|
1622
|
+
"qua",
|
|
1623
|
+
"qui",
|
|
1624
|
+
"sex",
|
|
1625
|
+
"s\xE1b"
|
|
1626
|
+
],
|
|
1627
|
+
"ordinal": {
|
|
1628
|
+
"one": "{n}ro",
|
|
1629
|
+
"two": "{n}do",
|
|
1630
|
+
"few": "{n}ro",
|
|
1631
|
+
"other": "{n}to"
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
var pt_default = copy23;
|
|
1635
|
+
var copy24 = {
|
|
1636
|
+
"month": [
|
|
1637
|
+
"ianuarie",
|
|
1638
|
+
"februarie",
|
|
1639
|
+
"martie",
|
|
1640
|
+
"aprilie",
|
|
1641
|
+
"mai",
|
|
1642
|
+
"iunie",
|
|
1643
|
+
"iulie",
|
|
1644
|
+
"august",
|
|
1645
|
+
"septembrie",
|
|
1646
|
+
"octombrie",
|
|
1647
|
+
"noiembrie",
|
|
1648
|
+
"decembrie"
|
|
1649
|
+
],
|
|
1650
|
+
"month_short": [
|
|
1651
|
+
"ian",
|
|
1652
|
+
"feb",
|
|
1653
|
+
"mar",
|
|
1654
|
+
"apr",
|
|
1655
|
+
"mai",
|
|
1656
|
+
"iun",
|
|
1657
|
+
"iul",
|
|
1658
|
+
"aug",
|
|
1659
|
+
"sept",
|
|
1660
|
+
"oct",
|
|
1661
|
+
"nov",
|
|
1662
|
+
"dec"
|
|
1663
|
+
],
|
|
1664
|
+
"day": [
|
|
1665
|
+
"duminic\u0103",
|
|
1666
|
+
"luni",
|
|
1667
|
+
"mar\u021Bi",
|
|
1668
|
+
"miercuri",
|
|
1669
|
+
"joi",
|
|
1670
|
+
"vineri",
|
|
1671
|
+
"s\xE2mb\u0103t\u0103"
|
|
1672
|
+
],
|
|
1673
|
+
"day_short": [
|
|
1674
|
+
"dum",
|
|
1675
|
+
"lun",
|
|
1676
|
+
"mar",
|
|
1677
|
+
"mie",
|
|
1678
|
+
"joi",
|
|
1679
|
+
"vin",
|
|
1680
|
+
"s\xE2m"
|
|
1681
|
+
],
|
|
1682
|
+
"ordinal": {
|
|
1683
|
+
"one": "{n}st",
|
|
1684
|
+
"two": "{n}nd",
|
|
1685
|
+
"few": "{n}rd",
|
|
1686
|
+
"other": "{n}th"
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
var ro_default = copy24;
|
|
1690
|
+
var copy25 = {
|
|
1691
|
+
"month": [
|
|
1692
|
+
"\u042F\u043D\u0432\u0430\u0440\u044C",
|
|
1693
|
+
"\u0424\u0435\u0432\u0440\u0430\u043B\u044C",
|
|
1694
|
+
"\u041C\u0430\u0440\u0442",
|
|
1695
|
+
"\u0410\u043F\u0440\u0435\u043B\u044C",
|
|
1696
|
+
"\u041C\u0430\u0439",
|
|
1697
|
+
"\u0418\u044E\u043D\u044C",
|
|
1698
|
+
"\u0418\u044E\u043B\u044C",
|
|
1699
|
+
"\u0410\u0432\u0433\u0443\u0441\u0442",
|
|
1700
|
+
"\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C",
|
|
1701
|
+
"\u041E\u043A\u0442\u044F\u0431\u0440\u044C",
|
|
1702
|
+
"\u041D\u043E\u044F\u0431\u0440\u044C",
|
|
1703
|
+
"\u0414\u0435\u043A\u0430\u0431\u0440\u044C"
|
|
1704
|
+
],
|
|
1705
|
+
"month_short": [
|
|
1706
|
+
"\u044F\u043D\u0432",
|
|
1707
|
+
"\u0444\u0435\u0432",
|
|
1708
|
+
"\u043C\u0430\u0440",
|
|
1709
|
+
"\u0430\u043F\u0440",
|
|
1710
|
+
"\u043C\u0430\u0439",
|
|
1711
|
+
"\u0438\u044E\u043D",
|
|
1712
|
+
"\u0438\u044E\u043B",
|
|
1713
|
+
"\u0430\u0432\u0433",
|
|
1714
|
+
"\u0441\u0435\u043D",
|
|
1715
|
+
"\u043E\u043A\u0442",
|
|
1716
|
+
"\u043D\u043E\u044F",
|
|
1717
|
+
"\u0434\u0435\u043A"
|
|
1718
|
+
],
|
|
1719
|
+
"day": [
|
|
1720
|
+
"\u0412\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435",
|
|
1721
|
+
"\u041F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A",
|
|
1722
|
+
"\u0412\u0442\u043E\u0440\u043D\u0438\u043A",
|
|
1723
|
+
"\u0421\u0440\u0435\u0434\u0430",
|
|
1724
|
+
"\u0427\u0435\u0442\u0432\u0435\u0440\u0433",
|
|
1725
|
+
"\u041F\u044F\u0442\u043D\u0438\u0446\u0430",
|
|
1726
|
+
"\u0421\u0443\u0431\u0431\u043E\u0442\u0430"
|
|
1727
|
+
],
|
|
1728
|
+
"day_short": [
|
|
1729
|
+
"\u0432\u0441",
|
|
1730
|
+
"\u043F\u043D",
|
|
1731
|
+
"\u0432\u0442",
|
|
1732
|
+
"\u0441\u0440",
|
|
1733
|
+
"\u0447\u0442",
|
|
1734
|
+
"\u043F\u0442",
|
|
1735
|
+
"\u0441\u0431"
|
|
1736
|
+
],
|
|
1737
|
+
"ordinal": {
|
|
1738
|
+
"one": "{n}\u044B\u0439",
|
|
1739
|
+
"two": "{n}\u043E\u0439",
|
|
1740
|
+
"few": "{n}\u043E\u0439",
|
|
1741
|
+
"other": "{n}\u044B\u0439"
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
var ru_default = copy25;
|
|
1745
|
+
var copy26 = {
|
|
1746
|
+
"month": [
|
|
1747
|
+
"januari",
|
|
1748
|
+
"februari",
|
|
1749
|
+
"mars",
|
|
1750
|
+
"april",
|
|
1751
|
+
"maj",
|
|
1752
|
+
"juni",
|
|
1753
|
+
"juli",
|
|
1754
|
+
"augusti",
|
|
1755
|
+
"september",
|
|
1756
|
+
"oktober",
|
|
1757
|
+
"november",
|
|
1758
|
+
"december"
|
|
1759
|
+
],
|
|
1760
|
+
"month_short": [
|
|
1761
|
+
"jan",
|
|
1762
|
+
"feb",
|
|
1763
|
+
"mar",
|
|
1764
|
+
"apr",
|
|
1765
|
+
"maj",
|
|
1766
|
+
"jun",
|
|
1767
|
+
"jul",
|
|
1768
|
+
"aug",
|
|
1769
|
+
"sep",
|
|
1770
|
+
"okt",
|
|
1771
|
+
"nov",
|
|
1772
|
+
"dec"
|
|
1773
|
+
],
|
|
1774
|
+
"day": [
|
|
1775
|
+
"s\xF6ndag",
|
|
1776
|
+
"m\xE5ndag",
|
|
1777
|
+
"tisdag",
|
|
1778
|
+
"onsdag",
|
|
1779
|
+
"torsdag",
|
|
1780
|
+
"fredag",
|
|
1781
|
+
"l\xF6rdag"
|
|
1782
|
+
],
|
|
1783
|
+
"day_short": [
|
|
1784
|
+
"s\xF6n",
|
|
1785
|
+
"m\xE5n",
|
|
1786
|
+
"tis",
|
|
1787
|
+
"ons",
|
|
1788
|
+
"tors",
|
|
1789
|
+
"fre",
|
|
1790
|
+
"l\xF6r"
|
|
1791
|
+
],
|
|
1792
|
+
"ordinal": {
|
|
1793
|
+
"one": "{n}ste",
|
|
1794
|
+
"two": "{n}de",
|
|
1795
|
+
"few": "{n}de",
|
|
1796
|
+
"other": "{n}de"
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1799
|
+
var sv_default = copy26;
|
|
1800
|
+
var copy27 = {
|
|
1801
|
+
[Language.AM]: am_default,
|
|
1802
|
+
[Language.AR]: ar_default,
|
|
1803
|
+
[Language.BG]: bg_default,
|
|
1804
|
+
[Language.CY]: cy_default,
|
|
1805
|
+
[Language.DE]: de_default,
|
|
1806
|
+
[Language.DK]: dk_default,
|
|
1807
|
+
[Language.EN]: en_default,
|
|
1808
|
+
[Language.ES]: es_default,
|
|
1809
|
+
[Language.ET]: et_default,
|
|
1810
|
+
[Language.FI]: fi_default,
|
|
1811
|
+
[Language.FR]: fr_default,
|
|
1812
|
+
[Language.GR]: gr_default,
|
|
1813
|
+
[Language.HU]: hu_default,
|
|
1814
|
+
[Language.IR]: ir_default,
|
|
1815
|
+
[Language.IT]: it_default,
|
|
1816
|
+
[Language.LA]: la_default,
|
|
1817
|
+
[Language.LT]: lt_default,
|
|
1818
|
+
[Language.MT]: mt_default,
|
|
1819
|
+
[Language.NL]: nl_default,
|
|
1820
|
+
[Language.NO]: no_default,
|
|
1821
|
+
[Language.PE]: pe_default,
|
|
1822
|
+
[Language.PL]: pl_default,
|
|
1823
|
+
[Language.PT]: pt_default,
|
|
1824
|
+
[Language.RO]: ro_default,
|
|
1825
|
+
[Language.RU]: ru_default,
|
|
1826
|
+
[Language.SV]: sv_default
|
|
1827
|
+
};
|
|
1828
|
+
var getCopy = (value, options) => {
|
|
1829
|
+
const opts = __spreadValues(__spreadValues({}, defaultOptions), options);
|
|
1830
|
+
const langData = flattenObject(copy27[opts.language]);
|
|
1831
|
+
if (!isNaN(opts.index) && opts.index > -1) {
|
|
1832
|
+
const key = `${value}.${opts.index}`;
|
|
1833
|
+
return langData[key];
|
|
1834
|
+
}
|
|
1835
|
+
return copy27[opts.language][value];
|
|
1836
|
+
};
|
|
1837
|
+
var formatOrdinal = (day, options = {}) => {
|
|
1838
|
+
const opts = __spreadValues(__spreadValues({}, defaultOptions), options);
|
|
1839
|
+
const pr = new Intl.PluralRules(opts.language, { type: "ordinal" });
|
|
1840
|
+
const suffixes = copy27[opts.language].ordinal;
|
|
1841
|
+
if (!suffixes) {
|
|
1842
|
+
throw new Error(`Unsupported language: ${opts.language}`);
|
|
1843
|
+
}
|
|
1844
|
+
const suffix = suffixes[pr.select(day)];
|
|
1845
|
+
return suffix.replace("{n}", `${day}`);
|
|
1846
|
+
};
|
|
1847
|
+
var getDateObject = (value, options = {}) => {
|
|
1848
|
+
const opts = __spreadValues(__spreadValues({}, defaultOptions), options);
|
|
1849
|
+
return {
|
|
1850
|
+
day: opts.padded ? pad(value.getDate()) : value.getDate(),
|
|
1851
|
+
day_nth: formatOrdinal(value.getDate(), options),
|
|
1852
|
+
weekday: opts.padded ? pad(value.getDay()) : value.getDay(),
|
|
1853
|
+
weekday_name: getCopy("day", __spreadProps(__spreadValues({}, opts), { index: value.getDay() })),
|
|
1854
|
+
weekday_abbr: getCopy("day_short", __spreadProps(__spreadValues({}, opts), {
|
|
1855
|
+
index: value.getDay()
|
|
1856
|
+
})),
|
|
1857
|
+
month: opts.padded ? pad(value.getMonth() + 1) : value.getMonth() + 1,
|
|
1858
|
+
month_index: opts.padded ? pad(value.getMonth()) : value.getMonth(),
|
|
1859
|
+
month_name: getCopy("month", __spreadProps(__spreadValues({}, opts), { index: value.getMonth() })),
|
|
1860
|
+
month_abbr: getCopy("month_short", __spreadProps(__spreadValues({}, opts), {
|
|
1861
|
+
index: value.getMonth()
|
|
1862
|
+
})),
|
|
1863
|
+
year: opts.padded ? `${value.getFullYear()}` : value.getFullYear(),
|
|
1864
|
+
hours: opts.padded ? pad(value.getHours()) : value.getHours(),
|
|
1865
|
+
minutes: opts.padded ? pad(value.getMinutes()) : value.getMinutes(),
|
|
1866
|
+
seconds: opts.padded ? pad(value.getSeconds()) : value.getSeconds()
|
|
1867
|
+
};
|
|
1868
|
+
};
|
|
1869
|
+
var toDateFormat = (value) => {
|
|
1870
|
+
if (value instanceof Date)
|
|
1871
|
+
return value;
|
|
1872
|
+
else {
|
|
1873
|
+
const yrs = value.year || 1970;
|
|
1874
|
+
const mon = value.month || 1;
|
|
1875
|
+
const day = value.day || 1;
|
|
1876
|
+
const hrs = value.hrs || 0;
|
|
1877
|
+
const min = value.min || 0;
|
|
1878
|
+
const sec = value.sec || 0;
|
|
1879
|
+
return /* @__PURE__ */ new Date(`${yrs} ${mon} ${day} ${hrs}:${min}:${sec}`);
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
var format = (date, options = {}) => {
|
|
1883
|
+
const d = toDateFormat(date);
|
|
1884
|
+
const opts = __spreadValues(__spreadValues({}, defaultOptions), options);
|
|
1885
|
+
const obj_padded = getDateObject(d, __spreadProps(__spreadValues({}, opts), { padded: true }));
|
|
1886
|
+
const obj = getDateObject(d, __spreadProps(__spreadValues({}, opts), { padded: true }));
|
|
1887
|
+
const replacers = __spreadValues({
|
|
1888
|
+
DD: obj_padded.day,
|
|
1889
|
+
DT: obj_padded.day_nth,
|
|
1890
|
+
Day: obj.weekday_name,
|
|
1891
|
+
Da: obj.weekday_abbr,
|
|
1892
|
+
D: obj.day,
|
|
1893
|
+
MM: obj_padded.month,
|
|
1894
|
+
Month: obj.month_name,
|
|
1895
|
+
Mo: obj.month_abbr,
|
|
1896
|
+
M: obj.month,
|
|
1897
|
+
mm: obj_padded.minutes,
|
|
1898
|
+
m: obj.minutes,
|
|
1899
|
+
ss: obj_padded.seconds,
|
|
1900
|
+
s: obj.seconds,
|
|
1901
|
+
hh: obj_padded.hours,
|
|
1902
|
+
h: obj.hours,
|
|
1903
|
+
YY: obj.year,
|
|
1904
|
+
Y: obj_padded.year.substring(2, 4)
|
|
1905
|
+
}, opts.replace);
|
|
1906
|
+
let template = opts.template;
|
|
1907
|
+
Object.entries(replacers).forEach(([key, value]) => {
|
|
1908
|
+
if (template.indexOf(key) < 0)
|
|
1909
|
+
return;
|
|
1910
|
+
const regex = new RegExp(key, "g");
|
|
1911
|
+
template = template.replace(regex, `${value}`);
|
|
1912
|
+
});
|
|
1913
|
+
return template;
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
// ../nizel/dist/utils.js
|
|
1917
|
+
var escapeHtml = (value) => {
|
|
1918
|
+
const text = String(value);
|
|
1919
|
+
return /[&<>"]/.test(text) ? text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """) : text;
|
|
1920
|
+
};
|
|
1921
|
+
var slugify = (value, style = "github") => {
|
|
1922
|
+
if (style === "classic") {
|
|
1923
|
+
return value.toLowerCase().replace(/[^\w\s-]/g, "").replace(/[\s_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1924
|
+
}
|
|
1925
|
+
return P(value);
|
|
1926
|
+
};
|
|
1927
|
+
var textFromUnknown = (value) => {
|
|
1928
|
+
if (value === null || value === void 0)
|
|
1929
|
+
return "";
|
|
1930
|
+
if (value instanceof Date)
|
|
1931
|
+
return value.toISOString();
|
|
1932
|
+
return String(value);
|
|
1933
|
+
};
|
|
1934
|
+
var getPath = (source, path) => {
|
|
1935
|
+
return path.split(".").reduce((value, part) => {
|
|
1936
|
+
if (value && typeof value === "object" && part in value) {
|
|
1937
|
+
return value[part];
|
|
1938
|
+
}
|
|
1939
|
+
return void 0;
|
|
1940
|
+
}, source);
|
|
1941
|
+
};
|
|
1942
|
+
var uniqueSlug = (base, seen) => {
|
|
1943
|
+
const fallback = base || "section";
|
|
1944
|
+
const count = seen.get(fallback) ?? 0;
|
|
1945
|
+
seen.set(fallback, count + 1);
|
|
1946
|
+
return count === 0 ? fallback : `${fallback}-${count + 1}`;
|
|
1947
|
+
};
|
|
1948
|
+
|
|
1949
|
+
// ../nizel/dist/defaults.js
|
|
1950
|
+
var lowerFilter = (value) => textFromUnknown(value).toLowerCase();
|
|
1951
|
+
var upperFilter = (value) => textFromUnknown(value).toUpperCase();
|
|
1952
|
+
var titleFilter = (value) => I(textFromUnknown(value)).replace(/\w\S*/g, (word) => {
|
|
1953
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
1954
|
+
});
|
|
1955
|
+
var kebabFilter = L;
|
|
1956
|
+
var camelFilter = j;
|
|
1957
|
+
var pascalFilter = $;
|
|
1958
|
+
var snakeFilter = m;
|
|
1959
|
+
var constantFilter = b;
|
|
1960
|
+
var capitalFilter = (value) => {
|
|
1961
|
+
const text = textFromUnknown(value);
|
|
1962
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
1963
|
+
};
|
|
1964
|
+
var dotFilter = (value) => textFromUnknown(value).toLowerCase().replace(/[\s_-]+/g, ".").replace(/^\.+|\.+$/g, "");
|
|
1965
|
+
var headerFilter = (value) => textFromUnknown(value).replace(/\w+/g, (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1966
|
+
var pathFilter = (value) => textFromUnknown(value).toLowerCase().replace(/[\s_-]+/g, "/").replace(/^\/+|\/+$/g, "");
|
|
1967
|
+
var sentenceFilter = (value) => I(textFromUnknown(value));
|
|
1968
|
+
var formatFilter = (value, kind, localeOrCurrency = "en-US") => {
|
|
1969
|
+
if (kind === "currency") {
|
|
1970
|
+
return new Intl.NumberFormat("en-US", {
|
|
1971
|
+
style: "currency",
|
|
1972
|
+
currency: textFromUnknown(localeOrCurrency)
|
|
1973
|
+
}).format(Number(value));
|
|
1974
|
+
}
|
|
1975
|
+
if (kind === "number") {
|
|
1976
|
+
const pattern = textFromUnknown(localeOrCurrency);
|
|
1977
|
+
return formatNumber(Number(value), pattern);
|
|
1978
|
+
}
|
|
1979
|
+
if (kind === "date") {
|
|
1980
|
+
const date = new Date(textFromUnknown(value));
|
|
1981
|
+
const template = textFromUnknown(localeOrCurrency);
|
|
1982
|
+
const dateObject = getDateObject(date);
|
|
1983
|
+
return format(date, {
|
|
1984
|
+
template: normalizeDateTemplate(template === "en-US" ? "YY-MM-DD" : template),
|
|
1985
|
+
replace: {
|
|
1986
|
+
"\xA7\xA7\xA7": String(dateObject.month_name)
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
return textFromUnknown(value);
|
|
1991
|
+
};
|
|
1992
|
+
var formatNumber = (value, pattern) => {
|
|
1993
|
+
const digits = (pattern.match(/0/g) || []).length;
|
|
1994
|
+
const [intPart, decPart] = pattern.split(".");
|
|
1995
|
+
const decimals = decPart ? decPart.length : 0;
|
|
1996
|
+
return new Intl.NumberFormat("en-US", {
|
|
1997
|
+
minimumFractionDigits: decimals,
|
|
1998
|
+
maximumFractionDigits: decimals
|
|
1999
|
+
}).format(value);
|
|
2000
|
+
};
|
|
2001
|
+
var normalizeDateTemplate = (template) => {
|
|
2002
|
+
return template.replaceAll("yyyy", "YY").replaceAll("MMM", "\xA7\xA7\xA7").replaceAll("dd", "DD");
|
|
2003
|
+
};
|
|
2004
|
+
var defaultFilters = {
|
|
2005
|
+
lower: lowerFilter,
|
|
2006
|
+
upper: upperFilter,
|
|
2007
|
+
title: titleFilter,
|
|
2008
|
+
capital: capitalFilter,
|
|
2009
|
+
capitalize: capitalFilter,
|
|
2010
|
+
kebab: kebabFilter,
|
|
2011
|
+
camel: camelFilter,
|
|
2012
|
+
pascal: pascalFilter,
|
|
2013
|
+
snake: snakeFilter,
|
|
2014
|
+
constant: constantFilter,
|
|
2015
|
+
dot: dotFilter,
|
|
2016
|
+
header: headerFilter,
|
|
2017
|
+
path: pathFilter,
|
|
2018
|
+
sentence: sentenceFilter,
|
|
2019
|
+
format: formatFilter
|
|
2020
|
+
};
|
|
2021
|
+
var defaultOptions2 = {
|
|
2022
|
+
output: "html",
|
|
2023
|
+
frontmatter: true,
|
|
2024
|
+
template: { missing: "keep", raw: false, filters: defaultFilters },
|
|
2025
|
+
toc: true,
|
|
2026
|
+
anchors: true,
|
|
2027
|
+
autolinks: { enabled: true },
|
|
2028
|
+
safe: true,
|
|
2029
|
+
unwrapStandaloneImages: false,
|
|
2030
|
+
elements: {},
|
|
2031
|
+
blocks: {},
|
|
2032
|
+
data: {},
|
|
2033
|
+
plugins: [],
|
|
2034
|
+
transforms: []
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
// ../nizel/dist/options.js
|
|
2038
|
+
function resolveOptions(baseOptions = {}, runtimeOptions = {}) {
|
|
2039
|
+
const plugins = [
|
|
2040
|
+
...baseOptions.plugins ?? [],
|
|
2041
|
+
...runtimeOptions.plugins ?? []
|
|
2042
|
+
];
|
|
2043
|
+
const pluginOptions = plugins.reduce((merged, plugin) => {
|
|
2044
|
+
const pluginTemplate = plugin.template ?? (plugin.filters ? { filters: plugin.filters } : void 0);
|
|
2045
|
+
return mergeOptions(merged, {
|
|
2046
|
+
...plugin.options,
|
|
2047
|
+
elements: plugin.elements,
|
|
2048
|
+
blocks: plugin.blocks,
|
|
2049
|
+
transforms: plugin.transforms,
|
|
2050
|
+
template: pluginTemplate
|
|
2051
|
+
});
|
|
2052
|
+
}, {});
|
|
2053
|
+
return mergeOptions(mergeOptions(mergeOptions(defaultOptions2, pluginOptions), baseOptions), runtimeOptions);
|
|
2054
|
+
}
|
|
2055
|
+
function mergeOptions(left, right) {
|
|
2056
|
+
if (!right)
|
|
2057
|
+
return left;
|
|
2058
|
+
return {
|
|
2059
|
+
...left,
|
|
2060
|
+
...right,
|
|
2061
|
+
data: {
|
|
2062
|
+
...left.data ?? {},
|
|
2063
|
+
...right.data ?? {}
|
|
2064
|
+
},
|
|
2065
|
+
variables: {
|
|
2066
|
+
...left.variables ?? {},
|
|
2067
|
+
...right.variables ?? {}
|
|
2068
|
+
},
|
|
2069
|
+
elements: {
|
|
2070
|
+
...left.elements ?? {},
|
|
2071
|
+
...right.elements ?? {}
|
|
2072
|
+
},
|
|
2073
|
+
blocks: {
|
|
2074
|
+
...left.blocks ?? {},
|
|
2075
|
+
...right.blocks ?? {}
|
|
2076
|
+
},
|
|
2077
|
+
transforms: [...left.transforms ?? [], ...right.transforms ?? []],
|
|
2078
|
+
template: mergeTemplateOptions(left.template, right.template)
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
function mergeTemplateOptions(left, right) {
|
|
2082
|
+
if (right === false)
|
|
2083
|
+
return false;
|
|
2084
|
+
if (left === false && right === void 0)
|
|
2085
|
+
return false;
|
|
2086
|
+
if (left === false && right === true)
|
|
2087
|
+
return {};
|
|
2088
|
+
if (left === false)
|
|
2089
|
+
left = {};
|
|
2090
|
+
if (right === true || right === void 0)
|
|
2091
|
+
right = {};
|
|
2092
|
+
if (left === true || left === void 0)
|
|
2093
|
+
left = {};
|
|
2094
|
+
return {
|
|
2095
|
+
...left,
|
|
2096
|
+
...right,
|
|
2097
|
+
filters: {
|
|
2098
|
+
...defaultFilters,
|
|
2099
|
+
...left.filters,
|
|
2100
|
+
...right.filters
|
|
2101
|
+
}
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
// ../nizel/dist/parse/block.js
|
|
2106
|
+
var isRawHtmlBlockLine = (line) => {
|
|
2107
|
+
return /^<\/?[A-Za-z][A-Za-z0-9-]*(?=[\s>/])[\s\S]*>$/.test(line.trim());
|
|
2108
|
+
};
|
|
2109
|
+
var isThematicBreak = (line) => {
|
|
2110
|
+
return /^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/.test(line);
|
|
2111
|
+
};
|
|
2112
|
+
var isSetextUnderline = (line) => {
|
|
2113
|
+
return /^ {0,3}(=+|-+)\s*$/.exec(line);
|
|
2114
|
+
};
|
|
2115
|
+
var trimClosingHeadingHashes = (source) => {
|
|
2116
|
+
if (/^#+\s*$/.test(source))
|
|
2117
|
+
return "";
|
|
2118
|
+
return source.replace(/\s+#+\s*$/, "").trim();
|
|
2119
|
+
};
|
|
2120
|
+
var normalizeParagraphLine = (line) => {
|
|
2121
|
+
return line.replace(/^ {0,3}/, "").trimStart();
|
|
2122
|
+
};
|
|
2123
|
+
var normalizeParagraphSource = (lines) => {
|
|
2124
|
+
return lines.join("\n").replace(/[ \t]+$/, "");
|
|
2125
|
+
};
|
|
2126
|
+
|
|
2127
|
+
// ../nizel/dist/parse/html.js
|
|
2128
|
+
var htmlBlockTags = /* @__PURE__ */ new Set([
|
|
2129
|
+
"address",
|
|
2130
|
+
"article",
|
|
2131
|
+
"aside",
|
|
2132
|
+
"base",
|
|
2133
|
+
"basefont",
|
|
2134
|
+
"blockquote",
|
|
2135
|
+
"body",
|
|
2136
|
+
"caption",
|
|
2137
|
+
"center",
|
|
2138
|
+
"col",
|
|
2139
|
+
"colgroup",
|
|
2140
|
+
"dd",
|
|
2141
|
+
"details",
|
|
2142
|
+
"dialog",
|
|
2143
|
+
"dir",
|
|
2144
|
+
"div",
|
|
2145
|
+
"dl",
|
|
2146
|
+
"dt",
|
|
2147
|
+
"fieldset",
|
|
2148
|
+
"figcaption",
|
|
2149
|
+
"figure",
|
|
2150
|
+
"footer",
|
|
2151
|
+
"form",
|
|
2152
|
+
"frame",
|
|
2153
|
+
"frameset",
|
|
2154
|
+
"h1",
|
|
2155
|
+
"h2",
|
|
2156
|
+
"h3",
|
|
2157
|
+
"h4",
|
|
2158
|
+
"h5",
|
|
2159
|
+
"h6",
|
|
2160
|
+
"head",
|
|
2161
|
+
"header",
|
|
2162
|
+
"hr",
|
|
2163
|
+
"html",
|
|
2164
|
+
"iframe",
|
|
2165
|
+
"legend",
|
|
2166
|
+
"li",
|
|
2167
|
+
"link",
|
|
2168
|
+
"main",
|
|
2169
|
+
"menu",
|
|
2170
|
+
"menuitem",
|
|
2171
|
+
"nav",
|
|
2172
|
+
"noframes",
|
|
2173
|
+
"ol",
|
|
2174
|
+
"optgroup",
|
|
2175
|
+
"option",
|
|
2176
|
+
"p",
|
|
2177
|
+
"param",
|
|
2178
|
+
"search",
|
|
2179
|
+
"section",
|
|
2180
|
+
"summary",
|
|
2181
|
+
"table",
|
|
2182
|
+
"tbody",
|
|
2183
|
+
"td",
|
|
2184
|
+
"tfoot",
|
|
2185
|
+
"th",
|
|
2186
|
+
"thead",
|
|
2187
|
+
"title",
|
|
2188
|
+
"tr",
|
|
2189
|
+
"track",
|
|
2190
|
+
"ul"
|
|
2191
|
+
]);
|
|
2192
|
+
var readHtmlBlock = (lines, startIndex) => {
|
|
2193
|
+
const line = lines[startIndex];
|
|
2194
|
+
if (!/^ {0,3}</.test(line))
|
|
2195
|
+
return null;
|
|
2196
|
+
const trimmed = line.trimStart();
|
|
2197
|
+
const closedBy = htmlBlockClosingPattern(trimmed);
|
|
2198
|
+
if (closedBy) {
|
|
2199
|
+
return readHtmlBlockUntil(lines, startIndex, closedBy);
|
|
2200
|
+
}
|
|
2201
|
+
if (isBlankTerminatedHtmlBlockStart(trimmed)) {
|
|
2202
|
+
return readHtmlBlockUntilBlank(lines, startIndex);
|
|
2203
|
+
}
|
|
2204
|
+
return null;
|
|
2205
|
+
};
|
|
2206
|
+
var isInterruptingHtmlBlockStart = (line) => {
|
|
2207
|
+
if (!/^ {0,3}</.test(line))
|
|
2208
|
+
return false;
|
|
2209
|
+
const trimmed = line.trimStart();
|
|
2210
|
+
return htmlBlockClosingPattern(trimmed) !== null || isBlockTagHtmlBlockStart(trimmed);
|
|
2211
|
+
};
|
|
2212
|
+
var isValidInlineHtmlToken = (source) => {
|
|
2213
|
+
if (/^(?:<!-->|<!--->|<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<![A-Z][^>]*>|<!\[CDATA\[[\s\S]*?\]\]>)$/u.test(source)) {
|
|
2214
|
+
return true;
|
|
2215
|
+
}
|
|
2216
|
+
if (isValidInlineHtmlTag(source))
|
|
2217
|
+
return true;
|
|
2218
|
+
return /\n/.test(source) && /^<[A-Za-z][A-Za-z0-9-]*(?:\s|>)/.test(source) && !/[A-Za-z0-9_.:-]![A-Za-z0-9_.:-]/.test(source);
|
|
2219
|
+
};
|
|
2220
|
+
var htmlBlockClosingPattern = (trimmed) => {
|
|
2221
|
+
if (/^<(script|pre|style|textarea)(?:\s|>|$)/i.test(trimmed)) {
|
|
2222
|
+
return new RegExp(`</${/^<([A-Za-z][A-Za-z0-9-]*)/.exec(trimmed)?.[1]}>`, "i");
|
|
2223
|
+
}
|
|
2224
|
+
if (/^<!--/.test(trimmed))
|
|
2225
|
+
return /-->/;
|
|
2226
|
+
if (/^<\?/.test(trimmed))
|
|
2227
|
+
return /\?>/;
|
|
2228
|
+
if (/^<![A-Z]/.test(trimmed))
|
|
2229
|
+
return />/;
|
|
2230
|
+
if (/^<!\[CDATA\[/.test(trimmed))
|
|
2231
|
+
return /\]\]>/;
|
|
2232
|
+
return null;
|
|
2233
|
+
};
|
|
2234
|
+
var readHtmlBlockUntil = (lines, startIndex, close) => {
|
|
2235
|
+
const html = [];
|
|
2236
|
+
let index = startIndex;
|
|
2237
|
+
while (index < lines.length) {
|
|
2238
|
+
html.push(lines[index]);
|
|
2239
|
+
if (close.test(lines[index]))
|
|
2240
|
+
break;
|
|
2241
|
+
index += 1;
|
|
2242
|
+
}
|
|
2243
|
+
return { value: html.join("\n"), endIndex: index };
|
|
2244
|
+
};
|
|
2245
|
+
var isBlankTerminatedHtmlBlockStart = (trimmed) => {
|
|
2246
|
+
if (isBlockTagHtmlBlockStart(trimmed))
|
|
2247
|
+
return true;
|
|
2248
|
+
return isValidInlineHtmlTag(trimmed);
|
|
2249
|
+
};
|
|
2250
|
+
var isValidInlineHtmlTag = (source) => {
|
|
2251
|
+
return /^<[A-Za-z][A-Za-z0-9-]*(?:\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?>\s*$/.test(source) || /^<\/[A-Za-z][A-Za-z0-9-]*\s*>\s*$/.test(source);
|
|
2252
|
+
};
|
|
2253
|
+
var isBlockTagHtmlBlockStart = (trimmed) => {
|
|
2254
|
+
if (!/^<\/?([A-Za-z][A-Za-z0-9-]*)(?:\s|\/?>|$)/.test(trimmed))
|
|
2255
|
+
return false;
|
|
2256
|
+
const tag = /^<\/?([A-Za-z][A-Za-z0-9-]*)/.exec(trimmed)?.[1].toLowerCase();
|
|
2257
|
+
return tag !== void 0 && htmlBlockTags.has(tag);
|
|
2258
|
+
};
|
|
2259
|
+
var readHtmlBlockUntilBlank = (lines, startIndex) => {
|
|
2260
|
+
const html = [];
|
|
2261
|
+
let index = startIndex;
|
|
2262
|
+
while (index < lines.length && lines[index].trim()) {
|
|
2263
|
+
html.push(lines[index]);
|
|
2264
|
+
index += 1;
|
|
2265
|
+
}
|
|
2266
|
+
return { value: html.join("\n"), endIndex: index - 1 };
|
|
2267
|
+
};
|
|
2268
|
+
|
|
2269
|
+
// ../nizel/dist/parse/list.js
|
|
2270
|
+
var parseListMarker = (line) => {
|
|
2271
|
+
const expanded = line.includes(" ") ? expandListMarkerTabs(line) : line;
|
|
2272
|
+
const unordered = /^( {0,3})([-*+])([ \t]*)(.*)$/.exec(expanded);
|
|
2273
|
+
if (unordered && (unordered[3].length > 0 || unordered[4] === "")) {
|
|
2274
|
+
return {
|
|
2275
|
+
body: listMarkerBody(unordered[3], unordered[4]),
|
|
2276
|
+
contentIndent: listContentIndent(unordered[1].length, unordered[2].length, unordered[3].length),
|
|
2277
|
+
marker: unordered[2],
|
|
2278
|
+
ordered: false
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
const ordered = /^( {0,3})(\d{1,9})([.)])([ \t]*)(.*)$/.exec(expanded);
|
|
2282
|
+
if (ordered && (ordered[4].length > 0 || ordered[5] === "")) {
|
|
2283
|
+
return {
|
|
2284
|
+
body: listMarkerBody(ordered[4], ordered[5]),
|
|
2285
|
+
contentIndent: listContentIndent(ordered[1].length, ordered[2].length + 1, ordered[4].length),
|
|
2286
|
+
marker: ordered[3],
|
|
2287
|
+
ordered: true,
|
|
2288
|
+
start: Number(ordered[2])
|
|
2289
|
+
};
|
|
2290
|
+
}
|
|
2291
|
+
return null;
|
|
2292
|
+
};
|
|
2293
|
+
var listMarkerBody = (padding, body) => {
|
|
2294
|
+
return padding.length > 4 ? `${padding.slice(1)}${body}` : body;
|
|
2295
|
+
};
|
|
2296
|
+
var expandListMarkerTabs = (line) => {
|
|
2297
|
+
let result = "";
|
|
2298
|
+
let cursor = 0;
|
|
2299
|
+
let inMarkerPadding = false;
|
|
2300
|
+
while (cursor < line.length) {
|
|
2301
|
+
const character = line[cursor];
|
|
2302
|
+
if (character === " " && (inMarkerPadding || /^ {0,3}(?:[-*+]|\d{1,9}[.)])$/.test(result))) {
|
|
2303
|
+
const column = result.length;
|
|
2304
|
+
result += " ".repeat(4 - column % 4);
|
|
2305
|
+
inMarkerPadding = true;
|
|
2306
|
+
cursor += 1;
|
|
2307
|
+
continue;
|
|
2308
|
+
}
|
|
2309
|
+
result += character;
|
|
2310
|
+
if (/^ {0,3}(?:[-*+]|\d{1,9}[.)])$/.test(result)) {
|
|
2311
|
+
inMarkerPadding = true;
|
|
2312
|
+
} else if (inMarkerPadding && character !== " ") {
|
|
2313
|
+
inMarkerPadding = false;
|
|
2314
|
+
}
|
|
2315
|
+
cursor += 1;
|
|
2316
|
+
}
|
|
2317
|
+
return result;
|
|
2318
|
+
};
|
|
2319
|
+
var isSameListMarker = (opening, current) => {
|
|
2320
|
+
return opening.ordered ? current.marker === opening.marker : current.marker === opening.marker;
|
|
2321
|
+
};
|
|
2322
|
+
var isParagraphInterruptingListMarker = (line) => {
|
|
2323
|
+
const marker = parseListMarker(line);
|
|
2324
|
+
return marker !== null && marker.body !== "" && (!marker.ordered || marker.start === 1);
|
|
2325
|
+
};
|
|
2326
|
+
var listContentIndent = (indent, markerLength, padding) => {
|
|
2327
|
+
return indent + markerLength + (padding > 0 && padding <= 4 ? padding : 1);
|
|
2328
|
+
};
|
|
2329
|
+
|
|
2330
|
+
// ../nizel/dist/parse/table.js
|
|
2331
|
+
var isTableStart = (lines, index) => {
|
|
2332
|
+
return Boolean(lines[index]?.includes("|") && lines[index + 1] && /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(lines[index + 1]));
|
|
2333
|
+
};
|
|
2334
|
+
var readTable = (lines, startIndex, options, parseInline2) => {
|
|
2335
|
+
const headers = splitTableRow(lines[startIndex]);
|
|
2336
|
+
const align = splitTableRow(lines[startIndex + 1]).map((cell) => {
|
|
2337
|
+
const trimmed = cell.trim();
|
|
2338
|
+
if (trimmed.startsWith(":") && trimmed.endsWith(":"))
|
|
2339
|
+
return "center";
|
|
2340
|
+
if (trimmed.endsWith(":"))
|
|
2341
|
+
return "right";
|
|
2342
|
+
if (trimmed.startsWith(":"))
|
|
2343
|
+
return "left";
|
|
2344
|
+
return null;
|
|
2345
|
+
});
|
|
2346
|
+
const rows = [
|
|
2347
|
+
{
|
|
2348
|
+
type: "tableRow",
|
|
2349
|
+
children: headers.map((cell) => ({
|
|
2350
|
+
type: "tableCell",
|
|
2351
|
+
children: parseInline2(cell.trim(), options)
|
|
2352
|
+
}))
|
|
2353
|
+
}
|
|
2354
|
+
];
|
|
2355
|
+
let index = startIndex + 2;
|
|
2356
|
+
while (index < lines.length && lines[index].includes("|") && lines[index].trim()) {
|
|
2357
|
+
rows.push({
|
|
2358
|
+
type: "tableRow",
|
|
2359
|
+
children: splitTableRow(lines[index]).map((cell) => ({
|
|
2360
|
+
type: "tableCell",
|
|
2361
|
+
children: parseInline2(cell.trim(), options)
|
|
2362
|
+
}))
|
|
2363
|
+
});
|
|
2364
|
+
index += 1;
|
|
2365
|
+
}
|
|
2366
|
+
return { table: { type: "table", align, children: rows }, endIndex: index - 1 };
|
|
2367
|
+
};
|
|
2368
|
+
var splitTableRow = (line) => {
|
|
2369
|
+
return line.trim().replace(/^\||\|$/g, "").split("|");
|
|
2370
|
+
};
|
|
2371
|
+
|
|
2372
|
+
// ../nizel/dist/parse/blockquote.js
|
|
2373
|
+
var canContinueBlockquoteLazily = (line, options, lines, index) => {
|
|
2374
|
+
return Boolean(line.trim() && !/^ {0,3}> ?/.test(line) && !/^ {0,3}(`{3,}|~{3,})/.test(line) && !isThematicBreak(line) && !parseListMarker(line) && !isTableStart(lines, index) && !(options.safe === false && isInterruptingHtmlBlockStart(line)));
|
|
2375
|
+
};
|
|
2376
|
+
var canStartLazyBlockquoteContinuation = (line, options, lines, index, isBlockStart2) => {
|
|
2377
|
+
const candidate = lazyContinuationCandidate(line);
|
|
2378
|
+
return Boolean(candidate.trim() && !/^ {0,3}(`{3,}|~{3,})/.test(candidate) && !/^ {4}/.test(candidate) && !isBlockStart2(candidate, options, lines, index));
|
|
2379
|
+
};
|
|
2380
|
+
var lazyContinuationCandidate = (line) => {
|
|
2381
|
+
let candidate = line;
|
|
2382
|
+
while (true) {
|
|
2383
|
+
const quoteMarker = /^ {0,3}> ?(.*)$/.exec(candidate);
|
|
2384
|
+
if (quoteMarker) {
|
|
2385
|
+
candidate = quoteMarker[1];
|
|
2386
|
+
continue;
|
|
2387
|
+
}
|
|
2388
|
+
const marker = parseListMarker(candidate);
|
|
2389
|
+
if (marker && /^ {0,3}> ?/.test(marker.body)) {
|
|
2390
|
+
candidate = marker.body;
|
|
2391
|
+
continue;
|
|
2392
|
+
}
|
|
2393
|
+
return candidate;
|
|
2394
|
+
}
|
|
2395
|
+
};
|
|
2396
|
+
|
|
2397
|
+
// ../nizel/dist/parse/common.js
|
|
2398
|
+
var normalizeReference = (label) => {
|
|
2399
|
+
return label.trim().replace(/\s+/g, " ").replace(/[ẞß]/g, "ss").toLowerCase();
|
|
2400
|
+
};
|
|
2401
|
+
var normalizeReferenceLabelForLookup = (label) => {
|
|
2402
|
+
return normalizeReference(label.replace(/\\([\[\]])/g, "$1"));
|
|
2403
|
+
};
|
|
2404
|
+
var normalizeHref = (destination) => {
|
|
2405
|
+
try {
|
|
2406
|
+
return encodeURI(destination).replace(/%25([0-9A-Fa-f]{2})/g, "%$1");
|
|
2407
|
+
} catch {
|
|
2408
|
+
return destination;
|
|
2409
|
+
}
|
|
2410
|
+
};
|
|
2411
|
+
var decodeStringContent = (source) => {
|
|
2412
|
+
return source.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, "$1").replace(/&([A-Za-z][A-Za-z0-9]+|#[0-9]+|#[xX][0-9A-Fa-f]+);/g, (_, entity) => decodeEntity(entity));
|
|
2413
|
+
};
|
|
2414
|
+
var decodeEntity = (entity) => {
|
|
2415
|
+
if (/^#[xX]/.test(entity))
|
|
2416
|
+
return decodeCodePoint(entity, Number.parseInt(entity.slice(2), 16));
|
|
2417
|
+
if (entity.startsWith("#"))
|
|
2418
|
+
return decodeCodePoint(entity, Number.parseInt(entity.slice(1), 10));
|
|
2419
|
+
const named = {
|
|
2420
|
+
amp: "&",
|
|
2421
|
+
lt: "<",
|
|
2422
|
+
gt: ">",
|
|
2423
|
+
quot: '"',
|
|
2424
|
+
apos: "'",
|
|
2425
|
+
nbsp: "\xA0",
|
|
2426
|
+
AElig: "\xC6",
|
|
2427
|
+
auml: "\xE4",
|
|
2428
|
+
ClockwiseContourIntegral: "\u2232",
|
|
2429
|
+
copy: "\xA9",
|
|
2430
|
+
Dcaron: "\u010E",
|
|
2431
|
+
DifferentialD: "\u2146",
|
|
2432
|
+
frac34: "\xBE",
|
|
2433
|
+
HilbertSpace: "\u210B",
|
|
2434
|
+
ngE: "\u2267\u0338",
|
|
2435
|
+
ouml: "\xF6"
|
|
2436
|
+
};
|
|
2437
|
+
return named[entity] ?? `&${entity};`;
|
|
2438
|
+
};
|
|
2439
|
+
var decodeCodePoint = (entity, codePoint) => {
|
|
2440
|
+
if (!Number.isFinite(codePoint) || codePoint === 0 || codePoint >= 55296 && codePoint <= 57343) {
|
|
2441
|
+
return "\uFFFD";
|
|
2442
|
+
}
|
|
2443
|
+
if (codePoint < 0 || codePoint > 1114111) {
|
|
2444
|
+
return `&${entity};`;
|
|
2445
|
+
}
|
|
2446
|
+
return String.fromCodePoint(codePoint);
|
|
2447
|
+
};
|
|
2448
|
+
|
|
2449
|
+
// ../nizel/dist/parse/code.js
|
|
2450
|
+
var openingFenceClosePattern = (line) => {
|
|
2451
|
+
const fence = /^( {0,3})(`{3,}|~{3,})[ \t]*(.*)$/.exec(line);
|
|
2452
|
+
if (!fence)
|
|
2453
|
+
return null;
|
|
2454
|
+
const marker = fence[2][0];
|
|
2455
|
+
return new RegExp(`^ {0,3}\\${marker}{${fence[2].length},}\\s*$`);
|
|
2456
|
+
};
|
|
2457
|
+
var normalizeCodeSpan = (code) => {
|
|
2458
|
+
const normalized = code.replace(/\r?\n/g, " ");
|
|
2459
|
+
return normalized.startsWith(" ") && normalized.endsWith(" ") && /[^ ]/.test(normalized) ? normalized.slice(1, -1) : normalized;
|
|
2460
|
+
};
|
|
2461
|
+
var parseFenceInfo = (info, marker) => {
|
|
2462
|
+
const meta = decodeStringContent(info.trim());
|
|
2463
|
+
if (marker === "`" && meta.includes("`"))
|
|
2464
|
+
return { meta: "", valid: false };
|
|
2465
|
+
if (!meta)
|
|
2466
|
+
return { meta: "", valid: true };
|
|
2467
|
+
const [lang] = meta.split(/\s+/, 1);
|
|
2468
|
+
return { lang, meta, valid: true };
|
|
2469
|
+
};
|
|
2470
|
+
var stripFenceIndent = (line, indent) => {
|
|
2471
|
+
let removed = 0;
|
|
2472
|
+
while (removed < indent && line.startsWith(" ")) {
|
|
2473
|
+
line = line.slice(1);
|
|
2474
|
+
removed += 1;
|
|
2475
|
+
}
|
|
2476
|
+
return line;
|
|
2477
|
+
};
|
|
2478
|
+
var parseCodeMeta = (meta) => {
|
|
2479
|
+
const filename = /filename=(?:"([^"]+)"|'([^']+)'|(\S+))/.exec(meta);
|
|
2480
|
+
const highlight = /\{([^}]+)\}/.exec(meta);
|
|
2481
|
+
return {
|
|
2482
|
+
filename: filename?.[1] ?? filename?.[2] ?? filename?.[3],
|
|
2483
|
+
highlightLines: highlight ? expandLineRanges(highlight[1]) : void 0
|
|
2484
|
+
};
|
|
2485
|
+
};
|
|
2486
|
+
var expandLineRanges = (source) => {
|
|
2487
|
+
const lines = /* @__PURE__ */ new Set();
|
|
2488
|
+
for (const part of source.split(",")) {
|
|
2489
|
+
const [start, end] = part.trim().split("-").map(Number);
|
|
2490
|
+
if (!Number.isFinite(start))
|
|
2491
|
+
continue;
|
|
2492
|
+
if (Number.isFinite(end)) {
|
|
2493
|
+
for (let line = start; line <= end; line += 1)
|
|
2494
|
+
lines.add(line);
|
|
2495
|
+
} else {
|
|
2496
|
+
lines.add(start);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
return [...lines].sort((a, b2) => a - b2);
|
|
2500
|
+
};
|
|
2501
|
+
|
|
2502
|
+
// ../nizel/dist/parse/custom.js
|
|
2503
|
+
var readCustomBlock = (lines, startIndex) => {
|
|
2504
|
+
const firstDelimiter = findDelimiter(lines, startIndex + 1);
|
|
2505
|
+
if (firstDelimiter === -1) {
|
|
2506
|
+
return {
|
|
2507
|
+
props: {},
|
|
2508
|
+
content: lines.slice(startIndex + 1).join("\n"),
|
|
2509
|
+
endIndex: lines.length - 1
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
const beforeDelimiter = lines.slice(startIndex + 1, firstDelimiter);
|
|
2513
|
+
if (beforeDelimiter.length > 0 && beforeDelimiter.every(isPropOrBlank)) {
|
|
2514
|
+
const closingDelimiter = findDelimiter(lines, firstDelimiter + 1);
|
|
2515
|
+
return {
|
|
2516
|
+
props: parseProps(beforeDelimiter),
|
|
2517
|
+
content: lines.slice(firstDelimiter + 1, closingDelimiter === -1 ? lines.length : closingDelimiter).join("\n"),
|
|
2518
|
+
endIndex: closingDelimiter === -1 ? lines.length - 1 : closingDelimiter
|
|
2519
|
+
};
|
|
2520
|
+
}
|
|
2521
|
+
return {
|
|
2522
|
+
props: {},
|
|
2523
|
+
content: beforeDelimiter.join("\n"),
|
|
2524
|
+
endIndex: firstDelimiter
|
|
2525
|
+
};
|
|
2526
|
+
};
|
|
2527
|
+
var findDelimiter = (lines, startIndex) => {
|
|
2528
|
+
for (let index = startIndex; index < lines.length; index += 1) {
|
|
2529
|
+
if (lines[index].trim() === "::")
|
|
2530
|
+
return index;
|
|
2531
|
+
}
|
|
2532
|
+
return -1;
|
|
2533
|
+
};
|
|
2534
|
+
var isPropOrBlank = (line) => {
|
|
2535
|
+
return !line.trim() || /^[A-Za-z0-9_-]+:\s*.*$/.test(line.trim());
|
|
2536
|
+
};
|
|
2537
|
+
var parseProps = (lines) => {
|
|
2538
|
+
const props = {};
|
|
2539
|
+
for (const line of lines) {
|
|
2540
|
+
const match = /^([A-Za-z0-9_-]+):\s*(.*)$/.exec(line.trim());
|
|
2541
|
+
if (!match)
|
|
2542
|
+
continue;
|
|
2543
|
+
props[match[1]] = parsePrimitive(match[2]);
|
|
2544
|
+
}
|
|
2545
|
+
return props;
|
|
2546
|
+
};
|
|
2547
|
+
var parsePrimitive = (value) => {
|
|
2548
|
+
const trimmed = value.trim();
|
|
2549
|
+
if (trimmed === "true")
|
|
2550
|
+
return true;
|
|
2551
|
+
if (trimmed === "false")
|
|
2552
|
+
return false;
|
|
2553
|
+
if (trimmed === "null")
|
|
2554
|
+
return null;
|
|
2555
|
+
if (/^-?\d+(\.\d+)?$/.test(trimmed))
|
|
2556
|
+
return Number(trimmed);
|
|
2557
|
+
return trimmed.replace(/^["']|["']$/g, "");
|
|
2558
|
+
};
|
|
2559
|
+
var splitWords = (source) => {
|
|
2560
|
+
return source.trim() ? source.trim().split(/\s+/) : [];
|
|
2561
|
+
};
|
|
2562
|
+
|
|
2563
|
+
// ../nizel/dist/parse/autolink.js
|
|
2564
|
+
var trimTrailingPunctuation = (source) => {
|
|
2565
|
+
return source.replace(/[),.;:!?]+$/g, "");
|
|
2566
|
+
};
|
|
2567
|
+
var getAutolinkOptions = (options) => {
|
|
2568
|
+
return typeof options === "object" ? options : { enabled: options !== false };
|
|
2569
|
+
};
|
|
2570
|
+
var isExternalHref = (href) => {
|
|
2571
|
+
return /^(?:https?:)?\/\//.test(href);
|
|
2572
|
+
};
|
|
2573
|
+
|
|
2574
|
+
// ../nizel/dist/parse/emphasis.js
|
|
2575
|
+
var resolveRemainingEmphasis = (nodes) => {
|
|
2576
|
+
const tokens = tokenizeEmphasisDelimiters(nodes);
|
|
2577
|
+
let changed = true;
|
|
2578
|
+
while (changed) {
|
|
2579
|
+
changed = false;
|
|
2580
|
+
for (let closeIndex = 0; closeIndex < tokens.length; closeIndex += 1) {
|
|
2581
|
+
const closer = tokens[closeIndex];
|
|
2582
|
+
if (closer.type !== "delimiter" || !closer.close || closer.length === 0)
|
|
2583
|
+
continue;
|
|
2584
|
+
for (let openIndex = closeIndex - 1; openIndex >= 0; openIndex -= 1) {
|
|
2585
|
+
const opener = tokens[openIndex];
|
|
2586
|
+
if (opener.type !== "delimiter" || !opener.open || opener.char !== closer.char || opener.length === 0) {
|
|
2587
|
+
continue;
|
|
2588
|
+
}
|
|
2589
|
+
if (isForbiddenDelimiterMatch(opener, closer))
|
|
2590
|
+
continue;
|
|
2591
|
+
const size = opener.length >= 2 && closer.length >= 2 ? 2 : 1;
|
|
2592
|
+
const children = inlineTokensToNodes(tokens.slice(openIndex + 1, closeIndex));
|
|
2593
|
+
const wrapped = size === 2 ? { type: "strong", children: resolveRemainingEmphasis(children) } : { type: "emphasis", children: resolveRemainingEmphasis(children) };
|
|
2594
|
+
const replacement = [];
|
|
2595
|
+
if (opener.length > size) {
|
|
2596
|
+
replacement.push({ ...opener, length: opener.length - size });
|
|
2597
|
+
}
|
|
2598
|
+
replacement.push({ type: "node", node: wrapped });
|
|
2599
|
+
if (closer.length > size) {
|
|
2600
|
+
replacement.push({ ...closer, length: closer.length - size });
|
|
2601
|
+
}
|
|
2602
|
+
tokens.splice(openIndex, closeIndex - openIndex + 1, ...replacement);
|
|
2603
|
+
changed = true;
|
|
2604
|
+
closeIndex = -1;
|
|
2605
|
+
break;
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
return inlineTokensToNodes(tokens);
|
|
2610
|
+
};
|
|
2611
|
+
var tokenizeEmphasisDelimiters = (nodes) => {
|
|
2612
|
+
const tokens = [];
|
|
2613
|
+
for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex += 1) {
|
|
2614
|
+
const node = nodes[nodeIndex];
|
|
2615
|
+
if (node.type !== "text") {
|
|
2616
|
+
tokens.push({ type: "node", node });
|
|
2617
|
+
continue;
|
|
2618
|
+
}
|
|
2619
|
+
if (node.escaped === true) {
|
|
2620
|
+
tokens.push({ type: "node", node });
|
|
2621
|
+
continue;
|
|
2622
|
+
}
|
|
2623
|
+
let cursor = 0;
|
|
2624
|
+
while (cursor < node.value.length) {
|
|
2625
|
+
const character = node.value[cursor];
|
|
2626
|
+
if (character !== "*" && character !== "_") {
|
|
2627
|
+
const nextDelimiter = nextEmphasisDelimiter(node.value, cursor + 1);
|
|
2628
|
+
tokens.push({
|
|
2629
|
+
type: "node",
|
|
2630
|
+
node: { type: "text", value: node.value.slice(cursor, nextDelimiter) }
|
|
2631
|
+
});
|
|
2632
|
+
cursor = nextDelimiter;
|
|
2633
|
+
continue;
|
|
2634
|
+
}
|
|
2635
|
+
const runStart = cursor;
|
|
2636
|
+
while (cursor < node.value.length && node.value[cursor] === character)
|
|
2637
|
+
cursor += 1;
|
|
2638
|
+
const runLength = cursor - runStart;
|
|
2639
|
+
const before = previousCharacter(tokens);
|
|
2640
|
+
const after = node.value[cursor] ?? nextInlineCharacter(nodes, nodeIndex + 1);
|
|
2641
|
+
const { open, close } = classifyDelimiterRun(character, before, after);
|
|
2642
|
+
tokens.push({
|
|
2643
|
+
type: "delimiter",
|
|
2644
|
+
char: character,
|
|
2645
|
+
close,
|
|
2646
|
+
length: runLength,
|
|
2647
|
+
open
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
return tokens;
|
|
2652
|
+
};
|
|
2653
|
+
var nextInlineCharacter = (nodes, startIndex) => {
|
|
2654
|
+
for (let index = startIndex; index < nodes.length; index += 1) {
|
|
2655
|
+
const character = firstInlineCharacter(nodes[index]);
|
|
2656
|
+
if (character)
|
|
2657
|
+
return character;
|
|
2658
|
+
}
|
|
2659
|
+
return "";
|
|
2660
|
+
};
|
|
2661
|
+
var firstInlineCharacter = (node) => {
|
|
2662
|
+
if (node.type === "text" && node.value)
|
|
2663
|
+
return node.value[0];
|
|
2664
|
+
if (node.type === "lineBreak")
|
|
2665
|
+
return "\n";
|
|
2666
|
+
if (node.type === "inlineCode" && node.code)
|
|
2667
|
+
return node.code[0];
|
|
2668
|
+
if (node.type === "image" && node.alt)
|
|
2669
|
+
return node.alt[0];
|
|
2670
|
+
if ("children" in node && node.children.length > 0) {
|
|
2671
|
+
for (const child of node.children) {
|
|
2672
|
+
const character = firstInlineCharacter(child);
|
|
2673
|
+
if (character)
|
|
2674
|
+
return character;
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
return "";
|
|
2678
|
+
};
|
|
2679
|
+
var isForbiddenDelimiterMatch = (opener, closer) => {
|
|
2680
|
+
if (opener.char !== closer.char)
|
|
2681
|
+
return true;
|
|
2682
|
+
if (!(opener.close || closer.open))
|
|
2683
|
+
return false;
|
|
2684
|
+
return (opener.length + closer.length) % 3 === 0 && opener.length % 3 !== 0 && closer.length % 3 !== 0;
|
|
2685
|
+
};
|
|
2686
|
+
var nextEmphasisDelimiter = (source, startIndex) => {
|
|
2687
|
+
let index = startIndex;
|
|
2688
|
+
while (index < source.length && source[index] !== "*" && source[index] !== "_")
|
|
2689
|
+
index += 1;
|
|
2690
|
+
return index;
|
|
2691
|
+
};
|
|
2692
|
+
var previousCharacter = (tokens) => {
|
|
2693
|
+
for (let index = tokens.length - 1; index >= 0; index -= 1) {
|
|
2694
|
+
const token = tokens[index];
|
|
2695
|
+
if (token.type === "delimiter" && token.length > 0)
|
|
2696
|
+
return token.char;
|
|
2697
|
+
if (token.type === "node") {
|
|
2698
|
+
const character = lastInlineCharacter(token.node);
|
|
2699
|
+
if (character)
|
|
2700
|
+
return character;
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
return "";
|
|
2704
|
+
};
|
|
2705
|
+
var lastInlineCharacter = (node) => {
|
|
2706
|
+
if (node.type === "text" && node.value)
|
|
2707
|
+
return node.value[node.value.length - 1];
|
|
2708
|
+
if (node.type === "lineBreak")
|
|
2709
|
+
return "\n";
|
|
2710
|
+
if (node.type === "inlineCode" && node.code)
|
|
2711
|
+
return node.code[node.code.length - 1];
|
|
2712
|
+
if (node.type === "image" && node.alt)
|
|
2713
|
+
return node.alt[node.alt.length - 1];
|
|
2714
|
+
if ("children" in node && node.children.length > 0) {
|
|
2715
|
+
for (let index = node.children.length - 1; index >= 0; index -= 1) {
|
|
2716
|
+
const character = lastInlineCharacter(node.children[index]);
|
|
2717
|
+
if (character)
|
|
2718
|
+
return character;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
return "";
|
|
2722
|
+
};
|
|
2723
|
+
var classifyDelimiterRun = (char, before, after) => {
|
|
2724
|
+
const beforeWhitespace = before === "" || /\s/u.test(before);
|
|
2725
|
+
const afterWhitespace = after === "" || /\s/u.test(after);
|
|
2726
|
+
const beforePunctuation = isUnicodePunctuation(before);
|
|
2727
|
+
const afterPunctuation = isUnicodePunctuation(after);
|
|
2728
|
+
const leftFlanking = !afterWhitespace && (!afterPunctuation || beforeWhitespace || beforePunctuation);
|
|
2729
|
+
const rightFlanking = !beforeWhitespace && (!beforePunctuation || afterWhitespace || afterPunctuation);
|
|
2730
|
+
if (char === "_") {
|
|
2731
|
+
return {
|
|
2732
|
+
open: leftFlanking && (!rightFlanking || beforePunctuation),
|
|
2733
|
+
close: rightFlanking && (!leftFlanking || afterPunctuation)
|
|
2734
|
+
};
|
|
2735
|
+
}
|
|
2736
|
+
return { open: leftFlanking, close: rightFlanking };
|
|
2737
|
+
};
|
|
2738
|
+
var isUnicodePunctuation = (character) => {
|
|
2739
|
+
return character !== "" && /[\p{P}\p{S}]/u.test(character);
|
|
2740
|
+
};
|
|
2741
|
+
var inlineTokensToNodes = (tokens) => {
|
|
2742
|
+
const nodes = [];
|
|
2743
|
+
for (const token of tokens) {
|
|
2744
|
+
if (token.type === "delimiter") {
|
|
2745
|
+
appendTextNode(nodes, token.char.repeat(token.length));
|
|
2746
|
+
continue;
|
|
2747
|
+
}
|
|
2748
|
+
if (token.node.type === "text") {
|
|
2749
|
+
appendTextNode(nodes, token.node.value);
|
|
2750
|
+
} else {
|
|
2751
|
+
nodes.push(token.node);
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
return nodes;
|
|
2755
|
+
};
|
|
2756
|
+
var appendTextNode = (nodes, value) => {
|
|
2757
|
+
if (!value)
|
|
2758
|
+
return;
|
|
2759
|
+
const previous = nodes[nodes.length - 1];
|
|
2760
|
+
if (previous?.type === "text") {
|
|
2761
|
+
previous.value += value;
|
|
2762
|
+
return;
|
|
2763
|
+
}
|
|
2764
|
+
nodes.push({ type: "text", value });
|
|
2765
|
+
};
|
|
2766
|
+
|
|
2767
|
+
// ../nizel/dist/parse/inline-links.js
|
|
2768
|
+
var nextInlineLabelOpener = (source, startIndex) => {
|
|
2769
|
+
for (let index = startIndex; index < source.length; index += 1) {
|
|
2770
|
+
if (source[index] === "\\") {
|
|
2771
|
+
index += 1;
|
|
2772
|
+
continue;
|
|
2773
|
+
}
|
|
2774
|
+
if (source[index] === "[")
|
|
2775
|
+
return index;
|
|
2776
|
+
if (source[index] === "!" && source[index + 1] === "[")
|
|
2777
|
+
return index;
|
|
2778
|
+
}
|
|
2779
|
+
return -1;
|
|
2780
|
+
};
|
|
2781
|
+
var findBalancedLabelEnd = (source, startIndex) => {
|
|
2782
|
+
let depth = 0;
|
|
2783
|
+
for (let index = startIndex; index < source.length; index += 1) {
|
|
2784
|
+
if (source[index] === "\\") {
|
|
2785
|
+
index += 1;
|
|
2786
|
+
continue;
|
|
2787
|
+
}
|
|
2788
|
+
if (source[index] === "`") {
|
|
2789
|
+
const ticks = /^`+/.exec(source.slice(index))?.[0] ?? "`";
|
|
2790
|
+
const close = source.indexOf(ticks, index + ticks.length);
|
|
2791
|
+
if (close !== -1) {
|
|
2792
|
+
index = close + ticks.length - 1;
|
|
2793
|
+
continue;
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
if (source[index] === "<") {
|
|
2797
|
+
const close = source.indexOf(">", index + 1);
|
|
2798
|
+
if (close !== -1) {
|
|
2799
|
+
const token = source.slice(index, close + 1);
|
|
2800
|
+
if (isAutolinkToken(token) || isValidInlineHtmlToken(token)) {
|
|
2801
|
+
index = close;
|
|
2802
|
+
continue;
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
if (source[index] === "[") {
|
|
2807
|
+
depth += 1;
|
|
2808
|
+
continue;
|
|
2809
|
+
}
|
|
2810
|
+
if (source[index] === "]") {
|
|
2811
|
+
if (depth === 0)
|
|
2812
|
+
return index;
|
|
2813
|
+
depth -= 1;
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
return -1;
|
|
2817
|
+
};
|
|
2818
|
+
var containsInlineLink = (label) => {
|
|
2819
|
+
return new RegExp("(?<!!)\\[[^\\]]+\\](?:\\(|\\[)").test(label);
|
|
2820
|
+
};
|
|
2821
|
+
var isAutolinkToken = (token) => {
|
|
2822
|
+
return /^<[A-Za-z][A-Za-z0-9+.-]{1,31}:[^<>\s]*>$/.test(token) || /^<[A-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?(?:\.[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?)*>$/i.test(token);
|
|
2823
|
+
};
|
|
2824
|
+
var readInlineReferenceDestination = (source, labelEnd, label, state) => {
|
|
2825
|
+
if (source[labelEnd + 1] !== "[")
|
|
2826
|
+
return null;
|
|
2827
|
+
const referenceEnd = findReferenceLabelEnd(source, labelEnd + 2);
|
|
2828
|
+
if (referenceEnd === -1)
|
|
2829
|
+
return null;
|
|
2830
|
+
const referenceLabel = source.slice(labelEnd + 2, referenceEnd);
|
|
2831
|
+
const reference = state.references.get(normalizeReferenceLabelForLookup(referenceLabel || label));
|
|
2832
|
+
if (!reference)
|
|
2833
|
+
return null;
|
|
2834
|
+
return {
|
|
2835
|
+
href: reference.href,
|
|
2836
|
+
title: reference.title,
|
|
2837
|
+
endIndex: referenceEnd
|
|
2838
|
+
};
|
|
2839
|
+
};
|
|
2840
|
+
var readUnresolvedInlineReferenceEnd = (source, labelEnd) => {
|
|
2841
|
+
if (source[labelEnd + 1] !== "[")
|
|
2842
|
+
return -1;
|
|
2843
|
+
return findReferenceLabelEnd(source, labelEnd + 2);
|
|
2844
|
+
};
|
|
2845
|
+
var canTailBecomeReferenceLink = (source, unresolvedReferenceEnd, referenceLabel, state) => {
|
|
2846
|
+
return readInlineReferenceDestination(source, unresolvedReferenceEnd, referenceLabel, state) !== null;
|
|
2847
|
+
};
|
|
2848
|
+
var findReferenceLabelEnd = (source, startIndex) => {
|
|
2849
|
+
for (let index = startIndex; index < source.length; index += 1) {
|
|
2850
|
+
if (source[index] === "\\") {
|
|
2851
|
+
index += 1;
|
|
2852
|
+
continue;
|
|
2853
|
+
}
|
|
2854
|
+
if (source[index] === "[")
|
|
2855
|
+
return -1;
|
|
2856
|
+
if (source[index] === "]")
|
|
2857
|
+
return index;
|
|
2858
|
+
}
|
|
2859
|
+
return -1;
|
|
2860
|
+
};
|
|
2861
|
+
var readInlineDestination = (source, openParenIndex) => {
|
|
2862
|
+
if (source[openParenIndex] !== "(")
|
|
2863
|
+
return null;
|
|
2864
|
+
let cursor = openParenIndex + 1;
|
|
2865
|
+
while (/[ \t\n]/.test(source[cursor] ?? ""))
|
|
2866
|
+
cursor += 1;
|
|
2867
|
+
let href = "";
|
|
2868
|
+
if (source[cursor] === "<") {
|
|
2869
|
+
const close = source.indexOf(">", cursor + 1);
|
|
2870
|
+
if (close === -1)
|
|
2871
|
+
return null;
|
|
2872
|
+
href = source.slice(cursor + 1, close);
|
|
2873
|
+
if (/[<>\\\n]/.test(href))
|
|
2874
|
+
return null;
|
|
2875
|
+
cursor = close + 1;
|
|
2876
|
+
} else {
|
|
2877
|
+
let depth = 0;
|
|
2878
|
+
while (cursor < source.length) {
|
|
2879
|
+
const character = source[cursor];
|
|
2880
|
+
if (character === "\\" && source[cursor + 1]) {
|
|
2881
|
+
if (/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/.test(source[cursor + 1])) {
|
|
2882
|
+
href += source[cursor + 1];
|
|
2883
|
+
cursor += 2;
|
|
2884
|
+
} else {
|
|
2885
|
+
href += character;
|
|
2886
|
+
cursor += 1;
|
|
2887
|
+
}
|
|
2888
|
+
continue;
|
|
2889
|
+
}
|
|
2890
|
+
if (character === "(") {
|
|
2891
|
+
depth += 1;
|
|
2892
|
+
href += character;
|
|
2893
|
+
cursor += 1;
|
|
2894
|
+
continue;
|
|
2895
|
+
}
|
|
2896
|
+
if (character === ")") {
|
|
2897
|
+
if (depth === 0)
|
|
2898
|
+
break;
|
|
2899
|
+
depth -= 1;
|
|
2900
|
+
href += character;
|
|
2901
|
+
cursor += 1;
|
|
2902
|
+
continue;
|
|
2903
|
+
}
|
|
2904
|
+
if (/[ \t\n]/.test(character) && depth === 0)
|
|
2905
|
+
break;
|
|
2906
|
+
href += character;
|
|
2907
|
+
cursor += 1;
|
|
2908
|
+
}
|
|
2909
|
+
if (depth !== 0)
|
|
2910
|
+
return null;
|
|
2911
|
+
}
|
|
2912
|
+
let title;
|
|
2913
|
+
const beforeTitle = cursor;
|
|
2914
|
+
while (/[ \t\n]/.test(source[cursor] ?? ""))
|
|
2915
|
+
cursor += 1;
|
|
2916
|
+
if (cursor > beforeTitle && ['"', "'", "("].includes(source[cursor])) {
|
|
2917
|
+
const opener = source[cursor];
|
|
2918
|
+
const closer = opener === "(" ? ")" : opener;
|
|
2919
|
+
cursor += 1;
|
|
2920
|
+
let value = "";
|
|
2921
|
+
while (cursor < source.length) {
|
|
2922
|
+
if (source[cursor] === "\\" && source[cursor + 1]) {
|
|
2923
|
+
value += source[cursor + 1];
|
|
2924
|
+
cursor += 2;
|
|
2925
|
+
continue;
|
|
2926
|
+
}
|
|
2927
|
+
if (source[cursor] === closer)
|
|
2928
|
+
break;
|
|
2929
|
+
value += source[cursor];
|
|
2930
|
+
cursor += 1;
|
|
2931
|
+
}
|
|
2932
|
+
if (source[cursor] !== closer)
|
|
2933
|
+
return null;
|
|
2934
|
+
title = value;
|
|
2935
|
+
cursor += 1;
|
|
2936
|
+
while (/[ \t\n]/.test(source[cursor] ?? ""))
|
|
2937
|
+
cursor += 1;
|
|
2938
|
+
}
|
|
2939
|
+
if (source[cursor] !== ")")
|
|
2940
|
+
return null;
|
|
2941
|
+
return { href, title, endIndex: cursor };
|
|
2942
|
+
};
|
|
2943
|
+
var normalizeInlineDestination = (destination) => {
|
|
2944
|
+
return destination.startsWith("<") && destination.endsWith(">") ? destination.slice(1, -1) : destination;
|
|
2945
|
+
};
|
|
2946
|
+
var inlineTitleFromGroups = (groups, prefix) => {
|
|
2947
|
+
const title = groups[prefix] ?? groups[`${prefix}Single`] ?? groups[`${prefix}Paren`];
|
|
2948
|
+
return title === void 0 ? void 0 : decodeStringContent(title);
|
|
2949
|
+
};
|
|
2950
|
+
|
|
2951
|
+
// ../nizel/dist/parse/inline-text.js
|
|
2952
|
+
var stripInlineNodes = (nodes) => {
|
|
2953
|
+
return nodes.map((node) => {
|
|
2954
|
+
if (node.type === "text")
|
|
2955
|
+
return node.value;
|
|
2956
|
+
if (node.type === "lineBreak")
|
|
2957
|
+
return "\n";
|
|
2958
|
+
if (node.type === "inlineCode")
|
|
2959
|
+
return node.code;
|
|
2960
|
+
if (node.type === "image")
|
|
2961
|
+
return node.alt ?? "";
|
|
2962
|
+
if ("children" in node)
|
|
2963
|
+
return stripInlineNodes(node.children);
|
|
2964
|
+
return "";
|
|
2965
|
+
}).join("");
|
|
2966
|
+
};
|
|
2967
|
+
var trimTrailingSoftBreakSpace = (nodes) => {
|
|
2968
|
+
const previous = nodes[nodes.length - 1];
|
|
2969
|
+
if (previous?.type === "text" && new RegExp("(?<! ) $").test(previous.value)) {
|
|
2970
|
+
previous.value = previous.value.slice(0, -1);
|
|
2971
|
+
}
|
|
2972
|
+
};
|
|
2973
|
+
|
|
2974
|
+
// ../nizel/dist/parse/inline.js
|
|
2975
|
+
var parseInline = (source, options = { autolinks: true }) => parseInlineWithState(source, options, { references: /* @__PURE__ */ new Map() });
|
|
2976
|
+
var parseInlineWithState = (source, options = { autolinks: true }, state, extractNestedLinks = true) => {
|
|
2977
|
+
const autolinks = options.autolinks !== false && getAutolinkOptions(options.autolinks).enabled !== false;
|
|
2978
|
+
if (!hasInlineSyntax(source, autolinks)) {
|
|
2979
|
+
return source ? [{ type: "text", value: source }] : [];
|
|
2980
|
+
}
|
|
2981
|
+
if (extractNestedLinks && hasBalancedLinkCandidate(source)) {
|
|
2982
|
+
const scanned = scanBalancedInlineLinks(source, options, state);
|
|
2983
|
+
if (scanned)
|
|
2984
|
+
return resolveRemainingEmphasis(scanned);
|
|
2985
|
+
}
|
|
2986
|
+
const nodes = [];
|
|
2987
|
+
const safe = options.safe !== false;
|
|
2988
|
+
const pattern = new RegExp("(?<inlineHtml><!-->|<!--->|<!--[\\s\\S]*?-->|<\\?[\\s\\S]*?\\?>|<![A-Z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|<\\/?[A-Za-z][A-Za-z0-9-]*(?:\\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s\"'=<>`]+))?)*\\s*\\/?>)|(?<hardSpaces> {2,}\\n)|(?<hardBackslash>\\\\\\n)|(?<softBreak>\\n)|(?<!`)(?<codeTicks>`+)(?!`)(?<codeValue>[\\s\\S]*?)(?<!`)\\k<codeTicks>(?!`)|\\\\(?<escaped>[!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_`{|}~])|&(?<entity>[A-Za-z][A-Za-z0-9]+|#[0-9]+|#[xX][0-9A-Fa-f]+);|!\\[(?<refImageAlt>[^\\]]*)\\]\\[(?<refImageLabel>[^\\]]*)\\]|\\[(?<refLinkText>[^\\]`<\\[]+)\\]\\[(?<refLinkLabel>[^\\]]*)\\]|!\\[(?<inlineImageAlt>[^\\]`<]*)\\]\\([ \\t\\n]*(?<inlineImageHref><[^<>\\n\\\\]*>|(?!<)(?:\\\\.|[^() \\t\\n`\\\\]|\\([^()\\n]*(?:\\([^()\\n]*\\)[^()\\n]*)*\\))*)(?:[ \\t\\n]+(?:\"(?<inlineImageTitle>(?:\\\\.|[^\"`])*)\"|'(?<inlineImageTitleSingle>[^']*)'|\\((?<inlineImageTitleParen>[^)]*)\\)))?[ \\t\\n]*\\)|\\[(?<inlineLinkText>[^\\]`<]*)\\]\\([ \\t\\n]*(?<inlineLinkHref><[^<>\\n\\\\]*>|(?!<)(?:\\\\.|[^() \\t\\n`\\\\]|\\([^()\\n]*(?:\\([^()\\n]*\\)[^()\\n]*)*\\))*)(?:[ \\t\\n]+(?:\"(?<inlineLinkTitle>(?:\\\\.|[^\"`])*)\"|'(?<inlineLinkTitleSingle>[^']*)'|\\((?<inlineLinkTitleParen>[^)]*)\\)))?[ \\t\\n]*\\)|<(?<angleUrl>[A-Za-z][A-Za-z0-9+.-]{1,31}:[^<>\\s]*)>|<(?<angleEmail>[A-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?(?:\\.[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?)*)>|!\\[(?<shortcutImageAlt>(?:\\\\\\]|[^\\]`<\\[])+)\\]|\\[(?<shortcutLinkText>(?:\\\\\\]|[^\\]`<\\[])+)\\]|~~(?<deleteValue>[^~`]+)~~|(?<bareUrl>https?:\\/\\/[^\\s<`]+)|(?<bareEmail>[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,})", "giu");
|
|
2989
|
+
let lastIndex = 0;
|
|
2990
|
+
let match;
|
|
2991
|
+
while (match = pattern.exec(source)) {
|
|
2992
|
+
if (match.index > lastIndex) {
|
|
2993
|
+
nodes.push({ type: "text", value: source.slice(lastIndex, match.index) });
|
|
2994
|
+
}
|
|
2995
|
+
const groups = match.groups ?? {};
|
|
2996
|
+
if (groups.inlineHtml !== void 0) {
|
|
2997
|
+
nodes.push(safe || !isValidInlineHtmlToken(groups.inlineHtml) ? { type: "text", value: groups.inlineHtml } : { type: "inlineHtml", value: groups.inlineHtml });
|
|
2998
|
+
} else if (groups.hardSpaces !== void 0 || groups.hardBackslash !== void 0) {
|
|
2999
|
+
nodes.push({ type: "lineBreak", hard: true });
|
|
3000
|
+
} else if (groups.softBreak !== void 0) {
|
|
3001
|
+
trimTrailingSoftBreakSpace(nodes);
|
|
3002
|
+
nodes.push({ type: "lineBreak", value: " " });
|
|
3003
|
+
} else if (groups.codeValue !== void 0) {
|
|
3004
|
+
nodes.push({ type: "inlineCode", code: normalizeCodeSpan(groups.codeValue) });
|
|
3005
|
+
} else if (groups.escaped !== void 0) {
|
|
3006
|
+
nodes.push({ type: "text", value: groups.escaped, escaped: true });
|
|
3007
|
+
} else if (groups.entity !== void 0) {
|
|
3008
|
+
nodes.push({ type: "text", value: decodeEntity(groups.entity), escaped: true });
|
|
3009
|
+
} else if (groups.refImageAlt !== void 0) {
|
|
3010
|
+
const reference = state.references.get(normalizeReferenceLabelForLookup(groups.refImageLabel || groups.refImageAlt));
|
|
3011
|
+
if (reference) {
|
|
3012
|
+
nodes.push({
|
|
3013
|
+
type: "image",
|
|
3014
|
+
alt: stripInlineMarkdown(groups.refImageAlt, options),
|
|
3015
|
+
src: reference.href,
|
|
3016
|
+
title: reference.title
|
|
3017
|
+
});
|
|
3018
|
+
} else {
|
|
3019
|
+
nodes.push({ type: "text", value: decodeStringContent(match[0]) });
|
|
3020
|
+
}
|
|
3021
|
+
} else if (groups.refLinkText !== void 0) {
|
|
3022
|
+
const reference = state.references.get(normalizeReferenceLabelForLookup(groups.refLinkLabel || groups.refLinkText));
|
|
3023
|
+
if (reference) {
|
|
3024
|
+
nodes.push({
|
|
3025
|
+
type: "link",
|
|
3026
|
+
href: reference.href,
|
|
3027
|
+
title: reference.title,
|
|
3028
|
+
external: isExternalHref(reference.href),
|
|
3029
|
+
children: parseInlineWithState(groups.refLinkText, options, state)
|
|
3030
|
+
});
|
|
3031
|
+
} else {
|
|
3032
|
+
nodes.push({ type: "text", value: decodeStringContent(match[0]) });
|
|
3033
|
+
}
|
|
3034
|
+
} else if (groups.inlineImageAlt !== void 0) {
|
|
3035
|
+
nodes.push({
|
|
3036
|
+
type: "image",
|
|
3037
|
+
alt: stripInlineMarkdown(groups.inlineImageAlt, options),
|
|
3038
|
+
src: normalizeHref(decodeStringContent(normalizeInlineDestination(groups.inlineImageHref))),
|
|
3039
|
+
title: inlineTitleFromGroups(groups, "inlineImageTitle")
|
|
3040
|
+
});
|
|
3041
|
+
} else if (groups.inlineLinkText !== void 0) {
|
|
3042
|
+
const href = normalizeHref(decodeStringContent(normalizeInlineDestination(groups.inlineLinkHref)));
|
|
3043
|
+
nodes.push({
|
|
3044
|
+
type: "link",
|
|
3045
|
+
href,
|
|
3046
|
+
title: inlineTitleFromGroups(groups, "inlineLinkTitle"),
|
|
3047
|
+
external: isExternalHref(href),
|
|
3048
|
+
children: parseInlineWithState(groups.inlineLinkText, options, state)
|
|
3049
|
+
});
|
|
3050
|
+
} else if (groups.angleUrl !== void 0) {
|
|
3051
|
+
const href = normalizeHref(groups.angleUrl);
|
|
3052
|
+
nodes.push({
|
|
3053
|
+
type: "link",
|
|
3054
|
+
href,
|
|
3055
|
+
external: isExternalHref(href),
|
|
3056
|
+
children: [{ type: "text", value: groups.angleUrl }]
|
|
3057
|
+
});
|
|
3058
|
+
} else if (groups.angleEmail !== void 0) {
|
|
3059
|
+
nodes.push({
|
|
3060
|
+
type: "link",
|
|
3061
|
+
href: `mailto:${groups.angleEmail}`,
|
|
3062
|
+
external: false,
|
|
3063
|
+
children: [{ type: "text", value: groups.angleEmail }]
|
|
3064
|
+
});
|
|
3065
|
+
} else if (groups.shortcutImageAlt !== void 0) {
|
|
3066
|
+
const alt = decodeStringContent(groups.shortcutImageAlt);
|
|
3067
|
+
const reference = state.references.get(normalizeReference(alt));
|
|
3068
|
+
if (reference) {
|
|
3069
|
+
nodes.push({
|
|
3070
|
+
type: "image",
|
|
3071
|
+
alt: stripInlineMarkdown(alt, options),
|
|
3072
|
+
src: reference.href,
|
|
3073
|
+
title: reference.title
|
|
3074
|
+
});
|
|
3075
|
+
} else {
|
|
3076
|
+
nodes.push({ type: "text", value: decodeStringContent(match[0]) });
|
|
3077
|
+
}
|
|
3078
|
+
} else if (groups.shortcutLinkText !== void 0) {
|
|
3079
|
+
const text = decodeStringContent(groups.shortcutLinkText);
|
|
3080
|
+
const reference = state.references.get(normalizeReference(text));
|
|
3081
|
+
if (reference) {
|
|
3082
|
+
nodes.push({
|
|
3083
|
+
type: "link",
|
|
3084
|
+
href: reference.href,
|
|
3085
|
+
title: reference.title,
|
|
3086
|
+
external: isExternalHref(reference.href),
|
|
3087
|
+
children: parseInlineWithState(text, options, state)
|
|
3088
|
+
});
|
|
3089
|
+
} else {
|
|
3090
|
+
nodes.push({ type: "text", value: decodeStringContent(match[0]) });
|
|
3091
|
+
}
|
|
3092
|
+
} else if (groups.deleteValue !== void 0) {
|
|
3093
|
+
nodes.push({ type: "delete", children: parseInlineWithState(groups.deleteValue, options, state) });
|
|
3094
|
+
} else if (groups.strongStarValue !== void 0 || groups.strongUnderscoreValue !== void 0) {
|
|
3095
|
+
nodes.push({
|
|
3096
|
+
type: "strong",
|
|
3097
|
+
children: parseInlineWithState(groups.strongStarValue ?? groups.strongUnderscoreValue, options, state)
|
|
3098
|
+
});
|
|
3099
|
+
} else if (groups.emStarValue !== void 0 || groups.emUnderscoreValue !== void 0) {
|
|
3100
|
+
nodes.push({
|
|
3101
|
+
type: "emphasis",
|
|
3102
|
+
children: parseInlineWithState(groups.emStarValue ?? groups.emUnderscoreValue, options, state)
|
|
3103
|
+
});
|
|
3104
|
+
} else if (groups.bareUrl !== void 0 && autolinks) {
|
|
3105
|
+
const href = trimTrailingPunctuation(groups.bareUrl);
|
|
3106
|
+
nodes.push({
|
|
3107
|
+
type: "link",
|
|
3108
|
+
href,
|
|
3109
|
+
external: true,
|
|
3110
|
+
children: [{ type: "text", value: href }]
|
|
3111
|
+
});
|
|
3112
|
+
const trailing = groups.bareUrl.slice(href.length);
|
|
3113
|
+
if (trailing)
|
|
3114
|
+
nodes.push({ type: "text", value: trailing });
|
|
3115
|
+
} else if (groups.bareEmail !== void 0 && autolinks) {
|
|
3116
|
+
nodes.push({
|
|
3117
|
+
type: "link",
|
|
3118
|
+
href: `mailto:${groups.bareEmail}`,
|
|
3119
|
+
external: false,
|
|
3120
|
+
children: [{ type: "text", value: groups.bareEmail }]
|
|
3121
|
+
});
|
|
3122
|
+
} else {
|
|
3123
|
+
nodes.push({ type: "text", value: match[0] });
|
|
3124
|
+
}
|
|
3125
|
+
lastIndex = pattern.lastIndex;
|
|
3126
|
+
}
|
|
3127
|
+
if (lastIndex < source.length)
|
|
3128
|
+
nodes.push({ type: "text", value: source.slice(lastIndex) });
|
|
3129
|
+
return resolveRemainingEmphasis(nodes);
|
|
3130
|
+
};
|
|
3131
|
+
var hasInlineSyntax = (source, autolinks) => {
|
|
3132
|
+
if (!source)
|
|
3133
|
+
return false;
|
|
3134
|
+
if (/[\\`<&\n\[\]*_~]/.test(source))
|
|
3135
|
+
return true;
|
|
3136
|
+
return autolinks && (source.includes("http://") || source.includes("https://") || source.includes("@"));
|
|
3137
|
+
};
|
|
3138
|
+
var hasBalancedLinkCandidate = (source) => {
|
|
3139
|
+
return source.includes("[");
|
|
3140
|
+
};
|
|
3141
|
+
var scanBalancedInlineLinks = (source, options, state) => {
|
|
3142
|
+
const nodes = [];
|
|
3143
|
+
let cursor = 0;
|
|
3144
|
+
let searchStart = 0;
|
|
3145
|
+
let found = false;
|
|
3146
|
+
while (cursor < source.length) {
|
|
3147
|
+
const opener = nextInlineLabelOpener(source, searchStart);
|
|
3148
|
+
if (opener === -1)
|
|
3149
|
+
break;
|
|
3150
|
+
const image = source[opener] === "!";
|
|
3151
|
+
const labelStart = opener + (image ? 2 : 1);
|
|
3152
|
+
const labelEnd = findBalancedLabelEnd(source, labelStart);
|
|
3153
|
+
if (labelEnd === -1) {
|
|
3154
|
+
searchStart = opener + 1;
|
|
3155
|
+
continue;
|
|
3156
|
+
}
|
|
3157
|
+
const label = source.slice(labelStart, labelEnd);
|
|
3158
|
+
if (!image && containsInlineLink(label)) {
|
|
3159
|
+
searchStart = opener + 1;
|
|
3160
|
+
continue;
|
|
3161
|
+
}
|
|
3162
|
+
const inlineDestination = source[labelEnd + 1] === "(" ? readInlineDestination(source, labelEnd + 1) : null;
|
|
3163
|
+
const referenceDestination = inlineDestination ? null : readInlineReferenceDestination(source, labelEnd, label, state);
|
|
3164
|
+
const href = inlineDestination?.href ?? referenceDestination?.href;
|
|
3165
|
+
if (href === void 0) {
|
|
3166
|
+
const unresolvedReferenceEnd = inlineDestination ? -1 : readUnresolvedInlineReferenceEnd(source, labelEnd);
|
|
3167
|
+
if (!image && unresolvedReferenceEnd !== -1) {
|
|
3168
|
+
const referenceLabel = source.slice(labelEnd + 2, unresolvedReferenceEnd);
|
|
3169
|
+
if (opener > cursor) {
|
|
3170
|
+
nodes.push(...parseInlineWithState(source.slice(cursor, opener), options, state, false));
|
|
3171
|
+
}
|
|
3172
|
+
nodes.push({ type: "text", value: "[" });
|
|
3173
|
+
nodes.push(...parseInlineWithState(label, options, state, false));
|
|
3174
|
+
nodes.push({ type: "text", value: "]" });
|
|
3175
|
+
if (!canTailBecomeReferenceLink(source, unresolvedReferenceEnd, referenceLabel, state)) {
|
|
3176
|
+
nodes.push({ type: "text", value: "[" });
|
|
3177
|
+
nodes.push(...parseInlineWithState(referenceLabel, options, state, false));
|
|
3178
|
+
nodes.push({ type: "text", value: "]" });
|
|
3179
|
+
cursor = unresolvedReferenceEnd + 1;
|
|
3180
|
+
} else {
|
|
3181
|
+
cursor = labelEnd + 1;
|
|
3182
|
+
}
|
|
3183
|
+
found = true;
|
|
3184
|
+
searchStart = unresolvedReferenceEnd + 1;
|
|
3185
|
+
continue;
|
|
3186
|
+
}
|
|
3187
|
+
searchStart = opener + 1;
|
|
3188
|
+
continue;
|
|
3189
|
+
}
|
|
3190
|
+
const title = inlineDestination?.title ?? referenceDestination?.title;
|
|
3191
|
+
const endIndex = inlineDestination?.endIndex ?? referenceDestination?.endIndex;
|
|
3192
|
+
if (endIndex === void 0) {
|
|
3193
|
+
searchStart = opener + 1;
|
|
3194
|
+
continue;
|
|
3195
|
+
}
|
|
3196
|
+
if (opener > cursor) {
|
|
3197
|
+
nodes.push(...parseInlineWithState(source.slice(cursor, opener), options, state, false));
|
|
3198
|
+
}
|
|
3199
|
+
if (image) {
|
|
3200
|
+
nodes.push({
|
|
3201
|
+
type: "image",
|
|
3202
|
+
alt: stripInlineMarkdown(label, options),
|
|
3203
|
+
src: normalizeHref(decodeStringContent(href)),
|
|
3204
|
+
title: title === void 0 ? void 0 : decodeStringContent(title)
|
|
3205
|
+
});
|
|
3206
|
+
} else {
|
|
3207
|
+
const normalizedHref = normalizeHref(decodeStringContent(href));
|
|
3208
|
+
nodes.push({
|
|
3209
|
+
type: "link",
|
|
3210
|
+
href: normalizedHref,
|
|
3211
|
+
title: title === void 0 ? void 0 : decodeStringContent(title),
|
|
3212
|
+
external: isExternalHref(normalizedHref),
|
|
3213
|
+
children: parseInlineWithState(label, options, state, false)
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
found = true;
|
|
3217
|
+
cursor = endIndex + 1;
|
|
3218
|
+
searchStart = cursor;
|
|
3219
|
+
}
|
|
3220
|
+
if (!found)
|
|
3221
|
+
return null;
|
|
3222
|
+
if (cursor < source.length) {
|
|
3223
|
+
nodes.push(...parseInlineWithState(source.slice(cursor), options, state, false));
|
|
3224
|
+
}
|
|
3225
|
+
return nodes;
|
|
3226
|
+
};
|
|
3227
|
+
var stripInlineMarkdown = (source, options = { autolinks: true }) => stripInlineNodes(parseInline(source, options));
|
|
3228
|
+
|
|
3229
|
+
// ../nizel/dist/parse/lines.js
|
|
3230
|
+
var expandLeadingTabsToLines = (markdown) => {
|
|
3231
|
+
return markdown.split("\n").map((line) => expandLeadingTabsInLine(line));
|
|
3232
|
+
};
|
|
3233
|
+
var expandLeadingTabsInLine = (line) => {
|
|
3234
|
+
let result = "";
|
|
3235
|
+
let column = 0;
|
|
3236
|
+
let cursor = 0;
|
|
3237
|
+
while (cursor < line.length) {
|
|
3238
|
+
const character = line[cursor];
|
|
3239
|
+
if (character === " ") {
|
|
3240
|
+
const spaces = 4 - column % 4;
|
|
3241
|
+
result += " ".repeat(spaces);
|
|
3242
|
+
column += spaces;
|
|
3243
|
+
cursor += 1;
|
|
3244
|
+
continue;
|
|
3245
|
+
}
|
|
3246
|
+
result += character;
|
|
3247
|
+
column += 1;
|
|
3248
|
+
cursor += 1;
|
|
3249
|
+
if (character !== " ")
|
|
3250
|
+
break;
|
|
3251
|
+
}
|
|
3252
|
+
return result + line.slice(cursor);
|
|
3253
|
+
};
|
|
3254
|
+
var expandLeadingTabsFromColumn = (line, startColumn) => {
|
|
3255
|
+
let result = "";
|
|
3256
|
+
let column = startColumn;
|
|
3257
|
+
let inLeadingIndent = true;
|
|
3258
|
+
for (const character of line) {
|
|
3259
|
+
if (character === " " && inLeadingIndent) {
|
|
3260
|
+
const spaces = 4 - column % 4;
|
|
3261
|
+
result += " ".repeat(spaces);
|
|
3262
|
+
column += spaces;
|
|
3263
|
+
continue;
|
|
3264
|
+
}
|
|
3265
|
+
result += character;
|
|
3266
|
+
column += 1;
|
|
3267
|
+
if (character !== " ")
|
|
3268
|
+
inLeadingIndent = false;
|
|
3269
|
+
}
|
|
3270
|
+
return result;
|
|
3271
|
+
};
|
|
3272
|
+
var nextNonBlankLine = (lines, startIndex) => {
|
|
3273
|
+
for (let index = startIndex; index < lines.length; index += 1) {
|
|
3274
|
+
if (lines[index].trim())
|
|
3275
|
+
return index;
|
|
3276
|
+
}
|
|
3277
|
+
return -1;
|
|
3278
|
+
};
|
|
3279
|
+
var countLeadingSpaces = (line) => {
|
|
3280
|
+
let count = 0;
|
|
3281
|
+
while (line[count] === " ") {
|
|
3282
|
+
count += 1;
|
|
3283
|
+
}
|
|
3284
|
+
return count;
|
|
3285
|
+
};
|
|
3286
|
+
var trimTrailingBlankLines = (lines) => {
|
|
3287
|
+
const result = [...lines];
|
|
3288
|
+
while (result.length > 0 && !result[result.length - 1].trim())
|
|
3289
|
+
result.pop();
|
|
3290
|
+
return result;
|
|
3291
|
+
};
|
|
3292
|
+
|
|
3293
|
+
// ../nizel/dist/parse/list-items.js
|
|
3294
|
+
var parseListItemBlocks = (firstLine, lines, index, openingListMarker, contentIndent, options, seenSlugs, state, parseBlocks2, isBlockStart2) => {
|
|
3295
|
+
const itemLines = [firstLine];
|
|
3296
|
+
let cursor = index + 1;
|
|
3297
|
+
let loose = false;
|
|
3298
|
+
let sawBlank = false;
|
|
3299
|
+
let openFence = openingFenceClosePattern(firstLine);
|
|
3300
|
+
while (cursor < lines.length) {
|
|
3301
|
+
const marker = parseListMarker(lines[cursor]);
|
|
3302
|
+
if (marker && marker.ordered === openingListMarker.ordered && isSameListMarker(openingListMarker, marker) && countLeadingSpaces(lines[cursor]) < contentIndent) {
|
|
3303
|
+
break;
|
|
3304
|
+
}
|
|
3305
|
+
if (!lines[cursor].trim()) {
|
|
3306
|
+
if (openFence) {
|
|
3307
|
+
itemLines.push("");
|
|
3308
|
+
cursor += 1;
|
|
3309
|
+
continue;
|
|
3310
|
+
}
|
|
3311
|
+
const nextContentIndex = nextNonBlankLine(lines, cursor + 1);
|
|
3312
|
+
if (nextContentIndex === -1)
|
|
3313
|
+
break;
|
|
3314
|
+
const nextMarker = parseListMarker(lines[nextContentIndex]);
|
|
3315
|
+
if (nextMarker && nextMarker.ordered === openingListMarker.ordered && isSameListMarker(openingListMarker, nextMarker) && countLeadingSpaces(lines[nextContentIndex]) < contentIndent) {
|
|
3316
|
+
itemLines.push("");
|
|
3317
|
+
loose = true;
|
|
3318
|
+
sawBlank = true;
|
|
3319
|
+
cursor += 1;
|
|
3320
|
+
continue;
|
|
3321
|
+
}
|
|
3322
|
+
if (cursor === index + 1 && firstLine === "")
|
|
3323
|
+
break;
|
|
3324
|
+
const nextIndent = countLeadingSpaces(lines[nextContentIndex]);
|
|
3325
|
+
if (nextIndent < contentIndent)
|
|
3326
|
+
break;
|
|
3327
|
+
itemLines.push("");
|
|
3328
|
+
loose = !hasNestedListMarkerBeforeBlank(itemLines, nextIndent - contentIndent);
|
|
3329
|
+
sawBlank = true;
|
|
3330
|
+
cursor += 1;
|
|
3331
|
+
continue;
|
|
3332
|
+
}
|
|
3333
|
+
if (countLeadingSpaces(lines[cursor]) >= contentIndent) {
|
|
3334
|
+
const itemLine = lines[cursor].slice(contentIndent);
|
|
3335
|
+
itemLines.push(itemLine);
|
|
3336
|
+
openFence = updateOpenFence(openFence, itemLine);
|
|
3337
|
+
cursor += 1;
|
|
3338
|
+
continue;
|
|
3339
|
+
}
|
|
3340
|
+
if (!sawBlank && !isBlockStart2(lines[cursor], options, lines, cursor)) {
|
|
3341
|
+
itemLines.push(lines[cursor]);
|
|
3342
|
+
openFence = updateOpenFence(openFence, lines[cursor]);
|
|
3343
|
+
cursor += 1;
|
|
3344
|
+
continue;
|
|
3345
|
+
}
|
|
3346
|
+
break;
|
|
3347
|
+
}
|
|
3348
|
+
while (itemLines.length > 0 && itemLines[itemLines.length - 1] === "") {
|
|
3349
|
+
itemLines.pop();
|
|
3350
|
+
}
|
|
3351
|
+
return {
|
|
3352
|
+
children: parseBlocks2(itemLines, options, seenSlugs, state),
|
|
3353
|
+
endIndex: cursor - 1,
|
|
3354
|
+
loose
|
|
3355
|
+
};
|
|
3356
|
+
};
|
|
3357
|
+
var hasNestedListMarkerBeforeBlank = (itemLines, relativeNextIndent) => {
|
|
3358
|
+
return itemLines.some((itemLine) => {
|
|
3359
|
+
const marker = parseListMarker(itemLine);
|
|
3360
|
+
return marker !== null && countLeadingSpaces(itemLine) < relativeNextIndent;
|
|
3361
|
+
});
|
|
3362
|
+
};
|
|
3363
|
+
var updateOpenFence = (openFence, line) => {
|
|
3364
|
+
if (openFence)
|
|
3365
|
+
return openFence.test(line) ? null : openFence;
|
|
3366
|
+
return openingFenceClosePattern(line);
|
|
3367
|
+
};
|
|
3368
|
+
|
|
3369
|
+
// ../nizel/dist/parse/references.js
|
|
3370
|
+
var extractReferenceDefinitions = (lines) => {
|
|
3371
|
+
const references = /* @__PURE__ */ new Map();
|
|
3372
|
+
const contentLines = [];
|
|
3373
|
+
let previousWasReference = false;
|
|
3374
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
3375
|
+
const htmlBlock = readHtmlBlock(lines, index);
|
|
3376
|
+
if (htmlBlock) {
|
|
3377
|
+
contentLines.push(...lines.slice(index, htmlBlock.endIndex + 1));
|
|
3378
|
+
index = htmlBlock.endIndex;
|
|
3379
|
+
previousWasReference = false;
|
|
3380
|
+
continue;
|
|
3381
|
+
}
|
|
3382
|
+
const fence = /^ {0,3}(`{3,}|~{3,})/.exec(lines[index]);
|
|
3383
|
+
if (fence) {
|
|
3384
|
+
const marker = fence[1][0];
|
|
3385
|
+
const close = new RegExp(`^ {0,3}\\${marker}{${fence[1].length},}\\s*$`);
|
|
3386
|
+
contentLines.push(lines[index]);
|
|
3387
|
+
index += 1;
|
|
3388
|
+
while (index < lines.length) {
|
|
3389
|
+
contentLines.push(lines[index]);
|
|
3390
|
+
if (close.test(lines[index]))
|
|
3391
|
+
break;
|
|
3392
|
+
index += 1;
|
|
3393
|
+
}
|
|
3394
|
+
previousWasReference = false;
|
|
3395
|
+
continue;
|
|
3396
|
+
}
|
|
3397
|
+
if (/^ {4}/.test(lines[index])) {
|
|
3398
|
+
contentLines.push(lines[index]);
|
|
3399
|
+
previousWasReference = false;
|
|
3400
|
+
continue;
|
|
3401
|
+
}
|
|
3402
|
+
const blockquoteReference = /^>\s?(.*)$/.exec(lines[index]);
|
|
3403
|
+
if (blockquoteReference) {
|
|
3404
|
+
const parsed2 = readReferenceDefinition([blockquoteReference[1]], 0);
|
|
3405
|
+
if (parsed2) {
|
|
3406
|
+
const label2 = normalizeReference(parsed2.label);
|
|
3407
|
+
if (!references.has(label2))
|
|
3408
|
+
references.set(label2, parsed2.reference);
|
|
3409
|
+
contentLines.push(">");
|
|
3410
|
+
previousWasReference = true;
|
|
3411
|
+
continue;
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
const canStartReference = index === 0 || !lines[index - 1].trim() || previousWasReference || isReferenceStartAfterBlock(lines[index - 1]);
|
|
3415
|
+
if (!canStartReference) {
|
|
3416
|
+
contentLines.push(lines[index]);
|
|
3417
|
+
previousWasReference = false;
|
|
3418
|
+
continue;
|
|
3419
|
+
}
|
|
3420
|
+
const parsed = readReferenceDefinition(lines, index);
|
|
3421
|
+
if (!parsed) {
|
|
3422
|
+
contentLines.push(lines[index]);
|
|
3423
|
+
previousWasReference = false;
|
|
3424
|
+
continue;
|
|
3425
|
+
}
|
|
3426
|
+
const label = normalizeReference(parsed.label);
|
|
3427
|
+
if (!references.has(label))
|
|
3428
|
+
references.set(label, parsed.reference);
|
|
3429
|
+
index = parsed.endIndex;
|
|
3430
|
+
previousWasReference = true;
|
|
3431
|
+
}
|
|
3432
|
+
return { contentLines, references };
|
|
3433
|
+
};
|
|
3434
|
+
var readReferenceDefinition = (lines, startIndex) => {
|
|
3435
|
+
const multiline = readMultilineReferenceDefinition(lines, startIndex);
|
|
3436
|
+
if (multiline)
|
|
3437
|
+
return multiline;
|
|
3438
|
+
const opener = /^ {0,3}\[((?:\\[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]|[^\[\]\n]){1,999})\]:[ \t]*(.*)$/.exec(lines[startIndex]);
|
|
3439
|
+
if (!opener)
|
|
3440
|
+
return null;
|
|
3441
|
+
const parts = [opener[2]];
|
|
3442
|
+
let cursor = startIndex + 1;
|
|
3443
|
+
while (cursor < lines.length && lines[cursor].trim() && canContinueReferenceDefinition(parts, lines[cursor])) {
|
|
3444
|
+
parts.push(lines[cursor]);
|
|
3445
|
+
cursor += 1;
|
|
3446
|
+
}
|
|
3447
|
+
const reference = parseReferenceDefinitionContent(parts.join("\n"));
|
|
3448
|
+
if (!reference)
|
|
3449
|
+
return null;
|
|
3450
|
+
return {
|
|
3451
|
+
label: decodeStringContent(opener[1]),
|
|
3452
|
+
reference,
|
|
3453
|
+
endIndex: cursor - 1
|
|
3454
|
+
};
|
|
3455
|
+
};
|
|
3456
|
+
var readMultilineReferenceDefinition = (lines, startIndex) => {
|
|
3457
|
+
const opener = /^ {0,3}\[((?:\\[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]|[^\[\]\n])*)$/.exec(lines[startIndex]);
|
|
3458
|
+
if (!opener)
|
|
3459
|
+
return null;
|
|
3460
|
+
const labelParts = [opener[1]];
|
|
3461
|
+
for (let cursor = startIndex + 1; cursor < lines.length; cursor += 1) {
|
|
3462
|
+
const closer = /^ {0,3}((?:\\[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]|[^\[\]\n])*)\]:[ \t]*(.*)$/.exec(lines[cursor]);
|
|
3463
|
+
if (!closer) {
|
|
3464
|
+
if (!lines[cursor].trim())
|
|
3465
|
+
return null;
|
|
3466
|
+
labelParts.push(lines[cursor]);
|
|
3467
|
+
continue;
|
|
3468
|
+
}
|
|
3469
|
+
const label = labelParts.concat(closer[1]).join("\n");
|
|
3470
|
+
if (!label.trim() || label.length > 999)
|
|
3471
|
+
return null;
|
|
3472
|
+
const parts = [closer[2]];
|
|
3473
|
+
let contentCursor = cursor + 1;
|
|
3474
|
+
while (contentCursor < lines.length && lines[contentCursor].trim() && canContinueReferenceDefinition(parts, lines[contentCursor])) {
|
|
3475
|
+
parts.push(lines[contentCursor]);
|
|
3476
|
+
contentCursor += 1;
|
|
3477
|
+
}
|
|
3478
|
+
const reference = parseReferenceDefinitionContent(parts.join("\n"));
|
|
3479
|
+
if (!reference)
|
|
3480
|
+
return null;
|
|
3481
|
+
return {
|
|
3482
|
+
label: decodeStringContent(label),
|
|
3483
|
+
reference,
|
|
3484
|
+
endIndex: contentCursor - 1
|
|
3485
|
+
};
|
|
3486
|
+
}
|
|
3487
|
+
return null;
|
|
3488
|
+
};
|
|
3489
|
+
var canContinueReferenceDefinition = (parts, line) => {
|
|
3490
|
+
const collected = parts.join("\n").trim();
|
|
3491
|
+
if (!collected)
|
|
3492
|
+
return true;
|
|
3493
|
+
if (/^ {1,}/.test(line))
|
|
3494
|
+
return true;
|
|
3495
|
+
if (hasOpenReferenceTitle(parts))
|
|
3496
|
+
return true;
|
|
3497
|
+
const parsed = parseReferenceDefinitionContent(collected);
|
|
3498
|
+
return parsed?.title === void 0 && /^["'(]/.test(line.trim()) && parseReferenceDefinitionContent(`${collected}
|
|
3499
|
+
${line}`) !== null;
|
|
3500
|
+
};
|
|
3501
|
+
var isReferenceStartAfterBlock = (line) => {
|
|
3502
|
+
return /^ {0,3}(#{1,6})(?:\s|$)/.test(line) || isThematicBreak2(line);
|
|
3503
|
+
};
|
|
3504
|
+
var parseReferenceDefinitionContent = (content) => {
|
|
3505
|
+
let rest = content.trim();
|
|
3506
|
+
if (!rest)
|
|
3507
|
+
return null;
|
|
3508
|
+
let destination = "";
|
|
3509
|
+
if (rest.startsWith("<")) {
|
|
3510
|
+
const closeIndex = rest.indexOf(">");
|
|
3511
|
+
if (closeIndex === -1)
|
|
3512
|
+
return null;
|
|
3513
|
+
destination = rest.slice(1, closeIndex);
|
|
3514
|
+
rest = rest.slice(closeIndex + 1);
|
|
3515
|
+
if (rest && !/^\s/.test(rest))
|
|
3516
|
+
return null;
|
|
3517
|
+
} else {
|
|
3518
|
+
const destinationMatch = /^\S+/.exec(rest);
|
|
3519
|
+
if (!destinationMatch)
|
|
3520
|
+
return null;
|
|
3521
|
+
destination = destinationMatch[0];
|
|
3522
|
+
rest = rest.slice(destination.length);
|
|
3523
|
+
}
|
|
3524
|
+
const title = parseReferenceTitle(rest);
|
|
3525
|
+
if (title === null)
|
|
3526
|
+
return null;
|
|
3527
|
+
return {
|
|
3528
|
+
href: normalizeHref(decodeStringContent(destination)),
|
|
3529
|
+
title: title === void 0 ? void 0 : decodeStringContent(title)
|
|
3530
|
+
};
|
|
3531
|
+
};
|
|
3532
|
+
var parseReferenceTitle = (source) => {
|
|
3533
|
+
const rest = source.trim();
|
|
3534
|
+
if (!rest)
|
|
3535
|
+
return void 0;
|
|
3536
|
+
const opener = rest[0];
|
|
3537
|
+
const closer = opener === "(" ? ")" : opener;
|
|
3538
|
+
if (!['"', "'", "("].includes(opener))
|
|
3539
|
+
return null;
|
|
3540
|
+
if (!rest.endsWith(closer))
|
|
3541
|
+
return null;
|
|
3542
|
+
return rest.slice(1, -1);
|
|
3543
|
+
};
|
|
3544
|
+
var hasOpenReferenceTitle = (parts) => {
|
|
3545
|
+
const content = parts.join("\n").trim();
|
|
3546
|
+
const destination = /^<?\S+>?/.exec(content);
|
|
3547
|
+
if (!destination)
|
|
3548
|
+
return false;
|
|
3549
|
+
const rest = content.slice(destination[0].length).trimStart();
|
|
3550
|
+
if (!rest)
|
|
3551
|
+
return false;
|
|
3552
|
+
const opener = rest[0];
|
|
3553
|
+
const closer = opener === "(" ? ")" : opener;
|
|
3554
|
+
return ['"', "'", "("].includes(opener) && (rest.length === 1 || !rest.endsWith(closer));
|
|
3555
|
+
};
|
|
3556
|
+
var isThematicBreak2 = (line) => {
|
|
3557
|
+
return /^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/.test(line);
|
|
3558
|
+
};
|
|
3559
|
+
|
|
3560
|
+
// ../nizel/dist/parse.js
|
|
3561
|
+
function parseMarkdown(markdown, options) {
|
|
3562
|
+
const normalizedMarkdown = markdown.includes("\r") ? markdown.replace(/\r\n?/g, "\n") : markdown;
|
|
3563
|
+
const lines = normalizedMarkdown.includes(" ") ? expandLeadingTabsToLines(normalizedMarkdown) : normalizedMarkdown.split("\n");
|
|
3564
|
+
const { contentLines, references } = normalizedMarkdown.includes("[") && hasPossibleReferenceDefinitionStart(normalizedMarkdown) ? extractReferenceDefinitions(lines) : { contentLines: lines, references: /* @__PURE__ */ new Map() };
|
|
3565
|
+
const children = parseBlocks(contentLines, options, /* @__PURE__ */ new Map(), { references });
|
|
3566
|
+
return { type: "root", children };
|
|
3567
|
+
}
|
|
3568
|
+
var hasPossibleReferenceDefinitionStart = (markdown) => {
|
|
3569
|
+
return /(^|\n)(?: {0,3}> ?| {0,3})\[/.test(markdown);
|
|
3570
|
+
};
|
|
3571
|
+
function parseBlocks(lines, options, seenSlugs, state) {
|
|
3572
|
+
const children = [];
|
|
3573
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
3574
|
+
const line = lines[index];
|
|
3575
|
+
if (!line.trim())
|
|
3576
|
+
continue;
|
|
3577
|
+
if (!options.safe) {
|
|
3578
|
+
const htmlBlock = readHtmlBlock(lines, index);
|
|
3579
|
+
if (htmlBlock) {
|
|
3580
|
+
children.push({ type: "html", value: htmlBlock.value });
|
|
3581
|
+
index = htmlBlock.endIndex;
|
|
3582
|
+
continue;
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
const customBlock = /^::([A-Za-z][\w-]*)(?:\s+(.*))?$/.exec(line.trim());
|
|
3586
|
+
if (customBlock) {
|
|
3587
|
+
const parsed = readCustomBlock(lines, index);
|
|
3588
|
+
const args = splitWords(customBlock[2] ?? "");
|
|
3589
|
+
const definition = options.blocks[customBlock[1]];
|
|
3590
|
+
const value = definition?.parse?.({
|
|
3591
|
+
name: customBlock[1],
|
|
3592
|
+
args,
|
|
3593
|
+
props: parsed.props,
|
|
3594
|
+
content: parsed.content
|
|
3595
|
+
});
|
|
3596
|
+
children.push({
|
|
3597
|
+
type: "customBlock",
|
|
3598
|
+
name: customBlock[1],
|
|
3599
|
+
args,
|
|
3600
|
+
props: parsed.props,
|
|
3601
|
+
value,
|
|
3602
|
+
children: parseBlocks(parsed.content.split("\n"), options, seenSlugs, state)
|
|
3603
|
+
});
|
|
3604
|
+
index = parsed.endIndex;
|
|
3605
|
+
continue;
|
|
3606
|
+
}
|
|
3607
|
+
const fence = /^( {0,3})(`{3,}|~{3,})[ \t]*(.*)$/.exec(line);
|
|
3608
|
+
if (fence) {
|
|
3609
|
+
const code = [];
|
|
3610
|
+
const indent = fence[1].length;
|
|
3611
|
+
const markerRun = fence[2];
|
|
3612
|
+
const marker = markerRun[0];
|
|
3613
|
+
const close = new RegExp(`^ {0,3}\\${marker}{${markerRun.length},}\\s*$`);
|
|
3614
|
+
const info = parseFenceInfo(fence[3] ?? "", marker);
|
|
3615
|
+
if (!info.valid) {
|
|
3616
|
+
} else {
|
|
3617
|
+
index += 1;
|
|
3618
|
+
while (index < lines.length && !close.test(lines[index])) {
|
|
3619
|
+
code.push(stripFenceIndent(lines[index], indent));
|
|
3620
|
+
index += 1;
|
|
3621
|
+
}
|
|
3622
|
+
if (index >= lines.length && code[code.length - 1] === "")
|
|
3623
|
+
code.pop();
|
|
3624
|
+
const metadata = parseCodeMeta(info.meta);
|
|
3625
|
+
children.push({
|
|
3626
|
+
type: "code",
|
|
3627
|
+
code: code.length > 0 ? `${code.join("\n")}
|
|
3628
|
+
` : "",
|
|
3629
|
+
lang: info.lang,
|
|
3630
|
+
meta: info.meta || void 0,
|
|
3631
|
+
filename: metadata.filename,
|
|
3632
|
+
highlightLines: metadata.highlightLines
|
|
3633
|
+
});
|
|
3634
|
+
continue;
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
if (/^ {4}/.test(line)) {
|
|
3638
|
+
const code = [];
|
|
3639
|
+
while (index < lines.length && (/^ {4}/.test(lines[index]) || !lines[index].trim())) {
|
|
3640
|
+
code.push(lines[index].replace(/^ {0,4}/, ""));
|
|
3641
|
+
index += 1;
|
|
3642
|
+
}
|
|
3643
|
+
index -= 1;
|
|
3644
|
+
const trimmedCode = trimTrailingBlankLines(code);
|
|
3645
|
+
children.push({ type: "code", code: trimmedCode.length > 0 ? `${trimmedCode.join("\n")}
|
|
3646
|
+
` : "" });
|
|
3647
|
+
continue;
|
|
3648
|
+
}
|
|
3649
|
+
if (isThematicBreak(line)) {
|
|
3650
|
+
children.push({ type: "thematicBreak" });
|
|
3651
|
+
continue;
|
|
3652
|
+
}
|
|
3653
|
+
const heading = /^ {0,3}(#{1,6})(?:\s+(.*?))?\s*$/.exec(line);
|
|
3654
|
+
if (heading) {
|
|
3655
|
+
const source = trimClosingHeadingHashes(heading[2] ?? "");
|
|
3656
|
+
const inlineChildren = parseInlineWithState(source, options, state);
|
|
3657
|
+
const text = stripInlineNodes(inlineChildren);
|
|
3658
|
+
const node = {
|
|
3659
|
+
type: "heading",
|
|
3660
|
+
depth: heading[1].length,
|
|
3661
|
+
text,
|
|
3662
|
+
children: inlineChildren
|
|
3663
|
+
};
|
|
3664
|
+
if (options.anchors && text)
|
|
3665
|
+
node.id = uniqueSlug(slugify(text, options.slugStyle), seenSlugs);
|
|
3666
|
+
children.push(node);
|
|
3667
|
+
continue;
|
|
3668
|
+
}
|
|
3669
|
+
const setext = lines[index + 1] && isSetextUnderline(lines[index + 1]);
|
|
3670
|
+
if (setext && line.trim() && !isBlockStart(line, options, lines, index)) {
|
|
3671
|
+
const source = line.trim();
|
|
3672
|
+
const inlineChildren = parseInlineWithState(source, options, state);
|
|
3673
|
+
const text = stripInlineNodes(inlineChildren);
|
|
3674
|
+
const node = {
|
|
3675
|
+
type: "heading",
|
|
3676
|
+
depth: setext[1][0] === "=" ? 1 : 2,
|
|
3677
|
+
text,
|
|
3678
|
+
children: inlineChildren
|
|
3679
|
+
};
|
|
3680
|
+
if (options.anchors && text)
|
|
3681
|
+
node.id = uniqueSlug(slugify(text, options.slugStyle), seenSlugs);
|
|
3682
|
+
children.push(node);
|
|
3683
|
+
index += 1;
|
|
3684
|
+
continue;
|
|
3685
|
+
}
|
|
3686
|
+
if (isTableStart(lines, index)) {
|
|
3687
|
+
const parsed = readTable(lines, index, options, parseInline);
|
|
3688
|
+
children.push(parsed.table);
|
|
3689
|
+
index = parsed.endIndex;
|
|
3690
|
+
continue;
|
|
3691
|
+
}
|
|
3692
|
+
if (/^ {0,3}> ?/.test(line)) {
|
|
3693
|
+
const quoteLines = [];
|
|
3694
|
+
let allowLazyContinuation = false;
|
|
3695
|
+
while (index < lines.length) {
|
|
3696
|
+
const quoteMarker = /^( {0,3}> ?)(.*)$/.exec(lines[index]);
|
|
3697
|
+
if (quoteMarker) {
|
|
3698
|
+
const markerColumn = quoteMarker[1].endsWith(" ") ? quoteMarker[1].length : quoteMarker[1].length + 1;
|
|
3699
|
+
const quoteLine = expandLeadingTabsFromColumn(quoteMarker[2], markerColumn);
|
|
3700
|
+
quoteLines.push(quoteLine);
|
|
3701
|
+
allowLazyContinuation = canStartLazyBlockquoteContinuation(quoteLine, options, quoteLines, quoteLines.length - 1, isBlockStart);
|
|
3702
|
+
index += 1;
|
|
3703
|
+
continue;
|
|
3704
|
+
}
|
|
3705
|
+
if (allowLazyContinuation && canContinueBlockquoteLazily(lines[index], options, lines, index)) {
|
|
3706
|
+
quoteLines.push(isSetextUnderline(lines[index]) ? `\\${lines[index]}` : lines[index]);
|
|
3707
|
+
allowLazyContinuation = true;
|
|
3708
|
+
index += 1;
|
|
3709
|
+
continue;
|
|
3710
|
+
}
|
|
3711
|
+
break;
|
|
3712
|
+
}
|
|
3713
|
+
if (quoteLines[quoteLines.length - 1] === "") {
|
|
3714
|
+
quoteLines.pop();
|
|
3715
|
+
}
|
|
3716
|
+
if (index > 0) {
|
|
3717
|
+
index -= 1;
|
|
3718
|
+
} else {
|
|
3719
|
+
index += 1;
|
|
3720
|
+
}
|
|
3721
|
+
children.push({
|
|
3722
|
+
type: "blockquote",
|
|
3723
|
+
children: parseBlocks(quoteLines, options, seenSlugs, state)
|
|
3724
|
+
});
|
|
3725
|
+
continue;
|
|
3726
|
+
}
|
|
3727
|
+
const openingListMarker = parseListMarker(line);
|
|
3728
|
+
if (openingListMarker) {
|
|
3729
|
+
const items = [];
|
|
3730
|
+
const ordered = openingListMarker.ordered;
|
|
3731
|
+
const start = openingListMarker.start;
|
|
3732
|
+
let tight = true;
|
|
3733
|
+
while (index < lines.length) {
|
|
3734
|
+
if (items.length > 0 && isThematicBreak(lines[index]))
|
|
3735
|
+
break;
|
|
3736
|
+
const marker = parseListMarker(lines[index]);
|
|
3737
|
+
if (!marker || marker.ordered !== ordered || !isSameListMarker(openingListMarker, marker)) {
|
|
3738
|
+
break;
|
|
3739
|
+
}
|
|
3740
|
+
const body = marker.body;
|
|
3741
|
+
const checked = /^\[[ xX]\]\s+/.test(body) ? /^\[[xX]\]\s+/.test(body) : void 0;
|
|
3742
|
+
const cleanBody = body.replace(/^\[[ xX]\]\s+/, "");
|
|
3743
|
+
const parsedItem = parseListItemBlocks(cleanBody, lines, index, openingListMarker, marker.contentIndent, options, seenSlugs, state, parseBlocks, isBlockStart);
|
|
3744
|
+
if (parsedItem.loose)
|
|
3745
|
+
tight = false;
|
|
3746
|
+
items.push({
|
|
3747
|
+
type: "listItem",
|
|
3748
|
+
checked,
|
|
3749
|
+
children: parsedItem.children
|
|
3750
|
+
});
|
|
3751
|
+
index = parsedItem.endIndex + 1;
|
|
3752
|
+
}
|
|
3753
|
+
index -= 1;
|
|
3754
|
+
children.push({ type: "list", ordered, start, tight, children: items });
|
|
3755
|
+
continue;
|
|
3756
|
+
}
|
|
3757
|
+
const paragraph = [normalizeParagraphLine(line)];
|
|
3758
|
+
while (index + 1 < lines.length && canContinueParagraph(lines[index + 1], lines, index + 1, options)) {
|
|
3759
|
+
index += 1;
|
|
3760
|
+
paragraph.push(normalizeParagraphLine(lines[index]));
|
|
3761
|
+
}
|
|
3762
|
+
const paragraphSetext = lines[index + 1] && isSetextUnderline(lines[index + 1]);
|
|
3763
|
+
if (paragraphSetext) {
|
|
3764
|
+
const source = normalizeParagraphSource(paragraph);
|
|
3765
|
+
const inlineChildren = parseInlineWithState(source, options, state);
|
|
3766
|
+
const text = stripInlineNodes(inlineChildren);
|
|
3767
|
+
const node = {
|
|
3768
|
+
type: "heading",
|
|
3769
|
+
depth: paragraphSetext[1][0] === "=" ? 1 : 2,
|
|
3770
|
+
text,
|
|
3771
|
+
children: inlineChildren
|
|
3772
|
+
};
|
|
3773
|
+
if (options.anchors && text)
|
|
3774
|
+
node.id = uniqueSlug(slugify(text, options.slugStyle), seenSlugs);
|
|
3775
|
+
children.push(node);
|
|
3776
|
+
index += 1;
|
|
3777
|
+
continue;
|
|
3778
|
+
}
|
|
3779
|
+
children.push({
|
|
3780
|
+
type: "paragraph",
|
|
3781
|
+
children: parseInlineWithState(normalizeParagraphSource(paragraph), options, state)
|
|
3782
|
+
});
|
|
3783
|
+
}
|
|
3784
|
+
return children;
|
|
3785
|
+
}
|
|
3786
|
+
function canContinueParagraph(line, lines, index, options) {
|
|
3787
|
+
if (!line.trim())
|
|
3788
|
+
return false;
|
|
3789
|
+
if (!hasParagraphInterruptCandidate(line, options))
|
|
3790
|
+
return true;
|
|
3791
|
+
return Boolean(!isSetextUnderline(line) && !isThematicBreak(line) && !/^(#{1,6})\s+/.test(line) && !/^ {0,3}(`{3,}|~{3,})/.test(line) && !/^::[A-Za-z][\w-]*/.test(line.trim()) && !isParagraphInterruptingListMarker(line) && !/^ {0,3}> ?/.test(line) && !(options.safe === false && isInterruptingHtmlBlockStart(line)) && !isTableStart(lines, index));
|
|
3792
|
+
}
|
|
3793
|
+
function hasParagraphInterruptCandidate(line, options) {
|
|
3794
|
+
const trimmedStart = line.trimStart();
|
|
3795
|
+
const first = trimmedStart[0];
|
|
3796
|
+
if (line.includes("|"))
|
|
3797
|
+
return true;
|
|
3798
|
+
if (options.safe === false && first === "<")
|
|
3799
|
+
return true;
|
|
3800
|
+
return first !== void 0 && "#`~:->*+=0123456789".includes(first);
|
|
3801
|
+
}
|
|
3802
|
+
function isBlockStart(line, options, lines, index) {
|
|
3803
|
+
return Boolean(/^ {0,3}(#{1,6})(?:\s|$)/.test(line) || /^ {0,3}(`{3,}|~{3,})/.test(line) || isThematicBreak(line) || /^ {0,3}> ?/.test(line) || parseListMarker(line) || isTableStart(lines, index) || !options.safe && isRawHtmlBlockLine(line));
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3806
|
+
// ../nizel/dist/render.js
|
|
3807
|
+
function renderHtml(ast, elements, blocks = {}, options = {}) {
|
|
3808
|
+
if (isEmptyObject(elements) && isEmptyObject(blocks) && options.unwrapStandaloneImages !== true) {
|
|
3809
|
+
return ast.children.map(renderBlockFast).join("\n");
|
|
3810
|
+
}
|
|
3811
|
+
return ast.children.map((node) => renderBlock(node, elements, blocks, options)).join("\n");
|
|
3812
|
+
}
|
|
3813
|
+
function isEmptyObject(value) {
|
|
3814
|
+
for (const _key in value)
|
|
3815
|
+
return false;
|
|
3816
|
+
return true;
|
|
3817
|
+
}
|
|
3818
|
+
function renderBlockFast(node) {
|
|
3819
|
+
if (node.type === "heading") {
|
|
3820
|
+
return wrap(`h${node.depth}`, renderInlineFast(node.children), { id: node.id });
|
|
3821
|
+
}
|
|
3822
|
+
if (node.type === "paragraph")
|
|
3823
|
+
return wrap("p", renderInlineFast(node.children));
|
|
3824
|
+
if (node.type === "code") {
|
|
3825
|
+
const code = wrap("code", escapeHtml(node.code), {
|
|
3826
|
+
class: node.lang ? `language-${node.lang}` : void 0,
|
|
3827
|
+
"data-filename": node.filename,
|
|
3828
|
+
"data-highlight-lines": node.highlightLines?.join(",")
|
|
3829
|
+
});
|
|
3830
|
+
return wrap("pre", code);
|
|
3831
|
+
}
|
|
3832
|
+
if (node.type === "list") {
|
|
3833
|
+
const tag = node.ordered ? "ol" : "ul";
|
|
3834
|
+
const items = node.children.map((item) => wrap("li", renderListItemChildrenFast(item.children, node.tight === true), { "data-checked": item.checked })).join("\n");
|
|
3835
|
+
return wrap(tag, `
|
|
3836
|
+
${items}
|
|
3837
|
+
`, { start: node.start !== void 0 && node.start !== 1 ? node.start : void 0 });
|
|
3838
|
+
}
|
|
3839
|
+
if (node.type === "blockquote") {
|
|
3840
|
+
const body = node.children.length > 0 ? `
|
|
3841
|
+
${node.children.map(renderBlockFast).join("\n")}
|
|
3842
|
+
` : "\n";
|
|
3843
|
+
return wrap("blockquote", body);
|
|
3844
|
+
}
|
|
3845
|
+
if (node.type === "table") {
|
|
3846
|
+
const [header, ...rows] = node.children;
|
|
3847
|
+
const head = header ? wrap("thead", wrap("tr", header.children.map((cell, index) => wrap("th", renderInlineFast(cell.children), tableCellAttrs(node.align?.[index]))).join(""))) : "";
|
|
3848
|
+
const body = wrap("tbody", rows.map((row) => wrap("tr", row.children.map((cell, index) => wrap("td", renderInlineFast(cell.children), tableCellAttrs(node.align?.[index]))).join(""))).join(""));
|
|
3849
|
+
return wrap("table", head + body);
|
|
3850
|
+
}
|
|
3851
|
+
if (node.type === "thematicBreak")
|
|
3852
|
+
return "<hr />";
|
|
3853
|
+
if (node.type === "html")
|
|
3854
|
+
return node.value;
|
|
3855
|
+
if (node.type === "customBlock") {
|
|
3856
|
+
return wrap("div", (node.children ?? []).map(renderBlockFast).join("\n"), { "data-nizel-block": node.name });
|
|
3857
|
+
}
|
|
3858
|
+
return "";
|
|
3859
|
+
}
|
|
3860
|
+
function renderBlock(node, elements, blocks, options) {
|
|
3861
|
+
if (node.type === "heading") {
|
|
3862
|
+
const tag = `h${node.depth}`;
|
|
3863
|
+
return wrap(resolveTag(tag, node, elements), renderInline(node.children, elements), {
|
|
3864
|
+
id: node.id,
|
|
3865
|
+
...attrsFor(tag, node, elements)
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3868
|
+
if (node.type === "paragraph") {
|
|
3869
|
+
if (options.unwrapStandaloneImages && isStandaloneImageParagraph(node.children)) {
|
|
3870
|
+
return renderInline(node.children, elements);
|
|
3871
|
+
}
|
|
3872
|
+
return wrap(resolveTag("p", node, elements), renderInline(node.children, elements), attrsFor("p", node, elements));
|
|
3873
|
+
}
|
|
3874
|
+
if (node.type === "code") {
|
|
3875
|
+
const renderer = blocks.code?.formats?.html;
|
|
3876
|
+
if (renderer) {
|
|
3877
|
+
return renderer(node, {
|
|
3878
|
+
render(nodes) {
|
|
3879
|
+
return Array.isArray(nodes) && nodes[0] && isInline2(nodes[0]) ? renderInline(nodes, elements) : nodes.map((child) => renderBlock(child, elements, blocks, options)).join("\n");
|
|
3880
|
+
},
|
|
3881
|
+
escape: escapeHtml
|
|
3882
|
+
});
|
|
3883
|
+
}
|
|
3884
|
+
const code = wrap(resolveTag("code", node, elements), escapeHtml(node.code), {
|
|
3885
|
+
class: node.lang ? `language-${node.lang}` : void 0,
|
|
3886
|
+
"data-filename": node.filename,
|
|
3887
|
+
"data-highlight-lines": node.highlightLines?.join(",")
|
|
3888
|
+
});
|
|
3889
|
+
return wrap(resolveTag("pre", node, elements), code, attrsFor("pre", node, elements));
|
|
3890
|
+
}
|
|
3891
|
+
if (node.type === "list") {
|
|
3892
|
+
const tag = node.ordered ? "ol" : "ul";
|
|
3893
|
+
const items = node.children.map((item) => wrap(resolveTag("li", item, elements), renderListItemChildren(item.children, node.tight === true, elements, blocks, options), {
|
|
3894
|
+
"data-checked": item.checked,
|
|
3895
|
+
...attrsFor("li", item, elements)
|
|
3896
|
+
})).join("\n");
|
|
3897
|
+
return wrap(resolveTag(tag, node, elements), `
|
|
3898
|
+
${items}
|
|
3899
|
+
`, {
|
|
3900
|
+
start: node.start !== void 0 && node.start !== 1 ? node.start : void 0,
|
|
3901
|
+
...attrsFor(tag, node, elements)
|
|
3902
|
+
});
|
|
3903
|
+
}
|
|
3904
|
+
if (node.type === "blockquote") {
|
|
3905
|
+
return wrap(resolveTag("blockquote", node, elements), node.children.length > 0 ? `
|
|
3906
|
+
${node.children.map((child) => renderBlock(child, elements, blocks, options)).join("\n")}
|
|
3907
|
+
` : "\n", attrsFor("blockquote", node, elements));
|
|
3908
|
+
}
|
|
3909
|
+
if (node.type === "table") {
|
|
3910
|
+
const [header, ...rows] = node.children;
|
|
3911
|
+
const head = header ? wrap(resolveTag("thead", header, elements), wrap(resolveTag("tr", header, elements), header.children.map((cell, index) => wrap(resolveTag("th", cell, elements), renderInline(cell.children, elements), tableCellAttrs(node.align?.[index]))).join(""))) : "";
|
|
3912
|
+
const body = wrap(resolveTag("tbody", node, elements), rows.map((row) => wrap(resolveTag("tr", row, elements), row.children.map((cell, index) => wrap(resolveTag("td", cell, elements), renderInline(cell.children, elements), tableCellAttrs(node.align?.[index]))).join(""))).join(""));
|
|
3913
|
+
return wrap(resolveTag("table", node, elements), head + body, attrsFor("table", node, elements));
|
|
3914
|
+
}
|
|
3915
|
+
if (node.type === "thematicBreak")
|
|
3916
|
+
return `<hr${serializeAttrs(attrsFor("hr", node, elements))} />`;
|
|
3917
|
+
if (node.type === "html")
|
|
3918
|
+
return node.value;
|
|
3919
|
+
if (node.type === "customBlock") {
|
|
3920
|
+
const renderer = blocks[node.name]?.formats?.html;
|
|
3921
|
+
if (renderer) {
|
|
3922
|
+
return renderer(node, {
|
|
3923
|
+
render(nodes) {
|
|
3924
|
+
return Array.isArray(nodes) && nodes[0] && isInline2(nodes[0]) ? renderInline(nodes, elements) : nodes.map((child) => renderBlock(child, elements, blocks, options)).join("\n");
|
|
3925
|
+
},
|
|
3926
|
+
escape: escapeHtml
|
|
3927
|
+
});
|
|
3928
|
+
}
|
|
3929
|
+
return wrap(resolveTag("div", node, elements), (node.children ?? []).map((child) => renderBlock(child, elements, blocks, options)).join("\n"), {
|
|
3930
|
+
"data-nizel-block": node.name,
|
|
3931
|
+
...attrsFor(node.name, node, elements)
|
|
3932
|
+
});
|
|
3933
|
+
}
|
|
3934
|
+
return "";
|
|
3935
|
+
}
|
|
3936
|
+
function isStandaloneImageParagraph(nodes) {
|
|
3937
|
+
return nodes.length === 1 && nodes[0].type === "image";
|
|
3938
|
+
}
|
|
3939
|
+
function renderListItemChildren(children, tight, elements, blocks, options) {
|
|
3940
|
+
if (children.length === 0)
|
|
3941
|
+
return "";
|
|
3942
|
+
if (!tight) {
|
|
3943
|
+
return `
|
|
3944
|
+
${children.map((child) => renderBlock(child, elements, blocks, options)).join("\n")}
|
|
3945
|
+
`;
|
|
3946
|
+
}
|
|
3947
|
+
const hasBlockChild = children.some((child) => child.type !== "paragraph");
|
|
3948
|
+
const body = children.map((child) => {
|
|
3949
|
+
if (child.type === "paragraph")
|
|
3950
|
+
return renderInline(child.children, elements);
|
|
3951
|
+
return renderBlock(child, elements, blocks, options);
|
|
3952
|
+
}).join("\n");
|
|
3953
|
+
if (!hasBlockChild)
|
|
3954
|
+
return body;
|
|
3955
|
+
if (children[children.length - 1]?.type === "paragraph")
|
|
3956
|
+
return `
|
|
3957
|
+
${body}`;
|
|
3958
|
+
return children[0]?.type === "paragraph" ? `${body}
|
|
3959
|
+
` : `
|
|
3960
|
+
${body}
|
|
3961
|
+
`;
|
|
3962
|
+
}
|
|
3963
|
+
function renderListItemChildrenFast(children, tight) {
|
|
3964
|
+
if (children.length === 0)
|
|
3965
|
+
return "";
|
|
3966
|
+
if (!tight) {
|
|
3967
|
+
return `
|
|
3968
|
+
${children.map(renderBlockFast).join("\n")}
|
|
3969
|
+
`;
|
|
3970
|
+
}
|
|
3971
|
+
const hasBlockChild = children.some((child) => child.type !== "paragraph");
|
|
3972
|
+
const body = children.map((child) => {
|
|
3973
|
+
if (child.type === "paragraph")
|
|
3974
|
+
return renderInlineFast(child.children);
|
|
3975
|
+
return renderBlockFast(child);
|
|
3976
|
+
}).join("\n");
|
|
3977
|
+
if (!hasBlockChild)
|
|
3978
|
+
return body;
|
|
3979
|
+
if (children[children.length - 1]?.type === "paragraph")
|
|
3980
|
+
return `
|
|
3981
|
+
${body}`;
|
|
3982
|
+
return children[0]?.type === "paragraph" ? `${body}
|
|
3983
|
+
` : `
|
|
3984
|
+
${body}
|
|
3985
|
+
`;
|
|
3986
|
+
}
|
|
3987
|
+
function renderInline(nodes, elements) {
|
|
3988
|
+
if (nodes.length === 0)
|
|
3989
|
+
return "";
|
|
3990
|
+
if (nodes.length === 1)
|
|
3991
|
+
return renderInlineNode(nodes[0], elements);
|
|
3992
|
+
return nodes.map((node) => renderInlineNode(node, elements)).join("");
|
|
3993
|
+
}
|
|
3994
|
+
function renderInlineNode(node, elements) {
|
|
3995
|
+
if (node.type === "text")
|
|
3996
|
+
return escapeHtml(node.value);
|
|
3997
|
+
if (node.type === "inlineHtml")
|
|
3998
|
+
return node.value;
|
|
3999
|
+
if (node.type === "lineBreak") {
|
|
4000
|
+
if (!node.hard)
|
|
4001
|
+
return "\n";
|
|
4002
|
+
const brAttrs = attrsFor("br", node, elements);
|
|
4003
|
+
return `<br${serializeAttrs(brAttrs)} />
|
|
4004
|
+
`;
|
|
4005
|
+
}
|
|
4006
|
+
if (node.type === "inlineCode") {
|
|
4007
|
+
return wrap(resolveTag("code", node, elements), escapeHtml(node.code), attrsFor("code", node, elements));
|
|
4008
|
+
}
|
|
4009
|
+
if (node.type === "strong") {
|
|
4010
|
+
return wrap(resolveTag("strong", node, elements), renderInline(node.children, elements), attrsFor("strong", node, elements));
|
|
4011
|
+
}
|
|
4012
|
+
if (node.type === "emphasis") {
|
|
4013
|
+
return wrap(resolveTag("em", node, elements), renderInline(node.children, elements), attrsFor("em", node, elements));
|
|
4014
|
+
}
|
|
4015
|
+
if (node.type === "delete") {
|
|
4016
|
+
return wrap(resolveTag("del", node, elements), renderInline(node.children, elements), attrsFor("del", node, elements));
|
|
4017
|
+
}
|
|
4018
|
+
if (node.type === "image") {
|
|
4019
|
+
return `<img${serializeAttrs({
|
|
4020
|
+
src: node.src,
|
|
4021
|
+
alt: node.alt ?? "",
|
|
4022
|
+
title: node.title,
|
|
4023
|
+
...attrsFor("img", node, elements)
|
|
4024
|
+
})} />`;
|
|
4025
|
+
}
|
|
4026
|
+
if (node.type === "link") {
|
|
4027
|
+
const href = node.href?.toLowerCase().trim().startsWith("javascript:") ? void 0 : node.href;
|
|
4028
|
+
return wrap(resolveTag("a", node, elements), renderInline(node.children, elements), {
|
|
4029
|
+
href,
|
|
4030
|
+
title: node.title,
|
|
4031
|
+
...attrsFor("a", node, elements)
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
return "";
|
|
4035
|
+
}
|
|
4036
|
+
function renderInlineFast(nodes) {
|
|
4037
|
+
if (nodes.length === 0)
|
|
4038
|
+
return "";
|
|
4039
|
+
if (nodes.length === 1)
|
|
4040
|
+
return renderInlineNodeFast(nodes[0]);
|
|
4041
|
+
return nodes.map(renderInlineNodeFast).join("");
|
|
4042
|
+
}
|
|
4043
|
+
function renderInlineNodeFast(node) {
|
|
4044
|
+
if (node.type === "text")
|
|
4045
|
+
return escapeHtml(node.value);
|
|
4046
|
+
if (node.type === "inlineHtml")
|
|
4047
|
+
return node.value;
|
|
4048
|
+
if (node.type === "lineBreak")
|
|
4049
|
+
return node.hard ? "<br />\n" : "\n";
|
|
4050
|
+
if (node.type === "inlineCode")
|
|
4051
|
+
return wrap("code", escapeHtml(node.code));
|
|
4052
|
+
if (node.type === "strong")
|
|
4053
|
+
return wrap("strong", renderInlineFast(node.children));
|
|
4054
|
+
if (node.type === "emphasis")
|
|
4055
|
+
return wrap("em", renderInlineFast(node.children));
|
|
4056
|
+
if (node.type === "delete")
|
|
4057
|
+
return wrap("del", renderInlineFast(node.children));
|
|
4058
|
+
if (node.type === "image") {
|
|
4059
|
+
return `<img${serializeAttrs({
|
|
4060
|
+
src: node.src,
|
|
4061
|
+
alt: node.alt ?? "",
|
|
4062
|
+
title: node.title
|
|
4063
|
+
})} />`;
|
|
4064
|
+
}
|
|
4065
|
+
if (node.type === "link") {
|
|
4066
|
+
const href = node.href?.toLowerCase().trim().startsWith("javascript:") ? void 0 : node.href;
|
|
4067
|
+
return wrap("a", renderInlineFast(node.children), {
|
|
4068
|
+
href,
|
|
4069
|
+
title: node.title
|
|
4070
|
+
});
|
|
4071
|
+
}
|
|
4072
|
+
return "";
|
|
4073
|
+
}
|
|
4074
|
+
function resolveTag(defaultTag, node, elements) {
|
|
4075
|
+
const rule = elements[defaultTag];
|
|
4076
|
+
if (!rule)
|
|
4077
|
+
return defaultTag;
|
|
4078
|
+
const descriptor = typeof rule === "function" ? rule(node) : rule;
|
|
4079
|
+
return descriptor?.tag ?? defaultTag;
|
|
4080
|
+
}
|
|
4081
|
+
function attrsFor(tag, node, elements) {
|
|
4082
|
+
const rule = elements[tag];
|
|
4083
|
+
if (!rule)
|
|
4084
|
+
return {};
|
|
4085
|
+
const descriptor = typeof rule === "function" ? rule(node) : rule;
|
|
4086
|
+
if (!descriptor)
|
|
4087
|
+
return {};
|
|
4088
|
+
const { tag: _t, class: _c, attr, attrs, ...rest } = descriptor;
|
|
4089
|
+
return { class: _c, ...attr ?? attrs, ...rest };
|
|
4090
|
+
}
|
|
4091
|
+
function tableCellAttrs(align) {
|
|
4092
|
+
return { align: align ?? void 0 };
|
|
4093
|
+
}
|
|
4094
|
+
function wrap(tag, content, attrs = {}) {
|
|
4095
|
+
return `<${tag}${serializeAttrs(attrs)}>${content}</${tag}>`;
|
|
4096
|
+
}
|
|
4097
|
+
function serializeAttrs(attrs) {
|
|
4098
|
+
let serialized = "";
|
|
4099
|
+
for (const key in attrs) {
|
|
4100
|
+
const value = attrs[key];
|
|
4101
|
+
if (value === void 0 || value === false)
|
|
4102
|
+
continue;
|
|
4103
|
+
if (isEventAttribute(key))
|
|
4104
|
+
continue;
|
|
4105
|
+
serialized += value === true ? ` ${key}` : ` ${key}="${escapeHtml(value)}"`;
|
|
4106
|
+
}
|
|
4107
|
+
return serialized;
|
|
4108
|
+
}
|
|
4109
|
+
function isEventAttribute(key) {
|
|
4110
|
+
return key.length > 2 && key[0].toLowerCase() === "o" && key[1].toLowerCase() === "n" && /^on[a-z]+$/i.test(key);
|
|
4111
|
+
}
|
|
4112
|
+
function isInline2(node) {
|
|
4113
|
+
return [
|
|
4114
|
+
"text",
|
|
4115
|
+
"emphasis",
|
|
4116
|
+
"strong",
|
|
4117
|
+
"delete",
|
|
4118
|
+
"lineBreak",
|
|
4119
|
+
"inlineCode",
|
|
4120
|
+
"link",
|
|
4121
|
+
"image",
|
|
4122
|
+
"inlineHtml"
|
|
4123
|
+
].includes(node.type);
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
// ../nizel/dist/template.js
|
|
4127
|
+
var renderTemplate = (markdown, data, options) => {
|
|
4128
|
+
const filters = options.filters ?? {};
|
|
4129
|
+
const missing = options.missing ?? "keep";
|
|
4130
|
+
const rawEnabled = options.raw ?? false;
|
|
4131
|
+
return markdown.replace(/\{\{\{\s*([^}]+)\s*\}\}\}|\{\{\s*([^}]+)\s*\}\}/g, (match, rawExpression, escapedExpression) => {
|
|
4132
|
+
const isRaw = rawExpression !== void 0;
|
|
4133
|
+
if (isRaw && !rawEnabled)
|
|
4134
|
+
return match;
|
|
4135
|
+
const expression = (rawExpression ?? escapedExpression).trim();
|
|
4136
|
+
const value = evaluateExpression(expression, data, filters);
|
|
4137
|
+
if (value === void 0) {
|
|
4138
|
+
if (missing === "error") {
|
|
4139
|
+
throw new Error(`Missing template value: ${expression}`);
|
|
4140
|
+
}
|
|
4141
|
+
return missing === "empty" ? "" : match;
|
|
4142
|
+
}
|
|
4143
|
+
const text = textFromUnknown(value);
|
|
4144
|
+
return isRaw ? text : escapeHtml(text);
|
|
4145
|
+
});
|
|
4146
|
+
};
|
|
4147
|
+
var evaluateExpression = (expression, data, filters) => {
|
|
4148
|
+
const [path, ...filterParts] = expression.split("|").map((part) => part.trim());
|
|
4149
|
+
let value = getPath(data, path);
|
|
4150
|
+
for (const part of filterParts) {
|
|
4151
|
+
const { name, args } = parseFilter(part);
|
|
4152
|
+
const filter = filters[name];
|
|
4153
|
+
if (!filter)
|
|
4154
|
+
continue;
|
|
4155
|
+
value = filter(textFromUnknown(value), ...args);
|
|
4156
|
+
}
|
|
4157
|
+
return value;
|
|
4158
|
+
};
|
|
4159
|
+
var parseFilter = (source) => {
|
|
4160
|
+
const call = /^([A-Za-z0-9_-]+)\((.*)\)$/.exec(source);
|
|
4161
|
+
if (!call)
|
|
4162
|
+
return { name: source, args: [] };
|
|
4163
|
+
return {
|
|
4164
|
+
name: call[1],
|
|
4165
|
+
args: splitArgs(call[2]).map((arg) => {
|
|
4166
|
+
const trimmed = arg.trim();
|
|
4167
|
+
if (/^['"].*['"]$/.test(trimmed))
|
|
4168
|
+
return trimmed.slice(1, -1);
|
|
4169
|
+
if (/^-?\d+(\.\d+)?$/.test(trimmed))
|
|
4170
|
+
return Number(trimmed);
|
|
4171
|
+
return trimmed;
|
|
4172
|
+
})
|
|
4173
|
+
};
|
|
4174
|
+
};
|
|
4175
|
+
var splitArgs = (source) => {
|
|
4176
|
+
if (!source.trim())
|
|
4177
|
+
return [];
|
|
4178
|
+
const args = [];
|
|
4179
|
+
let current = "";
|
|
4180
|
+
let quote;
|
|
4181
|
+
for (const char of source) {
|
|
4182
|
+
if ((char === '"' || char === "'") && !quote) {
|
|
4183
|
+
quote = char;
|
|
4184
|
+
} else if (char === quote) {
|
|
4185
|
+
quote = void 0;
|
|
4186
|
+
}
|
|
4187
|
+
if (char === "," && !quote) {
|
|
4188
|
+
args.push(current);
|
|
4189
|
+
current = "";
|
|
4190
|
+
continue;
|
|
4191
|
+
}
|
|
4192
|
+
current += char;
|
|
4193
|
+
}
|
|
4194
|
+
args.push(current);
|
|
4195
|
+
return args;
|
|
4196
|
+
};
|
|
4197
|
+
|
|
4198
|
+
// ../nizel/dist/use-nizel.js
|
|
4199
|
+
function createNizel(options = {}) {
|
|
4200
|
+
const presetOptions = options.preset ? resolvePreset(options.preset) : {};
|
|
4201
|
+
const effectiveOptions = { ...presetOptions, ...options, preset: void 0 };
|
|
4202
|
+
const baseResolved = resolveOptions(effectiveOptions, {});
|
|
4203
|
+
async function process(markdown, runtimeOptions = {}) {
|
|
4204
|
+
const { ast, meta, resolved } = prepareMarkdown(markdown, runtimeOptions);
|
|
4205
|
+
const collected = collect(ast);
|
|
4206
|
+
const finalHtml = renderPreparedHtml(ast, resolved);
|
|
4207
|
+
const output = resolved.output ?? "html";
|
|
4208
|
+
const result = output === "text" ? collected.text : output === "ast" ? ast : finalHtml;
|
|
4209
|
+
return {
|
|
4210
|
+
result,
|
|
4211
|
+
html: finalHtml,
|
|
4212
|
+
text: collected.text,
|
|
4213
|
+
ast,
|
|
4214
|
+
meta,
|
|
4215
|
+
frontmatter: meta,
|
|
4216
|
+
title: stringMeta(meta.title) ?? collected.headings[0]?.text,
|
|
4217
|
+
description: stringMeta(meta.description),
|
|
4218
|
+
excerpt: collected.excerpt,
|
|
4219
|
+
toc: resolved.toc === false ? [] : collected.headings,
|
|
4220
|
+
headings: collected.headings,
|
|
4221
|
+
links: collected.links,
|
|
4222
|
+
images: collected.images,
|
|
4223
|
+
readingTime: collected.readingTime
|
|
4224
|
+
};
|
|
4225
|
+
}
|
|
4226
|
+
const nizel = process;
|
|
4227
|
+
nizel.html = async (markdown, runtimeOptions) => {
|
|
4228
|
+
const { ast, resolved } = prepareMarkdown(markdown, runtimeOptions);
|
|
4229
|
+
return renderPreparedHtml(ast, resolved);
|
|
4230
|
+
};
|
|
4231
|
+
nizel.text = async (markdown, runtimeOptions) => {
|
|
4232
|
+
const { ast } = prepareMarkdown(markdown, runtimeOptions);
|
|
4233
|
+
return collect(ast).text;
|
|
4234
|
+
};
|
|
4235
|
+
nizel.ast = async (markdown, runtimeOptions) => {
|
|
4236
|
+
return prepareMarkdown(markdown, runtimeOptions).ast;
|
|
4237
|
+
};
|
|
4238
|
+
nizel.meta = async (markdown, runtimeOptions) => {
|
|
4239
|
+
return prepareMeta(markdown, runtimeOptions).meta;
|
|
4240
|
+
};
|
|
4241
|
+
nizel.preset = (name) => createNizel(resolvePreset(name));
|
|
4242
|
+
nizel.parse = async (markdown, runtimeOptions) => {
|
|
4243
|
+
const resolved = resolveRuntime(runtimeOptions);
|
|
4244
|
+
const extracted = resolved.frontmatter === false ? { markdown, frontmatter: {} } : extractFrontmatter(markdown);
|
|
4245
|
+
let preparedMarkdown = extracted.markdown;
|
|
4246
|
+
for (const plugin of resolved.plugins ?? []) {
|
|
4247
|
+
const next = plugin.hooks?.beforeParse?.(preparedMarkdown, resolved);
|
|
4248
|
+
if (next !== void 0)
|
|
4249
|
+
preparedMarkdown = next;
|
|
4250
|
+
}
|
|
4251
|
+
return parseMarkdown(preparedMarkdown, {
|
|
4252
|
+
anchors: resolved.anchors !== false,
|
|
4253
|
+
autolinks: resolved.autolinks,
|
|
4254
|
+
blocks: resolved.blocks ?? {},
|
|
4255
|
+
safe: resolved.safe !== false,
|
|
4256
|
+
slugStyle: resolved.slugStyle
|
|
4257
|
+
});
|
|
4258
|
+
};
|
|
4259
|
+
nizel.render = (ast, runtimeOptions) => {
|
|
4260
|
+
const resolved = resolveRuntime(runtimeOptions);
|
|
4261
|
+
return renderHtml(ast, withAutolinkElements(resolved.elements ?? {}, resolved.autolinks), resolved.blocks ?? {}, {
|
|
4262
|
+
unwrapStandaloneImages: resolved.unwrapStandaloneImages === true
|
|
4263
|
+
});
|
|
4264
|
+
};
|
|
4265
|
+
return nizel;
|
|
4266
|
+
function prepareMarkdown(markdown, runtimeOptions = {}) {
|
|
4267
|
+
const preparedMeta = prepareMeta(markdown, runtimeOptions);
|
|
4268
|
+
let preparedMarkdown = preparedMeta.markdown;
|
|
4269
|
+
for (const plugin of preparedMeta.resolved.plugins ?? []) {
|
|
4270
|
+
const nextMarkdown = plugin.hooks?.beforeParse?.(preparedMarkdown, preparedMeta.resolved);
|
|
4271
|
+
if (nextMarkdown !== void 0) {
|
|
4272
|
+
preparedMarkdown = nextMarkdown;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
let ast = parseMarkdown(preparedMarkdown, {
|
|
4276
|
+
anchors: preparedMeta.resolved.anchors !== false,
|
|
4277
|
+
autolinks: preparedMeta.resolved.autolinks,
|
|
4278
|
+
blocks: preparedMeta.resolved.blocks ?? {},
|
|
4279
|
+
safe: preparedMeta.resolved.safe !== false,
|
|
4280
|
+
slugStyle: preparedMeta.resolved.slugStyle
|
|
4281
|
+
});
|
|
4282
|
+
for (const plugin of preparedMeta.resolved.plugins ?? []) {
|
|
4283
|
+
const afterResult = plugin.hooks?.afterParse?.(ast, preparedMeta.resolved);
|
|
4284
|
+
if (afterResult)
|
|
4285
|
+
ast = afterResult;
|
|
4286
|
+
}
|
|
4287
|
+
for (const transform of preparedMeta.resolved.transforms ?? []) {
|
|
4288
|
+
const transformResult = transform(ast);
|
|
4289
|
+
if (transformResult)
|
|
4290
|
+
ast = transformResult;
|
|
4291
|
+
}
|
|
4292
|
+
return {
|
|
4293
|
+
ast,
|
|
4294
|
+
meta: preparedMeta.meta,
|
|
4295
|
+
resolved: preparedMeta.resolved
|
|
4296
|
+
};
|
|
4297
|
+
}
|
|
4298
|
+
function prepareMeta(markdown, runtimeOptions = {}) {
|
|
4299
|
+
const resolved = resolvePreparedRuntime(runtimeOptions);
|
|
4300
|
+
const extracted = resolved.frontmatter === false ? { markdown, frontmatter: {} } : extractFrontmatter(markdown);
|
|
4301
|
+
let meta = {
|
|
4302
|
+
...extracted.frontmatter,
|
|
4303
|
+
...resolved.meta
|
|
4304
|
+
};
|
|
4305
|
+
let data = {
|
|
4306
|
+
...meta,
|
|
4307
|
+
...resolved.data ?? {},
|
|
4308
|
+
meta,
|
|
4309
|
+
frontmatter: extracted.frontmatter
|
|
4310
|
+
};
|
|
4311
|
+
if (resolved.template !== false) {
|
|
4312
|
+
meta = renderObjectTemplates(meta, data, resolved.template);
|
|
4313
|
+
data = {
|
|
4314
|
+
...meta,
|
|
4315
|
+
...resolved.data ?? {},
|
|
4316
|
+
meta,
|
|
4317
|
+
frontmatter: meta
|
|
4318
|
+
};
|
|
4319
|
+
}
|
|
4320
|
+
const templated = resolved.template === false || !hasTemplateSyntax(extracted.markdown) ? extracted.markdown : renderTemplate(extracted.markdown, data, resolved.template);
|
|
4321
|
+
return {
|
|
4322
|
+
markdown: templated,
|
|
4323
|
+
meta,
|
|
4324
|
+
resolved
|
|
4325
|
+
};
|
|
4326
|
+
}
|
|
4327
|
+
function resolveRuntime(runtimeOptions) {
|
|
4328
|
+
return hasRuntimeOptions(runtimeOptions) ? resolveOptions(effectiveOptions, runtimeOptions) : baseResolved;
|
|
4329
|
+
}
|
|
4330
|
+
function resolvePreparedRuntime(runtimeOptions) {
|
|
4331
|
+
const resolved = resolveRuntime(runtimeOptions);
|
|
4332
|
+
return {
|
|
4333
|
+
...resolved,
|
|
4334
|
+
data: { ...resolved.variables ?? {}, ...resolved.data ?? {} }
|
|
4335
|
+
};
|
|
4336
|
+
}
|
|
4337
|
+
}
|
|
4338
|
+
function renderPreparedHtml(ast, resolved) {
|
|
4339
|
+
const html = renderHtml(ast, withAutolinkElements(resolved.elements ?? {}, resolved.autolinks), resolved.blocks ?? {}, {
|
|
4340
|
+
unwrapStandaloneImages: resolved.unwrapStandaloneImages === true
|
|
4341
|
+
});
|
|
4342
|
+
let finalHtml = html;
|
|
4343
|
+
for (const plugin of resolved.plugins ?? []) {
|
|
4344
|
+
const modified = plugin.hooks?.afterRender?.(finalHtml, resolved);
|
|
4345
|
+
if (modified !== void 0)
|
|
4346
|
+
finalHtml = modified;
|
|
4347
|
+
}
|
|
4348
|
+
return finalHtml;
|
|
4349
|
+
}
|
|
4350
|
+
function renderObjectTemplates(object, data, options) {
|
|
4351
|
+
return Object.fromEntries(Object.entries(object).map(([key, value]) => [
|
|
4352
|
+
key,
|
|
4353
|
+
typeof value === "string" && hasTemplateSyntax(value) ? renderTemplate(value, data, options) : value
|
|
4354
|
+
]));
|
|
4355
|
+
}
|
|
4356
|
+
function hasTemplateSyntax(value) {
|
|
4357
|
+
return value.includes("{{");
|
|
4358
|
+
}
|
|
4359
|
+
function hasRuntimeOptions(runtimeOptions) {
|
|
4360
|
+
return Boolean(runtimeOptions && Object.keys(runtimeOptions).length > 0);
|
|
4361
|
+
}
|
|
4362
|
+
var useNizel = createNizel;
|
|
4363
|
+
useNizel.preset = (name) => createNizel(resolvePreset(name));
|
|
4364
|
+
function stringMeta(value) {
|
|
4365
|
+
return typeof value === "string" ? value : void 0;
|
|
4366
|
+
}
|
|
4367
|
+
function resolvePreset(name) {
|
|
4368
|
+
if (name === "minimal") {
|
|
4369
|
+
return { frontmatter: false, template: false, toc: false, anchors: false, autolinks: false };
|
|
4370
|
+
}
|
|
4371
|
+
if (name === "blog") {
|
|
4372
|
+
return {
|
|
4373
|
+
frontmatter: true,
|
|
4374
|
+
toc: true,
|
|
4375
|
+
anchors: true,
|
|
4376
|
+
elements: {
|
|
4377
|
+
time: { class: "nizel-date" }
|
|
4378
|
+
}
|
|
4379
|
+
};
|
|
4380
|
+
}
|
|
4381
|
+
if (name === "email") {
|
|
4382
|
+
return {
|
|
4383
|
+
safe: true,
|
|
4384
|
+
anchors: false,
|
|
4385
|
+
autolinks: { enabled: true },
|
|
4386
|
+
elements: {
|
|
4387
|
+
a: { attr: { target: void 0, rel: void 0 } },
|
|
4388
|
+
table: { attr: { role: "presentation", cellpadding: "0", cellspacing: "0", border: "0" } }
|
|
4389
|
+
}
|
|
4390
|
+
};
|
|
4391
|
+
}
|
|
4392
|
+
if (name === "docs") {
|
|
4393
|
+
return {
|
|
4394
|
+
toc: true,
|
|
4395
|
+
anchors: true,
|
|
4396
|
+
elements: {
|
|
4397
|
+
h2: { class: "nizel-docs-heading" },
|
|
4398
|
+
code: { class: "nizel-code" }
|
|
4399
|
+
}
|
|
4400
|
+
};
|
|
4401
|
+
}
|
|
4402
|
+
return {};
|
|
4403
|
+
}
|
|
4404
|
+
function withAutolinkElements(elements, autolinks) {
|
|
4405
|
+
if (!autolinks || typeof autolinks !== "object" || !autolinks.target && !autolinks.rel) {
|
|
4406
|
+
return elements;
|
|
4407
|
+
}
|
|
4408
|
+
const existing = elements.a;
|
|
4409
|
+
return {
|
|
4410
|
+
...elements,
|
|
4411
|
+
a(node) {
|
|
4412
|
+
const base = typeof existing === "function" ? existing(node) : existing;
|
|
4413
|
+
return {
|
|
4414
|
+
...base,
|
|
4415
|
+
attrs: {
|
|
4416
|
+
target: autolinks.target,
|
|
4417
|
+
rel: autolinks.rel,
|
|
4418
|
+
...base?.attrs
|
|
4419
|
+
}
|
|
4420
|
+
};
|
|
4421
|
+
}
|
|
4422
|
+
};
|
|
4423
|
+
}
|
|
4424
|
+
|
|
4425
|
+
// ../nizel/dist/html-to-markdown.js
|
|
4426
|
+
var htmlChildElements = (node) => node.type === "element" || node.type === "root" ? node.children.filter((child) => child.type === "element") : [];
|
|
4427
|
+
var findHtmlElement = (node, predicate) => htmlChildElements(node).find(predicate);
|
|
4428
|
+
var hasHtmlClass = (node, className) => node.type === "element" && (node.attrs.class ?? "").split(/\s+/).includes(className);
|
|
4429
|
+
|
|
4430
|
+
// src/index.ts
|
|
28
4431
|
var ALERT_TYPES = ["note", "tip", "important", "warning", "caution"];
|
|
29
4432
|
var alertPlugin = (options = {}) => {
|
|
30
4433
|
const blocks = Object.fromEntries(
|
|
@@ -35,7 +4438,23 @@ var NizelAlert = (() => {
|
|
|
35
4438
|
blocks,
|
|
36
4439
|
hooks: {
|
|
37
4440
|
beforeParse: transformGitHubAlerts
|
|
38
|
-
}
|
|
4441
|
+
},
|
|
4442
|
+
htmlToMarkdown: alertToMarkdown(options)
|
|
4443
|
+
};
|
|
4444
|
+
};
|
|
4445
|
+
var alertToMarkdown = (options = {}) => {
|
|
4446
|
+
const rootClass = options.className ?? "alert";
|
|
4447
|
+
return (node, ctx) => {
|
|
4448
|
+
if (node.type !== "element" || node.tag !== "div") return void 0;
|
|
4449
|
+
const type = node.attrs["data-alert"];
|
|
4450
|
+
if (!type) return void 0;
|
|
4451
|
+
const titleEl = findHtmlElement(node, (el) => el.tag === "p" && hasHtmlClass(el, `${rootClass}__title`));
|
|
4452
|
+
const contentEl = findHtmlElement(node, (el) => hasHtmlClass(el, `${rootClass}__content`));
|
|
4453
|
+
const title = titleEl ? ctx.text(titleEl).trim() : "";
|
|
4454
|
+
const body = contentEl ? ctx.block(contentEl) : "";
|
|
4455
|
+
return `${title ? `::${type} ${title}` : `::${type}`}
|
|
4456
|
+
${body}
|
|
4457
|
+
::`;
|
|
39
4458
|
};
|
|
40
4459
|
};
|
|
41
4460
|
var transformGitHubAlerts = (markdown) => {
|