markloom 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PACKAGES.md +26 -0
- package/README.md +20 -2
- package/collab.md +60 -13
- package/dist/ai/index.cjs +5 -4
- package/dist/ai/index.d.cts +5 -4
- package/dist/ai/index.d.ts +5 -4
- package/dist/ai/index.js +4 -3
- package/dist/ai/theme.css +66 -102
- package/dist/{chunk-ZMTLSFLO.js → chunk-4Q7PAR2T.js} +5746 -1341
- package/dist/chunk-75EJ4ARB.cjs +642 -0
- package/dist/{chunk-JS527FDV.cjs → chunk-BMPCVT3B.cjs} +47 -39
- package/dist/{chunk-RLTHVQNQ.js → chunk-EFYT2223.js} +47 -39
- package/dist/chunk-HXABDVLZ.cjs +297 -0
- package/dist/{chunk-YIFOGP2D.cjs → chunk-I2LDEVLA.cjs} +499 -102
- package/dist/chunk-MQLRZQZL.js +642 -0
- package/dist/chunk-OVHASRID.cjs +4279 -0
- package/dist/chunk-PCSVBPOR.cjs +40 -0
- package/dist/{chunk-FCH7LZFI.js → chunk-PSAXWBNM.js} +450 -53
- package/dist/chunk-PZRWTLLB.cjs +858 -0
- package/dist/chunk-QO7JEZDB.js +4279 -0
- package/dist/chunk-WSJUXPAG.js +40 -0
- package/dist/{chunk-VXM7Q6P5.cjs → chunk-Y4IXQFWL.cjs} +6026 -1621
- package/dist/chunk-YLVSMDIO.js +858 -0
- package/dist/chunk-ZL6WT6OY.js +297 -0
- package/dist/client-BvvyHjhh.d.ts +250 -0
- package/dist/client-Ciy7Fa_k.d.cts +250 -0
- package/dist/collab/index.cjs +17 -4
- package/dist/collab/index.d.cts +18 -7
- package/dist/collab/index.d.ts +18 -7
- package/dist/collab/index.js +19 -6
- package/dist/{controller-DQITsFhy.d.cts → controller-CHznEhAR.d.cts} +277 -26
- package/dist/{controller-BNuuUM3E.d.ts → controller-DLqI8_jm.d.ts} +277 -26
- package/dist/index.cjs +119 -7
- package/dist/index.d.cts +138 -6
- package/dist/index.d.ts +138 -6
- package/dist/index.js +130 -18
- package/dist/io/index.cjs +1412 -0
- package/dist/io/index.d.cts +33 -0
- package/dist/io/index.d.ts +33 -0
- package/dist/io/index.js +1412 -0
- package/dist/react/index.cjs +9 -8
- package/dist/react/index.d.cts +5 -4
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +8 -7
- package/dist/{rebase-batch-8rL_aXEE.d.ts → rebase-batch-CSnv8FKp.d.ts} +11 -9
- package/dist/{rebase-batch-bYnBJpRO.d.cts → rebase-batch-DO1ygkx9.d.cts} +11 -9
- package/dist/types-BkHlmUFL.d.cts +34 -0
- package/dist/types-BkHlmUFL.d.ts +34 -0
- package/dist/versions-DNFf8zVz.d.cts +51 -0
- package/dist/versions-DOkOyh2J.d.ts +51 -0
- package/dist/view/index.cjs +259 -17
- package/dist/view/index.d.cts +277 -12
- package/dist/view/index.d.ts +277 -12
- package/dist/view/index.js +256 -14
- package/dist/view/theme.css +2093 -1577
- package/dist/word-count-BPw9G2Bg.d.ts +130 -0
- package/dist/word-count-DNLn1h_t.d.cts +130 -0
- package/io.md +38 -0
- package/package.json +25 -4
- package/dist/chunk-4JSJAHTB.js +0 -255
- package/dist/chunk-4TMHVNL6.cjs +0 -2297
- package/dist/chunk-ALZ3A5CS.cjs +0 -255
- package/dist/chunk-GQ2HHRGI.cjs +0 -16
- package/dist/chunk-LA5SBCGQ.js +0 -16
- package/dist/chunk-LEYAQNJA.js +0 -220
- package/dist/chunk-MFYF2A6U.js +0 -2297
- package/dist/chunk-YXQDCW4Y.cjs +0 -220
- package/dist/client-6KiH4kGK.d.ts +0 -144
- package/dist/client-ZRZj2nkq.d.cts +0 -144
- package/dist/comments-DlExS6f-.d.cts +0 -43
- package/dist/comments-PhnR7Gkn.d.ts +0 -43
- package/dist/step-BrvHIK7O.d.cts +0 -65
- package/dist/step-BrvHIK7O.d.ts +0 -65
|
@@ -0,0 +1,858 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkTable,
|
|
3
|
+
validateAll
|
|
4
|
+
} from "./chunk-QO7JEZDB.js";
|
|
5
|
+
import {
|
|
6
|
+
mapSelectionThrough,
|
|
7
|
+
rebaseStepsThrough
|
|
8
|
+
} from "./chunk-EFYT2223.js";
|
|
9
|
+
import {
|
|
10
|
+
apply,
|
|
11
|
+
applyAll,
|
|
12
|
+
invertAll,
|
|
13
|
+
nodeAt
|
|
14
|
+
} from "./chunk-ZL6WT6OY.js";
|
|
15
|
+
import {
|
|
16
|
+
footnoteKey,
|
|
17
|
+
isElement,
|
|
18
|
+
isFootnoteDef,
|
|
19
|
+
isInlineAtom,
|
|
20
|
+
isText
|
|
21
|
+
} from "./chunk-WSJUXPAG.js";
|
|
22
|
+
|
|
23
|
+
// src/tree/history.ts
|
|
24
|
+
function init(doc, validate) {
|
|
25
|
+
return { doc, past: [], future: [], validate };
|
|
26
|
+
}
|
|
27
|
+
function gate(h, next) {
|
|
28
|
+
const v = h.validate?.(next);
|
|
29
|
+
if (v)
|
|
30
|
+
throw new Error(`[invariant] \u63D0\u4EA4\u4EA7\u751F\u975E\u6CD5 doc: ${v}`);
|
|
31
|
+
}
|
|
32
|
+
function commit(h, steps, before, after) {
|
|
33
|
+
if (steps.length === 0)
|
|
34
|
+
return h;
|
|
35
|
+
const inverse = invertAll(h.doc, steps);
|
|
36
|
+
const next = applyAll(h.doc, steps);
|
|
37
|
+
gate(h, next);
|
|
38
|
+
const entry = { steps, inverse };
|
|
39
|
+
if (before)
|
|
40
|
+
entry.before = before;
|
|
41
|
+
if (after)
|
|
42
|
+
entry.after = after;
|
|
43
|
+
return { ...h, doc: next, past: h.past.concat(entry), future: [] };
|
|
44
|
+
}
|
|
45
|
+
function applyForeign(h, steps, thisSite = 0, foreignSite = 1) {
|
|
46
|
+
if (steps.length === 0)
|
|
47
|
+
return h;
|
|
48
|
+
const next = applyAll(h.doc, steps);
|
|
49
|
+
gate(h, next);
|
|
50
|
+
const overs = [{ siteId: foreignSite, steps }];
|
|
51
|
+
const mapCommit = (c) => {
|
|
52
|
+
const fwd = rebaseStepsThrough(c.steps, overs, thisSite);
|
|
53
|
+
const inv = rebaseStepsThrough(c.inverse, overs, thisSite);
|
|
54
|
+
if (fwd.length === 0 && inv.length === 0)
|
|
55
|
+
return null;
|
|
56
|
+
const entry = { steps: fwd, inverse: inv };
|
|
57
|
+
const b = mapSelectionThrough(c.before, steps);
|
|
58
|
+
const a = mapSelectionThrough(c.after, steps);
|
|
59
|
+
if (b)
|
|
60
|
+
entry.before = b;
|
|
61
|
+
if (a)
|
|
62
|
+
entry.after = a;
|
|
63
|
+
return entry;
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
...h,
|
|
67
|
+
doc: next,
|
|
68
|
+
past: h.past.map(mapCommit).filter((c) => c != null),
|
|
69
|
+
future: h.future.map(mapCommit).filter((c) => c != null)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function amend(h, more, after, before) {
|
|
73
|
+
if (more.length === 0)
|
|
74
|
+
return h;
|
|
75
|
+
if (h.past.length === 0)
|
|
76
|
+
return commit(h, more, before, after);
|
|
77
|
+
const last = h.past[h.past.length - 1];
|
|
78
|
+
const steps = last.steps.concat(more);
|
|
79
|
+
const inverse = invertAll(h.doc, more).concat(last.inverse);
|
|
80
|
+
const next = applyAll(h.doc, more);
|
|
81
|
+
gate(h, next);
|
|
82
|
+
const entry = { steps, inverse };
|
|
83
|
+
if (last.before)
|
|
84
|
+
entry.before = last.before;
|
|
85
|
+
if (after)
|
|
86
|
+
entry.after = after;
|
|
87
|
+
else if (last.after)
|
|
88
|
+
entry.after = last.after;
|
|
89
|
+
return {
|
|
90
|
+
...h,
|
|
91
|
+
doc: next,
|
|
92
|
+
past: h.past.slice(0, -1).concat(entry),
|
|
93
|
+
future: []
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function undo(h) {
|
|
97
|
+
const last = h.past[h.past.length - 1];
|
|
98
|
+
if (!last)
|
|
99
|
+
return h;
|
|
100
|
+
const next = applyAll(h.doc, last.inverse);
|
|
101
|
+
gate(h, next);
|
|
102
|
+
return { ...h, doc: next, past: h.past.slice(0, -1), future: [last, ...h.future] };
|
|
103
|
+
}
|
|
104
|
+
function redo(h) {
|
|
105
|
+
const next = h.future[0];
|
|
106
|
+
if (!next)
|
|
107
|
+
return h;
|
|
108
|
+
const doc = applyAll(h.doc, next.steps);
|
|
109
|
+
gate(h, doc);
|
|
110
|
+
return { ...h, doc, past: h.past.concat(next), future: h.future.slice(1) };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/tree/invariants.ts
|
|
114
|
+
function invariants(schema, doc) {
|
|
115
|
+
const out = [];
|
|
116
|
+
out.push(...validateAll(schema, doc));
|
|
117
|
+
const ids = /* @__PURE__ */ new Map();
|
|
118
|
+
walk(doc, [], schema, out, ids);
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
var INTERNAL_MARKS = ["html", "image"];
|
|
122
|
+
function walk(node, path, schema, out, ids) {
|
|
123
|
+
if (isText(node)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (node.id !== void 0) {
|
|
127
|
+
ids.set(node.id, (ids.get(node.id) ?? 0) + 1);
|
|
128
|
+
if (ids.get(node.id) === 2) {
|
|
129
|
+
out.push({ path, reason: `\u91CD\u590D id "${node.id}"` });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const spec = schema.nodes[node.type];
|
|
133
|
+
if (spec?.atom) {
|
|
134
|
+
if (node.type === "image") {
|
|
135
|
+
if (!node.attrs?.url)
|
|
136
|
+
out.push({ path, reason: `[image] \u7F3A url` });
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (node.type === "mention") {
|
|
140
|
+
if (!node.attrs?.id)
|
|
141
|
+
out.push({ path, reason: `[mention] \u7F3A id` });
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (node.type === "footnote_ref") {
|
|
145
|
+
if (typeof node.attrs?.label !== "string" || !node.attrs.label)
|
|
146
|
+
out.push({ path, reason: `[footnote_ref] \u7F3A label` });
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (node.type === "math") {
|
|
150
|
+
if (typeof node.attrs?.latex !== "string")
|
|
151
|
+
out.push({ path, reason: `[math] \u7F3A latex` });
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (node.type === "embed") {
|
|
155
|
+
if (!node.attrs?.kind)
|
|
156
|
+
out.push({ path, reason: `[embed] \u7F3A kind` });
|
|
157
|
+
if (!node.attrs?.src)
|
|
158
|
+
out.push({ path, reason: `[embed] \u7F3A src` });
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
for (const reason of checkTable(node)) {
|
|
162
|
+
out.push({ path, reason: `[table] ${reason}` });
|
|
163
|
+
}
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
167
|
+
const child = node.children[i];
|
|
168
|
+
if (isText(child) && child.marks) {
|
|
169
|
+
for (const m of child.marks) {
|
|
170
|
+
if (!schema.marks.includes(m.name) && !INTERNAL_MARKS.includes(m.name)) {
|
|
171
|
+
out.push({ path: path.concat(i), reason: `\u672A\u77E5 mark "${m.name}"` });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (spec?.marks) {
|
|
177
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
178
|
+
const child = node.children[i];
|
|
179
|
+
if (isText(child) && child.marks) {
|
|
180
|
+
for (const m of child.marks) {
|
|
181
|
+
if (!spec.marks.includes(m.name)) {
|
|
182
|
+
out.push({ path: path.concat(i), reason: `${node.type} \u4E0D\u5141\u8BB8 mark "${m.name}"` });
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
189
|
+
walk(node.children[i], path.concat(i), schema, out, ids);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function firstViolation(vs) {
|
|
193
|
+
if (vs.length === 0) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
const v = vs[0];
|
|
197
|
+
return `${v.path.join(",")}: ${v.reason}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/tree/word-count.ts
|
|
201
|
+
function isCjk(c) {
|
|
202
|
+
return c >= 19968 && c <= 40959 || c >= 13312 && c <= 19903 || c >= 131072 && c <= 195103 || c >= 63744 && c <= 64255 || c >= 12352 && c <= 12543 || c >= 44032 && c <= 55215;
|
|
203
|
+
}
|
|
204
|
+
var WORD_CHAR = /[\p{L}\p{N}\p{M}]/u;
|
|
205
|
+
var JOINER = /* @__PURE__ */ new Set(["'", "\u2019", "-", "_"]);
|
|
206
|
+
var SPACE = /\s/u;
|
|
207
|
+
function scan(text, acc) {
|
|
208
|
+
let inWord = false;
|
|
209
|
+
for (const ch of text) {
|
|
210
|
+
if (ch === "\n" || ch === "\r")
|
|
211
|
+
inWord = false;
|
|
212
|
+
else
|
|
213
|
+
acc.chars++;
|
|
214
|
+
if (SPACE.test(ch)) {
|
|
215
|
+
inWord = false;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
acc.charsNoSpace++;
|
|
219
|
+
if (isCjk(ch.codePointAt(0))) {
|
|
220
|
+
acc.words++;
|
|
221
|
+
inWord = false;
|
|
222
|
+
} else if (WORD_CHAR.test(ch)) {
|
|
223
|
+
if (!inWord)
|
|
224
|
+
acc.words++;
|
|
225
|
+
inWord = true;
|
|
226
|
+
} else if (!(inWord && JOINER.has(ch))) {
|
|
227
|
+
inWord = false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
function leafText(n) {
|
|
232
|
+
return n.children.map((c) => isText(c) ? c.text : "\n").join("");
|
|
233
|
+
}
|
|
234
|
+
function walk2(n, acc) {
|
|
235
|
+
if (n.type === "raw")
|
|
236
|
+
return;
|
|
237
|
+
if (n.children.some(isText)) {
|
|
238
|
+
const text = leafText(n);
|
|
239
|
+
if ((n.type === "paragraph" || n.type === "heading") && text.trim() !== "")
|
|
240
|
+
acc.paragraphs++;
|
|
241
|
+
scan(text, acc);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
for (const c of n.children) {
|
|
245
|
+
if (!isText(c))
|
|
246
|
+
walk2(c, acc);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function wordCount(doc) {
|
|
250
|
+
const acc = { words: 0, chars: 0, charsNoSpace: 0, paragraphs: 0 };
|
|
251
|
+
walk2(doc, acc);
|
|
252
|
+
return acc;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/tree/toc.ts
|
|
256
|
+
function headingText(node) {
|
|
257
|
+
let out = "";
|
|
258
|
+
for (const c of node.children) {
|
|
259
|
+
if (isText(c))
|
|
260
|
+
out += c.text;
|
|
261
|
+
}
|
|
262
|
+
return out;
|
|
263
|
+
}
|
|
264
|
+
function outline(doc) {
|
|
265
|
+
const out = [];
|
|
266
|
+
const walk4 = (node, path) => {
|
|
267
|
+
if (isText(node))
|
|
268
|
+
return;
|
|
269
|
+
if (node.type === "heading") {
|
|
270
|
+
const level = Math.min(Math.max(Number(node.attrs?.depth ?? 1), 1), 6);
|
|
271
|
+
out.push({ level, text: headingText(node), path, id: node.id });
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
for (let i = 0; i < node.children.length; i++)
|
|
275
|
+
walk4(node.children[i], path.concat(i));
|
|
276
|
+
};
|
|
277
|
+
walk4(doc, []);
|
|
278
|
+
return out;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/tree/annotate.ts
|
|
282
|
+
function markIdsInDoc(doc, name) {
|
|
283
|
+
const ids = /* @__PURE__ */ new Set();
|
|
284
|
+
const walk4 = (n) => {
|
|
285
|
+
if (isText(n)) {
|
|
286
|
+
for (const m of n.marks ?? []) {
|
|
287
|
+
if (m.name === name && m.attrs?.id != null)
|
|
288
|
+
ids.add(String(m.attrs.id));
|
|
289
|
+
}
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (isElement(n))
|
|
293
|
+
for (const c of n.children)
|
|
294
|
+
walk4(c);
|
|
295
|
+
};
|
|
296
|
+
walk4(doc);
|
|
297
|
+
return ids;
|
|
298
|
+
}
|
|
299
|
+
function mapLeafBlocks(doc, fn) {
|
|
300
|
+
const steps = [];
|
|
301
|
+
const walk4 = (node, path) => {
|
|
302
|
+
if (node.children.every((c) => isText(c) || isInlineAtom(c))) {
|
|
303
|
+
const next = fn(node, path);
|
|
304
|
+
if (next)
|
|
305
|
+
steps.push({ kind: "replaceNode", path, node: next });
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
node.children.forEach((c, i) => {
|
|
309
|
+
if (isElement(c))
|
|
310
|
+
walk4(c, path.concat(i));
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
doc.children.forEach((c, i) => {
|
|
314
|
+
if (isElement(c))
|
|
315
|
+
walk4(c, [i]);
|
|
316
|
+
});
|
|
317
|
+
return steps;
|
|
318
|
+
}
|
|
319
|
+
function stripMarks(doc, pred) {
|
|
320
|
+
return mapLeafBlocks(doc, (node) => {
|
|
321
|
+
let changed = false;
|
|
322
|
+
const children = node.children.map((c) => {
|
|
323
|
+
if (!isText(c) || !c.marks?.some(pred))
|
|
324
|
+
return c;
|
|
325
|
+
changed = true;
|
|
326
|
+
const rest = (c.marks ?? []).filter((m) => !pred(m));
|
|
327
|
+
return rest.length ? { ...c, marks: rest } : { text: c.text };
|
|
328
|
+
});
|
|
329
|
+
return changed ? { ...node, children } : null;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
function dropMarkedLeaves(doc, pred) {
|
|
333
|
+
return mapLeafBlocks(doc, (node) => {
|
|
334
|
+
let changed = false;
|
|
335
|
+
const children = [];
|
|
336
|
+
for (const c of node.children) {
|
|
337
|
+
if (isText(c) && pred(c)) {
|
|
338
|
+
changed = true;
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
children.push(c);
|
|
342
|
+
}
|
|
343
|
+
if (!changed)
|
|
344
|
+
return null;
|
|
345
|
+
return { ...node, children: children.length ? children : [{ text: "" }] };
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// src/tree/comments.ts
|
|
350
|
+
function commentIdsInDoc(doc) {
|
|
351
|
+
return markIdsInDoc(doc, "comment");
|
|
352
|
+
}
|
|
353
|
+
function stripCommentMarks(doc, id) {
|
|
354
|
+
return stripMarks(doc, (m) => m.name === "comment" && String(m.attrs?.id) === id);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// src/tree/search.ts
|
|
358
|
+
var DEFAULT_SKIP = ["code"];
|
|
359
|
+
function findText(doc, query, opts = {}) {
|
|
360
|
+
if (!query)
|
|
361
|
+
return [];
|
|
362
|
+
const skip = new Set(opts.skipTypes ?? DEFAULT_SKIP);
|
|
363
|
+
const cs = opts.caseSensitive === true;
|
|
364
|
+
const needle = cs ? query : query.toLowerCase();
|
|
365
|
+
const out = [];
|
|
366
|
+
walk3(doc, [], skip, (path, text) => {
|
|
367
|
+
const hay = cs ? text : text.toLowerCase();
|
|
368
|
+
let from = 0;
|
|
369
|
+
while (from <= hay.length - needle.length) {
|
|
370
|
+
const i = hay.indexOf(needle, from);
|
|
371
|
+
if (i < 0)
|
|
372
|
+
break;
|
|
373
|
+
out.push({ path: path.slice(), offset: i, length: query.length });
|
|
374
|
+
from = i + Math.max(1, needle.length);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
return out;
|
|
378
|
+
}
|
|
379
|
+
function replaceMatch(match, replacement) {
|
|
380
|
+
const del = {
|
|
381
|
+
kind: "deleteText",
|
|
382
|
+
path: match.path,
|
|
383
|
+
offset: match.offset,
|
|
384
|
+
length: match.length
|
|
385
|
+
};
|
|
386
|
+
if (!replacement)
|
|
387
|
+
return [del];
|
|
388
|
+
return [
|
|
389
|
+
del,
|
|
390
|
+
{
|
|
391
|
+
kind: "insertText",
|
|
392
|
+
path: match.path,
|
|
393
|
+
offset: match.offset,
|
|
394
|
+
text: replacement
|
|
395
|
+
}
|
|
396
|
+
];
|
|
397
|
+
}
|
|
398
|
+
function replaceAll(doc, query, replacement, opts = {}) {
|
|
399
|
+
if (!query)
|
|
400
|
+
return { steps: [], count: 0 };
|
|
401
|
+
const skip = new Set(opts.skipTypes ?? DEFAULT_SKIP);
|
|
402
|
+
const cs = opts.caseSensitive === true;
|
|
403
|
+
const steps = [];
|
|
404
|
+
let count = 0;
|
|
405
|
+
walk3(doc, [], skip, (path, text, leaf) => {
|
|
406
|
+
const { text: next, n } = replaceInString(text, query, replacement, cs);
|
|
407
|
+
if (n === 0)
|
|
408
|
+
return;
|
|
409
|
+
count += n;
|
|
410
|
+
steps.push({
|
|
411
|
+
kind: "replaceNode",
|
|
412
|
+
path: path.slice(),
|
|
413
|
+
node: { ...leaf, text: next }
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
return { steps, count };
|
|
417
|
+
}
|
|
418
|
+
function applyReplaceAll(doc, query, replacement, opts = {}) {
|
|
419
|
+
const { steps } = replaceAll(doc, query, replacement, opts);
|
|
420
|
+
let d = doc;
|
|
421
|
+
for (const s of steps)
|
|
422
|
+
d = apply(d, s);
|
|
423
|
+
return d;
|
|
424
|
+
}
|
|
425
|
+
function replaceInString(text, query, replacement, caseSensitive) {
|
|
426
|
+
if (!query)
|
|
427
|
+
return { text, n: 0 };
|
|
428
|
+
if (caseSensitive) {
|
|
429
|
+
if (!text.includes(query))
|
|
430
|
+
return { text, n: 0 };
|
|
431
|
+
const parts = text.split(query);
|
|
432
|
+
return { text: parts.join(replacement), n: parts.length - 1 };
|
|
433
|
+
}
|
|
434
|
+
const needle = query.toLowerCase();
|
|
435
|
+
const hay = text.toLowerCase();
|
|
436
|
+
let out = "";
|
|
437
|
+
let i = 0;
|
|
438
|
+
let n = 0;
|
|
439
|
+
while (i < text.length) {
|
|
440
|
+
if (i <= text.length - query.length && hay.startsWith(needle, i)) {
|
|
441
|
+
out += replacement;
|
|
442
|
+
i += query.length;
|
|
443
|
+
n++;
|
|
444
|
+
} else {
|
|
445
|
+
out += text[i];
|
|
446
|
+
i++;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return { text: out, n };
|
|
450
|
+
}
|
|
451
|
+
function walk3(node, path, skip, onLeaf) {
|
|
452
|
+
if (isText(node)) {
|
|
453
|
+
onLeaf(path, node.text, node);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (!isElement(node))
|
|
457
|
+
return;
|
|
458
|
+
if (skip.has(node.type))
|
|
459
|
+
return;
|
|
460
|
+
for (let i = 0; i < node.children.length; i++)
|
|
461
|
+
walk3(node.children[i], path.concat(i), skip, onLeaf);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// src/tree/versions.ts
|
|
465
|
+
function cloneDoc(doc) {
|
|
466
|
+
return typeof structuredClone === "function" ? structuredClone(doc) : JSON.parse(JSON.stringify(doc));
|
|
467
|
+
}
|
|
468
|
+
function nid() {
|
|
469
|
+
return typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : `v${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
470
|
+
}
|
|
471
|
+
function snapshotDoc(doc, name, id) {
|
|
472
|
+
const label = name.trim() || defaultName();
|
|
473
|
+
return {
|
|
474
|
+
id: id ?? nid(),
|
|
475
|
+
name: label,
|
|
476
|
+
createdAt: Date.now(),
|
|
477
|
+
doc: cloneDoc(doc)
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function defaultName() {
|
|
481
|
+
const d = /* @__PURE__ */ new Date();
|
|
482
|
+
const p = (n) => n < 10 ? `0${n}` : `${n}`;
|
|
483
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
|
484
|
+
}
|
|
485
|
+
function pushVersion(list, v, max = 50) {
|
|
486
|
+
const next = list.filter((x) => x.id !== v.id).concat(v);
|
|
487
|
+
return next.length > max ? next.slice(next.length - max) : next;
|
|
488
|
+
}
|
|
489
|
+
function getVersion(list, id) {
|
|
490
|
+
return list.find((v) => v.id === id);
|
|
491
|
+
}
|
|
492
|
+
function removeVersion(list, id) {
|
|
493
|
+
return list.filter((v) => v.id !== id);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// src/tree/suggest.ts
|
|
497
|
+
function cmpPath(a, b) {
|
|
498
|
+
const n = Math.min(a.length, b.length);
|
|
499
|
+
for (let i = 0; i < n; i++) {
|
|
500
|
+
if (a[i] !== b[i])
|
|
501
|
+
return a[i] - b[i];
|
|
502
|
+
}
|
|
503
|
+
return a.length - b.length;
|
|
504
|
+
}
|
|
505
|
+
function suggestMark(id, kind, author) {
|
|
506
|
+
const attrs = { id, kind };
|
|
507
|
+
if (author?.id)
|
|
508
|
+
attrs.authorId = author.id;
|
|
509
|
+
if (author?.name)
|
|
510
|
+
attrs.authorName = author.name;
|
|
511
|
+
return { name: "suggest", attrs };
|
|
512
|
+
}
|
|
513
|
+
function isSuggestMark(m, id) {
|
|
514
|
+
if (m.name !== "suggest")
|
|
515
|
+
return false;
|
|
516
|
+
if (id == null)
|
|
517
|
+
return true;
|
|
518
|
+
return String(m.attrs?.id ?? "") === id;
|
|
519
|
+
}
|
|
520
|
+
function suggestIdsInDoc(doc) {
|
|
521
|
+
return markIdsInDoc(doc, "suggest");
|
|
522
|
+
}
|
|
523
|
+
function listSuggestions(doc) {
|
|
524
|
+
const order = [];
|
|
525
|
+
const map = /* @__PURE__ */ new Map();
|
|
526
|
+
const walk4 = (n) => {
|
|
527
|
+
if (isText(n)) {
|
|
528
|
+
for (const m of n.marks ?? []) {
|
|
529
|
+
if (m.name !== "suggest" || m.attrs?.id == null)
|
|
530
|
+
continue;
|
|
531
|
+
const id = String(m.attrs.id);
|
|
532
|
+
const kind = m.attrs.kind === "delete" ? "delete" : "insert";
|
|
533
|
+
const cur = map.get(id);
|
|
534
|
+
if (!cur) {
|
|
535
|
+
order.push(id);
|
|
536
|
+
map.set(id, {
|
|
537
|
+
id,
|
|
538
|
+
kind,
|
|
539
|
+
quote: n.text,
|
|
540
|
+
authorId: m.attrs.authorId != null ? String(m.attrs.authorId) : void 0,
|
|
541
|
+
authorName: m.attrs.authorName != null ? String(m.attrs.authorName) : void 0
|
|
542
|
+
});
|
|
543
|
+
} else {
|
|
544
|
+
cur.quote += n.text;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
if (isElement(n))
|
|
550
|
+
for (const c of n.children)
|
|
551
|
+
walk4(c);
|
|
552
|
+
};
|
|
553
|
+
walk4(doc);
|
|
554
|
+
return order.map((id) => map.get(id));
|
|
555
|
+
}
|
|
556
|
+
function leafHasSuggest(leaf, id) {
|
|
557
|
+
return (leaf.marks ?? []).some((m) => isSuggestMark(m, id));
|
|
558
|
+
}
|
|
559
|
+
function leafSuggestKind(leaf, id) {
|
|
560
|
+
const m = (leaf.marks ?? []).find((m2) => isSuggestMark(m2, id));
|
|
561
|
+
if (!m)
|
|
562
|
+
return null;
|
|
563
|
+
return m.attrs?.kind === "delete" ? "delete" : "insert";
|
|
564
|
+
}
|
|
565
|
+
function stripSuggestMarks(doc, id) {
|
|
566
|
+
return stripMarks(doc, (m) => isSuggestMark(m, id));
|
|
567
|
+
}
|
|
568
|
+
function dropSuggestText(doc, id) {
|
|
569
|
+
return dropMarkedLeaves(doc, (leaf) => leafHasSuggest(leaf, id));
|
|
570
|
+
}
|
|
571
|
+
function kindOfId(doc, id) {
|
|
572
|
+
let kind = "insert";
|
|
573
|
+
const walk4 = (n) => {
|
|
574
|
+
if (isText(n)) {
|
|
575
|
+
const k = leafSuggestKind(n, id);
|
|
576
|
+
if (k) {
|
|
577
|
+
kind = k;
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
582
|
+
if (isElement(n)) {
|
|
583
|
+
for (const c of n.children) {
|
|
584
|
+
if (walk4(c))
|
|
585
|
+
return true;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return false;
|
|
589
|
+
};
|
|
590
|
+
walk4(doc);
|
|
591
|
+
return kind;
|
|
592
|
+
}
|
|
593
|
+
function acceptSuggestion(doc, id) {
|
|
594
|
+
return kindOfId(doc, id) === "delete" ? dropSuggestText(doc, id) : stripSuggestMarks(doc, id);
|
|
595
|
+
}
|
|
596
|
+
function rejectSuggestion(doc, id) {
|
|
597
|
+
return kindOfId(doc, id) === "delete" ? stripSuggestMarks(doc, id) : dropSuggestText(doc, id);
|
|
598
|
+
}
|
|
599
|
+
function split(path) {
|
|
600
|
+
return {
|
|
601
|
+
blockPath: path.slice(0, -2),
|
|
602
|
+
leafIdx: path[path.length - 2],
|
|
603
|
+
char: path[path.length - 1]
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function blockChar(children, leafIdx, char) {
|
|
607
|
+
let n = 0;
|
|
608
|
+
for (let i = 0; i < leafIdx; i++) {
|
|
609
|
+
const c = children[i];
|
|
610
|
+
n += isText(c) ? c.text.length : 1;
|
|
611
|
+
}
|
|
612
|
+
return n + char;
|
|
613
|
+
}
|
|
614
|
+
function totalChars(children) {
|
|
615
|
+
return children.reduce((a, c) => a + (isText(c) ? c.text.length : 1), 0);
|
|
616
|
+
}
|
|
617
|
+
function leafBlocksBetween(doc, fromBlock, toBlock) {
|
|
618
|
+
const all = [];
|
|
619
|
+
const walk4 = (node, path) => {
|
|
620
|
+
if (!isElement(node))
|
|
621
|
+
return;
|
|
622
|
+
if (node.children.every((c) => isText(c) || isInlineAtom(c)))
|
|
623
|
+
all.push({ path, node });
|
|
624
|
+
else
|
|
625
|
+
node.children.forEach((c, i) => walk4(c, path.concat(i)));
|
|
626
|
+
};
|
|
627
|
+
doc.children.forEach((c, i) => walk4(c, [i]));
|
|
628
|
+
const fi = all.findIndex((b) => cmpPath(b.path, fromBlock) === 0);
|
|
629
|
+
const ti = all.findIndex((b) => cmpPath(b.path, toBlock) === 0);
|
|
630
|
+
return fi < 0 || ti < 0 ? [] : all.slice(fi, ti + 1);
|
|
631
|
+
}
|
|
632
|
+
function setSuggestOn(leaf, mark) {
|
|
633
|
+
const rest = (leaf.marks ?? []).filter((m) => m.name !== "suggest");
|
|
634
|
+
return { ...leaf, marks: [...rest, mark] };
|
|
635
|
+
}
|
|
636
|
+
function markChars(block, from, to, mark) {
|
|
637
|
+
const out = [];
|
|
638
|
+
let pos = 0;
|
|
639
|
+
for (const leaf of block.children) {
|
|
640
|
+
if (!isText(leaf)) {
|
|
641
|
+
out.push(leaf);
|
|
642
|
+
pos += 1;
|
|
643
|
+
continue;
|
|
644
|
+
}
|
|
645
|
+
const len = leaf.text.length;
|
|
646
|
+
const lo = Math.max(from, pos);
|
|
647
|
+
const hi = Math.min(to, pos + len);
|
|
648
|
+
if (lo >= hi) {
|
|
649
|
+
out.push(leaf);
|
|
650
|
+
} else {
|
|
651
|
+
if (lo > pos)
|
|
652
|
+
out.push({ ...leaf, text: leaf.text.slice(0, lo - pos) });
|
|
653
|
+
out.push(setSuggestOn({ ...leaf, text: leaf.text.slice(lo - pos, hi - pos) }, mark));
|
|
654
|
+
if (hi < pos + len)
|
|
655
|
+
out.push({ ...leaf, text: leaf.text.slice(hi - pos) });
|
|
656
|
+
}
|
|
657
|
+
pos += len;
|
|
658
|
+
}
|
|
659
|
+
return coalesce(out);
|
|
660
|
+
}
|
|
661
|
+
function coalesce(nodes) {
|
|
662
|
+
const out = [];
|
|
663
|
+
for (const n of nodes) {
|
|
664
|
+
const prev = out[out.length - 1];
|
|
665
|
+
if (prev && isText(prev) && isText(n) && sameMarks(prev.marks, n.marks))
|
|
666
|
+
out[out.length - 1] = { ...prev, text: prev.text + n.text };
|
|
667
|
+
else
|
|
668
|
+
out.push(n);
|
|
669
|
+
}
|
|
670
|
+
return out;
|
|
671
|
+
}
|
|
672
|
+
function sameMarks(a, b) {
|
|
673
|
+
const x = a ?? [];
|
|
674
|
+
const y = b ?? [];
|
|
675
|
+
if (x.length !== y.length)
|
|
676
|
+
return false;
|
|
677
|
+
return x.every((m, i) => m.name === y[i].name && JSON.stringify(m.attrs ?? {}) === JSON.stringify(y[i].attrs ?? {}));
|
|
678
|
+
}
|
|
679
|
+
function rangeForDelete(doc, sel, dir) {
|
|
680
|
+
if (cmpPath(sel.anchor.path, sel.head.path) !== 0)
|
|
681
|
+
return sel;
|
|
682
|
+
const path = sel.head.path;
|
|
683
|
+
if (path.length < 2)
|
|
684
|
+
return null;
|
|
685
|
+
const char = path[path.length - 1];
|
|
686
|
+
const leafPath = path.slice(0, -1);
|
|
687
|
+
const leaf = nodeAt(doc, leafPath);
|
|
688
|
+
if (!isText(leaf))
|
|
689
|
+
return null;
|
|
690
|
+
if (dir === "backward") {
|
|
691
|
+
if (char <= 0)
|
|
692
|
+
return null;
|
|
693
|
+
return {
|
|
694
|
+
anchor: { path: leafPath.concat(char - 1) },
|
|
695
|
+
head: { path: leafPath.concat(char) }
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
if (char >= leaf.text.length)
|
|
699
|
+
return null;
|
|
700
|
+
return {
|
|
701
|
+
anchor: { path: leafPath.concat(char) },
|
|
702
|
+
head: { path: leafPath.concat(char + 1) }
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function rangeIsSuggestInsert(doc, sel) {
|
|
706
|
+
const [lo, hi] = cmpPath(sel.anchor.path, sel.head.path) <= 0 ? [sel.anchor.path, sel.head.path] : [sel.head.path, sel.anchor.path];
|
|
707
|
+
if (cmpPath(lo, hi) === 0)
|
|
708
|
+
return false;
|
|
709
|
+
const a = split(lo);
|
|
710
|
+
const b = split(hi);
|
|
711
|
+
const blocks = leafBlocksBetween(doc, a.blockPath, b.blockPath);
|
|
712
|
+
if (!blocks.length)
|
|
713
|
+
return false;
|
|
714
|
+
let any = false;
|
|
715
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
716
|
+
const blk = blocks[i];
|
|
717
|
+
const from = i === 0 ? blockChar(blk.node.children, a.leafIdx, a.char) : 0;
|
|
718
|
+
const to = i === blocks.length - 1 ? blockChar(blk.node.children, b.leafIdx, b.char) : totalChars(blk.node.children);
|
|
719
|
+
if (from >= to)
|
|
720
|
+
continue;
|
|
721
|
+
let pos = 0;
|
|
722
|
+
for (const leaf of blk.node.children) {
|
|
723
|
+
if (!isText(leaf)) {
|
|
724
|
+
pos += 1;
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
const len = leaf.text.length;
|
|
728
|
+
const loC = Math.max(from, pos);
|
|
729
|
+
const hiC = Math.min(to, pos + len);
|
|
730
|
+
if (loC < hiC) {
|
|
731
|
+
any = true;
|
|
732
|
+
const hasIns = (leaf.marks ?? []).some((m) => m.name === "suggest" && m.attrs?.kind !== "delete");
|
|
733
|
+
if (!hasIns)
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
736
|
+
pos += len;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return any;
|
|
740
|
+
}
|
|
741
|
+
function markSuggestRange(doc, sel, kind, id, author) {
|
|
742
|
+
const [lo, hi] = cmpPath(sel.anchor.path, sel.head.path) <= 0 ? [sel.anchor.path, sel.head.path] : [sel.head.path, sel.anchor.path];
|
|
743
|
+
if (cmpPath(lo, hi) === 0)
|
|
744
|
+
return [];
|
|
745
|
+
const a = split(lo);
|
|
746
|
+
const b = split(hi);
|
|
747
|
+
const blocks = leafBlocksBetween(doc, a.blockPath, b.blockPath);
|
|
748
|
+
if (!blocks.length)
|
|
749
|
+
return [];
|
|
750
|
+
const mark = suggestMark(id, kind, author);
|
|
751
|
+
const steps = [];
|
|
752
|
+
blocks.forEach((blk, i) => {
|
|
753
|
+
const from = i === 0 ? blockChar(blk.node.children, a.leafIdx, a.char) : 0;
|
|
754
|
+
const to = i === blocks.length - 1 ? blockChar(blk.node.children, b.leafIdx, b.char) : totalChars(blk.node.children);
|
|
755
|
+
if (from >= to)
|
|
756
|
+
return;
|
|
757
|
+
const children = markChars(blk.node, from, to, mark);
|
|
758
|
+
steps.push({ kind: "replaceNode", path: blk.path, node: { ...blk.node, children } });
|
|
759
|
+
});
|
|
760
|
+
return steps;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// src/tree/footnote.ts
|
|
764
|
+
function footnoteIndex(doc) {
|
|
765
|
+
const order = [];
|
|
766
|
+
const defs = /* @__PURE__ */ new Map();
|
|
767
|
+
const refs = /* @__PURE__ */ new Map();
|
|
768
|
+
const walk4 = (n) => {
|
|
769
|
+
if (isText(n))
|
|
770
|
+
return;
|
|
771
|
+
if (n.type === "footnote_ref") {
|
|
772
|
+
const k = footnoteKey(String(n.attrs?.label ?? ""));
|
|
773
|
+
if (!refs.has(k))
|
|
774
|
+
order.push(k);
|
|
775
|
+
refs.set(k, (refs.get(k) ?? 0) + 1);
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
if (isFootnoteDef(n)) {
|
|
779
|
+
const k = footnoteKey(String(n.attrs?.footnote ?? ""));
|
|
780
|
+
if (!defs.has(k))
|
|
781
|
+
defs.set(k, n);
|
|
782
|
+
}
|
|
783
|
+
for (const c of n.children)
|
|
784
|
+
walk4(c);
|
|
785
|
+
};
|
|
786
|
+
walk4(doc);
|
|
787
|
+
return { order, defs, refs };
|
|
788
|
+
}
|
|
789
|
+
function footnoteText(def) {
|
|
790
|
+
const lines = [];
|
|
791
|
+
const walk4 = (n, acc) => {
|
|
792
|
+
if (isText(n)) {
|
|
793
|
+
acc.push(n.text);
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
if (n.type === "footnote_ref") {
|
|
797
|
+
acc.push(`[${String(n.attrs?.label ?? "")}]`);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
if (isElement(n) && n.children.length && n.children.every((c) => isText(c) || isElement(c) && c.children.length === 0)) {
|
|
801
|
+
const line = [];
|
|
802
|
+
for (const c of n.children)
|
|
803
|
+
walk4(c, line);
|
|
804
|
+
lines.push(line.join(""));
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
for (const c of n.children)
|
|
808
|
+
walk4(c, acc);
|
|
809
|
+
};
|
|
810
|
+
for (const c of def.children)
|
|
811
|
+
walk4(c, lines);
|
|
812
|
+
return lines.join("\n").trim();
|
|
813
|
+
}
|
|
814
|
+
function hasFootnotes(doc) {
|
|
815
|
+
const walk4 = (n) => !isText(n) && (n.type === "footnote_ref" || isFootnoteDef(n) || n.children.some(walk4));
|
|
816
|
+
return walk4(doc);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
export {
|
|
820
|
+
init,
|
|
821
|
+
commit,
|
|
822
|
+
applyForeign,
|
|
823
|
+
amend,
|
|
824
|
+
undo,
|
|
825
|
+
redo,
|
|
826
|
+
invariants,
|
|
827
|
+
firstViolation,
|
|
828
|
+
wordCount,
|
|
829
|
+
outline,
|
|
830
|
+
markIdsInDoc,
|
|
831
|
+
mapLeafBlocks,
|
|
832
|
+
stripMarks,
|
|
833
|
+
dropMarkedLeaves,
|
|
834
|
+
commentIdsInDoc,
|
|
835
|
+
stripCommentMarks,
|
|
836
|
+
findText,
|
|
837
|
+
replaceMatch,
|
|
838
|
+
replaceAll,
|
|
839
|
+
applyReplaceAll,
|
|
840
|
+
snapshotDoc,
|
|
841
|
+
pushVersion,
|
|
842
|
+
getVersion,
|
|
843
|
+
removeVersion,
|
|
844
|
+
suggestMark,
|
|
845
|
+
isSuggestMark,
|
|
846
|
+
suggestIdsInDoc,
|
|
847
|
+
listSuggestions,
|
|
848
|
+
stripSuggestMarks,
|
|
849
|
+
dropSuggestText,
|
|
850
|
+
acceptSuggestion,
|
|
851
|
+
rejectSuggestion,
|
|
852
|
+
rangeForDelete,
|
|
853
|
+
rangeIsSuggestInsert,
|
|
854
|
+
markSuggestRange,
|
|
855
|
+
footnoteIndex,
|
|
856
|
+
footnoteText,
|
|
857
|
+
hasFootnotes
|
|
858
|
+
};
|