reactive-md 0.9.0 → 0.9.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 +13 -0
- package/CHANGELOG.md +13 -0
- package/README-ch.md +6 -6
- package/README-en.md +6 -6
- package/README.md +6 -6
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/build.mjs +1 -0
- package/cli/init.mjs +1 -1
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-sthUP0ct.js} +10 -10
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Dsune4Hy.js} +40 -20
- package/dist-library/{compile-LhpTKqCR.js → compile-wUv8KEge.js} +1 -1
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-As_m-MNm.js} +2449 -1742
- package/dist-library/{compiler-DfGbQhyD.js → compiler-eOfcinZs.js} +19 -19
- package/dist-library/{component-state-BBJ08vML.js → component-state-C52ZFJGl.js} +1 -1
- package/dist-library/{config-BUo-8O5C.js → config-BadfhjdP.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → config-validation-F47AcE6o.js} +49 -1
- package/dist-library/{controls-BWiLLtBO.js → controls-CcT6n7k_.js} +2433 -2409
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-CWS9p5q_.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-Bgccxd7h.js} +68 -65
- package/dist-library/{display-lw3BT1TA.js → display-B-VhqVND.js} +1 -1
- package/dist-library/{export-C7IDW9ul.js → export-BqVmTXm8.js} +145 -87
- package/dist-library/{gallery-B8kSt1oI.js → gallery-CY6mTx8i.js} +151 -147
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-Dv0FSp_U.js} +404 -142
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-KxvtKgJb.js} +2 -2
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-WFK1RhAZ.js} +3 -3
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-Yuf3A_VI.js} +3270 -3778
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +16 -18
- package/dist-library/reactive-md-build.js +51 -51
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +2 -2
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +2 -2
- package/dist-library/reactive-md-plugin-gallery.js +2 -2
- package/dist-library/reactive-md-plugin-navigation.js +2 -2
- package/dist-library/reactive-md-plugin-network.js +117 -115
- package/dist-library/reactive-md-plugin-plot.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +10 -11
- package/dist-library/reactive-md-react.js +10 -11
- package/dist-library/reactive-md-sdk.js +3 -3
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +4 -4
- package/dist-library/reactive-md.js +280 -193
- package/dist-library/{registry-05JiqmEp.js → registry-B9NGct4d.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-D2GDQS0p.js} +1 -1
- package/dist-library/{runtime-CuOyRe9f.js → runtime-kcA7bG7G.js} +341 -341
- package/dist-library/{schema-C-AeByPp.js → schema-BufhKUSM.js} +5 -5
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-BoJT1SIt.js} +490 -150
- package/dist-library/{session-core-BGka5D1J.js → session-core-nmJHuR9c.js} +170 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-DpbE-59H.js} +207 -242
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +27 -4
- package/dist-library/types/local/types.d.ts +52 -16
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/{validation-BlDL2uD9.js → validation-BEBA_HvS.js} +88 -72
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-CyV1FXzs.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-BZbZYA7w.js} +24181 -24180
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +2 -1
- package/docs/README.md +2 -1
- package/docs/compatibility/compatibility-ch.md +6 -6
- package/docs/compatibility/compatibility-en.md +6 -6
- package/docs/compatibility/source-versioning-ch.md +1 -1
- package/docs/compatibility/source-versioning-en.md +1 -1
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-development-reference-ch.md +2 -2
- package/docs/development/component-development-reference-en.md +2 -2
- package/docs/development/component-protocol-ch.md +2 -2
- package/docs/development/component-protocol-en.md +2 -2
- package/docs/development/extension-tutorial-ch.md +3 -3
- package/docs/development/extension-tutorial-en.md +3 -3
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/compiler-ch.md +3 -1
- package/docs/integration/compiler-en.md +3 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +2 -2
- package/docs/integration/extension-sdk-en.md +2 -2
- package/docs/integration/local-integration-ch.md +130 -8
- package/docs/integration/local-integration-en.md +130 -8
- package/docs/integration/shareable-export-ch.md +4 -2
- package/docs/integration/shareable-export-en.md +4 -2
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/public-api-ch.md +10 -7
- package/docs/reference/public-api-en.md +10 -7
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/examples/component-package/README-ch.md +1 -1
- package/examples/component-package/README.md +1 -1
- package/examples/game-2048-package/README-ch.md +1 -1
- package/examples/game-2048-package/README.md +1 -1
- package/examples/integration/README-ch.md +21 -2
- package/examples/integration/README.md +21 -2
- package/examples/integration/extension-sdk/README-ch.md +1 -1
- package/examples/integration/extension-sdk/README.md +1 -1
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/minimal-extension/README-ch.md +3 -3
- package/examples/minimal-extension/README.md +3 -3
- package/examples/tetris-package/README-ch.md +1 -1
- package/examples/tetris-package/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { a as e, i as t, r as n, s as r } from "./latex-1w7aQgD5.js";
|
|
2
|
-
import { A as i, B as a, C as o, F as s, I as c, M as l, N as u, P as d, S as f, j as p, w as m, x as h } from "./config-validation-
|
|
3
|
-
import { a as g, t as _ } from "./compile-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { c as x } from "./config-
|
|
7
|
-
import { t as S } from "./options-
|
|
8
|
-
import { t as ee } from "./compiler-
|
|
9
|
-
import { i as te, n as ne, r as re, t as C } from "./authoring-
|
|
10
|
-
import { c as w } from "./schema-
|
|
11
|
-
import { n as T, t as ie } from "./incremental-
|
|
2
|
+
import { A as i, B as a, C as o, F as s, I as c, M as l, N as u, P as d, S as f, j as p, w as m, x as h } from "./config-validation-F47AcE6o.js";
|
|
3
|
+
import { a as g, t as _ } from "./compile-wUv8KEge.js";
|
|
4
|
+
import { d as v } from "./compiler-core-As_m-MNm.js";
|
|
5
|
+
import { S as y, g as b } from "./validation-BEBA_HvS.js";
|
|
6
|
+
import { c as x } from "./config-BadfhjdP.js";
|
|
7
|
+
import { t as S } from "./options-1aDLK7JY.js";
|
|
8
|
+
import { t as ee } from "./compiler-eOfcinZs.js";
|
|
9
|
+
import { i as te, n as ne, r as re, t as C } from "./authoring-Dsune4Hy.js";
|
|
10
|
+
import { c as w } from "./schema-BufhKUSM.js";
|
|
11
|
+
import { n as T, t as ie } from "./incremental-Dv0FSp_U.js";
|
|
12
12
|
import { C as ae } from "./component-state-BoLCGee4.js";
|
|
13
|
-
import { a as oe, i as se, n as ce, o as le, r as ue } from "./runtime-
|
|
13
|
+
import { a as oe, i as se, n as ce, o as le, r as ue } from "./runtime-kcA7bG7G.js";
|
|
14
14
|
import { i as de, n as fe, r as pe, t as me } from "./sample-bP4zHB3L.js";
|
|
15
|
-
import { _ as he, a as ge, f as _e, g as ve, h as ye, i as be, m as xe, n as Se, p as Ce, r as we, t as Te, v as Ee, y as De } from "./shareable-
|
|
16
|
-
import { t as Oe } from "./component-state-
|
|
15
|
+
import { _ as he, a as ge, f as _e, g as ve, h as ye, i as be, m as xe, n as Se, p as Ce, r as we, t as Te, v as Ee, y as De } from "./shareable-DpbE-59H.js";
|
|
16
|
+
import { t as Oe } from "./component-state-C52ZFJGl.js";
|
|
17
17
|
// src/local/source/source-migration.ts
|
|
18
18
|
var E = /* @__PURE__ */ new Set([
|
|
19
19
|
"sum",
|
|
@@ -231,54 +231,54 @@ function Be(e) {
|
|
|
231
231
|
insert: r
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Ve(e, t) {
|
|
235
235
|
let n = Be(t);
|
|
236
236
|
return n === null || typeof e != "string" || n.to > e.length ? null : e.slice(0, n.from) + n.insert + e.slice(n.to);
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function I(e) {
|
|
239
239
|
let t = {};
|
|
240
240
|
for (let [n, r] of Object.entries(e)) n !== "children" && (t[n] = r);
|
|
241
241
|
return t;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function L(e, t) {
|
|
244
244
|
let n = Object.keys(e).filter((e) => e !== "children"), r = Object.keys(t).filter((e) => e !== "children");
|
|
245
245
|
if (n.length !== r.length) return !1;
|
|
246
246
|
for (let r of n) if (!Object.hasOwn(t, r) || !N(e[r], t[r])) return !1;
|
|
247
247
|
return !0;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function R(e) {
|
|
250
250
|
return e.children === void 0 ? void 0 : e.children.map((e) => e.id);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
let n =
|
|
252
|
+
function z(e, t) {
|
|
253
|
+
let n = R(e), r = R(t);
|
|
254
254
|
if (n === void 0 || r === void 0) return n === r;
|
|
255
255
|
if (n.length !== r.length) return !1;
|
|
256
256
|
for (let e = 0; e < n.length; e += 1) if (n[e] !== r[e]) return !1;
|
|
257
257
|
return !0;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
if (!
|
|
259
|
+
function He(e, t) {
|
|
260
|
+
if (!L(e, t) || !z(e, t)) return !1;
|
|
261
261
|
if (!e.children || !t.children) return !0;
|
|
262
|
-
for (let n = 0; n < e.children.length; n += 1) if (!
|
|
262
|
+
for (let n = 0; n < e.children.length; n += 1) if (!He(e.children[n], t.children[n])) return !1;
|
|
263
263
|
return !0;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function Ue(e, t) {
|
|
266
266
|
let n = Object.keys(e).filter((e) => e !== "children" && e !== "range"), r = Object.keys(t).filter((e) => e !== "children" && e !== "range");
|
|
267
267
|
if (n.length !== r.length) return null;
|
|
268
268
|
for (let r of n) if (!Object.hasOwn(t, r) || !N(e[r], t[r])) return null;
|
|
269
269
|
if (!j(e.range) || !j(t.range)) return null;
|
|
270
270
|
let i = e.range.start - t.range.start;
|
|
271
271
|
if (e.range.end !== t.range.end + i) return null;
|
|
272
|
-
let a =
|
|
272
|
+
let a = R(e), o = R(t);
|
|
273
273
|
if (a === void 0 || o === void 0) {
|
|
274
274
|
if (a !== o) return null;
|
|
275
275
|
} else {
|
|
276
276
|
if (a.length !== o.length) return null;
|
|
277
|
-
for (let n = 0; n < a.length; n += 1) if (a[n] !== o[n] ||
|
|
277
|
+
for (let n = 0; n < a.length; n += 1) if (a[n] !== o[n] || Ue(e.children[n], t.children[n]) !== i) return null;
|
|
278
278
|
}
|
|
279
279
|
return i;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function We(e, t) {
|
|
282
282
|
let n = Object.keys(e).filter((e) => e !== "children" && e !== "range"), r = Object.keys(t).filter((e) => e !== "children" && e !== "range");
|
|
283
283
|
if (n.length !== r.length) return null;
|
|
284
284
|
for (let r of n) if (!Object.hasOwn(t, r) || !N(e[r], t[r])) return null;
|
|
@@ -286,7 +286,7 @@ function He(e, t) {
|
|
|
286
286
|
let i = e.range.start - t.range.start;
|
|
287
287
|
return e.range.end === t.range.end + i ? i : null;
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Ge(e) {
|
|
290
290
|
let t = /* @__PURE__ */ new Map(), n = [...e].reverse();
|
|
291
291
|
for (; n.length > 0;) {
|
|
292
292
|
let e = n.pop();
|
|
@@ -294,8 +294,8 @@ function Ue(e) {
|
|
|
294
294
|
}
|
|
295
295
|
return t;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
if (t !== void 0 &&
|
|
297
|
+
function Ke(e, t, n, r) {
|
|
298
|
+
if (t !== void 0 && He(e, t)) return;
|
|
299
299
|
if (t === void 0) {
|
|
300
300
|
r.push({
|
|
301
301
|
id: e.id,
|
|
@@ -303,7 +303,7 @@ function We(e, t, n, r) {
|
|
|
303
303
|
});
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
|
-
let i =
|
|
306
|
+
let i = Ue(e, t);
|
|
307
307
|
if (i !== null) {
|
|
308
308
|
i !== 0 && r.push({
|
|
309
309
|
id: e.id,
|
|
@@ -313,16 +313,16 @@ function We(e, t, n, r) {
|
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
315
|
let a = { id: e.id };
|
|
316
|
-
if (!
|
|
317
|
-
let n =
|
|
318
|
-
n !== null && n !== 0 ? a.shift = n : a.data =
|
|
316
|
+
if (!L(e, t)) {
|
|
317
|
+
let n = We(e, t);
|
|
318
|
+
n !== null && n !== 0 ? a.shift = n : a.data = I(e);
|
|
319
319
|
}
|
|
320
|
-
|
|
320
|
+
z(e, t) || (a.children = e.children === void 0 ? null : e.children.map((e) => e.id));
|
|
321
321
|
let o = r.length;
|
|
322
|
-
if (e.children) for (let t of e.children)
|
|
322
|
+
if (e.children) for (let t of e.children) Ke(t, n.get(t.id), n, r);
|
|
323
323
|
Object.keys(a).length > 1 ? r.splice(o, 0, a) : r.length > o && r.splice(o, 0, { id: e.id });
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function qe(e, t) {
|
|
326
326
|
if (!A(e)) return { set: t };
|
|
327
327
|
let n = {}, r = [];
|
|
328
328
|
for (let [r, i] of Object.entries(t)) Object.hasOwn(e, r) && N(e[r], i) || (n[r] = i);
|
|
@@ -332,8 +332,8 @@ function Ge(e, t) {
|
|
|
332
332
|
...r.length === 0 ? {} : { remove: r }
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
|
-
var
|
|
336
|
-
function
|
|
335
|
+
var Je = /* @__PURE__ */ new WeakMap();
|
|
336
|
+
function Ye(e) {
|
|
337
337
|
let t = 2;
|
|
338
338
|
for (let n = 0; n < e.length; n++) {
|
|
339
339
|
let r = e.charCodeAt(n);
|
|
@@ -348,14 +348,14 @@ function qe(e) {
|
|
|
348
348
|
}
|
|
349
349
|
return t;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function B(e, t) {
|
|
352
352
|
if (e === null) return {
|
|
353
353
|
bytes: 4,
|
|
354
354
|
nodes: 0
|
|
355
355
|
};
|
|
356
356
|
let n = typeof e;
|
|
357
357
|
if (n === "string") return {
|
|
358
|
-
bytes:
|
|
358
|
+
bytes: Ye(e),
|
|
359
359
|
nodes: 0
|
|
360
360
|
};
|
|
361
361
|
if (n === "number") return {
|
|
@@ -370,19 +370,19 @@ function H(e, t) {
|
|
|
370
370
|
bytes: 0,
|
|
371
371
|
nodes: 0
|
|
372
372
|
};
|
|
373
|
-
let r = e, i =
|
|
373
|
+
let r = e, i = Je.get(r);
|
|
374
374
|
if (i !== void 0) return i;
|
|
375
375
|
if (t.has(r)) return {
|
|
376
376
|
bytes: 0,
|
|
377
377
|
nodes: 0
|
|
378
378
|
};
|
|
379
379
|
t.add(r);
|
|
380
|
-
let a, o = +!!
|
|
380
|
+
let a, o = +!!nt(e);
|
|
381
381
|
if (Array.isArray(e)) {
|
|
382
382
|
a = 2;
|
|
383
383
|
for (let n = 0; n < e.length; n += 1) {
|
|
384
384
|
n > 0 && (a += 1);
|
|
385
|
-
let r =
|
|
385
|
+
let r = B(e[n], t);
|
|
386
386
|
a += r.bytes || 4, o += r.nodes;
|
|
387
387
|
}
|
|
388
388
|
} else {
|
|
@@ -392,8 +392,8 @@ function H(e, t) {
|
|
|
392
392
|
if (!Object.hasOwn(r, n)) continue;
|
|
393
393
|
let i = r[n];
|
|
394
394
|
if (i === void 0) continue;
|
|
395
|
-
e > 0 && (a += 1), e += 1, a +=
|
|
396
|
-
let s =
|
|
395
|
+
e > 0 && (a += 1), e += 1, a += Ye(n) + 1;
|
|
396
|
+
let s = B(i, t);
|
|
397
397
|
a += s.bytes, o += s.nodes;
|
|
398
398
|
}
|
|
399
399
|
}
|
|
@@ -402,19 +402,19 @@ function H(e, t) {
|
|
|
402
402
|
bytes: a,
|
|
403
403
|
nodes: o
|
|
404
404
|
};
|
|
405
|
-
return
|
|
405
|
+
return Je.set(r, s), s;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Xe(e, t) {
|
|
408
408
|
let n = e.document.nodes ?? [];
|
|
409
409
|
try {
|
|
410
|
-
let r =
|
|
410
|
+
let r = B(e, /* @__PURE__ */ new Set()), i = t.ok && typeof t.document.source == "string" ? t.document.source.length : 0;
|
|
411
411
|
if (r.bytes <= Math.max(i, ze)) return {
|
|
412
412
|
patchBytes: r.bytes,
|
|
413
413
|
patchNodes: n.length,
|
|
414
414
|
preferFull: !1
|
|
415
415
|
};
|
|
416
|
-
let a =
|
|
417
|
-
for (let e of n) e.node === void 0 ? e.data !== void 0 && (o += 1) : o +=
|
|
416
|
+
let a = B(t, /* @__PURE__ */ new Set()), o = 0;
|
|
417
|
+
for (let e of n) e.node === void 0 ? e.data !== void 0 && (o += 1) : o += B(e.node, /* @__PURE__ */ new Set()).nodes;
|
|
418
418
|
let s = r.bytes * O >= a.bytes, c = a.nodes > 0 && o * O >= a.nodes;
|
|
419
419
|
return {
|
|
420
420
|
patchBytes: r.bytes,
|
|
@@ -432,21 +432,21 @@ function Je(e, t) {
|
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
function
|
|
436
|
-
return
|
|
435
|
+
function Ze(e, t) {
|
|
436
|
+
return et(e, t);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
439
|
-
let n =
|
|
438
|
+
function Qe(e, t) {
|
|
439
|
+
let n = et(e, t);
|
|
440
440
|
return n ? {
|
|
441
441
|
patch: n,
|
|
442
|
-
cost:
|
|
442
|
+
cost: Xe(n, t)
|
|
443
443
|
} : null;
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function $e(e, t) {
|
|
446
446
|
let n = e.recoveries, r = t.recoveries;
|
|
447
447
|
return n === void 0 ? r === void 0 ? {} : { recoveries: r } : r !== void 0 && N(n, r) ? {} : { recoveries: r === void 0 ? null : r };
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function et(e, t) {
|
|
450
450
|
try {
|
|
451
451
|
if (!e.ok || !t.ok) return null;
|
|
452
452
|
let n = e.document, r = t.document;
|
|
@@ -480,7 +480,7 @@ function Qe(e, t) {
|
|
|
480
480
|
o[e] = l;
|
|
481
481
|
continue;
|
|
482
482
|
}
|
|
483
|
-
let u =
|
|
483
|
+
let u = qe(c, l);
|
|
484
484
|
u !== null && (s[e] = u);
|
|
485
485
|
}
|
|
486
486
|
let u = Array.isArray(n.nodes) ? n.nodes : [], d = Array.isArray(r.nodes) ? r.nodes : [], f = u.map((e) => e.id), p = d.map((e) => e.id), m = f.length !== p.length;
|
|
@@ -490,30 +490,30 @@ function Qe(e, t) {
|
|
|
490
490
|
break;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
let h = [], g =
|
|
494
|
-
for (let e of d)
|
|
493
|
+
let h = [], g = Ge(u);
|
|
494
|
+
for (let e of d) Ke(e, g.get(e.id), g, h);
|
|
495
495
|
return m && (i.roots = p), h.length > 0 && (i.nodes = h), a.length > 0 && (i.removed = a), Object.keys(o).length > 0 && (i.values = o), Object.keys(s).length > 0 && (i.records = s), {
|
|
496
496
|
kind: "result-patch",
|
|
497
497
|
protocol: D,
|
|
498
498
|
document: i,
|
|
499
499
|
...N(e.diagnostics, t.diagnostics) ? {} : { diagnostics: t.diagnostics },
|
|
500
|
-
|
|
500
|
+
...$e(e, t)
|
|
501
501
|
};
|
|
502
502
|
} catch {
|
|
503
503
|
return null;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
function
|
|
507
|
-
let n =
|
|
506
|
+
function tt(e, t) {
|
|
507
|
+
let n = I(e);
|
|
508
508
|
return j(n.range) || M(), n.range = {
|
|
509
509
|
start: n.range.start + t,
|
|
510
510
|
end: n.range.end + t
|
|
511
|
-
}, e.children && (n.children = e.children.map((e) =>
|
|
511
|
+
}, e.children && (n.children = e.children.map((e) => tt(e, t))), n;
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function nt(e) {
|
|
514
514
|
return A(e) && typeof e.id == "string" && typeof e.type == "string" && j(e.range);
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function rt(e, t) {
|
|
517
517
|
A(t) || M(), t.set !== void 0 && !A(t.set) && M(), t.remove !== void 0 && !Array.isArray(t.remove) && M();
|
|
518
518
|
let n = {};
|
|
519
519
|
if (A(e)) for (let [t, r] of Object.entries(e)) Object.defineProperty(n, t, {
|
|
@@ -532,7 +532,7 @@ function tt(e, t) {
|
|
|
532
532
|
if (t.remove) for (let e of t.remove) typeof e != "string" && M(), delete n[e];
|
|
533
533
|
return n;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function it(e, t) {
|
|
536
536
|
try {
|
|
537
537
|
if (!e.ok || !A(t) || t.kind !== "result-patch" || t.protocol !== "patch-v1") return null;
|
|
538
538
|
let n = t.document;
|
|
@@ -570,7 +570,7 @@ function nt(e, t) {
|
|
|
570
570
|
for (let e of Object.keys(n.records)) {
|
|
571
571
|
if (!k.includes(e)) return null;
|
|
572
572
|
let t = n.records[e];
|
|
573
|
-
t !== void 0 && (i[e] =
|
|
573
|
+
t !== void 0 && (i[e] = rt(r[e], t));
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
let a = typeof r.source == "string" ? r.source : null;
|
|
@@ -578,12 +578,12 @@ function nt(e, t) {
|
|
|
578
578
|
if (n.source !== void 0) {
|
|
579
579
|
let e = Be(n.source);
|
|
580
580
|
if (e === null) return null;
|
|
581
|
-
let t =
|
|
581
|
+
let t = Ve(a, e);
|
|
582
582
|
if (t === null) return null;
|
|
583
583
|
a = t;
|
|
584
584
|
}
|
|
585
585
|
i.source = a;
|
|
586
|
-
let o = Array.isArray(r.nodes) ? r.nodes : [], s =
|
|
586
|
+
let o = Array.isArray(r.nodes) ? r.nodes : [], s = Ge(o), c = /* @__PURE__ */ new Map();
|
|
587
587
|
if (n.nodes !== void 0) {
|
|
588
588
|
if (!Array.isArray(n.nodes)) return null;
|
|
589
589
|
for (let e of n.nodes) {
|
|
@@ -607,16 +607,16 @@ function nt(e, t) {
|
|
|
607
607
|
let n = c.get(e), r = s.get(e);
|
|
608
608
|
if (n === void 0) return r === void 0 && M(), u.set(e, r), r;
|
|
609
609
|
if (A(n) || M(), n.node !== void 0) {
|
|
610
|
-
(n.data !== void 0 || n.children !== void 0 || n.shift !== void 0 || n.subtree) && M(),
|
|
610
|
+
(n.data !== void 0 || n.children !== void 0 || n.shift !== void 0 || n.subtree) && M(), nt(n.node) && n.node.id === e || M();
|
|
611
611
|
let t = P(n.node);
|
|
612
612
|
return u.set(e, t), t;
|
|
613
613
|
}
|
|
614
614
|
r === void 0 && n.data === void 0 && M(), n.subtree !== void 0 && n.subtree !== !0 && M(), n.shift !== void 0 && !Number.isSafeInteger(n.shift) && M(), n.data !== void 0 && n.shift !== void 0 && M(), n.children !== void 0 && n.children !== null && (!Array.isArray(n.children) || n.children.some((e) => typeof e != "string")) && M(), d.add(e);
|
|
615
615
|
let i;
|
|
616
|
-
if (n.subtree === !0) (r === void 0 || n.shift === void 0 || n.data !== void 0 || n.children !== void 0) && M(), i =
|
|
616
|
+
if (n.subtree === !0) (r === void 0 || n.shift === void 0 || n.data !== void 0 || n.children !== void 0) && M(), i = tt(r, n.shift);
|
|
617
617
|
else {
|
|
618
618
|
let t;
|
|
619
|
-
n.data === void 0 ? (r === void 0 && M(), t =
|
|
619
|
+
n.data === void 0 ? (r === void 0 && M(), t = I(r), n.shift !== void 0 && (j(t.range) || M(), t.range = {
|
|
620
620
|
start: t.range.start + n.shift,
|
|
621
621
|
end: t.range.end + n.shift
|
|
622
622
|
})) : (A(n.data) || M(), t = P(n.data), delete t.children, t.id !== e && M());
|
|
@@ -633,25 +633,28 @@ function nt(e, t) {
|
|
|
633
633
|
i.nodes = n.roots === void 0 && n.nodes === void 0 ? r.nodes : p;
|
|
634
634
|
let m = t.diagnostics === void 0 ? e.diagnostics : Array.isArray(t.diagnostics) ? P(t.diagnostics) : M();
|
|
635
635
|
if (t.recoveries !== void 0 && t.recoveries !== null && !Array.isArray(t.recoveries)) return null;
|
|
636
|
+
let h = e.status === void 0 ? {} : { status: e.status };
|
|
636
637
|
if (t.recoveries === null) return {
|
|
637
638
|
ok: !0,
|
|
638
639
|
document: i,
|
|
639
|
-
diagnostics: m
|
|
640
|
+
diagnostics: m,
|
|
641
|
+
...h
|
|
640
642
|
};
|
|
641
|
-
let
|
|
643
|
+
let g = t.recoveries === void 0 ? e.recoveries : P([...t.recoveries]);
|
|
642
644
|
return {
|
|
643
645
|
ok: !0,
|
|
644
646
|
document: i,
|
|
645
647
|
diagnostics: m,
|
|
646
|
-
...h
|
|
648
|
+
...h,
|
|
649
|
+
...g === void 0 ? {} : { recoveries: g }
|
|
647
650
|
};
|
|
648
651
|
} catch {
|
|
649
652
|
return null;
|
|
650
653
|
}
|
|
651
654
|
}
|
|
652
655
|
// src/local/transport/flat-compiled-data.ts
|
|
653
|
-
var
|
|
654
|
-
function
|
|
656
|
+
var V = "flat-v1";
|
|
657
|
+
function at(e) {
|
|
655
658
|
if (!e.ok) return !1;
|
|
656
659
|
let t = e.document.nodes.map((e) => ({
|
|
657
660
|
node: e,
|
|
@@ -667,7 +670,7 @@ function rt(e) {
|
|
|
667
670
|
}
|
|
668
671
|
return !1;
|
|
669
672
|
}
|
|
670
|
-
function
|
|
673
|
+
function ot(e) {
|
|
671
674
|
let t = [], n = /* @__PURE__ */ new Map(), r = [], i = (e) => {
|
|
672
675
|
if (typeof e == "object" && e) {
|
|
673
676
|
let i = n.get(e);
|
|
@@ -696,11 +699,11 @@ function it(e) {
|
|
|
696
699
|
for (let t of Object.keys(e)) n.push([t, i(e[t])]);
|
|
697
700
|
}
|
|
698
701
|
return {
|
|
699
|
-
version:
|
|
702
|
+
version: V,
|
|
700
703
|
records: t
|
|
701
704
|
};
|
|
702
705
|
}
|
|
703
|
-
function
|
|
706
|
+
function st(e) {
|
|
704
707
|
if (!e || typeof e != "object") return null;
|
|
705
708
|
let t = e;
|
|
706
709
|
if (t.version !== "flat-v1" || !Array.isArray(t.records) || t.records.length === 0 || t.records.length > 2e6) return null;
|
|
@@ -760,21 +763,21 @@ function at(e) {
|
|
|
760
763
|
return r[0];
|
|
761
764
|
}
|
|
762
765
|
// src/local/transport/worker-job.ts
|
|
763
|
-
var
|
|
766
|
+
var ct = 150, lt = 200, ut = [
|
|
764
767
|
"maxSyntaxNodes",
|
|
765
768
|
"maxParseWork",
|
|
766
769
|
"maxMarkdownDepth"
|
|
767
770
|
];
|
|
768
|
-
function
|
|
771
|
+
function H(e) {
|
|
769
772
|
return e instanceof Error ? e.message : String(e);
|
|
770
773
|
}
|
|
771
|
-
function
|
|
774
|
+
function U() {
|
|
772
775
|
return typeof performance < "u" ? performance.now() : Date.now();
|
|
773
776
|
}
|
|
774
|
-
function
|
|
777
|
+
function W(e) {
|
|
775
778
|
return Number.isFinite(e) ? Math.max(0, Math.round(e)) : 0;
|
|
776
779
|
}
|
|
777
|
-
function
|
|
780
|
+
function G(e, t, n) {
|
|
778
781
|
let r = {
|
|
779
782
|
tokens: [],
|
|
780
783
|
bindings: [],
|
|
@@ -794,7 +797,7 @@ function q(e, t, n) {
|
|
|
794
797
|
};
|
|
795
798
|
}
|
|
796
799
|
}
|
|
797
|
-
function
|
|
800
|
+
function dt(e) {
|
|
798
801
|
return Array.isArray(e) ? e.length > 32 ? Array(33) : e.map((e) => {
|
|
799
802
|
if (!e || typeof e != "object" || Array.isArray(e)) return e;
|
|
800
803
|
let t = e, n = { ...t }, r = t.props;
|
|
@@ -811,25 +814,25 @@ function lt(e) {
|
|
|
811
814
|
return n.props = i, n;
|
|
812
815
|
}) : e;
|
|
813
816
|
}
|
|
814
|
-
function
|
|
817
|
+
function ft(e) {
|
|
815
818
|
if (e !== void 0) try {
|
|
816
819
|
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
817
820
|
let t = e, n = {};
|
|
818
821
|
for (let e of b) Object.hasOwn(t, e) && (n[e] = t[e]);
|
|
819
|
-
if (Object.hasOwn(t, "markdownBreaks") && (n.markdownBreaks = t.markdownBreaks), Object.hasOwn(t, "strict") && (n.strict = t.strict), Object.hasOwn(t, "limits")) {
|
|
822
|
+
if (Object.hasOwn(t, "markdownBreaks") && (n.markdownBreaks = t.markdownBreaks), Object.hasOwn(t, "sourcePhase") && (n.sourcePhase = t.sourcePhase), Object.hasOwn(t, "strict") && (n.strict = t.strict), Object.hasOwn(t, "limits")) {
|
|
820
823
|
let e = t.limits;
|
|
821
824
|
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
822
825
|
let t = {};
|
|
823
|
-
for (let n of
|
|
826
|
+
for (let n of ut) Object.hasOwn(e, n) && (t[n] = e[n]);
|
|
824
827
|
n.limits = t;
|
|
825
828
|
} else n.limits = e;
|
|
826
829
|
}
|
|
827
|
-
return Object.hasOwn(t, "hostComponents") && (n.hostComponents =
|
|
830
|
+
return Object.hasOwn(t, "hostComponents") && (n.hostComponents = dt(t.hostComponents)), Object.hasOwn(t, "config") && (n.config = x(t.config)), n;
|
|
828
831
|
} catch {
|
|
829
832
|
return e;
|
|
830
833
|
}
|
|
831
834
|
}
|
|
832
|
-
function
|
|
835
|
+
function pt(e) {
|
|
833
836
|
try {
|
|
834
837
|
if (!e || typeof e != "object" || Array.isArray(e)) return "";
|
|
835
838
|
let t = e.limits;
|
|
@@ -845,7 +848,7 @@ function dt(e) {
|
|
|
845
848
|
return ":unreadable";
|
|
846
849
|
}
|
|
847
850
|
}
|
|
848
|
-
function
|
|
851
|
+
function mt(e) {
|
|
849
852
|
let t = S(e);
|
|
850
853
|
if (t !== "invalid") return t;
|
|
851
854
|
try {
|
|
@@ -854,18 +857,21 @@ function ft(e) {
|
|
|
854
857
|
return "invalid";
|
|
855
858
|
}
|
|
856
859
|
}
|
|
857
|
-
function
|
|
858
|
-
return `${
|
|
860
|
+
function K(e) {
|
|
861
|
+
return `${mt(e)}${pt(e)}`;
|
|
859
862
|
}
|
|
860
863
|
// src/local/transport/worker-handler.ts
|
|
861
|
-
function
|
|
862
|
-
let
|
|
863
|
-
return typeof
|
|
864
|
+
function ht(e, t, n, r) {
|
|
865
|
+
let i = e;
|
|
866
|
+
return typeof i.compileShared == "function" ? i.compileShared(t, n, r) : e.compile(t, n, r);
|
|
867
|
+
}
|
|
868
|
+
function gt(e) {
|
|
869
|
+
return e === "streaming" || e === "final";
|
|
864
870
|
}
|
|
865
|
-
function
|
|
871
|
+
function q(e) {
|
|
866
872
|
return e.stats;
|
|
867
873
|
}
|
|
868
|
-
function
|
|
874
|
+
function J(e, t, n) {
|
|
869
875
|
try {
|
|
870
876
|
e.postMessage({
|
|
871
877
|
id: t,
|
|
@@ -874,7 +880,7 @@ function X(e, t, n) {
|
|
|
874
880
|
});
|
|
875
881
|
} catch {}
|
|
876
882
|
}
|
|
877
|
-
function
|
|
883
|
+
function _t(e, t, n, r, i) {
|
|
878
884
|
try {
|
|
879
885
|
e.postMessage({
|
|
880
886
|
id: t,
|
|
@@ -886,15 +892,15 @@ function mt(e, t, n, r, i) {
|
|
|
886
892
|
});
|
|
887
893
|
} catch {}
|
|
888
894
|
}
|
|
889
|
-
function
|
|
895
|
+
function vt(e) {
|
|
890
896
|
return !!e && typeof e == "object" && (e.control === "dispose" || e.control === "cancel-preparation");
|
|
891
897
|
}
|
|
892
|
-
function
|
|
898
|
+
function yt(e) {
|
|
893
899
|
if (!e || typeof e != "object") return !1;
|
|
894
900
|
let t = e;
|
|
895
901
|
return typeof t.from == "number" && Number.isSafeInteger(t.from) && typeof t.to == "number" && Number.isSafeInteger(t.to) && t.from >= 0 && t.to >= t.from && typeof t.insert == "string";
|
|
896
902
|
}
|
|
897
|
-
function
|
|
903
|
+
function bt(e, t = {}) {
|
|
898
904
|
let n = e === void 0 ? globalThis : e;
|
|
899
905
|
if (!n || typeof n.postMessage != "function") throw TypeError("startLocalCompileWorker requires a worker scope with postMessage");
|
|
900
906
|
let r = t.createSession ? t.createSession() : T(), i = r, a = t.preparationDelay, o = typeof a == "number" && Number.isFinite(a) ? Math.max(0, a) : 200, s = typeof i.prepareAsync == "function", c = null, l = 0, u = !1, d = null, f = null, p = 0, m, h = () => {
|
|
@@ -907,11 +913,11 @@ function _t(e, t = {}) {
|
|
|
907
913
|
if (typeof t != "function") return;
|
|
908
914
|
let n = { aborted: !1 };
|
|
909
915
|
f = n;
|
|
910
|
-
let r =
|
|
916
|
+
let r = U(), a = !1;
|
|
911
917
|
try {
|
|
912
918
|
a = await t.call(i, n, g);
|
|
913
919
|
} catch {} finally {
|
|
914
|
-
f === n && (f = null), a && !n.aborted && !u && e === p && (m =
|
|
920
|
+
f === n && (f = null), a && !n.aborted && !u && e === p && (m = W(U() - r));
|
|
915
921
|
}
|
|
916
922
|
}, v = () => {
|
|
917
923
|
if (u || !s) return;
|
|
@@ -937,7 +943,7 @@ function _t(e, t = {}) {
|
|
|
937
943
|
}, S = (e, t, i, a, o = !1, s) => {
|
|
938
944
|
let l = c;
|
|
939
945
|
if (l === null) return !1;
|
|
940
|
-
let u =
|
|
946
|
+
let u = W(i), d = s === void 0 ? b(u) : {
|
|
941
947
|
...b(u),
|
|
942
948
|
...s
|
|
943
949
|
};
|
|
@@ -947,7 +953,8 @@ function _t(e, t = {}) {
|
|
|
947
953
|
ok: !0,
|
|
948
954
|
result: l.result,
|
|
949
955
|
duration: u,
|
|
950
|
-
incremental:
|
|
956
|
+
incremental: q(r),
|
|
957
|
+
...l.sourcePhase === void 0 ? {} : { sourcePhase: l.sourcePhase },
|
|
951
958
|
protocol: D,
|
|
952
959
|
revision: t,
|
|
953
960
|
metrics: d
|
|
@@ -956,65 +963,77 @@ function _t(e, t = {}) {
|
|
|
956
963
|
ok: !0,
|
|
957
964
|
result: l.result,
|
|
958
965
|
duration: u,
|
|
959
|
-
incremental:
|
|
966
|
+
incremental: q(r),
|
|
967
|
+
...l.sourcePhase === void 0 ? {} : { sourcePhase: l.sourcePhase }
|
|
960
968
|
};
|
|
961
969
|
if (o && i.ok) {
|
|
962
|
-
let e =
|
|
963
|
-
i.analysis =
|
|
970
|
+
let e = U();
|
|
971
|
+
i.analysis = G(l.source, l.options, l.result), i.metrics = {
|
|
964
972
|
...i.metrics,
|
|
965
|
-
analysisMs:
|
|
973
|
+
analysisMs: W(U() - e)
|
|
966
974
|
};
|
|
967
975
|
}
|
|
968
976
|
if (l.deep && l.flatResults && i.ok) {
|
|
969
977
|
let { result: e, ...t } = i, r = {
|
|
970
978
|
...t,
|
|
971
|
-
flatResult:
|
|
979
|
+
flatResult: ot(e)
|
|
972
980
|
};
|
|
973
981
|
n.postMessage(r);
|
|
974
982
|
} else n.postMessage(i);
|
|
975
983
|
return !0;
|
|
976
984
|
} catch (t) {
|
|
977
|
-
return
|
|
985
|
+
return J(n, e, `Could not return the compile result: ${H(t)}`), !1;
|
|
978
986
|
}
|
|
979
987
|
};
|
|
980
988
|
return n.onmessage = (e) => {
|
|
981
989
|
let t = e?.data;
|
|
982
|
-
if (
|
|
990
|
+
if (vt(t)) {
|
|
983
991
|
t.control === "dispose" ? y() : h();
|
|
984
992
|
return;
|
|
985
993
|
}
|
|
986
994
|
if (!t || typeof t.id != "number") return;
|
|
987
995
|
if (typeof t.source == "string") {
|
|
996
|
+
let e = t, i = ft(e.options), a = e.sourcePhase === void 0 ? i?.sourcePhase : e.sourcePhase;
|
|
997
|
+
if (a !== void 0 && !gt(a)) {
|
|
998
|
+
J(n, e.id, "The requested source phase is not supported: expected \"streaming\" or \"final\"");
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
let o = a;
|
|
988
1002
|
h();
|
|
989
|
-
let
|
|
1003
|
+
let s = K(i), u = e.protocol === D, d = x(e.revision), f = U();
|
|
990
1004
|
try {
|
|
991
|
-
if (c !== null && c.optionsKey !==
|
|
1005
|
+
if (c !== null && c.optionsKey !== s) try {
|
|
992
1006
|
r.clear();
|
|
993
1007
|
} catch {}
|
|
994
|
-
let t =
|
|
995
|
-
l =
|
|
1008
|
+
let t = ht(r, e.source, i, o), n = W(U() - f);
|
|
1009
|
+
l = d, c = {
|
|
996
1010
|
source: e.source,
|
|
997
|
-
revision:
|
|
1011
|
+
revision: d,
|
|
998
1012
|
options: i,
|
|
999
|
-
optionsKey:
|
|
1013
|
+
optionsKey: s,
|
|
1000
1014
|
result: t,
|
|
1001
|
-
deep:
|
|
1002
|
-
flatResults: e.flatResults ===
|
|
1003
|
-
|
|
1015
|
+
deep: at(t),
|
|
1016
|
+
flatResults: e.flatResults === V,
|
|
1017
|
+
...o === void 0 ? {} : { sourcePhase: o }
|
|
1018
|
+
}, S(e.id, d, n, u, e.includeAuthorAnalysis === !0) && v();
|
|
1004
1019
|
} catch (t) {
|
|
1005
|
-
|
|
1020
|
+
J(n, e.id, H(t));
|
|
1006
1021
|
}
|
|
1007
1022
|
return;
|
|
1008
1023
|
}
|
|
1009
1024
|
if (t.protocol !== "patch-v1") return;
|
|
1010
1025
|
h();
|
|
1011
1026
|
let i = t, a = c, o = (e, t) => {
|
|
1012
|
-
|
|
1027
|
+
_t(n, i.id, e, t, a?.revision);
|
|
1013
1028
|
};
|
|
1014
1029
|
if (a === null) {
|
|
1015
1030
|
o("No complete compile is available to patch", "stale-base");
|
|
1016
1031
|
return;
|
|
1017
1032
|
}
|
|
1033
|
+
if ((a.sourcePhase ?? "final") !== "final") {
|
|
1034
|
+
o("The baseline was compiled from a streaming snapshot", "phase-mismatch");
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1018
1037
|
if (typeof i.baseRevision != "number" || i.baseRevision !== a.revision) {
|
|
1019
1038
|
o("The requested base revision is not current", "stale-base");
|
|
1020
1039
|
return;
|
|
@@ -1023,7 +1042,7 @@ function _t(e, t = {}) {
|
|
|
1023
1042
|
o("The options signature changed since the baseline", "options-mismatch");
|
|
1024
1043
|
return;
|
|
1025
1044
|
}
|
|
1026
|
-
if (!
|
|
1045
|
+
if (!yt(i.edit)) {
|
|
1027
1046
|
o("The source edit is invalid", "invalid-edit");
|
|
1028
1047
|
return;
|
|
1029
1048
|
}
|
|
@@ -1037,22 +1056,23 @@ function _t(e, t = {}) {
|
|
|
1037
1056
|
o("The source edit produced an unexpected length", "invalid-edit");
|
|
1038
1057
|
return;
|
|
1039
1058
|
}
|
|
1040
|
-
let d = x(i.revision), f =
|
|
1059
|
+
let d = x(i.revision), f = U();
|
|
1041
1060
|
try {
|
|
1042
|
-
let e =
|
|
1061
|
+
let e = ht(r, u, a.options, a.sourcePhase), t = W(U() - f), o = a.revision, s = a.result;
|
|
1043
1062
|
l = d, c = {
|
|
1044
1063
|
source: u,
|
|
1045
1064
|
revision: d,
|
|
1046
1065
|
options: a.options,
|
|
1047
1066
|
optionsKey: a.optionsKey,
|
|
1048
1067
|
result: e,
|
|
1049
|
-
deep:
|
|
1050
|
-
flatResults: a.flatResults
|
|
1068
|
+
deep: at(e),
|
|
1069
|
+
flatResults: a.flatResults,
|
|
1070
|
+
...a.sourcePhase === void 0 ? {} : { sourcePhase: a.sourcePhase }
|
|
1051
1071
|
};
|
|
1052
1072
|
let p = null, h = 0;
|
|
1053
1073
|
if (e.ok && s.ok && !c.deep && !a.deep) {
|
|
1054
|
-
let t =
|
|
1055
|
-
p =
|
|
1074
|
+
let t = U();
|
|
1075
|
+
p = Qe(s, e), h = W(U() - t);
|
|
1056
1076
|
}
|
|
1057
1077
|
let g = p?.patch ?? null;
|
|
1058
1078
|
if (g === null) {
|
|
@@ -1084,19 +1104,20 @@ function _t(e, t = {}) {
|
|
|
1084
1104
|
revision: d,
|
|
1085
1105
|
patch: g,
|
|
1086
1106
|
duration: t,
|
|
1087
|
-
incremental:
|
|
1107
|
+
incremental: q(r),
|
|
1108
|
+
...a.sourcePhase === void 0 ? {} : { sourcePhase: a.sourcePhase },
|
|
1088
1109
|
metrics: _
|
|
1089
1110
|
};
|
|
1090
1111
|
if (i.includeAuthorAnalysis === !0) {
|
|
1091
|
-
let t =
|
|
1092
|
-
s.analysis =
|
|
1112
|
+
let t = U();
|
|
1113
|
+
s.analysis = G(u, a.options, e), _.analysisMs = W(U() - t);
|
|
1093
1114
|
}
|
|
1094
1115
|
n.postMessage(s), v();
|
|
1095
1116
|
} catch (e) {
|
|
1096
|
-
|
|
1117
|
+
J(n, i.id, `Could not return the compile result: ${H(e)}`);
|
|
1097
1118
|
}
|
|
1098
1119
|
} catch (e) {
|
|
1099
|
-
|
|
1120
|
+
J(n, i.id, H(e));
|
|
1100
1121
|
}
|
|
1101
1122
|
}, {
|
|
1102
1123
|
dispose: y,
|
|
@@ -1107,7 +1128,7 @@ function _t(e, t = {}) {
|
|
|
1107
1128
|
};
|
|
1108
1129
|
}
|
|
1109
1130
|
// src/local/transport/worker.ts
|
|
1110
|
-
function
|
|
1131
|
+
function xt(e, t) {
|
|
1111
1132
|
if (!e || typeof e != "object") return !1;
|
|
1112
1133
|
let n = e, r = (e) => e && Number.isSafeInteger(e.start) && Number.isSafeInteger(e.end) && e.start >= 0 && e.end >= e.start && e.end <= t;
|
|
1113
1134
|
if (!Array.isArray(n.tokens) || n.tokens.length > t + 1 || !Array.isArray(n.bindings) || n.bindings.length > t + 1 || !Array.isArray(n.diagnostics)) return !1;
|
|
@@ -1119,30 +1140,71 @@ function vt(e, t) {
|
|
|
1119
1140
|
for (let e of n.bindings) if (!e || typeof e.name != "string" || !Array.isArray(e.declarations) || !Array.isArray(e.references) || (a += e.declarations.length + e.references.length, a > t + 1 || !e.declarations.every(r) || !e.references.every(r))) return !1;
|
|
1120
1141
|
return !0;
|
|
1121
1142
|
}
|
|
1122
|
-
function
|
|
1123
|
-
let
|
|
1143
|
+
function St(e, t, n) {
|
|
1144
|
+
let r = ft(t), i = n === void 0 ? Ct(t) : n, a = i === "streaming" || i === "final" ? i : void 0, o = i !== void 0 && a === void 0 ? i : void 0;
|
|
1124
1145
|
return {
|
|
1125
1146
|
source: e,
|
|
1126
|
-
options:
|
|
1127
|
-
optionsKey:
|
|
1128
|
-
scheduledAt:
|
|
1147
|
+
options: r,
|
|
1148
|
+
optionsKey: K(r),
|
|
1149
|
+
scheduledAt: U(),
|
|
1150
|
+
sourcePhase: a === "streaming" ? "streaming" : "final",
|
|
1151
|
+
explicitPhase: i !== void 0,
|
|
1152
|
+
...o === void 0 ? {} : { invalidPhase: o }
|
|
1129
1153
|
};
|
|
1130
1154
|
}
|
|
1155
|
+
function Ct(e) {
|
|
1156
|
+
try {
|
|
1157
|
+
return !e || typeof e != "object" || Array.isArray(e) ? void 0 : e.sourcePhase;
|
|
1158
|
+
} catch {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
function Y(e, t) {
|
|
1163
|
+
return e.source === t.source && e.optionsKey === t.optionsKey && e.sourcePhase === t.sourcePhase && e.explicitPhase === t.explicitPhase && e.invalidPhase === t.invalidPhase;
|
|
1164
|
+
}
|
|
1165
|
+
function X(e) {
|
|
1166
|
+
return e.sourcePhase === "streaming" || e.explicitPhase ? { sourcePhase: e.sourcePhase } : {};
|
|
1167
|
+
}
|
|
1131
1168
|
function Z(e, t) {
|
|
1132
|
-
return e.
|
|
1169
|
+
return e.explicitPhase ? {
|
|
1170
|
+
ok: !1,
|
|
1171
|
+
diagnostics: [t],
|
|
1172
|
+
status: "failed"
|
|
1173
|
+
} : {
|
|
1174
|
+
ok: !1,
|
|
1175
|
+
diagnostics: [t]
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
function wt() {
|
|
1179
|
+
return {
|
|
1180
|
+
ok: !1,
|
|
1181
|
+
status: "failed",
|
|
1182
|
+
diagnostics: [{
|
|
1183
|
+
code: "local.options.invalid",
|
|
1184
|
+
message: "Compile option sourcePhase must be \"streaming\" or \"final\".",
|
|
1185
|
+
severity: "error",
|
|
1186
|
+
range: {
|
|
1187
|
+
start: 0,
|
|
1188
|
+
end: 0
|
|
1189
|
+
},
|
|
1190
|
+
line: 1,
|
|
1191
|
+
column: 1,
|
|
1192
|
+
messageKey: "local.options.invalid.source-phase"
|
|
1193
|
+
}]
|
|
1194
|
+
};
|
|
1133
1195
|
}
|
|
1134
1196
|
function Q(e) {
|
|
1135
1197
|
if (!e || typeof e != "object") return !1;
|
|
1136
1198
|
let t = e;
|
|
1137
1199
|
return !(typeof t.ok != "boolean" || !Array.isArray(t.diagnostics) || t.ok && (!t.document || typeof t.document != "object"));
|
|
1138
1200
|
}
|
|
1139
|
-
function
|
|
1201
|
+
function Tt(e) {
|
|
1140
1202
|
return e.ok && "patch" in e && e.patch !== void 0;
|
|
1141
1203
|
}
|
|
1142
1204
|
function $(e) {
|
|
1143
1205
|
return {
|
|
1144
1206
|
code: "local.worker.compile",
|
|
1145
|
-
message: `Compilation failed: ${
|
|
1207
|
+
message: `Compilation failed: ${H(e)}`,
|
|
1146
1208
|
severity: "error",
|
|
1147
1209
|
range: {
|
|
1148
1210
|
start: 0,
|
|
@@ -1152,7 +1214,7 @@ function $(e) {
|
|
|
1152
1214
|
column: 1
|
|
1153
1215
|
};
|
|
1154
1216
|
}
|
|
1155
|
-
var
|
|
1217
|
+
var Et = class {
|
|
1156
1218
|
options;
|
|
1157
1219
|
delay;
|
|
1158
1220
|
worker = null;
|
|
@@ -1177,16 +1239,18 @@ var xt = class {
|
|
|
1177
1239
|
this.handleWorkerFailure(t || "The compile worker encountered an error");
|
|
1178
1240
|
}, t.onmessageerror = () => this.handleWorkerFailure("The compile worker could not deliver the compile result"), this.worker = t;
|
|
1179
1241
|
} catch (t) {
|
|
1180
|
-
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${
|
|
1242
|
+
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${H(t)}`);
|
|
1181
1243
|
}
|
|
1182
1244
|
}
|
|
1183
|
-
schedule(e, t, n) {
|
|
1184
|
-
|
|
1245
|
+
schedule(e, t, n, r) {
|
|
1246
|
+
if (this.disposed) return;
|
|
1247
|
+
let i = St(e, t, r);
|
|
1248
|
+
this.queued = i, n && typeof n.baseSource == "string" && yt(n.edit) && n.edit.to <= n.baseSource.length && n.baseSource.slice(0, n.edit.from) + n.edit.insert + n.baseSource.slice(n.edit.to) === e && (this.queued.editHint = {
|
|
1185
1249
|
baseSource: n.baseSource,
|
|
1186
1250
|
edit: { ...n.edit }
|
|
1187
|
-
}), this.clearTimer(), this.timer = setTimeout(() => {
|
|
1251
|
+
}), this.clearTimer(), i.sourcePhase === "streaming" && (this.baseline = null), this.setPending(!0), i.sourcePhase === "streaming" || !i.explicitPhase ? this.timer = setTimeout(() => {
|
|
1188
1252
|
this.timer = null, this.drain();
|
|
1189
|
-
}, this.delay)
|
|
1253
|
+
}, this.delay) : this.drain();
|
|
1190
1254
|
}
|
|
1191
1255
|
dispose() {
|
|
1192
1256
|
if (this.disposed) return;
|
|
@@ -1206,12 +1270,24 @@ var xt = class {
|
|
|
1206
1270
|
e === null ? this.setPending(!1) : (this.queued = null, this.compile(e));
|
|
1207
1271
|
}
|
|
1208
1272
|
compile(e) {
|
|
1273
|
+
if (e.invalidPhase !== void 0) {
|
|
1274
|
+
this.deliver({
|
|
1275
|
+
source: e.source,
|
|
1276
|
+
result: wt(),
|
|
1277
|
+
duration: 0,
|
|
1278
|
+
mode: this.worker === null ? "fallback" : "worker",
|
|
1279
|
+
...e.options === void 0 ? {} : { options: e.options },
|
|
1280
|
+
metrics: { queueMs: W(U() - e.scheduledAt) }
|
|
1281
|
+
}), this.finishRun();
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1209
1284
|
let t = this.worker;
|
|
1210
1285
|
if (!t) {
|
|
1211
1286
|
this.compileFallback(e);
|
|
1212
1287
|
return;
|
|
1213
1288
|
}
|
|
1214
|
-
|
|
1289
|
+
e.sourcePhase === "streaming" && (this.baseline = null);
|
|
1290
|
+
let n = this.nextId++, r = this.nextRevision++, i = U(), a = this.baseline, o = e.sourcePhase === "final" && this.patchState === "enabled" && a !== null && a.optionsKey === e.optionsKey ? {
|
|
1215
1291
|
id: n,
|
|
1216
1292
|
protocol: D,
|
|
1217
1293
|
baseRevision: a.revision,
|
|
@@ -1229,7 +1305,8 @@ var xt = class {
|
|
|
1229
1305
|
...e.options === void 0 ? {} : { options: e.options },
|
|
1230
1306
|
protocol: D,
|
|
1231
1307
|
revision: r,
|
|
1232
|
-
flatResults:
|
|
1308
|
+
flatResults: V,
|
|
1309
|
+
...e.sourcePhase === "streaming" || e.explicitPhase ? { sourcePhase: e.sourcePhase } : {}
|
|
1233
1310
|
};
|
|
1234
1311
|
this.inFlight = {
|
|
1235
1312
|
id: n,
|
|
@@ -1241,8 +1318,8 @@ var xt = class {
|
|
|
1241
1318
|
t.postMessage(o);
|
|
1242
1319
|
} catch (t) {
|
|
1243
1320
|
this.inFlight = null;
|
|
1244
|
-
let n = `Could not send the source to the compile worker: ${
|
|
1245
|
-
if (r !== null && !
|
|
1321
|
+
let n = `Could not send the source to the compile worker: ${H(t)}`, r = this.queued;
|
|
1322
|
+
if (r !== null && !Y(r, e)) {
|
|
1246
1323
|
this.resetProtocol(), this.degrade(n), this.finishRun();
|
|
1247
1324
|
return;
|
|
1248
1325
|
}
|
|
@@ -1251,24 +1328,23 @@ var xt = class {
|
|
|
1251
1328
|
}
|
|
1252
1329
|
compileFallback(e) {
|
|
1253
1330
|
if (this.disposed) return;
|
|
1254
|
-
|
|
1331
|
+
e.sourcePhase === "streaming" && (this.baseline = null);
|
|
1332
|
+
let t = U(), n;
|
|
1255
1333
|
try {
|
|
1256
|
-
let t = this.options.fallbackCompile ?? ((e, t) => (this.fallbackSession ??= T(), this.fallbackSession.compile(e, t)));
|
|
1257
|
-
n = e.options === void 0 ? t(e.source) : t(e.source, e.options);
|
|
1258
|
-
} catch (
|
|
1259
|
-
n =
|
|
1260
|
-
ok: !1,
|
|
1261
|
-
diagnostics: [$(e)]
|
|
1262
|
-
};
|
|
1334
|
+
let t = this.options.fallbackCompile ?? ((e, t, n) => (this.fallbackSession ??= T(), this.fallbackSession.compile(e, t, n)));
|
|
1335
|
+
n = e.explicitPhase ? t(e.source, e.options, e.sourcePhase) : e.options === void 0 ? t(e.source) : t(e.source, e.options);
|
|
1336
|
+
} catch (t) {
|
|
1337
|
+
n = Z(e, $(t));
|
|
1263
1338
|
}
|
|
1264
1339
|
this.deliver({
|
|
1265
1340
|
source: e.source,
|
|
1266
1341
|
result: n,
|
|
1267
|
-
duration:
|
|
1342
|
+
duration: W(U() - t),
|
|
1268
1343
|
mode: "fallback",
|
|
1269
|
-
...this.options.includeAuthorAnalysis ? { analysis:
|
|
1344
|
+
...this.options.includeAuthorAnalysis ? { analysis: G(e.source, e.options, n) } : {},
|
|
1270
1345
|
...e.options === void 0 ? {} : { options: e.options },
|
|
1271
|
-
|
|
1346
|
+
...X(e),
|
|
1347
|
+
metrics: { queueMs: W(t - e.scheduledAt) }
|
|
1272
1348
|
}), this.finishRun();
|
|
1273
1349
|
}
|
|
1274
1350
|
receive(e) {
|
|
@@ -1277,8 +1353,8 @@ var xt = class {
|
|
|
1277
1353
|
if (!t || !e || e.id !== t.id) return;
|
|
1278
1354
|
let n, r = 0;
|
|
1279
1355
|
if (e.ok && "flatResult" in e) {
|
|
1280
|
-
let t =
|
|
1281
|
-
r =
|
|
1356
|
+
let t = U(), i = st(e.flatResult);
|
|
1357
|
+
r = W(U() - t), n = Q(i) ? {
|
|
1282
1358
|
...e,
|
|
1283
1359
|
result: i
|
|
1284
1360
|
} : {
|
|
@@ -1289,14 +1365,14 @@ var xt = class {
|
|
|
1289
1365
|
};
|
|
1290
1366
|
} else n = e;
|
|
1291
1367
|
this.inFlight = null;
|
|
1292
|
-
let i = t.job, a =
|
|
1368
|
+
let i = t.job, a = W(U() - t.startedAt), o = W(t.startedAt - i.scheduledAt), s = null, c = r, l = null, u = "worker", d;
|
|
1293
1369
|
if (n.ok) {
|
|
1294
|
-
if (
|
|
1295
|
-
let e =
|
|
1296
|
-
c =
|
|
1370
|
+
if (Tt(n)) {
|
|
1371
|
+
let e = U(), t = this.applyResponsePatch(i, n);
|
|
1372
|
+
c = W(U() - e), t !== null && (s = t, d = n.revision);
|
|
1297
1373
|
} else {
|
|
1298
1374
|
let e = n;
|
|
1299
|
-
Q(e.result) ? (s = e.result, d = typeof e.revision == "number" ? e.revision : void 0, e.protocol === "patch-v1" && typeof e.revision == "number" && Number.isSafeInteger(e.revision) ? (this.patchState = "enabled", this.baseline = e.result.ok ? {
|
|
1375
|
+
Q(e.result) ? (s = e.result, d = typeof e.revision == "number" ? e.revision : void 0, i.sourcePhase === "streaming" || e.sourcePhase === "streaming" ? this.baseline = null : e.protocol === "patch-v1" && typeof e.revision == "number" && Number.isSafeInteger(e.revision) ? (this.patchState = "enabled", this.baseline = e.result.ok ? {
|
|
1300
1376
|
source: i.source,
|
|
1301
1377
|
optionsKey: i.optionsKey,
|
|
1302
1378
|
revision: e.revision,
|
|
@@ -1304,16 +1380,14 @@ var xt = class {
|
|
|
1304
1380
|
} : null) : (this.patchState = "legacy", this.baseline = null)) : l = "The compile worker returned an invalid result";
|
|
1305
1381
|
}
|
|
1306
1382
|
} else n.retryFull !== !0 && (l = n.message);
|
|
1307
|
-
let f = this.queued, p = f !== null && !
|
|
1383
|
+
let f = this.queued, p = f !== null && !Y(f, i);
|
|
1308
1384
|
f !== null && !p && (this.queued = null, this.clearTimer()), s === null ? l === null ? (p || !this.recoverWithFullResult(i)) && (p ? this.resetProtocol() : (this.patchState = "disabled", this.baseline = null, this.deliver({
|
|
1309
1385
|
source: i.source,
|
|
1310
|
-
result:
|
|
1311
|
-
ok: !1,
|
|
1312
|
-
diagnostics: [$("The compile worker could not apply an incremental result patch")]
|
|
1313
|
-
},
|
|
1386
|
+
result: Z(i, $("The compile worker could not apply an incremental result patch")),
|
|
1314
1387
|
duration: 0,
|
|
1315
1388
|
mode: u,
|
|
1316
1389
|
...i.options === void 0 ? {} : { options: i.options },
|
|
1390
|
+
...X(i),
|
|
1317
1391
|
metrics: {
|
|
1318
1392
|
queueMs: o,
|
|
1319
1393
|
roundTripMs: a,
|
|
@@ -1321,13 +1395,11 @@ var xt = class {
|
|
|
1321
1395
|
}
|
|
1322
1396
|
})), this.finishRun()) : (p || this.deliver({
|
|
1323
1397
|
source: i.source,
|
|
1324
|
-
result:
|
|
1325
|
-
ok: !1,
|
|
1326
|
-
diagnostics: [$(l)]
|
|
1327
|
-
},
|
|
1398
|
+
result: Z(i, $(l)),
|
|
1328
1399
|
duration: 0,
|
|
1329
1400
|
mode: u,
|
|
1330
1401
|
...i.options === void 0 ? {} : { options: i.options },
|
|
1402
|
+
...X(i),
|
|
1331
1403
|
metrics: {
|
|
1332
1404
|
queueMs: o,
|
|
1333
1405
|
roundTripMs: a
|
|
@@ -1335,10 +1407,11 @@ var xt = class {
|
|
|
1335
1407
|
}), this.finishRun()) : (p || this.deliver({
|
|
1336
1408
|
source: i.source,
|
|
1337
1409
|
result: s,
|
|
1338
|
-
duration:
|
|
1410
|
+
duration: W(n.ok ? n.duration : 0),
|
|
1339
1411
|
mode: u,
|
|
1340
|
-
...n.ok && this.options.includeAuthorAnalysis &&
|
|
1412
|
+
...n.ok && this.options.includeAuthorAnalysis && xt(n.analysis, i.source.length) ? { analysis: n.analysis } : {},
|
|
1341
1413
|
...i.options === void 0 ? {} : { options: i.options },
|
|
1414
|
+
...X(i),
|
|
1342
1415
|
metrics: {
|
|
1343
1416
|
queueMs: o,
|
|
1344
1417
|
roundTripMs: a,
|
|
@@ -1349,20 +1422,34 @@ var xt = class {
|
|
|
1349
1422
|
}), this.finishRun());
|
|
1350
1423
|
}
|
|
1351
1424
|
applyResponsePatch(e, t) {
|
|
1425
|
+
if (e.sourcePhase !== "final") return null;
|
|
1352
1426
|
let n = this.baseline;
|
|
1353
1427
|
if (n === null || n.optionsKey !== e.optionsKey || !Number.isSafeInteger(t.revision) || t.revision <= n.revision || t.baseRevision !== n.revision || t.protocol !== "patch-v1") return null;
|
|
1354
|
-
let r =
|
|
1355
|
-
|
|
1428
|
+
let r = it(n.result, t.patch);
|
|
1429
|
+
if (r === null || !r.ok || r.document.source !== e.source) return null;
|
|
1430
|
+
let i;
|
|
1431
|
+
if (e.sourcePhase === "final" && e.explicitPhase) i = r.recoveries === void 0 ? {
|
|
1432
|
+
...r,
|
|
1433
|
+
status: "valid"
|
|
1434
|
+
} : {
|
|
1435
|
+
...r,
|
|
1436
|
+
status: "recovered"
|
|
1437
|
+
};
|
|
1438
|
+
else if (r.ok && r.status !== void 0) {
|
|
1439
|
+
let e = { ...r };
|
|
1440
|
+
delete e.status, i = e;
|
|
1441
|
+
} else i = r;
|
|
1442
|
+
return this.baseline = {
|
|
1356
1443
|
source: e.source,
|
|
1357
1444
|
optionsKey: e.optionsKey,
|
|
1358
1445
|
revision: t.revision,
|
|
1359
|
-
result:
|
|
1360
|
-
},
|
|
1446
|
+
result: i
|
|
1447
|
+
}, i;
|
|
1361
1448
|
}
|
|
1362
1449
|
recoverWithFullResult(e) {
|
|
1363
1450
|
if (this.worker === null || (e.recovery ?? 0) >= 1) return !1;
|
|
1364
1451
|
let t = this.queued;
|
|
1365
|
-
return t !== null && !
|
|
1452
|
+
return t !== null && !Y(t, e) ? !1 : (t !== null && (this.queued = null, this.clearTimer()), this.resetProtocol(), this.compile({
|
|
1366
1453
|
...e,
|
|
1367
1454
|
recovery: (e.recovery ?? 0) + 1
|
|
1368
1455
|
}), !0);
|
|
@@ -1371,7 +1458,7 @@ var xt = class {
|
|
|
1371
1458
|
if (this.disposed) return;
|
|
1372
1459
|
this.resetProtocol(), this.degrade(e);
|
|
1373
1460
|
let t = this.inFlight;
|
|
1374
|
-
this.inFlight = null, t && (this.queued === null ||
|
|
1461
|
+
this.inFlight = null, t && (this.queued === null || Y(this.queued, t.job)) && (this.queued !== null && (this.queued = null, this.clearTimer()), this.compileFallback(t.job)), this.finishRun();
|
|
1375
1462
|
}
|
|
1376
1463
|
degrade(e) {
|
|
1377
1464
|
let t = this.worker;
|
|
@@ -1404,4 +1491,4 @@ var xt = class {
|
|
|
1404
1491
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
1405
1492
|
}
|
|
1406
1493
|
};
|
|
1407
|
-
export { h as DEFAULT_LOCAL_THEME,
|
|
1494
|
+
export { h as DEFAULT_LOCAL_THEME, ct as LOCAL_COMPILE_DELAY_MS, lt as LOCAL_COMPILE_PREPARATION_DELAY_MS, i as LOCAL_DIAGNOSTIC_CODES, D as LOCAL_RESULT_PATCH_PROTOCOL, _e as LOCAL_STATE_FORMAT, y as LOCAL_SYNTAX_VERSION, f as LOCAL_THEME_PROTOCOL, Et as LocalCompileScheduler, ie as LocalCompileSession, g as LocalExpressionError, Te as SHAREABLE_HTML_FORMAT, Se as SHAREABLE_HTML_FORMAT_V2, C as analyzeLocalSource, it as applyLocalResultPatch, Ce as applyLocalState, oe as applyLocalStateRetention, Ve as applySourceEdit, Le as checkLocalUpgrade, _ as compileExpression, $ as compileFailureDiagnostic, n as compileLatex, ee as compileLocal, t as compilePlotFormula, ne as completeLocalSource, a as countLocalCodePoints, T as createLocalCompileSession, ce as createLocalRuntime, xe as createLocalStateFile, we as createShareableHtml, F as diffSourceEdit, Ze as encodeLocalResultPatch, ye as exportLocalState, l as formatLocalDiagnostic, re as formatLocalSource, e as implicitGridSize, ve as importLocalState, Pe as inspectLocalSourceVersion, u as isLocalDiagnosticCode, o as isLocalThemeName, S as localCompileOptionsKey, s as localDiagnosticTemplate, c as localDiagnosticTemplateKeys, ae as localSourceDigest, K as localWorkerOptionsKey, Re as migrateLocalSource, ue as notifyLocalRuntime, he as parseLocalState, le as planLocalStateRetention, r as plotFormulaKind, te as renameLocalBinding, Oe as resolveLocalComponentStateExport, Ee as resolveLocalState, be as resolveLocalStateBaseline, m as resolveLocalTheme, me as sampleImplicit, fe as sampleParametric, pe as samplePlot, de as samplePolar, ge as serializeForScript, De as serializeLocalState, bt as startLocalCompileWorker, se as updateLocalRuntime };
|