reactive-md 0.5.3 → 0.6.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.
Files changed (141) hide show
  1. package/CHANGELOG-ch.md +195 -165
  2. package/CHANGELOG.md +195 -165
  3. package/CONTRIBUTING-ch.md +67 -62
  4. package/CONTRIBUTING.md +69 -64
  5. package/README-ch.md +157 -155
  6. package/README-en.md +184 -181
  7. package/README.md +184 -181
  8. package/SECURITY-ch.md +81 -81
  9. package/SECURITY.md +81 -81
  10. package/THIRD_PARTY_NOTICES.md +585 -1
  11. package/bin/reactive-md.mjs +39 -39
  12. package/cli/args.mjs +181 -181
  13. package/cli/assets.mjs +390 -390
  14. package/cli/build.mjs +268 -268
  15. package/cli/document.mjs +130 -130
  16. package/cli/errors.mjs +61 -61
  17. package/cli/fs-utils.mjs +133 -133
  18. package/cli/glob.mjs +203 -203
  19. package/cli/help.mjs +138 -138
  20. package/cli/lint.mjs +177 -177
  21. package/cli/main.mjs +55 -55
  22. package/cli/migrate.mjs +368 -368
  23. package/cli/package.mjs +210 -210
  24. package/dist-library/{authoring-DJJjKYg9.js → authoring-BEVyth5X.js} +58 -58
  25. package/dist-library/compiler-Cm3ppMxG.js +46044 -0
  26. package/dist-library/react-Bh7_oxZp.js +59655 -0
  27. package/dist-library/reactive-md-authoring.js +2 -2
  28. package/dist-library/reactive-md-editor.js +13 -0
  29. package/dist-library/reactive-md-print.css +284 -284
  30. package/dist-library/reactive-md-react-unstyled.js +1 -1
  31. package/dist-library/reactive-md-react.js +1 -1
  32. package/dist-library/reactive-md.css +1 -1
  33. package/dist-library/reactive-md.js +123 -123
  34. package/dist-library/{runtime-DXtle_6c.js → runtime-DlFYQ4s_.js} +151 -151
  35. package/dist-library/types/editor/types.d.ts +2 -0
  36. package/dist-library/types/local/code-block.d.ts +3 -1
  37. package/dist-library/types/local/code-languages.d.ts +7 -0
  38. package/dist-library/types/local/compiled-data.d.ts +6 -0
  39. package/dist-library/types/local/compiler.d.ts +1 -0
  40. package/dist-library/types/local/diagnostics.d.ts +31 -0
  41. package/dist-library/types/local/diagram-layout.d.ts +69 -0
  42. package/dist-library/types/local/html-names.d.ts +6 -0
  43. package/dist-library/types/local/html-table.d.ts +25 -0
  44. package/dist-library/types/local/math-display.d.ts +22 -22
  45. package/dist-library/types/local/math-view.d.ts +6 -7
  46. package/dist-library/types/local/table-surface.d.ts +10 -0
  47. package/dist-library/types/local/types.d.ts +2 -0
  48. package/dist-library/types/local/visuals.d.ts +9 -0
  49. package/dist-standalone/reactive-md-standalone.css +1 -1
  50. package/dist-standalone/reactive-md-standalone.js +331 -51
  51. package/docs/README.md +84 -0
  52. package/docs/{compatibility-ch.md → compatibility/compatibility-ch.md} +121 -109
  53. package/docs/{compatibility-en.md → compatibility/compatibility-en.md} +121 -109
  54. package/docs/{source-versioning-ch.md → compatibility/source-versioning-ch.md} +159 -159
  55. package/docs/{source-versioning-en.md → compatibility/source-versioning-en.md} +159 -159
  56. package/docs/{component-development-ch.md → development/component-development-ch.md} +210 -210
  57. package/docs/{component-development-en.md → development/component-development-en.md} +210 -210
  58. package/docs/{component-protocol-ch.md → development/component-protocol-ch.md} +747 -747
  59. package/docs/{component-protocol-en.md → development/component-protocol-en.md} +747 -747
  60. package/docs/{performance-ch.md → development/performance-ch.md} +76 -76
  61. package/docs/{performance-en.md → development/performance-en.md} +76 -76
  62. package/docs/{releasing-ch.md → development/releasing-ch.md} +108 -108
  63. package/docs/{releasing-en.md → development/releasing-en.md} +108 -108
  64. package/docs/guides/local-guide-ch.md +513 -0
  65. package/docs/guides/local-guide-en.md +513 -0
  66. package/docs/{author-tools-ch.md → integration/author-tools-ch.md} +57 -57
  67. package/docs/{author-tools-en.md → integration/author-tools-en.md} +57 -57
  68. package/docs/{editor-ch.md → integration/editor-ch.md} +7 -6
  69. package/docs/{editor-en.md → integration/editor-en.md} +7 -6
  70. package/docs/{local-integration-ch.md → integration/local-integration-ch.md} +33 -15
  71. package/docs/{local-integration-en.md → integration/local-integration-en.md} +33 -15
  72. package/docs/{shareable-export-ch.md → integration/shareable-export-ch.md} +221 -209
  73. package/docs/{shareable-export-en.md → integration/shareable-export-en.md} +223 -211
  74. package/docs/{computations-formatting-ch.md → reference/computations-formatting-ch.md} +87 -87
  75. package/docs/{computations-formatting-en.md → reference/computations-formatting-en.md} +87 -87
  76. package/docs/{constraints-collections-ch.md → reference/constraints-collections-ch.md} +84 -84
  77. package/docs/{constraints-collections-en.md → reference/constraints-collections-en.md} +84 -84
  78. package/docs/{diagnostics-counting-ch.md → reference/diagnostics-counting-ch.md} +104 -84
  79. package/docs/{diagnostics-counting-en.md → reference/diagnostics-counting-en.md} +104 -84
  80. package/docs/{html-compatibility-ch.md → reference/html-compatibility-ch.md} +42 -4
  81. package/docs/{html-compatibility-en.md → reference/html-compatibility-en.md} +42 -4
  82. package/docs/{local-components-v2-ch.md → reference/local-components-v2-ch.md} +138 -138
  83. package/docs/{local-components-v2-en.md → reference/local-components-v2-en.md} +104 -104
  84. package/docs/{local-interaction-syntax-ch.md → reference/local-interaction-syntax-ch.md} +515 -492
  85. package/docs/{local-interaction-syntax-en.md → reference/local-interaction-syntax-en.md} +511 -488
  86. package/docs/{theme-protocol-ch.md → reference/theme-protocol-ch.md} +107 -107
  87. package/docs/{theme-protocol-en.md → reference/theme-protocol-en.md} +107 -107
  88. package/docs/{release-0.4.0-ch.md → releases/release-0.4.0-ch.md} +89 -89
  89. package/docs/{release-0.4.0-en.md → releases/release-0.4.0-en.md} +89 -89
  90. package/docs/{release-0.4.1-ch.md → releases/release-0.4.1-ch.md} +23 -23
  91. package/docs/{release-0.4.1-en.md → releases/release-0.4.1-en.md} +23 -23
  92. package/docs/{release-0.5.0-ch.md → releases/release-0.5.0-ch.md} +4 -4
  93. package/docs/{release-0.5.0-en.md → releases/release-0.5.0-en.md} +4 -4
  94. package/docs/{release-0.5.1-ch.md → releases/release-0.5.1-ch.md} +4 -4
  95. package/docs/{release-0.5.1-en.md → releases/release-0.5.1-en.md} +4 -4
  96. package/docs/{release-0.5.2-ch.md → releases/release-0.5.2-ch.md} +3 -3
  97. package/docs/{release-0.5.2-en.md → releases/release-0.5.2-en.md} +3 -3
  98. package/docs/{release-0.5.3-ch.md → releases/release-0.5.3-ch.md} +1 -1
  99. package/docs/{release-0.5.3-en.md → releases/release-0.5.3-en.md} +1 -1
  100. package/docs/releases/release-0.6.0-ch.md +57 -0
  101. package/docs/releases/release-0.6.0-en.md +57 -0
  102. package/docs/releases/release-0.6.1-ch.md +27 -0
  103. package/docs/releases/release-0.6.1-en.md +27 -0
  104. package/examples/conformance/README.md +53 -53
  105. package/examples/conformance/component-protocol-1.json +482 -482
  106. package/examples/conformance/component-protocol-1.schema.json +76 -76
  107. package/examples/conformance/local-draft-1.json +50 -50
  108. package/examples/conformance/local-draft-2.json +212 -212
  109. package/examples/integration/README.md +47 -45
  110. package/examples/integration/core/index.mjs +32 -32
  111. package/examples/integration/worker/index.html +19 -19
  112. package/examples/integration/worker/main.js +61 -61
  113. package/examples/integration/worker/package.json +13 -13
  114. package/examples/integration/worker/worker.js +3 -3
  115. package/examples/local/README.md +74 -74
  116. package/examples/local/charts.reactive.md +73 -73
  117. package/examples/local/html-compat.reactive.md +19 -0
  118. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  119. package/examples/local/recipes/invoice.reactive.md +36 -36
  120. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  121. package/examples/local/recipes/workshop.reactive.md +33 -33
  122. package/examples/local/showcase/README.md +25 -25
  123. package/examples/local/showcase/explore.reactive.md +102 -102
  124. package/examples/local/showcase/flow.reactive.md +86 -86
  125. package/examples/local/showcase/forms.reactive.md +126 -126
  126. package/examples/local/showcase/functions.reactive.md +119 -119
  127. package/examples/local/showcase/layout.reactive.md +100 -100
  128. package/examples/local/showcase/statistics.reactive.md +108 -108
  129. package/examples/local/showcase/tasks.reactive.md +89 -89
  130. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  131. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  132. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  133. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  134. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  135. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  136. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  137. package/package.json +152 -145
  138. package/dist-library/compiler-UyPwGzJZ.js +0 -22109
  139. package/dist-library/react-fizgU3i8.js +0 -12764
  140. package/docs/local-guide-ch.md +0 -967
  141. package/docs/local-guide-en.md +0 -967
@@ -1,6 +1,6 @@
1
- import { $ as e, A as t, G as n, J as r, K as i, M as a, U as o, _ as s, at as c, b as l, d as u, et as d, f, it as p, j as m, k as h, lt as g, m as _, n as ee, nt as v, ot as y, p as b, r as te, rt as ne, t as x, tt as re, v as ie, y as ae } from "./compiler-UyPwGzJZ.js";
2
- import { i as oe, n as se, r as ce, t as le } from "./authoring-DJJjKYg9.js";
3
- import { t as ue } from "./runtime-DXtle_6c.js";
1
+ import { F as e, J as t, K as n, M as r, N as i, P as a, Y as o, Z as s, _ as c, at as l, b as u, ct as d, d as f, f as p, ft as m, it as h, lt as g, m as _, n as ee, nt as v, ot as y, p as b, r as te, rt as ne, st as re, t as x, v as ie, y as ae } from "./compiler-Cm3ppMxG.js";
2
+ import { i as oe, n as se, r as ce, t as le } from "./authoring-BEVyth5X.js";
3
+ import { t as ue } from "./runtime-DlFYQ4s_.js";
4
4
  // src/local/source-migration.ts
5
5
  var de = /* @__PURE__ */ new Set([
6
6
  "sum",
@@ -36,7 +36,7 @@ var de = /* @__PURE__ */ new Set([
36
36
  "validation",
37
37
  "data-table",
38
38
  "column"
39
- ]), pe = `<!-- reactive-md: ${h} -->`;
39
+ ]), pe = `<!-- reactive-md: ${r} -->`;
40
40
  function me(e) {
41
41
  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;
42
42
  return {
@@ -48,15 +48,15 @@ function me(e) {
48
48
  };
49
49
  }
50
50
  function he(e) {
51
- return me(u(e));
51
+ return me(f(e));
52
52
  }
53
53
  function ge(e, t, n, r, i = "error") {
54
- let a = p(t, r), o = e.slice(0, n.start), s = o.lastIndexOf("\n");
54
+ let a = re(t, r), o = e.slice(0, n.start), s = o.lastIndexOf("\n");
55
55
  return {
56
56
  code: t,
57
57
  severity: i,
58
58
  range: { ...n },
59
- message: re(a),
59
+ message: h(a),
60
60
  line: o.split("\n").length,
61
61
  column: n.start - s,
62
62
  messageKey: a.key,
@@ -64,42 +64,42 @@ function ge(e, t, n, r, i = "error") {
64
64
  };
65
65
  }
66
66
  function S(e, t = {}) {
67
- let n = u(e), r = me(n), i = typeof t == "object" && !!t && !Array.isArray(t), a = i ? t.fromVersion ?? r.effectiveVersion : r.effectiveVersion, o = typeof a == "string" ? a : "", s = {
67
+ let n = f(e), i = me(n), a = typeof t == "object" && !!t && !Array.isArray(t), o = a ? t.fromVersion ?? i.effectiveVersion : i.effectiveVersion, s = typeof o == "string" ? o : "", c = {
68
68
  ok: !1,
69
- fromVersion: o,
70
- toVersion: h,
71
- needsMigration: !n.versionDeclaration || o !== "local-draft-2",
72
- diagnostics: r.diagnostics.filter((e) => e.code !== "local.version.unsupported")
73
- }, c = {
74
- report: s,
69
+ fromVersion: s,
70
+ toVersion: r,
71
+ needsMigration: !n.versionDeclaration || s !== "local-draft-2",
72
+ diagnostics: i.diagnostics.filter((e) => e.code !== "local.version.unsupported")
73
+ }, l = {
74
+ report: c,
75
75
  declaration: n.versionDeclaration
76
76
  };
77
- if (typeof e != "string" || s.diagnostics.some((e) => e.severity === "error")) return c;
78
- let l = r.range ?? {
77
+ if (typeof e != "string" || c.diagnostics.some((e) => e.severity === "error")) return l;
78
+ let u = i.range ?? {
79
79
  start: 0,
80
80
  end: 0
81
81
  }, d = (e) => {
82
- if (s.diagnostics.length >= 100) {
82
+ if (c.diagnostics.length >= 100) {
83
83
  if (e.severity === "warning") return;
84
- let t = s.diagnostics.length - 1;
85
- for (; t >= 0 && s.diagnostics[t].severity !== "warning";) --t;
84
+ let t = c.diagnostics.length - 1;
85
+ for (; t >= 0 && c.diagnostics[t].severity !== "warning";) --t;
86
86
  if (t < 0) return;
87
- s.diagnostics.splice(t, 1);
87
+ c.diagnostics.splice(t, 1);
88
88
  }
89
- s.diagnostics.push(e);
90
- }, f = (t, n, r, i) => {
89
+ c.diagnostics.push(e);
90
+ }, p = (t, n, r, i) => {
91
91
  d(ge(e, t, n, r, i));
92
92
  };
93
- 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 f("local.upgrade.from-version", l, {
94
- from: o,
93
+ if (!a || typeof o != "string" || !["local-draft-1", "local-draft-2"].includes(s) || t.allowSemanticChanges !== void 0 && typeof t.allowSemanticChanges != "boolean" || t.fromVersion !== void 0 && i.declaredVersion !== null && s !== i.declaredVersion) return p("local.upgrade.from-version", u, {
94
+ from: s,
95
95
  detail: "use local-draft-1 or local-draft-2 and match the source declaration"
96
- }), c;
97
- let p = n.versionDeclaration ? e.slice(0, l.start) + e.slice(l.start, l.end).replace(/[^\r\n]/g, " ") + e.slice(l.end) : e, m = n.versionDeclaration ? u(p) : n;
98
- if (o === "local-draft-1") {
96
+ }), l;
97
+ let m = n.versionDeclaration ? e.slice(0, u.start) + e.slice(u.start, u.end).replace(/[^\r\n]/g, " ") + e.slice(u.end) : e, h = n.versionDeclaration ? f(m) : n;
98
+ if (s === "local-draft-1") {
99
99
  let e = (n) => {
100
100
  for (let r of n) {
101
101
  if (r.name && fe.has(r.name)) {
102
- f("local.upgrade.tag", r.range, { name: r.name });
102
+ p("local.upgrade.tag", r.range, { name: r.name });
103
103
  continue;
104
104
  }
105
105
  for (let e of [
@@ -110,26 +110,26 @@ function S(e, t = {}) {
110
110
  "bind-y"
111
111
  ]) {
112
112
  let t = r.attrs?.[e];
113
- t && de.has(t) && f("local.upgrade.reserved-binding", r.range, { name: t });
113
+ t && de.has(t) && p("local.upgrade.reserved-binding", r.range, { name: t });
114
114
  }
115
- (r.name === "input" || r.name === "textarea") && (r.attrs?.["max-length"] !== void 0 || Number(r.attrs?.["min-length"] ?? 0) > 0) && f("local.upgrade.text-length", r.range, void 0, t.allowSemanticChanges ? "warning" : "error");
115
+ (r.name === "input" || r.name === "textarea") && (r.attrs?.["max-length"] !== void 0 || Number(r.attrs?.["min-length"] ?? 0) > 0) && p("local.upgrade.text-length", r.range, void 0, t.allowSemanticChanges ? "warning" : "error");
116
116
  let n = [...r.type === "interpolation" ? [r.value ?? ""] : [], ...Object.values(r.attrs ?? {}).flatMap((e) => [...e.matchAll(/\{\{([\s\S]*?)\}\}/g)].map((e) => e[1]))];
117
117
  for (let e of n) {
118
118
  let t = e.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g, "");
119
- (t.includes("[") || [...de].some((e) => RegExp(`\\b${e}\\s*\\(`).test(t))) && f("local.upgrade.expression", r.range);
119
+ (t.includes("[") || [...de].some((e) => RegExp(`\\b${e}\\s*\\(`).test(t))) && p("local.upgrade.expression", r.range);
120
120
  }
121
121
  r.type !== "fallback" && r.children && e(r.children);
122
122
  }
123
123
  };
124
- e(m.nodes);
124
+ e(h.nodes);
125
125
  }
126
- if (s.diagnostics.some((e) => e.severity === "error")) return c;
127
- let g = x(p);
126
+ if (c.diagnostics.some((e) => e.severity === "error")) return l;
127
+ let g = x(m);
128
128
  for (let e of g.diagnostics) d(e);
129
- return g.ok && (!n.versionDeclaration && s.diagnostics.length < 100 && f("local.upgrade.version-missing", {
129
+ return g.ok && (!n.versionDeclaration && c.diagnostics.length < 100 && p("local.upgrade.version-missing", {
130
130
  start: +(e.charCodeAt(0) === 65279),
131
131
  end: +(e.charCodeAt(0) === 65279)
132
- }, { version: h }, "warning"), s.ok = !0), c;
132
+ }, { version: r }, "warning"), c.ok = !0), l;
133
133
  }
134
134
  function _e(e, t) {
135
135
  return S(e, t).report;
@@ -167,7 +167,7 @@ var C = "reactive-md-state/v1", w = 1048576, ye = /^fnv1a32:[0-9a-f]{8}$/, be =
167
167
  function E(e, t) {
168
168
  return {
169
169
  code: e,
170
- message: t.length > 2e3 ? `${t.slice(0, g - 1)}…` : t,
170
+ message: t.length > 2e3 ? `${t.slice(0, m - 1)}…` : t,
171
171
  severity: "error",
172
172
  range: {
173
173
  start: 0,
@@ -292,33 +292,33 @@ function Te(e) {
292
292
  function L(e, t, n) {
293
293
  if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
294
294
  if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
295
- let r = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), i = new Set(r), a = /* @__PURE__ */ new Map();
295
+ let i = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), a = new Set(i), o = /* @__PURE__ */ new Map();
296
296
  for (let n of Object.keys(t)) {
297
297
  if (Object.hasOwn(e.computations ?? {}, n)) continue;
298
298
  if (n.startsWith("@")) {
299
299
  if (!Object.hasOwn(e.bindings, n)) throw Error(`Cannot persist parameter "${n}": it is not a binding of this document.`);
300
300
  continue;
301
301
  }
302
- if (!i.has(n)) throw Error(`Cannot persist parameter "${n}": it is not a public binding of this document.`);
302
+ if (!a.has(n)) throw Error(`Cannot persist parameter "${n}": it is not a public binding of this document.`);
303
303
  let r = j(t[n]);
304
304
  if (!r.ok) throw TypeError(`Cannot persist parameter "${n}": the value ${r.message}`);
305
- a.set(n, r.value);
305
+ o.set(n, r.value);
306
306
  }
307
- let o = {};
308
- for (let e of r) {
309
- if (!a.has(e)) throw Error(`Cannot persist the document: parameter "${e}" is missing from the supplied state.`);
310
- o[e] = a.get(e);
307
+ let s = {};
308
+ for (let e of i) {
309
+ if (!o.has(e)) throw Error(`Cannot persist the document: parameter "${e}" is missing from the supplied state.`);
310
+ s[e] = o.get(e);
311
311
  }
312
- let s = {
312
+ let c = {
313
313
  format: C,
314
- syntax: h,
314
+ syntax: r,
315
315
  sourceDigest: A(e.source),
316
- parameters: o
316
+ parameters: s
317
317
  };
318
- return n !== void 0 && (s.generator = P(n)), N(s);
318
+ return n !== void 0 && (c.generator = P(n)), N(c);
319
319
  }
320
320
  function Ee(e, t) {
321
- let n = [], r = (e, t) => D(n, e, t), i = e;
321
+ let n = [], i = (e, t) => D(n, e, t), a = e;
322
322
  if (typeof e == "string") {
323
323
  if (I(e, t) > t) return {
324
324
  ok: !1,
@@ -329,7 +329,7 @@ function Ee(e, t) {
329
329
  diagnostics: [E("local.state.utf", "The state payload contains malformed Unicode.")]
330
330
  };
331
331
  try {
332
- i = JSON.parse(e);
332
+ a = JSON.parse(e);
333
333
  } catch (e) {
334
334
  return {
335
335
  ok: !1,
@@ -347,39 +347,39 @@ function Ee(e, t) {
347
347
  diagnostics: [E("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
348
348
  };
349
349
  }
350
- if (!M(i)) return {
350
+ if (!M(a)) return {
351
351
  ok: !1,
352
352
  diagnostics: [E("local.state.shape", "The state payload must be a JSON object.")]
353
353
  };
354
- Object.getOwnPropertySymbols(i).length > 0 && r("local.state.shape", "The state payload cannot use symbol keys.");
355
- for (let e of Object.keys(i)) Se.has(e) || r("local.state.key", `Unknown top-level state key "${e}".`);
356
- let a = i.format;
357
- a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${F(a)}; expected "${C}".`);
358
- let o = i.syntax;
359
- o !== "local-draft-2" && r("local.state.syntax", `Unsupported state syntax ${F(o)}; expected "${h}".`);
360
- let s = i.sourceDigest;
361
- typeof s == "string" && ye.test(s) || r("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
362
- let c = {}, l = i.parameters;
363
- if (!M(l)) r("local.state.parameters", "parameters must be a JSON object of public binding values.");
364
- else for (let e of Object.keys(l).sort()) {
354
+ Object.getOwnPropertySymbols(a).length > 0 && i("local.state.shape", "The state payload cannot use symbol keys.");
355
+ for (let e of Object.keys(a)) Se.has(e) || i("local.state.key", `Unknown top-level state key "${e}".`);
356
+ let o = a.format;
357
+ o !== "reactive-md-state/v1" && i("local.state.format", `Unsupported state format ${F(o)}; expected "${C}".`);
358
+ let s = a.syntax;
359
+ s !== "local-draft-2" && i("local.state.syntax", `Unsupported state syntax ${F(s)}; expected "${r}".`);
360
+ let c = a.sourceDigest;
361
+ typeof c == "string" && ye.test(c) || i("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
362
+ let l = {}, u = a.parameters;
363
+ if (!M(u)) i("local.state.parameters", "parameters must be a JSON object of public binding values.");
364
+ else for (let e of Object.keys(u).sort()) {
365
365
  if (e === "__proto__") {
366
- r("local.state.parameter.prototype", "Parameter names cannot be \"__proto__\".");
366
+ i("local.state.parameter.prototype", "Parameter names cannot be \"__proto__\".");
367
367
  continue;
368
368
  }
369
369
  if (e.startsWith("@")) {
370
- r("local.state.parameter.internal", `Internal parameter "${e}" cannot be persisted.`);
370
+ i("local.state.parameter.internal", `Internal parameter "${e}" cannot be persisted.`);
371
371
  continue;
372
372
  }
373
- let t = j(l[e]);
374
- t.ok ? c[e] = t.value : r("local.state.parameter.value", `Parameter "${e}" ${t.message}`);
373
+ let t = j(u[e]);
374
+ t.ok ? l[e] = t.value : i("local.state.parameter.value", `Parameter "${e}" ${t.message}`);
375
375
  }
376
- let u;
377
- if (Object.hasOwn(i, "generator")) {
378
- let e = i.generator;
379
- if (!M(e)) r("local.state.generator", "generator must be an object with string name and version.");
376
+ let d;
377
+ if (Object.hasOwn(a, "generator")) {
378
+ let e = a.generator;
379
+ if (!M(e)) i("local.state.generator", "generator must be an object with string name and version.");
380
380
  else {
381
- for (let t of Object.keys(e)) Ce.has(t) || r("local.state.generator", `generator has unknown key "${t}".`);
382
- typeof e.name != "string" || typeof e.version != "string" ? r("local.state.generator", "generator must have string name and version.") : !k(e.name) || !k(e.version) ? r("local.state.utf", "generator contains malformed Unicode.") : u = Object.freeze({
381
+ for (let t of Object.keys(e)) Ce.has(t) || i("local.state.generator", `generator has unknown key "${t}".`);
382
+ typeof e.name != "string" || typeof e.version != "string" ? i("local.state.generator", "generator must have string name and version.") : !k(e.name) || !k(e.version) ? i("local.state.utf", "generator contains malformed Unicode.") : d = Object.freeze({
383
383
  name: e.name,
384
384
  version: e.version
385
385
  });
@@ -389,15 +389,15 @@ function Ee(e, t) {
389
389
  ok: !1,
390
390
  diagnostics: n
391
391
  };
392
- let d = {
392
+ let f = {
393
393
  format: C,
394
- syntax: h,
395
- sourceDigest: s,
396
- parameters: c
394
+ syntax: r,
395
+ sourceDigest: c,
396
+ parameters: l
397
397
  };
398
- return u && (d.generator = u), {
398
+ return d && (f.generator = d), {
399
399
  ok: !0,
400
- file: N(d)
400
+ file: N(f)
401
401
  };
402
402
  }
403
403
  function R(e, t) {
@@ -478,31 +478,31 @@ function Oe(e, t) {
478
478
  }
479
479
  return Object.freeze(r);
480
480
  }
481
- function V(e, t, n, r) {
482
- let i = R(t, r);
483
- if (!i.ok) return i;
481
+ function V(e, t, n, i) {
482
+ let a = R(t, i);
483
+ if (!a.ok) return a;
484
484
  if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
485
485
  ok: !1,
486
486
  diagnostics: [E("local.state.document", "resolveLocalState requires a compiled local document.")]
487
487
  };
488
- if (i.file.syntax !== "local-draft-2") return {
488
+ if (a.file.syntax !== "local-draft-2") return {
489
489
  ok: !1,
490
- diagnostics: [E("local.state.syntax", `This state file uses syntax "${i.file.syntax}", but this build accepts "${h}".`)]
490
+ diagnostics: [E("local.state.syntax", `This state file uses syntax "${a.file.syntax}", but this build accepts "${r}".`)]
491
491
  };
492
- if (i.file.sourceDigest !== A(e.source)) return {
492
+ if (a.file.sourceDigest !== A(e.source)) return {
493
493
  ok: !1,
494
494
  diagnostics: [E("local.state.source", "This state file was created for a different document (source digest mismatch).")]
495
495
  };
496
- let a = z(e), o = new Set(a.plans.map((e) => e.key)), s = [];
497
- for (let e of Object.keys(i.file.parameters)) o.has(e) || D(s, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
498
- for (let e of o) Object.hasOwn(i.file.parameters, e) || D(s, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
499
- if (s.length) return {
496
+ let o = z(e), s = new Set(o.plans.map((e) => e.key)), c = [];
497
+ for (let e of Object.keys(a.file.parameters)) s.has(e) || D(c, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
498
+ for (let e of s) Object.hasOwn(a.file.parameters, e) || D(c, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
499
+ if (c.length) return {
500
500
  ok: !1,
501
- diagnostics: s
501
+ diagnostics: c
502
502
  };
503
- let c;
503
+ let l;
504
504
  try {
505
- c = ue(e);
505
+ l = ue(e);
506
506
  } catch (e) {
507
507
  return {
508
508
  ok: !1,
@@ -511,25 +511,25 @@ function V(e, t, n, r) {
511
511
  }
512
512
  try {
513
513
  if (n) {
514
- let e = B(c, a, n);
514
+ let e = B(l, o, n);
515
515
  if (e.length) return {
516
516
  ok: !1,
517
517
  diagnostics: e
518
518
  };
519
519
  }
520
- let e = B(c, a, i.file.parameters);
520
+ let e = B(l, o, a.file.parameters);
521
521
  if (e.length) return {
522
522
  ok: !1,
523
523
  diagnostics: e
524
524
  };
525
- let t = [...o].sort();
525
+ let t = [...s].sort();
526
526
  return {
527
527
  ok: !0,
528
- file: i.file,
529
- state: Oe(c, t)
528
+ file: a.file,
529
+ state: Oe(l, t)
530
530
  };
531
531
  } finally {
532
- c.dispose();
532
+ l.dispose();
533
533
  }
534
534
  }
535
535
  function H(e, t, n) {
@@ -695,7 +695,7 @@ function Be(e) {
695
695
  if (e !== void 0) try {
696
696
  if (typeof e != "object" || !e || Array.isArray(e)) return e;
697
697
  let t = e, n = {};
698
- for (let e of f) Object.hasOwn(t, e) && (n[e] = t[e]);
698
+ for (let e of p) Object.hasOwn(t, e) && (n[e] = t[e]);
699
699
  if (Object.hasOwn(t, "markdownBreaks") && (n.markdownBreaks = t.markdownBreaks), Object.hasOwn(t, "limits")) {
700
700
  let e = t.limits;
701
701
  n.limits = e && typeof e == "object" && !Array.isArray(e) && Object.hasOwn(e, "maxSyntaxNodes") ? { maxSyntaxNodes: e.maxSyntaxNodes } : e;
@@ -970,49 +970,49 @@ function rt(e) {
970
970
  limits: { maxSyntaxNodes: t.maxSyntaxNodes }
971
971
  } : n;
972
972
  }
973
- function it(e) {
974
- let t = [];
975
- for (let n of e.childNodes) {
976
- if (a.isElementNode(n)) {
977
- let e = n.tagName.toLowerCase();
978
- if (e === "script") continue;
979
- it(e === "template" ? a.getTemplateContent(n) : n);
973
+ function it(t) {
974
+ let n = [];
975
+ for (let r of t.childNodes) {
976
+ if (e.isElementNode(r)) {
977
+ let t = r.tagName.toLowerCase();
978
+ if (t === "script") continue;
979
+ it(t === "template" ? e.getTemplateContent(r) : r);
980
980
  }
981
- t.push(n);
981
+ n.push(r);
982
982
  }
983
- e.childNodes = t;
983
+ t.childNodes = n;
984
984
  }
985
- function $(e, t, n) {
986
- let r = !1;
987
- for (let i of e.childNodes) if (a.isElementNode(i)) {
988
- if (i.tagName.toLowerCase() === "iframe") {
989
- let e = i.attrs.filter((e) => {
985
+ function $(t, n, r) {
986
+ let i = !1;
987
+ for (let a of t.childNodes) if (e.isElementNode(a)) {
988
+ if (a.tagName.toLowerCase() === "iframe") {
989
+ let e = a.attrs.filter((e) => {
990
990
  let t = e.name.toLowerCase();
991
991
  return t !== "srcdoc" && t !== "sandbox";
992
992
  });
993
993
  e.push({
994
994
  name: "srcdoc",
995
- value: t
995
+ value: n
996
996
  }), e.push({
997
997
  name: "sandbox",
998
- value: n
999
- }), i.attrs = e, r = !0;
998
+ value: r
999
+ }), a.attrs = e, i = !0;
1000
1000
  }
1001
- $(i, t, n) && (r = !0);
1001
+ $(a, n, r) && (i = !0);
1002
1002
  }
1003
- return r;
1003
+ return i;
1004
1004
  }
1005
1005
  function at(e) {
1006
1006
  let t = "";
1007
- for (let n of e.childNodes) t += m(n, { scriptingEnabled: !1 });
1007
+ for (let n of e.childNodes) t += a(n, { scriptingEnabled: !1 });
1008
1008
  return t;
1009
1009
  }
1010
- function ot(e, n, r) {
1010
+ function ot(e, t, n) {
1011
1011
  try {
1012
- let i = t(e, { scriptingEnabled: !1 });
1013
- if (it(i), $(i, n, r)) return at(i);
1012
+ let r = i(e, { scriptingEnabled: !1 });
1013
+ if (it(r), $(r, t, n)) return at(r);
1014
1014
  } catch {}
1015
- return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${X(r, !0)}" style="display:block;width:100%;min-height:60vh;border:0;background:#fff" srcdoc="${X(n, !0)}"></iframe></div>`;
1015
+ return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${X(n, !0)}" style="display:block;width:100%;min-height:60vh;border:0;background:#fff" srcdoc="${X(t, !0)}"></iframe></div>`;
1016
1016
  }
1017
1017
  function st(e, t) {
1018
1018
  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'";
@@ -1114,4 +1114,4 @@ ${y}
1114
1114
  </html>
1115
1115
  `;
1116
1116
  }
1117
- export { s as DEFAULT_LOCAL_THEME, Re as LOCAL_COMPILE_DELAY_MS, d as LOCAL_DIAGNOSTIC_CODES, C as LOCAL_STATE_FORMAT, h as LOCAL_SYNTAX_VERSION, ie as LOCAL_THEME_PROTOCOL, Ue as LocalCompileScheduler, i as LocalExpressionError, Ke as SHAREABLE_HTML_FORMAT, le as analyzeLocalSource, U as applyLocalState, Le as applyLocalStateRetention, _e as checkLocalUpgrade, r as compileExpression, Y as compileFailureDiagnostic, o as compileLatex, x as compileLocal, se as completeLocalSource, e as countLocalCodePoints, ue as createLocalRuntime, L as createLocalStateFile, dt as createShareableHtml, ke as exportLocalState, v as formatLocalDiagnostic, ce as formatLocalSource, Ae as importLocalState, he as inspectLocalSourceVersion, ne as isLocalDiagnosticCode, ae as isLocalThemeName, b as localCompileOptionsKey, c as localDiagnosticTemplate, y as localDiagnosticTemplateKeys, A as localSourceDigest, ve as migrateLocalSource, R as parseLocalState, Fe as planLocalStateRetention, oe as renameLocalBinding, H as resolveLocalState, lt as resolveLocalStateBaseline, l as resolveLocalTheme, n as samplePlot, nt as serializeForScript, je as serializeLocalState, Ge as startLocalCompileWorker };
1117
+ export { c as DEFAULT_LOCAL_THEME, Re as LOCAL_COMPILE_DELAY_MS, ne as LOCAL_DIAGNOSTIC_CODES, C as LOCAL_STATE_FORMAT, r as LOCAL_SYNTAX_VERSION, ie as LOCAL_THEME_PROTOCOL, Ue as LocalCompileScheduler, o as LocalExpressionError, Ke as SHAREABLE_HTML_FORMAT, le as analyzeLocalSource, U as applyLocalState, Le as applyLocalStateRetention, _e as checkLocalUpgrade, s as compileExpression, Y as compileFailureDiagnostic, n as compileLatex, x as compileLocal, se as completeLocalSource, v as countLocalCodePoints, ue as createLocalRuntime, L as createLocalStateFile, dt as createShareableHtml, ke as exportLocalState, l as formatLocalDiagnostic, ce as formatLocalSource, Ae as importLocalState, he as inspectLocalSourceVersion, y as isLocalDiagnosticCode, ae as isLocalThemeName, b as localCompileOptionsKey, d as localDiagnosticTemplate, g as localDiagnosticTemplateKeys, A as localSourceDigest, ve as migrateLocalSource, R as parseLocalState, Fe as planLocalStateRetention, oe as renameLocalBinding, H as resolveLocalState, lt as resolveLocalStateBaseline, u as resolveLocalTheme, t as samplePlot, nt as serializeForScript, je as serializeLocalState, Ge as startLocalCompileWorker };