reactive-md 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +16 -0
- package/CHANGELOG.md +16 -0
- package/README-ch.md +9 -7
- package/README-en.md +10 -7
- package/README.md +10 -7
- package/SECURITY-ch.md +4 -3
- package/SECURITY.md +4 -3
- package/THIRD_PARTY_NOTICES.md +45 -1
- package/dist-library/reactive-md-editor.css +1 -1
- package/dist-library/reactive-md-editor.js +739 -615
- package/dist-library/reactive-md-react.js +2081 -1904
- package/dist-library/reactive-md.js +440 -320
- package/dist-library/{runtime-DPuMxM_y.js → runtime-CXBdLQ3A.js} +8405 -2745
- package/dist-library/types/editor/editor-i18n.d.ts +7 -0
- package/dist-library/types/editor/editor-view-bar.d.ts +11 -0
- package/dist-library/types/editor/index.d.ts +1 -1
- package/dist-library/types/editor/types.d.ts +8 -1
- package/dist-library/types/local/LocalDocumentView.d.ts +10 -3
- package/dist-library/types/local/code-block.d.ts +3 -1
- package/dist-library/types/local/diagnostics.d.ts +25 -0
- package/dist-library/types/local/heading-anchors.d.ts +2 -0
- package/dist-library/types/local/html.d.ts +16 -0
- package/dist-library/types/local/image-view.d.ts +3 -1
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/options.d.ts +29 -0
- package/dist-library/types/local/types.d.ts +35 -1
- package/dist-library/types/local/worker.d.ts +18 -6
- package/dist-library/types/shareable.d.ts +9 -1
- package/dist-standalone/reactive-md-standalone.js +48 -48
- package/docs/compatibility-ch.md +4 -4
- package/docs/compatibility-en.md +4 -4
- package/docs/editor-ch.md +235 -216
- package/docs/editor-en.md +235 -216
- package/docs/html-compatibility-ch.md +98 -0
- package/docs/html-compatibility-en.md +98 -0
- package/docs/local-integration-ch.md +4 -1
- package/docs/local-integration-en.md +4 -1
- package/docs/local-interaction-syntax-ch.md +3 -1
- package/docs/local-interaction-syntax-en.md +1 -1
- package/docs/release-0.5.1-ch.md +39 -0
- package/docs/release-0.5.1-en.md +39 -0
- package/docs/releasing-ch.md +7 -7
- package/docs/releasing-en.md +8 -8
- package/docs/shareable-export-ch.md +2 -0
- package/docs/shareable-export-en.md +2 -0
- package/examples/local/README.md +2 -0
- package/examples/local/html-compat.reactive.md +24 -0
- package/package.json +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as e,
|
|
1
|
+
import { A as e, B as t, D as n, F as r, I as i, L as a, M as o, N as s, O as c, P as l, R as u, U as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as ee, i as te, j as ne, k as re, m as ie, n as y, o as ae, p as oe, r as se, s as ce, t as b, v as le, y as ue, z as de } from "./runtime-CXBdLQ3A.js";
|
|
2
2
|
// src/local/authoring.ts
|
|
3
|
-
var
|
|
3
|
+
var fe = /^[A-Za-z_][A-Za-z0-9_]*$/, pe = 128, me = /* @__PURE__ */ new Set([
|
|
4
4
|
"code",
|
|
5
5
|
"inlineCode",
|
|
6
6
|
"math",
|
|
@@ -8,7 +8,7 @@ var oe = /^[A-Za-z_][A-Za-z0-9_]*$/, se = 128, ce = /* @__PURE__ */ new Set([
|
|
|
8
8
|
"fallback",
|
|
9
9
|
"comment",
|
|
10
10
|
"footnoteDefinition"
|
|
11
|
-
]),
|
|
11
|
+
]), he = /* @__PURE__ */ new Set([
|
|
12
12
|
"local.version.unsupported",
|
|
13
13
|
"local.version.malformed",
|
|
14
14
|
"local.version.duplicate",
|
|
@@ -22,35 +22,35 @@ var oe = /^[A-Za-z_][A-Za-z0-9_]*$/, se = 128, ce = /* @__PURE__ */ new Set([
|
|
|
22
22
|
"local.attribute",
|
|
23
23
|
"local.budget"
|
|
24
24
|
]);
|
|
25
|
-
function
|
|
25
|
+
function x(e) {
|
|
26
26
|
return e !== void 0 && /[A-Za-z_]/.test(e);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function ge(e) {
|
|
29
29
|
return e !== void 0 && /[A-Za-z0-9_]/.test(e);
|
|
30
30
|
}
|
|
31
|
-
function x(e) {
|
|
32
|
-
return e !== void 0 && /\s/.test(e);
|
|
33
|
-
}
|
|
34
31
|
function S(e) {
|
|
35
|
-
return e
|
|
32
|
+
return e !== void 0 && /\s/.test(e);
|
|
36
33
|
}
|
|
37
34
|
function C(e) {
|
|
35
|
+
return e.length > 0 && e.length <= pe && fe.test(e) && !ne.has(e);
|
|
36
|
+
}
|
|
37
|
+
function w(e) {
|
|
38
38
|
return {
|
|
39
39
|
start: e.start,
|
|
40
40
|
end: e.end
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function _e(e) {
|
|
44
44
|
try {
|
|
45
|
-
return
|
|
45
|
+
return y(e).diagnostics;
|
|
46
46
|
} catch {
|
|
47
47
|
return [];
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
var
|
|
51
|
-
function
|
|
50
|
+
var ve = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)(?=[\s/>])/;
|
|
51
|
+
function T(e, t) {
|
|
52
52
|
if (e[t] !== "<") return null;
|
|
53
|
-
let n =
|
|
53
|
+
let n = ve.exec(e.slice(t));
|
|
54
54
|
if (!n) return null;
|
|
55
55
|
let r = !!n[1], i = n[2], a = t + (r ? 2 : 1), o = "", s = t + n[0].length;
|
|
56
56
|
for (; s < e.length; s += 1) {
|
|
@@ -76,7 +76,7 @@ function w(e, t) {
|
|
|
76
76
|
};
|
|
77
77
|
let u = [], d = a + i.length;
|
|
78
78
|
for (; d < c;) {
|
|
79
|
-
for (; d < c &&
|
|
79
|
+
for (; d < c && S(e[d]);) d += 1;
|
|
80
80
|
if (d >= c) break;
|
|
81
81
|
if (e[d] === "/") {
|
|
82
82
|
d += 1;
|
|
@@ -90,7 +90,7 @@ function w(e, t) {
|
|
|
90
90
|
let n = d, r = t[0];
|
|
91
91
|
d += r.length;
|
|
92
92
|
let i = d, a = d;
|
|
93
|
-
for (; a < c &&
|
|
93
|
+
for (; a < c && S(e[a]);) a += 1;
|
|
94
94
|
if (e[a] !== "=") {
|
|
95
95
|
u.push({
|
|
96
96
|
name: r,
|
|
@@ -101,7 +101,7 @@ function w(e, t) {
|
|
|
101
101
|
}), d = i;
|
|
102
102
|
continue;
|
|
103
103
|
}
|
|
104
|
-
for (d = a + 1; d < c &&
|
|
104
|
+
for (d = a + 1; d < c && S(e[d]);) d += 1;
|
|
105
105
|
let o = e[d];
|
|
106
106
|
if (o === "\"" || o === "'") {
|
|
107
107
|
let t = d, i = d + 1, a = e.indexOf(o, i);
|
|
@@ -137,7 +137,7 @@ function w(e, t) {
|
|
|
137
137
|
continue;
|
|
138
138
|
}
|
|
139
139
|
let s = d;
|
|
140
|
-
for (; d < c && !
|
|
140
|
+
for (; d < c && !S(e[d]);) d += 1;
|
|
141
141
|
u.push({
|
|
142
142
|
name: r,
|
|
143
143
|
nameRange: {
|
|
@@ -165,14 +165,14 @@ function w(e, t) {
|
|
|
165
165
|
attrs: u
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function ye(e, t, n) {
|
|
169
169
|
if (t.range.end <= n) return null;
|
|
170
170
|
let r = e.lastIndexOf("</", t.range.end - 1);
|
|
171
171
|
if (r < n) return null;
|
|
172
|
-
let i =
|
|
172
|
+
let i = T(e, r);
|
|
173
173
|
return !i || !i.closing || i.name !== t.name || i.end > t.range.end ? null : i;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function be(e, t, n) {
|
|
176
176
|
let r = [];
|
|
177
177
|
for (let i = t; i < n;) {
|
|
178
178
|
if (e[i] === "\\" && e.startsWith("{{", i + 1)) {
|
|
@@ -200,7 +200,7 @@ function pe(e, t, n) {
|
|
|
200
200
|
}
|
|
201
201
|
return r;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function xe(e, t) {
|
|
204
204
|
let n = {
|
|
205
205
|
quot: "\"",
|
|
206
206
|
apos: "'",
|
|
@@ -217,58 +217,58 @@ function me(e, t) {
|
|
|
217
217
|
offsets: r
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
let
|
|
222
|
-
for (let
|
|
223
|
-
let
|
|
224
|
-
if (
|
|
225
|
-
let
|
|
226
|
-
for (
|
|
220
|
+
function Se(e, t, n) {
|
|
221
|
+
let r = [];
|
|
222
|
+
for (let i = t; i < n;) {
|
|
223
|
+
let t = e[i];
|
|
224
|
+
if (t === "\"" || t === "'") {
|
|
225
|
+
let r = t;
|
|
226
|
+
for (i += 1; i < n;) if (e[i] === "\\") i += 2;
|
|
227
227
|
else {
|
|
228
|
-
if (e[
|
|
229
|
-
|
|
228
|
+
if (e[i] === r) {
|
|
229
|
+
i += 1;
|
|
230
230
|
break;
|
|
231
231
|
}
|
|
232
|
-
|
|
232
|
+
i += 1;
|
|
233
233
|
}
|
|
234
234
|
} else {
|
|
235
|
-
if (/[0-9]/.test(
|
|
236
|
-
let t = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(
|
|
235
|
+
if (/[0-9]/.test(t) || t === "." && e[i + 1] !== void 0 && /[0-9]/.test(e[i + 1])) {
|
|
236
|
+
let t = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(i, n));
|
|
237
237
|
if (t) {
|
|
238
|
-
|
|
238
|
+
i += t[0].length;
|
|
239
239
|
continue;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
if (
|
|
243
|
-
let
|
|
244
|
-
for (
|
|
245
|
-
let
|
|
246
|
-
for (;
|
|
247
|
-
if (e[
|
|
248
|
-
|
|
249
|
-
name:
|
|
242
|
+
if (x(t)) {
|
|
243
|
+
let t = i;
|
|
244
|
+
for (i += 1; i < n && ge(e[i]);) i += 1;
|
|
245
|
+
let a = e.slice(t, i), o = i;
|
|
246
|
+
for (; o < n && S(e[o]);) o += 1;
|
|
247
|
+
if (e[o] === "(" || a === "true" || a === "false" || a === "null" || a === "pi" || a === "e" || ne.has(a)) continue;
|
|
248
|
+
r.push({
|
|
249
|
+
name: a,
|
|
250
250
|
range: {
|
|
251
|
-
start:
|
|
252
|
-
end:
|
|
251
|
+
start: t,
|
|
252
|
+
end: i
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
|
-
} else
|
|
255
|
+
} else i += 1;
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
return
|
|
258
|
+
return r;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Ce(e, t) {
|
|
261
261
|
return Object.hasOwn(e.props, t) ? t === "bind" || !!e.slots?.some((e) => e.bind === t) : !1;
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
for (let n of e)
|
|
263
|
+
function E(e, t = []) {
|
|
264
|
+
for (let n of e) me.has(n.type) && t.push(w(n.range)), n.type !== "fallback" && n.children && E(n.children, t);
|
|
265
265
|
return t;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
let n =
|
|
267
|
+
function D(e, t) {
|
|
268
|
+
let n = E(t), r = (t) => {
|
|
269
269
|
for (let i of t) {
|
|
270
270
|
if (i.type === "component") {
|
|
271
|
-
let t =
|
|
271
|
+
let t = T(e, i.range.start);
|
|
272
272
|
t && n.push({
|
|
273
273
|
start: t.start,
|
|
274
274
|
end: t.end
|
|
@@ -296,29 +296,29 @@ function _e(e, t) {
|
|
|
296
296
|
}
|
|
297
297
|
return i;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function O(e, t) {
|
|
300
300
|
let n = [], r = /* @__PURE__ */ new Map(), i = [], a = [], o = (t, n) => {
|
|
301
|
-
for (let r of
|
|
301
|
+
for (let r of Se(e, t, n)) i.push(r);
|
|
302
302
|
}, s = (e, t) => {
|
|
303
303
|
let n = r.get(e);
|
|
304
|
-
n ? n.push(
|
|
305
|
-
},
|
|
306
|
-
let a =
|
|
304
|
+
n ? n.push(w(t)) : r.set(e, [w(t)]);
|
|
305
|
+
}, l = (t, r) => {
|
|
306
|
+
let a = T(e, t.range.start);
|
|
307
307
|
if (!a || a.closing) return;
|
|
308
308
|
n.push({
|
|
309
309
|
kind: "tag",
|
|
310
|
-
range:
|
|
310
|
+
range: w(a.nameRange)
|
|
311
311
|
});
|
|
312
|
-
let o =
|
|
312
|
+
let o = v(t.name ?? ""), c = a.attrs.some((e) => e.name === "key");
|
|
313
313
|
for (let l of a.attrs) {
|
|
314
314
|
if (n.push({
|
|
315
315
|
kind: "attribute",
|
|
316
|
-
range:
|
|
316
|
+
range: w(l.nameRange)
|
|
317
317
|
}), !l.valueRange) continue;
|
|
318
|
-
let a = o?.props[l.name], u = o !== void 0 &&
|
|
318
|
+
let a = o?.props[l.name], u = o !== void 0 && Ce(o, l.name) && (t.name !== "table" && t.name !== "chart" || !!c), d = (t.name === "computed" || t.name === "const") && l.name === "name", f = e.slice(l.valueRange.start, l.valueRange.end), p = xe(e, l.valueRange);
|
|
319
319
|
if (t.name === "validation" && l.name === "fields") {
|
|
320
320
|
for (let e of p.text.matchAll(/\S+/g)) {
|
|
321
|
-
if (!
|
|
321
|
+
if (!C(e[0])) continue;
|
|
322
322
|
let t = {
|
|
323
323
|
start: p.offsets[e.index],
|
|
324
324
|
end: p.offsets[e.index + e[0].length]
|
|
@@ -333,7 +333,7 @@ function E(e, t) {
|
|
|
333
333
|
}
|
|
334
334
|
continue;
|
|
335
335
|
}
|
|
336
|
-
let m = a && !a.static ?
|
|
336
|
+
let m = a && !a.static ? be(p.text, 0, p.text.length) : [];
|
|
337
337
|
if (m.length > 0) {
|
|
338
338
|
let e = 0;
|
|
339
339
|
for (let a of m) {
|
|
@@ -350,7 +350,7 @@ function E(e, t) {
|
|
|
350
350
|
end: p.offsets[a.end]
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
|
-
for (let e of
|
|
353
|
+
for (let e of Se(p.text, a.innerStart, a.innerEnd)) ((r !== "data-table" || t.name !== "column") && (t.name !== "data-table" || l.name !== "key") || e.name !== "item" && e.name !== "index") && i.push({
|
|
354
354
|
name: e.name,
|
|
355
355
|
range: {
|
|
356
356
|
start: p.offsets[e.range.start],
|
|
@@ -366,34 +366,34 @@ function E(e, t) {
|
|
|
366
366
|
end: l.valueRange.end
|
|
367
367
|
}
|
|
368
368
|
});
|
|
369
|
-
} else (u || d) &&
|
|
369
|
+
} else (u || d) && C(f) ? (n.push({
|
|
370
370
|
kind: "binding",
|
|
371
|
-
range:
|
|
371
|
+
range: w(l.valueRange)
|
|
372
372
|
}), s(f, l.valueRange)) : l.valueRange.end > l.valueRange.start && n.push({
|
|
373
373
|
kind: "string",
|
|
374
|
-
range:
|
|
374
|
+
range: w(l.valueRange)
|
|
375
375
|
});
|
|
376
376
|
}
|
|
377
|
-
let l =
|
|
377
|
+
let l = ye(e, t, a.end);
|
|
378
378
|
l && n.push({
|
|
379
379
|
kind: "tag",
|
|
380
|
-
range:
|
|
380
|
+
range: w(l.nameRange)
|
|
381
381
|
});
|
|
382
382
|
}, u = (t, r) => {
|
|
383
383
|
for (let s of t) {
|
|
384
|
-
if (s.type === "component" && s.name)
|
|
384
|
+
if (s.type === "component" && s.name) l(s, r);
|
|
385
385
|
else if (s.type === "interpolation") n.push({
|
|
386
386
|
kind: "expression",
|
|
387
|
-
range:
|
|
387
|
+
range: w(s.range)
|
|
388
388
|
}), o(s.range.start + 2, Math.max(s.range.start + 2, s.range.end - 2));
|
|
389
389
|
else if (s.type === "math" || s.type === "inlineMath") {
|
|
390
390
|
if (n.push({
|
|
391
391
|
kind: "math",
|
|
392
|
-
range:
|
|
392
|
+
range: w(s.range)
|
|
393
393
|
}), r === "plot" && s.type === "math") {
|
|
394
394
|
let t = s.range.start + 2;
|
|
395
395
|
try {
|
|
396
|
-
for (let n of
|
|
396
|
+
for (let n of c(e.slice(t, s.range.end - 2))) {
|
|
397
397
|
let e = {
|
|
398
398
|
name: n.name,
|
|
399
399
|
range: {
|
|
@@ -407,63 +407,63 @@ function E(e, t) {
|
|
|
407
407
|
}
|
|
408
408
|
} else s.type === "code" || s.type === "inlineCode" ? n.push({
|
|
409
409
|
kind: "code",
|
|
410
|
-
range:
|
|
410
|
+
range: w(s.range)
|
|
411
411
|
}) : s.type === "comment" && n.push({
|
|
412
412
|
kind: "comment",
|
|
413
|
-
range:
|
|
413
|
+
range: w(s.range)
|
|
414
414
|
});
|
|
415
415
|
s.type !== "fallback" && s.children && u(s.children, s.name);
|
|
416
416
|
}
|
|
417
417
|
};
|
|
418
418
|
u(t);
|
|
419
|
-
for (let r of
|
|
419
|
+
for (let r of D(e, t)) n.push({
|
|
420
420
|
kind: "comment",
|
|
421
421
|
range: r
|
|
422
422
|
});
|
|
423
423
|
n.sort((e, t) => e.range.start - t.range.start || e.range.end - t.range.end);
|
|
424
|
-
let
|
|
424
|
+
let d = [];
|
|
425
425
|
for (let e of n) {
|
|
426
426
|
if (e.range.end <= e.range.start) continue;
|
|
427
|
-
let t =
|
|
428
|
-
t && e.range.start < t.range.end ||
|
|
427
|
+
let t = d[d.length - 1];
|
|
428
|
+
t && e.range.start < t.range.end || d.push(e);
|
|
429
429
|
}
|
|
430
|
-
let
|
|
430
|
+
let f = [];
|
|
431
431
|
for (let [e, t] of r) {
|
|
432
432
|
let n = [];
|
|
433
|
-
for (let t of i) t.name === e && (n.some((e) => e.start === t.range.start && e.end === t.range.end) || n.push(
|
|
434
|
-
n.sort((e, t) => e.start - t.start || e.end - t.end), t.sort((e, t) => e.start - t.start || e.end - t.end),
|
|
433
|
+
for (let t of i) t.name === e && (n.some((e) => e.start === t.range.start && e.end === t.range.end) || n.push(w(t.range)));
|
|
434
|
+
n.sort((e, t) => e.start - t.start || e.end - t.end), t.sort((e, t) => e.start - t.start || e.end - t.end), f.push({
|
|
435
435
|
name: e,
|
|
436
436
|
declarations: t,
|
|
437
437
|
references: n
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
|
-
return
|
|
441
|
-
tokens:
|
|
442
|
-
bindings:
|
|
440
|
+
return f.sort((e, t) => e.declarations[0].start - t.declarations[0].start || e.name.localeCompare(t.name)), {
|
|
441
|
+
tokens: d,
|
|
442
|
+
bindings: f,
|
|
443
443
|
mathReferences: a
|
|
444
444
|
};
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function we(e) {
|
|
447
447
|
if (typeof e != "string") return {
|
|
448
448
|
tokens: [],
|
|
449
449
|
bindings: [],
|
|
450
450
|
diagnostics: []
|
|
451
451
|
};
|
|
452
|
-
let t =
|
|
452
|
+
let t = O(e, p(e).nodes);
|
|
453
453
|
return {
|
|
454
454
|
tokens: t.tokens,
|
|
455
455
|
bindings: t.bindings,
|
|
456
|
-
diagnostics:
|
|
456
|
+
diagnostics: _e(e)
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function k(e, t, n) {
|
|
460
460
|
let r = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)/.exec(e.slice(t, Math.min(e.length, n + 1)));
|
|
461
461
|
if (!r) return null;
|
|
462
462
|
let i = !!r[1], a = r[2], o = t + r[0].length, s = [], c = !1, l, u = !1;
|
|
463
463
|
if (!i) {
|
|
464
464
|
let t = o;
|
|
465
465
|
for (; t < n;) {
|
|
466
|
-
for (; t < n &&
|
|
466
|
+
for (; t < n && S(e[t]);) t += 1;
|
|
467
467
|
if (t >= n) break;
|
|
468
468
|
if (e[t] === "/") {
|
|
469
469
|
u = !0, t += 1;
|
|
@@ -477,7 +477,7 @@ function D(e, t, n) {
|
|
|
477
477
|
let i = r[0], a = t;
|
|
478
478
|
t += i.length;
|
|
479
479
|
let o = t, d = t;
|
|
480
|
-
for (; d < n &&
|
|
480
|
+
for (; d < n && S(e[d]);) d += 1;
|
|
481
481
|
if (e[d] !== "=") {
|
|
482
482
|
s.push({
|
|
483
483
|
name: i,
|
|
@@ -490,7 +490,7 @@ function D(e, t, n) {
|
|
|
490
490
|
}), t = o;
|
|
491
491
|
continue;
|
|
492
492
|
}
|
|
493
|
-
for (t = d + 1; t < n &&
|
|
493
|
+
for (t = d + 1; t < n && S(e[t]);) t += 1;
|
|
494
494
|
let f = e[t];
|
|
495
495
|
if (f === "\"" || f === "'") {
|
|
496
496
|
let r = t, u = t + 1, d = e.indexOf(f, u);
|
|
@@ -531,7 +531,7 @@ function D(e, t, n) {
|
|
|
531
531
|
continue;
|
|
532
532
|
}
|
|
533
533
|
let p = t;
|
|
534
|
-
for (; t < n && !
|
|
534
|
+
for (; t < n && !S(e[t]);) t += 1;
|
|
535
535
|
s.push({
|
|
536
536
|
name: i,
|
|
537
537
|
nameStart: a,
|
|
@@ -552,7 +552,7 @@ function D(e, t, n) {
|
|
|
552
552
|
if (!c) {
|
|
553
553
|
let t = n;
|
|
554
554
|
for (; t > o && /[A-Za-z0-9_-]/.test(e[t - 1]);) --t;
|
|
555
|
-
t > o &&
|
|
555
|
+
t > o && S(e[t - 1]) && (d = t);
|
|
556
556
|
}
|
|
557
557
|
return {
|
|
558
558
|
name: a,
|
|
@@ -564,7 +564,7 @@ function D(e, t, n) {
|
|
|
564
564
|
partialStart: d
|
|
565
565
|
};
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function A(e, t, n) {
|
|
568
568
|
let r = [], i = (e) => {
|
|
569
569
|
for (let t of e) t.type === "component" && r.push(t.range.start), t.type !== "fallback" && t.children && i(t.children);
|
|
570
570
|
};
|
|
@@ -572,7 +572,7 @@ function O(e, t, n) {
|
|
|
572
572
|
for (let n = r.length - 1; n >= 0; --n) {
|
|
573
573
|
let i = r[n];
|
|
574
574
|
if (i >= t) continue;
|
|
575
|
-
let a =
|
|
575
|
+
let a = T(e, i);
|
|
576
576
|
if (a && t <= a.end) return i;
|
|
577
577
|
if (a && a.end < t) break;
|
|
578
578
|
}
|
|
@@ -585,13 +585,13 @@ function O(e, t, n) {
|
|
|
585
585
|
continue;
|
|
586
586
|
}
|
|
587
587
|
let r = e[n + 1];
|
|
588
|
-
if (r !== "/" && !
|
|
589
|
-
else if (
|
|
588
|
+
if (r !== "/" && !x(r)) a = n;
|
|
589
|
+
else if (Te(e, n, t)) a = n;
|
|
590
590
|
else return n;
|
|
591
591
|
}
|
|
592
592
|
return -1;
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function Te(e, t, n) {
|
|
595
595
|
let r = "";
|
|
596
596
|
for (let i = t; i < n; i += 1) {
|
|
597
597
|
let t = e[i];
|
|
@@ -601,7 +601,7 @@ function ye(e, t, n) {
|
|
|
601
601
|
}
|
|
602
602
|
return !1;
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function Ee(e, t) {
|
|
605
605
|
let n = t;
|
|
606
606
|
for (; n > 0;) {
|
|
607
607
|
let r = e.lastIndexOf("{{", n - 1);
|
|
@@ -630,7 +630,7 @@ function be(e, t) {
|
|
|
630
630
|
}
|
|
631
631
|
return null;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function De(e, t, n) {
|
|
634
634
|
let r = "";
|
|
635
635
|
for (let i = t; i < n; i += 1) {
|
|
636
636
|
let t = e[i];
|
|
@@ -638,7 +638,7 @@ function xe(e, t, n) {
|
|
|
638
638
|
}
|
|
639
639
|
return r !== "";
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function Oe(e, t) {
|
|
642
642
|
let n = 0, r = e.length - 1;
|
|
643
643
|
for (; n <= r;) {
|
|
644
644
|
let i = n + r >> 1, a = e[i];
|
|
@@ -648,44 +648,44 @@ function Se(e, t) {
|
|
|
648
648
|
}
|
|
649
649
|
return !1;
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function j(e, t, n, r) {
|
|
652
652
|
let i = e.slice(t, n), a = i && r.startsWith(i) ? r.slice(i.length) : "";
|
|
653
653
|
return {
|
|
654
654
|
start: t,
|
|
655
655
|
end: a && e.startsWith(a, n) ? n + a.length : n
|
|
656
656
|
};
|
|
657
657
|
}
|
|
658
|
-
function
|
|
659
|
-
if (
|
|
658
|
+
function ke(e, t, n, r) {
|
|
659
|
+
if (De(e, n.innerStart, t)) return [];
|
|
660
660
|
let i = t;
|
|
661
|
-
for (; i > n.innerStart &&
|
|
661
|
+
for (; i > n.innerStart && ge(e[i - 1]);) --i;
|
|
662
662
|
if (e[i - 1] === ".") return [];
|
|
663
663
|
let a = e.slice(i, t);
|
|
664
|
-
return a && !
|
|
664
|
+
return a && !x(a[0]) ? [] : r.filter((e) => e.name.startsWith(a)).map((n) => ({
|
|
665
665
|
label: n.name,
|
|
666
666
|
insertText: n.name,
|
|
667
|
-
range:
|
|
667
|
+
range: j(e, i, t, n.name),
|
|
668
668
|
kind: "binding",
|
|
669
669
|
detail: `${n.declarations.length} declaration${n.declarations.length === 1 ? "" : "s"}, ${n.references.length} reference${n.references.length === 1 ? "" : "s"}`
|
|
670
670
|
}));
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function Ae(e, t, n) {
|
|
673
673
|
let r = n.currentAttribute;
|
|
674
674
|
if (!r) return [];
|
|
675
|
-
let i =
|
|
675
|
+
let i = v(n.name)?.props[r.name];
|
|
676
676
|
if (!i || i.kind !== "enum" || !i.values) return [];
|
|
677
677
|
let a = r.valueRange?.start ?? t, o = e.slice(a, t);
|
|
678
678
|
return i.values.filter((e) => e.startsWith(o)).map((n) => ({
|
|
679
679
|
label: n,
|
|
680
680
|
insertText: n,
|
|
681
|
-
range:
|
|
681
|
+
range: j(e, a, t, n),
|
|
682
682
|
kind: "value",
|
|
683
683
|
detail: `${r.name} value`
|
|
684
684
|
}));
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function je(e, t, n) {
|
|
687
687
|
if (n.closing || n.inValue || n.partialStart < 0) return [];
|
|
688
|
-
let r =
|
|
688
|
+
let r = v(n.name);
|
|
689
689
|
if (!r) return [];
|
|
690
690
|
let i = e.slice(n.partialStart, t);
|
|
691
691
|
if (i && !/^[A-Za-z0-9_-]*$/.test(i)) return [];
|
|
@@ -693,12 +693,12 @@ function Te(e, t, n) {
|
|
|
693
693
|
return Object.entries(r.props).filter(([e]) => !a.has(e) && e.startsWith(i)).map(([r, i]) => ({
|
|
694
694
|
label: r,
|
|
695
695
|
insertText: r,
|
|
696
|
-
range:
|
|
696
|
+
range: j(e, n.partialStart, t, r),
|
|
697
697
|
kind: "attribute",
|
|
698
698
|
detail: i.required ? `${i.kind}, required` : i.kind
|
|
699
699
|
}));
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function Me(e, t) {
|
|
702
702
|
let n = Math.max(0, t - 256), r = e.slice(n, t), i = /<\/?([A-Za-z][A-Za-z0-9-]*)?$/.exec(r);
|
|
703
703
|
if (!i) return [];
|
|
704
704
|
let a = n + i.index;
|
|
@@ -706,94 +706,94 @@ function Ee(e, t) {
|
|
|
706
706
|
let o = e[a + 1] === "/", s = a + (o ? 2 : 1);
|
|
707
707
|
if (s > t) return [];
|
|
708
708
|
let c = i[1] ?? "";
|
|
709
|
-
return
|
|
709
|
+
return ee.filter((e) => e.startsWith(c)).map((n) => ({
|
|
710
710
|
label: n,
|
|
711
711
|
insertText: n,
|
|
712
|
-
range:
|
|
712
|
+
range: j(e, s, t, n),
|
|
713
713
|
kind: "tag",
|
|
714
714
|
detail: o ? "closing tag" : "component"
|
|
715
715
|
}));
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function Ne(e, t) {
|
|
718
718
|
if (typeof e != "string" || !Number.isFinite(t)) return [];
|
|
719
|
-
let n = Math.max(0, Math.min(e.length, Math.floor(t))), r =
|
|
720
|
-
if (
|
|
721
|
-
let a =
|
|
719
|
+
let n = Math.max(0, Math.min(e.length, Math.floor(t))), r = p(e), i = [...E(r.nodes), ...D(e, r.nodes)].sort((e, t) => e.start - t.start);
|
|
720
|
+
if (Oe(i, n) || n === e.length && i.some((e) => e.end === n && e.start < n)) return [];
|
|
721
|
+
let a = O(e, r.nodes), o = Ee(e, n);
|
|
722
722
|
if (o) {
|
|
723
|
-
let t =
|
|
723
|
+
let t = A(e, n, r.nodes);
|
|
724
724
|
if (t >= 0) {
|
|
725
|
-
let r =
|
|
726
|
-
if (r?.inValue && r.currentAttribute &&
|
|
725
|
+
let r = k(e, t, n);
|
|
726
|
+
if (r?.inValue && r.currentAttribute && v(r.name)?.props[r.currentAttribute.name]?.static) return [];
|
|
727
727
|
}
|
|
728
|
-
return
|
|
728
|
+
return ke(e, n, o, a.bindings);
|
|
729
729
|
}
|
|
730
|
-
let s =
|
|
730
|
+
let s = A(e, n, r.nodes);
|
|
731
731
|
if (s >= 0) {
|
|
732
|
-
let t =
|
|
733
|
-
if (t?.inValue) return
|
|
732
|
+
let t = k(e, s, n);
|
|
733
|
+
if (t?.inValue) return Ae(e, n, t);
|
|
734
734
|
}
|
|
735
|
-
let c =
|
|
735
|
+
let c = Me(e, n);
|
|
736
736
|
if (c.length > 0) return c;
|
|
737
737
|
if (s >= 0) {
|
|
738
|
-
let t =
|
|
739
|
-
if (t) return
|
|
738
|
+
let t = k(e, s, n);
|
|
739
|
+
if (t) return je(e, n, t);
|
|
740
740
|
}
|
|
741
741
|
return [];
|
|
742
742
|
}
|
|
743
|
-
function
|
|
743
|
+
function Pe(e, t) {
|
|
744
744
|
let n = "", r = 0;
|
|
745
745
|
for (let i of t) n += e.slice(r, i.range.start) + i.text, r = i.range.end;
|
|
746
746
|
return n + e.slice(r);
|
|
747
747
|
}
|
|
748
|
-
function
|
|
748
|
+
function Fe(e, t, n) {
|
|
749
749
|
if (typeof e != "string" || typeof t != "string" || typeof n != "string") throw Error("Rename requires string arguments.");
|
|
750
|
-
if (!
|
|
751
|
-
let r =
|
|
750
|
+
if (!C(n)) throw Error(`"${n}" is not a valid binding name. Use [A-Za-z_][A-Za-z0-9_]* and avoid reserved names.`);
|
|
751
|
+
let r = O(e, p(e).nodes), i = r.bindings.find((e) => e.name === t);
|
|
752
752
|
if (!i || i.declarations.length === 0) throw Error(`Binding "${t}" is not declared in this document.`);
|
|
753
753
|
if (t === n) return {
|
|
754
754
|
source: e,
|
|
755
755
|
edits: []
|
|
756
756
|
};
|
|
757
757
|
if (r.bindings.some((e) => e.name === n)) throw Error(`Binding "${n}" already exists.`);
|
|
758
|
-
if (
|
|
758
|
+
if (_e(e).some((e) => e.severity === "error" && he.has(e.code))) throw Error("The document cannot be renamed safely while parse errors remain.");
|
|
759
759
|
let a = /* @__PURE__ */ new Set(), o = [];
|
|
760
760
|
for (let e of [...i.declarations, ...i.references]) {
|
|
761
761
|
let t = `${e.start}:${e.end}`;
|
|
762
|
-
a.has(t) || (a.add(t), o.push(
|
|
762
|
+
a.has(t) || (a.add(t), o.push(w(e)));
|
|
763
763
|
}
|
|
764
764
|
o.sort((e, t) => e.start - t.start || e.end - t.end);
|
|
765
765
|
let s = new Set(r.mathReferences.filter((e) => e.name === t).map((e) => `${e.range.start}:${e.range.end}`)), c = o.map((e) => ({
|
|
766
|
-
range:
|
|
766
|
+
range: w(e),
|
|
767
767
|
text: s.has(`${e.start}:${e.end}`) ? `\\mathrm{${n}}` : n
|
|
768
|
-
})), l =
|
|
769
|
-
if (
|
|
768
|
+
})), l = Pe(e, c);
|
|
769
|
+
if (y(e).ok && !y(l).ok) throw Error("Rename could not preserve all binding references; the source was left unchanged.");
|
|
770
770
|
return {
|
|
771
771
|
source: l,
|
|
772
772
|
edits: c
|
|
773
773
|
};
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function Ie(e, t) {
|
|
776
776
|
let n = e.slice(t.nameRange.start, t.nameRange.end), r = t.attrs.map((t) => {
|
|
777
777
|
let n = e.slice(t.nameRange.start, t.nameRange.end);
|
|
778
778
|
return t.valueRange === void 0 ? n : t.quoteStart !== void 0 && t.quoteEnd !== void 0 ? `${n}=${e.slice(t.quoteStart, t.quoteEnd + 1)}` : n;
|
|
779
779
|
}), i = r.length > 0 ? `<${n} ${r.join(" ")}` : `<${n}`;
|
|
780
780
|
return t.selfClosing ? `${i} />` : `${i}>`;
|
|
781
781
|
}
|
|
782
|
-
function
|
|
782
|
+
function Le(e) {
|
|
783
783
|
if (typeof e != "string") return e;
|
|
784
784
|
let t;
|
|
785
785
|
try {
|
|
786
|
-
t =
|
|
786
|
+
t = y(e);
|
|
787
787
|
} catch {
|
|
788
788
|
return e;
|
|
789
789
|
}
|
|
790
790
|
if (t.diagnostics.some((e) => e.severity === "error")) return e;
|
|
791
|
-
let n =
|
|
791
|
+
let n = p(e), r = [], i = (t) => {
|
|
792
792
|
for (let n of t) {
|
|
793
793
|
if (n.type === "component" && n.name) {
|
|
794
|
-
let t =
|
|
794
|
+
let t = T(e, n.range.start);
|
|
795
795
|
if (t && !t.closing && !/[\r\n]/.test(e.slice(t.start, t.end))) {
|
|
796
|
-
let n =
|
|
796
|
+
let n = Ie(e, t);
|
|
797
797
|
n !== e.slice(t.start, t.end) && r.push({
|
|
798
798
|
start: t.start,
|
|
799
799
|
end: t.end,
|
|
@@ -801,7 +801,7 @@ function je(e) {
|
|
|
801
801
|
});
|
|
802
802
|
}
|
|
803
803
|
if (t) {
|
|
804
|
-
let i =
|
|
804
|
+
let i = ye(e, n, t.end);
|
|
805
805
|
if (i && !/[\r\n]/.test(e.slice(i.start, i.end))) {
|
|
806
806
|
let t = `</${e.slice(i.nameRange.start, i.nameRange.end)}>`;
|
|
807
807
|
t !== e.slice(i.start, i.end) && r.push({
|
|
@@ -821,7 +821,7 @@ function je(e) {
|
|
|
821
821
|
return a + e.slice(o);
|
|
822
822
|
}
|
|
823
823
|
// src/local/source-migration.ts
|
|
824
|
-
var
|
|
824
|
+
var M = /* @__PURE__ */ new Set([
|
|
825
825
|
"sum",
|
|
826
826
|
"average",
|
|
827
827
|
"minOf",
|
|
@@ -839,7 +839,7 @@ var A = /* @__PURE__ */ new Set([
|
|
|
839
839
|
"slice",
|
|
840
840
|
"dateCompare",
|
|
841
841
|
"dateDiff"
|
|
842
|
-
]),
|
|
842
|
+
]), Re = /* @__PURE__ */ new Set([
|
|
843
843
|
"jump",
|
|
844
844
|
"anchor",
|
|
845
845
|
"text",
|
|
@@ -855,8 +855,8 @@ var A = /* @__PURE__ */ new Set([
|
|
|
855
855
|
"validation",
|
|
856
856
|
"data-table",
|
|
857
857
|
"column"
|
|
858
|
-
]),
|
|
859
|
-
function
|
|
858
|
+
]), N = `<!-- reactive-md: ${f} -->`;
|
|
859
|
+
function P(e) {
|
|
860
860
|
let t = e.diagnostics.filter((t) => t.code.startsWith("local.version.") || t.code === "local.budget" || t.code === "local.parse" && !e.nodes.length), n = e.versionDeclaration?.version ?? null;
|
|
861
861
|
return {
|
|
862
862
|
declaredVersion: n,
|
|
@@ -866,24 +866,24 @@ function M(e) {
|
|
|
866
866
|
diagnostics: t
|
|
867
867
|
};
|
|
868
868
|
}
|
|
869
|
-
function
|
|
870
|
-
return
|
|
869
|
+
function ze(e) {
|
|
870
|
+
return P(p(e));
|
|
871
871
|
}
|
|
872
|
-
function
|
|
873
|
-
let
|
|
872
|
+
function Be(e, t, n, i, a = "error") {
|
|
873
|
+
let o = u(t, i), s = e.slice(0, n.start), c = s.lastIndexOf("\n");
|
|
874
874
|
return {
|
|
875
|
-
code:
|
|
876
|
-
severity:
|
|
877
|
-
range: { ...
|
|
878
|
-
message:
|
|
879
|
-
line:
|
|
880
|
-
column:
|
|
881
|
-
messageKey:
|
|
882
|
-
...
|
|
875
|
+
code: t,
|
|
876
|
+
severity: a,
|
|
877
|
+
range: { ...n },
|
|
878
|
+
message: r(o),
|
|
879
|
+
line: s.split("\n").length,
|
|
880
|
+
column: n.start - c,
|
|
881
|
+
messageKey: o.key,
|
|
882
|
+
...o.params ? { params: o.params } : {}
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
|
-
function
|
|
886
|
-
let n =
|
|
885
|
+
function F(e, t = {}) {
|
|
886
|
+
let n = p(e), r = P(n), i = typeof t == "object" && !!t && !Array.isArray(t), a = i ? t.fromVersion ?? r.effectiveVersion : r.effectiveVersion, o = typeof a == "string" ? a : "", s = {
|
|
887
887
|
ok: !1,
|
|
888
888
|
fromVersion: o,
|
|
889
889
|
toVersion: f,
|
|
@@ -907,17 +907,17 @@ function N(e, t = {}) {
|
|
|
907
907
|
}
|
|
908
908
|
s.diagnostics.push(e);
|
|
909
909
|
}, d = (t, n, r, i) => {
|
|
910
|
-
u(
|
|
910
|
+
u(Be(e, t, n, r, i));
|
|
911
911
|
};
|
|
912
912
|
if (!i || typeof a != "string" || !["local-draft-1", "local-draft-2"].includes(o) || t.allowSemanticChanges !== void 0 && typeof t.allowSemanticChanges != "boolean" || t.fromVersion !== void 0 && r.declaredVersion !== null && o !== r.declaredVersion) return d("local.upgrade.from-version", l, {
|
|
913
913
|
from: o,
|
|
914
914
|
detail: "use local-draft-1 or local-draft-2 and match the source declaration"
|
|
915
915
|
}), c;
|
|
916
|
-
let
|
|
916
|
+
let m = n.versionDeclaration ? e.slice(0, l.start) + e.slice(l.start, l.end).replace(/[^\r\n]/g, " ") + e.slice(l.end) : e, h = n.versionDeclaration ? p(m) : n;
|
|
917
917
|
if (o === "local-draft-1") {
|
|
918
918
|
let e = (n) => {
|
|
919
919
|
for (let r of n) {
|
|
920
|
-
if (r.name &&
|
|
920
|
+
if (r.name && Re.has(r.name)) {
|
|
921
921
|
d("local.upgrade.tag", r.range, { name: r.name });
|
|
922
922
|
continue;
|
|
923
923
|
}
|
|
@@ -929,32 +929,32 @@ function N(e, t = {}) {
|
|
|
929
929
|
"bind-y"
|
|
930
930
|
]) {
|
|
931
931
|
let t = r.attrs?.[e];
|
|
932
|
-
t &&
|
|
932
|
+
t && M.has(t) && d("local.upgrade.reserved-binding", r.range, { name: t });
|
|
933
933
|
}
|
|
934
934
|
(r.name === "input" || r.name === "textarea") && (r.attrs?.["max-length"] !== void 0 || Number(r.attrs?.["min-length"] ?? 0) > 0) && d("local.upgrade.text-length", r.range, void 0, t.allowSemanticChanges ? "warning" : "error");
|
|
935
935
|
let n = [...r.type === "interpolation" ? [r.value ?? ""] : [], ...Object.values(r.attrs ?? {}).flatMap((e) => [...e.matchAll(/\{\{([\s\S]*?)\}\}/g)].map((e) => e[1]))];
|
|
936
936
|
for (let e of n) {
|
|
937
937
|
let t = e.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g, "");
|
|
938
|
-
(t.includes("[") || [...
|
|
938
|
+
(t.includes("[") || [...M].some((e) => RegExp(`\\b${e}\\s*\\(`).test(t))) && d("local.upgrade.expression", r.range);
|
|
939
939
|
}
|
|
940
940
|
r.type !== "fallback" && r.children && e(r.children);
|
|
941
941
|
}
|
|
942
942
|
};
|
|
943
|
-
e(
|
|
943
|
+
e(h.nodes);
|
|
944
944
|
}
|
|
945
945
|
if (s.diagnostics.some((e) => e.severity === "error")) return c;
|
|
946
|
-
let
|
|
947
|
-
for (let e of
|
|
948
|
-
return
|
|
946
|
+
let g = y(m);
|
|
947
|
+
for (let e of g.diagnostics) u(e);
|
|
948
|
+
return g.ok && (!n.versionDeclaration && s.diagnostics.length < 100 && d("local.upgrade.version-missing", {
|
|
949
949
|
start: +(e.charCodeAt(0) === 65279),
|
|
950
950
|
end: +(e.charCodeAt(0) === 65279)
|
|
951
951
|
}, { version: f }, "warning"), s.ok = !0), c;
|
|
952
952
|
}
|
|
953
|
-
function
|
|
954
|
-
return
|
|
953
|
+
function Ve(e, t) {
|
|
954
|
+
return F(e, t).report;
|
|
955
955
|
}
|
|
956
|
-
function
|
|
957
|
-
let { report: n, declaration: r } =
|
|
956
|
+
function He(e, t) {
|
|
957
|
+
let { report: n, declaration: r } = F(e, t), i = {
|
|
958
958
|
...n,
|
|
959
959
|
source: e,
|
|
960
960
|
changed: !1,
|
|
@@ -964,7 +964,7 @@ function Ie(e, t) {
|
|
|
964
964
|
let a = +(e.charCodeAt(0) === 65279), o = r?.range ?? {
|
|
965
965
|
start: a,
|
|
966
966
|
end: a
|
|
967
|
-
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ?
|
|
967
|
+
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ? N : `${N}${s}${s}`, l = e.slice(0, o.start) + c + e.slice(o.end);
|
|
968
968
|
return {
|
|
969
969
|
...n,
|
|
970
970
|
source: l,
|
|
@@ -976,17 +976,17 @@ function Ie(e, t) {
|
|
|
976
976
|
};
|
|
977
977
|
}
|
|
978
978
|
// src/local/state.ts
|
|
979
|
-
var
|
|
979
|
+
var I = "reactive-md-state/v1", Ue = 1048576, We = /^fnv1a32:[0-9a-f]{8}$/, Ge = 2166136261, Ke = 16777619, qe = /* @__PURE__ */ new Set([
|
|
980
980
|
"format",
|
|
981
981
|
"syntax",
|
|
982
982
|
"sourceDigest",
|
|
983
983
|
"parameters",
|
|
984
984
|
"generator"
|
|
985
|
-
]),
|
|
985
|
+
]), Je = /* @__PURE__ */ new Set(["name", "version"]), Ye = new TextEncoder();
|
|
986
986
|
function L(e, t) {
|
|
987
987
|
return {
|
|
988
988
|
code: e,
|
|
989
|
-
message: t.length > 2e3 ? `${t.slice(0,
|
|
989
|
+
message: t.length > 2e3 ? `${t.slice(0, d - 1)}…` : t,
|
|
990
990
|
severity: "error",
|
|
991
991
|
range: {
|
|
992
992
|
start: 0,
|
|
@@ -1019,8 +1019,8 @@ function B(e) {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
function V(e) {
|
|
1021
1021
|
if (typeof e != "string") throw TypeError("localSourceDigest requires a source string.");
|
|
1022
|
-
let t =
|
|
1023
|
-
for (let e = 0; e < t.length; e += 1) n ^= t[e], n = Math.imul(n,
|
|
1022
|
+
let t = Ye.encode(e), n = Ge;
|
|
1023
|
+
for (let e = 0; e < t.length; e += 1) n ^= t[e], n = Math.imul(n, Ke) >>> 0;
|
|
1024
1024
|
return `fnv1a32:${n.toString(16).padStart(8, "0")}`;
|
|
1025
1025
|
}
|
|
1026
1026
|
function H(e) {
|
|
@@ -1071,10 +1071,10 @@ function U(e) {
|
|
|
1071
1071
|
let t = Object.getPrototypeOf(e);
|
|
1072
1072
|
return t === Object.prototype || t === null;
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1074
|
+
function Xe(e) {
|
|
1075
1075
|
return Object.freeze(e.parameters), e.generator && Object.freeze(e.generator), Object.freeze(e);
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function Ze(e) {
|
|
1078
1078
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("generator must be an object with string name and version.");
|
|
1079
1079
|
if (typeof e.name != "string" || typeof e.version != "string") throw TypeError("generator must have string name and version.");
|
|
1080
1080
|
if (!B(e.name) || !B(e.version)) throw TypeError("generator name and version must be well-formed Unicode strings.");
|
|
@@ -1083,13 +1083,13 @@ function Ue(e) {
|
|
|
1083
1083
|
version: e.version
|
|
1084
1084
|
});
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function Qe(e) {
|
|
1087
1087
|
return typeof e == "string" ? `"${e.length > 48 ? `${e.slice(0, 48)}…` : e}"` : e === null ? "null" : Array.isArray(e) ? "an array" : typeof e;
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1090
|
-
return e.length > t ? e.length :
|
|
1089
|
+
function $e(e, t) {
|
|
1090
|
+
return e.length > t ? e.length : Ye.encode(e).byteLength;
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function et(e, t) {
|
|
1093
1093
|
let n;
|
|
1094
1094
|
try {
|
|
1095
1095
|
let t = JSON.stringify(e);
|
|
@@ -1098,17 +1098,17 @@ function Ke(e, t) {
|
|
|
1098
1098
|
} catch {
|
|
1099
1099
|
return null;
|
|
1100
1100
|
}
|
|
1101
|
-
return
|
|
1101
|
+
return $e(n, t);
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1104
|
-
if (e === void 0) return
|
|
1103
|
+
function tt(e) {
|
|
1104
|
+
if (e === void 0) return Ue;
|
|
1105
1105
|
if (typeof e != "object" || !e) throw TypeError("parseLocalState options must be an object.");
|
|
1106
1106
|
let { maxLength: t } = e;
|
|
1107
|
-
if (t === void 0) return
|
|
1107
|
+
if (t === void 0) return Ue;
|
|
1108
1108
|
if (typeof t != "number" || !Number.isSafeInteger(t) || t <= 0) throw RangeError("maxLength must be a finite positive integer.");
|
|
1109
1109
|
return t;
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1111
|
+
function nt(e, t, n) {
|
|
1112
1112
|
if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
|
|
1113
1113
|
if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
|
|
1114
1114
|
let r = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), i = new Set(r), a = /* @__PURE__ */ new Map();
|
|
@@ -1129,17 +1129,17 @@ function Je(e, t, n) {
|
|
|
1129
1129
|
o[e] = a.get(e);
|
|
1130
1130
|
}
|
|
1131
1131
|
let s = {
|
|
1132
|
-
format:
|
|
1132
|
+
format: I,
|
|
1133
1133
|
syntax: f,
|
|
1134
1134
|
sourceDigest: V(e.source),
|
|
1135
1135
|
parameters: o
|
|
1136
1136
|
};
|
|
1137
|
-
return n !== void 0 && (s.generator =
|
|
1137
|
+
return n !== void 0 && (s.generator = Ze(n)), Xe(s);
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1139
|
+
function rt(e, t) {
|
|
1140
1140
|
let n = [], r = (e, t) => R(n, e, t), i = e;
|
|
1141
1141
|
if (typeof e == "string") {
|
|
1142
|
-
if (
|
|
1142
|
+
if ($e(e, t) > t) return {
|
|
1143
1143
|
ok: !1,
|
|
1144
1144
|
diagnostics: [L("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
1145
1145
|
};
|
|
@@ -1156,7 +1156,7 @@ function Ye(e, t) {
|
|
|
1156
1156
|
};
|
|
1157
1157
|
}
|
|
1158
1158
|
} else {
|
|
1159
|
-
let n =
|
|
1159
|
+
let n = et(e, t);
|
|
1160
1160
|
if (n === null) return {
|
|
1161
1161
|
ok: !1,
|
|
1162
1162
|
diagnostics: [L("local.state.shape", "The state payload must be a JSON object.")]
|
|
@@ -1171,13 +1171,13 @@ function Ye(e, t) {
|
|
|
1171
1171
|
diagnostics: [L("local.state.shape", "The state payload must be a JSON object.")]
|
|
1172
1172
|
};
|
|
1173
1173
|
Object.getOwnPropertySymbols(i).length > 0 && r("local.state.shape", "The state payload cannot use symbol keys.");
|
|
1174
|
-
for (let e of Object.keys(i))
|
|
1174
|
+
for (let e of Object.keys(i)) qe.has(e) || r("local.state.key", `Unknown top-level state key "${e}".`);
|
|
1175
1175
|
let a = i.format;
|
|
1176
|
-
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${
|
|
1176
|
+
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${Qe(a)}; expected "${I}".`);
|
|
1177
1177
|
let o = i.syntax;
|
|
1178
|
-
o !== "local-draft-2" && r("local.state.syntax", `Unsupported state syntax ${
|
|
1178
|
+
o !== "local-draft-2" && r("local.state.syntax", `Unsupported state syntax ${Qe(o)}; expected "${f}".`);
|
|
1179
1179
|
let s = i.sourceDigest;
|
|
1180
|
-
typeof s == "string" &&
|
|
1180
|
+
typeof s == "string" && We.test(s) || r("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
1181
1181
|
let c = {}, l = i.parameters;
|
|
1182
1182
|
if (!U(l)) r("local.state.parameters", "parameters must be a JSON object of public binding values.");
|
|
1183
1183
|
else for (let e of Object.keys(l).sort()) {
|
|
@@ -1197,7 +1197,7 @@ function Ye(e, t) {
|
|
|
1197
1197
|
let e = i.generator;
|
|
1198
1198
|
if (!U(e)) r("local.state.generator", "generator must be an object with string name and version.");
|
|
1199
1199
|
else {
|
|
1200
|
-
for (let t of Object.keys(e))
|
|
1200
|
+
for (let t of Object.keys(e)) Je.has(t) || r("local.state.generator", `generator has unknown key "${t}".`);
|
|
1201
1201
|
typeof e.name != "string" || typeof e.version != "string" ? r("local.state.generator", "generator must have string name and version.") : !B(e.name) || !B(e.version) ? r("local.state.utf", "generator contains malformed Unicode.") : u = Object.freeze({
|
|
1202
1202
|
name: e.name,
|
|
1203
1203
|
version: e.version
|
|
@@ -1209,20 +1209,20 @@ function Ye(e, t) {
|
|
|
1209
1209
|
diagnostics: n
|
|
1210
1210
|
};
|
|
1211
1211
|
let d = {
|
|
1212
|
-
format:
|
|
1212
|
+
format: I,
|
|
1213
1213
|
syntax: f,
|
|
1214
1214
|
sourceDigest: s,
|
|
1215
1215
|
parameters: c
|
|
1216
1216
|
};
|
|
1217
1217
|
return u && (d.generator = u), {
|
|
1218
1218
|
ok: !0,
|
|
1219
|
-
file:
|
|
1219
|
+
file: Xe(d)
|
|
1220
1220
|
};
|
|
1221
1221
|
}
|
|
1222
1222
|
function W(e, t) {
|
|
1223
|
-
let n =
|
|
1223
|
+
let n = tt(t);
|
|
1224
1224
|
try {
|
|
1225
|
-
return
|
|
1225
|
+
return rt(e, n);
|
|
1226
1226
|
} catch (e) {
|
|
1227
1227
|
return {
|
|
1228
1228
|
ok: !1,
|
|
@@ -1230,14 +1230,14 @@ function W(e, t) {
|
|
|
1230
1230
|
};
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1233
|
+
function it(e) {
|
|
1234
1234
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1235
1235
|
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
1236
1236
|
};
|
|
1237
1237
|
return n(e.nodes), t;
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1240
|
-
let t =
|
|
1239
|
+
function at(e) {
|
|
1240
|
+
let t = it(e), n = /* @__PURE__ */ new Map(), r = [];
|
|
1241
1241
|
for (let [i, a] of Object.entries(e.bindingSlots ?? {})) {
|
|
1242
1242
|
let e = t.get(i);
|
|
1243
1243
|
if (!e) continue;
|
|
@@ -1289,7 +1289,7 @@ function G(e, t, n) {
|
|
|
1289
1289
|
}
|
|
1290
1290
|
return r;
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1292
|
+
function ot(e, t) {
|
|
1293
1293
|
let n = e.snapshot(), r = {};
|
|
1294
1294
|
for (let e of t) {
|
|
1295
1295
|
let t = n.state[e];
|
|
@@ -1297,7 +1297,7 @@ function Qe(e, t) {
|
|
|
1297
1297
|
}
|
|
1298
1298
|
return Object.freeze(r);
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1300
|
+
function st(e, t, n, r) {
|
|
1301
1301
|
let i = W(t, r);
|
|
1302
1302
|
if (!i.ok) return i;
|
|
1303
1303
|
if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
|
|
@@ -1312,7 +1312,7 @@ function $e(e, t, n, r) {
|
|
|
1312
1312
|
ok: !1,
|
|
1313
1313
|
diagnostics: [L("local.state.source", "This state file was created for a different document (source digest mismatch).")]
|
|
1314
1314
|
};
|
|
1315
|
-
let a =
|
|
1315
|
+
let a = at(e), o = new Set(a.plans.map((e) => e.key)), s = [];
|
|
1316
1316
|
for (let e of Object.keys(i.file.parameters)) o.has(e) || R(s, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
|
|
1317
1317
|
for (let e of o) Object.hasOwn(i.file.parameters, e) || R(s, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
|
|
1318
1318
|
if (s.length) return {
|
|
@@ -1321,7 +1321,7 @@ function $e(e, t, n, r) {
|
|
|
1321
1321
|
};
|
|
1322
1322
|
let c;
|
|
1323
1323
|
try {
|
|
1324
|
-
c =
|
|
1324
|
+
c = b(e);
|
|
1325
1325
|
} catch (e) {
|
|
1326
1326
|
return {
|
|
1327
1327
|
ok: !1,
|
|
@@ -1345,15 +1345,15 @@ function $e(e, t, n, r) {
|
|
|
1345
1345
|
return {
|
|
1346
1346
|
ok: !0,
|
|
1347
1347
|
file: i.file,
|
|
1348
|
-
state:
|
|
1348
|
+
state: ot(c, t)
|
|
1349
1349
|
};
|
|
1350
1350
|
} finally {
|
|
1351
1351
|
c.dispose();
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function ct(e, t, n) {
|
|
1355
1355
|
try {
|
|
1356
|
-
return
|
|
1356
|
+
return st(e, t, void 0, n);
|
|
1357
1357
|
} catch (e) {
|
|
1358
1358
|
return {
|
|
1359
1359
|
ok: !1,
|
|
@@ -1361,29 +1361,29 @@ function et(e, t, n) {
|
|
|
1361
1361
|
};
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
|
-
function
|
|
1364
|
+
function lt(e, t, n) {
|
|
1365
1365
|
let r;
|
|
1366
1366
|
try {
|
|
1367
|
-
r =
|
|
1367
|
+
r = st(e.document, t, e.snapshot().state, n);
|
|
1368
1368
|
} catch (e) {
|
|
1369
1369
|
return [L("local.state.invalid", `Cannot apply the local state: ${z(e)}`)];
|
|
1370
1370
|
}
|
|
1371
1371
|
if (!r.ok) return r.diagnostics;
|
|
1372
|
-
let i =
|
|
1372
|
+
let i = at(e.document);
|
|
1373
1373
|
try {
|
|
1374
1374
|
return G(e, i, r.state);
|
|
1375
1375
|
} catch (e) {
|
|
1376
1376
|
return [L("local.state.invalid", `Cannot apply the local state: ${z(e)}`)];
|
|
1377
1377
|
}
|
|
1378
1378
|
}
|
|
1379
|
-
function
|
|
1380
|
-
return
|
|
1379
|
+
function ut(e, t) {
|
|
1380
|
+
return nt(e.document, e.getParameters(), t);
|
|
1381
1381
|
}
|
|
1382
|
-
function
|
|
1382
|
+
function dt(e, t, n) {
|
|
1383
1383
|
let r = W(t, n);
|
|
1384
|
-
return r.ok ?
|
|
1384
|
+
return r.ok ? lt(e, r.file, n) : r.diagnostics;
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1386
|
+
function ft(e) {
|
|
1387
1387
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("serializeLocalState requires a state file.");
|
|
1388
1388
|
if (!e.parameters || typeof e.parameters != "object" || Array.isArray(e.parameters)) throw TypeError("serializeLocalState requires an object of parameters.");
|
|
1389
1389
|
let t = Object.create(null);
|
|
@@ -1400,7 +1400,7 @@ function it(e) {
|
|
|
1400
1400
|
parameters: t
|
|
1401
1401
|
};
|
|
1402
1402
|
if (e.generator !== void 0) {
|
|
1403
|
-
let t =
|
|
1403
|
+
let t = Ze(e.generator);
|
|
1404
1404
|
n.generator = {
|
|
1405
1405
|
name: t.name,
|
|
1406
1406
|
version: t.version
|
|
@@ -1409,24 +1409,24 @@ function it(e) {
|
|
|
1409
1409
|
return JSON.stringify(n);
|
|
1410
1410
|
}
|
|
1411
1411
|
// src/local/retention.ts
|
|
1412
|
-
function
|
|
1412
|
+
function pt(e) {
|
|
1413
1413
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1414
1414
|
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
1415
1415
|
};
|
|
1416
1416
|
return n(e.nodes), t;
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1418
|
+
function mt(e, t, n) {
|
|
1419
1419
|
let r = e.bindingSlots?.[t.id];
|
|
1420
1420
|
return r !== void 0 && Object.values(r).includes(n);
|
|
1421
1421
|
}
|
|
1422
|
-
function
|
|
1423
|
-
let t =
|
|
1422
|
+
function ht(e) {
|
|
1423
|
+
let t = pt(e), n = /* @__PURE__ */ new Map();
|
|
1424
1424
|
for (let [r, i] of Object.entries(e.bindings)) {
|
|
1425
1425
|
let a = i.nodeIds.flatMap((e) => {
|
|
1426
1426
|
let n = t.get(e);
|
|
1427
1427
|
return n ? [n] : [];
|
|
1428
1428
|
});
|
|
1429
|
-
if (!a.length || r.startsWith("@") || a.some((t) => t.attrs?.bind !== r && !
|
|
1429
|
+
if (!a.length || r.startsWith("@") || a.some((t) => t.attrs?.bind !== r && !mt(e, t, r) || t.name === "timer" || t.name === "checklist")) continue;
|
|
1430
1430
|
let o = a.flatMap((e) => Object.hasOwn(e.attrs ?? {}, "initial") ? [e.attrs.initial] : []).sort();
|
|
1431
1431
|
n.set(r, {
|
|
1432
1432
|
type: i.type,
|
|
@@ -1441,8 +1441,8 @@ function K(e, t) {
|
|
|
1441
1441
|
reason: t
|
|
1442
1442
|
});
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1445
|
-
let t =
|
|
1444
|
+
function gt(e) {
|
|
1445
|
+
let t = ht(e.previous), n = ht(e.next), r = {}, i = [], a = [];
|
|
1446
1446
|
for (let o of Object.keys(e.state).sort()) {
|
|
1447
1447
|
if (o.startsWith("@")) {
|
|
1448
1448
|
a.push(K(o, "internal"));
|
|
@@ -1474,38 +1474,72 @@ function ct(e) {
|
|
|
1474
1474
|
dropped: Object.freeze(a)
|
|
1475
1475
|
});
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function _t(e, t, n) {
|
|
1478
1478
|
return Object.freeze({
|
|
1479
1479
|
retained: Object.freeze([...e]),
|
|
1480
1480
|
dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
|
|
1481
1481
|
diagnostics: Object.freeze([...n])
|
|
1482
1482
|
});
|
|
1483
1483
|
}
|
|
1484
|
-
function
|
|
1484
|
+
function vt(e, t) {
|
|
1485
1485
|
let n = Object.keys(t.values).sort();
|
|
1486
|
-
if (!e.setParameters(t.values).length) return
|
|
1486
|
+
if (!e.setParameters(t.values).length) return _t(n, t.dropped, []);
|
|
1487
1487
|
let r = [], i = [...t.dropped], a = [];
|
|
1488
1488
|
for (let o of n) {
|
|
1489
1489
|
let n = e.setParameter(o, t.values[o]);
|
|
1490
1490
|
n.length ? (i.push(K(o, "invalid")), a.push(...n)) : r.push(o);
|
|
1491
1491
|
}
|
|
1492
|
-
return i.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)),
|
|
1492
|
+
return i.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), _t(r, i, a);
|
|
1493
1493
|
}
|
|
1494
1494
|
// src/local/worker.ts
|
|
1495
|
-
var
|
|
1496
|
-
function
|
|
1495
|
+
var yt = 150;
|
|
1496
|
+
function bt(e) {
|
|
1497
|
+
if (e !== void 0) try {
|
|
1498
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
1499
|
+
let t = e, n = {};
|
|
1500
|
+
for (let e of ae) Object.hasOwn(t, e) && (n[e] = t[e]);
|
|
1501
|
+
if (Object.hasOwn(t, "limits")) {
|
|
1502
|
+
let e = t.limits;
|
|
1503
|
+
n.limits = e && typeof e == "object" && !Array.isArray(e) && Object.hasOwn(e, "maxSyntaxNodes") ? { maxSyntaxNodes: e.maxSyntaxNodes } : e;
|
|
1504
|
+
}
|
|
1505
|
+
return n;
|
|
1506
|
+
} catch {
|
|
1507
|
+
return e;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
function xt(e) {
|
|
1511
|
+
let t = ce(e);
|
|
1512
|
+
if (t !== "invalid") return t;
|
|
1513
|
+
try {
|
|
1514
|
+
return `invalid:${JSON.stringify(e)}`;
|
|
1515
|
+
} catch {
|
|
1516
|
+
return "invalid";
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
function St(e, t) {
|
|
1520
|
+
let n = bt(t);
|
|
1521
|
+
return {
|
|
1522
|
+
source: e,
|
|
1523
|
+
options: n,
|
|
1524
|
+
optionsKey: xt(n)
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
function q(e, t) {
|
|
1528
|
+
return e.source === t.source && e.optionsKey === t.optionsKey;
|
|
1529
|
+
}
|
|
1530
|
+
function J(e) {
|
|
1497
1531
|
return e instanceof Error ? e.message : String(e);
|
|
1498
1532
|
}
|
|
1499
|
-
function
|
|
1533
|
+
function Y() {
|
|
1500
1534
|
return typeof performance < "u" ? performance.now() : Date.now();
|
|
1501
1535
|
}
|
|
1502
|
-
function
|
|
1536
|
+
function X(e) {
|
|
1503
1537
|
return Number.isFinite(e) ? Math.max(0, Math.round(e)) : 0;
|
|
1504
1538
|
}
|
|
1505
|
-
function
|
|
1539
|
+
function Z(e) {
|
|
1506
1540
|
return {
|
|
1507
1541
|
code: "local.worker.compile",
|
|
1508
|
-
message: `Compilation failed: ${
|
|
1542
|
+
message: `Compilation failed: ${J(e)}`,
|
|
1509
1543
|
severity: "error",
|
|
1510
1544
|
range: {
|
|
1511
1545
|
start: 0,
|
|
@@ -1515,12 +1549,12 @@ function X(e) {
|
|
|
1515
1549
|
column: 1
|
|
1516
1550
|
};
|
|
1517
1551
|
}
|
|
1518
|
-
var
|
|
1552
|
+
var Ct = class {
|
|
1519
1553
|
options;
|
|
1520
1554
|
delay;
|
|
1521
1555
|
worker = null;
|
|
1522
1556
|
timer = null;
|
|
1523
|
-
|
|
1557
|
+
queued = null;
|
|
1524
1558
|
inFlight = null;
|
|
1525
1559
|
nextId = 1;
|
|
1526
1560
|
pending = !1;
|
|
@@ -1536,17 +1570,17 @@ var ft = class {
|
|
|
1536
1570
|
this.handleWorkerFailure(t || "The compile worker encountered an error");
|
|
1537
1571
|
}, t.onmessageerror = () => this.handleWorkerFailure("The compile worker could not deliver the compile result"), this.worker = t;
|
|
1538
1572
|
} catch (t) {
|
|
1539
|
-
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${
|
|
1573
|
+
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${J(t)}`);
|
|
1540
1574
|
}
|
|
1541
1575
|
}
|
|
1542
|
-
schedule(e) {
|
|
1543
|
-
this.disposed || (this.
|
|
1576
|
+
schedule(e, t) {
|
|
1577
|
+
this.disposed || (this.queued = St(e, t), this.clearTimer(), this.timer = setTimeout(() => {
|
|
1544
1578
|
this.timer = null, this.drain();
|
|
1545
1579
|
}, this.delay), this.setPending(!0));
|
|
1546
1580
|
}
|
|
1547
1581
|
dispose() {
|
|
1548
1582
|
if (this.disposed) return;
|
|
1549
|
-
this.disposed = !0, this.clearTimer(), this.
|
|
1583
|
+
this.disposed = !0, this.clearTimer(), this.queued = null, this.inFlight = null;
|
|
1550
1584
|
let e = this.worker;
|
|
1551
1585
|
if (this.worker = null, e) {
|
|
1552
1586
|
e.onmessage = null, e.onerror = null, e.onmessageerror = null;
|
|
@@ -1558,8 +1592,8 @@ var ft = class {
|
|
|
1558
1592
|
}
|
|
1559
1593
|
drain() {
|
|
1560
1594
|
if (this.disposed || this.timer !== null || this.inFlight !== null) return;
|
|
1561
|
-
let e = this.
|
|
1562
|
-
e === null ? this.setPending(!1) : (this.
|
|
1595
|
+
let e = this.queued;
|
|
1596
|
+
e === null ? this.setPending(!1) : (this.queued = null, this.compile(e));
|
|
1563
1597
|
}
|
|
1564
1598
|
compile(e) {
|
|
1565
1599
|
let t = this.worker;
|
|
@@ -1570,33 +1604,42 @@ var ft = class {
|
|
|
1570
1604
|
let n = this.nextId++;
|
|
1571
1605
|
this.inFlight = {
|
|
1572
1606
|
id: n,
|
|
1573
|
-
|
|
1607
|
+
job: e
|
|
1574
1608
|
};
|
|
1575
1609
|
try {
|
|
1576
1610
|
t.postMessage({
|
|
1577
1611
|
id: n,
|
|
1578
|
-
source: e
|
|
1612
|
+
source: e.source,
|
|
1613
|
+
...e.options === void 0 ? {} : { options: e.options }
|
|
1579
1614
|
});
|
|
1580
1615
|
} catch (t) {
|
|
1581
|
-
this.inFlight = null
|
|
1616
|
+
this.inFlight = null;
|
|
1617
|
+
let n = `Could not send the source to the compile worker: ${J(t)}`, r = this.queued;
|
|
1618
|
+
if (r !== null && !q(r, e)) {
|
|
1619
|
+
this.degrade(n), this.finishRun();
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
r !== null && (this.queued = null, this.clearTimer()), this.degrade(n), this.compileFallback(e);
|
|
1582
1623
|
}
|
|
1583
1624
|
}
|
|
1584
1625
|
compileFallback(e) {
|
|
1585
1626
|
if (this.disposed) return;
|
|
1586
|
-
let t =
|
|
1627
|
+
let t = Y(), n;
|
|
1587
1628
|
try {
|
|
1588
|
-
|
|
1629
|
+
let t = this.options.fallbackCompile ?? y;
|
|
1630
|
+
n = e.options === void 0 ? t(e.source) : t(e.source, e.options);
|
|
1589
1631
|
} catch (e) {
|
|
1590
1632
|
n = {
|
|
1591
1633
|
ok: !1,
|
|
1592
|
-
diagnostics: [
|
|
1634
|
+
diagnostics: [Z(e)]
|
|
1593
1635
|
};
|
|
1594
1636
|
}
|
|
1595
1637
|
this.deliver({
|
|
1596
|
-
source: e,
|
|
1638
|
+
source: e.source,
|
|
1597
1639
|
result: n,
|
|
1598
|
-
duration: Y(
|
|
1599
|
-
mode: "fallback"
|
|
1640
|
+
duration: X(Y() - t),
|
|
1641
|
+
mode: "fallback",
|
|
1642
|
+
...e.options === void 0 ? {} : { options: e.options }
|
|
1600
1643
|
}), this.finishRun();
|
|
1601
1644
|
}
|
|
1602
1645
|
receive(e) {
|
|
@@ -1604,27 +1647,29 @@ var ft = class {
|
|
|
1604
1647
|
let t = this.inFlight;
|
|
1605
1648
|
if (!t || !e || e.id !== t.id) return;
|
|
1606
1649
|
this.inFlight = null;
|
|
1607
|
-
let n = this.
|
|
1608
|
-
|
|
1609
|
-
source:
|
|
1650
|
+
let n = t.job, r = this.queued;
|
|
1651
|
+
r !== null && !q(r, n) || (r !== null && (this.queued = null, this.clearTimer()), e.ok ? this.deliver({
|
|
1652
|
+
source: n.source,
|
|
1610
1653
|
result: e.result,
|
|
1611
|
-
duration:
|
|
1612
|
-
mode: "worker"
|
|
1654
|
+
duration: X(e.duration),
|
|
1655
|
+
mode: "worker",
|
|
1656
|
+
...n.options === void 0 ? {} : { options: n.options }
|
|
1613
1657
|
}) : this.deliver({
|
|
1614
|
-
source:
|
|
1658
|
+
source: n.source,
|
|
1615
1659
|
result: {
|
|
1616
1660
|
ok: !1,
|
|
1617
|
-
diagnostics: [
|
|
1661
|
+
diagnostics: [Z(e.message)]
|
|
1618
1662
|
},
|
|
1619
1663
|
duration: 0,
|
|
1620
|
-
mode: "worker"
|
|
1664
|
+
mode: "worker",
|
|
1665
|
+
...n.options === void 0 ? {} : { options: n.options }
|
|
1621
1666
|
})), this.finishRun();
|
|
1622
1667
|
}
|
|
1623
1668
|
handleWorkerFailure(e) {
|
|
1624
1669
|
if (this.disposed) return;
|
|
1625
1670
|
this.degrade(e);
|
|
1626
1671
|
let t = this.inFlight;
|
|
1627
|
-
this.inFlight = null, t && (this.
|
|
1672
|
+
this.inFlight = null, t && (this.queued === null || q(this.queued, t.job)) && (this.queued !== null && (this.queued = null, this.clearTimer()), this.compileFallback(t.job)), this.finishRun();
|
|
1628
1673
|
}
|
|
1629
1674
|
degrade(e) {
|
|
1630
1675
|
let t = this.worker;
|
|
@@ -1637,7 +1682,7 @@ var ft = class {
|
|
|
1637
1682
|
}
|
|
1638
1683
|
}
|
|
1639
1684
|
finishRun() {
|
|
1640
|
-
this.disposed || (this.drain(), !this.disposed && this.setPending(this.timer !== null || this.inFlight !== null || this.
|
|
1685
|
+
this.disposed || (this.drain(), !this.disposed && this.setPending(this.timer !== null || this.inFlight !== null || this.queued !== null));
|
|
1641
1686
|
}
|
|
1642
1687
|
deliver(e) {
|
|
1643
1688
|
this.disposed || this.options.onResult(e);
|
|
@@ -1649,7 +1694,7 @@ var ft = class {
|
|
|
1649
1694
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
1650
1695
|
}
|
|
1651
1696
|
};
|
|
1652
|
-
function
|
|
1697
|
+
function wt(e, t, n) {
|
|
1653
1698
|
try {
|
|
1654
1699
|
e.postMessage({
|
|
1655
1700
|
id: t,
|
|
@@ -1658,15 +1703,15 @@ function pt(e, t, n) {
|
|
|
1658
1703
|
});
|
|
1659
1704
|
} catch {}
|
|
1660
1705
|
}
|
|
1661
|
-
function
|
|
1706
|
+
function Tt(e) {
|
|
1662
1707
|
let t = e === void 0 ? globalThis : e;
|
|
1663
1708
|
if (!t || typeof t.postMessage != "function") throw TypeError("startLocalCompileWorker requires a worker scope with postMessage");
|
|
1664
1709
|
t.onmessage = (e) => {
|
|
1665
1710
|
let n = e?.data;
|
|
1666
1711
|
if (!n || typeof n.id != "number" || typeof n.source != "string") return;
|
|
1667
|
-
let r =
|
|
1712
|
+
let r = Y();
|
|
1668
1713
|
try {
|
|
1669
|
-
let e =
|
|
1714
|
+
let e = n.options === void 0 ? y(n.source) : y(n.source, n.options), i = X(Y() - r);
|
|
1670
1715
|
try {
|
|
1671
1716
|
t.postMessage({
|
|
1672
1717
|
id: n.id,
|
|
@@ -1675,29 +1720,29 @@ function mt(e) {
|
|
|
1675
1720
|
duration: i
|
|
1676
1721
|
});
|
|
1677
1722
|
} catch (e) {
|
|
1678
|
-
|
|
1723
|
+
wt(t, n.id, `Could not return the compile result: ${J(e)}`);
|
|
1679
1724
|
}
|
|
1680
1725
|
} catch (e) {
|
|
1681
|
-
|
|
1726
|
+
wt(t, n.id, J(e));
|
|
1682
1727
|
}
|
|
1683
1728
|
};
|
|
1684
1729
|
}
|
|
1685
1730
|
// src/shareable.ts
|
|
1686
|
-
var
|
|
1687
|
-
function
|
|
1731
|
+
var Et = "reactive-md-html/v1", Dt = /^[A-Za-z][A-Za-z0-9_-]*$/, Ot = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/, kt = /^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/, At = /[\u0000-\u001f\u007f-\u009f]/, jt = 64, Mt = 41943040, Nt = 4096;
|
|
1732
|
+
function Q(e, t = !1) {
|
|
1688
1733
|
let n = e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1689
1734
|
return t && (n = n.replace(/"/g, """).replace(/'/g, "'")), n;
|
|
1690
1735
|
}
|
|
1691
|
-
function
|
|
1736
|
+
function Pt(e) {
|
|
1692
1737
|
return e.replace(/<\/style/gi, "<\\/style");
|
|
1693
1738
|
}
|
|
1694
|
-
function
|
|
1739
|
+
function Ft(e) {
|
|
1695
1740
|
return e.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
|
|
1696
1741
|
}
|
|
1697
|
-
function
|
|
1698
|
-
return
|
|
1742
|
+
function $(e) {
|
|
1743
|
+
return Q(e, !0);
|
|
1699
1744
|
}
|
|
1700
|
-
function
|
|
1745
|
+
function It(e) {
|
|
1701
1746
|
let t = JSON.stringify(e);
|
|
1702
1747
|
if (typeof t != "string") throw TypeError("Cannot serialize a non-JSON value for an inline script.");
|
|
1703
1748
|
return t.replace(/[<>&\u2028\u2029]/g, (e) => {
|
|
@@ -1710,32 +1755,94 @@ function Tt(e) {
|
|
|
1710
1755
|
}
|
|
1711
1756
|
});
|
|
1712
1757
|
}
|
|
1713
|
-
function
|
|
1758
|
+
function Lt(e) {
|
|
1714
1759
|
return Array.isArray(e) ? e.slice() : e;
|
|
1715
1760
|
}
|
|
1716
|
-
function
|
|
1761
|
+
function Rt(e) {
|
|
1762
|
+
if (e === void 0) return;
|
|
1763
|
+
let t = h(e);
|
|
1764
|
+
if (!t.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${t.message}`);
|
|
1765
|
+
let n = {
|
|
1766
|
+
enableCss: t.html.enableCss,
|
|
1767
|
+
enableJavaScript: t.html.enableJavaScript,
|
|
1768
|
+
enableExtendedHtml: t.html.enableExtendedHtml
|
|
1769
|
+
};
|
|
1770
|
+
return e.limits !== void 0 && e.limits.maxSyntaxNodes !== void 0 ? {
|
|
1771
|
+
...n,
|
|
1772
|
+
limits: { maxSyntaxNodes: t.maxSyntaxNodes }
|
|
1773
|
+
} : n;
|
|
1774
|
+
}
|
|
1775
|
+
function zt(e) {
|
|
1776
|
+
let t = [];
|
|
1777
|
+
for (let n of e.childNodes) {
|
|
1778
|
+
if (m.isElementNode(n)) {
|
|
1779
|
+
let e = n.tagName.toLowerCase();
|
|
1780
|
+
if (e === "script") continue;
|
|
1781
|
+
zt(e === "template" ? m.getTemplateContent(n) : n);
|
|
1782
|
+
}
|
|
1783
|
+
t.push(n);
|
|
1784
|
+
}
|
|
1785
|
+
e.childNodes = t;
|
|
1786
|
+
}
|
|
1787
|
+
function Bt(e, t, n) {
|
|
1788
|
+
let r = !1;
|
|
1789
|
+
for (let i of e.childNodes) if (m.isElementNode(i)) {
|
|
1790
|
+
if (i.tagName.toLowerCase() === "iframe") {
|
|
1791
|
+
let e = i.attrs.filter((e) => {
|
|
1792
|
+
let t = e.name.toLowerCase();
|
|
1793
|
+
return t !== "srcdoc" && t !== "sandbox";
|
|
1794
|
+
});
|
|
1795
|
+
e.push({
|
|
1796
|
+
name: "srcdoc",
|
|
1797
|
+
value: t
|
|
1798
|
+
}), e.push({
|
|
1799
|
+
name: "sandbox",
|
|
1800
|
+
value: n
|
|
1801
|
+
}), i.attrs = e, r = !0;
|
|
1802
|
+
}
|
|
1803
|
+
Bt(i, t, n) && (r = !0);
|
|
1804
|
+
}
|
|
1805
|
+
return r;
|
|
1806
|
+
}
|
|
1807
|
+
function Vt(e) {
|
|
1808
|
+
let t = "";
|
|
1809
|
+
for (let n of e.childNodes) t += ue(n, { scriptingEnabled: !1 });
|
|
1810
|
+
return t;
|
|
1811
|
+
}
|
|
1812
|
+
function Ht(e, t, n) {
|
|
1813
|
+
try {
|
|
1814
|
+
let r = le(e, { scriptingEnabled: !1 });
|
|
1815
|
+
if (zt(r), Bt(r, t, n)) return Vt(r);
|
|
1816
|
+
} catch {}
|
|
1817
|
+
return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${Q(n, !0)}" style="display:block;width:100%;min-height:60vh;border:0;background:#fff" srcdoc="${Q(t, !0)}"></iframe></div>`;
|
|
1818
|
+
}
|
|
1819
|
+
function Ut(e, t) {
|
|
1820
|
+
let n = t?.enableExtendedHtml === !0, r = t ? `frame-src about:${n ? " data: blob: http: https:" : ""}` : "frame-src 'none'", i = n ? "base-uri 'self' http: https:" : "base-uri 'none'", a = n ? "form-action http: https:" : "form-action 'none'";
|
|
1821
|
+
return e ? `default-src 'none'; img-src data:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; font-src data:; connect-src 'none'; media-src 'none'; object-src 'none'; ${r}; ${i}; ${a}` : `default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:; object-src 'none'; ${r}; ${i}; ${a}`;
|
|
1822
|
+
}
|
|
1823
|
+
function Wt(e) {
|
|
1717
1824
|
if (e === void 0) return;
|
|
1718
1825
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("images must be an object mapping relative URLs to data: image URLs.");
|
|
1719
1826
|
let t = Object.entries(e);
|
|
1720
|
-
if (t.length >
|
|
1827
|
+
if (t.length > jt) throw RangeError(`images cannot contain more than ${jt} entries.`);
|
|
1721
1828
|
let n = 0;
|
|
1722
1829
|
for (let [e, r] of t) {
|
|
1723
|
-
if (!e || e.length >
|
|
1724
|
-
if (typeof r != "string" || !
|
|
1725
|
-
if (n += r.length, n >
|
|
1830
|
+
if (!e || e.length > Nt || At.test(e) || e === "__proto__") throw TypeError("Every image key must be a bounded, control-free URL.");
|
|
1831
|
+
if (typeof r != "string" || !kt.test(r)) throw TypeError(`The image map for "${e}" must contain a base64 PNG, JPEG, GIF or WebP data URL.`);
|
|
1832
|
+
if (n += r.length, n > Mt) throw RangeError("The embedded image map exceeds the 40 MiB budget.");
|
|
1726
1833
|
}
|
|
1727
1834
|
return Object.fromEntries(t);
|
|
1728
1835
|
}
|
|
1729
|
-
function
|
|
1730
|
-
let n =
|
|
1836
|
+
function Gt(e, t) {
|
|
1837
|
+
let n = ct(e, t);
|
|
1731
1838
|
if (!n.ok) return n;
|
|
1732
1839
|
let r = {};
|
|
1733
1840
|
for (let [t, i] of Object.entries(e.bindings)) r[t] = Object.hasOwn(n.state, t) ? {
|
|
1734
1841
|
...i,
|
|
1735
|
-
initial:
|
|
1842
|
+
initial: Lt(n.state[t])
|
|
1736
1843
|
} : i;
|
|
1737
1844
|
let i = { ...e.initialState };
|
|
1738
|
-
for (let [e, t] of Object.entries(n.state)) i[e] =
|
|
1845
|
+
for (let [e, t] of Object.entries(n.state)) i[e] = Lt(t);
|
|
1739
1846
|
return {
|
|
1740
1847
|
ok: !0,
|
|
1741
1848
|
baseline: {
|
|
@@ -1748,52 +1855,65 @@ function Dt(e, t) {
|
|
|
1748
1855
|
}
|
|
1749
1856
|
};
|
|
1750
1857
|
}
|
|
1751
|
-
var
|
|
1752
|
-
function
|
|
1858
|
+
var Kt = "\n:root { color-scheme: light; background: #f5f7fb; }\nhtml, body { margin: 0; }\nbody.reactive-md-export {\n min-height: 100vh;\n padding: clamp(16px, 4vw, 48px);\n background: #f5f7fb;\n color: #17233d;\n font-family: system-ui, -apple-system, \"Segoe UI\", sans-serif;\n}\n.reactive-md-export-root { max-width: 840px; margin: 0 auto; }\n@media print {\n :root, html, body.reactive-md-export { background: #fff !important; }\n body.reactive-md-export { min-height: 0; padding: 0 !important; }\n .reactive-md-export-root { max-width: none !important; margin: 0 !important; }\n}\n";
|
|
1859
|
+
function qt(e) {
|
|
1753
1860
|
let t = e.targetId ?? "reactive-md-document";
|
|
1754
|
-
if (!
|
|
1861
|
+
if (!Dt.test(t)) throw TypeError("targetId must start with a letter and contain only letters, digits, underscores or hyphens.");
|
|
1755
1862
|
let n = e.mode === "static" ? "static" : "interactive";
|
|
1756
1863
|
if (!e.staticMarkup.trim()) throw TypeError("createShareableHtml requires rendered document markup.");
|
|
1757
1864
|
if (!e.css.trim()) throw TypeError("createShareableHtml requires the document stylesheet.");
|
|
1758
1865
|
if (e.state.sourceDigest !== V(e.source)) throw Error("The state file does not belong to the exported source.");
|
|
1759
1866
|
if (n === "interactive" && !e.runtimeScript?.trim()) throw TypeError("Interactive HTML requires the standalone runtime script.");
|
|
1760
|
-
let r = e.
|
|
1867
|
+
let r = Rt(e.compileOptions), i = h(r);
|
|
1868
|
+
if (!i.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${i.message}`);
|
|
1869
|
+
let a = i.htmlActive, o = e.staticMarkup;
|
|
1870
|
+
if (a && (n === "static" || !i.html.enableJavaScript)) {
|
|
1871
|
+
let t = {
|
|
1872
|
+
enableCss: i.html.enableCss,
|
|
1873
|
+
enableJavaScript: !1,
|
|
1874
|
+
enableExtendedHtml: i.html.enableExtendedHtml
|
|
1875
|
+
}, n = te(e.source, t, i.maxSyntaxNodes);
|
|
1876
|
+
if (!n.markup) throw Error("The native HTML document could not be regenerated without author JavaScript.");
|
|
1877
|
+
o = Ht(e.staticMarkup, n.markup, se(t));
|
|
1878
|
+
}
|
|
1879
|
+
let s = e.locale === "zh" ? "zh" : "en", c = s === "zh" ? "zh-CN" : "en", l = e.colorScheme === "light" || e.colorScheme === "dark" ? e.colorScheme : "auto", u = e.assets === "omit" ? "omit" : "inline", d = e.generator ?? {
|
|
1761
1880
|
name: "reactive-md",
|
|
1762
1881
|
version: "unknown"
|
|
1763
|
-
},
|
|
1882
|
+
}, f = Wt(e.images), p = Number.isSafeInteger(e.imageCount) && (e.imageCount ?? 0) > 0 ? String(e.imageCount) : String(Object.keys(f ?? {}).length), m = n === "interactive", g = {
|
|
1764
1883
|
version: 1,
|
|
1765
1884
|
target: t,
|
|
1766
1885
|
source: e.source,
|
|
1767
1886
|
state: e.state,
|
|
1768
|
-
locale:
|
|
1769
|
-
colorScheme:
|
|
1887
|
+
locale: s,
|
|
1888
|
+
colorScheme: l,
|
|
1770
1889
|
hydrate: !0,
|
|
1771
|
-
...
|
|
1772
|
-
|
|
1773
|
-
|
|
1890
|
+
...r === void 0 ? {} : { compileOptions: r },
|
|
1891
|
+
...f ? { images: f } : {}
|
|
1892
|
+
}, _ = Ut(m, a ? i.html : void 0), v = m ? `<script type="application/reactive-md+json" data-reactive-md-auto>${It(g)}<\/script>
|
|
1893
|
+
<script>${Ft(e.runtimeScript)}<\/script>` : "", ee = e.notices?.trim() ? `<template id="reactive-md-notices"><pre>${Q(e.notices)}</pre></template>` : "";
|
|
1774
1894
|
return `<!doctype html>
|
|
1775
|
-
<html lang="${
|
|
1895
|
+
<html lang="${Q(Ot.test(c) ? c : "en", !0)}">
|
|
1776
1896
|
<head>
|
|
1777
1897
|
<meta charset="utf-8">
|
|
1778
1898
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1779
1899
|
<meta name="referrer" content="no-referrer">
|
|
1780
|
-
<meta http-equiv="Content-Security-Policy" content="${
|
|
1781
|
-
<meta name="generator" content="${
|
|
1782
|
-
<meta name="reactive-md-html-format" content="${
|
|
1783
|
-
<meta name="reactive-md-syntax" content="${
|
|
1900
|
+
<meta http-equiv="Content-Security-Policy" content="${$(_)}">
|
|
1901
|
+
<meta name="generator" content="${$(`${d.name} ${d.version}`)}">
|
|
1902
|
+
<meta name="reactive-md-html-format" content="${Et}">
|
|
1903
|
+
<meta name="reactive-md-syntax" content="${$(e.state.syntax)}">
|
|
1784
1904
|
<meta name="reactive-md-output" content="${n}">
|
|
1785
|
-
<meta name="reactive-md-state" content="${
|
|
1786
|
-
<meta name="reactive-md-images" content="${
|
|
1787
|
-
<meta name="reactive-md-image-count" content="${
|
|
1788
|
-
<title>${
|
|
1789
|
-
<style>${
|
|
1905
|
+
<meta name="reactive-md-state" content="${$(e.state.sourceDigest)}">
|
|
1906
|
+
<meta name="reactive-md-images" content="${u}">
|
|
1907
|
+
<meta name="reactive-md-image-count" content="${p}">
|
|
1908
|
+
<title>${Q(e.title || "Reactive MD document")}</title>
|
|
1909
|
+
<style>${Pt(e.css)}${Kt}</style>
|
|
1790
1910
|
</head>
|
|
1791
1911
|
<body class="reactive-md-export">
|
|
1792
|
-
<div id="${t}" class="reactive-md-export-root">${
|
|
1793
|
-
${
|
|
1794
|
-
${
|
|
1912
|
+
<div id="${t}" class="reactive-md-export-root">${o}</div>
|
|
1913
|
+
${v}
|
|
1914
|
+
${ee}
|
|
1795
1915
|
</body>
|
|
1796
1916
|
</html>
|
|
1797
1917
|
`;
|
|
1798
1918
|
}
|
|
1799
|
-
export {
|
|
1919
|
+
export { g as DEFAULT_LOCAL_THEME, yt as LOCAL_COMPILE_DELAY_MS, l as LOCAL_DIAGNOSTIC_CODES, I as LOCAL_STATE_FORMAT, f as LOCAL_SYNTAX_VERSION, _ as LOCAL_THEME_PROTOCOL, Ct as LocalCompileScheduler, e as LocalExpressionError, Et as SHAREABLE_HTML_FORMAT, we as analyzeLocalSource, lt as applyLocalState, vt as applyLocalStateRetention, Ve as checkLocalUpgrade, o as compileExpression, Z as compileFailureDiagnostic, n as compileLatex, y as compileLocal, Ne as completeLocalSource, s as countLocalCodePoints, b as createLocalRuntime, nt as createLocalStateFile, qt as createShareableHtml, ut as exportLocalState, i as formatLocalDiagnostic, Le as formatLocalSource, dt as importLocalState, ze as inspectLocalSourceVersion, a as isLocalDiagnosticCode, oe as isLocalThemeName, de as localDiagnosticTemplate, t as localDiagnosticTemplateKeys, V as localSourceDigest, He as migrateLocalSource, W as parseLocalState, gt as planLocalStateRetention, Fe as renameLocalBinding, ct as resolveLocalState, Gt as resolveLocalStateBaseline, ie as resolveLocalTheme, re as samplePlot, It as serializeForScript, ft as serializeLocalState, Tt as startLocalCompileWorker };
|